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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mingchen/protobuf-ios | 0958df34558cd54cb7b6e6ca5c8855bf3d475046 | compiler/python/google/protobuf/internal/containers.py | python | RepeatedScalarFieldContainer.__delslice__ | (self, start, stop) | Deletes the subset of items from between the specified indices. | Deletes the subset of items from between the specified indices. | [
"Deletes",
"the",
"subset",
"of",
"items",
"from",
"between",
"the",
"specified",
"indices",
"."
] | def __delslice__(self, start, stop):
"""Deletes the subset of items from between the specified indices."""
del self._values[start:stop]
self._message_listener.ByteSizeDirty() | [
"def",
"__delslice__",
"(",
"self",
",",
"start",
",",
"stop",
")",
":",
"del",
"self",
".",
"_values",
"[",
"start",
":",
"stop",
"]",
"self",
".",
"_message_listener",
".",
"ByteSizeDirty",
"(",
")"
] | https://github.com/mingchen/protobuf-ios/blob/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/python/google/protobuf/internal/containers.py#L156-L159 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/map_fn.py | python | _most_general_compatible_type | (spec) | Returns the most general TypeSpec compatible with `spec`. | Returns the most general TypeSpec compatible with `spec`. | [
"Returns",
"the",
"most",
"general",
"TypeSpec",
"compatible",
"with",
"spec",
"."
] | def _most_general_compatible_type(spec):
"""Returns the most general TypeSpec compatible with `spec`."""
# TODO(edloper): Consider adding most_general_compatible_type to TypeSpec API
if isinstance(spec, tensor_spec.TensorSpec):
return tensor_spec.TensorSpec(None, spec.dtype)
elif isinstance(spec, ragged_ten... | [
"def",
"_most_general_compatible_type",
"(",
"spec",
")",
":",
"# TODO(edloper): Consider adding most_general_compatible_type to TypeSpec API",
"if",
"isinstance",
"(",
"spec",
",",
"tensor_spec",
".",
"TensorSpec",
")",
":",
"return",
"tensor_spec",
".",
"TensorSpec",
"(",... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/map_fn.py#L527-L540 | ||
chanyn/3Dpose_ssl | 585696676279683a279b1ecca136c0e0d02aef2a | caffe-3dssl/python/caffe/net_spec.py | python | to_proto | (*tops) | return net | Generate a NetParameter that contains all layers needed to compute
all arguments. | Generate a NetParameter that contains all layers needed to compute
all arguments. | [
"Generate",
"a",
"NetParameter",
"that",
"contains",
"all",
"layers",
"needed",
"to",
"compute",
"all",
"arguments",
"."
] | def to_proto(*tops):
"""Generate a NetParameter that contains all layers needed to compute
all arguments."""
layers = OrderedDict()
autonames = Counter()
for top in tops:
top.fn._to_proto(layers, {}, autonames)
net = caffe_pb2.NetParameter()
net.layer.extend(layers.values())
ret... | [
"def",
"to_proto",
"(",
"*",
"tops",
")",
":",
"layers",
"=",
"OrderedDict",
"(",
")",
"autonames",
"=",
"Counter",
"(",
")",
"for",
"top",
"in",
"tops",
":",
"top",
".",
"fn",
".",
"_to_proto",
"(",
"layers",
",",
"{",
"}",
",",
"autonames",
")",
... | https://github.com/chanyn/3Dpose_ssl/blob/585696676279683a279b1ecca136c0e0d02aef2a/caffe-3dssl/python/caffe/net_spec.py#L43-L53 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/examples/speech_commands/label_wav.py | python | main | (_) | Entry point for script, converts flags to arguments. | Entry point for script, converts flags to arguments. | [
"Entry",
"point",
"for",
"script",
"converts",
"flags",
"to",
"arguments",
"."
] | def main(_):
"""Entry point for script, converts flags to arguments."""
label_wav(FLAGS.wav, FLAGS.labels, FLAGS.graph, FLAGS.input_name,
FLAGS.output_name, FLAGS.how_many_labels) | [
"def",
"main",
"(",
"_",
")",
":",
"label_wav",
"(",
"FLAGS",
".",
"wav",
",",
"FLAGS",
".",
"labels",
",",
"FLAGS",
".",
"graph",
",",
"FLAGS",
".",
"input_name",
",",
"FLAGS",
".",
"output_name",
",",
"FLAGS",
".",
"how_many_labels",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/examples/speech_commands/label_wav.py#L94-L97 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | Dialog.CreateSeparatedButtonSizer | (*args, **kwargs) | return _windows_.Dialog_CreateSeparatedButtonSizer(*args, **kwargs) | CreateSeparatedButtonSizer(self, long flags) -> Sizer | CreateSeparatedButtonSizer(self, long flags) -> Sizer | [
"CreateSeparatedButtonSizer",
"(",
"self",
"long",
"flags",
")",
"-",
">",
"Sizer"
] | def CreateSeparatedButtonSizer(*args, **kwargs):
"""CreateSeparatedButtonSizer(self, long flags) -> Sizer"""
return _windows_.Dialog_CreateSeparatedButtonSizer(*args, **kwargs) | [
"def",
"CreateSeparatedButtonSizer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"Dialog_CreateSeparatedButtonSizer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L791-L793 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/leveleditor/ObjectMgrBase.py | python | ObjectMgrBase.updateObjectAnim | (self, anim, obj, fSelectObject=True) | replace object's anim | replace object's anim | [
"replace",
"object",
"s",
"anim"
] | def updateObjectAnim(self, anim, obj, fSelectObject=True):
""" replace object's anim """
if obj[OG.OBJ_ANIM] != anim:
base.direct.deselectAllCB()
objNP = obj[OG.OBJ_NP]
# load new anim
animName = os.path.basename(anim)
newAnim = objNP.loadAnim... | [
"def",
"updateObjectAnim",
"(",
"self",
",",
"anim",
",",
"obj",
",",
"fSelectObject",
"=",
"True",
")",
":",
"if",
"obj",
"[",
"OG",
".",
"OBJ_ANIM",
"]",
"!=",
"anim",
":",
"base",
".",
"direct",
".",
"deselectAllCB",
"(",
")",
"objNP",
"=",
"obj",... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/leveleditor/ObjectMgrBase.py#L559-L573 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/labelbook.py | python | ImageContainerBase.OnMouseMove | (self, event) | Handles the ``wx.EVT_MOTION`` event for :class:`ImageContainerBase`.
:param `event`: a :class:`MouseEvent` event to be processed. | Handles the ``wx.EVT_MOTION`` event for :class:`ImageContainerBase`. | [
"Handles",
"the",
"wx",
".",
"EVT_MOTION",
"event",
"for",
":",
"class",
":",
"ImageContainerBase",
"."
] | def OnMouseMove(self, event):
"""
Handles the ``wx.EVT_MOTION`` event for :class:`ImageContainerBase`.
:param `event`: a :class:`MouseEvent` event to be processed.
"""
style = self.GetParent().GetAGWWindowStyleFlag()
if style & INB_USE_PIN_BUTTON:
#... | [
"def",
"OnMouseMove",
"(",
"self",
",",
"event",
")",
":",
"style",
"=",
"self",
".",
"GetParent",
"(",
")",
".",
"GetAGWWindowStyleFlag",
"(",
")",
"if",
"style",
"&",
"INB_USE_PIN_BUTTON",
":",
"# Check to see if we are in the pin button rect",
"if",
"not",
"s... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/labelbook.py#L974-L1011 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/seq2seq/python/ops/helper.py | python | ScheduledOutputTrainingHelper.__init__ | (self, inputs, sequence_length, sampling_probability,
time_major=False, seed=None, next_inputs_fn=None,
auxiliary_inputs=None, name=None) | Initializer.
Args:
inputs: A (structure) of input tensors.
sequence_length: An int32 vector tensor.
sampling_probability: A 0D `float32` tensor: the probability of sampling
from the outputs instead of reading directly from the inputs.
time_major: Python bool. Whether the tensors in... | Initializer. | [
"Initializer",
"."
] | def __init__(self, inputs, sequence_length, sampling_probability,
time_major=False, seed=None, next_inputs_fn=None,
auxiliary_inputs=None, name=None):
"""Initializer.
Args:
inputs: A (structure) of input tensors.
sequence_length: An int32 vector tensor.
sampling_... | [
"def",
"__init__",
"(",
"self",
",",
"inputs",
",",
"sequence_length",
",",
"sampling_probability",
",",
"time_major",
"=",
"False",
",",
"seed",
"=",
"None",
",",
"next_inputs_fn",
"=",
"None",
",",
"auxiliary_inputs",
"=",
"None",
",",
"name",
"=",
"None",... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/seq2seq/python/ops/helper.py#L352-L411 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/pydoc.py | python | HTMLDoc.heading | (self, title, fgcol, bgcol, extras='') | return '''
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="%s">
<td valign=bottom> <br>
<font color="%s" face="helvetica, arial"> <br>%s</font></td
><td align=right valign=bottom
><font color="%s" face="helvetica, arial">%s</font></td></tr></table>
''' % (bgcol, f... | Format a page heading. | Format a page heading. | [
"Format",
"a",
"page",
"heading",
"."
] | def heading(self, title, fgcol, bgcol, extras=''):
"""Format a page heading."""
return '''
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="%s">
<td valign=bottom> <br>
<font color="%s" face="helvetica, arial"> <br>%s</font></td
><td align=right valign=... | [
"def",
"heading",
"(",
"self",
",",
"title",
",",
"fgcol",
",",
"bgcol",
",",
"extras",
"=",
"''",
")",
":",
"return",
"'''\n<table width=\"100%%\" cellspacing=0 cellpadding=2 border=0 summary=\"heading\">\n<tr bgcolor=\"%s\">\n<td valign=bottom> <br>\n<font color=\"%s\" face=... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/pydoc.py#L434-L443 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/rnn/python/ops/lstm_ops.py | python | LSTMBlockFusedCell.num_units | (self) | return self._num_units | Number of units in this cell (output dimension). | Number of units in this cell (output dimension). | [
"Number",
"of",
"units",
"in",
"this",
"cell",
"(",
"output",
"dimension",
")",
"."
] | def num_units(self):
"""Number of units in this cell (output dimension)."""
return self._num_units | [
"def",
"num_units",
"(",
"self",
")",
":",
"return",
"self",
".",
"_num_units"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/rnn/python/ops/lstm_ops.py#L590-L592 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/matrix_frac.py | python | MatrixFrac._domain | (self) | return [self.args[1] >> 0] | Returns constraints describing the domain of the node. | Returns constraints describing the domain of the node. | [
"Returns",
"constraints",
"describing",
"the",
"domain",
"of",
"the",
"node",
"."
] | def _domain(self) -> List[Constraint]:
"""Returns constraints describing the domain of the node.
"""
return [self.args[1] >> 0] | [
"def",
"_domain",
"(",
"self",
")",
"->",
"List",
"[",
"Constraint",
"]",
":",
"return",
"[",
"self",
".",
"args",
"[",
"1",
"]",
">>",
"0",
"]"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/matrix_frac.py#L48-L51 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/turtle.py | python | ScrolledCanvas.cget | (self, *args, **kwargs) | return self._canvas.cget(*args, **kwargs) | 'forward' method, which canvas itself has inherited... | 'forward' method, which canvas itself has inherited... | [
"forward",
"method",
"which",
"canvas",
"itself",
"has",
"inherited",
"..."
] | def cget(self, *args, **kwargs):
""" 'forward' method, which canvas itself has inherited...
"""
return self._canvas.cget(*args, **kwargs) | [
"def",
"cget",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_canvas",
".",
"cget",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/turtle.py#L427-L430 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | PhysicsTools/HeppyCore/python/framework/services/service.py | python | Service.__init__ | (self, cfg, comp, outdir) | cfg: framework.config.Service object containing whatever parameters
you need
comp: dummy parameter
outdir: output directory for your service (feel free not to use it)
Please have a look at TFileService for more information | cfg: framework.config.Service object containing whatever parameters
you need
comp: dummy parameter
outdir: output directory for your service (feel free not to use it) | [
"cfg",
":",
"framework",
".",
"config",
".",
"Service",
"object",
"containing",
"whatever",
"parameters",
"you",
"need",
"comp",
":",
"dummy",
"parameter",
"outdir",
":",
"output",
"directory",
"for",
"your",
"service",
"(",
"feel",
"free",
"not",
"to",
"use... | def __init__(self, cfg, comp, outdir):
'''
cfg: framework.config.Service object containing whatever parameters
you need
comp: dummy parameter
outdir: output directory for your service (feel free not to use it)
Please have a look at TFileService for more information
... | [
"def",
"__init__",
"(",
"self",
",",
"cfg",
",",
"comp",
",",
"outdir",
")",
":"
] | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/PhysicsTools/HeppyCore/python/framework/services/service.py#L7-L15 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/special/_generate_pyx.py | python | FusedFunc._get_python_wrap | (self) | return body | Generate a python wrapper for functions which pass their
arguments as pointers. | Generate a python wrapper for functions which pass their
arguments as pointers. | [
"Generate",
"a",
"python",
"wrapper",
"for",
"functions",
"which",
"pass",
"their",
"arguments",
"as",
"pointers",
"."
] | def _get_python_wrap(self):
"""Generate a python wrapper for functions which pass their
arguments as pointers.
"""
tab = " "*4
body, callvars = [], []
for (intype, _), invar in zip(self.intypes, self.invars):
callvars.append("{} {}".format(intype, invar))
... | [
"def",
"_get_python_wrap",
"(",
"self",
")",
":",
"tab",
"=",
"\" \"",
"*",
"4",
"body",
",",
"callvars",
"=",
"[",
"]",
",",
"[",
"]",
"for",
"(",
"intype",
",",
"_",
")",
",",
"invar",
"in",
"zip",
"(",
"self",
".",
"intypes",
",",
"self",
".... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/special/_generate_pyx.py#L887-L908 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | TextAttr.Merge | (*args, **kwargs) | return _controls_.TextAttr_Merge(*args, **kwargs) | Merge(self, TextAttr overlay) | Merge(self, TextAttr overlay) | [
"Merge",
"(",
"self",
"TextAttr",
"overlay",
")"
] | def Merge(*args, **kwargs):
"""Merge(self, TextAttr overlay)"""
return _controls_.TextAttr_Merge(*args, **kwargs) | [
"def",
"Merge",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TextAttr_Merge",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L1916-L1918 | |
tpfister/caffe-heatmap | 4db69ef53e6b8a0b3b4ebb29328b0ab3dbf67c4e | scripts/cpp_lint.py | python | _ShouldPrintError | (category, confidence, linenum) | return True | If confidence >= verbose, category passes filter and is not suppressed. | If confidence >= verbose, category passes filter and is not suppressed. | [
"If",
"confidence",
">",
"=",
"verbose",
"category",
"passes",
"filter",
"and",
"is",
"not",
"suppressed",
"."
] | def _ShouldPrintError(category, confidence, linenum):
"""If confidence >= verbose, category passes filter and is not suppressed."""
# There are three ways we might decide not to print an error message:
# a "NOLINT(category)" comment appears in the source,
# the verbosity level isn't high enough, or the filters... | [
"def",
"_ShouldPrintError",
"(",
"category",
",",
"confidence",
",",
"linenum",
")",
":",
"# There are three ways we might decide not to print an error message:",
"# a \"NOLINT(category)\" comment appears in the source,",
"# the verbosity level isn't high enough, or the filters filter it out... | https://github.com/tpfister/caffe-heatmap/blob/4db69ef53e6b8a0b3b4ebb29328b0ab3dbf67c4e/scripts/cpp_lint.py#L961-L985 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/dataset/audio/validators.py | python | check_magphase | (method) | return new_method | Wrapper method to check the parameters of Magphase. | Wrapper method to check the parameters of Magphase. | [
"Wrapper",
"method",
"to",
"check",
"the",
"parameters",
"of",
"Magphase",
"."
] | def check_magphase(method):
"""Wrapper method to check the parameters of Magphase."""
@wraps(method)
def new_method(self, *args, **kwargs):
[power], _ = parse_user_args(method, *args, **kwargs)
check_power(power)
return method(self, *args, **kwargs)
return new_method | [
"def",
"check_magphase",
"(",
"method",
")",
":",
"@",
"wraps",
"(",
"method",
")",
"def",
"new_method",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"[",
"power",
"]",
",",
"_",
"=",
"parse_user_args",
"(",
"method",
",",
"*",... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/audio/validators.py#L497-L506 | |
francinexue/xuefu | b6ff79747a42e020588c0c0a921048e08fe4680c | ctpx/ctp3/ctptd.py | python | CtpTd.onRtnFromBankToFutureByFuture | (self, RspTransferField) | 期货发起银行资金转期货通知 | 期货发起银行资金转期货通知 | [
"期货发起银行资金转期货通知"
] | def onRtnFromBankToFutureByFuture(self, RspTransferField):
"""期货发起银行资金转期货通知"""
pass | [
"def",
"onRtnFromBankToFutureByFuture",
"(",
"self",
",",
"RspTransferField",
")",
":",
"pass"
] | https://github.com/francinexue/xuefu/blob/b6ff79747a42e020588c0c0a921048e08fe4680c/ctpx/ctp3/ctptd.py#L475-L477 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/more-itertools/py2/more_itertools/more.py | python | split_before | (iterable, pred) | Yield lists of items from *iterable*, where each list starts with an
item where callable *pred* returns ``True``:
>>> list(split_before('OneTwo', lambda s: s.isupper()))
[['O', 'n', 'e'], ['T', 'w', 'o']]
>>> list(split_before(range(10), lambda n: n % 3 == 0))
[[0, 1, 2], [3, 4, 5]... | Yield lists of items from *iterable*, where each list starts with an
item where callable *pred* returns ``True``: | [
"Yield",
"lists",
"of",
"items",
"from",
"*",
"iterable",
"*",
"where",
"each",
"list",
"starts",
"with",
"an",
"item",
"where",
"callable",
"*",
"pred",
"*",
"returns",
"True",
":"
] | def split_before(iterable, pred):
"""Yield lists of items from *iterable*, where each list starts with an
item where callable *pred* returns ``True``:
>>> list(split_before('OneTwo', lambda s: s.isupper()))
[['O', 'n', 'e'], ['T', 'w', 'o']]
>>> list(split_before(range(10), lambda n: n... | [
"def",
"split_before",
"(",
"iterable",
",",
"pred",
")",
":",
"buf",
"=",
"[",
"]",
"for",
"item",
"in",
"iterable",
":",
"if",
"pred",
"(",
"item",
")",
"and",
"buf",
":",
"yield",
"buf",
"buf",
"=",
"[",
"]",
"buf",
".",
"append",
"(",
"item",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/more-itertools/py2/more_itertools/more.py#L1033-L1050 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | build/android/gyp/generate_split_manifest.py | python | Build | (main_manifest, split, has_code) | return MANIFEST_TEMPLATE % {
'package': package,
'split': split.replace('-', '_'),
'has_code': str(has_code).lower()
} | Builds a split manifest based on the manifest of the main APK.
Args:
main_manifest: the XML manifest of the main APK as a string
split: the name of the split as a string
has_code: whether this split APK will contain .dex files
Returns:
The XML split manifest as a string | Builds a split manifest based on the manifest of the main APK. | [
"Builds",
"a",
"split",
"manifest",
"based",
"on",
"the",
"manifest",
"of",
"the",
"main",
"APK",
"."
] | def Build(main_manifest, split, has_code):
"""Builds a split manifest based on the manifest of the main APK.
Args:
main_manifest: the XML manifest of the main APK as a string
split: the name of the split as a string
has_code: whether this split APK will contain .dex files
Returns:
The XML split ... | [
"def",
"Build",
"(",
"main_manifest",
",",
"split",
",",
"has_code",
")",
":",
"doc",
"=",
"xml",
".",
"etree",
".",
"ElementTree",
".",
"fromstring",
"(",
"main_manifest",
")",
"package",
"=",
"doc",
".",
"get",
"(",
"'package'",
")",
"return",
"MANIFES... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/build/android/gyp/generate_split_manifest.py#L57-L76 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/debug/lib/debug_graphs.py | python | parse_debug_node_name | (node_name) | return watched_node_name, watched_output_slot, debug_op_index, debug_op | Parse the name of a debug node.
Args:
node_name: Name of the debug node.
Returns:
1. Name of the watched node, as a str.
2. Output slot index of the watched tensor, as an int.
3. Index of the debug node, as an int.
4. Name of the debug op, as a str, e.g, "DebugIdentity".
Raises:
ValueEr... | Parse the name of a debug node. | [
"Parse",
"the",
"name",
"of",
"a",
"debug",
"node",
"."
] | def parse_debug_node_name(node_name):
"""Parse the name of a debug node.
Args:
node_name: Name of the debug node.
Returns:
1. Name of the watched node, as a str.
2. Output slot index of the watched tensor, as an int.
3. Index of the debug node, as an int.
4. Name of the debug op, as a str, e... | [
"def",
"parse_debug_node_name",
"(",
"node_name",
")",
":",
"prefix",
"=",
"\"__dbg_\"",
"name",
"=",
"node_name",
"if",
"not",
"name",
".",
"startswith",
"(",
"prefix",
")",
":",
"raise",
"ValueError",
"(",
"\"Invalid prefix in debug node name: '%s'\"",
"%",
"nod... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/debug/lib/debug_graphs.py#L103-L141 | |
llvm-dcpu16/llvm-dcpu16 | ae6b01fecd03219677e391d4421df5d966d80dcf | utils/llvm-build/llvmbuild/main.py | python | cmake_quote_string | (value) | return value | cmake_quote_string(value) -> str
Return a quoted form of the given value that is suitable for use in CMake
language files. | cmake_quote_string(value) -> str | [
"cmake_quote_string",
"(",
"value",
")",
"-",
">",
"str"
] | def cmake_quote_string(value):
"""
cmake_quote_string(value) -> str
Return a quoted form of the given value that is suitable for use in CMake
language files.
"""
# Currently, we only handle escaping backslashes.
value = value.replace("\\", "\\\\")
return value | [
"def",
"cmake_quote_string",
"(",
"value",
")",
":",
"# Currently, we only handle escaping backslashes.",
"value",
"=",
"value",
".",
"replace",
"(",
"\"\\\\\"",
",",
"\"\\\\\\\\\"",
")",
"return",
"value"
] | https://github.com/llvm-dcpu16/llvm-dcpu16/blob/ae6b01fecd03219677e391d4421df5d966d80dcf/utils/llvm-build/llvmbuild/main.py#L12-L23 | |
psnonis/FinBERT | c0c555d833a14e2316a3701e59c0b5156f804b4e | bert-gpu/optimization.py | python | AdamWeightDecayOptimizer._get_variable_name | (self, param_name) | return param_name | Get the variable name from the tensor name. | Get the variable name from the tensor name. | [
"Get",
"the",
"variable",
"name",
"from",
"the",
"tensor",
"name",
"."
] | def _get_variable_name(self, param_name):
"""Get the variable name from the tensor name."""
m = re.match("^(.*):\\d+$", param_name)
if m is not None:
param_name = m.group(1)
return param_name | [
"def",
"_get_variable_name",
"(",
"self",
",",
"param_name",
")",
":",
"m",
"=",
"re",
".",
"match",
"(",
"\"^(.*):\\\\d+$\"",
",",
"param_name",
")",
"if",
"m",
"is",
"not",
"None",
":",
"param_name",
"=",
"m",
".",
"group",
"(",
"1",
")",
"return",
... | https://github.com/psnonis/FinBERT/blob/c0c555d833a14e2316a3701e59c0b5156f804b4e/bert-gpu/optimization.py#L203-L208 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/recfunctions.py | python | repack_fields | (a, align=False, recurse=False) | return np.dtype((a.type, dt)) | Re-pack the fields of a structured array or dtype in memory.
The memory layout of structured datatypes allows fields at arbitrary
byte offsets. This means the fields can be separated by padding bytes,
their offsets can be non-monotonically increasing, and they can overlap.
This method removes any over... | Re-pack the fields of a structured array or dtype in memory. | [
"Re",
"-",
"pack",
"the",
"fields",
"of",
"a",
"structured",
"array",
"or",
"dtype",
"in",
"memory",
"."
] | def repack_fields(a, align=False, recurse=False):
"""
Re-pack the fields of a structured array or dtype in memory.
The memory layout of structured datatypes allows fields at arbitrary
byte offsets. This means the fields can be separated by padding bytes,
their offsets can be non-monotonically incre... | [
"def",
"repack_fields",
"(",
"a",
",",
"align",
"=",
"False",
",",
"recurse",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"a",
",",
"np",
".",
"dtype",
")",
":",
"dt",
"=",
"repack_fields",
"(",
"a",
".",
"dtype",
",",
"align",
"=",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/recfunctions.py#L793-L871 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/core/fromnumeric.py | python | rank | (a) | Return the number of dimensions of an array.
If `a` is not already an array, a conversion is attempted.
Scalars are zero dimensional.
Parameters
----------
a : array_like
Array whose number of dimensions is desired. If `a` is not an array,
a conversion is attempted.
Returns
... | Return the number of dimensions of an array. | [
"Return",
"the",
"number",
"of",
"dimensions",
"of",
"an",
"array",
"."
] | def rank(a):
"""
Return the number of dimensions of an array.
If `a` is not already an array, a conversion is attempted.
Scalars are zero dimensional.
Parameters
----------
a : array_like
Array whose number of dimensions is desired. If `a` is not an array,
a conversion is a... | [
"def",
"rank",
"(",
"a",
")",
":",
"try",
":",
"return",
"a",
".",
"ndim",
"except",
"AttributeError",
":",
"return",
"asarray",
"(",
"a",
")",
".",
"ndim"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/core/fromnumeric.py#L2449-L2492 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py | python | Menu.invoke | (self, index) | return self.tk.call(self._w, 'invoke', index) | Invoke a menu item identified by INDEX and execute
the associated command. | Invoke a menu item identified by INDEX and execute
the associated command. | [
"Invoke",
"a",
"menu",
"item",
"identified",
"by",
"INDEX",
"and",
"execute",
"the",
"associated",
"command",
"."
] | def invoke(self, index):
"""Invoke a menu item identified by INDEX and execute
the associated command."""
return self.tk.call(self._w, 'invoke', index) | [
"def",
"invoke",
"(",
"self",
",",
"index",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'invoke'",
",",
"index",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py#L2940-L2943 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py2/google/protobuf/internal/containers.py | python | RepeatedCompositeFieldContainer.append | (self, value) | Appends one element by copying the message. | Appends one element by copying the message. | [
"Appends",
"one",
"element",
"by",
"copying",
"the",
"message",
"."
] | def append(self, value):
"""Appends one element by copying the message."""
new_element = self._message_descriptor._concrete_class()
new_element._SetListener(self._message_listener)
new_element.CopyFrom(value)
self._values.append(new_element)
if not self._message_listener.dirty:
self._messa... | [
"def",
"append",
"(",
"self",
",",
"value",
")",
":",
"new_element",
"=",
"self",
".",
"_message_descriptor",
".",
"_concrete_class",
"(",
")",
"new_element",
".",
"_SetListener",
"(",
"self",
".",
"_message_listener",
")",
"new_element",
".",
"CopyFrom",
"(",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py2/google/protobuf/internal/containers.py#L387-L394 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/compiler.py | python | IpuStrategy.enable_fp16 | (self) | return self._ipu_strategy.enable_fp16 | Get the boolean of float16 mode or not from IpuStrategy instance. | Get the boolean of float16 mode or not from IpuStrategy instance. | [
"Get",
"the",
"boolean",
"of",
"float16",
"mode",
"or",
"not",
"from",
"IpuStrategy",
"instance",
"."
] | def enable_fp16(self):
"""
Get the boolean of float16 mode or not from IpuStrategy instance.
"""
return self._ipu_strategy.enable_fp16 | [
"def",
"enable_fp16",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ipu_strategy",
".",
"enable_fp16"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/compiler.py#L712-L716 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/tpu.py | python | replicate | (computation,
inputs=None,
infeed_queue=None,
device_assignment=None,
name=None,
maximum_shapes=None) | return split_compile_and_replicate(
computation,
inputs,
infeed_queue,
device_assignment,
name,
maximum_shapes=maximum_shapes)[1] | Builds a graph operator that runs a replicated TPU computation.
Args:
computation: A Python function that builds the computation to replicate.
inputs: A list of lists of input tensors or `None` (equivalent to
`[[]]`), indexed by `[replica_num][input_num]`. All replicas must
have the same number o... | Builds a graph operator that runs a replicated TPU computation. | [
"Builds",
"a",
"graph",
"operator",
"that",
"runs",
"a",
"replicated",
"TPU",
"computation",
"."
] | def replicate(computation,
inputs=None,
infeed_queue=None,
device_assignment=None,
name=None,
maximum_shapes=None):
"""Builds a graph operator that runs a replicated TPU computation.
Args:
computation: A Python function that builds the compu... | [
"def",
"replicate",
"(",
"computation",
",",
"inputs",
"=",
"None",
",",
"infeed_queue",
"=",
"None",
",",
"device_assignment",
"=",
"None",
",",
"name",
"=",
"None",
",",
"maximum_shapes",
"=",
"None",
")",
":",
"return",
"split_compile_and_replicate",
"(",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/tpu.py#L579-L639 | |
apiaryio/snowcrash | b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3 | tools/gyp/pylib/gyp/msvs_emulation.py | python | VerifyMissingSources | (sources, build_dir, generator_flags, gyp_to_ninja) | Emulate behavior of msvs_error_on_missing_sources present in the msvs
generator: Check that all regular source files, i.e. not created at run time,
exist on disk. Missing files cause needless recompilation when building via
VS, and we want this check to match for people/bots that build using ninja,
so they're n... | Emulate behavior of msvs_error_on_missing_sources present in the msvs
generator: Check that all regular source files, i.e. not created at run time,
exist on disk. Missing files cause needless recompilation when building via
VS, and we want this check to match for people/bots that build using ninja,
so they're n... | [
"Emulate",
"behavior",
"of",
"msvs_error_on_missing_sources",
"present",
"in",
"the",
"msvs",
"generator",
":",
"Check",
"that",
"all",
"regular",
"source",
"files",
"i",
".",
"e",
".",
"not",
"created",
"at",
"run",
"time",
"exist",
"on",
"disk",
".",
"Miss... | def VerifyMissingSources(sources, build_dir, generator_flags, gyp_to_ninja):
"""Emulate behavior of msvs_error_on_missing_sources present in the msvs
generator: Check that all regular source files, i.e. not created at run time,
exist on disk. Missing files cause needless recompilation when building via
VS, and ... | [
"def",
"VerifyMissingSources",
"(",
"sources",
",",
"build_dir",
",",
"generator_flags",
",",
"gyp_to_ninja",
")",
":",
"if",
"int",
"(",
"generator_flags",
".",
"get",
"(",
"'msvs_error_on_missing_sources'",
",",
"0",
")",
")",
":",
"no_specials",
"=",
"filter"... | https://github.com/apiaryio/snowcrash/blob/b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3/tools/gyp/pylib/gyp/msvs_emulation.py#L1060-L1074 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.WriteLink | (self, spec, config_name, config, link_deps) | 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 WriteLink(self, spec, config_name, config, link_deps):
"""Write out a link step. Fills out target.binary. """
if self.flavor != 'mac' or len(self.archs) == 1:
return self.WriteLinkForArch(
self.ninja, spec, config_name, config, link_deps)
else:
output = self.ComputeOutput(spec)
... | [
"def",
"WriteLink",
"(",
"self",
",",
"spec",
",",
"config_name",
",",
"config",
",",
"link_deps",
")",
":",
"if",
"self",
".",
"flavor",
"!=",
"'mac'",
"or",
"len",
"(",
"self",
".",
"archs",
")",
"==",
"1",
":",
"return",
"self",
".",
"WriteLinkFor... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/generator/ninja.py#L1057-L1082 | ||
microsoft/clang | 86d4513d3e0daa4d5a29b0b1de7c854ca15f9fe5 | utils/check_cfc/check_cfc.py | python | main_is_frozen | () | return (hasattr(sys, "frozen") or # new py2exe
hasattr(sys, "importers") or # old py2exe
imp.is_frozen("__main__")) | Returns True when running as a py2exe executable. | Returns True when running as a py2exe executable. | [
"Returns",
"True",
"when",
"running",
"as",
"a",
"py2exe",
"executable",
"."
] | def main_is_frozen():
"""Returns True when running as a py2exe executable."""
return (hasattr(sys, "frozen") or # new py2exe
hasattr(sys, "importers") or # old py2exe
imp.is_frozen("__main__")) | [
"def",
"main_is_frozen",
"(",
")",
":",
"return",
"(",
"hasattr",
"(",
"sys",
",",
"\"frozen\"",
")",
"or",
"# new py2exe",
"hasattr",
"(",
"sys",
",",
"\"importers\"",
")",
"or",
"# old py2exe",
"imp",
".",
"is_frozen",
"(",
"\"__main__\"",
")",
")"
] | https://github.com/microsoft/clang/blob/86d4513d3e0daa4d5a29b0b1de7c854ca15f9fe5/utils/check_cfc/check_cfc.py#L81-L85 | |
apache/trafodion | 8455c839ad6b6d7b6e04edda5715053095b78046 | core/sqf/src/seatrans/hbase-trx/src/main/python/thrift1/gen-py/hbase/Hbase.py | python | Client.deleteTable | (self, tableName) | Deletes a table
@throws IOError if table doesn't exist on server or there was some other
problem
Parameters:
- tableName: name of table to delete | Deletes a table | [
"Deletes",
"a",
"table"
] | def deleteTable(self, tableName):
"""
Deletes a table
@throws IOError if table doesn't exist on server or there was some other
problem
Parameters:
- tableName: name of table to delete
"""
self.send_deleteTable(tableName)
self.recv_deleteTable() | [
"def",
"deleteTable",
"(",
"self",
",",
"tableName",
")",
":",
"self",
".",
"send_deleteTable",
"(",
"tableName",
")",
"self",
".",
"recv_deleteTable",
"(",
")"
] | https://github.com/apache/trafodion/blob/8455c839ad6b6d7b6e04edda5715053095b78046/core/sqf/src/seatrans/hbase-trx/src/main/python/thrift1/gen-py/hbase/Hbase.py#L930-L941 | ||
tensor-compiler/taco | d0654a84137169883973c40a951dfdb89883fd9c | python_bindings/pytaco/pytensor/taco_tensor.py | python | tensor_sub | (t1, t2, out_format, dtype=None) | return _compute_bin_elt_wise_op(operator.sub, t1, t2, out_format, dtype) | Computes the element wise subtraction of two tensors.
* If the two tensors are equal order, performs the operation element-wise
* If the two tensors have order N and M and N > M, requires the last M dimensions of the tensor with
order N be equal to the dimensions of the tensor with order M i... | Computes the element wise subtraction of two tensors. | [
"Computes",
"the",
"element",
"wise",
"subtraction",
"of",
"two",
"tensors",
"."
] | def tensor_sub(t1, t2, out_format, dtype=None):
"""
Computes the element wise subtraction of two tensors.
* If the two tensors are equal order, performs the operation element-wise
* If the two tensors have order N and M and N > M, requires the last M dimensions of the tensor with
... | [
"def",
"tensor_sub",
"(",
"t1",
",",
"t2",
",",
"out_format",
",",
"dtype",
"=",
"None",
")",
":",
"return",
"_compute_bin_elt_wise_op",
"(",
"operator",
".",
"sub",
",",
"t1",
",",
"t2",
",",
"out_format",
",",
"dtype",
")"
] | https://github.com/tensor-compiler/taco/blob/d0654a84137169883973c40a951dfdb89883fd9c/python_bindings/pytaco/pytensor/taco_tensor.py#L948-L984 | |
mhammond/pywin32 | 44afd86ba8485194df93234639243252deeb40d5 | adodbapi/remote.py | python | Connection._i_am_closing | (self, crsr) | message from a cursor giving connection a chance to clean up | message from a cursor giving connection a chance to clean up | [
"message",
"from",
"a",
"cursor",
"giving",
"connection",
"a",
"chance",
"to",
"clean",
"up"
] | def _i_am_closing(self, crsr):
"message from a cursor giving connection a chance to clean up"
try:
del self.cursors[crsr.id]
except:
pass | [
"def",
"_i_am_closing",
"(",
"self",
",",
"crsr",
")",
":",
"try",
":",
"del",
"self",
".",
"cursors",
"[",
"crsr",
".",
"id",
"]",
"except",
":",
"pass"
] | https://github.com/mhammond/pywin32/blob/44afd86ba8485194df93234639243252deeb40d5/adodbapi/remote.py#L343-L348 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/s3/bucket.py | python | Bucket.get_location | (self) | Returns the LocationConstraint for the bucket.
:rtype: str
:return: The LocationConstraint for the bucket or the empty
string if no constraint was specified when bucket was created. | Returns the LocationConstraint for the bucket. | [
"Returns",
"the",
"LocationConstraint",
"for",
"the",
"bucket",
"."
] | def get_location(self):
"""
Returns the LocationConstraint for the bucket.
:rtype: str
:return: The LocationConstraint for the bucket or the empty
string if no constraint was specified when bucket was created.
"""
response = self.connection.make_request('GET'... | [
"def",
"get_location",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"connection",
".",
"make_request",
"(",
"'GET'",
",",
"self",
".",
"name",
",",
"query_args",
"=",
"'location'",
")",
"body",
"=",
"response",
".",
"read",
"(",
")",
"if",
"res... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/s3/bucket.py#L1124-L1144 | ||
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | versioneer.py | python | register_vcs_handler | (vcs, method) | return decorate | Decorator to mark a method as the handler for a particular VCS. | Decorator to mark a method as the handler for a particular VCS. | [
"Decorator",
"to",
"mark",
"a",
"method",
"as",
"the",
"handler",
"for",
"a",
"particular",
"VCS",
"."
] | def register_vcs_handler(vcs, method): # decorator
"""Decorator to mark a method as the handler for a particular VCS."""
def decorate(f):
"""Store f in HANDLERS[vcs][method]."""
if vcs not in HANDLERS:
HANDLERS[vcs] = {}
HANDLERS[vcs][method] = f
return f
return ... | [
"def",
"register_vcs_handler",
"(",
"vcs",
",",
"method",
")",
":",
"# decorator",
"def",
"decorate",
"(",
"f",
")",
":",
"\"\"\"Store f in HANDLERS[vcs][method].\"\"\"",
"if",
"vcs",
"not",
"in",
"HANDLERS",
":",
"HANDLERS",
"[",
"vcs",
"]",
"=",
"{",
"}",
... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/versioneer.py#L373-L381 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/xml/dom/expatbuilder.py | python | Namespaces.start_namespace_decl_handler | (self, prefix, uri) | Push this namespace declaration on our storage. | Push this namespace declaration on our storage. | [
"Push",
"this",
"namespace",
"declaration",
"on",
"our",
"storage",
"."
] | def start_namespace_decl_handler(self, prefix, uri):
"""Push this namespace declaration on our storage."""
self._ns_ordered_prefixes.append((prefix, uri)) | [
"def",
"start_namespace_decl_handler",
"(",
"self",
",",
"prefix",
",",
"uri",
")",
":",
"self",
".",
"_ns_ordered_prefixes",
".",
"append",
"(",
"(",
"prefix",
",",
"uri",
")",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/xml/dom/expatbuilder.py#L739-L741 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/examples/learn/random_forest_mnist.py | python | train_and_eval | () | Train and evaluate the model. | Train and evaluate the model. | [
"Train",
"and",
"evaluate",
"the",
"model",
"."
] | def train_and_eval():
"""Train and evaluate the model."""
model_dir = tempfile.mkdtemp() if not FLAGS.model_dir else FLAGS.model_dir
print('model directory = %s' % model_dir)
est = build_estimator(model_dir)
mnist = input_data.read_data_sets(FLAGS.data_dir, one_hot=False)
train_input_fn = numpy_io.numpy_... | [
"def",
"train_and_eval",
"(",
")",
":",
"model_dir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"if",
"not",
"FLAGS",
".",
"model_dir",
"else",
"FLAGS",
".",
"model_dir",
"print",
"(",
"'model directory = %s'",
"%",
"model_dir",
")",
"est",
"=",
"build_estim... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/examples/learn/random_forest_mnist.py#L51-L85 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/factorization/python/ops/clustering_ops.py | python | KMeans.training_graph | (self) | return all_scores, cluster_idx, scores, training_op | Generate a training graph for kmeans algorithm.
Returns:
A tuple consisting of:
all_scores: A matrix (or list of matrices) of dimensions (num_input,
num_clusters) where the value is the distance of an input vector and a
cluster center.
cluster_idx: A vector (or list of vectors). E... | Generate a training graph for kmeans algorithm. | [
"Generate",
"a",
"training",
"graph",
"for",
"kmeans",
"algorithm",
"."
] | def training_graph(self):
"""Generate a training graph for kmeans algorithm.
Returns:
A tuple consisting of:
all_scores: A matrix (or list of matrices) of dimensions (num_input,
num_clusters) where the value is the distance of an input vector and a
cluster center.
cluster_idx:... | [
"def",
"training_graph",
"(",
"self",
")",
":",
"# Implementation of kmeans.",
"inputs",
"=",
"self",
".",
"_inputs",
"cluster_centers_var",
",",
"total_counts",
"=",
"self",
".",
"_init_clusters",
"(",
")",
"cluster_centers",
"=",
"cluster_centers_var",
"if",
"self... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/factorization/python/ops/clustering_ops.py#L271-L305 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | DateTime.ParseISOCombined | (*args, **kwargs) | return _misc_.DateTime_ParseISOCombined(*args, **kwargs) | ParseISOCombined(self, String datetime, char sep='T') -> bool | ParseISOCombined(self, String datetime, char sep='T') -> bool | [
"ParseISOCombined",
"(",
"self",
"String",
"datetime",
"char",
"sep",
"=",
"T",
")",
"-",
">",
"bool"
] | def ParseISOCombined(*args, **kwargs):
"""ParseISOCombined(self, String datetime, char sep='T') -> bool"""
return _misc_.DateTime_ParseISOCombined(*args, **kwargs) | [
"def",
"ParseISOCombined",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DateTime_ParseISOCombined",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L4146-L4148 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/dtypes/common.py | python | infer_dtype_from_object | (dtype) | return infer_dtype_from_object(np.dtype(dtype)) | Get a numpy dtype.type-style object for a dtype object.
This methods also includes handling of the datetime64[ns] and
datetime64[ns, TZ] objects.
If no dtype can be found, we return ``object``.
Parameters
----------
dtype : dtype, type
The dtype object whose numpy dtype.type-style
... | Get a numpy dtype.type-style object for a dtype object. | [
"Get",
"a",
"numpy",
"dtype",
".",
"type",
"-",
"style",
"object",
"for",
"a",
"dtype",
"object",
"."
] | def infer_dtype_from_object(dtype):
"""
Get a numpy dtype.type-style object for a dtype object.
This methods also includes handling of the datetime64[ns] and
datetime64[ns, TZ] objects.
If no dtype can be found, we return ``object``.
Parameters
----------
dtype : dtype, type
T... | [
"def",
"infer_dtype_from_object",
"(",
"dtype",
")",
":",
"if",
"isinstance",
"(",
"dtype",
",",
"type",
")",
"and",
"issubclass",
"(",
"dtype",
",",
"np",
".",
"generic",
")",
":",
"# Type object from a dtype",
"return",
"dtype",
"elif",
"isinstance",
"(",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/dtypes/common.py#L1892-L1953 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/metrics/python/ops/metric_ops.py | python | streaming_mean | (values, weights=None, metrics_collections=None,
updates_collections=None, name=None) | Computes the (weighted) mean of the given values.
The `streaming_mean` function creates two local variables, `total` and `count`
that are used to compute the average of `values`. This average is ultimately
returned as `mean` which is an idempotent operation that simply divides
`total` by `count`.
For estima... | Computes the (weighted) mean of the given values. | [
"Computes",
"the",
"(",
"weighted",
")",
"mean",
"of",
"the",
"given",
"values",
"."
] | def streaming_mean(values, weights=None, metrics_collections=None,
updates_collections=None, name=None):
"""Computes the (weighted) mean of the given values.
The `streaming_mean` function creates two local variables, `total` and `count`
that are used to compute the average of `values`. This av... | [
"def",
"streaming_mean",
"(",
"values",
",",
"weights",
"=",
"None",
",",
"metrics_collections",
"=",
"None",
",",
"updates_collections",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"with",
"variable_scope",
".",
"variable_scope",
"(",
"name",
",",
"'me... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/metrics/python/ops/metric_ops.py#L325-L387 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/hypertreelist.py | python | TreeListMainWindow.GetBestColumnWidth | (self, column, parent=None) | return max(10, width) | Returns the best column's width based on the items width in this column.
:param `column`: an integer specifying the column index;
:param `parent`: an instance of :class:`TreeListItem`. | Returns the best column's width based on the items width in this column. | [
"Returns",
"the",
"best",
"column",
"s",
"width",
"based",
"on",
"the",
"items",
"width",
"in",
"this",
"column",
"."
] | def GetBestColumnWidth(self, column, parent=None):
"""
Returns the best column's width based on the items width in this column.
:param `column`: an integer specifying the column index;
:param `parent`: an instance of :class:`TreeListItem`.
"""
maxWidth, h = self.GetClie... | [
"def",
"GetBestColumnWidth",
"(",
"self",
",",
"column",
",",
"parent",
"=",
"None",
")",
":",
"maxWidth",
",",
"h",
"=",
"self",
".",
"GetClientSize",
"(",
")",
"width",
"=",
"0",
"if",
"maxWidth",
"<",
"5",
":",
"# Not shown on screen",
"maxWidth",
"="... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/hypertreelist.py#L4004-L4050 | |
nodejs/nan | 8db8c8f544f2b6ce1b0859ef6ecdd0a3873a9e62 | cpplint.py | python | CheckSpacing | (filename, clean_lines, linenum, nesting_state, error) | Checks for the correctness of various spacing issues in the code.
Things we check for: spaces around operators, spaces after
if/for/while/switch, no spaces around parens in function calls, two
spaces between code and comment, don't start a block with a blank
line, don't end a function with a blank line, don't ... | Checks for the correctness of various spacing issues in the code. | [
"Checks",
"for",
"the",
"correctness",
"of",
"various",
"spacing",
"issues",
"in",
"the",
"code",
"."
] | def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
"""Checks for the correctness of various spacing issues in the code.
Things we check for: spaces around operators, spaces after
if/for/while/switch, no spaces around parens in function calls, two
spaces between code and comment, don't star... | [
"def",
"CheckSpacing",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"# Don't use \"elided\" lines here, otherwise we can't check commented lines.",
"# Don't want to use \"raw\" either, because we don't want to check inside C++11",
... | https://github.com/nodejs/nan/blob/8db8c8f544f2b6ce1b0859ef6ecdd0a3873a9e62/cpplint.py#L3408-L3533 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/calendar.py | python | TextCalendar.formatmonthname | (self, theyear, themonth, width, withyear=True) | return s.center(width) | Return a formatted month name. | Return a formatted month name. | [
"Return",
"a",
"formatted",
"month",
"name",
"."
] | def formatmonthname(self, theyear, themonth, width, withyear=True):
"""
Return a formatted month name.
"""
s = month_name[themonth]
if withyear:
s = "%s %r" % (s, theyear)
return s.center(width) | [
"def",
"formatmonthname",
"(",
"self",
",",
"theyear",
",",
"themonth",
",",
"width",
",",
"withyear",
"=",
"True",
")",
":",
"s",
"=",
"month_name",
"[",
"themonth",
"]",
"if",
"withyear",
":",
"s",
"=",
"\"%s %r\"",
"%",
"(",
"s",
",",
"theyear",
"... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/calendar.py#L299-L306 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_gdi.py | python | GraphicsGradientStop.SetColour | (*args, **kwargs) | return _gdi_.GraphicsGradientStop_SetColour(*args, **kwargs) | SetColour(self, Colour col) | SetColour(self, Colour col) | [
"SetColour",
"(",
"self",
"Colour",
"col",
")"
] | def SetColour(*args, **kwargs):
"""SetColour(self, Colour col)"""
return _gdi_.GraphicsGradientStop_SetColour(*args, **kwargs) | [
"def",
"SetColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"GraphicsGradientStop_SetColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L5894-L5896 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/contributed/sumopy/agilepy/lib_wx/wxmisc.py | python | KeyHandler.init_keys | (self, parent=None) | Sets events and variables for parent.
If no parent is defined then self is assumed to be parent. | Sets events and variables for parent.
If no parent is defined then self is assumed to be parent. | [
"Sets",
"events",
"and",
"variables",
"for",
"parent",
".",
"If",
"no",
"parent",
"is",
"defined",
"then",
"self",
"is",
"assumed",
"to",
"be",
"parent",
"."
] | def init_keys(self, parent=None):
"""
Sets events and variables for parent.
If no parent is defined then self is assumed to be parent.
"""
if parent is None:
parent = self
self.key_pressed = '' # string code of currently pressed key
wx.EVT_ENTER_WIND... | [
"def",
"init_keys",
"(",
"self",
",",
"parent",
"=",
"None",
")",
":",
"if",
"parent",
"is",
"None",
":",
"parent",
"=",
"self",
"self",
".",
"key_pressed",
"=",
"''",
"# string code of currently pressed key",
"wx",
".",
"EVT_ENTER_WINDOW",
"(",
"self",
",",... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/agilepy/lib_wx/wxmisc.py#L625-L636 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/cpplint.py | python | CheckRedundantOverrideOrFinal | (filename, clean_lines, linenum, error) | Check if line contains a redundant "override" or "final" virt-specifier.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Check if line contains a redundant "override" or "final" virt-specifier. | [
"Check",
"if",
"line",
"contains",
"a",
"redundant",
"override",
"or",
"final",
"virt",
"-",
"specifier",
"."
] | def CheckRedundantOverrideOrFinal(filename, clean_lines, linenum, error):
"""Check if line contains a redundant "override" or "final" virt-specifier.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
er... | [
"def",
"CheckRedundantOverrideOrFinal",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"# Look for closing parenthesis nearby. We need one to confirm where",
"# the declarator ends and where the virt-specifier starts to avoid",
"# false positives.",
"line... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/cpplint.py#L6337-L6363 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/numpy/math_ops.py | python | _get_histogramdd_count | (ndim, bin_edges, sample, weights) | return count | Returns count for histogramdd. | Returns count for histogramdd. | [
"Returns",
"count",
"for",
"histogramdd",
"."
] | def _get_histogramdd_count(ndim, bin_edges, sample, weights):
"""Returns count for histogramdd."""
data_indices = []
nbin = ()
flattened_bin_size = 1
for i in F.make_range(ndim):
data_to_bins = searchsorted(bin_edges[i], sample[:, i], 'right')
bin_size = _type_convert(int, bin_edges[... | [
"def",
"_get_histogramdd_count",
"(",
"ndim",
",",
"bin_edges",
",",
"sample",
",",
"weights",
")",
":",
"data_indices",
"=",
"[",
"]",
"nbin",
"=",
"(",
")",
"flattened_bin_size",
"=",
"1",
"for",
"i",
"in",
"F",
".",
"make_range",
"(",
"ndim",
")",
"... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/numpy/math_ops.py#L4745-L4767 | |
epfml/sent2vec | 770bd2d475c35eccc9a2452592e7c4304ac89fb9 | wikiTokenize.py | python | tokenize | (tknzr, sentence, to_lower=True) | return sentence | Arguments:
- tknzr: a tokenizer implementing the NLTK tokenizer interface
- sentence: a string to be tokenized
- to_lower: lowercasing or not | Arguments:
- tknzr: a tokenizer implementing the NLTK tokenizer interface
- sentence: a string to be tokenized
- to_lower: lowercasing or not | [
"Arguments",
":",
"-",
"tknzr",
":",
"a",
"tokenizer",
"implementing",
"the",
"NLTK",
"tokenizer",
"interface",
"-",
"sentence",
":",
"a",
"string",
"to",
"be",
"tokenized",
"-",
"to_lower",
":",
"lowercasing",
"or",
"not"
] | def tokenize(tknzr, sentence, to_lower=True):
"""Arguments:
- tknzr: a tokenizer implementing the NLTK tokenizer interface
- sentence: a string to be tokenized
- to_lower: lowercasing or not
"""
sentence = sentence.strip()
sentence = ' '.join([format_token(x) for x in tknzr.token... | [
"def",
"tokenize",
"(",
"tknzr",
",",
"sentence",
",",
"to_lower",
"=",
"True",
")",
":",
"sentence",
"=",
"sentence",
".",
"strip",
"(",
")",
"sentence",
"=",
"' '",
".",
"join",
"(",
"[",
"format_token",
"(",
"x",
")",
"for",
"x",
"in",
"tknzr",
... | https://github.com/epfml/sent2vec/blob/770bd2d475c35eccc9a2452592e7c4304ac89fb9/wikiTokenize.py#L8-L21 | |
telefonicaid/fiware-orion | 27c3202b9ddcfb9e3635a0af8d373f76e89b1d24 | scripts/cpplint.py | python | _IsTestFilename | (filename) | Determines if the given filename has a suffix that identifies it as a test.
Args:
filename: The input filename.
Returns:
True if 'filename' looks like a test, False otherwise. | Determines if the given filename has a suffix that identifies it as a test. | [
"Determines",
"if",
"the",
"given",
"filename",
"has",
"a",
"suffix",
"that",
"identifies",
"it",
"as",
"a",
"test",
"."
] | def _IsTestFilename(filename):
"""Determines if the given filename has a suffix that identifies it as a test.
Args:
filename: The input filename.
Returns:
True if 'filename' looks like a test, False otherwise.
"""
if (filename.endswith('_test.cc') or
filename.endswith('_unittest.cc') or
... | [
"def",
"_IsTestFilename",
"(",
"filename",
")",
":",
"if",
"(",
"filename",
".",
"endswith",
"(",
"'_test.cc'",
")",
"or",
"filename",
".",
"endswith",
"(",
"'_unittest.cc'",
")",
"or",
"filename",
".",
"endswith",
"(",
"'_regtest.cc'",
")",
")",
":",
"ret... | https://github.com/telefonicaid/fiware-orion/blob/27c3202b9ddcfb9e3635a0af8d373f76e89b1d24/scripts/cpplint.py#L2322-L2336 | ||
TGAC/KAT | e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216 | deps/boost/tools/build/src/tools/gcc.py | python | init_link_flags | (toolset, linker, condition) | Now, the vendor specific flags.
The parameter linker can be either gnu, darwin, osf, hpux or sun. | Now, the vendor specific flags.
The parameter linker can be either gnu, darwin, osf, hpux or sun. | [
"Now",
"the",
"vendor",
"specific",
"flags",
".",
"The",
"parameter",
"linker",
"can",
"be",
"either",
"gnu",
"darwin",
"osf",
"hpux",
"or",
"sun",
"."
] | def init_link_flags(toolset, linker, condition):
"""
Now, the vendor specific flags.
The parameter linker can be either gnu, darwin, osf, hpux or sun.
"""
toolset_link = toolset + '.link'
if linker == 'gnu':
# Strip the binary when no debugging is needed. We use --strip-all flag
... | [
"def",
"init_link_flags",
"(",
"toolset",
",",
"linker",
",",
"condition",
")",
":",
"toolset_link",
"=",
"toolset",
"+",
"'.link'",
"if",
"linker",
"==",
"'gnu'",
":",
"# Strip the binary when no debugging is needed. We use --strip-all flag",
"# as opposed to -s since icc ... | https://github.com/TGAC/KAT/blob/e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216/deps/boost/tools/build/src/tools/gcc.py#L494-L608 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/gslib/commands/perfdiag.py | python | PerfDiagCommand._RunLatencyTests | (self) | Runs latency tests. | Runs latency tests. | [
"Runs",
"latency",
"tests",
"."
] | def _RunLatencyTests(self):
"""Runs latency tests."""
# Stores timing information for each category of operation.
self.results['latency'] = defaultdict(list)
for i in range(self.num_objects):
self.logger.info('\nRunning latency iteration %d...', i+1)
for fpath in self.latency_files:
... | [
"def",
"_RunLatencyTests",
"(",
"self",
")",
":",
"# Stores timing information for each category of operation.",
"self",
".",
"results",
"[",
"'latency'",
"]",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"num_objects",
")",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/gslib/commands/perfdiag.py#L688-L737 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/eclib/outbuff.py | python | TaskObject.__init__ | (self, parent, task, *args, **kwargs) | Initialize the TaskObject. All *args and **kwargs are passed
to the task.
@param parent: Parent Window/EventHandler to receive the events
generated by the process.
@param task: callable should be a generator object and must be iterable | Initialize the TaskObject. All *args and **kwargs are passed
to the task. | [
"Initialize",
"the",
"TaskObject",
".",
"All",
"*",
"args",
"and",
"**",
"kwargs",
"are",
"passed",
"to",
"the",
"task",
"."
] | def __init__(self, parent, task, *args, **kwargs):
"""Initialize the TaskObject. All *args and **kwargs are passed
to the task.
@param parent: Parent Window/EventHandler to receive the events
generated by the process.
@param task: callable should be a generator ob... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
",",
"task",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"TaskObject",
",",
"self",
")",
".",
"__init__",
"(",
")",
"assert",
"isinstance",
"(",
"parent",
",",
"OutputBuffer",
")",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/eclib/outbuff.py#L1038-L1056 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset13.py | python | convert_softmax | (node, **kwargs) | Map MXNet's softmax operator attributes to onnx's Softmax operator
and return the created node. | Map MXNet's softmax operator attributes to onnx's Softmax operator
and return the created node. | [
"Map",
"MXNet",
"s",
"softmax",
"operator",
"attributes",
"to",
"onnx",
"s",
"Softmax",
"operator",
"and",
"return",
"the",
"created",
"node",
"."
] | def convert_softmax(node, **kwargs):
"""Map MXNet's softmax operator attributes to onnx's Softmax operator
and return the created node.
"""
from onnx.helper import make_node
from onnx import TensorProto
name, input_nodes, attrs = get_inputs(node, kwargs)
input_dtypes = get_input_dtypes(node,... | [
"def",
"convert_softmax",
"(",
"node",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"onnx",
".",
"helper",
"import",
"make_node",
"from",
"onnx",
"import",
"TensorProto",
"name",
",",
"input_nodes",
",",
"attrs",
"=",
"get_inputs",
"(",
"node",
",",
"kwargs"... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset13.py#L565-L681 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | _Stream.read | (self, size=None) | return buf | Return the next size number of bytes from the stream.
If size is not defined, return all bytes of the stream
up to EOF. | Return the next size number of bytes from the stream.
If size is not defined, return all bytes of the stream
up to EOF. | [
"Return",
"the",
"next",
"size",
"number",
"of",
"bytes",
"from",
"the",
"stream",
".",
"If",
"size",
"is",
"not",
"defined",
"return",
"all",
"bytes",
"of",
"the",
"stream",
"up",
"to",
"EOF",
"."
] | def read(self, size=None):
"""Return the next size number of bytes from the stream.
If size is not defined, return all bytes of the stream
up to EOF.
"""
if size is None:
t = []
while True:
buf = self._read(self.bufsize)
... | [
"def",
"read",
"(",
"self",
",",
"size",
"=",
"None",
")",
":",
"if",
"size",
"is",
"None",
":",
"t",
"=",
"[",
"]",
"while",
"True",
":",
"buf",
"=",
"self",
".",
"_read",
"(",
"self",
".",
"bufsize",
")",
"if",
"not",
"buf",
":",
"break",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L565-L581 | |
vesoft-inc/nebula | 25a06217ebaf169e1f0e5ff6a797ba6f0c41fc35 | .linters/cpp/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/vesoft-inc/nebula/blob/25a06217ebaf169e1f0e5ff6a797ba6f0c41fc35/.linters/cpp/cpplint.py#L3284-L3349 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/all_reduce/python/all_reduce.py | python | _apply_unary_to_chunks | (f, chunks_by_dev) | return output | Apply a unary op to each tensor in chunks_by_dev, on same device.
Args:
f: a unary function over T @{tf.Tensor}.
chunks_by_dev: list of lists of T @{tf.Tensor}.
Returns:
new list of lists of T @{tf.Tensor} with the same structure as
chunks_by_dev containing the derived tensors. | Apply a unary op to each tensor in chunks_by_dev, on same device. | [
"Apply",
"a",
"unary",
"op",
"to",
"each",
"tensor",
"in",
"chunks_by_dev",
"on",
"same",
"device",
"."
] | def _apply_unary_to_chunks(f, chunks_by_dev):
"""Apply a unary op to each tensor in chunks_by_dev, on same device.
Args:
f: a unary function over T @{tf.Tensor}.
chunks_by_dev: list of lists of T @{tf.Tensor}.
Returns:
new list of lists of T @{tf.Tensor} with the same structure as
chunks_by_dev ... | [
"def",
"_apply_unary_to_chunks",
"(",
"f",
",",
"chunks_by_dev",
")",
":",
"output",
"=",
"[",
"]",
"for",
"x",
"in",
"chunks_by_dev",
":",
"with",
"ops",
".",
"colocate_with",
"(",
"x",
"[",
"0",
"]",
")",
":",
"output",
".",
"append",
"(",
"[",
"f"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/all_reduce/python/all_reduce.py#L359-L374 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | URI.fragment | (self) | return ret | Get the fragment part from an URI | Get the fragment part from an URI | [
"Get",
"the",
"fragment",
"part",
"from",
"an",
"URI"
] | def fragment(self):
"""Get the fragment part from an URI """
ret = libxml2mod.xmlURIGetFragment(self._o)
return ret | [
"def",
"fragment",
"(",
"self",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlURIGetFragment",
"(",
"self",
".",
"_o",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L6184-L6187 | |
opengauss-mirror/openGauss-server | e383f1b77720a00ddbe4c0655bc85914d9b02a2b | src/gausskernel/dbmind/tools/ai_manager/tools/common_tools.py | python | CommonTools.remote_mkdir_with_mode | (path, mode, ip, username, password) | Create directory with defined mode if not exist. | Create directory with defined mode if not exist. | [
"Create",
"directory",
"with",
"defined",
"mode",
"if",
"not",
"exist",
"."
] | def remote_mkdir_with_mode(path, mode, ip, username, password):
"""
Create directory with defined mode if not exist.
"""
cmd = Constant.SHELL_CMD_DICT['createDirSimple'] % (path, mode)
status, output = CommonTools.remote_execute_cmd(ip, username, password, cmd)
if status ... | [
"def",
"remote_mkdir_with_mode",
"(",
"path",
",",
"mode",
",",
"ip",
",",
"username",
",",
"password",
")",
":",
"cmd",
"=",
"Constant",
".",
"SHELL_CMD_DICT",
"[",
"'createDirSimple'",
"]",
"%",
"(",
"path",
",",
"mode",
")",
"status",
",",
"output",
"... | https://github.com/opengauss-mirror/openGauss-server/blob/e383f1b77720a00ddbe4c0655bc85914d9b02a2b/src/gausskernel/dbmind/tools/ai_manager/tools/common_tools.py#L112-L121 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/framework/ops.py | python | Operation._id | (self) | return self._id_value | The unique integer id of this operation. | The unique integer id of this operation. | [
"The",
"unique",
"integer",
"id",
"of",
"this",
"operation",
"."
] | def _id(self):
"""The unique integer id of this operation."""
return self._id_value | [
"def",
"_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_id_value"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/framework/ops.py#L1658-L1660 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/botocore/regions.py | python | BaseEndpointResolver.get_available_partitions | (self) | Lists the partitions available to the endpoint resolver.
:return: Returns a list of partition names (e.g., ["aws", "aws-cn"]). | Lists the partitions available to the endpoint resolver. | [
"Lists",
"the",
"partitions",
"available",
"to",
"the",
"endpoint",
"resolver",
"."
] | def get_available_partitions(self):
"""Lists the partitions available to the endpoint resolver.
:return: Returns a list of partition names (e.g., ["aws", "aws-cn"]).
"""
raise NotImplementedError | [
"def",
"get_available_partitions",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/botocore/regions.py#L60-L65 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/_pydecimal.py | python | _log10_lb | (c, correction = {
'1': 100, '2': 70, '3': 53, '4': 40, '5': 31,
'6': 23, '7': 16, '8': 10, '9': 5}) | return 100*len(str_c) - correction[str_c[0]] | Compute a lower bound for 100*log10(c) for a positive integer c. | Compute a lower bound for 100*log10(c) for a positive integer c. | [
"Compute",
"a",
"lower",
"bound",
"for",
"100",
"*",
"log10",
"(",
"c",
")",
"for",
"a",
"positive",
"integer",
"c",
"."
] | def _log10_lb(c, correction = {
'1': 100, '2': 70, '3': 53, '4': 40, '5': 31,
'6': 23, '7': 16, '8': 10, '9': 5}):
"""Compute a lower bound for 100*log10(c) for a positive integer c."""
if c <= 0:
raise ValueError("The argument to _log10_lb should be nonnegative.")
str_c = str(c)
... | [
"def",
"_log10_lb",
"(",
"c",
",",
"correction",
"=",
"{",
"'1'",
":",
"100",
",",
"'2'",
":",
"70",
",",
"'3'",
":",
"53",
",",
"'4'",
":",
"40",
",",
"'5'",
":",
"31",
",",
"'6'",
":",
"23",
",",
"'7'",
":",
"16",
",",
"'8'",
":",
"10",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/_pydecimal.py#L6002-L6009 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/debug/cli/curses_ui.py | python | CursesUI.run_ui | (self,
init_command=None,
title=None,
title_color=None,
enable_mouse_on_start=True) | return exit_token | Run the CLI: See the doc of base_ui.BaseUI.run_ui for more details. | Run the CLI: See the doc of base_ui.BaseUI.run_ui for more details. | [
"Run",
"the",
"CLI",
":",
"See",
"the",
"doc",
"of",
"base_ui",
".",
"BaseUI",
".",
"run_ui",
"for",
"more",
"details",
"."
] | def run_ui(self,
init_command=None,
title=None,
title_color=None,
enable_mouse_on_start=True):
"""Run the CLI: See the doc of base_ui.BaseUI.run_ui for more details."""
# Only one instance of the Curses UI can be running at a time, since
# otherwise they ... | [
"def",
"run_ui",
"(",
"self",
",",
"init_command",
"=",
"None",
",",
"title",
"=",
"None",
",",
"title_color",
"=",
"None",
",",
"enable_mouse_on_start",
"=",
"True",
")",
":",
"# Only one instance of the Curses UI can be running at a time, since",
"# otherwise they wou... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/debug/cli/curses_ui.py#L480-L511 | |
herbstluftwm/herbstluftwm | 23ef0274bd4d317208eae5fea72b21478a71431b | doc/format-doc.py | python | ObjectDocPrinter.run | (self, clsname, path=[]) | print the documentation for a given class. However,
if the documentation for it has already been generated,
only insert a link to ot using clsname2anchor | print the documentation for a given class. However,
if the documentation for it has already been generated,
only insert a link to ot using clsname2anchor | [
"print",
"the",
"documentation",
"for",
"a",
"given",
"class",
".",
"However",
"if",
"the",
"documentation",
"for",
"it",
"has",
"already",
"been",
"generated",
"only",
"insert",
"a",
"link",
"to",
"ot",
"using",
"clsname2anchor"
] | def run(self, clsname, path=[]):
"""print the documentation for a given class. However,
if the documentation for it has already been generated,
only insert a link to ot using clsname2anchor
"""
reference_cls_doc = self.reference_to_class_doc(clsname, path)
if reference_cl... | [
"def",
"run",
"(",
"self",
",",
"clsname",
",",
"path",
"=",
"[",
"]",
")",
":",
"reference_cls_doc",
"=",
"self",
".",
"reference_to_class_doc",
"(",
"clsname",
",",
"path",
")",
"if",
"reference_cls_doc",
"is",
"not",
"None",
":",
"identifier",
",",
"t... | https://github.com/herbstluftwm/herbstluftwm/blob/23ef0274bd4d317208eae5fea72b21478a71431b/doc/format-doc.py#L195-L269 | ||
alibaba/weex_js_engine | 2bdf4b6f020c1fc99c63f649718f6faf7e27fdde | jni/v8core/v8/build/gyp/pylib/gyp/generator/make.py | python | EscapeMakeVariableExpansion | (s) | return s.replace('$', '$$') | Make has its own variable expansion syntax using $. We must escape it for
string to be interpreted literally. | Make has its own variable expansion syntax using $. We must escape it for
string to be interpreted literally. | [
"Make",
"has",
"its",
"own",
"variable",
"expansion",
"syntax",
"using",
"$",
".",
"We",
"must",
"escape",
"it",
"for",
"string",
"to",
"be",
"interpreted",
"literally",
"."
] | def EscapeMakeVariableExpansion(s):
"""Make has its own variable expansion syntax using $. We must escape it for
string to be interpreted literally."""
return s.replace('$', '$$') | [
"def",
"EscapeMakeVariableExpansion",
"(",
"s",
")",
":",
"return",
"s",
".",
"replace",
"(",
"'$'",
",",
"'$$'",
")"
] | https://github.com/alibaba/weex_js_engine/blob/2bdf4b6f020c1fc99c63f649718f6faf7e27fdde/jni/v8core/v8/build/gyp/pylib/gyp/generator/make.py#L579-L582 | |
NeoGeographyToolkit/StereoPipeline | eedf54a919fb5cce1ab0e280bb0df4050763aa11 | src/asp/Python/asp_system_utils.py | python | get_num_cpus | () | return num_cpus | Return the number of CPUs on the current machine. | Return the number of CPUs on the current machine. | [
"Return",
"the",
"number",
"of",
"CPUs",
"on",
"the",
"current",
"machine",
"."
] | def get_num_cpus():
"""Return the number of CPUs on the current machine."""
import sys
if sys.version_info < (2, 6, 0):
num_cpus = 8
else:
from multiprocessing import cpu_count
num_cpus = cpu_count()
return num_cpus | [
"def",
"get_num_cpus",
"(",
")",
":",
"import",
"sys",
"if",
"sys",
".",
"version_info",
"<",
"(",
"2",
",",
"6",
",",
"0",
")",
":",
"num_cpus",
"=",
"8",
"else",
":",
"from",
"multiprocessing",
"import",
"cpu_count",
"num_cpus",
"=",
"cpu_count",
"("... | https://github.com/NeoGeographyToolkit/StereoPipeline/blob/eedf54a919fb5cce1ab0e280bb0df4050763aa11/src/asp/Python/asp_system_utils.py#L60-L70 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/input/win32_pipe.py | python | Win32PipeInput.close | (self) | Close pipe handles. | Close pipe handles. | [
"Close",
"pipe",
"handles",
"."
] | def close(self) -> None:
"Close pipe handles."
windll.kernel32.CloseHandle(self._event)
self._closed = True | [
"def",
"close",
"(",
"self",
")",
"->",
"None",
":",
"windll",
".",
"kernel32",
".",
"CloseHandle",
"(",
"self",
".",
"_event",
")",
"self",
".",
"_closed",
"=",
"True"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/input/win32_pipe.py#L126-L129 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/symtable.py | python | SymbolTable.has_exec | (self) | return bool(self._table.optimized & (OPT_EXEC | OPT_BARE_EXEC)) | Return true if the scope uses exec | Return true if the scope uses exec | [
"Return",
"true",
"if",
"the",
"scope",
"uses",
"exec"
] | def has_exec(self):
"""Return true if the scope uses exec"""
return bool(self._table.optimized & (OPT_EXEC | OPT_BARE_EXEC)) | [
"def",
"has_exec",
"(",
"self",
")",
":",
"return",
"bool",
"(",
"self",
".",
"_table",
".",
"optimized",
"&",
"(",
"OPT_EXEC",
"|",
"OPT_BARE_EXEC",
")",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/symtable.py#L90-L92 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/grid.py | python | GridTableBase._setOORInfo | (*args, **kwargs) | return _grid.GridTableBase__setOORInfo(*args, **kwargs) | _setOORInfo(self, PyObject _self) | _setOORInfo(self, PyObject _self) | [
"_setOORInfo",
"(",
"self",
"PyObject",
"_self",
")"
] | def _setOORInfo(*args, **kwargs):
"""_setOORInfo(self, PyObject _self)"""
return _grid.GridTableBase__setOORInfo(*args, **kwargs) | [
"def",
"_setOORInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"GridTableBase__setOORInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/grid.py#L770-L772 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/external/bazel_tools/third_party/py/concurrent/futures/_base.py | python | Future.set_exception | (self, exception) | Sets the result of the future as being the given exception.
Should only be used by Executor implementations and unit tests. | Sets the result of the future as being the given exception. | [
"Sets",
"the",
"result",
"of",
"the",
"future",
"as",
"being",
"the",
"given",
"exception",
"."
] | def set_exception(self, exception):
"""Sets the result of the future as being the given exception.
Should only be used by Executor implementations and unit tests.
"""
with self._condition:
self._exception = exception
self._state = FINISHED
for waiter ... | [
"def",
"set_exception",
"(",
"self",
",",
"exception",
")",
":",
"with",
"self",
".",
"_condition",
":",
"self",
".",
"_exception",
"=",
"exception",
"self",
".",
"_state",
"=",
"FINISHED",
"for",
"waiter",
"in",
"self",
".",
"_waiters",
":",
"waiter",
"... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/external/bazel_tools/third_party/py/concurrent/futures/_base.py#L496-L507 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | Rect2D.MoveRightTopTo | (*args, **kwargs) | return _core_.Rect2D_MoveRightTopTo(*args, **kwargs) | MoveRightTopTo(self, Point2D pt) | MoveRightTopTo(self, Point2D pt) | [
"MoveRightTopTo",
"(",
"self",
"Point2D",
"pt",
")"
] | def MoveRightTopTo(*args, **kwargs):
"""MoveRightTopTo(self, Point2D pt)"""
return _core_.Rect2D_MoveRightTopTo(*args, **kwargs) | [
"def",
"MoveRightTopTo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Rect2D_MoveRightTopTo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L1935-L1937 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | RegionIterator.GetRect | (*args, **kwargs) | return _gdi_.RegionIterator_GetRect(*args, **kwargs) | GetRect(self) -> Rect | GetRect(self) -> Rect | [
"GetRect",
"(",
"self",
")",
"-",
">",
"Rect"
] | def GetRect(*args, **kwargs):
"""GetRect(self) -> Rect"""
return _gdi_.RegionIterator_GetRect(*args, **kwargs) | [
"def",
"GetRect",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"RegionIterator_GetRect",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L1694-L1696 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/optimize/_remove_redundancy.py | python | _get_densest | (A, eligibleRows) | return np.argmax(rowCounts * eligibleRows) | Returns the index of the densest row of A. Ignores rows that are not
eligible for consideration.
Parameters
----------
A : 2-D array
An array representing a matrix
eligibleRows : 1-D logical array
Values indicate whether the corresponding row of A is eligible
to be considere... | Returns the index of the densest row of A. Ignores rows that are not
eligible for consideration. | [
"Returns",
"the",
"index",
"of",
"the",
"densest",
"row",
"of",
"A",
".",
"Ignores",
"rows",
"that",
"are",
"not",
"eligible",
"for",
"consideration",
"."
] | def _get_densest(A, eligibleRows):
"""
Returns the index of the densest row of A. Ignores rows that are not
eligible for consideration.
Parameters
----------
A : 2-D array
An array representing a matrix
eligibleRows : 1-D logical array
Values indicate whether the correspondi... | [
"def",
"_get_densest",
"(",
"A",
",",
"eligibleRows",
")",
":",
"rowCounts",
"=",
"_row_count",
"(",
"A",
")",
"return",
"np",
".",
"argmax",
"(",
"rowCounts",
"*",
"eligibleRows",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/_remove_redundancy.py#L34-L54 | |
baidu/lac | 3e10dbed9bfd87bea927c84a6627a167c17b5617 | python/LAC/_compat.py | python | strdecode | (sentence) | return sentence | string to unicode
Args:
sentence: a string of utf-8 or gbk
Returns:
input's unicode result | string to unicode | [
"string",
"to",
"unicode"
] | def strdecode(sentence):
"""string to unicode
Args:
sentence: a string of utf-8 or gbk
Returns:
input's unicode result
"""
if not isinstance(sentence, text_type):
try:
sentence = sentence.decode('utf-8')
except UnicodeDecodeError:
sentence ... | [
"def",
"strdecode",
"(",
"sentence",
")",
":",
"if",
"not",
"isinstance",
"(",
"sentence",
",",
"text_type",
")",
":",
"try",
":",
"sentence",
"=",
"sentence",
".",
"decode",
"(",
"'utf-8'",
")",
"except",
"UnicodeDecodeError",
":",
"sentence",
"=",
"sente... | https://github.com/baidu/lac/blob/3e10dbed9bfd87bea927c84a6627a167c17b5617/python/LAC/_compat.py#L51-L66 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | xmlNode.nextElementSibling | (self) | return __tmp | Finds the first closest next sibling of the node which is
an element node. Note the handling of entities references
is different than in the W3C DOM element traversal spec
since we don't have back reference from entities content to
entities references. | Finds the first closest next sibling of the node which is
an element node. Note the handling of entities references
is different than in the W3C DOM element traversal spec
since we don't have back reference from entities content to
entities references. | [
"Finds",
"the",
"first",
"closest",
"next",
"sibling",
"of",
"the",
"node",
"which",
"is",
"an",
"element",
"node",
".",
"Note",
"the",
"handling",
"of",
"entities",
"references",
"is",
"different",
"than",
"in",
"the",
"W3C",
"DOM",
"element",
"traversal",
... | def nextElementSibling(self):
"""Finds the first closest next sibling of the node which is
an element node. Note the handling of entities references
is different than in the W3C DOM element traversal spec
since we don't have back reference from entities content to
entiti... | [
"def",
"nextElementSibling",
"(",
"self",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlNextElementSibling",
"(",
"self",
".",
"_o",
")",
"if",
"ret",
"is",
"None",
":",
"return",
"None",
"__tmp",
"=",
"xmlNode",
"(",
"_obj",
"=",
"ret",
")",
"return",
... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L3423-L3432 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/protobuf/python/google/protobuf/internal/decoder.py | python | ReadTag | (buffer, pos) | return (buffer[start:pos], pos) | Read a tag from the buffer, and return a (tag_bytes, new_pos) tuple.
We return the raw bytes of the tag rather than decoding them. The raw
bytes can then be used to look up the proper decoder. This effectively allows
us to trade some work that would be done in pure-python (decoding a varint)
for work that is... | Read a tag from the buffer, and return a (tag_bytes, new_pos) tuple. | [
"Read",
"a",
"tag",
"from",
"the",
"buffer",
"and",
"return",
"a",
"(",
"tag_bytes",
"new_pos",
")",
"tuple",
"."
] | def ReadTag(buffer, pos):
"""Read a tag from the buffer, and return a (tag_bytes, new_pos) tuple.
We return the raw bytes of the tag rather than decoding them. The raw
bytes can then be used to look up the proper decoder. This effectively allows
us to trade some work that would be done in pure-python (decodi... | [
"def",
"ReadTag",
"(",
"buffer",
",",
"pos",
")",
":",
"start",
"=",
"pos",
"while",
"ord",
"(",
"buffer",
"[",
"pos",
"]",
")",
"&",
"0x80",
":",
"pos",
"+=",
"1",
"pos",
"+=",
"1",
"return",
"(",
"buffer",
"[",
"start",
":",
"pos",
"]",
",",
... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/protobuf/python/google/protobuf/internal/decoder.py#L160-L175 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/linalg/_interpolative_backend.py | python | idd_diffsnorm | (m, n, matvect, matvect2, matvec, matvec2, its=20) | return _id.idd_diffsnorm(m, n, matvect, matvect2, matvec, matvec2, its) | Estimate spectral norm of the difference of two real matrices by the
randomized power method.
:param m:
Matrix row dimension.
:type m: int
:param n:
Matrix column dimension.
:type n: int
:param matvect:
Function to apply the transpose of the first matrix to a vector, wit... | Estimate spectral norm of the difference of two real matrices by the
randomized power method. | [
"Estimate",
"spectral",
"norm",
"of",
"the",
"difference",
"of",
"two",
"real",
"matrices",
"by",
"the",
"randomized",
"power",
"method",
"."
] | def idd_diffsnorm(m, n, matvect, matvect2, matvec, matvec2, its=20):
"""
Estimate spectral norm of the difference of two real matrices by the
randomized power method.
:param m:
Matrix row dimension.
:type m: int
:param n:
Matrix column dimension.
:type n: int
:param matv... | [
"def",
"idd_diffsnorm",
"(",
"m",
",",
"n",
",",
"matvect",
",",
"matvect2",
",",
"matvec",
",",
"matvec2",
",",
"its",
"=",
"20",
")",
":",
"return",
"_id",
".",
"idd_diffsnorm",
"(",
"m",
",",
"n",
",",
"matvect",
",",
"matvect2",
",",
"matvec",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/linalg/_interpolative_backend.py#L374-L413 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/frame.py | python | DataFrame._box_col_values | (self, values, items) | return klass(values, index=self.index, name=items, fastpath=True) | Provide boxed values for a column. | Provide boxed values for a column. | [
"Provide",
"boxed",
"values",
"for",
"a",
"column",
"."
] | def _box_col_values(self, values, items):
"""
Provide boxed values for a column.
"""
klass = self._constructor_sliced
return klass(values, index=self.index, name=items, fastpath=True) | [
"def",
"_box_col_values",
"(",
"self",
",",
"values",
",",
"items",
")",
":",
"klass",
"=",
"self",
".",
"_constructor_sliced",
"return",
"klass",
"(",
"values",
",",
"index",
"=",
"self",
".",
"index",
",",
"name",
"=",
"items",
",",
"fastpath",
"=",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/frame.py#L3073-L3078 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/states.py | python | Body.is_enumerated_list_item | (self, ordinal, sequence, format) | return None | Check validity based on the ordinal value and the second line.
Return true if the ordinal is valid and the second line is blank,
indented, or starts with the next enumerator or an auto-enumerator. | Check validity based on the ordinal value and the second line. | [
"Check",
"validity",
"based",
"on",
"the",
"ordinal",
"value",
"and",
"the",
"second",
"line",
"."
] | def is_enumerated_list_item(self, ordinal, sequence, format):
"""
Check validity based on the ordinal value and the second line.
Return true if the ordinal is valid and the second line is blank,
indented, or starts with the next enumerator or an auto-enumerator.
"""
if o... | [
"def",
"is_enumerated_list_item",
"(",
"self",
",",
"ordinal",
",",
"sequence",
",",
"format",
")",
":",
"if",
"ordinal",
"is",
"None",
":",
"return",
"None",
"try",
":",
"next_line",
"=",
"self",
".",
"state_machine",
".",
"next_line",
"(",
")",
"except",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/states.py#L1368-L1395 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/summary/summary.py | python | histogram | (name, values, collections=None, family=None) | return val | Outputs a `Summary` protocol buffer with a histogram.
Adding a histogram summary makes it possible to visualize your data's
distribution in TensorBoard. You can see a detailed explanation of the
TensorBoard histogram dashboard
[here](https://www.tensorflow.org/get_started/tensorboard_histograms).
The genera... | Outputs a `Summary` protocol buffer with a histogram. | [
"Outputs",
"a",
"Summary",
"protocol",
"buffer",
"with",
"a",
"histogram",
"."
] | def histogram(name, values, collections=None, family=None):
# pylint: disable=line-too-long
"""Outputs a `Summary` protocol buffer with a histogram.
Adding a histogram summary makes it possible to visualize your data's
distribution in TensorBoard. You can see a detailed explanation of the
TensorBoard histogr... | [
"def",
"histogram",
"(",
"name",
",",
"values",
",",
"collections",
"=",
"None",
",",
"family",
"=",
"None",
")",
":",
"# pylint: disable=line-too-long",
"if",
"_distribute_summary_op_util",
".",
"skip_summary",
"(",
")",
":",
"return",
"_constant_op",
".",
"con... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/summary/summary.py#L144-L181 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/numpy/multiarray.py | python | _as_mx_np_array | (object, device=None, zero_copy=False) | Convert arrays or any array member of container to mxnet.numpy.ndarray on device. | Convert arrays or any array member of container to mxnet.numpy.ndarray on device. | [
"Convert",
"arrays",
"or",
"any",
"array",
"member",
"of",
"container",
"to",
"mxnet",
".",
"numpy",
".",
"ndarray",
"on",
"device",
"."
] | def _as_mx_np_array(object, device=None, zero_copy=False):
"""Convert arrays or any array member of container to mxnet.numpy.ndarray on device."""
if object is None or isinstance(object, ndarray):
return object
elif isinstance(object, _np.ndarray):
from_numpy = ndarray_from_numpy(ndarray, ar... | [
"def",
"_as_mx_np_array",
"(",
"object",
",",
"device",
"=",
"None",
",",
"zero_copy",
"=",
"False",
")",
":",
"if",
"object",
"is",
"None",
"or",
"isinstance",
"(",
"object",
",",
"ndarray",
")",
":",
"return",
"object",
"elif",
"isinstance",
"(",
"obje... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/numpy/multiarray.py#L190-L205 | ||
rbgirshick/caffe-fast-rcnn | 28a579eaf0668850705598b3075b8969f22226d9 | scripts/cpp_lint.py | python | PrintUsage | (message) | Prints a brief usage string and exits, optionally with an error message.
Args:
message: The optional error message. | Prints a brief usage string and exits, optionally with an error message. | [
"Prints",
"a",
"brief",
"usage",
"string",
"and",
"exits",
"optionally",
"with",
"an",
"error",
"message",
"."
] | def PrintUsage(message):
"""Prints a brief usage string and exits, optionally with an error message.
Args:
message: The optional error message.
"""
sys.stderr.write(_USAGE)
if message:
sys.exit('\nFATAL ERROR: ' + message)
else:
sys.exit(1) | [
"def",
"PrintUsage",
"(",
"message",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"_USAGE",
")",
"if",
"message",
":",
"sys",
".",
"exit",
"(",
"'\\nFATAL ERROR: '",
"+",
"message",
")",
"else",
":",
"sys",
".",
"exit",
"(",
"1",
")"
] | https://github.com/rbgirshick/caffe-fast-rcnn/blob/28a579eaf0668850705598b3075b8969f22226d9/scripts/cpp_lint.py#L4757-L4767 | ||
baidu-research/persistent-rnn | dcb55b7bc4669021a9da82a3e847c7fe1377ef87 | site_scons/site_tools/nvcc.py | python | generate | (env) | Add Builders and construction variables for CUDA compilers to an Environment. | Add Builders and construction variables for CUDA compilers to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"CUDA",
"compilers",
"to",
"an",
"Environment",
"."
] | def generate(env):
"""
Add Builders and construction variables for CUDA compilers to an Environment.
"""
if not cuda_exists(env):
print('Failed to build NVCC tool')
generate_dummy(env)
return
# create a builder that makes PTX files from .cu files
ptx_builder = SCons.Builder.Builder(action = '$... | [
"def",
"generate",
"(",
"env",
")",
":",
"if",
"not",
"cuda_exists",
"(",
"env",
")",
":",
"print",
"(",
"'Failed to build NVCC tool'",
")",
"generate_dummy",
"(",
"env",
")",
"return",
"# create a builder that makes PTX files from .cu files",
"ptx_builder",
"=",
"S... | https://github.com/baidu-research/persistent-rnn/blob/dcb55b7bc4669021a9da82a3e847c7fe1377ef87/site_scons/site_tools/nvcc.py#L142-L195 | ||
indutny/candor | 48e7260618f5091c80a3416828e2808cad3ea22e | tools/gyp/pylib/gyp/easy_xml.py | python | WriteXmlIfChanged | (content, path, encoding='utf-8', pretty=False,
win32=False) | Writes the XML content to disk, touching the file only if it has changed.
Args:
content: The structured content to be written.
path: Location of the file.
encoding: The encoding to report on the first line of the XML file.
pretty: True if we want pretty printing with indents and new lines. | Writes the XML content to disk, touching the file only if it has changed. | [
"Writes",
"the",
"XML",
"content",
"to",
"disk",
"touching",
"the",
"file",
"only",
"if",
"it",
"has",
"changed",
"."
] | def WriteXmlIfChanged(content, path, encoding='utf-8', pretty=False,
win32=False):
""" Writes the XML content to disk, touching the file only if it has changed.
Args:
content: The structured content to be written.
path: Location of the file.
encoding: The encoding to report on th... | [
"def",
"WriteXmlIfChanged",
"(",
"content",
",",
"path",
",",
"encoding",
"=",
"'utf-8'",
",",
"pretty",
"=",
"False",
",",
"win32",
"=",
"False",
")",
":",
"xml_string",
"=",
"XmlToString",
"(",
"content",
",",
"encoding",
",",
"pretty",
")",
"if",
"win... | https://github.com/indutny/candor/blob/48e7260618f5091c80a3416828e2808cad3ea22e/tools/gyp/pylib/gyp/easy_xml.py#L105-L131 | ||
epam/Indigo | 30e40b4b1eb9bae0207435a26cfcb81ddcc42be1 | api/python/indigo/__init__.py | python | IndigoObject.countRGroups | (self) | return self.dispatcher._checkResult(
Indigo._lib.indigoCountRGroups(self.id)
) | Molecule method returns the number of r-groups
Returns:
int: number of r-groups | Molecule method returns the number of r-groups | [
"Molecule",
"method",
"returns",
"the",
"number",
"of",
"r",
"-",
"groups"
] | def countRGroups(self):
"""Molecule method returns the number of r-groups
Returns:
int: number of r-groups
"""
self.dispatcher._setSessionId()
return self.dispatcher._checkResult(
Indigo._lib.indigoCountRGroups(self.id)
) | [
"def",
"countRGroups",
"(",
"self",
")",
":",
"self",
".",
"dispatcher",
".",
"_setSessionId",
"(",
")",
"return",
"self",
".",
"dispatcher",
".",
"_checkResult",
"(",
"Indigo",
".",
"_lib",
".",
"indigoCountRGroups",
"(",
"self",
".",
"id",
")",
")"
] | https://github.com/epam/Indigo/blob/30e40b4b1eb9bae0207435a26cfcb81ddcc42be1/api/python/indigo/__init__.py#L881-L890 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/layers/python/layers/feature_column.py | python | real_valued_column | (column_name,
dimension=1,
default_value=None,
dtype=dtypes.float32,
normalizer=None) | Creates a `_RealValuedColumn` for dense numeric data.
Args:
column_name: A string defining real valued column name.
dimension: An integer specifying dimension of the real valued column. The
default is 1.
default_value: A single value compatible with dtype or a list of values
compatible with d... | Creates a `_RealValuedColumn` for dense numeric data. | [
"Creates",
"a",
"_RealValuedColumn",
"for",
"dense",
"numeric",
"data",
"."
] | def real_valued_column(column_name,
dimension=1,
default_value=None,
dtype=dtypes.float32,
normalizer=None):
"""Creates a `_RealValuedColumn` for dense numeric data.
Args:
column_name: A string defining real valued colu... | [
"def",
"real_valued_column",
"(",
"column_name",
",",
"dimension",
"=",
"1",
",",
"default_value",
"=",
"None",
",",
"dtype",
"=",
"dtypes",
".",
"float32",
",",
"normalizer",
"=",
"None",
")",
":",
"if",
"dimension",
"is",
"None",
":",
"raise",
"TypeError... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/layers/python/layers/feature_column.py#L1922-L2034 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/examples/learn/text_classification.py | python | rnn_model | (features, labels, mode) | return estimator_spec_for_softmax_classification(
logits=logits, labels=labels, mode=mode) | RNN model to predict from sequence of words to a class. | RNN model to predict from sequence of words to a class. | [
"RNN",
"model",
"to",
"predict",
"from",
"sequence",
"of",
"words",
"to",
"a",
"class",
"."
] | def rnn_model(features, labels, mode):
"""RNN model to predict from sequence of words to a class."""
# Convert indexes of words into embeddings.
# This creates embeddings matrix of [n_words, EMBEDDING_SIZE] and then
# maps word indexes of the sequence into [batch_size, sequence_length,
# EMBEDDING_SIZE].
wo... | [
"def",
"rnn_model",
"(",
"features",
",",
"labels",
",",
"mode",
")",
":",
"# Convert indexes of words into embeddings.",
"# This creates embeddings matrix of [n_words, EMBEDDING_SIZE] and then",
"# maps word indexes of the sequence into [batch_size, sequence_length,",
"# EMBEDDING_SIZE]."... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/examples/learn/text_classification.py#L80-L105 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/pkg_resources/_vendor/packaging/specifiers.py | python | BaseSpecifier.__eq__ | (self, other) | Returns a boolean representing whether or not the two Specifier like
objects are equal. | Returns a boolean representing whether or not the two Specifier like
objects are equal. | [
"Returns",
"a",
"boolean",
"representing",
"whether",
"or",
"not",
"the",
"two",
"Specifier",
"like",
"objects",
"are",
"equal",
"."
] | def __eq__(self, other):
"""
Returns a boolean representing whether or not the two Specifier like
objects are equal.
""" | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/pkg_resources/_vendor/packaging/specifiers.py#L37-L41 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/mapreduce/mapreduce/input_readers.py | python | _OldAbstractDatastoreInputReader._choose_split_points | (cls, sorted_keys, shard_count) | return [sorted_keys[int(round(index_stride * i))]
for i in range(1, shard_count)] | Returns the best split points given a random set of db.Keys. | Returns the best split points given a random set of db.Keys. | [
"Returns",
"the",
"best",
"split",
"points",
"given",
"a",
"random",
"set",
"of",
"db",
".",
"Keys",
"."
] | def _choose_split_points(cls, sorted_keys, shard_count):
"""Returns the best split points given a random set of db.Keys."""
assert len(sorted_keys) >= shard_count
index_stride = len(sorted_keys) / float(shard_count)
return [sorted_keys[int(round(index_stride * i))]
for i in range(1, shard_co... | [
"def",
"_choose_split_points",
"(",
"cls",
",",
"sorted_keys",
",",
"shard_count",
")",
":",
"assert",
"len",
"(",
"sorted_keys",
")",
">=",
"shard_count",
"index_stride",
"=",
"len",
"(",
"sorted_keys",
")",
"/",
"float",
"(",
"shard_count",
")",
"return",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/mapreduce/mapreduce/input_readers.py#L972-L977 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/io/json/_normalize.py | python | nested_to_record | (
ds,
prefix: str = "",
sep: str = ".",
level: int = 0,
max_level: int | None = None,
) | return new_ds | A simplified json_normalize
Converts a nested dict into a flat dict ("record"), unlike json_normalize,
it does not attempt to extract a subset of the data.
Parameters
----------
ds : dict or list of dicts
prefix: the prefix, optional, default: ""
sep : str, default '.'
Nested recor... | A simplified json_normalize | [
"A",
"simplified",
"json_normalize"
] | def nested_to_record(
ds,
prefix: str = "",
sep: str = ".",
level: int = 0,
max_level: int | None = None,
):
"""
A simplified json_normalize
Converts a nested dict into a flat dict ("record"), unlike json_normalize,
it does not attempt to extract a subset of the data.
Parameter... | [
"def",
"nested_to_record",
"(",
"ds",
",",
"prefix",
":",
"str",
"=",
"\"\"",
",",
"sep",
":",
"str",
"=",
"\".\"",
",",
"level",
":",
"int",
"=",
"0",
",",
"max_level",
":",
"int",
"|",
"None",
"=",
"None",
",",
")",
":",
"singleton",
"=",
"Fals... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/json/_normalize.py#L39-L119 | |
openthread/openthread | 9fcdbed9c526c70f1556d1ed84099c1535c7cd32 | tools/otci/otci/otci.py | python | OTCI.get_commissioner_session_id | (self) | return self.__parse_int(self.execute_command('commissioner sessionid')) | Get current commissioner session id. | Get current commissioner session id. | [
"Get",
"current",
"commissioner",
"session",
"id",
"."
] | def get_commissioner_session_id(self) -> int:
"""Get current commissioner session id."""
return self.__parse_int(self.execute_command('commissioner sessionid')) | [
"def",
"get_commissioner_session_id",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"__parse_int",
"(",
"self",
".",
"execute_command",
"(",
"'commissioner sessionid'",
")",
")"
] | https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/tools/otci/otci/otci.py#L1439-L1441 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | CommandEvent.SetInt | (*args, **kwargs) | return _core_.CommandEvent_SetInt(*args, **kwargs) | SetInt(self, int i) | SetInt(self, int i) | [
"SetInt",
"(",
"self",
"int",
"i",
")"
] | def SetInt(*args, **kwargs):
"""SetInt(self, int i)"""
return _core_.CommandEvent_SetInt(*args, **kwargs) | [
"def",
"SetInt",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"CommandEvent_SetInt",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L5273-L5275 | |
PaddlePaddle/Anakin | 5fd68a6cc4c4620cd1a30794c1bf06eebd3f4730 | tools/external_converter_v2/parser/onnx/onnx_trans_utils.py | python | parse_ImageScaler | (onnx_node, weights, graph) | parse ImageScaler
:param onnx_node:
:param weights:
:param graph:
:return: | parse ImageScaler
:param onnx_node:
:param weights:
:param graph:
:return: | [
"parse",
"ImageScaler",
":",
"param",
"onnx_node",
":",
":",
"param",
"weights",
":",
":",
"param",
"graph",
":",
":",
"return",
":"
] | def parse_ImageScaler(onnx_node, weights, graph):
"""
parse ImageScaler
:param onnx_node:
:param weights:
:param graph:
:return:
"""
onnx_node['visited'] = True
onnx_node['ak_type'] = 'Scale'
ak_attr = onnx_node['ak_attr']
scale_val = onnx_node['onnx_attr']['scale']
shap... | [
"def",
"parse_ImageScaler",
"(",
"onnx_node",
",",
"weights",
",",
"graph",
")",
":",
"onnx_node",
"[",
"'visited'",
"]",
"=",
"True",
"onnx_node",
"[",
"'ak_type'",
"]",
"=",
"'Scale'",
"ak_attr",
"=",
"onnx_node",
"[",
"'ak_attr'",
"]",
"scale_val",
"=",
... | https://github.com/PaddlePaddle/Anakin/blob/5fd68a6cc4c4620cd1a30794c1bf06eebd3f4730/tools/external_converter_v2/parser/onnx/onnx_trans_utils.py#L1104-L1140 | ||
google/clif | cab24d6a105609a65c95a36a1712ae3c20c7b5df | clif/python/pyext.py | python | Module._WrapAllCallables | (self, c, cname, ln, class_ns, only_pyobjas) | Recursively process callable returns and params types of AST.Type c. | Recursively process callable returns and params types of AST.Type c. | [
"Recursively",
"process",
"callable",
"returns",
"and",
"params",
"types",
"of",
"AST",
".",
"Type",
"c",
"."
] | def _WrapAllCallables(self, c, cname, ln, class_ns, only_pyobjas):
"""Recursively process callable returns and params types of AST.Type c."""
for i, r in enumerate(c.returns):
if r.type.HasField('callable'):
for s in self.WrapOneCallable(
r.type, cname, 'ret%d' % i, ln, class_ns, only_... | [
"def",
"_WrapAllCallables",
"(",
"self",
",",
"c",
",",
"cname",
",",
"ln",
",",
"class_ns",
",",
"only_pyobjas",
")",
":",
"for",
"i",
",",
"r",
"in",
"enumerate",
"(",
"c",
".",
"returns",
")",
":",
"if",
"r",
".",
"type",
".",
"HasField",
"(",
... | https://github.com/google/clif/blob/cab24d6a105609a65c95a36a1712ae3c20c7b5df/clif/python/pyext.py#L294-L305 | ||
GJDuck/LowFat | ecf6a0f0fa1b73a27a626cf493cc39e477b6faea | llvm-4.0.0.src/tools/clang/bindings/python/clang/cindex.py | python | Cursor.enum_value | (self) | return self._enum_value | Return the value of an enum constant. | Return the value of an enum constant. | [
"Return",
"the",
"value",
"of",
"an",
"enum",
"constant",
"."
] | def enum_value(self):
"""Return the value of an enum constant."""
if not hasattr(self, '_enum_value'):
assert self.kind == CursorKind.ENUM_CONSTANT_DECL
# Figure out the underlying type of the enum to know if it
# is a signed or unsigned quantity.
underlyi... | [
"def",
"enum_value",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_enum_value'",
")",
":",
"assert",
"self",
".",
"kind",
"==",
"CursorKind",
".",
"ENUM_CONSTANT_DECL",
"# Figure out the underlying type of the enum to know if it",
"# is a signed ... | https://github.com/GJDuck/LowFat/blob/ecf6a0f0fa1b73a27a626cf493cc39e477b6faea/llvm-4.0.0.src/tools/clang/bindings/python/clang/cindex.py#L1562-L1584 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/propgrid.py | python | PropertyGrid.Create | (*args, **kwargs) | return _propgrid.PropertyGrid_Create(*args, **kwargs) | Create(self, Window parent, int id=ID_ANY, Point pos=DefaultPosition,
Size size=DefaultSize, long style=(0),
String name=wxPropertyGridNameStr) -> bool | Create(self, Window parent, int id=ID_ANY, Point pos=DefaultPosition,
Size size=DefaultSize, long style=(0),
String name=wxPropertyGridNameStr) -> bool | [
"Create",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"ID_ANY",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"(",
"0",
")",
"String",
"name",
"=",
"wxPropertyGridNameStr",
")",
"-",
">",
"bool"
] | def Create(*args, **kwargs):
"""
Create(self, Window parent, int id=ID_ANY, Point pos=DefaultPosition,
Size size=DefaultSize, long style=(0),
String name=wxPropertyGridNameStr) -> bool
"""
return _propgrid.PropertyGrid_Create(*args, **kwargs) | [
"def",
"Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGrid_Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L2011-L2017 | |
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/pyedbglib/protocols/avr8protocol.py | python | Avr8Protocol.regfile_write | (self, data) | return self.memory_write(self.AVR8_MEMTYPE_REGFILE, 0, data) | Writes the AVR registe file (R0::R31)
:param data: register array
:return: | Writes the AVR registe file (R0::R31) | [
"Writes",
"the",
"AVR",
"registe",
"file",
"(",
"R0",
"::",
"R31",
")"
] | def regfile_write(self, data):
"""
Writes the AVR registe file (R0::R31)
:param data: register array
:return:
"""
if len(data) != 32:
raise ValueError("Invalid data length for regfile")
self.logger.debug("Writing register file")
return self.me... | [
"def",
"regfile_write",
"(",
"self",
",",
"data",
")",
":",
"if",
"len",
"(",
"data",
")",
"!=",
"32",
":",
"raise",
"ValueError",
"(",
"\"Invalid data length for regfile\"",
")",
"self",
".",
"logger",
".",
"debug",
"(",
"\"Writing register file\"",
")",
"r... | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/pyedbglib/protocols/avr8protocol.py#L444-L454 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/utils/subprocess.py | python | runner_with_spinner_message | (message) | return runner | Provide a subprocess_runner that shows a spinner message.
Intended for use with for pep517's Pep517HookCaller. Thus, the runner has
an API that matches what's expected by Pep517HookCaller.subprocess_runner. | Provide a subprocess_runner that shows a spinner message. | [
"Provide",
"a",
"subprocess_runner",
"that",
"shows",
"a",
"spinner",
"message",
"."
] | def runner_with_spinner_message(message):
# type: (str) -> Callable[..., None]
"""Provide a subprocess_runner that shows a spinner message.
Intended for use with for pep517's Pep517HookCaller. Thus, the runner has
an API that matches what's expected by Pep517HookCaller.subprocess_runner.
"""
... | [
"def",
"runner_with_spinner_message",
"(",
"message",
")",
":",
"# type: (str) -> Callable[..., None]",
"def",
"runner",
"(",
"cmd",
",",
"# type: List[str]",
"cwd",
"=",
"None",
",",
"# type: Optional[str]",
"extra_environ",
"=",
"None",
"# type: Optional[Mapping[str, Any]... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/utils/subprocess.py#L547-L591 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.