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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
githubharald/CTCWordBeamSearch | 43567e5b06dd43bdcbec452f5099171c81f5e737 | extras/prototype/Beam.py | python | BeamList.getBestBeams | (self, num) | return sorted(u, reverse=True, key=lambda x: x.getPrTotal() * (x.getPrTextual() ** lmWeight))[:num] | return best beams, specify the max. number of beams to be returned (beam width) | return best beams, specify the max. number of beams to be returned (beam width) | [
"return",
"best",
"beams",
"specify",
"the",
"max",
".",
"number",
"of",
"beams",
"to",
"be",
"returned",
"(",
"beam",
"width",
")"
] | def getBestBeams(self, num):
"return best beams, specify the max. number of beams to be returned (beam width)"
u = [v for (_, v) in self.beams.items()]
lmWeight = 1
return sorted(u, reverse=True, key=lambda x: x.getPrTotal() * (x.getPrTextual() ** lmWeight))[:num] | [
"def",
"getBestBeams",
"(",
"self",
",",
"num",
")",
":",
"u",
"=",
"[",
"v",
"for",
"(",
"_",
",",
"v",
")",
"in",
"self",
".",
"beams",
".",
"items",
"(",
")",
"]",
"lmWeight",
"=",
"1",
"return",
"sorted",
"(",
"u",
",",
"reverse",
"=",
"T... | https://github.com/githubharald/CTCWordBeamSearch/blob/43567e5b06dd43bdcbec452f5099171c81f5e737/extras/prototype/Beam.py#L140-L144 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/robotsim.py | python | WidgetSet.add | (self, subwidget) | return _robotsim.WidgetSet_add(self, subwidget) | add(WidgetSet self, Widget subwidget) | add(WidgetSet self, Widget subwidget) | [
"add",
"(",
"WidgetSet",
"self",
"Widget",
"subwidget",
")"
] | def add(self, subwidget):
"""
add(WidgetSet self, Widget subwidget)
"""
return _robotsim.WidgetSet_add(self, subwidget) | [
"def",
"add",
"(",
"self",
",",
"subwidget",
")",
":",
"return",
"_robotsim",
".",
"WidgetSet_add",
"(",
"self",
",",
"subwidget",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/robotsim.py#L3124-L3131 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/cross_validation.py | python | _safe_split | (estimator, X, y, indices, train_indices=None) | return X_subset, y_subset | Create subset of dataset and properly handle kernels. | Create subset of dataset and properly handle kernels. | [
"Create",
"subset",
"of",
"dataset",
"and",
"properly",
"handle",
"kernels",
"."
] | def _safe_split(estimator, X, y, indices, train_indices=None):
"""Create subset of dataset and properly handle kernels."""
if hasattr(estimator, 'kernel') and callable(estimator.kernel) \
and not isinstance(estimator.kernel, GPKernel):
# cannot compute the kernel values with custom function
... | [
"def",
"_safe_split",
"(",
"estimator",
",",
"X",
",",
"y",
",",
"indices",
",",
"train_indices",
"=",
"None",
")",
":",
"if",
"hasattr",
"(",
"estimator",
",",
"'kernel'",
")",
"and",
"callable",
"(",
"estimator",
".",
"kernel",
")",
"and",
"not",
"is... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/cross_validation.py#L1703-L1733 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/ndarray/ndarray.py | python | NDArray.asscalar | (self) | return self.asnumpy()[0] | Returns a scalar whose value is copied from this array.
This function is equivalent to ``self.asnumpy()[0]``. This NDArray must have shape (1,).
Examples
--------
>>> x = mx.nd.ones((1,), dtype='int32')
>>> x.asscalar()
1
>>> type(x.asscalar())
<type 'nu... | Returns a scalar whose value is copied from this array. | [
"Returns",
"a",
"scalar",
"whose",
"value",
"is",
"copied",
"from",
"this",
"array",
"."
] | def asscalar(self):
"""Returns a scalar whose value is copied from this array.
This function is equivalent to ``self.asnumpy()[0]``. This NDArray must have shape (1,).
Examples
--------
>>> x = mx.nd.ones((1,), dtype='int32')
>>> x.asscalar()
1
>>> type(... | [
"def",
"asscalar",
"(",
"self",
")",
":",
"if",
"self",
".",
"shape",
"!=",
"(",
"1",
",",
")",
":",
"raise",
"ValueError",
"(",
"\"The current array is not a scalar\"",
")",
"return",
"self",
".",
"asnumpy",
"(",
")",
"[",
"0",
"]"
] | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/ndarray/ndarray.py#L2023-L2038 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/yaml/__init__.py | python | compose_all | (stream, Loader=Loader) | Parse all YAML documents in a stream
and produce corresponding representation trees. | Parse all YAML documents in a stream
and produce corresponding representation trees. | [
"Parse",
"all",
"YAML",
"documents",
"in",
"a",
"stream",
"and",
"produce",
"corresponding",
"representation",
"trees",
"."
] | def compose_all(stream, Loader=Loader):
"""
Parse all YAML documents in a stream
and produce corresponding representation trees.
"""
loader = Loader(stream)
try:
while loader.check_node():
yield loader.get_node()
finally:
loader.dispose() | [
"def",
"compose_all",
"(",
"stream",
",",
"Loader",
"=",
"Loader",
")",
":",
"loader",
"=",
"Loader",
"(",
"stream",
")",
"try",
":",
"while",
"loader",
".",
"check_node",
"(",
")",
":",
"yield",
"loader",
".",
"get_node",
"(",
")",
"finally",
":",
"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/yaml/__init__.py#L52-L62 | ||
facebook/ThreatExchange | 31914a51820c73c8a0daffe62ccca29a6e3d359e | python-threatexchange/threatexchange/cli/dataset/simple_serialization.py | python | HMASerialization.as_csv_row | (self) | return (self.indicator, self.indicator_id) + self.rollup.as_row() | indicator details and descriptor rollup without descriptor ID | indicator details and descriptor rollup without descriptor ID | [
"indicator",
"details",
"and",
"descriptor",
"rollup",
"without",
"descriptor",
"ID"
] | def as_csv_row(self) -> t.Tuple:
"""indicator details and descriptor rollup without descriptor ID"""
return (self.indicator, self.indicator_id) + self.rollup.as_row() | [
"def",
"as_csv_row",
"(",
"self",
")",
"->",
"t",
".",
"Tuple",
":",
"return",
"(",
"self",
".",
"indicator",
",",
"self",
".",
"indicator_id",
")",
"+",
"self",
".",
"rollup",
".",
"as_row",
"(",
")"
] | https://github.com/facebook/ThreatExchange/blob/31914a51820c73c8a0daffe62ccca29a6e3d359e/python-threatexchange/threatexchange/cli/dataset/simple_serialization.py#L116-L118 | |
mingchen/protobuf-ios | 0958df34558cd54cb7b6e6ca5c8855bf3d475046 | compiler/python/google/protobuf/internal/decoder.py | python | Decoder.ReadFieldNumberAndWireType | (self) | return wire_format.UnpackTag(tag_and_type) | Reads a tag from the wire. Returns a (field_number, wire_type) pair. | Reads a tag from the wire. Returns a (field_number, wire_type) pair. | [
"Reads",
"a",
"tag",
"from",
"the",
"wire",
".",
"Returns",
"a",
"(",
"field_number",
"wire_type",
")",
"pair",
"."
] | def ReadFieldNumberAndWireType(self):
"""Reads a tag from the wire. Returns a (field_number, wire_type) pair."""
tag_and_type = self.ReadUInt32()
return wire_format.UnpackTag(tag_and_type) | [
"def",
"ReadFieldNumberAndWireType",
"(",
"self",
")",
":",
"tag_and_type",
"=",
"self",
".",
"ReadUInt32",
"(",
")",
"return",
"wire_format",
".",
"UnpackTag",
"(",
"tag_and_type",
")"
] | https://github.com/mingchen/protobuf-ios/blob/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/python/google/protobuf/internal/decoder.py#L72-L75 | |
zhaoweicai/cascade-rcnn | 2252f46158ea6555868ca6fa5c221ea71d9b5e6c | python/caffe/draw.py | python | get_layer_label | (layer, rankdir) | return node_label | Define node label based on layer type.
Parameters
----------
layer : ?
rankdir : {'LR', 'TB', 'BT'}
Direction of graph layout.
Returns
-------
string :
A label for the current layer | Define node label based on layer type. | [
"Define",
"node",
"label",
"based",
"on",
"layer",
"type",
"."
] | def get_layer_label(layer, rankdir):
"""Define node label based on layer type.
Parameters
----------
layer : ?
rankdir : {'LR', 'TB', 'BT'}
Direction of graph layout.
Returns
-------
string :
A label for the current layer
"""
if rankdir in ('TB', 'BT'):
... | [
"def",
"get_layer_label",
"(",
"layer",
",",
"rankdir",
")",
":",
"if",
"rankdir",
"in",
"(",
"'TB'",
",",
"'BT'",
")",
":",
"# If graph orientation is vertical, horizontal space is free and",
"# vertical space is not; separate words with spaces",
"separator",
"=",
"' '",
... | https://github.com/zhaoweicai/cascade-rcnn/blob/2252f46158ea6555868ca6fa5c221ea71d9b5e6c/python/caffe/draw.py#L62-L114 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Path/PathScripts/PathSetupSheet.py | python | SetupSheet.expressionReference | (self) | return self.obj.Name | expressionReference() ... returns the string to be used in expressions | expressionReference() ... returns the string to be used in expressions | [
"expressionReference",
"()",
"...",
"returns",
"the",
"string",
"to",
"be",
"used",
"in",
"expressions"
] | def expressionReference(self):
"""expressionReference() ... returns the string to be used in expressions"""
# Using the Name here and not the Label (both would be valid) because the Name 'fails early'.
#
# If there is a Name/Label conflict and an expression is bound to the Name we'll get... | [
"def",
"expressionReference",
"(",
"self",
")",
":",
"# Using the Name here and not the Label (both would be valid) because the Name 'fails early'.",
"#",
"# If there is a Name/Label conflict and an expression is bound to the Name we'll get an error",
"# on creation (Property not found). Not good,... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Path/PathScripts/PathSetupSheet.py#L345-L365 | |
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/instrument.py | python | Instrument.risk_limit | (self) | return self._risk_limit | Gets the risk_limit of this Instrument. # noqa: E501
:return: The risk_limit of this Instrument. # noqa: E501
:rtype: float | Gets the risk_limit of this Instrument. # noqa: E501 | [
"Gets",
"the",
"risk_limit",
"of",
"this",
"Instrument",
".",
"#",
"noqa",
":",
"E501"
] | def risk_limit(self):
"""Gets the risk_limit of this Instrument. # noqa: E501
:return: The risk_limit of this Instrument. # noqa: E501
:rtype: float
"""
return self._risk_limit | [
"def",
"risk_limit",
"(",
"self",
")",
":",
"return",
"self",
".",
"_risk_limit"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/instrument.py#L1360-L1367 | |
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | imperative/python/megengine/functional/nn.py | python | one_hot | (inp: Tensor, num_classes: int) | return result | r"""Performs one-hot encoding for the input tensor.
Args:
inp: input tensor.
num_classes: number of classes denotes the last dimension of the output tensor.
Examples:
.. testcode::
import numpy as np
from megengine import tensor
import megengine.fu... | r"""Performs one-hot encoding for the input tensor. | [
"r",
"Performs",
"one",
"-",
"hot",
"encoding",
"for",
"the",
"input",
"tensor",
"."
] | def one_hot(inp: Tensor, num_classes: int) -> Tensor:
r"""Performs one-hot encoding for the input tensor.
Args:
inp: input tensor.
num_classes: number of classes denotes the last dimension of the output tensor.
Examples:
.. testcode::
import numpy as np
fr... | [
"def",
"one_hot",
"(",
"inp",
":",
"Tensor",
",",
"num_classes",
":",
"int",
")",
"->",
"Tensor",
":",
"zeros_tensor",
"=",
"zeros",
"(",
"list",
"(",
"inp",
".",
"shape",
")",
"+",
"[",
"num_classes",
"]",
",",
"dtype",
"=",
"inp",
".",
"dtype",
"... | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/functional/nn.py#L1517-L1551 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/searchengine.py | python | SearchEngine.__init__ | (self, root) | Initialize Variables that save search state.
The dialogs bind these to the UI elements present in the dialogs. | Initialize Variables that save search state. | [
"Initialize",
"Variables",
"that",
"save",
"search",
"state",
"."
] | def __init__(self, root):
'''Initialize Variables that save search state.
The dialogs bind these to the UI elements present in the dialogs.
'''
self.root = root # need for report_error()
self.patvar = StringVar(root, '') # search pattern
self.revar = BooleanVar(root, ... | [
"def",
"__init__",
"(",
"self",
",",
"root",
")",
":",
"self",
".",
"root",
"=",
"root",
"# need for report_error()",
"self",
".",
"patvar",
"=",
"StringVar",
"(",
"root",
",",
"''",
")",
"# search pattern",
"self",
".",
"revar",
"=",
"BooleanVar",
"(",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/searchengine.py#L22-L33 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | GraphicsPath.GetBox | (*args, **kwargs) | return _gdi_.GraphicsPath_GetBox(*args, **kwargs) | GetBox(self) -> Rect2D
Gets the bounding box enclosing all points (possibly including control
points) | GetBox(self) -> Rect2D | [
"GetBox",
"(",
"self",
")",
"-",
">",
"Rect2D"
] | def GetBox(*args, **kwargs):
"""
GetBox(self) -> Rect2D
Gets the bounding box enclosing all points (possibly including control
points)
"""
return _gdi_.GraphicsPath_GetBox(*args, **kwargs) | [
"def",
"GetBox",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"GraphicsPath_GetBox",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L5861-L5868 | |
apache/arrow | af33dd1157eb8d7d9bfac25ebf61445b793b7943 | python/pyarrow/pandas_compat.py | python | get_column_metadata | (column, name, arrow_type, field_name) | return {
'name': name,
'field_name': 'None' if field_name is None else field_name,
'pandas_type': logical_type,
'numpy_type': string_dtype,
'metadata': extra_metadata,
} | Construct the metadata for a given column
Parameters
----------
column : pandas.Series or pandas.Index
name : str
arrow_type : pyarrow.DataType
field_name : str
Equivalent to `name` when `column` is a `Series`, otherwise if `column`
is a pandas Index then `field_name` will not b... | Construct the metadata for a given column | [
"Construct",
"the",
"metadata",
"for",
"a",
"given",
"column"
] | def get_column_metadata(column, name, arrow_type, field_name):
"""Construct the metadata for a given column
Parameters
----------
column : pandas.Series or pandas.Index
name : str
arrow_type : pyarrow.DataType
field_name : str
Equivalent to `name` when `column` is a `Series`, otherw... | [
"def",
"get_column_metadata",
"(",
"column",
",",
"name",
",",
"arrow_type",
",",
"field_name",
")",
":",
"logical_type",
"=",
"get_logical_type",
"(",
"arrow_type",
")",
"string_dtype",
",",
"extra_metadata",
"=",
"get_extension_dtype_info",
"(",
"column",
")",
"... | https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/python/pyarrow/pandas_compat.py#L139-L181 | |
indutny/candor | 48e7260618f5091c80a3416828e2808cad3ea22e | tools/gyp/pylib/gyp/generator/make.py | python | StringToMakefileVariable | (string) | return re.sub('[^a-zA-Z0-9_]', '_', string) | Convert a string to a value that is acceptable as a make variable name. | Convert a string to a value that is acceptable as a make variable name. | [
"Convert",
"a",
"string",
"to",
"a",
"value",
"that",
"is",
"acceptable",
"as",
"a",
"make",
"variable",
"name",
"."
] | def StringToMakefileVariable(string):
"""Convert a string to a value that is acceptable as a make variable name."""
return re.sub('[^a-zA-Z0-9_]', '_', string) | [
"def",
"StringToMakefileVariable",
"(",
"string",
")",
":",
"return",
"re",
".",
"sub",
"(",
"'[^a-zA-Z0-9_]'",
",",
"'_'",
",",
"string",
")"
] | https://github.com/indutny/candor/blob/48e7260618f5091c80a3416828e2808cad3ea22e/tools/gyp/pylib/gyp/generator/make.py#L601-L603 | |
simon-anders/htseq | 5ba0507ea237e2e067ea79fb28febbc56a37f0d4 | python3/HTSeq/scripts/count.py | python | count_reads_in_features | (
sam_filenames,
gff_filename,
order,
max_buffer_size,
stranded,
overlap_mode,
multimapped_mode,
secondary_alignment_mode,
supplementary_alignment_mode,
feature_type,
id_attribute,
additional_attributes,
quiet,
... | Count reads in features, parallelizing by file | Count reads in features, parallelizing by file | [
"Count",
"reads",
"in",
"features",
"parallelizing",
"by",
"file"
] | def count_reads_in_features(
sam_filenames,
gff_filename,
order,
max_buffer_size,
stranded,
overlap_mode,
multimapped_mode,
secondary_alignment_mode,
supplementary_alignment_mode,
feature_type,
id_attribute,
additional_attri... | [
"def",
"count_reads_in_features",
"(",
"sam_filenames",
",",
"gff_filename",
",",
"order",
",",
"max_buffer_size",
",",
"stranded",
",",
"overlap_mode",
",",
"multimapped_mode",
",",
"secondary_alignment_mode",
",",
"supplementary_alignment_mode",
",",
"feature_type",
","... | https://github.com/simon-anders/htseq/blob/5ba0507ea237e2e067ea79fb28febbc56a37f0d4/python3/HTSeq/scripts/count.py#L322-L504 | ||
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/NinjaWriter.py | python | NinjaWriter.WriteSpec | (self) | return self.target | The entry point for NinjaWriter: write the build rules for a spec.
Returns a Target object, which represents the output paths for this spec.
Returns None if there are no outputs (e.g. a settings-only 'none' type
target). | The entry point for NinjaWriter: write the build rules for a spec. | [
"The",
"entry",
"point",
"for",
"NinjaWriter",
":",
"write",
"the",
"build",
"rules",
"for",
"a",
"spec",
"."
] | def WriteSpec(self):
"""
The entry point for NinjaWriter: write the build rules for a spec.
Returns a Target object, which represents the output paths for this spec.
Returns None if there are no outputs (e.g. a settings-only 'none' type
target).
"""
if self.flavor == 'mac':
self.xcod... | [
"def",
"WriteSpec",
"(",
"self",
")",
":",
"if",
"self",
".",
"flavor",
"==",
"'mac'",
":",
"self",
".",
"xcode_settings",
"=",
"xcode_emulation",
".",
"XcodeSettings",
"(",
"self",
".",
"spec",
")",
"mac_toolchain_dir",
"=",
"self",
".",
"generator_flags",
... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/NinjaWriter.py#L1250-L1370 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/linalg_ops.py | python | _MatrixSolveLsShapeHelper | (lhs_shape, rhs_shape) | return [lhs_shape[:-2].concatenate([lhs_shape[-1], rhs_shape[-1]])] | Shape inference helper function for least squares matrix solver ops. | Shape inference helper function for least squares matrix solver ops. | [
"Shape",
"inference",
"helper",
"function",
"for",
"least",
"squares",
"matrix",
"solver",
"ops",
"."
] | def _MatrixSolveLsShapeHelper(lhs_shape, rhs_shape):
"""Shape inference helper function for least squares matrix solver ops."""
# The matrices and right-hand sides must have the same number of rows.
lhs_shape[-2].assert_is_compatible_with(rhs_shape[-2])
return [lhs_shape[:-2].concatenate([lhs_shape[-1], rhs_sha... | [
"def",
"_MatrixSolveLsShapeHelper",
"(",
"lhs_shape",
",",
"rhs_shape",
")",
":",
"# The matrices and right-hand sides must have the same number of rows.",
"lhs_shape",
"[",
"-",
"2",
"]",
".",
"assert_is_compatible_with",
"(",
"rhs_shape",
"[",
"-",
"2",
"]",
")",
"ret... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/linalg_ops.py#L187-L191 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py | python | _ToLocalPath | (toplevel_dir, path) | return path | Converts |path| to a path relative to |toplevel_dir|. | Converts |path| to a path relative to |toplevel_dir|. | [
"Converts",
"|path|",
"to",
"a",
"path",
"relative",
"to",
"|toplevel_dir|",
"."
] | def _ToLocalPath(toplevel_dir, path):
"""Converts |path| to a path relative to |toplevel_dir|."""
if path == toplevel_dir:
return ''
if path.startswith(toplevel_dir + '/'):
return path[len(toplevel_dir) + len('/'):]
return path | [
"def",
"_ToLocalPath",
"(",
"toplevel_dir",
",",
"path",
")",
":",
"if",
"path",
"==",
"toplevel_dir",
":",
"return",
"''",
"if",
"path",
".",
"startswith",
"(",
"toplevel_dir",
"+",
"'/'",
")",
":",
"return",
"path",
"[",
"len",
"(",
"toplevel_dir",
")"... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py#L169-L175 | |
BTCPrivate/BTCP-Rebase | c8c7fe6ac26b6fba71eae1c89cdc0d924f5c6d82 | contrib/devtools/update-translations.py | python | remove_invalid_characters | (s) | return FIX_RE.sub(b'', s) | Remove invalid characters from translation string | Remove invalid characters from translation string | [
"Remove",
"invalid",
"characters",
"from",
"translation",
"string"
] | def remove_invalid_characters(s):
'''Remove invalid characters from translation string'''
return FIX_RE.sub(b'', s) | [
"def",
"remove_invalid_characters",
"(",
"s",
")",
":",
"return",
"FIX_RE",
".",
"sub",
"(",
"b''",
",",
"s",
")"
] | https://github.com/BTCPrivate/BTCP-Rebase/blob/c8c7fe6ac26b6fba71eae1c89cdc0d924f5c6d82/contrib/devtools/update-translations.py#L114-L116 | |
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | driver/python/pysequoiadb/replicagroup.py | python | replicagroup.create_node | (self, hostname, servicename, dbpath, config=None) | Create node in a given replica group.
Parameters:
Name Type Info:
hostname str The host name for the node.
servicename str The servicename for the node.
dbpath str The database path for the node.
config dict ... | Create node in a given replica group. | [
"Create",
"node",
"in",
"a",
"given",
"replica",
"group",
"."
] | def create_node(self, hostname, servicename, dbpath, config=None):
"""Create node in a given replica group.
Parameters:
Name Type Info:
hostname str The host name for the node.
servicename str The servicename for the node.
dbpath ... | [
"def",
"create_node",
"(",
"self",
",",
"hostname",
",",
"servicename",
",",
"dbpath",
",",
"config",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"hostname",
",",
"str_type",
")",
":",
"raise",
"SDBTypeError",
"(",
"\"host must be an instance of str... | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/driver/python/pysequoiadb/replicagroup.py#L237-L264 | ||
luca-m/emotime | 643a5c09144b515a102942a178a3b7ce0e2cdc92 | src/dataset/datasetTrain.py | python | dataset_run_training | (dsFolder, config, mode) | Start training | Start training | [
"Start",
"training"
] | def dataset_run_training(dsFolder, config, mode):
"""
Start training
"""
trainFldr = join(dsFolder, config['TRAIN_FOLDER'])
if mode == "ada":
smode = "ada"
classifFldr = join(dsFolder, config['CLASSIFIER_ADA_FOLDER'])
else:
smode = "svm"
classifFldr = join(dsFolder, config['CLASSIFIER_SV... | [
"def",
"dataset_run_training",
"(",
"dsFolder",
",",
"config",
",",
"mode",
")",
":",
"trainFldr",
"=",
"join",
"(",
"dsFolder",
",",
"config",
"[",
"'TRAIN_FOLDER'",
"]",
")",
"if",
"mode",
"==",
"\"ada\"",
":",
"smode",
"=",
"\"ada\"",
"classifFldr",
"="... | https://github.com/luca-m/emotime/blob/643a5c09144b515a102942a178a3b7ce0e2cdc92/src/dataset/datasetTrain.py#L48-L59 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/framework/dtypes.py | python | DType._is_ref_dtype | (self) | return self._type_enum > 100 | Returns `True` if this `DType` represents a reference type. | Returns `True` if this `DType` represents a reference type. | [
"Returns",
"True",
"if",
"this",
"DType",
"represents",
"a",
"reference",
"type",
"."
] | def _is_ref_dtype(self):
"""Returns `True` if this `DType` represents a reference type."""
return self._type_enum > 100 | [
"def",
"_is_ref_dtype",
"(",
"self",
")",
":",
"return",
"self",
".",
"_type_enum",
">",
"100"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/framework/dtypes.py#L86-L88 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | WindowList.__contains__ | (*args, **kwargs) | return _core_.WindowList___contains__(*args, **kwargs) | __contains__(self, Window obj) -> bool | __contains__(self, Window obj) -> bool | [
"__contains__",
"(",
"self",
"Window",
"obj",
")",
"-",
">",
"bool"
] | def __contains__(*args, **kwargs):
"""__contains__(self, Window obj) -> bool"""
return _core_.WindowList___contains__(*args, **kwargs) | [
"def",
"__contains__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"WindowList___contains__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L9063-L9065 | |
osquery/osquery | fd529718e48348853f708d56990720c3c84c7152 | tools/codegen/templite.py | python | Templite.__init__ | (self, text=None, filename=None,
encoding='utf-8', delimiters=None, caching=False) | Loads a template from string or file. | Loads a template from string or file. | [
"Loads",
"a",
"template",
"from",
"string",
"or",
"file",
"."
] | def __init__(self, text=None, filename=None,
encoding='utf-8', delimiters=None, caching=False):
"""Loads a template from string or file."""
if filename:
filename = os.path.abspath(filename)
mtime = os.path.getmtime(filename)
self.file = key = filen... | [
"def",
"__init__",
"(",
"self",
",",
"text",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"encoding",
"=",
"'utf-8'",
",",
"delimiters",
"=",
"None",
",",
"caching",
"=",
"False",
")",
":",
"if",
"filename",
":",
"filename",
"=",
"os",
".",
"path"... | https://github.com/osquery/osquery/blob/fd529718e48348853f708d56990720c3c84c7152/tools/codegen/templite.py#L37-L68 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/goat-latin.py | python | Solution.toGoatLatin | (self, S) | return " ".join(convert(S)) | :type S: str
:rtype: str | :type S: str
:rtype: str | [
":",
"type",
"S",
":",
"str",
":",
"rtype",
":",
"str"
] | def toGoatLatin(self, S):
"""
:type S: str
:rtype: str
"""
def convert(S):
vowel = set('aeiouAEIOU')
for i, word in enumerate(S.split(), 1):
if word[0] not in vowel:
word = word[1:] + word[:1]
yield word ... | [
"def",
"toGoatLatin",
"(",
"self",
",",
"S",
")",
":",
"def",
"convert",
"(",
"S",
")",
":",
"vowel",
"=",
"set",
"(",
"'aeiouAEIOU'",
")",
"for",
"i",
",",
"word",
"in",
"enumerate",
"(",
"S",
".",
"split",
"(",
")",
",",
"1",
")",
":",
"if",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/goat-latin.py#L8-L19 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/io/loader.py | python | read_Vector_raw | (text) | return [float(v) for v in items] | Reads a vector from a raw string 'v1 ... vn | Reads a vector from a raw string 'v1 ... vn | [
"Reads",
"a",
"vector",
"from",
"a",
"raw",
"string",
"v1",
"...",
"vn"
] | def read_Vector_raw(text):
"""Reads a vector from a raw string 'v1 ... vn'"""
items = text.split()
return [float(v) for v in items] | [
"def",
"read_Vector_raw",
"(",
"text",
")",
":",
"items",
"=",
"text",
".",
"split",
"(",
")",
"return",
"[",
"float",
"(",
"v",
")",
"for",
"v",
"in",
"items",
"]"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/io/loader.py#L171-L174 | |
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | imperative/python/megengine/functional/external.py | python | cambricon_runtime_opr | (inputs, data, symbol, tensor_dim_mutable) | return apply(op, *inputs) | r"""Load a serialized Cambricon model as a runtime operator in MegEngine.
Args:
inputs: list of input tensors.
data: the serialized Cambricon model.
symbol: name of the function in Cambricon model.
tensor_dim_mutable: whether the input tensors' shapes are mutable
in ``cn... | r"""Load a serialized Cambricon model as a runtime operator in MegEngine. | [
"r",
"Load",
"a",
"serialized",
"Cambricon",
"model",
"as",
"a",
"runtime",
"operator",
"in",
"MegEngine",
"."
] | def cambricon_runtime_opr(inputs, data, symbol, tensor_dim_mutable):
r"""Load a serialized Cambricon model as a runtime operator in MegEngine.
Args:
inputs: list of input tensors.
data: the serialized Cambricon model.
symbol: name of the function in Cambricon model.
tensor_dim_m... | [
"def",
"cambricon_runtime_opr",
"(",
"inputs",
",",
"data",
",",
"symbol",
",",
"tensor_dim_mutable",
")",
":",
"op",
"=",
"builtin",
".",
"CambriconRuntime",
"(",
"data",
",",
"len",
"(",
"data",
")",
",",
"symbol",
",",
"tensor_dim_mutable",
")",
"return",... | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/functional/external.py#L44-L56 | |
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_internal/utils/appdirs.py | python | user_data_dir | (appname, roaming=False) | return path | r"""
Return full path to the user-specific data dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
"roaming" (boolean, default False) can be set True to use the Windows
roaming appdata directory. That means that fo... | r"""
Return full path to the user-specific data dir for this application. | [
"r",
"Return",
"full",
"path",
"to",
"the",
"user",
"-",
"specific",
"data",
"dir",
"for",
"this",
"application",
"."
] | def user_data_dir(appname, roaming=False):
# type: (str, bool) -> str
r"""
Return full path to the user-specific data dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
"roaming" (boolean, default False) can be set Tru... | [
"def",
"user_data_dir",
"(",
"appname",
",",
"roaming",
"=",
"False",
")",
":",
"# type: (str, bool) -> str",
"if",
"WINDOWS",
":",
"const",
"=",
"roaming",
"and",
"\"CSIDL_APPDATA\"",
"or",
"\"CSIDL_LOCAL_APPDATA\"",
"path",
"=",
"os",
".",
"path",
".",
"join",... | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_internal/utils/appdirs.py#L70-L120 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/optimize/_basinhopping.py | python | basinhopping | (func, x0, niter=100, T=1.0, stepsize=0.5,
minimizer_kwargs=None, take_step=None, accept_test=None,
callback=None, interval=50, disp=False, niter_success=None,
seed=None) | return res | Find the global minimum of a function using the basin-hopping algorithm
Parameters
----------
func : callable ``f(x, *args)``
Function to be optimized. ``args`` can be passed as an optional item
in the dict ``minimizer_kwargs``
x0 : ndarray
Initial guess.
niter : integer, o... | Find the global minimum of a function using the basin-hopping algorithm | [
"Find",
"the",
"global",
"minimum",
"of",
"a",
"function",
"using",
"the",
"basin",
"-",
"hopping",
"algorithm"
] | def basinhopping(func, x0, niter=100, T=1.0, stepsize=0.5,
minimizer_kwargs=None, take_step=None, accept_test=None,
callback=None, interval=50, disp=False, niter_success=None,
seed=None):
"""
Find the global minimum of a function using the basin-hopping algorit... | [
"def",
"basinhopping",
"(",
"func",
",",
"x0",
",",
"niter",
"=",
"100",
",",
"T",
"=",
"1.0",
",",
"stepsize",
"=",
"0.5",
",",
"minimizer_kwargs",
"=",
"None",
",",
"take_step",
"=",
"None",
",",
"accept_test",
"=",
"None",
",",
"callback",
"=",
"N... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/optimize/_basinhopping.py#L311-L667 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/gyp/pylib/gyp/msvs_emulation.py | python | GenerateEnvironmentFiles | (toplevel_build_dir, generator_flags,
system_includes, open_out) | return cl_paths | It's not sufficient to have the absolute path to the compiler, linker,
etc. on Windows, as those tools rely on .dlls being in the PATH. We also
need to support both x86 and x64 compilers within the same build (to support
msvs_target_platform hackery). Different architectures require a different
compiler binary,... | It's not sufficient to have the absolute path to the compiler, linker,
etc. on Windows, as those tools rely on .dlls being in the PATH. We also
need to support both x86 and x64 compilers within the same build (to support
msvs_target_platform hackery). Different architectures require a different
compiler binary,... | [
"It",
"s",
"not",
"sufficient",
"to",
"have",
"the",
"absolute",
"path",
"to",
"the",
"compiler",
"linker",
"etc",
".",
"on",
"Windows",
"as",
"those",
"tools",
"rely",
"on",
".",
"dlls",
"being",
"in",
"the",
"PATH",
".",
"We",
"also",
"need",
"to",
... | def GenerateEnvironmentFiles(toplevel_build_dir, generator_flags,
system_includes, open_out):
"""It's not sufficient to have the absolute path to the compiler, linker,
etc. on Windows, as those tools rely on .dlls being in the PATH. We also
need to support both x86 and x64 compilers w... | [
"def",
"GenerateEnvironmentFiles",
"(",
"toplevel_build_dir",
",",
"generator_flags",
",",
"system_includes",
",",
"open_out",
")",
":",
"archs",
"=",
"(",
"'x86'",
",",
"'x64'",
")",
"if",
"generator_flags",
".",
"get",
"(",
"'ninja_use_custom_environment_files'",
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/gyp/pylib/gyp/msvs_emulation.py#L1030-L1087 | |
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | python/mxnet/image/detection.py | python | DetRandomPadAug.__call__ | (self, src, label) | return (src, label) | Augmenter body | Augmenter body | [
"Augmenter",
"body"
] | def __call__(self, src, label):
"""Augmenter body"""
height, width, _ = src.shape
pad = self._random_pad_proposal(label, height, width)
if pad:
x, y, w, h, label = pad
src = copyMakeBorder(src, y, h-y-height, x, w-x-width, 16, values=self.pad_val)
return (... | [
"def",
"__call__",
"(",
"self",
",",
"src",
",",
"label",
")",
":",
"height",
",",
"width",
",",
"_",
"=",
"src",
".",
"shape",
"pad",
"=",
"self",
".",
"_random_pad_proposal",
"(",
"label",
",",
"height",
",",
"width",
")",
"if",
"pad",
":",
"x",
... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/image/detection.py#L369-L376 | |
apiaryio/snowcrash | b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3 | tools/gyp/pylib/gyp/xml_fix.py | python | _Replacement_write_data | (writer, data, is_attrib=False) | Writes datachars to writer. | Writes datachars to writer. | [
"Writes",
"datachars",
"to",
"writer",
"."
] | def _Replacement_write_data(writer, data, is_attrib=False):
"""Writes datachars to writer."""
data = data.replace("&", "&").replace("<", "<")
data = data.replace("\"", """).replace(">", ">")
if is_attrib:
data = data.replace(
"\r", "
").replace(
"\n", "
").replace(
... | [
"def",
"_Replacement_write_data",
"(",
"writer",
",",
"data",
",",
"is_attrib",
"=",
"False",
")",
":",
"data",
"=",
"data",
".",
"replace",
"(",
"\"&\"",
",",
"\"&\"",
")",
".",
"replace",
"(",
"\"<\"",
",",
"\"<\"",
")",
"data",
"=",
"data",
"... | https://github.com/apiaryio/snowcrash/blob/b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3/tools/gyp/pylib/gyp/xml_fix.py#L16-L25 | ||
Evolving-AI-Lab/fooling | 66f097dd6bd2eb6794ade3e187a7adfdf1887688 | caffe/scripts/cpp_lint.py | python | GetHeaderGuardCPPVariable | (filename) | return re.sub(r'[-./\s]', '_', 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/Evolving-AI-Lab/fooling/blob/66f097dd6bd2eb6794ade3e187a7adfdf1887688/caffe/scripts/cpp_lint.py#L1384-L1405 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/image_ops.py | python | random_brightness | (image, max_delta, seed=None) | return adjust_brightness(image, delta) | Adjust the brightness of images by a random factor.
Equivalent to `adjust_brightness()` using a `delta` randomly picked in the
interval `[-max_delta, max_delta)`.
Args:
image: An image.
max_delta: float, must be non-negative.
seed: A Python integer. Used to create a random seed. See
[`set_rand... | Adjust the brightness of images by a random factor. | [
"Adjust",
"the",
"brightness",
"of",
"images",
"by",
"a",
"random",
"factor",
"."
] | def random_brightness(image, max_delta, seed=None):
"""Adjust the brightness of images by a random factor.
Equivalent to `adjust_brightness()` using a `delta` randomly picked in the
interval `[-max_delta, max_delta)`.
Args:
image: An image.
max_delta: float, must be non-negative.
seed: A Python in... | [
"def",
"random_brightness",
"(",
"image",
",",
"max_delta",
",",
"seed",
"=",
"None",
")",
":",
"if",
"max_delta",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"'max_delta must be non-negative.'",
")",
"delta",
"=",
"random_ops",
".",
"random_uniform",
"(",
"[",... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/image_ops.py#L876-L899 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rospy/src/rospy/impl/tcpros_pubsub.py | python | TCPROSHandler.set_tcp_nodelay | (self, resolved_name, tcp_nodelay) | @param resolved_name: resolved topic name
@type resolved_name: str
@param tcp_nodelay: If True, sets TCP_NODELAY on publisher's
socket (disables Nagle algorithm). This results in lower
latency publishing at the cost of efficiency.
@type tcp_nodelay: bool | @param resolved_name: resolved topic name
@type resolved_name: str | [
"@param",
"resolved_name",
":",
"resolved",
"topic",
"name",
"@type",
"resolved_name",
":",
"str"
] | def set_tcp_nodelay(self, resolved_name, tcp_nodelay):
"""
@param resolved_name: resolved topic name
@type resolved_name: str
@param tcp_nodelay: If True, sets TCP_NODELAY on publisher's
socket (disables Nagle algorithm). This results in lower
latency publishing at the ... | [
"def",
"set_tcp_nodelay",
"(",
"self",
",",
"resolved_name",
",",
"tcp_nodelay",
")",
":",
"self",
".",
"tcp_nodelay_map",
"[",
"resolved_name",
"]",
"=",
"tcp_nodelay"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rospy/src/rospy/impl/tcpros_pubsub.py#L210-L220 | ||
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | platforms/nuttx/NuttX/tools/kconfiglib.py | python | Kconfig.load_config | (self, filename=None, replace=True, verbose=True) | return loaded_existing | Loads symbol values from a file in the .config format. Equivalent to
calling Symbol.set_value() to set each of the values.
"# CONFIG_FOO is not set" within a .config file sets the user value of
FOO to n. The C tools work the same way.
For each symbol, the Symbol.user_value attribute ho... | Loads symbol values from a file in the .config format. Equivalent to
calling Symbol.set_value() to set each of the values. | [
"Loads",
"symbol",
"values",
"from",
"a",
"file",
"in",
"the",
".",
"config",
"format",
".",
"Equivalent",
"to",
"calling",
"Symbol",
".",
"set_value",
"()",
"to",
"set",
"each",
"of",
"the",
"values",
"."
] | def load_config(self, filename=None, replace=True, verbose=True):
"""
Loads symbol values from a file in the .config format. Equivalent to
calling Symbol.set_value() to set each of the values.
"# CONFIG_FOO is not set" within a .config file sets the user value of
FOO to n. The C... | [
"def",
"load_config",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"replace",
"=",
"True",
",",
"verbose",
"=",
"True",
")",
":",
"loaded_existing",
"=",
"True",
"if",
"filename",
"is",
"None",
":",
"filename",
"=",
"standard_config_filename",
"(",
")",... | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/platforms/nuttx/NuttX/tools/kconfiglib.py#L1038-L1129 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py | python | EntryPoint.parse_map | (cls, data, dist=None) | return maps | Parse a map of entry point groups | Parse a map of entry point groups | [
"Parse",
"a",
"map",
"of",
"entry",
"point",
"groups"
] | def parse_map(cls, data, dist=None):
"""Parse a map of entry point groups"""
if isinstance(data, dict):
data = data.items()
else:
data = split_sections(data)
maps = {}
for group, lines in data:
if group is None:
if not lines:
... | [
"def",
"parse_map",
"(",
"cls",
",",
"data",
",",
"dist",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"dict",
")",
":",
"data",
"=",
"data",
".",
"items",
"(",
")",
"else",
":",
"data",
"=",
"split_sections",
"(",
"data",
")",
"m... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py#L2520-L2536 | |
s9xie/hed | 94fb22f10cbfec8d84fbc0642b224022014b6bd6 | scripts/cpp_lint.py | python | _SetFilters | (filters) | Sets the module's error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "whitespace/indent").
Each filter should start with + or -; else we die. | Sets the module's error-message filters. | [
"Sets",
"the",
"module",
"s",
"error",
"-",
"message",
"filters",
"."
] | def _SetFilters(filters):
"""Sets the module's error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "whitespace/indent").
Each filter should start with + or -; else we die.
"""
_cpplint... | [
"def",
"_SetFilters",
"(",
"filters",
")",
":",
"_cpplint_state",
".",
"SetFilters",
"(",
"filters",
")"
] | https://github.com/s9xie/hed/blob/94fb22f10cbfec8d84fbc0642b224022014b6bd6/scripts/cpp_lint.py#L797-L807 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/base64.py | python | test | () | Small test program | Small test program | [
"Small",
"test",
"program"
] | def test():
"""Small test program"""
import sys, getopt
try:
opts, args = getopt.getopt(sys.argv[1:], 'deut')
except getopt.error, msg:
sys.stdout = sys.stderr
print msg
print """usage: %s [-d|-e|-u|-t] [file|-]
-d, -u: decode
-e: encode (default)
... | [
"def",
"test",
"(",
")",
":",
"import",
"sys",
",",
"getopt",
"try",
":",
"opts",
",",
"args",
"=",
"getopt",
".",
"getopt",
"(",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
",",
"'deut'",
")",
"except",
"getopt",
".",
"error",
",",
"msg",
":",
"sy... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/base64.py#L326-L348 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/decimal.py | python | Context.remainder_near | (self, a, b) | return a.remainder_near(b, context=self) | Returns to be "a - b * n", where n is the integer nearest the exact
value of "x / b" (if two integers are equally near then the even one
is chosen). If the result is equal to 0 then its sign will be the
sign of a.
This operation will fail under the same conditions as integer division
... | Returns to be "a - b * n", where n is the integer nearest the exact
value of "x / b" (if two integers are equally near then the even one
is chosen). If the result is equal to 0 then its sign will be the
sign of a. | [
"Returns",
"to",
"be",
"a",
"-",
"b",
"*",
"n",
"where",
"n",
"is",
"the",
"integer",
"nearest",
"the",
"exact",
"value",
"of",
"x",
"/",
"b",
"(",
"if",
"two",
"integers",
"are",
"equally",
"near",
"then",
"the",
"even",
"one",
"is",
"chosen",
")"... | def remainder_near(self, a, b):
"""Returns to be "a - b * n", where n is the integer nearest the exact
value of "x / b" (if two integers are equally near then the even one
is chosen). If the result is equal to 0 then its sign will be the
sign of a.
This operation will fail unde... | [
"def",
"remainder_near",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"return",
"a",
".",
"remainder_near",
"(",
"b",
",",
"context",
"=",
"self",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/decimal.py#L4709-L4734 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/connection.py | python | EC2Connection.unmonitor_instances | (self, instance_ids, dry_run=False) | return self.get_list('UnmonitorInstances', params,
[('item', InstanceInfo)], verb='POST') | Disable CloudWatch monitoring for the supplied instance.
:type instance_id: list of string
:param instance_id: The instance id
:type dry_run: bool
:param dry_run: Set to True if the operation should not actually run.
:rtype: list
:return: A list of :class:`boto.ec2.ins... | Disable CloudWatch monitoring for the supplied instance. | [
"Disable",
"CloudWatch",
"monitoring",
"for",
"the",
"supplied",
"instance",
"."
] | def unmonitor_instances(self, instance_ids, dry_run=False):
"""
Disable CloudWatch monitoring for the supplied instance.
:type instance_id: list of string
:param instance_id: The instance id
:type dry_run: bool
:param dry_run: Set to True if the operation should not act... | [
"def",
"unmonitor_instances",
"(",
"self",
",",
"instance_ids",
",",
"dry_run",
"=",
"False",
")",
":",
"params",
"=",
"{",
"}",
"self",
".",
"build_list_params",
"(",
"params",
",",
"instance_ids",
",",
"'InstanceId'",
")",
"if",
"dry_run",
":",
"params",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/connection.py#L3905-L3923 | |
freeorion/freeorion | c266a40eccd3a99a17de8fe57c36ef6ba3771665 | default/python/AI/MilitaryAI.py | python | Allocator._regional_threat | (self) | return get_system_regional_threat(self.sys_id) | Threat derived from enemy supply lanes. | Threat derived from enemy supply lanes. | [
"Threat",
"derived",
"from",
"enemy",
"supply",
"lanes",
"."
] | def _regional_threat(self):
"""Threat derived from enemy supply lanes."""
return get_system_regional_threat(self.sys_id) | [
"def",
"_regional_threat",
"(",
"self",
")",
":",
"return",
"get_system_regional_threat",
"(",
"self",
".",
"sys_id",
")"
] | https://github.com/freeorion/freeorion/blob/c266a40eccd3a99a17de8fe57c36ef6ba3771665/default/python/AI/MilitaryAI.py#L414-L416 | |
NVIDIA/DALI | bf16cc86ba8f091b145f91962f21fe1b6aff243d | docs/examples/use_cases/tensorflow/efficientdet/model/backbone/efficientnet_model.py | python | round_repeats | (repeats, global_params, skip=False) | return int(math.ceil(multiplier * repeats)) | Round number of filters based on depth multiplier. | Round number of filters based on depth multiplier. | [
"Round",
"number",
"of",
"filters",
"based",
"on",
"depth",
"multiplier",
"."
] | def round_repeats(repeats, global_params, skip=False):
"""Round number of filters based on depth multiplier."""
multiplier = global_params.depth_coefficient
if skip or not multiplier:
return repeats
return int(math.ceil(multiplier * repeats)) | [
"def",
"round_repeats",
"(",
"repeats",
",",
"global_params",
",",
"skip",
"=",
"False",
")",
":",
"multiplier",
"=",
"global_params",
".",
"depth_coefficient",
"if",
"skip",
"or",
"not",
"multiplier",
":",
"return",
"repeats",
"return",
"int",
"(",
"math",
... | https://github.com/NVIDIA/DALI/blob/bf16cc86ba8f091b145f91962f21fe1b6aff243d/docs/examples/use_cases/tensorflow/efficientdet/model/backbone/efficientnet_model.py#L143-L148 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/ssl.py | python | SSLSocket.connect_ex | (self, addr) | return self._real_connect(addr, True) | Connects to remote ADDR, and then wraps the connection in
an SSL channel. | Connects to remote ADDR, and then wraps the connection in
an SSL channel. | [
"Connects",
"to",
"remote",
"ADDR",
"and",
"then",
"wraps",
"the",
"connection",
"in",
"an",
"SSL",
"channel",
"."
] | def connect_ex(self, addr):
"""Connects to remote ADDR, and then wraps the connection in
an SSL channel."""
return self._real_connect(addr, True) | [
"def",
"connect_ex",
"(",
"self",
",",
"addr",
")",
":",
"return",
"self",
".",
"_real_connect",
"(",
"addr",
",",
"True",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/ssl.py#L883-L886 | |
gromacs/gromacs | 7dec3a3f99993cf5687a122de3e12de31c21c399 | docs/doxygen/gmxtree.py | python | GromacsTree.find_include_file | (self, includedpath) | Find a file object corresponding to an include path. | Find a file object corresponding to an include path. | [
"Find",
"a",
"file",
"object",
"corresponding",
"to",
"an",
"include",
"path",
"."
] | def find_include_file(self, includedpath):
"""Find a file object corresponding to an include path."""
for testdir in ('src', 'src/external/thread_mpi/include',
'src/external/tng_io/include'):
testpath = os.path.join(testdir, includedpath)
if testpath in self._file... | [
"def",
"find_include_file",
"(",
"self",
",",
"includedpath",
")",
":",
"for",
"testdir",
"in",
"(",
"'src'",
",",
"'src/external/thread_mpi/include'",
",",
"'src/external/tng_io/include'",
")",
":",
"testpath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"testdir... | https://github.com/gromacs/gromacs/blob/7dec3a3f99993cf5687a122de3e12de31c21c399/docs/doxygen/gmxtree.py#L944-L950 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/Calibration/ideal_tube.py | python | IdealTube.constructTubeFor3PointsMethod | (self, idealAP, idealBP, idealCP, activeTubeLen) | Construct and ideal tube for Merlin 3-point calibration
:param idealAP: Ideal left (AP) in pixels
:param idealBP: ideal right (BP) in pixels
:param idealCP: ideal centre (CP) in pixels
:param activeTubeLen: Active tube length in metres | Construct and ideal tube for Merlin 3-point calibration | [
"Construct",
"and",
"ideal",
"tube",
"for",
"Merlin",
"3",
"-",
"point",
"calibration"
] | def constructTubeFor3PointsMethod(self, idealAP, idealBP, idealCP, activeTubeLen):
"""
Construct and ideal tube for Merlin 3-point calibration
:param idealAP: Ideal left (AP) in pixels
:param idealBP: ideal right (BP) in pixels
:param idealCP: ideal centre (CP) in pixels
... | [
"def",
"constructTubeFor3PointsMethod",
"(",
"self",
",",
"idealAP",
",",
"idealBP",
",",
"idealCP",
",",
"activeTubeLen",
")",
":",
"#Construct Ideal tube for 3 point calibration of MERLIN standard tube (code could be put into a function)",
"pixelLen",
"=",
"activeTubeLen",
"/",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Calibration/ideal_tube.py#L68-L84 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py | python | default_fill_value | (obj) | Function to calculate default fill value for an object. | Function to calculate default fill value for an object. | [
"Function",
"to",
"calculate",
"default",
"fill",
"value",
"for",
"an",
"object",
"."
] | def default_fill_value (obj):
"Function to calculate default fill value for an object."
if isinstance(obj, float):
return default_real_fill_value
elif isinstance(obj, int) or isinstance(obj, long):
return default_integer_fill_value
elif isinstance(obj, bytes):
return default_char... | [
"def",
"default_fill_value",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"float",
")",
":",
"return",
"default_real_fill_value",
"elif",
"isinstance",
"(",
"obj",
",",
"int",
")",
"or",
"isinstance",
"(",
"obj",
",",
"long",
")",
":",
"ret... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py#L96-L120 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/geographic_msgs/srv/_GetGeographicMap.py | python | GetGeographicMapResponse.deserialize_numpy | (self, str, numpy) | unpack serialized message in str into this message instance using numpy for array types
:param str: byte array of serialized message, ``str``
:param numpy: numpy python module | unpack serialized message in str into this message instance using numpy for array types
:param str: byte array of serialized message, ``str``
:param numpy: numpy python module | [
"unpack",
"serialized",
"message",
"in",
"str",
"into",
"this",
"message",
"instance",
"using",
"numpy",
"for",
"array",
"types",
":",
"param",
"str",
":",
"byte",
"array",
"of",
"serialized",
"message",
"str",
":",
"param",
"numpy",
":",
"numpy",
"python",
... | def deserialize_numpy(self, str, numpy):
"""
unpack serialized message in str into this message instance using numpy for array types
:param str: byte array of serialized message, ``str``
:param numpy: numpy python module
"""
try:
if self.map is None:
self.map = geographic_msgs.msg.... | [
"def",
"deserialize_numpy",
"(",
"self",
",",
"str",
",",
"numpy",
")",
":",
"try",
":",
"if",
"self",
".",
"map",
"is",
"None",
":",
"self",
".",
"map",
"=",
"geographic_msgs",
".",
"msg",
".",
"GeographicMap",
"(",
")",
"end",
"=",
"0",
"start",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/geographic_msgs/srv/_GetGeographicMap.py#L779-L936 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/engine/compile_utils.py | python | MetricsContainer.update_state | (self, y_true, y_pred, sample_weight=None) | Updates the state of per-output metrics. | Updates the state of per-output metrics. | [
"Updates",
"the",
"state",
"of",
"per",
"-",
"output",
"metrics",
"."
] | def update_state(self, y_true, y_pred, sample_weight=None):
"""Updates the state of per-output metrics."""
y_true = self._conform_to_outputs(y_pred, y_true)
sample_weight = self._conform_to_outputs(y_pred, sample_weight)
if not self._built:
self.build(y_pred, y_true)
y_pred = nest.flatten(y_... | [
"def",
"update_state",
"(",
"self",
",",
"y_true",
",",
"y_pred",
",",
"sample_weight",
"=",
"None",
")",
":",
"y_true",
"=",
"self",
".",
"_conform_to_outputs",
"(",
"y_pred",
",",
"y_true",
")",
"sample_weight",
"=",
"self",
".",
"_conform_to_outputs",
"("... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/engine/compile_utils.py#L433-L465 | ||
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/execution.py | python | Execution.price | (self) | return self._price | Gets the price of this Execution. # noqa: E501
:return: The price of this Execution. # noqa: E501
:rtype: float | Gets the price of this Execution. # noqa: E501 | [
"Gets",
"the",
"price",
"of",
"this",
"Execution",
".",
"#",
"noqa",
":",
"E501"
] | def price(self):
"""Gets the price of this Execution. # noqa: E501
:return: The price of this Execution. # noqa: E501
:rtype: float
"""
return self._price | [
"def",
"price",
"(",
"self",
")",
":",
"return",
"self",
".",
"_price"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/execution.py#L576-L583 | |
apiaryio/snowcrash | b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3 | tools/gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter._WinIdlRule | (self, source, prebuild, outputs) | Handle the implicit VS .idl rule for one source file. Fills |outputs|
with files that are generated. | Handle the implicit VS .idl rule for one source file. Fills |outputs|
with files that are generated. | [
"Handle",
"the",
"implicit",
"VS",
".",
"idl",
"rule",
"for",
"one",
"source",
"file",
".",
"Fills",
"|outputs|",
"with",
"files",
"that",
"are",
"generated",
"."
] | def _WinIdlRule(self, source, prebuild, outputs):
"""Handle the implicit VS .idl rule for one source file. Fills |outputs|
with files that are generated."""
outdir, output, vars, flags = self.msvs_settings.GetIdlBuildData(
source, self.config_name)
outdir = self.GypPathToNinja(outdir)
def fi... | [
"def",
"_WinIdlRule",
"(",
"self",
",",
"source",
",",
"prebuild",
",",
"outputs",
")",
":",
"outdir",
",",
"output",
",",
"vars",
",",
"flags",
"=",
"self",
".",
"msvs_settings",
".",
"GetIdlBuildData",
"(",
"source",
",",
"self",
".",
"config_name",
")... | https://github.com/apiaryio/snowcrash/blob/b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3/tools/gyp/pylib/gyp/generator/ninja.py#L504-L526 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py | python | IsStrCanonicalInt | (string) | return False | Returns True if |string| is in its canonical integer form.
The canonical form is such that str(int(string)) == string. | Returns True if |string| is in its canonical integer form. | [
"Returns",
"True",
"if",
"|string|",
"is",
"in",
"its",
"canonical",
"integer",
"form",
"."
] | def IsStrCanonicalInt(string):
"""Returns True if |string| is in its canonical integer form.
The canonical form is such that str(int(string)) == string.
"""
if type(string) is str:
# This function is called a lot so for maximum performance, avoid
# involving regexps which would otherwise make the code ... | [
"def",
"IsStrCanonicalInt",
"(",
"string",
")",
":",
"if",
"type",
"(",
"string",
")",
"is",
"str",
":",
"# This function is called a lot so for maximum performance, avoid",
"# involving regexps which would otherwise make the code much",
"# shorter. Regexps would need twice the time ... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py#L646-L665 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListCtrl.SetItemBackgroundColour | (self, item, col) | Sets the item background colour.
:param `item`: the index of the item;
:param `col`: a valid :class:`Colour` object. | Sets the item background colour. | [
"Sets",
"the",
"item",
"background",
"colour",
"."
] | def SetItemBackgroundColour(self, item, col):
"""
Sets the item background colour.
:param `item`: the index of the item;
:param `col`: a valid :class:`Colour` object.
"""
info = UltimateListItem()
info._itemId = item
info = self._mainWin.GetItem(info)
... | [
"def",
"SetItemBackgroundColour",
"(",
"self",
",",
"item",
",",
"col",
")",
":",
"info",
"=",
"UltimateListItem",
"(",
")",
"info",
".",
"_itemId",
"=",
"item",
"info",
"=",
"self",
".",
"_mainWin",
".",
"GetItem",
"(",
"info",
")",
"info",
".",
"SetB... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ultimatelistctrl.py#L11679-L11691 | ||
nyuwireless-unipd/ns3-mmwave | 4ff9e87e8079764e04cbeccd8e85bff15ae16fb3 | utils/check-style.py | python | PatchChunk.dst_len | (self) | return len(self.dst()) | ! Get number of destinaton lines
@param self The current class
@return number of destination lines | ! Get number of destinaton lines | [
"!",
"Get",
"number",
"of",
"destinaton",
"lines"
] | def dst_len(self):
"""! Get number of destinaton lines
@param self The current class
@return number of destination lines
"""
return len(self.dst()) | [
"def",
"dst_len",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"dst",
"(",
")",
")"
] | https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/utils/check-style.py#L280-L285 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/grid.py | python | Grid.SetColSizes | (*args, **kwargs) | return _grid.Grid_SetColSizes(*args, **kwargs) | SetColSizes(self, GridSizesInfo sizeInfo) | SetColSizes(self, GridSizesInfo sizeInfo) | [
"SetColSizes",
"(",
"self",
"GridSizesInfo",
"sizeInfo",
")"
] | def SetColSizes(*args, **kwargs):
"""SetColSizes(self, GridSizesInfo sizeInfo)"""
return _grid.Grid_SetColSizes(*args, **kwargs) | [
"def",
"SetColSizes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"Grid_SetColSizes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/grid.py#L1854-L1856 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/requests/utils.py | python | default_user_agent | (name="python-requests") | return '%s/%s' % (name, __version__) | Return a string representing the default user agent.
:rtype: str | Return a string representing the default user agent. | [
"Return",
"a",
"string",
"representing",
"the",
"default",
"user",
"agent",
"."
] | def default_user_agent(name="python-requests"):
"""
Return a string representing the default user agent.
:rtype: str
"""
return '%s/%s' % (name, __version__) | [
"def",
"default_user_agent",
"(",
"name",
"=",
"\"python-requests\"",
")",
":",
"return",
"'%s/%s'",
"%",
"(",
"name",
",",
"__version__",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/requests/utils.py#L798-L804 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Cipher/_mode_siv.py | python | SivMode._create_ctr_cipher | (self, v) | return self._factory.new(
self._subkey_cipher,
self._factory.MODE_CTR,
initial_value=q,
nonce=b"",
**self._cipher_params) | Create a new CTR cipher from V in SIV mode | Create a new CTR cipher from V in SIV mode | [
"Create",
"a",
"new",
"CTR",
"cipher",
"from",
"V",
"in",
"SIV",
"mode"
] | def _create_ctr_cipher(self, v):
"""Create a new CTR cipher from V in SIV mode"""
v_int = bytes_to_long(v)
q = v_int & 0xFFFFFFFFFFFFFFFF7FFFFFFF7FFFFFFF
return self._factory.new(
self._subkey_cipher,
self._factory.MODE_CTR,
in... | [
"def",
"_create_ctr_cipher",
"(",
"self",
",",
"v",
")",
":",
"v_int",
"=",
"bytes_to_long",
"(",
"v",
")",
"q",
"=",
"v_int",
"&",
"0xFFFFFFFFFFFFFFFF7FFFFFFF7FFFFFFF",
"return",
"self",
".",
"_factory",
".",
"new",
"(",
"self",
".",
"_subkey_cipher",
",",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Cipher/_mode_siv.py#L129-L139 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/req/req_uninstall.py | python | compress_for_rename | (paths) | return set(map(case_map.__getitem__, remaining)) | wildcards | Returns a set containing the paths that need to be renamed.
This set may include directories when the original sequence of paths
included every file on disk. | Returns a set containing the paths that need to be renamed. | [
"Returns",
"a",
"set",
"containing",
"the",
"paths",
"that",
"need",
"to",
"be",
"renamed",
"."
] | def compress_for_rename(paths):
# type: (Iterable[str]) -> Set[str]
"""Returns a set containing the paths that need to be renamed.
This set may include directories when the original sequence of paths
included every file on disk.
"""
case_map = {os.path.normcase(p): p for p in paths}
... | [
"def",
"compress_for_rename",
"(",
"paths",
")",
":",
"# type: (Iterable[str]) -> Set[str]",
"case_map",
"=",
"{",
"os",
".",
"path",
".",
"normcase",
"(",
"p",
")",
":",
"p",
"for",
"p",
"in",
"paths",
"}",
"remaining",
"=",
"set",
"(",
"case_map",
")",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/req/req_uninstall.py#L249-L321 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/abins/powderdata.py | python | PowderData.extract | (self) | return {key: {str(k): array for k, array in data.items()}
for key, data in self._data.items()} | Get tensor data as dict | Get tensor data as dict | [
"Get",
"tensor",
"data",
"as",
"dict"
] | def extract(self) -> PowderDict:
"""Get tensor data as dict"""
return {key: {str(k): array for k, array in data.items()}
for key, data in self._data.items()} | [
"def",
"extract",
"(",
"self",
")",
"->",
"PowderDict",
":",
"return",
"{",
"key",
":",
"{",
"str",
"(",
"k",
")",
":",
"array",
"for",
"k",
",",
"array",
"in",
"data",
".",
"items",
"(",
")",
"}",
"for",
"key",
",",
"data",
"in",
"self",
".",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/abins/powderdata.py#L65-L68 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/polynomial/chebyshev.py | python | chebdiv | (c1, c2) | Divide one Chebyshev series by another.
Returns the quotient-with-remainder of two Chebyshev series
`c1` / `c2`. The arguments are sequences of coefficients from lowest
order "term" to highest, e.g., [1,2,3] represents the series
``T_0 + 2*T_1 + 3*T_2``.
Parameters
----------
c1, c2 : arr... | Divide one Chebyshev series by another. | [
"Divide",
"one",
"Chebyshev",
"series",
"by",
"another",
"."
] | def chebdiv(c1, c2):
"""
Divide one Chebyshev series by another.
Returns the quotient-with-remainder of two Chebyshev series
`c1` / `c2`. The arguments are sequences of coefficients from lowest
order "term" to highest, e.g., [1,2,3] represents the series
``T_0 + 2*T_1 + 3*T_2``.
Parameter... | [
"def",
"chebdiv",
"(",
"c1",
",",
"c2",
")",
":",
"# c1, c2 are trimmed copies",
"[",
"c1",
",",
"c2",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"c1",
",",
"c2",
"]",
")",
"if",
"c2",
"[",
"-",
"1",
"]",
"==",
"0",
":",
"raise",
"ZeroDivisionEr... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/polynomial/chebyshev.py#L750-L814 | ||
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Validation/Tools/scripts/summarizeEdmComparisonLogfiles.py | python | summaryOK | (summary) | return (retval, {'count':count, 'compared':compared}) | returns a tuple. First value is true if summary hasn't found
any problems, else false. | returns a tuple. First value is true if summary hasn't found
any problems, else false. | [
"returns",
"a",
"tuple",
".",
"First",
"value",
"is",
"true",
"if",
"summary",
"hasn",
"t",
"found",
"any",
"problems",
"else",
"false",
"."
] | def summaryOK (summary):
"""returns a tuple. First value is true if summary hasn't found
any problems, else false."""
retval = True
count = -1
compared = summary.get('eventsCompared', -1)
if len( summary) != 2:
retval = False
for key,value in summary.items():
if countRE.s... | [
"def",
"summaryOK",
"(",
"summary",
")",
":",
"retval",
"=",
"True",
"count",
"=",
"-",
"1",
"compared",
"=",
"summary",
".",
"get",
"(",
"'eventsCompared'",
",",
"-",
"1",
")",
"if",
"len",
"(",
"summary",
")",
"!=",
"2",
":",
"retval",
"=",
"Fals... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Validation/Tools/scripts/summarizeEdmComparisonLogfiles.py#L13-L24 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/mantid/plots/axesfunctions.py | python | _setLabels1D | (axes,
workspace,
indices=None,
normalize_by_bin_width=True,
axis=MantidAxType.SPECTRUM) | helper function to automatically set axes labels for 1D plots | helper function to automatically set axes labels for 1D plots | [
"helper",
"function",
"to",
"automatically",
"set",
"axes",
"labels",
"for",
"1D",
"plots"
] | def _setLabels1D(axes,
workspace,
indices=None,
normalize_by_bin_width=True,
axis=MantidAxType.SPECTRUM):
'''
helper function to automatically set axes labels for 1D plots
'''
labels = get_axes_labels(workspace, indices, normalize_by_bi... | [
"def",
"_setLabels1D",
"(",
"axes",
",",
"workspace",
",",
"indices",
"=",
"None",
",",
"normalize_by_bin_width",
"=",
"True",
",",
"axis",
"=",
"MantidAxType",
".",
"SPECTRUM",
")",
":",
"labels",
"=",
"get_axes_labels",
"(",
"workspace",
",",
"indices",
",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/mantid/plots/axesfunctions.py#L68-L79 | ||
ideawu/icomet | e842345af22b49cc00226ba4378bf1f2e377a597 | deps/libevent-2.0.21-stable/event_rpcgen.py | python | EntryInt.CodeArrayAdd | (self, varname, value) | return [ '%(varname)s = %(value)s;' % { 'varname' : varname,
'value' : value } ] | Returns a new entry of this type. | Returns a new entry of this type. | [
"Returns",
"a",
"new",
"entry",
"of",
"this",
"type",
"."
] | def CodeArrayAdd(self, varname, value):
"""Returns a new entry of this type."""
return [ '%(varname)s = %(value)s;' % { 'varname' : varname,
'value' : value } ] | [
"def",
"CodeArrayAdd",
"(",
"self",
",",
"varname",
",",
"value",
")",
":",
"return",
"[",
"'%(varname)s = %(value)s;'",
"%",
"{",
"'varname'",
":",
"varname",
",",
"'value'",
":",
"value",
"}",
"]"
] | https://github.com/ideawu/icomet/blob/e842345af22b49cc00226ba4378bf1f2e377a597/deps/libevent-2.0.21-stable/event_rpcgen.py#L621-L624 | |
google/clif | cab24d6a105609a65c95a36a1712ae3c20c7b5df | clif/python/slots.py | python | GenSetAttr | (setattr_slots) | Generate slot implementation for __set*__ / __del*__ user functions. | Generate slot implementation for __set*__ / __del*__ user functions. | [
"Generate",
"slot",
"implementation",
"for",
"__set",
"*",
"__",
"/",
"__del",
"*",
"__",
"user",
"functions",
"."
] | def GenSetAttr(setattr_slots):
"""Generate slot implementation for __set*__ / __del*__ user functions."""
assert len(setattr_slots) == 2, 'Need 2-slot input.'
set_attr, del_attr = setattr_slots
assert setattr or delattr, 'Need one or both set/del funcs.'
yield ''
yield 'int slot_seto(PyObject* self, PyObjec... | [
"def",
"GenSetAttr",
"(",
"setattr_slots",
")",
":",
"assert",
"len",
"(",
"setattr_slots",
")",
"==",
"2",
",",
"'Need 2-slot input.'",
"set_attr",
",",
"del_attr",
"=",
"setattr_slots",
"assert",
"setattr",
"or",
"delattr",
",",
"'Need one or both set/del funcs.'"... | https://github.com/google/clif/blob/cab24d6a105609a65c95a36a1712ae3c20c7b5df/clif/python/slots.py#L120-L148 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | PUTXnHandler.WriteServiceUnitTest | (self, func, file) | Overrriden from TypeHandler. | Overrriden from TypeHandler. | [
"Overrriden",
"from",
"TypeHandler",
"."
] | def WriteServiceUnitTest(self, func, file):
"""Overrriden from TypeHandler."""
valid_test = """
TEST_F(%(test_name)s, %(name)sValidArgs) {
EXPECT_CALL(*gl_, %(name)sv(%(local_args)s));
SpecializedSetup<cmds::%(name)s, 0>(true);
cmds::%(name)s cmd;
cmd.Init(%(args)s);
EXPECT_EQ(error::kNoError, Execute... | [
"def",
"WriteServiceUnitTest",
"(",
"self",
",",
"func",
",",
"file",
")",
":",
"valid_test",
"=",
"\"\"\"\nTEST_F(%(test_name)s, %(name)sValidArgs) {\n EXPECT_CALL(*gl_, %(name)sv(%(local_args)s));\n SpecializedSetup<cmds::%(name)s, 0>(true);\n cmds::%(name)s cmd;\n cmd.Init(%(args)s);\... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/gpu/command_buffer/build_gles2_cmd_buffer.py#L5264-L5296 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py | python | Listbox.selection_set | (self, first, last=None) | Set the selection from FIRST to LAST (included) without
changing the currently selected elements. | Set the selection from FIRST to LAST (included) without
changing the currently selected elements. | [
"Set",
"the",
"selection",
"from",
"FIRST",
"to",
"LAST",
"(",
"included",
")",
"without",
"changing",
"the",
"currently",
"selected",
"elements",
"."
] | def selection_set(self, first, last=None):
"""Set the selection from FIRST to LAST (included) without
changing the currently selected elements."""
self.tk.call(self._w, 'selection', 'set', first, last) | [
"def",
"selection_set",
"(",
"self",
",",
"first",
",",
"last",
"=",
"None",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'selection'",
",",
"'set'",
",",
"first",
",",
"last",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py#L2836-L2839 | ||
francinexue/xuefu | b6ff79747a42e020588c0c0a921048e08fe4680c | ctpx/ctp2/ctpmd.py | python | CtpMd.onRspUserLogout | (self, UserLogoutField, RspInfoField, requestId, final) | 登出请求响应 | 登出请求响应 | [
"登出请求响应"
] | def onRspUserLogout(self, UserLogoutField, RspInfoField, requestId, final):
"""登出请求响应"""
if RspInfoField.errorID == 0:
log = u'行情服务器登出成功'
else:
log = u'行情服务登出失败,错误码:[{0}], 错误信息:[{1}]'.format(
RspInfoField.errorID, RspInfoField.errorMsg.decode('gbk'))
... | [
"def",
"onRspUserLogout",
"(",
"self",
",",
"UserLogoutField",
",",
"RspInfoField",
",",
"requestId",
",",
"final",
")",
":",
"if",
"RspInfoField",
".",
"errorID",
"==",
"0",
":",
"log",
"=",
"u'行情服务器登出成功'",
"else",
":",
"log",
"=",
"u'行情服务登出失败,错误码:[{0}], 错误信息... | https://github.com/francinexue/xuefu/blob/b6ff79747a42e020588c0c0a921048e08fe4680c/ctpx/ctp2/ctpmd.py#L59-L66 | ||
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/qcdb/libmintsmolecule.py | python | LibmintsMolecule.create_psi4_string_from_molecule | (self, force_c1=False) | return text | Regenerates a input file molecule specification string from the
current state of the Molecule. Contains geometry info,
fragmentation, charges and multiplicities, and any frame
restriction. | Regenerates a input file molecule specification string from the
current state of the Molecule. Contains geometry info,
fragmentation, charges and multiplicities, and any frame
restriction. | [
"Regenerates",
"a",
"input",
"file",
"molecule",
"specification",
"string",
"from",
"the",
"current",
"state",
"of",
"the",
"Molecule",
".",
"Contains",
"geometry",
"info",
"fragmentation",
"charges",
"and",
"multiplicities",
"and",
"any",
"frame",
"restriction",
... | def create_psi4_string_from_molecule(self, force_c1=False):
"""Regenerates a input file molecule specification string from the
current state of the Molecule. Contains geometry info,
fragmentation, charges and multiplicities, and any frame
restriction.
"""
text = ""
... | [
"def",
"create_psi4_string_from_molecule",
"(",
"self",
",",
"force_c1",
"=",
"False",
")",
":",
"text",
"=",
"\"\"",
"if",
"self",
".",
"nallatom",
"(",
")",
":",
"# append units and any other non-default molecule keywords",
"text",
"+=",
"\" units %-s\\n\"",
"%",... | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/qcdb/libmintsmolecule.py#L945-L990 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/internal/browser/profile_types.py | python | GetProfileTypes | () | return BASE_PROFILE_TYPES + PROFILE_TYPE_MAPPING.keys() | Returns a list of all command line options that can be specified for
profile type. | Returns a list of all command line options that can be specified for
profile type. | [
"Returns",
"a",
"list",
"of",
"all",
"command",
"line",
"options",
"that",
"can",
"be",
"specified",
"for",
"profile",
"type",
"."
] | def GetProfileTypes():
"""Returns a list of all command line options that can be specified for
profile type."""
return BASE_PROFILE_TYPES + PROFILE_TYPE_MAPPING.keys() | [
"def",
"GetProfileTypes",
"(",
")",
":",
"return",
"BASE_PROFILE_TYPES",
"+",
"PROFILE_TYPE_MAPPING",
".",
"keys",
"(",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/internal/browser/profile_types.py#L16-L19 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/Tools/c_config.py | python | check_cfg | (self, *k, **kw) | return ret | Check for configuration flags using a **-config**-like program (pkg-config, sdl-config, etc).
Encapsulate the calls to :py:func:`waflib.Tools.c_config.validate_cfg` and :py:func:`waflib.Tools.c_config.exec_cfg`
A few examples::
def configure(conf):
conf.load('compiler_c')
conf.check_cfg(package='glib-2.0', ... | Check for configuration flags using a **-config**-like program (pkg-config, sdl-config, etc).
Encapsulate the calls to :py:func:`waflib.Tools.c_config.validate_cfg` and :py:func:`waflib.Tools.c_config.exec_cfg` | [
"Check",
"for",
"configuration",
"flags",
"using",
"a",
"**",
"-",
"config",
"**",
"-",
"like",
"program",
"(",
"pkg",
"-",
"config",
"sdl",
"-",
"config",
"etc",
")",
".",
"Encapsulate",
"the",
"calls",
"to",
":",
"py",
":",
"func",
":",
"waflib",
"... | def check_cfg(self, *k, **kw):
"""
Check for configuration flags using a **-config**-like program (pkg-config, sdl-config, etc).
Encapsulate the calls to :py:func:`waflib.Tools.c_config.validate_cfg` and :py:func:`waflib.Tools.c_config.exec_cfg`
A few examples::
def configure(conf):
conf.load('compiler_c')
... | [
"def",
"check_cfg",
"(",
"self",
",",
"*",
"k",
",",
"*",
"*",
"kw",
")",
":",
"if",
"k",
":",
"lst",
"=",
"k",
"[",
"0",
"]",
".",
"split",
"(",
")",
"kw",
"[",
"'package'",
"]",
"=",
"lst",
"[",
"0",
"]",
"kw",
"[",
"'args'",
"]",
"=",
... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Tools/c_config.py#L339-L384 | |
greenheartgames/greenworks | 3ea4ab490b56676de3f0a237c74bcfdb17323e60 | deps/cpplint/cpplint.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/greenheartgames/greenworks/blob/3ea4ab490b56676de3f0a237c74bcfdb17323e60/deps/cpplint/cpplint.py#L4181-L4210 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | Point2D.GetCrossProduct | (*args, **kwargs) | return _core_.Point2D_GetCrossProduct(*args, **kwargs) | GetCrossProduct(self, Point2D vec) -> double | GetCrossProduct(self, Point2D vec) -> double | [
"GetCrossProduct",
"(",
"self",
"Point2D",
"vec",
")",
"-",
">",
"double"
] | def GetCrossProduct(*args, **kwargs):
"""GetCrossProduct(self, Point2D vec) -> double"""
return _core_.Point2D_GetCrossProduct(*args, **kwargs) | [
"def",
"GetCrossProduct",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Point2D_GetCrossProduct",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L1706-L1708 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/auibar.py | python | AuiToolBar.SetToolLabel | (self, tool_id, label) | Sets the tool label for the tool identified by `tool_id`.
:param integer `tool_id`: the tool identifier;
:param string `label`: the new toolbar item label. | Sets the tool label for the tool identified by `tool_id`. | [
"Sets",
"the",
"tool",
"label",
"for",
"the",
"tool",
"identified",
"by",
"tool_id",
"."
] | def SetToolLabel(self, tool_id, label):
"""
Sets the tool label for the tool identified by `tool_id`.
:param integer `tool_id`: the tool identifier;
:param string `label`: the new toolbar item label.
"""
tool = self.FindTool(tool_id)
if tool:
... | [
"def",
"SetToolLabel",
"(",
"self",
",",
"tool_id",
",",
"label",
")",
":",
"tool",
"=",
"self",
".",
"FindTool",
"(",
"tool_id",
")",
"if",
"tool",
":",
"tool",
".",
"label",
"=",
"label"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/auibar.py#L2727-L2737 | ||
godlikepanos/anki-3d-engine | e2f65e5045624492571ea8527a4dbf3fad8d2c0a | AnKi/Script/LuaGlueGen.py | python | get_base_fname | (path) | return os.path.splitext(os.path.basename(path))[0] | From path/to/a/file.ext return the "file" | From path/to/a/file.ext return the "file" | [
"From",
"path",
"/",
"to",
"/",
"a",
"/",
"file",
".",
"ext",
"return",
"the",
"file"
] | def get_base_fname(path):
""" From path/to/a/file.ext return the "file" """
return os.path.splitext(os.path.basename(path))[0] | [
"def",
"get_base_fname",
"(",
"path",
")",
":",
"return",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")",
")",
"[",
"0",
"]"
] | https://github.com/godlikepanos/anki-3d-engine/blob/e2f65e5045624492571ea8527a4dbf3fad8d2c0a/AnKi/Script/LuaGlueGen.py#L41-L43 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/distlib/locators.py | python | Locator._get_project | (self, name) | For a given project, get a dictionary mapping available versions to Distribution
instances.
This should be implemented in subclasses.
If called from a locate() request, self.matcher will be set to a
matcher for the requirement to satisfy, otherwise it will be None. | For a given project, get a dictionary mapping available versions to Distribution
instances. | [
"For",
"a",
"given",
"project",
"get",
"a",
"dictionary",
"mapping",
"available",
"versions",
"to",
"Distribution",
"instances",
"."
] | def _get_project(self, name):
"""
For a given project, get a dictionary mapping available versions to Distribution
instances.
This should be implemented in subclasses.
If called from a locate() request, self.matcher will be set to a
matcher for the requirement to satisf... | [
"def",
"_get_project",
"(",
"self",
",",
"name",
")",
":",
"raise",
"NotImplementedError",
"(",
"'Please implement in the subclass'",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/distlib/locators.py#L153-L163 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBTypeSynthetic.IsClassCode | (self) | return _lldb.SBTypeSynthetic_IsClassCode(self) | IsClassCode(self) -> bool | IsClassCode(self) -> bool | [
"IsClassCode",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsClassCode(self):
"""IsClassCode(self) -> bool"""
return _lldb.SBTypeSynthetic_IsClassCode(self) | [
"def",
"IsClassCode",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBTypeSynthetic_IsClassCode",
"(",
"self",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L11590-L11592 | |
openmm/openmm | cb293447c4fc8b03976dfe11399f107bab70f3d9 | wrappers/python/openmm/app/internal/pdbx/reader/PdbxContainers.py | python | DataCategory.__formatPdbx | (self, inp) | Format input data following PDBx quoting rules - | Format input data following PDBx quoting rules - | [
"Format",
"input",
"data",
"following",
"PDBx",
"quoting",
"rules",
"-"
] | def __formatPdbx(self, inp):
""" Format input data following PDBx quoting rules -
"""
try:
if (inp is None):
return ("?",'DT_NULL_VALUE')
# pure numerical values are returned as unquoted strings
if (isinstance(inp,int) or self.__intRe.search(... | [
"def",
"__formatPdbx",
"(",
"self",
",",
"inp",
")",
":",
"try",
":",
"if",
"(",
"inp",
"is",
"None",
")",
":",
"return",
"(",
"\"?\"",
",",
"'DT_NULL_VALUE'",
")",
"# pure numerical values are returned as unquoted strings",
"if",
"(",
"isinstance",
"(",
"inp"... | https://github.com/openmm/openmm/blob/cb293447c4fc8b03976dfe11399f107bab70f3d9/wrappers/python/openmm/app/internal/pdbx/reader/PdbxContainers.py#L606-L657 | ||
facebook/ThreatExchange | 31914a51820c73c8a0daffe62ccca29a6e3d359e | hasher-matcher-actioner/hmalib/lambdas/api/content.py | python | get_content_api | (
dynamodb_table: Table, image_bucket: str, image_prefix: str
) | return content_api | A Closure that includes all dependencies that MUST be provided by the root
API that this API plugs into. Declare dependencies here, but initialize in
the root API alone. | A Closure that includes all dependencies that MUST be provided by the root
API that this API plugs into. Declare dependencies here, but initialize in
the root API alone. | [
"A",
"Closure",
"that",
"includes",
"all",
"dependencies",
"that",
"MUST",
"be",
"provided",
"by",
"the",
"root",
"API",
"that",
"this",
"API",
"plugs",
"into",
".",
"Declare",
"dependencies",
"here",
"but",
"initialize",
"in",
"the",
"root",
"API",
"alone",... | def get_content_api(
dynamodb_table: Table, image_bucket: str, image_prefix: str
) -> bottle.Bottle:
"""
A Closure that includes all dependencies that MUST be provided by the root
API that this API plugs into. Declare dependencies here, but initialize in
the root API alone.
"""
def get_prev... | [
"def",
"get_content_api",
"(",
"dynamodb_table",
":",
"Table",
",",
"image_bucket",
":",
"str",
",",
"image_prefix",
":",
"str",
")",
"->",
"bottle",
".",
"Bottle",
":",
"def",
"get_preview_url",
"(",
"content_id",
",",
"content_object",
")",
"->",
"str",
":... | https://github.com/facebook/ThreatExchange/blob/31914a51820c73c8a0daffe62ccca29a6e3d359e/hasher-matcher-actioner/hmalib/lambdas/api/content.py#L111-L281 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/setuptools/command/egg_info.py | python | manifest_maker.write_manifest | (self) | Write the file list in 'self.filelist' (presumably as filled in
by 'add_defaults()' and 'read_template()') to the manifest file
named by 'self.manifest'. | Write the file list in 'self.filelist' (presumably as filled in
by 'add_defaults()' and 'read_template()') to the manifest file
named by 'self.manifest'. | [
"Write",
"the",
"file",
"list",
"in",
"self",
".",
"filelist",
"(",
"presumably",
"as",
"filled",
"in",
"by",
"add_defaults",
"()",
"and",
"read_template",
"()",
")",
"to",
"the",
"manifest",
"file",
"named",
"by",
"self",
".",
"manifest",
"."
] | def write_manifest (self):
"""Write the file list in 'self.filelist' (presumably as filled in
by 'add_defaults()' and 'read_template()') to the manifest file
named by 'self.manifest'.
"""
# The manifest must be UTF-8 encodable. See #303.
if sys.version_info >= (3,):
... | [
"def",
"write_manifest",
"(",
"self",
")",
":",
"# The manifest must be UTF-8 encodable. See #303.",
"if",
"sys",
".",
"version_info",
">=",
"(",
"3",
",",
")",
":",
"files",
"=",
"[",
"]",
"for",
"file",
"in",
"self",
".",
"filelist",
".",
"files",
":",
"... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/setuptools/command/egg_info.py#L335-L356 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/framework/device.py | python | merge_device | (spec) | return _device_function | Returns a device function that merges devices specifications.
This can be used to merge partial specifications of devices. The
innermost setting for a device field takes precedence. For example:
with tf.device(merge_device("/device:GPU:0"))
# Nodes created here have device "/device:GPU:0"
with tf.... | Returns a device function that merges devices specifications. | [
"Returns",
"a",
"device",
"function",
"that",
"merges",
"devices",
"specifications",
"."
] | def merge_device(spec):
"""Returns a device function that merges devices specifications.
This can be used to merge partial specifications of devices. The
innermost setting for a device field takes precedence. For example:
with tf.device(merge_device("/device:GPU:0"))
# Nodes created here have device "... | [
"def",
"merge_device",
"(",
"spec",
")",
":",
"if",
"not",
"isinstance",
"(",
"spec",
",",
"DeviceSpec",
")",
":",
"spec",
"=",
"DeviceSpec",
".",
"from_string",
"(",
"spec",
"or",
"\"\"",
")",
"def",
"_device_function",
"(",
"node_def",
")",
":",
"curre... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/framework/device.py#L255-L288 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/curses/textpad.py | python | Textbox._end_of_line | (self, y) | return last | Go to the location of the first blank on the given line,
returning the index of the last non-blank character. | Go to the location of the first blank on the given line,
returning the index of the last non-blank character. | [
"Go",
"to",
"the",
"location",
"of",
"the",
"first",
"blank",
"on",
"the",
"given",
"line",
"returning",
"the",
"index",
"of",
"the",
"last",
"non",
"-",
"blank",
"character",
"."
] | def _end_of_line(self, y):
"""Go to the location of the first blank on the given line,
returning the index of the last non-blank character."""
last = self.maxx
while True:
if curses.ascii.ascii(self.win.inch(y, last)) != curses.ascii.SP:
last = min(self.maxx, ... | [
"def",
"_end_of_line",
"(",
"self",
",",
"y",
")",
":",
"last",
"=",
"self",
".",
"maxx",
"while",
"True",
":",
"if",
"curses",
".",
"ascii",
".",
"ascii",
"(",
"self",
".",
"win",
".",
"inch",
"(",
"y",
",",
"last",
")",
")",
"!=",
"curses",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/curses/textpad.py#L53-L64 | |
PyMesh/PyMesh | 384ba882b7558ba6e8653ed263c419226c22bddf | python/pymesh/predicates.py | python | in_sphere | (p1, p2, p3, p4, p5) | return PyMesh.insphere(p1, p2, p3, p4, p5) | Determine if p5 is in the sphere formed by p1, p2, p3, p4.
Args:
p1,p2,p3,p4,p5: 3D points. ``orient_3D(p1, p2, p3, p4)`` must be
positive, otherwise the result will be flipped.
Returns:
positive p5 is inside of the sphere.
negative p5 is outside of the sphere.
0.0... | Determine if p5 is in the sphere formed by p1, p2, p3, p4. | [
"Determine",
"if",
"p5",
"is",
"in",
"the",
"sphere",
"formed",
"by",
"p1",
"p2",
"p3",
"p4",
"."
] | def in_sphere(p1, p2, p3, p4, p5):
""" Determine if p5 is in the sphere formed by p1, p2, p3, p4.
Args:
p1,p2,p3,p4,p5: 3D points. ``orient_3D(p1, p2, p3, p4)`` must be
positive, otherwise the result will be flipped.
Returns:
positive p5 is inside of the sphere.
negati... | [
"def",
"in_sphere",
"(",
"p1",
",",
"p2",
",",
"p3",
",",
"p4",
",",
"p5",
")",
":",
"return",
"PyMesh",
".",
"insphere",
"(",
"p1",
",",
"p2",
",",
"p3",
",",
"p4",
",",
"p5",
")"
] | https://github.com/PyMesh/PyMesh/blob/384ba882b7558ba6e8653ed263c419226c22bddf/python/pymesh/predicates.py#L50-L62 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rosmaster/src/rosmaster/broadcast_handler.py | python | byteify | (input) | Convert unicode to str. | Convert unicode to str. | [
"Convert",
"unicode",
"to",
"str",
"."
] | def byteify(input):
"""
Convert unicode to str.
"""
if isinstance(input, dict):
return {byteify(key): byteify(value) for key, value in input.iteritems()}
elif isinstance(input, list):
return [byteify(element) for element in input]
elif isinstance(input, unicode):
return i... | [
"def",
"byteify",
"(",
"input",
")",
":",
"if",
"isinstance",
"(",
"input",
",",
"dict",
")",
":",
"return",
"{",
"byteify",
"(",
"key",
")",
":",
"byteify",
"(",
"value",
")",
"for",
"key",
",",
"value",
"in",
"input",
".",
"iteritems",
"(",
")",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rosmaster/src/rosmaster/broadcast_handler.py#L81-L92 | ||
BlueBrain/Brayns | 0133aae76cc2b7f800fc0bfb064400b64fd9b792 | python/brayns/api/function_builder.py | python | build_function | (
client: AbstractClient,
entrypoint: Entrypoint
) | return context['_function'] | Create a function calling the given entrypoint on the given client.
If the entrypoint params are not a oneOf and have properties, the function
will have these properties as keyword arguments.
The function return type is defined by the content of the field 'result' of
the reply that is returned without... | Create a function calling the given entrypoint on the given client. | [
"Create",
"a",
"function",
"calling",
"the",
"given",
"entrypoint",
"on",
"the",
"given",
"client",
"."
] | def build_function(
client: AbstractClient,
entrypoint: Entrypoint
) -> Callable:
"""Create a function calling the given entrypoint on the given client.
If the entrypoint params are not a oneOf and have properties, the function
will have these properties as keyword arguments.
The function retu... | [
"def",
"build_function",
"(",
"client",
":",
"AbstractClient",
",",
"entrypoint",
":",
"Entrypoint",
")",
"->",
"Callable",
":",
"code",
"=",
"_get_function_code",
"(",
"entrypoint",
")",
"context",
"=",
"{",
"'_get_result'",
":",
"lambda",
"params",
":",
"_ge... | https://github.com/BlueBrain/Brayns/blob/0133aae76cc2b7f800fc0bfb064400b64fd9b792/python/brayns/api/function_builder.py#L30-L63 | |
echronos/echronos | c996f1d2c8af6c6536205eb319c1bf1d4d84569c | external_tools/ply_info/example/ansic/cparse.py | python | p_shift_expression_3 | (t) | shift_expression : shift_expression RSHIFT additive_expression | shift_expression : shift_expression RSHIFT additive_expression | [
"shift_expression",
":",
"shift_expression",
"RSHIFT",
"additive_expression"
] | def p_shift_expression_3(t):
'shift_expression : shift_expression RSHIFT additive_expression'
pass | [
"def",
"p_shift_expression_3",
"(",
"t",
")",
":",
"pass"
] | https://github.com/echronos/echronos/blob/c996f1d2c8af6c6536205eb319c1bf1d4d84569c/external_tools/ply_info/example/ansic/cparse.py#L711-L713 | ||
chromiumembedded/cef | 80caf947f3fe2210e5344713c5281d8af9bdc295 | tools/yapf/yapf/yapflib/pytree_visitor.py | python | PyTreeVisitor.Visit | (self, node) | Visit a node. | Visit a node. | [
"Visit",
"a",
"node",
"."
] | def Visit(self, node):
"""Visit a node."""
method = 'Visit_{0}'.format(pytree_utils.NodeName(node))
if hasattr(self, method):
# Found a specific visitor for this node
getattr(self, method)(node)
else:
if isinstance(node, pytree.Leaf):
self.DefaultLeafVisit(node)
else:
... | [
"def",
"Visit",
"(",
"self",
",",
"node",
")",
":",
"method",
"=",
"'Visit_{0}'",
".",
"format",
"(",
"pytree_utils",
".",
"NodeName",
"(",
"node",
")",
")",
"if",
"hasattr",
"(",
"self",
",",
"method",
")",
":",
"# Found a specific visitor for this node",
... | https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/yapf/yapf/yapflib/pytree_visitor.py#L57-L67 | ||
cyberbotics/webots | af7fa7d68dcf7b4550f1f2e132092b41e83698fc | projects/humans/c3d/controllers/c3d_viewer/c3d.py | python | Writer._write_frames | (self, handle) | Write our frame data to the given file handle.
Parameters
----------
handle : file
Write metadata and C3D motion frames to the given file handle. The
writer does not close the handle. | Write our frame data to the given file handle. | [
"Write",
"our",
"frame",
"data",
"to",
"the",
"given",
"file",
"handle",
"."
] | def _write_frames(self, handle):
'''Write our frame data to the given file handle.
Parameters
----------
handle : file
Write metadata and C3D motion frames to the given file handle. The
writer does not close the handle.
'''
assert handle.tell() ==... | [
"def",
"_write_frames",
"(",
"self",
",",
"handle",
")",
":",
"assert",
"handle",
".",
"tell",
"(",
")",
"==",
"512",
"*",
"(",
"self",
".",
"header",
".",
"data_block",
"-",
"1",
")",
"scale",
"=",
"abs",
"(",
"self",
".",
"point_scale",
")",
"is_... | https://github.com/cyberbotics/webots/blob/af7fa7d68dcf7b4550f1f2e132092b41e83698fc/projects/humans/c3d/controllers/c3d_viewer/c3d.py#L986-L1016 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/parallel_for/pfor.py | python | _unflatten_first_dim | (x, first_dim) | return array_ops.reshape(x, new_shape) | Splits first dimension into [first_dim, -1]. | Splits first dimension into [first_dim, -1]. | [
"Splits",
"first",
"dimension",
"into",
"[",
"first_dim",
"-",
"1",
"]",
"."
] | def _unflatten_first_dim(x, first_dim):
"""Splits first dimension into [first_dim, -1]."""
old_shape = array_ops.shape(x)
new_shape = array_ops.concat([first_dim, [-1], old_shape[1:]], axis=0)
return array_ops.reshape(x, new_shape) | [
"def",
"_unflatten_first_dim",
"(",
"x",
",",
"first_dim",
")",
":",
"old_shape",
"=",
"array_ops",
".",
"shape",
"(",
"x",
")",
"new_shape",
"=",
"array_ops",
".",
"concat",
"(",
"[",
"first_dim",
",",
"[",
"-",
"1",
"]",
",",
"old_shape",
"[",
"1",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/parallel_for/pfor.py#L1744-L1748 | |
kiwix/kiwix-xulrunner | 38f4a10ae4b1585c16cb11730bb0dcc4924ae19f | android/gen-custom-android-build.py | python | step_list_output_apk | (jsdata, **options) | ls on the expected APK to check presence and size | ls on the expected APK to check presence and size | [
"ls",
"on",
"the",
"expected",
"APK",
"to",
"check",
"presence",
"and",
"size"
] | def step_list_output_apk(jsdata, **options):
""" ls on the expected APK to check presence and size """
move_to_current_folder()
syscall('ls -lh build/outputs/apk/{}-*'
.format(jsdata.get('package')), shell=True) | [
"def",
"step_list_output_apk",
"(",
"jsdata",
",",
"*",
"*",
"options",
")",
":",
"move_to_current_folder",
"(",
")",
"syscall",
"(",
"'ls -lh build/outputs/apk/{}-*'",
".",
"format",
"(",
"jsdata",
".",
"get",
"(",
"'package'",
")",
")",
",",
"shell",
"=",
... | https://github.com/kiwix/kiwix-xulrunner/blob/38f4a10ae4b1585c16cb11730bb0dcc4924ae19f/android/gen-custom-android-build.py#L557-L563 | ||
espressomd/espresso | 7e29f9052e710fe1ebf0f5d2a8076b32921fbc6a | src/python/espressomd/io/mpiio.py | python | Mpiio.read | (self, prefix=None, positions=False, velocities=False,
types=False, bonds=False) | MPI-IO read.
This function reads data dumped by :meth`write`. See the :meth`write`
documentation for details.
.. note::
The files must be read on the same number of processes that wrote
the data. The data must be read on a machine with the same
architecture ... | MPI-IO read. | [
"MPI",
"-",
"IO",
"read",
"."
] | def read(self, prefix=None, positions=False, velocities=False,
types=False, bonds=False):
"""MPI-IO read.
This function reads data dumped by :meth`write`. See the :meth`write`
documentation for details.
.. note::
The files must be read on the same number of pro... | [
"def",
"read",
"(",
"self",
",",
"prefix",
"=",
"None",
",",
"positions",
"=",
"False",
",",
"velocities",
"=",
"False",
",",
"types",
"=",
"False",
",",
"bonds",
"=",
"False",
")",
":",
"if",
"prefix",
"is",
"None",
":",
"raise",
"ValueError",
"(",
... | https://github.com/espressomd/espresso/blob/7e29f9052e710fe1ebf0f5d2a8076b32921fbc6a/src/python/espressomd/io/mpiio.py#L81-L100 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/learn/python/learn/dataframe/series.py | python | Series.register_binary_op | (cls, series_method_name) | return register | A decorator that registers `Transform`s as `Series` member functions.
For example:
'''
@series.Series.register_binary_op("__add___")
class Sum(Transform):
...
'''
The registered member function takes `args` and `kwargs`. These values will
be passed to the `__init__` function for the ... | A decorator that registers `Transform`s as `Series` member functions. | [
"A",
"decorator",
"that",
"registers",
"Transform",
"s",
"as",
"Series",
"member",
"functions",
"."
] | def register_binary_op(cls, series_method_name):
"""A decorator that registers `Transform`s as `Series` member functions.
For example:
'''
@series.Series.register_binary_op("__add___")
class Sum(Transform):
...
'''
The registered member function takes `args` and `kwargs`. These value... | [
"def",
"register_binary_op",
"(",
"cls",
",",
"series_method_name",
")",
":",
"def",
"register",
"(",
"transform_cls",
")",
":",
"if",
"hasattr",
"(",
"cls",
",",
"series_method_name",
")",
":",
"raise",
"ValueError",
"(",
"\"Series already has a function registered... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/learn/python/learn/dataframe/series.py#L71-L101 | |
livecode/livecode | 4606a10ea10b16d5071d0f9f263ccdd7ede8b31d | gyp/pylib/gyp/xcodeproj_file.py | python | XCObject._XCKVPrint | (self, file, tabs, key, value) | Prints a key and value, members of an XCObject's _properties dictionary,
to file.
tabs is an int identifying the indentation level. If the class'
_should_print_single_line variable is True, tabs is ignored and the
key-value pair will be followed by a space insead of a newline. | Prints a key and value, members of an XCObject's _properties dictionary,
to file. | [
"Prints",
"a",
"key",
"and",
"value",
"members",
"of",
"an",
"XCObject",
"s",
"_properties",
"dictionary",
"to",
"file",
"."
] | def _XCKVPrint(self, file, tabs, key, value):
"""Prints a key and value, members of an XCObject's _properties dictionary,
to file.
tabs is an int identifying the indentation level. If the class'
_should_print_single_line variable is True, tabs is ignored and the
key-value pair will be followed by ... | [
"def",
"_XCKVPrint",
"(",
"self",
",",
"file",
",",
"tabs",
",",
"key",
",",
"value",
")",
":",
"if",
"self",
".",
"_should_print_single_line",
":",
"printable",
"=",
"''",
"after_kv",
"=",
"' '",
"else",
":",
"printable",
"=",
"'\\t'",
"*",
"tabs",
"a... | https://github.com/livecode/livecode/blob/4606a10ea10b16d5071d0f9f263ccdd7ede8b31d/gyp/pylib/gyp/xcodeproj_file.py#L639-L699 | ||
apache/singa | 93fd9da72694e68bfe3fb29d0183a65263d238a1 | python/singa/layer.py | python | MaxPool2d.__init__ | (self, kernel_size, stride=None, padding=0, pad_mode="NOTSET") | Args:
kernel_size (int or tuple): kernel size for two direction of each
axis. For example, (2, 3), the first 2 means will add 2 at the
beginning and also 2 at the end for its axis.and if a int is
accepted, the kernel size will be initiated as (int, int)
... | Args:
kernel_size (int or tuple): kernel size for two direction of each
axis. For example, (2, 3), the first 2 means will add 2 at the
beginning and also 2 at the end for its axis.and if a int is
accepted, the kernel size will be initiated as (int, int)
... | [
"Args",
":",
"kernel_size",
"(",
"int",
"or",
"tuple",
")",
":",
"kernel",
"size",
"for",
"two",
"direction",
"of",
"each",
"axis",
".",
"For",
"example",
"(",
"2",
"3",
")",
"the",
"first",
"2",
"means",
"will",
"add",
"2",
"at",
"the",
"beginning",... | def __init__(self, kernel_size, stride=None, padding=0, pad_mode="NOTSET"):
"""
Args:
kernel_size (int or tuple): kernel size for two direction of each
axis. For example, (2, 3), the first 2 means will add 2 at the
beginning and also 2 at the end for its axis.... | [
"def",
"__init__",
"(",
"self",
",",
"kernel_size",
",",
"stride",
"=",
"None",
",",
"padding",
"=",
"0",
",",
"pad_mode",
"=",
"\"NOTSET\"",
")",
":",
"super",
"(",
"MaxPool2d",
",",
"self",
")",
".",
"__init__",
"(",
"kernel_size",
",",
"stride",
","... | https://github.com/apache/singa/blob/93fd9da72694e68bfe3fb29d0183a65263d238a1/python/singa/layer.py#L1011-L1030 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/VBox/Frontends/VBoxShell/vboxshell.py | python | nicCableSubCmd | (ctx, vm, nicnum, adapter, args) | return nicSwitchOnOff(adapter, 'cableConnected', args) | usage: nic <vm> <nicnum> cable [on|off] | usage: nic <vm> <nicnum> cable [on|off] | [
"usage",
":",
"nic",
"<vm",
">",
"<nicnum",
">",
"cable",
"[",
"on|off",
"]"
] | def nicCableSubCmd(ctx, vm, nicnum, adapter, args):
'''
usage: nic <vm> <nicnum> cable [on|off]
'''
return nicSwitchOnOff(adapter, 'cableConnected', args) | [
"def",
"nicCableSubCmd",
"(",
"ctx",
",",
"vm",
",",
"nicnum",
",",
"adapter",
",",
"args",
")",
":",
"return",
"nicSwitchOnOff",
"(",
"adapter",
",",
"'cableConnected'",
",",
"args",
")"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/VBox/Frontends/VBoxShell/vboxshell.py#L2959-L2963 | |
microsoft/DirectX-Graphics-Samples | 316de71537a460f9b90a51b145d9fb9d67f5e7b8 | MiniEngine/Tools/Scripts/CreateNewProject.py | python | copy_template_file | (filename, project, guid) | Copies one template file and replaces templated values | Copies one template file and replaces templated values | [
"Copies",
"one",
"template",
"file",
"and",
"replaces",
"templated",
"values"
] | def copy_template_file(filename, project, guid):
'''Copies one template file and replaces templated values'''
template_filename = os.path.join(TEMPLATES_FOLDER, filename)
output_filename = os.path.join(project, filename)
output_filename = output_filename.replace('AppTemplate', project)
output_filena... | [
"def",
"copy_template_file",
"(",
"filename",
",",
"project",
",",
"guid",
")",
":",
"template_filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"TEMPLATES_FOLDER",
",",
"filename",
")",
"output_filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"proj... | https://github.com/microsoft/DirectX-Graphics-Samples/blob/316de71537a460f9b90a51b145d9fb9d67f5e7b8/MiniEngine/Tools/Scripts/CreateNewProject.py#L22-L33 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/TOFTOFCropWorkspace.py | python | TOFTOFCropWorkspace.PyInit | (self) | return | Declare properties | Declare properties | [
"Declare",
"properties"
] | def PyInit(self):
""" Declare properties
"""
# better would be to use the validator, but it fails if WorkspaceGroup is given as an input
# self.declareProperty(WorkspaceProperty("InputWorkspace", "", direction=Direction.Input,
# validator=Wor... | [
"def",
"PyInit",
"(",
"self",
")",
":",
"# better would be to use the validator, but it fails if WorkspaceGroup is given as an input",
"# self.declareProperty(WorkspaceProperty(\"InputWorkspace\", \"\", direction=Direction.Input,",
"# validator=WorkspaceUnitVali... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/TOFTOFCropWorkspace.py#L35-L46 | |
QMCPACK/qmcpack | d0948ab455e38364458740cc8e2239600a14c5cd | nexus/lib/grid_functions.py | python | StructuredGrid.unit_metric | (self,upoints=None) | return self.unit_metric_bare(upoints) | (`External API`) Compute the integration metric in the unit coordinate
space for a set of points defined there.
Parameters
----------
upoints : `array_like, float, shape (N,d), optional`
Array of points in the unit coordinate space. `N` is the number
of point... | (`External API`) Compute the integration metric in the unit coordinate
space for a set of points defined there. | [
"(",
"External",
"API",
")",
"Compute",
"the",
"integration",
"metric",
"in",
"the",
"unit",
"coordinate",
"space",
"for",
"a",
"set",
"of",
"points",
"defined",
"there",
"."
] | def unit_metric(self,upoints=None):
"""
(`External API`) Compute the integration metric in the unit coordinate
space for a set of points defined there.
Parameters
----------
upoints : `array_like, float, shape (N,d), optional`
Array of points in the unit co... | [
"def",
"unit_metric",
"(",
"self",
",",
"upoints",
"=",
"None",
")",
":",
"return",
"self",
".",
"unit_metric_bare",
"(",
"upoints",
")"
] | https://github.com/QMCPACK/qmcpack/blob/d0948ab455e38364458740cc8e2239600a14c5cd/nexus/lib/grid_functions.py#L1551-L1570 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py | python | Spinbox.selection_element | (self, element=None) | return self.selection("element", element) | Sets or gets the currently selected element.
If a spinbutton element is specified, it will be
displayed depressed | Sets or gets the currently selected element. | [
"Sets",
"or",
"gets",
"the",
"currently",
"selected",
"element",
"."
] | def selection_element(self, element=None):
"""Sets or gets the currently selected element.
If a spinbutton element is specified, it will be
displayed depressed
"""
return self.selection("element", element) | [
"def",
"selection_element",
"(",
"self",
",",
"element",
"=",
"None",
")",
":",
"return",
"self",
".",
"selection",
"(",
"\"element\"",
",",
"element",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py#L3519-L3525 | |
stan-dev/math | 5fd79f89933269a4ca4d8dd1fde2a36d53d4768c | lib/boost_1.75.0/tools/build/src/build/feature.py | python | implied_feature | (implicit_value) | return __implicit_features[components[0]] | Returns the implicit feature associated with the given implicit value. | Returns the implicit feature associated with the given implicit value. | [
"Returns",
"the",
"implicit",
"feature",
"associated",
"with",
"the",
"given",
"implicit",
"value",
"."
] | def implied_feature (implicit_value):
""" Returns the implicit feature associated with the given implicit value.
"""
assert isinstance(implicit_value, basestring)
components = implicit_value.split('-')
if components[0] not in __implicit_features:
raise InvalidValue ("'%s' is not a value of ... | [
"def",
"implied_feature",
"(",
"implicit_value",
")",
":",
"assert",
"isinstance",
"(",
"implicit_value",
",",
"basestring",
")",
"components",
"=",
"implicit_value",
".",
"split",
"(",
"'-'",
")",
"if",
"components",
"[",
"0",
"]",
"not",
"in",
"__implicit_fe... | https://github.com/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/lib/boost_1.75.0/tools/build/src/build/feature.py#L243-L252 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.