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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
baidu/AnyQ | d94d450d2aaa5f7ed73424b10aa4539835b97527 | tools/common/utils.py | python | import_class | (module_path, module_name, class_name) | return getattr(module, class_name) | Load class dynamically
Args:
module_path: The current path of the module
module_name: The module name
class_name: The name of class in the import module
Return:
Return the attribute value of the class object | Load class dynamically
Args:
module_path: The current path of the module
module_name: The module name
class_name: The name of class in the import module
Return:
Return the attribute value of the class object | [
"Load",
"class",
"dynamically",
"Args",
":",
"module_path",
":",
"The",
"current",
"path",
"of",
"the",
"module",
"module_name",
":",
"The",
"module",
"name",
"class_name",
":",
"The",
"name",
"of",
"class",
"in",
"the",
"import",
"module",
"Return",
":",
... | def import_class(module_path, module_name, class_name):
"""
Load class dynamically
Args:
module_path: The current path of the module
module_name: The module name
class_name: The name of class in the import module
Return:
Return the attribute value of the class object
"""
... | [
"def",
"import_class",
"(",
"module_path",
",",
"module_name",
",",
"class_name",
")",
":",
"if",
"module_path",
":",
"sys",
".",
"path",
".",
"append",
"(",
"module_path",
")",
"module",
"=",
"__import__",
"(",
"module_name",
")",
"return",
"getattr",
"(",
... | https://github.com/baidu/AnyQ/blob/d94d450d2aaa5f7ed73424b10aa4539835b97527/tools/common/utils.py#L142-L155 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/converters/mil/backend/nn/passes/mlmodel_passes.py | python | transform_conv_crop | (spec) | Transforms Conv -> Crop -> BN (if present) -> Activation (if present) into
Conv -> BN (if present) -> Activation (if present) -> Crop
This transformation will allow Conv -> BN -> Activation fusion by changing
the position of the crop layer, which does not affect the computation | Transforms Conv -> Crop -> BN (if present) -> Activation (if present) into
Conv -> BN (if present) -> Activation (if present) -> Crop
This transformation will allow Conv -> BN -> Activation fusion by changing
the position of the crop layer, which does not affect the computation | [
"Transforms",
"Conv",
"-",
">",
"Crop",
"-",
">",
"BN",
"(",
"if",
"present",
")",
"-",
">",
"Activation",
"(",
"if",
"present",
")",
"into",
"Conv",
"-",
">",
"BN",
"(",
"if",
"present",
")",
"-",
">",
"Activation",
"(",
"if",
"present",
")",
"-... | def transform_conv_crop(spec):
"""
Transforms Conv -> Crop -> BN (if present) -> Activation (if present) into
Conv -> BN (if present) -> Activation (if present) -> Crop
This transformation will allow Conv -> BN -> Activation fusion by changing
the position of the crop layer, which does no... | [
"def",
"transform_conv_crop",
"(",
"spec",
")",
":",
"# Collect metadata",
"out_degree",
"=",
"_get_blob_out_degree",
"(",
"spec",
")",
"network_output_names",
"=",
"_get_network_output",
"(",
"spec",
")",
"nn_spec",
"=",
"_get_nn_spec",
"(",
"spec",
")",
"nn_layers... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/backend/nn/passes/mlmodel_passes.py#L105-L169 | ||
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | clang/bindings/python/clang/cindex.py | python | Config.set_library_path | (path) | Set the path in which to search for libclang | Set the path in which to search for libclang | [
"Set",
"the",
"path",
"in",
"which",
"to",
"search",
"for",
"libclang"
] | def set_library_path(path):
"""Set the path in which to search for libclang"""
if Config.loaded:
raise Exception("library path must be set before before using " \
"any other functionalities in libclang.")
Config.library_path = fspath(path) | [
"def",
"set_library_path",
"(",
"path",
")",
":",
"if",
"Config",
".",
"loaded",
":",
"raise",
"Exception",
"(",
"\"library path must be set before before using \"",
"\"any other functionalities in libclang.\"",
")",
"Config",
".",
"library_path",
"=",
"fspath",
"(",
"p... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/clang/bindings/python/clang/cindex.py#L4105-L4111 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/tools/gyp/pylib/gyp/win_tool.py | python | WinTool.ExecManifestToRc | (self, arch, *args) | Creates a resource file pointing a SxS assembly manifest.
|args| is tuple containing path to resource file, path to manifest file
and resource name which can be "1" (for executables) or "2" (for DLLs). | Creates a resource file pointing a SxS assembly manifest.
|args| is tuple containing path to resource file, path to manifest file
and resource name which can be "1" (for executables) or "2" (for DLLs). | [
"Creates",
"a",
"resource",
"file",
"pointing",
"a",
"SxS",
"assembly",
"manifest",
".",
"|args|",
"is",
"tuple",
"containing",
"path",
"to",
"resource",
"file",
"path",
"to",
"manifest",
"file",
"and",
"resource",
"name",
"which",
"can",
"be",
"1",
"(",
"... | def ExecManifestToRc(self, arch, *args):
"""Creates a resource file pointing a SxS assembly manifest.
|args| is tuple containing path to resource file, path to manifest file
and resource name which can be "1" (for executables) or "2" (for DLLs)."""
manifest_path, resource_path, resource_name = args
... | [
"def",
"ExecManifestToRc",
"(",
"self",
",",
"arch",
",",
"*",
"args",
")",
":",
"manifest_path",
",",
"resource_path",
",",
"resource_name",
"=",
"args",
"with",
"open",
"(",
"resource_path",
",",
"'wb'",
")",
"as",
"output",
":",
"output",
".",
"write",
... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/tools/gyp/pylib/gyp/win_tool.py#L229-L237 | ||
trailofbits/llvm-sanitizer-tutorial | d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99 | llvm/tools/clang/bindings/python/clang/cindex.py | python | TranslationUnit.save | (self, filename) | Saves the TranslationUnit to a file.
This is equivalent to passing -emit-ast to the clang frontend. The
saved file can be loaded back into a TranslationUnit. Or, if it
corresponds to a header, it can be used as a pre-compiled header file.
If an error occurs while saving, a TranslationU... | Saves the TranslationUnit to a file. | [
"Saves",
"the",
"TranslationUnit",
"to",
"a",
"file",
"."
] | def save(self, filename):
"""Saves the TranslationUnit to a file.
This is equivalent to passing -emit-ast to the clang frontend. The
saved file can be loaded back into a TranslationUnit. Or, if it
corresponds to a header, it can be used as a pre-compiled header file.
If an erro... | [
"def",
"save",
"(",
"self",
",",
"filename",
")",
":",
"options",
"=",
"conf",
".",
"lib",
".",
"clang_defaultSaveOptions",
"(",
"self",
")",
"result",
"=",
"int",
"(",
"conf",
".",
"lib",
".",
"clang_saveTranslationUnit",
"(",
"self",
",",
"fspath",
"("... | https://github.com/trailofbits/llvm-sanitizer-tutorial/blob/d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99/llvm/tools/clang/bindings/python/clang/cindex.py#L3011-L3031 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/setuptools/monkey.py | python | get_unpatched_class | (cls) | return base | Protect against re-patching the distutils if reloaded
Also ensures that no other distutils extension monkeypatched the distutils
first. | Protect against re-patching the distutils if reloaded | [
"Protect",
"against",
"re",
"-",
"patching",
"the",
"distutils",
"if",
"reloaded"
] | def get_unpatched_class(cls):
"""Protect against re-patching the distutils if reloaded
Also ensures that no other distutils extension monkeypatched the distutils
first.
"""
external_bases = (
cls
for cls in _get_mro(cls)
if not cls.__module__.startswith('setuptools')
)
... | [
"def",
"get_unpatched_class",
"(",
"cls",
")",
":",
"external_bases",
"=",
"(",
"cls",
"for",
"cls",
"in",
"_get_mro",
"(",
"cls",
")",
"if",
"not",
"cls",
".",
"__module__",
".",
"startswith",
"(",
"'setuptools'",
")",
")",
"base",
"=",
"next",
"(",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/monkey.py#L47-L62 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TChA.SaveTxt | (self, *args) | return _snap.TChA_SaveTxt(self, *args) | SaveTxt(TChA self, PSOut const & SOut)
Parameters:
SOut: PSOut const & | SaveTxt(TChA self, PSOut const & SOut) | [
"SaveTxt",
"(",
"TChA",
"self",
"PSOut",
"const",
"&",
"SOut",
")"
] | def SaveTxt(self, *args):
"""
SaveTxt(TChA self, PSOut const & SOut)
Parameters:
SOut: PSOut const &
"""
return _snap.TChA_SaveTxt(self, *args) | [
"def",
"SaveTxt",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TChA_SaveTxt",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L9072-L9080 | |
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | grc/core/FlowGraph.py | python | FlowGraph.export_data | (self) | return data | Export this flow graph to nested data.
Export all block and connection data.
Returns:
a nested data odict | Export this flow graph to nested data.
Export all block and connection data. | [
"Export",
"this",
"flow",
"graph",
"to",
"nested",
"data",
".",
"Export",
"all",
"block",
"and",
"connection",
"data",
"."
] | def export_data(self):
"""
Export this flow graph to nested data.
Export all block and connection data.
Returns:
a nested data odict
"""
def block_order(b):
return not b.is_variable, b.name # todo: vars still first ?!?
data = collections... | [
"def",
"export_data",
"(",
"self",
")",
":",
"def",
"block_order",
"(",
"b",
")",
":",
"return",
"not",
"b",
".",
"is_variable",
",",
"b",
".",
"name",
"# todo: vars still first ?!?",
"data",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"data",
"[",
... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/grc/core/FlowGraph.py#L382-L399 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/clip_ops.py | python | clip_by_global_norm | (t_list, clip_norm, use_norm=None, name=None) | return list_clipped, use_norm | Clips values of multiple tensors by the ratio of the sum of their norms.
Given a tuple or list of tensors `t_list`, and a clipping ratio `clip_norm`,
this operation returns a list of clipped tensors `list_clipped`
and the global norm (`global_norm`) of all tensors in `t_list`. Optionally,
if you've already com... | Clips values of multiple tensors by the ratio of the sum of their norms. | [
"Clips",
"values",
"of",
"multiple",
"tensors",
"by",
"the",
"ratio",
"of",
"the",
"sum",
"of",
"their",
"norms",
"."
] | def clip_by_global_norm(t_list, clip_norm, use_norm=None, name=None):
"""Clips values of multiple tensors by the ratio of the sum of their norms.
Given a tuple or list of tensors `t_list`, and a clipping ratio `clip_norm`,
this operation returns a list of clipped tensors `list_clipped`
and the global norm (`gl... | [
"def",
"clip_by_global_norm",
"(",
"t_list",
",",
"clip_norm",
",",
"use_norm",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"t_list",
",",
"collections",
".",
"Sequence",
")",
"or",
"isinstance",
"(",
"t_list",
"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/clip_ops.py#L167-L246 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Window_UnreserveControlId | (*args, **kwargs) | return _core_.Window_UnreserveControlId(*args, **kwargs) | Window_UnreserveControlId(int id, int count=1)
If an ID generated from NewControlId is not assigned to a wxWindowIDRef,
it must be unreserved. | Window_UnreserveControlId(int id, int count=1) | [
"Window_UnreserveControlId",
"(",
"int",
"id",
"int",
"count",
"=",
"1",
")"
] | def Window_UnreserveControlId(*args, **kwargs):
"""
Window_UnreserveControlId(int id, int count=1)
If an ID generated from NewControlId is not assigned to a wxWindowIDRef,
it must be unreserved.
"""
return _core_.Window_UnreserveControlId(*args, **kwargs) | [
"def",
"Window_UnreserveControlId",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_UnreserveControlId",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L11738-L11745 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | samples/ide/activegrid/tool/STCTextEditor.py | python | TextCtrl.MarkerDefineDefault | (self) | This must be called after the textcontrol is instantiated | This must be called after the textcontrol is instantiated | [
"This",
"must",
"be",
"called",
"after",
"the",
"textcontrol",
"is",
"instantiated"
] | def MarkerDefineDefault(self):
""" This must be called after the textcontrol is instantiated """
self.MarkerDefine(TextView.MARKER_NUM, wx.stc.STC_MARK_ROUNDRECT, wx.BLACK, wx.BLUE) | [
"def",
"MarkerDefineDefault",
"(",
"self",
")",
":",
"self",
".",
"MarkerDefine",
"(",
"TextView",
".",
"MARKER_NUM",
",",
"wx",
".",
"stc",
".",
"STC_MARK_ROUNDRECT",
",",
"wx",
".",
"BLACK",
",",
"wx",
".",
"BLUE",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/samples/ide/activegrid/tool/STCTextEditor.py#L1190-L1192 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/xml/sax/xmlreader.py | python | XMLReader.setFeature | (self, name, state) | Sets the state of a SAX2 feature. | Sets the state of a SAX2 feature. | [
"Sets",
"the",
"state",
"of",
"a",
"SAX2",
"feature",
"."
] | def setFeature(self, name, state):
"Sets the state of a SAX2 feature."
raise SAXNotRecognizedException("Feature '%s' not recognized" % name) | [
"def",
"setFeature",
"(",
"self",
",",
"name",
",",
"state",
")",
":",
"raise",
"SAXNotRecognizedException",
"(",
"\"Feature '%s' not recognized\"",
"%",
"name",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/xml/sax/xmlreader.py#L79-L81 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/lib2to3/fixer_util.py | python | is_import | (node) | return node.type in (syms.import_name, syms.import_from) | Returns true if the node is an import statement. | Returns true if the node is an import statement. | [
"Returns",
"true",
"if",
"the",
"node",
"is",
"an",
"import",
"statement",
"."
] | def is_import(node):
"""Returns true if the node is an import statement."""
return node.type in (syms.import_name, syms.import_from) | [
"def",
"is_import",
"(",
"node",
")",
":",
"return",
"node",
".",
"type",
"in",
"(",
"syms",
".",
"import_name",
",",
"syms",
".",
"import_from",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/lib2to3/fixer_util.py#L311-L313 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/ma/mrecords.py | python | fromarrays | (arraylist, dtype=None, shape=None, formats=None,
names=None, titles=None, aligned=False, byteorder=None,
fill_value=None) | return _array | Creates a mrecarray from a (flat) list of masked arrays.
Parameters
----------
arraylist : sequence
A list of (masked) arrays. Each element of the sequence is first converted
to a masked array if needed. If a 2D array is passed as argument, it is
processed line by line
dtype : {... | Creates a mrecarray from a (flat) list of masked arrays. | [
"Creates",
"a",
"mrecarray",
"from",
"a",
"(",
"flat",
")",
"list",
"of",
"masked",
"arrays",
"."
] | def fromarrays(arraylist, dtype=None, shape=None, formats=None,
names=None, titles=None, aligned=False, byteorder=None,
fill_value=None):
"""Creates a mrecarray from a (flat) list of masked arrays.
Parameters
----------
arraylist : sequence
A list of (masked) array... | [
"def",
"fromarrays",
"(",
"arraylist",
",",
"dtype",
"=",
"None",
",",
"shape",
"=",
"None",
",",
"formats",
"=",
"None",
",",
"names",
"=",
"None",
",",
"titles",
"=",
"None",
",",
"aligned",
"=",
"False",
",",
"byteorder",
"=",
"None",
",",
"fill_v... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/ma/mrecords.py#L479-L517 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_controls.py | python | PreBitmapButton | (*args, **kwargs) | return val | PreBitmapButton() -> BitmapButton
Precreate a BitmapButton for 2-phase creation. | PreBitmapButton() -> BitmapButton | [
"PreBitmapButton",
"()",
"-",
">",
"BitmapButton"
] | def PreBitmapButton(*args, **kwargs):
"""
PreBitmapButton() -> BitmapButton
Precreate a BitmapButton for 2-phase creation.
"""
val = _controls_.new_PreBitmapButton(*args, **kwargs)
return val | [
"def",
"PreBitmapButton",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"_controls_",
".",
"new_PreBitmapButton",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"val"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L320-L327 | |
limbo018/DREAMPlace | 146c3b9fd003d1acd52c96d9fd02e3f0a05154e4 | dreamplace/BasicPlace.py | python | BasicPlace.validate | (self, placedb, pos, iteration) | return hpwl, overflow, max_density | @brief validate placement
@param placedb placement database
@param pos locations of cells
@param iteration optimization step | [] | def validate(self, placedb, pos, iteration):
"""
@brief validate placement
@param placedb placement database
@param pos locations of cells
@param iteration optimization step
"""
pos = torch.from_numpy(pos).to(self.device)
hpwl = self.op_collections.hpwl_op... | [
"def",
"validate",
"(",
"self",
",",
"placedb",
",",
"pos",
",",
"iteration",
")",
":",
"pos",
"=",
"torch",
".",
"from_numpy",
"(",
"pos",
")",
".",
"to",
"(",
"self",
".",
"device",
")",
"hpwl",
"=",
"self",
".",
"op_collections",
".",
"hpwl_op",
... | https://github.com/limbo018/DREAMPlace/blob/146c3b9fd003d1acd52c96d9fd02e3f0a05154e4/dreamplace/BasicPlace.py#L1003-L1017 | ||
olliw42/storm32bgc | 99d62a6130ae2950514022f50eb669c45a8cc1ba | old/betacopter/old/betacopter36dev-v005/modules/uavcan/libuavcan/dsdl_compiler/pyuavcan/uavcan/dsdl/signature.py | python | Signature.add | (self, data_bytes) | Feed ASCII string or bytes to the signature function | Feed ASCII string or bytes to the signature function | [
"Feed",
"ASCII",
"string",
"or",
"bytes",
"to",
"the",
"signature",
"function"
] | def add(self, data_bytes):
'''Feed ASCII string or bytes to the signature function'''
try:
if isinstance(data_bytes, basestring): # Python 2.7 compatibility
data_bytes = map(ord, data_bytes)
except NameError:
if isinstance(data_bytes, str): # This branch... | [
"def",
"add",
"(",
"self",
",",
"data_bytes",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"data_bytes",
",",
"basestring",
")",
":",
"# Python 2.7 compatibility",
"data_bytes",
"=",
"map",
"(",
"ord",
",",
"data_bytes",
")",
"except",
"NameError",
":",
... | https://github.com/olliw42/storm32bgc/blob/99d62a6130ae2950514022f50eb669c45a8cc1ba/old/betacopter/old/betacopter36dev-v005/modules/uavcan/libuavcan/dsdl_compiler/pyuavcan/uavcan/dsdl/signature.py#L34-L49 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/opt/python/training/drop_stale_gradient_optimizer.py | python | DropStaleGradientOptimizer.__init__ | (self,
opt,
staleness,
use_locking=False,
name="DropStaleGradient") | Constructs a new DropStaleGradientOptimizer.
Args:
opt: The actual optimizer that will be used to compute and apply the
gradients. Must be one of the Optimizer classes.
staleness: The maximum staleness allowed for the optimizer.
use_locking: If `True` use locks for clip update operatio... | Constructs a new DropStaleGradientOptimizer. | [
"Constructs",
"a",
"new",
"DropStaleGradientOptimizer",
"."
] | def __init__(self,
opt,
staleness,
use_locking=False,
name="DropStaleGradient"):
"""Constructs a new DropStaleGradientOptimizer.
Args:
opt: The actual optimizer that will be used to compute and apply the
gradients. Must be one of the ... | [
"def",
"__init__",
"(",
"self",
",",
"opt",
",",
"staleness",
",",
"use_locking",
"=",
"False",
",",
"name",
"=",
"\"DropStaleGradient\"",
")",
":",
"super",
"(",
"DropStaleGradientOptimizer",
",",
"self",
")",
".",
"__init__",
"(",
"use_locking",
",",
"name... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/opt/python/training/drop_stale_gradient_optimizer.py#L44-L61 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_txt.py | python | EdFile.FireModified | (self) | Fire the modified callback(s) | Fire the modified callback(s) | [
"Fire",
"the",
"modified",
"callback",
"(",
"s",
")"
] | def FireModified(self):
"""Fire the modified callback(s)"""
remove = list()
for idx, mcallback in enumerate(self._mcallback):
try:
mcallback()
except:
remove.append(idx)
# Cleanup any bad callbacks
if len(remove):
... | [
"def",
"FireModified",
"(",
"self",
")",
":",
"remove",
"=",
"list",
"(",
")",
"for",
"idx",
",",
"mcallback",
"in",
"enumerate",
"(",
"self",
".",
"_mcallback",
")",
":",
"try",
":",
"mcallback",
"(",
")",
"except",
":",
"remove",
".",
"append",
"("... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_txt.py#L329-L342 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pyclbr.py | python | readmodule | (module, path=None) | return res | Return Class objects for the top-level classes in module.
This is the original interface, before Functions were added. | Return Class objects for the top-level classes in module. | [
"Return",
"Class",
"objects",
"for",
"the",
"top",
"-",
"level",
"classes",
"in",
"module",
"."
] | def readmodule(module, path=None):
"""Return Class objects for the top-level classes in module.
This is the original interface, before Functions were added.
"""
res = {}
for key, value in _readmodule(module, path or []).items():
if isinstance(value, Class):
res[key] = value
... | [
"def",
"readmodule",
"(",
"module",
",",
"path",
"=",
"None",
")",
":",
"res",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"_readmodule",
"(",
"module",
",",
"path",
"or",
"[",
"]",
")",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pyclbr.py#L97-L107 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | cmake/developer_package/cpplint/cpplint.py | python | CheckLanguage | (filename, clean_lines, linenum, file_extension,
include_state, nesting_state, error) | Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum:... | Checks rules from the 'C++ language rules' section of cppguide.html. | [
"Checks",
"rules",
"from",
"the",
"C",
"++",
"language",
"rules",
"section",
"of",
"cppguide",
".",
"html",
"."
] | def CheckLanguage(filename, clean_lines, linenum, file_extension,
include_state, nesting_state, error):
"""Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.... | [
"def",
"CheckLanguage",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"file_extension",
",",
"include_state",
",",
"nesting_state",
",",
"error",
")",
":",
"# If the line is empty or consists of entirely a comment, no need to",
"# check it.",
"line",
"=",
"cle... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/cmake/developer_package/cpplint/cpplint.py#L4954-L5112 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/email/message.py | python | Message.__str__ | (self) | return self.as_string() | Return the entire formatted message as a string. | Return the entire formatted message as a string. | [
"Return",
"the",
"entire",
"formatted",
"message",
"as",
"a",
"string",
"."
] | def __str__(self):
"""Return the entire formatted message as a string.
"""
return self.as_string() | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"self",
".",
"as_string",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/email/message.py#L132-L135 | |
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/software/scene_retrieving/src/nlohmann_json/benchmarks/thirdparty/benchmark/tools/gbench/util.py | python | remove_benchmark_flags | (prefix, benchmark_flags) | return [f for f in benchmark_flags if not f.startswith(prefix)] | Return a new list containing the specified benchmark_flags except those
with the specified prefix. | Return a new list containing the specified benchmark_flags except those
with the specified prefix. | [
"Return",
"a",
"new",
"list",
"containing",
"the",
"specified",
"benchmark_flags",
"except",
"those",
"with",
"the",
"specified",
"prefix",
"."
] | def remove_benchmark_flags(prefix, benchmark_flags):
"""
Return a new list containing the specified benchmark_flags except those
with the specified prefix.
"""
assert prefix.startswith('--') and prefix.endswith('=')
return [f for f in benchmark_flags if not f.startswith(prefix)] | [
"def",
"remove_benchmark_flags",
"(",
"prefix",
",",
"benchmark_flags",
")",
":",
"assert",
"prefix",
".",
"startswith",
"(",
"'--'",
")",
"and",
"prefix",
".",
"endswith",
"(",
"'='",
")",
"return",
"[",
"f",
"for",
"f",
"in",
"benchmark_flags",
"if",
"no... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/software/scene_retrieving/src/nlohmann_json/benchmarks/thirdparty/benchmark/tools/gbench/util.py#L100-L106 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/data_flow_ops.py | python | Barrier.take_many | (self,
num_elements,
allow_small_batch=False,
timeout=None,
name=None) | return ret | Takes the given number of completed elements from this barrier.
This operation concatenates completed-element component tensors along
the 0th dimension to make a single component tensor.
If barrier has no completed elements, this operation will block
until there are 'num_elements' elements to take.
... | Takes the given number of completed elements from this barrier. | [
"Takes",
"the",
"given",
"number",
"of",
"completed",
"elements",
"from",
"this",
"barrier",
"."
] | def take_many(self,
num_elements,
allow_small_batch=False,
timeout=None,
name=None):
"""Takes the given number of completed elements from this barrier.
This operation concatenates completed-element component tensors along
the 0th dimension to ... | [
"def",
"take_many",
"(",
"self",
",",
"num_elements",
",",
"allow_small_batch",
"=",
"False",
",",
"timeout",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"\"%s_BarrierTakeMany\"",
"%",
"self",
".",
"_nam... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/data_flow_ops.py#L955-L1022 | |
OpenChemistry/tomviz | 0a903679318f191cb7dd3eb5ff5bc3a7d3320d9a | acquisition/tomviz/acquisition/vendors/passive/filesystem.py | python | Monitor.get | (self) | return None | Returns the first pending file available. If there are pending files in
the queue the first in the queue is return, otherwise the path if check
for new files.
:returns: The first pending file, None if no file is available. | Returns the first pending file available. If there are pending files in
the queue the first in the queue is return, otherwise the path if check
for new files. | [
"Returns",
"the",
"first",
"pending",
"file",
"available",
".",
"If",
"there",
"are",
"pending",
"files",
"in",
"the",
"queue",
"the",
"first",
"in",
"the",
"queue",
"is",
"return",
"otherwise",
"the",
"path",
"if",
"check",
"for",
"new",
"files",
"."
] | def get(self):
"""
Returns the first pending file available. If there are pending files in
the queue the first in the queue is return, otherwise the path if check
for new files.
:returns: The first pending file, None if no file is available.
"""
if self._files.e... | [
"def",
"get",
"(",
"self",
")",
":",
"if",
"self",
".",
"_files",
".",
"empty",
"(",
")",
":",
"self",
".",
"_check",
"(",
")",
"try",
":",
"return",
"self",
".",
"_files",
".",
"get",
"(",
"block",
"=",
"False",
")",
"except",
"queue",
".",
"E... | https://github.com/OpenChemistry/tomviz/blob/0a903679318f191cb7dd3eb5ff5bc3a7d3320d9a/acquisition/tomviz/acquisition/vendors/passive/filesystem.py#L46-L63 | |
genn-team/genn | 75e1eb218cafa228bf36ae4613d1ce26e877b12c | pygenn/genn_groups.py | python | SynapseGroup.is_dense | (self) | return (self.matrix_type & SynapseMatrixConnectivity_DENSE) != 0 | Tests whether synaptic connectivity uses dense format | Tests whether synaptic connectivity uses dense format | [
"Tests",
"whether",
"synaptic",
"connectivity",
"uses",
"dense",
"format"
] | def is_dense(self):
"""Tests whether synaptic connectivity uses dense format"""
return (self.matrix_type & SynapseMatrixConnectivity_DENSE) != 0 | [
"def",
"is_dense",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"matrix_type",
"&",
"SynapseMatrixConnectivity_DENSE",
")",
"!=",
"0"
] | https://github.com/genn-team/genn/blob/75e1eb218cafa228bf36ae4613d1ce26e877b12c/pygenn/genn_groups.py#L906-L908 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/layers/python/layers/feature_column.py | python | real_valued_column | (column_name,
dimension=1,
default_value=None,
dtype=dtypes.float32) | Creates a _RealValuedColumn.
Args:
column_name: A string defining real valued column name.
dimension: An integer specifying dimension of the real valued column.
The default is 1. The Tensor representing the _RealValuedColumn
will have the shape of [batch_size, dimension].
default_value: A sin... | Creates a _RealValuedColumn. | [
"Creates",
"a",
"_RealValuedColumn",
"."
] | def real_valued_column(column_name,
dimension=1,
default_value=None,
dtype=dtypes.float32):
"""Creates a _RealValuedColumn.
Args:
column_name: A string defining real valued column name.
dimension: An integer specifying dimension of the re... | [
"def",
"real_valued_column",
"(",
"column_name",
",",
"dimension",
"=",
"1",
",",
"default_value",
"=",
"None",
",",
"dtype",
"=",
"dtypes",
".",
"float32",
")",
":",
"if",
"not",
"isinstance",
"(",
"dimension",
",",
"int",
")",
":",
"raise",
"TypeError",
... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/layers/python/layers/feature_column.py#L909-L998 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/html.py | python | HtmlLinkEvent.__init__ | (self, *args, **kwargs) | __init__(self, int id, HtmlLinkInfo linkinfo) -> HtmlLinkEvent | __init__(self, int id, HtmlLinkInfo linkinfo) -> HtmlLinkEvent | [
"__init__",
"(",
"self",
"int",
"id",
"HtmlLinkInfo",
"linkinfo",
")",
"-",
">",
"HtmlLinkEvent"
] | def __init__(self, *args, **kwargs):
"""__init__(self, int id, HtmlLinkInfo linkinfo) -> HtmlLinkEvent"""
_html.HtmlLinkEvent_swiginit(self,_html.new_HtmlLinkEvent(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_html",
".",
"HtmlLinkEvent_swiginit",
"(",
"self",
",",
"_html",
".",
"new_HtmlLinkEvent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/html.py#L1716-L1718 | ||
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Environment.py | python | Base.Detect | (self, progs) | return None | Return the first available program in progs. | Return the first available program in progs. | [
"Return",
"the",
"first",
"available",
"program",
"in",
"progs",
"."
] | def Detect(self, progs):
"""Return the first available program in progs.
"""
if not SCons.Util.is_List(progs):
progs = [ progs ]
for prog in progs:
path = self.WhereIs(prog)
if path: return prog
return None | [
"def",
"Detect",
"(",
"self",
",",
"progs",
")",
":",
"if",
"not",
"SCons",
".",
"Util",
".",
"is_List",
"(",
"progs",
")",
":",
"progs",
"=",
"[",
"progs",
"]",
"for",
"prog",
"in",
"progs",
":",
"path",
"=",
"self",
".",
"WhereIs",
"(",
"prog",... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Environment.py#L1486-L1494 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_controls.py | python | PickerBase.IsTextCtrlGrowable | (*args, **kwargs) | return _controls_.PickerBase_IsTextCtrlGrowable(*args, **kwargs) | IsTextCtrlGrowable(self) -> bool | IsTextCtrlGrowable(self) -> bool | [
"IsTextCtrlGrowable",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsTextCtrlGrowable(*args, **kwargs):
"""IsTextCtrlGrowable(self) -> bool"""
return _controls_.PickerBase_IsTextCtrlGrowable(*args, **kwargs) | [
"def",
"IsTextCtrlGrowable",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"PickerBase_IsTextCtrlGrowable",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L6790-L6792 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.