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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | docs/bin/simplify.py | python | processInsert | (parentNode, insertNode) | Check for pythoncode | Check for pythoncode | [
"Check",
"for",
"pythoncode"
] | def processInsert(parentNode, insertNode):
"""
Check for pythoncode
"""
if getAttr(insertNode, "section") == "python":
code = getAttr(insertNode, "code")
node = libxml2.newNode("pythoncode")
node.addChild(libxml2.newText(code))
parentNode.addChild(node) | [
"def",
"processInsert",
"(",
"parentNode",
",",
"insertNode",
")",
":",
"if",
"getAttr",
"(",
"insertNode",
",",
"\"section\"",
")",
"==",
"\"python\"",
":",
"code",
"=",
"getAttr",
"(",
"insertNode",
",",
"\"code\"",
")",
"node",
"=",
"libxml2",
".",
"new... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/docs/bin/simplify.py#L129-L137 | ||
OGRECave/ogre-next | 287307980e6de8910f04f3cc0994451b075071fd | Tools/Wings3DExporter/pgon.py | python | Triangulator.find_and_clip_earx | (self) | find clip one ear | find clip one ear | [
"find",
"clip",
"one",
"ear"
] | def find_and_clip_earx(self):
"find clip one ear"
print self.indices
for vert in self.indices:
# check if point is convex
if self.is_convex(vert):
self.dump("%s is convex" % repr(vert))
# check if this vertex is an ear
if self.is_ear(vert):
self.dump("%s is an ear" % repr(vert))
# ... | [
"def",
"find_and_clip_earx",
"(",
"self",
")",
":",
"print",
"self",
".",
"indices",
"for",
"vert",
"in",
"self",
".",
"indices",
":",
"# check if point is convex",
"if",
"self",
".",
"is_convex",
"(",
"vert",
")",
":",
"self",
".",
"dump",
"(",
"\"%s is c... | https://github.com/OGRECave/ogre-next/blob/287307980e6de8910f04f3cc0994451b075071fd/Tools/Wings3DExporter/pgon.py#L164-L183 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/client/timeline.py | python | _ChromeTraceFormatter._create_event | (self, ph, category, name, pid, tid, timestamp) | return event | Creates a new Chrome Trace event.
For details of the file format, see:
https://github.com/catapult-project/catapult/blob/master/tracing/README.md
Args:
ph: The type of event - usually a single character.
category: The event category as a string.
name: The event name as a string.
... | Creates a new Chrome Trace event. | [
"Creates",
"a",
"new",
"Chrome",
"Trace",
"event",
"."
] | def _create_event(self, ph, category, name, pid, tid, timestamp):
"""Creates a new Chrome Trace event.
For details of the file format, see:
https://github.com/catapult-project/catapult/blob/master/tracing/README.md
Args:
ph: The type of event - usually a single character.
category: The ev... | [
"def",
"_create_event",
"(",
"self",
",",
"ph",
",",
"category",
",",
"name",
",",
"pid",
",",
"tid",
",",
"timestamp",
")",
":",
"event",
"=",
"{",
"}",
"event",
"[",
"'ph'",
"]",
"=",
"ph",
"event",
"[",
"'cat'",
"]",
"=",
"category",
"event",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/client/timeline.py#L64-L88 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/saved_model/loader_impl.py | python | SavedModelLoader.get_meta_graph_def_from_tags | (self, tags) | return meta_graph_def_to_load | Return MetaGraphDef with the exact specified tags.
Args:
tags: A list or set of string tags that identify the MetaGraphDef.
Returns:
MetaGraphDef with the same tags.
Raises:
RuntimeError: if no metagraphs were found with the associated tags. | Return MetaGraphDef with the exact specified tags. | [
"Return",
"MetaGraphDef",
"with",
"the",
"exact",
"specified",
"tags",
"."
] | def get_meta_graph_def_from_tags(self, tags):
"""Return MetaGraphDef with the exact specified tags.
Args:
tags: A list or set of string tags that identify the MetaGraphDef.
Returns:
MetaGraphDef with the same tags.
Raises:
RuntimeError: if no metagraphs were found with the associate... | [
"def",
"get_meta_graph_def_from_tags",
"(",
"self",
",",
"tags",
")",
":",
"found_match",
"=",
"False",
"available_tags",
"=",
"[",
"]",
"for",
"meta_graph_def",
"in",
"self",
".",
"_saved_model",
".",
"meta_graphs",
":",
"available_tags",
".",
"append",
"(",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/saved_model/loader_impl.py#L370-L397 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/training/moving_averages.py | python | assign_moving_average | (variable, value, decay, name=None) | Compute the moving average of a variable.
The moving average of 'variable' updated with 'value' is:
variable * decay + value * (1 - decay)
The returned Operation sets 'variable' to the newly computed moving average.
The new value of 'variable' can be set with the 'AssignSub' op as:
variable -= (1 - de... | Compute the moving average of a variable. | [
"Compute",
"the",
"moving",
"average",
"of",
"a",
"variable",
"."
] | def assign_moving_average(variable, value, decay, name=None):
"""Compute the moving average of a variable.
The moving average of 'variable' updated with 'value' is:
variable * decay + value * (1 - decay)
The returned Operation sets 'variable' to the newly computed moving average.
The new value of 'variab... | [
"def",
"assign_moving_average",
"(",
"variable",
",",
"value",
",",
"decay",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"variable",
",",
"value",
",",
"decay",
"]",
",",
"name",
",",
"\"AssignMovingAvg\"",
")",
"as",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/training/moving_averages.py#L32-L60 | ||
Tencent/mars | 54969ba56b402a622db123e780a4f760b38c5c36 | mars/lint/cpplint.py | python | CheckForNonStandardConstructs | (filename, clean_lines, linenum,
nesting_state, error) | r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
Complain about several constructs which gcc-2 accepts, but which are
not standard C++. Warning about these in lint is one way to ease the
transition to new compilers.
- put storage class first (e.g. "static const" instead of "const stat... | r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2. | [
"r",
"Logs",
"an",
"error",
"if",
"we",
"see",
"certain",
"non",
"-",
"ANSI",
"constructs",
"ignored",
"by",
"gcc",
"-",
"2",
"."
] | def CheckForNonStandardConstructs(filename, clean_lines, linenum,
nesting_state, error):
r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
Complain about several constructs which gcc-2 accepts, but which are
not standard C++. Warning about these in lint ... | [
"def",
"CheckForNonStandardConstructs",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"# Remove comments from the line, but leave in strings for now.",
"line",
"=",
"clean_lines",
".",
"lines",
"[",
"linenum",
"]",
"i... | https://github.com/Tencent/mars/blob/54969ba56b402a622db123e780a4f760b38c5c36/mars/lint/cpplint.py#L2578-L2739 | ||
luliyucoordinate/Leetcode | 96afcdc54807d1d184e881a075d1dbf3371e31fb | src/0349-Intersection-of-Two-Arrays/0349.py | python | Solution.intersection | (self, nums1, nums2) | return list(result) | :type nums1: List[int]
:type nums2: List[int]
:rtype: List[int] | :type nums1: List[int]
:type nums2: List[int]
:rtype: List[int] | [
":",
"type",
"nums1",
":",
"List",
"[",
"int",
"]",
":",
"type",
"nums2",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"List",
"[",
"int",
"]"
] | def intersection(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: List[int]
"""
result = set([i for i in nums1 if i in nums2])
return list(result) | [
"def",
"intersection",
"(",
"self",
",",
"nums1",
",",
"nums2",
")",
":",
"result",
"=",
"set",
"(",
"[",
"i",
"for",
"i",
"in",
"nums1",
"if",
"i",
"in",
"nums2",
"]",
")",
"return",
"list",
"(",
"result",
")"
] | https://github.com/luliyucoordinate/Leetcode/blob/96afcdc54807d1d184e881a075d1dbf3371e31fb/src/0349-Intersection-of-Two-Arrays/0349.py#L2-L9 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/android/loading/controller.py | python | RemoteChromeController.ResetBrowserState | (self) | Override resetting Chrome local state. | Override resetting Chrome local state. | [
"Override",
"resetting",
"Chrome",
"local",
"state",
"."
] | def ResetBrowserState(self):
"""Override resetting Chrome local state."""
logging.info('Resetting Chrome local state')
package = OPTIONS.ChromePackage().package
# Remove the Chrome Profile and the various disk caches. Other parts
# theoretically should not affect loading performance. Also remove the... | [
"def",
"ResetBrowserState",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Resetting Chrome local state'",
")",
"package",
"=",
"OPTIONS",
".",
"ChromePackage",
"(",
")",
".",
"package",
"# Remove the Chrome Profile and the various disk caches. Other parts",
"# the... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/android/loading/controller.py#L406-L416 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/browser.py | python | transform_children | (child_dict, modname=None) | return obs | Transform a child dictionary to an ordered sequence of objects.
The dictionary maps names to pyclbr information objects.
Filter out imported objects.
Augment class names with bases.
The insertion order of the dictionary is assumed to have been in line
number order, so sorting is not necessary.
... | Transform a child dictionary to an ordered sequence of objects. | [
"Transform",
"a",
"child",
"dictionary",
"to",
"an",
"ordered",
"sequence",
"of",
"objects",
"."
] | def transform_children(child_dict, modname=None):
"""Transform a child dictionary to an ordered sequence of objects.
The dictionary maps names to pyclbr information objects.
Filter out imported objects.
Augment class names with bases.
The insertion order of the dictionary is assumed to have been in... | [
"def",
"transform_children",
"(",
"child_dict",
",",
"modname",
"=",
"None",
")",
":",
"obs",
"=",
"[",
"]",
"# Use list since values should already be sorted.",
"for",
"key",
",",
"obj",
"in",
"child_dict",
".",
"items",
"(",
")",
":",
"if",
"modname",
"is",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/browser.py#L26-L55 | |
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py | python | xmlNode.xincludeProcessTreeFlags | (self, flags) | return ret | Implement the XInclude substitution for the given subtree | Implement the XInclude substitution for the given subtree | [
"Implement",
"the",
"XInclude",
"substitution",
"for",
"the",
"given",
"subtree"
] | def xincludeProcessTreeFlags(self, flags):
"""Implement the XInclude substitution for the given subtree """
ret = libxml2mod.xmlXIncludeProcessTreeFlags(self._o, flags)
return ret | [
"def",
"xincludeProcessTreeFlags",
"(",
"self",
",",
"flags",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlXIncludeProcessTreeFlags",
"(",
"self",
".",
"_o",
",",
"flags",
")",
"return",
"ret"
] | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py#L3637-L3640 | |
facebookresearch/ELF | 1f790173095cd910976d9f651b80beb872ec5d12 | rts/engine/.ropeproject/config.py | python | project_opened | (project) | This function is called after opening the project | This function is called after opening the project | [
"This",
"function",
"is",
"called",
"after",
"opening",
"the",
"project"
] | def project_opened(project):
"""This function is called after opening the project""" | [
"def",
"project_opened",
"(",
"project",
")",
":"
] | https://github.com/facebookresearch/ELF/blob/1f790173095cd910976d9f651b80beb872ec5d12/rts/engine/.ropeproject/config.py#L101-L102 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/site_compare/operators/equals_with_mask.py | python | Compare | (file1, file2, **kwargs) | Compares two images to see if they're identical subject to a mask.
An optional directory containing masks is supplied. If a mask exists
which matches file1's name, areas under the mask where it's black
are ignored.
Args:
file1: path to first image to compare
file2: path to second image to compare
... | Compares two images to see if they're identical subject to a mask. | [
"Compares",
"two",
"images",
"to",
"see",
"if",
"they",
"re",
"identical",
"subject",
"to",
"a",
"mask",
"."
] | def Compare(file1, file2, **kwargs):
"""Compares two images to see if they're identical subject to a mask.
An optional directory containing masks is supplied. If a mask exists
which matches file1's name, areas under the mask where it's black
are ignored.
Args:
file1: path to first image to compare
f... | [
"def",
"Compare",
"(",
"file1",
",",
"file2",
",",
"*",
"*",
"kwargs",
")",
":",
"maskdir",
"=",
"None",
"if",
"\"maskdir\"",
"in",
"kwargs",
":",
"maskdir",
"=",
"kwargs",
"[",
"\"maskdir\"",
"]",
"im1",
"=",
"Image",
".",
"open",
"(",
"file1",
")",... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/site_compare/operators/equals_with_mask.py#L13-L57 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/sql.py | python | _wrap_result | (data, columns, index_col=None, coerce_float=True, parse_dates=None) | return frame | Wrap result set of query in a DataFrame. | Wrap result set of query in a DataFrame. | [
"Wrap",
"result",
"set",
"of",
"query",
"in",
"a",
"DataFrame",
"."
] | def _wrap_result(data, columns, index_col=None, coerce_float=True, parse_dates=None):
"""Wrap result set of query in a DataFrame."""
frame = DataFrame.from_records(data, columns=columns, coerce_float=coerce_float)
frame = _parse_date_columns(frame, parse_dates)
if index_col is not None:
frame... | [
"def",
"_wrap_result",
"(",
"data",
",",
"columns",
",",
"index_col",
"=",
"None",
",",
"coerce_float",
"=",
"True",
",",
"parse_dates",
"=",
"None",
")",
":",
"frame",
"=",
"DataFrame",
".",
"from_records",
"(",
"data",
",",
"columns",
"=",
"columns",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/sql.py#L121-L131 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/input_lib.py | python | MultiStepContext.__init__ | (self) | Initialize an output context.
Returns:
A context object. | Initialize an output context. | [
"Initialize",
"an",
"output",
"context",
"."
] | def __init__(self):
"""Initialize an output context.
Returns:
A context object.
"""
self._last_step_outputs = {}
self._last_step_outputs_reduce_ops = {}
self._non_tensor_outputs = {} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_last_step_outputs",
"=",
"{",
"}",
"self",
".",
"_last_step_outputs_reduce_ops",
"=",
"{",
"}",
"self",
".",
"_non_tensor_outputs",
"=",
"{",
"}"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/input_lib.py#L1927-L1935 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/profiler/parser/memory_usage_parser.py | python | MemoryUsageParser.write_memory_files | (self) | Write memory files. | Write memory files. | [
"Write",
"memory",
"files",
"."
] | def write_memory_files(self):
"""Write memory files."""
logger.info('Start recording memory data into files...')
# write memory summary to json file
summary_filename = self._summary_filename.format(self._device_id)
self._write_memory_files(summary_filename, self._mem_summary)
... | [
"def",
"write_memory_files",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"'Start recording memory data into files...'",
")",
"# write memory summary to json file",
"summary_filename",
"=",
"self",
".",
"_summary_filename",
".",
"format",
"(",
"self",
".",
"_devic... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/profiler/parser/memory_usage_parser.py#L145-L155 | ||
JarveeLee/SynthText_Chinese_version | 4b2cbc7d14741f21d0bb17966a339ab3574b09a8 | poisson_reconstruct.py | python | get_laplacian | (Dx,Dy) | return Dxx+Dyy | return the laplacian | return the laplacian | [
"return",
"the",
"laplacian"
] | def get_laplacian(Dx,Dy):
"""
return the laplacian
"""
[H,W] = Dx.shape
Dxx, Dyy = np.zeros((H,W)), np.zeros((H,W))
j,k = np.atleast_2d(np.arange(0,H-1)).T, np.arange(0,W-1)
Dxx[j,k+1] = Dx[j,k+1] - Dx[j,k]
Dyy[j+1,k] = Dy[j+1,k] - Dy[j,k]
return Dxx+Dyy | [
"def",
"get_laplacian",
"(",
"Dx",
",",
"Dy",
")",
":",
"[",
"H",
",",
"W",
"]",
"=",
"Dx",
".",
"shape",
"Dxx",
",",
"Dyy",
"=",
"np",
".",
"zeros",
"(",
"(",
"H",
",",
"W",
")",
")",
",",
"np",
".",
"zeros",
"(",
"(",
"H",
",",
"W",
"... | https://github.com/JarveeLee/SynthText_Chinese_version/blob/4b2cbc7d14741f21d0bb17966a339ab3574b09a8/poisson_reconstruct.py#L44-L53 | |
esphome/esphome | 40e06c9819f17409615d4f4eec5cfe4dc9a3776d | esphome/config_validation.py | python | subscribe_topic | (value) | return value | Validate that we can subscribe using this MQTT topic. | Validate that we can subscribe using this MQTT topic. | [
"Validate",
"that",
"we",
"can",
"subscribe",
"using",
"this",
"MQTT",
"topic",
"."
] | def subscribe_topic(value):
"""Validate that we can subscribe using this MQTT topic."""
value = _valid_topic(value)
for i in (i for i, c in enumerate(value) if c == "+"):
if (i > 0 and value[i - 1] != "/") or (
i < len(value) - 1 and value[i + 1] != "/"
):
raise Inval... | [
"def",
"subscribe_topic",
"(",
"value",
")",
":",
"value",
"=",
"_valid_topic",
"(",
"value",
")",
"for",
"i",
"in",
"(",
"i",
"for",
"i",
",",
"c",
"in",
"enumerate",
"(",
"value",
")",
"if",
"c",
"==",
"\"+\"",
")",
":",
"if",
"(",
"i",
">",
... | https://github.com/esphome/esphome/blob/40e06c9819f17409615d4f4eec5cfe4dc9a3776d/esphome/config_validation.py#L991-L1015 | |
ispc/ispc | 0a7ee59b6ec50e54d545eb2a31056e54c4891d51 | utils/lit/lit/util.py | python | listdir_files | (dirname, suffixes=None, exclude_filenames=None) | Yields files in a directory.
Filenames that are not excluded by rules below are yielded one at a time, as
basenames (i.e., without dirname).
Files starting with '.' are always skipped.
If 'suffixes' is not None, then only filenames ending with one of its
members will be yielded. These can be exte... | Yields files in a directory. | [
"Yields",
"files",
"in",
"a",
"directory",
"."
] | def listdir_files(dirname, suffixes=None, exclude_filenames=None):
"""Yields files in a directory.
Filenames that are not excluded by rules below are yielded one at a time, as
basenames (i.e., without dirname).
Files starting with '.' are always skipped.
If 'suffixes' is not None, then only filen... | [
"def",
"listdir_files",
"(",
"dirname",
",",
"suffixes",
"=",
"None",
",",
"exclude_filenames",
"=",
"None",
")",
":",
"if",
"exclude_filenames",
"is",
"None",
":",
"exclude_filenames",
"=",
"set",
"(",
")",
"if",
"suffixes",
"is",
"None",
":",
"suffixes",
... | https://github.com/ispc/ispc/blob/0a7ee59b6ec50e54d545eb2a31056e54c4891d51/utils/lit/lit/util.py#L148-L186 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/linalg_grad.py | python | _EigGrad | (op, grad_e, grad_v) | Gradient for Eig.
Based on eq. 4.77 from paper by
Christoph Boeddeker et al.
https://arxiv.org/abs/1701.00392
See also
"Computation of eigenvalue and eigenvector derivatives
for a general complex-valued eigensystem" by Nico van der Aa.
As for now only distinct eigenvalue case is considered. | Gradient for Eig. | [
"Gradient",
"for",
"Eig",
"."
] | def _EigGrad(op, grad_e, grad_v):
"""Gradient for Eig.
Based on eq. 4.77 from paper by
Christoph Boeddeker et al.
https://arxiv.org/abs/1701.00392
See also
"Computation of eigenvalue and eigenvector derivatives
for a general complex-valued eigensystem" by Nico van der Aa.
As for now only distinct eigen... | [
"def",
"_EigGrad",
"(",
"op",
",",
"grad_e",
",",
"grad_v",
")",
":",
"e",
"=",
"op",
".",
"outputs",
"[",
"0",
"]",
"compute_v",
"=",
"op",
".",
"get_attr",
"(",
"\"compute_v\"",
")",
"# a = op.inputs[0], which satisfies",
"# a[...,:,:] * v[...,:,i] = e[...,i] ... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/linalg_grad.py#L717-L767 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py | python | masked_inside | (x, v1, v2, copy=1) | return array(d, mask = m, copy=copy) | x with mask of all values of x that are inside [v1,v2]
v1 and v2 can be given in either order. | x with mask of all values of x that are inside [v1,v2]
v1 and v2 can be given in either order. | [
"x",
"with",
"mask",
"of",
"all",
"values",
"of",
"x",
"that",
"are",
"inside",
"[",
"v1",
"v2",
"]",
"v1",
"and",
"v2",
"can",
"be",
"given",
"in",
"either",
"order",
"."
] | def masked_inside(x, v1, v2, copy=1):
"""x with mask of all values of x that are inside [v1,v2]
v1 and v2 can be given in either order.
"""
if v2 < v1:
t = v2
v2 = v1
v1 = t
d = filled(x, 0)
c = umath.logical_and(umath.less_equal(d, v2), umath.greater_equal(d, v1))
... | [
"def",
"masked_inside",
"(",
"x",
",",
"v1",
",",
"v2",
",",
"copy",
"=",
"1",
")",
":",
"if",
"v2",
"<",
"v1",
":",
"t",
"=",
"v2",
"v2",
"=",
"v1",
"v1",
"=",
"t",
"d",
"=",
"filled",
"(",
"x",
",",
"0",
")",
"c",
"=",
"umath",
".",
"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py#L1811-L1822 | |
OpenChemistry/tomviz | 0a903679318f191cb7dd3eb5ff5bc3a7d3320d9a | tomviz/python/tomviz/io/ser.py | python | read_emi | (filename) | return _emi | Read the meta data from an emi file.
Parameters
----------
filename: str or pathlib.Path
Path to the emi file.
Returns
-------
: dict
Dictionary of experimental metadata stored in the EMI file. | Read the meta data from an emi file. | [
"Read",
"the",
"meta",
"data",
"from",
"an",
"emi",
"file",
"."
] | def read_emi(filename):
"""Read the meta data from an emi file.
Parameters
----------
filename: str or pathlib.Path
Path to the emi file.
Returns
-------
: dict
Dictionary of experimental metadata stored in the EMI file.
"""
# check filename type
... | [
"def",
"read_emi",
"(",
"filename",
")",
":",
"# check filename type",
"if",
"isinstance",
"(",
"filename",
",",
"str",
")",
":",
"pass",
"elif",
"isinstance",
"(",
"filename",
",",
"Path",
")",
":",
"filename",
"=",
"str",
"(",
"filename",
")",
"else",
... | https://github.com/OpenChemistry/tomviz/blob/0a903679318f191cb7dd3eb5ff5bc3a7d3320d9a/tomviz/python/tomviz/io/ser.py#L585-L685 | |
abforce/xposed_art_n | ec3fbe417d74d4664cec053d91dd4e3881176374 | tools/cpplint.py | python | CheckSpacing | (filename, clean_lines, linenum, nesting_state, error) | Checks for the correctness of various spacing issues in the code.
Things we check for: spaces around operators, spaces after
if/for/while/switch, no spaces around parens in function calls, two
spaces between code and comment, don't start a block with a blank
line, don't end a function with a blank line, don't ... | Checks for the correctness of various spacing issues in the code. | [
"Checks",
"for",
"the",
"correctness",
"of",
"various",
"spacing",
"issues",
"in",
"the",
"code",
"."
] | def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
"""Checks for the correctness of various spacing issues in the code.
Things we check for: spaces around operators, spaces after
if/for/while/switch, no spaces around parens in function calls, two
spaces between code and comment, don't star... | [
"def",
"CheckSpacing",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"raw",
"=",
"clean_lines",
".",
"raw_lines",
"line",
"=",
"raw",
"[",
"linenum",
"]",
"# Before nixing comments, check if the line is blank for ... | https://github.com/abforce/xposed_art_n/blob/ec3fbe417d74d4664cec053d91dd4e3881176374/tools/cpplint.py#L2235-L2522 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/autograph/operators/data_structures.py | python | _py_list_stack | (list_, opts) | return opts.original_call(list_) | Overload of list_stack that executes a Python list append. | Overload of list_stack that executes a Python list append. | [
"Overload",
"of",
"list_stack",
"that",
"executes",
"a",
"Python",
"list",
"append",
"."
] | def _py_list_stack(list_, opts):
"""Overload of list_stack that executes a Python list append."""
# Revert to the original call.
return opts.original_call(list_) | [
"def",
"_py_list_stack",
"(",
"list_",
",",
"opts",
")",
":",
"# Revert to the original call.",
"return",
"opts",
".",
"original_call",
"(",
"list_",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/autograph/operators/data_structures.py#L344-L347 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/fastparquet/util.py | python | check_column_names | (columns, *args) | Ensure that parameters listing column names have corresponding columns | Ensure that parameters listing column names have corresponding columns | [
"Ensure",
"that",
"parameters",
"listing",
"column",
"names",
"have",
"corresponding",
"columns"
] | def check_column_names(columns, *args):
"""Ensure that parameters listing column names have corresponding columns"""
for arg in args:
if isinstance(arg, (tuple, list)):
missing = set(arg) - set(columns)
if missing:
raise ValueError("Following columns were requeste... | [
"def",
"check_column_names",
"(",
"columns",
",",
"*",
"args",
")",
":",
"for",
"arg",
"in",
"args",
":",
"if",
"isinstance",
"(",
"arg",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"missing",
"=",
"set",
"(",
"arg",
")",
"-",
"set",
"(",
"col... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/fastparquet/util.py#L84-L94 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/__init__.py | python | start_kernel | (argv=None, **kwargs) | return launch_new_instance(argv=argv, **kwargs) | Launch a normal IPython kernel instance (as opposed to embedded)
`IPython.embed_kernel()` puts a shell in a particular calling scope,
such as a function or method for debugging purposes,
which is often not desirable.
`start_kernel()` does full, regular IPython initialization,
including loa... | Launch a normal IPython kernel instance (as opposed to embedded)
`IPython.embed_kernel()` puts a shell in a particular calling scope,
such as a function or method for debugging purposes,
which is often not desirable.
`start_kernel()` does full, regular IPython initialization,
including loa... | [
"Launch",
"a",
"normal",
"IPython",
"kernel",
"instance",
"(",
"as",
"opposed",
"to",
"embedded",
")",
"IPython",
".",
"embed_kernel",
"()",
"puts",
"a",
"shell",
"in",
"a",
"particular",
"calling",
"scope",
"such",
"as",
"a",
"function",
"or",
"method",
"... | def start_kernel(argv=None, **kwargs):
"""Launch a normal IPython kernel instance (as opposed to embedded)
`IPython.embed_kernel()` puts a shell in a particular calling scope,
such as a function or method for debugging purposes,
which is often not desirable.
`start_kernel()` does full, reg... | [
"def",
"start_kernel",
"(",
"argv",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"IPython",
".",
"kernel",
".",
"zmq",
".",
"kernelapp",
"import",
"launch_new_instance",
"return",
"launch_new_instance",
"(",
"argv",
"=",
"argv",
",",
"*",
"*",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/__init__.py#L132-L156 | |
Tau-Coin/tautcoin | b40dd5ebae49ccecbbf77cc0289b747fd1764219 | contrib/devtools/security-check.py | python | check_ELF_NX | (executable) | return have_gnu_stack and not have_wx | Check that no sections are writable and executable (including the stack) | Check that no sections are writable and executable (including the stack) | [
"Check",
"that",
"no",
"sections",
"are",
"writable",
"and",
"executable",
"(",
"including",
"the",
"stack",
")"
] | def check_ELF_NX(executable):
'''
Check that no sections are writable and executable (including the stack)
'''
have_wx = False
have_gnu_stack = False
for (typ, flags) in get_ELF_program_headers(executable):
if typ == b'GNU_STACK':
have_gnu_stack = True
if b'W' in flag... | [
"def",
"check_ELF_NX",
"(",
"executable",
")",
":",
"have_wx",
"=",
"False",
"have_gnu_stack",
"=",
"False",
"for",
"(",
"typ",
",",
"flags",
")",
"in",
"get_ELF_program_headers",
"(",
"executable",
")",
":",
"if",
"typ",
"==",
"b'GNU_STACK'",
":",
"have_gnu... | https://github.com/Tau-Coin/tautcoin/blob/b40dd5ebae49ccecbbf77cc0289b747fd1764219/contrib/devtools/security-check.py#L61-L72 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBModule.GetNumSymbols | (self) | return _lldb.SBModule_GetNumSymbols(self) | GetNumSymbols(self) -> size_t | GetNumSymbols(self) -> size_t | [
"GetNumSymbols",
"(",
"self",
")",
"-",
">",
"size_t"
] | def GetNumSymbols(self):
"""GetNumSymbols(self) -> size_t"""
return _lldb.SBModule_GetNumSymbols(self) | [
"def",
"GetNumSymbols",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBModule_GetNumSymbols",
"(",
"self",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L6113-L6115 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | TextBoxAttr.GetFloatMode | (*args, **kwargs) | return _richtext.TextBoxAttr_GetFloatMode(*args, **kwargs) | GetFloatMode(self) -> int | GetFloatMode(self) -> int | [
"GetFloatMode",
"(",
"self",
")",
"-",
">",
"int"
] | def GetFloatMode(*args, **kwargs):
"""GetFloatMode(self) -> int"""
return _richtext.TextBoxAttr_GetFloatMode(*args, **kwargs) | [
"def",
"GetFloatMode",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"TextBoxAttr_GetFloatMode",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L576-L578 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/closure_linter/closure_linter/ecmametadatapass.py | python | EcmaContext.GetRoot | (self) | Get the root context that contains this context, if any. | Get the root context that contains this context, if any. | [
"Get",
"the",
"root",
"context",
"that",
"contains",
"this",
"context",
"if",
"any",
"."
] | def GetRoot(self):
"""Get the root context that contains this context, if any."""
context = self
while context:
if context.type is EcmaContext.ROOT:
return context
context = context.parent | [
"def",
"GetRoot",
"(",
"self",
")",
":",
"context",
"=",
"self",
"while",
"context",
":",
"if",
"context",
".",
"type",
"is",
"EcmaContext",
".",
"ROOT",
":",
"return",
"context",
"context",
"=",
"context",
".",
"parent"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/closure_linter/closure_linter/ecmametadatapass.py#L165-L171 | ||
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/requests/cookies.py | python | RequestsCookieJar.__getitem__ | (self, name) | return self._find_no_duplicates(name) | Dict-like __getitem__() for compatibility with client code. Throws
exception if there are more than one cookie with name. In that case,
use the more explicit get() method instead.
.. warning:: operation is O(n), not O(1). | Dict-like __getitem__() for compatibility with client code. Throws
exception if there are more than one cookie with name. In that case,
use the more explicit get() method instead. | [
"Dict",
"-",
"like",
"__getitem__",
"()",
"for",
"compatibility",
"with",
"client",
"code",
".",
"Throws",
"exception",
"if",
"there",
"are",
"more",
"than",
"one",
"cookie",
"with",
"name",
".",
"In",
"that",
"case",
"use",
"the",
"more",
"explicit",
"get... | def __getitem__(self, name):
"""Dict-like __getitem__() for compatibility with client code. Throws
exception if there are more than one cookie with name. In that case,
use the more explicit get() method instead.
.. warning:: operation is O(n), not O(1).
"""
return self._... | [
"def",
"__getitem__",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"_find_no_duplicates",
"(",
"name",
")"
] | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/requests/cookies.py#L321-L328 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/io/pytables.py | python | SparseFixed.validate_read | (self, kwargs) | return kwargs | we don't support start, stop kwds in Sparse | we don't support start, stop kwds in Sparse | [
"we",
"don",
"t",
"support",
"start",
"stop",
"kwds",
"in",
"Sparse"
] | def validate_read(self, kwargs):
"""
we don't support start, stop kwds in Sparse
"""
kwargs = super(SparseFixed, self).validate_read(kwargs)
if 'start' in kwargs or 'stop' in kwargs:
raise NotImplementedError("start and/or stop are not supported "
... | [
"def",
"validate_read",
"(",
"self",
",",
"kwargs",
")",
":",
"kwargs",
"=",
"super",
"(",
"SparseFixed",
",",
"self",
")",
".",
"validate_read",
"(",
"kwargs",
")",
"if",
"'start'",
"in",
"kwargs",
"or",
"'stop'",
"in",
"kwargs",
":",
"raise",
"NotImple... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/io/pytables.py#L2872-L2880 | |
naver/sling | 5671cd445a2caae0b4dd0332299e4cfede05062c | webkit/Tools/Scripts/webkitpy/common/system/filesystem.py | python | FileSystem.mkdtemp | (self, **kwargs) | return TemporaryDirectory(**kwargs) | Create and return a uniquely named directory.
This is like tempfile.mkdtemp, but if used in a with statement
the directory will self-delete at the end of the block (if the
directory is empty; non-empty directories raise errors). The
directory can be safely deleted inside the block as we... | Create and return a uniquely named directory. | [
"Create",
"and",
"return",
"a",
"uniquely",
"named",
"directory",
"."
] | def mkdtemp(self, **kwargs):
"""Create and return a uniquely named directory.
This is like tempfile.mkdtemp, but if used in a with statement
the directory will self-delete at the end of the block (if the
directory is empty; non-empty directories raise errors). The
directory can ... | [
"def",
"mkdtemp",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"class",
"TemporaryDirectory",
"(",
"object",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_kwargs",
"=",
"kwargs",
"self",
".",
"_directo... | https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/common/system/filesystem.py#L166-L196 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/profile.py | python | run | (statement, filename=None, sort=-1) | Run statement under profiler optionally saving results in filename
This function takes a single argument that can be passed to the
"exec" statement, and an optional file name. In all cases this
routine attempts to "exec" its first argument and gather profiling
statistics from the execution. If no file... | Run statement under profiler optionally saving results in filename | [
"Run",
"statement",
"under",
"profiler",
"optionally",
"saving",
"results",
"in",
"filename"
] | def run(statement, filename=None, sort=-1):
"""Run statement under profiler optionally saving results in filename
This function takes a single argument that can be passed to the
"exec" statement, and an optional file name. In all cases this
routine attempts to "exec" its first argument and gather prof... | [
"def",
"run",
"(",
"statement",
",",
"filename",
"=",
"None",
",",
"sort",
"=",
"-",
"1",
")",
":",
"prof",
"=",
"Profile",
"(",
")",
"try",
":",
"prof",
"=",
"prof",
".",
"run",
"(",
"statement",
")",
"except",
"SystemExit",
":",
"pass",
"if",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/profile.py#L48-L67 | ||
jackaudio/jack2 | 21b293dbc37d42446141a08922cdec0d2550c6a0 | waflib/Scripting.py | python | Dist.get_files | (self) | return files | Files to package are searched automatically by :py:func:`waflib.Node.Node.ant_glob`.
Set *files* to prevent this behaviour::
def dist(ctx):
ctx.files = ctx.path.find_node('wscript')
Files are also searched from the directory 'base_path', to change it, set::
def dist(ctx):
ctx.base_path = path
:r... | Files to package are searched automatically by :py:func:`waflib.Node.Node.ant_glob`.
Set *files* to prevent this behaviour:: | [
"Files",
"to",
"package",
"are",
"searched",
"automatically",
"by",
":",
"py",
":",
"func",
":",
"waflib",
".",
"Node",
".",
"Node",
".",
"ant_glob",
".",
"Set",
"*",
"files",
"*",
"to",
"prevent",
"this",
"behaviour",
"::"
] | def get_files(self):
"""
Files to package are searched automatically by :py:func:`waflib.Node.Node.ant_glob`.
Set *files* to prevent this behaviour::
def dist(ctx):
ctx.files = ctx.path.find_node('wscript')
Files are also searched from the directory 'base_path', to change it, set::
def dist(ctx):
... | [
"def",
"get_files",
"(",
"self",
")",
":",
"try",
":",
"files",
"=",
"self",
".",
"files",
"except",
"AttributeError",
":",
"files",
"=",
"self",
".",
"base_path",
".",
"ant_glob",
"(",
"'**/*'",
",",
"excl",
"=",
"self",
".",
"get_excl",
"(",
")",
"... | https://github.com/jackaudio/jack2/blob/21b293dbc37d42446141a08922cdec0d2550c6a0/waflib/Scripting.py#L492-L511 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/platform/gfile.py | python | Remove | (path) | Delete the (non-directory) file "path".
Args:
path: The file to remove.
Raises:
OSError: If "path" does not exist, is a directory, or cannot be deleted. | Delete the (non-directory) file "path". | [
"Delete",
"the",
"(",
"non",
"-",
"directory",
")",
"file",
"path",
"."
] | def Remove(path): # pylint: disable=invalid-name
"""Delete the (non-directory) file "path".
Args:
path: The file to remove.
Raises:
OSError: If "path" does not exist, is a directory, or cannot be deleted.
"""
os.remove(path) | [
"def",
"Remove",
"(",
"path",
")",
":",
"# pylint: disable=invalid-name",
"os",
".",
"remove",
"(",
"path",
")"
] | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/platform/gfile.py#L313-L322 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/closure_linter/closure_linter/statetracker.py | python | StateTracker.IsFunctionOpen | (self) | return (self._functions and
self._functions[-1].block_depth == self._block_depth - 1) | Returns true if the current token is a function block open.
Returns:
True if the current token is a function block open. | Returns true if the current token is a function block open. | [
"Returns",
"true",
"if",
"the",
"current",
"token",
"is",
"a",
"function",
"block",
"open",
"."
] | def IsFunctionOpen(self):
"""Returns true if the current token is a function block open.
Returns:
True if the current token is a function block open.
"""
return (self._functions and
self._functions[-1].block_depth == self._block_depth - 1) | [
"def",
"IsFunctionOpen",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"_functions",
"and",
"self",
".",
"_functions",
"[",
"-",
"1",
"]",
".",
"block_depth",
"==",
"self",
".",
"_block_depth",
"-",
"1",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/closure_linter/closure_linter/statetracker.py#L643-L650 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/indexes/multi.py | python | MultiIndex.set_codes | (self, codes, level=None, inplace=False,
verify_integrity=True) | Set new codes on MultiIndex. Defaults to returning
new index.
.. versionadded:: 0.24.0
New name for deprecated method `set_labels`.
Parameters
----------
codes : sequence or list of sequence
new codes to apply
level : int, level name, or sequence... | Set new codes on MultiIndex. Defaults to returning
new index. | [
"Set",
"new",
"codes",
"on",
"MultiIndex",
".",
"Defaults",
"to",
"returning",
"new",
"index",
"."
] | def set_codes(self, codes, level=None, inplace=False,
verify_integrity=True):
"""
Set new codes on MultiIndex. Defaults to returning
new index.
.. versionadded:: 0.24.0
New name for deprecated method `set_labels`.
Parameters
----------
... | [
"def",
"set_codes",
"(",
"self",
",",
"codes",
",",
"level",
"=",
"None",
",",
"inplace",
"=",
"False",
",",
"verify_integrity",
"=",
"True",
")",
":",
"if",
"level",
"is",
"not",
"None",
"and",
"not",
"is_list_like",
"(",
"level",
")",
":",
"if",
"n... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/indexes/multi.py#L709-L774 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/internal/backends/chrome/android_browser_finder.py | python | FindAllAvailableBrowsers | (finder_options, device) | return _FindAllPossibleBrowsers(finder_options, android_platform) | Finds all the possible browsers on one device.
The device is either the only device on the host platform,
or |finder_options| specifies a particular device. | Finds all the possible browsers on one device. | [
"Finds",
"all",
"the",
"possible",
"browsers",
"on",
"one",
"device",
"."
] | def FindAllAvailableBrowsers(finder_options, device):
"""Finds all the possible browsers on one device.
The device is either the only device on the host platform,
or |finder_options| specifies a particular device.
"""
if not isinstance(device, android_device.AndroidDevice):
return []
android_platform =... | [
"def",
"FindAllAvailableBrowsers",
"(",
"finder_options",
",",
"device",
")",
":",
"if",
"not",
"isinstance",
"(",
"device",
",",
"android_device",
".",
"AndroidDevice",
")",
":",
"return",
"[",
"]",
"android_platform",
"=",
"platform",
".",
"GetPlatformForDevice"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/internal/backends/chrome/android_browser_finder.py#L250-L259 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_ops.py | python | _div_python2 | (x, y, name=None) | Divide two values using Python 2 semantics.
Used for Tensor.__div__.
Args:
x: `Tensor` numerator of real numeric type.
y: `Tensor` denominator of real numeric type.
name: A name for the operation (optional).
Returns:
`x / y` returns the quotient of x and y. | Divide two values using Python 2 semantics. | [
"Divide",
"two",
"values",
"using",
"Python",
"2",
"semantics",
"."
] | def _div_python2(x, y, name=None):
"""Divide two values using Python 2 semantics.
Used for Tensor.__div__.
Args:
x: `Tensor` numerator of real numeric type.
y: `Tensor` denominator of real numeric type.
name: A name for the operation (optional).
Returns:
`x / y` returns the quotient of x and ... | [
"def",
"_div_python2",
"(",
"x",
",",
"y",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"\"div\"",
",",
"[",
"x",
",",
"y",
"]",
")",
"as",
"name",
":",
"x",
"=",
"ops",
".",
"convert_to_tensor",
"(",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_ops.py#L1008-L1033 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py | python | Standard_Suite_Events.count | (self, _object, _attributes={}, **_arguments) | count: Return the number of elements of an object
Required argument: the object whose elements are to be counted
Keyword argument each: if specified, restricts counting to objects of this class
Keyword argument _attributes: AppleEvent attribute dictionary
Returns: the number of elements | count: Return the number of elements of an object
Required argument: the object whose elements are to be counted
Keyword argument each: if specified, restricts counting to objects of this class
Keyword argument _attributes: AppleEvent attribute dictionary
Returns: the number of elements | [
"count",
":",
"Return",
"the",
"number",
"of",
"elements",
"of",
"an",
"object",
"Required",
"argument",
":",
"the",
"object",
"whose",
"elements",
"are",
"to",
"be",
"counted",
"Keyword",
"argument",
"each",
":",
"if",
"specified",
"restricts",
"counting",
... | def count(self, _object, _attributes={}, **_arguments):
"""count: Return the number of elements of an object
Required argument: the object whose elements are to be counted
Keyword argument each: if specified, restricts counting to objects of this class
Keyword argument _attributes: Apple... | [
"def",
"count",
"(",
"self",
",",
"_object",
",",
"_attributes",
"=",
"{",
"}",
",",
"*",
"*",
"_arguments",
")",
":",
"_code",
"=",
"'core'",
"_subcode",
"=",
"'cnte'",
"aetools",
".",
"keysubst",
"(",
"_arguments",
",",
"self",
".",
"_argmap_count",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py#L74-L94 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/layers/python/layers/regularizers.py | python | apply_regularization | (regularizer, weights_list=None) | Returns the summed penalty by applying `regularizer` to the `weights_list`.
Adding a regularization penalty over the layer weights and embedding weights
can help prevent overfitting the training data. Regularization over layer
biases is less common/useful, but assuming proper data preprocessing/mean
subtractio... | Returns the summed penalty by applying `regularizer` to the `weights_list`. | [
"Returns",
"the",
"summed",
"penalty",
"by",
"applying",
"regularizer",
"to",
"the",
"weights_list",
"."
] | def apply_regularization(regularizer, weights_list=None):
"""Returns the summed penalty by applying `regularizer` to the `weights_list`.
Adding a regularization penalty over the layer weights and embedding weights
can help prevent overfitting the training data. Regularization over layer
biases is less common/u... | [
"def",
"apply_regularization",
"(",
"regularizer",
",",
"weights_list",
"=",
"None",
")",
":",
"if",
"not",
"weights_list",
":",
"weights_list",
"=",
"ops",
".",
"get_collection",
"(",
"ops",
".",
"GraphKeys",
".",
"WEIGHTS",
")",
"if",
"not",
"weights_list",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/layers/python/layers/regularizers.py#L157-L196 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/distributed/fleet/meta_optimizers/sharding/utils.py | python | insert_sync_comm_ops | (block, insert_idx, ring_id, comm_dep_vars) | return 1 | insert sync_comm_op for vars | insert sync_comm_op for vars | [
"insert",
"sync_comm_op",
"for",
"vars"
] | def insert_sync_comm_ops(block, insert_idx, ring_id, comm_dep_vars):
"""
insert sync_comm_op for vars
"""
# NOTE (JZ-LIANG) to be check, may result undefined case
if len(comm_dep_vars) == 0:
return 0
op_role = get_valid_op_role(block, insert_idx)
block._insert_op_without_sync(
... | [
"def",
"insert_sync_comm_ops",
"(",
"block",
",",
"insert_idx",
",",
"ring_id",
",",
"comm_dep_vars",
")",
":",
"# NOTE (JZ-LIANG) to be check, may result undefined case ",
"if",
"len",
"(",
"comm_dep_vars",
")",
"==",
"0",
":",
"return",
"0",
"op_role",
"=",
"get_v... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/fleet/meta_optimizers/sharding/utils.py#L273-L289 | |
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | sdhash-ui/cherrypy/wsgiserver/wsgiserver2.py | python | plat_specific_errors | (*errnames) | return list(dict.fromkeys(nums).keys()) | Return error numbers for all errors in errnames on this platform.
The 'errno' module contains different global constants depending on
the specific platform (OS). This function will return the list of
numeric values for a given list of potential names. | Return error numbers for all errors in errnames on this platform.
The 'errno' module contains different global constants depending on
the specific platform (OS). This function will return the list of
numeric values for a given list of potential names. | [
"Return",
"error",
"numbers",
"for",
"all",
"errors",
"in",
"errnames",
"on",
"this",
"platform",
".",
"The",
"errno",
"module",
"contains",
"different",
"global",
"constants",
"depending",
"on",
"the",
"specific",
"platform",
"(",
"OS",
")",
".",
"This",
"f... | def plat_specific_errors(*errnames):
"""Return error numbers for all errors in errnames on this platform.
The 'errno' module contains different global constants depending on
the specific platform (OS). This function will return the list of
numeric values for a given list of potential names.
"""... | [
"def",
"plat_specific_errors",
"(",
"*",
"errnames",
")",
":",
"errno_names",
"=",
"dir",
"(",
"errno",
")",
"nums",
"=",
"[",
"getattr",
"(",
"errno",
",",
"k",
")",
"for",
"k",
"in",
"errnames",
"if",
"k",
"in",
"errno_names",
"]",
"# de-dupe the list"... | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/sdhash-ui/cherrypy/wsgiserver/wsgiserver2.py#L149-L159 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/setuptools/_vendor/pyparsing.py | python | ParserElement.addCondition | (self, *fns, **kwargs) | return self | Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the condition.
Optional keyword arguments:
... | Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the condition. | [
"Add",
"a",
"boolean",
"predicate",
"function",
"to",
"expression",
"s",
"list",
"of",
"parse",
"actions",
".",
"See",
"L",
"{",
"I",
"{",
"setParseAction",
"}",
"<setParseAction",
">",
"}",
"for",
"function",
"call",
"signatures",
".",
"Unlike",
"C",
"{",... | def addCondition(self, *fns, **kwargs):
"""Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the con... | [
"def",
"addCondition",
"(",
"self",
",",
"*",
"fns",
",",
"*",
"*",
"kwargs",
")",
":",
"msg",
"=",
"kwargs",
".",
"get",
"(",
"\"message\"",
",",
"\"failed user-defined condition\"",
")",
"exc_type",
"=",
"ParseFatalException",
"if",
"kwargs",
".",
"get",
... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/setuptools/_vendor/pyparsing.py#L1298-L1323 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/signal/window_ops.py | python | hann_window | (window_length, periodic=True, dtype=dtypes.float32, name=None) | return _raised_cosine_window(name, 'hann_window', window_length, periodic,
dtype, 0.5, 0.5) | Generate a [Hann window][hann].
Args:
window_length: A scalar `Tensor` indicating the window length to generate.
periodic: A bool `Tensor` indicating whether to generate a periodic or
symmetric window. Periodic windows are typically used for spectral
analysis while symmetric windows are typically... | Generate a [Hann window][hann]. | [
"Generate",
"a",
"[",
"Hann",
"window",
"]",
"[",
"hann",
"]",
"."
] | def hann_window(window_length, periodic=True, dtype=dtypes.float32, name=None):
"""Generate a [Hann window][hann].
Args:
window_length: A scalar `Tensor` indicating the window length to generate.
periodic: A bool `Tensor` indicating whether to generate a periodic or
symmetric window. Periodic windows... | [
"def",
"hann_window",
"(",
"window_length",
",",
"periodic",
"=",
"True",
",",
"dtype",
"=",
"dtypes",
".",
"float32",
",",
"name",
"=",
"None",
")",
":",
"return",
"_raised_cosine_window",
"(",
"name",
",",
"'hann_window'",
",",
"window_length",
",",
"perio... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/signal/window_ops.py#L34-L55 | |
Cisco-Talos/moflow | ed71dfb0540d9e0d7a4c72f0881b58958d573728 | BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/google/protobuf/descriptor.py | python | FieldDescriptor.__init__ | (self, name, full_name, index, number, type, cpp_type, label,
default_value, message_type, enum_type, containing_type,
is_extension, extension_scope, options=None,
has_default_value=True) | The arguments are as described in the description of FieldDescriptor
attributes above.
Note that containing_type may be None, and may be set later if necessary
(to deal with circular references between message types, for example).
Likewise for extension_scope. | The arguments are as described in the description of FieldDescriptor
attributes above. | [
"The",
"arguments",
"are",
"as",
"described",
"in",
"the",
"description",
"of",
"FieldDescriptor",
"attributes",
"above",
"."
] | def __init__(self, name, full_name, index, number, type, cpp_type, label,
default_value, message_type, enum_type, containing_type,
is_extension, extension_scope, options=None,
has_default_value=True):
"""The arguments are as described in the description of FieldDescripto... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"full_name",
",",
"index",
",",
"number",
",",
"type",
",",
"cpp_type",
",",
"label",
",",
"default_value",
",",
"message_type",
",",
"enum_type",
",",
"containing_type",
",",
"is_extension",
",",
"extension_... | https://github.com/Cisco-Talos/moflow/blob/ed71dfb0540d9e0d7a4c72f0881b58958d573728/BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/google/protobuf/descriptor.py#L370-L402 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/py/crustslices.py | python | CrustSlicesFrame.updateNamespace | (self) | Update the buffer namespace for autocompletion and calltips. | Update the buffer namespace for autocompletion and calltips. | [
"Update",
"the",
"buffer",
"namespace",
"for",
"autocompletion",
"and",
"calltips",
"."
] | def updateNamespace(self):
"""Update the buffer namespace for autocompletion and calltips."""
if self.buffer.updateNamespace():
self.SetStatusText('Namespace updated')
else:
self.SetStatusText('Error executing, unable to update namespace') | [
"def",
"updateNamespace",
"(",
"self",
")",
":",
"if",
"self",
".",
"buffer",
".",
"updateNamespace",
"(",
")",
":",
"self",
".",
"SetStatusText",
"(",
"'Namespace updated'",
")",
"else",
":",
"self",
".",
"SetStatusText",
"(",
"'Error executing, unable to updat... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/py/crustslices.py#L411-L416 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/gettext.py | python | GNUTranslations._parse | (self, fp) | Override this method to support alternative .mo formats. | Override this method to support alternative .mo formats. | [
"Override",
"this",
"method",
"to",
"support",
"alternative",
".",
"mo",
"formats",
"."
] | def _parse(self, fp):
"""Override this method to support alternative .mo formats."""
unpack = struct.unpack
filename = getattr(fp, 'name', '')
# Parse the .mo file header, which consists of 5 little endian 32
# bit words.
self._catalog = catalog = {}
self.plural =... | [
"def",
"_parse",
"(",
"self",
",",
"fp",
")",
":",
"unpack",
"=",
"struct",
".",
"unpack",
"filename",
"=",
"getattr",
"(",
"fp",
",",
"'name'",
",",
"''",
")",
"# Parse the .mo file header, which consists of 5 little endian 32",
"# bit words.",
"self",
".",
"_c... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/gettext.py#L262-L341 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros/roscreate/src/roscreate/core.py | python | read_template | (tmplf) | return t | Read resource template from egg installation, or fallback on rospkg otherwise.
:returns: text of template file | Read resource template from egg installation, or fallback on rospkg otherwise. | [
"Read",
"resource",
"template",
"from",
"egg",
"installation",
"or",
"fallback",
"on",
"rospkg",
"otherwise",
"."
] | def read_template(tmplf):
"""
Read resource template from egg installation, or fallback on rospkg otherwise.
:returns: text of template file
"""
if pkg_resources.resource_exists('roscreate', tmplf):
f = pkg_resources.resource_stream('roscreate', tmplf)
t = f.read()
else:
... | [
"def",
"read_template",
"(",
"tmplf",
")",
":",
"if",
"pkg_resources",
".",
"resource_exists",
"(",
"'roscreate'",
",",
"tmplf",
")",
":",
"f",
"=",
"pkg_resources",
".",
"resource_stream",
"(",
"'roscreate'",
",",
"tmplf",
")",
"t",
"=",
"f",
".",
"read",... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros/roscreate/src/roscreate/core.py#L71-L89 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/pip/baseparser.py | python | ConfigOptionParser.normalize_keys | (self, items) | return normalized | Return a config dictionary with normalized keys regardless of
whether the keys were specified in environment variables or in config
files | Return a config dictionary with normalized keys regardless of
whether the keys were specified in environment variables or in config
files | [
"Return",
"a",
"config",
"dictionary",
"with",
"normalized",
"keys",
"regardless",
"of",
"whether",
"the",
"keys",
"were",
"specified",
"in",
"environment",
"variables",
"or",
"in",
"config",
"files"
] | def normalize_keys(self, items):
"""Return a config dictionary with normalized keys regardless of
whether the keys were specified in environment variables or in config
files"""
normalized = {}
for key, val in items:
key = key.replace('_', '-')
if not key.s... | [
"def",
"normalize_keys",
"(",
"self",
",",
"items",
")",
":",
"normalized",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"items",
":",
"key",
"=",
"key",
".",
"replace",
"(",
"'_'",
",",
"'-'",
")",
"if",
"not",
"key",
".",
"startswith",
"(",
"... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pip/baseparser.py#L228-L238 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/numpy_extension/utils.py | python | load | (file) | Load arrays from ``.npy``, ``.npz`` or legacy MXNet file format.
See more details in ``save``.
Parameters
----------
file : str
The filename.
Returns
-------
result : list of ndarrays or dict of str -> ndarray
Data stored in the file.
Notes
-----
This function... | Load arrays from ``.npy``, ``.npz`` or legacy MXNet file format. | [
"Load",
"arrays",
"from",
".",
"npy",
".",
"npz",
"or",
"legacy",
"MXNet",
"file",
"format",
"."
] | def load(file):
"""Load arrays from ``.npy``, ``.npz`` or legacy MXNet file format.
See more details in ``save``.
Parameters
----------
file : str
The filename.
Returns
-------
result : list of ndarrays or dict of str -> ndarray
Data stored in the file.
Notes
... | [
"def",
"load",
"(",
"file",
")",
":",
"if",
"not",
"(",
"is_np_shape",
"(",
")",
"and",
"is_np_array",
"(",
")",
")",
":",
"raise",
"ValueError",
"(",
"'Cannot load `mxnet.numpy.ndarray` in legacy mode. Please activate'",
"' numpy semantics by calling `npx.set_np()` in th... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/numpy_extension/utils.py#L124-L167 | ||
ndrplz/self-driving-car | 2bdcc7c822e8f03adc0a7490f1ae29a658720713 | project_4_advanced_lane_finding/main.py | python | process_pipeline | (frame, keep_state=True) | return blend_output | Apply whole lane detection pipeline to an input color frame.
:param frame: input color frame
:param keep_state: if True, lane-line state is conserved (this permits to average results)
:return: output blend with detected lane overlaid | Apply whole lane detection pipeline to an input color frame.
:param frame: input color frame
:param keep_state: if True, lane-line state is conserved (this permits to average results)
:return: output blend with detected lane overlaid | [
"Apply",
"whole",
"lane",
"detection",
"pipeline",
"to",
"an",
"input",
"color",
"frame",
".",
":",
"param",
"frame",
":",
"input",
"color",
"frame",
":",
"param",
"keep_state",
":",
"if",
"True",
"lane",
"-",
"line",
"state",
"is",
"conserved",
"(",
"th... | def process_pipeline(frame, keep_state=True):
"""
Apply whole lane detection pipeline to an input color frame.
:param frame: input color frame
:param keep_state: if True, lane-line state is conserved (this permits to average results)
:return: output blend with detected lane overlaid
"""
glo... | [
"def",
"process_pipeline",
"(",
"frame",
",",
"keep_state",
"=",
"True",
")",
":",
"global",
"line_lt",
",",
"line_rt",
",",
"processed_frames",
"# undistort the image using coefficients found in calibration",
"img_undistorted",
"=",
"undistort",
"(",
"frame",
",",
"mtx... | https://github.com/ndrplz/self-driving-car/blob/2bdcc7c822e8f03adc0a7490f1ae29a658720713/project_4_advanced_lane_finding/main.py#L92-L128 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/external/bazel_tools/third_party/py/gflags/__init__.py | python | ArgumentParser.Parse | (self, argument) | return argument | Default implementation: always returns its argument unmodified. | Default implementation: always returns its argument unmodified. | [
"Default",
"implementation",
":",
"always",
"returns",
"its",
"argument",
"unmodified",
"."
] | def Parse(self, argument):
"""Default implementation: always returns its argument unmodified."""
return argument | [
"def",
"Parse",
"(",
"self",
",",
"argument",
")",
":",
"return",
"argument"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/external/bazel_tools/third_party/py/gflags/__init__.py#L2052-L2054 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/mox3/mox3/mox.py | python | IsAlmost.equals | (self, rhs) | Check to see if RHS is almost equal to float_value
Args:
rhs: the value to compare to float_value
Returns:
bool | Check to see if RHS is almost equal to float_value | [
"Check",
"to",
"see",
"if",
"RHS",
"is",
"almost",
"equal",
"to",
"float_value"
] | def equals(self, rhs):
"""Check to see if RHS is almost equal to float_value
Args:
rhs: the value to compare to float_value
Returns:
bool
"""
try:
return round(rhs - self._float_value, self._places) == 0
except Exception:
... | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"try",
":",
"return",
"round",
"(",
"rhs",
"-",
"self",
".",
"_float_value",
",",
"self",
".",
"_places",
")",
"==",
"0",
"except",
"Exception",
":",
"# Probably because either float_value or rhs is not a num... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/mox3/mox3/mox.py#L1453-L1467 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/lib/utils.py | python | who | (vardict=None) | return | Print the Numpy arrays in the given dictionary.
If there is no dictionary passed in or `vardict` is None then returns
Numpy arrays in the globals() dictionary (all Numpy arrays in the
namespace).
Parameters
----------
vardict : dict, optional
A dictionary possibly containing ndarrays. ... | Print the Numpy arrays in the given dictionary. | [
"Print",
"the",
"Numpy",
"arrays",
"in",
"the",
"given",
"dictionary",
"."
] | def who(vardict=None):
"""
Print the Numpy arrays in the given dictionary.
If there is no dictionary passed in or `vardict` is None then returns
Numpy arrays in the globals() dictionary (all Numpy arrays in the
namespace).
Parameters
----------
vardict : dict, optional
A dictio... | [
"def",
"who",
"(",
"vardict",
"=",
"None",
")",
":",
"if",
"vardict",
"is",
"None",
":",
"frame",
"=",
"sys",
".",
"_getframe",
"(",
")",
".",
"f_back",
"vardict",
"=",
"frame",
".",
"f_globals",
"sta",
"=",
"[",
"]",
"cache",
"=",
"{",
"}",
"for... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/lib/utils.py#L274-L368 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/distutils/command/build_ext.py | python | build_ext.check_extensions_list | (self, extensions) | Ensure that the list of extensions (presumably provided as a
command option 'extensions') is valid, i.e. it is a list of
Extension objects. We also support the old-style list of 2-tuples,
where the tuples are (ext_name, build_info), which are converted to
Extension instances here.
... | Ensure that the list of extensions (presumably provided as a
command option 'extensions') is valid, i.e. it is a list of
Extension objects. We also support the old-style list of 2-tuples,
where the tuples are (ext_name, build_info), which are converted to
Extension instances here. | [
"Ensure",
"that",
"the",
"list",
"of",
"extensions",
"(",
"presumably",
"provided",
"as",
"a",
"command",
"option",
"extensions",
")",
"is",
"valid",
"i",
".",
"e",
".",
"it",
"is",
"a",
"list",
"of",
"Extension",
"objects",
".",
"We",
"also",
"support",... | def check_extensions_list(self, extensions):
"""Ensure that the list of extensions (presumably provided as a
command option 'extensions') is valid, i.e. it is a list of
Extension objects. We also support the old-style list of 2-tuples,
where the tuples are (ext_name, build_info), which ... | [
"def",
"check_extensions_list",
"(",
"self",
",",
"extensions",
")",
":",
"if",
"not",
"isinstance",
"(",
"extensions",
",",
"list",
")",
":",
"raise",
"DistutilsSetupError",
",",
"\"'ext_modules' option must be a list of Extension instances\"",
"for",
"i",
",",
"ext"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/distutils/command/build_ext.py#L342-L418 | ||
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | src/condor_credd/condor_credmon_oauth/credmon/CredentialMonitors/OAuthCredmonWebserver/OAuthCredmonWebserver.py | python | oauth_return | (provider) | return redirect("/") | Returning from OAuth provider | Returning from OAuth provider | [
"Returning",
"from",
"OAuth",
"provider"
] | def oauth_return(provider):
"""
Returning from OAuth provider
"""
# get the provider name from the outgoing_provider set in oauth_login()
provider = session.pop('outgoing_provider', get_provider_str(provider, ''))
if not ('providers' in session):
sys.stderr.write('"providers" key was no... | [
"def",
"oauth_return",
"(",
"provider",
")",
":",
"# get the provider name from the outgoing_provider set in oauth_login()",
"provider",
"=",
"session",
".",
"pop",
"(",
"'outgoing_provider'",
",",
"get_provider_str",
"(",
"provider",
",",
"''",
")",
")",
"if",
"not",
... | https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/src/condor_credd/condor_credmon_oauth/credmon/CredentialMonitors/OAuthCredmonWebserver/OAuthCredmonWebserver.py#L235-L370 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/distributions/special_math.py | python | ndtri | (p, name="ndtri") | The inverse of the CDF of the Normal distribution function.
Returns x such that the area under the pdf from minus infinity to x is equal
to p.
A piece-wise rational approximation is done for the function.
This is a port of the implementation in netlib.
Args:
p: `Tensor` of type `float32`, `float64`.
... | The inverse of the CDF of the Normal distribution function. | [
"The",
"inverse",
"of",
"the",
"CDF",
"of",
"the",
"Normal",
"distribution",
"function",
"."
] | def ndtri(p, name="ndtri"):
"""The inverse of the CDF of the Normal distribution function.
Returns x such that the area under the pdf from minus infinity to x is equal
to p.
A piece-wise rational approximation is done for the function.
This is a port of the implementation in netlib.
Args:
p: `Tensor`... | [
"def",
"ndtri",
"(",
"p",
",",
"name",
"=",
"\"ndtri\"",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"values",
"=",
"[",
"p",
"]",
")",
":",
"p",
"=",
"ops",
".",
"convert_to_tensor",
"(",
"p",
",",
"name",
"=",
"\"p\"",
")",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/distributions/special_math.py#L104-L130 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_gdi.py | python | MemoryDC.SelectObject | (*args, **kwargs) | return _gdi_.MemoryDC_SelectObject(*args, **kwargs) | SelectObject(self, Bitmap bitmap)
Selects the bitmap into the device context, to use as the memory
bitmap. Selecting the bitmap into a memory DC allows you to draw into
the DC, and therefore the bitmap, and also to use Blit to copy the
bitmap to a window.
If the argument is wx.... | SelectObject(self, Bitmap bitmap) | [
"SelectObject",
"(",
"self",
"Bitmap",
"bitmap",
")"
] | def SelectObject(*args, **kwargs):
"""
SelectObject(self, Bitmap bitmap)
Selects the bitmap into the device context, to use as the memory
bitmap. Selecting the bitmap into a memory DC allows you to draw into
the DC, and therefore the bitmap, and also to use Blit to copy the
... | [
"def",
"SelectObject",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"MemoryDC_SelectObject",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L5157-L5171 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | RichTextBuffer.SetScale | (*args, **kwargs) | return _richtext.RichTextBuffer_SetScale(*args, **kwargs) | SetScale(self, double scale) | SetScale(self, double scale) | [
"SetScale",
"(",
"self",
"double",
"scale",
")"
] | def SetScale(*args, **kwargs):
"""SetScale(self, double scale)"""
return _richtext.RichTextBuffer_SetScale(*args, **kwargs) | [
"def",
"SetScale",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextBuffer_SetScale",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L2639-L2641 | |
facebookarchive/LogDevice | ce7726050edc49a1e15d9160e81c890736b779e2 | build/fbcode_builder/getdeps/fetcher.py | python | ShipitPathMap.add_mapping | (self, fbsource_dir, target_dir) | Add a posix path or pattern. We cannot normpath the input
here because that would change the paths from posix to windows
form and break the logic throughout this class. | Add a posix path or pattern. We cannot normpath the input
here because that would change the paths from posix to windows
form and break the logic throughout this class. | [
"Add",
"a",
"posix",
"path",
"or",
"pattern",
".",
"We",
"cannot",
"normpath",
"the",
"input",
"here",
"because",
"that",
"would",
"change",
"the",
"paths",
"from",
"posix",
"to",
"windows",
"form",
"and",
"break",
"the",
"logic",
"throughout",
"this",
"cl... | def add_mapping(self, fbsource_dir, target_dir):
"""Add a posix path or pattern. We cannot normpath the input
here because that would change the paths from posix to windows
form and break the logic throughout this class."""
self.roots.append(fbsource_dir)
self.mapping.append((fb... | [
"def",
"add_mapping",
"(",
"self",
",",
"fbsource_dir",
",",
"target_dir",
")",
":",
"self",
".",
"roots",
".",
"append",
"(",
"fbsource_dir",
")",
"self",
".",
"mapping",
".",
"append",
"(",
"(",
"fbsource_dir",
",",
"target_dir",
")",
")"
] | https://github.com/facebookarchive/LogDevice/blob/ce7726050edc49a1e15d9160e81c890736b779e2/build/fbcode_builder/getdeps/fetcher.py#L381-L386 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/contextlib.py | python | ExitStack.close | (self) | Immediately unwind the context stack. | Immediately unwind the context stack. | [
"Immediately",
"unwind",
"the",
"context",
"stack",
"."
] | def close(self):
"""Immediately unwind the context stack."""
self.__exit__(None, None, None) | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"__exit__",
"(",
"None",
",",
"None",
",",
"None",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/contextlib.py#L530-L532 | ||
gnina/gnina | b9ae032f52fc7a8153987bde09c0efa3620d8bb6 | caffe/python/caffe/pycaffe.py | python | _Net_batch | (self, blobs) | Batch blob lists according to net's batch size.
Parameters
----------
blobs: Keys blob names and values are lists of blobs (of any length).
Naturally, all the lists should have the same length.
Yields
------
batch: {blob name: list of blobs} dict for a single batch. | Batch blob lists according to net's batch size. | [
"Batch",
"blob",
"lists",
"according",
"to",
"net",
"s",
"batch",
"size",
"."
] | def _Net_batch(self, blobs):
"""
Batch blob lists according to net's batch size.
Parameters
----------
blobs: Keys blob names and values are lists of blobs (of any length).
Naturally, all the lists should have the same length.
Yields
------
batch: {blob name: list of blobs} ... | [
"def",
"_Net_batch",
"(",
"self",
",",
"blobs",
")",
":",
"num",
"=",
"len",
"(",
"six",
".",
"next",
"(",
"six",
".",
"itervalues",
"(",
"blobs",
")",
")",
")",
"batch_size",
"=",
"six",
".",
"next",
"(",
"six",
".",
"itervalues",
"(",
"self",
"... | https://github.com/gnina/gnina/blob/b9ae032f52fc7a8153987bde09c0efa3620d8bb6/caffe/python/caffe/pycaffe.py#L272-L303 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/gluon/embedding_learning/train.py | python | train | (epochs, ctx) | return best_val | Training function. | Training function. | [
"Training",
"function",
"."
] | def train(epochs, ctx):
"""Training function."""
if isinstance(ctx, mx.Context):
ctx = [ctx]
net.initialize(mx.init.Xavier(magnitude=2), ctx=ctx)
opt_options = {'learning_rate': opt.lr, 'wd': opt.wd}
if opt.optimizer == 'sgd':
opt_options['momentum'] = 0.9
if opt.optimizer == 'a... | [
"def",
"train",
"(",
"epochs",
",",
"ctx",
")",
":",
"if",
"isinstance",
"(",
"ctx",
",",
"mx",
".",
"Context",
")",
":",
"ctx",
"=",
"[",
"ctx",
"]",
"net",
".",
"initialize",
"(",
"mx",
".",
"init",
".",
"Xavier",
"(",
"magnitude",
"=",
"2",
... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/gluon/embedding_learning/train.py#L169-L250 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | catboost/jvm-packages/tools/copy_prebuilt_native_files.py | python | makedirs_if_not_exist | (dir_path) | ensure that target directory exists, can't use exist_ok flag because it is unavailable in
python 2.7 | ensure that target directory exists, can't use exist_ok flag because it is unavailable in
python 2.7 | [
"ensure",
"that",
"target",
"directory",
"exists",
"can",
"t",
"use",
"exist_ok",
"flag",
"because",
"it",
"is",
"unavailable",
"in",
"python",
"2",
".",
"7"
] | def makedirs_if_not_exist(dir_path):
"""
ensure that target directory exists, can't use exist_ok flag because it is unavailable in
python 2.7
"""
try:
os.makedirs(dir_path)
except OSError as e:
if e.errno != errno.EEXIST:
raise | [
"def",
"makedirs_if_not_exist",
"(",
"dir_path",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"dir_path",
")",
"except",
"OSError",
"as",
"e",
":",
"if",
"e",
".",
"errno",
"!=",
"errno",
".",
"EEXIST",
":",
"raise"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/catboost/jvm-packages/tools/copy_prebuilt_native_files.py#L10-L19 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/closure_linter/closure_linter/ecmametadatapass.py | python | EcmaMetaDataPass.__init__ | (self) | Initialize the meta data pass object. | Initialize the meta data pass object. | [
"Initialize",
"the",
"meta",
"data",
"pass",
"object",
"."
] | def __init__(self):
"""Initialize the meta data pass object."""
self.Reset() | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Reset",
"(",
")"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/closure_linter/closure_linter/ecmametadatapass.py#L188-L190 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/io/pytables.py | python | HDFStore.put | (self, key, value, format=None, append=False, **kwargs) | Store object in HDFStore
Parameters
----------
key : object
value : {Series, DataFrame, Panel}
format : 'fixed(f)|table(t)', default is 'fixed'
fixed(f) : Fixed format
Fast writing/reading. Not-appendable, nor searchable
t... | Store object in HDFStore | [
"Store",
"object",
"in",
"HDFStore"
] | def put(self, key, value, format=None, append=False, **kwargs):
"""
Store object in HDFStore
Parameters
----------
key : object
value : {Series, DataFrame, Panel}
format : 'fixed(f)|table(t)', default is 'fixed'
fixed(f) : Fixed format
... | [
"def",
"put",
"(",
"self",
",",
"key",
",",
"value",
",",
"format",
"=",
"None",
",",
"append",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"format",
"is",
"None",
":",
"format",
"=",
"get_option",
"(",
"\"io.hdf.default_format\"",
")",
"o... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/io/pytables.py#L861-L889 | ||
devpack/android-python27 | d42dd67565e104cf7b0b50eb473f615db3e69901 | python-build-with-qt/sip-4.11.2/siputils.py | python | ModuleMakefile.generate_target_clean | (self, mfile) | Generate the clean target.
mfile is the file object. | Generate the clean target. | [
"Generate",
"the",
"clean",
"target",
"."
] | def generate_target_clean(self, mfile):
"""Generate the clean target.
mfile is the file object.
"""
mfile.write("\nclean:\n")
self.clean_build_file_objects(mfile, self._build)
if self._manifest and not self.static:
mfile.write("\t-%s $(TARGET).manifest\n" % ... | [
"def",
"generate_target_clean",
"(",
"self",
",",
"mfile",
")",
":",
"mfile",
".",
"write",
"(",
"\"\\nclean:\\n\"",
")",
"self",
".",
"clean_build_file_objects",
"(",
"mfile",
",",
"self",
".",
"_build",
")",
"if",
"self",
".",
"_manifest",
"and",
"not",
... | https://github.com/devpack/android-python27/blob/d42dd67565e104cf7b0b50eb473f615db3e69901/python-build-with-qt/sip-4.11.2/siputils.py#L1626-L1641 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/k8sevents/module.py | python | Module.k8s_ready | (self) | return ready, missing | Validate the k8s_config dict
Returns:
- bool .... indicating whether the config is ready to use
- string .. variables that need to be defined before the module will function | Validate the k8s_config dict | [
"Validate",
"the",
"k8s_config",
"dict"
] | def k8s_ready(self):
"""Validate the k8s_config dict
Returns:
- bool .... indicating whether the config is ready to use
- string .. variables that need to be defined before the module will function
"""
missing = list()
ready = True
for k in self.k8s_c... | [
"def",
"k8s_ready",
"(",
"self",
")",
":",
"missing",
"=",
"list",
"(",
")",
"ready",
"=",
"True",
"for",
"k",
"in",
"self",
".",
"k8s_config",
":",
"if",
"not",
"self",
".",
"k8s_config",
"[",
"k",
"]",
":",
"missing",
".",
"append",
"(",
"k",
"... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/k8sevents/module.py#L1080-L1094 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/functions/DSFinterp1DFit.py | python | DSFinterp1DFit.function1D | (self, xvals) | return intensities_interpolator(xvals) | Fit using the interpolated structure factor | Fit using the interpolated structure factor | [
"Fit",
"using",
"the",
"interpolated",
"structure",
"factor"
] | def function1D(self, xvals):
''' Fit using the interpolated structure factor '''
p = self.validateParams()
if not p:
# return zeros if parameters not valid
return numpy.zeros(len(xvals), dtype=float)
# The first time the function is called requires initialization ... | [
"def",
"function1D",
"(",
"self",
",",
"xvals",
")",
":",
"p",
"=",
"self",
".",
"validateParams",
"(",
")",
"if",
"not",
"p",
":",
"# return zeros if parameters not valid",
"return",
"numpy",
".",
"zeros",
"(",
"len",
"(",
"xvals",
")",
",",
"dtype",
"=... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/functions/DSFinterp1DFit.py#L111-L184 | |
SpaceNetChallenge/BuildingDetectors | 3def3c44b5847c744cd2f3356182892d92496579 | qinhaifang/src/caffe-mnc/scripts/cpp_lint.py | python | PrintCategories | () | Prints a list of all the error-categories used by error messages.
These are the categories used to filter messages via --filter. | Prints a list of all the error-categories used by error messages. | [
"Prints",
"a",
"list",
"of",
"all",
"the",
"error",
"-",
"categories",
"used",
"by",
"error",
"messages",
"."
] | def PrintCategories():
"""Prints a list of all the error-categories used by error messages.
These are the categories used to filter messages via --filter.
"""
sys.stderr.write(''.join(' %s\n' % cat for cat in _ERROR_CATEGORIES))
sys.exit(0) | [
"def",
"PrintCategories",
"(",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"''",
".",
"join",
"(",
"' %s\\n'",
"%",
"cat",
"for",
"cat",
"in",
"_ERROR_CATEGORIES",
")",
")",
"sys",
".",
"exit",
"(",
"0",
")"
] | https://github.com/SpaceNetChallenge/BuildingDetectors/blob/3def3c44b5847c744cd2f3356182892d92496579/qinhaifang/src/caffe-mnc/scripts/cpp_lint.py#L4770-L4776 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | TextAttr.SetAlignment | (*args, **kwargs) | return _controls_.TextAttr_SetAlignment(*args, **kwargs) | SetAlignment(self, int alignment) | SetAlignment(self, int alignment) | [
"SetAlignment",
"(",
"self",
"int",
"alignment",
")"
] | def SetAlignment(*args, **kwargs):
"""SetAlignment(self, int alignment)"""
return _controls_.TextAttr_SetAlignment(*args, **kwargs) | [
"def",
"SetAlignment",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TextAttr_SetAlignment",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L1519-L1521 | |
zju3dv/clean-pvnet | 5870c509e3cc205e1bb28910a7b1a9a3c8add9a8 | lib/utils/meshrenderer/pysixd/transform.py | python | random_rotation_matrix | (rand=None) | return quaternion_matrix(random_quaternion(rand)) | Return uniform random rotation matrix.
rand: array like
Three independent random variables that are uniformly distributed
between 0 and 1 for each returned quaternion.
>>> R = random_rotation_matrix()
>>> numpy.allclose(numpy.dot(R.T, R), numpy.identity(4))
True | Return uniform random rotation matrix. | [
"Return",
"uniform",
"random",
"rotation",
"matrix",
"."
] | def random_rotation_matrix(rand=None):
"""Return uniform random rotation matrix.
rand: array like
Three independent random variables that are uniformly distributed
between 0 and 1 for each returned quaternion.
>>> R = random_rotation_matrix()
>>> numpy.allclose(numpy.dot(R.T, R), numpy... | [
"def",
"random_rotation_matrix",
"(",
"rand",
"=",
"None",
")",
":",
"return",
"quaternion_matrix",
"(",
"random_quaternion",
"(",
"rand",
")",
")"
] | https://github.com/zju3dv/clean-pvnet/blob/5870c509e3cc205e1bb28910a7b1a9a3c8add9a8/lib/utils/meshrenderer/pysixd/transform.py#L1491-L1503 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/resmokelib/selector.py | python | TestFileExplorer.list_dbtests | (self, dbtest_binary) | return stdout.splitlines() | Lists the available dbtests suites. | Lists the available dbtests suites. | [
"Lists",
"the",
"available",
"dbtests",
"suites",
"."
] | def list_dbtests(self, dbtest_binary):
"""Lists the available dbtests suites."""
returncode, stdout = self._run_program(dbtest_binary, ["--list"])
if returncode != 0:
raise errors.ResmokeError("Getting list of dbtest suites failed")
return stdout.splitlines() | [
"def",
"list_dbtests",
"(",
"self",
",",
"dbtest_binary",
")",
":",
"returncode",
",",
"stdout",
"=",
"self",
".",
"_run_program",
"(",
"dbtest_binary",
",",
"[",
"\"--list\"",
"]",
")",
"if",
"returncode",
"!=",
"0",
":",
"raise",
"errors",
".",
"ResmokeE... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/resmokelib/selector.py#L86-L93 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/series.py | python | Series.to_period | (self, freq=None, copy=True) | return self._constructor(new_values,
index=new_index).__finalize__(self) | Convert Series from DatetimeIndex to PeriodIndex with desired
frequency (inferred from index if not passed).
Parameters
----------
freq : string, default
Returns
-------
ts : Series with PeriodIndex | Convert Series from DatetimeIndex to PeriodIndex with desired
frequency (inferred from index if not passed). | [
"Convert",
"Series",
"from",
"DatetimeIndex",
"to",
"PeriodIndex",
"with",
"desired",
"frequency",
"(",
"inferred",
"from",
"index",
"if",
"not",
"passed",
")",
"."
] | def to_period(self, freq=None, copy=True):
"""
Convert Series from DatetimeIndex to PeriodIndex with desired
frequency (inferred from index if not passed).
Parameters
----------
freq : string, default
Returns
-------
ts : Series with PeriodIndex
... | [
"def",
"to_period",
"(",
"self",
",",
"freq",
"=",
"None",
",",
"copy",
"=",
"True",
")",
":",
"new_values",
"=",
"self",
".",
"_values",
"if",
"copy",
":",
"new_values",
"=",
"new_values",
".",
"copy",
"(",
")",
"new_index",
"=",
"self",
".",
"index... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/series.py#L4351-L4370 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/f2py/capi_maps.py | python | sign2map | (a,var) | return ret | varname,ctype,atype
init,init.r,init.i,pytype
vardebuginfo,vardebugshowvalue,varshowvalue
varrfromat
intent | varname,ctype,atype
init,init.r,init.i,pytype
vardebuginfo,vardebugshowvalue,varshowvalue
varrfromat
intent | [
"varname",
"ctype",
"atype",
"init",
"init",
".",
"r",
"init",
".",
"i",
"pytype",
"vardebuginfo",
"vardebugshowvalue",
"varshowvalue",
"varrfromat",
"intent"
] | def sign2map(a,var):
"""
varname,ctype,atype
init,init.r,init.i,pytype
vardebuginfo,vardebugshowvalue,varshowvalue
varrfromat
intent
"""
global lcb_map,cb_map
out_a = a
if isintent_out(var):
for k in var['intent']:
if k[:4]=='out=':
out_a = k[4... | [
"def",
"sign2map",
"(",
"a",
",",
"var",
")",
":",
"global",
"lcb_map",
",",
"cb_map",
"out_a",
"=",
"a",
"if",
"isintent_out",
"(",
"var",
")",
":",
"for",
"k",
"in",
"var",
"[",
"'intent'",
"]",
":",
"if",
"k",
"[",
":",
"4",
"]",
"==",
"'out... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/f2py/capi_maps.py#L450-L547 | |
neopenx/Dragon | 0e639a7319035ddc81918bd3df059230436ee0a1 | Dragon/python/dragon/vm/theano/tensor/basic.py | python | ones_like | (model, dtype=None, **kwargs) | return ops.Fill(shape=ops.Shape(model), value=1) | Initialize a tensor with ones, refer the shape of another tensor.
The values can be access only after the run of graph.
If dtype is ``None``, use ``config.floatX``.
Parameters
----------
model : Tensor
The tensor to refer shape.
dtype : str
The data type of Tensor.
Return... | Initialize a tensor with ones, refer the shape of another tensor. | [
"Initialize",
"a",
"tensor",
"with",
"ones",
"refer",
"the",
"shape",
"of",
"another",
"tensor",
"."
] | def ones_like(model, dtype=None, **kwargs):
"""Initialize a tensor with ones, refer the shape of another tensor.
The values can be access only after the run of graph.
If dtype is ``None``, use ``config.floatX``.
Parameters
----------
model : Tensor
The tensor to refer shape.
dtype... | [
"def",
"ones_like",
"(",
"model",
",",
"dtype",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"dtype",
"is",
"None",
":",
"dtype",
"=",
"config",
".",
"floatX",
"else",
":",
"raise",
"TypeError",
"(",
"\"Unsupported data type: {}\"",
".",
"format... | https://github.com/neopenx/Dragon/blob/0e639a7319035ddc81918bd3df059230436ee0a1/Dragon/python/dragon/vm/theano/tensor/basic.py#L178-L201 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/ma/extras.py | python | clump_unmasked | (a) | return result | Return list of slices corresponding to the unmasked clumps of a 1-D array.
(A "clump" is defined as a contiguous region of the array).
Parameters
----------
a : ndarray
A one-dimensional masked array.
Returns
-------
slices : list of slice
The list of slices, one for each c... | Return list of slices corresponding to the unmasked clumps of a 1-D array.
(A "clump" is defined as a contiguous region of the array). | [
"Return",
"list",
"of",
"slices",
"corresponding",
"to",
"the",
"unmasked",
"clumps",
"of",
"a",
"1",
"-",
"D",
"array",
".",
"(",
"A",
"clump",
"is",
"defined",
"as",
"a",
"contiguous",
"region",
"of",
"the",
"array",
")",
"."
] | def clump_unmasked(a):
"""
Return list of slices corresponding to the unmasked clumps of a 1-D array.
(A "clump" is defined as a contiguous region of the array).
Parameters
----------
a : ndarray
A one-dimensional masked array.
Returns
-------
slices : list of slice
... | [
"def",
"clump_unmasked",
"(",
"a",
")",
":",
"mask",
"=",
"getattr",
"(",
"a",
",",
"'_mask'",
",",
"nomask",
")",
"if",
"mask",
"is",
"nomask",
":",
"return",
"[",
"slice",
"(",
"0",
",",
"a",
".",
"size",
")",
"]",
"slices",
"=",
"_ezclump",
"(... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/ma/extras.py#L1742-L1783 | |
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/CoSimulationApplication/python_scripts/data_transfer_operators/kratos_mapping.py | python | KratosMappingDataTransferOperator.__GetModelPartFromInterfaceData | (interface_data) | If the solver does not exist on this rank, then pass a
dummy ModelPart to the Mapper that has a DataCommunicator
that is not defined on this rank | If the solver does not exist on this rank, then pass a
dummy ModelPart to the Mapper that has a DataCommunicator
that is not defined on this rank | [
"If",
"the",
"solver",
"does",
"not",
"exist",
"on",
"this",
"rank",
"then",
"pass",
"a",
"dummy",
"ModelPart",
"to",
"the",
"Mapper",
"that",
"has",
"a",
"DataCommunicator",
"that",
"is",
"not",
"defined",
"on",
"this",
"rank"
] | def __GetModelPartFromInterfaceData(interface_data):
"""If the solver does not exist on this rank, then pass a
dummy ModelPart to the Mapper that has a DataCommunicator
that is not defined on this rank
"""
if interface_data.IsDefinedOnThisRank():
return interface_data... | [
"def",
"__GetModelPartFromInterfaceData",
"(",
"interface_data",
")",
":",
"if",
"interface_data",
".",
"IsDefinedOnThisRank",
"(",
")",
":",
"return",
"interface_data",
".",
"GetModelPart",
"(",
")",
"else",
":",
"return",
"KratosMappingDataTransferOperator",
".",
"_... | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/CoSimulationApplication/python_scripts/data_transfer_operators/kratos_mapping.py#L117-L125 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | contrib/gizmos/msw/gizmos.py | python | TreeListCtrl.__init__ | (self, *args, **kwargs) | __init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=TR_DEFAULT_STYLE,
Validator validator=DefaultValidator,
String name=TreeListCtrlNameStr) -> TreeListCtrl | __init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=TR_DEFAULT_STYLE,
Validator validator=DefaultValidator,
String name=TreeListCtrlNameStr) -> TreeListCtrl | [
"__init__",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"TR_DEFAULT_STYLE",
"Validator",
"validator",
"=",
"DefaultValidator",
"String",
"name",
... | def __init__(self, *args, **kwargs):
"""
__init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=TR_DEFAULT_STYLE,
Validator validator=DefaultValidator,
String name=TreeListCtrlNameStr) -> TreeListCtrl
"""
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_gizmos",
".",
"TreeListCtrl_swiginit",
"(",
"self",
",",
"_gizmos",
".",
"new_TreeListCtrl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"self",
".",
"_se... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/contrib/gizmos/msw/gizmos.py#L474-L482 | ||
SIPp/sipp | f44d0cf5dec0013eff8fd7b4da885d455aa82e0e | cpplint.py | python | GetLineWidth | (line) | Determines the width of the line in column positions.
Args:
line: A string, which may be a Unicode string.
Returns:
The width of the line in column positions, accounting for Unicode
combining characters and wide characters. | Determines the width of the line in column positions. | [
"Determines",
"the",
"width",
"of",
"the",
"line",
"in",
"column",
"positions",
"."
] | def GetLineWidth(line):
"""Determines the width of the line in column positions.
Args:
line: A string, which may be a Unicode string.
Returns:
The width of the line in column positions, accounting for Unicode
combining characters and wide characters.
"""
if isinstance(line, unicode):
width =... | [
"def",
"GetLineWidth",
"(",
"line",
")",
":",
"if",
"isinstance",
"(",
"line",
",",
"unicode",
")",
":",
"width",
"=",
"0",
"for",
"uc",
"in",
"unicodedata",
".",
"normalize",
"(",
"'NFC'",
",",
"line",
")",
":",
"if",
"unicodedata",
".",
"east_asian_w... | https://github.com/SIPp/sipp/blob/f44d0cf5dec0013eff8fd7b4da885d455aa82e0e/cpplint.py#L2770-L2789 | ||
cmu-db/noisepage | 79276e68fe83322f1249e8a8be96bd63c583ae56 | script/self_driving/model_server.py | python | _infer_with_cache | (model, features, cache) | return np.array(results) | Perform model inference with caching
:param model: the model to invoke
:param features: input features
:param cache: cache the inference result based on the input feature
:return: inference results with the features | Perform model inference with caching
:param model: the model to invoke
:param features: input features
:param cache: cache the inference result based on the input feature
:return: inference results with the features | [
"Perform",
"model",
"inference",
"with",
"caching",
":",
"param",
"model",
":",
"the",
"model",
"to",
"invoke",
":",
"param",
"features",
":",
"input",
"features",
":",
"param",
"cache",
":",
"cache",
"the",
"inference",
"result",
"based",
"on",
"the",
"in... | def _infer_with_cache(model, features, cache):
"""
Perform model inference with caching
:param model: the model to invoke
:param features: input features
:param cache: cache the inference result based on the input feature
:return: inference results with the features
"""
# Convert feature... | [
"def",
"_infer_with_cache",
"(",
"model",
",",
"features",
",",
"cache",
")",
":",
"# Convert features to integers to use for cache key",
"int_features",
"=",
"(",
"features",
"*",
"100",
")",
".",
"astype",
"(",
"int",
")",
"n",
"=",
"features",
".",
"shape",
... | https://github.com/cmu-db/noisepage/blob/79276e68fe83322f1249e8a8be96bd63c583ae56/script/self_driving/model_server.py#L202-L225 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/model/sensing.py | python | camera_ray | (camera : SimRobotSensor, robot : RobotModel, x : float, y : float) | return camera_to_viewport(camera,robot).click_ray(x,y) | Returns the (source,direction) of a ray emanating from the
SimRobotSensor at pixel coordinates (x,y).
If you are doing this multiple times, it's faster to convert the camera
to GLViewport and use GLViewport.click_ray.
Arguments:
camera (SimRobotSensor): the camera
robot (RobotModel): t... | Returns the (source,direction) of a ray emanating from the
SimRobotSensor at pixel coordinates (x,y). | [
"Returns",
"the",
"(",
"source",
"direction",
")",
"of",
"a",
"ray",
"emanating",
"from",
"the",
"SimRobotSensor",
"at",
"pixel",
"coordinates",
"(",
"x",
"y",
")",
"."
] | def camera_ray(camera : SimRobotSensor, robot : RobotModel, x : float, y : float) -> Tuple[Vector3,Vector3]:
"""Returns the (source,direction) of a ray emanating from the
SimRobotSensor at pixel coordinates (x,y).
If you are doing this multiple times, it's faster to convert the camera
to GLViewport and... | [
"def",
"camera_ray",
"(",
"camera",
":",
"SimRobotSensor",
",",
"robot",
":",
"RobotModel",
",",
"x",
":",
"float",
",",
"y",
":",
"float",
")",
"->",
"Tuple",
"[",
"Vector3",
",",
"Vector3",
"]",
":",
"return",
"camera_to_viewport",
"(",
"camera",
",",
... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/model/sensing.py#L845-L861 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/os2emxpath.py | python | ismount | (path) | return len(p) == 1 and p[0] in '/\\' | Test whether a path is a mount point (defined as root of drive) | Test whether a path is a mount point (defined as root of drive) | [
"Test",
"whether",
"a",
"path",
"is",
"a",
"mount",
"point",
"(",
"defined",
"as",
"root",
"of",
"drive",
")"
] | def ismount(path):
"""Test whether a path is a mount point (defined as root of drive)"""
unc, rest = splitunc(path)
if unc:
return rest in ("", "/", "\\")
p = splitdrive(path)[1]
return len(p) == 1 and p[0] in '/\\' | [
"def",
"ismount",
"(",
"path",
")",
":",
"unc",
",",
"rest",
"=",
"splitunc",
"(",
"path",
")",
"if",
"unc",
":",
"return",
"rest",
"in",
"(",
"\"\"",
",",
"\"/\"",
",",
"\"\\\\\"",
")",
"p",
"=",
"splitdrive",
"(",
"path",
")",
"[",
"1",
"]",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/os2emxpath.py#L110-L116 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/array_grad.py | python | _MatrixSetDiagGradV2 | (op, grad) | return (grad_input, grad_diag, None) | Gradient for MatrixSetDiagV2. | Gradient for MatrixSetDiagV2. | [
"Gradient",
"for",
"MatrixSetDiagV2",
"."
] | def _MatrixSetDiagGradV2(op, grad):
"""Gradient for MatrixSetDiagV2."""
diag_shape = op.inputs[1].get_shape()
if not diag_shape.is_fully_defined():
# Need to know the values of `d_lower` and `d_upper` to infer diag_shape.
grad_shape = array_ops.shape(grad)
batch_shape = grad_shape[:-2]
matrix_shap... | [
"def",
"_MatrixSetDiagGradV2",
"(",
"op",
",",
"grad",
")",
":",
"diag_shape",
"=",
"op",
".",
"inputs",
"[",
"1",
"]",
".",
"get_shape",
"(",
")",
"if",
"not",
"diag_shape",
".",
"is_fully_defined",
"(",
")",
":",
"# Need to know the values of `d_lower` and `... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/array_grad.py#L452-L484 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/setuptools/command/build_ext.py | python | build_ext.run | (self) | Build extensions in build directory, then copy if --inplace | Build extensions in build directory, then copy if --inplace | [
"Build",
"extensions",
"in",
"build",
"directory",
"then",
"copy",
"if",
"--",
"inplace"
] | def run(self):
"""Build extensions in build directory, then copy if --inplace"""
old_inplace, self.inplace = self.inplace, 0
_build_ext.run(self)
self.inplace = old_inplace
if old_inplace:
self.copy_extensions_to_source() | [
"def",
"run",
"(",
"self",
")",
":",
"old_inplace",
",",
"self",
".",
"inplace",
"=",
"self",
".",
"inplace",
",",
"0",
"_build_ext",
".",
"run",
"(",
"self",
")",
"self",
".",
"inplace",
"=",
"old_inplace",
"if",
"old_inplace",
":",
"self",
".",
"co... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/setuptools/command/build_ext.py#L75-L81 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/the-kth-factor-of-n.py | python | Solution.kthFactor | (self, n, k) | return result if k <= count else n//result | :type n: int
:type k: int
:rtype: int | :type n: int
:type k: int
:rtype: int | [
":",
"type",
"n",
":",
"int",
":",
"type",
"k",
":",
"int",
":",
"rtype",
":",
"int"
] | def kthFactor(self, n, k):
"""
:type n: int
:type k: int
:rtype: int
"""
def kth_factor(n, k=0):
mid = None
i = 1
while i*i <= n:
if not n%i:
mid = i
k -= 1
if ... | [
"def",
"kthFactor",
"(",
"self",
",",
"n",
",",
"k",
")",
":",
"def",
"kth_factor",
"(",
"n",
",",
"k",
"=",
"0",
")",
":",
"mid",
"=",
"None",
"i",
"=",
"1",
"while",
"i",
"*",
"i",
"<=",
"n",
":",
"if",
"not",
"n",
"%",
"i",
":",
"mid",... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/the-kth-factor-of-n.py#L5-L28 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/setuptools/command/easy_install.py | python | expand_paths | (inputs) | Yield sys.path directories that might contain "old-style" packages | Yield sys.path directories that might contain "old-style" packages | [
"Yield",
"sys",
".",
"path",
"directories",
"that",
"might",
"contain",
"old",
"-",
"style",
"packages"
] | def expand_paths(inputs):
"""Yield sys.path directories that might contain "old-style" packages"""
seen = {}
for dirname in inputs:
dirname = normalize_path(dirname)
if dirname in seen:
continue
seen[dirname] = 1
if not os.path.isdir(dirname):
conti... | [
"def",
"expand_paths",
"(",
"inputs",
")",
":",
"seen",
"=",
"{",
"}",
"for",
"dirname",
"in",
"inputs",
":",
"dirname",
"=",
"normalize_path",
"(",
"dirname",
")",
"if",
"dirname",
"in",
"seen",
":",
"continue",
"seen",
"[",
"dirname",
"]",
"=",
"1",
... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/setuptools/command/easy_install.py#L1458-L1496 | ||
msoos/cryptominisat | 02f53d1fc045fdba53671306964d3d094feb949e | scripts/reconf/generate_reconf.py | python | query_yes_no | (question, default="no") | Ask a yes/no question via input() and return their answer.
"question" is a string that is presented to the user.
"default" is the presumed answer if the user just hits <Enter>.
It must be "yes" (the default), "no" or None (meaning
an answer is required of the user).
The "answer" return val... | Ask a yes/no question via input() and return their answer. | [
"Ask",
"a",
"yes",
"/",
"no",
"question",
"via",
"input",
"()",
"and",
"return",
"their",
"answer",
"."
] | def query_yes_no(question, default="no"):
"""Ask a yes/no question via input() and return their answer.
"question" is a string that is presented to the user.
"default" is the presumed answer if the user just hits <Enter>.
It must be "yes" (the default), "no" or None (meaning
an answer is re... | [
"def",
"query_yes_no",
"(",
"question",
",",
"default",
"=",
"\"no\"",
")",
":",
"valid",
"=",
"{",
"\"yes\"",
":",
"True",
",",
"\"y\"",
":",
"True",
",",
"\"ye\"",
":",
"True",
",",
"\"no\"",
":",
"False",
",",
"\"n\"",
":",
"False",
"}",
"if",
"... | https://github.com/msoos/cryptominisat/blob/02f53d1fc045fdba53671306964d3d094feb949e/scripts/reconf/generate_reconf.py#L27-L57 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/stc.py | python | StyledTextCtrl.StyleClearAll | (*args, **kwargs) | return _stc.StyledTextCtrl_StyleClearAll(*args, **kwargs) | StyleClearAll(self)
Clear all the styles and make equivalent to the global default style. | StyleClearAll(self) | [
"StyleClearAll",
"(",
"self",
")"
] | def StyleClearAll(*args, **kwargs):
"""
StyleClearAll(self)
Clear all the styles and make equivalent to the global default style.
"""
return _stc.StyledTextCtrl_StyleClearAll(*args, **kwargs) | [
"def",
"StyleClearAll",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_StyleClearAll",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/stc.py#L2506-L2512 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/cpplint.py | python | _FilterExcludedFiles | (fnames) | return [f for f in fnames
if not any(e for e in exclude_paths
if _IsParentOrSame(e, os.path.abspath(f)))] | Filters out files listed in the --exclude command line switch. File paths
in the switch are evaluated relative to the current working directory | Filters out files listed in the --exclude command line switch. File paths
in the switch are evaluated relative to the current working directory | [
"Filters",
"out",
"files",
"listed",
"in",
"the",
"--",
"exclude",
"command",
"line",
"switch",
".",
"File",
"paths",
"in",
"the",
"switch",
"are",
"evaluated",
"relative",
"to",
"the",
"current",
"working",
"directory"
] | def _FilterExcludedFiles(fnames):
"""Filters out files listed in the --exclude command line switch. File paths
in the switch are evaluated relative to the current working directory
"""
exclude_paths = [os.path.abspath(f) for f in _excludes]
# because globbing does not work recursively, exclude all subpath of ... | [
"def",
"_FilterExcludedFiles",
"(",
"fnames",
")",
":",
"exclude_paths",
"=",
"[",
"os",
".",
"path",
".",
"abspath",
"(",
"f",
")",
"for",
"f",
"in",
"_excludes",
"]",
"# because globbing does not work recursively, exclude all subpath of all excluded entries",
"return"... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/cpplint.py#L6945-L6953 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/distributed/distributed_c10d.py | python | _rank_not_in_group | (group: ProcessGroup) | return group == GroupMember.NON_GROUP_MEMBER | Helper that checks if the current process's rank is not in a given group. | Helper that checks if the current process's rank is not in a given group. | [
"Helper",
"that",
"checks",
"if",
"the",
"current",
"process",
"s",
"rank",
"is",
"not",
"in",
"a",
"given",
"group",
"."
] | def _rank_not_in_group(group: ProcessGroup):
"""
Helper that checks if the current process's rank is not in a given group.
"""
if group is None:
return False
return group == GroupMember.NON_GROUP_MEMBER | [
"def",
"_rank_not_in_group",
"(",
"group",
":",
"ProcessGroup",
")",
":",
"if",
"group",
"is",
"None",
":",
"return",
"False",
"return",
"group",
"==",
"GroupMember",
".",
"NON_GROUP_MEMBER"
] | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/distributed/distributed_c10d.py#L267-L273 | |
ucb-bar/esp-llvm | 8aec2ae754fd66d4e73b9b777a9f20c4583a0f03 | utils/llvm-build/llvmbuild/main.py | python | LLVMProjectInfo.write_cmake_fragment | (self, output_path, enabled_optional_components) | write_cmake_fragment(output_path) -> None
Generate a CMake fragment which includes all of the collated LLVMBuild
information in a format that is easily digestible by a CMake. The exact
contents of this are closely tied to how the CMake configuration
integrates LLVMBuild, see CMakeLists.... | write_cmake_fragment(output_path) -> None | [
"write_cmake_fragment",
"(",
"output_path",
")",
"-",
">",
"None"
] | def write_cmake_fragment(self, output_path, enabled_optional_components):
"""
write_cmake_fragment(output_path) -> None
Generate a CMake fragment which includes all of the collated LLVMBuild
information in a format that is easily digestible by a CMake. The exact
contents of this... | [
"def",
"write_cmake_fragment",
"(",
"self",
",",
"output_path",
",",
"enabled_optional_components",
")",
":",
"dependencies",
"=",
"list",
"(",
"self",
".",
"get_fragment_dependencies",
"(",
")",
")",
"# Write out the CMake fragment.",
"make_install_dir",
"(",
"os",
"... | https://github.com/ucb-bar/esp-llvm/blob/8aec2ae754fd66d4e73b9b777a9f20c4583a0f03/utils/llvm-build/llvmbuild/main.py#L535-L616 | ||
crosslife/OpenBird | 9e0198a1a2295f03fa1e8676e216e22c9c7d380b | cocos2d/tools/bindings-generator/clang/cindex.py | python | Cursor.semantic_parent | (self) | return self._semantic_parent | Return the semantic parent for this cursor. | Return the semantic parent for this cursor. | [
"Return",
"the",
"semantic",
"parent",
"for",
"this",
"cursor",
"."
] | def semantic_parent(self):
"""Return the semantic parent for this cursor."""
if not hasattr(self, '_semantic_parent'):
self._semantic_parent = conf.lib.clang_getCursorSemanticParent(self)
return self._semantic_parent | [
"def",
"semantic_parent",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_semantic_parent'",
")",
":",
"self",
".",
"_semantic_parent",
"=",
"conf",
".",
"lib",
".",
"clang_getCursorSemanticParent",
"(",
"self",
")",
"return",
"self",
"."... | https://github.com/crosslife/OpenBird/blob/9e0198a1a2295f03fa1e8676e216e22c9c7d380b/cocos2d/tools/bindings-generator/clang/cindex.py#L1400-L1405 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/grid.py | python | GridEditorCreatedEvent.SetCol | (*args, **kwargs) | return _grid.GridEditorCreatedEvent_SetCol(*args, **kwargs) | SetCol(self, int col) | SetCol(self, int col) | [
"SetCol",
"(",
"self",
"int",
"col",
")"
] | def SetCol(*args, **kwargs):
"""SetCol(self, int col)"""
return _grid.GridEditorCreatedEvent_SetCol(*args, **kwargs) | [
"def",
"SetCol",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"GridEditorCreatedEvent_SetCol",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/grid.py#L2483-L2485 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | mlir/python/mlir/dialects/_pdl_ops_ext.py | python | _get_int_attr | (bits: int, value: Union[IntegerAttr, int]) | Converts the given value to signless integer attribute of given bit width. | Converts the given value to signless integer attribute of given bit width. | [
"Converts",
"the",
"given",
"value",
"to",
"signless",
"integer",
"attribute",
"of",
"given",
"bit",
"width",
"."
] | def _get_int_attr(bits: int, value: Union[IntegerAttr, int]) -> IntegerAttr:
"""Converts the given value to signless integer attribute of given bit width."""
if isinstance(value, int):
ty = IntegerType.get_signless(bits)
return IntegerAttr.get(ty, value)
else:
return value | [
"def",
"_get_int_attr",
"(",
"bits",
":",
"int",
",",
"value",
":",
"Union",
"[",
"IntegerAttr",
",",
"int",
"]",
")",
"->",
"IntegerAttr",
":",
"if",
"isinstance",
"(",
"value",
",",
"int",
")",
":",
"ty",
"=",
"IntegerType",
".",
"get_signless",
"(",... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/mlir/python/mlir/dialects/_pdl_ops_ext.py#L15-L21 | ||
openai/atari-py | b0117f704919ed4cbbd5addcec5ec1b0fb3bff99 | atari_py/ale_python_interface.py | python | ALEInterface.getRAM | (self, ram=None) | return ram | This function grabs the atari RAM.
ram MUST be a numpy array of uint8/int8. This can be initialized like so:
ram = np.array(ram_size, dtype=uint8)
Notice: It must be ram_size where ram_size can be retrieved via the getRAMSize function.
If it is None, then this function will initialize i... | This function grabs the atari RAM.
ram MUST be a numpy array of uint8/int8. This can be initialized like so:
ram = np.array(ram_size, dtype=uint8)
Notice: It must be ram_size where ram_size can be retrieved via the getRAMSize function.
If it is None, then this function will initialize i... | [
"This",
"function",
"grabs",
"the",
"atari",
"RAM",
".",
"ram",
"MUST",
"be",
"a",
"numpy",
"array",
"of",
"uint8",
"/",
"int8",
".",
"This",
"can",
"be",
"initialized",
"like",
"so",
":",
"ram",
"=",
"np",
".",
"array",
"(",
"ram_size",
"dtype",
"="... | def getRAM(self, ram=None):
"""This function grabs the atari RAM.
ram MUST be a numpy array of uint8/int8. This can be initialized like so:
ram = np.array(ram_size, dtype=uint8)
Notice: It must be ram_size where ram_size can be retrieved via the getRAMSize function.
If it is None... | [
"def",
"getRAM",
"(",
"self",
",",
"ram",
"=",
"None",
")",
":",
"if",
"(",
"ram",
"is",
"None",
")",
":",
"ram_size",
"=",
"ale_lib",
".",
"getRAMSize",
"(",
"self",
".",
"obj",
")",
"ram",
"=",
"np",
".",
"zeros",
"(",
"ram_size",
",",
"dtype",... | https://github.com/openai/atari-py/blob/b0117f704919ed4cbbd5addcec5ec1b0fb3bff99/atari_py/ale_python_interface.py#L285-L296 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/archive_util.py | python | unpack_archive | (
filename, extract_dir, progress_filter=default_filter,
drivers=None) | Unpack `filename` to `extract_dir`, or raise ``UnrecognizedFormat``
`progress_filter` is a function taking two arguments: a source path
internal to the archive ('/'-separated), and a filesystem path where it
will be extracted. The callback must return the desired extract path
(which may be the same as... | Unpack `filename` to `extract_dir`, or raise ``UnrecognizedFormat`` | [
"Unpack",
"filename",
"to",
"extract_dir",
"or",
"raise",
"UnrecognizedFormat"
] | def unpack_archive(
filename, extract_dir, progress_filter=default_filter,
drivers=None):
"""Unpack `filename` to `extract_dir`, or raise ``UnrecognizedFormat``
`progress_filter` is a function taking two arguments: a source path
internal to the archive ('/'-separated), and a filesystem path... | [
"def",
"unpack_archive",
"(",
"filename",
",",
"extract_dir",
",",
"progress_filter",
"=",
"default_filter",
",",
"drivers",
"=",
"None",
")",
":",
"for",
"driver",
"in",
"drivers",
"or",
"extraction_drivers",
":",
"try",
":",
"driver",
"(",
"filename",
",",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/archive_util.py#L28-L61 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/html.py | python | HtmlBookRecord.GetBasePath | (*args, **kwargs) | return _html.HtmlBookRecord_GetBasePath(*args, **kwargs) | GetBasePath(self) -> String | GetBasePath(self) -> String | [
"GetBasePath",
"(",
"self",
")",
"-",
">",
"String"
] | def GetBasePath(*args, **kwargs):
"""GetBasePath(self) -> String"""
return _html.HtmlBookRecord_GetBasePath(*args, **kwargs) | [
"def",
"GetBasePath",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlBookRecord_GetBasePath",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/html.py#L1423-L1425 | |
irods/irods | ed6328646cee87182098d569919004049bf4ce21 | scripts/irods/pyparsing.py | python | countedArray | ( expr, intExpr=None ) | return ( intExpr + arrayExpr ).setName('(len) ' + _ustr(expr) + '...') | Helper to define a counted list of expressions.
This helper defines a pattern of the form::
integer expr expr expr...
where the leading integer tells how many expr expressions follow.
The matched tokens returns the array of expr tokens as a list - the leading count token is suppressed. | Helper to define a counted list of expressions.
This helper defines a pattern of the form::
integer expr expr expr...
where the leading integer tells how many expr expressions follow.
The matched tokens returns the array of expr tokens as a list - the leading count token is suppressed. | [
"Helper",
"to",
"define",
"a",
"counted",
"list",
"of",
"expressions",
".",
"This",
"helper",
"defines",
"a",
"pattern",
"of",
"the",
"form",
"::",
"integer",
"expr",
"expr",
"expr",
"...",
"where",
"the",
"leading",
"integer",
"tells",
"how",
"many",
"exp... | def countedArray( expr, intExpr=None ):
"""Helper to define a counted list of expressions.
This helper defines a pattern of the form::
integer expr expr expr...
where the leading integer tells how many expr expressions follow.
The matched tokens returns the array of expr tokens as a ... | [
"def",
"countedArray",
"(",
"expr",
",",
"intExpr",
"=",
"None",
")",
":",
"arrayExpr",
"=",
"Forward",
"(",
")",
"def",
"countFieldParseAction",
"(",
"s",
",",
"l",
",",
"t",
")",
":",
"n",
"=",
"t",
"[",
"0",
"]",
"arrayExpr",
"<<",
"(",
"n",
"... | https://github.com/irods/irods/blob/ed6328646cee87182098d569919004049bf4ce21/scripts/irods/pyparsing.py#L3218-L3236 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.