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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
vioshyvo/mrpt | 88cc6f40782ca0f8de7491279766ded01d767861 | utils/binary_converter.py | python | fvecs_to_binary | (fname, out, n=-1) | Convert a fvecs file to binary format.
The fvecs format is used in e.g. http://corpus-texmex.irisa.fr/
:param fname: path to the fvecs file
:param out: path to the output file
:param matrix: name of the matrix being converted in the RData
:param n: write only the first n rows, or -1 for all rows | Convert a fvecs file to binary format.
The fvecs format is used in e.g. http://corpus-texmex.irisa.fr/
:param fname: path to the fvecs file
:param out: path to the output file
:param matrix: name of the matrix being converted in the RData
:param n: write only the first n rows, or -1 for all rows | [
"Convert",
"a",
"fvecs",
"file",
"to",
"binary",
"format",
".",
"The",
"fvecs",
"format",
"is",
"used",
"in",
"e",
".",
"g",
".",
"http",
":",
"//",
"corpus",
"-",
"texmex",
".",
"irisa",
".",
"fr",
"/",
":",
"param",
"fname",
":",
"path",
"to",
... | def fvecs_to_binary(fname, out, n=-1):
"""
Convert a fvecs file to binary format.
The fvecs format is used in e.g. http://corpus-texmex.irisa.fr/
:param fname: path to the fvecs file
:param out: path to the output file
:param matrix: name of the matrix being converted in the RData
:param n: ... | [
"def",
"fvecs_to_binary",
"(",
"fname",
",",
"out",
",",
"n",
"=",
"-",
"1",
")",
":",
"sz",
"=",
"os",
".",
"path",
".",
"getsize",
"(",
"fname",
")",
"with",
"open",
"(",
"fname",
",",
"'rb'",
")",
"as",
"inp",
":",
"dim",
"=",
"struct",
".",... | https://github.com/vioshyvo/mrpt/blob/88cc6f40782ca0f8de7491279766ded01d767861/utils/binary_converter.py#L83-L105 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | caffe2/python/dyndep.py | python | InitOpsLibrary | (name, trigger_lazy=True) | Loads a dynamic library that contains custom operators into Caffe2.
Since Caffe2 uses static variable registration, you can optionally load a
separate .so file that contains custom operators and registers that into
the caffe2 core binary. In C++, this is usually done by either declaring
dependency duri... | Loads a dynamic library that contains custom operators into Caffe2. | [
"Loads",
"a",
"dynamic",
"library",
"that",
"contains",
"custom",
"operators",
"into",
"Caffe2",
"."
] | def InitOpsLibrary(name, trigger_lazy=True):
"""Loads a dynamic library that contains custom operators into Caffe2.
Since Caffe2 uses static variable registration, you can optionally load a
separate .so file that contains custom operators and registers that into
the caffe2 core binary. In C++, this is ... | [
"def",
"InitOpsLibrary",
"(",
"name",
",",
"trigger_lazy",
"=",
"True",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"name",
")",
":",
"# Note(jiayq): if the name does not exist, instead of immediately",
"# failing we will simply print a warning, deferrin... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/python/dyndep.py#L14-L35 | ||
jackaudio/jack2 | 21b293dbc37d42446141a08922cdec0d2550c6a0 | waflib/ConfigSet.py | python | ConfigSet.__str__ | (self) | return "\n".join(["%r %r" % (x, self.__getitem__(x)) for x in self.keys()]) | Text representation of the ConfigSet (for debugging purposes) | Text representation of the ConfigSet (for debugging purposes) | [
"Text",
"representation",
"of",
"the",
"ConfigSet",
"(",
"for",
"debugging",
"purposes",
")"
] | def __str__(self):
"""Text representation of the ConfigSet (for debugging purposes)"""
return "\n".join(["%r %r" % (x, self.__getitem__(x)) for x in self.keys()]) | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"\"\\n\"",
".",
"join",
"(",
"[",
"\"%r %r\"",
"%",
"(",
"x",
",",
"self",
".",
"__getitem__",
"(",
"x",
")",
")",
"for",
"x",
"in",
"self",
".",
"keys",
"(",
")",
"]",
")"
] | https://github.com/jackaudio/jack2/blob/21b293dbc37d42446141a08922cdec0d2550c6a0/waflib/ConfigSet.py#L68-L70 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/stc.py | python | StyledTextCtrl.SetPrintMagnification | (*args, **kwargs) | return _stc.StyledTextCtrl_SetPrintMagnification(*args, **kwargs) | SetPrintMagnification(self, int magnification)
Sets the print magnification added to the point size of each style for printing. | SetPrintMagnification(self, int magnification) | [
"SetPrintMagnification",
"(",
"self",
"int",
"magnification",
")"
] | def SetPrintMagnification(*args, **kwargs):
"""
SetPrintMagnification(self, int magnification)
Sets the print magnification added to the point size of each style for printing.
"""
return _stc.StyledTextCtrl_SetPrintMagnification(*args, **kwargs) | [
"def",
"SetPrintMagnification",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_SetPrintMagnification",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/stc.py#L3464-L3470 | |
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | python/mxnet/image/image.py | python | LightingAug.__call__ | (self, src) | return src | Augmenter body | Augmenter body | [
"Augmenter",
"body"
] | def __call__(self, src):
"""Augmenter body"""
alpha = np.random.normal(0, self.alphastd, size=(3,))
rgb = np.dot(self.eigvec * alpha, self.eigval)
src += nd.array(rgb)
return src | [
"def",
"__call__",
"(",
"self",
",",
"src",
")",
":",
"alpha",
"=",
"np",
".",
"random",
".",
"normal",
"(",
"0",
",",
"self",
".",
"alphastd",
",",
"size",
"=",
"(",
"3",
",",
")",
")",
"rgb",
"=",
"np",
".",
"dot",
"(",
"self",
".",
"eigvec... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/image/image.py#L804-L809 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/ftplib.py | python | Netrc.get_hosts | (self) | return self.__hosts.keys() | Return a list of hosts mentioned in the .netrc file. | Return a list of hosts mentioned in the .netrc file. | [
"Return",
"a",
"list",
"of",
"hosts",
"mentioned",
"in",
"the",
".",
"netrc",
"file",
"."
] | def get_hosts(self):
"""Return a list of hosts mentioned in the .netrc file."""
return self.__hosts.keys() | [
"def",
"get_hosts",
"(",
"self",
")",
":",
"return",
"self",
".",
"__hosts",
".",
"keys",
"(",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/ftplib.py#L769-L771 | |
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | libs/lv2/lv2specgen/lv2specgen.py | python | specProperties | (m, subject, predicate) | return properties | Return a property of the spec. | Return a property of the spec. | [
"Return",
"a",
"property",
"of",
"the",
"spec",
"."
] | def specProperties(m, subject, predicate):
"Return a property of the spec."
properties = []
for c in findStatements(m, subject, predicate, None):
properties += [getObject(c)]
return properties | [
"def",
"specProperties",
"(",
"m",
",",
"subject",
",",
"predicate",
")",
":",
"properties",
"=",
"[",
"]",
"for",
"c",
"in",
"findStatements",
"(",
"m",
",",
"subject",
",",
"predicate",
",",
"None",
")",
":",
"properties",
"+=",
"[",
"getObject",
"("... | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/libs/lv2/lv2specgen/lv2specgen.py#L881-L886 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/checkdeps/checkdeps.py | python | DepsChecker.CheckDirectory | (self, start_dir) | Checks all relevant source files in the specified directory and
its subdirectories for compliance with DEPS rules throughout the
tree (starting at |self.base_directory|). |start_dir| must be a
subdirectory of |self.base_directory|.
On completion, self.results_formatter has the results of
processin... | Checks all relevant source files in the specified directory and
its subdirectories for compliance with DEPS rules throughout the
tree (starting at |self.base_directory|). |start_dir| must be a
subdirectory of |self.base_directory|. | [
"Checks",
"all",
"relevant",
"source",
"files",
"in",
"the",
"specified",
"directory",
"and",
"its",
"subdirectories",
"for",
"compliance",
"with",
"DEPS",
"rules",
"throughout",
"the",
"tree",
"(",
"starting",
"at",
"|self",
".",
"base_directory|",
")",
".",
... | def CheckDirectory(self, start_dir):
"""Checks all relevant source files in the specified directory and
its subdirectories for compliance with DEPS rules throughout the
tree (starting at |self.base_directory|). |start_dir| must be a
subdirectory of |self.base_directory|.
On completion, self.result... | [
"def",
"CheckDirectory",
"(",
"self",
",",
"start_dir",
")",
":",
"java",
"=",
"java_checker",
".",
"JavaChecker",
"(",
"self",
".",
"base_directory",
",",
"self",
".",
"verbose",
")",
"cpp",
"=",
"cpp_checker",
".",
"CppChecker",
"(",
"self",
".",
"verbos... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/checkdeps/checkdeps.py#L68-L82 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/timeline/memory_dump_event.py | python | GlobalMemoryDump.GetMemoryUsage | (self) | return result | Get the aggregated memory usage over all processes in this dump. | Get the aggregated memory usage over all processes in this dump. | [
"Get",
"the",
"aggregated",
"memory",
"usage",
"over",
"all",
"processes",
"in",
"this",
"dump",
"."
] | def GetMemoryUsage(self):
"""Get the aggregated memory usage over all processes in this dump."""
result = {}
for dump in self._process_dumps:
for key, value in dump.GetMemoryUsage().iteritems():
result[key] = result.get(key, 0) + value
return result | [
"def",
"GetMemoryUsage",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"for",
"dump",
"in",
"self",
".",
"_process_dumps",
":",
"for",
"key",
",",
"value",
"in",
"dump",
".",
"GetMemoryUsage",
"(",
")",
".",
"iteritems",
"(",
")",
":",
"result",
"[... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/timeline/memory_dump_event.py#L337-L343 | |
alibaba/weex_js_engine | 2bdf4b6f020c1fc99c63f649718f6faf7e27fdde | jni/v8core/v8/build/gyp/pylib/gyp/MSVSVersion.py | python | VisualStudioVersion.ProjectExtension | (self) | return self.uses_vcxproj and '.vcxproj' or '.vcproj' | Returns the file extension for the project. | Returns the file extension for the project. | [
"Returns",
"the",
"file",
"extension",
"for",
"the",
"project",
"."
] | def ProjectExtension(self):
"""Returns the file extension for the project."""
return self.uses_vcxproj and '.vcxproj' or '.vcproj' | [
"def",
"ProjectExtension",
"(",
"self",
")",
":",
"return",
"self",
".",
"uses_vcxproj",
"and",
"'.vcxproj'",
"or",
"'.vcproj'"
] | https://github.com/alibaba/weex_js_engine/blob/2bdf4b6f020c1fc99c63f649718f6faf7e27fdde/jni/v8core/v8/build/gyp/pylib/gyp/MSVSVersion.py#L53-L55 | |
bumptop/BumpTop | 466d23597a07ae738f4265262fa01087fc6e257c | trunk/win/Source/bin/jinja2/filters.py | python | do_join | (environment, value, d=u'') | return soft_unicode(d).join(imap(soft_unicode, value)) | Return a string which is the concatenation of the strings in the
sequence. The separator between elements is an empty string per
default, you can define it with the optional parameter:
.. sourcecode:: jinja
{{ [1, 2, 3]|join('|') }}
-> 1|2|3
{{ [1, 2, 3]|join }}
->... | Return a string which is the concatenation of the strings in the
sequence. The separator between elements is an empty string per
default, you can define it with the optional parameter: | [
"Return",
"a",
"string",
"which",
"is",
"the",
"concatenation",
"of",
"the",
"strings",
"in",
"the",
"sequence",
".",
"The",
"separator",
"between",
"elements",
"is",
"an",
"empty",
"string",
"per",
"default",
"you",
"can",
"define",
"it",
"with",
"the",
"... | def do_join(environment, value, d=u''):
"""Return a string which is the concatenation of the strings in the
sequence. The separator between elements is an empty string per
default, you can define it with the optional parameter:
.. sourcecode:: jinja
{{ [1, 2, 3]|join('|') }}
-> 1|2... | [
"def",
"do_join",
"(",
"environment",
",",
"value",
",",
"d",
"=",
"u''",
")",
":",
"# no automatic escaping? joining is a lot eaiser then",
"if",
"not",
"environment",
".",
"autoescape",
":",
"return",
"unicode",
"(",
"d",
")",
".",
"join",
"(",
"imap",
"(",... | https://github.com/bumptop/BumpTop/blob/466d23597a07ae738f4265262fa01087fc6e257c/trunk/win/Source/bin/jinja2/filters.py#L216-L250 | |
ApolloAuto/apollo | 463fb82f9e979d02dcb25044e60931293ab2dba0 | modules/tools/routing/debug_passage_region.py | python | plot_lane_change | (lane_change, passage_regions) | Plot lane change information | Plot lane change information | [
"Plot",
"lane",
"change",
"information"
] | def plot_lane_change(lane_change, passage_regions):
"""Plot lane change information"""
st_idx = lane_change.start_passage_region_index
ed_idx = lane_change.end_passage_region_index
from_pt = get_center_of_passage_region(passage_regions[st_idx])
to_pt = get_center_of_passage_region(passage_regions[ed... | [
"def",
"plot_lane_change",
"(",
"lane_change",
",",
"passage_regions",
")",
":",
"st_idx",
"=",
"lane_change",
".",
"start_passage_region_index",
"ed_idx",
"=",
"lane_change",
".",
"end_passage_region_index",
"from_pt",
"=",
"get_center_of_passage_region",
"(",
"passage_r... | https://github.com/ApolloAuto/apollo/blob/463fb82f9e979d02dcb25044e60931293ab2dba0/modules/tools/routing/debug_passage_region.py#L53-L64 | ||
brave/muon | 43661f9a8ceefda8e3aba0e8944a72995aa53281 | vendor/native_mate/script/pump.py | python | Cursor.Clone | (self) | return Cursor(self.line, self.column) | Returns a copy of self. | Returns a copy of self. | [
"Returns",
"a",
"copy",
"of",
"self",
"."
] | def Clone(self):
"""Returns a copy of self."""
return Cursor(self.line, self.column) | [
"def",
"Clone",
"(",
"self",
")",
":",
"return",
"Cursor",
"(",
"self",
".",
"line",
",",
"self",
".",
"column",
")"
] | https://github.com/brave/muon/blob/43661f9a8ceefda8e3aba0e8944a72995aa53281/vendor/native_mate/script/pump.py#L125-L128 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/common/utils.py | python | clean_stale_pycs | (base_folder) | Perform simple stale pyc housekeeping (pyc files that dont have the source .py) since there are cases where
:param base_folder: The folder to recurse into and clean up the stale pyc files | Perform simple stale pyc housekeeping (pyc files that dont have the source .py) since there are cases where
:param base_folder: The folder to recurse into and clean up the stale pyc files | [
"Perform",
"simple",
"stale",
"pyc",
"housekeeping",
"(",
"pyc",
"files",
"that",
"dont",
"have",
"the",
"source",
".",
"py",
")",
"since",
"there",
"are",
"cases",
"where",
":",
"param",
"base_folder",
":",
"The",
"folder",
"to",
"recurse",
"into",
"and",... | def clean_stale_pycs(base_folder):
"""
Perform simple stale pyc housekeeping (pyc files that dont have the source .py) since there are cases where
:param base_folder: The folder to recurse into and clean up the stale pyc files
"""
# Recurse through the package folder
for root, _, files in o... | [
"def",
"clean_stale_pycs",
"(",
"base_folder",
")",
":",
"# Recurse through the package folder",
"for",
"root",
",",
"_",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"base_folder",
",",
"topdown",
"=",
"True",
")",
":",
"for",
"file",
"in",
"files",
":",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/common/utils.py#L14-L28 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib2to3/pytree.py | python | LeafPattern.__init__ | (self, type=None, content=None, name=None) | Initializer. Takes optional type, content, and name.
The type, if given must be a token type (< 256). If not given,
this matches any *leaf* node; the content may still be required.
The content, if given, must be a string.
If a name is given, the matching node is stored in the result... | Initializer. Takes optional type, content, and name. | [
"Initializer",
".",
"Takes",
"optional",
"type",
"content",
"and",
"name",
"."
] | def __init__(self, type=None, content=None, name=None):
"""
Initializer. Takes optional type, content, and name.
The type, if given must be a token type (< 256). If not given,
this matches any *leaf* node; the content may still be required.
The content, if given, must be a st... | [
"def",
"__init__",
"(",
"self",
",",
"type",
"=",
"None",
",",
"content",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"type",
"is",
"not",
"None",
":",
"assert",
"0",
"<=",
"type",
"<",
"256",
",",
"type",
"if",
"content",
"is",
"not",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib2to3/pytree.py#L536-L554 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/confusion_matrix.py | python | remove_squeezable_dimensions | (
labels, predictions, expected_rank_diff=0, name=None) | Squeeze last dim if ranks differ from expected by exactly 1.
In the common case where we expect shapes to match, `expected_rank_diff`
defaults to 0, and we squeeze the last dimension of the larger rank if they
differ by 1.
But, for example, if `labels` contains class IDs and `predictions` contains 1
probabi... | Squeeze last dim if ranks differ from expected by exactly 1. | [
"Squeeze",
"last",
"dim",
"if",
"ranks",
"differ",
"from",
"expected",
"by",
"exactly",
"1",
"."
] | def remove_squeezable_dimensions(
labels, predictions, expected_rank_diff=0, name=None):
"""Squeeze last dim if ranks differ from expected by exactly 1.
In the common case where we expect shapes to match, `expected_rank_diff`
defaults to 0, and we squeeze the last dimension of the larger rank if they
diffe... | [
"def",
"remove_squeezable_dimensions",
"(",
"labels",
",",
"predictions",
",",
"expected_rank_diff",
"=",
"0",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"'remove_squeezable_dimensions'",
",",
"[",
"labels",
",",
"p... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/confusion_matrix.py#L33-L90 | ||
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/sfm/OpenSfM/opensfm/types.py | python | FisheyeCamera.pixel_bearing_many | (self, pixels) | return np.column_stack((x / l, y / l, 1.0 / l)) | Unit vector pointing to the pixel viewing directions. | Unit vector pointing to the pixel viewing directions. | [
"Unit",
"vector",
"pointing",
"to",
"the",
"pixel",
"viewing",
"directions",
"."
] | def pixel_bearing_many(self, pixels):
"""Unit vector pointing to the pixel viewing directions."""
points = pixels.reshape((-1, 1, 2)).astype(np.float64)
distortion = np.array([self.k1, self.k2, 0., 0.])
up = cv2.fisheye.undistortPoints(points, self.get_K(), distortion)
up = up.re... | [
"def",
"pixel_bearing_many",
"(",
"self",
",",
"pixels",
")",
":",
"points",
"=",
"pixels",
".",
"reshape",
"(",
"(",
"-",
"1",
",",
"1",
",",
"2",
")",
")",
".",
"astype",
"(",
"np",
".",
"float64",
")",
"distortion",
"=",
"np",
".",
"array",
"(... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/sfm/OpenSfM/opensfm/types.py#L487-L496 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/stats/morestats.py | python | yeojohnson_normplot | (x, la, lb, plot=None, N=80) | return _normplot('yeojohnson', x, la, lb, plot, N) | Compute parameters for a Yeo-Johnson normality plot, optionally show it.
A Yeo-Johnson normality plot shows graphically what the best
transformation parameter is to use in `yeojohnson` to obtain a
distribution that is close to normal.
Parameters
----------
x : array_like
Input array.
... | Compute parameters for a Yeo-Johnson normality plot, optionally show it. | [
"Compute",
"parameters",
"for",
"a",
"Yeo",
"-",
"Johnson",
"normality",
"plot",
"optionally",
"show",
"it",
"."
] | def yeojohnson_normplot(x, la, lb, plot=None, N=80):
"""Compute parameters for a Yeo-Johnson normality plot, optionally show it.
A Yeo-Johnson normality plot shows graphically what the best
transformation parameter is to use in `yeojohnson` to obtain a
distribution that is close to normal.
Paramet... | [
"def",
"yeojohnson_normplot",
"(",
"x",
",",
"la",
",",
"lb",
",",
"plot",
"=",
"None",
",",
"N",
"=",
"80",
")",
":",
"return",
"_normplot",
"(",
"'yeojohnson'",
",",
"x",
",",
"la",
",",
"lb",
",",
"plot",
",",
"N",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/stats/morestats.py#L1516-L1583 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/layer/activation.py | python | FastGelu.__init__ | (self) | Initialize FastGelu. | Initialize FastGelu. | [
"Initialize",
"FastGelu",
"."
] | def __init__(self):
"""Initialize FastGelu."""
super(FastGelu, self).__init__()
self.fast_gelu = P.FastGeLU() | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"FastGelu",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"fast_gelu",
"=",
"P",
".",
"FastGeLU",
"(",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/layer/activation.py#L558-L561 | ||
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py | python | xpathParserContext.xpathValueFlipSign | (self) | Implement the unary - operation on an XPath object The
numeric operators convert their operands to numbers as if
by calling the number function. | Implement the unary - operation on an XPath object The
numeric operators convert their operands to numbers as if
by calling the number function. | [
"Implement",
"the",
"unary",
"-",
"operation",
"on",
"an",
"XPath",
"object",
"The",
"numeric",
"operators",
"convert",
"their",
"operands",
"to",
"numbers",
"as",
"if",
"by",
"calling",
"the",
"number",
"function",
"."
] | def xpathValueFlipSign(self):
"""Implement the unary - operation on an XPath object The
numeric operators convert their operands to numbers as if
by calling the number function. """
libxml2mod.xmlXPathValueFlipSign(self._o) | [
"def",
"xpathValueFlipSign",
"(",
"self",
")",
":",
"libxml2mod",
".",
"xmlXPathValueFlipSign",
"(",
"self",
".",
"_o",
")"
] | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py#L7908-L7912 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/contrib/onnx/mx2onnx/export_onnx.py | python | MXNetGraph.get_outputs | (sym, params, in_shape, in_label) | return graph_outputs | Infer output shapes and return dictionary of output name to shape
:param :class:`~mxnet.symbol.Symbol` sym: symbol to perform infer shape on
:param dic of (str, nd.NDArray) params:
:param list of tuple(int, ...) in_shape: list of all input shapes
:param in_label: name of label typicall... | Infer output shapes and return dictionary of output name to shape | [
"Infer",
"output",
"shapes",
"and",
"return",
"dictionary",
"of",
"output",
"name",
"to",
"shape"
] | def get_outputs(sym, params, in_shape, in_label):
""" Infer output shapes and return dictionary of output name to shape
:param :class:`~mxnet.symbol.Symbol` sym: symbol to perform infer shape on
:param dic of (str, nd.NDArray) params:
:param list of tuple(int, ...) in_shape: list of all... | [
"def",
"get_outputs",
"(",
"sym",
",",
"params",
",",
"in_shape",
",",
"in_label",
")",
":",
"# remove any input listed in params from sym.list_inputs() and bind them to the input shapes provided",
"# by user. Also remove in_label, which is the name of the label symbol that may have been u... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/contrib/onnx/mx2onnx/export_onnx.py#L123-L156 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/demo/eiffel.py | python | EiffelBaseMetaClass.convert_methods | (cls, dict) | Replace functions in dict with EiffelMethod wrappers.
The dict is modified in place.
If a method ends in _pre or _post, it is removed from the dict
regardless of whether there is a corresponding method. | Replace functions in dict with EiffelMethod wrappers. | [
"Replace",
"functions",
"in",
"dict",
"with",
"EiffelMethod",
"wrappers",
"."
] | def convert_methods(cls, dict):
"""Replace functions in dict with EiffelMethod wrappers.
The dict is modified in place.
If a method ends in _pre or _post, it is removed from the dict
regardless of whether there is a corresponding method.
"""
# find methods with pre or p... | [
"def",
"convert_methods",
"(",
"cls",
",",
"dict",
")",
":",
"# find methods with pre or post conditions",
"methods",
"=",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"dict",
".",
"items",
"(",
")",
":",
"if",
"k",
".",
"endswith",
"(",
"'_pre'",
")",
"or",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/demo/eiffel.py#L20-L39 | ||
p4lang/p4c | 3272e79369f20813cc1a555a5eb26f44432f84a4 | tools/cpplint.py | python | _ShouldPrintError | (category, confidence, linenum) | return True | If confidence >= verbose, category passes filter and is not suppressed. | If confidence >= verbose, category passes filter and is not suppressed. | [
"If",
"confidence",
">",
"=",
"verbose",
"category",
"passes",
"filter",
"and",
"is",
"not",
"suppressed",
"."
] | def _ShouldPrintError(category, confidence, linenum):
"""If confidence >= verbose, category passes filter and is not suppressed."""
# There are three ways we might decide not to print an error message:
# a "NOLINT(category)" comment appears in the source,
# the verbosity level isn't high enough, or the filters... | [
"def",
"_ShouldPrintError",
"(",
"category",
",",
"confidence",
",",
"linenum",
")",
":",
"# There are three ways we might decide not to print an error message:",
"# a \"NOLINT(category)\" comment appears in the source,",
"# the verbosity level isn't high enough, or the filters filter it out... | https://github.com/p4lang/p4c/blob/3272e79369f20813cc1a555a5eb26f44432f84a4/tools/cpplint.py#L1658-L1683 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/grid.py | python | Grid.SetUseNativeColLabels | (*args, **kwargs) | return _grid.Grid_SetUseNativeColLabels(*args, **kwargs) | SetUseNativeColLabels(self, bool native=True) | SetUseNativeColLabels(self, bool native=True) | [
"SetUseNativeColLabels",
"(",
"self",
"bool",
"native",
"=",
"True",
")"
] | def SetUseNativeColLabels(*args, **kwargs):
"""SetUseNativeColLabels(self, bool native=True)"""
return _grid.Grid_SetUseNativeColLabels(*args, **kwargs) | [
"def",
"SetUseNativeColLabels",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"Grid_SetUseNativeColLabels",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/grid.py#L1534-L1536 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/logging/__init__.py | python | shutdown | (handlerList=_handlerList) | Perform any cleanup actions in the logging system (e.g. flushing
buffers).
Should be called at application exit. | Perform any cleanup actions in the logging system (e.g. flushing
buffers). | [
"Perform",
"any",
"cleanup",
"actions",
"in",
"the",
"logging",
"system",
"(",
"e",
".",
"g",
".",
"flushing",
"buffers",
")",
"."
] | def shutdown(handlerList=_handlerList):
"""
Perform any cleanup actions in the logging system (e.g. flushing
buffers).
Should be called at application exit.
"""
for wr in reversed(handlerList[:]):
#errors might occur, for example, if files are locked
#we just ignore them if rais... | [
"def",
"shutdown",
"(",
"handlerList",
"=",
"_handlerList",
")",
":",
"for",
"wr",
"in",
"reversed",
"(",
"handlerList",
"[",
":",
"]",
")",
":",
"#errors might occur, for example, if files are locked",
"#we just ignore them if raiseExceptions is not set",
"try",
":",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/logging/__init__.py#L1635-L1662 | ||
may0324/DeepCompression-caffe | 0aff6c1287bda4cfc7f378ed8a16524e1afabd8c | python/caffe/draw.py | python | get_layer_label | (layer, rankdir) | return node_label | Define node label based on layer type.
Parameters
----------
layer : ?
rankdir : {'LR', 'TB', 'BT'}
Direction of graph layout.
Returns
-------
string :
A label for the current layer | Define node label based on layer type. | [
"Define",
"node",
"label",
"based",
"on",
"layer",
"type",
"."
] | def get_layer_label(layer, rankdir):
"""Define node label based on layer type.
Parameters
----------
layer : ?
rankdir : {'LR', 'TB', 'BT'}
Direction of graph layout.
Returns
-------
string :
A label for the current layer
"""
if rankdir in ('TB', 'BT'):
... | [
"def",
"get_layer_label",
"(",
"layer",
",",
"rankdir",
")",
":",
"if",
"rankdir",
"in",
"(",
"'TB'",
",",
"'BT'",
")",
":",
"# If graph orientation is vertical, horizontal space is free and",
"# vertical space is not; separate words with spaces",
"separator",
"=",
"' '",
... | https://github.com/may0324/DeepCompression-caffe/blob/0aff6c1287bda4cfc7f378ed8a16524e1afabd8c/python/caffe/draw.py#L62-L114 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/longest-happy-string.py | python | Solution2.longestDiverseString | (self, a, b, c) | return "".join(result) | :type a: int
:type b: int
:type c: int
:rtype: str | :type a: int
:type b: int
:type c: int
:rtype: str | [
":",
"type",
"a",
":",
"int",
":",
"type",
"b",
":",
"int",
":",
"type",
"c",
":",
"int",
":",
"rtype",
":",
"str"
] | def longestDiverseString(self, a, b, c):
"""
:type a: int
:type b: int
:type c: int
:rtype: str
"""
choices = [[a, 'a'], [b, 'b'], [c, 'c']]
result = []
for _ in xrange(a+b+c):
choices.sort(reverse=True)
for i, (x, c) in enu... | [
"def",
"longestDiverseString",
"(",
"self",
",",
"a",
",",
"b",
",",
"c",
")",
":",
"choices",
"=",
"[",
"[",
"a",
",",
"'a'",
"]",
",",
"[",
"b",
",",
"'b'",
"]",
",",
"[",
"c",
",",
"'c'",
"]",
"]",
"result",
"=",
"[",
"]",
"for",
"_",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/longest-happy-string.py#L45-L63 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/get_relative_lib_dir.py | python | get_python_relative_libdir | () | return None | Returns the appropropriate python libdir relative to the build directory.
@param exe_path the path to the lldb executable
@return the python path that needs to be added to sys.path (PYTHONPATH)
in order to find the lldb python module. | Returns the appropropriate python libdir relative to the build directory. | [
"Returns",
"the",
"appropropriate",
"python",
"libdir",
"relative",
"to",
"the",
"build",
"directory",
"."
] | def get_python_relative_libdir():
"""Returns the appropropriate python libdir relative to the build directory.
@param exe_path the path to the lldb executable
@return the python path that needs to be added to sys.path (PYTHONPATH)
in order to find the lldb python module.
"""
if platform.system... | [
"def",
"get_python_relative_libdir",
"(",
")",
":",
"if",
"platform",
".",
"system",
"(",
")",
"!=",
"'Linux'",
":",
"return",
"None",
"# We currently have a bug in lldb -P that does not account for",
"# architecture variants in python paths for",
"# architecture-specific modules... | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/get_relative_lib_dir.py#L8-L36 | |
vusec/vuzzer64 | 2b1b0ed757a3dca114db0192fa4ab1add92348bc | fuzzer-code/gautils.py | python | createNextGeneration3 | (fit,gn) | return 0 | this funtion generates new generation. This is the implemntation of standard ilitism approach. We are also addressing "input bloating" issue by selecting inputs based on its length. the idea is to select inputs for crossover their lenths is less than the best input's length. Oterwise, such inputs directly go for mutat... | this funtion generates new generation. This is the implemntation of standard ilitism approach. We are also addressing "input bloating" issue by selecting inputs based on its length. the idea is to select inputs for crossover their lenths is less than the best input's length. Oterwise, such inputs directly go for mutat... | [
"this",
"funtion",
"generates",
"new",
"generation",
".",
"This",
"is",
"the",
"implemntation",
"of",
"standard",
"ilitism",
"approach",
".",
"We",
"are",
"also",
"addressing",
"input",
"bloating",
"issue",
"by",
"selecting",
"inputs",
"based",
"on",
"its",
"l... | def createNextGeneration3(fit,gn):
''' this funtion generates new generation. This is the implemntation of standard ilitism approach. We are also addressing "input bloating" issue by selecting inputs based on its length. the idea is to select inputs for crossover their lenths is less than the best input's length. ... | [
"def",
"createNextGeneration3",
"(",
"fit",
",",
"gn",
")",
":",
"files",
"=",
"os",
".",
"listdir",
"(",
"config",
".",
"INPUTD",
")",
"ga",
"=",
"operators",
".",
"GAoperator",
"(",
"random",
".",
"Random",
"(",
")",
",",
"config",
".",
"ALLSTRINGS",... | https://github.com/vusec/vuzzer64/blob/2b1b0ed757a3dca114db0192fa4ab1add92348bc/fuzzer-code/gautils.py#L239-L372 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/boost/boost_1_68_0/tools/build/src/build/virtual_target.py | python | add_prefix_and_suffix | (specified_name, type, property_set) | return prefix + specified_name + suffix | Appends the suffix appropriate to 'type/property-set' combination
to the specified name and returns the result. | Appends the suffix appropriate to 'type/property-set' combination
to the specified name and returns the result. | [
"Appends",
"the",
"suffix",
"appropriate",
"to",
"type",
"/",
"property",
"-",
"set",
"combination",
"to",
"the",
"specified",
"name",
"and",
"returns",
"the",
"result",
"."
] | def add_prefix_and_suffix(specified_name, type, property_set):
"""Appends the suffix appropriate to 'type/property-set' combination
to the specified name and returns the result."""
property_set = b2.util.jam_to_value_maybe(property_set)
suffix = ""
if type:
suffix = b2.build.type.generated... | [
"def",
"add_prefix_and_suffix",
"(",
"specified_name",
",",
"type",
",",
"property_set",
")",
":",
"property_set",
"=",
"b2",
".",
"util",
".",
"jam_to_value_maybe",
"(",
"property_set",
")",
"suffix",
"=",
"\"\"",
"if",
"type",
":",
"suffix",
"=",
"b2",
"."... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/boost/boost_1_68_0/tools/build/src/build/virtual_target.py#L610-L639 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/sidebar.py | python | LineNumbers.update_colors | (self) | Update the sidebar text colors, usually after config changes. | Update the sidebar text colors, usually after config changes. | [
"Update",
"the",
"sidebar",
"text",
"colors",
"usually",
"after",
"config",
"changes",
"."
] | def update_colors(self):
"""Update the sidebar text colors, usually after config changes."""
colors = idleConf.GetHighlight(idleConf.CurrentTheme(), 'linenumber')
self._update_colors(foreground=colors['foreground'],
background=colors['background']) | [
"def",
"update_colors",
"(",
"self",
")",
":",
"colors",
"=",
"idleConf",
".",
"GetHighlight",
"(",
"idleConf",
".",
"CurrentTheme",
"(",
")",
",",
"'linenumber'",
")",
"self",
".",
"_update_colors",
"(",
"foreground",
"=",
"colors",
"[",
"'foreground'",
"]"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/sidebar.py#L279-L283 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/distutils/ccompiler_opt.py | python | _Distutils.dist_compile | (self, sources, flags, ccompiler=None, **kwargs) | return ccompiler.compile(sources, extra_postargs=flags, **kwargs) | Wrap CCompiler.compile() | Wrap CCompiler.compile() | [
"Wrap",
"CCompiler",
".",
"compile",
"()"
] | def dist_compile(self, sources, flags, ccompiler=None, **kwargs):
"""Wrap CCompiler.compile()"""
assert(isinstance(sources, list))
assert(isinstance(flags, list))
flags = kwargs.pop("extra_postargs", []) + flags
if not ccompiler:
ccompiler = self._ccompiler
re... | [
"def",
"dist_compile",
"(",
"self",
",",
"sources",
",",
"flags",
",",
"ccompiler",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"(",
"isinstance",
"(",
"sources",
",",
"list",
")",
")",
"assert",
"(",
"isinstance",
"(",
"flags",
",",
"l... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/distutils/ccompiler_opt.py#L551-L558 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/http/server.py | python | BaseHTTPRequestHandler.version_string | (self) | return self.server_version + ' ' + self.sys_version | Return the server software version string. | Return the server software version string. | [
"Return",
"the",
"server",
"software",
"version",
"string",
"."
] | def version_string(self):
"""Return the server software version string."""
return self.server_version + ' ' + self.sys_version | [
"def",
"version_string",
"(",
"self",
")",
":",
"return",
"self",
".",
"server_version",
"+",
"' '",
"+",
"self",
".",
"sys_version"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/http/server.py#L582-L584 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/combo.py | python | ComboCtrl.DoShowPopup | (*args, **kwargs) | return _combo.ComboCtrl_DoShowPopup(*args, **kwargs) | DoShowPopup(self, Rect rect, int flags)
Shows and positions the popup.
Flags:
============ =====================================================
ShowBelow Showing popup below the control
ShowAbove Showing popup above the control
CanDeferShow Ca... | DoShowPopup(self, Rect rect, int flags) | [
"DoShowPopup",
"(",
"self",
"Rect",
"rect",
"int",
"flags",
")"
] | def DoShowPopup(*args, **kwargs):
"""
DoShowPopup(self, Rect rect, int flags)
Shows and positions the popup.
Flags:
============ =====================================================
ShowBelow Showing popup below the control
ShowAbove Showin... | [
"def",
"DoShowPopup",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_combo",
".",
"ComboCtrl_DoShowPopup",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/combo.py#L523-L537 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py | python | Decimal.adjusted | (self) | Return the adjusted exponent of self | Return the adjusted exponent of self | [
"Return",
"the",
"adjusted",
"exponent",
"of",
"self"
] | def adjusted(self):
"""Return the adjusted exponent of self"""
try:
return self._exp + len(self._int) - 1
# If NaN or Infinity, self._exp is string
except TypeError:
return 0 | [
"def",
"adjusted",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_exp",
"+",
"len",
"(",
"self",
".",
"_int",
")",
"-",
"1",
"# If NaN or Infinity, self._exp is string",
"except",
"TypeError",
":",
"return",
"0"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py#L2803-L2809 | ||
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/scripts/exodus3.in.py | python | exodus.num_dimensions | (self) | return self.numDim.value | get the number of model spatial dimensions
>>> num_dims = exo.num_dimensions()
Returns
-------
num_dims : <int | get the number of model spatial dimensions | [
"get",
"the",
"number",
"of",
"model",
"spatial",
"dimensions"
] | def num_dimensions(self):
"""
get the number of model spatial dimensions
>>> num_dims = exo.num_dimensions()
Returns
-------
num_dims : <int
"""
return self.numDim.value | [
"def",
"num_dimensions",
"(",
"self",
")",
":",
"return",
"self",
".",
"numDim",
".",
"value"
] | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exodus3.in.py#L1164-L1174 | |
yuxng/DA-RNN | 77fbb50b4272514588a10a9f90b7d5f8d46974fb | lib/fcn/config.py | python | get_output_dir | (imdb, net) | Return the directory where experimental artifacts are placed.
A canonical path is built using the name from an imdb and a network
(if not None). | Return the directory where experimental artifacts are placed. | [
"Return",
"the",
"directory",
"where",
"experimental",
"artifacts",
"are",
"placed",
"."
] | def get_output_dir(imdb, net):
"""Return the directory where experimental artifacts are placed.
A canonical path is built using the name from an imdb and a network
(if not None).
"""
path = osp.abspath(osp.join(__C.ROOT_DIR, 'output', __C.EXP_DIR, imdb.name))
if net is None:
return path... | [
"def",
"get_output_dir",
"(",
"imdb",
",",
"net",
")",
":",
"path",
"=",
"osp",
".",
"abspath",
"(",
"osp",
".",
"join",
"(",
"__C",
".",
"ROOT_DIR",
",",
"'output'",
",",
"__C",
".",
"EXP_DIR",
",",
"imdb",
".",
"name",
")",
")",
"if",
"net",
"i... | https://github.com/yuxng/DA-RNN/blob/77fbb50b4272514588a10a9f90b7d5f8d46974fb/lib/fcn/config.py#L118-L128 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/boost_1_66_0/tools/litre/cplusplus.py | python | CPlusPlusTranslator._execute | (self, code) | Override of litre._execute; sets up variable context before
evaluating code | Override of litre._execute; sets up variable context before
evaluating code | [
"Override",
"of",
"litre",
".",
"_execute",
";",
"sets",
"up",
"variable",
"context",
"before",
"evaluating",
"code"
] | def _execute(self, code):
"""Override of litre._execute; sets up variable context before
evaluating code
"""
self.globals['example'] = self.example
eval(code, self.globals) | [
"def",
"_execute",
"(",
"self",
",",
"code",
")",
":",
"self",
".",
"globals",
"[",
"'example'",
"]",
"=",
"self",
".",
"example",
"eval",
"(",
"code",
",",
"self",
".",
"globals",
")"
] | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/boost_1_66_0/tools/litre/cplusplus.py#L320-L325 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/eclib/pstatbar.py | python | ProgressStatusBar.OnSize | (self, evt) | Reposition progress bar on resize
@param evt: wx.EVT_SIZE | Reposition progress bar on resize
@param evt: wx.EVT_SIZE | [
"Reposition",
"progress",
"bar",
"on",
"resize",
"@param",
"evt",
":",
"wx",
".",
"EVT_SIZE"
] | def OnSize(self, evt):
"""Reposition progress bar on resize
@param evt: wx.EVT_SIZE
"""
self.__Reposition()
self._changed = True
evt.Skip() | [
"def",
"OnSize",
"(",
"self",
",",
"evt",
")",
":",
"self",
".",
"__Reposition",
"(",
")",
"self",
".",
"_changed",
"=",
"True",
"evt",
".",
"Skip",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/eclib/pstatbar.py#L164-L171 | ||
ideawu/ssdb-rocks | a3cbb322cafb2f493252829c608e2239df98c9ac | deps/rocksdb-master/linters/cpp_linter/cpplint.py | python | CheckForIncludeWhatYouUse | (filename, clean_lines, include_state, error,
io=codecs) | Reports for missing stl includes.
This function will output warnings to make sure you are including the headers
necessary for the stl containers and functions that you use. We only give one
reason to include a header. For example, if you use both equal_to<> and
less<> in a .h file, only one (the latter in the ... | Reports for missing stl includes. | [
"Reports",
"for",
"missing",
"stl",
"includes",
"."
] | def CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error,
io=codecs):
"""Reports for missing stl includes.
This function will output warnings to make sure you are including the headers
necessary for the stl containers and functions that you use. We only give one
r... | [
"def",
"CheckForIncludeWhatYouUse",
"(",
"filename",
",",
"clean_lines",
",",
"include_state",
",",
"error",
",",
"io",
"=",
"codecs",
")",
":",
"required",
"=",
"{",
"}",
"# A map of header name to linenumber and the template entity.",
"# Example of required: { '<functiona... | https://github.com/ideawu/ssdb-rocks/blob/a3cbb322cafb2f493252829c608e2239df98c9ac/deps/rocksdb-master/linters/cpp_linter/cpplint.py#L4385-L4475 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/orchestrator/_interface.py | python | Orchestrator.get_hosts | (self) | Report the hosts in the cluster.
:return: list of HostSpec | Report the hosts in the cluster. | [
"Report",
"the",
"hosts",
"in",
"the",
"cluster",
"."
] | def get_hosts(self) -> OrchResult[List[HostSpec]]:
"""
Report the hosts in the cluster.
:return: list of HostSpec
"""
raise NotImplementedError() | [
"def",
"get_hosts",
"(",
"self",
")",
"->",
"OrchResult",
"[",
"List",
"[",
"HostSpec",
"]",
"]",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/orchestrator/_interface.py#L375-L381 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/html2.py | python | WebView.CanSetZoomType | (*args, **kwargs) | return _html2.WebView_CanSetZoomType(*args, **kwargs) | CanSetZoomType(self, int type) -> bool | CanSetZoomType(self, int type) -> bool | [
"CanSetZoomType",
"(",
"self",
"int",
"type",
")",
"-",
">",
"bool"
] | def CanSetZoomType(*args, **kwargs):
"""CanSetZoomType(self, int type) -> bool"""
return _html2.WebView_CanSetZoomType(*args, **kwargs) | [
"def",
"CanSetZoomType",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html2",
".",
"WebView_CanSetZoomType",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/html2.py#L306-L308 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/variable_scope.py | python | _compute_slice_dim_and_shape | (full_shape, slicing) | return slice_dim, slice_shape | Computes which dimension is being sliced and the typical slice shape. | Computes which dimension is being sliced and the typical slice shape. | [
"Computes",
"which",
"dimension",
"is",
"being",
"sliced",
"and",
"the",
"typical",
"slice",
"shape",
"."
] | def _compute_slice_dim_and_shape(full_shape, slicing):
"""Computes which dimension is being sliced and the typical slice shape."""
slice_shape = [0] * len(full_shape)
slice_dim = None
for dim, num_slices in enumerate(slicing):
dim_size = full_shape[dim]
if num_slices <= 0 or dim_size < num_slices:
... | [
"def",
"_compute_slice_dim_and_shape",
"(",
"full_shape",
",",
"slicing",
")",
":",
"slice_shape",
"=",
"[",
"0",
"]",
"*",
"len",
"(",
"full_shape",
")",
"slice_dim",
"=",
"None",
"for",
"dim",
",",
"num_slices",
"in",
"enumerate",
"(",
"slicing",
")",
":... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/variable_scope.py#L1308-L1335 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/codecontext.py | python | CodeContext.update_code_context | (self) | Update context information and lines visible in the context pane.
No update is done if the text hasn't been scrolled. If the text
was scrolled, the lines that should be shown in the context will
be retrieved and the context area will be updated with the code,
up to the number of maxlin... | Update context information and lines visible in the context pane. | [
"Update",
"context",
"information",
"and",
"lines",
"visible",
"in",
"the",
"context",
"pane",
"."
] | def update_code_context(self):
"""Update context information and lines visible in the context pane.
No update is done if the text hasn't been scrolled. If the text
was scrolled, the lines that should be shown in the context will
be retrieved and the context area will be updated with th... | [
"def",
"update_code_context",
"(",
"self",
")",
":",
"new_topvisible",
"=",
"self",
".",
"editwin",
".",
"getlineno",
"(",
"\"@0,0\"",
")",
"if",
"self",
".",
"topvisible",
"==",
"new_topvisible",
":",
"# Haven't scrolled.",
"return",
"if",
"self",
".",
"topvi... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/codecontext.py#L176-L214 | ||
TGAC/KAT | e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216 | deps/boost/tools/build/src/util/path.py | python | is_rooted | (path) | return path and path [0] == '/' | Tests if a path is rooted. | Tests if a path is rooted. | [
"Tests",
"if",
"a",
"path",
"is",
"rooted",
"."
] | def is_rooted (path):
""" Tests if a path is rooted.
"""
return path and path [0] == '/' | [
"def",
"is_rooted",
"(",
"path",
")",
":",
"return",
"path",
"and",
"path",
"[",
"0",
"]",
"==",
"'/'"
] | https://github.com/TGAC/KAT/blob/e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216/deps/boost/tools/build/src/util/path.py#L69-L72 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | ZipFSHandler.CanOpen | (*args, **kwargs) | return _core_.ZipFSHandler_CanOpen(*args, **kwargs) | CanOpen(self, String location) -> bool | CanOpen(self, String location) -> bool | [
"CanOpen",
"(",
"self",
"String",
"location",
")",
"-",
">",
"bool"
] | def CanOpen(*args, **kwargs):
"""CanOpen(self, String location) -> bool"""
return _core_.ZipFSHandler_CanOpen(*args, **kwargs) | [
"def",
"CanOpen",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"ZipFSHandler_CanOpen",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L2508-L2510 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/html5lib/_inputstream.py | python | HTMLUnicodeInputStream.openStream | (self, source) | return stream | Produces a file object from source.
source can be either a file object, local filename or a string. | Produces a file object from source. | [
"Produces",
"a",
"file",
"object",
"from",
"source",
"."
] | def openStream(self, source):
"""Produces a file object from source.
source can be either a file object, local filename or a string.
"""
# Already a file object
if hasattr(source, 'read'):
stream = source
else:
stream = StringIO(source)
... | [
"def",
"openStream",
"(",
"self",
",",
"source",
")",
":",
"# Already a file object",
"if",
"hasattr",
"(",
"source",
",",
"'read'",
")",
":",
"stream",
"=",
"source",
"else",
":",
"stream",
"=",
"StringIO",
"(",
"source",
")",
"return",
"stream"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/html5lib/_inputstream.py#L204-L216 | |
mapsme/omim | 1892903b63f2c85b16ed4966d21fe76aba06b9ba | 3party/freetype/src/tools/docmaker/content.py | python | ContentProcessor.add_markup | ( self ) | Add a new markup section. | Add a new markup section. | [
"Add",
"a",
"new",
"markup",
"section",
"."
] | def add_markup( self ):
"""Add a new markup section."""
if self.markup and self.markup_lines:
# get rid of last line of markup if it's empty
marks = self.markup_lines
if len( marks ) > 0 and not string.strip( marks[-1] ):
self.markup_lines = marks[:-... | [
"def",
"add_markup",
"(",
"self",
")",
":",
"if",
"self",
".",
"markup",
"and",
"self",
".",
"markup_lines",
":",
"# get rid of last line of markup if it's empty",
"marks",
"=",
"self",
".",
"markup_lines",
"if",
"len",
"(",
"marks",
")",
">",
"0",
"and",
"n... | https://github.com/mapsme/omim/blob/1892903b63f2c85b16ed4966d21fe76aba06b9ba/3party/freetype/src/tools/docmaker/content.py#L416-L430 | ||
plumonito/dtslam | 5994bb9cf7a11981b830370db206bceb654c085d | 3rdparty/opencv-git/doc/pattern_tools/svgfig.py | python | Dots.SVG | (self, trans=None) | return output | Apply the transformation "trans" and return an SVG object. | Apply the transformation "trans" and return an SVG object. | [
"Apply",
"the",
"transformation",
"trans",
"and",
"return",
"an",
"SVG",
"object",
"."
] | def SVG(self, trans=None):
"""Apply the transformation "trans" and return an SVG object."""
if isinstance(trans, basestring):
trans = totrans(trans)
output = SVG("g", SVG("defs", self.symbol))
id = "#%s" % self.symbol["id"]
for p in self.d:
x, y = p[0], ... | [
"def",
"SVG",
"(",
"self",
",",
"trans",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"trans",
",",
"basestring",
")",
":",
"trans",
"=",
"totrans",
"(",
"trans",
")",
"output",
"=",
"SVG",
"(",
"\"g\"",
",",
"SVG",
"(",
"\"defs\"",
",",
"self",... | https://github.com/plumonito/dtslam/blob/5994bb9cf7a11981b830370db206bceb654c085d/3rdparty/opencv-git/doc/pattern_tools/svgfig.py#L2134-L2157 | |
facebookresearch/faiss | eb8781557f556505ca93f6f21fff932e17f0d9e0 | benchs/bench_polysemous_1bn.py | python | matrix_slice_iterator | (x, bs) | return rate_limited_imap(
lambda i01: x[i01[0]:i01[1]].astype('float32').copy(),
block_ranges) | iterate over the lines of x in blocks of size bs | iterate over the lines of x in blocks of size bs | [
"iterate",
"over",
"the",
"lines",
"of",
"x",
"in",
"blocks",
"of",
"size",
"bs"
] | def matrix_slice_iterator(x, bs):
" iterate over the lines of x in blocks of size bs"
nb = x.shape[0]
block_ranges = [(i0, min(nb, i0 + bs))
for i0 in range(0, nb, bs)]
return rate_limited_imap(
lambda i01: x[i01[0]:i01[1]].astype('float32').copy(),
block_ranges) | [
"def",
"matrix_slice_iterator",
"(",
"x",
",",
"bs",
")",
":",
"nb",
"=",
"x",
".",
"shape",
"[",
"0",
"]",
"block_ranges",
"=",
"[",
"(",
"i0",
",",
"min",
"(",
"nb",
",",
"i0",
"+",
"bs",
")",
")",
"for",
"i0",
"in",
"range",
"(",
"0",
",",... | https://github.com/facebookresearch/faiss/blob/eb8781557f556505ca93f6f21fff932e17f0d9e0/benchs/bench_polysemous_1bn.py#L153-L161 | |
gwaldron/osgearth | 4c521857d59a69743e4a9cedba00afe570f984e8 | src/third_party/tinygltf/deps/cpplint.py | python | ShouldCheckNamespaceIndentation | (nesting_state, is_namespace_indent_item,
raw_lines_no_comments, linenum) | return IsBlockInNameSpace(nesting_state, is_forward_declaration) | This method determines if we should apply our namespace indentation check.
Args:
nesting_state: The current nesting state.
is_namespace_indent_item: If we just put a new class on the stack, True.
If the top of the stack is not a class, or we did not recently
add the class, False.
raw_lines_no... | This method determines if we should apply our namespace indentation check. | [
"This",
"method",
"determines",
"if",
"we",
"should",
"apply",
"our",
"namespace",
"indentation",
"check",
"."
] | def ShouldCheckNamespaceIndentation(nesting_state, is_namespace_indent_item,
raw_lines_no_comments, linenum):
"""This method determines if we should apply our namespace indentation check.
Args:
nesting_state: The current nesting state.
is_namespace_indent_item: If we jus... | [
"def",
"ShouldCheckNamespaceIndentation",
"(",
"nesting_state",
",",
"is_namespace_indent_item",
",",
"raw_lines_no_comments",
",",
"linenum",
")",
":",
"is_forward_declaration",
"=",
"IsForwardClassDeclaration",
"(",
"raw_lines_no_comments",
",",
"linenum",
")",
"if",
"not... | https://github.com/gwaldron/osgearth/blob/4c521857d59a69743e4a9cedba00afe570f984e8/src/third_party/tinygltf/deps/cpplint.py#L5865-L5892 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | Palette.__init__ | (self, *args, **kwargs) | __init__(self, wxArrayInt red, wxArrayInt green, wxArrayInt blue) -> Palette | __init__(self, wxArrayInt red, wxArrayInt green, wxArrayInt blue) -> Palette | [
"__init__",
"(",
"self",
"wxArrayInt",
"red",
"wxArrayInt",
"green",
"wxArrayInt",
"blue",
")",
"-",
">",
"Palette"
] | def __init__(self, *args, **kwargs):
"""__init__(self, wxArrayInt red, wxArrayInt green, wxArrayInt blue) -> Palette"""
_gdi_.Palette_swiginit(self,_gdi_.new_Palette(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_gdi_",
".",
"Palette_swiginit",
"(",
"self",
",",
"_gdi_",
".",
"new_Palette",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L336-L338 | ||
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/esptool/serial/serialwin32.py | python | Serial.set_output_flow_control | (self, enable=True) | \
Manually control flow - when software flow control is enabled.
This will do the same as if XON (true) or XOFF (false) are received
from the other device and control the transmission accordingly.
WARNING: this function is not portable to different platforms! | \
Manually control flow - when software flow control is enabled.
This will do the same as if XON (true) or XOFF (false) are received
from the other device and control the transmission accordingly.
WARNING: this function is not portable to different platforms! | [
"\\",
"Manually",
"control",
"flow",
"-",
"when",
"software",
"flow",
"control",
"is",
"enabled",
".",
"This",
"will",
"do",
"the",
"same",
"as",
"if",
"XON",
"(",
"true",
")",
"or",
"XOFF",
"(",
"false",
")",
"are",
"received",
"from",
"the",
"other",... | def set_output_flow_control(self, enable=True):
"""\
Manually control flow - when software flow control is enabled.
This will do the same as if XON (true) or XOFF (false) are received
from the other device and control the transmission accordingly.
WARNING: this function is not po... | [
"def",
"set_output_flow_control",
"(",
"self",
",",
"enable",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"is_open",
":",
"raise",
"portNotOpenError",
"if",
"enable",
":",
"win32",
".",
"EscapeCommFunction",
"(",
"self",
".",
"_port_handle",
",",
"win32... | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/esptool/serial/serialwin32.py#L425-L437 | ||
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | tools/idl_parser/idl_ppapi_parser.py | python | IDLPPAPIParser.p_ExtendedAttributeIdentConst | (self, p) | ExtendedAttributeIdentConst : identifier '=' ConstValue | ExtendedAttributeIdentConst : identifier '=' ConstValue | [
"ExtendedAttributeIdentConst",
":",
"identifier",
"=",
"ConstValue"
] | def p_ExtendedAttributeIdentConst(self, p):
"""ExtendedAttributeIdentConst : identifier '=' ConstValue"""
p[0] = self.BuildNamed('ExtAttribute', p, 1, p[3]) | [
"def",
"p_ExtendedAttributeIdentConst",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"self",
".",
"BuildNamed",
"(",
"'ExtAttribute'",
",",
"p",
",",
"1",
",",
"p",
"[",
"3",
"]",
")"
] | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/tools/idl_parser/idl_ppapi_parser.py#L278-L280 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/datetime.py | python | timedelta.total_seconds | (self) | return ((self.days * 86400 + self.seconds) * 10**6 +
self.microseconds) / 10**6 | Total seconds in the duration. | Total seconds in the duration. | [
"Total",
"seconds",
"in",
"the",
"duration",
"."
] | def total_seconds(self):
"""Total seconds in the duration."""
return ((self.days * 86400 + self.seconds) * 10**6 +
self.microseconds) / 10**6 | [
"def",
"total_seconds",
"(",
"self",
")",
":",
"return",
"(",
"(",
"self",
".",
"days",
"*",
"86400",
"+",
"self",
".",
"seconds",
")",
"*",
"10",
"**",
"6",
"+",
"self",
".",
"microseconds",
")",
"/",
"10",
"**",
"6"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/datetime.py#L600-L603 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/android/pylib/android_commands.py | python | AndroidCommands.SetUtilWrapper | (self, util_wrapper) | Sets a wrapper prefix to be used when running a locally-built
binary on the device (ex.: md5sum_bin). | Sets a wrapper prefix to be used when running a locally-built
binary on the device (ex.: md5sum_bin). | [
"Sets",
"a",
"wrapper",
"prefix",
"to",
"be",
"used",
"when",
"running",
"a",
"locally",
"-",
"built",
"binary",
"on",
"the",
"device",
"(",
"ex",
".",
":",
"md5sum_bin",
")",
"."
] | def SetUtilWrapper(self, util_wrapper):
"""Sets a wrapper prefix to be used when running a locally-built
binary on the device (ex.: md5sum_bin).
"""
self._util_wrapper = util_wrapper | [
"def",
"SetUtilWrapper",
"(",
"self",
",",
"util_wrapper",
")",
":",
"self",
".",
"_util_wrapper",
"=",
"util_wrapper"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/android/pylib/android_commands.py#L1695-L1699 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Path/PathScripts/PathProfileEdges.py | python | Create | (name, obj=None, parentJob=None) | return obj | Create(name) ... Creates and returns a Profile operation. | Create(name) ... Creates and returns a Profile operation. | [
"Create",
"(",
"name",
")",
"...",
"Creates",
"and",
"returns",
"a",
"Profile",
"operation",
"."
] | def Create(name, obj=None, parentJob=None):
'''Create(name) ... Creates and returns a Profile operation.'''
if obj is None:
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
obj.Proxy = ObjectProfile(obj, name, parentJob)
return obj | [
"def",
"Create",
"(",
"name",
",",
"obj",
"=",
"None",
",",
"parentJob",
"=",
"None",
")",
":",
"if",
"obj",
"is",
"None",
":",
"obj",
"=",
"FreeCAD",
".",
"ActiveDocument",
".",
"addObject",
"(",
"\"Path::FeaturePython\"",
",",
"name",
")",
"obj",
"."... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Path/PathScripts/PathProfileEdges.py#L46-L51 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/util/_cloudpickle/_cloudpickle_py27.py | python | CloudPickler.save_file | (self, obj) | Save a file | Save a file | [
"Save",
"a",
"file"
] | def save_file(self, obj):
"""Save a file"""
try:
import StringIO as pystringIO # we can't use cStringIO as it lacks the name attribute
except ImportError:
import io as pystringIO
if not hasattr(obj, "name") or not hasattr(obj, "mode"):
raise pickle.P... | [
"def",
"save_file",
"(",
"self",
",",
"obj",
")",
":",
"try",
":",
"import",
"StringIO",
"as",
"pystringIO",
"# we can't use cStringIO as it lacks the name attribute",
"except",
"ImportError",
":",
"import",
"io",
"as",
"pystringIO",
"if",
"not",
"hasattr",
"(",
"... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/util/_cloudpickle/_cloudpickle_py27.py#L906-L951 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/toolkits/_private_utils.py | python | _validate_lists | (
sa,
allowed_types=[str],
require_same_type=True,
require_equal_length=False,
num_to_check=10,
) | return True | For a list-typed SArray, check whether the first elements are lists that
- contain only the provided types
- all have the same lengths (optionally)
Parameters
----------
sa : SArray
An SArray containing lists.
allowed_types : list
A list of types that are allowed in each list.
... | For a list-typed SArray, check whether the first elements are lists that
- contain only the provided types
- all have the same lengths (optionally) | [
"For",
"a",
"list",
"-",
"typed",
"SArray",
"check",
"whether",
"the",
"first",
"elements",
"are",
"lists",
"that",
"-",
"contain",
"only",
"the",
"provided",
"types",
"-",
"all",
"have",
"the",
"same",
"lengths",
"(",
"optionally",
")"
] | def _validate_lists(
sa,
allowed_types=[str],
require_same_type=True,
require_equal_length=False,
num_to_check=10,
):
"""
For a list-typed SArray, check whether the first elements are lists that
- contain only the provided types
- all have the same lengths (optionally)
Parameter... | [
"def",
"_validate_lists",
"(",
"sa",
",",
"allowed_types",
"=",
"[",
"str",
"]",
",",
"require_same_type",
"=",
"True",
",",
"require_equal_length",
"=",
"False",
",",
"num_to_check",
"=",
"10",
",",
")",
":",
"if",
"len",
"(",
"sa",
")",
"==",
"0",
":... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/_private_utils.py#L165-L235 | |
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | clang/bindings/python/clang/cindex.py | python | Diagnostic.disable_option | (self) | return _CXString.from_result(disable) | The command-line option that disables this diagnostic. | The command-line option that disables this diagnostic. | [
"The",
"command",
"-",
"line",
"option",
"that",
"disables",
"this",
"diagnostic",
"."
] | def disable_option(self):
"""The command-line option that disables this diagnostic."""
disable = _CXString()
conf.lib.clang_getDiagnosticOption(self, byref(disable))
return _CXString.from_result(disable) | [
"def",
"disable_option",
"(",
"self",
")",
":",
"disable",
"=",
"_CXString",
"(",
")",
"conf",
".",
"lib",
".",
"clang_getDiagnosticOption",
"(",
"self",
",",
"byref",
"(",
"disable",
")",
")",
"return",
"_CXString",
".",
"from_result",
"(",
"disable",
")"... | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/clang/bindings/python/clang/cindex.py#L475-L479 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Misc._substitute | (self, *args) | return (e,) | Internal function. | Internal function. | [
"Internal",
"function",
"."
] | def _substitute(self, *args):
"""Internal function."""
if len(args) != len(self._subst_format): return args
getboolean = self.tk.getboolean
getint = int
def getint_event(s):
"""Tk changed behavior in 8.4.2, returning "??" rather more often."""
try:
... | [
"def",
"_substitute",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"!=",
"len",
"(",
"self",
".",
"_subst_format",
")",
":",
"return",
"args",
"getboolean",
"=",
"self",
".",
"tk",
".",
"getboolean",
"getint",
"=",
"int",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L1174-L1230 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/core/history.py | python | HistoryAccessor.search | (self, pattern="*", raw=True, search_raw=True,
output=False, n=None, unique=False) | return cur | Search the database using unix glob-style matching (wildcards
* and ?).
Parameters
----------
pattern : str
The wildcarded pattern to match when searching
search_raw : bool
If True, search the raw input, otherwise, the parsed input
raw, output : bool
... | Search the database using unix glob-style matching (wildcards
* and ?). | [
"Search",
"the",
"database",
"using",
"unix",
"glob",
"-",
"style",
"matching",
"(",
"wildcards",
"*",
"and",
"?",
")",
"."
] | def search(self, pattern="*", raw=True, search_raw=True,
output=False, n=None, unique=False):
"""Search the database using unix glob-style matching (wildcards
* and ?).
Parameters
----------
pattern : str
The wildcarded pattern to match when searching
... | [
"def",
"search",
"(",
"self",
",",
"pattern",
"=",
"\"*\"",
",",
"raw",
"=",
"True",
",",
"search_raw",
"=",
"True",
",",
"output",
"=",
"False",
",",
"n",
"=",
"None",
",",
"unique",
"=",
"False",
")",
":",
"tosearch",
"=",
"\"source_raw\"",
"if",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/core/history.py#L375-L414 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_op_impl/tbe/acos_ds.py | python | _acos_ds_tbe | () | return | ACos TBE register | ACos TBE register | [
"ACos",
"TBE",
"register"
] | def _acos_ds_tbe():
"""ACos TBE register"""
return | [
"def",
"_acos_ds_tbe",
"(",
")",
":",
"return"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/tbe/acos_ds.py#L36-L38 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | samples/pySketch/pySketch.py | python | EditTextObjectDialog._doEnter | (self, event) | Respond to the user hitting the ENTER key.
We simulate clicking on the "OK" button. | Respond to the user hitting the ENTER key. | [
"Respond",
"to",
"the",
"user",
"hitting",
"the",
"ENTER",
"key",
"."
] | def _doEnter(self, event):
""" Respond to the user hitting the ENTER key.
We simulate clicking on the "OK" button.
"""
if self.Validate(): self.Show(False) | [
"def",
"_doEnter",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"Validate",
"(",
")",
":",
"self",
".",
"Show",
"(",
"False",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/samples/pySketch/pySketch.py#L3399-L3404 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBTypeSynthetic.__str__ | (self) | return _lldb.SBTypeSynthetic___str__(self) | __str__(SBTypeSynthetic self) -> PyObject * | __str__(SBTypeSynthetic self) -> PyObject * | [
"__str__",
"(",
"SBTypeSynthetic",
"self",
")",
"-",
">",
"PyObject",
"*"
] | def __str__(self):
"""__str__(SBTypeSynthetic self) -> PyObject *"""
return _lldb.SBTypeSynthetic___str__(self) | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBTypeSynthetic___str__",
"(",
"self",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L14064-L14066 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | Function.WriteHandlerValidation | (self, file) | Writes validation code for the function. | Writes validation code for the function. | [
"Writes",
"validation",
"code",
"for",
"the",
"function",
"."
] | def WriteHandlerValidation(self, file):
"""Writes validation code for the function."""
for arg in self.GetOriginalArgs():
arg.WriteValidationCode(file, self)
self.WriteValidationCode(file) | [
"def",
"WriteHandlerValidation",
"(",
"self",
",",
"file",
")",
":",
"for",
"arg",
"in",
"self",
".",
"GetOriginalArgs",
"(",
")",
":",
"arg",
".",
"WriteValidationCode",
"(",
"file",
",",
"self",
")",
"self",
".",
"WriteValidationCode",
"(",
"file",
")"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/gpu/command_buffer/build_gles2_cmd_buffer.py#L5262-L5266 | ||
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/qcdb/options.py | python | format_option_for_cfour | (opt, val) | return opt[6:], text | Function to reformat value *val* for option *opt* from python
into cfour-speak. Arrays are the primary target. | Function to reformat value *val* for option *opt* from python
into cfour-speak. Arrays are the primary target. | [
"Function",
"to",
"reformat",
"value",
"*",
"val",
"*",
"for",
"option",
"*",
"opt",
"*",
"from",
"python",
"into",
"cfour",
"-",
"speak",
".",
"Arrays",
"are",
"the",
"primary",
"target",
"."
] | def format_option_for_cfour(opt, val):
"""Function to reformat value *val* for option *opt* from python
into cfour-speak. Arrays are the primary target.
"""
text = ''
# Transform list from [[3, 0, 1, 1], [2, 0, 1, 0]] --> 3-0-1-1/2-0-1-0
if isinstance(val, list):
if type(val[0]).__name... | [
"def",
"format_option_for_cfour",
"(",
"opt",
",",
"val",
")",
":",
"text",
"=",
"''",
"# Transform list from [[3, 0, 1, 1], [2, 0, 1, 0]] --> 3-0-1-1/2-0-1-0",
"if",
"isinstance",
"(",
"val",
",",
"list",
")",
":",
"if",
"type",
"(",
"val",
"[",
"0",
"]",
")",
... | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/qcdb/options.py#L33-L81 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/reshape/tile.py | python | _coerce_to_type | (x) | return x, dtype | if the passed data is of datetime/timedelta type,
this method converts it to numeric so that cut method can
handle it | if the passed data is of datetime/timedelta type,
this method converts it to numeric so that cut method can
handle it | [
"if",
"the",
"passed",
"data",
"is",
"of",
"datetime",
"/",
"timedelta",
"type",
"this",
"method",
"converts",
"it",
"to",
"numeric",
"so",
"that",
"cut",
"method",
"can",
"handle",
"it"
] | def _coerce_to_type(x):
"""
if the passed data is of datetime/timedelta type,
this method converts it to numeric so that cut method can
handle it
"""
dtype = None
if is_datetime64tz_dtype(x):
dtype = x.dtype
elif is_datetime64_dtype(x):
x = to_datetime(x)
dtype =... | [
"def",
"_coerce_to_type",
"(",
"x",
")",
":",
"dtype",
"=",
"None",
"if",
"is_datetime64tz_dtype",
"(",
"x",
")",
":",
"dtype",
"=",
"x",
".",
"dtype",
"elif",
"is_datetime64_dtype",
"(",
"x",
")",
":",
"x",
"=",
"to_datetime",
"(",
"x",
")",
"dtype",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/reshape/tile.py#L384-L405 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/groups-of-special-equivalent-strings.py | python | Solution.numSpecialEquivGroups | (self, A) | return len({count(word) for word in A}) | :type A: List[str]
:rtype: int | :type A: List[str]
:rtype: int | [
":",
"type",
"A",
":",
"List",
"[",
"str",
"]",
":",
"rtype",
":",
"int"
] | def numSpecialEquivGroups(self, A):
"""
:type A: List[str]
:rtype: int
"""
def count(word):
result = [0]*52
for i, letter in enumerate(word):
result[ord(letter)-ord('a') + 26*(i%2)] += 1
return tuple(result)
return len(... | [
"def",
"numSpecialEquivGroups",
"(",
"self",
",",
"A",
")",
":",
"def",
"count",
"(",
"word",
")",
":",
"result",
"=",
"[",
"0",
"]",
"*",
"52",
"for",
"i",
",",
"letter",
"in",
"enumerate",
"(",
"word",
")",
":",
"result",
"[",
"ord",
"(",
"lett... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/groups-of-special-equivalent-strings.py#L5-L16 | |
pristineio/webrtc-mirror | 7a5bcdffaab90a05bc1146b2b1ea71c004e54d71 | PRESUBMIT.py | python | _CheckNoIOStreamInHeaders | (input_api, output_api) | return [] | Checks to make sure no .h files include <iostream>. | Checks to make sure no .h files include <iostream>. | [
"Checks",
"to",
"make",
"sure",
"no",
".",
"h",
"files",
"include",
"<iostream",
">",
"."
] | def _CheckNoIOStreamInHeaders(input_api, output_api):
"""Checks to make sure no .h files include <iostream>."""
files = []
pattern = input_api.re.compile(r'^#include\s*<iostream>',
input_api.re.MULTILINE)
for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
if... | [
"def",
"_CheckNoIOStreamInHeaders",
"(",
"input_api",
",",
"output_api",
")",
":",
"files",
"=",
"[",
"]",
"pattern",
"=",
"input_api",
".",
"re",
".",
"compile",
"(",
"r'^#include\\s*<iostream>'",
",",
"input_api",
".",
"re",
".",
"MULTILINE",
")",
"for",
"... | https://github.com/pristineio/webrtc-mirror/blob/7a5bcdffaab90a05bc1146b2b1ea71c004e54d71/PRESUBMIT.py#L159-L177 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/supertooltip.py | python | SuperToolTip.SetDropShadow | (self, drop) | Whether to draw a shadow below :class:`SuperToolTip` or not.
:param `drop`: ``True`` to drop a shadow below the control, ``False`` otherwise.
:note: This method is available only on Windows and requires Mark Hammond's
pywin32 package. | Whether to draw a shadow below :class:`SuperToolTip` or not. | [
"Whether",
"to",
"draw",
"a",
"shadow",
"below",
":",
"class",
":",
"SuperToolTip",
"or",
"not",
"."
] | def SetDropShadow(self, drop):
"""
Whether to draw a shadow below :class:`SuperToolTip` or not.
:param `drop`: ``True`` to drop a shadow below the control, ``False`` otherwise.
:note: This method is available only on Windows and requires Mark Hammond's
pywin32 package.
... | [
"def",
"SetDropShadow",
"(",
"self",
",",
"drop",
")",
":",
"self",
".",
"_dropShadow",
"=",
"drop",
"if",
"self",
".",
"_superToolTip",
":",
"self",
".",
"_superToolTip",
".",
"Invalidate",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/supertooltip.py#L1348-L1360 | ||
apitrace/apitrace | 764c9786b2312b656ce0918dff73001c6a85f46f | retrace/retrace.py | python | Retracer.checkOrigResult | (self, function) | Hook for checking the original result, to prevent succeeding now
where the original did not, which would cause diversion and potentially
unpredictable results. | Hook for checking the original result, to prevent succeeding now
where the original did not, which would cause diversion and potentially
unpredictable results. | [
"Hook",
"for",
"checking",
"the",
"original",
"result",
"to",
"prevent",
"succeeding",
"now",
"where",
"the",
"original",
"did",
"not",
"which",
"would",
"cause",
"diversion",
"and",
"potentially",
"unpredictable",
"results",
"."
] | def checkOrigResult(self, function):
'''Hook for checking the original result, to prevent succeeding now
where the original did not, which would cause diversion and potentially
unpredictable results.'''
assert function.type is not stdapi.Void
if str(function.type) == 'HRESULT':... | [
"def",
"checkOrigResult",
"(",
"self",
",",
"function",
")",
":",
"assert",
"function",
".",
"type",
"is",
"not",
"stdapi",
".",
"Void",
"if",
"str",
"(",
"function",
".",
"type",
")",
"==",
"'HRESULT'",
":",
"print",
"(",
"r' if (call.ret && FAILED(call.... | https://github.com/apitrace/apitrace/blob/764c9786b2312b656ce0918dff73001c6a85f46f/retrace/retrace.py#L429-L439 | ||
InsightSoftwareConsortium/ITK | 87acfce9a93d928311c38bc371b666b515b9f19d | Modules/ThirdParty/pygccxml/src/pygccxml/parser/project_reader.py | python | project_reader_t.get_os_file_names | (files) | return fnames | returns file names
:param files: list of strings and\\or :class:`file_configuration_t`
instances.
:type files: list | returns file names | [
"returns",
"file",
"names"
] | def get_os_file_names(files):
"""
returns file names
:param files: list of strings and\\or :class:`file_configuration_t`
instances.
:type files: list
"""
fnames = []
for f in files:
if utils.is_str(f):
fnames.app... | [
"def",
"get_os_file_names",
"(",
"files",
")",
":",
"fnames",
"=",
"[",
"]",
"for",
"f",
"in",
"files",
":",
"if",
"utils",
".",
"is_str",
"(",
"f",
")",
":",
"fnames",
".",
"append",
"(",
"f",
")",
"elif",
"isinstance",
"(",
"f",
",",
"file_config... | https://github.com/InsightSoftwareConsortium/ITK/blob/87acfce9a93d928311c38bc371b666b515b9f19d/Modules/ThirdParty/pygccxml/src/pygccxml/parser/project_reader.py#L213-L234 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/number-of-islands.py | python | Solution.numIslands | (self, grid) | return union_find.count-zero_count | :type grid: List[List[str]]
:rtype: int | :type grid: List[List[str]]
:rtype: int | [
":",
"type",
"grid",
":",
"List",
"[",
"List",
"[",
"str",
"]]",
":",
"rtype",
":",
"int"
] | def numIslands(self, grid):
"""
:type grid: List[List[str]]
:rtype: int
"""
def index(n, i, j):
return i*n + j
if not grid:
return 0
zero_count = 0
union_find = UnionFind(len(grid)*len(grid[0]))
for i in xrange(len(gri... | [
"def",
"numIslands",
"(",
"self",
",",
"grid",
")",
":",
"def",
"index",
"(",
"n",
",",
"i",
",",
"j",
")",
":",
"return",
"i",
"*",
"n",
"+",
"j",
"if",
"not",
"grid",
":",
"return",
"0",
"zero_count",
"=",
"0",
"union_find",
"=",
"UnionFind",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/number-of-islands.py#L22-L46 | |
epiqc/ScaffCC | 66a79944ee4cd116b27bc1a69137276885461db8 | clang/bindings/python/clang/cindex.py | python | Index.create | (excludeDecls=False) | return Index(conf.lib.clang_createIndex(excludeDecls, 0)) | Create a new Index.
Parameters:
excludeDecls -- Exclude local declarations from translation units. | Create a new Index.
Parameters:
excludeDecls -- Exclude local declarations from translation units. | [
"Create",
"a",
"new",
"Index",
".",
"Parameters",
":",
"excludeDecls",
"--",
"Exclude",
"local",
"declarations",
"from",
"translation",
"units",
"."
] | def create(excludeDecls=False):
"""
Create a new Index.
Parameters:
excludeDecls -- Exclude local declarations from translation units.
"""
return Index(conf.lib.clang_createIndex(excludeDecls, 0)) | [
"def",
"create",
"(",
"excludeDecls",
"=",
"False",
")",
":",
"return",
"Index",
"(",
"conf",
".",
"lib",
".",
"clang_createIndex",
"(",
"excludeDecls",
",",
"0",
")",
")"
] | https://github.com/epiqc/ScaffCC/blob/66a79944ee4cd116b27bc1a69137276885461db8/clang/bindings/python/clang/cindex.py#L2692-L2698 | |
quantOS-org/DataCore | e2ef9bd2c22ee9e2845675b6435a14fa607f3551 | mdlink/deps/windows/protobuf-2.5.0/python/mox.py | python | MockMethod.__ne__ | (self, rhs) | return not self == rhs | Test whether this MockMethod is not equivalent to another MockMethod.
Args:
# rhs: the right hand side of the test
rhs: MockMethod | Test whether this MockMethod is not equivalent to another MockMethod. | [
"Test",
"whether",
"this",
"MockMethod",
"is",
"not",
"equivalent",
"to",
"another",
"MockMethod",
"."
] | def __ne__(self, rhs):
"""Test whether this MockMethod is not equivalent to another MockMethod.
Args:
# rhs: the right hand side of the test
rhs: MockMethod
"""
return not self == rhs | [
"def",
"__ne__",
"(",
"self",
",",
"rhs",
")",
":",
"return",
"not",
"self",
"==",
"rhs"
] | https://github.com/quantOS-org/DataCore/blob/e2ef9bd2c22ee9e2845675b6435a14fa607f3551/mdlink/deps/windows/protobuf-2.5.0/python/mox.py#L635-L643 | |
andrewssobral/bgslibrary | 4e47342e6c0ee7638283379e6bd3679667f377b9 | setup.py | python | InstallCMakeLibsData.run | (self) | Outfiles are the libraries that were built using cmake | Outfiles are the libraries that were built using cmake | [
"Outfiles",
"are",
"the",
"libraries",
"that",
"were",
"built",
"using",
"cmake"
] | def run(self):
"""
Outfiles are the libraries that were built using cmake
"""
# There seems to be no other way to do this; I tried listing the
# libraries during the execution of the InstallCMakeLibs.run() but
# setuptools never tracked them, seems like setuptools wants t... | [
"def",
"run",
"(",
"self",
")",
":",
"# There seems to be no other way to do this; I tried listing the",
"# libraries during the execution of the InstallCMakeLibs.run() but",
"# setuptools never tracked them, seems like setuptools wants to",
"# track the libraries through package data more than an... | https://github.com/andrewssobral/bgslibrary/blob/4e47342e6c0ee7638283379e6bd3679667f377b9/setup.py#L42-L51 | ||
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/v7.9.317/third_party/jinja2/runtime.py | python | Macro._invoke | (self, arguments, autoescape) | return rv | This method is being swapped out by the async implementation. | This method is being swapped out by the async implementation. | [
"This",
"method",
"is",
"being",
"swapped",
"out",
"by",
"the",
"async",
"implementation",
"."
] | def _invoke(self, arguments, autoescape):
"""This method is being swapped out by the async implementation."""
rv = self._func(*arguments)
if autoescape:
rv = Markup(rv)
return rv | [
"def",
"_invoke",
"(",
"self",
",",
"arguments",
",",
"autoescape",
")",
":",
"rv",
"=",
"self",
".",
"_func",
"(",
"*",
"arguments",
")",
"if",
"autoescape",
":",
"rv",
"=",
"Markup",
"(",
"rv",
")",
"return",
"rv"
] | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/v7.9.317/third_party/jinja2/runtime.py#L577-L582 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/io/io.py | python | DataIter.getlabel | (self) | Get label of the current batch.
Returns
-------
list of NDArray
The label of the current batch. | Get label of the current batch. | [
"Get",
"label",
"of",
"the",
"current",
"batch",
"."
] | def getlabel(self):
"""Get label of the current batch.
Returns
-------
list of NDArray
The label of the current batch.
"""
pass | [
"def",
"getlabel",
"(",
"self",
")",
":",
"pass"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/io/io.py#L251-L259 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/SystemEvents/Folder_Actions_Suite.py | python | Folder_Actions_Suite_Events.attached_scripts | (self, _object, _attributes={}, **_arguments) | attached scripts: List the actions attached to a folder
Required argument: the object for the command
Keyword argument _attributes: AppleEvent attribute dictionary
Returns: the reply for the command | attached scripts: List the actions attached to a folder
Required argument: the object for the command
Keyword argument _attributes: AppleEvent attribute dictionary
Returns: the reply for the command | [
"attached",
"scripts",
":",
"List",
"the",
"actions",
"attached",
"to",
"a",
"folder",
"Required",
"argument",
":",
"the",
"object",
"for",
"the",
"command",
"Keyword",
"argument",
"_attributes",
":",
"AppleEvent",
"attribute",
"dictionary",
"Returns",
":",
"the... | def attached_scripts(self, _object, _attributes={}, **_arguments):
"""attached scripts: List the actions attached to a folder
Required argument: the object for the command
Keyword argument _attributes: AppleEvent attribute dictionary
Returns: the reply for the command
"""
... | [
"def",
"attached_scripts",
"(",
"self",
",",
"_object",
",",
"_attributes",
"=",
"{",
"}",
",",
"*",
"*",
"_arguments",
")",
":",
"_code",
"=",
"'faco'",
"_subcode",
"=",
"'lact'",
"if",
"_arguments",
":",
"raise",
"TypeError",
",",
"'No optional args expect... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/SystemEvents/Folder_Actions_Suite.py#L41-L60 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/botocore/vendored/requests/packages/urllib3/_collections.py | python | HTTPHeaderDict.itermerged | (self) | Iterate over all headers, merging duplicate ones together. | Iterate over all headers, merging duplicate ones together. | [
"Iterate",
"over",
"all",
"headers",
"merging",
"duplicate",
"ones",
"together",
"."
] | def itermerged(self):
"""Iterate over all headers, merging duplicate ones together."""
for key in self:
val = _dict_getitem(self, key)
yield val[0], ', '.join(val[1:]) | [
"def",
"itermerged",
"(",
"self",
")",
":",
"for",
"key",
"in",
"self",
":",
"val",
"=",
"_dict_getitem",
"(",
"self",
",",
"key",
")",
"yield",
"val",
"[",
"0",
"]",
",",
"', '",
".",
"join",
"(",
"val",
"[",
"1",
":",
"]",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/botocore/vendored/requests/packages/urllib3/_collections.py#L297-L301 | ||
rprichard/CxxCodeBrowser | a2fa83d2fe06119f0a7a1827b8167fab88b53561 | third_party/libre2/lib/codereview/codereview.py | python | AbstractRpcServer._Authenticate | (self) | Authenticates the user.
The authentication process works as follows:
1) We get a username and password from the user
2) We use ClientLogin to obtain an AUTH token for the user
(see http://code.google.com/apis/accounts/AuthForInstalledApps.html).
3) We pass the auth token to /_ah/login on the server to obta... | Authenticates the user. | [
"Authenticates",
"the",
"user",
"."
] | def _Authenticate(self):
"""Authenticates the user.
The authentication process works as follows:
1) We get a username and password from the user
2) We use ClientLogin to obtain an AUTH token for the user
(see http://code.google.com/apis/accounts/AuthForInstalledApps.html).
3) We pass the auth token to /_... | [
"def",
"_Authenticate",
"(",
"self",
")",
":",
"for",
"i",
"in",
"range",
"(",
"3",
")",
":",
"credentials",
"=",
"self",
".",
"auth_function",
"(",
")",
"try",
":",
"auth_token",
"=",
"self",
".",
"_GetAuthToken",
"(",
"credentials",
"[",
"0",
"]",
... | https://github.com/rprichard/CxxCodeBrowser/blob/a2fa83d2fe06119f0a7a1827b8167fab88b53561/third_party/libre2/lib/codereview/codereview.py#L2871-L2920 | ||
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | SimCalorimetry/HGCalSimProducers/python/hgcalDigitizer_cfi.py | python | HGCal_ignoreNoise | (process) | return process | include all effects except noise impact on leakage current and CCE, and scint
(see also notes in HGCal_setRealisticStartupNoise) | include all effects except noise impact on leakage current and CCE, and scint
(see also notes in HGCal_setRealisticStartupNoise) | [
"include",
"all",
"effects",
"except",
"noise",
"impact",
"on",
"leakage",
"current",
"and",
"CCE",
"and",
"scint",
"(",
"see",
"also",
"notes",
"in",
"HGCal_setRealisticStartupNoise",
")"
] | def HGCal_ignoreNoise(process):
"""
include all effects except noise impact on leakage current and CCE, and scint
(see also notes in HGCal_setRealisticStartupNoise)
"""
process=HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=4)
process=HGCal_setRealisticNoiseSci(process,byDose=True,byDo... | [
"def",
"HGCal_ignoreNoise",
"(",
"process",
")",
":",
"process",
"=",
"HGCal_setRealisticNoiseSi",
"(",
"process",
",",
"byDose",
"=",
"True",
",",
"byDoseAlgo",
"=",
"4",
")",
"process",
"=",
"HGCal_setRealisticNoiseSci",
"(",
"process",
",",
"byDose",
"=",
"... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/SimCalorimetry/HGCalSimProducers/python/hgcalDigitizer_cfi.py#L271-L278 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/generator/msvs.py | python | _GetMsbuildToolsetOfProject | (spec, version) | return toolset | Get the platform toolset for the project.
Arguments:
spec: The target dictionary containing the properties of the target.
version: The MSVSVersion object.
Returns:
the platform toolset string or None. | Get the platform toolset for the project. | [
"Get",
"the",
"platform",
"toolset",
"for",
"the",
"project",
"."
] | def _GetMsbuildToolsetOfProject(spec, version):
"""Get the platform toolset for the project.
Arguments:
spec: The target dictionary containing the properties of the target.
version: The MSVSVersion object.
Returns:
the platform toolset string or None.
"""
# Pluck out the default configuration.
... | [
"def",
"_GetMsbuildToolsetOfProject",
"(",
"spec",
",",
"version",
")",
":",
"# Pluck out the default configuration.",
"default_config",
"=",
"_GetDefaultConfiguration",
"(",
"spec",
")",
"toolset",
"=",
"default_config",
".",
"get",
"(",
"'msbuild_toolset'",
",",
"vers... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/generator/msvs.py#L872-L886 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/converters/onnx/_operators_nd.py | python | _convert_pad | (builder, node, graph, err) | convert to CoreML Padding / ConstantPadding Layer:
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L4397
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L1822 | convert to CoreML Padding / ConstantPadding Layer:
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L4397
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L1822 | [
"convert",
"to",
"CoreML",
"Padding",
"/",
"ConstantPadding",
"Layer",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"apple",
"/",
"coremltools",
"/",
"blob",
"/",
"655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492",
"/",
"mlmodel",
"/",
"format",
"/",
"NeuralNetwo... | def _convert_pad(builder, node, graph, err):
"""
convert to CoreML Padding / ConstantPadding Layer:
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L4397
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e4... | [
"def",
"_convert_pad",
"(",
"builder",
",",
"node",
",",
"graph",
",",
"err",
")",
":",
"mode",
"=",
"node",
".",
"attrs",
".",
"get",
"(",
"\"mode\"",
",",
"\"constant\"",
")",
"try",
":",
"mode",
"=",
"mode",
".",
"decode",
"(",
")",
"except",
"(... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/converters/onnx/_operators_nd.py#L1593-L1619 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | tools/json_schema_compiler/cpp_type_generator.py | python | CppTypeGenerator._ResolveTypeNamespace | (self, ref_type) | return None | Resolves a type name to its enclosing namespace.
Searches for the ref_type first as an explicitly qualified name, then within
the enclosing namespace, then within other namespaces that the current
namespace depends upon. | Resolves a type name to its enclosing namespace. | [
"Resolves",
"a",
"type",
"name",
"to",
"its",
"enclosing",
"namespace",
"."
] | def _ResolveTypeNamespace(self, ref_type):
"""Resolves a type name to its enclosing namespace.
Searches for the ref_type first as an explicitly qualified name, then within
the enclosing namespace, then within other namespaces that the current
namespace depends upon.
"""
if ref_type in self._typ... | [
"def",
"_ResolveTypeNamespace",
"(",
"self",
",",
"ref_type",
")",
":",
"if",
"ref_type",
"in",
"self",
".",
"_type_namespaces",
":",
"return",
"self",
".",
"_type_namespaces",
"[",
"ref_type",
"]",
"qualified_name",
"=",
"self",
".",
"_QualifyName",
"(",
"sel... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/tools/json_schema_compiler/cpp_type_generator.py#L205-L223 | |
gemrb/gemrb | 730206eed8d1dd358ca5e69a62f9e099aa22ffc6 | gemrb/GUIScripts/LUSpellSelection.py | python | OpenSpellsWindow | (actor, table, level, diff, kit=0, gen=0, recommend=True, booktype=0) | return | Opens the spells selection window.
table should refer to the name of the classes MXSPLxxx.2da.
level contains the current level of the actor.
diff contains the difference from the old level.
kit should always be GetKitIndex except when dualclassing.
gen is true if this is for character generation.
recommend is u... | Opens the spells selection window. | [
"Opens",
"the",
"spells",
"selection",
"window",
"."
] | def OpenSpellsWindow (actor, table, level, diff, kit=0, gen=0, recommend=True, booktype=0):
"""Opens the spells selection window.
table should refer to the name of the classes MXSPLxxx.2da.
level contains the current level of the actor.
diff contains the difference from the old level.
kit should always be GetKitI... | [
"def",
"OpenSpellsWindow",
"(",
"actor",
",",
"table",
",",
"level",
",",
"diff",
",",
"kit",
"=",
"0",
",",
"gen",
"=",
"0",
",",
"recommend",
"=",
"True",
",",
"booktype",
"=",
"0",
")",
":",
"global",
"SpellsWindow",
",",
"DoneButton",
",",
"Spell... | https://github.com/gemrb/gemrb/blob/730206eed8d1dd358ca5e69a62f9e099aa22ffc6/gemrb/GUIScripts/LUSpellSelection.py#L61-L253 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_scale.py | python | Scale.GetResources | (self) | return {'Pixmap': 'Draft_Scale',
'Accel': "S, C",
'MenuText': QT_TRANSLATE_NOOP("Draft_Scale", "Scale"),
'ToolTip': QT_TRANSLATE_NOOP("Draft_Scale", "Scales the selected objects from a base point.\nCTRL to snap, SHIFT to constrain, ALT to copy.")} | Set icon, menu and tooltip. | Set icon, menu and tooltip. | [
"Set",
"icon",
"menu",
"and",
"tooltip",
"."
] | def GetResources(self):
"""Set icon, menu and tooltip."""
return {'Pixmap': 'Draft_Scale',
'Accel': "S, C",
'MenuText': QT_TRANSLATE_NOOP("Draft_Scale", "Scale"),
'ToolTip': QT_TRANSLATE_NOOP("Draft_Scale", "Scales the selected objects from a base point.\... | [
"def",
"GetResources",
"(",
"self",
")",
":",
"return",
"{",
"'Pixmap'",
":",
"'Draft_Scale'",
",",
"'Accel'",
":",
"\"S, C\"",
",",
"'MenuText'",
":",
"QT_TRANSLATE_NOOP",
"(",
"\"Draft_Scale\"",
",",
"\"Scale\"",
")",
",",
"'ToolTip'",
":",
"QT_TRANSLATE_NOOP"... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_scale.py#L66-L72 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/gyp/pylib/gyp/xcode_emulation.py | python | XcodeArchsDefault.ActiveArchs | (self, archs, valid_archs, sdkroot) | return expanded_archs | Expands variables references in ARCHS, and filter by VALID_ARCHS if it
is defined (if not set, Xcode accept any value in ARCHS, otherwise, only
values present in VALID_ARCHS are kept). | Expands variables references in ARCHS, and filter by VALID_ARCHS if it
is defined (if not set, Xcode accept any value in ARCHS, otherwise, only
values present in VALID_ARCHS are kept). | [
"Expands",
"variables",
"references",
"in",
"ARCHS",
"and",
"filter",
"by",
"VALID_ARCHS",
"if",
"it",
"is",
"defined",
"(",
"if",
"not",
"set",
"Xcode",
"accept",
"any",
"value",
"in",
"ARCHS",
"otherwise",
"only",
"values",
"present",
"in",
"VALID_ARCHS",
... | def ActiveArchs(self, archs, valid_archs, sdkroot):
"""Expands variables references in ARCHS, and filter by VALID_ARCHS if it
is defined (if not set, Xcode accept any value in ARCHS, otherwise, only
values present in VALID_ARCHS are kept)."""
expanded_archs = self._ExpandArchs(archs or self._def... | [
"def",
"ActiveArchs",
"(",
"self",
",",
"archs",
",",
"valid_archs",
",",
"sdkroot",
")",
":",
"expanded_archs",
"=",
"self",
".",
"_ExpandArchs",
"(",
"archs",
"or",
"self",
".",
"_default",
",",
"sdkroot",
"or",
"\"\"",
")",
"if",
"valid_archs",
":",
"... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/xcode_emulation.py#L82-L93 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | build/android/gyp/generate_v14_compatible_resources.py | python | GenerateV14StyleResourceDom | (dom, filename, assert_not_deprecated=True) | return is_modified | Convert style resource to API 14 compatible style resource.
Args:
dom: Parsed minidom object to be modified.
filename: Filename that the DOM was parsed from.
assert_not_deprecated: Whether deprecated attributes (e.g. paddingLeft) will
cause an exception to be thrown.
Returns... | Convert style resource to API 14 compatible style resource. | [
"Convert",
"style",
"resource",
"to",
"API",
"14",
"compatible",
"style",
"resource",
"."
] | def GenerateV14StyleResourceDom(dom, filename, assert_not_deprecated=True):
"""Convert style resource to API 14 compatible style resource.
Args:
dom: Parsed minidom object to be modified.
filename: Filename that the DOM was parsed from.
assert_not_deprecated: Whether deprecated attributes (e.g. padding... | [
"def",
"GenerateV14StyleResourceDom",
"(",
"dom",
",",
"filename",
",",
"assert_not_deprecated",
"=",
"True",
")",
":",
"is_modified",
"=",
"False",
"for",
"style_element",
"in",
"dom",
".",
"getElementsByTagName",
"(",
"'style'",
")",
":",
"for",
"item_element",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/build/android/gyp/generate_v14_compatible_resources.py#L158-L182 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/grid.py | python | GridSizesInfo.__init__ | (self, *args, **kwargs) | __init__(self, int defSize, wxArrayInt allSizes) -> GridSizesInfo | __init__(self, int defSize, wxArrayInt allSizes) -> GridSizesInfo | [
"__init__",
"(",
"self",
"int",
"defSize",
"wxArrayInt",
"allSizes",
")",
"-",
">",
"GridSizesInfo"
] | def __init__(self, *args, **kwargs):
"""__init__(self, int defSize, wxArrayInt allSizes) -> GridSizesInfo"""
_grid.GridSizesInfo_swiginit(self,_grid.new_GridSizesInfo(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_grid",
".",
"GridSizesInfo_swiginit",
"(",
"self",
",",
"_grid",
".",
"new_GridSizesInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/grid.py#L1180-L1182 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/engine/base_layer_v1.py | python | Layer.get_output_mask_at | (self, node_index) | Retrieves the output mask tensor(s) of a layer at a given node.
Args:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
first time the layer was called.
Returns:
A mask tensor
(or ... | Retrieves the output mask tensor(s) of a layer at a given node. | [
"Retrieves",
"the",
"output",
"mask",
"tensor",
"(",
"s",
")",
"of",
"a",
"layer",
"at",
"a",
"given",
"node",
"."
] | def get_output_mask_at(self, node_index):
"""Retrieves the output mask tensor(s) of a layer at a given node.
Args:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
first time the layer was called.... | [
"def",
"get_output_mask_at",
"(",
"self",
",",
"node_index",
")",
":",
"output",
"=",
"self",
".",
"get_output_at",
"(",
"node_index",
")",
"if",
"isinstance",
"(",
"output",
",",
"list",
")",
":",
"return",
"[",
"getattr",
"(",
"x",
",",
"'_keras_mask'",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/engine/base_layer_v1.py#L1407-L1424 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | PrintPreview.AdjustScrollbars | (*args, **kwargs) | return _windows_.PrintPreview_AdjustScrollbars(*args, **kwargs) | AdjustScrollbars(self, PreviewCanvas canvas) | AdjustScrollbars(self, PreviewCanvas canvas) | [
"AdjustScrollbars",
"(",
"self",
"PreviewCanvas",
"canvas",
")"
] | def AdjustScrollbars(*args, **kwargs):
"""AdjustScrollbars(self, PreviewCanvas canvas)"""
return _windows_.PrintPreview_AdjustScrollbars(*args, **kwargs) | [
"def",
"AdjustScrollbars",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PrintPreview_AdjustScrollbars",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L5617-L5619 | |
openthread/openthread | 9fcdbed9c526c70f1556d1ed84099c1535c7cd32 | tools/harness-thci/OpenThread_WpanCtl.py | python | OpenThread_WpanCtl.removeRouter | (self, xRouterId) | kick router with a given router id from the Thread Network
Args:
xRouterId: a given router id in hex format
Returns:
True: successful to remove the router from the Thread Network
False: fail to remove the router from the Thread Network | kick router with a given router id from the Thread Network | [
"kick",
"router",
"with",
"a",
"given",
"router",
"id",
"from",
"the",
"Thread",
"Network"
] | def removeRouter(self, xRouterId):
"""kick router with a given router id from the Thread Network
Args:
xRouterId: a given router id in hex format
Returns:
True: successful to remove the router from the Thread Network
False: fail to remove the router from the... | [
"def",
"removeRouter",
"(",
"self",
",",
"xRouterId",
")",
":",
"print",
"(",
"'%s call removeRouter'",
"%",
"self",
".",
"port",
")",
"print",
"(",
"xRouterId",
")",
"routerId",
"=",
"''",
"routerId",
"=",
"self",
".",
"__convertRlocToRouterId",
"(",
"xRout... | https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/tools/harness-thci/OpenThread_WpanCtl.py#L1403-L1427 | ||
logcabin/logcabin | ee6c55ae9744b82b451becd9707d26c7c1b6bbfb | scripts/common.py | python | captureSh | (command, **kwargs) | Execute a local command and capture its output. | Execute a local command and capture its output. | [
"Execute",
"a",
"local",
"command",
"and",
"capture",
"its",
"output",
"."
] | def captureSh(command, **kwargs):
"""Execute a local command and capture its output."""
kwargs['shell'] = True
kwargs['stdout'] = subprocess.PIPE
p = subprocess.Popen(command, **kwargs)
output = p.communicate()[0]
if p.returncode:
raise subprocess.CalledProcessError(p.returncode, comman... | [
"def",
"captureSh",
"(",
"command",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'shell'",
"]",
"=",
"True",
"kwargs",
"[",
"'stdout'",
"]",
"=",
"subprocess",
".",
"PIPE",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"command",
",",
"*",
"*",
... | https://github.com/logcabin/logcabin/blob/ee6c55ae9744b82b451becd9707d26c7c1b6bbfb/scripts/common.py#L39-L51 | ||
cksystemsgroup/scal | fa2208a97a77d65f4e90f85fef3404c27c1f2ac2 | tools/cpplint.py | python | CheckCStyleCast | (filename, clean_lines, linenum, cast_type, pattern, error) | return True | Checks for a C-style cast by looking for the pattern.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
cast_type: The string for the C++ cast to recommend. This is either
reinterpret_cast, static_... | Checks for a C-style cast by looking for the pattern. | [
"Checks",
"for",
"a",
"C",
"-",
"style",
"cast",
"by",
"looking",
"for",
"the",
"pattern",
"."
] | def CheckCStyleCast(filename, clean_lines, linenum, cast_type, pattern, error):
"""Checks for a C-style cast by looking for the pattern.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
cast_type: The ... | [
"def",
"CheckCStyleCast",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"cast_type",
",",
"pattern",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"match",
"=",
"Search",
"(",
"pattern",
",",
"line",
... | https://github.com/cksystemsgroup/scal/blob/fa2208a97a77d65f4e90f85fef3404c27c1f2ac2/tools/cpplint.py#L5337-L5438 | |
esphome/esphome | 40e06c9819f17409615d4f4eec5cfe4dc9a3776d | esphome/config.py | python | Config.get_path_for_id | (self, id: core.ID) | Return the config fragment where the given ID is declared. | Return the config fragment where the given ID is declared. | [
"Return",
"the",
"config",
"fragment",
"where",
"the",
"given",
"ID",
"is",
"declared",
"."
] | def get_path_for_id(self, id: core.ID):
"""Return the config fragment where the given ID is declared."""
for declared_id, path in self.declare_ids:
if declared_id.id == str(id):
return path
raise KeyError(f"ID {id} not found in configuration") | [
"def",
"get_path_for_id",
"(",
"self",
",",
"id",
":",
"core",
".",
"ID",
")",
":",
"for",
"declared_id",
",",
"path",
"in",
"self",
".",
"declare_ids",
":",
"if",
"declared_id",
".",
"id",
"==",
"str",
"(",
"id",
")",
":",
"return",
"path",
"raise",... | https://github.com/esphome/esphome/blob/40e06c9819f17409615d4f4eec5cfe4dc9a3776d/esphome/config.py#L218-L223 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ebmlib/fileutil.py | python | Which | (program) | return None | Find the path of the given executable
@param program: executable name (i.e 'python')
@return: executable path or None | Find the path of the given executable
@param program: executable name (i.e 'python')
@return: executable path or None | [
"Find",
"the",
"path",
"of",
"the",
"given",
"executable",
"@param",
"program",
":",
"executable",
"name",
"(",
"i",
".",
"e",
"python",
")",
"@return",
":",
"executable",
"path",
"or",
"None"
] | def Which(program):
"""Find the path of the given executable
@param program: executable name (i.e 'python')
@return: executable path or None
"""
# Check local directory first
if IsExecutable(program):
return program
else:
# Start looking on the $PATH
for path in os.e... | [
"def",
"Which",
"(",
"program",
")",
":",
"# Check local directory first",
"if",
"IsExecutable",
"(",
"program",
")",
":",
"return",
"program",
"else",
":",
"# Start looking on the $PATH",
"for",
"path",
"in",
"os",
".",
"environ",
"[",
"\"PATH\"",
"]",
".",
"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ebmlib/fileutil.py#L302-L317 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/random.py | python | Random.__init__ | (self, x=None) | Initialize an instance.
Optional argument x controls seeding, as for Random.seed(). | Initialize an instance. | [
"Initialize",
"an",
"instance",
"."
] | def __init__(self, x=None):
"""Initialize an instance.
Optional argument x controls seeding, as for Random.seed().
"""
self.seed(x)
self.gauss_next = None | [
"def",
"__init__",
"(",
"self",
",",
"x",
"=",
"None",
")",
":",
"self",
".",
"seed",
"(",
"x",
")",
"self",
".",
"gauss_next",
"=",
"None"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/random.py#L88-L95 | ||
InsightSoftwareConsortium/ITK | 87acfce9a93d928311c38bc371b666b515b9f19d | Modules/ThirdParty/pygccxml/src/pygccxml/declarations/declaration_utils.py | python | full_name | (decl, with_defaults=True) | Returns declaration full qualified name.
If `decl` belongs to anonymous namespace or class, the function will return
C++ illegal qualified name.
Args:
decl (declaration_t): declaration for which the full qualified name
should be calculated.
Returns:
list[... | Returns declaration full qualified name. | [
"Returns",
"declaration",
"full",
"qualified",
"name",
"."
] | def full_name(decl, with_defaults=True):
"""
Returns declaration full qualified name.
If `decl` belongs to anonymous namespace or class, the function will return
C++ illegal qualified name.
Args:
decl (declaration_t): declaration for which the full qualified name
... | [
"def",
"full_name",
"(",
"decl",
",",
"with_defaults",
"=",
"True",
")",
":",
"if",
"None",
"is",
"decl",
":",
"raise",
"RuntimeError",
"(",
"\"Unable to generate full name for None object!\"",
")",
"if",
"with_defaults",
":",
"if",
"not",
"decl",
".",
"cache",
... | https://github.com/InsightSoftwareConsortium/ITK/blob/87acfce9a93d928311c38bc371b666b515b9f19d/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/declaration_utils.py#L90-L128 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.