nwo stringlengths 5 86 | sha stringlengths 40 40 | path stringlengths 4 189 | language stringclasses 1
value | identifier stringlengths 1 94 | parameters stringlengths 2 4.03k | argument_list stringclasses 1
value | return_statement stringlengths 0 11.5k | docstring stringlengths 1 33.2k | docstring_summary stringlengths 0 5.15k | docstring_tokens list | function stringlengths 34 151k | function_tokens list | url stringlengths 90 278 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/stc.py | python | StyledTextCtrl.GetCurLine | (*args, **kwargs) | return _stc.StyledTextCtrl_GetCurLine(*args, **kwargs) | GetCurLine(self) -> (text, pos)
Retrieve the text of the line containing the caret, and also theindex
of the caret on the line. | GetCurLine(self) -> (text, pos) | [
"GetCurLine",
"(",
"self",
")",
"-",
">",
"(",
"text",
"pos",
")"
] | def GetCurLine(*args, **kwargs):
"""
GetCurLine(self) -> (text, pos)
Retrieve the text of the line containing the caret, and also theindex
of the caret on the line.
"""
return _stc.StyledTextCtrl_GetCurLine(*args, **kwargs) | [
"def",
"GetCurLine",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_GetCurLine",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/stc.py#L2228-L2235 | |
dmlc/nnvm | dab5ce8ab6adbf4edd8bd2fa89f1a99f343b6e38 | python/nnvm/frontend/common.py | python | AttrConverter._parse_bool | (self, value) | return bool(value) | Helper function to parse default boolean values. | Helper function to parse default boolean values. | [
"Helper",
"function",
"to",
"parse",
"default",
"boolean",
"values",
"."
] | def _parse_bool(self, value):
"""Helper function to parse default boolean values."""
if isinstance(value, string_types):
return value.strip().lower() in ['true', '1', 't', 'y', 'yes']
return bool(value) | [
"def",
"_parse_bool",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"string_types",
")",
":",
"return",
"value",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"in",
"[",
"'true'",
",",
"'1'",
",",
"'t'",
",",
"'y'",
... | https://github.com/dmlc/nnvm/blob/dab5ce8ab6adbf4edd8bd2fa89f1a99f343b6e38/python/nnvm/frontend/common.py#L126-L130 | |
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | python/mxnet/kvstore.py | python | KVStore.set_gradient_compression | (self, compression_params) | Specifies type of low-bit quantization for gradient compression \
and additional arguments depending on the type of compression being used.
2bit Gradient Compression takes a positive float `threshold`.
The technique works by thresholding values such that positive values in the
gradient... | Specifies type of low-bit quantization for gradient compression \
and additional arguments depending on the type of compression being used. | [
"Specifies",
"type",
"of",
"low",
"-",
"bit",
"quantization",
"for",
"gradient",
"compression",
"\\",
"and",
"additional",
"arguments",
"depending",
"on",
"the",
"type",
"of",
"compression",
"being",
"used",
"."
] | def set_gradient_compression(self, compression_params):
""" Specifies type of low-bit quantization for gradient compression \
and additional arguments depending on the type of compression being used.
2bit Gradient Compression takes a positive float `threshold`.
The technique works by t... | [
"def",
"set_gradient_compression",
"(",
"self",
",",
"compression_params",
")",
":",
"if",
"(",
"'device'",
"in",
"self",
".",
"type",
")",
"or",
"(",
"'dist'",
"in",
"self",
".",
"type",
")",
":",
"ckeys",
",",
"cvals",
"=",
"_ctype_dict",
"(",
"compres... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/kvstore.py#L363-L417 | ||
kristjankorjus/Replicating-DeepMind | 68539394e792b34a4d6b430a2eb73b8b8f91d8db | src/ale/preprocessor.py | python | Preprocessor.__init__ | (self) | Initialise preprocessor | Initialise preprocessor | [
"Initialise",
"preprocessor"
] | def __init__(self):
"""
Initialise preprocessor
"""
self.grayscale_array = self.get_grayscale_array() | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"grayscale_array",
"=",
"self",
".",
"get_grayscale_array",
"(",
")"
] | https://github.com/kristjankorjus/Replicating-DeepMind/blob/68539394e792b34a4d6b430a2eb73b8b8f91d8db/src/ale/preprocessor.py#L15-L19 | ||
gwaldron/osgearth | 4c521857d59a69743e4a9cedba00afe570f984e8 | src/third_party/tinygltf/deps/cpplint.py | python | _ShouldPrintError | (category, confidence, linenum) | return True | If confidence >= verbose, category passes filter and is not suppressed. | If confidence >= verbose, category passes filter and is not suppressed. | [
"If",
"confidence",
">",
"=",
"verbose",
"category",
"passes",
"filter",
"and",
"is",
"not",
"suppressed",
"."
] | def _ShouldPrintError(category, confidence, linenum):
"""If confidence >= verbose, category passes filter and is not suppressed."""
# There are three ways we might decide not to print an error message:
# a "NOLINT(category)" comment appears in the source,
# the verbosity level isn't high enough, or the filters... | [
"def",
"_ShouldPrintError",
"(",
"category",
",",
"confidence",
",",
"linenum",
")",
":",
"# There are three ways we might decide not to print an error message:",
"# a \"NOLINT(category)\" comment appears in the source,",
"# the verbosity level isn't high enough, or the filters filter it out... | https://github.com/gwaldron/osgearth/blob/4c521857d59a69743e4a9cedba00afe570f984e8/src/third_party/tinygltf/deps/cpplint.py#L1064-L1089 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TForestFire_GenGraph | (*args) | return _snap.TForestFire_GenGraph(*args) | TForestFire_GenGraph(int const & Nodes, double const & FwdProb, double const & BckProb) -> PNGraph
Parameters:
Nodes: int const &
FwdProb: double const &
BckProb: double const & | TForestFire_GenGraph(int const & Nodes, double const & FwdProb, double const & BckProb) -> PNGraph | [
"TForestFire_GenGraph",
"(",
"int",
"const",
"&",
"Nodes",
"double",
"const",
"&",
"FwdProb",
"double",
"const",
"&",
"BckProb",
")",
"-",
">",
"PNGraph"
] | def TForestFire_GenGraph(*args):
"""
TForestFire_GenGraph(int const & Nodes, double const & FwdProb, double const & BckProb) -> PNGraph
Parameters:
Nodes: int const &
FwdProb: double const &
BckProb: double const &
"""
return _snap.TForestFire_GenGraph(*args) | [
"def",
"TForestFire_GenGraph",
"(",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TForestFire_GenGraph",
"(",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L1384-L1394 | |
gklz1982/caffe-yolov2 | ebb27029db4ddc0d40e520634633b0fa9cdcc10d | scripts/cpp_lint.py | python | _SetCountingStyle | (level) | Sets the module's counting options. | Sets the module's counting options. | [
"Sets",
"the",
"module",
"s",
"counting",
"options",
"."
] | def _SetCountingStyle(level):
"""Sets the module's counting options."""
_cpplint_state.SetCountingStyle(level) | [
"def",
"_SetCountingStyle",
"(",
"level",
")",
":",
"_cpplint_state",
".",
"SetCountingStyle",
"(",
"level",
")"
] | https://github.com/gklz1982/caffe-yolov2/blob/ebb27029db4ddc0d40e520634633b0fa9cdcc10d/scripts/cpp_lint.py#L787-L789 | ||
kmatheussen/radium | 90f113f2df1d63b987a0106be3bb09ab2ab8c233 | bin/import_midi.py | python | Events.split_by_channel | (self) | return [self] + other_channels | Returns a list of channel-specific Event instances, replacing 'self'.
If the instance already only contained events for one channel, it will return a list only containing itself.
Only the first of the returned Event instances will contain 'other_events'. | Returns a list of channel-specific Event instances, replacing 'self'.
If the instance already only contained events for one channel, it will return a list only containing itself. | [
"Returns",
"a",
"list",
"of",
"channel",
"-",
"specific",
"Event",
"instances",
"replacing",
"self",
".",
"If",
"the",
"instance",
"already",
"only",
"contained",
"events",
"for",
"one",
"channel",
"it",
"will",
"return",
"a",
"list",
"only",
"containing",
"... | def split_by_channel(self):
"""
Returns a list of channel-specific Event instances, replacing 'self'.
If the instance already only contained events for one channel, it will return a list only containing itself.
Only the first of the returned Event instances will contain 'other_events'.
... | [
"def",
"split_by_channel",
"(",
"self",
")",
":",
"other_channels",
"=",
"[",
"]",
"new",
"=",
"self",
".",
"split_channels_helper",
"(",
")",
"while",
"new",
":",
"other_channels",
".",
"append",
"(",
"new",
")",
"new",
"=",
"self",
".",
"split_channels_h... | https://github.com/kmatheussen/radium/blob/90f113f2df1d63b987a0106be3bb09ab2ab8c233/bin/import_midi.py#L397-L413 | |
tensorflow/io | 92b44e180674a8af0e12e405530f7343e3e693e4 | tensorflow_io/python/experimental/io_dataset_ops.py | python | IODataset.from_libsvm | (
cls,
filename,
num_features,
dtype=None,
label_dtype=None,
compression_type="",
**kwargs
) | Creates an `IODataset` from a libsvm file.
Args:
filename: A `tf.string` tensor containing one or more filenames.
num_features: The number of features.
dtype(Optional): The type of the output feature tensor.
Default to tf.float32.
label_dtype(Optional): The t... | Creates an `IODataset` from a libsvm file. | [
"Creates",
"an",
"IODataset",
"from",
"a",
"libsvm",
"file",
"."
] | def from_libsvm(
cls,
filename,
num_features,
dtype=None,
label_dtype=None,
compression_type="",
**kwargs
):
"""Creates an `IODataset` from a libsvm file.
Args:
filename: A `tf.string` tensor containing one or more filenames.
... | [
"def",
"from_libsvm",
"(",
"cls",
",",
"filename",
",",
"num_features",
",",
"dtype",
"=",
"None",
",",
"label_dtype",
"=",
"None",
",",
"compression_type",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"kwargs",
... | https://github.com/tensorflow/io/blob/92b44e180674a8af0e12e405530f7343e3e693e4/tensorflow_io/python/experimental/io_dataset_ops.py#L52-L86 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/caching.py | python | IndexDataCacheFile._load_index | (self) | Load the cache index and return it as a dictionary (possibly
empty if cache is empty or obsolete). | Load the cache index and return it as a dictionary (possibly
empty if cache is empty or obsolete). | [
"Load",
"the",
"cache",
"index",
"and",
"return",
"it",
"as",
"a",
"dictionary",
"(",
"possibly",
"empty",
"if",
"cache",
"is",
"empty",
"or",
"obsolete",
")",
"."
] | def _load_index(self):
"""
Load the cache index and return it as a dictionary (possibly
empty if cache is empty or obsolete).
"""
try:
with open(self._index_path, "rb") as f:
version = pickle.load(f)
data = f.read()
except Envir... | [
"def",
"_load_index",
"(",
"self",
")",
":",
"try",
":",
"with",
"open",
"(",
"self",
".",
"_index_path",
",",
"\"rb\"",
")",
"as",
"f",
":",
"version",
"=",
"pickle",
".",
"load",
"(",
"f",
")",
"data",
"=",
"f",
".",
"read",
"(",
")",
"except",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/caching.py#L508-L533 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/mailbox.py | python | _singlefileMailbox.remove | (self, key) | Remove the keyed message; raise KeyError if it doesn't exist. | Remove the keyed message; raise KeyError if it doesn't exist. | [
"Remove",
"the",
"keyed",
"message",
";",
"raise",
"KeyError",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | def remove(self, key):
"""Remove the keyed message; raise KeyError if it doesn't exist."""
self._lookup(key)
del self._toc[key]
self._pending = True | [
"def",
"remove",
"(",
"self",
",",
"key",
")",
":",
"self",
".",
"_lookup",
"(",
"key",
")",
"del",
"self",
".",
"_toc",
"[",
"key",
"]",
"self",
".",
"_pending",
"=",
"True"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/mailbox.py#L594-L598 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/GenerateGroupingSNSInelastic.py | python | GenerateGroupingSNSInelastic.category | (self) | return "Inelastic\\Utility;Transforms\\Grouping" | Mantid required | Mantid required | [
"Mantid",
"required"
] | def category(self):
""" Mantid required
"""
return "Inelastic\\Utility;Transforms\\Grouping" | [
"def",
"category",
"(",
"self",
")",
":",
"return",
"\"Inelastic\\\\Utility;Transforms\\\\Grouping\""
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/GenerateGroupingSNSInelastic.py#L19-L22 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/feature_column/feature_column_v2.py | python | _standardize_and_copy_config | (config) | return kwargs | Returns a shallow copy of config with lists turned to tuples.
Keras serialization uses nest to listify everything.
This causes problems with the NumericColumn shape, which becomes
unhashable. We could try to solve this on the Keras side, but that
would require lots of tracking to avoid changing existing behavi... | Returns a shallow copy of config with lists turned to tuples. | [
"Returns",
"a",
"shallow",
"copy",
"of",
"config",
"with",
"lists",
"turned",
"to",
"tuples",
"."
] | def _standardize_and_copy_config(config):
"""Returns a shallow copy of config with lists turned to tuples.
Keras serialization uses nest to listify everything.
This causes problems with the NumericColumn shape, which becomes
unhashable. We could try to solve this on the Keras side, but that
would require lot... | [
"def",
"_standardize_and_copy_config",
"(",
"config",
")",
":",
"kwargs",
"=",
"config",
".",
"copy",
"(",
")",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"list",
")",
":",
"kwargs",
"[",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/feature_column/feature_column_v2.py#L4604-L4624 | |
baidu/tera | dbcd28af792d879d961bf9fc7eb60de81b437646 | src/sdk/python/TeraSdk.py | python | ScanDescriptor.SetEnd | (self, end_key) | 不调用此函数时,end_key被置为“无穷大”
Args:
end_key(string): scan操作的终止位置,scan结果不包含end_key | 不调用此函数时,end_key被置为“无穷大” | [
"不调用此函数时,end_key被置为“无穷大”"
] | def SetEnd(self, end_key):
"""
不调用此函数时,end_key被置为“无穷大”
Args:
end_key(string): scan操作的终止位置,scan结果不包含end_key
"""
lib.tera_scan_descriptor_set_end(self.desc, end_key,
c_uint64(len(end_key))) | [
"def",
"SetEnd",
"(",
"self",
",",
"end_key",
")",
":",
"lib",
".",
"tera_scan_descriptor_set_end",
"(",
"self",
".",
"desc",
",",
"end_key",
",",
"c_uint64",
"(",
"len",
"(",
"end_key",
")",
")",
")"
] | https://github.com/baidu/tera/blob/dbcd28af792d879d961bf9fc7eb60de81b437646/src/sdk/python/TeraSdk.py#L77-L85 | ||
ZhouWeikuan/DouDiZhu | 0d84ff6c0bc54dba6ae37955de9ae9307513dc99 | code/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py | python | Type.element_type | (self) | return result | Retrieve the Type of elements within this Type.
If accessed on a type that is not an array, complex, or vector type, an
exception will be raised. | Retrieve the Type of elements within this Type. | [
"Retrieve",
"the",
"Type",
"of",
"elements",
"within",
"this",
"Type",
"."
] | def element_type(self):
"""Retrieve the Type of elements within this Type.
If accessed on a type that is not an array, complex, or vector type, an
exception will be raised.
"""
result = conf.lib.clang_getElementType(self)
if result.kind == TypeKind.INVALID:
r... | [
"def",
"element_type",
"(",
"self",
")",
":",
"result",
"=",
"conf",
".",
"lib",
".",
"clang_getElementType",
"(",
"self",
")",
"if",
"result",
".",
"kind",
"==",
"TypeKind",
".",
"INVALID",
":",
"raise",
"Exception",
"(",
"'Element type not available on this ... | https://github.com/ZhouWeikuan/DouDiZhu/blob/0d84ff6c0bc54dba6ae37955de9ae9307513dc99/code/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py#L1680-L1690 | |
nvdla/sw | 79538ba1b52b040a4a4645f630e457fa01839e90 | umd/external/protobuf-2.6/python/google/protobuf/service_reflection.py | python | GeneratedServiceType.__init__ | (cls, name, bases, dictionary) | Creates a message service class.
Args:
name: Name of the class (ignored, but required by the metaclass
protocol).
bases: Base classes of the class being constructed.
dictionary: The class dictionary of the class being constructed.
dictionary[_DESCRIPTOR_KEY] must contain a Service... | Creates a message service class. | [
"Creates",
"a",
"message",
"service",
"class",
"."
] | def __init__(cls, name, bases, dictionary):
"""Creates a message service class.
Args:
name: Name of the class (ignored, but required by the metaclass
protocol).
bases: Base classes of the class being constructed.
dictionary: The class dictionary of the class being constructed.
... | [
"def",
"__init__",
"(",
"cls",
",",
"name",
",",
"bases",
",",
"dictionary",
")",
":",
"# Don't do anything if this class doesn't have a descriptor. This happens",
"# when a service class is subclassed.",
"if",
"GeneratedServiceType",
".",
"_DESCRIPTOR_KEY",
"not",
"in",
"dic... | https://github.com/nvdla/sw/blob/79538ba1b52b040a4a4645f630e457fa01839e90/umd/external/protobuf-2.6/python/google/protobuf/service_reflection.py#L64-L81 | ||
SpaceNetChallenge/BuildingDetectors | 3def3c44b5847c744cd2f3356182892d92496579 | qinhaifang/src/evalTools/script/preprocess_space_net_data.py | python | convert_wgs84geojson_to_pixgeojson_worker | (image_name) | docstring for convert_wgs84geojson_to_pixgeojson_worker | docstring for convert_wgs84geojson_to_pixgeojson_worker | [
"docstring",
"for",
"convert_wgs84geojson_to_pixgeojson_worker"
] | def convert_wgs84geojson_to_pixgeojson_worker(image_name):
"""docstring for convert_wgs84geojson_to_pixgeojson_worker"""
try:
image_id = '_'.join(image_name.split('.')[0].split('_')[1:])
image_name = os.path.join(setting.PIC_3BAND_DIR, image_name)
wgs_geojson_file = os.path.join(setting.... | [
"def",
"convert_wgs84geojson_to_pixgeojson_worker",
"(",
"image_name",
")",
":",
"try",
":",
"image_id",
"=",
"'_'",
".",
"join",
"(",
"image_name",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]",
".",
"split",
"(",
"'_'",
")",
"[",
"1",
":",
"]",
")",
... | https://github.com/SpaceNetChallenge/BuildingDetectors/blob/3def3c44b5847c744cd2f3356182892d92496579/qinhaifang/src/evalTools/script/preprocess_space_net_data.py#L126-L141 | ||
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/models/Channel.py | python | Channel.__init__ | (
self,
ids,
name,
ctype,
size,
abbrev=None,
format_string=None,
update=None,
limits=(None, None, None, None),
comment=None,
xml_filename=None,
component_name=None,
component_base_name=None,
) | Constructor
@param id: Numeric ID of channel
@param name: Name of channel
@param ctype: Type of channel
@param size: Size, if string type
@param abbrev: Abbreviation (to support AMPCS)
@param comment: A single or multi-line comment describing the channel
@para... | Constructor | [
"Constructor"
] | def __init__(
self,
ids,
name,
ctype,
size,
abbrev=None,
format_string=None,
update=None,
limits=(None, None, None, None),
comment=None,
xml_filename=None,
component_name=None,
component_base_name=None,
):
... | [
"def",
"__init__",
"(",
"self",
",",
"ids",
",",
"name",
",",
"ctype",
",",
"size",
",",
"abbrev",
"=",
"None",
",",
"format_string",
"=",
"None",
",",
"update",
"=",
"None",
",",
"limits",
"=",
"(",
"None",
",",
"None",
",",
"None",
",",
"None",
... | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/models/Channel.py#L41-L78 | ||
Jittor/jittor | e9aca0444c2bdc8e2389d99122954cd0903eec46 | python/jittor/transform/__init__.py | python | hflip | (img) | return F_pil.hflip(img) | Function for horizontally flipping the given image.
Args::
[in] img(PIL Image.Image): Input image.
Example::
img = Image.open(...)
img_ = transform.hflip(img) | Function for horizontally flipping the given image.
Args::
[in] img(PIL Image.Image): Input image.
Example::
img = Image.open(...)
img_ = transform.hflip(img) | [
"Function",
"for",
"horizontally",
"flipping",
"the",
"given",
"image",
".",
"Args",
"::",
"[",
"in",
"]",
"img",
"(",
"PIL",
"Image",
".",
"Image",
")",
":",
"Input",
"image",
".",
"Example",
"::",
"img",
"=",
"Image",
".",
"open",
"(",
"...",
")",
... | def hflip(img):
"""
Function for horizontally flipping the given image.
Args::
[in] img(PIL Image.Image): Input image.
Example::
img = Image.open(...)
img_ = transform.hflip(img)
"""
return F_pil.hflip(img) | [
"def",
"hflip",
"(",
"img",
")",
":",
"return",
"F_pil",
".",
"hflip",
"(",
"img",
")"
] | https://github.com/Jittor/jittor/blob/e9aca0444c2bdc8e2389d99122954cd0903eec46/python/jittor/transform/__init__.py#L223-L233 | |
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/agents/tools/in_graph_env.py | python | InGraphEnv.action | (self) | return self._action | Access the variable holding the last recieved action. | Access the variable holding the last recieved action. | [
"Access",
"the",
"variable",
"holding",
"the",
"last",
"recieved",
"action",
"."
] | def action(self):
"""Access the variable holding the last recieved action."""
return self._action | [
"def",
"action",
"(",
"self",
")",
":",
"return",
"self",
".",
"_action"
] | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/agents/tools/in_graph_env.py#L113-L115 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/static/io.py | python | save_inference_model | (path_prefix, feed_vars, fetch_vars, executor,
**kwargs) | :api_attr: Static Graph
Save current model and its parameters to given path. i.e.
Given path_prefix = "/path/to/modelname", after invoking
save_inference_model(path_prefix, feed_vars, fetch_vars, executor),
you will find two files named modelname.pdmodel and modelname.pdiparams
under "/path/to", wh... | :api_attr: Static Graph | [
":",
"api_attr",
":",
"Static",
"Graph"
] | def save_inference_model(path_prefix, feed_vars, fetch_vars, executor,
**kwargs):
"""
:api_attr: Static Graph
Save current model and its parameters to given path. i.e.
Given path_prefix = "/path/to/modelname", after invoking
save_inference_model(path_prefix, feed_vars, fetc... | [
"def",
"save_inference_model",
"(",
"path_prefix",
",",
"feed_vars",
",",
"fetch_vars",
",",
"executor",
",",
"*",
"*",
"kwargs",
")",
":",
"# check path_prefix, set model_path and params_path",
"path_prefix",
"=",
"_normalize_path_prefix",
"(",
"path_prefix",
")",
"try... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/static/io.py#L433-L521 | ||
omnisci/omniscidb | b9c95f1bd602b4ffc8b0edf18bfad61031e08d86 | QueryEngine/scripts/generate_TableFunctionsFactory_init.py | python | AnnotationNode.__init__ | (self, key, value) | Parameters
----------
key : str
value : {str, list} | Parameters
----------
key : str
value : {str, list} | [
"Parameters",
"----------",
"key",
":",
"str",
"value",
":",
"{",
"str",
"list",
"}"
] | def __init__(self, key, value):
"""
Parameters
----------
key : str
value : {str, list}
"""
self.key = key
self.value = value | [
"def",
"__init__",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"key",
"=",
"key",
"self",
".",
"value",
"=",
"value"
] | https://github.com/omnisci/omniscidb/blob/b9c95f1bd602b4ffc8b0edf18bfad61031e08d86/QueryEngine/scripts/generate_TableFunctionsFactory_init.py#L1163-L1171 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/dataset/engine/datasets.py | python | Dataset.reset | (self) | Reset the dataset for next epoch. | Reset the dataset for next epoch. | [
"Reset",
"the",
"dataset",
"for",
"next",
"epoch",
"."
] | def reset(self):
"""Reset the dataset for next epoch.""" | [
"def",
"reset",
"(",
"self",
")",
":"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/engine/datasets.py#L1786-L1787 | ||
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | Tools/mavlink_px4.py | python | MAVLink.param_request_list_encode | (self, target_system, target_component) | return msg | Request all parameters of this component. After his request, all
parameters are emitted.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t) | Request all parameters of this component. After his request, all
parameters are emitted. | [
"Request",
"all",
"parameters",
"of",
"this",
"component",
".",
"After",
"his",
"request",
"all",
"parameters",
"are",
"emitted",
"."
] | def param_request_list_encode(self, target_system, target_component):
'''
Request all parameters of this component. After his request, all
parameters are emitted.
target_system : System ID (uint8_t)
target_component : ... | [
"def",
"param_request_list_encode",
"(",
"self",
",",
"target_system",
",",
"target_component",
")",
":",
"msg",
"=",
"MAVLink_param_request_list_message",
"(",
"target_system",
",",
"target_component",
")",
"msg",
".",
"pack",
"(",
"self",
")",
"return",
"msg"
] | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/Tools/mavlink_px4.py#L2707-L2718 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/shell.py | python | rm_rf | (dest) | Remove a tree | Remove a tree | [
"Remove",
"a",
"tree"
] | def rm_rf(dest):
""" Remove a tree """
dest = native(dest)
if _os.path.exists(dest):
for path in files(dest, '*'):
_os.chmod(native(path), 0o644)
_shutil.rmtree(dest) | [
"def",
"rm_rf",
"(",
"dest",
")",
":",
"dest",
"=",
"native",
"(",
"dest",
")",
"if",
"_os",
".",
"path",
".",
"exists",
"(",
"dest",
")",
":",
"for",
"path",
"in",
"files",
"(",
"dest",
",",
"'*'",
")",
":",
"_os",
".",
"chmod",
"(",
"native",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/shell.py#L84-L90 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/drafttaskpanels/task_polararray.py | python | TaskPanelPolarArray.reset_point | (self) | Reset the center point to the original distance. | Reset the center point to the original distance. | [
"Reset",
"the",
"center",
"point",
"to",
"the",
"original",
"distance",
"."
] | def reset_point(self):
"""Reset the center point to the original distance."""
self.form.input_c_x.setProperty('rawValue', 0)
self.form.input_c_y.setProperty('rawValue', 0)
self.form.input_c_z.setProperty('rawValue', 0)
self.center = self.get_center()
_msg(translate("draf... | [
"def",
"reset_point",
"(",
"self",
")",
":",
"self",
".",
"form",
".",
"input_c_x",
".",
"setProperty",
"(",
"'rawValue'",
",",
"0",
")",
"self",
".",
"form",
".",
"input_c_y",
".",
"setProperty",
"(",
"'rawValue'",
",",
"0",
")",
"self",
".",
"form",
... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/drafttaskpanels/task_polararray.py#L282-L292 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/ntpath.py | python | ismount | (path) | Test whether a path is a mount point (a drive root, the root of a
share, or a mounted volume) | Test whether a path is a mount point (a drive root, the root of a
share, or a mounted volume) | [
"Test",
"whether",
"a",
"path",
"is",
"a",
"mount",
"point",
"(",
"a",
"drive",
"root",
"the",
"root",
"of",
"a",
"share",
"or",
"a",
"mounted",
"volume",
")"
] | def ismount(path):
"""Test whether a path is a mount point (a drive root, the root of a
share, or a mounted volume)"""
path = os.fspath(path)
seps = _get_bothseps(path)
path = abspath(path)
root, rest = splitdrive(path)
if root and root[0] in seps:
return (not rest) or (rest in seps)... | [
"def",
"ismount",
"(",
"path",
")",
":",
"path",
"=",
"os",
".",
"fspath",
"(",
"path",
")",
"seps",
"=",
"_get_bothseps",
"(",
"path",
")",
"path",
"=",
"abspath",
"(",
"path",
")",
"root",
",",
"rest",
"=",
"splitdrive",
"(",
"path",
")",
"if",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/ntpath.py#L260-L275 | ||
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/pcollection.py | python | PCollection.combine | (self, fn, **options) | return transforms.combine(self, fn, **options) | 等同于 :func:`bigflow.transforms.combine(self, fn) <bigflow.transforms.combine>`
Args:
fn (callable): 合并函数
**options: 可配置选项
Returns:
PObject: 合并结果
>>> _pipeline.parallelize([2, 4, 6, 10]).combine(sum).get()
22 | 等同于 :func:`bigflow.transforms.combine(self, fn) <bigflow.transforms.combine>` | [
"等同于",
":",
"func",
":",
"bigflow",
".",
"transforms",
".",
"combine",
"(",
"self",
"fn",
")",
"<bigflow",
".",
"transforms",
".",
"combine",
">"
] | def combine(self, fn, **options):
"""
等同于 :func:`bigflow.transforms.combine(self, fn) <bigflow.transforms.combine>`
Args:
fn (callable): 合并函数
**options: 可配置选项
Returns:
PObject: 合并结果
>>> _pipeline.parallelize([2, 4, 6, 10]).combine(sum).get()
... | [
"def",
"combine",
"(",
"self",
",",
"fn",
",",
"*",
"*",
"options",
")",
":",
"return",
"transforms",
".",
"combine",
"(",
"self",
",",
"fn",
",",
"*",
"*",
"options",
")"
] | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/pcollection.py#L112-L126 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/models/embedding/word2vec_optimized.py | python | Word2Vec.analogy | (self, w0, w1, w2) | return "unknown" | Predict word w3 as in w0:w1 vs w2:w3. | Predict word w3 as in w0:w1 vs w2:w3. | [
"Predict",
"word",
"w3",
"as",
"in",
"w0",
":",
"w1",
"vs",
"w2",
":",
"w3",
"."
] | def analogy(self, w0, w1, w2):
"""Predict word w3 as in w0:w1 vs w2:w3."""
wid = np.array([[self._word2id.get(w, 0) for w in [w0, w1, w2]]])
idx = self._predict(wid)
for c in [self._id2word[i] for i in idx[0, :]]:
if c not in [w0, w1, w2]:
return c
return "unknown" | [
"def",
"analogy",
"(",
"self",
",",
"w0",
",",
"w1",
",",
"w2",
")",
":",
"wid",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"self",
".",
"_word2id",
".",
"get",
"(",
"w",
",",
"0",
")",
"for",
"w",
"in",
"[",
"w0",
",",
"w1",
",",
"w2",
"]",... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/models/embedding/word2vec_optimized.py#L378-L385 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/array_analysis.py | python | SymbolicEquivSet._get_or_set_rel | (self, name, func_ir=None) | Retrieve a definition pair for the given variable,
and if it is not already available, try to look it up
in the given func_ir, and remember it for future use. | Retrieve a definition pair for the given variable,
and if it is not already available, try to look it up
in the given func_ir, and remember it for future use. | [
"Retrieve",
"a",
"definition",
"pair",
"for",
"the",
"given",
"variable",
"and",
"if",
"it",
"is",
"not",
"already",
"available",
"try",
"to",
"look",
"it",
"up",
"in",
"the",
"given",
"func_ir",
"and",
"remember",
"it",
"for",
"future",
"use",
"."
] | def _get_or_set_rel(self, name, func_ir=None):
"""Retrieve a definition pair for the given variable,
and if it is not already available, try to look it up
in the given func_ir, and remember it for future use.
"""
if isinstance(name, ir.Var):
name = name.name
r... | [
"def",
"_get_or_set_rel",
"(",
"self",
",",
"name",
",",
"func_ir",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"name",
",",
"ir",
".",
"Var",
")",
":",
"name",
"=",
"name",
".",
"name",
"require",
"(",
"self",
".",
"defs",
".",
"get",
"(",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/array_analysis.py#L741-L823 | ||
NVIDIA/MDL-SDK | aa9642b2546ad7b6236b5627385d882c2ed83c5d | examples/mdl_python/modules/example_modules.py | python | load_module | (neuray, transaction, module_mdl_name) | return res >= 0 | Load the module given its name.
Returns true if the module is loaded to database | Load the module given its name.
Returns true if the module is loaded to database | [
"Load",
"the",
"module",
"given",
"its",
"name",
".",
"Returns",
"true",
"if",
"the",
"module",
"is",
"loaded",
"to",
"database"
] | def load_module(neuray, transaction, module_mdl_name):
"""Load the module given its name.
Returns true if the module is loaded to database"""
with neuray.get_api_component(pymdlsdk.IMdl_impexp_api) as imp_exp:
with neuray.get_api_component(pymdlsdk.IMdl_factory) as mdl_factory:
# for il... | [
"def",
"load_module",
"(",
"neuray",
",",
"transaction",
",",
"module_mdl_name",
")",
":",
"with",
"neuray",
".",
"get_api_component",
"(",
"pymdlsdk",
".",
"IMdl_impexp_api",
")",
"as",
"imp_exp",
":",
"with",
"neuray",
".",
"get_api_component",
"(",
"pymdlsdk"... | https://github.com/NVIDIA/MDL-SDK/blob/aa9642b2546ad7b6236b5627385d882c2ed83c5d/examples/mdl_python/modules/example_modules.py#L284-L295 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/animate.py | python | Animation.GetFramePosition | (*args, **kwargs) | return _animate.Animation_GetFramePosition(*args, **kwargs) | GetFramePosition(self, int frame) -> Point | GetFramePosition(self, int frame) -> Point | [
"GetFramePosition",
"(",
"self",
"int",
"frame",
")",
"-",
">",
"Point"
] | def GetFramePosition(*args, **kwargs):
"""GetFramePosition(self, int frame) -> Point"""
return _animate.Animation_GetFramePosition(*args, **kwargs) | [
"def",
"GetFramePosition",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_animate",
".",
"Animation_GetFramePosition",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/animate.py#L122-L124 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/pydoc.py | python | HTMLDoc.multicolumn | (self, list, format, cols=4) | return '<table width="100%%" summary="list"><tr>%s</tr></table>' % result | Format a list of items into a multi-column list. | Format a list of items into a multi-column list. | [
"Format",
"a",
"list",
"of",
"items",
"into",
"a",
"multi",
"-",
"column",
"list",
"."
] | def multicolumn(self, list, format, cols=4):
"""Format a list of items into a multi-column list."""
result = ''
rows = (len(list)+cols-1)//cols
for col in range(cols):
result = result + '<td width="%d%%" valign=top>' % (100//cols)
for i in range(rows*col, rows*col... | [
"def",
"multicolumn",
"(",
"self",
",",
"list",
",",
"format",
",",
"cols",
"=",
"4",
")",
":",
"result",
"=",
"''",
"rows",
"=",
"(",
"len",
"(",
"list",
")",
"+",
"cols",
"-",
"1",
")",
"//",
"cols",
"for",
"col",
"in",
"range",
"(",
"cols",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/pydoc.py#L535-L545 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/labeled_tensor/python/ops/ops.py | python | batch | (labeled_tensors,
batch_size,
num_threads=1,
capacity=32,
enqueue_many=False,
allow_smaller_final_batch=False,
name=None) | return _batch_helper('lt_batch', fn, batch_size, enqueue_many,
labeled_tensors, allow_smaller_final_batch, name) | Rebatch a tensor.
See tf.batch.
Args:
labeled_tensors: The input tensors.
batch_size: The output batch size.
num_threads: See tf.batch.
capacity: See tf.batch.
enqueue_many: If true, the input tensors must contain a 'batch' axis as
their first axis.
If false, the input tensors must... | Rebatch a tensor. | [
"Rebatch",
"a",
"tensor",
"."
] | def batch(labeled_tensors,
batch_size,
num_threads=1,
capacity=32,
enqueue_many=False,
allow_smaller_final_batch=False,
name=None):
"""Rebatch a tensor.
See tf.batch.
Args:
labeled_tensors: The input tensors.
batch_size: The output batch size.
... | [
"def",
"batch",
"(",
"labeled_tensors",
",",
"batch_size",
",",
"num_threads",
"=",
"1",
",",
"capacity",
"=",
"32",
",",
"enqueue_many",
"=",
"False",
",",
"allow_smaller_final_batch",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"def",
"fn",
"(",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/labeled_tensor/python/ops/ops.py#L452-L496 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/textwrap.py | python | fill | (text, width=70, **kwargs) | return w.fill(text) | Fill a single paragraph of text, returning a new string.
Reformat the single paragraph in 'text' to fit in lines of no more
than 'width' columns, and return a new string containing the entire
wrapped paragraph. As with wrap(), tabs are expanded and other
whitespace characters converted to space. See ... | Fill a single paragraph of text, returning a new string. | [
"Fill",
"a",
"single",
"paragraph",
"of",
"text",
"returning",
"a",
"new",
"string",
"."
] | def fill(text, width=70, **kwargs):
"""Fill a single paragraph of text, returning a new string.
Reformat the single paragraph in 'text' to fit in lines of no more
than 'width' columns, and return a new string containing the entire
wrapped paragraph. As with wrap(), tabs are expanded and other
whit... | [
"def",
"fill",
"(",
"text",
",",
"width",
"=",
"70",
",",
"*",
"*",
"kwargs",
")",
":",
"w",
"=",
"TextWrapper",
"(",
"width",
"=",
"width",
",",
"*",
"*",
"kwargs",
")",
"return",
"w",
".",
"fill",
"(",
"text",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/textwrap.py#L381-L391 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/xcode_emulation.py | python | GetXcodeArchsDefault | () | return XCODE_ARCHS_DEFAULT_CACHE | Returns the |XcodeArchsDefault| object to use to expand ARCHS for the
installed version of Xcode. The default values used by Xcode for ARCHS
and the expansion of the variables depends on the version of Xcode used.
For all version anterior to Xcode 5.0 or posterior to Xcode 5.1 included
uses $(ARCHS_STANDARD) i... | Returns the |XcodeArchsDefault| object to use to expand ARCHS for the
installed version of Xcode. The default values used by Xcode for ARCHS
and the expansion of the variables depends on the version of Xcode used. | [
"Returns",
"the",
"|XcodeArchsDefault|",
"object",
"to",
"use",
"to",
"expand",
"ARCHS",
"for",
"the",
"installed",
"version",
"of",
"Xcode",
".",
"The",
"default",
"values",
"used",
"by",
"Xcode",
"for",
"ARCHS",
"and",
"the",
"expansion",
"of",
"the",
"var... | def GetXcodeArchsDefault():
"""Returns the |XcodeArchsDefault| object to use to expand ARCHS for the
installed version of Xcode. The default values used by Xcode for ARCHS
and the expansion of the variables depends on the version of Xcode used.
For all version anterior to Xcode 5.0 or posterior to Xcode 5.1 in... | [
"def",
"GetXcodeArchsDefault",
"(",
")",
":",
"global",
"XCODE_ARCHS_DEFAULT_CACHE",
"if",
"XCODE_ARCHS_DEFAULT_CACHE",
":",
"return",
"XCODE_ARCHS_DEFAULT_CACHE",
"xcode_version",
",",
"_",
"=",
"XcodeVersion",
"(",
")",
"if",
"xcode_version",
"<",
"'0500'",
":",
"XC... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/xcode_emulation.py#L99-L145 | |
Tencent/Pebble | 68315f176d9e328a233ace29b7579a829f89879f | tools/blade/src/blade/java_jar_target.py | python | JavaJarTarget.scons_rules | (self) | scons_rules.
Description
-----------
It outputs the scons rules according to user options. | scons_rules. | [
"scons_rules",
"."
] | def scons_rules(self):
"""scons_rules.
Description
-----------
It outputs the scons rules according to user options.
"""
self._clone_env()
if self.type == 'prebuilt_java_jar':
self._prebuilt_java_jar()
return
env_name = self._en... | [
"def",
"scons_rules",
"(",
"self",
")",
":",
"self",
".",
"_clone_env",
"(",
")",
"if",
"self",
".",
"type",
"==",
"'prebuilt_java_jar'",
":",
"self",
".",
"_prebuilt_java_jar",
"(",
")",
"return",
"env_name",
"=",
"self",
".",
"_env_name",
"(",
")",
"cl... | https://github.com/Tencent/Pebble/blob/68315f176d9e328a233ace29b7579a829f89879f/tools/blade/src/blade/java_jar_target.py#L340-L410 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/s3transfer/manager.py | python | TransferManager.shutdown | (self, cancel=False, cancel_msg='') | Shutdown the TransferManager
It will wait till all transfers complete before it completely shuts
down.
:type cancel: boolean
:param cancel: If True, calls TransferFuture.cancel() for
all in-progress in transfers. This is useful if you want the
shutdown to happen... | Shutdown the TransferManager | [
"Shutdown",
"the",
"TransferManager"
] | def shutdown(self, cancel=False, cancel_msg=''):
"""Shutdown the TransferManager
It will wait till all transfers complete before it completely shuts
down.
:type cancel: boolean
:param cancel: If True, calls TransferFuture.cancel() for
all in-progress in transfers. T... | [
"def",
"shutdown",
"(",
"self",
",",
"cancel",
"=",
"False",
",",
"cancel_msg",
"=",
"''",
")",
":",
"self",
".",
"_shutdown",
"(",
"cancel",
",",
"cancel",
",",
"cancel_msg",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/s3transfer/manager.py#L541-L556 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/distributions/bijector_impl.py | python | _Mapping.merge | (self, x=None, y=None, ildj_map=None, kwargs=None, mapping=None) | return _Mapping(
x=self._merge(self.x, mapping.x),
y=self._merge(self.y, mapping.y),
ildj_map=self._merge_dicts(self.ildj_map, mapping.ildj_map),
kwargs=self._merge(self.kwargs, mapping.kwargs)) | Returns new _Mapping with args merged with self.
Args:
x: `Tensor`. Forward.
y: `Tensor`. Inverse.
ildj_map: `Dictionary`. This is a mapping from event_ndims to a `Tensor`
representing the inverse log det jacobian.
kwargs: Python dictionary. Extra args supplied to
forward/in... | Returns new _Mapping with args merged with self. | [
"Returns",
"new",
"_Mapping",
"with",
"args",
"merged",
"with",
"self",
"."
] | def merge(self, x=None, y=None, ildj_map=None, kwargs=None, mapping=None):
"""Returns new _Mapping with args merged with self.
Args:
x: `Tensor`. Forward.
y: `Tensor`. Inverse.
ildj_map: `Dictionary`. This is a mapping from event_ndims to a `Tensor`
representing the inverse log det ja... | [
"def",
"merge",
"(",
"self",
",",
"x",
"=",
"None",
",",
"y",
"=",
"None",
",",
"ildj_map",
"=",
"None",
",",
"kwargs",
"=",
"None",
",",
"mapping",
"=",
"None",
")",
":",
"if",
"mapping",
"is",
"None",
":",
"mapping",
"=",
"_Mapping",
"(",
"x",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/distributions/bijector_impl.py#L72-L101 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/core/defchararray.py | python | lstrip | (a, chars=None) | return _vec_string(a_arr, a_arr.dtype, 'lstrip', (chars,)) | For each element in `a`, return a copy with the leading characters
removed.
Calls `str.lstrip` element-wise.
Parameters
----------
a : array-like, {str, unicode}
Input array.
chars : {str, unicode}, optional
The `chars` argument is a string specifying the set of
charac... | For each element in `a`, return a copy with the leading characters
removed. | [
"For",
"each",
"element",
"in",
"a",
"return",
"a",
"copy",
"with",
"the",
"leading",
"characters",
"removed",
"."
] | def lstrip(a, chars=None):
"""
For each element in `a`, return a copy with the leading characters
removed.
Calls `str.lstrip` element-wise.
Parameters
----------
a : array-like, {str, unicode}
Input array.
chars : {str, unicode}, optional
The `chars` argument is a stri... | [
"def",
"lstrip",
"(",
"a",
",",
"chars",
"=",
"None",
")",
":",
"a_arr",
"=",
"numpy",
".",
"asarray",
"(",
"a",
")",
"return",
"_vec_string",
"(",
"a_arr",
",",
"a_arr",
".",
"dtype",
",",
"'lstrip'",
",",
"(",
"chars",
",",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/core/defchararray.py#L1055-L1109 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/ir/builder.py | python | IRBuilder.sitofp | (self, value, typ, name='') | Convert signed integer to floating-point:
name = (typ) value | Convert signed integer to floating-point:
name = (typ) value | [
"Convert",
"signed",
"integer",
"to",
"floating",
"-",
"point",
":",
"name",
"=",
"(",
"typ",
")",
"value"
] | def sitofp(self, value, typ, name=''):
"""
Convert signed integer to floating-point:
name = (typ) value
""" | [
"def",
"sitofp",
"(",
"self",
",",
"value",
",",
"typ",
",",
"name",
"=",
"''",
")",
":"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/ir/builder.py#L675-L679 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Cipher/_mode_siv.py | python | SivMode.encrypt | (self, plaintext) | For SIV, encryption and MAC authentication must take place at the same
point. This method shall not be used.
Use `encrypt_and_digest` instead. | For SIV, encryption and MAC authentication must take place at the same
point. This method shall not be used. | [
"For",
"SIV",
"encryption",
"and",
"MAC",
"authentication",
"must",
"take",
"place",
"at",
"the",
"same",
"point",
".",
"This",
"method",
"shall",
"not",
"be",
"used",
"."
] | def encrypt(self, plaintext):
"""
For SIV, encryption and MAC authentication must take place at the same
point. This method shall not be used.
Use `encrypt_and_digest` instead.
"""
raise TypeError("encrypt() not allowed for SIV mode."
" Use encry... | [
"def",
"encrypt",
"(",
"self",
",",
"plaintext",
")",
":",
"raise",
"TypeError",
"(",
"\"encrypt() not allowed for SIV mode.\"",
"\" Use encrypt_and_digest() instead.\"",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Cipher/_mode_siv.py#L176-L185 | ||
fabianschenk/RESLAM | 2e71a578b6d1a1ad1fb018641218e1f41dd9e330 | thirdparty/Sophus/py/sophus/so3.py | python | So3.matrix | (self) | return sympy.Matrix([[
1 - 2 * self.q.vec[1]**2 - 2 * self.q.vec[2]**2,
2 * self.q.vec[0] * self.q.vec[1] -
2 * self.q.vec[2] * self.q[3],
2 * self.q.vec[0] * self.q.vec[2] +
2 * self.q.vec[1] * self.q[3]
], [
2 * self.q.vec[0] * self.q.vec... | returns matrix representation | returns matrix representation | [
"returns",
"matrix",
"representation"
] | def matrix(self):
""" returns matrix representation """
return sympy.Matrix([[
1 - 2 * self.q.vec[1]**2 - 2 * self.q.vec[2]**2,
2 * self.q.vec[0] * self.q.vec[1] -
2 * self.q.vec[2] * self.q[3],
2 * self.q.vec[0] * self.q.vec[2] +
2 * self.q.ve... | [
"def",
"matrix",
"(",
"self",
")",
":",
"return",
"sympy",
".",
"Matrix",
"(",
"[",
"[",
"1",
"-",
"2",
"*",
"self",
".",
"q",
".",
"vec",
"[",
"1",
"]",
"**",
"2",
"-",
"2",
"*",
"self",
".",
"q",
".",
"vec",
"[",
"2",
"]",
"**",
"2",
... | https://github.com/fabianschenk/RESLAM/blob/2e71a578b6d1a1ad1fb018641218e1f41dd9e330/thirdparty/Sophus/py/sophus/so3.py#L39-L59 | |
taichi-dev/taichi | 973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6 | python/taichi/lang/ops.py | python | bit_and | (a, b) | return _binary_operation(_ti_core.expr_bit_and, _bt_ops_mod.and_, a, b) | Compute bitwise-and
Args:
a (Union[:class:`~taichi.lang.expr.Expr`, :class:`~taichi.lang.matrix.Matrix`]): value LHS
b (Union[:class:`~taichi.lang.expr.Expr`, :class:`~taichi.lang.matrix.Matrix`]): value RHS
Returns:
Union[:class:`~taichi.lang.expr.Expr`, bool]: LHS bitwise-and with RH... | Compute bitwise-and | [
"Compute",
"bitwise",
"-",
"and"
] | def bit_and(a, b):
"""Compute bitwise-and
Args:
a (Union[:class:`~taichi.lang.expr.Expr`, :class:`~taichi.lang.matrix.Matrix`]): value LHS
b (Union[:class:`~taichi.lang.expr.Expr`, :class:`~taichi.lang.matrix.Matrix`]): value RHS
Returns:
Union[:class:`~taichi.lang.expr.Expr`, bool... | [
"def",
"bit_and",
"(",
"a",
",",
"b",
")",
":",
"return",
"_binary_operation",
"(",
"_ti_core",
".",
"expr_bit_and",
",",
"_bt_ops_mod",
".",
"and_",
",",
"a",
",",
"b",
")"
] | https://github.com/taichi-dev/taichi/blob/973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6/python/taichi/lang/ops.py#L696-L707 | |
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPM2_Certify_REQUEST.inSchemeScheme | (self) | return inScheme.GetUnionSelector() if inScheme else TPM_ALG_ID.NULL | Scheme selector | Scheme selector | [
"Scheme",
"selector"
] | def inSchemeScheme(self): # TPM_ALG_ID
""" Scheme selector """
return inScheme.GetUnionSelector() if inScheme else TPM_ALG_ID.NULL | [
"def",
"inSchemeScheme",
"(",
"self",
")",
":",
"# TPM_ALG_ID",
"return",
"inScheme",
".",
"GetUnionSelector",
"(",
")",
"if",
"inScheme",
"else",
"TPM_ALG_ID",
".",
"NULL"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L12411-L12413 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/plat-mac/findertools.py | python | _setlocation | (object_alias, (x, y)) | return (x,y) | _setlocation: Set the location of the icon for the object. | _setlocation: Set the location of the icon for the object. | [
"_setlocation",
":",
"Set",
"the",
"location",
"of",
"the",
"icon",
"for",
"the",
"object",
"."
] | def _setlocation(object_alias, (x, y)):
"""_setlocation: Set the location of the icon for the object."""
finder = _getfinder()
args = {}
attrs = {}
aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=object_alias, fr=None)
aeobj_01 = aetypes.ObjectSpecifier(want=aetyp... | [
"def",
"_setlocation",
"(",
"object_alias",
",",
"(",
"x",
",",
"y",
")",
")",
":",
"finder",
"=",
"_getfinder",
"(",
")",
"args",
"=",
"{",
"}",
"attrs",
"=",
"{",
"}",
"aeobj_00",
"=",
"aetypes",
".",
"ObjectSpecifier",
"(",
"want",
"=",
"aetypes",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/plat-mac/findertools.py#L303-L315 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/fnmatch.py | python | fnmatchcase | (name, pat) | return _cache[pat].match(name) is not None | Test whether FILENAME matches PATTERN, including case.
This is a version of fnmatch() which doesn't case-normalize
its arguments. | Test whether FILENAME matches PATTERN, including case. | [
"Test",
"whether",
"FILENAME",
"matches",
"PATTERN",
"including",
"case",
"."
] | def fnmatchcase(name, pat):
"""Test whether FILENAME matches PATTERN, including case.
This is a version of fnmatch() which doesn't case-normalize
its arguments.
"""
if not pat in _cache:
res = translate(pat)
_cache[pat] = re.compile(res)
return _cache[pat].match(name) is not No... | [
"def",
"fnmatchcase",
"(",
"name",
",",
"pat",
")",
":",
"if",
"not",
"pat",
"in",
"_cache",
":",
"res",
"=",
"translate",
"(",
"pat",
")",
"_cache",
"[",
"pat",
"]",
"=",
"re",
".",
"compile",
"(",
"res",
")",
"return",
"_cache",
"[",
"pat",
"]"... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/fnmatch.py#L60-L70 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py | python | Misc.winfo_id | (self) | return self.tk.getint(
self.tk.call('winfo', 'id', self._w)) | Return identifier ID for this widget. | Return identifier ID for this widget. | [
"Return",
"identifier",
"ID",
"for",
"this",
"widget",
"."
] | def winfo_id(self):
"""Return identifier ID for this widget."""
return self.tk.getint(
self.tk.call('winfo', 'id', self._w)) | [
"def",
"winfo_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"tk",
".",
"getint",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"'winfo'",
",",
"'id'",
",",
"self",
".",
"_w",
")",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py#L783-L786 | |
shoaibrayeen/Programmers-Community | 1d352fb3e6ac5e2e7d9472d90527bdcc8d5ec355 | Bit Algorithm/Count Number of Set Bits in A Number/SolutionByTanmay.py | python | counSetBits | (num) | return st,st.count('1') | Objective : To Count The Number Of Set Bits In Binary Representation Of A Given Number
Input : A Decimal Number - Numeric Value
Return : No. Of Set Bits - Numeric Value | Objective : To Count The Number Of Set Bits In Binary Representation Of A Given Number
Input : A Decimal Number - Numeric Value
Return : No. Of Set Bits - Numeric Value | [
"Objective",
":",
"To",
"Count",
"The",
"Number",
"Of",
"Set",
"Bits",
"In",
"Binary",
"Representation",
"Of",
"A",
"Given",
"Number",
"Input",
":",
"A",
"Decimal",
"Number",
"-",
"Numeric",
"Value",
"Return",
":",
"No",
".",
"Of",
"Set",
"Bits",
"-",
... | def counSetBits(num):
'''
Objective : To Count The Number Of Set Bits In Binary Representation Of A Given Number
Input : A Decimal Number - Numeric Value
Return : No. Of Set Bits - Numeric Value
'''
if num == 0:
return 0, 0
st = ""
while n... | [
"def",
"counSetBits",
"(",
"num",
")",
":",
"if",
"num",
"==",
"0",
":",
"return",
"0",
",",
"0",
"st",
"=",
"\"\"",
"while",
"num",
"!=",
"1",
":",
"if",
"num",
"%",
"2",
"==",
"0",
":",
"r",
"=",
"num",
"%",
"2",
"num",
"=",
"(",
"num",
... | https://github.com/shoaibrayeen/Programmers-Community/blob/1d352fb3e6ac5e2e7d9472d90527bdcc8d5ec355/Bit Algorithm/Count Number of Set Bits in A Number/SolutionByTanmay.py#L1-L24 | |
AojunZhou/Incremental-Network-Quantization | c7f6a609d5817d8424ce224209cf4c50f1e4de50 | python/caffe/draw.py | python | choose_color_by_layertype | (layertype) | return color | Define colors for nodes based on the layer type. | Define colors for nodes based on the layer type. | [
"Define",
"colors",
"for",
"nodes",
"based",
"on",
"the",
"layer",
"type",
"."
] | def choose_color_by_layertype(layertype):
"""Define colors for nodes based on the layer type.
"""
color = '#6495ED' # Default
if layertype == 'Convolution' or layertype == 'Deconvolution':
color = '#FF5050'
elif layertype == 'Pooling':
color = '#FF9900'
elif layertype == 'InnerP... | [
"def",
"choose_color_by_layertype",
"(",
"layertype",
")",
":",
"color",
"=",
"'#6495ED'",
"# Default",
"if",
"layertype",
"==",
"'Convolution'",
"or",
"layertype",
"==",
"'Deconvolution'",
":",
"color",
"=",
"'#FF5050'",
"elif",
"layertype",
"==",
"'Pooling'",
":... | https://github.com/AojunZhou/Incremental-Network-Quantization/blob/c7f6a609d5817d8424ce224209cf4c50f1e4de50/python/caffe/draw.py#L117-L127 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/dataset/engine/validators.py | python | check_gnn_graphdata | (method) | return new_method | check the input arguments of graphdata. | check the input arguments of graphdata. | [
"check",
"the",
"input",
"arguments",
"of",
"graphdata",
"."
] | def check_gnn_graphdata(method):
"""check the input arguments of graphdata."""
@wraps(method)
def new_method(self, *args, **kwargs):
[dataset_file, num_parallel_workers, working_mode, hostname,
port, num_client, auto_shutdown], _ = parse_user_args(method, *args, **kwargs)
check_fil... | [
"def",
"check_gnn_graphdata",
"(",
"method",
")",
":",
"@",
"wraps",
"(",
"method",
")",
"def",
"new_method",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"[",
"dataset_file",
",",
"num_parallel_workers",
",",
"working_mode",
",",
"h... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/engine/validators.py#L1563-L1586 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/symbol/symbol.py | python | Symbol.eval | (self, ctx=None, **kwargs) | return self.bind(ctx, kwargs).forward() | Evaluates a symbol given arguments.
The `eval` method combines a call to `bind` (which returns an executor)
with a call to `forward` (executor method).
For the common use case, where you might repeatedly evaluate with same arguments,
eval is slow.
In that case, you should call `... | Evaluates a symbol given arguments. | [
"Evaluates",
"a",
"symbol",
"given",
"arguments",
"."
] | def eval(self, ctx=None, **kwargs):
"""Evaluates a symbol given arguments.
The `eval` method combines a call to `bind` (which returns an executor)
with a call to `forward` (executor method).
For the common use case, where you might repeatedly evaluate with same arguments,
eval i... | [
"def",
"eval",
"(",
"self",
",",
"ctx",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"ctx",
"is",
"None",
":",
"ctx",
"=",
"current_context",
"(",
")",
"return",
"self",
".",
"bind",
"(",
"ctx",
",",
"kwargs",
")",
".",
"forward",
"(",
... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/symbol/symbol.py#L1838-L1876 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/python/gem5/components/cachehierarchies/ruby/caches/abstract_dma_controller.py | python | AbstractDMAController.connectQueues | (self, network) | Connect all of the queues for this controller. | Connect all of the queues for this controller. | [
"Connect",
"all",
"of",
"the",
"queues",
"for",
"this",
"controller",
"."
] | def connectQueues(self, network):
"""Connect all of the queues for this controller."""
raise NotImplementedError | [
"def",
"connectQueues",
"(",
"self",
",",
"network",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/python/gem5/components/cachehierarchies/ruby/caches/abstract_dma_controller.py#L48-L50 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/supertooltip.py | python | SuperToolTip.GetMessage | (self) | return self._message | Returns the main body message in :class:`SuperToolTip`. | Returns the main body message in :class:`SuperToolTip`. | [
"Returns",
"the",
"main",
"body",
"message",
"in",
":",
"class",
":",
"SuperToolTip",
"."
] | def GetMessage(self):
""" Returns the main body message in :class:`SuperToolTip`. """
return self._message | [
"def",
"GetMessage",
"(",
"self",
")",
":",
"return",
"self",
".",
"_message"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/supertooltip.py#L1171-L1174 | |
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/programs/scripts/metadata/Music/musicbrainzngs/musicbrainz.py | python | get_releases_in_collection | (collection, limit=None, offset=None) | return _do_mb_query("collection", "%s/releases" % collection, [], params) | List the releases in a collection.
Returns a dict with a 'collection' key, which again has a 'release-list'.
See `Browsing`_ for how to use `limit` and `offset`. | List the releases in a collection.
Returns a dict with a 'collection' key, which again has a 'release-list'. | [
"List",
"the",
"releases",
"in",
"a",
"collection",
".",
"Returns",
"a",
"dict",
"with",
"a",
"collection",
"key",
"which",
"again",
"has",
"a",
"release",
"-",
"list",
"."
] | def get_releases_in_collection(collection, limit=None, offset=None):
"""List the releases in a collection.
Returns a dict with a 'collection' key, which again has a 'release-list'.
See `Browsing`_ for how to use `limit` and `offset`.
"""
params = {}
if limit: params["limit"] = limit
if offs... | [
"def",
"get_releases_in_collection",
"(",
"collection",
",",
"limit",
"=",
"None",
",",
"offset",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"limit",
":",
"params",
"[",
"\"limit\"",
"]",
"=",
"limit",
"if",
"offset",
":",
"params",
"[",
"\"... | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/programs/scripts/metadata/Music/musicbrainzngs/musicbrainz.py#L1185-L1194 | |
kungfu-origin/kungfu | 90c84b2b590855654cb9a6395ed050e0f7763512 | core/deps/SQLiteCpp-2.3.0/cpplint.py | python | Search | (pattern, s) | return _regexp_compile_cache[pattern].search(s) | Searches the string for the pattern, caching the compiled regexp. | Searches the string for the pattern, caching the compiled regexp. | [
"Searches",
"the",
"string",
"for",
"the",
"pattern",
"caching",
"the",
"compiled",
"regexp",
"."
] | def Search(pattern, s):
"""Searches the string for the pattern, caching the compiled regexp."""
if pattern not in _regexp_compile_cache:
_regexp_compile_cache[pattern] = sre_compile.compile(pattern)
return _regexp_compile_cache[pattern].search(s) | [
"def",
"Search",
"(",
"pattern",
",",
"s",
")",
":",
"if",
"pattern",
"not",
"in",
"_regexp_compile_cache",
":",
"_regexp_compile_cache",
"[",
"pattern",
"]",
"=",
"sre_compile",
".",
"compile",
"(",
"pattern",
")",
"return",
"_regexp_compile_cache",
"[",
"pat... | https://github.com/kungfu-origin/kungfu/blob/90c84b2b590855654cb9a6395ed050e0f7763512/core/deps/SQLiteCpp-2.3.0/cpplint.py#L531-L535 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/framework/ops.py | python | Graph.colocate_with | (self, op, ignore_existing=False) | Returns a context manager that specifies an op to colocate with.
Note: this function is not for public use, only for internal libraries.
For example:
```python
a = tf.Variable([1.0])
with g.colocate_with(a):
b = tf.constant(1.0)
c = tf.add(a, b)
```
`b` and `c` will always be... | Returns a context manager that specifies an op to colocate with. | [
"Returns",
"a",
"context",
"manager",
"that",
"specifies",
"an",
"op",
"to",
"colocate",
"with",
"."
] | def colocate_with(self, op, ignore_existing=False):
"""Returns a context manager that specifies an op to colocate with.
Note: this function is not for public use, only for internal libraries.
For example:
```python
a = tf.Variable([1.0])
with g.colocate_with(a):
b = tf.constant(1.0)
... | [
"def",
"colocate_with",
"(",
"self",
",",
"op",
",",
"ignore_existing",
"=",
"False",
")",
":",
"if",
"op",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Tried to colocate with None\"",
")",
"if",
"not",
"isinstance",
"(",
"op",
",",
"Operation",
")",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/framework/ops.py#L2873-L2936 | ||
francinexue/xuefu | b6ff79747a42e020588c0c0a921048e08fe4680c | api/stock/histmd/to_mongodb_md/k_min_dao.py | python | KminDbCache._update_cache | (self,collection_name = 'k_data_5',code=None,ktype='5') | return update_one_code(code,collection_name) | :return: 默认更新5分钟线数据,且用一个缓存一个
start='2015-01-01' | :return: 默认更新5分钟线数据,且用一个缓存一个
start='2015-01-01' | [
":",
"return",
":",
"默认更新5分钟线数据,且用一个缓存一个",
"start",
"=",
"2015",
"-",
"01",
"-",
"01"
] | def _update_cache(self,collection_name = 'k_data_5',code=None,ktype='5'):
"""
:return: 默认更新5分钟线数据,且用一个缓存一个
start='2015-01-01'
"""
date_fmt = '%Y-%m-%d %H:%M:%S'
today = ct._TODAY_
client = MongoClient(ct._MONGODB_ENGIN_)
def update_one_code(code,collectio... | [
"def",
"_update_cache",
"(",
"self",
",",
"collection_name",
"=",
"'k_data_5'",
",",
"code",
"=",
"None",
",",
"ktype",
"=",
"'5'",
")",
":",
"date_fmt",
"=",
"'%Y-%m-%d %H:%M:%S'",
"today",
"=",
"ct",
".",
"_TODAY_",
"client",
"=",
"MongoClient",
"(",
"ct... | https://github.com/francinexue/xuefu/blob/b6ff79747a42e020588c0c0a921048e08fe4680c/api/stock/histmd/to_mongodb_md/k_min_dao.py#L50-L83 | |
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/core.py | python | CherryTree.apply_tag_exist_or_create | (self, tag_property, property_value) | return str(tag_name) | Check into the Tags Table whether the Tag Exists, if Not Creates it | Check into the Tags Table whether the Tag Exists, if Not Creates it | [
"Check",
"into",
"the",
"Tags",
"Table",
"whether",
"the",
"Tag",
"Exists",
"if",
"Not",
"Creates",
"it"
] | def apply_tag_exist_or_create(self, tag_property, property_value):
"""Check into the Tags Table whether the Tag Exists, if Not Creates it"""
if property_value == "large": property_value = cons.TAG_PROP_H1
elif property_value == "largo": property_value = cons.TAG_PROP_H2
tag_name = tag_pr... | [
"def",
"apply_tag_exist_or_create",
"(",
"self",
",",
"tag_property",
",",
"property_value",
")",
":",
"if",
"property_value",
"==",
"\"large\"",
":",
"property_value",
"=",
"cons",
".",
"TAG_PROP_H1",
"elif",
"property_value",
"==",
"\"largo\"",
":",
"property_valu... | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/core.py#L4778-L4824 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/closure_linter/closure_linter/statetracker.py | python | StateTracker.HasDocComment | (self, identifier) | return identifier in self._documented_identifiers | Returns whether the identifier has been documented yet.
Args:
identifier: The identifier.
Returns:
Whether the identifier has been documented yet. | Returns whether the identifier has been documented yet. | [
"Returns",
"whether",
"the",
"identifier",
"has",
"been",
"documented",
"yet",
"."
] | def HasDocComment(self, identifier):
"""Returns whether the identifier has been documented yet.
Args:
identifier: The identifier.
Returns:
Whether the identifier has been documented yet.
"""
return identifier in self._documented_identifiers | [
"def",
"HasDocComment",
"(",
"self",
",",
"identifier",
")",
":",
"return",
"identifier",
"in",
"self",
".",
"_documented_identifiers"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/closure_linter/closure_linter/statetracker.py#L762-L771 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/mindrecord/shardsegment.py | python | ShardSegment.read_category_info | (self) | return self._segment.read_category_info() | Get the group info by the current category field.
Returns:
str, description fo group information. | Get the group info by the current category field. | [
"Get",
"the",
"group",
"info",
"by",
"the",
"current",
"category",
"field",
"."
] | def read_category_info(self):
"""
Get the group info by the current category field.
Returns:
str, description fo group information.
"""
return self._segment.read_category_info() | [
"def",
"read_category_info",
"(",
"self",
")",
":",
"return",
"self",
".",
"_segment",
".",
"read_category_info",
"(",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/mindrecord/shardsegment.py#L82-L90 | |
ROCmSoftwarePlatform/rocBLAS | 3738f8b098cdc1db1bdfc164ceb689d073116c98 | scripts/performance/blas/commandrunner.py | python | ArgumentSetABC.collect_timing | (self, run_configuration) | Use a RunConfiguration to find the data files on disk and process them. | Use a RunConfiguration to find the data files on disk and process them. | [
"Use",
"a",
"RunConfiguration",
"to",
"find",
"the",
"data",
"files",
"on",
"disk",
"and",
"process",
"them",
"."
] | def collect_timing(self, run_configuration):
'''Use a RunConfiguration to find the data files on disk and process them.'''
raise NotImplementedError('ArgumentSetABC.collect_timing is meant to be pure virtual') | [
"def",
"collect_timing",
"(",
"self",
",",
"run_configuration",
")",
":",
"raise",
"NotImplementedError",
"(",
"'ArgumentSetABC.collect_timing is meant to be pure virtual'",
")"
] | https://github.com/ROCmSoftwarePlatform/rocBLAS/blob/3738f8b098cdc1db1bdfc164ceb689d073116c98/scripts/performance/blas/commandrunner.py#L320-L322 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILLReduction.py | python | DirectILLReduction.PyInit | (self) | Initialize the algorithm's input and output properties. | Initialize the algorithm's input and output properties. | [
"Initialize",
"the",
"algorithm",
"s",
"input",
"and",
"output",
"properties",
"."
] | def PyInit(self):
"""Initialize the algorithm's input and output properties."""
PROPGROUP_REBINNING = 'Rebinning for SofQW'
inputWorkspaceValidator = CompositeValidator()
inputWorkspaceValidator.add(InstrumentValidator())
inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF'))... | [
"def",
"PyInit",
"(",
"self",
")",
":",
"PROPGROUP_REBINNING",
"=",
"'Rebinning for SofQW'",
"inputWorkspaceValidator",
"=",
"CompositeValidator",
"(",
")",
"inputWorkspaceValidator",
".",
"add",
"(",
"InstrumentValidator",
"(",
")",
")",
"inputWorkspaceValidator",
".",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILLReduction.py#L307-L388 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | MenuBar.IsEnabled | (*args, **kwargs) | return _core_.MenuBar_IsEnabled(*args, **kwargs) | IsEnabled(self, int id) -> bool | IsEnabled(self, int id) -> bool | [
"IsEnabled",
"(",
"self",
"int",
"id",
")",
"-",
">",
"bool"
] | def IsEnabled(*args, **kwargs):
"""IsEnabled(self, int id) -> bool"""
return _core_.MenuBar_IsEnabled(*args, **kwargs) | [
"def",
"IsEnabled",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"MenuBar_IsEnabled",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L12343-L12345 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/Node.py | python | Node.__eq__ | (self, node) | return id(self) == id(node) | Node comparison, based on the IDs | Node comparison, based on the IDs | [
"Node",
"comparison",
"based",
"on",
"the",
"IDs"
] | def __eq__(self, node):
"Node comparison, based on the IDs"
return id(self) == id(node) | [
"def",
"__eq__",
"(",
"self",
",",
"node",
")",
":",
"return",
"id",
"(",
"self",
")",
"==",
"id",
"(",
"node",
")"
] | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Node.py#L138-L140 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/linalg/decomp_lu.py | python | lu_solve | (lu_and_piv, b, trans=0, overwrite_b=False, check_finite=True) | Solve an equation system, a x = b, given the LU factorization of a
Parameters
----------
(lu, piv)
Factorization of the coefficient matrix a, as given by lu_factor
b : array
Right-hand side
trans : {0, 1, 2}, optional
Type of system to solve:
===== =========
... | Solve an equation system, a x = b, given the LU factorization of a | [
"Solve",
"an",
"equation",
"system",
"a",
"x",
"=",
"b",
"given",
"the",
"LU",
"factorization",
"of",
"a"
] | def lu_solve(lu_and_piv, b, trans=0, overwrite_b=False, check_finite=True):
"""Solve an equation system, a x = b, given the LU factorization of a
Parameters
----------
(lu, piv)
Factorization of the coefficient matrix a, as given by lu_factor
b : array
Right-hand side
trans : {0... | [
"def",
"lu_solve",
"(",
"lu_and_piv",
",",
"b",
",",
"trans",
"=",
"0",
",",
"overwrite_b",
"=",
"False",
",",
"check_finite",
"=",
"True",
")",
":",
"(",
"lu",
",",
"piv",
")",
"=",
"lu_and_piv",
"if",
"check_finite",
":",
"b1",
"=",
"asarray_chkfinit... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/linalg/decomp_lu.py#L90-L150 | ||
stan-dev/math | 5fd79f89933269a4ca4d8dd1fde2a36d53d4768c | lib/boost_1.75.0/tools/build/src/util/utility.py | python | split_action_id | (id) | return (toolset, name) | Splits an id in the toolset and specific rule parts. E.g.
'gcc.compile.c++' returns ('gcc', 'compile.c++') | Splits an id in the toolset and specific rule parts. E.g.
'gcc.compile.c++' returns ('gcc', 'compile.c++') | [
"Splits",
"an",
"id",
"in",
"the",
"toolset",
"and",
"specific",
"rule",
"parts",
".",
"E",
".",
"g",
".",
"gcc",
".",
"compile",
".",
"c",
"++",
"returns",
"(",
"gcc",
"compile",
".",
"c",
"++",
")"
] | def split_action_id (id):
""" Splits an id in the toolset and specific rule parts. E.g.
'gcc.compile.c++' returns ('gcc', 'compile.c++')
"""
assert isinstance(id, basestring)
split = id.split ('.', 1)
toolset = split [0]
name = ''
if len (split) > 1:
name = split [1]
retu... | [
"def",
"split_action_id",
"(",
"id",
")",
":",
"assert",
"isinstance",
"(",
"id",
",",
"basestring",
")",
"split",
"=",
"id",
".",
"split",
"(",
"'.'",
",",
"1",
")",
"toolset",
"=",
"split",
"[",
"0",
"]",
"name",
"=",
"''",
"if",
"len",
"(",
"s... | https://github.com/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/lib/boost_1.75.0/tools/build/src/util/utility.py#L141-L151 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.WriteSourcesForArch | (self, ninja_file, config_name, config, sources,
predepends, precompiled_header, spec, arch=None) | return outputs | Write build rules to compile all of |sources|. | Write build rules to compile all of |sources|. | [
"Write",
"build",
"rules",
"to",
"compile",
"all",
"of",
"|sources|",
"."
] | def WriteSourcesForArch(self, ninja_file, config_name, config, sources,
predepends, precompiled_header, spec, arch=None):
"""Write build rules to compile all of |sources|."""
extra_defines = []
if self.flavor == 'mac':
cflags = self.xcode_settings.GetCflags(config_name, arch... | [
"def",
"WriteSourcesForArch",
"(",
"self",
",",
"ninja_file",
",",
"config_name",
",",
"config",
",",
"sources",
",",
"predepends",
",",
"precompiled_header",
",",
"spec",
",",
"arch",
"=",
"None",
")",
":",
"extra_defines",
"=",
"[",
"]",
"if",
"self",
".... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py#L884-L1042 | |
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | Wrapping/Python/paraview/simple.py | python | ResetCameraToDirection | (position, direction, up=None, view=None) | Resets the settings of the camera to the given position and direction | Resets the settings of the camera to the given position and direction | [
"Resets",
"the",
"settings",
"of",
"the",
"camera",
"to",
"the",
"given",
"position",
"and",
"direction"
] | def ResetCameraToDirection(position, direction, up=None, view=None):
"""Resets the settings of the camera to the given position and direction"""
if not view:
view = active_objects.view
if hasattr(view, "CameraFocalPoint"):
view.CameraFocalPoint = position
if hasattr(view, "CameraPosition... | [
"def",
"ResetCameraToDirection",
"(",
"position",
",",
"direction",
",",
"up",
"=",
"None",
",",
"view",
"=",
"None",
")",
":",
"if",
"not",
"view",
":",
"view",
"=",
"active_objects",
".",
"view",
"if",
"hasattr",
"(",
"view",
",",
"\"CameraFocalPoint\"",... | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Wrapping/Python/paraview/simple.py#L361-L372 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Platform/virtualenv.py | python | _inject_venv_path | (env, path_list=None) | Modify environment such that SCons will take into account its virtualenv
when running external tools. | Modify environment such that SCons will take into account its virtualenv
when running external tools. | [
"Modify",
"environment",
"such",
"that",
"SCons",
"will",
"take",
"into",
"account",
"its",
"virtualenv",
"when",
"running",
"external",
"tools",
"."
] | def _inject_venv_path(env, path_list=None):
"""Modify environment such that SCons will take into account its virtualenv
when running external tools."""
if path_list is None:
path_list = os.getenv('PATH')
env.PrependENVPath('PATH', select_paths_in_venv(path_list)) | [
"def",
"_inject_venv_path",
"(",
"env",
",",
"path_list",
"=",
"None",
")",
":",
"if",
"path_list",
"is",
"None",
":",
"path_list",
"=",
"os",
".",
"getenv",
"(",
"'PATH'",
")",
"env",
".",
"PrependENVPath",
"(",
"'PATH'",
",",
"select_paths_in_venv",
"(",... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Platform/virtualenv.py#L77-L82 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/kms/layer1.py | python | KMSConnection.revoke_grant | (self, key_id, grant_id) | return self.make_request(action='RevokeGrant',
body=json.dumps(params)) | Revokes a grant. You can revoke a grant to actively deny
operations that depend on it.
:type key_id: string
:param key_id: Unique identifier of the key associated with the grant.
:type grant_id: string
:param grant_id: Identifier of the grant to be revoked. | Revokes a grant. You can revoke a grant to actively deny
operations that depend on it. | [
"Revokes",
"a",
"grant",
".",
"You",
"can",
"revoke",
"a",
"grant",
"to",
"actively",
"deny",
"operations",
"that",
"depend",
"on",
"it",
"."
] | def revoke_grant(self, key_id, grant_id):
"""
Revokes a grant. You can revoke a grant to actively deny
operations that depend on it.
:type key_id: string
:param key_id: Unique identifier of the key associated with the grant.
:type grant_id: string
:param grant_i... | [
"def",
"revoke_grant",
"(",
"self",
",",
"key_id",
",",
"grant_id",
")",
":",
"params",
"=",
"{",
"'KeyId'",
":",
"key_id",
",",
"'GrantId'",
":",
"grant_id",
",",
"}",
"return",
"self",
".",
"make_request",
"(",
"action",
"=",
"'RevokeGrant'",
",",
"bod... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/kms/layer1.py#L767-L781 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/tempfile.py | python | _get_default_tempdir | () | Calculate the default directory to use for temporary files.
This routine should be called exactly once.
We determine whether or not a candidate temp dir is usable by
trying to create and write to a file in that directory. If this
is successful, the test file is deleted. To prevent denial of
servi... | Calculate the default directory to use for temporary files.
This routine should be called exactly once. | [
"Calculate",
"the",
"default",
"directory",
"to",
"use",
"for",
"temporary",
"files",
".",
"This",
"routine",
"should",
"be",
"called",
"exactly",
"once",
"."
] | def _get_default_tempdir():
"""Calculate the default directory to use for temporary files.
This routine should be called exactly once.
We determine whether or not a candidate temp dir is usable by
trying to create and write to a file in that directory. If this
is successful, the test file is delet... | [
"def",
"_get_default_tempdir",
"(",
")",
":",
"namer",
"=",
"_RandomNameSequence",
"(",
")",
"dirlist",
"=",
"_candidate_tempdir_list",
"(",
")",
"for",
"dir",
"in",
"dirlist",
":",
"if",
"dir",
"!=",
"_os",
".",
"curdir",
":",
"dir",
"=",
"_os",
".",
"p... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tempfile.py#L186-L229 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/interpolate/interpolate.py | python | PPoly.roots | (self, discontinuity=True, extrapolate=None) | return self.solve(0, discontinuity, extrapolate) | Find real roots of the the piecewise polynomial.
Parameters
----------
discontinuity : bool, optional
Whether to report sign changes across discontinuities at
breakpoints as roots.
extrapolate : {bool, 'periodic', None}, optional
If bool, determines w... | Find real roots of the the piecewise polynomial. | [
"Find",
"real",
"roots",
"of",
"the",
"the",
"piecewise",
"polynomial",
"."
] | def roots(self, discontinuity=True, extrapolate=None):
"""
Find real roots of the the piecewise polynomial.
Parameters
----------
discontinuity : bool, optional
Whether to report sign changes across discontinuities at
breakpoints as roots.
extrapo... | [
"def",
"roots",
"(",
"self",
",",
"discontinuity",
"=",
"True",
",",
"extrapolate",
"=",
"None",
")",
":",
"return",
"self",
".",
"solve",
"(",
"0",
",",
"discontinuity",
",",
"extrapolate",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/interpolate/interpolate.py#L1242-L1269 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/lowest-common-ancestor-of-a-binary-tree-iii.py | python | Solution.lowestCommonAncestor | (self, p, q) | return a | :type node: Node
:rtype: Node | :type node: Node
:rtype: Node | [
":",
"type",
"node",
":",
"Node",
":",
"rtype",
":",
"Node"
] | def lowestCommonAncestor(self, p, q):
"""
:type node: Node
:rtype: Node
"""
a, b = p, q
while a != b:
a = a.parent if a else q
b = b.parent if b else p
return a | [
"def",
"lowestCommonAncestor",
"(",
"self",
",",
"p",
",",
"q",
")",
":",
"a",
",",
"b",
"=",
"p",
",",
"q",
"while",
"a",
"!=",
"b",
":",
"a",
"=",
"a",
".",
"parent",
"if",
"a",
"else",
"q",
"b",
"=",
"b",
".",
"parent",
"if",
"b",
"else"... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/lowest-common-ancestor-of-a-binary-tree-iii.py#L10-L19 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/masking-personal-information.py | python | Solution.maskPII | (self, S) | return "+{}-{}".format('*' * (len(digits) - 10), local) | :type S: str
:rtype: str | :type S: str
:rtype: str | [
":",
"type",
"S",
":",
"str",
":",
"rtype",
":",
"str"
] | def maskPII(self, S):
"""
:type S: str
:rtype: str
"""
if '@' in S:
first, after = S.split('@')
return "{}*****{}@{}".format(first[0], first[-1], after).lower()
digits = filter(lambda x: x.isdigit(), S)
local = "***-***-{}".format(digits[-... | [
"def",
"maskPII",
"(",
"self",
",",
"S",
")",
":",
"if",
"'@'",
"in",
"S",
":",
"first",
",",
"after",
"=",
"S",
".",
"split",
"(",
"'@'",
")",
"return",
"\"{}*****{}@{}\"",
".",
"format",
"(",
"first",
"[",
"0",
"]",
",",
"first",
"[",
"-",
"1... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/masking-personal-information.py#L5-L18 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/aui.py | python | AuiToolBarItem.Assign | (*args, **kwargs) | return _aui.AuiToolBarItem_Assign(*args, **kwargs) | Assign(self, AuiToolBarItem c) | Assign(self, AuiToolBarItem c) | [
"Assign",
"(",
"self",
"AuiToolBarItem",
"c",
")"
] | def Assign(*args, **kwargs):
"""Assign(self, AuiToolBarItem c)"""
return _aui.AuiToolBarItem_Assign(*args, **kwargs) | [
"def",
"Assign",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiToolBarItem_Assign",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/aui.py#L1725-L1727 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/dirichlet.py | python | Dirichlet.get_event_shape | (self) | return self._get_event_shape | `TensorShape` available at graph construction time.
Same meaning as `event_shape`. May be only partially defined.
Returns:
event shape | `TensorShape` available at graph construction time. | [
"TensorShape",
"available",
"at",
"graph",
"construction",
"time",
"."
] | def get_event_shape(self):
"""`TensorShape` available at graph construction time.
Same meaning as `event_shape`. May be only partially defined.
Returns:
event shape
"""
return self._get_event_shape | [
"def",
"get_event_shape",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_event_shape"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/dirichlet.py#L221-L229 | |
alexgkendall/caffe-segnet | 344c113bf1832886f1cbe9f33ffe28a3beeaf412 | scripts/cpp_lint.py | python | RemoveMultiLineCommentsFromRange | (lines, begin, end) | Clears a range of lines for multi-line comments. | Clears a range of lines for multi-line comments. | [
"Clears",
"a",
"range",
"of",
"lines",
"for",
"multi",
"-",
"line",
"comments",
"."
] | def RemoveMultiLineCommentsFromRange(lines, begin, end):
"""Clears a range of lines for multi-line comments."""
# Having // dummy comments makes the lines non-empty, so we will not get
# unnecessary blank line warnings later in the code.
for i in range(begin, end):
lines[i] = '// dummy' | [
"def",
"RemoveMultiLineCommentsFromRange",
"(",
"lines",
",",
"begin",
",",
"end",
")",
":",
"# Having // dummy comments makes the lines non-empty, so we will not get",
"# unnecessary blank line warnings later in the code.",
"for",
"i",
"in",
"range",
"(",
"begin",
",",
"end",
... | https://github.com/alexgkendall/caffe-segnet/blob/344c113bf1832886f1cbe9f33ffe28a3beeaf412/scripts/cpp_lint.py#L1143-L1148 | ||
schwehr/libais | 1e19605942c8e155cd02fde6d1acde75ecd15d75 | third_party/gmock/scripts/upload.py | python | SubversionVCS._CollapseKeywords | (self, content, keyword_str) | return re.sub(r"\$(%s):(:?)([^\$]+)\$" % '|'.join(keywords), repl, content) | Collapses SVN keywords. | Collapses SVN keywords. | [
"Collapses",
"SVN",
"keywords",
"."
] | def _CollapseKeywords(self, content, keyword_str):
"""Collapses SVN keywords."""
# svn cat translates keywords but svn diff doesn't. As a result of this
# behavior patching.PatchChunks() fails with a chunk mismatch error.
# This part was originally written by the Review Board development team
# who ... | [
"def",
"_CollapseKeywords",
"(",
"self",
",",
"content",
",",
"keyword_str",
")",
":",
"# svn cat translates keywords but svn diff doesn't. As a result of this",
"# behavior patching.PatchChunks() fails with a chunk mismatch error.",
"# This part was originally written by the Review Board de... | https://github.com/schwehr/libais/blob/1e19605942c8e155cd02fde6d1acde75ecd15d75/third_party/gmock/scripts/upload.py#L805-L834 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/tools/gyp/pylib/gyp/generator/cmake.py | python | CreateCMakeTargetBaseName | (qualified_target) | return StringToCMakeTargetName(cmake_target_base_name) | This is the name we would like the target to have. | This is the name we would like the target to have. | [
"This",
"is",
"the",
"name",
"we",
"would",
"like",
"the",
"target",
"to",
"have",
"."
] | def CreateCMakeTargetBaseName(qualified_target):
"""This is the name we would like the target to have."""
_, gyp_target_name, gyp_target_toolset = (
gyp.common.ParseQualifiedTarget(qualified_target))
cmake_target_base_name = gyp_target_name
if gyp_target_toolset and gyp_target_toolset != 'target':
cma... | [
"def",
"CreateCMakeTargetBaseName",
"(",
"qualified_target",
")",
":",
"_",
",",
"gyp_target_name",
",",
"gyp_target_toolset",
"=",
"(",
"gyp",
".",
"common",
".",
"ParseQualifiedTarget",
"(",
"qualified_target",
")",
")",
"cmake_target_base_name",
"=",
"gyp_target_na... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/tools/gyp/pylib/gyp/generator/cmake.py#L552-L559 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/util/proxy.py | python | connection_requires_http_tunnel | (
proxy_url=None, proxy_config=None, destination_scheme=None
) | return True | Returns True if the connection requires an HTTP CONNECT through the proxy.
:param URL proxy_url:
URL of the proxy.
:param ProxyConfig proxy_config:
Proxy configuration from poolmanager.py
:param str destination_scheme:
The scheme of the destination. (i.e https, http, etc) | Returns True if the connection requires an HTTP CONNECT through the proxy. | [
"Returns",
"True",
"if",
"the",
"connection",
"requires",
"an",
"HTTP",
"CONNECT",
"through",
"the",
"proxy",
"."
] | def connection_requires_http_tunnel(
proxy_url=None, proxy_config=None, destination_scheme=None
):
"""
Returns True if the connection requires an HTTP CONNECT through the proxy.
:param URL proxy_url:
URL of the proxy.
:param ProxyConfig proxy_config:
Proxy configuration from poolman... | [
"def",
"connection_requires_http_tunnel",
"(",
"proxy_url",
"=",
"None",
",",
"proxy_config",
"=",
"None",
",",
"destination_scheme",
"=",
"None",
")",
":",
"# If we're not using a proxy, no way to use a tunnel.",
"if",
"proxy_url",
"is",
"None",
":",
"return",
"False",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/util/proxy.py#L4-L34 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | webkit/support/setup_third_party.py | python | TryToMakeDir | (dir_name) | Create the directory dir_name if it doesn't exist. | Create the directory dir_name if it doesn't exist. | [
"Create",
"the",
"directory",
"dir_name",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | def TryToMakeDir(dir_name):
"""Create the directory dir_name if it doesn't exist."""
try:
os.makedirs(dir_name)
except OSError, e:
if e.errno != errno.EEXIST:
raise e | [
"def",
"TryToMakeDir",
"(",
"dir_name",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"dir_name",
")",
"except",
"OSError",
",",
"e",
":",
"if",
"e",
".",
"errno",
"!=",
"errno",
".",
"EEXIST",
":",
"raise",
"e"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/webkit/support/setup_third_party.py#L81-L87 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/plot.py | python | PlotCanvas.Printout | (self, paper=None) | Print current plot. | Print current plot. | [
"Print",
"current",
"plot",
"."
] | def Printout(self, paper=None):
"""Print current plot."""
if paper != None:
self.print_data.SetPaperId(paper)
pdd = wx.PrintDialogData(self.print_data)
printer = wx.Printer(pdd)
out = PlotPrintout(self)
print_ok = printer.Print(self.parent, out)
if pri... | [
"def",
"Printout",
"(",
"self",
",",
"paper",
"=",
"None",
")",
":",
"if",
"paper",
"!=",
"None",
":",
"self",
".",
"print_data",
".",
"SetPaperId",
"(",
"paper",
")",
"pdd",
"=",
"wx",
".",
"PrintDialogData",
"(",
"self",
".",
"print_data",
")",
"pr... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/plot.py#L777-L788 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/ragged/ragged_shape.py | python | _get_layer_broadcasters_from_rps | (zero_broadcaster, source_rps, target_rps) | return [zero_broadcaster] + tail_broadcasters | Get LayerBroadcasters from RowPartitions.
*--zero_broadcaster->*
| |
source_rps[0] target_rps[0]
| |
V V
*---result[1]------->*
| |
source_rps[1] targe... | Get LayerBroadcasters from RowPartitions. | [
"Get",
"LayerBroadcasters",
"from",
"RowPartitions",
"."
] | def _get_layer_broadcasters_from_rps(zero_broadcaster, source_rps, target_rps):
"""Get LayerBroadcasters from RowPartitions.
*--zero_broadcaster->*
| |
source_rps[0] target_rps[0]
| |
V V
*---... | [
"def",
"_get_layer_broadcasters_from_rps",
"(",
"zero_broadcaster",
",",
"source_rps",
",",
"target_rps",
")",
":",
"if",
"not",
"isinstance",
"(",
"zero_broadcaster",
",",
"_LayerBroadcaster",
")",
":",
"raise",
"TypeError",
"(",
"\"Not a _LayerBroadcaster: \"",
"+",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/ragged/ragged_shape.py#L1375-L1419 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/android/pylib/cmd_helper.py | python | RunCmd | (args, cwd=None) | return Call(args, cwd=cwd) | Opens a subprocess to execute a program and returns its return value.
Args:
args: A string or a sequence of program arguments. The program to execute is
the string or the first item in the args sequence.
cwd: If not None, the subprocess's current directory will be changed to
|cwd| before it's exe... | Opens a subprocess to execute a program and returns its return value. | [
"Opens",
"a",
"subprocess",
"to",
"execute",
"a",
"program",
"and",
"returns",
"its",
"return",
"value",
"."
] | def RunCmd(args, cwd=None):
"""Opens a subprocess to execute a program and returns its return value.
Args:
args: A string or a sequence of program arguments. The program to execute is
the string or the first item in the args sequence.
cwd: If not None, the subprocess's current directory will be chang... | [
"def",
"RunCmd",
"(",
"args",
",",
"cwd",
"=",
"None",
")",
":",
"logging",
".",
"info",
"(",
"str",
"(",
"args",
")",
"+",
"' '",
"+",
"(",
"cwd",
"or",
"''",
")",
")",
"return",
"Call",
"(",
"args",
",",
"cwd",
"=",
"cwd",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/android/pylib/cmd_helper.py#L30-L43 | |
stellar-deprecated/stellard | 67eabb2217bdfa9a6ea317f62338fb6bca458c90 | src/protobuf/python/google/protobuf/internal/cpp_message.py | python | NewMessage | (bases, message_descriptor, dictionary) | return bases | Creates a new protocol message *class*. | Creates a new protocol message *class*. | [
"Creates",
"a",
"new",
"protocol",
"message",
"*",
"class",
"*",
"."
] | def NewMessage(bases, message_descriptor, dictionary):
"""Creates a new protocol message *class*."""
_AddClassAttributesForNestedExtensions(message_descriptor, dictionary)
_AddEnumValues(message_descriptor, dictionary)
_AddDescriptors(message_descriptor, dictionary)
return bases | [
"def",
"NewMessage",
"(",
"bases",
",",
"message_descriptor",
",",
"dictionary",
")",
":",
"_AddClassAttributesForNestedExtensions",
"(",
"message_descriptor",
",",
"dictionary",
")",
"_AddEnumValues",
"(",
"message_descriptor",
",",
"dictionary",
")",
"_AddDescriptors",
... | https://github.com/stellar-deprecated/stellard/blob/67eabb2217bdfa9a6ea317f62338fb6bca458c90/src/protobuf/python/google/protobuf/internal/cpp_message.py#L374-L379 | |
hakuna-m/wubiuefi | caec1af0a09c78fd5a345180ada1fe45e0c63493 | src/openpgp/sap/crypto.py | python | pad_rsa | (alg_hash, hashed_msg, rsa_n_bit_length) | return ''.join(['\x00\x01', padding, '\x00', prefix, hashed_msg]) | Pad RSA signature hashed data with "full hash prefixes".
:Parameters:
- `alg_hash`: integer hash algorithm constant
- `hashed_msg`: string of [already] hashed data
- `rsa_n_bit_length`: integer RSA MPI "n" bit length
:Returns: string hashed data padded according to rfc2440 5.2.2. | Pad RSA signature hashed data with "full hash prefixes". | [
"Pad",
"RSA",
"signature",
"hashed",
"data",
"with",
"full",
"hash",
"prefixes",
"."
] | def pad_rsa(alg_hash, hashed_msg, rsa_n_bit_length):
"""Pad RSA signature hashed data with "full hash prefixes".
:Parameters:
- `alg_hash`: integer hash algorithm constant
- `hashed_msg`: string of [already] hashed data
- `rsa_n_bit_length`: integer RSA MPI "n" bit length
:Retu... | [
"def",
"pad_rsa",
"(",
"alg_hash",
",",
"hashed_msg",
",",
"rsa_n_bit_length",
")",
":",
"# \"full hash prefixes\"",
"if",
"HASH_MD5",
"==",
"alg_hash",
":",
"prefix",
"=",
"'\\x30\\x20\\x30\\x0C\\x06\\x08\\x2A\\x86\\x48\\x86\\xF7\\x0D\\x02\\x05\\x05\\x00\\x04\\x10'",
"elif",
... | https://github.com/hakuna-m/wubiuefi/blob/caec1af0a09c78fd5a345180ada1fe45e0c63493/src/openpgp/sap/crypto.py#L192-L219 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/contrib/onnx/onnx2mx/_op_translations.py | python | softplus | (attrs, inputs, proto_obj) | return 'Activation', new_attrs, inputs | Applies the sofplus activation function element-wise to the input. | Applies the sofplus activation function element-wise to the input. | [
"Applies",
"the",
"sofplus",
"activation",
"function",
"element",
"-",
"wise",
"to",
"the",
"input",
"."
] | def softplus(attrs, inputs, proto_obj):
"""Applies the sofplus activation function element-wise to the input."""
new_attrs = translation_utils._add_extra_attributes(attrs, {'act_type' : 'softrelu'})
return 'Activation', new_attrs, inputs | [
"def",
"softplus",
"(",
"attrs",
",",
"inputs",
",",
"proto_obj",
")",
":",
"new_attrs",
"=",
"translation_utils",
".",
"_add_extra_attributes",
"(",
"attrs",
",",
"{",
"'act_type'",
":",
"'softrelu'",
"}",
")",
"return",
"'Activation'",
",",
"new_attrs",
",",... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/contrib/onnx/onnx2mx/_op_translations.py#L312-L315 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/transpiler/collective.py | python | MultiThread._insert_allgather_ops | (self) | insert allgather op to the main_program | insert allgather op to the main_program | [
"insert",
"allgather",
"op",
"to",
"the",
"main_program"
] | def _insert_allgather_ops(self):
"""
insert allgather op to the main_program
"""
block = self.main_program.global_block()
ring_id = -1
grad = None
for idx, op in reversed(list(enumerate(block.ops))):
if self._is_backward_op(op) and \
... | [
"def",
"_insert_allgather_ops",
"(",
"self",
")",
":",
"block",
"=",
"self",
".",
"main_program",
".",
"global_block",
"(",
")",
"ring_id",
"=",
"-",
"1",
"grad",
"=",
"None",
"for",
"idx",
",",
"op",
"in",
"reversed",
"(",
"list",
"(",
"enumerate",
"(... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/transpiler/collective.py#L483-L550 | ||
mhammond/pywin32 | 44afd86ba8485194df93234639243252deeb40d5 | com/win32comext/adsi/demos/scp.py | python | do_ScpDelete | (po) | return sc | Delete a Service Connection Point | Delete a Service Connection Point | [
"Delete",
"a",
"Service",
"Connection",
"Point"
] | def do_ScpDelete(po):
"""Delete a Service Connection Point"""
sc = _get_option(po, "service_class")
try:
ScpDelete(sc)
except adsi.error as details:
if details[0] != winerror.ERROR_DS_OBJ_NOT_FOUND:
raise
log(2, "ScpDelete ignoring ERROR_DS_OBJ_NOT_FOUND for service-c... | [
"def",
"do_ScpDelete",
"(",
"po",
")",
":",
"sc",
"=",
"_get_option",
"(",
"po",
",",
"\"service_class\"",
")",
"try",
":",
"ScpDelete",
"(",
"sc",
")",
"except",
"adsi",
".",
"error",
"as",
"details",
":",
"if",
"details",
"[",
"0",
"]",
"!=",
"wine... | https://github.com/mhammond/pywin32/blob/44afd86ba8485194df93234639243252deeb40d5/com/win32comext/adsi/demos/scp.py#L302-L311 | |
troldal/OpenXLSX | 3eb9c748e3ecd865203fb9946ea86d3c02b3f7d9 | Benchmarks/gbench/tools/strip_asm.py | python | process_asm | (asm) | return new_contents | Strip the ASM of unwanted directives and lines | Strip the ASM of unwanted directives and lines | [
"Strip",
"the",
"ASM",
"of",
"unwanted",
"directives",
"and",
"lines"
] | def process_asm(asm):
"""
Strip the ASM of unwanted directives and lines
"""
new_contents = ''
asm = transform_labels(asm)
# TODO: Add more things we want to remove
discard_regexes = [
re.compile("\s+\..*$"), # directive
re.compile("\s*#(NO_APP|APP)$"), #inline ASM
r... | [
"def",
"process_asm",
"(",
"asm",
")",
":",
"new_contents",
"=",
"''",
"asm",
"=",
"transform_labels",
"(",
"asm",
")",
"# TODO: Add more things we want to remove",
"discard_regexes",
"=",
"[",
"re",
".",
"compile",
"(",
"\"\\s+\\..*$\"",
")",
",",
"# directive",
... | https://github.com/troldal/OpenXLSX/blob/3eb9c748e3ecd865203fb9946ea86d3c02b3f7d9/Benchmarks/gbench/tools/strip_asm.py#L84-L121 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBValue.GetDisplayTypeName | (self) | return _lldb.SBValue_GetDisplayTypeName(self) | GetDisplayTypeName(self) -> str | GetDisplayTypeName(self) -> str | [
"GetDisplayTypeName",
"(",
"self",
")",
"-",
">",
"str"
] | def GetDisplayTypeName(self):
"""GetDisplayTypeName(self) -> str"""
return _lldb.SBValue_GetDisplayTypeName(self) | [
"def",
"GetDisplayTypeName",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBValue_GetDisplayTypeName",
"(",
"self",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L11815-L11817 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | benchmarks/sparse/dlmc/utils.py | python | load_spmm_dataset | (dataset_path, hidden_size, sparsity, spmm_type, device, n_limit=math.inf) | load_spmm_dataset loads a DLMC dataset for a sparse matrix-matrix multiplication (SPMM) performance test.
Args:
dataset_path:
path of the dataset from DLMC collection.
hidden_size
This value allows tensors of varying sizes.
sparsity:
This value allows tens... | load_spmm_dataset loads a DLMC dataset for a sparse matrix-matrix multiplication (SPMM) performance test.
Args:
dataset_path:
path of the dataset from DLMC collection.
hidden_size
This value allows tensors of varying sizes.
sparsity:
This value allows tens... | [
"load_spmm_dataset",
"loads",
"a",
"DLMC",
"dataset",
"for",
"a",
"sparse",
"matrix",
"-",
"matrix",
"multiplication",
"(",
"SPMM",
")",
"performance",
"test",
".",
"Args",
":",
"dataset_path",
":",
"path",
"of",
"the",
"dataset",
"from",
"DLMC",
"collection",... | def load_spmm_dataset(dataset_path, hidden_size, sparsity, spmm_type, device, n_limit=math.inf):
"""load_spmm_dataset loads a DLMC dataset for a sparse matrix-matrix multiplication (SPMM) performance test.
Args:
dataset_path:
path of the dataset from DLMC collection.
hidden_size
... | [
"def",
"load_spmm_dataset",
"(",
"dataset_path",
",",
"hidden_size",
",",
"sparsity",
",",
"spmm_type",
",",
"device",
",",
"n_limit",
"=",
"math",
".",
"inf",
")",
":",
"current_folder_path",
"=",
"f\"{dataset_path}/{sparsity}\"",
"path",
"=",
"Path",
"(",
"cur... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/benchmarks/sparse/dlmc/utils.py#L107-L144 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/xml/sax/xmlreader.py | python | IncrementalParser.feed | (self, data) | This method gives the raw XML data in the data parameter to
the parser and makes it parse the data, emitting the
corresponding events. It is allowed for XML constructs to be
split across several calls to feed.
feed may raise SAXException. | This method gives the raw XML data in the data parameter to
the parser and makes it parse the data, emitting the
corresponding events. It is allowed for XML constructs to be
split across several calls to feed. | [
"This",
"method",
"gives",
"the",
"raw",
"XML",
"data",
"in",
"the",
"data",
"parameter",
"to",
"the",
"parser",
"and",
"makes",
"it",
"parse",
"the",
"data",
"emitting",
"the",
"corresponding",
"events",
".",
"It",
"is",
"allowed",
"for",
"XML",
"construc... | def feed(self, data):
"""This method gives the raw XML data in the data parameter to
the parser and makes it parse the data, emitting the
corresponding events. It is allowed for XML constructs to be
split across several calls to feed.
feed may raise SAXException."""
rais... | [
"def",
"feed",
"(",
"self",
",",
"data",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"This method must be implemented!\"",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/xml/sax/xmlreader.py#L127-L134 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/eclib/platebtn.py | python | PlateButton.__InitColors | (self) | return colors | Initialize the default colors | Initialize the default colors | [
"Initialize",
"the",
"default",
"colors"
] | def __InitColors(self):
"""Initialize the default colors"""
color = GetHighlightColour()
pcolor = AdjustColour(color, -12)
colors = dict(default=True,
hlight=color,
press=pcolor,
htxt=BestLabelColour(self.GetForegroundCol... | [
"def",
"__InitColors",
"(",
"self",
")",
":",
"color",
"=",
"GetHighlightColour",
"(",
")",
"pcolor",
"=",
"AdjustColour",
"(",
"color",
",",
"-",
"12",
")",
"colors",
"=",
"dict",
"(",
"default",
"=",
"True",
",",
"hlight",
"=",
"color",
",",
"press",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/eclib/platebtn.py#L320-L328 | |
v8mips/v8mips | f0c9cc0bbfd461c7f516799d9a58e9a7395f737e | tools/stats-viewer.py | python | ChromeCounterCollection.CountersInUse | (self) | return self.max_counters | Return the number of counters in active use. | Return the number of counters in active use. | [
"Return",
"the",
"number",
"of",
"counters",
"in",
"active",
"use",
"."
] | def CountersInUse(self):
"""Return the number of counters in active use."""
for i in xrange(self.max_counters):
name_offset = self.counter_names_offset + i * self._COUNTER_NAME_SIZE
if self.data.ByteAt(name_offset) == 0:
return i
return self.max_counters | [
"def",
"CountersInUse",
"(",
"self",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"self",
".",
"max_counters",
")",
":",
"name_offset",
"=",
"self",
".",
"counter_names_offset",
"+",
"i",
"*",
"self",
".",
"_COUNTER_NAME_SIZE",
"if",
"self",
".",
"data",
"... | https://github.com/v8mips/v8mips/blob/f0c9cc0bbfd461c7f516799d9a58e9a7395f737e/tools/stats-viewer.py#L436-L442 | |
microsoft/EdgeML | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | examples/pytorch/vision/Face_Detection/models/RPool_Face_C.py | python | S3FD.__init__ | (self, phase, base, head, num_classes) | self.priorbox = PriorBox(size,cfg)
self.priors = Variable(self.priorbox.forward(), volatile=True) | self.priorbox = PriorBox(size,cfg)
self.priors = Variable(self.priorbox.forward(), volatile=True) | [
"self",
".",
"priorbox",
"=",
"PriorBox",
"(",
"size",
"cfg",
")",
"self",
".",
"priors",
"=",
"Variable",
"(",
"self",
".",
"priorbox",
".",
"forward",
"()",
"volatile",
"=",
"True",
")"
] | def __init__(self, phase, base, head, num_classes):
super(S3FD, self).__init__()
self.phase = phase
self.num_classes = num_classes
'''
self.priorbox = PriorBox(size,cfg)
self.priors = Variable(self.priorbox.forward(), volatile=True)
'''
# SSD network
... | [
"def",
"__init__",
"(",
"self",
",",
"phase",
",",
"base",
",",
"head",
",",
"num_classes",
")",
":",
"super",
"(",
"S3FD",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"phase",
"=",
"phase",
"self",
".",
"num_classes",
"=",
"num_classes... | https://github.com/microsoft/EdgeML/blob/ef9f8a77f096acbdeb941014791f8eda1c1bc35b/examples/pytorch/vision/Face_Detection/models/RPool_Face_C.py#L39-L64 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/plot.py | python | PolyLine.getSymExtent | (self, printerScale) | return (w, h) | Width and Height of Marker | Width and Height of Marker | [
"Width",
"and",
"Height",
"of",
"Marker"
] | def getSymExtent(self, printerScale):
"""Width and Height of Marker"""
h = self.attributes['width'] * printerScale * self._pointSize[0]
w = 5 * h
return (w, h) | [
"def",
"getSymExtent",
"(",
"self",
",",
"printerScale",
")",
":",
"h",
"=",
"self",
".",
"attributes",
"[",
"'width'",
"]",
"*",
"printerScale",
"*",
"self",
".",
"_pointSize",
"[",
"0",
"]",
"w",
"=",
"5",
"*",
"h",
"return",
"(",
"w",
",",
"h",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/plot.py#L264-L268 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/utils/lui/lldbutil.py | python | get_FPRs | (frame) | return get_registers(frame, "floating point") | Returns the floating point registers of the frame as an SBValue.
The returned SBValue object is iterable. An example:
...
from lldbutil import get_FPRs
regs = get_FPRs(frame)
for reg in regs:
print "%s => %s" % (reg.GetName(), reg.GetValue())
... | Returns the floating point registers of the frame as an SBValue. | [
"Returns",
"the",
"floating",
"point",
"registers",
"of",
"the",
"frame",
"as",
"an",
"SBValue",
"."
] | def get_FPRs(frame):
"""Returns the floating point registers of the frame as an SBValue.
The returned SBValue object is iterable. An example:
...
from lldbutil import get_FPRs
regs = get_FPRs(frame)
for reg in regs:
print "%s => %s" % (reg.GetName(), reg.GetValue())... | [
"def",
"get_FPRs",
"(",
"frame",
")",
":",
"return",
"get_registers",
"(",
"frame",
",",
"\"floating point\"",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/utils/lui/lldbutil.py#L927-L938 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/image/detection.py | python | ImageDetIter.reshape | (self, data_shape=None, label_shape=None) | Reshape iterator for data_shape or label_shape.
Parameters
----------
data_shape : tuple or None
Reshape the data_shape to the new shape if not None
label_shape : tuple or None
Reshape label shape to new shape if not None | Reshape iterator for data_shape or label_shape. | [
"Reshape",
"iterator",
"for",
"data_shape",
"or",
"label_shape",
"."
] | def reshape(self, data_shape=None, label_shape=None):
"""Reshape iterator for data_shape or label_shape.
Parameters
----------
data_shape : tuple or None
Reshape the data_shape to the new shape if not None
label_shape : tuple or None
Reshape label shape t... | [
"def",
"reshape",
"(",
"self",
",",
"data_shape",
"=",
"None",
",",
"label_shape",
"=",
"None",
")",
":",
"if",
"data_shape",
"is",
"not",
"None",
":",
"self",
".",
"check_data_shape",
"(",
"data_shape",
")",
"self",
".",
"provide_data",
"=",
"[",
"(",
... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/image/detection.py#L743-L760 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.