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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriVtkDataExportOperation.py | python | PhactoriVtkDataExportOperation.ExportOperationData | (self, datadescription) | overrides parent class method in order to output .vtm or .vtp
(vtkMultiBlockData or vtkPolyData) files | overrides parent class method in order to output .vtm or .vtp
(vtkMultiBlockData or vtkPolyData) files | [
"overrides",
"parent",
"class",
"method",
"in",
"order",
"to",
"output",
".",
"vtm",
"or",
".",
"vtp",
"(",
"vtkMultiBlockData",
"or",
"vtkPolyData",
")",
"files"
] | def ExportOperationData(self, datadescription):
"""overrides parent class method in order to output .vtm or .vtp
(vtkMultiBlockData or vtkPolyData) files"""
if PhactoriDbg(100):
myDebugPrint3("PhactoriVtkDataExportOperation." \
"ExportOperationData entered\n", 100)
self.mFilterToWrit... | [
"def",
"ExportOperationData",
"(",
"self",
",",
"datadescription",
")",
":",
"if",
"PhactoriDbg",
"(",
"100",
")",
":",
"myDebugPrint3",
"(",
"\"PhactoriVtkDataExportOperation.\"",
"\"ExportOperationData entered\\n\"",
",",
"100",
")",
"self",
".",
"mFilterToWriteDataFr... | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriVtkDataExportOperation.py#L156-L190 | ||
KDE/krita | 10ea63984e00366865769c193ab298de73a59c5c | plugins/python/scripter/ui_scripter/editor/statusbar.py | python | StatusBar.paintEvent | (self, event) | It Invokes the draw method(statusBarPaintEvent) in CodeEditor | It Invokes the draw method(statusBarPaintEvent) in CodeEditor | [
"It",
"Invokes",
"the",
"draw",
"method",
"(",
"statusBarPaintEvent",
")",
"in",
"CodeEditor"
] | def paintEvent(self, event):
"""It Invokes the draw method(statusBarPaintEvent) in CodeEditor"""
self.codeEditor.statusBarPaintEvent(event) | [
"def",
"paintEvent",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"codeEditor",
".",
"statusBarPaintEvent",
"(",
"event",
")"
] | https://github.com/KDE/krita/blob/10ea63984e00366865769c193ab298de73a59c5c/plugins/python/scripter/ui_scripter/editor/statusbar.py#L19-L21 | ||
Dobiasd/frugally-deep | 99d9378c6ef537a209bcb2a102e953899a6ab0e3 | keras_export/convert_model.py | python | show_embedding_layer | (layer) | return result | Serialize Embedding layer to dict | Serialize Embedding layer to dict | [
"Serialize",
"Embedding",
"layer",
"to",
"dict"
] | def show_embedding_layer(layer):
"""Serialize Embedding layer to dict"""
weights = layer.get_weights()
assert len(weights) == 1
result = {
'weights': encode_floats(weights[0])
}
return result | [
"def",
"show_embedding_layer",
"(",
"layer",
")",
":",
"weights",
"=",
"layer",
".",
"get_weights",
"(",
")",
"assert",
"len",
"(",
"weights",
")",
"==",
"1",
"result",
"=",
"{",
"'weights'",
":",
"encode_floats",
"(",
"weights",
"[",
"0",
"]",
")",
"}... | https://github.com/Dobiasd/frugally-deep/blob/99d9378c6ef537a209bcb2a102e953899a6ab0e3/keras_export/convert_model.py#L355-L362 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | FileCtrlEvent.__init__ | (self, *args, **kwargs) | __init__(self, EventType type, Object evtObject, int id) -> FileCtrlEvent | __init__(self, EventType type, Object evtObject, int id) -> FileCtrlEvent | [
"__init__",
"(",
"self",
"EventType",
"type",
"Object",
"evtObject",
"int",
"id",
")",
"-",
">",
"FileCtrlEvent"
] | def __init__(self, *args, **kwargs):
"""__init__(self, EventType type, Object evtObject, int id) -> FileCtrlEvent"""
_controls_.FileCtrlEvent_swiginit(self,_controls_.new_FileCtrlEvent(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_controls_",
".",
"FileCtrlEvent_swiginit",
"(",
"self",
",",
"_controls_",
".",
"new_FileCtrlEvent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L7734-L7736 | ||
dicecco1/fpga_caffe | 7a191704efd7873071cfef35772d7e7bf3e3cfd6 | python/caffe/net_spec.py | python | assign_proto | (proto, name, val) | Assign a Python object to a protobuf message, based on the Python
type (in recursive fashion). Lists become repeated fields/messages, dicts
become messages, and other types are assigned directly. For convenience,
repeated fields whose values are not lists are converted to single-element
lists; e.g., `my... | Assign a Python object to a protobuf message, based on the Python
type (in recursive fashion). Lists become repeated fields/messages, dicts
become messages, and other types are assigned directly. For convenience,
repeated fields whose values are not lists are converted to single-element
lists; e.g., `my... | [
"Assign",
"a",
"Python",
"object",
"to",
"a",
"protobuf",
"message",
"based",
"on",
"the",
"Python",
"type",
"(",
"in",
"recursive",
"fashion",
")",
".",
"Lists",
"become",
"repeated",
"fields",
"/",
"messages",
"dicts",
"become",
"messages",
"and",
"other",... | def assign_proto(proto, name, val):
"""Assign a Python object to a protobuf message, based on the Python
type (in recursive fashion). Lists become repeated fields/messages, dicts
become messages, and other types are assigned directly. For convenience,
repeated fields whose values are not lists are conve... | [
"def",
"assign_proto",
"(",
"proto",
",",
"name",
",",
"val",
")",
":",
"is_repeated_field",
"=",
"hasattr",
"(",
"getattr",
"(",
"proto",
",",
"name",
")",
",",
"'extend'",
")",
"if",
"is_repeated_field",
"and",
"not",
"isinstance",
"(",
"val",
",",
"li... | https://github.com/dicecco1/fpga_caffe/blob/7a191704efd7873071cfef35772d7e7bf3e3cfd6/python/caffe/net_spec.py#L56-L79 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/propgrid.py | python | PropertyGrid.EndLabelEdit | (*args, **kwargs) | return _propgrid.PropertyGrid_EndLabelEdit(*args, **kwargs) | EndLabelEdit(self, bool commit=True) | EndLabelEdit(self, bool commit=True) | [
"EndLabelEdit",
"(",
"self",
"bool",
"commit",
"=",
"True",
")"
] | def EndLabelEdit(*args, **kwargs):
"""EndLabelEdit(self, bool commit=True)"""
return _propgrid.PropertyGrid_EndLabelEdit(*args, **kwargs) | [
"def",
"EndLabelEdit",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGrid_EndLabelEdit",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L2219-L2221 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/lib/financial.py | python | ipmt | (rate, per, nper, pv, fv=0.0, when='end') | Not implemented. Compute the payment portion for loan interest.
Parameters
----------
rate : scalar or array_like of shape(M, )
Rate of interest as decimal (not per cent) per period
per : scalar or array_like of shape(M, )
Interest paid against the loan changes during the life or the lo... | Not implemented. Compute the payment portion for loan interest. | [
"Not",
"implemented",
".",
"Compute",
"the",
"payment",
"portion",
"for",
"loan",
"interest",
"."
] | def ipmt(rate, per, nper, pv, fv=0.0, when='end'):
"""
Not implemented. Compute the payment portion for loan interest.
Parameters
----------
rate : scalar or array_like of shape(M, )
Rate of interest as decimal (not per cent) per period
per : scalar or array_like of shape(M, )
I... | [
"def",
"ipmt",
"(",
"rate",
",",
"per",
",",
"nper",
",",
"pv",
",",
"fv",
"=",
"0.0",
",",
"when",
"=",
"'end'",
")",
":",
"total",
"=",
"pmt",
"(",
"rate",
",",
"nper",
",",
"pv",
",",
"fv",
",",
"when",
")",
"# Now, compute the nth step in the a... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/lib/financial.py#L278-L320 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/packager_enterprise.py | python | make_package | (distro, build_os, arch, spec, srcdir) | return distro.make_pkg(build_os, arch, spec, srcdir) | Construct the package for (arch, distro, spec).
Get the packaging files from srcdir and any user-specified suffix from suffixes. | Construct the package for (arch, distro, spec). | [
"Construct",
"the",
"package",
"for",
"(",
"arch",
"distro",
"spec",
")",
"."
] | def make_package(distro, build_os, arch, spec, srcdir):
"""Construct the package for (arch, distro, spec).
Get the packaging files from srcdir and any user-specified suffix from suffixes.
"""
sdir = setupdir(distro, build_os, arch, spec)
packager.ensure_dir(sdir)
# Note that the RPM packages g... | [
"def",
"make_package",
"(",
"distro",
",",
"build_os",
",",
"arch",
",",
"spec",
",",
"srcdir",
")",
":",
"sdir",
"=",
"setupdir",
"(",
"distro",
",",
"build_os",
",",
"arch",
",",
"spec",
")",
"packager",
".",
"ensure_dir",
"(",
"sdir",
")",
"# Note t... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/packager_enterprise.py#L241-L265 | |
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/schema.py | python | _ret_dict_handler | (ret_dict, record_val) | 内部函数 | 内部函数 | [
"内部函数"
] | def _ret_dict_handler(ret_dict, record_val):
""" 内部函数 """
inter_type_keys = []
inter_type_values = []
inter_type_flag = False
ptype_keys = []
ptype_values = []
ptype_flag = False
for key, value in ret_dict.items():
if isinstance(value, ptype.PType):
ptype_keys.append... | [
"def",
"_ret_dict_handler",
"(",
"ret_dict",
",",
"record_val",
")",
":",
"inter_type_keys",
"=",
"[",
"]",
"inter_type_values",
"=",
"[",
"]",
"inter_type_flag",
"=",
"False",
"ptype_keys",
"=",
"[",
"]",
"ptype_values",
"=",
"[",
"]",
"ptype_flag",
"=",
"F... | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/schema.py#L614-L644 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/__init__.py | python | WorkingSet.subscribe | (self, callback, existing=True) | Invoke `callback` for all distributions
If `existing=True` (default),
call on all existing ones, as well. | Invoke `callback` for all distributions | [
"Invoke",
"callback",
"for",
"all",
"distributions"
] | def subscribe(self, callback, existing=True):
"""Invoke `callback` for all distributions
If `existing=True` (default),
call on all existing ones, as well.
"""
if callback in self.callbacks:
return
self.callbacks.append(callback)
if not existing:
... | [
"def",
"subscribe",
"(",
"self",
",",
"callback",
",",
"existing",
"=",
"True",
")",
":",
"if",
"callback",
"in",
"self",
".",
"callbacks",
":",
"return",
"self",
".",
"callbacks",
".",
"append",
"(",
"callback",
")",
"if",
"not",
"existing",
":",
"ret... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/__init__.py#L908-L920 | ||
openthread/openthread | 9fcdbed9c526c70f1556d1ed84099c1535c7cd32 | tools/otci/otci/otci.py | python | OTCI.get_rloc16 | (self) | return self.__parse_int(self.execute_command('rloc16'), 16) | Get the Thread RLOC16 value. | Get the Thread RLOC16 value. | [
"Get",
"the",
"Thread",
"RLOC16",
"value",
"."
] | def get_rloc16(self) -> int:
"""Get the Thread RLOC16 value."""
return self.__parse_int(self.execute_command('rloc16'), 16) | [
"def",
"get_rloc16",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"__parse_int",
"(",
"self",
".",
"execute_command",
"(",
"'rloc16'",
")",
",",
"16",
")"
] | https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/tools/otci/otci/otci.py#L498-L500 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/platform.py | python | _syscmd_uname | (option, default='') | Interface to the system's uname command. | Interface to the system's uname command. | [
"Interface",
"to",
"the",
"system",
"s",
"uname",
"command",
"."
] | def _syscmd_uname(option, default=''):
""" Interface to the system's uname command.
"""
if sys.platform in ('dos', 'win32', 'win16'):
# XXX Others too ?
return default
try:
f = os.popen('uname %s 2> %s' % (option, DEV_NULL))
except (AttributeError, OSError):
return d... | [
"def",
"_syscmd_uname",
"(",
"option",
",",
"default",
"=",
"''",
")",
":",
"if",
"sys",
".",
"platform",
"in",
"(",
"'dos'",
",",
"'win32'",
",",
"'win16'",
")",
":",
"# XXX Others too ?",
"return",
"default",
"try",
":",
"f",
"=",
"os",
".",
"popen",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/platform.py#L780-L796 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBSymbol.__init__ | (self, *args) | __init__(self) -> SBSymbol
__init__(self, SBSymbol rhs) -> SBSymbol | __init__(self) -> SBSymbol
__init__(self, SBSymbol rhs) -> SBSymbol | [
"__init__",
"(",
"self",
")",
"-",
">",
"SBSymbol",
"__init__",
"(",
"self",
"SBSymbol",
"rhs",
")",
"-",
">",
"SBSymbol"
] | def __init__(self, *args):
"""
__init__(self) -> SBSymbol
__init__(self, SBSymbol rhs) -> SBSymbol
"""
this = _lldb.new_SBSymbol(*args)
try: self.this.append(this)
except: self.this = this | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
":",
"this",
"=",
"_lldb",
".",
"new_SBSymbol",
"(",
"*",
"args",
")",
"try",
":",
"self",
".",
"this",
".",
"append",
"(",
"this",
")",
"except",
":",
"self",
".",
"this",
"=",
"this"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L8083-L8090 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | chrome/common/extensions/docs/server2/subversion_file_system.py | python | _ParseHTML | (html) | Unfortunately, the viewvc page has a stray </div> tag, so this takes care
of all mismatched tags. | Unfortunately, the viewvc page has a stray </div> tag, so this takes care
of all mismatched tags. | [
"Unfortunately",
"the",
"viewvc",
"page",
"has",
"a",
"stray",
"<",
"/",
"div",
">",
"tag",
"so",
"this",
"takes",
"care",
"of",
"all",
"mismatched",
"tags",
"."
] | def _ParseHTML(html):
'''Unfortunately, the viewvc page has a stray </div> tag, so this takes care
of all mismatched tags.
'''
try:
return xml.parseString(html)
except ExpatError as e:
return _ParseHTML('\n'.join(
line for (i, line) in enumerate(html.split('\n'))
if e.lineno != i + 1)) | [
"def",
"_ParseHTML",
"(",
"html",
")",
":",
"try",
":",
"return",
"xml",
".",
"parseString",
"(",
"html",
")",
"except",
"ExpatError",
"as",
"e",
":",
"return",
"_ParseHTML",
"(",
"'\\n'",
".",
"join",
"(",
"line",
"for",
"(",
"i",
",",
"line",
")",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/chrome/common/extensions/docs/server2/subversion_file_system.py#L18-L27 | ||
facebookresearch/ELF | 1f790173095cd910976d9f651b80beb872ec5d12 | rlpytorch/trainer/trainer.py | python | Evaluator.actor | (self, batch) | return reply_msg | Actor.
Get the model, forward the batch and get a distribution. Sample from it and act.
Reply the message to game engine.
Args:
batch(dict): batch data
Returns:
reply_msg(dict): ``pi``: policy, ``a``: action, ``V``: value, `rv`: reply version, signatured by step | Actor.
Get the model, forward the batch and get a distribution. Sample from it and act.
Reply the message to game engine. | [
"Actor",
".",
"Get",
"the",
"model",
"forward",
"the",
"batch",
"and",
"get",
"a",
"distribution",
".",
"Sample",
"from",
"it",
"and",
"act",
".",
"Reply",
"the",
"message",
"to",
"game",
"engine",
"."
] | def actor(self, batch):
''' Actor.
Get the model, forward the batch and get a distribution. Sample from it and act.
Reply the message to game engine.
Args:
batch(dict): batch data
Returns:
reply_msg(dict): ``pi``: policy, ``a``: action, ``V``: value, `rv... | [
"def",
"actor",
"(",
"self",
",",
"batch",
")",
":",
"if",
"self",
".",
"verbose",
":",
"print",
"(",
"\"In Evaluator[%s]::actor\"",
"%",
"self",
".",
"name",
")",
"# actor model.",
"m",
"=",
"self",
".",
"mi",
"[",
"self",
".",
"actor_name",
"]",
"m",... | https://github.com/facebookresearch/ELF/blob/1f790173095cd910976d9f651b80beb872ec5d12/rlpytorch/trainer/trainer.py#L57-L91 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | TextAttr.SetBulletNumber | (*args, **kwargs) | return _controls_.TextAttr_SetBulletNumber(*args, **kwargs) | SetBulletNumber(self, int n) | SetBulletNumber(self, int n) | [
"SetBulletNumber",
"(",
"self",
"int",
"n",
")"
] | def SetBulletNumber(*args, **kwargs):
"""SetBulletNumber(self, int n)"""
return _controls_.TextAttr_SetBulletNumber(*args, **kwargs) | [
"def",
"SetBulletNumber",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TextAttr_SetBulletNumber",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L1603-L1605 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/lmbrwaflib/settings_manager.py | python | get_settings_value | (ctx, attribute_name) | return LUMBERYARD_SETTINGS.get_settings_value(attribute_name) | Get a particular settings value based on the attribute name
:param ctx: Context
:param attribute_name: The name to lookup the value | Get a particular settings value based on the attribute name
:param ctx: Context
:param attribute_name: The name to lookup the value | [
"Get",
"a",
"particular",
"settings",
"value",
"based",
"on",
"the",
"attribute",
"name",
":",
"param",
"ctx",
":",
"Context",
":",
"param",
"attribute_name",
":",
"The",
"name",
"to",
"lookup",
"the",
"value"
] | def get_settings_value(ctx, attribute_name):
"""
Get a particular settings value based on the attribute name
:param ctx: Context
:param attribute_name: The name to lookup the value
"""
return LUMBERYARD_SETTINGS.get_settings_value(attribute_name) | [
"def",
"get_settings_value",
"(",
"ctx",
",",
"attribute_name",
")",
":",
"return",
"LUMBERYARD_SETTINGS",
".",
"get_settings_value",
"(",
"attribute_name",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/lmbrwaflib/settings_manager.py#L1556-L1562 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/graph_editor/reroute.py | python | reroute_b2a_ts | (ts0, ts1, can_modify=None, cannot_modify=None) | return _reroute_ts(ts0, ts1, _RerouteMode.b2a, can_modify, cannot_modify) | r"""For each tensor's pair, replace the end of t0 by the end of t1.
B0 B1 B0 B1
| | => \|
A0 A1 A0 A1
The end of the tensors in ts0 are left dangling.
Args:
ts0: an object convertible to a list of `tf.Tensor`.
ts1: an object convertible to a list of `tf.Tensor`.
can_modify: iterabl... | r"""For each tensor's pair, replace the end of t0 by the end of t1. | [
"r",
"For",
"each",
"tensor",
"s",
"pair",
"replace",
"the",
"end",
"of",
"t0",
"by",
"the",
"end",
"of",
"t1",
"."
] | def reroute_b2a_ts(ts0, ts1, can_modify=None, cannot_modify=None):
r"""For each tensor's pair, replace the end of t0 by the end of t1.
B0 B1 B0 B1
| | => \|
A0 A1 A0 A1
The end of the tensors in ts0 are left dangling.
Args:
ts0: an object convertible to a list of `tf.Tensor`.
ts1: an... | [
"def",
"reroute_b2a_ts",
"(",
"ts0",
",",
"ts1",
",",
"can_modify",
"=",
"None",
",",
"cannot_modify",
"=",
"None",
")",
":",
"return",
"_reroute_ts",
"(",
"ts0",
",",
"ts1",
",",
"_RerouteMode",
".",
"b2a",
",",
"can_modify",
",",
"cannot_modify",
")"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/graph_editor/reroute.py#L256-L280 | |
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | lldb/examples/python/file_extract.py | python | FileExtract.get_uint16 | (self, fail_value=0) | Extract a single uint16_t from the binary file at the current file position, returns a single integer | Extract a single uint16_t from the binary file at the current file position, returns a single integer | [
"Extract",
"a",
"single",
"uint16_t",
"from",
"the",
"binary",
"file",
"at",
"the",
"current",
"file",
"position",
"returns",
"a",
"single",
"integer"
] | def get_uint16(self, fail_value=0):
'''Extract a single uint16_t from the binary file at the current file position, returns a single integer'''
s = self.read_size(2)
if s:
v, = struct.unpack(self.byte_order + 'H', s)
return v
else:
return fail_value | [
"def",
"get_uint16",
"(",
"self",
",",
"fail_value",
"=",
"0",
")",
":",
"s",
"=",
"self",
".",
"read_size",
"(",
"2",
")",
"if",
"s",
":",
"v",
",",
"=",
"struct",
".",
"unpack",
"(",
"self",
".",
"byte_order",
"+",
"'H'",
",",
"s",
")",
"retu... | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/lldb/examples/python/file_extract.py#L90-L97 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py | python | MacroFunction.parsebit | (self, pos) | Parse a number of input parameters. | Parse a number of input parameters. | [
"Parse",
"a",
"number",
"of",
"input",
"parameters",
"."
] | def parsebit(self, pos):
"Parse a number of input parameters."
self.output = FilteredOutput()
self.values = []
macro = self.translated
self.parseparameters(pos, macro)
self.completemacro(macro) | [
"def",
"parsebit",
"(",
"self",
",",
"pos",
")",
":",
"self",
".",
"output",
"=",
"FilteredOutput",
"(",
")",
"self",
".",
"values",
"=",
"[",
"]",
"macro",
"=",
"self",
".",
"translated",
"self",
".",
"parseparameters",
"(",
"pos",
",",
"macro",
")"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py#L5247-L5253 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/propgrid.py | python | PGValidationInfo.GetFailureMessage | (*args, **kwargs) | return _propgrid.PGValidationInfo_GetFailureMessage(*args, **kwargs) | GetFailureMessage(self) -> String | GetFailureMessage(self) -> String | [
"GetFailureMessage",
"(",
"self",
")",
"-",
">",
"String"
] | def GetFailureMessage(*args, **kwargs):
"""GetFailureMessage(self) -> String"""
return _propgrid.PGValidationInfo_GetFailureMessage(*args, **kwargs) | [
"def",
"GetFailureMessage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGValidationInfo_GetFailureMessage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L1892-L1894 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/inline_closurecall.py | python | _fix_nested_array | (func_ir) | Look for assignment like: a[..] = b, where both a and b are numpy arrays, and
try to eliminate array b by expanding a with an extra dimension. | Look for assignment like: a[..] = b, where both a and b are numpy arrays, and
try to eliminate array b by expanding a with an extra dimension. | [
"Look",
"for",
"assignment",
"like",
":",
"a",
"[",
"..",
"]",
"=",
"b",
"where",
"both",
"a",
"and",
"b",
"are",
"numpy",
"arrays",
"and",
"try",
"to",
"eliminate",
"array",
"b",
"by",
"expanding",
"a",
"with",
"an",
"extra",
"dimension",
"."
] | def _fix_nested_array(func_ir):
"""Look for assignment like: a[..] = b, where both a and b are numpy arrays, and
try to eliminate array b by expanding a with an extra dimension.
"""
blocks = func_ir.blocks
cfg = compute_cfg_from_blocks(blocks)
usedefs = compute_use_defs(blocks)
empty_deadmap... | [
"def",
"_fix_nested_array",
"(",
"func_ir",
")",
":",
"blocks",
"=",
"func_ir",
".",
"blocks",
"cfg",
"=",
"compute_cfg_from_blocks",
"(",
"blocks",
")",
"usedefs",
"=",
"compute_use_defs",
"(",
"blocks",
")",
"empty_deadmap",
"=",
"dict",
"(",
"[",
"(",
"la... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/inline_closurecall.py#L895-L1013 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/feature_column/sequence_feature_column.py | python | SequenceNumericColumn.parse_example_spec | (self) | return {self.key: parsing_ops.VarLenFeature(self.dtype)} | See `FeatureColumn` base class. | See `FeatureColumn` base class. | [
"See",
"FeatureColumn",
"base",
"class",
"."
] | def parse_example_spec(self):
"""See `FeatureColumn` base class."""
return {self.key: parsing_ops.VarLenFeature(self.dtype)} | [
"def",
"parse_example_spec",
"(",
"self",
")",
":",
"return",
"{",
"self",
".",
"key",
":",
"parsing_ops",
".",
"VarLenFeature",
"(",
"self",
".",
"dtype",
")",
"}"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/feature_column/sequence_feature_column.py#L400-L402 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | third_party/Python/module/pexpect-4.6/pexpect/FSM.py | python | FSM.get_transition | (self, input_symbol, state) | This returns (action, next state) given an input_symbol and state.
This does not modify the FSM state, so calling this method has no side
effects. Normally you do not call this method directly. It is called by
process().
The sequence of steps to check for a defined transition goes from ... | This returns (action, next state) given an input_symbol and state.
This does not modify the FSM state, so calling this method has no side
effects. Normally you do not call this method directly. It is called by
process(). | [
"This",
"returns",
"(",
"action",
"next",
"state",
")",
"given",
"an",
"input_symbol",
"and",
"state",
".",
"This",
"does",
"not",
"modify",
"the",
"FSM",
"state",
"so",
"calling",
"this",
"method",
"has",
"no",
"side",
"effects",
".",
"Normally",
"you",
... | def get_transition (self, input_symbol, state):
'''This returns (action, next state) given an input_symbol and state.
This does not modify the FSM state, so calling this method has no side
effects. Normally you do not call this method directly. It is called by
process().
The se... | [
"def",
"get_transition",
"(",
"self",
",",
"input_symbol",
",",
"state",
")",
":",
"if",
"(",
"input_symbol",
",",
"state",
")",
"in",
"self",
".",
"state_transitions",
":",
"return",
"self",
".",
"state_transitions",
"[",
"(",
"input_symbol",
",",
"state",
... | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/third_party/Python/module/pexpect-4.6/pexpect/FSM.py#L195-L226 | ||
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/v8/tools/dev/v8gen.py | python | GenerateGnArgs._append_gn_args | (self, type, gn_args_path, more_gn_args) | return True | Append extra gn arguments to the generated args.gn file. | Append extra gn arguments to the generated args.gn file. | [
"Append",
"extra",
"gn",
"arguments",
"to",
"the",
"generated",
"args",
".",
"gn",
"file",
"."
] | def _append_gn_args(self, type, gn_args_path, more_gn_args):
"""Append extra gn arguments to the generated args.gn file."""
if not more_gn_args:
return False
self.verbose_print_1('Appending """\n%s\n""" to %s.' % (
more_gn_args, os.path.abspath(gn_args_path)))
with open(gn_args_path, 'a') ... | [
"def",
"_append_gn_args",
"(",
"self",
",",
"type",
",",
"gn_args_path",
",",
"more_gn_args",
")",
":",
"if",
"not",
"more_gn_args",
":",
"return",
"False",
"self",
".",
"verbose_print_1",
"(",
"'Appending \"\"\"\\n%s\\n\"\"\" to %s.'",
"%",
"(",
"more_gn_args",
"... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/v8/tools/dev/v8gen.py#L258-L275 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/s3transfer/copies.py | python | CopySubmissionTask._submit | (self, client, config, osutil, request_executor,
transfer_future) | :param client: The client associated with the transfer manager
:type config: s3transfer.manager.TransferConfig
:param config: The transfer config associated with the transfer
manager
:type osutil: s3transfer.utils.OSUtil
:param osutil: The os utility associated to the trans... | :param client: The client associated with the transfer manager | [
":",
"param",
"client",
":",
"The",
"client",
"associated",
"with",
"the",
"transfer",
"manager"
] | def _submit(self, client, config, osutil, request_executor,
transfer_future):
"""
:param client: The client associated with the transfer manager
:type config: s3transfer.manager.TransferConfig
:param config: The transfer config associated with the transfer
ma... | [
"def",
"_submit",
"(",
"self",
",",
"client",
",",
"config",
",",
"osutil",
",",
"request_executor",
",",
"transfer_future",
")",
":",
"# Determine the size if it was not provided",
"if",
"transfer_future",
".",
"meta",
".",
"size",
"is",
"None",
":",
"# If a size... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/s3transfer/copies.py#L70-L122 | ||
zhaoweicai/mscnn | 534bcac5710a579d60827f192035f7eef6d8c585 | python/caffe/detector.py | python | Detector.detect_selective_search | (self, image_fnames) | return self.detect_windows(zip(image_fnames, windows_list)) | Do windowed detection over Selective Search proposals by extracting
the crop and warping to the input dimensions of the net.
Parameters
----------
image_fnames: list
Returns
-------
detections: list of {filename: image filename, window: crop coordinates,
... | Do windowed detection over Selective Search proposals by extracting
the crop and warping to the input dimensions of the net. | [
"Do",
"windowed",
"detection",
"over",
"Selective",
"Search",
"proposals",
"by",
"extracting",
"the",
"crop",
"and",
"warping",
"to",
"the",
"input",
"dimensions",
"of",
"the",
"net",
"."
] | def detect_selective_search(self, image_fnames):
"""
Do windowed detection over Selective Search proposals by extracting
the crop and warping to the input dimensions of the net.
Parameters
----------
image_fnames: list
Returns
-------
detections:... | [
"def",
"detect_selective_search",
"(",
"self",
",",
"image_fnames",
")",
":",
"import",
"selective_search_ijcv_with_python",
"as",
"selective_search",
"# Make absolute paths so MATLAB can find the files.",
"image_fnames",
"=",
"[",
"os",
".",
"path",
".",
"abspath",
"(",
... | https://github.com/zhaoweicai/mscnn/blob/534bcac5710a579d60827f192035f7eef6d8c585/python/caffe/detector.py#L101-L123 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/ndarray/ndarray.py | python | NDArray.relu | (self, *args, **kwargs) | return op.relu(self, *args, **kwargs) | Convenience fluent method for :py:func:`relu`.
The arguments are the same as for :py:func:`relu`, with
this array as data. | Convenience fluent method for :py:func:`relu`. | [
"Convenience",
"fluent",
"method",
"for",
":",
"py",
":",
"func",
":",
"relu",
"."
] | def relu(self, *args, **kwargs):
"""Convenience fluent method for :py:func:`relu`.
The arguments are the same as for :py:func:`relu`, with
this array as data.
"""
return op.relu(self, *args, **kwargs) | [
"def",
"relu",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"op",
".",
"relu",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/ndarray/ndarray.py#L2230-L2236 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/byteflow.py | python | TraceRunner.op_STORE_SLICE_3 | (self, state, inst) | TOS2[TOS1:TOS] = TOS3 | TOS2[TOS1:TOS] = TOS3 | [
"TOS2",
"[",
"TOS1",
":",
"TOS",
"]",
"=",
"TOS3"
] | def op_STORE_SLICE_3(self, state, inst):
"""
TOS2[TOS1:TOS] = TOS3
"""
tos = state.pop()
tos1 = state.pop()
tos2 = state.pop()
value = state.pop()
slicevar = state.make_temp()
indexvar = state.make_temp()
state.append(
inst,
... | [
"def",
"op_STORE_SLICE_3",
"(",
"self",
",",
"state",
",",
"inst",
")",
":",
"tos",
"=",
"state",
".",
"pop",
"(",
")",
"tos1",
"=",
"state",
".",
"pop",
"(",
")",
"tos2",
"=",
"state",
".",
"pop",
"(",
")",
"value",
"=",
"state",
".",
"pop",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/byteflow.py#L445-L463 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/cgitb.py | python | lookup | (name, frame, locals) | return None, __UNDEF__ | Find the value for a given name in the given environment. | Find the value for a given name in the given environment. | [
"Find",
"the",
"value",
"for",
"a",
"given",
"name",
"in",
"the",
"given",
"environment",
"."
] | def lookup(name, frame, locals):
"""Find the value for a given name in the given environment."""
if name in locals:
return 'local', locals[name]
if name in frame.f_globals:
return 'global', frame.f_globals[name]
if '__builtins__' in frame.f_globals:
builtins = frame.f_globals['__... | [
"def",
"lookup",
"(",
"name",
",",
"frame",
",",
"locals",
")",
":",
"if",
"name",
"in",
"locals",
":",
"return",
"'local'",
",",
"locals",
"[",
"name",
"]",
"if",
"name",
"in",
"frame",
".",
"f_globals",
":",
"return",
"'global'",
",",
"frame",
".",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/cgitb.py#L65-L79 | |
GeometryCollective/boundary-first-flattening | 8250e5a0e85980ec50b5e8aa8f49dd6519f915cd | deps/nanogui/ext/pybind11/tools/clang/cindex.py | python | TranslationUnit.codeComplete | (self, path, line, column, unsaved_files=None,
include_macros=False, include_code_patterns=False,
include_brief_comments=False) | return None | Code complete in this translation unit.
In-memory contents for files can be provided by passing a list of pairs
as unsaved_files, the first items should be the filenames to be mapped
and the second should be the contents to be substituted for the
file. The contents may be passed as stri... | Code complete in this translation unit. | [
"Code",
"complete",
"in",
"this",
"translation",
"unit",
"."
] | def codeComplete(self, path, line, column, unsaved_files=None,
include_macros=False, include_code_patterns=False,
include_brief_comments=False):
"""
Code complete in this translation unit.
In-memory contents for files can be provided by passing a list o... | [
"def",
"codeComplete",
"(",
"self",
",",
"path",
",",
"line",
",",
"column",
",",
"unsaved_files",
"=",
"None",
",",
"include_macros",
"=",
"False",
",",
"include_code_patterns",
"=",
"False",
",",
"include_brief_comments",
"=",
"False",
")",
":",
"options",
... | https://github.com/GeometryCollective/boundary-first-flattening/blob/8250e5a0e85980ec50b5e8aa8f49dd6519f915cd/deps/nanogui/ext/pybind11/tools/clang/cindex.py#L2612-L2655 | |
AcademySoftwareFoundation/openvdb | ad209a385f13cad88315b114db1c728f1bbcd2dd | ci/download_houdini.py | python | get_access_token_and_expiry_time | (
access_token_url, client_id, client_secret_key) | return response_json["access_token"], access_token_expiry_time | Given an API client (id and secret key) that is allowed to make API
calls, return an access token that can be used to make calls. | Given an API client (id and secret key) that is allowed to make API
calls, return an access token that can be used to make calls. | [
"Given",
"an",
"API",
"client",
"(",
"id",
"and",
"secret",
"key",
")",
"that",
"is",
"allowed",
"to",
"make",
"API",
"calls",
"return",
"an",
"access",
"token",
"that",
"can",
"be",
"used",
"to",
"make",
"calls",
"."
] | def get_access_token_and_expiry_time(
access_token_url, client_id, client_secret_key):
"""Given an API client (id and secret key) that is allowed to make API
calls, return an access token that can be used to make calls.
"""
response = requests.post(
access_token_url,
headers={
... | [
"def",
"get_access_token_and_expiry_time",
"(",
"access_token_url",
",",
"client_id",
",",
"client_secret_key",
")",
":",
"response",
"=",
"requests",
".",
"post",
"(",
"access_token_url",
",",
"headers",
"=",
"{",
"\"Authorization\"",
":",
"u\"Basic {0}\"",
".",
"f... | https://github.com/AcademySoftwareFoundation/openvdb/blob/ad209a385f13cad88315b114db1c728f1bbcd2dd/ci/download_houdini.py#L80-L101 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/sysconfig.py | python | get_config_vars | (*args) | With no arguments, return a dictionary of all configuration
variables relevant for the current platform.
On Unix, this means every variable defined in Python's installed Makefile;
On Windows and Mac OS it's a much smaller set.
With arguments, return a list of values that result from looking up
eac... | With no arguments, return a dictionary of all configuration
variables relevant for the current platform. | [
"With",
"no",
"arguments",
"return",
"a",
"dictionary",
"of",
"all",
"configuration",
"variables",
"relevant",
"for",
"the",
"current",
"platform",
"."
] | def get_config_vars(*args):
"""With no arguments, return a dictionary of all configuration
variables relevant for the current platform.
On Unix, this means every variable defined in Python's installed Makefile;
On Windows and Mac OS it's a much smaller set.
With arguments, return a list of values ... | [
"def",
"get_config_vars",
"(",
"*",
"args",
")",
":",
"import",
"re",
"global",
"_CONFIG_VARS",
"if",
"_CONFIG_VARS",
"is",
"None",
":",
"_CONFIG_VARS",
"=",
"{",
"}",
"# Normalized versions of prefix and exec_prefix are handy to have;",
"# in fact, these are the standard v... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/sysconfig.py#L439-L508 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/systrace/systrace/tracing_agents/atrace_agent.py | python | fix_thread_names | (trace_data, thread_names) | return trace_data | Replaces thread ids with their names.
Args:
trace_data: The atrace data.
thread_names: A mapping of thread ids to thread names.
Returns:
The updated trace data. | Replaces thread ids with their names. | [
"Replaces",
"thread",
"ids",
"with",
"their",
"names",
"."
] | def fix_thread_names(trace_data, thread_names):
"""Replaces thread ids with their names.
Args:
trace_data: The atrace data.
thread_names: A mapping of thread ids to thread names.
Returns:
The updated trace data.
"""
def repl(m):
tid = int(m.group(2))
if tid > 0:
name = thread_names... | [
"def",
"fix_thread_names",
"(",
"trace_data",
",",
"thread_names",
")",
":",
"def",
"repl",
"(",
"m",
")",
":",
"tid",
"=",
"int",
"(",
"m",
".",
"group",
"(",
"2",
")",
")",
"if",
"tid",
">",
"0",
":",
"name",
"=",
"thread_names",
".",
"get",
"(... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/systrace/systrace/tracing_agents/atrace_agent.py#L403-L430 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/arch/micro_asm.py | python | p_block | (t) | block : LBRACE statements RBRACE | block : LBRACE statements RBRACE | [
"block",
":",
"LBRACE",
"statements",
"RBRACE"
] | def p_block(t):
'block : LBRACE statements RBRACE'
block = Block()
block.statements = t[2]
t[0] = block | [
"def",
"p_block",
"(",
"t",
")",
":",
"block",
"=",
"Block",
"(",
")",
"block",
".",
"statements",
"=",
"t",
"[",
"2",
"]",
"t",
"[",
"0",
"]",
"=",
"block"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/arch/micro_asm.py#L364-L368 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.WriteLinkForArch | (self, ninja_file, spec, config_name, config,
link_deps, compile_deps, arch=None) | return linked_binary | Write out a link step. Fills out target.binary. | Write out a link step. Fills out target.binary. | [
"Write",
"out",
"a",
"link",
"step",
".",
"Fills",
"out",
"target",
".",
"binary",
"."
] | def WriteLinkForArch(self, ninja_file, spec, config_name, config,
link_deps, compile_deps, arch=None):
"""Write out a link step. Fills out target.binary. """
command = {
'executable': 'link',
'loadable_module': 'solink_module',
'shared_library': 'solink',
}[spe... | [
"def",
"WriteLinkForArch",
"(",
"self",
",",
"ninja_file",
",",
"spec",
",",
"config_name",
",",
"config",
",",
"link_deps",
",",
"compile_deps",
",",
"arch",
"=",
"None",
")",
":",
"command",
"=",
"{",
"'executable'",
":",
"'link'",
",",
"'loadable_module'"... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/gyp/pylib/gyp/generator/ninja.py#L1135-L1319 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/email/__init__.py | python | message_from_string | (s, *args, **kws) | return Parser(*args, **kws).parsestr(s) | Parse a string into a Message object model.
Optional _class and strict are passed to the Parser constructor. | Parse a string into a Message object model. | [
"Parse",
"a",
"string",
"into",
"a",
"Message",
"object",
"model",
"."
] | def message_from_string(s, *args, **kws):
"""Parse a string into a Message object model.
Optional _class and strict are passed to the Parser constructor.
"""
from email.parser import Parser
return Parser(*args, **kws).parsestr(s) | [
"def",
"message_from_string",
"(",
"s",
",",
"*",
"args",
",",
"*",
"*",
"kws",
")",
":",
"from",
"email",
".",
"parser",
"import",
"Parser",
"return",
"Parser",
"(",
"*",
"args",
",",
"*",
"*",
"kws",
")",
".",
"parsestr",
"(",
"s",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/email/__init__.py#L51-L57 | |
lammps/lammps | b75c3065430a75b1b5543a10e10f46d9b4c91913 | tools/i-pi/ipi/engine/beads.py | python | Beads.mtom3 | (self) | return m3 | Takes the mass array for each bead and returns one with an element
for each degree of freedom.
Returns:
An array of size (nbeads,3*natoms), with each element corresponding
to the mass associated with the appropriate degree of freedom in q. | Takes the mass array for each bead and returns one with an element
for each degree of freedom. | [
"Takes",
"the",
"mass",
"array",
"for",
"each",
"bead",
"and",
"returns",
"one",
"with",
"an",
"element",
"for",
"each",
"degree",
"of",
"freedom",
"."
] | def mtom3(self):
"""Takes the mass array for each bead and returns one with an element
for each degree of freedom.
Returns:
An array of size (nbeads,3*natoms), with each element corresponding
to the mass associated with the appropriate degree of freedom in q.
"""
m3 = n... | [
"def",
"mtom3",
"(",
"self",
")",
":",
"m3",
"=",
"np",
".",
"zeros",
"(",
"(",
"self",
".",
"nbeads",
",",
"3",
"*",
"self",
".",
"natoms",
")",
",",
"float",
")",
"m3",
"[",
":",
",",
"0",
":",
"3",
"*",
"self",
".",
"natoms",
":",
"3",
... | https://github.com/lammps/lammps/blob/b75c3065430a75b1b5543a10e10f46d9b4c91913/tools/i-pi/ipi/engine/beads.py#L174-L187 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/ccompiler.py | python | CCompiler.add_runtime_library_dir | (self, dir) | Add 'dir' to the list of directories that will be searched for
shared libraries at runtime. | Add 'dir' to the list of directories that will be searched for
shared libraries at runtime. | [
"Add",
"dir",
"to",
"the",
"list",
"of",
"directories",
"that",
"will",
"be",
"searched",
"for",
"shared",
"libraries",
"at",
"runtime",
"."
] | def add_runtime_library_dir(self, dir):
"""Add 'dir' to the list of directories that will be searched for
shared libraries at runtime.
"""
self.runtime_library_dirs.append(dir) | [
"def",
"add_runtime_library_dir",
"(",
"self",
",",
"dir",
")",
":",
"self",
".",
"runtime_library_dirs",
".",
"append",
"(",
"dir",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/ccompiler.py#L274-L278 | ||
metashell/metashell | f4177e4854ea00c8dbc722cadab26ef413d798ea | 3rd/templight/llvm/bindings/python/llvm/core.py | python | LLVMEnumeration.from_value | (cls, value) | return result | Obtain an enumeration instance from a numeric value. | Obtain an enumeration instance from a numeric value. | [
"Obtain",
"an",
"enumeration",
"instance",
"from",
"a",
"numeric",
"value",
"."
] | def from_value(cls, value):
"""Obtain an enumeration instance from a numeric value."""
result = cls._value_map.get(value, None)
if result is None:
raise ValueError('Unknown %s: %d' % (cls.__name__,
value))
return result | [
"def",
"from_value",
"(",
"cls",
",",
"value",
")",
":",
"result",
"=",
"cls",
".",
"_value_map",
".",
"get",
"(",
"value",
",",
"None",
")",
"if",
"result",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Unknown %s: %d'",
"%",
"(",
"cls",
".",
"__... | https://github.com/metashell/metashell/blob/f4177e4854ea00c8dbc722cadab26ef413d798ea/3rd/templight/llvm/bindings/python/llvm/core.py#L52-L60 | |
Illumina/strelka | d7377443b62319f7c7bd70c241c4b2df3459e29a | src/python/deNovoQualityScore/denovo.py | python | calculate_dng_DQ_indel | (variant, prior, param) | return score | Calculate indel denovo score | Calculate indel denovo score | [
"Calculate",
"indel",
"denovo",
"score"
] | def calculate_dng_DQ_indel(variant, prior, param):
"""Calculate indel denovo score"""
if not can_compute_dng_DQ_indel(variant, param):
return None
if not is_denovo_candidate(variant, param, _mendel_conflict_name):
return 0.0
sample_index = param['sample_index']
if param['is_select... | [
"def",
"calculate_dng_DQ_indel",
"(",
"variant",
",",
"prior",
",",
"param",
")",
":",
"if",
"not",
"can_compute_dng_DQ_indel",
"(",
"variant",
",",
"param",
")",
":",
"return",
"None",
"if",
"not",
"is_denovo_candidate",
"(",
"variant",
",",
"param",
",",
"... | https://github.com/Illumina/strelka/blob/d7377443b62319f7c7bd70c241c4b2df3459e29a/src/python/deNovoQualityScore/denovo.py#L783-L829 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | Window.SetVirtualSizeHints | (*args, **kwargs) | return _core_.Window_SetVirtualSizeHints(*args, **kwargs) | SetVirtualSizeHints(self, int minW, int minH, int maxW=-1, int maxH=-1) | SetVirtualSizeHints(self, int minW, int minH, int maxW=-1, int maxH=-1) | [
"SetVirtualSizeHints",
"(",
"self",
"int",
"minW",
"int",
"minH",
"int",
"maxW",
"=",
"-",
"1",
"int",
"maxH",
"=",
"-",
"1",
")"
] | def SetVirtualSizeHints(*args, **kwargs):
"""SetVirtualSizeHints(self, int minW, int minH, int maxW=-1, int maxH=-1)"""
return _core_.Window_SetVirtualSizeHints(*args, **kwargs) | [
"def",
"SetVirtualSizeHints",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_SetVirtualSizeHints",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L9735-L9737 | |
google/swiftshader | 8ccc63f045d5975fb67f9dfd3d2b8235b0526990 | third_party/subzero/bloat/bloat.py | python | format_bytes | (bytes) | return str(bytes) | Pretty-print a number of bytes. | Pretty-print a number of bytes. | [
"Pretty",
"-",
"print",
"a",
"number",
"of",
"bytes",
"."
] | def format_bytes(bytes):
"""Pretty-print a number of bytes."""
if bytes > 1e6:
bytes = bytes / 1.0e6
return '%.1fm' % bytes
if bytes > 1e3:
bytes = bytes / 1.0e3
return '%.1fk' % bytes
return str(bytes) | [
"def",
"format_bytes",
"(",
"bytes",
")",
":",
"if",
"bytes",
">",
"1e6",
":",
"bytes",
"=",
"bytes",
"/",
"1.0e6",
"return",
"'%.1fm'",
"%",
"bytes",
"if",
"bytes",
">",
"1e3",
":",
"bytes",
"=",
"bytes",
"/",
"1.0e3",
"return",
"'%.1fk'",
"%",
"byt... | https://github.com/google/swiftshader/blob/8ccc63f045d5975fb67f9dfd3d2b8235b0526990/third_party/subzero/bloat/bloat.py#L27-L35 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/hfctables.py | python | ProcessTableWidget.set_status | (self, row_number, status) | return self.update_cell_value(row_number, self._colIndexStatus, status) | Set the status for merging scan to QTable
:param row_number: scan number
:param status:
:return: | Set the status for merging scan to QTable
:param row_number: scan number
:param status:
:return: | [
"Set",
"the",
"status",
"for",
"merging",
"scan",
"to",
"QTable",
":",
"param",
"row_number",
":",
"scan",
"number",
":",
"param",
"status",
":",
":",
"return",
":"
] | def set_status(self, row_number, status):
"""
Set the status for merging scan to QTable
:param row_number: scan number
:param status:
:return:
"""
# Check
assert isinstance(status, str), 'Status (%s) must be a string, but not %s.' % (str(status), type(stat... | [
"def",
"set_status",
"(",
"self",
",",
"row_number",
",",
"status",
")",
":",
"# Check",
"assert",
"isinstance",
"(",
"status",
",",
"str",
")",
",",
"'Status (%s) must be a string, but not %s.'",
"%",
"(",
"str",
"(",
"status",
")",
",",
"type",
"(",
"statu... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/hfctables.py#L1038-L1048 | |
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/third_party/depot_tools/cpplint.py | python | CheckSpacingForFunctionCall | (filename, clean_lines, linenum, error) | Checks for the correctness of various spacing around function calls.
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. | Checks for the correctness of various spacing around function calls. | [
"Checks",
"for",
"the",
"correctness",
"of",
"various",
"spacing",
"around",
"function",
"calls",
"."
] | def CheckSpacingForFunctionCall(filename, clean_lines, linenum, error):
"""Checks for the correctness of various spacing around function calls.
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: T... | [
"def",
"CheckSpacingForFunctionCall",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Since function calls often occur inside if/for/while/switch",
"# expressions - which have th... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/third_party/depot_tools/cpplint.py#L2819-L2893 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/distributed/fleet/meta_optimizers/dygraph_optimizer/sharding_optimizer_stage2.py | python | ShardingOptimizerStage2.dtype_rank_params | (self) | return self._dtype_rank_params | Divide the parameters into groups according to rank and dtype. | Divide the parameters into groups according to rank and dtype. | [
"Divide",
"the",
"parameters",
"into",
"groups",
"according",
"to",
"rank",
"and",
"dtype",
"."
] | def dtype_rank_params(self):
"""
Divide the parameters into groups according to rank and dtype.
"""
if len(self._dtype_rank_params) == 0:
# Assign the parameters of each rank according to the type
for param in self._local_params:
if param.dtype not... | [
"def",
"dtype_rank_params",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"_dtype_rank_params",
")",
"==",
"0",
":",
"# Assign the parameters of each rank according to the type",
"for",
"param",
"in",
"self",
".",
"_local_params",
":",
"if",
"param",
".",
... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/fleet/meta_optimizers/dygraph_optimizer/sharding_optimizer_stage2.py#L195-L213 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/training/training_util.py | python | global_step | (sess, global_step_tensor) | return int(sess.run(global_step_tensor)) | Small helper to get the global step.
```python
# Creates a variable to hold the global_step.
global_step_tensor = tf.Variable(10, trainable=False, name='global_step')
# Creates a session.
sess = tf.Session()
# Initializes the variable.
print('global_step: %s' % tf.train.global_step(sess, global_step_tens... | Small helper to get the global step. | [
"Small",
"helper",
"to",
"get",
"the",
"global",
"step",
"."
] | def global_step(sess, global_step_tensor):
"""Small helper to get the global step.
```python
# Creates a variable to hold the global_step.
global_step_tensor = tf.Variable(10, trainable=False, name='global_step')
# Creates a session.
sess = tf.Session()
# Initializes the variable.
print('global_step: %... | [
"def",
"global_step",
"(",
"sess",
",",
"global_step_tensor",
")",
":",
"return",
"int",
"(",
"sess",
".",
"run",
"(",
"global_step_tensor",
")",
")"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/training/training_util.py#L36-L58 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/feature_column/feature_column_v2.py | python | EmbeddingColumn.transform_feature | (self, transformation_cache, state_manager) | return transformation_cache.get(self.categorical_column, state_manager) | Transforms underlying `categorical_column`. | Transforms underlying `categorical_column`. | [
"Transforms",
"underlying",
"categorical_column",
"."
] | def transform_feature(self, transformation_cache, state_manager):
"""Transforms underlying `categorical_column`."""
return transformation_cache.get(self.categorical_column, state_manager) | [
"def",
"transform_feature",
"(",
"self",
",",
"transformation_cache",
",",
"state_manager",
")",
":",
"return",
"transformation_cache",
".",
"get",
"(",
"self",
".",
"categorical_column",
",",
"state_manager",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/feature_column/feature_column_v2.py#L2939-L2941 | |
ultralight-ux/WebCore | 8a83d7f3a7517b75ae7dc18183b4ff9ce898419b | Source/JavaScriptCore/disassembler/udis86/ud_opcode.py | python | UdOpcodeTables.parseOptableXML | (xml) | return insns | Parse udis86 optable.xml file and return list of
instruction definitions. | Parse udis86 optable.xml file and return list of
instruction definitions. | [
"Parse",
"udis86",
"optable",
".",
"xml",
"file",
"and",
"return",
"list",
"of",
"instruction",
"definitions",
"."
] | def parseOptableXML(xml):
"""Parse udis86 optable.xml file and return list of
instruction definitions.
"""
from xml.dom import minidom
xmlDoc = minidom.parse(xml)
tlNode = xmlDoc.firstChild
insns = []
while tlNode and tlNode.localName != "x86optable"... | [
"def",
"parseOptableXML",
"(",
"xml",
")",
":",
"from",
"xml",
".",
"dom",
"import",
"minidom",
"xmlDoc",
"=",
"minidom",
".",
"parse",
"(",
"xml",
")",
"tlNode",
"=",
"xmlDoc",
".",
"firstChild",
"insns",
"=",
"[",
"]",
"while",
"tlNode",
"and",
"tlNo... | https://github.com/ultralight-ux/WebCore/blob/8a83d7f3a7517b75ae7dc18183b4ff9ce898419b/Source/JavaScriptCore/disassembler/udis86/ud_opcode.py#L579-L622 | |
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/scene_retrieving/src/nlohmann_json/benchmarks/thirdparty/benchmark/mingw.py | python | root | (location = None, arch = None, version = None, threading = None,
exceptions = None, revision = None, log = EmptyLogger()) | return root_dir | Returns the root folder of a specific version of the mingw-builds variant
of gcc. Will download the compiler if needed | Returns the root folder of a specific version of the mingw-builds variant
of gcc. Will download the compiler if needed | [
"Returns",
"the",
"root",
"folder",
"of",
"a",
"specific",
"version",
"of",
"the",
"mingw",
"-",
"builds",
"variant",
"of",
"gcc",
".",
"Will",
"download",
"the",
"compiler",
"if",
"needed"
] | def root(location = None, arch = None, version = None, threading = None,
exceptions = None, revision = None, log = EmptyLogger()):
'''
Returns the root folder of a specific version of the mingw-builds variant
of gcc. Will download the compiler if needed
'''
# Get the repository if we don't ... | [
"def",
"root",
"(",
"location",
"=",
"None",
",",
"arch",
"=",
"None",
",",
"version",
"=",
"None",
",",
"threading",
"=",
"None",
",",
"exceptions",
"=",
"None",
",",
"revision",
"=",
"None",
",",
"log",
"=",
"EmptyLogger",
"(",
")",
")",
":",
"# ... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/scene_retrieving/src/nlohmann_json/benchmarks/thirdparty/benchmark/mingw.py#L172-L246 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/flatmenu.py | python | FMRendererMgr.GetRenderer | (self) | return self._renderers[self._currentTheme] | Returns the current theme's renderer. | Returns the current theme's renderer. | [
"Returns",
"the",
"current",
"theme",
"s",
"renderer",
"."
] | def GetRenderer(self):
""" Returns the current theme's renderer. """
return self._renderers[self._currentTheme] | [
"def",
"GetRenderer",
"(",
"self",
")",
":",
"return",
"self",
".",
"_renderers",
"[",
"self",
".",
"_currentTheme",
"]"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/flatmenu.py#L392-L395 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | tools/stats/scribe.py | python | rds_write | (
table_name: str,
values_list: List[Dict[str, Any]],
only_on_master: bool = True,
only_on_jobs: Optional[List[str]] = None,
) | Note: Only works from GitHub Actions CI runners
Write a set of entries to a particular RDS table. 'table_name' should be
a table registered via 'register_rds_schema' prior to calling rds_write.
'values_list' should be a list of dictionaries that map field names to
values. | Note: Only works from GitHub Actions CI runners | [
"Note",
":",
"Only",
"works",
"from",
"GitHub",
"Actions",
"CI",
"runners"
] | def rds_write(
table_name: str,
values_list: List[Dict[str, Any]],
only_on_master: bool = True,
only_on_jobs: Optional[List[str]] = None,
) -> None:
"""
Note: Only works from GitHub Actions CI runners
Write a set of entries to a particular RDS table. 'table_name' should be
a table regis... | [
"def",
"rds_write",
"(",
"table_name",
":",
"str",
",",
"values_list",
":",
"List",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
",",
"only_on_master",
":",
"bool",
"=",
"True",
",",
"only_on_jobs",
":",
"Optional",
"[",
"List",
"[",
"str",
"]",
"]... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/tools/stats/scribe.py#L162-L206 | ||
ros/geometry | 63c3c7b404b8f390061bdadc5bc675e7ae5808be | tf/src/tf/listener.py | python | TransformerROS.fromTranslationRotation | (self, translation, rotation) | return numpy.dot(transformations.translation_matrix(translation), transformations.quaternion_matrix(rotation)) | :param translation: translation expressed as a tuple (x,y,z)
:param rotation: rotation quaternion expressed as a tuple (x,y,z,w)
:return: a :class:`numpy.matrix` 4x4 representation of the transform
:raises: any of the exceptions that :meth:`~tf.Transformer.lookupTransform` can raise
... | :param translation: translation expressed as a tuple (x,y,z)
:param rotation: rotation quaternion expressed as a tuple (x,y,z,w)
:return: a :class:`numpy.matrix` 4x4 representation of the transform
:raises: any of the exceptions that :meth:`~tf.Transformer.lookupTransform` can raise
... | [
":",
"param",
"translation",
":",
"translation",
"expressed",
"as",
"a",
"tuple",
"(",
"x",
"y",
"z",
")",
":",
"param",
"rotation",
":",
"rotation",
"quaternion",
"expressed",
"as",
"a",
"tuple",
"(",
"x",
"y",
"z",
"w",
")",
":",
"return",
":",
"a"... | def fromTranslationRotation(self, translation, rotation):
"""
:param translation: translation expressed as a tuple (x,y,z)
:param rotation: rotation quaternion expressed as a tuple (x,y,z,w)
:return: a :class:`numpy.matrix` 4x4 representation of the transform
:raises: any of the ... | [
"def",
"fromTranslationRotation",
"(",
"self",
",",
"translation",
",",
"rotation",
")",
":",
"return",
"numpy",
".",
"dot",
"(",
"transformations",
".",
"translation_matrix",
"(",
"translation",
")",
",",
"transformations",
".",
"quaternion_matrix",
"(",
"rotatio... | https://github.com/ros/geometry/blob/63c3c7b404b8f390061bdadc5bc675e7ae5808be/tf/src/tf/listener.py#L190-L200 | |
yun-liu/RCF | 91bfb054ad04187dbbe21e539e165ad9bd3ff00b | tools/extra/parse_log.py | python | save_csv_files | (logfile_path, output_dir, train_dict_list, test_dict_list,
delimiter=',', verbose=False) | Save CSV files to output_dir
If the input log file is, e.g., caffe.INFO, the names will be
caffe.INFO.train and caffe.INFO.test | Save CSV files to output_dir | [
"Save",
"CSV",
"files",
"to",
"output_dir"
] | def save_csv_files(logfile_path, output_dir, train_dict_list, test_dict_list,
delimiter=',', verbose=False):
"""Save CSV files to output_dir
If the input log file is, e.g., caffe.INFO, the names will be
caffe.INFO.train and caffe.INFO.test
"""
log_basename = os.path.basename(log... | [
"def",
"save_csv_files",
"(",
"logfile_path",
",",
"output_dir",
",",
"train_dict_list",
",",
"test_dict_list",
",",
"delimiter",
"=",
"','",
",",
"verbose",
"=",
"False",
")",
":",
"log_basename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"logfile_path",
... | https://github.com/yun-liu/RCF/blob/91bfb054ad04187dbbe21e539e165ad9bd3ff00b/tools/extra/parse_log.py#L129-L142 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/site_compare/drivers/win32/windowing.py | python | WaitForProcessExit | (proc, timeout=None) | return (win32event.WaitForSingleObject(proc, timeout) ==
win32event.WAIT_OBJECT_0) | Waits for a given process to terminate.
Args:
proc: handle to process
timeout: timeout (in seconds). None = wait indefinitely
Returns:
True if process ended, False if timed out | Waits for a given process to terminate. | [
"Waits",
"for",
"a",
"given",
"process",
"to",
"terminate",
"."
] | def WaitForProcessExit(proc, timeout=None):
"""Waits for a given process to terminate.
Args:
proc: handle to process
timeout: timeout (in seconds). None = wait indefinitely
Returns:
True if process ended, False if timed out
"""
if timeout is None:
timeout = win32event.INFINITE
else:
# ... | [
"def",
"WaitForProcessExit",
"(",
"proc",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"timeout",
"is",
"None",
":",
"timeout",
"=",
"win32event",
".",
"INFINITE",
"else",
":",
"# convert sec to msec",
"timeout",
"*=",
"1000",
"return",
"(",
"win32event",
".... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/site_compare/drivers/win32/windowing.py#L198-L215 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/debug/wrappers/hooks.py | python | LocalCLIDebugHook.__init__ | (self,
ui_type="curses",
dump_root=None,
thread_name_filter=None) | Create a local debugger command-line interface (CLI) hook.
Args:
ui_type: (str) user-interface type.
dump_root: (`str`) optional path to the dump root directory. Must be a
directory that does not exist or an empty directory. If the directory
does not exist, it will be created by the deb... | Create a local debugger command-line interface (CLI) hook. | [
"Create",
"a",
"local",
"debugger",
"command",
"-",
"line",
"interface",
"(",
"CLI",
")",
"hook",
"."
] | def __init__(self,
ui_type="curses",
dump_root=None,
thread_name_filter=None):
"""Create a local debugger command-line interface (CLI) hook.
Args:
ui_type: (str) user-interface type.
dump_root: (`str`) optional path to the dump root directory. Must be a
... | [
"def",
"__init__",
"(",
"self",
",",
"ui_type",
"=",
"\"curses\"",
",",
"dump_root",
"=",
"None",
",",
"thread_name_filter",
"=",
"None",
")",
":",
"self",
".",
"_ui_type",
"=",
"ui_type",
"self",
".",
"_dump_root",
"=",
"dump_root",
"self",
".",
"_thread_... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/debug/wrappers/hooks.py#L41-L62 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/persist/persistencemanager.py | python | PersistenceManager.AddBadDefaultName | (self, name) | Adds a name to the ``BAD_DEFAULT_NAMES`` constant.
:param `name`: a string specifying the control's default name. | Adds a name to the ``BAD_DEFAULT_NAMES`` constant. | [
"Adds",
"a",
"name",
"to",
"the",
"BAD_DEFAULT_NAMES",
"constant",
"."
] | def AddBadDefaultName(self, name):
"""
Adds a name to the ``BAD_DEFAULT_NAMES`` constant.
:param `name`: a string specifying the control's default name.
"""
global BAD_DEFAULT_NAMES
BAD_DEFAULT_NAMES.append(name) | [
"def",
"AddBadDefaultName",
"(",
"self",
",",
"name",
")",
":",
"global",
"BAD_DEFAULT_NAMES",
"BAD_DEFAULT_NAMES",
".",
"append",
"(",
"name",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/persist/persistencemanager.py#L837-L845 | ||
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/controls/GravityWalker.py | python | GravityWalker.disableAvatarControls | (self) | Ignore the arrow keys, etc. | Ignore the arrow keys, etc. | [
"Ignore",
"the",
"arrow",
"keys",
"etc",
"."
] | def disableAvatarControls(self):
"""
Ignore the arrow keys, etc.
"""
assert self.notify.debugStateCall(self)
if self.controlsTask:
self.controlsTask.remove()
self.controlsTask = None
if self.indicatorTask:
self.indicatorTask.remove()
... | [
"def",
"disableAvatarControls",
"(",
"self",
")",
":",
"assert",
"self",
".",
"notify",
".",
"debugStateCall",
"(",
"self",
")",
"if",
"self",
".",
"controlsTask",
":",
"self",
".",
"controlsTask",
".",
"remove",
"(",
")",
"self",
".",
"controlsTask",
"=",... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/controls/GravityWalker.py#L586-L602 | ||
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/generators/visitors/InstanceTopologyHVisitor.py | python | InstanceTopologyHVisitor.startSourceFilesVisit | (self, obj) | Defined to generate starting static code within files. | Defined to generate starting static code within files. | [
"Defined",
"to",
"generate",
"starting",
"static",
"code",
"within",
"files",
"."
] | def startSourceFilesVisit(self, obj):
"""
Defined to generate starting static code within files.
""" | [
"def",
"startSourceFilesVisit",
"(",
"self",
",",
"obj",
")",
":"
] | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/generators/visitors/InstanceTopologyHVisitor.py#L136-L139 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/ndimage/morphology.py | python | generate_binary_structure | (rank, connectivity) | return output <= connectivity | Generate a binary structure for binary morphological operations.
Parameters
----------
rank : int
Number of dimensions of the array to which the structuring element
will be applied, as returned by `np.ndim`.
connectivity : int
`connectivity` determines which elements of the o... | Generate a binary structure for binary morphological operations. | [
"Generate",
"a",
"binary",
"structure",
"for",
"binary",
"morphological",
"operations",
"."
] | def generate_binary_structure(rank, connectivity):
"""
Generate a binary structure for binary morphological operations.
Parameters
----------
rank : int
Number of dimensions of the array to which the structuring element
will be applied, as returned by `np.ndim`.
connectivity :... | [
"def",
"generate_binary_structure",
"(",
"rank",
",",
"connectivity",
")",
":",
"if",
"connectivity",
"<",
"1",
":",
"connectivity",
"=",
"1",
"if",
"rank",
"<",
"1",
":",
"return",
"numpy",
".",
"array",
"(",
"True",
",",
"dtype",
"=",
"bool",
")",
"o... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/ndimage/morphology.py#L124-L212 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/decorators.py | python | jit_module | (**kwargs) | Automatically ``jit``-wraps functions defined in a Python module
Note that ``jit_module`` should only be called at the end of the module to
be jitted. In addition, only functions which are defined in the module
``jit_module`` is called from are considered for automatic jit-wrapping.
See the Numba docum... | Automatically ``jit``-wraps functions defined in a Python module | [
"Automatically",
"jit",
"-",
"wraps",
"functions",
"defined",
"in",
"a",
"Python",
"module"
] | def jit_module(**kwargs):
""" Automatically ``jit``-wraps functions defined in a Python module
Note that ``jit_module`` should only be called at the end of the module to
be jitted. In addition, only functions which are defined in the module
``jit_module`` is called from are considered for automatic jit... | [
"def",
"jit_module",
"(",
"*",
"*",
"kwargs",
")",
":",
"# Get the module jit_module is being called from",
"frame",
"=",
"inspect",
".",
"stack",
"(",
")",
"[",
"1",
"]",
"module",
"=",
"inspect",
".",
"getmodule",
"(",
"frame",
"[",
"0",
"]",
")",
"# Rep... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/decorators.py#L265-L286 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/ir/builder.py | python | IRBuilder.load | (self, ptr, name='', align=None) | return ld | Load value from pointer, with optional guaranteed alignment:
name = *ptr | Load value from pointer, with optional guaranteed alignment:
name = *ptr | [
"Load",
"value",
"from",
"pointer",
"with",
"optional",
"guaranteed",
"alignment",
":",
"name",
"=",
"*",
"ptr"
] | def load(self, ptr, name='', align=None):
"""
Load value from pointer, with optional guaranteed alignment:
name = *ptr
"""
if not isinstance(ptr.type, types.PointerType):
raise TypeError("cannot load from value of type %s (%r): not a pointer"
... | [
"def",
"load",
"(",
"self",
",",
"ptr",
",",
"name",
"=",
"''",
",",
"align",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"ptr",
".",
"type",
",",
"types",
".",
"PointerType",
")",
":",
"raise",
"TypeError",
"(",
"\"cannot load from value of... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/ir/builder.py#L717-L728 | |
goldeneye-source/ges-code | 2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d | thirdparty/protobuf-2.3.0/python/mox.py | python | MultipleTimesGroup.IsSatisfied | (self) | return False | Return True if all methods in this group are called at least once. | Return True if all methods in this group are called at least once. | [
"Return",
"True",
"if",
"all",
"methods",
"in",
"this",
"group",
"are",
"called",
"at",
"least",
"once",
"."
] | def IsSatisfied(self):
"""Return True if all methods in this group are called at least once."""
# NOTE(psycho): We can't use the simple set difference here because we want
# to match different parameters which are considered the same e.g. IsA(str)
# and some string. This solution is O(n^2) but n should ... | [
"def",
"IsSatisfied",
"(",
"self",
")",
":",
"# NOTE(psycho): We can't use the simple set difference here because we want",
"# to match different parameters which are considered the same e.g. IsA(str)",
"# and some string. This solution is O(n^2) but n should be small.",
"tmp",
"=",
"self",
... | https://github.com/goldeneye-source/ges-code/blob/2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d/thirdparty/protobuf-2.3.0/python/mox.py#L1318-L1331 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/urllib3/filepost.py | python | choose_boundary | () | return boundary | Our embarrassingly-simple replacement for mimetools.choose_boundary. | Our embarrassingly-simple replacement for mimetools.choose_boundary. | [
"Our",
"embarrassingly",
"-",
"simple",
"replacement",
"for",
"mimetools",
".",
"choose_boundary",
"."
] | def choose_boundary():
"""
Our embarrassingly-simple replacement for mimetools.choose_boundary.
"""
boundary = binascii.hexlify(os.urandom(16))
if not six.PY2:
boundary = boundary.decode("ascii")
return boundary | [
"def",
"choose_boundary",
"(",
")",
":",
"boundary",
"=",
"binascii",
".",
"hexlify",
"(",
"os",
".",
"urandom",
"(",
"16",
")",
")",
"if",
"not",
"six",
".",
"PY2",
":",
"boundary",
"=",
"boundary",
".",
"decode",
"(",
"\"ascii\"",
")",
"return",
"b... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/urllib3/filepost.py#L15-L22 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | ListBox.Insert | (*args, **kwargs) | return _controls_.ListBox_Insert(*args, **kwargs) | Insert(self, String item, int pos, PyObject clientData=None)
Insert an item into the control before the item at the ``pos`` index,
optionally associating some data object with the item. | Insert(self, String item, int pos, PyObject clientData=None) | [
"Insert",
"(",
"self",
"String",
"item",
"int",
"pos",
"PyObject",
"clientData",
"=",
"None",
")"
] | def Insert(*args, **kwargs):
"""
Insert(self, String item, int pos, PyObject clientData=None)
Insert an item into the control before the item at the ``pos`` index,
optionally associating some data object with the item.
"""
return _controls_.ListBox_Insert(*args, **kwargs... | [
"def",
"Insert",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ListBox_Insert",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L1167-L1174 | |
nsnam/ns-3-dev-git | efdb2e21f45c0a87a60b47c547b68fa140a7b686 | src/visualizer/visualizer/core.py | python | Visualizer._end_panning | (self, event) | !
End panning function.
@param self: class object.
@param event: active event.
@return none | !
End panning function. | [
"!",
"End",
"panning",
"function",
"."
] | def _end_panning(self, event):
"""!
End panning function.
@param self: class object.
@param event: active event.
@return none
"""
if self._panning_state is None:
return
self.canvas.get_window().set_cursor(None)
self.canvas.disconnect(s... | [
"def",
"_end_panning",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"_panning_state",
"is",
"None",
":",
"return",
"self",
".",
"canvas",
".",
"get_window",
"(",
")",
".",
"set_cursor",
"(",
"None",
")",
"self",
".",
"canvas",
".",
"disconne... | https://github.com/nsnam/ns-3-dev-git/blob/efdb2e21f45c0a87a60b47c547b68fa140a7b686/src/visualizer/visualizer/core.py#L908-L920 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/array_ops.py | python | _autopacking_helper | (list_or_tuple, dtype, name) | Converts the given list or tuple to a tensor by packing.
Args:
list_or_tuple: A (possibly nested) list or tuple containing a tensor.
dtype: The element type of the returned tensor.
name: A name for the returned tensor.
Returns:
A `tf.Tensor` with value equivalent to `list_or_tuple`. | Converts the given list or tuple to a tensor by packing. | [
"Converts",
"the",
"given",
"list",
"or",
"tuple",
"to",
"a",
"tensor",
"by",
"packing",
"."
] | def _autopacking_helper(list_or_tuple, dtype, name):
"""Converts the given list or tuple to a tensor by packing.
Args:
list_or_tuple: A (possibly nested) list or tuple containing a tensor.
dtype: The element type of the returned tensor.
name: A name for the returned tensor.
Returns:
A `tf.Tensor... | [
"def",
"_autopacking_helper",
"(",
"list_or_tuple",
",",
"dtype",
",",
"name",
")",
":",
"if",
"context",
".",
"executing_eagerly",
"(",
")",
":",
"# NOTE: Fast path when all the items are tensors, this doesn't do any type",
"# checking.",
"if",
"all",
"(",
"isinstance",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/array_ops.py#L1484-L1530 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/pkg_resources/__init__.py | python | register_namespace_handler | (importer_type, namespace_handler) | Register `namespace_handler` to declare namespace packages
`importer_type` is the type or class of a PEP 302 "Importer" (sys.path item
handler), and `namespace_handler` is a callable like this::
def namespace_handler(importer, path_entry, moduleName, module):
# return a path_entry to use f... | Register `namespace_handler` to declare namespace packages | [
"Register",
"namespace_handler",
"to",
"declare",
"namespace",
"packages"
] | def register_namespace_handler(importer_type, namespace_handler):
"""Register `namespace_handler` to declare namespace packages
`importer_type` is the type or class of a PEP 302 "Importer" (sys.path item
handler), and `namespace_handler` is a callable like this::
def namespace_handler(importer, pa... | [
"def",
"register_namespace_handler",
"(",
"importer_type",
",",
"namespace_handler",
")",
":",
"_namespace_handlers",
"[",
"importer_type",
"]",
"=",
"namespace_handler"
] | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pkg_resources/__init__.py#L2164-L2179 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | media/webrtc/trunk/build/android/pylib/debug_info.py | python | GTestDebugInfo.ZipAndCleanResults | (dest_dir, dump_file_name) | A helper method to zip all debug information results into a dump file.
Args:
dest_dir: Dir path in where we put the dump file.
dump_file_name: Desired name of the dump file. This method makes sure
'.zip' will be added as ext name. | A helper method to zip all debug information results into a dump file. | [
"A",
"helper",
"method",
"to",
"zip",
"all",
"debug",
"information",
"results",
"into",
"a",
"dump",
"file",
"."
] | def ZipAndCleanResults(dest_dir, dump_file_name):
"""A helper method to zip all debug information results into a dump file.
Args:
dest_dir: Dir path in where we put the dump file.
dump_file_name: Desired name of the dump file. This method makes sure
'.zip' will be added as ext... | [
"def",
"ZipAndCleanResults",
"(",
"dest_dir",
",",
"dump_file_name",
")",
":",
"if",
"not",
"dest_dir",
"or",
"not",
"dump_file_name",
":",
"return",
"cmd_helper",
".",
"RunCmd",
"(",
"[",
"'mkdir'",
",",
"'-p'",
",",
"dest_dir",
"]",
")",
"log_basename",
"=... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/media/webrtc/trunk/build/android/pylib/debug_info.py#L174-L196 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/vis/editors.py | python | VisualEditorBase.loadable | (self) | return True | Whether Load... should be shown | Whether Load... should be shown | [
"Whether",
"Load",
"...",
"should",
"be",
"shown"
] | def loadable(self) -> bool:
"""Whether Load... should be shown"""
return True | [
"def",
"loadable",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"True"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/vis/editors.py#L41-L43 | |
isl-org/Open3D | 79aec3ddde6a571ce2f28e4096477e52ec465244 | python/open3d/visualization/tensorboard_plugin/plugin.py | python | Open3DPlugin._webrtc_http_api | (self, request) | Relay WebRTC connection setup messages coming as HTTP requests. | Relay WebRTC connection setup messages coming as HTTP requests. | [
"Relay",
"WebRTC",
"connection",
"setup",
"messages",
"coming",
"as",
"HTTP",
"requests",
"."
] | def _webrtc_http_api(self, request):
"""Relay WebRTC connection setup messages coming as HTTP requests."""
try:
entry_point = request.path[(len(self._PLUGIN_DIRECTORY_PATH_PART) -
1):]
query_string = (b'?' + request.query_string
... | [
"def",
"_webrtc_http_api",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"entry_point",
"=",
"request",
".",
"path",
"[",
"(",
"len",
"(",
"self",
".",
"_PLUGIN_DIRECTORY_PATH_PART",
")",
"-",
"1",
")",
":",
"]",
"query_string",
"=",
"(",
"b'?'",
... | https://github.com/isl-org/Open3D/blob/79aec3ddde6a571ce2f28e4096477e52ec465244/python/open3d/visualization/tensorboard_plugin/plugin.py#L749-L775 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/site_compare/commands/measure.py | python | CreateCommand | (cmdline) | Inserts the command and arguments into a command line for parsing. | Inserts the command and arguments into a command line for parsing. | [
"Inserts",
"the",
"command",
"and",
"arguments",
"into",
"a",
"command",
"line",
"for",
"parsing",
"."
] | def CreateCommand(cmdline):
"""Inserts the command and arguments into a command line for parsing."""
cmd = cmdline.AddCommand(
["measure"],
"Measures how long a series of URLs takes to load in one or more browsers.",
None,
ExecuteMeasure)
browser_iterate.SetupIterationCommandLine(cmd)
cmd.AddAr... | [
"def",
"CreateCommand",
"(",
"cmdline",
")",
":",
"cmd",
"=",
"cmdline",
".",
"AddCommand",
"(",
"[",
"\"measure\"",
"]",
",",
"\"Measures how long a series of URLs takes to load in one or more browsers.\"",
",",
"None",
",",
"ExecuteMeasure",
")",
"browser_iterate",
".... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/site_compare/commands/measure.py#L27-L37 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/MooseDocs/base/renderers.py | python | HTMLRenderer.postRender | (self, page, result) | Insert CSS/JS dependencies into html node tree. | Insert CSS/JS dependencies into html node tree. | [
"Insert",
"CSS",
"/",
"JS",
"dependencies",
"into",
"html",
"node",
"tree",
"."
] | def postRender(self, page, result):
"""Insert CSS/JS dependencies into html node tree."""
def rel(path):
"""Helper to create relative paths for js/css dependencies."""
if path.startswith('http'):
return path
return os.path.relpath(path, os.path.dirnam... | [
"def",
"postRender",
"(",
"self",
",",
"page",
",",
"result",
")",
":",
"def",
"rel",
"(",
"path",
")",
":",
"\"\"\"Helper to create relative paths for js/css dependencies.\"\"\"",
"if",
"path",
".",
"startswith",
"(",
"'http'",
")",
":",
"return",
"path",
"retu... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/MooseDocs/base/renderers.py#L277-L308 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/backend.py | python | repeat | (x, n) | return array_ops.tile(x, pattern) | Repeats a 2D tensor.
if `x` has shape (samples, dim) and `n` is `2`,
the output will have shape `(samples, 2, dim)`.
Args:
x: Tensor or variable.
n: Python integer, number of times to repeat.
Returns:
A tensor.
Example:
>>> b = tf.constant([[1, 2], [3, 4]])
>>> b
<tf.T... | Repeats a 2D tensor. | [
"Repeats",
"a",
"2D",
"tensor",
"."
] | def repeat(x, n):
"""Repeats a 2D tensor.
if `x` has shape (samples, dim) and `n` is `2`,
the output will have shape `(samples, 2, dim)`.
Args:
x: Tensor or variable.
n: Python integer, number of times to repeat.
Returns:
A tensor.
Example:
>>> b = tf.constant([[1, 2], [3, 4]])
... | [
"def",
"repeat",
"(",
"x",
",",
"n",
")",
":",
"assert",
"ndim",
"(",
"x",
")",
"==",
"2",
"x",
"=",
"array_ops",
".",
"expand_dims",
"(",
"x",
",",
"1",
")",
"pattern",
"=",
"array_ops",
".",
"stack",
"(",
"[",
"1",
",",
"n",
",",
"1",
"]",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/backend.py#L3325-L3356 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/lmbrwaflib/build_configurations.py | python | add_restricted_3rd_party_subpaths | (ctx, third_party_subpaths_map) | return None | For grebuilding some 3rd party libraries with WAF for restricted platforms, update the incoming map with the restricted platform name and
a subfolder that represents where the waf-built binaries will be built to
:param ctx: Context
:param third_party_subpaths_map: The third p... | For grebuilding some 3rd party libraries with WAF for restricted platforms, update the incoming map with the restricted platform name and
a subfolder that represents where the waf-built binaries will be built to
:param ctx: Context
:param third_party_subpaths_map: The third p... | [
"For",
"grebuilding",
"some",
"3rd",
"party",
"libraries",
"with",
"WAF",
"for",
"restricted",
"platforms",
"update",
"the",
"incoming",
"map",
"with",
"the",
"restricted",
"platform",
"name",
"and",
"a",
"subfolder",
"that",
"represents",
"where",
"the",
"waf",... | def add_restricted_3rd_party_subpaths(ctx, third_party_subpaths_map):
"""
For grebuilding some 3rd party libraries with WAF for restricted platforms, update the incoming map with the restricted platform name and
a subfolder that represents where the waf-built binaries will be built to
:param ctx: ... | [
"def",
"add_restricted_3rd_party_subpaths",
"(",
"ctx",
",",
"third_party_subpaths_map",
")",
":",
"return",
"None"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/lmbrwaflib/build_configurations.py#L1818-L1827 | |
asLody/whale | 6a661b27cc4cf83b7b5a3b02451597ee1ac7f264 | whale/cpplint.py | python | CheckForFunctionLengths | (filename, clean_lines, linenum,
function_state, error) | Reports for long function bodies.
For an overview why this is done, see:
https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions
Uses a simplistic algorithm assuming other style guidelines
(especially spacing) are followed.
Only checks unindented functions, so class members are... | Reports for long function bodies. | [
"Reports",
"for",
"long",
"function",
"bodies",
"."
] | def CheckForFunctionLengths(filename, clean_lines, linenum,
function_state, error):
"""Reports for long function bodies.
For an overview why this is done, see:
https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions
Uses a simplistic algorithm assuming... | [
"def",
"CheckForFunctionLengths",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"function_state",
",",
"error",
")",
":",
"lines",
"=",
"clean_lines",
".",
"lines",
"line",
"=",
"lines",
"[",
"linenum",
"]",
"joined_line",
"=",
"''",
"starting_func... | https://github.com/asLody/whale/blob/6a661b27cc4cf83b7b5a3b02451597ee1ac7f264/whale/cpplint.py#L3046-L3111 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/aui.py | python | AuiDockArt.DrawBorder | (*args, **kwargs) | return _aui.AuiDockArt_DrawBorder(*args, **kwargs) | DrawBorder(self, DC dc, Window window, Rect rect, AuiPaneInfo pane) | DrawBorder(self, DC dc, Window window, Rect rect, AuiPaneInfo pane) | [
"DrawBorder",
"(",
"self",
"DC",
"dc",
"Window",
"window",
"Rect",
"rect",
"AuiPaneInfo",
"pane",
")"
] | def DrawBorder(*args, **kwargs):
"""DrawBorder(self, DC dc, Window window, Rect rect, AuiPaneInfo pane)"""
return _aui.AuiDockArt_DrawBorder(*args, **kwargs) | [
"def",
"DrawBorder",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiDockArt_DrawBorder",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/aui.py#L1014-L1016 | |
jackaudio/jack2 | 21b293dbc37d42446141a08922cdec0d2550c6a0 | waflib/Context.py | python | create_context | (cmd_name, *k, **kw) | return ctx | Returns a new :py:class:`waflib.Context.Context` instance corresponding to the given command.
Used in particular by :py:func:`waflib.Scripting.run_command`
:param cmd_name: command name
:type cmd_name: string
:param k: arguments to give to the context class initializer
:type k: list
:param k: keyword arguments t... | Returns a new :py:class:`waflib.Context.Context` instance corresponding to the given command.
Used in particular by :py:func:`waflib.Scripting.run_command` | [
"Returns",
"a",
"new",
":",
"py",
":",
"class",
":",
"waflib",
".",
"Context",
".",
"Context",
"instance",
"corresponding",
"to",
"the",
"given",
"command",
".",
"Used",
"in",
"particular",
"by",
":",
"py",
":",
"func",
":",
"waflib",
".",
"Scripting",
... | def create_context(cmd_name, *k, **kw):
"""
Returns a new :py:class:`waflib.Context.Context` instance corresponding to the given command.
Used in particular by :py:func:`waflib.Scripting.run_command`
:param cmd_name: command name
:type cmd_name: string
:param k: arguments to give to the context class initializer... | [
"def",
"create_context",
"(",
"cmd_name",
",",
"*",
"k",
",",
"*",
"*",
"kw",
")",
":",
"for",
"x",
"in",
"classes",
":",
"if",
"x",
".",
"cmd",
"==",
"cmd_name",
":",
"return",
"x",
"(",
"*",
"k",
",",
"*",
"*",
"kw",
")",
"ctx",
"=",
"Conte... | https://github.com/jackaudio/jack2/blob/21b293dbc37d42446141a08922cdec0d2550c6a0/waflib/Context.py#L73-L92 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/inspector_protocol/jinja2/filters.py | python | do_sum | (environment, iterable, attribute=None, start=0) | return sum(iterable, start) | Returns the sum of a sequence of numbers plus the value of parameter
'start' (which defaults to 0). When the sequence is empty it returns
start.
It is also possible to sum up only certain attributes:
.. sourcecode:: jinja
Total: {{ items|sum(attribute='price') }}
.. versionchanged:: 2.6... | Returns the sum of a sequence of numbers plus the value of parameter
'start' (which defaults to 0). When the sequence is empty it returns
start. | [
"Returns",
"the",
"sum",
"of",
"a",
"sequence",
"of",
"numbers",
"plus",
"the",
"value",
"of",
"parameter",
"start",
"(",
"which",
"defaults",
"to",
"0",
")",
".",
"When",
"the",
"sequence",
"is",
"empty",
"it",
"returns",
"start",
"."
] | def do_sum(environment, iterable, attribute=None, start=0):
"""Returns the sum of a sequence of numbers plus the value of parameter
'start' (which defaults to 0). When the sequence is empty it returns
start.
It is also possible to sum up only certain attributes:
.. sourcecode:: jinja
Tot... | [
"def",
"do_sum",
"(",
"environment",
",",
"iterable",
",",
"attribute",
"=",
"None",
",",
"start",
"=",
"0",
")",
":",
"if",
"attribute",
"is",
"not",
"None",
":",
"iterable",
"=",
"imap",
"(",
"make_attrgetter",
"(",
"environment",
",",
"attribute",
")"... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/inspector_protocol/jinja2/filters.py#L856-L873 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/redirector.py | python | WidgetRedirector.unregister | (self, operation) | Return the function for the operation, or None.
Deleting the instance attribute unmasks the class attribute. | Return the function for the operation, or None. | [
"Return",
"the",
"function",
"for",
"the",
"operation",
"or",
"None",
"."
] | def unregister(self, operation):
'''Return the function for the operation, or None.
Deleting the instance attribute unmasks the class attribute.
'''
if operation in self._operations:
function = self._operations[operation]
del self._operations[operation]
... | [
"def",
"unregister",
"(",
"self",
",",
"operation",
")",
":",
"if",
"operation",
"in",
"self",
".",
"_operations",
":",
"function",
"=",
"self",
".",
"_operations",
"[",
"operation",
"]",
"del",
"self",
".",
"_operations",
"[",
"operation",
"]",
"try",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/redirector.py#L82-L96 | ||
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/rl_tools.py | python | LinearSchedule.__init__ | (self, init_val, final_val, num_steps) | A simple linear schedule.
Once the the number of steps is reached, value is always equal to the final
value.
Arguments:
init_val: the initial value.
final_val: the final_value
num_steps: the number of steps to get from the initial to final value. | A simple linear schedule. | [
"A",
"simple",
"linear",
"schedule",
"."
] | def __init__(self, init_val, final_val, num_steps):
"""A simple linear schedule.
Once the the number of steps is reached, value is always equal to the final
value.
Arguments:
init_val: the initial value.
final_val: the final_value
num_steps: the number of steps to get from the initia... | [
"def",
"__init__",
"(",
"self",
",",
"init_val",
",",
"final_val",
",",
"num_steps",
")",
":",
"super",
"(",
"LinearSchedule",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_value",
"=",
"init_val",
"self",
".",
"_final_value",
"=",
"final_v... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/rl_tools.py#L65-L82 | ||
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/intelhex/bench.py | python | main | (argv=None) | return 0 | Main function to run benchmarks.
@param argv: command-line arguments.
@return: exit code (0 is OK). | Main function to run benchmarks. | [
"Main",
"function",
"to",
"run",
"benchmarks",
"."
] | def main(argv=None):
"""Main function to run benchmarks.
@param argv: command-line arguments.
@return: exit code (0 is OK).
"""
import getopt
# default values
test_read = None
test_write = None
n = 3 # number of repeat
if argv is None:
argv = sys.argv[1:... | [
"def",
"main",
"(",
"argv",
"=",
"None",
")",
":",
"import",
"getopt",
"# default values",
"test_read",
"=",
"None",
"test_write",
"=",
"None",
"n",
"=",
"3",
"# number of repeat",
"if",
"argv",
"is",
"None",
":",
"argv",
"=",
"sys",
".",
"argv",
"[",
... | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/intelhex/bench.py#L232-L276 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py2/google/protobuf/descriptor_pool.py | python | DescriptorPool.Add | (self, file_desc_proto) | Adds the FileDescriptorProto and its types to this pool.
Args:
file_desc_proto (FileDescriptorProto): The file descriptor to add. | Adds the FileDescriptorProto and its types to this pool. | [
"Adds",
"the",
"FileDescriptorProto",
"and",
"its",
"types",
"to",
"this",
"pool",
"."
] | def Add(self, file_desc_proto):
"""Adds the FileDescriptorProto and its types to this pool.
Args:
file_desc_proto (FileDescriptorProto): The file descriptor to add.
"""
self._internal_db.Add(file_desc_proto) | [
"def",
"Add",
"(",
"self",
",",
"file_desc_proto",
")",
":",
"self",
".",
"_internal_db",
".",
"Add",
"(",
"file_desc_proto",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py2/google/protobuf/descriptor_pool.py#L195-L202 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | Window.ShouldInheritColours | (*args, **kwargs) | return _core_.Window_ShouldInheritColours(*args, **kwargs) | ShouldInheritColours(self) -> bool
Return true from here to allow the colours of this window to be
changed by InheritAttributes, returning false forbids inheriting them
from the parent window.
The base class version returns false, but this method is overridden in
wxControl wher... | ShouldInheritColours(self) -> bool | [
"ShouldInheritColours",
"(",
"self",
")",
"-",
">",
"bool"
] | def ShouldInheritColours(*args, **kwargs):
"""
ShouldInheritColours(self) -> bool
Return true from here to allow the colours of this window to be
changed by InheritAttributes, returning false forbids inheriting them
from the parent window.
The base class version returns... | [
"def",
"ShouldInheritColours",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_ShouldInheritColours",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L11578-L11589 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/series.py | python | Series._binop | (self, other, func, level=None, fill_value=None) | return ret | Perform generic binary operation with optional fill value.
Parameters
----------
other : Series
func : binary operator
fill_value : float or object
Value to substitute for NA/null values. If both Series are NA in a
location, the result will be NA regardle... | Perform generic binary operation with optional fill value. | [
"Perform",
"generic",
"binary",
"operation",
"with",
"optional",
"fill",
"value",
"."
] | def _binop(self, other, func, level=None, fill_value=None):
"""
Perform generic binary operation with optional fill value.
Parameters
----------
other : Series
func : binary operator
fill_value : float or object
Value to substitute for NA/null values.... | [
"def",
"_binop",
"(",
"self",
",",
"other",
",",
"func",
",",
"level",
"=",
"None",
",",
"fill_value",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"Series",
")",
":",
"raise",
"AssertionError",
"(",
"\"Other operand must be Series\... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/series.py#L2585-L2622 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/framework/errors.py | python | AbortedError.__init__ | (self, node_def, op, message) | Creates an `AbortedError`. | Creates an `AbortedError`. | [
"Creates",
"an",
"AbortedError",
"."
] | def __init__(self, node_def, op, message):
"""Creates an `AbortedError`."""
super(AbortedError, self).__init__(node_def, op, message, ABORTED) | [
"def",
"__init__",
"(",
"self",
",",
"node_def",
",",
"op",
",",
"message",
")",
":",
"super",
"(",
"AbortedError",
",",
"self",
")",
".",
"__init__",
"(",
"node_def",
",",
"op",
",",
"message",
",",
"ABORTED",
")"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/framework/errors.py#L328-L330 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/xrc.py | python | XmlResource.Unload | (*args, **kwargs) | return _xrc.XmlResource_Unload(*args, **kwargs) | Unload(self, String filename) -> bool | Unload(self, String filename) -> bool | [
"Unload",
"(",
"self",
"String",
"filename",
")",
"-",
">",
"bool"
] | def Unload(*args, **kwargs):
"""Unload(self, String filename) -> bool"""
return _xrc.XmlResource_Unload(*args, **kwargs) | [
"def",
"Unload",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_xrc",
".",
"XmlResource_Unload",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/xrc.py#L94-L96 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | uCSIsGujarati | (code) | return ret | Check whether the character is part of Gujarati UCS Block | Check whether the character is part of Gujarati UCS Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"Gujarati",
"UCS",
"Block"
] | def uCSIsGujarati(code):
"""Check whether the character is part of Gujarati UCS Block """
ret = libxml2mod.xmlUCSIsGujarati(code)
return ret | [
"def",
"uCSIsGujarati",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsGujarati",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L2555-L2558 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/command/setopt.py | python | edit_config | (filename, settings, dry_run=False) | Edit a configuration file to include `settings`
`settings` is a dictionary of dictionaries or ``None`` values, keyed by
command/section name. A ``None`` value means to delete the entire section,
while a dictionary lists settings to be changed or deleted in that section.
A setting of ``None`` means to ... | Edit a configuration file to include `settings` | [
"Edit",
"a",
"configuration",
"file",
"to",
"include",
"settings"
] | def edit_config(filename, settings, dry_run=False):
"""Edit a configuration file to include `settings`
`settings` is a dictionary of dictionaries or ``None`` values, keyed by
command/section name. A ``None`` value means to delete the entire section,
while a dictionary lists settings to be changed or d... | [
"def",
"edit_config",
"(",
"filename",
",",
"settings",
",",
"dry_run",
"=",
"False",
")",
":",
"log",
".",
"debug",
"(",
"\"Reading configuration from %s\"",
",",
"filename",
")",
"opts",
"=",
"configparser",
".",
"RawConfigParser",
"(",
")",
"opts",
".",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/command/setopt.py#L33-L73 | ||
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/tools/gyp/pylib/gyp/common.py | python | BuildFileTargets | (target_list, build_file) | return [p for p in target_list if BuildFile(p) == build_file] | From a target_list, returns the subset from the specified build_file. | From a target_list, returns the subset from the specified build_file. | [
"From",
"a",
"target_list",
"returns",
"the",
"subset",
"from",
"the",
"specified",
"build_file",
"."
] | def BuildFileTargets(target_list, build_file):
"""From a target_list, returns the subset from the specified build_file.
"""
return [p for p in target_list if BuildFile(p) == build_file] | [
"def",
"BuildFileTargets",
"(",
"target_list",
",",
"build_file",
")",
":",
"return",
"[",
"p",
"for",
"p",
"in",
"target_list",
"if",
"BuildFile",
"(",
"p",
")",
"==",
"build_file",
"]"
] | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/common.py#L315-L318 | |
neoml-lib/neoml | a0d370fba05269a1b2258cef126f77bbd2054a3e | NeoML/Python/neoml/Dnn/Loss.py | python | Loss.loss_weight | (self) | return self._internal.get_loss_weight() | Gets the multiplier for the loss function during training. | Gets the multiplier for the loss function during training. | [
"Gets",
"the",
"multiplier",
"for",
"the",
"loss",
"function",
"during",
"training",
"."
] | def loss_weight(self):
"""Gets the multiplier for the loss function during training.
"""
return self._internal.get_loss_weight() | [
"def",
"loss_weight",
"(",
"self",
")",
":",
"return",
"self",
".",
"_internal",
".",
"get_loss_weight",
"(",
")"
] | https://github.com/neoml-lib/neoml/blob/a0d370fba05269a1b2258cef126f77bbd2054a3e/NeoML/Python/neoml/Dnn/Loss.py#L40-L43 | |
jeog/TDAmeritradeAPI | 91c738afd7d57b54f6231170bd64c2550fafd34d | python/tdma_api/get.py | python | TransactionHistoryGetter.set_transaction_type | (self, transaction_type) | Sets/changes TRANSACTION_TYPE_[] constant to use. | Sets/changes TRANSACTION_TYPE_[] constant to use. | [
"Sets",
"/",
"changes",
"TRANSACTION_TYPE_",
"[]",
"constant",
"to",
"use",
"."
] | def set_transaction_type(self, transaction_type):
"""Sets/changes TRANSACTION_TYPE_[] constant to use."""
clib.set_val(self._abi('SetTransactionType'), c_int, transaction_type,
self._obj) | [
"def",
"set_transaction_type",
"(",
"self",
",",
"transaction_type",
")",
":",
"clib",
".",
"set_val",
"(",
"self",
".",
"_abi",
"(",
"'SetTransactionType'",
")",
",",
"c_int",
",",
"transaction_type",
",",
"self",
".",
"_obj",
")"
] | https://github.com/jeog/TDAmeritradeAPI/blob/91c738afd7d57b54f6231170bd64c2550fafd34d/python/tdma_api/get.py#L1176-L1179 | ||
bh107/bohrium | 5b83e7117285fefc7779ed0e9acb0f8e74c7e068 | bridge/npbackend/bohrium/reorganization.py | python | nonzero | (a) | return tuple(ret) | Return the indices of the elements that are non-zero.
Returns a tuple of arrays, one for each dimension of `a`,
containing the indices of the non-zero elements in that
dimension. The values in `a` are always tested and returned in
row-major, C-style order. The corresponding non-zero
values can be ob... | Return the indices of the elements that are non-zero.
Returns a tuple of arrays, one for each dimension of `a`,
containing the indices of the non-zero elements in that
dimension. The values in `a` are always tested and returned in
row-major, C-style order. The corresponding non-zero
values can be ob... | [
"Return",
"the",
"indices",
"of",
"the",
"elements",
"that",
"are",
"non",
"-",
"zero",
".",
"Returns",
"a",
"tuple",
"of",
"arrays",
"one",
"for",
"each",
"dimension",
"of",
"a",
"containing",
"the",
"indices",
"of",
"the",
"non",
"-",
"zero",
"elements... | def nonzero(a):
"""
Return the indices of the elements that are non-zero.
Returns a tuple of arrays, one for each dimension of `a`,
containing the indices of the non-zero elements in that
dimension. The values in `a` are always tested and returned in
row-major, C-style order. The corresponding n... | [
"def",
"nonzero",
"(",
"a",
")",
":",
"if",
"a",
".",
"ndim",
"==",
"1",
":",
"return",
"(",
"flatnonzero",
"(",
"a",
")",
",",
")",
"if",
"not",
"a",
".",
"flags",
"[",
"'C_CONTIGUOUS'",
"]",
":",
"a",
"=",
"a",
".",
"copy",
"(",
"order",
"=... | https://github.com/bh107/bohrium/blob/5b83e7117285fefc7779ed0e9acb0f8e74c7e068/bridge/npbackend/bohrium/reorganization.py#L501-L576 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/debug/wrappers/framework.py | python | OnSessionInitResponse.__init__ | (self, action) | Constructor.
Args:
action: (`OnSessionInitAction`) Debugger action to take on session init. | Constructor. | [
"Constructor",
"."
] | def __init__(self, action):
"""Constructor.
Args:
action: (`OnSessionInitAction`) Debugger action to take on session init.
"""
_check_type(action, str)
self.action = action | [
"def",
"__init__",
"(",
"self",
",",
"action",
")",
":",
"_check_type",
"(",
"action",
",",
"str",
")",
"self",
".",
"action",
"=",
"action"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/debug/wrappers/framework.py#L167-L174 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/xml/dom/minidom.py | python | ElementInfo.isId | (self, aname) | return False | Returns true iff the named attribute is a DTD-style ID. | Returns true iff the named attribute is a DTD-style ID. | [
"Returns",
"true",
"iff",
"the",
"named",
"attribute",
"is",
"a",
"DTD",
"-",
"style",
"ID",
"."
] | def isId(self, aname):
"""Returns true iff the named attribute is a DTD-style ID."""
return False | [
"def",
"isId",
"(",
"self",
",",
"aname",
")",
":",
"return",
"False"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/xml/dom/minidom.py#L1522-L1524 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/multiprocessing/pool.py | python | Pool._guarded_task_generation | (self, result_job, func, iterable) | Provides a generator of tasks for imap and imap_unordered with
appropriate handling for iterables which throw exceptions during
iteration. | Provides a generator of tasks for imap and imap_unordered with
appropriate handling for iterables which throw exceptions during
iteration. | [
"Provides",
"a",
"generator",
"of",
"tasks",
"for",
"imap",
"and",
"imap_unordered",
"with",
"appropriate",
"handling",
"for",
"iterables",
"which",
"throw",
"exceptions",
"during",
"iteration",
"."
] | def _guarded_task_generation(self, result_job, func, iterable):
'''Provides a generator of tasks for imap and imap_unordered with
appropriate handling for iterables which throw exceptions during
iteration.'''
try:
i = -1
for i, x in enumerate(iterable):
... | [
"def",
"_guarded_task_generation",
"(",
"self",
",",
"result_job",
",",
"func",
",",
"iterable",
")",
":",
"try",
":",
"i",
"=",
"-",
"1",
"for",
"i",
",",
"x",
"in",
"enumerate",
"(",
"iterable",
")",
":",
"yield",
"(",
"result_job",
",",
"i",
",",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/multiprocessing/pool.py#L286-L295 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | SizerFlags.Centre | (*args, **kwargs) | return _core_.SizerFlags_Centre(*args, **kwargs) | Centre(self) -> SizerFlags
Same as `Center` for those with an alternate dialect of English. | Centre(self) -> SizerFlags | [
"Centre",
"(",
"self",
")",
"-",
">",
"SizerFlags"
] | def Centre(*args, **kwargs):
"""
Centre(self) -> SizerFlags
Same as `Center` for those with an alternate dialect of English.
"""
return _core_.SizerFlags_Centre(*args, **kwargs) | [
"def",
"Centre",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"SizerFlags_Centre",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L13794-L13800 | |
s9xie/DSN | 065e49898d239f5c96be558616b2556eabc50351 | scripts/cpp_lint.py | python | _SetVerboseLevel | (level) | return _cpplint_state.SetVerboseLevel(level) | Sets the module's verbosity, and returns the previous setting. | Sets the module's verbosity, and returns the previous setting. | [
"Sets",
"the",
"module",
"s",
"verbosity",
"and",
"returns",
"the",
"previous",
"setting",
"."
] | def _SetVerboseLevel(level):
"""Sets the module's verbosity, and returns the previous setting."""
return _cpplint_state.SetVerboseLevel(level) | [
"def",
"_SetVerboseLevel",
"(",
"level",
")",
":",
"return",
"_cpplint_state",
".",
"SetVerboseLevel",
"(",
"level",
")"
] | https://github.com/s9xie/DSN/blob/065e49898d239f5c96be558616b2556eabc50351/scripts/cpp_lint.py#L777-L779 | |
google/or-tools | 2cb85b4eead4c38e1c54b48044f92087cf165bce | ortools/sat/python/cp_model.py | python | CpSolver.ObjectiveValue | (self) | return self.__solution.objective_value | Returns the value of the objective after solve. | Returns the value of the objective after solve. | [
"Returns",
"the",
"value",
"of",
"the",
"objective",
"after",
"solve",
"."
] | def ObjectiveValue(self):
"""Returns the value of the objective after solve."""
return self.__solution.objective_value | [
"def",
"ObjectiveValue",
"(",
"self",
")",
":",
"return",
"self",
".",
"__solution",
".",
"objective_value"
] | https://github.com/google/or-tools/blob/2cb85b4eead4c38e1c54b48044f92087cf165bce/ortools/sat/python/cp_model.py#L2167-L2169 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextCtrl.AutoCompGetMaxWidth | (*args, **kwargs) | return _stc.StyledTextCtrl_AutoCompGetMaxWidth(*args, **kwargs) | AutoCompGetMaxWidth(self) -> int
Get the maximum width, in characters, of auto-completion and user lists. | AutoCompGetMaxWidth(self) -> int | [
"AutoCompGetMaxWidth",
"(",
"self",
")",
"-",
">",
"int"
] | def AutoCompGetMaxWidth(*args, **kwargs):
"""
AutoCompGetMaxWidth(self) -> int
Get the maximum width, in characters, of auto-completion and user lists.
"""
return _stc.StyledTextCtrl_AutoCompGetMaxWidth(*args, **kwargs) | [
"def",
"AutoCompGetMaxWidth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_AutoCompGetMaxWidth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L3245-L3251 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.