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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/parsers.py | python | ResponseParser.parse | (self, response, shape) | return parsed | Parse the HTTP response given a shape.
:param response: The HTTP response dictionary. This is a dictionary
that represents the HTTP request. The dictionary must have the
following keys, ``body``, ``headers``, and ``status_code``.
:param shape: The model shape describing the e... | Parse the HTTP response given a shape. | [
"Parse",
"the",
"HTTP",
"response",
"given",
"a",
"shape",
"."
] | def parse(self, response, shape):
"""Parse the HTTP response given a shape.
:param response: The HTTP response dictionary. This is a dictionary
that represents the HTTP request. The dictionary must have the
following keys, ``body``, ``headers``, and ``status_code``.
:... | [
"def",
"parse",
"(",
"self",
",",
"response",
",",
"shape",
")",
":",
"LOG",
".",
"debug",
"(",
"'Response headers: %s'",
",",
"response",
"[",
"'headers'",
"]",
")",
"LOG",
".",
"debug",
"(",
"'Response body:\\n%s'",
",",
"response",
"[",
"'body'",
"]",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/parsers.py#L217-L259 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/boost/boost_1_68_0/tools/build/src/build/targets.py | python | ProjectTarget.generate | (self, ps) | return result | Generates all possible targets contained in this project. | Generates all possible targets contained in this project. | [
"Generates",
"all",
"possible",
"targets",
"contained",
"in",
"this",
"project",
"."
] | def generate (self, ps):
""" Generates all possible targets contained in this project.
"""
assert isinstance(ps, property_set.PropertySet)
self.manager_.targets().log(
"Building project '%s' with '%s'" % (self.name (), str(ps)))
self.manager_.targets().increase_indent... | [
"def",
"generate",
"(",
"self",
",",
"ps",
")",
":",
"assert",
"isinstance",
"(",
"ps",
",",
"property_set",
".",
"PropertySet",
")",
"self",
".",
"manager_",
".",
"targets",
"(",
")",
".",
"log",
"(",
"\"Building project '%s' with '%s'\"",
"%",
"(",
"self... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/boost/boost_1_68_0/tools/build/src/build/targets.py#L433-L448 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/gluon/block.py | python | Block.apply | (self, fn) | return self | r"""Applies ``fn`` recursively to every child block as well as self.
Parameters
----------
fn : callable
Function to be applied to each submodule, of form `fn(block)`.
Returns
-------
this block | r"""Applies ``fn`` recursively to every child block as well as self. | [
"r",
"Applies",
"fn",
"recursively",
"to",
"every",
"child",
"block",
"as",
"well",
"as",
"self",
"."
] | def apply(self, fn):
r"""Applies ``fn`` recursively to every child block as well as self.
Parameters
----------
fn : callable
Function to be applied to each submodule, of form `fn(block)`.
Returns
-------
this block
"""
for cld in sel... | [
"def",
"apply",
"(",
"self",
",",
"fn",
")",
":",
"for",
"cld",
"in",
"self",
".",
"_children",
".",
"values",
"(",
")",
":",
"cld",
"(",
")",
".",
"apply",
"(",
"fn",
")",
"fn",
"(",
"self",
")",
"return",
"self"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/gluon/block.py#L539-L554 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/util/deprecation.py | python | deprecated_argument_lookup | (new_name, new_value, old_name, old_value) | return new_value | Looks up deprecated argument name and ensures both are not used.
Args:
new_name: new name of argument
new_value: value of new argument (or None if not used)
old_name: old name of argument
old_value: value of old argument (or None if not used)
Returns:
The effective argument that should be used.... | Looks up deprecated argument name and ensures both are not used. | [
"Looks",
"up",
"deprecated",
"argument",
"name",
"and",
"ensures",
"both",
"are",
"not",
"used",
"."
] | def deprecated_argument_lookup(new_name, new_value, old_name, old_value):
"""Looks up deprecated argument name and ensures both are not used.
Args:
new_name: new name of argument
new_value: value of new argument (or None if not used)
old_name: old name of argument
old_value: value of old argument (... | [
"def",
"deprecated_argument_lookup",
"(",
"new_name",
",",
"new_value",
",",
"old_name",
",",
"old_value",
")",
":",
"if",
"old_value",
"is",
"not",
"None",
":",
"if",
"new_value",
"is",
"not",
"None",
":",
"raise",
"ValueError",
"(",
"\"Cannot specify both '%s'... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/util/deprecation.py#L583-L601 | |
microsoft/EdgeML | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | examples/pytorch/FastCells/KWS-training/kws-demo.py | python | save | (data, sample_width, path) | Saves audio `data` to given path. | Saves audio `data` to given path. | [
"Saves",
"audio",
"data",
"to",
"given",
"path",
"."
] | def save(data, sample_width, path):
"""
Saves audio `data` to given path.
"""
wf = wave.open(path, 'wb')
wf.setnchannels(1)
wf.setsampwidth(sample_width)
wf.setframerate(RATE)
wf.writeframes(data)
wf.close() | [
"def",
"save",
"(",
"data",
",",
"sample_width",
",",
"path",
")",
":",
"wf",
"=",
"wave",
".",
"open",
"(",
"path",
",",
"'wb'",
")",
"wf",
".",
"setnchannels",
"(",
"1",
")",
"wf",
".",
"setsampwidth",
"(",
"sample_width",
")",
"wf",
".",
"setfra... | https://github.com/microsoft/EdgeML/blob/ef9f8a77f096acbdeb941014791f8eda1c1bc35b/examples/pytorch/FastCells/KWS-training/kws-demo.py#L169-L178 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/ttk.py | python | LabeledScale.__init__ | (self, master=None, variable=None, from_=0, to=10, **kw) | Construct an horizontal LabeledScale with parent master, a
variable to be associated with the Ttk Scale widget and its range.
If variable is not specified, a Tkinter.IntVar is created.
WIDGET-SPECIFIC OPTIONS
compound: 'top' or 'bottom'
Specifies how to display the ... | Construct an horizontal LabeledScale with parent master, a
variable to be associated with the Ttk Scale widget and its range.
If variable is not specified, a Tkinter.IntVar is created. | [
"Construct",
"an",
"horizontal",
"LabeledScale",
"with",
"parent",
"master",
"a",
"variable",
"to",
"be",
"associated",
"with",
"the",
"Ttk",
"Scale",
"widget",
"and",
"its",
"range",
".",
"If",
"variable",
"is",
"not",
"specified",
"a",
"Tkinter",
".",
"Int... | def __init__(self, master=None, variable=None, from_=0, to=10, **kw):
"""Construct an horizontal LabeledScale with parent master, a
variable to be associated with the Ttk Scale widget and its range.
If variable is not specified, a Tkinter.IntVar is created.
WIDGET-SPECIFIC OPTIONS
... | [
"def",
"__init__",
"(",
"self",
",",
"master",
"=",
"None",
",",
"variable",
"=",
"None",
",",
"from_",
"=",
"0",
",",
"to",
"=",
"10",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"_label_top",
"=",
"kw",
".",
"pop",
"(",
"'compound'",
",",
"'t... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/ttk.py#L1466-L1498 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/graph_editor/subgraph.py | python | SubGraphView.find_op_by_name | (self, op_name) | return res[0] | Return the op named op_name.
Args:
op_name: the name to search for
Returns:
The op named op_name.
Raises:
ValueError: if the op_name could not be found.
AssertionError: if the name was found multiple time. | Return the op named op_name. | [
"Return",
"the",
"op",
"named",
"op_name",
"."
] | def find_op_by_name(self, op_name):
"""Return the op named op_name.
Args:
op_name: the name to search for
Returns:
The op named op_name.
Raises:
ValueError: if the op_name could not be found.
AssertionError: if the name was found multiple time.
"""
res = [op for op in se... | [
"def",
"find_op_by_name",
"(",
"self",
",",
"op_name",
")",
":",
"res",
"=",
"[",
"op",
"for",
"op",
"in",
"self",
".",
"_ops",
"if",
"op",
".",
"name",
"==",
"op_name",
"]",
"if",
"not",
"res",
":",
"raise",
"ValueError",
"(",
"\"{} not in subgraph.\"... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/graph_editor/subgraph.py#L397-L413 | |
tfwu/FaceDetection-ConvNet-3D | f9251c48eb40c5aec8fba7455115c355466555be | example/kaggle-ndsb2/Preprocessing.py | python | write_data_csv | (fname, frames, preproc) | return result | Write data to csv file | Write data to csv file | [
"Write",
"data",
"to",
"csv",
"file"
] | def write_data_csv(fname, frames, preproc):
"""Write data to csv file"""
fdata = open(fname, "w")
dr = Parallel()(delayed(get_data)(lst,preproc) for lst in frames)
data,result = zip(*dr)
for entry in data:
fdata.write(','.join(entry)+'\r\n')
print("All finished, %d slices in total" % len(data))
... | [
"def",
"write_data_csv",
"(",
"fname",
",",
"frames",
",",
"preproc",
")",
":",
"fdata",
"=",
"open",
"(",
"fname",
",",
"\"w\"",
")",
"dr",
"=",
"Parallel",
"(",
")",
"(",
"delayed",
"(",
"get_data",
")",
"(",
"lst",
",",
"preproc",
")",
"for",
"l... | https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/example/kaggle-ndsb2/Preprocessing.py#L77-L87 | |
microsoft/LightGBM | 904b2d5158703c4900b68008617951dd2f9ff21b | python-package/lightgbm/basic.py | python | Booster.update | (self, train_set=None, fobj=None) | Update Booster for one iteration.
Parameters
----------
train_set : Dataset or None, optional (default=None)
Training data.
If None, last training data is used.
fobj : callable or None, optional (default=None)
Customized objective function.
... | Update Booster for one iteration. | [
"Update",
"Booster",
"for",
"one",
"iteration",
"."
] | def update(self, train_set=None, fobj=None):
"""Update Booster for one iteration.
Parameters
----------
train_set : Dataset or None, optional (default=None)
Training data.
If None, last training data is used.
fobj : callable or None, optional (default=Non... | [
"def",
"update",
"(",
"self",
",",
"train_set",
"=",
"None",
",",
"fobj",
"=",
"None",
")",
":",
"# need reset training data",
"if",
"train_set",
"is",
"None",
"and",
"self",
".",
"train_set_version",
"!=",
"self",
".",
"train_set",
".",
"version",
":",
"t... | https://github.com/microsoft/LightGBM/blob/904b2d5158703c4900b68008617951dd2f9ff21b/python-package/lightgbm/basic.py#L2936-L3002 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/rfc822.py | python | AddrlistClass.getatom | (self, atomends=None) | return ''.join(atomlist) | Parse an RFC 2822 atom.
Optional atomends specifies a different set of end token delimiters
(the default is to use self.atomends). This is used e.g. in
getphraselist() since phrase endings must not include the `.' (which
is legal in phrases). | Parse an RFC 2822 atom. | [
"Parse",
"an",
"RFC",
"2822",
"atom",
"."
] | def getatom(self, atomends=None):
"""Parse an RFC 2822 atom.
Optional atomends specifies a different set of end token delimiters
(the default is to use self.atomends). This is used e.g. in
getphraselist() since phrase endings must not include the `.' (which
is legal in phrases)... | [
"def",
"getatom",
"(",
"self",
",",
"atomends",
"=",
"None",
")",
":",
"atomlist",
"=",
"[",
"''",
"]",
"if",
"atomends",
"is",
"None",
":",
"atomends",
"=",
"self",
".",
"atomends",
"while",
"self",
".",
"pos",
"<",
"len",
"(",
"self",
".",
"field... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/rfc822.py#L728-L745 | |
rsummers11/CADLab | 976ed959a0b5208bb4173127a7ef732ac73a9b6f | lesion_detector_3DCE/rcnn/processing/generate_anchor.py | python | _ratio_enum | (anchor, ratios) | return anchors | Enumerate a set of anchors for each aspect ratio wrt an anchor. | Enumerate a set of anchors for each aspect ratio wrt an anchor. | [
"Enumerate",
"a",
"set",
"of",
"anchors",
"for",
"each",
"aspect",
"ratio",
"wrt",
"an",
"anchor",
"."
] | def _ratio_enum(anchor, ratios):
"""
Enumerate a set of anchors for each aspect ratio wrt an anchor.
"""
w, h, x_ctr, y_ctr = _whctrs(anchor)
size = w * h
size_ratios = size / ratios
ws = np.round(np.sqrt(size_ratios))
hs = np.round(ws * ratios)
anchors = _mkanchors(ws, hs, x_ctr, y... | [
"def",
"_ratio_enum",
"(",
"anchor",
",",
"ratios",
")",
":",
"w",
",",
"h",
",",
"x_ctr",
",",
"y_ctr",
"=",
"_whctrs",
"(",
"anchor",
")",
"size",
"=",
"w",
"*",
"h",
"size_ratios",
"=",
"size",
"/",
"ratios",
"ws",
"=",
"np",
".",
"round",
"("... | https://github.com/rsummers11/CADLab/blob/976ed959a0b5208bb4173127a7ef732ac73a9b6f/lesion_detector_3DCE/rcnn/processing/generate_anchor.py#L49-L60 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/tkFont.py | python | names | (root=None) | return root.tk.splitlist(root.tk.call("font", "names")) | Get names of defined fonts (as a tuple) | Get names of defined fonts (as a tuple) | [
"Get",
"names",
"of",
"defined",
"fonts",
"(",
"as",
"a",
"tuple",
")"
] | def names(root=None):
"Get names of defined fonts (as a tuple)"
if not root:
root = Tkinter._default_root
return root.tk.splitlist(root.tk.call("font", "names")) | [
"def",
"names",
"(",
"root",
"=",
"None",
")",
":",
"if",
"not",
"root",
":",
"root",
"=",
"Tkinter",
".",
"_default_root",
"return",
"root",
".",
"tk",
".",
"splitlist",
"(",
"root",
".",
"tk",
".",
"call",
"(",
"\"font\"",
",",
"\"names\"",
")",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/tkFont.py#L172-L176 | |
ApolloAuto/apollo | 463fb82f9e979d02dcb25044e60931293ab2dba0 | modules/tools/control_info/control_info.py | python | ControlInfo.callback_control | (self, entity) | New Control Command | New Control Command | [
"New",
"Control",
"Command"
] | def callback_control(self, entity):
"""
New Control Command
"""
self.throttlecmd.append(entity.throttle)
self.brakecmd.append(entity.brake)
self.steercmd.append(entity.steering_target)
self.controltime.append(entity.header.timestamp_sec)
self.acceleration... | [
"def",
"callback_control",
"(",
"self",
",",
"entity",
")",
":",
"self",
".",
"throttlecmd",
".",
"append",
"(",
"entity",
".",
"throttle",
")",
"self",
".",
"brakecmd",
".",
"append",
"(",
"entity",
".",
"brake",
")",
"self",
".",
"steercmd",
".",
"ap... | https://github.com/ApolloAuto/apollo/blob/463fb82f9e979d02dcb25044e60931293ab2dba0/modules/tools/control_info/control_info.py#L150-L191 | ||
alibaba/graph-learn | 54cafee9db3054dc310a28b856be7f97c7d5aee9 | graphlearn/python/nn/tf/data/feature_column.py | python | NumericColumn.forward | (self, x) | return x | Args:
x: A 1D Tensor with type tf.float32 or other type which can be casted to
tf.float32.
Returns:
A `tf.Tensor` with the same shape of the input feature and with the type
tf.float32. | Args:
x: A 1D Tensor with type tf.float32 or other type which can be casted to
tf.float32.
Returns:
A `tf.Tensor` with the same shape of the input feature and with the type
tf.float32. | [
"Args",
":",
"x",
":",
"A",
"1D",
"Tensor",
"with",
"type",
"tf",
".",
"float32",
"or",
"other",
"type",
"which",
"can",
"be",
"casted",
"to",
"tf",
".",
"float32",
".",
"Returns",
":",
"A",
"tf",
".",
"Tensor",
"with",
"the",
"same",
"shape",
"of"... | def forward(self, x):
"""
Args:
x: A 1D Tensor with type tf.float32 or other type which can be casted to
tf.float32.
Returns:
A `tf.Tensor` with the same shape of the input feature and with the type
tf.float32.
"""
if self.normalizer_func is not None:
x = self.normaliz... | [
"def",
"forward",
"(",
"self",
",",
"x",
")",
":",
"if",
"self",
".",
"normalizer_func",
"is",
"not",
"None",
":",
"x",
"=",
"self",
".",
"normalizer_func",
"(",
"x",
")",
"x",
"=",
"tf",
".",
"cast",
"(",
"x",
",",
"tf",
".",
"float32",
")",
"... | https://github.com/alibaba/graph-learn/blob/54cafee9db3054dc310a28b856be7f97c7d5aee9/graphlearn/python/nn/tf/data/feature_column.py#L108-L120 | |
luliyucoordinate/Leetcode | 96afcdc54807d1d184e881a075d1dbf3371e31fb | src/0078-Subsets/0078.py | python | Solution.subsets | (self, nums) | return result + [[nums[0]] + s for s in result] | :type nums: List[int]
:rtype: List[List[int]] | :type nums: List[int]
:rtype: List[List[int]] | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"List",
"[",
"List",
"[",
"int",
"]]"
] | def subsets(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
if not nums:
return [[]]
result = self.subsets(nums[1:])
return result + [[nums[0]] + s for s in result] | [
"def",
"subsets",
"(",
"self",
",",
"nums",
")",
":",
"if",
"not",
"nums",
":",
"return",
"[",
"[",
"]",
"]",
"result",
"=",
"self",
".",
"subsets",
"(",
"nums",
"[",
"1",
":",
"]",
")",
"return",
"result",
"+",
"[",
"[",
"nums",
"[",
"0",
"]... | https://github.com/luliyucoordinate/Leetcode/blob/96afcdc54807d1d184e881a075d1dbf3371e31fb/src/0078-Subsets/0078.py#L2-L10 | |
Evolving-AI-Lab/fooling | 66f097dd6bd2eb6794ade3e187a7adfdf1887688 | caffe/scripts/cpp_lint.py | python | _IsTestFilename | (filename) | Determines if the given filename has a suffix that identifies it as a test.
Args:
filename: The input filename.
Returns:
True if 'filename' looks like a test, False otherwise. | Determines if the given filename has a suffix that identifies it as a test. | [
"Determines",
"if",
"the",
"given",
"filename",
"has",
"a",
"suffix",
"that",
"identifies",
"it",
"as",
"a",
"test",
"."
] | def _IsTestFilename(filename):
"""Determines if the given filename has a suffix that identifies it as a test.
Args:
filename: The input filename.
Returns:
True if 'filename' looks like a test, False otherwise.
"""
if (filename.endswith('_test.cc') or
filename.endswith('_unittest.cc') or
... | [
"def",
"_IsTestFilename",
"(",
"filename",
")",
":",
"if",
"(",
"filename",
".",
"endswith",
"(",
"'_test.cc'",
")",
"or",
"filename",
".",
"endswith",
"(",
"'_unittest.cc'",
")",
"or",
"filename",
".",
"endswith",
"(",
"'_regtest.cc'",
")",
")",
":",
"ret... | https://github.com/Evolving-AI-Lab/fooling/blob/66f097dd6bd2eb6794ade3e187a7adfdf1887688/caffe/scripts/cpp_lint.py#L3533-L3547 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/pyparse.py | python | Parser.find_good_parse_start | (self, is_char_in_string) | return pos | Return index of a good place to begin parsing, as close to the
end of the string as possible. This will be the start of some
popular stmt like "if" or "def". Return None if none found:
the caller should pass more prior context then, if possible, or
if not (the entire program text up un... | Return index of a good place to begin parsing, as close to the
end of the string as possible. This will be the start of some
popular stmt like "if" or "def". Return None if none found:
the caller should pass more prior context then, if possible, or
if not (the entire program text up un... | [
"Return",
"index",
"of",
"a",
"good",
"place",
"to",
"begin",
"parsing",
"as",
"close",
"to",
"the",
"end",
"of",
"the",
"string",
"as",
"possible",
".",
"This",
"will",
"be",
"the",
"start",
"of",
"some",
"popular",
"stmt",
"like",
"if",
"or",
"def",
... | def find_good_parse_start(self, is_char_in_string):
"""
Return index of a good place to begin parsing, as close to the
end of the string as possible. This will be the start of some
popular stmt like "if" or "def". Return None if none found:
the caller should pass more prior con... | [
"def",
"find_good_parse_start",
"(",
"self",
",",
"is_char_in_string",
")",
":",
"code",
",",
"pos",
"=",
"self",
".",
"code",
",",
"None",
"# Peek back from the end for a good place to start,",
"# but don't try too often; pos will be left None, or",
"# bumped to a legitimate s... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/pyparse.py#L136-L190 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/framework/common_shapes.py | python | conv2d_shape | (op) | return [tensor_shape.TensorShape(output_shape)] | Shape function for a Conv2D op.
This op has two inputs:
* input, a 4D tensor with shape = [batch_size, rows, cols, depth_in]
* filter, a 4D tensor with shape = [filter_rows, filter_cols,
depth_in, depth_out]
The output is a 4D tensor with shape = [batch_size, out_rows,
out_cols, depth_out], where out_... | Shape function for a Conv2D op. | [
"Shape",
"function",
"for",
"a",
"Conv2D",
"op",
"."
] | def conv2d_shape(op):
"""Shape function for a Conv2D op.
This op has two inputs:
* input, a 4D tensor with shape = [batch_size, rows, cols, depth_in]
* filter, a 4D tensor with shape = [filter_rows, filter_cols,
depth_in, depth_out]
The output is a 4D tensor with shape = [batch_size, out_rows,
out_c... | [
"def",
"conv2d_shape",
"(",
"op",
")",
":",
"input_shape",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
".",
"get_shape",
"(",
")",
".",
"with_rank",
"(",
"4",
")",
"filter_shape",
"=",
"op",
".",
"inputs",
"[",
"1",
"]",
".",
"get_shape",
"(",
")",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/framework/common_shapes.py#L155-L221 | |
moderngl/moderngl | 32fe79927e02b0fa893b3603d677bdae39771e14 | extras/gc/boom.py | python | ref_count | () | Simple refcount demo | Simple refcount demo | [
"Simple",
"refcount",
"demo"
] | def ref_count():
"""Simple refcount demo"""
var1 = [1, 2]
print(c_long.from_address(id(var1)).value) | [
"def",
"ref_count",
"(",
")",
":",
"var1",
"=",
"[",
"1",
",",
"2",
"]",
"print",
"(",
"c_long",
".",
"from_address",
"(",
"id",
"(",
"var1",
")",
")",
".",
"value",
")"
] | https://github.com/moderngl/moderngl/blob/32fe79927e02b0fa893b3603d677bdae39771e14/extras/gc/boom.py#L22-L25 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py | python | Decimal._round_up | (self, prec) | return -self._round_down(prec) | Rounds away from 0. | Rounds away from 0. | [
"Rounds",
"away",
"from",
"0",
"."
] | def _round_up(self, prec):
"""Rounds away from 0."""
return -self._round_down(prec) | [
"def",
"_round_up",
"(",
"self",
",",
"prec",
")",
":",
"return",
"-",
"self",
".",
"_round_down",
"(",
"prec",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py#L1749-L1751 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/dev_tool.py | python | LogMsg.ClockTime | (self) | return tstamp | Formatted timestring of the messages timestamp | Formatted timestring of the messages timestamp | [
"Formatted",
"timestring",
"of",
"the",
"messages",
"timestamp"
] | def ClockTime(self):
"""Formatted timestring of the messages timestamp"""
ltime = time.localtime(self._msg['tstamp'])
tstamp = u"%s:%s:%s" % (str(ltime[3]).zfill(2),
str(ltime[4]).zfill(2),
str(ltime[5]).zfill(2))
return tst... | [
"def",
"ClockTime",
"(",
"self",
")",
":",
"ltime",
"=",
"time",
".",
"localtime",
"(",
"self",
".",
"_msg",
"[",
"'tstamp'",
"]",
")",
"tstamp",
"=",
"u\"%s:%s:%s\"",
"%",
"(",
"str",
"(",
"ltime",
"[",
"3",
"]",
")",
".",
"zfill",
"(",
"2",
")"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/dev_tool.py#L211-L217 | |
NicknineTheEagle/TF2-Base | 20459c5a7fbc995b6bf54fa85c2f62a101e9fb64 | src/thirdparty/protobuf-2.3.0/python/mox.py | python | MultipleTimesGroup.MethodCalled | (self, mock_method) | Remove a method call from the group.
If the method is not in the set, an UnexpectedMethodCallError will be
raised.
Args:
mock_method: a mock method that should be equal to a method in the group.
Returns:
The mock method from the group
Raises:
UnexpectedMethodCallError if the mo... | Remove a method call from the group. | [
"Remove",
"a",
"method",
"call",
"from",
"the",
"group",
"."
] | def MethodCalled(self, mock_method):
"""Remove a method call from the group.
If the method is not in the set, an UnexpectedMethodCallError will be
raised.
Args:
mock_method: a mock method that should be equal to a method in the group.
Returns:
The mock method from the group
Raise... | [
"def",
"MethodCalled",
"(",
"self",
",",
"mock_method",
")",
":",
"# Check to see if this method exists, and if so add it to the set of",
"# called methods.",
"for",
"method",
"in",
"self",
".",
"_methods",
":",
"if",
"method",
"==",
"mock_method",
":",
"self",
".",
"... | https://github.com/NicknineTheEagle/TF2-Base/blob/20459c5a7fbc995b6bf54fa85c2f62a101e9fb64/src/thirdparty/protobuf-2.3.0/python/mox.py#L1285-L1316 | ||
wbaizx/VideoLive | 9452554b58536c54a5dd1a2ebd5b76363bd39c06 | library/src/main/cpp/libyuv/PRESUBMIT.py | python | GetDefaultTryConfigs | (bots=None) | return { 'tryserver.libyuv': dict((bot, []) for bot in bots)} | Returns a list of ('bot', set(['tests']), optionally filtered by [bots].
For WebRTC purposes, we always return an empty list of tests, since we want
to run all tests by default on all our trybots. | Returns a list of ('bot', set(['tests']), optionally filtered by [bots]. | [
"Returns",
"a",
"list",
"of",
"(",
"bot",
"set",
"(",
"[",
"tests",
"]",
")",
"optionally",
"filtered",
"by",
"[",
"bots",
"]",
"."
] | def GetDefaultTryConfigs(bots=None):
"""Returns a list of ('bot', set(['tests']), optionally filtered by [bots].
For WebRTC purposes, we always return an empty list of tests, since we want
to run all tests by default on all our trybots.
"""
return { 'tryserver.libyuv': dict((bot, []) for bot in bots)} | [
"def",
"GetDefaultTryConfigs",
"(",
"bots",
"=",
"None",
")",
":",
"return",
"{",
"'tryserver.libyuv'",
":",
"dict",
"(",
"(",
"bot",
",",
"[",
"]",
")",
"for",
"bot",
"in",
"bots",
")",
"}"
] | https://github.com/wbaizx/VideoLive/blob/9452554b58536c54a5dd1a2ebd5b76363bd39c06/library/src/main/cpp/libyuv/PRESUBMIT.py#L13-L19 | |
RLBot/RLBot | 34332b12cf158b3ef8dbf174ae67c53683368a9d | src/main/python/rlbot/matchcomms/server.py | python | launch_matchcomms_server | () | return MatchcommsServerThread(
root_url=URL(scheme='ws', netloc=f'{host}:{port}', path='', params='', query='', fragment=''),
_server=server,
_event_loop=event_loop,
_thread=thread,
) | Launches a background process that handles match communications. | Launches a background process that handles match communications. | [
"Launches",
"a",
"background",
"process",
"that",
"handles",
"match",
"communications",
"."
] | def launch_matchcomms_server() -> MatchcommsServerThread:
"""
Launches a background process that handles match communications.
"""
host = 'localhost'
port = find_free_port() # deliberately not using a fixed port to prevent hardcoding fragility.
event_loop = asyncio.new_event_loop()
matchco... | [
"def",
"launch_matchcomms_server",
"(",
")",
"->",
"MatchcommsServerThread",
":",
"host",
"=",
"'localhost'",
"port",
"=",
"find_free_port",
"(",
")",
"# deliberately not using a fixed port to prevent hardcoding fragility.",
"event_loop",
"=",
"asyncio",
".",
"new_event_loop"... | https://github.com/RLBot/RLBot/blob/34332b12cf158b3ef8dbf174ae67c53683368a9d/src/main/python/rlbot/matchcomms/server.py#L78-L96 | |
qgis/QGIS | 15a77662d4bb712184f6aa60d0bd663010a76a75 | python/plugins/db_manager/layer_preview.py | python | LayerPreview._loadTablePreview | (self, table, limit=False) | if has geometry column load to map canvas | if has geometry column load to map canvas | [
"if",
"has",
"geometry",
"column",
"load",
"to",
"map",
"canvas"
] | def _loadTablePreview(self, table, limit=False):
""" if has geometry column load to map canvas """
with OverrideCursor(Qt.WaitCursor):
self.freeze()
vl = None
if table and table.geomType:
# limit the query result if required
if limit a... | [
"def",
"_loadTablePreview",
"(",
"self",
",",
"table",
",",
"limit",
"=",
"False",
")",
":",
"with",
"OverrideCursor",
"(",
"Qt",
".",
"WaitCursor",
")",
":",
"self",
".",
"freeze",
"(",
")",
"vl",
"=",
"None",
"if",
"table",
"and",
"table",
".",
"ge... | https://github.com/qgis/QGIS/blob/15a77662d4bb712184f6aa60d0bd663010a76a75/python/plugins/db_manager/layer_preview.py#L92-L136 | ||
wy1iu/LargeMargin_Softmax_Loss | c3e9f20e4f16e2b4daf7d358a614366b9b39a6ec | scripts/cpp_lint.py | python | _CppLintState.SetCountingStyle | (self, counting_style) | Sets the module's counting options. | Sets the module's counting options. | [
"Sets",
"the",
"module",
"s",
"counting",
"options",
"."
] | def SetCountingStyle(self, counting_style):
"""Sets the module's counting options."""
self.counting = counting_style | [
"def",
"SetCountingStyle",
"(",
"self",
",",
"counting_style",
")",
":",
"self",
".",
"counting",
"=",
"counting_style"
] | https://github.com/wy1iu/LargeMargin_Softmax_Loss/blob/c3e9f20e4f16e2b4daf7d358a614366b9b39a6ec/scripts/cpp_lint.py#L713-L715 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/setuptools/_vendor/pyparsing.py | python | col | (loc,strg) | return 1 if 0<loc<len(s) and s[loc-1] == '\n' else loc - s.rfind("\n", 0, loc) | Returns current column within a string, counting newlines as line separators.
The first column is number 1.
Note: the default parsing behavior is to expand tabs in the input string
before starting the parsing process. See L{I{ParserElement.parseString}<ParserElement.parseString>} for more information
on p... | Returns current column within a string, counting newlines as line separators.
The first column is number 1. | [
"Returns",
"current",
"column",
"within",
"a",
"string",
"counting",
"newlines",
"as",
"line",
"separators",
".",
"The",
"first",
"column",
"is",
"number",
"1",
"."
] | def col (loc,strg):
"""Returns current column within a string, counting newlines as line separators.
The first column is number 1.
Note: the default parsing behavior is to expand tabs in the input string
before starting the parsing process. See L{I{ParserElement.parseString}<ParserElement.parseString>} f... | [
"def",
"col",
"(",
"loc",
",",
"strg",
")",
":",
"s",
"=",
"strg",
"return",
"1",
"if",
"0",
"<",
"loc",
"<",
"len",
"(",
"s",
")",
"and",
"s",
"[",
"loc",
"-",
"1",
"]",
"==",
"'\\n'",
"else",
"loc",
"-",
"s",
".",
"rfind",
"(",
"\"\\n\"",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/_vendor/pyparsing.py#L968-L979 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/email/charset.py | python | add_charset | (charset, header_enc=None, body_enc=None, output_charset=None) | Add character set properties to the global registry.
charset is the input character set, and must be the canonical name of a
character set.
Optional header_enc and body_enc is either Charset.QP for
quoted-printable, Charset.BASE64 for base64 encoding, Charset.SHORTEST for
the shortest of qp or bas... | Add character set properties to the global registry. | [
"Add",
"character",
"set",
"properties",
"to",
"the",
"global",
"registry",
"."
] | def add_charset(charset, header_enc=None, body_enc=None, output_charset=None):
"""Add character set properties to the global registry.
charset is the input character set, and must be the canonical name of a
character set.
Optional header_enc and body_enc is either Charset.QP for
quoted-printable, ... | [
"def",
"add_charset",
"(",
"charset",
",",
"header_enc",
"=",
"None",
",",
"body_enc",
"=",
"None",
",",
"output_charset",
"=",
"None",
")",
":",
"if",
"body_enc",
"==",
"SHORTEST",
":",
"raise",
"ValueError",
"(",
"'SHORTEST not allowed for body_enc'",
")",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/email/charset.py#L108-L133 | ||
google/mysql-protobuf | 467cda676afaa49e762c5c9164a43f6ad31a1fbf | protobuf/python/google/protobuf/internal/encoder.py | python | MessageSizer | (field_number, is_repeated, is_packed) | Returns a sizer for a message field. | Returns a sizer for a message field. | [
"Returns",
"a",
"sizer",
"for",
"a",
"message",
"field",
"."
] | def MessageSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a message field."""
tag_size = _TagSize(field_number)
local_VarintSize = _VarintSize
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in value:
l... | [
"def",
"MessageSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"local_VarintSize",
"=",
"_VarintSize",
"assert",
"not",
"is_packed",
"if",
"is_repeated",
":",
"def",
"RepeatedField... | https://github.com/google/mysql-protobuf/blob/467cda676afaa49e762c5c9164a43f6ad31a1fbf/protobuf/python/google/protobuf/internal/encoder.py#L295-L313 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/framemanager.py | python | AuiManager.OnCaptureLost | (self, event) | Handles the ``wx.EVT_MOUSE_CAPTURE_LOST`` event for :class:`AuiManager`.
:param `event`: a :class:`MouseCaptureLostEvent` to be processed. | Handles the ``wx.EVT_MOUSE_CAPTURE_LOST`` event for :class:`AuiManager`. | [
"Handles",
"the",
"wx",
".",
"EVT_MOUSE_CAPTURE_LOST",
"event",
"for",
":",
"class",
":",
"AuiManager",
"."
] | def OnCaptureLost(self, event):
"""
Handles the ``wx.EVT_MOUSE_CAPTURE_LOST`` event for :class:`AuiManager`.
:param `event`: a :class:`MouseCaptureLostEvent` to be processed.
"""
# cancel the operation in progress, if any
if self._action != actionNone:
self.... | [
"def",
"OnCaptureLost",
"(",
"self",
",",
"event",
")",
":",
"# cancel the operation in progress, if any",
"if",
"self",
".",
"_action",
"!=",
"actionNone",
":",
"self",
".",
"_action",
"=",
"actionNone",
"self",
".",
"HideHint",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/framemanager.py#L9242-L9252 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/distutils/fancy_getopt.py | python | FancyGetopt.generate_help | (self, header=None) | return lines | Generate help text (a list of strings, one per suggested line of
output) from the option table for this FancyGetopt object. | Generate help text (a list of strings, one per suggested line of
output) from the option table for this FancyGetopt object. | [
"Generate",
"help",
"text",
"(",
"a",
"list",
"of",
"strings",
"one",
"per",
"suggested",
"line",
"of",
"output",
")",
"from",
"the",
"option",
"table",
"for",
"this",
"FancyGetopt",
"object",
"."
] | def generate_help(self, header=None):
"""Generate help text (a list of strings, one per suggested line of
output) from the option table for this FancyGetopt object.
"""
# Blithely assume the option table is good: probably wouldn't call
# 'generate_help()' unless you've already ca... | [
"def",
"generate_help",
"(",
"self",
",",
"header",
"=",
"None",
")",
":",
"# Blithely assume the option table is good: probably wouldn't call",
"# 'generate_help()' unless you've already called 'getopt()'.",
"# First pass: determine maximum length of long option names",
"max_opt",
"=",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/distutils/fancy_getopt.py#L281-L358 | |
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/sfm/OpenSfM/opensfm/reconstruction.py | python | TrackTriangulator.triangulate | (self, track, reproj_threshold, min_ray_angle_degrees) | Triangulate track and add point to reconstruction. | Triangulate track and add point to reconstruction. | [
"Triangulate",
"track",
"and",
"add",
"point",
"to",
"reconstruction",
"."
] | def triangulate(self, track, reproj_threshold, min_ray_angle_degrees):
"""Triangulate track and add point to reconstruction."""
os, bs = [], []
for shot_id in self.graph[track]:
if shot_id in self.reconstruction.shots:
shot = self.reconstruction.shots[shot_id]
... | [
"def",
"triangulate",
"(",
"self",
",",
"track",
",",
"reproj_threshold",
",",
"min_ray_angle_degrees",
")",
":",
"os",
",",
"bs",
"=",
"[",
"]",
",",
"[",
"]",
"for",
"shot_id",
"in",
"self",
".",
"graph",
"[",
"track",
"]",
":",
"if",
"shot_id",
"i... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/sfm/OpenSfM/opensfm/reconstruction.py#L819-L839 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/attrs/attr/_make.py | python | pipe | (*converters) | return pipe_converter | A converter that composes multiple converters into one.
When called on a value, it runs all wrapped converters, returning the
*last* value.
Type annotations will be inferred from the wrapped converters', if
they have any.
:param callables converters: Arbitrary number of converters.
.. versio... | A converter that composes multiple converters into one. | [
"A",
"converter",
"that",
"composes",
"multiple",
"converters",
"into",
"one",
"."
] | def pipe(*converters):
"""
A converter that composes multiple converters into one.
When called on a value, it runs all wrapped converters, returning the
*last* value.
Type annotations will be inferred from the wrapped converters', if
they have any.
:param callables converters: Arbitrary n... | [
"def",
"pipe",
"(",
"*",
"converters",
")",
":",
"def",
"pipe_converter",
"(",
"val",
")",
":",
"for",
"converter",
"in",
"converters",
":",
"val",
"=",
"converter",
"(",
"val",
")",
"return",
"val",
"if",
"not",
"PY2",
":",
"if",
"not",
"converters",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/attrs/attr/_make.py#L2999-L3052 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/io/harwell_boeing/hb.py | python | HBInfo.__init__ | (self, title, key,
total_nlines, pointer_nlines, indices_nlines, values_nlines,
mxtype, nrows, ncols, nnon_zeros,
pointer_format_str, indices_format_str, values_format_str,
right_hand_sides_nlines=0, nelementals=0) | Do not use this directly, but the class ctrs (from_* functions). | Do not use this directly, but the class ctrs (from_* functions). | [
"Do",
"not",
"use",
"this",
"directly",
"but",
"the",
"class",
"ctrs",
"(",
"from_",
"*",
"functions",
")",
"."
] | def __init__(self, title, key,
total_nlines, pointer_nlines, indices_nlines, values_nlines,
mxtype, nrows, ncols, nnon_zeros,
pointer_format_str, indices_format_str, values_format_str,
right_hand_sides_nlines=0, nelementals=0):
"""Do not use this directly, but the... | [
"def",
"__init__",
"(",
"self",
",",
"title",
",",
"key",
",",
"total_nlines",
",",
"pointer_nlines",
",",
"indices_nlines",
",",
"values_nlines",
",",
"mxtype",
",",
"nrows",
",",
"ncols",
",",
"nnon_zeros",
",",
"pointer_format_str",
",",
"indices_format_str",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/io/harwell_boeing/hb.py#L211-L281 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/vis/glprogram.py | python | GLProgram.keyboardfunc | (self,c,x,y) | return False | Called on keypress down. May be overridden. c is either the ASCII/unicode
character of the key pressed or a string describing the character (up,down,left,right,
home,end,delete,enter,f1,...,f12) | Called on keypress down. May be overridden. c is either the ASCII/unicode
character of the key pressed or a string describing the character (up,down,left,right,
home,end,delete,enter,f1,...,f12) | [
"Called",
"on",
"keypress",
"down",
".",
"May",
"be",
"overridden",
".",
"c",
"is",
"either",
"the",
"ASCII",
"/",
"unicode",
"character",
"of",
"the",
"key",
"pressed",
"or",
"a",
"string",
"describing",
"the",
"character",
"(",
"up",
"down",
"left",
"r... | def keyboardfunc(self,c,x,y):
"""Called on keypress down. May be overridden. c is either the ASCII/unicode
character of the key pressed or a string describing the character (up,down,left,right,
home,end,delete,enter,f1,...,f12)"""
if c == '?':
self.print_help()
r... | [
"def",
"keyboardfunc",
"(",
"self",
",",
"c",
",",
"x",
",",
"y",
")",
":",
"if",
"c",
"==",
"'?'",
":",
"self",
".",
"print_help",
"(",
")",
"return",
"True",
"if",
"'alt'",
"in",
"self",
".",
"modifiers",
"(",
")",
":",
"c",
"=",
"'Alt+'",
"+... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/vis/glprogram.py#L254-L270 | |
hakuna-m/wubiuefi | caec1af0a09c78fd5a345180ada1fe45e0c63493 | src/openpgp/sap/api.py | python | verify_block | (key, blocktype, target, **kw) | Determine whether a key block is appropriate for use.
**This function might be scrapped or hidden):** can just use
verify_msg(([pkt], key), signer) where pkt is the block leader in question.
:Parameters:
- `key`: public or private key message (`openpgp.sap.msg.KeyMsg.KeyMsg`
subclass ins... | Determine whether a key block is appropriate for use. | [
"Determine",
"whether",
"a",
"key",
"block",
"is",
"appropriate",
"for",
"use",
"."
] | def verify_block(key, blocktype, target, **kw):
"""Determine whether a key block is appropriate for use.
**This function might be scrapped or hidden):** can just use
verify_msg(([pkt], key), signer) where pkt is the block leader in question.
:Parameters:
- `key`: public or private key message ... | [
"def",
"verify_block",
"(",
"key",
",",
"blocktype",
",",
"target",
",",
"*",
"*",
"kw",
")",
":",
"saplog",
"=",
"logging",
".",
"getLogger",
"(",
"\"saplog\"",
")",
"saplog",
".",
"info",
"(",
"\"Checking block bindings..\"",
")",
"block",
"=",
"key",
... | https://github.com/hakuna-m/wubiuefi/blob/caec1af0a09c78fd5a345180ada1fe45e0c63493/src/openpgp/sap/api.py#L742-L945 | ||
perilouswithadollarsign/cstrike15_src | f82112a2388b841d72cb62ca48ab1846dfcc11c8 | thirdparty/protobuf-2.5.0/python/mox.py | python | IsA.equals | (self, rhs) | Check to see if the RHS is an instance of class_name.
Args:
# rhs: the right hand side of the test
rhs: object
Returns:
bool | Check to see if the RHS is an instance of class_name. | [
"Check",
"to",
"see",
"if",
"the",
"RHS",
"is",
"an",
"instance",
"of",
"class_name",
"."
] | def equals(self, rhs):
"""Check to see if the RHS is an instance of class_name.
Args:
# rhs: the right hand side of the test
rhs: object
Returns:
bool
"""
try:
return isinstance(rhs, self._class_name)
except TypeError:
# Check raw types if there was a type error.... | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"try",
":",
"return",
"isinstance",
"(",
"rhs",
",",
"self",
".",
"_class_name",
")",
"except",
"TypeError",
":",
"# Check raw types if there was a type error. This is helpful for",
"# things like cStringIO.StringIO."... | https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/thirdparty/protobuf-2.5.0/python/mox.py#L807-L823 | ||
ArduPilot/ardupilot | 6e684b3496122b8158ac412b609d00004b7ac306 | libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py | python | add_apperiph_defaults | (f) | add default defines for peripherals | add default defines for peripherals | [
"add",
"default",
"defines",
"for",
"peripherals"
] | def add_apperiph_defaults(f):
'''add default defines for peripherals'''
if env_vars.get('AP_PERIPH',0) == 0:
# not AP_Periph
return
if not args.bootloader:
# use the app descriptor needed by MissionPlanner for CAN upload
env_vars['APP_DESCRIPTOR'] = 'MissionPlanner'
pri... | [
"def",
"add_apperiph_defaults",
"(",
"f",
")",
":",
"if",
"env_vars",
".",
"get",
"(",
"'AP_PERIPH'",
",",
"0",
")",
"==",
"0",
":",
"# not AP_Periph",
"return",
"if",
"not",
"args",
".",
"bootloader",
":",
"# use the app descriptor needed by MissionPlanner for CA... | https://github.com/ArduPilot/ardupilot/blob/6e684b3496122b8158ac412b609d00004b7ac306/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py#L2628-L2684 | ||
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/traci/_person.py | python | PersonDomain.getVehicle | (self, personID) | return self._getUniversal(tc.VAR_VEHICLE, personID) | getVehicle(string) -> string
Returns the id of the current vehicle if the person is in stage driving
and has entered a vehicle.
Return the empty string otherwise | getVehicle(string) -> string
Returns the id of the current vehicle if the person is in stage driving
and has entered a vehicle.
Return the empty string otherwise | [
"getVehicle",
"(",
"string",
")",
"-",
">",
"string",
"Returns",
"the",
"id",
"of",
"the",
"current",
"vehicle",
"if",
"the",
"person",
"is",
"in",
"stage",
"driving",
"and",
"has",
"entered",
"a",
"vehicle",
".",
"Return",
"the",
"empty",
"string",
"oth... | def getVehicle(self, personID):
"""getVehicle(string) -> string
Returns the id of the current vehicle if the person is in stage driving
and has entered a vehicle.
Return the empty string otherwise
"""
return self._getUniversal(tc.VAR_VEHICLE, personID) | [
"def",
"getVehicle",
"(",
"self",
",",
"personID",
")",
":",
"return",
"self",
".",
"_getUniversal",
"(",
"tc",
".",
"VAR_VEHICLE",
",",
"personID",
")"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/traci/_person.py#L240-L246 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py | python | Canvas.find_enclosed | (self, x1, y1, x2, y2) | return self.find('enclosed', x1, y1, x2, y2) | Return all items in rectangle defined
by X1,Y1,X2,Y2. | Return all items in rectangle defined
by X1,Y1,X2,Y2. | [
"Return",
"all",
"items",
"in",
"rectangle",
"defined",
"by",
"X1",
"Y1",
"X2",
"Y2",
"."
] | def find_enclosed(self, x1, y1, x2, y2):
"""Return all items in rectangle defined
by X1,Y1,X2,Y2."""
return self.find('enclosed', x1, y1, x2, y2) | [
"def",
"find_enclosed",
"(",
"self",
",",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
")",
":",
"return",
"self",
".",
"find",
"(",
"'enclosed'",
",",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py#L2538-L2541 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/io/json/_json.py | python | Parser._try_convert_to_date | (self, data) | return data, False | Try to parse a ndarray like into a date column.
Try to coerce object in epoch/iso formats and integer/float in epoch
formats. Return a boolean if parsing was successful. | Try to parse a ndarray like into a date column. | [
"Try",
"to",
"parse",
"a",
"ndarray",
"like",
"into",
"a",
"date",
"column",
"."
] | def _try_convert_to_date(self, data):
"""
Try to parse a ndarray like into a date column.
Try to coerce object in epoch/iso formats and integer/float in epoch
formats. Return a boolean if parsing was successful.
"""
# no conversion on empty
if not len(data):
... | [
"def",
"_try_convert_to_date",
"(",
"self",
",",
"data",
")",
":",
"# no conversion on empty",
"if",
"not",
"len",
"(",
"data",
")",
":",
"return",
"data",
",",
"False",
"new_data",
"=",
"data",
"if",
"new_data",
".",
"dtype",
"==",
"\"object\"",
":",
"try... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/json/_json.py#L1002-L1037 | |
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/pyserial/serial/tools/hexlify_codec.py | python | getregentry | () | return codecs.CodecInfo(
name='hexlify',
encode=hex_encode,
decode=hex_decode,
incrementalencoder=IncrementalEncoder,
incrementaldecoder=IncrementalDecoder,
streamwriter=StreamWriter,
streamreader=StreamReader,
#~ _is_text_encoding=True,
) | encodings module API | encodings module API | [
"encodings",
"module",
"API"
] | def getregentry():
"""encodings module API"""
return codecs.CodecInfo(
name='hexlify',
encode=hex_encode,
decode=hex_decode,
incrementalencoder=IncrementalEncoder,
incrementaldecoder=IncrementalDecoder,
streamwriter=StreamWriter,
streamreader=StreamReader,... | [
"def",
"getregentry",
"(",
")",
":",
"return",
"codecs",
".",
"CodecInfo",
"(",
"name",
"=",
"'hexlify'",
",",
"encode",
"=",
"hex_encode",
",",
"decode",
"=",
"hex_decode",
",",
"incrementalencoder",
"=",
"IncrementalEncoder",
",",
"incrementaldecoder",
"=",
... | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/pyserial/serial/tools/hexlify_codec.py#L113-L124 | |
apache/impala | 8ddac48f3428c86f2cbd037ced89cfb903298b12 | shell/impala_shell.py | python | ImpalaShell._print_options | (self, print_mode) | Prints the current query options with default values distinguished from set values
by brackets [], followed by shell-local options.
The options are displayed in groups based on option levels received in parameter.
Input parameter decides whether all groups or just the 'Regular' and 'Advanced'
options ar... | Prints the current query options with default values distinguished from set values
by brackets [], followed by shell-local options.
The options are displayed in groups based on option levels received in parameter.
Input parameter decides whether all groups or just the 'Regular' and 'Advanced'
options ar... | [
"Prints",
"the",
"current",
"query",
"options",
"with",
"default",
"values",
"distinguished",
"from",
"set",
"values",
"by",
"brackets",
"[]",
"followed",
"by",
"shell",
"-",
"local",
"options",
".",
"The",
"options",
"are",
"displayed",
"in",
"groups",
"based... | def _print_options(self, print_mode):
"""Prints the current query options with default values distinguished from set values
by brackets [], followed by shell-local options.
The options are displayed in groups based on option levels received in parameter.
Input parameter decides whether all groups or jus... | [
"def",
"_print_options",
"(",
"self",
",",
"print_mode",
")",
":",
"print",
"(",
"\"Query options (defaults shown in []):\"",
")",
"if",
"not",
"self",
".",
"imp_client",
".",
"default_query_options",
"and",
"not",
"self",
".",
"set_query_options",
":",
"print",
"... | https://github.com/apache/impala/blob/8ddac48f3428c86f2cbd037ced89cfb903298b12/shell/impala_shell.py#L320-L346 | ||
zetavm/zetavm | 61af9cd317fa5629f570b30b61ea8c7ffc375e59 | espresso/e_input.py | python | Input.next_ws | (self, string) | return self.next(string) | Version of next that consumes preceding whitespace | Version of next that consumes preceding whitespace | [
"Version",
"of",
"next",
"that",
"consumes",
"preceding",
"whitespace"
] | def next_ws(self, string):
"""Version of next that consumes preceding whitespace"""
self.eat_ws()
return self.next(string) | [
"def",
"next_ws",
"(",
"self",
",",
"string",
")",
":",
"self",
".",
"eat_ws",
"(",
")",
"return",
"self",
".",
"next",
"(",
"string",
")"
] | https://github.com/zetavm/zetavm/blob/61af9cd317fa5629f570b30b61ea8c7ffc375e59/espresso/e_input.py#L70-L73 | |
may0324/DeepCompression-caffe | 0aff6c1287bda4cfc7f378ed8a16524e1afabd8c | python/caffe/net_spec.py | python | assign_proto | (proto, name, val) | Assign a Python object to a protobuf message, based on the Python
type (in recursive fashion). Lists become repeated fields/messages, dicts
become messages, and other types are assigned directly. For convenience,
repeated fields whose values are not lists are converted to single-element
lists; e.g., `my... | Assign a Python object to a protobuf message, based on the Python
type (in recursive fashion). Lists become repeated fields/messages, dicts
become messages, and other types are assigned directly. For convenience,
repeated fields whose values are not lists are converted to single-element
lists; e.g., `my... | [
"Assign",
"a",
"Python",
"object",
"to",
"a",
"protobuf",
"message",
"based",
"on",
"the",
"Python",
"type",
"(",
"in",
"recursive",
"fashion",
")",
".",
"Lists",
"become",
"repeated",
"fields",
"/",
"messages",
"dicts",
"become",
"messages",
"and",
"other",... | def assign_proto(proto, name, val):
"""Assign a Python object to a protobuf message, based on the Python
type (in recursive fashion). Lists become repeated fields/messages, dicts
become messages, and other types are assigned directly. For convenience,
repeated fields whose values are not lists are conve... | [
"def",
"assign_proto",
"(",
"proto",
",",
"name",
",",
"val",
")",
":",
"is_repeated_field",
"=",
"hasattr",
"(",
"getattr",
"(",
"proto",
",",
"name",
")",
",",
"'extend'",
")",
"if",
"is_repeated_field",
"and",
"not",
"isinstance",
"(",
"val",
",",
"li... | https://github.com/may0324/DeepCompression-caffe/blob/0aff6c1287bda4cfc7f378ed8a16524e1afabd8c/python/caffe/net_spec.py#L56-L79 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | RichTextFileHandler.SetExtension | (*args, **kwargs) | return _richtext.RichTextFileHandler_SetExtension(*args, **kwargs) | SetExtension(self, String ext) | SetExtension(self, String ext) | [
"SetExtension",
"(",
"self",
"String",
"ext",
")"
] | def SetExtension(*args, **kwargs):
"""SetExtension(self, String ext)"""
return _richtext.RichTextFileHandler_SetExtension(*args, **kwargs) | [
"def",
"SetExtension",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextFileHandler_SetExtension",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L2797-L2799 | |
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | llvm/utils/git/pre-push.py | python | get_dev_null | () | return dev_null_fd | Lazily create a /dev/null fd for use in shell() | Lazily create a /dev/null fd for use in shell() | [
"Lazily",
"create",
"a",
"/",
"dev",
"/",
"null",
"fd",
"for",
"use",
"in",
"shell",
"()"
] | def get_dev_null():
"""Lazily create a /dev/null fd for use in shell()"""
global dev_null_fd
if dev_null_fd is None:
dev_null_fd = open(os.devnull, 'w')
return dev_null_fd | [
"def",
"get_dev_null",
"(",
")",
":",
"global",
"dev_null_fd",
"if",
"dev_null_fd",
"is",
"None",
":",
"dev_null_fd",
"=",
"open",
"(",
"os",
".",
"devnull",
",",
"'w'",
")",
"return",
"dev_null_fd"
] | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/llvm/utils/git/pre-push.py#L76-L81 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | media/tools/constrained_network_server/traffic_control.py | python | _AddIptableRule | (interface, port, server_port) | Forwards traffic from constrained port to a specified server port.
Args:
interface: Interface name to attach the filter to (string).
port: Port of incoming packets (integer 1-65535).
server_port: Server port to forward the packets to (integer 1-65535). | Forwards traffic from constrained port to a specified server port. | [
"Forwards",
"traffic",
"from",
"constrained",
"port",
"to",
"a",
"specified",
"server",
"port",
"."
] | def _AddIptableRule(interface, port, server_port):
"""Forwards traffic from constrained port to a specified server port.
Args:
interface: Interface name to attach the filter to (string).
port: Port of incoming packets (integer 1-65535).
server_port: Server port to forward the packets to (integer 1-6553... | [
"def",
"_AddIptableRule",
"(",
"interface",
",",
"port",
",",
"server_port",
")",
":",
"# Preroute rules for accessing the port through external connections.",
"command",
"=",
"[",
"'sudo'",
",",
"'iptables'",
",",
"'-t'",
",",
"'nat'",
",",
"'-A'",
",",
"'PREROUTING'... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/media/tools/constrained_network_server/traffic_control.py#L289-L306 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/xrc.py | python | XmlNode.HasProp | (*args, **kwargs) | return _xrc.XmlNode_HasProp(*args, **kwargs) | HasProp(self, String propName) -> bool | HasProp(self, String propName) -> bool | [
"HasProp",
"(",
"self",
"String",
"propName",
")",
"-",
">",
"bool"
] | def HasProp(*args, **kwargs):
"""HasProp(self, String propName) -> bool"""
return _xrc.XmlNode_HasProp(*args, **kwargs) | [
"def",
"HasProp",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_xrc",
".",
"XmlNode_HasProp",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/xrc.py#L438-L440 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py | python | Misc.setvar | (self, name='PY_VAR', value='1') | Set Tcl variable NAME to VALUE. | Set Tcl variable NAME to VALUE. | [
"Set",
"Tcl",
"variable",
"NAME",
"to",
"VALUE",
"."
] | def setvar(self, name='PY_VAR', value='1'):
"""Set Tcl variable NAME to VALUE."""
self.tk.setvar(name, value) | [
"def",
"setvar",
"(",
"self",
",",
"name",
"=",
"'PY_VAR'",
",",
"value",
"=",
"'1'",
")",
":",
"self",
".",
"tk",
".",
"setvar",
"(",
"name",
",",
"value",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py#L449-L451 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | build/android/android_commands.py | python | AndroidCommands.SetFileContents | (self, filename, contents) | Writes |contents| to the file specified by |filename|. | Writes |contents| to the file specified by |filename|. | [
"Writes",
"|contents|",
"to",
"the",
"file",
"specified",
"by",
"|filename|",
"."
] | def SetFileContents(self, filename, contents):
"""Writes |contents| to the file specified by |filename|."""
with tempfile.NamedTemporaryFile() as f:
f.write(contents)
f.flush()
self._adb.Push(f.name, filename) | [
"def",
"SetFileContents",
"(",
"self",
",",
"filename",
",",
"contents",
")",
":",
"with",
"tempfile",
".",
"NamedTemporaryFile",
"(",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"contents",
")",
"f",
".",
"flush",
"(",
")",
"self",
".",
"_adb",
"."... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/build/android/android_commands.py#L437-L442 | ||
facebookresearch/minirts | 859e747a5e2fab2355bea083daffa6a36820a7f2 | scripts/behavior_clone/dataset.py | python | BehaviorCloneDataset._process_cmds | (self, units, cmd_name, padded_size) | return data | units: (list) of our/enemy/resource units
cmd_name: (str) current_cmd or target_cmd
padded_size: padded num of units | [] | def _process_cmds(self, units, cmd_name, padded_size):
"""
units: (list) of our/enemy/resource units
cmd_name: (str) current_cmd or target_cmd
padded_size: padded num of units
"""
field_and_pad_idxs = [
('cmd_type', 0),
('target_type', 0),
... | [
"def",
"_process_cmds",
"(",
"self",
",",
"units",
",",
"cmd_name",
",",
"padded_size",
")",
":",
"field_and_pad_idxs",
"=",
"[",
"(",
"'cmd_type'",
",",
"0",
")",
",",
"(",
"'target_type'",
",",
"0",
")",
",",
"(",
"'target_x'",
",",
"0",
")",
",",
... | https://github.com/facebookresearch/minirts/blob/859e747a5e2fab2355bea083daffa6a36820a7f2/scripts/behavior_clone/dataset.py#L326-L363 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/training/training_ops.py | python | _ApplyRMSPropShape | (op) | return [grad_shape] | Shape function for the ApplyRMSProp op. | Shape function for the ApplyRMSProp op. | [
"Shape",
"function",
"for",
"the",
"ApplyRMSProp",
"op",
"."
] | def _ApplyRMSPropShape(op):
"""Shape function for the ApplyRMSProp op."""
var_shape = op.inputs[0].get_shape()
ms_shape = op.inputs[1].get_shape().merge_with(var_shape)
mom_shape = op.inputs[2].get_shape().merge_with(ms_shape)
_AssertInputIsScalar(op, 3) # lr
_AssertInputIsScalar(op, 4) # rho
_AssertInp... | [
"def",
"_ApplyRMSPropShape",
"(",
"op",
")",
":",
"var_shape",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
".",
"get_shape",
"(",
")",
"ms_shape",
"=",
"op",
".",
"inputs",
"[",
"1",
"]",
".",
"get_shape",
"(",
")",
".",
"merge_with",
"(",
"var_shape",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/training/training_ops.py#L126-L136 | |
papyrussolution/OpenPapyrus | bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91 | Src/OSF/protobuf-3.19.1/python/google/protobuf/internal/containers.py | python | RepeatedCompositeFieldContainer.__delslice__ | (self, start, stop) | Deletes the subset of items from between the specified indices. | Deletes the subset of items from between the specified indices. | [
"Deletes",
"the",
"subset",
"of",
"items",
"from",
"between",
"the",
"specified",
"indices",
"."
] | def __delslice__(self, start, stop):
"""Deletes the subset of items from between the specified indices."""
del self._values[start:stop]
self._message_listener.Modified() | [
"def",
"__delslice__",
"(",
"self",
",",
"start",
",",
"stop",
")",
":",
"del",
"self",
".",
"_values",
"[",
"start",
":",
"stop",
"]",
"self",
".",
"_message_listener",
".",
"Modified",
"(",
")"
] | https://github.com/papyrussolution/OpenPapyrus/blob/bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91/Src/OSF/protobuf-3.19.1/python/google/protobuf/internal/containers.py#L304-L307 | ||
naver/sling | 5671cd445a2caae0b4dd0332299e4cfede05062c | webkit/Tools/Scripts/webkitpy/style/checker.py | python | _check_webkit_style_defaults | () | return DefaultCommandOptionValues(min_confidence=_DEFAULT_MIN_CONFIDENCE,
output_format=_DEFAULT_OUTPUT_FORMAT) | Return the default command-line options for check-webkit-style. | Return the default command-line options for check-webkit-style. | [
"Return",
"the",
"default",
"command",
"-",
"line",
"options",
"for",
"check",
"-",
"webkit",
"-",
"style",
"."
] | def _check_webkit_style_defaults():
"""Return the default command-line options for check-webkit-style."""
return DefaultCommandOptionValues(min_confidence=_DEFAULT_MIN_CONFIDENCE,
output_format=_DEFAULT_OUTPUT_FORMAT) | [
"def",
"_check_webkit_style_defaults",
"(",
")",
":",
"return",
"DefaultCommandOptionValues",
"(",
"min_confidence",
"=",
"_DEFAULT_MIN_CONFIDENCE",
",",
"output_format",
"=",
"_DEFAULT_OUTPUT_FORMAT",
")"
] | https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/style/checker.py#L375-L378 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/model_pruning/examples/cifar10/cifar10_input.py | python | distorted_inputs | (data_dir, batch_size) | return _generate_image_and_label_batch(
float_image,
read_input.label,
min_queue_examples,
batch_size,
shuffle=True) | Construct distorted input for CIFAR training using the Reader ops.
Args:
data_dir: Path to the CIFAR-10 data directory.
batch_size: Number of images per batch.
Returns:
images: Images. 4D tensor of [batch_size, IMAGE_SIZE, IMAGE_SIZE, 3] size.
labels: Labels. 1D tensor of [batch_size] size. | Construct distorted input for CIFAR training using the Reader ops. | [
"Construct",
"distorted",
"input",
"for",
"CIFAR",
"training",
"using",
"the",
"Reader",
"ops",
"."
] | def distorted_inputs(data_dir, batch_size):
"""Construct distorted input for CIFAR training using the Reader ops.
Args:
data_dir: Path to the CIFAR-10 data directory.
batch_size: Number of images per batch.
Returns:
images: Images. 4D tensor of [batch_size, IMAGE_SIZE, IMAGE_SIZE, 3] size.
label... | [
"def",
"distorted_inputs",
"(",
"data_dir",
",",
"batch_size",
")",
":",
"filenames",
"=",
"[",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"'data_batch_%d.bin'",
"%",
"i",
")",
"for",
"i",
"in",
"xrange",
"(",
"1",
",",
"6",
")",
"]",
"for... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/model_pruning/examples/cifar10/cifar10_input.py#L140-L203 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/template.py | python | Template.variable_scope_name | (self) | Returns the variable scope name created by this Template. | Returns the variable scope name created by this Template. | [
"Returns",
"the",
"variable",
"scope",
"name",
"created",
"by",
"this",
"Template",
"."
] | def variable_scope_name(self):
"""Returns the variable scope name created by this Template."""
if self._variable_scope:
name = self._variable_scope.name
# To prevent partial matches on the scope_name, we add '/' at the end.
return name if name[-1] == "/" else name + "/" | [
"def",
"variable_scope_name",
"(",
"self",
")",
":",
"if",
"self",
".",
"_variable_scope",
":",
"name",
"=",
"self",
".",
"_variable_scope",
".",
"name",
"# To prevent partial matches on the scope_name, we add '/' at the end.",
"return",
"name",
"if",
"name",
"[",
"-"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/template.py#L288-L293 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/mozbuild/mozpack/packager/__init__.py | python | PackageManifestParser.__init__ | (self, sink) | Initialize the package manifest parser with the given sink. | Initialize the package manifest parser with the given sink. | [
"Initialize",
"the",
"package",
"manifest",
"parser",
"with",
"the",
"given",
"sink",
"."
] | def __init__(self, sink):
'''
Initialize the package manifest parser with the given sink.
'''
self._component = Component('')
self._sink = sink | [
"def",
"__init__",
"(",
"self",
",",
"sink",
")",
":",
"self",
".",
"_component",
"=",
"Component",
"(",
"''",
")",
"self",
".",
"_sink",
"=",
"sink"
] | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/mozbuild/mozpack/packager/__init__.py#L139-L144 | ||
tkn-tub/ns3-gym | 19bfe0a583e641142609939a090a09dfc63a095f | utils/grid.py | python | TimelineEvent.sort | (self) | ! Sort function
@param self this object
@return none | ! Sort function | [
"!",
"Sort",
"function"
] | def sort(self):
"""! Sort function
@param self this object
@return none
"""
self.events.sort(events_cmp) | [
"def",
"sort",
"(",
"self",
")",
":",
"self",
".",
"events",
".",
"sort",
"(",
"events_cmp",
")"
] | https://github.com/tkn-tub/ns3-gym/blob/19bfe0a583e641142609939a090a09dfc63a095f/utils/grid.py#L246-L251 | ||
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/core/indexed_frame.py | python | IndexedFrame._gather | (
self, gather_map, keep_index=True, nullify=False, check_bounds=True
) | return self._from_columns_like_self(
libcudf.copying.gather(
list(self._index._columns + self._columns)
if keep_index
else list(self._columns),
gather_map,
nullify=nullify,
),
self._column_names,
... | Gather rows of frame specified by indices in `gather_map`.
Skip bounds checking if check_bounds is False.
Set rows to null for all out of bound indices if nullify is `True`. | Gather rows of frame specified by indices in `gather_map`. | [
"Gather",
"rows",
"of",
"frame",
"specified",
"by",
"indices",
"in",
"gather_map",
"."
] | def _gather(
self, gather_map, keep_index=True, nullify=False, check_bounds=True
):
"""Gather rows of frame specified by indices in `gather_map`.
Skip bounds checking if check_bounds is False.
Set rows to null for all out of bound indices if nullify is `True`.
"""
ga... | [
"def",
"_gather",
"(",
"self",
",",
"gather_map",
",",
"keep_index",
"=",
"True",
",",
"nullify",
"=",
"False",
",",
"check_bounds",
"=",
"True",
")",
":",
"gather_map",
"=",
"cudf",
".",
"core",
".",
"column",
".",
"as_column",
"(",
"gather_map",
")",
... | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/indexed_frame.py#L602-L632 | |
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | Web/Python/paraview/web/protocols.py | python | ParaViewWebProxyManager.__init__ | (
self,
allowedProxiesFile=None,
baseDir=None,
fileToLoad=None,
allowUnconfiguredReaders=True,
groupProxyEditorWidgets=True,
respectPropertyGroups=True,
**kwargs
) | basePath: specify the base directory (or directories) that we should start with, if this
parameter takes the form: "name1=path1|name2=path2|...", then we will treat this as the
case where multiple data directories are required. In this case, each top-level directory
will be given the name assoc... | basePath: specify the base directory (or directories) that we should start with, if this
parameter takes the form: "name1=path1|name2=path2|...", then we will treat this as the
case where multiple data directories are required. In this case, each top-level directory
will be given the name assoc... | [
"basePath",
":",
"specify",
"the",
"base",
"directory",
"(",
"or",
"directories",
")",
"that",
"we",
"should",
"start",
"with",
"if",
"this",
"parameter",
"takes",
"the",
"form",
":",
"name1",
"=",
"path1|name2",
"=",
"path2|",
"...",
"then",
"we",
"will",... | def __init__(
self,
allowedProxiesFile=None,
baseDir=None,
fileToLoad=None,
allowUnconfiguredReaders=True,
groupProxyEditorWidgets=True,
respectPropertyGroups=True,
**kwargs
):
"""
basePath: specify the base directory (or directories) t... | [
"def",
"__init__",
"(",
"self",
",",
"allowedProxiesFile",
"=",
"None",
",",
"baseDir",
"=",
"None",
",",
"fileToLoad",
"=",
"None",
",",
"allowUnconfiguredReaders",
"=",
"True",
",",
"groupProxyEditorWidgets",
"=",
"True",
",",
"respectPropertyGroups",
"=",
"Tr... | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Web/Python/paraview/web/protocols.py#L1969-L2068 | ||
nvdla/sw | 79538ba1b52b040a4a4645f630e457fa01839e90 | regression/scripts/run_regression.py | python | deploy_tests | (options) | Resolve testing dependency on target running env
KUM/firmware: always run in host mode
UMD: from device or host | Resolve testing dependency on target running env | [
"Resolve",
"testing",
"dependency",
"on",
"target",
"running",
"env"
] | def deploy_tests(options):
"""Resolve testing dependency on target running env
KUM/firmware: always run in host mode
UMD: from device or host
"""
pass | [
"def",
"deploy_tests",
"(",
"options",
")",
":",
"pass"
] | https://github.com/nvdla/sw/blob/79538ba1b52b040a4a4645f630e457fa01839e90/regression/scripts/run_regression.py#L159-L165 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/count-of-range-sum.py | python | Solution.countRangeSum | (self, nums, lower, upper) | return countAndMergeSort(sums, 0, len(sums), lower, upper) | :type nums: List[int]
:type lower: int
:type upper: int
:rtype: int | :type nums: List[int]
:type lower: int
:type upper: int
:rtype: int | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"type",
"lower",
":",
"int",
":",
"type",
"upper",
":",
"int",
":",
"rtype",
":",
"int"
] | def countRangeSum(self, nums, lower, upper):
"""
:type nums: List[int]
:type lower: int
:type upper: int
:rtype: int
"""
def countAndMergeSort(sums, start, end, lower, upper):
if end - start <= 1: # The size of range [start, end) less than 2 is always... | [
"def",
"countRangeSum",
"(",
"self",
",",
"nums",
",",
"lower",
",",
"upper",
")",
":",
"def",
"countAndMergeSort",
"(",
"sums",
",",
"start",
",",
"end",
",",
"lower",
",",
"upper",
")",
":",
"if",
"end",
"-",
"start",
"<=",
"1",
":",
"# The size of... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/count-of-range-sum.py#L5-L40 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/distutils/misc_util.py | python | get_frame | (level=0) | Return frame object from call stack with given level. | Return frame object from call stack with given level. | [
"Return",
"frame",
"object",
"from",
"call",
"stack",
"with",
"given",
"level",
"."
] | def get_frame(level=0):
"""Return frame object from call stack with given level.
"""
try:
return sys._getframe(level+1)
except AttributeError:
frame = sys.exc_info()[2].tb_frame
for _ in range(level+1):
frame = frame.f_back
return frame | [
"def",
"get_frame",
"(",
"level",
"=",
"0",
")",
":",
"try",
":",
"return",
"sys",
".",
"_getframe",
"(",
"level",
"+",
"1",
")",
"except",
"AttributeError",
":",
"frame",
"=",
"sys",
".",
"exc_info",
"(",
")",
"[",
"2",
"]",
".",
"tb_frame",
"for"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/distutils/misc_util.py#L645-L654 | ||
daijifeng001/caffe-rfcn | 543f8f6a4b7c88256ea1445ae951a12d1ad9cffd | scripts/cpp_lint.py | python | CheckAltTokens | (filename, clean_lines, linenum, error) | Check alternative keywords being used in boolean expressions.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Check alternative keywords being used in boolean expressions. | [
"Check",
"alternative",
"keywords",
"being",
"used",
"in",
"boolean",
"expressions",
"."
] | def CheckAltTokens(filename, clean_lines, linenum, error):
"""Check alternative keywords being used in boolean expressions.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call ... | [
"def",
"CheckAltTokens",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Avoid preprocessor lines",
"if",
"Match",
"(",
"r'^\\s*#'",
",",
"line",
")",
":",
"retur... | https://github.com/daijifeng001/caffe-rfcn/blob/543f8f6a4b7c88256ea1445ae951a12d1ad9cffd/scripts/cpp_lint.py#L3405-L3434 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib-tk/turtle.py | python | TurtleScreenBase._onclick | (self, item, fun, num=1, add=None) | Bind fun to mouse-click event on turtle.
fun must be a function with two arguments, the coordinates
of the clicked point on the canvas.
num, the number of the mouse-button defaults to 1 | Bind fun to mouse-click event on turtle.
fun must be a function with two arguments, the coordinates
of the clicked point on the canvas.
num, the number of the mouse-button defaults to 1 | [
"Bind",
"fun",
"to",
"mouse",
"-",
"click",
"event",
"on",
"turtle",
".",
"fun",
"must",
"be",
"a",
"function",
"with",
"two",
"arguments",
"the",
"coordinates",
"of",
"the",
"clicked",
"point",
"on",
"the",
"canvas",
".",
"num",
"the",
"number",
"of",
... | def _onclick(self, item, fun, num=1, add=None):
"""Bind fun to mouse-click event on turtle.
fun must be a function with two arguments, the coordinates
of the clicked point on the canvas.
num, the number of the mouse-button defaults to 1
"""
if fun is None:
sel... | [
"def",
"_onclick",
"(",
"self",
",",
"item",
",",
"fun",
",",
"num",
"=",
"1",
",",
"add",
"=",
"None",
")",
":",
"if",
"fun",
"is",
"None",
":",
"self",
".",
"cv",
".",
"tag_unbind",
"(",
"item",
",",
"\"<Button-%s>\"",
"%",
"num",
")",
"else",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib-tk/turtle.py#L629-L642 | ||
jiaxiang-wu/quantized-cnn | 4d020e17026df90e40111d219e3eb74e0afb1588 | cpplint.py | python | GetHeaderGuardCPPVariable | (filename) | return re.sub(r'[^a-zA-Z0-9]', '_', file_path_from_root).upper() + '_' | Returns the CPP variable that should be used as a header guard.
Args:
filename: The name of a C++ header file.
Returns:
The CPP variable that should be used as a header guard in the
named file. | Returns the CPP variable that should be used as a header guard. | [
"Returns",
"the",
"CPP",
"variable",
"that",
"should",
"be",
"used",
"as",
"a",
"header",
"guard",
"."
] | def GetHeaderGuardCPPVariable(filename):
"""Returns the CPP variable that should be used as a header guard.
Args:
filename: The name of a C++ header file.
Returns:
The CPP variable that should be used as a header guard in the
named file.
"""
# Restores original filename in case that cpplint is... | [
"def",
"GetHeaderGuardCPPVariable",
"(",
"filename",
")",
":",
"# Restores original filename in case that cpplint is invoked from Emacs's",
"# flymake.",
"filename",
"=",
"re",
".",
"sub",
"(",
"r'_flymake\\.h$'",
",",
"'.h'",
",",
"filename",
")",
"filename",
"=",
"re",
... | https://github.com/jiaxiang-wu/quantized-cnn/blob/4d020e17026df90e40111d219e3eb74e0afb1588/cpplint.py#L1651-L1674 | |
mysql/mysql-workbench | 2f35f9034f015cbcd22139a60e1baa2e3e8e795c | modules/db.sql92/db_sql92_re_grt.py | python | Sql92ReverseEngineering.getSchemaNames | (cls, connection, catalog_name) | return sorted(list(set(row[0] for row in cls.execute_query(connection, query, catalog_name))) ) | Returns a list of schemata for the given connection object. | Returns a list of schemata for the given connection object. | [
"Returns",
"a",
"list",
"of",
"schemata",
"for",
"the",
"given",
"connection",
"object",
"."
] | def getSchemaNames(cls, connection, catalog_name):
"""Returns a list of schemata for the given connection object."""
query = """SELECT TABLE_SCHEMA
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_CATALOG = ?"""
return sorted(list(set(row[0] for row in cls.execute_query(connection, qu... | [
"def",
"getSchemaNames",
"(",
"cls",
",",
"connection",
",",
"catalog_name",
")",
":",
"query",
"=",
"\"\"\"SELECT TABLE_SCHEMA\n FROM INFORMATION_SCHEMA.TABLES\n WHERE TABLE_CATALOG = ?\"\"\"",
"return",
"sorted",
"(",
"list",
"(",
"set",
"(",
"row",
"[",
"... | https://github.com/mysql/mysql-workbench/blob/2f35f9034f015cbcd22139a60e1baa2e3e8e795c/modules/db.sql92/db_sql92_re_grt.py#L47-L53 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | TextEntryBase.Replace | (*args, **kwargs) | return _core_.TextEntryBase_Replace(*args, **kwargs) | Replace(self, long from, long to, String value)
Replaces the text between two positions with the given text. | Replace(self, long from, long to, String value) | [
"Replace",
"(",
"self",
"long",
"from",
"long",
"to",
"String",
"value",
")"
] | def Replace(*args, **kwargs):
"""
Replace(self, long from, long to, String value)
Replaces the text between two positions with the given text.
"""
return _core_.TextEntryBase_Replace(*args, **kwargs) | [
"def",
"Replace",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"TextEntryBase_Replace",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L13132-L13138 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/plistlib.py | python | writePlist | (rootObject, pathOrFile) | Write 'rootObject' to a .plist file. 'pathOrFile' may either be a
file name or a (writable) file object. | Write 'rootObject' to a .plist file. 'pathOrFile' may either be a
file name or a (writable) file object. | [
"Write",
"rootObject",
"to",
"a",
".",
"plist",
"file",
".",
"pathOrFile",
"may",
"either",
"be",
"a",
"file",
"name",
"or",
"a",
"(",
"writable",
")",
"file",
"object",
"."
] | def writePlist(rootObject, pathOrFile):
"""Write 'rootObject' to a .plist file. 'pathOrFile' may either be a
file name or a (writable) file object.
"""
didOpen = 0
if isinstance(pathOrFile, (str, unicode)):
pathOrFile = open(pathOrFile, "w")
didOpen = 1
writer = PlistWriter(pathO... | [
"def",
"writePlist",
"(",
"rootObject",
",",
"pathOrFile",
")",
":",
"didOpen",
"=",
"0",
"if",
"isinstance",
"(",
"pathOrFile",
",",
"(",
"str",
",",
"unicode",
")",
")",
":",
"pathOrFile",
"=",
"open",
"(",
"pathOrFile",
",",
"\"w\"",
")",
"didOpen",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/plistlib.py#L84-L97 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/ops/data_flow_ops.py | python | PaddingFIFOQueue.__init__ | (self, capacity, dtypes, shapes, names=None, shared_name=None,
name="padding_fifo_queue") | Creates a queue that dequeues elements in a first-in first-out order.
A `PaddingFIFOQueue` has bounded capacity; supports multiple concurrent
producers and consumers; and provides exactly-once delivery.
A `PaddingFIFOQueue` holds a list of up to `capacity` elements. Each
element is a fixed-length tupl... | Creates a queue that dequeues elements in a first-in first-out order. | [
"Creates",
"a",
"queue",
"that",
"dequeues",
"elements",
"in",
"a",
"first",
"-",
"in",
"first",
"-",
"out",
"order",
"."
] | def __init__(self, capacity, dtypes, shapes, names=None, shared_name=None,
name="padding_fifo_queue"):
"""Creates a queue that dequeues elements in a first-in first-out order.
A `PaddingFIFOQueue` has bounded capacity; supports multiple concurrent
producers and consumers; and provides exactl... | [
"def",
"__init__",
"(",
"self",
",",
"capacity",
",",
"dtypes",
",",
"shapes",
",",
"names",
"=",
"None",
",",
"shared_name",
"=",
"None",
",",
"name",
"=",
"\"padding_fifo_queue\"",
")",
":",
"dtypes",
"=",
"_as_type_list",
"(",
"dtypes",
")",
"shapes",
... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/data_flow_ops.py#L659-L711 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/importlib/__init__.py | python | import_module | (name, package=None) | return sys.modules[name] | Import a module.
The 'package' argument is required when performing a relative import. It
specifies the package to use as the anchor point from which to resolve the
relative import to an absolute import. | Import a module. | [
"Import",
"a",
"module",
"."
] | def import_module(name, package=None):
"""Import a module.
The 'package' argument is required when performing a relative import. It
specifies the package to use as the anchor point from which to resolve the
relative import to an absolute import.
"""
if name.startswith('.'):
if not pack... | [
"def",
"import_module",
"(",
"name",
",",
"package",
"=",
"None",
")",
":",
"if",
"name",
".",
"startswith",
"(",
"'.'",
")",
":",
"if",
"not",
"package",
":",
"raise",
"TypeError",
"(",
"\"relative imports require the 'package' argument\"",
")",
"level",
"=",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/importlib/__init__.py#L20-L38 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | JoystickEvent.SetButtonChange | (*args, **kwargs) | return _misc_.JoystickEvent_SetButtonChange(*args, **kwargs) | SetButtonChange(self, int change) | SetButtonChange(self, int change) | [
"SetButtonChange",
"(",
"self",
"int",
"change",
")"
] | def SetButtonChange(*args, **kwargs):
"""SetButtonChange(self, int change)"""
return _misc_.JoystickEvent_SetButtonChange(*args, **kwargs) | [
"def",
"SetButtonChange",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"JoystickEvent_SetButtonChange",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L2370-L2372 | |
tensorflow/ngraph-bridge | ea6422491ec75504e78a63db029e7f74ec3479a5 | examples/mnist/mnist_fprop_only.py | python | run_mnist | (_) | cross_entropy = tf.reduce_mean(
tf.nn.softmax_cross_entropy_with_logits(labels=y_, logits=y))
train_step = tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy) | cross_entropy = tf.reduce_mean(
tf.nn.softmax_cross_entropy_with_logits(labels=y_, logits=y))
train_step = tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy) | [
"cross_entropy",
"=",
"tf",
".",
"reduce_mean",
"(",
"tf",
".",
"nn",
".",
"softmax_cross_entropy_with_logits",
"(",
"labels",
"=",
"y_",
"logits",
"=",
"y",
"))",
"train_step",
"=",
"tf",
".",
"train",
".",
"GradientDescentOptimizer",
"(",
"0",
".",
"5",
... | def run_mnist(_):
# Create the model
x = tf.compat.v1.placeholder(tf.float32, [None, 784])
W = tf.Variable(tf.zeros([784, 10]))
b = tf.Variable(tf.zeros([10]))
y = tf.matmul(x, W) + b
# Define loss and optimizer
y_ = tf.compat.v1.placeholder(tf.float32, [None, 10])
# The raw formulati... | [
"def",
"run_mnist",
"(",
"_",
")",
":",
"# Create the model",
"x",
"=",
"tf",
".",
"compat",
".",
"v1",
".",
"placeholder",
"(",
"tf",
".",
"float32",
",",
"[",
"None",
",",
"784",
"]",
")",
"W",
"=",
"tf",
".",
"Variable",
"(",
"tf",
".",
"zeros... | https://github.com/tensorflow/ngraph-bridge/blob/ea6422491ec75504e78a63db029e7f74ec3479a5/examples/mnist/mnist_fprop_only.py#L42-L100 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/fsspec/implementations/http.py | python | HTTPFile._fetch_range | (self, start, end) | return out | Download a block of data
The expectation is that the server returns only the requested bytes,
with HTTP code 206. If this is not the case, we first check the headers,
and then stream the output - if the data size is bigger than we
requested, an exception is raised. | Download a block of data | [
"Download",
"a",
"block",
"of",
"data"
] | def _fetch_range(self, start, end):
"""Download a block of data
The expectation is that the server returns only the requested bytes,
with HTTP code 206. If this is not the case, we first check the headers,
and then stream the output - if the data size is bigger than we
requested... | [
"def",
"_fetch_range",
"(",
"self",
",",
"start",
",",
"end",
")",
":",
"kwargs",
"=",
"self",
".",
"kwargs",
".",
"copy",
"(",
")",
"headers",
"=",
"kwargs",
".",
"pop",
"(",
"\"headers\"",
",",
"{",
"}",
")",
"headers",
"[",
"\"Range\"",
"]",
"="... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/fsspec/implementations/http.py#L294-L338 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/util/_cloudpickle/_cloudpickle_py27.py | python | CloudPickler.save_global | (self, obj, name=None, pack=struct.pack) | Save a "global".
The name of this method is somewhat misleading: all types get
dispatched here. | Save a "global". | [
"Save",
"a",
"global",
"."
] | def save_global(self, obj, name=None, pack=struct.pack):
"""
Save a "global".
The name of this method is somewhat misleading: all types get
dispatched here.
"""
if obj.__module__ == "__builtin__" or obj.__module__ == "builtins":
if obj in _BUILTIN_TYPE_NAMES:... | [
"def",
"save_global",
"(",
"self",
",",
"obj",
",",
"name",
"=",
"None",
",",
"pack",
"=",
"struct",
".",
"pack",
")",
":",
"if",
"obj",
".",
"__module__",
"==",
"\"__builtin__\"",
"or",
"obj",
".",
"__module__",
"==",
"\"builtins\"",
":",
"if",
"obj",... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/util/_cloudpickle/_cloudpickle_py27.py#L658-L697 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TChA.CountCh | (self, *args) | return _snap.TChA_CountCh(self, *args) | CountCh(TChA self, char const & Ch, int const & BChN=0) -> int
Parameters:
Ch: char const &
BChN: int const &
CountCh(TChA self, char const & Ch) -> int
Parameters:
Ch: char const & | CountCh(TChA self, char const & Ch, int const & BChN=0) -> int | [
"CountCh",
"(",
"TChA",
"self",
"char",
"const",
"&",
"Ch",
"int",
"const",
"&",
"BChN",
"=",
"0",
")",
"-",
">",
"int"
] | def CountCh(self, *args):
"""
CountCh(TChA self, char const & Ch, int const & BChN=0) -> int
Parameters:
Ch: char const &
BChN: int const &
CountCh(TChA self, char const & Ch) -> int
Parameters:
Ch: char const &
"""
return _... | [
"def",
"CountCh",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TChA_CountCh",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L8821-L8835 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/http/server.py | python | SimpleHTTPRequestHandler.do_GET | (self) | Serve a GET request. | Serve a GET request. | [
"Serve",
"a",
"GET",
"request",
"."
] | def do_GET(self):
"""Serve a GET request."""
f = self.send_head()
if f:
try:
self.copyfile(f, self.wfile)
finally:
f.close() | [
"def",
"do_GET",
"(",
"self",
")",
":",
"f",
"=",
"self",
".",
"send_head",
"(",
")",
"if",
"f",
":",
"try",
":",
"self",
".",
"copyfile",
"(",
"f",
",",
"self",
".",
"wfile",
")",
"finally",
":",
"f",
".",
"close",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/http/server.py#L648-L655 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/protobuf/python/google/protobuf/internal/decoder.py | python | _ModifiedDecoder | (wire_type, decode_value, modify_value) | return _SimpleDecoder(wire_type, InnerDecode) | Like SimpleDecoder but additionally invokes modify_value on every value
before storing it. Usually modify_value is ZigZagDecode. | Like SimpleDecoder but additionally invokes modify_value on every value
before storing it. Usually modify_value is ZigZagDecode. | [
"Like",
"SimpleDecoder",
"but",
"additionally",
"invokes",
"modify_value",
"on",
"every",
"value",
"before",
"storing",
"it",
".",
"Usually",
"modify_value",
"is",
"ZigZagDecode",
"."
] | def _ModifiedDecoder(wire_type, decode_value, modify_value):
"""Like SimpleDecoder but additionally invokes modify_value on every value
before storing it. Usually modify_value is ZigZagDecode.
"""
# Reusing _SimpleDecoder is slightly slower than copying a bunch of code, but
# not enough to make a significan... | [
"def",
"_ModifiedDecoder",
"(",
"wire_type",
",",
"decode_value",
",",
"modify_value",
")",
":",
"# Reusing _SimpleDecoder is slightly slower than copying a bunch of code, but",
"# not enough to make a significant difference.",
"def",
"InnerDecode",
"(",
"buffer",
",",
"pos",
")"... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/protobuf/python/google/protobuf/internal/decoder.py#L240-L251 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/ssl.py | python | match_hostname | (cert, hostname) | Verify that *cert* (in decoded format as returned by
SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125
rules are followed.
The function matches IP addresses rather than dNSNames if hostname is a
valid ipaddress string. IPv4 addresses are supported on all platforms.
IPv6 addres... | Verify that *cert* (in decoded format as returned by
SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125
rules are followed. | [
"Verify",
"that",
"*",
"cert",
"*",
"(",
"in",
"decoded",
"format",
"as",
"returned",
"by",
"SSLSocket",
".",
"getpeercert",
"()",
")",
"matches",
"the",
"*",
"hostname",
"*",
".",
"RFC",
"2818",
"and",
"RFC",
"6125",
"rules",
"are",
"followed",
"."
] | def match_hostname(cert, hostname):
"""Verify that *cert* (in decoded format as returned by
SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125
rules are followed.
The function matches IP addresses rather than dNSNames if hostname is a
valid ipaddress string. IPv4 addresses are ... | [
"def",
"match_hostname",
"(",
"cert",
",",
"hostname",
")",
":",
"if",
"not",
"cert",
":",
"raise",
"ValueError",
"(",
"\"empty or no certificate, match_hostname needs a \"",
"\"SSL socket or SSL context with either \"",
"\"CERT_OPTIONAL or CERT_REQUIRED\"",
")",
"try",
":",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/ssl.py#L371-L425 | ||
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | kratos/python_scripts/analysis_stage.py | python | AnalysisStage.OutputSolutionStep | (self) | This function printed / writes output files after the solution of a step | This function printed / writes output files after the solution of a step | [
"This",
"function",
"printed",
"/",
"writes",
"output",
"files",
"after",
"the",
"solution",
"of",
"a",
"step"
] | def OutputSolutionStep(self):
"""This function printed / writes output files after the solution of a step
"""
execute_was_called = False
for output_process in self._GetListOfOutputProcesses():
if output_process.IsOutputStep():
if not execute_was_called:
... | [
"def",
"OutputSolutionStep",
"(",
"self",
")",
":",
"execute_was_called",
"=",
"False",
"for",
"output_process",
"in",
"self",
".",
"_GetListOfOutputProcesses",
"(",
")",
":",
"if",
"output_process",
".",
"IsOutputStep",
"(",
")",
":",
"if",
"not",
"execute_was_... | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/kratos/python_scripts/analysis_stage.py#L151-L166 | ||
bigartm/bigartm | 47e37f982de87aa67bfd475ff1f39da696b181b3 | utils/cpplint.py | python | ExpectingFunctionArgs | (clean_lines, linenum) | return (Match(r'^\s*MOCK_(CONST_)?METHOD\d+(_T)?\(', line) or
(linenum >= 2 and
(Match(r'^\s*MOCK_(?:CONST_)?METHOD\d+(?:_T)?\((?:\S+,)?\s*$',
clean_lines.elided[linenum - 1]) or
Match(r'^\s*MOCK_(?:CONST_)?METHOD\d+(?:_T)?\(\s*$',
clean_lines.elided[... | Checks whether where function type arguments are expected.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
Returns:
True if the line at 'linenum' is inside something that expects arguments
of function types. | Checks whether where function type arguments are expected. | [
"Checks",
"whether",
"where",
"function",
"type",
"arguments",
"are",
"expected",
"."
] | def ExpectingFunctionArgs(clean_lines, linenum):
"""Checks whether where function type arguments are expected.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
Returns:
True if the line at 'linenum' is inside something that expects arguments
... | [
"def",
"ExpectingFunctionArgs",
"(",
"clean_lines",
",",
"linenum",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"return",
"(",
"Match",
"(",
"r'^\\s*MOCK_(CONST_)?METHOD\\d+(_T)?\\('",
",",
"line",
")",
"or",
"(",
"linenum",
">=",
... | https://github.com/bigartm/bigartm/blob/47e37f982de87aa67bfd475ff1f39da696b181b3/utils/cpplint.py#L5445-L5464 | |
projectchrono/chrono | 92015a8a6f84ef63ac8206a74e54a676251dcc89 | src/demos/python/chrono-tensorflow/PPO/utils.py | python | Scaler.get | (self) | return 1/(np.sqrt(self.vars) + 0.1)/3, self.means | returns 2-tuple: (scale, offset) | returns 2-tuple: (scale, offset) | [
"returns",
"2",
"-",
"tuple",
":",
"(",
"scale",
"offset",
")"
] | def get(self):
""" returns 2-tuple: (scale, offset) """
return 1/(np.sqrt(self.vars) + 0.1)/3, self.means | [
"def",
"get",
"(",
"self",
")",
":",
"return",
"1",
"/",
"(",
"np",
".",
"sqrt",
"(",
"self",
".",
"vars",
")",
"+",
"0.1",
")",
"/",
"3",
",",
"self",
".",
"means"
] | https://github.com/projectchrono/chrono/blob/92015a8a6f84ef63ac8206a74e54a676251dcc89/src/demos/python/chrono-tensorflow/PPO/utils.py#L74-L76 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_main.py | python | MainWindow.OnUpdateFileUI | (self, evt) | Update filemenu items
@param evt: EVT_UPDATE_UI | Update filemenu items
@param evt: EVT_UPDATE_UI | [
"Update",
"filemenu",
"items",
"@param",
"evt",
":",
"EVT_UPDATE_UI"
] | def OnUpdateFileUI(self, evt):
"""Update filemenu items
@param evt: EVT_UPDATE_UI
"""
if not self.IsActive():
return
e_id = evt.Id
ctrl = self.nb.GetCurrentCtrl()
if e_id == ID_REVERT_FILE:
evt.Enable(ctrl.GetModify())
elif e_id =... | [
"def",
"OnUpdateFileUI",
"(",
"self",
",",
"evt",
")",
":",
"if",
"not",
"self",
".",
"IsActive",
"(",
")",
":",
"return",
"e_id",
"=",
"evt",
".",
"Id",
"ctrl",
"=",
"self",
".",
"nb",
".",
"GetCurrentCtrl",
"(",
")",
"if",
"e_id",
"==",
"ID_REVER... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_main.py#L1292-L1307 | ||
stellar-deprecated/stellard | 67eabb2217bdfa9a6ea317f62338fb6bca458c90 | src/beast/python/beast/env/Print.py | python | print_build_vars | (name, value, same, print=print) | Pretty-print values as a build configuration. | Pretty-print values as a build configuration. | [
"Pretty",
"-",
"print",
"values",
"as",
"a",
"build",
"configuration",
"."
] | def print_build_vars(name, value, same, print=print):
"""Pretty-print values as a build configuration."""
name = '%s' % name.rjust(FIELD_WIDTH)
color = Terminal.blue if same else Terminal.green
for line in TEXT_WRAPPER.wrap(String.stringify(value, ' ')):
print(' '.join([name, color(line)]))
... | [
"def",
"print_build_vars",
"(",
"name",
",",
"value",
",",
"same",
",",
"print",
"=",
"print",
")",
":",
"name",
"=",
"'%s'",
"%",
"name",
".",
"rjust",
"(",
"FIELD_WIDTH",
")",
"color",
"=",
"Terminal",
".",
"blue",
"if",
"same",
"else",
"Terminal",
... | https://github.com/stellar-deprecated/stellard/blob/67eabb2217bdfa9a6ea317f62338fb6bca458c90/src/beast/python/beast/env/Print.py#L21-L28 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | Error.level | (self) | return ret | how consequent is the error | how consequent is the error | [
"how",
"consequent",
"is",
"the",
"error"
] | def level(self):
"""how consequent is the error """
ret = libxml2mod.xmlErrorGetLevel(self._o)
return ret | [
"def",
"level",
"(",
"self",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlErrorGetLevel",
"(",
"self",
".",
"_o",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L5038-L5041 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py | python | Metrowerks_Shell_Suite_Events.Remove_Files | (self, _object, _attributes={}, **_arguments) | Remove Files: Remove the specified file(s) from the current project
Required argument: List of files to remove
Keyword argument _attributes: AppleEvent attribute dictionary
Returns: Error code for each file removed | Remove Files: Remove the specified file(s) from the current project
Required argument: List of files to remove
Keyword argument _attributes: AppleEvent attribute dictionary
Returns: Error code for each file removed | [
"Remove",
"Files",
":",
"Remove",
"the",
"specified",
"file",
"(",
"s",
")",
"from",
"the",
"current",
"project",
"Required",
"argument",
":",
"List",
"of",
"files",
"to",
"remove",
"Keyword",
"argument",
"_attributes",
":",
"AppleEvent",
"attribute",
"diction... | def Remove_Files(self, _object, _attributes={}, **_arguments):
"""Remove Files: Remove the specified file(s) from the current project
Required argument: List of files to remove
Keyword argument _attributes: AppleEvent attribute dictionary
Returns: Error code for each file removed
... | [
"def",
"Remove_Files",
"(",
"self",
",",
"_object",
",",
"_attributes",
"=",
"{",
"}",
",",
"*",
"*",
"_arguments",
")",
":",
"_code",
"=",
"'MMPR'",
"_subcode",
"=",
"'RemF'",
"if",
"_arguments",
":",
"raise",
"TypeError",
",",
"'No optional args expected'"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py#L517-L536 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py | python | convert_convolution | (node, **kwargs) | return nodes | Map MXNet's convolution operator attributes to onnx's Conv operator
and return the created node. | Map MXNet's convolution operator attributes to onnx's Conv operator
and return the created node. | [
"Map",
"MXNet",
"s",
"convolution",
"operator",
"attributes",
"to",
"onnx",
"s",
"Conv",
"operator",
"and",
"return",
"the",
"created",
"node",
"."
] | def convert_convolution(node, **kwargs):
"""Map MXNet's convolution operator attributes to onnx's Conv operator
and return the created node.
"""
from onnx.helper import make_node
name, input_nodes, attrs = get_inputs(node, kwargs)
kernel = convert_string_to_list(attrs.get('kernel', '()'))
s... | [
"def",
"convert_convolution",
"(",
"node",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"onnx",
".",
"helper",
"import",
"make_node",
"name",
",",
"input_nodes",
",",
"attrs",
"=",
"get_inputs",
"(",
"node",
",",
"kwargs",
")",
"kernel",
"=",
"convert_string... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py#L223-L261 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/_vendor/ordered_set.py | python | OrderedSet.index | (self, key) | return self.map[key] | Get the index of a given entry, raising an IndexError if it's not
present.
`key` can be an iterable of entries that is not a string, in which case
this returns a list of indices.
Example:
>>> oset = OrderedSet([1, 2, 3])
>>> oset.index(2)
1 | Get the index of a given entry, raising an IndexError if it's not
present. | [
"Get",
"the",
"index",
"of",
"a",
"given",
"entry",
"raising",
"an",
"IndexError",
"if",
"it",
"s",
"not",
"present",
"."
] | def index(self, key):
"""
Get the index of a given entry, raising an IndexError if it's not
present.
`key` can be an iterable of entries that is not a string, in which case
this returns a list of indices.
Example:
>>> oset = OrderedSet([1, 2, 3])
... | [
"def",
"index",
"(",
"self",
",",
"key",
")",
":",
"if",
"is_iterable",
"(",
"key",
")",
":",
"return",
"[",
"self",
".",
"index",
"(",
"subkey",
")",
"for",
"subkey",
"in",
"key",
"]",
"return",
"self",
".",
"map",
"[",
"key",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/_vendor/ordered_set.py#L188-L203 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/core/numeric.py | python | asfortranarray | (a, dtype=None) | return array(a, dtype, copy=False, order='F', ndmin=1) | Return an array (ndim >= 1) laid out in Fortran order in memory.
Parameters
----------
a : array_like
Input array.
dtype : str or dtype object, optional
By default, the data-type is inferred from the input data.
Returns
-------
out : ndarray
The input `a` in Fortran... | Return an array (ndim >= 1) laid out in Fortran order in memory. | [
"Return",
"an",
"array",
"(",
"ndim",
">",
"=",
"1",
")",
"laid",
"out",
"in",
"Fortran",
"order",
"in",
"memory",
"."
] | def asfortranarray(a, dtype=None):
"""
Return an array (ndim >= 1) laid out in Fortran order in memory.
Parameters
----------
a : array_like
Input array.
dtype : str or dtype object, optional
By default, the data-type is inferred from the input data.
Returns
-------
... | [
"def",
"asfortranarray",
"(",
"a",
",",
"dtype",
"=",
"None",
")",
":",
"return",
"array",
"(",
"a",
",",
"dtype",
",",
"copy",
"=",
"False",
",",
"order",
"=",
"'F'",
",",
"ndmin",
"=",
"1",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/core/numeric.py#L636-L673 | |
qboticslabs/mastering_ros | d83e78f30acc45b0f18522c1d5fae3a7f52974b9 | chapter_9_codes/chefbot/chefbot/chefbot_bringup/scripts/bkup_working/DeadReckoning.py | python | Driver.turn | (self, angle, angularSpeed) | return done | Turn the robot based on odometry information
angle [rad]: the angle to turn (positive angles mean clockwise rotation)
angularSpeed [rad/s]: the speed with which to turn; must be positive | Turn the robot based on odometry information
angle [rad]: the angle to turn (positive angles mean clockwise rotation)
angularSpeed [rad/s]: the speed with which to turn; must be positive | [
"Turn",
"the",
"robot",
"based",
"on",
"odometry",
"information",
"angle",
"[",
"rad",
"]",
":",
"the",
"angle",
"to",
"turn",
"(",
"positive",
"angles",
"mean",
"clockwise",
"rotation",
")",
"angularSpeed",
"[",
"rad",
"/",
"s",
"]",
":",
"the",
"speed"... | def turn(self, angle, angularSpeed):
'''
Turn the robot based on odometry information
angle [rad]: the angle to turn (positive angles mean clockwise rotation)
angularSpeed [rad/s]: the speed with which to turn; must be positive
'''
ccw = (angle >= 0) # counter clockwise rotation
# record the starting ... | [
"def",
"turn",
"(",
"self",
",",
"angle",
",",
"angularSpeed",
")",
":",
"ccw",
"=",
"(",
"angle",
">=",
"0",
")",
"# counter clockwise rotation",
"# record the starting transform from the odom to the base frame",
"# Note that here the 'from' frame precedes 'to' frame which is ... | https://github.com/qboticslabs/mastering_ros/blob/d83e78f30acc45b0f18522c1d5fae3a7f52974b9/chapter_9_codes/chefbot/chefbot/chefbot_bringup/scripts/bkup_working/DeadReckoning.py#L132-L203 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/graph_editor/match.py | python | OpMatcher.__init__ | (self, positive_filter) | Graph match constructor. | Graph match constructor. | [
"Graph",
"match",
"constructor",
"."
] | def __init__(self, positive_filter):
"""Graph match constructor."""
self.positive_filters = []
self.input_op_matches = None
self.control_input_op_matches = None
self.output_op_matches = None
positive_filter = self._finalize_positive_filter(positive_filter)
self.positive_filters.append(positi... | [
"def",
"__init__",
"(",
"self",
",",
"positive_filter",
")",
":",
"self",
".",
"positive_filters",
"=",
"[",
"]",
"self",
".",
"input_op_matches",
"=",
"None",
"self",
".",
"control_input_op_matches",
"=",
"None",
"self",
".",
"output_op_matches",
"=",
"None",... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/graph_editor/match.py#L58-L65 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/traitlets/py2/traitlets/traitlets.py | python | is_trait | (t) | return (isinstance(t, TraitType) or
(isinstance(t, type) and issubclass(t, TraitType))) | Returns whether the given value is an instance or subclass of TraitType. | Returns whether the given value is an instance or subclass of TraitType. | [
"Returns",
"whether",
"the",
"given",
"value",
"is",
"an",
"instance",
"or",
"subclass",
"of",
"TraitType",
"."
] | def is_trait(t):
""" Returns whether the given value is an instance or subclass of TraitType.
"""
return (isinstance(t, TraitType) or
(isinstance(t, type) and issubclass(t, TraitType))) | [
"def",
"is_trait",
"(",
"t",
")",
":",
"return",
"(",
"isinstance",
"(",
"t",
",",
"TraitType",
")",
"or",
"(",
"isinstance",
"(",
"t",
",",
"type",
")",
"and",
"issubclass",
"(",
"t",
",",
"TraitType",
")",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/traitlets/py2/traitlets/traitlets.py#L181-L185 | |
pyne/pyne | 0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3 | pyne/mcnp.py | python | PtracReader.read_headers | (self) | Read and save the MCNP version and problem description from the
Ptrac file. | Read and save the MCNP version and problem description from the
Ptrac file. | [
"Read",
"and",
"save",
"the",
"MCNP",
"version",
"and",
"problem",
"description",
"from",
"the",
"Ptrac",
"file",
"."
] | def read_headers(self):
"""Read and save the MCNP version and problem description from the
Ptrac file.
"""
# mcnp version info
self.mcnp_version_info = self.read_next('s', auto=True)
# problem title
self.problem_title = self.read_next('s', auto=True).strip()
... | [
"def",
"read_headers",
"(",
"self",
")",
":",
"# mcnp version info",
"self",
".",
"mcnp_version_info",
"=",
"self",
".",
"read_next",
"(",
"'s'",
",",
"auto",
"=",
"True",
")",
"# problem title",
"self",
".",
"problem_title",
"=",
"self",
".",
"read_next",
"... | https://github.com/pyne/pyne/blob/0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3/pyne/mcnp.py#L1159-L1197 | ||
liminchen/OptCuts | cb85b06ece3a6d1279863e26b5fd17a5abb0834d | ext/libigl/external/eigen/debug/gdb/printers.py | python | EigenMatrixPrinter.__init__ | (self, variety, val) | Extract all the necessary information | Extract all the necessary information | [
"Extract",
"all",
"the",
"necessary",
"information"
] | def __init__(self, variety, val):
"Extract all the necessary information"
# Save the variety (presumably "Matrix" or "Array") for later usage
self.variety = variety
# The gdb extension does not support value template arguments - need to extract them by hand
type = val.type
if type.code == gdb.TYPE_COD... | [
"def",
"__init__",
"(",
"self",
",",
"variety",
",",
"val",
")",
":",
"# Save the variety (presumably \"Matrix\" or \"Array\") for later usage",
"self",
".",
"variety",
"=",
"variety",
"# The gdb extension does not support value template arguments - need to extract them by hand",
"... | https://github.com/liminchen/OptCuts/blob/cb85b06ece3a6d1279863e26b5fd17a5abb0834d/ext/libigl/external/eigen/debug/gdb/printers.py#L37-L78 | ||
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/affine/kron.py | python | kron.is_decr | (self, idx) | return self.args[0].is_nonpos() | Is the composition non-increasing in argument idx? | Is the composition non-increasing in argument idx? | [
"Is",
"the",
"composition",
"non",
"-",
"increasing",
"in",
"argument",
"idx?"
] | def is_decr(self, idx) -> bool:
"""Is the composition non-increasing in argument idx?
"""
return self.args[0].is_nonpos() | [
"def",
"is_decr",
"(",
"self",
",",
"idx",
")",
"->",
"bool",
":",
"return",
"self",
".",
"args",
"[",
"0",
"]",
".",
"is_nonpos",
"(",
")"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/affine/kron.py#L67-L70 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ma/core.py | python | MaskedArray.sort | (self, axis=-1, kind=None, order=None,
endwith=True, fill_value=None) | Sort the array, in-place
Parameters
----------
a : array_like
Array to be sorted.
axis : int, optional
Axis along which to sort. If None, the array is flattened before
sorting. The default is -1, which sorts along the last axis.
kind : {'quick... | Sort the array, in-place | [
"Sort",
"the",
"array",
"in",
"-",
"place"
] | def sort(self, axis=-1, kind=None, order=None,
endwith=True, fill_value=None):
"""
Sort the array, in-place
Parameters
----------
a : array_like
Array to be sorted.
axis : int, optional
Axis along which to sort. If None, the array is ... | [
"def",
"sort",
"(",
"self",
",",
"axis",
"=",
"-",
"1",
",",
"kind",
"=",
"None",
",",
"order",
"=",
"None",
",",
"endwith",
"=",
"True",
",",
"fill_value",
"=",
"None",
")",
":",
"if",
"self",
".",
"_mask",
"is",
"nomask",
":",
"ndarray",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ma/core.py#L5549-L5630 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/dataview.py | python | DataViewEvent.SetColumn | (*args, **kwargs) | return _dataview.DataViewEvent_SetColumn(*args, **kwargs) | SetColumn(self, int col) | SetColumn(self, int col) | [
"SetColumn",
"(",
"self",
"int",
"col",
")"
] | def SetColumn(*args, **kwargs):
"""SetColumn(self, int col)"""
return _dataview.DataViewEvent_SetColumn(*args, **kwargs) | [
"def",
"SetColumn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewEvent_SetColumn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/dataview.py#L1911-L1913 | |
google/mysql-protobuf | 467cda676afaa49e762c5c9164a43f6ad31a1fbf | storage/ndb/mcc/request_handler.py | python | handle_shutdownServerReq | (req, body) | return make_rep(req, 'incorrect death key') | x | x | [
"x"
] | def handle_shutdownServerReq(req, body):
"""x"""
if body.has_key('deathkey') and body['deathkey'] == deathkey:
raise ShutdownException("Shutdown request received")
time.sleep(util.get_val(body, 'sleeptime', 0))
return make_rep(req, 'incorrect death key') | [
"def",
"handle_shutdownServerReq",
"(",
"req",
",",
"body",
")",
":",
"if",
"body",
".",
"has_key",
"(",
"'deathkey'",
")",
"and",
"body",
"[",
"'deathkey'",
"]",
"==",
"deathkey",
":",
"raise",
"ShutdownException",
"(",
"\"Shutdown request received\"",
")",
"... | https://github.com/google/mysql-protobuf/blob/467cda676afaa49e762c5c9164a43f6ad31a1fbf/storage/ndb/mcc/request_handler.py#L232-L237 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | compiler-rt/lib/asan/scripts/asan_symbolize.py | python | AsanSymbolizerPlugIn.filter_module_desc | (self, module_desc) | return module_desc | Given a ModuleDesc object (`module_desc`) return
a ModuleDesc suitable for symbolication.
Implementations should return `None` if symbolication of this binary
should be skipped. | Given a ModuleDesc object (`module_desc`) return
a ModuleDesc suitable for symbolication. | [
"Given",
"a",
"ModuleDesc",
"object",
"(",
"module_desc",
")",
"return",
"a",
"ModuleDesc",
"suitable",
"for",
"symbolication",
"."
] | def filter_module_desc(self, module_desc):
"""
Given a ModuleDesc object (`module_desc`) return
a ModuleDesc suitable for symbolication.
Implementations should return `None` if symbolication of this binary
should be skipped.
"""
return module_desc | [
"def",
"filter_module_desc",
"(",
"self",
",",
"module_desc",
")",
":",
"return",
"module_desc"
] | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/compiler-rt/lib/asan/scripts/asan_symbolize.py#L700-L708 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.