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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
francinexue/xuefu | b6ff79747a42e020588c0c0a921048e08fe4680c | cnx/bar.py | python | Bars.getInstruments | (self) | return self.__barDict.keys() | Returns the instrument symbols. | Returns the instrument symbols. | [
"Returns",
"the",
"instrument",
"symbols",
"."
] | def getInstruments(self):
"""Returns the instrument symbols."""
return self.__barDict.keys() | [
"def",
"getInstruments",
"(",
"self",
")",
":",
"return",
"self",
".",
"__barDict",
".",
"keys",
"(",
")"
] | https://github.com/francinexue/xuefu/blob/b6ff79747a42e020588c0c0a921048e08fe4680c/cnx/bar.py#L290-L292 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py | python | tied_rnn_seq2seq | (encoder_inputs,
decoder_inputs,
cell,
loop_function=None,
dtype=dtypes.float32,
scope=None) | RNN sequence-to-sequence model with tied encoder and decoder parameters.
This model first runs an RNN to encode encoder_inputs into a state vector, and
then runs decoder, initialized with the last encoder state, on decoder_inputs.
Encoder and decoder use the same RNN cell and share parameters.
Args:
encod... | RNN sequence-to-sequence model with tied encoder and decoder parameters. | [
"RNN",
"sequence",
"-",
"to",
"-",
"sequence",
"model",
"with",
"tied",
"encoder",
"and",
"decoder",
"parameters",
"."
] | def tied_rnn_seq2seq(encoder_inputs,
decoder_inputs,
cell,
loop_function=None,
dtype=dtypes.float32,
scope=None):
"""RNN sequence-to-sequence model with tied encoder and decoder parameters.
This model first run... | [
"def",
"tied_rnn_seq2seq",
"(",
"encoder_inputs",
",",
"decoder_inputs",
",",
"cell",
",",
"loop_function",
"=",
"None",
",",
"dtype",
"=",
"dtypes",
".",
"float32",
",",
"scope",
"=",
"None",
")",
":",
"with",
"variable_scope",
".",
"variable_scope",
"(",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py#L190-L230 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/pydoc.py | python | HTMLDoc.modulelink | (self, object) | return '<a href="%s.html">%s</a>' % (object.__name__, object.__name__) | Make a link for a module. | Make a link for a module. | [
"Make",
"a",
"link",
"for",
"a",
"module",
"."
] | def modulelink(self, object):
"""Make a link for a module."""
return '<a href="%s.html">%s</a>' % (object.__name__, object.__name__) | [
"def",
"modulelink",
"(",
"self",
",",
"object",
")",
":",
"return",
"'<a href=\"%s.html\">%s</a>'",
"%",
"(",
"object",
".",
"__name__",
",",
"object",
".",
"__name__",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/pydoc.py#L541-L543 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | RendererNative_Get | (*args) | return _gdi_.RendererNative_Get(*args) | RendererNative_Get() -> RendererNative
Return the currently used renderer | RendererNative_Get() -> RendererNative | [
"RendererNative_Get",
"()",
"-",
">",
"RendererNative"
] | def RendererNative_Get(*args):
"""
RendererNative_Get() -> RendererNative
Return the currently used renderer
"""
return _gdi_.RendererNative_Get(*args) | [
"def",
"RendererNative_Get",
"(",
"*",
"args",
")",
":",
"return",
"_gdi_",
".",
"RendererNative_Get",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L7518-L7524 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | ppapi/generators/idl_parser.py | python | IDLParser.p_top_short | (self, p) | top : COMMENT ext_attr_block top_list | top : COMMENT ext_attr_block top_list | [
"top",
":",
"COMMENT",
"ext_attr_block",
"top_list"
] | def p_top_short(self, p):
"""top : COMMENT ext_attr_block top_list"""
Copyright = self.BuildComment('Copyright', p, 1)
Filedoc = IDLNode('Comment', self.lexobj.filename, p.lineno(2)-1,
p.lexpos(2)-1, [self.BuildAttribute('NAME', ''),
self.BuildAttribute('FORM', 'cc')])
p[0] = ListFromC... | [
"def",
"p_top_short",
"(",
"self",
",",
"p",
")",
":",
"Copyright",
"=",
"self",
".",
"BuildComment",
"(",
"'Copyright'",
",",
"p",
",",
"1",
")",
"Filedoc",
"=",
"IDLNode",
"(",
"'Comment'",
",",
"self",
".",
"lexobj",
".",
"filename",
",",
"p",
"."... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/ppapi/generators/idl_parser.py#L224-L231 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/codecs.py | python | make_identity_dict | (rng) | return res | make_identity_dict(rng) -> dict
Return a dictionary where elements of the rng sequence are
mapped to themselves. | make_identity_dict(rng) -> dict | [
"make_identity_dict",
"(",
"rng",
")",
"-",
">",
"dict"
] | def make_identity_dict(rng):
""" make_identity_dict(rng) -> dict
Return a dictionary where elements of the rng sequence are
mapped to themselves.
"""
res = {}
for i in rng:
res[i]=i
return res | [
"def",
"make_identity_dict",
"(",
"rng",
")",
":",
"res",
"=",
"{",
"}",
"for",
"i",
"in",
"rng",
":",
"res",
"[",
"i",
"]",
"=",
"i",
"return",
"res"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/codecs.py#L1034-L1045 | |
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/CoSimulationApplication/python_scripts/base_classes/co_simulation_solver_wrapper.py | python | CoSimulationSolverWrapper.__init__ | (self, settings, model, solver_name) | Constructor of the Base Solver Wrapper
The derived classes should do the following things in their constructors:
1. call the base-class constructor (i.e. the constructor of this class => CoSimulationSolverWrapper)
2. create the ModelParts required for the CoSimulation
3. Optional: call ... | Constructor of the Base Solver Wrapper | [
"Constructor",
"of",
"the",
"Base",
"Solver",
"Wrapper"
] | def __init__(self, settings, model, solver_name):
"""Constructor of the Base Solver Wrapper
The derived classes should do the following things in their constructors:
1. call the base-class constructor (i.e. the constructor of this class => CoSimulationSolverWrapper)
2. create the ModelP... | [
"def",
"__init__",
"(",
"self",
",",
"settings",
",",
"model",
",",
"solver_name",
")",
":",
"# Every SolverWrapper has its own model, because:",
"# - the names can be easily overlapping (e.g. \"Structure.Interface\")",
"# - Solvers should not be able to access the data of other solvers ... | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/CoSimulationApplication/python_scripts/base_classes/co_simulation_solver_wrapper.py#L17-L50 | ||
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/transform_impls/accumulate.py | python | accumulate | (pvalue, zero, accumulator, *side_inputs, **kargs) | return pobject.PObject(result_node, pvalue.pipeline()) | Implementation of transforms.accumulate() | Implementation of transforms.accumulate() | [
"Implementation",
"of",
"transforms",
".",
"accumulate",
"()"
] | def accumulate(pvalue, zero, accumulator, *side_inputs, **kargs):
"""
Implementation of transforms.accumulate()
"""
if utils.is_infinite(pvalue):
raise ValueError("accumulate not supported infinite PType")
objector = kargs.get('serde', pvalue.pipeline().default_objector())
side_inputs... | [
"def",
"accumulate",
"(",
"pvalue",
",",
"zero",
",",
"accumulator",
",",
"*",
"side_inputs",
",",
"*",
"*",
"kargs",
")",
":",
"if",
"utils",
".",
"is_infinite",
"(",
"pvalue",
")",
":",
"raise",
"ValueError",
"(",
"\"accumulate not supported infinite PType\"... | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/transform_impls/accumulate.py#L33-L55 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/utils/ipstruct.py | python | Struct.hasattr | (self, key) | return key in self | hasattr function available as a method.
Implemented like has_key.
Examples
--------
>>> s = Struct(a=10)
>>> s.hasattr('a')
True
>>> s.hasattr('b')
False
>>> s.hasattr('get')
False | hasattr function available as a method. | [
"hasattr",
"function",
"available",
"as",
"a",
"method",
"."
] | def hasattr(self, key):
"""hasattr function available as a method.
Implemented like has_key.
Examples
--------
>>> s = Struct(a=10)
>>> s.hasattr('a')
True
>>> s.hasattr('b')
False
>>> s.hasattr('get')
False
"""
r... | [
"def",
"hasattr",
"(",
"self",
",",
"key",
")",
":",
"return",
"key",
"in",
"self"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/utils/ipstruct.py#L247-L263 | |
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | external/tools/build/v2/build/targets.py | python | BasicTarget.construct | (self, name, source_targets, properties) | Constructs the virtual targets for this abstract targets and
the dependecy graph. Returns a tuple consisting of the properties and the list of virtual targets.
Should be overrided in derived classes. | Constructs the virtual targets for this abstract targets and
the dependecy graph. Returns a tuple consisting of the properties and the list of virtual targets.
Should be overrided in derived classes. | [
"Constructs",
"the",
"virtual",
"targets",
"for",
"this",
"abstract",
"targets",
"and",
"the",
"dependecy",
"graph",
".",
"Returns",
"a",
"tuple",
"consisting",
"of",
"the",
"properties",
"and",
"the",
"list",
"of",
"virtual",
"targets",
".",
"Should",
"be",
... | def construct (self, name, source_targets, properties):
""" Constructs the virtual targets for this abstract targets and
the dependecy graph. Returns a tuple consisting of the properties and the list of virtual targets.
Should be overrided in derived classes.
"""
raise Ba... | [
"def",
"construct",
"(",
"self",
",",
"name",
",",
"source_targets",
",",
"properties",
")",
":",
"raise",
"BaseException",
"(",
"\"method should be defined in derived classes\"",
")"
] | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/external/tools/build/v2/build/targets.py#L1270-L1275 | ||
qt/qt | 0a2f2382541424726168804be2c90b91381608c6 | src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSUserFile.py | python | Writer.__init__ | (self, user_file_path, version) | Initializes the user file.
Args:
user_file_path: Path to the user file. | Initializes the user file. | [
"Initializes",
"the",
"user",
"file",
"."
] | def __init__(self, user_file_path, version):
"""Initializes the user file.
Args:
user_file_path: Path to the user file.
"""
self.user_file_path = user_file_path
self.version = version
self.doc = None | [
"def",
"__init__",
"(",
"self",
",",
"user_file_path",
",",
"version",
")",
":",
"self",
".",
"user_file_path",
"=",
"user_file_path",
"self",
".",
"version",
"=",
"version",
"self",
".",
"doc",
"=",
"None"
] | https://github.com/qt/qt/blob/0a2f2382541424726168804be2c90b91381608c6/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSUserFile.py#L59-L67 | ||
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | Utilities/Sphinx/sphinx_apidoc.py | python | main | (argv=sys.argv) | Parse and check the command line arguments. | Parse and check the command line arguments. | [
"Parse",
"and",
"check",
"the",
"command",
"line",
"arguments",
"."
] | def main(argv=sys.argv):
"""
Parse and check the command line arguments.
"""
parser = optparse.OptionParser(
usage="""\
usage: %prog [options] -o <output_path> <module_path> [exclude_paths, ...]
Look recursively in <module_path> for Python modules and packages and create
one reST file with auto... | [
"def",
"main",
"(",
"argv",
"=",
"sys",
".",
"argv",
")",
":",
"parser",
"=",
"optparse",
".",
"OptionParser",
"(",
"usage",
"=",
"\"\"\"\\\nusage: %prog [options] -o <output_path> <module_path> [exclude_paths, ...]\n\nLook recursively in <module_path> for Python modules and pack... | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Utilities/Sphinx/sphinx_apidoc.py#L353-L444 | ||
microsoft/EdgeML | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | pytorch/edgeml_pytorch/trainer/srnnTrainer.py | python | SRNNTrainer.train | (self, brickSize, batchSize, epochs, x_train, x_val, y_train, y_val,
printStep=10, valStep=1) | Performs training of SRNN.
batchSize: Batch size per update
epochs : The number of epochs to run training for. One epoch is
defined as one pass over the entire training data.
x_train, x_val, y_train, y_val: The numpy array containing train and
validation data. x data is ... | Performs training of SRNN. | [
"Performs",
"training",
"of",
"SRNN",
"."
] | def train(self, brickSize, batchSize, epochs, x_train, x_val, y_train, y_val,
printStep=10, valStep=1):
'''
Performs training of SRNN.
batchSize: Batch size per update
epochs : The number of epochs to run training for. One epoch is
defined as one pass over the ... | [
"def",
"train",
"(",
"self",
",",
"brickSize",
",",
"batchSize",
",",
"epochs",
",",
"x_train",
",",
"x_val",
",",
"y_train",
",",
"y_val",
",",
"printStep",
"=",
"10",
",",
"valStep",
"=",
"1",
")",
":",
"L",
"=",
"self",
".",
"srnnObj",
".",
"out... | https://github.com/microsoft/EdgeML/blob/ef9f8a77f096acbdeb941014791f8eda1c1bc35b/pytorch/edgeml_pytorch/trainer/srnnTrainer.py#L64-L125 | ||
raspberrypi/tools | 13474ee775d0c5ec8a7da4fb0a9fa84187abfc87 | arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/share/gdb/python/gdb/command/explore.py | python | ExploreUtils.get_type_from_str | (type_str) | A utility function to deduce the gdb.Type value from a string
representing the type.
Arguments:
type_str: The type string from which the gdb.Type value should be
deduced.
Returns:
The deduced gdb.Type value if possible, None otherwise. | A utility function to deduce the gdb.Type value from a string
representing the type. | [
"A",
"utility",
"function",
"to",
"deduce",
"the",
"gdb",
".",
"Type",
"value",
"from",
"a",
"string",
"representing",
"the",
"type",
"."
] | def get_type_from_str(type_str):
"""A utility function to deduce the gdb.Type value from a string
representing the type.
Arguments:
type_str: The type string from which the gdb.Type value should be
deduced.
Returns:
The deduced gdb.Type val... | [
"def",
"get_type_from_str",
"(",
"type_str",
")",
":",
"try",
":",
"# Assume the current language to be C/C++ and make a try.",
"return",
"gdb",
".",
"parse_and_eval",
"(",
"\"(%s *)0\"",
"%",
"type_str",
")",
".",
"type",
".",
"target",
"(",
")",
"except",
"Runtime... | https://github.com/raspberrypi/tools/blob/13474ee775d0c5ec8a7da4fb0a9fa84187abfc87/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/share/gdb/python/gdb/command/explore.py#L609-L629 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/contrib/onnx/mx2onnx/_op_translations.py | python | convert_minimum | (node, **kwargs) | return create_basic_op_node('Min', node, kwargs) | Map MXNet's _minimum operator attributes to onnx's Min operator
and return the created node. | Map MXNet's _minimum operator attributes to onnx's Min operator
and return the created node. | [
"Map",
"MXNet",
"s",
"_minimum",
"operator",
"attributes",
"to",
"onnx",
"s",
"Min",
"operator",
"and",
"return",
"the",
"created",
"node",
"."
] | def convert_minimum(node, **kwargs):
"""Map MXNet's _minimum operator attributes to onnx's Min operator
and return the created node.
"""
return create_basic_op_node('Min', node, kwargs) | [
"def",
"convert_minimum",
"(",
"node",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"create_basic_op_node",
"(",
"'Min'",
",",
"node",
",",
"kwargs",
")"
] | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/contrib/onnx/mx2onnx/_op_translations.py#L1179-L1183 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_pydecimal.py | python | _Log10Memoize.getdigits | (self, p) | return int(self.digits[:p+1]) | Given an integer p >= 0, return floor(10**p)*log(10).
For example, self.getdigits(3) returns 2302. | Given an integer p >= 0, return floor(10**p)*log(10). | [
"Given",
"an",
"integer",
"p",
">",
"=",
"0",
"return",
"floor",
"(",
"10",
"**",
"p",
")",
"*",
"log",
"(",
"10",
")",
"."
] | def getdigits(self, p):
"""Given an integer p >= 0, return floor(10**p)*log(10).
For example, self.getdigits(3) returns 2302.
"""
# digits are stored as a string, for quick conversion to
# integer in the case that we've already computed enough
# digits; the stored digits... | [
"def",
"getdigits",
"(",
"self",
",",
"p",
")",
":",
"# digits are stored as a string, for quick conversion to",
"# integer in the case that we've already computed enough",
"# digits; the stored digits should always be correct",
"# (truncated, not rounded to nearest).",
"if",
"p",
"<",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_pydecimal.py#L5859-L5885 | |
asLody/whale | 6a661b27cc4cf83b7b5a3b02451597ee1ac7f264 | whale/cpplint.py | python | NestingState.Update | (self, filename, clean_lines, linenum, error) | Update nesting state with current line.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Update nesting state with current line. | [
"Update",
"nesting",
"state",
"with",
"current",
"line",
"."
] | def Update(self, filename, clean_lines, linenum, error):
"""Update nesting state with current line.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any err... | [
"def",
"Update",
"(",
"self",
",",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Remember top of the previous nesting stack.",
"#",
"# The stack is always pushed/popped and no... | https://github.com/asLody/whale/blob/6a661b27cc4cf83b7b5a3b02451597ee1ac7f264/whale/cpplint.py#L2582-L2744 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rospy/src/rospy/impl/masterslave.py | python | ROSHandler.getBusStats | (self, caller_id) | return 1, '', [pub_stats, sub_stats, []] | Retrieve transport/topic statistics
@param caller_id: ROS caller id
@type caller_id: str
@return: [publishStats, subscribeStats, serviceStats]::
publishStats: [[topicName, messageDataSent, pubConnectionData]...[topicNameN, messageDataSentN, pubConnectionDataN]]
pub... | Retrieve transport/topic statistics | [
"Retrieve",
"transport",
"/",
"topic",
"statistics"
] | def getBusStats(self, caller_id):
"""
Retrieve transport/topic statistics
@param caller_id: ROS caller id
@type caller_id: str
@return: [publishStats, subscribeStats, serviceStats]::
publishStats: [[topicName, messageDataSent, pubConnectionData]...[topicNameN, mes... | [
"def",
"getBusStats",
"(",
"self",
",",
"caller_id",
")",
":",
"pub_stats",
",",
"sub_stats",
"=",
"get_topic_manager",
"(",
")",
".",
"get_pub_sub_stats",
"(",
")",
"#TODO: serviceStats",
"return",
"1",
",",
"''",
",",
"[",
"pub_stats",
",",
"sub_stats",
",... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rospy/src/rospy/impl/masterslave.py#L294-L308 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/v8/third_party/jinja2/utils.py | python | urlize | (text, trim_url_limit=None, rel=None, target=None) | return u''.join(words) | Converts any URLs in text into clickable links. Works on http://,
https:// and www. links. Links can have trailing punctuation (periods,
commas, close-parens) and leading punctuation (opening parens) and
it'll still do the right thing.
If trim_url_limit is not None, the URLs in link text will be limite... | Converts any URLs in text into clickable links. Works on http://,
https:// and www. links. Links can have trailing punctuation (periods,
commas, close-parens) and leading punctuation (opening parens) and
it'll still do the right thing. | [
"Converts",
"any",
"URLs",
"in",
"text",
"into",
"clickable",
"links",
".",
"Works",
"on",
"http",
":",
"//",
"https",
":",
"//",
"and",
"www",
".",
"links",
".",
"Links",
"can",
"have",
"trailing",
"punctuation",
"(",
"periods",
"commas",
"close",
"-",
... | def urlize(text, trim_url_limit=None, rel=None, target=None):
"""Converts any URLs in text into clickable links. Works on http://,
https:// and www. links. Links can have trailing punctuation (periods,
commas, close-parens) and leading punctuation (opening parens) and
it'll still do the right thing.
... | [
"def",
"urlize",
"(",
"text",
",",
"trim_url_limit",
"=",
"None",
",",
"rel",
"=",
"None",
",",
"target",
"=",
"None",
")",
":",
"trim_url",
"=",
"lambda",
"x",
",",
"limit",
"=",
"trim_url_limit",
":",
"limit",
"is",
"not",
"None",
"and",
"(",
"x",
... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/v8/third_party/jinja2/utils.py#L189-L235 | |
Slicer/Slicer | ba9fadf332cb0303515b68d8d06a344c82e3e3e5 | Base/Python/slicer/util.py | python | logProcessOutput | (proc) | Continuously write process output to the application log and the Python console.
:param proc: process object. | Continuously write process output to the application log and the Python console. | [
"Continuously",
"write",
"process",
"output",
"to",
"the",
"application",
"log",
"and",
"the",
"Python",
"console",
"."
] | def logProcessOutput(proc):
"""Continuously write process output to the application log and the Python console.
:param proc: process object.
"""
from subprocess import Popen, PIPE, CalledProcessError
import logging
try:
from slicer import app
guiApp = app
except ImportError:
# Running from co... | [
"def",
"logProcessOutput",
"(",
"proc",
")",
":",
"from",
"subprocess",
"import",
"Popen",
",",
"PIPE",
",",
"CalledProcessError",
"import",
"logging",
"try",
":",
"from",
"slicer",
"import",
"app",
"guiApp",
"=",
"app",
"except",
"ImportError",
":",
"# Runnin... | https://github.com/Slicer/Slicer/blob/ba9fadf332cb0303515b68d8d06a344c82e3e3e5/Base/Python/slicer/util.py#L3077-L3099 | ||
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | buildscripts/cpplint.py | python | _CppLintState.SetFilters | (self, filters) | Sets the error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "+whitespace/indent").
Each filter should start with + or -; else we die.
Raises:
ValueError: The comma-sepa... | Sets the error-message filters. | [
"Sets",
"the",
"error",
"-",
"message",
"filters",
"."
] | def SetFilters(self, filters):
"""Sets the error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "+whitespace/indent").
Each filter should start with + or -; else we die.
Ra... | [
"def",
"SetFilters",
"(",
"self",
",",
"filters",
")",
":",
"# Default filters always have less priority than the flag ones.",
"self",
".",
"filters",
"=",
"_DEFAULT_FILTERS",
"[",
":",
"]",
"self",
".",
"AddFilters",
"(",
"filters",
")"
] | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/buildscripts/cpplint.py#L784-L800 | ||
google/asylo | a3b09ebff6c0e3b10e25d40f14991e16bb75d883 | asylo/platform/system_call/preprocess.py | python | SystemCallTable.parse_includes | (self) | Collect each 'INCLUDE' directive in the input stream. | Collect each 'INCLUDE' directive in the input stream. | [
"Collect",
"each",
"INCLUDE",
"directive",
"in",
"the",
"input",
"stream",
"."
] | def parse_includes(self):
"""Collect each 'INCLUDE' directive in the input stream."""
pattern = re.compile(r'INCLUDE\(\s*\"([^)]*)\"\s*\)')
self.includes = re.findall(pattern, self.declarations) | [
"def",
"parse_includes",
"(",
"self",
")",
":",
"pattern",
"=",
"re",
".",
"compile",
"(",
"r'INCLUDE\\(\\s*\\\"([^)]*)\\\"\\s*\\)'",
")",
"self",
".",
"includes",
"=",
"re",
".",
"findall",
"(",
"pattern",
",",
"self",
".",
"declarations",
")"
] | https://github.com/google/asylo/blob/a3b09ebff6c0e3b10e25d40f14991e16bb75d883/asylo/platform/system_call/preprocess.py#L104-L108 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/utils/TerminalUtils.py | python | terminalOutputToHtml | (output) | return html_tmp | Converts output with terminal codes into HTML.
Input:
output[str]: Text that might contain terminal codes
Return:
str: any terminal codes replaced by html and "&", ">", and "<" replaced. | Converts output with terminal codes into HTML.
Input:
output[str]: Text that might contain terminal codes
Return:
str: any terminal codes replaced by html and "&", ">", and "<" replaced. | [
"Converts",
"output",
"with",
"terminal",
"codes",
"into",
"HTML",
".",
"Input",
":",
"output",
"[",
"str",
"]",
":",
"Text",
"that",
"might",
"contain",
"terminal",
"codes",
"Return",
":",
"str",
":",
"any",
"terminal",
"codes",
"replaced",
"by",
"html",
... | def terminalOutputToHtml(output):
"""
Converts output with terminal codes into HTML.
Input:
output[str]: Text that might contain terminal codes
Return:
str: any terminal codes replaced by html and "&", ">", and "<" replaced.
"""
html_tmp = output.replace("&", "&")
html_tm... | [
"def",
"terminalOutputToHtml",
"(",
"output",
")",
":",
"html_tmp",
"=",
"output",
".",
"replace",
"(",
"\"&\"",
",",
"\"&\"",
")",
"html_tmp",
"=",
"html_tmp",
".",
"replace",
"(",
"\"<\"",
",",
"\"<\"",
")",
"html_tmp",
"=",
"html_tmp",
".",
"repl... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/utils/TerminalUtils.py#L23-L40 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILLCollectData.py | python | DirectILLCollectData.category | (self) | return common.CATEGORIES | Return the algorithm's category. | Return the algorithm's category. | [
"Return",
"the",
"algorithm",
"s",
"category",
"."
] | def category(self):
"""Return the algorithm's category."""
return common.CATEGORIES | [
"def",
"category",
"(",
"self",
")",
":",
"return",
"common",
".",
"CATEGORIES"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILLCollectData.py#L270-L272 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/aui.py | python | AuiToolBarArt.SetFlags | (*args, **kwargs) | return _aui.AuiToolBarArt_SetFlags(*args, **kwargs) | SetFlags(self, int flags) | SetFlags(self, int flags) | [
"SetFlags",
"(",
"self",
"int",
"flags",
")"
] | def SetFlags(*args, **kwargs):
"""SetFlags(self, int flags)"""
return _aui.AuiToolBarArt_SetFlags(*args, **kwargs) | [
"def",
"SetFlags",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiToolBarArt_SetFlags",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/aui.py#L1894-L1896 | |
jeog/TDAmeritradeAPI | 91c738afd7d57b54f6231170bd64c2550fafd34d | python/tdma_api/get.py | python | _APIGetter.close | (self) | Closes underlying connection. | Closes underlying connection. | [
"Closes",
"underlying",
"connection",
"."
] | def close(self):
"""Closes underlying connection."""
clib.call('APIGetter_Close_ABI', _REF(self._obj)) | [
"def",
"close",
"(",
"self",
")",
":",
"clib",
".",
"call",
"(",
"'APIGetter_Close_ABI'",
",",
"_REF",
"(",
"self",
".",
"_obj",
")",
")"
] | https://github.com/jeog/TDAmeritradeAPI/blob/91c738afd7d57b54f6231170bd64c2550fafd34d/python/tdma_api/get.py#L231-L233 | ||
xiaolonw/caffe-video_triplet | c39ea1ad6e937ccf7deba4510b7e555165abf05f | python/caffe/pycaffe.py | python | _Net_blobs | (self) | return OrderedDict(zip(self._blob_names, self._blobs)) | An OrderedDict (bottom to top, i.e., input to output) of network
blobs indexed by name | An OrderedDict (bottom to top, i.e., input to output) of network
blobs indexed by name | [
"An",
"OrderedDict",
"(",
"bottom",
"to",
"top",
"i",
".",
"e",
".",
"input",
"to",
"output",
")",
"of",
"network",
"blobs",
"indexed",
"by",
"name"
] | def _Net_blobs(self):
"""
An OrderedDict (bottom to top, i.e., input to output) of network
blobs indexed by name
"""
return OrderedDict(zip(self._blob_names, self._blobs)) | [
"def",
"_Net_blobs",
"(",
"self",
")",
":",
"return",
"OrderedDict",
"(",
"zip",
"(",
"self",
".",
"_blob_names",
",",
"self",
".",
"_blobs",
")",
")"
] | https://github.com/xiaolonw/caffe-video_triplet/blob/c39ea1ad6e937ccf7deba4510b7e555165abf05f/python/caffe/pycaffe.py#L23-L28 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/contributed/sumopy/plugins/mapmatching/mapmatching.py | python | FilterMixin.filter_time | (self, timestamps) | return inds_elim | timestamps is an array with timestamps.
Function returns a binary array, with a True value for each
time stamp that does NOT SATISFY the specified time constrants. | timestamps is an array with timestamps.
Function returns a binary array, with a True value for each
time stamp that does NOT SATISFY the specified time constrants. | [
"timestamps",
"is",
"an",
"array",
"with",
"timestamps",
".",
"Function",
"returns",
"a",
"binary",
"array",
"with",
"a",
"True",
"value",
"for",
"each",
"time",
"stamp",
"that",
"does",
"NOT",
"SATISFY",
"the",
"specified",
"time",
"constrants",
"."
] | def filter_time(self, timestamps):
"""
timestamps is an array with timestamps.
Function returns a binary array, with a True value for each
time stamp that does NOT SATISFY the specified time constrants.
"""
#print 'filter_time'
#print ' self.hour_from_morning,s... | [
"def",
"filter_time",
"(",
"self",
",",
"timestamps",
")",
":",
"#print 'filter_time'",
"#print ' self.hour_from_morning,self.hour_to_morning',self.hour_from_morning,self.hour_to_morning",
"localtime",
"=",
"time",
".",
"localtime",
"inds_elim",
"=",
"np",
".",
"zeros",
"(",... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/plugins/mapmatching/mapmatching.py#L3636-L3666 | |
myriadrf/LoRa-SDR | c545c51e5e37284363a971ec298f72255646a6fa | RN2483Capture.py | python | transmitAndCollect | (rn2483, sdr, rxStream, payload) | return loraSamples | Transmit the specified payload over the RN2483
and receive through the RTLSDR device.
\return a numpy array with LoRa samples | Transmit the specified payload over the RN2483
and receive through the RTLSDR device.
\return a numpy array with LoRa samples | [
"Transmit",
"the",
"specified",
"payload",
"over",
"the",
"RN2483",
"and",
"receive",
"through",
"the",
"RTLSDR",
"device",
".",
"\\",
"return",
"a",
"numpy",
"array",
"with",
"LoRa",
"samples"
] | def transmitAndCollect(rn2483, sdr, rxStream, payload):
"""
Transmit the specified payload over the RN2483
and receive through the RTLSDR device.
\return a numpy array with LoRa samples
"""
buff = np.array([0]*1024, np.complex64)
#flush
while True:
sr = sdr.readStream(rxStream, ... | [
"def",
"transmitAndCollect",
"(",
"rn2483",
",",
"sdr",
",",
"rxStream",
",",
"payload",
")",
":",
"buff",
"=",
"np",
".",
"array",
"(",
"[",
"0",
"]",
"*",
"1024",
",",
"np",
".",
"complex64",
")",
"#flush",
"while",
"True",
":",
"sr",
"=",
"sdr",... | https://github.com/myriadrf/LoRa-SDR/blob/c545c51e5e37284363a971ec298f72255646a6fa/RN2483Capture.py#L24-L56 | |
NervanaSystems/ngraph | f677a119765ca30636cf407009dabd118664951f | python/src/ngraph/utils/decorators.py | python | unary_op | (node_factory_function: Callable) | return wrapper | Convert the first input value to a Constant Node if a numeric value is detected. | Convert the first input value to a Constant Node if a numeric value is detected. | [
"Convert",
"the",
"first",
"input",
"value",
"to",
"a",
"Constant",
"Node",
"if",
"a",
"numeric",
"value",
"is",
"detected",
"."
] | def unary_op(node_factory_function: Callable) -> Callable:
"""Convert the first input value to a Constant Node if a numeric value is detected."""
@wraps(node_factory_function)
def wrapper(input_value: NodeInput, *args: Any, **kwargs: Any) -> Node:
input_node = as_node(input_value)
node = no... | [
"def",
"unary_op",
"(",
"node_factory_function",
":",
"Callable",
")",
"->",
"Callable",
":",
"@",
"wraps",
"(",
"node_factory_function",
")",
"def",
"wrapper",
"(",
"input_value",
":",
"NodeInput",
",",
"*",
"args",
":",
"Any",
",",
"*",
"*",
"kwargs",
":... | https://github.com/NervanaSystems/ngraph/blob/f677a119765ca30636cf407009dabd118664951f/python/src/ngraph/utils/decorators.py#L41-L51 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/lite/python/lite.py | python | TFLiteKerasModelConverterV2._convert_keras_to_saved_model | (self, output_dir) | return None, None, None | Save Keras model to the SavedModel format.
Args:
output_dir: The output directory to save the SavedModel.
Returns:
graph_def: The frozen GraphDef.
input_tensors: List of input tensors.
output_tensors: List of output tensors. | Save Keras model to the SavedModel format. | [
"Save",
"Keras",
"model",
"to",
"the",
"SavedModel",
"format",
"."
] | def _convert_keras_to_saved_model(self, output_dir):
"""Save Keras model to the SavedModel format.
Args:
output_dir: The output directory to save the SavedModel.
Returns:
graph_def: The frozen GraphDef.
input_tensors: List of input tensors.
output_tensors: List of output tensors.
... | [
"def",
"_convert_keras_to_saved_model",
"(",
"self",
",",
"output_dir",
")",
":",
"try",
":",
"_saved_model",
".",
"save",
"(",
"self",
".",
"_keras_model",
",",
"output_dir",
",",
"options",
"=",
"_save_options",
".",
"SaveOptions",
"(",
"save_debug_info",
"=",... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/lite/python/lite.py#L1226-L1258 | |
bitcoin-sv/bitcoin-sv | 98064703540dc085bdee53408ff10644f4b8fe28 | contrib/devtools/optimize-pngs.py | python | file_hash | (filename) | Return hash of raw file contents | Return hash of raw file contents | [
"Return",
"hash",
"of",
"raw",
"file",
"contents"
] | def file_hash(filename):
'''Return hash of raw file contents'''
with open(filename, 'rb') as f:
return hashlib.sha256(f.read()).hexdigest() | [
"def",
"file_hash",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'rb'",
")",
"as",
"f",
":",
"return",
"hashlib",
".",
"sha256",
"(",
"f",
".",
"read",
"(",
")",
")",
".",
"hexdigest",
"(",
")"
] | https://github.com/bitcoin-sv/bitcoin-sv/blob/98064703540dc085bdee53408ff10644f4b8fe28/contrib/devtools/optimize-pngs.py#L16-L19 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/pyfakefs/pyfakefs/fake_filesystem.py | python | FakeFilesystem.GetPathComponents | (self, path) | return path_components | Breaks the path into a list of component names.
Does not include the root directory as a component, as all paths
are considered relative to the root directory for the FakeFilesystem.
Callers should basically follow this pattern:
file_path = self.NormalizePath(file_path)
path_components = self.... | Breaks the path into a list of component names. | [
"Breaks",
"the",
"path",
"into",
"a",
"list",
"of",
"component",
"names",
"."
] | def GetPathComponents(self, path):
"""Breaks the path into a list of component names.
Does not include the root directory as a component, as all paths
are considered relative to the root directory for the FakeFilesystem.
Callers should basically follow this pattern:
file_path = self.NormalizePat... | [
"def",
"GetPathComponents",
"(",
"self",
",",
"path",
")",
":",
"if",
"not",
"path",
"or",
"path",
"==",
"self",
".",
"root",
".",
"name",
":",
"return",
"[",
"]",
"path_components",
"=",
"path",
".",
"split",
"(",
"self",
".",
"path_separator",
")",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/pyfakefs/pyfakefs/fake_filesystem.py#L556-L585 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/symbol/numpy/random.py | python | f | (dfnum, dfden, size=None, ctx=None) | return (X * dfden) / (Y * dfnum) | r"""Draw samples from an F distribution.
Samples are drawn from an F distribution with specified parameters,
`dfnum` (degrees of freedom in numerator) and `dfden` (degrees of
freedom in denominator), where both parameters must be greater than
zero.
The random variate of the F distribution (also kn... | r"""Draw samples from an F distribution. | [
"r",
"Draw",
"samples",
"from",
"an",
"F",
"distribution",
"."
] | def f(dfnum, dfden, size=None, ctx=None):
r"""Draw samples from an F distribution.
Samples are drawn from an F distribution with specified parameters,
`dfnum` (degrees of freedom in numerator) and `dfden` (degrees of
freedom in denominator), where both parameters must be greater than
zero.
The... | [
"def",
"f",
"(",
"dfnum",
",",
"dfden",
",",
"size",
"=",
"None",
",",
"ctx",
"=",
"None",
")",
":",
"X",
"=",
"chisquare",
"(",
"df",
"=",
"dfnum",
",",
"size",
"=",
"size",
",",
"ctx",
"=",
"ctx",
")",
"Y",
"=",
"chisquare",
"(",
"df",
"=",... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/numpy/random.py#L622-L656 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectQuickRun.py | python | IndirectQuickRun._group_energy_window_scan_output | (self) | Group the output workspaces from the ElasticWindowScan algorithm. | Group the output workspaces from the ElasticWindowScan algorithm. | [
"Group",
"the",
"output",
"workspaces",
"from",
"the",
"ElasticWindowScan",
"algorithm",
"."
] | def _group_energy_window_scan_output(self):
"""
Group the output workspaces from the ElasticWindowScan algorithm.
"""
suffixes = ['_el_elf', '_inel_elf', '_total_elf', '_el_elt', '_inel_elt', '_total_elt', '_el_eq1', '_inel_eq1',
'_total_eq1', '_el_eq2', '_inel_eq2', ... | [
"def",
"_group_energy_window_scan_output",
"(",
"self",
")",
":",
"suffixes",
"=",
"[",
"'_el_elf'",
",",
"'_inel_elf'",
",",
"'_total_elf'",
",",
"'_el_elt'",
",",
"'_inel_elt'",
",",
"'_total_elt'",
",",
"'_el_eq1'",
",",
"'_inel_eq1'",
",",
"'_total_eq1'",
",",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectQuickRun.py#L245-L254 | ||
wyrover/book-code | 7f4883d9030d553bc6bcfa3da685e34789839900 | 3rdparty/protobuf/python/google/protobuf/descriptor.py | python | DescriptorBase.GetOptions | (self) | return self._options | Retrieves descriptor options.
This method returns the options set or creates the default options for the
descriptor. | Retrieves descriptor options. | [
"Retrieves",
"descriptor",
"options",
"."
] | def GetOptions(self):
"""Retrieves descriptor options.
This method returns the options set or creates the default options for the
descriptor.
"""
if self._options:
return self._options
from google.protobuf import descriptor_pb2
try:
options_class = getattr(descriptor_pb2, self._... | [
"def",
"GetOptions",
"(",
"self",
")",
":",
"if",
"self",
".",
"_options",
":",
"return",
"self",
".",
"_options",
"from",
"google",
".",
"protobuf",
"import",
"descriptor_pb2",
"try",
":",
"options_class",
"=",
"getattr",
"(",
"descriptor_pb2",
",",
"self",... | https://github.com/wyrover/book-code/blob/7f4883d9030d553bc6bcfa3da685e34789839900/3rdparty/protobuf/python/google/protobuf/descriptor.py#L118-L133 | |
p4lang/p4c | 3272e79369f20813cc1a555a5eb26f44432f84a4 | tools/cpplint.py | python | RemoveMultiLineComments | (filename, lines, error) | Removes multiline (c-style) comments from lines. | Removes multiline (c-style) comments from lines. | [
"Removes",
"multiline",
"(",
"c",
"-",
"style",
")",
"comments",
"from",
"lines",
"."
] | def RemoveMultiLineComments(filename, lines, error):
"""Removes multiline (c-style) comments from lines."""
lineix = 0
while lineix < len(lines):
lineix_begin = FindNextMultiLineCommentStart(lines, lineix)
if lineix_begin >= len(lines):
return
lineix_end = FindNextMultiLineCommentEnd(lines, line... | [
"def",
"RemoveMultiLineComments",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"lineix",
"=",
"0",
"while",
"lineix",
"<",
"len",
"(",
"lines",
")",
":",
"lineix_begin",
"=",
"FindNextMultiLineCommentStart",
"(",
"lines",
",",
"lineix",
")",
"if",
... | https://github.com/p4lang/p4c/blob/3272e79369f20813cc1a555a5eb26f44432f84a4/tools/cpplint.py#L1872-L1885 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | ListCtrl.Append | (self, entry) | Append an item to the list control. The entry parameter should be a
sequence with an item for each column | Append an item to the list control. The entry parameter should be a
sequence with an item for each column | [
"Append",
"an",
"item",
"to",
"the",
"list",
"control",
".",
"The",
"entry",
"parameter",
"should",
"be",
"a",
"sequence",
"with",
"an",
"item",
"for",
"each",
"column"
] | def Append(self, entry):
'''Append an item to the list control. The entry parameter should be a
sequence with an item for each column'''
if len(entry):
if wx.USE_UNICODE:
cvtfunc = unicode
else:
cvtfunc = str
pos = self.GetI... | [
"def",
"Append",
"(",
"self",
",",
"entry",
")",
":",
"if",
"len",
"(",
"entry",
")",
":",
"if",
"wx",
".",
"USE_UNICODE",
":",
"cvtfunc",
"=",
"unicode",
"else",
":",
"cvtfunc",
"=",
"str",
"pos",
"=",
"self",
".",
"GetItemCount",
"(",
")",
"self"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L4812-L4824 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | gr-utils/modtool/core/rename.py | python | ModToolRename.validate | (self) | Validates the arguments | Validates the arguments | [
"Validates",
"the",
"arguments"
] | def validate(self):
""" Validates the arguments """
ModTool._validate(self)
if not self.info['oldname']:
raise ModToolException('Old block name (blockname) not specified.')
validate_name('old block', self.info['oldname'])
block_candidates = get_block_candidates()
... | [
"def",
"validate",
"(",
"self",
")",
":",
"ModTool",
".",
"_validate",
"(",
"self",
")",
"if",
"not",
"self",
".",
"info",
"[",
"'oldname'",
"]",
":",
"raise",
"ModToolException",
"(",
"'Old block name (blockname) not specified.'",
")",
"validate_name",
"(",
"... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/gr-utils/modtool/core/rename.py#L31-L45 | ||
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | src/api/python/z3/z3.py | python | ArithRef.__sub__ | (self, other) | return ArithRef(_mk_bin(Z3_mk_sub, a, b), self.ctx) | Create the Z3 expression `self - other`.
>>> x = Int('x')
>>> y = Int('y')
>>> x - y
x - y
>>> (x - y).sort()
Int | Create the Z3 expression `self - other`. | [
"Create",
"the",
"Z3",
"expression",
"self",
"-",
"other",
"."
] | def __sub__(self, other):
"""Create the Z3 expression `self - other`.
>>> x = Int('x')
>>> y = Int('y')
>>> x - y
x - y
>>> (x - y).sort()
Int
"""
a, b = _coerce_exprs(self, other)
return ArithRef(_mk_bin(Z3_mk_sub, a, b), self.ctx) | [
"def",
"__sub__",
"(",
"self",
",",
"other",
")",
":",
"a",
",",
"b",
"=",
"_coerce_exprs",
"(",
"self",
",",
"other",
")",
"return",
"ArithRef",
"(",
"_mk_bin",
"(",
"Z3_mk_sub",
",",
"a",
",",
"b",
")",
",",
"self",
".",
"ctx",
")"
] | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L2431-L2442 | |
metashell/metashell | f4177e4854ea00c8dbc722cadab26ef413d798ea | 3rd/templight/llvm/bindings/python/llvm/object.py | python | Section.size | (self) | return lib.LLVMGetSectionSize(self) | The size of the section, in long bytes. | The size of the section, in long bytes. | [
"The",
"size",
"of",
"the",
"section",
"in",
"long",
"bytes",
"."
] | def size(self):
"""The size of the section, in long bytes."""
if self.expired:
raise Exception('Section instance has expired.')
return lib.LLVMGetSectionSize(self) | [
"def",
"size",
"(",
"self",
")",
":",
"if",
"self",
".",
"expired",
":",
"raise",
"Exception",
"(",
"'Section instance has expired.'",
")",
"return",
"lib",
".",
"LLVMGetSectionSize",
"(",
"self",
")"
] | https://github.com/metashell/metashell/blob/f4177e4854ea00c8dbc722cadab26ef413d798ea/3rd/templight/llvm/bindings/python/llvm/object.py#L204-L209 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBTarget.ResolvePastLoadAddress | (self, stop_id, vm_addr) | return _lldb.SBTarget_ResolvePastLoadAddress(self, stop_id, vm_addr) | ResolvePastLoadAddress(SBTarget self, uint32_t stop_id, lldb::addr_t vm_addr) -> SBAddress | ResolvePastLoadAddress(SBTarget self, uint32_t stop_id, lldb::addr_t vm_addr) -> SBAddress | [
"ResolvePastLoadAddress",
"(",
"SBTarget",
"self",
"uint32_t",
"stop_id",
"lldb",
"::",
"addr_t",
"vm_addr",
")",
"-",
">",
"SBAddress"
] | def ResolvePastLoadAddress(self, stop_id, vm_addr):
"""ResolvePastLoadAddress(SBTarget self, uint32_t stop_id, lldb::addr_t vm_addr) -> SBAddress"""
return _lldb.SBTarget_ResolvePastLoadAddress(self, stop_id, vm_addr) | [
"def",
"ResolvePastLoadAddress",
"(",
"self",
",",
"stop_id",
",",
"vm_addr",
")",
":",
"return",
"_lldb",
".",
"SBTarget_ResolvePastLoadAddress",
"(",
"self",
",",
"stop_id",
",",
"vm_addr",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L10843-L10845 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/trace.py | python | CoverageResults.write_results_file | (self, path, lines, lnotab, lines_hit) | return n_hits, n_lines | Return a coverage results file in path. | Return a coverage results file in path. | [
"Return",
"a",
"coverage",
"results",
"file",
"in",
"path",
"."
] | def write_results_file(self, path, lines, lnotab, lines_hit):
"""Return a coverage results file in path."""
try:
outfile = open(path, "w")
except IOError, err:
print >> sys.stderr, ("trace: Could not open %r for writing: %s"
"- skipping"... | [
"def",
"write_results_file",
"(",
"self",
",",
"path",
",",
"lines",
",",
"lnotab",
",",
"lines_hit",
")",
":",
"try",
":",
"outfile",
"=",
"open",
"(",
"path",
",",
"\"w\"",
")",
"except",
"IOError",
",",
"err",
":",
"print",
">>",
"sys",
".",
"stde... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/trace.py#L357-L391 | |
aimerykong/Low-Rank-Bilinear-Pooling | 487eb2c857fd9c95357a5166b0c15ad0fe135b28 | caffe-20160312/scripts/cpp_lint.py | python | _NestingState.UpdatePreprocessor | (self, line) | Update preprocessor stack.
We need to handle preprocessors due to classes like this:
#ifdef SWIG
struct ResultDetailsPageElementExtensionPoint {
#else
struct ResultDetailsPageElementExtensionPoint : public Extension {
#endif
We make the following assumptions (good enough for most... | Update preprocessor stack. | [
"Update",
"preprocessor",
"stack",
"."
] | def UpdatePreprocessor(self, line):
"""Update preprocessor stack.
We need to handle preprocessors due to classes like this:
#ifdef SWIG
struct ResultDetailsPageElementExtensionPoint {
#else
struct ResultDetailsPageElementExtensionPoint : public Extension {
#endif
We make the ... | [
"def",
"UpdatePreprocessor",
"(",
"self",
",",
"line",
")",
":",
"if",
"Match",
"(",
"r'^\\s*#\\s*(if|ifdef|ifndef)\\b'",
",",
"line",
")",
":",
"# Beginning of #if block, save the nesting stack here. The saved",
"# stack will allow us to restore the parsing state in the #else cas... | https://github.com/aimerykong/Low-Rank-Bilinear-Pooling/blob/487eb2c857fd9c95357a5166b0c15ad0fe135b28/caffe-20160312/scripts/cpp_lint.py#L1948-L2002 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | GetHostName | (*args) | return _misc_.GetHostName(*args) | GetHostName() -> String | GetHostName() -> String | [
"GetHostName",
"()",
"-",
">",
"String"
] | def GetHostName(*args):
"""GetHostName() -> String"""
return _misc_.GetHostName(*args) | [
"def",
"GetHostName",
"(",
"*",
"args",
")",
":",
"return",
"_misc_",
".",
"GetHostName",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L389-L391 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/pydoc.py | python | HTMLDoc.filelink | (self, url, path) | return '<a href="file:%s">%s</a>' % (url, path) | Make a link to source file. | Make a link to source file. | [
"Make",
"a",
"link",
"to",
"source",
"file",
"."
] | def filelink(self, url, path):
"""Make a link to source file."""
return '<a href="file:%s">%s</a>' % (url, path) | [
"def",
"filelink",
"(",
"self",
",",
"url",
",",
"path",
")",
":",
"return",
"'<a href=\"file:%s\">%s</a>'",
"%",
"(",
"url",
",",
"path",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/pydoc.py#L669-L671 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/telemetry/telemetry/core/platform/profiler/__init__.py | python | Profiler._GetProcessOutputFileMap | (self) | return process_output_file_map | Returns a dict with pid: output_file. | Returns a dict with pid: output_file. | [
"Returns",
"a",
"dict",
"with",
"pid",
":",
"output_file",
"."
] | def _GetProcessOutputFileMap(self):
"""Returns a dict with pid: output_file."""
all_pids = ([self._browser_backend.pid] +
self._platform_backend.GetChildPids(self._browser_backend.pid))
process_name_counts = collections.defaultdict(int)
process_output_file_map = {}
for pid in all_pi... | [
"def",
"_GetProcessOutputFileMap",
"(",
"self",
")",
":",
"all_pids",
"=",
"(",
"[",
"self",
".",
"_browser_backend",
".",
"pid",
"]",
"+",
"self",
".",
"_platform_backend",
".",
"GetChildPids",
"(",
"self",
".",
"_browser_backend",
".",
"pid",
")",
")",
"... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/telemetry/telemetry/core/platform/profiler/__init__.py#L44-L58 | |
apache/qpid-proton | 6bcdfebb55ea3554bc29b1901422532db331a591 | python/proton/_reactor.py | python | Transaction.accept | (self, delivery: Delivery) | Accept a received message under this transaction.
:param delivery: Delivery object for the received message. | Accept a received message under this transaction. | [
"Accept",
"a",
"received",
"message",
"under",
"this",
"transaction",
"."
] | def accept(self, delivery: Delivery) -> None:
"""
Accept a received message under this transaction.
:param delivery: Delivery object for the received message.
"""
self.update(delivery, PN_ACCEPTED)
if self.settle_before_discharge:
delivery.settle()
el... | [
"def",
"accept",
"(",
"self",
",",
"delivery",
":",
"Delivery",
")",
"->",
"None",
":",
"self",
".",
"update",
"(",
"delivery",
",",
"PN_ACCEPTED",
")",
"if",
"self",
".",
"settle_before_discharge",
":",
"delivery",
".",
"settle",
"(",
")",
"else",
":",
... | https://github.com/apache/qpid-proton/blob/6bcdfebb55ea3554bc29b1901422532db331a591/python/proton/_reactor.py#L600-L610 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/nn_ops.py | python | BinaryCrossEntropy.__init__ | (self, reduction='mean') | Initialize BinaryCrossEntropy. | Initialize BinaryCrossEntropy. | [
"Initialize",
"BinaryCrossEntropy",
"."
] | def __init__(self, reduction='mean'):
"""Initialize BinaryCrossEntropy."""
self.reduction = validator.check_string(reduction, ['none', 'mean', 'sum'], 'reduction', self.name) | [
"def",
"__init__",
"(",
"self",
",",
"reduction",
"=",
"'mean'",
")",
":",
"self",
".",
"reduction",
"=",
"validator",
".",
"check_string",
"(",
"reduction",
",",
"[",
"'none'",
",",
"'mean'",
",",
"'sum'",
"]",
",",
"'reduction'",
",",
"self",
".",
"n... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/nn_ops.py#L5225-L5227 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/sessions.py | python | SessionRedirectMixin.should_strip_auth | (self, old_url, new_url) | return changed_port or changed_scheme | Decide whether Authorization header should be removed when redirecting | Decide whether Authorization header should be removed when redirecting | [
"Decide",
"whether",
"Authorization",
"header",
"should",
"be",
"removed",
"when",
"redirecting"
] | def should_strip_auth(self, old_url, new_url):
"""Decide whether Authorization header should be removed when redirecting"""
old_parsed = urlparse(old_url)
new_parsed = urlparse(new_url)
if old_parsed.hostname != new_parsed.hostname:
return True
# Special case: allow h... | [
"def",
"should_strip_auth",
"(",
"self",
",",
"old_url",
",",
"new_url",
")",
":",
"old_parsed",
"=",
"urlparse",
"(",
"old_url",
")",
"new_parsed",
"=",
"urlparse",
"(",
"new_url",
")",
"if",
"old_parsed",
".",
"hostname",
"!=",
"new_parsed",
".",
"hostname... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/sessions.py#L119-L142 | |
pytorch/ELF | e851e786ced8d26cf470f08a6b9bf7e413fc63f7 | src_py/rlpytorch/trainer/trainer.py | python | Trainer.episode_summary | (self, i, save=True) | return self.evaluator.mi["model"].step | Called after each episode. Print stats and summary.
Also print arguments passed in.
Args:
i(int): index in the minibatch | Called after each episode. Print stats and summary. | [
"Called",
"after",
"each",
"episode",
".",
"Print",
"stats",
"and",
"summary",
"."
] | def episode_summary(self, i, save=True):
"""Called after each episode. Print stats and summary.
Also print arguments passed in.
Args:
i(int): index in the minibatch
"""
prefix = "[%s][%d] Iter" % (
str(datetime.now()), self.options.batchsize) + "[%d]: " ... | [
"def",
"episode_summary",
"(",
"self",
",",
"i",
",",
"save",
"=",
"True",
")",
":",
"prefix",
"=",
"\"[%s][%d] Iter\"",
"%",
"(",
"str",
"(",
"datetime",
".",
"now",
"(",
")",
")",
",",
"self",
".",
"options",
".",
"batchsize",
")",
"+",
"\"[%d]: \"... | https://github.com/pytorch/ELF/blob/e851e786ced8d26cf470f08a6b9bf7e413fc63f7/src_py/rlpytorch/trainer/trainer.py#L251-L274 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | TextAttrBorders.IsValid | (*args, **kwargs) | return _richtext.TextAttrBorders_IsValid(*args, **kwargs) | IsValid(self) -> bool | IsValid(self) -> bool | [
"IsValid",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsValid(*args, **kwargs):
"""IsValid(self) -> bool"""
return _richtext.TextAttrBorders_IsValid(*args, **kwargs) | [
"def",
"IsValid",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"TextAttrBorders_IsValid",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L480-L482 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/lib2to3/pytree.py | python | Base._eq | (self, other) | Compare two nodes for equality.
This is called by __eq__ and __ne__. It is only called if the two nodes
have the same type. This must be implemented by the concrete subclass.
Nodes should be considered equal if they have the same structure,
ignoring the prefix string and other context... | Compare two nodes for equality. | [
"Compare",
"two",
"nodes",
"for",
"equality",
"."
] | def _eq(self, other):
"""
Compare two nodes for equality.
This is called by __eq__ and __ne__. It is only called if the two nodes
have the same type. This must be implemented by the concrete subclass.
Nodes should be considered equal if they have the same structure,
ig... | [
"def",
"_eq",
"(",
"self",
",",
"other",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/lib2to3/pytree.py#L66-L75 | ||
Genius-x/genius-x | 9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0 | cocos2d/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py | python | Type.is_function_variadic | (self) | return conf.lib.clang_isFunctionTypeVariadic(self) | Determine whether this function Type is a variadic function type. | Determine whether this function Type is a variadic function type. | [
"Determine",
"whether",
"this",
"function",
"Type",
"is",
"a",
"variadic",
"function",
"type",
"."
] | def is_function_variadic(self):
"""Determine whether this function Type is a variadic function type."""
assert self.kind == TypeKind.FUNCTIONPROTO
return conf.lib.clang_isFunctionTypeVariadic(self) | [
"def",
"is_function_variadic",
"(",
"self",
")",
":",
"assert",
"self",
".",
"kind",
"==",
"TypeKind",
".",
"FUNCTIONPROTO",
"return",
"conf",
".",
"lib",
".",
"clang_isFunctionTypeVariadic",
"(",
"self",
")"
] | https://github.com/Genius-x/genius-x/blob/9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0/cocos2d/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py#L1588-L1592 | |
Yijunmaverick/GenerativeFaceCompletion | f72dea0fa27c779fef7b65d2f01e82bcc23a0eb2 | scripts/cpp_lint.py | python | FileInfo.RepositoryName | (self) | return fullname | FullName after removing the local path to the repository.
If we have a real absolute path name here we can try to do something smart:
detecting the root of the checkout and truncating /path/to/checkout from
the name so that we get header guards that don't include things like
"C:\Documents and Settings\... | FullName after removing the local path to the repository. | [
"FullName",
"after",
"removing",
"the",
"local",
"path",
"to",
"the",
"repository",
"."
] | def RepositoryName(self):
"""FullName after removing the local path to the repository.
If we have a real absolute path name here we can try to do something smart:
detecting the root of the checkout and truncating /path/to/checkout from
the name so that we get header guards that don't include things lik... | [
"def",
"RepositoryName",
"(",
"self",
")",
":",
"fullname",
"=",
"self",
".",
"FullName",
"(",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"fullname",
")",
":",
"project_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"fullname",
")",
"if",
... | https://github.com/Yijunmaverick/GenerativeFaceCompletion/blob/f72dea0fa27c779fef7b65d2f01e82bcc23a0eb2/scripts/cpp_lint.py#L885-L928 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/aui.py | python | AuiTabContainer.GetActivePage | (*args, **kwargs) | return _aui.AuiTabContainer_GetActivePage(*args, **kwargs) | GetActivePage(self) -> int | GetActivePage(self) -> int | [
"GetActivePage",
"(",
"self",
")",
"-",
">",
"int"
] | def GetActivePage(*args, **kwargs):
"""GetActivePage(self) -> int"""
return _aui.AuiTabContainer_GetActivePage(*args, **kwargs) | [
"def",
"GetActivePage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiTabContainer_GetActivePage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/aui.py#L1172-L1174 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/engine/base_preprocessing_layer_v1.py | python | CombinerPreprocessingLayer._set_state_variables | (self, updates) | Directly update the internal state of this Layer. V1 compatible. | Directly update the internal state of this Layer. V1 compatible. | [
"Directly",
"update",
"the",
"internal",
"state",
"of",
"this",
"Layer",
".",
"V1",
"compatible",
"."
] | def _set_state_variables(self, updates):
"""Directly update the internal state of this Layer. V1 compatible."""
# TODO(momernick): Do we need to do any more input sanitization?
if not self.built:
raise RuntimeError('_set_state_variables() must be called after build().')
assignments = []
for v... | [
"def",
"_set_state_variables",
"(",
"self",
",",
"updates",
")",
":",
"# TODO(momernick): Do we need to do any more input sanitization?",
"if",
"not",
"self",
".",
"built",
":",
"raise",
"RuntimeError",
"(",
"'_set_state_variables() must be called after build().'",
")",
"assi... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/engine/base_preprocessing_layer_v1.py#L69-L79 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/fractions.py | python | Fraction._operator_fallbacks | (monomorphic_operator, fallback_operator) | return forward, reverse | Generates forward and reverse operators given a purely-rational
operator and a function from the operator module.
Use this like:
__op__, __rop__ = _operator_fallbacks(just_rational_op, operator.op)
In general, we want to implement the arithmetic operations so
that mixed-mode op... | Generates forward and reverse operators given a purely-rational
operator and a function from the operator module. | [
"Generates",
"forward",
"and",
"reverse",
"operators",
"given",
"a",
"purely",
"-",
"rational",
"operator",
"and",
"a",
"function",
"from",
"the",
"operator",
"module",
"."
] | def _operator_fallbacks(monomorphic_operator, fallback_operator):
"""Generates forward and reverse operators given a purely-rational
operator and a function from the operator module.
Use this like:
__op__, __rop__ = _operator_fallbacks(just_rational_op, operator.op)
In general,... | [
"def",
"_operator_fallbacks",
"(",
"monomorphic_operator",
",",
"fallback_operator",
")",
":",
"def",
"forward",
"(",
"a",
",",
"b",
")",
":",
"if",
"isinstance",
"(",
"b",
",",
"(",
"int",
",",
"Fraction",
")",
")",
":",
"return",
"monomorphic_operator",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/fractions.py#L294-L399 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/masked/maskededit.py | python | MaskedEditMixin.ClearValue | (self) | Blanks the current control value by replacing it with the default value. | Blanks the current control value by replacing it with the default value. | [
"Blanks",
"the",
"current",
"control",
"value",
"by",
"replacing",
"it",
"with",
"the",
"default",
"value",
"."
] | def ClearValue(self):
""" Blanks the current control value by replacing it with the default value."""
## dbg("MaskedEditMixin::ClearValue - value reset to default value (template)")
self._SetValue( self._template )
self._SetInsertionPoint(0)
self.Refresh() | [
"def",
"ClearValue",
"(",
"self",
")",
":",
"## dbg(\"MaskedEditMixin::ClearValue - value reset to default value (template)\")",
"self",
".",
"_SetValue",
"(",
"self",
".",
"_template",
")",
"self",
".",
"_SetInsertionPoint",
"(",
"0",
")",
"self",
".",
"Refresh"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/masked/maskededit.py#L3229-L3234 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/default_scope_funcs.py | python | enter_local_scope | () | Enter a new local scope | Enter a new local scope | [
"Enter",
"a",
"new",
"local",
"scope"
] | def enter_local_scope():
"""
Enter a new local scope
"""
cur_scope = get_cur_scope()
new_scope = cur_scope.new_scope()
__tl_scope__.cur_scope.append(new_scope) | [
"def",
"enter_local_scope",
"(",
")",
":",
"cur_scope",
"=",
"get_cur_scope",
"(",
")",
"new_scope",
"=",
"cur_scope",
".",
"new_scope",
"(",
")",
"__tl_scope__",
".",
"cur_scope",
".",
"append",
"(",
"new_scope",
")"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/default_scope_funcs.py#L59-L65 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | xpathContext.xpathVariableLookupNS | (self, name, ns_uri) | return xpathObjectRet(ret) | Search in the Variable array of the context for the given
variable value. | Search in the Variable array of the context for the given
variable value. | [
"Search",
"in",
"the",
"Variable",
"array",
"of",
"the",
"context",
"for",
"the",
"given",
"variable",
"value",
"."
] | def xpathVariableLookupNS(self, name, ns_uri):
"""Search in the Variable array of the context for the given
variable value. """
ret = libxml2mod.xmlXPathVariableLookupNS(self._o, name, ns_uri)
if ret is None:raise xpathError('xmlXPathVariableLookupNS() failed')
return xpathObj... | [
"def",
"xpathVariableLookupNS",
"(",
"self",
",",
"name",
",",
"ns_uri",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlXPathVariableLookupNS",
"(",
"self",
".",
"_o",
",",
"name",
",",
"ns_uri",
")",
"if",
"ret",
"is",
"None",
":",
"raise",
"xpathError",
... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L6614-L6619 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/metrics/_plot/base.py | python | _check_classifer_response_method | (estimator, response_method) | return prediction_method | Return prediction method from the response_method
Parameters
----------
estimator: object
Classifier to check
response_method: {'auto', 'predict_proba', 'decision_function'}
Specifies whether to use :term:`predict_proba` or
:term:`decision_function` as the target response. If s... | Return prediction method from the response_method | [
"Return",
"prediction",
"method",
"from",
"the",
"response_method"
] | def _check_classifer_response_method(estimator, response_method):
"""Return prediction method from the response_method
Parameters
----------
estimator: object
Classifier to check
response_method: {'auto', 'predict_proba', 'decision_function'}
Specifies whether to use :term:`predict... | [
"def",
"_check_classifer_response_method",
"(",
"estimator",
",",
"response_method",
")",
":",
"if",
"response_method",
"not",
"in",
"(",
"\"predict_proba\"",
",",
"\"decision_function\"",
",",
"\"auto\"",
")",
":",
"raise",
"ValueError",
"(",
"\"response_method must be... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/metrics/_plot/base.py#L1-L40 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/auibar.py | python | AuiDefaultToolBarArt.DrawDropDownButton | (self, dc, wnd, item, rect) | Draws a toolbar dropdown button.
:param `dc`: a :class:`DC` device context;
:param `wnd`: a :class:`Window` derived window;
:param `item`: an instance of :class:`AuiToolBarItem`;
:param Rect `rect`: the :class:`AuiToolBarItem` rectangle. | Draws a toolbar dropdown button.
:param `dc`: a :class:`DC` device context;
:param `wnd`: a :class:`Window` derived window;
:param `item`: an instance of :class:`AuiToolBarItem`;
:param Rect `rect`: the :class:`AuiToolBarItem` rectangle. | [
"Draws",
"a",
"toolbar",
"dropdown",
"button",
".",
":",
"param",
"dc",
":",
"a",
":",
"class",
":",
"DC",
"device",
"context",
";",
":",
"param",
"wnd",
":",
"a",
":",
"class",
":",
"Window",
"derived",
"window",
";",
":",
"param",
"item",
":",
"a... | def DrawDropDownButton(self, dc, wnd, item, rect):
"""
Draws a toolbar dropdown button.
:param `dc`: a :class:`DC` device context;
:param `wnd`: a :class:`Window` derived window;
:param `item`: an instance of :class:`AuiToolBarItem`;
:param Rect `rect`: the :clas... | [
"def",
"DrawDropDownButton",
"(",
"self",
",",
"dc",
",",
"wnd",
",",
"item",
",",
"rect",
")",
":",
"dropbmp_x",
"=",
"dropbmp_y",
"=",
"0",
"button_rect",
"=",
"wx",
".",
"Rect",
"(",
"rect",
".",
"x",
",",
"rect",
".",
"y",
",",
"rect",
".",
"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/auibar.py#L1040-L1124 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/profiler/internal/flops_registry.py | python | _softmax_flops | (graph, node) | return _unary_op_flops(graph, node, ops_per_element=5) | Compute flops for Softmax operation. | Compute flops for Softmax operation. | [
"Compute",
"flops",
"for",
"Softmax",
"operation",
"."
] | def _softmax_flops(graph, node):
"""Compute flops for Softmax operation."""
# Softmax implenetation:
#
# Approximate flops breakdown:
# 2*n -- compute shifted logits
# n -- exp of shifted logits
# 2*n -- compute softmax from exp of shifted logits
return _unary_op_flops... | [
"def",
"_softmax_flops",
"(",
"graph",
",",
"node",
")",
":",
"# Softmax implenetation:",
"#",
"# Approximate flops breakdown:",
"# 2*n -- compute shifted logits",
"# n -- exp of shifted logits",
"# 2*n -- compute softmax from exp of shifted logits",
"r... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/profiler/internal/flops_registry.py#L125-L133 | |
goldeneye-source/ges-code | 2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d | thirdparty/protobuf-2.3.0/python/mox.py | python | Comparator.equals | (self, rhs) | Special equals method that all comparators must implement.
Args:
rhs: any python object | Special equals method that all comparators must implement. | [
"Special",
"equals",
"method",
"that",
"all",
"comparators",
"must",
"implement",
"."
] | def equals(self, rhs):
"""Special equals method that all comparators must implement.
Args:
rhs: any python object
"""
raise NotImplementedError, 'method must be implemented by a subclass.' | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"raise",
"NotImplementedError",
",",
"'method must be implemented by a subclass.'"
] | https://github.com/goldeneye-source/ges-code/blob/2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d/thirdparty/protobuf-2.3.0/python/mox.py#L774-L781 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/diet-plan-performance.py | python | Solution.dietPlanPerformance | (self, calories, k, lower, upper) | return result | :type calories: List[int]
:type k: int
:type lower: int
:type upper: int
:rtype: int | :type calories: List[int]
:type k: int
:type lower: int
:type upper: int
:rtype: int | [
":",
"type",
"calories",
":",
"List",
"[",
"int",
"]",
":",
"type",
"k",
":",
"int",
":",
"type",
"lower",
":",
"int",
":",
"type",
"upper",
":",
"int",
":",
"rtype",
":",
"int"
] | def dietPlanPerformance(self, calories, k, lower, upper):
"""
:type calories: List[int]
:type k: int
:type lower: int
:type upper: int
:rtype: int
"""
total = sum(itertools.islice(calories, 0, k))
result = int(total > upper)-int(total < lower)
... | [
"def",
"dietPlanPerformance",
"(",
"self",
",",
"calories",
",",
"k",
",",
"lower",
",",
"upper",
")",
":",
"total",
"=",
"sum",
"(",
"itertools",
".",
"islice",
"(",
"calories",
",",
"0",
",",
"k",
")",
")",
"result",
"=",
"int",
"(",
"total",
">"... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/diet-plan-performance.py#L8-L21 | |
facebookresearch/minirts | 859e747a5e2fab2355bea083daffa6a36820a7f2 | scripts/behavior_clone/cmd_heads.py | python | DotMoveHead.compute_loss | (self, ufeat, mapfeat, globfeat, x, y, mask) | return loss | loss | loss | [
"loss"
] | def compute_loss(self, ufeat, mapfeat, globfeat, x, y, mask):
"""loss
"""
# y = y // 2
# x = x // 2
loc = y * self.x_size + x
logit = self.forward(ufeat, mapfeat, globfeat)
logp = logit2logp(logit, loc)
loss = -(logp * mask).sum(1)
return loss | [
"def",
"compute_loss",
"(",
"self",
",",
"ufeat",
",",
"mapfeat",
",",
"globfeat",
",",
"x",
",",
"y",
",",
"mask",
")",
":",
"# y = y // 2",
"# x = x // 2",
"loc",
"=",
"y",
"*",
"self",
".",
"x_size",
"+",
"x",
"logit",
"=",
"self",
".",
"forward",... | https://github.com/facebookresearch/minirts/blob/859e747a5e2fab2355bea083daffa6a36820a7f2/scripts/behavior_clone/cmd_heads.py#L236-L245 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBExpressionOptions.SetFetchDynamicValue | (self, *args) | return _lldb.SBExpressionOptions_SetFetchDynamicValue(self, *args) | SetFetchDynamicValue(self, DynamicValueType dynamic = eDynamicCanRunTarget)
SetFetchDynamicValue(self)
Sets whether to cast the expression result to its dynamic type. | SetFetchDynamicValue(self, DynamicValueType dynamic = eDynamicCanRunTarget)
SetFetchDynamicValue(self) | [
"SetFetchDynamicValue",
"(",
"self",
"DynamicValueType",
"dynamic",
"=",
"eDynamicCanRunTarget",
")",
"SetFetchDynamicValue",
"(",
"self",
")"
] | def SetFetchDynamicValue(self, *args):
"""
SetFetchDynamicValue(self, DynamicValueType dynamic = eDynamicCanRunTarget)
SetFetchDynamicValue(self)
Sets whether to cast the expression result to its dynamic type.
"""
return _lldb.SBExpressionOptions_SetFetchDynamicValue(sel... | [
"def",
"SetFetchDynamicValue",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_lldb",
".",
"SBExpressionOptions_SetFetchDynamicValue",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L4106-L4113 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/sumolib/output/convert/phem.py | python | fcd2dri | (inpFCD, outSTRM, ignored) | Reformats the contents of the given fcd-output file into a .dri file, readable
by PHEM. The fcd-output "fcd" must be a valid file name of an fcd-output.
The following may be a matter of changes:
- the engine torque is not given | Reformats the contents of the given fcd-output file into a .dri file, readable
by PHEM. The fcd-output "fcd" must be a valid file name of an fcd-output. | [
"Reformats",
"the",
"contents",
"of",
"the",
"given",
"fcd",
"-",
"output",
"file",
"into",
"a",
".",
"dri",
"file",
"readable",
"by",
"PHEM",
".",
"The",
"fcd",
"-",
"output",
"fcd",
"must",
"be",
"a",
"valid",
"file",
"name",
"of",
"an",
"fcd",
"-"... | def fcd2dri(inpFCD, outSTRM, ignored):
"""
Reformats the contents of the given fcd-output file into a .dri file, readable
by PHEM. The fcd-output "fcd" must be a valid file name of an fcd-output.
The following may be a matter of changes:
- the engine torque is not given
"""
# print >> outST... | [
"def",
"fcd2dri",
"(",
"inpFCD",
",",
"outSTRM",
",",
"ignored",
")",
":",
"# print >> outSTRM, \"v1\\n<t>,<v>,<grad>,<n>\\n[s],[km/h],[%],[1/min]\\n\"",
"print",
"(",
"\"v1\\n<t>,<v>,<grad>\\n[s],[km/h],[%]\"",
",",
"file",
"=",
"outSTRM",
")",
"for",
"q",
"in",
"inpFCD"... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/sumolib/output/convert/phem.py#L44-L59 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/rnn/python/tools/checkpoint_convert.py | python | _split_sharded_vars | (name_shape_map) | return not_sharded, sharded | Split shareded variables.
Args:
name_shape_map: A dict from variable name to variable shape.
Returns:
not_sharded: Names of the non-sharded variables.
sharded: Names of the sharded variables. | Split shareded variables. | [
"Split",
"shareded",
"variables",
"."
] | def _split_sharded_vars(name_shape_map):
"""Split shareded variables.
Args:
name_shape_map: A dict from variable name to variable shape.
Returns:
not_sharded: Names of the non-sharded variables.
sharded: Names of the sharded variables.
"""
sharded = []
not_sharded = []
for name in name_shape... | [
"def",
"_split_sharded_vars",
"(",
"name_shape_map",
")",
":",
"sharded",
"=",
"[",
"]",
"not_sharded",
"=",
"[",
"]",
"for",
"name",
"in",
"name_shape_map",
":",
"if",
"re",
".",
"match",
"(",
"name",
",",
"'_[0-9]+$'",
")",
":",
"if",
"re",
".",
"sub... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/rnn/python/tools/checkpoint_convert.py#L171-L191 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/metrics/pairwise.py | python | chi2_kernel | (X, Y=None, gamma=1.) | return np.exp(K, K) | Computes the exponential chi-squared kernel X and Y.
The chi-squared kernel is computed between each pair of rows in X and Y. X
and Y have to be non-negative. This kernel is most commonly applied to
histograms.
The chi-squared kernel is given by::
k(x, y) = exp(-gamma Sum [(x - y)^2 / (x + y... | Computes the exponential chi-squared kernel X and Y. | [
"Computes",
"the",
"exponential",
"chi",
"-",
"squared",
"kernel",
"X",
"and",
"Y",
"."
] | def chi2_kernel(X, Y=None, gamma=1.):
"""Computes the exponential chi-squared kernel X and Y.
The chi-squared kernel is computed between each pair of rows in X and Y. X
and Y have to be non-negative. This kernel is most commonly applied to
histograms.
The chi-squared kernel is given by::
... | [
"def",
"chi2_kernel",
"(",
"X",
",",
"Y",
"=",
"None",
",",
"gamma",
"=",
"1.",
")",
":",
"K",
"=",
"additive_chi2_kernel",
"(",
"X",
",",
"Y",
")",
"K",
"*=",
"gamma",
"return",
"np",
".",
"exp",
"(",
"K",
",",
"K",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/metrics/pairwise.py#L1242-L1287 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/find-and-replace-pattern.py | python | Solution.findAndReplacePattern | (self, words, pattern) | return filter(match, words) | :type words: List[str]
:type pattern: str
:rtype: List[str] | :type words: List[str]
:type pattern: str
:rtype: List[str] | [
":",
"type",
"words",
":",
"List",
"[",
"str",
"]",
":",
"type",
"pattern",
":",
"str",
":",
"rtype",
":",
"List",
"[",
"str",
"]"
] | def findAndReplacePattern(self, words, pattern):
"""
:type words: List[str]
:type pattern: str
:rtype: List[str]
"""
def match(word):
lookup = {}
for x, y in itertools.izip(pattern, word):
if lookup.setdefault(x, y) != y:
... | [
"def",
"findAndReplacePattern",
"(",
"self",
",",
"words",
",",
"pattern",
")",
":",
"def",
"match",
"(",
"word",
")",
":",
"lookup",
"=",
"{",
"}",
"for",
"x",
",",
"y",
"in",
"itertools",
".",
"izip",
"(",
"pattern",
",",
"word",
")",
":",
"if",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/find-and-replace-pattern.py#L8-L21 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/dataview.py | python | DataViewModelNotifier.Resort | (*args, **kwargs) | return _dataview.DataViewModelNotifier_Resort(*args, **kwargs) | Resort(self)
Override this to be informed that a resort has been initiated after
the sort function has been changed. | Resort(self) | [
"Resort",
"(",
"self",
")"
] | def Resort(*args, **kwargs):
"""
Resort(self)
Override this to be informed that a resort has been initiated after
the sort function has been changed.
"""
return _dataview.DataViewModelNotifier_Resort(*args, **kwargs) | [
"def",
"Resort",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewModelNotifier_Resort",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/dataview.py#L267-L274 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/plan/robotoptimize.py | python | KlamptVariable.unbind | (self) | Unbinds all Variables associated with this. | Unbinds all Variables associated with this. | [
"Unbinds",
"all",
"Variables",
"associated",
"with",
"this",
"."
] | def unbind(self):
"""Unbinds all Variables associated with this."""
for v in self.variables:
v.unbind() | [
"def",
"unbind",
"(",
"self",
")",
":",
"for",
"v",
"in",
"self",
".",
"variables",
":",
"v",
".",
"unbind",
"(",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/plan/robotoptimize.py#L62-L65 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | build/get_syzygy_binaries.py | python | _RmTree | (path) | A wrapper of shutil.rmtree that handles read-only files. | A wrapper of shutil.rmtree that handles read-only files. | [
"A",
"wrapper",
"of",
"shutil",
".",
"rmtree",
"that",
"handles",
"read",
"-",
"only",
"files",
"."
] | def _RmTree(path):
"""A wrapper of shutil.rmtree that handles read-only files."""
shutil.rmtree(path, ignore_errors=False, onerror=_RmTreeHandleReadOnly) | [
"def",
"_RmTree",
"(",
"path",
")",
":",
"shutil",
".",
"rmtree",
"(",
"path",
",",
"ignore_errors",
"=",
"False",
",",
"onerror",
"=",
"_RmTreeHandleReadOnly",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/build/get_syzygy_binaries.py#L185-L187 | ||
OpenXRay/xray-15 | 1390dfb08ed20997d7e8c95147ea8e8cb71f5e86 | cs/sdk/3d_sdk/maya/ver-2008/devkit/plug-ins/scripted/splitUVCmd.py | python | splitUV.doIt | (self, args) | implements the scripted splitUV command.
Arguments:
args - the argument list that was passes to the command from MEL | implements the scripted splitUV command. | [
"implements",
"the",
"scripted",
"splitUV",
"command",
"."
] | def doIt(self, args):
"""
implements the scripted splitUV command.
Arguments:
args - the argument list that was passes to the command from MEL
"""
# Parse the selection list for objects with selected UV components.
# To simplify things, we only take the first object that we find with
# selected UVs an... | [
"def",
"doIt",
"(",
"self",
",",
"args",
")",
":",
"# Parse the selection list for objects with selected UV components.",
"# To simplify things, we only take the first object that we find with",
"# selected UVs and operate on that object alone.",
"#",
"# All other objects are ignored and ret... | https://github.com/OpenXRay/xray-15/blob/1390dfb08ed20997d7e8c95147ea8e8cb71f5e86/cs/sdk/3d_sdk/maya/ver-2008/devkit/plug-ins/scripted/splitUVCmd.py#L99-L195 | ||
OPAE/opae-sdk | 221124343c8275243a249eb72d69e0ea2d568d1b | python/opae.admin/opae/admin/sysfs.py | python | pci_node.rescan | (self) | remove Perform a pci rescan of the PCIe device represented by
this pci_node object. | remove Perform a pci rescan of the PCIe device represented by
this pci_node object. | [
"remove",
"Perform",
"a",
"pci",
"rescan",
"of",
"the",
"PCIe",
"device",
"represented",
"by",
"this",
"pci_node",
"object",
"."
] | def rescan(self):
"""remove Perform a pci rescan of the PCIe device represented by
this pci_node object.
"""
self.log.debug('rescanning device at %s', self.pci_address)
self.node('rescan').value = '1' | [
"def",
"rescan",
"(",
"self",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'rescanning device at %s'",
",",
"self",
".",
"pci_address",
")",
"self",
".",
"node",
"(",
"'rescan'",
")",
".",
"value",
"=",
"'1'"
] | https://github.com/OPAE/opae-sdk/blob/221124343c8275243a249eb72d69e0ea2d568d1b/python/opae.admin/opae/admin/sysfs.py#L454-L459 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | build/android/install_emulator_deps.py | python | CheckSDK | () | return os.path.exists(constants.ANDROID_SDK_ROOT) | Check if SDK is already installed.
Returns:
True if the emulator SDK directory (src/android_emulator_sdk/) exists. | Check if SDK is already installed. | [
"Check",
"if",
"SDK",
"is",
"already",
"installed",
"."
] | def CheckSDK():
"""Check if SDK is already installed.
Returns:
True if the emulator SDK directory (src/android_emulator_sdk/) exists.
"""
return os.path.exists(constants.ANDROID_SDK_ROOT) | [
"def",
"CheckSDK",
"(",
")",
":",
"return",
"os",
".",
"path",
".",
"exists",
"(",
"constants",
".",
"ANDROID_SDK_ROOT",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/build/android/install_emulator_deps.py#L34-L40 | |
google/certificate-transparency | 2588562fd306a447958471b6f06c1069619c1641 | python/ct/crypto/cert.py | python | Certificate.subject_key_identifier | (self) | return self._get_decoded_extension_value(
oid.ID_CE_SUBJECT_KEY_IDENTIFIER) | Get the subject key identifier.
Returns:
An x509_extension.KeyIdentifier (ASN.1 OctetString) holding the
value of the subject key identifier, or None if the subject key
identifier extension is not present.
Raises:
CertificateError: corrupt extension, or m... | Get the subject key identifier. | [
"Get",
"the",
"subject",
"key",
"identifier",
"."
] | def subject_key_identifier(self):
"""Get the subject key identifier.
Returns:
An x509_extension.KeyIdentifier (ASN.1 OctetString) holding the
value of the subject key identifier, or None if the subject key
identifier extension is not present.
Raises:
... | [
"def",
"subject_key_identifier",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_decoded_extension_value",
"(",
"oid",
".",
"ID_CE_SUBJECT_KEY_IDENTIFIER",
")"
] | https://github.com/google/certificate-transparency/blob/2588562fd306a447958471b6f06c1069619c1641/python/ct/crypto/cert.py#L747-L758 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/numpy/math_ops.py | python | std | (x, axis=None, ddof=0, keepdims=False) | return x.std(axis, ddof, keepdims) | Computes the standard deviation along the specified axis.
The standard deviation is the square root of the average of the squared deviations
from the mean, i.e., :math:`std = sqrt(mean(abs(x - x.mean())**2))`.
Returns the standard deviation, which is computed for the flattened array by default,
otherwi... | Computes the standard deviation along the specified axis.
The standard deviation is the square root of the average of the squared deviations
from the mean, i.e., :math:`std = sqrt(mean(abs(x - x.mean())**2))`. | [
"Computes",
"the",
"standard",
"deviation",
"along",
"the",
"specified",
"axis",
".",
"The",
"standard",
"deviation",
"is",
"the",
"square",
"root",
"of",
"the",
"average",
"of",
"the",
"squared",
"deviations",
"from",
"the",
"mean",
"i",
".",
"e",
".",
":... | def std(x, axis=None, ddof=0, keepdims=False):
"""
Computes the standard deviation along the specified axis.
The standard deviation is the square root of the average of the squared deviations
from the mean, i.e., :math:`std = sqrt(mean(abs(x - x.mean())**2))`.
Returns the standard deviation, which ... | [
"def",
"std",
"(",
"x",
",",
"axis",
"=",
"None",
",",
"ddof",
"=",
"0",
",",
"keepdims",
"=",
"False",
")",
":",
"x",
"=",
"_to_tensor",
"(",
"x",
")",
"return",
"x",
".",
"std",
"(",
"axis",
",",
"ddof",
",",
"keepdims",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/numpy/math_ops.py#L878-L918 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/io/formats/format.py | python | DataFrameFormatter._calc_max_rows_fitted | (self) | return self._adjust_max_rows(max_rows) | Number of rows with data fitting the screen. | Number of rows with data fitting the screen. | [
"Number",
"of",
"rows",
"with",
"data",
"fitting",
"the",
"screen",
"."
] | def _calc_max_rows_fitted(self) -> int | None:
"""Number of rows with data fitting the screen."""
max_rows: int | None
if self._is_in_terminal():
_, height = get_terminal_size()
if self.max_rows == 0:
# rows available to fill with actual data
... | [
"def",
"_calc_max_rows_fitted",
"(",
"self",
")",
"->",
"int",
"|",
"None",
":",
"max_rows",
":",
"int",
"|",
"None",
"if",
"self",
".",
"_is_in_terminal",
"(",
")",
":",
"_",
",",
"height",
"=",
"get_terminal_size",
"(",
")",
"if",
"self",
".",
"max_r... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/formats/format.py#L657-L674 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/iterator-for-combination.py | python | CombinationIterator.__init__ | (self, characters, combinationLength) | :type characters: str
:type combinationLength: int | :type characters: str
:type combinationLength: int | [
":",
"type",
"characters",
":",
"str",
":",
"type",
"combinationLength",
":",
"int"
] | def __init__(self, characters, combinationLength):
"""
:type characters: str
:type combinationLength: int
"""
self.__it = itertools.combinations(characters, combinationLength)
self.__curr = None
self.__last = characters[-combinationLength:] | [
"def",
"__init__",
"(",
"self",
",",
"characters",
",",
"combinationLength",
")",
":",
"self",
".",
"__it",
"=",
"itertools",
".",
"combinations",
"(",
"characters",
",",
"combinationLength",
")",
"self",
".",
"__curr",
"=",
"None",
"self",
".",
"__last",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/iterator-for-combination.py#L9-L16 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/protobuf/python/google/protobuf/text_format.py | python | _Tokenizer.ConsumeString | (self) | Consumes a string value.
Returns:
The string parsed.
Raises:
ParseError: If a string value couldn't be consumed. | Consumes a string value. | [
"Consumes",
"a",
"string",
"value",
"."
] | def ConsumeString(self):
"""Consumes a string value.
Returns:
The string parsed.
Raises:
ParseError: If a string value couldn't be consumed.
"""
bytes = self.ConsumeByteString()
try:
return unicode(bytes, 'utf-8')
except UnicodeDecodeError, e:
raise self._StringPars... | [
"def",
"ConsumeString",
"(",
"self",
")",
":",
"bytes",
"=",
"self",
".",
"ConsumeByteString",
"(",
")",
"try",
":",
"return",
"unicode",
"(",
"bytes",
",",
"'utf-8'",
")",
"except",
"UnicodeDecodeError",
",",
"e",
":",
"raise",
"self",
".",
"_StringParseE... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/protobuf/python/google/protobuf/text_format.py#L532-L545 | ||
OGRECave/ogre-next | 287307980e6de8910f04f3cc0994451b075071fd | Tools/BlenderExport/ogrepkg/armatureexport.py | python | ArmatureAnimation.__init__ | (self, bAction, name, startFrame, endFrame) | return | Constructor
@param bAction Blender action of the animation
@param name Animation name
@param startFrame first frame of the animation
@param endFrame last frame of the animation | Constructor | [
"Constructor"
] | def __init__(self, bAction, name, startFrame, endFrame):
"""Constructor
@param bAction Blender action of the animation
@param name Animation name
@param startFrame first frame of the animation
@param endFrame last frame of the animation
"""
self.bAction = bActi... | [
"def",
"__init__",
"(",
"self",
",",
"bAction",
",",
"name",
",",
"startFrame",
",",
"endFrame",
")",
":",
"self",
".",
"bAction",
"=",
"bAction",
"self",
".",
"name",
"=",
"name",
"self",
".",
"startFrame",
"=",
"startFrame",
"self",
".",
"endFrame",
... | https://github.com/OGRECave/ogre-next/blob/287307980e6de8910f04f3cc0994451b075071fd/Tools/BlenderExport/ogrepkg/armatureexport.py#L110-L125 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/specs/python/specs.py | python | create_net_fun | (spec, environment=None) | return net.funcall | Evaluates a spec and returns the binding of `net`.
Specs are written in a DSL based on function composition. A spec
like `net = Cr(64, [3, 3])` assigns an object that represents a
single argument function capable of creating a network to
the variable `net`.
Args:
spec: specification as a string, endi... | Evaluates a spec and returns the binding of `net`. | [
"Evaluates",
"a",
"spec",
"and",
"returns",
"the",
"binding",
"of",
"net",
"."
] | def create_net_fun(spec, environment=None):
"""Evaluates a spec and returns the binding of `net`.
Specs are written in a DSL based on function composition. A spec
like `net = Cr(64, [3, 3])` assigns an object that represents a
single argument function capable of creating a network to
the variable `net`.
... | [
"def",
"create_net_fun",
"(",
"spec",
",",
"environment",
"=",
"None",
")",
":",
"bindings",
"=",
"eval_spec",
"(",
"spec",
",",
"environment",
")",
"net",
"=",
"bindings",
".",
"get",
"(",
"\"net\"",
",",
"None",
")",
"if",
"net",
"is",
"None",
":",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/specs/python/specs.py#L79-L103 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py | python | PtyProcess.getecho | (self) | return self.echo | This returns the terminal echo mode. This returns True if echo is
on or False if echo is off. Child applications that are expecting you
to enter a password often set ECHO False. See waitnoecho().
Not supported on platforms where ``isatty()`` returns False. | This returns the terminal echo mode. This returns True if echo is
on or False if echo is off. Child applications that are expecting you
to enter a password often set ECHO False. See waitnoecho(). | [
"This",
"returns",
"the",
"terminal",
"echo",
"mode",
".",
"This",
"returns",
"True",
"if",
"echo",
"is",
"on",
"or",
"False",
"if",
"echo",
"is",
"off",
".",
"Child",
"applications",
"that",
"are",
"expecting",
"you",
"to",
"enter",
"a",
"password",
"of... | def getecho(self):
'''This returns the terminal echo mode. This returns True if echo is
on or False if echo is off. Child applications that are expecting you
to enter a password often set ECHO False. See waitnoecho().
Not supported on platforms where ``isatty()`` returns False. '''
... | [
"def",
"getecho",
"(",
"self",
")",
":",
"try",
":",
"attr",
"=",
"termios",
".",
"tcgetattr",
"(",
"self",
".",
"fd",
")",
"except",
"termios",
".",
"error",
"as",
"err",
":",
"errmsg",
"=",
"'getecho() may not be called on this platform'",
"if",
"err",
"... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py#L449-L465 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/polynomial/polynomial.py | python | polysub | (c1, c2) | return pu.trimseq(ret) | Subtract one polynomial from another.
Returns the difference of two polynomials `c1` - `c2`. The arguments
are sequences of coefficients from lowest order term to highest, i.e.,
[1,2,3] represents the polynomial ``1 + 2*x + 3*x**2``.
Parameters
----------
c1, c2 : array_like
1-D array... | Subtract one polynomial from another. | [
"Subtract",
"one",
"polynomial",
"from",
"another",
"."
] | def polysub(c1, c2):
"""
Subtract one polynomial from another.
Returns the difference of two polynomials `c1` - `c2`. The arguments
are sequences of coefficients from lowest order term to highest, i.e.,
[1,2,3] represents the polynomial ``1 + 2*x + 3*x**2``.
Parameters
----------
c1, ... | [
"def",
"polysub",
"(",
"c1",
",",
"c2",
")",
":",
"# c1, c2 are trimmed copies",
"[",
"c1",
",",
"c2",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"c1",
",",
"c2",
"]",
")",
"if",
"len",
"(",
"c1",
")",
">",
"len",
"(",
"c2",
")",
":",
"c1",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/polynomial/polynomial.py#L252-L295 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/intersection-of-three-sorted-arrays.py | python | Solution.arraysIntersection | (self, arr1, arr2, arr3) | return result | :type arr1: List[int]
:type arr2: List[int]
:type arr3: List[int]
:rtype: List[int] | :type arr1: List[int]
:type arr2: List[int]
:type arr3: List[int]
:rtype: List[int] | [
":",
"type",
"arr1",
":",
"List",
"[",
"int",
"]",
":",
"type",
"arr2",
":",
"List",
"[",
"int",
"]",
":",
"type",
"arr3",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"List",
"[",
"int",
"]"
] | def arraysIntersection(self, arr1, arr2, arr3):
"""
:type arr1: List[int]
:type arr2: List[int]
:type arr3: List[int]
:rtype: List[int]
"""
result = []
i, j, k = 0, 0, 0
while i != len(arr1) and j != len(arr2) and k != len(arr3):
if arr... | [
"def",
"arraysIntersection",
"(",
"self",
",",
"arr1",
",",
"arr2",
",",
"arr3",
")",
":",
"result",
"=",
"[",
"]",
"i",
",",
"j",
",",
"k",
"=",
"0",
",",
"0",
",",
"0",
"while",
"i",
"!=",
"len",
"(",
"arr1",
")",
"and",
"j",
"!=",
"len",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/intersection-of-three-sorted-arrays.py#L5-L28 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/distutils/ccompiler.py | python | gen_preprocess_options | (macros, include_dirs) | return pp_opts | Generate C pre-processor options (-D, -U, -I) as used by at least
two types of compilers: the typical Unix compiler and Visual C++.
'macros' is the usual thing, a list of 1- or 2-tuples, where (name,)
means undefine (-U) macro 'name', and (name,value) means define (-D)
macro 'name' to 'value'. 'include... | Generate C pre-processor options (-D, -U, -I) as used by at least
two types of compilers: the typical Unix compiler and Visual C++.
'macros' is the usual thing, a list of 1- or 2-tuples, where (name,)
means undefine (-U) macro 'name', and (name,value) means define (-D)
macro 'name' to 'value'. 'include... | [
"Generate",
"C",
"pre",
"-",
"processor",
"options",
"(",
"-",
"D",
"-",
"U",
"-",
"I",
")",
"as",
"used",
"by",
"at",
"least",
"two",
"types",
"of",
"compilers",
":",
"the",
"typical",
"Unix",
"compiler",
"and",
"Visual",
"C",
"++",
".",
"macros",
... | def gen_preprocess_options(macros, include_dirs):
"""Generate C pre-processor options (-D, -U, -I) as used by at least
two types of compilers: the typical Unix compiler and Visual C++.
'macros' is the usual thing, a list of 1- or 2-tuples, where (name,)
means undefine (-U) macro 'name', and (name,value)... | [
"def",
"gen_preprocess_options",
"(",
"macros",
",",
"include_dirs",
")",
":",
"# XXX it would be nice (mainly aesthetic, and so we don't generate",
"# stupid-looking command lines) to go over 'macros' and eliminate",
"# redundant definitions/undefinitions (ie. ensure that only the",
"# latest... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/distutils/ccompiler.py#L1035-L1077 | |
NVlabs/fermat | 06e8c03ac59ab440cbb13897f90631ef1861e769 | contrib/assimp-4.1.0/port/PyAssimp/scripts/transformations.py | python | rotation_matrix | (angle, direction, point=None) | return M | Return matrix to rotate about axis defined by point and direction.
>>> angle = (random.random() - 0.5) * (2*math.pi)
>>> direc = numpy.random.random(3) - 0.5
>>> point = numpy.random.random(3) - 0.5
>>> R0 = rotation_matrix(angle, direc, point)
>>> R1 = rotation_matrix(angle-2*math.pi, direc, point... | Return matrix to rotate about axis defined by point and direction. | [
"Return",
"matrix",
"to",
"rotate",
"about",
"axis",
"defined",
"by",
"point",
"and",
"direction",
"."
] | def rotation_matrix(angle, direction, point=None):
"""Return matrix to rotate about axis defined by point and direction.
>>> angle = (random.random() - 0.5) * (2*math.pi)
>>> direc = numpy.random.random(3) - 0.5
>>> point = numpy.random.random(3) - 0.5
>>> R0 = rotation_matrix(angle, direc, point)
... | [
"def",
"rotation_matrix",
"(",
"angle",
",",
"direction",
",",
"point",
"=",
"None",
")",
":",
"sina",
"=",
"math",
".",
"sin",
"(",
"angle",
")",
"cosa",
"=",
"math",
".",
"cos",
"(",
"angle",
")",
"direction",
"=",
"unit_vector",
"(",
"direction",
... | https://github.com/NVlabs/fermat/blob/06e8c03ac59ab440cbb13897f90631ef1861e769/contrib/assimp-4.1.0/port/PyAssimp/scripts/transformations.py#L275-L316 | |
DanielSWolf/rhubarb-lip-sync | 5cface0af3b6e4e58c0b829c51561d784fb9f52f | rhubarb/lib/sphinxbase-rev13216/doc/doxy2swig.py | python | Doxy2SWIG.parse_Element | (self, node) | Parse an `ELEMENT_NODE`. This calls specific
`do_<tagName>` handers for different elements. If no handler
is available the `generic_parse` method is called. All
tagNames specified in `self.ignores` are simply ignored. | Parse an `ELEMENT_NODE`. This calls specific
`do_<tagName>` handers for different elements. If no handler
is available the `generic_parse` method is called. All
tagNames specified in `self.ignores` are simply ignored. | [
"Parse",
"an",
"ELEMENT_NODE",
".",
"This",
"calls",
"specific",
"do_<tagName",
">",
"handers",
"for",
"different",
"elements",
".",
"If",
"no",
"handler",
"is",
"available",
"the",
"generic_parse",
"method",
"is",
"called",
".",
"All",
"tagNames",
"specified",
... | def parse_Element(self, node):
"""Parse an `ELEMENT_NODE`. This calls specific
`do_<tagName>` handers for different elements. If no handler
is available the `generic_parse` method is called. All
tagNames specified in `self.ignores` are simply ignored.
"""
name... | [
"def",
"parse_Element",
"(",
"self",
",",
"node",
")",
":",
"name",
"=",
"node",
".",
"tagName",
"ignores",
"=",
"self",
".",
"ignores",
"if",
"name",
"in",
"ignores",
":",
"return",
"attr",
"=",
"\"do_%s\"",
"%",
"name",
"if",
"hasattr",
"(",
"self",
... | https://github.com/DanielSWolf/rhubarb-lip-sync/blob/5cface0af3b6e4e58c0b829c51561d784fb9f52f/rhubarb/lib/sphinxbase-rev13216/doc/doxy2swig.py#L148-L164 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/requests/cookies.py | python | RequestsCookieJar._find | (self, name, domain=None, path=None) | Requests uses this method internally to get cookie values.
If there are conflicting cookies, _find arbitrarily chooses one.
See _find_no_duplicates if you want an exception thrown if there are
conflicting cookies.
:param name: a string containing name of cookie
:param domain: (... | Requests uses this method internally to get cookie values. | [
"Requests",
"uses",
"this",
"method",
"internally",
"to",
"get",
"cookie",
"values",
"."
] | def _find(self, name, domain=None, path=None):
"""Requests uses this method internally to get cookie values.
If there are conflicting cookies, _find arbitrarily chooses one.
See _find_no_duplicates if you want an exception thrown if there are
conflicting cookies.
:param name: a... | [
"def",
"_find",
"(",
"self",
",",
"name",
",",
"domain",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"for",
"cookie",
"in",
"iter",
"(",
"self",
")",
":",
"if",
"cookie",
".",
"name",
"==",
"name",
":",
"if",
"domain",
"is",
"None",
"or",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/requests/cookies.py#L356-L374 | ||
IntelRealSense/librealsense | c94410a420b74e5fb6a414bd12215c05ddd82b69 | wrappers/python/examples/box_dimensioner_multicam/realsense_device_manager.py | python | DeviceManager.get_depth_to_color_extrinsics | (self, frames) | return device_extrinsics | Get the extrinsics between the depth imager 1 and the color imager using its frame delivered by the realsense device
Parameters:
-----------
frames : rs::frame
The frame grabbed from the imager inside the Intel RealSense for which the intrinsic is needed
Return:
... | Get the extrinsics between the depth imager 1 and the color imager using its frame delivered by the realsense device | [
"Get",
"the",
"extrinsics",
"between",
"the",
"depth",
"imager",
"1",
"and",
"the",
"color",
"imager",
"using",
"its",
"frame",
"delivered",
"by",
"the",
"realsense",
"device"
] | def get_depth_to_color_extrinsics(self, frames):
"""
Get the extrinsics between the depth imager 1 and the color imager using its frame delivered by the realsense device
Parameters:
-----------
frames : rs::frame
The frame grabbed from the imager inside the Inte... | [
"def",
"get_depth_to_color_extrinsics",
"(",
"self",
",",
"frames",
")",
":",
"device_extrinsics",
"=",
"{",
"}",
"for",
"(",
"dev_info",
",",
"frameset",
")",
"in",
"frames",
".",
"items",
"(",
")",
":",
"serial",
"=",
"dev_info",
"[",
"0",
"]",
"device... | https://github.com/IntelRealSense/librealsense/blob/c94410a420b74e5fb6a414bd12215c05ddd82b69/wrappers/python/examples/box_dimensioner_multicam/realsense_device_manager.py#L289-L312 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/src/robotsim.py | python | WaitForStream | (protocol, name, timeout) | return _robotsim.WaitForStream(protocol, name, timeout) | WaitForStream(char const * protocol, char const * name, double timeout) -> bool
Waits up to timeout seconds for an update on the given stream.
Return:
(bool): True if the stream was updated. | WaitForStream(char const * protocol, char const * name, double timeout) -> bool | [
"WaitForStream",
"(",
"char",
"const",
"*",
"protocol",
"char",
"const",
"*",
"name",
"double",
"timeout",
")",
"-",
">",
"bool"
] | def WaitForStream(protocol, name, timeout):
"""
WaitForStream(char const * protocol, char const * name, double timeout) -> bool
Waits up to timeout seconds for an update on the given stream.
Return:
(bool): True if the stream was updated.
"""
return _robotsim.WaitForStream(pr... | [
"def",
"WaitForStream",
"(",
"protocol",
",",
"name",
",",
"timeout",
")",
":",
"return",
"_robotsim",
".",
"WaitForStream",
"(",
"protocol",
",",
"name",
",",
"timeout",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/src/robotsim.py#L8733-L8746 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/client/session.py | python | BaseSession.run | (self, fetches, feed_dict=None, options=None, run_metadata=None) | return result | Runs operations and evaluates tensors in `fetches`.
This method runs one "step" of TensorFlow computation, by
running the necessary graph fragment to execute every `Operation`
and evaluate every `Tensor` in `fetches`, substituting the values in
`feed_dict` for the corresponding input values.
The `... | Runs operations and evaluates tensors in `fetches`. | [
"Runs",
"operations",
"and",
"evaluates",
"tensors",
"in",
"fetches",
"."
] | def run(self, fetches, feed_dict=None, options=None, run_metadata=None):
"""Runs operations and evaluates tensors in `fetches`.
This method runs one "step" of TensorFlow computation, by
running the necessary graph fragment to execute every `Operation`
and evaluate every `Tensor` in `fetches`, substitut... | [
"def",
"run",
"(",
"self",
",",
"fetches",
",",
"feed_dict",
"=",
"None",
",",
"options",
"=",
"None",
",",
"run_metadata",
"=",
"None",
")",
":",
"run_metadata_ptr",
"=",
"tf_session",
".",
"TF_NewBuffer",
"(",
")",
"if",
"options",
":",
"options_ptr",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/client/session.py#L599-L718 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/distutils/filelist.py | python | translate_pattern | (pattern, anchor=1, prefix=None, is_regex=0) | return re.compile(pattern_re) | Translate a shell-like wildcard pattern to a compiled regular
expression.
Return the compiled regex. If 'is_regex' true,
then 'pattern' is directly compiled to a regex (if it's a string)
or just returned as-is (assumes it's a regex object). | Translate a shell-like wildcard pattern to a compiled regular
expression. | [
"Translate",
"a",
"shell",
"-",
"like",
"wildcard",
"pattern",
"to",
"a",
"compiled",
"regular",
"expression",
"."
] | def translate_pattern(pattern, anchor=1, prefix=None, is_regex=0):
"""Translate a shell-like wildcard pattern to a compiled regular
expression.
Return the compiled regex. If 'is_regex' true,
then 'pattern' is directly compiled to a regex (if it's a string)
or just returned as-is (assumes it's a re... | [
"def",
"translate_pattern",
"(",
"pattern",
",",
"anchor",
"=",
"1",
",",
"prefix",
"=",
"None",
",",
"is_regex",
"=",
"0",
")",
":",
"if",
"is_regex",
":",
"if",
"isinstance",
"(",
"pattern",
",",
"str",
")",
":",
"return",
"re",
".",
"compile",
"("... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/distutils/filelist.py#L312-L343 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/telnetlib.py | python | Telnet.read_very_lazy | (self) | return buf | Return any data available in the cooked queue (very lazy).
Raise EOFError if connection closed and no data available.
Return b'' if no cooked data available otherwise. Don't block. | Return any data available in the cooked queue (very lazy). | [
"Return",
"any",
"data",
"available",
"in",
"the",
"cooked",
"queue",
"(",
"very",
"lazy",
")",
"."
] | def read_very_lazy(self):
"""Return any data available in the cooked queue (very lazy).
Raise EOFError if connection closed and no data available.
Return b'' if no cooked data available otherwise. Don't block.
"""
buf = self.cookedq
self.cookedq = b''
if not bu... | [
"def",
"read_very_lazy",
"(",
"self",
")",
":",
"buf",
"=",
"self",
".",
"cookedq",
"self",
".",
"cookedq",
"=",
"b''",
"if",
"not",
"buf",
"and",
"self",
".",
"eof",
"and",
"not",
"self",
".",
"rawq",
":",
"raise",
"EOFError",
"(",
"'telnet connection... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/telnetlib.py#L393-L404 | |
epiqc/ScaffCC | 66a79944ee4cd116b27bc1a69137276885461db8 | braidflash/arrange.py | python | partition | (nodes, size_nodes_tl, filename) | return nodes_tl, nodes_br | Returns nodes_tl, nodes_br. | Returns nodes_tl, nodes_br. | [
"Returns",
"nodes_tl",
"nodes_br",
"."
] | def partition(nodes, size_nodes_tl, filename):
"""Returns nodes_tl, nodes_br."""
weight_0 = float(size_nodes_tl) / len(nodes)
num_edges = count_num_edges(nodes)
f = open(filename, 'w')
f.write('%s %s 001\n' % (len(nodes), num_edges))
for src_node in nodes:
x = 1
for dst_node in nodes:
if src_... | [
"def",
"partition",
"(",
"nodes",
",",
"size_nodes_tl",
",",
"filename",
")",
":",
"weight_0",
"=",
"float",
"(",
"size_nodes_tl",
")",
"/",
"len",
"(",
"nodes",
")",
"num_edges",
"=",
"count_num_edges",
"(",
"nodes",
")",
"f",
"=",
"open",
"(",
"filenam... | https://github.com/epiqc/ScaffCC/blob/66a79944ee4cd116b27bc1a69137276885461db8/braidflash/arrange.py#L254-L297 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/grit/grit/node/base.py | python | Node.AddChild | (self, child) | Adds a child to the list of children of this node, if it is a valid
child for the node. | Adds a child to the list of children of this node, if it is a valid
child for the node. | [
"Adds",
"a",
"child",
"to",
"the",
"list",
"of",
"children",
"of",
"this",
"node",
"if",
"it",
"is",
"a",
"valid",
"child",
"for",
"the",
"node",
"."
] | def AddChild(self, child):
'''Adds a child to the list of children of this node, if it is a valid
child for the node.'''
assert isinstance(child, Node)
if (not self._IsValidChild(child) or
self._ContentType() == self._CONTENT_TYPE_CDATA):
explanation = 'invalid child %s for parent %s' % (s... | [
"def",
"AddChild",
"(",
"self",
",",
"child",
")",
":",
"assert",
"isinstance",
"(",
"child",
",",
"Node",
")",
"if",
"(",
"not",
"self",
".",
"_IsValidChild",
"(",
"child",
")",
"or",
"self",
".",
"_ContentType",
"(",
")",
"==",
"self",
".",
"_CONTE... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/grit/grit/node/base.py#L113-L122 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mailbox.py | python | _mboxMMDF._install_message | (self, message) | return (start, stop) | Format a message and blindly write to self._file. | Format a message and blindly write to self._file. | [
"Format",
"a",
"message",
"and",
"blindly",
"write",
"to",
"self",
".",
"_file",
"."
] | def _install_message(self, message):
"""Format a message and blindly write to self._file."""
from_line = None
if isinstance(message, str) and message.startswith('From '):
newline = message.find('\n')
if newline != -1:
from_line = message[:newline]
... | [
"def",
"_install_message",
"(",
"self",
",",
"message",
")",
":",
"from_line",
"=",
"None",
"if",
"isinstance",
"(",
"message",
",",
"str",
")",
"and",
"message",
".",
"startswith",
"(",
"'From '",
")",
":",
"newline",
"=",
"message",
".",
"find",
"(",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mailbox.py#L786-L807 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.