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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/polynomial/laguerre.py | python | lagfromroots | (roots) | Generate a Laguerre series with given roots.
The function returns the coefficients of the polynomial
.. math:: p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n),
in Laguerre form, where the `r_n` are the roots specified in `roots`.
If a zero has multiplicity n, then it must appear in `roots` n times.
... | Generate a Laguerre series with given roots. | [
"Generate",
"a",
"Laguerre",
"series",
"with",
"given",
"roots",
"."
] | def lagfromroots(roots):
"""
Generate a Laguerre series with given roots.
The function returns the coefficients of the polynomial
.. math:: p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n),
in Laguerre form, where the `r_n` are the roots specified in `roots`.
If a zero has multiplicity n, then ... | [
"def",
"lagfromroots",
"(",
"roots",
")",
":",
"if",
"len",
"(",
"roots",
")",
"==",
"0",
":",
"return",
"np",
".",
"ones",
"(",
"1",
")",
"else",
":",
"[",
"roots",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"roots",
"]",
",",
"trim",
"=",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/polynomial/laguerre.py#L236-L300 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/lmbrwaflib/android.py | python | apply_android | (self) | Generates the code generation task (produces R.java) and setups the task chaining
for AIDL, Java and the code gen task | Generates the code generation task (produces R.java) and setups the task chaining
for AIDL, Java and the code gen task | [
"Generates",
"the",
"code",
"generation",
"task",
"(",
"produces",
"R",
".",
"java",
")",
"and",
"setups",
"the",
"task",
"chaining",
"for",
"AIDL",
"Java",
"and",
"the",
"code",
"gen",
"task"
] | def apply_android(self):
"""
Generates the code generation task (produces R.java) and setups the task chaining
for AIDL, Java and the code gen task
"""
Utils.def_attrs(
self,
classpath = [],
aapt_resources = [],
aapt_includes = [],
aapt_extra_packages = [],... | [
"def",
"apply_android",
"(",
"self",
")",
":",
"Utils",
".",
"def_attrs",
"(",
"self",
",",
"classpath",
"=",
"[",
"]",
",",
"aapt_resources",
"=",
"[",
"]",
",",
"aapt_includes",
"=",
"[",
"]",
",",
"aapt_extra_packages",
"=",
"[",
"]",
",",
"aapt_pac... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/lmbrwaflib/android.py#L1986-L2098 | ||
bigartm/bigartm | 47e37f982de87aa67bfd475ff1f39da696b181b3 | 3rdparty/protobuf-3.0.0/python/google/protobuf/internal/decoder.py | python | _SkipVarint | (buffer, pos, end) | return pos | Skip a varint value. Returns the new position. | Skip a varint value. Returns the new position. | [
"Skip",
"a",
"varint",
"value",
".",
"Returns",
"the",
"new",
"position",
"."
] | def _SkipVarint(buffer, pos, end):
"""Skip a varint value. Returns the new position."""
# Previously ord(buffer[pos]) raised IndexError when pos is out of range.
# With this code, ord(b'') raises TypeError. Both are handled in
# python_message.py to generate a 'Truncated message' error.
while ord(buffer[pos... | [
"def",
"_SkipVarint",
"(",
"buffer",
",",
"pos",
",",
"end",
")",
":",
"# Previously ord(buffer[pos]) raised IndexError when pos is out of range.",
"# With this code, ord(b'') raises TypeError. Both are handled in",
"# python_message.py to generate a 'Truncated message' error.",
"while",
... | https://github.com/bigartm/bigartm/blob/47e37f982de87aa67bfd475ff1f39da696b181b3/3rdparty/protobuf-3.0.0/python/google/protobuf/internal/decoder.py#L765-L775 | |
facebook/watchman | 0917460c71b000b96be9b9575d77f06f2f6053bb | build/fbcode_builder/getdeps/subcmd.py | python | SubCmd.run | (self, args) | return 0 | perform the command | perform the command | [
"perform",
"the",
"command"
] | def run(self, args):
"""perform the command"""
return 0 | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"return",
"0"
] | https://github.com/facebook/watchman/blob/0917460c71b000b96be9b9575d77f06f2f6053bb/build/fbcode_builder/getdeps/subcmd.py#L11-L13 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/configparser.py | python | RawConfigParser.read | (self, filenames, encoding=None) | return read_ok | Read and parse a filename or an iterable of filenames.
Files that cannot be opened are silently ignored; this is
designed so that you can specify an iterable of potential
configuration file locations (e.g. current directory, user's
home directory, systemwide directory), and all existing... | Read and parse a filename or an iterable of filenames. | [
"Read",
"and",
"parse",
"a",
"filename",
"or",
"an",
"iterable",
"of",
"filenames",
"."
] | def read(self, filenames, encoding=None):
"""Read and parse a filename or an iterable of filenames.
Files that cannot be opened are silently ignored; this is
designed so that you can specify an iterable of potential
configuration file locations (e.g. current directory, user's
ho... | [
"def",
"read",
"(",
"self",
",",
"filenames",
",",
"encoding",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"filenames",
",",
"(",
"str",
",",
"bytes",
",",
"os",
".",
"PathLike",
")",
")",
":",
"filenames",
"=",
"[",
"filenames",
"]",
"read_ok",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/configparser.py#L678-L702 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | qa/tasks/cephfs/filesystem.py | python | Filesystem.data_scan | (self, args, quiet=False, worker_count=1) | Invoke cephfs-data-scan with the passed arguments, and return its stdout
:param worker_count: if greater than 1, multiple workers will be run
in parallel and the return value will be None | Invoke cephfs-data-scan with the passed arguments, and return its stdout | [
"Invoke",
"cephfs",
"-",
"data",
"-",
"scan",
"with",
"the",
"passed",
"arguments",
"and",
"return",
"its",
"stdout"
] | def data_scan(self, args, quiet=False, worker_count=1):
"""
Invoke cephfs-data-scan with the passed arguments, and return its stdout
:param worker_count: if greater than 1, multiple workers will be run
in parallel and the return value will be None
"""
... | [
"def",
"data_scan",
"(",
"self",
",",
"args",
",",
"quiet",
"=",
"False",
",",
"worker_count",
"=",
"1",
")",
":",
"workers",
"=",
"[",
"]",
"for",
"n",
"in",
"range",
"(",
"0",
",",
"worker_count",
")",
":",
"if",
"worker_count",
">",
"1",
":",
... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/qa/tasks/cephfs/filesystem.py#L1518-L1546 | ||
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | interpreter/llvm/src/examples/Kaleidoscope/MCJIT/cached/split-lib.py | python | TimingScriptGenerator.writeTimingCall | (self, irname, callname) | Echo some comments and invoke both versions of toy | Echo some comments and invoke both versions of toy | [
"Echo",
"some",
"comments",
"and",
"invoke",
"both",
"versions",
"of",
"toy"
] | def writeTimingCall(self, irname, callname):
"""Echo some comments and invoke both versions of toy"""
rootname = irname
if '.' in irname:
rootname = irname[:irname.rfind('.')]
self.shfile.write("echo \"%s: Calls %s\" >> %s\n" % (callname, irname, self.timeFile))
self.... | [
"def",
"writeTimingCall",
"(",
"self",
",",
"irname",
",",
"callname",
")",
":",
"rootname",
"=",
"irname",
"if",
"'.'",
"in",
"irname",
":",
"rootname",
"=",
"irname",
"[",
":",
"irname",
".",
"rfind",
"(",
"'.'",
")",
"]",
"self",
".",
"shfile",
".... | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/interpreter/llvm/src/examples/Kaleidoscope/MCJIT/cached/split-lib.py#L12-L34 | ||
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | lldb/third_party/Python/module/pexpect-4.6/pexpect/replwrap.py | python | python | (command="python") | return REPLWrapper(command, u">>> ", u"import sys; sys.ps1={0!r}; sys.ps2={1!r}") | Start a Python shell and return a :class:`REPLWrapper` object. | Start a Python shell and return a :class:`REPLWrapper` object. | [
"Start",
"a",
"Python",
"shell",
"and",
"return",
"a",
":",
"class",
":",
"REPLWrapper",
"object",
"."
] | def python(command="python"):
"""Start a Python shell and return a :class:`REPLWrapper` object."""
return REPLWrapper(command, u">>> ", u"import sys; sys.ps1={0!r}; sys.ps2={1!r}") | [
"def",
"python",
"(",
"command",
"=",
"\"python\"",
")",
":",
"return",
"REPLWrapper",
"(",
"command",
",",
"u\">>> \"",
",",
"u\"import sys; sys.ps1={0!r}; sys.ps2={1!r}\"",
")"
] | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/lldb/third_party/Python/module/pexpect-4.6/pexpect/replwrap.py#L103-L105 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Object.IsSameAs | (*args, **kwargs) | return _core_.Object_IsSameAs(*args, **kwargs) | IsSameAs(self, Object p) -> bool
For wx.Objects that use C++ reference counting internally, this method
can be used to determine if two objects are referencing the same data
object. | IsSameAs(self, Object p) -> bool | [
"IsSameAs",
"(",
"self",
"Object",
"p",
")",
"-",
">",
"bool"
] | def IsSameAs(*args, **kwargs):
"""
IsSameAs(self, Object p) -> bool
For wx.Objects that use C++ reference counting internally, this method
can be used to determine if two objects are referencing the same data
object.
"""
return _core_.Object_IsSameAs(*args, **kwa... | [
"def",
"IsSameAs",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Object_IsSameAs",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L821-L829 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/concurrent/futures/_base.py | python | Future.add_done_callback | (self, fn) | Attaches a callable that will be called when the future finishes.
Args:
fn: A callable that will be called with this future as its only
argument when the future completes or is cancelled. The callable
will always be called by a thread in the same process in which
... | Attaches a callable that will be called when the future finishes. | [
"Attaches",
"a",
"callable",
"that",
"will",
"be",
"called",
"when",
"the",
"future",
"finishes",
"."
] | def add_done_callback(self, fn):
"""Attaches a callable that will be called when the future finishes.
Args:
fn: A callable that will be called with this future as its only
argument when the future completes or is cancelled. The callable
will always be called ... | [
"def",
"add_done_callback",
"(",
"self",
",",
"fn",
")",
":",
"with",
"self",
".",
"_condition",
":",
"if",
"self",
".",
"_state",
"not",
"in",
"[",
"CANCELLED",
",",
"CANCELLED_AND_NOTIFIED",
",",
"FINISHED",
"]",
":",
"self",
".",
"_done_callbacks",
".",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/concurrent/futures/_base.py#L398-L416 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/groupby/groupby.py | python | GroupBy.expanding | (self, *args, **kwargs) | return ExpandingGroupby(self, *args, **kwargs) | Return an expanding grouper, providing expanding
functionality per group. | Return an expanding grouper, providing expanding
functionality per group. | [
"Return",
"an",
"expanding",
"grouper",
"providing",
"expanding",
"functionality",
"per",
"group",
"."
] | def expanding(self, *args, **kwargs):
"""
Return an expanding grouper, providing expanding
functionality per group.
"""
from pandas.core.window import ExpandingGroupby
return ExpandingGroupby(self, *args, **kwargs) | [
"def",
"expanding",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"pandas",
".",
"core",
".",
"window",
"import",
"ExpandingGroupby",
"return",
"ExpandingGroupby",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/groupby/groupby.py#L1449-L1455 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/google/protobuf-py/mox.py | python | MultipleTimesGroup.IsSatisfied | (self) | return False | Return True if all methods in this group are called at least once. | Return True if all methods in this group are called at least once. | [
"Return",
"True",
"if",
"all",
"methods",
"in",
"this",
"group",
"are",
"called",
"at",
"least",
"once",
"."
] | def IsSatisfied(self):
"""Return True if all methods in this group are called at least once."""
# NOTE(psycho): We can't use the simple set difference here because we want
# to match different parameters which are considered the same e.g. IsA(str)
# and some string. This solution is O(n^2) but n should ... | [
"def",
"IsSatisfied",
"(",
"self",
")",
":",
"# NOTE(psycho): We can't use the simple set difference here because we want",
"# to match different parameters which are considered the same e.g. IsA(str)",
"# and some string. This solution is O(n^2) but n should be small.",
"tmp",
"=",
"self",
... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/google/protobuf-py/mox.py#L1318-L1331 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/external/bazel_tools/third_party/py/concurrent/futures/_base.py | python | Future.set_running_or_notify_cancel | (self) | Mark the future as running or process any cancel notifications.
Should only be used by Executor implementations and unit tests.
If the future has been cancelled (cancel() was called and returned
True) then any threads waiting on the future completing (though calls
to as_completed() or ... | Mark the future as running or process any cancel notifications. | [
"Mark",
"the",
"future",
"as",
"running",
"or",
"process",
"any",
"cancel",
"notifications",
"."
] | def set_running_or_notify_cancel(self):
"""Mark the future as running or process any cancel notifications.
Should only be used by Executor implementations and unit tests.
If the future has been cancelled (cancel() was called and returned
True) then any threads waiting on the future com... | [
"def",
"set_running_or_notify_cancel",
"(",
"self",
")",
":",
"with",
"self",
".",
"_condition",
":",
"if",
"self",
".",
"_state",
"==",
"CANCELLED",
":",
"self",
".",
"_state",
"=",
"CANCELLED_AND_NOTIFIED",
"for",
"waiter",
"in",
"self",
".",
"_waiters",
"... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/external/bazel_tools/third_party/py/concurrent/futures/_base.py#L443-L481 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/html.py | python | HtmlCell.SetNext | (*args, **kwargs) | return _html.HtmlCell_SetNext(*args, **kwargs) | SetNext(self, HtmlCell cell) | SetNext(self, HtmlCell cell) | [
"SetNext",
"(",
"self",
"HtmlCell",
"cell",
")"
] | def SetNext(*args, **kwargs):
"""SetNext(self, HtmlCell cell)"""
return _html.HtmlCell_SetNext(*args, **kwargs) | [
"def",
"SetNext",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlCell_SetNext",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/html.py#L670-L672 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBDeclaration.GetDescription | (self, description) | return _lldb.SBDeclaration_GetDescription(self, description) | GetDescription(SBDeclaration self, SBStream description) -> bool | GetDescription(SBDeclaration self, SBStream description) -> bool | [
"GetDescription",
"(",
"SBDeclaration",
"self",
"SBStream",
"description",
")",
"-",
">",
"bool"
] | def GetDescription(self, description):
"""GetDescription(SBDeclaration self, SBStream description) -> bool"""
return _lldb.SBDeclaration_GetDescription(self, description) | [
"def",
"GetDescription",
"(",
"self",
",",
"description",
")",
":",
"return",
"_lldb",
".",
"SBDeclaration_GetDescription",
"(",
"self",
",",
"description",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L4454-L4456 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PolDiffILLReduction.py | python | PolDiffILLReduction._load_and_prepare_data | (self, measurement_technique, process, progress) | return ws, progress | Loads the data, sets the instrument, and runs function to check the measurement method. In the case
of a single crystal measurement, it also merges the omega scan data into one workspace per polarisation
orientation. | Loads the data, sets the instrument, and runs function to check the measurement method. In the case
of a single crystal measurement, it also merges the omega scan data into one workspace per polarisation
orientation. | [
"Loads",
"the",
"data",
"sets",
"the",
"instrument",
"and",
"runs",
"function",
"to",
"check",
"the",
"measurement",
"method",
".",
"In",
"the",
"case",
"of",
"a",
"single",
"crystal",
"measurement",
"it",
"also",
"merges",
"the",
"omega",
"scan",
"data",
... | def _load_and_prepare_data(self, measurement_technique, process, progress):
"""Loads the data, sets the instrument, and runs function to check the measurement method. In the case
of a single crystal measurement, it also merges the omega scan data into one workspace per polarisation
orientation."... | [
"def",
"_load_and_prepare_data",
"(",
"self",
",",
"measurement_technique",
",",
"process",
",",
"progress",
")",
":",
"ws",
"=",
"'__'",
"+",
"self",
".",
"getPropertyValue",
"(",
"'OutputWorkspace'",
")",
"calibration_setting",
"=",
"'YIGFile'",
"if",
"self",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PolDiffILLReduction.py#L526-L564 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/fastparquet/api.py | python | statistics | (obj) | Return per-column statistics for a ParquerFile
Parameters
----------
obj: ParquetFile
Returns
-------
dictionary mapping stats (min, max, distinct_count, null_count) to column
names to lists of values. ``None``s used if no statistics found.
Examples
--------
>>> statistics(my... | Return per-column statistics for a ParquerFile | [
"Return",
"per",
"-",
"column",
"statistics",
"for",
"a",
"ParquerFile"
] | def statistics(obj):
"""
Return per-column statistics for a ParquerFile
Parameters
----------
obj: ParquetFile
Returns
-------
dictionary mapping stats (min, max, distinct_count, null_count) to column
names to lists of values. ``None``s used if no statistics found.
Examples
... | [
"def",
"statistics",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"parquet_thrift",
".",
"ColumnChunk",
")",
":",
"md",
"=",
"obj",
".",
"meta_data",
"s",
"=",
"obj",
".",
"meta_data",
".",
"statistics",
"rv",
"=",
"{",
"}",
"if",
"not"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/fastparquet/api.py#L675-L755 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/probability/distribution/gumbel.py | python | Gumbel._log_prob | (self, value) | return -(z + self.exp(-z)) - self.log(self.scale) | r"""
.. math::
log_pdf(X) = -(z + \exp(-z)) - \log(scale)
where z = \frac{x - loc}{scale} | r"""
.. math::
log_pdf(X) = -(z + \exp(-z)) - \log(scale)
where z = \frac{x - loc}{scale} | [
"r",
"..",
"math",
"::",
"log_pdf",
"(",
"X",
")",
"=",
"-",
"(",
"z",
"+",
"\\",
"exp",
"(",
"-",
"z",
"))",
"-",
"\\",
"log",
"(",
"scale",
")",
"where",
"z",
"=",
"\\",
"frac",
"{",
"x",
"-",
"loc",
"}",
"{",
"scale",
"}"
] | def _log_prob(self, value):
r"""
.. math::
log_pdf(X) = -(z + \exp(-z)) - \log(scale)
where z = \frac{x - loc}{scale}
"""
value = self._check_value(value, 'value')
value = self.cast(value, self.dtype)
z = (value - self.loc) / self.scale
... | [
"def",
"_log_prob",
"(",
"self",
",",
"value",
")",
":",
"value",
"=",
"self",
".",
"_check_value",
"(",
"value",
",",
"'value'",
")",
"value",
"=",
"self",
".",
"cast",
"(",
"value",
",",
"self",
".",
"dtype",
")",
"z",
"=",
"(",
"value",
"-",
"... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/probability/distribution/gumbel.py#L199-L208 | |
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/qcdb/dbwrap.py | python | oxcom | (lst) | Returns gramatical comma separated string of *lst*. | Returns gramatical comma separated string of *lst*. | [
"Returns",
"gramatical",
"comma",
"separated",
"string",
"of",
"*",
"lst",
"*",
"."
] | def oxcom(lst):
"""Returns gramatical comma separated string of *lst*."""
lst = [str(l) for l in lst]
if not lst:
return ''
elif len(lst) == 1:
return lst[0]
elif len(lst) == 2:
return ' and '.join(lst)
else:
return ', and '.join([', '.join(lst[:-1]), lst[-1]]) | [
"def",
"oxcom",
"(",
"lst",
")",
":",
"lst",
"=",
"[",
"str",
"(",
"l",
")",
"for",
"l",
"in",
"lst",
"]",
"if",
"not",
"lst",
":",
"return",
"''",
"elif",
"len",
"(",
"lst",
")",
"==",
"1",
":",
"return",
"lst",
"[",
"0",
"]",
"elif",
"len... | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/qcdb/dbwrap.py#L218-L229 | ||
apache/parquet-cpp | 642da055adf009652689b20e68a198cffb857651 | build-support/cpplint.py | python | NestingState.UpdatePreprocessor | (self, line) | Update preprocessor stack.
We need to handle preprocessors due to classes like this:
#ifdef SWIG
struct ResultDetailsPageElementExtensionPoint {
#else
struct ResultDetailsPageElementExtensionPoint : public Extension {
#endif
We make the following assumptions (good enough for most... | Update preprocessor stack. | [
"Update",
"preprocessor",
"stack",
"."
] | def UpdatePreprocessor(self, line):
"""Update preprocessor stack.
We need to handle preprocessors due to classes like this:
#ifdef SWIG
struct ResultDetailsPageElementExtensionPoint {
#else
struct ResultDetailsPageElementExtensionPoint : public Extension {
#endif
We make the ... | [
"def",
"UpdatePreprocessor",
"(",
"self",
",",
"line",
")",
":",
"if",
"Match",
"(",
"r'^\\s*#\\s*(if|ifdef|ifndef)\\b'",
",",
"line",
")",
":",
"# Beginning of #if block, save the nesting stack here. The saved",
"# stack will allow us to restore the parsing state in the #else cas... | https://github.com/apache/parquet-cpp/blob/642da055adf009652689b20e68a198cffb857651/build-support/cpplint.py#L2318-L2372 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/tensor_forest/data/data_ops.py | python | ParseLabelTensorOrDict | (labels) | Return a tensor to use for input labels to tensor_forest.
The incoming targets can be a dict where keys are the string names of the
columns, which we turn into a single 1-D tensor for classification or
2-D tensor for regression.
Converts sparse tensors to dense ones.
Args:
labels: `Tensor` or `dict` of... | Return a tensor to use for input labels to tensor_forest. | [
"Return",
"a",
"tensor",
"to",
"use",
"for",
"input",
"labels",
"to",
"tensor_forest",
"."
] | def ParseLabelTensorOrDict(labels):
"""Return a tensor to use for input labels to tensor_forest.
The incoming targets can be a dict where keys are the string names of the
columns, which we turn into a single 1-D tensor for classification or
2-D tensor for regression.
Converts sparse tensors to dense ones.
... | [
"def",
"ParseLabelTensorOrDict",
"(",
"labels",
")",
":",
"if",
"isinstance",
"(",
"labels",
",",
"dict",
")",
":",
"return",
"math_ops",
".",
"to_float",
"(",
"array_ops",
".",
"concat",
"(",
"1",
",",
"[",
"sparse_ops",
".",
"sparse_tensor_to_dense",
"(",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/tensor_forest/data/data_ops.py#L194-L219 | ||
fatih/subvim | 241b6d170597857105da219c9b7d36059e9f11fb | vim/base/YouCompleteMe/third_party/requests/requests/cookies.py | python | RequestsCookieJar.values | (self) | return values | Dict-like values() that returns a list of values of cookies from the jar.
See keys() and items(). | Dict-like values() that returns a list of values of cookies from the jar.
See keys() and items(). | [
"Dict",
"-",
"like",
"values",
"()",
"that",
"returns",
"a",
"list",
"of",
"values",
"of",
"cookies",
"from",
"the",
"jar",
".",
"See",
"keys",
"()",
"and",
"items",
"()",
"."
] | def values(self):
"""Dict-like values() that returns a list of values of cookies from the jar.
See keys() and items()."""
values = []
for cookie in iter(self):
values.append(cookie.value)
return values | [
"def",
"values",
"(",
"self",
")",
":",
"values",
"=",
"[",
"]",
"for",
"cookie",
"in",
"iter",
"(",
"self",
")",
":",
"values",
".",
"append",
"(",
"cookie",
".",
"value",
")",
"return",
"values"
] | https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/requests/requests/cookies.py#L198-L204 | |
cybermaggedon/cyberprobe | f826dbc35ad3a79019cb871c0bc3fb1236130b3e | indicators/cyberprobe/fsm.py | python | FsmState.is_fail | (self) | return self.state == 'fail' | True if FSM state has reached 'fail' | True if FSM state has reached 'fail' | [
"True",
"if",
"FSM",
"state",
"has",
"reached",
"fail"
] | def is_fail(self):
"""
True if FSM state has reached 'fail'
"""
return self.state == 'fail' | [
"def",
"is_fail",
"(",
"self",
")",
":",
"return",
"self",
".",
"state",
"==",
"'fail'"
] | https://github.com/cybermaggedon/cyberprobe/blob/f826dbc35ad3a79019cb871c0bc3fb1236130b3e/indicators/cyberprobe/fsm.py#L138-L142 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.WriteWinIdlFiles | (self, spec, prebuild) | return outputs | Writes rules to match MSVS's implicit idl handling. | Writes rules to match MSVS's implicit idl handling. | [
"Writes",
"rules",
"to",
"match",
"MSVS",
"s",
"implicit",
"idl",
"handling",
"."
] | def WriteWinIdlFiles(self, spec, prebuild):
"""Writes rules to match MSVS's implicit idl handling."""
assert self.flavor == 'win'
if self.msvs_settings.HasExplicitIdlRules(spec):
return []
outputs = []
for source in filter(lambda x: x.endswith('.idl'), spec['sources']):
self._WinIdlRule(... | [
"def",
"WriteWinIdlFiles",
"(",
"self",
",",
"spec",
",",
"prebuild",
")",
":",
"assert",
"self",
".",
"flavor",
"==",
"'win'",
"if",
"self",
".",
"msvs_settings",
".",
"HasExplicitIdlRules",
"(",
"spec",
")",
":",
"return",
"[",
"]",
"outputs",
"=",
"["... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/ninja.py#L486-L494 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/states.py | python | Body.line_block | (self, match, context, next_state) | return [], next_state, [] | First line of a line block. | First line of a line block. | [
"First",
"line",
"of",
"a",
"line",
"block",
"."
] | def line_block(self, match, context, next_state):
"""First line of a line block."""
block = nodes.line_block()
self.parent += block
lineno = self.state_machine.abs_line_number()
line, messages, blank_finish = self.line_block_line(match, lineno)
block += line
self.... | [
"def",
"line_block",
"(",
"self",
",",
"match",
",",
"context",
",",
"next_state",
")",
":",
"block",
"=",
"nodes",
".",
"line_block",
"(",
")",
"self",
".",
"parent",
"+=",
"block",
"lineno",
"=",
"self",
".",
"state_machine",
".",
"abs_line_number",
"(... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/states.py#L1574-L1598 | |
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | gr-digital/python/digital/qa_ofdm_chanest_vcvc.py | python | qa_ofdm_chanest_vcvc.test_999_all_at_once | (self) | docstring for test_999_all_at_once | docstring for test_999_all_at_once | [
"docstring",
"for",
"test_999_all_at_once"
] | def test_999_all_at_once(self):
"""docstring for test_999_all_at_once"""
fft_len = 32
# 6 carriers empty, 10 carriers full, 1 DC carrier, 10 carriers full, 5
# carriers empty
syncsym_mask = (
0,
0,
0,
0,
0,
0... | [
"def",
"test_999_all_at_once",
"(",
"self",
")",
":",
"fft_len",
"=",
"32",
"# 6 carriers empty, 10 carriers full, 1 DC carrier, 10 carriers full, 5",
"# carriers empty",
"syncsym_mask",
"=",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/gr-digital/python/digital/qa_ofdm_chanest_vcvc.py#L217-L351 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/ttk.py | python | Treeview.column | (self, column, option=None, **kw) | return _val_or_dict(self.tk, kw, self._w, "column", column) | Query or modify the options for the specified column.
If kw is not given, returns a dict of the column option values. If
option is specified then the value for that option is returned.
Otherwise, sets the options to the corresponding values. | Query or modify the options for the specified column. | [
"Query",
"or",
"modify",
"the",
"options",
"for",
"the",
"specified",
"column",
"."
] | def column(self, column, option=None, **kw):
"""Query or modify the options for the specified column.
If kw is not given, returns a dict of the column option values. If
option is specified then the value for that option is returned.
Otherwise, sets the options to the corresponding value... | [
"def",
"column",
"(",
"self",
",",
"column",
",",
"option",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"if",
"option",
"is",
"not",
"None",
":",
"kw",
"[",
"option",
"]",
"=",
"None",
"return",
"_val_or_dict",
"(",
"self",
".",
"tk",
",",
"kw",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/ttk.py#L1239-L1247 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/packaging/tags.py | python | interpreter_name | () | return INTERPRETER_SHORT_NAMES.get(name) or name | Returns the name of the running interpreter. | Returns the name of the running interpreter. | [
"Returns",
"the",
"name",
"of",
"the",
"running",
"interpreter",
"."
] | def interpreter_name():
# type: () -> str
"""
Returns the name of the running interpreter.
"""
try:
name = sys.implementation.name # type: ignore
except AttributeError: # pragma: no cover
# Python 2.7 compatibility.
name = platform.python_implementation().lower()
re... | [
"def",
"interpreter_name",
"(",
")",
":",
"# type: () -> str",
"try",
":",
"name",
"=",
"sys",
".",
"implementation",
".",
"name",
"# type: ignore",
"except",
"AttributeError",
":",
"# pragma: no cover",
"# Python 2.7 compatibility.",
"name",
"=",
"platform",
".",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/packaging/tags.py#L815-L825 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | src/bindings/python/src/compatibility/ngraph/opset1/ops.py | python | clamp | (
data: NodeInput, min_value: ScalarData, max_value: ScalarData, name: Optional[str] = None
) | return _get_node_factory_opset1().create(
"Clamp", [as_node(data)], {"min": min_value, "max": max_value}
) | Perform clamp element-wise on data from input node.
:param data: Input tensor. One of: input node, array or scalar.
:param min_value: The lower bound of the <min_value;max_value> range. Scalar value.
:param max_value: The upper bound of the <min_value;max_value> range. Scalar value.
:param name: Option... | Perform clamp element-wise on data from input node. | [
"Perform",
"clamp",
"element",
"-",
"wise",
"on",
"data",
"from",
"input",
"node",
"."
] | def clamp(
data: NodeInput, min_value: ScalarData, max_value: ScalarData, name: Optional[str] = None
) -> Node:
"""Perform clamp element-wise on data from input node.
:param data: Input tensor. One of: input node, array or scalar.
:param min_value: The lower bound of the <min_value;max_value> range. Sc... | [
"def",
"clamp",
"(",
"data",
":",
"NodeInput",
",",
"min_value",
":",
"ScalarData",
",",
"max_value",
":",
"ScalarData",
",",
"name",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"Node",
":",
"return",
"_get_node_factory_opset1",
"(",
")",
"... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/src/bindings/python/src/compatibility/ngraph/opset1/ops.py#L278-L307 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/socketserver.py | python | BaseServer.server_close | (self) | Called to clean-up the server.
May be overridden. | Called to clean-up the server. | [
"Called",
"to",
"clean",
"-",
"up",
"the",
"server",
"."
] | def server_close(self):
"""Called to clean-up the server.
May be overridden.
"""
pass | [
"def",
"server_close",
"(",
"self",
")",
":",
"pass"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/socketserver.py#L350-L356 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | TarInfo.__init__ | (self, name="") | Construct a TarInfo object. name is the optional name
of the member. | Construct a TarInfo object. name is the optional name | [
"Construct",
"a",
"TarInfo",
"object",
".",
"name",
"is",
"the",
"optional",
"name"
] | def __init__(self, name=""):
"""Construct a TarInfo object. name is the optional name
of the member.
"""
self.name = name # member name
self.mode = 0o644 # file permissions
self.uid = 0 # user id
self.gid = 0 # group id... | [
"def",
"__init__",
"(",
"self",
",",
"name",
"=",
"\"\"",
")",
":",
"self",
".",
"name",
"=",
"name",
"# member name",
"self",
".",
"mode",
"=",
"0o644",
"# file permissions",
"self",
".",
"uid",
"=",
"0",
"# user id",
"self",
".",
"gid",
"=",
"0",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L1873-L1917 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/nn_ops.py | python | log_softmax | (logits, dim=-1, name=None) | return _softmax(logits, gen_nn_ops._log_softmax, dim, name) | Computes log softmax activations.
For each batch `i` and class `j` we have
logsoftmax = logits - log(reduce_sum(exp(logits), dim))
Args:
logits: A non-empty `Tensor`. Must be one of the following types: `half`,
`float32`, `float64`.
dim: The dimension softmax would be performed on. The defaul... | Computes log softmax activations. | [
"Computes",
"log",
"softmax",
"activations",
"."
] | def log_softmax(logits, dim=-1, name=None):
"""Computes log softmax activations.
For each batch `i` and class `j` we have
logsoftmax = logits - log(reduce_sum(exp(logits), dim))
Args:
logits: A non-empty `Tensor`. Must be one of the following types: `half`,
`float32`, `float64`.
dim: The di... | [
"def",
"log_softmax",
"(",
"logits",
",",
"dim",
"=",
"-",
"1",
",",
"name",
"=",
"None",
")",
":",
"return",
"_softmax",
"(",
"logits",
",",
"gen_nn_ops",
".",
"_log_softmax",
",",
"dim",
",",
"name",
")"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/nn_ops.py#L1484-L1505 | |
jackaudio/jack2 | 21b293dbc37d42446141a08922cdec0d2550c6a0 | waflib/Scripting.py | python | run_command | (cmd_name) | return ctx | Executes a single Waf command. Called by :py:func:`waflib.Scripting.run_commands`.
:param cmd_name: command to execute, like ``build``
:type cmd_name: string | Executes a single Waf command. Called by :py:func:`waflib.Scripting.run_commands`. | [
"Executes",
"a",
"single",
"Waf",
"command",
".",
"Called",
"by",
":",
"py",
":",
"func",
":",
"waflib",
".",
"Scripting",
".",
"run_commands",
"."
] | def run_command(cmd_name):
"""
Executes a single Waf command. Called by :py:func:`waflib.Scripting.run_commands`.
:param cmd_name: command to execute, like ``build``
:type cmd_name: string
"""
ctx = Context.create_context(cmd_name)
ctx.log_timer = Utils.Timer()
ctx.options = Options.options # provided for conv... | [
"def",
"run_command",
"(",
"cmd_name",
")",
":",
"ctx",
"=",
"Context",
".",
"create_context",
"(",
"cmd_name",
")",
"ctx",
".",
"log_timer",
"=",
"Utils",
".",
"Timer",
"(",
")",
"ctx",
".",
"options",
"=",
"Options",
".",
"options",
"# provided for conve... | https://github.com/jackaudio/jack2/blob/21b293dbc37d42446141a08922cdec0d2550c6a0/waflib/Scripting.py#L224-L240 | |
KDE/krita | 10ea63984e00366865769c193ab298de73a59c5c | plugins/python/plugin_importer/plugin_downloader.py | python | is_zip | (url) | return response.getheader('Content-Type') == MTYPE | Check if the given URL is a direct link to a zip file | Check if the given URL is a direct link to a zip file | [
"Check",
"if",
"the",
"given",
"URL",
"is",
"a",
"direct",
"link",
"to",
"a",
"zip",
"file"
] | def is_zip(url):
"""Check if the given URL is a direct link to a zip file"""
MTYPE = 'application/zip'
# This just goes by the ending of the url string:
if mimetypes.guess_type(url)[0] == MTYPE:
return True
# Could still be a zip, so check the HTTP headers:
try:
request = urll... | [
"def",
"is_zip",
"(",
"url",
")",
":",
"MTYPE",
"=",
"'application/zip'",
"# This just goes by the ending of the url string:",
"if",
"mimetypes",
".",
"guess_type",
"(",
"url",
")",
"[",
"0",
"]",
"==",
"MTYPE",
":",
"return",
"True",
"# Could still be a zip, so che... | https://github.com/KDE/krita/blob/10ea63984e00366865769c193ab298de73a59c5c/plugins/python/plugin_importer/plugin_downloader.py#L29-L45 | |
goldeneye-source/ges-code | 2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d | thirdparty/protobuf-2.3.0/python/google/protobuf/internal/wire_format.py | python | TagByteSize | (field_number) | return _VarUInt64ByteSizeNoTag(PackTag(field_number, 0)) | Returns the bytes required to serialize a tag with this field number. | Returns the bytes required to serialize a tag with this field number. | [
"Returns",
"the",
"bytes",
"required",
"to",
"serialize",
"a",
"tag",
"with",
"this",
"field",
"number",
"."
] | def TagByteSize(field_number):
"""Returns the bytes required to serialize a tag with this field number."""
# Just pass in type 0, since the type won't affect the tag+type size.
return _VarUInt64ByteSizeNoTag(PackTag(field_number, 0)) | [
"def",
"TagByteSize",
"(",
"field_number",
")",
":",
"# Just pass in type 0, since the type won't affect the tag+type size.",
"return",
"_VarUInt64ByteSizeNoTag",
"(",
"PackTag",
"(",
"field_number",
",",
"0",
")",
")"
] | https://github.com/goldeneye-source/ges-code/blob/2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/wire_format.py#L224-L227 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/completer.py | python | compress_user | (path:str, tilde_expand:bool, tilde_val:str) | Does the opposite of expand_user, with its outputs. | Does the opposite of expand_user, with its outputs. | [
"Does",
"the",
"opposite",
"of",
"expand_user",
"with",
"its",
"outputs",
"."
] | def compress_user(path:str, tilde_expand:bool, tilde_val:str) -> str:
"""Does the opposite of expand_user, with its outputs.
"""
if tilde_expand:
return path.replace(tilde_val, '~')
else:
return path | [
"def",
"compress_user",
"(",
"path",
":",
"str",
",",
"tilde_expand",
":",
"bool",
",",
"tilde_val",
":",
"str",
")",
"->",
"str",
":",
"if",
"tilde_expand",
":",
"return",
"path",
".",
"replace",
"(",
"tilde_val",
",",
"'~'",
")",
"else",
":",
"return... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/completer.py#L292-L298 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/v8/third_party/jinja2/lexer.py | python | Token.test_any | (self, *iterable) | return False | Test against multiple token expressions. | Test against multiple token expressions. | [
"Test",
"against",
"multiple",
"token",
"expressions",
"."
] | def test_any(self, *iterable):
"""Test against multiple token expressions."""
for expr in iterable:
if self.test(expr):
return True
return False | [
"def",
"test_any",
"(",
"self",
",",
"*",
"iterable",
")",
":",
"for",
"expr",
"in",
"iterable",
":",
"if",
"self",
".",
"test",
"(",
"expr",
")",
":",
"return",
"True",
"return",
"False"
] | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/v8/third_party/jinja2/lexer.py#L260-L265 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | PyEvtHandler.__init__ | (self, *args, **kwargs) | __init__(self) -> PyEvtHandler
The wx.PyEvtHandler class can be used to intercept calls to the
`ProcessEvent` method. Simply derive a new class from this one,
override ProcessEvent, and then push an instance of the class onto the
event handler chain for a window using `wx.Window.PushEv... | __init__(self) -> PyEvtHandler | [
"__init__",
"(",
"self",
")",
"-",
">",
"PyEvtHandler"
] | def __init__(self, *args, **kwargs):
"""
__init__(self) -> PyEvtHandler
The wx.PyEvtHandler class can be used to intercept calls to the
`ProcessEvent` method. Simply derive a new class from this one,
override ProcessEvent, and then push an instance of the class onto the
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_core_",
".",
"PyEvtHandler_swiginit",
"(",
"self",
",",
"_core_",
".",
"new_PyEvtHandler",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"self",
".",
"_setO... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L4253-L4263 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/html.py | python | HtmlHelpController.MakeModalIfNeeded | (*args, **kwargs) | return _html.HtmlHelpController_MakeModalIfNeeded(*args, **kwargs) | MakeModalIfNeeded(self) | MakeModalIfNeeded(self) | [
"MakeModalIfNeeded",
"(",
"self",
")"
] | def MakeModalIfNeeded(*args, **kwargs):
"""MakeModalIfNeeded(self)"""
return _html.HtmlHelpController_MakeModalIfNeeded(*args, **kwargs) | [
"def",
"MakeModalIfNeeded",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlHelpController_MakeModalIfNeeded",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/html.py#L2002-L2004 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/math_ops.py | python | _OverrideBinaryOperatorHelper | (func, op_name, clazz_object=ops.Tensor) | Register operators with different tensor and scalar versions.
If `clazz_object` is `SparseTensor`, assumes `func` takes `(sp_indices,
sp_values, sp_shape, dense)` and outputs `(new_sp_values)`.
Args:
func: the operator
op_name: name of the operator being overridden
clazz_object: class to override fo... | Register operators with different tensor and scalar versions. | [
"Register",
"operators",
"with",
"different",
"tensor",
"and",
"scalar",
"versions",
"."
] | def _OverrideBinaryOperatorHelper(func, op_name, clazz_object=ops.Tensor):
"""Register operators with different tensor and scalar versions.
If `clazz_object` is `SparseTensor`, assumes `func` takes `(sp_indices,
sp_values, sp_shape, dense)` and outputs `(new_sp_values)`.
Args:
func: the operator
op_na... | [
"def",
"_OverrideBinaryOperatorHelper",
"(",
"func",
",",
"op_name",
",",
"clazz_object",
"=",
"ops",
".",
"Tensor",
")",
":",
"def",
"binary_op_wrapper",
"(",
"x",
",",
"y",
")",
":",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"x",
",",
"y",
"]",
",",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/math_ops.py#L745-L782 | ||
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/gdal.py | python | MajorObject.GetMetadataDomainList | (self, *args) | return _gdal.MajorObject_GetMetadataDomainList(self, *args) | r"""GetMetadataDomainList(MajorObject self) -> char ** | r"""GetMetadataDomainList(MajorObject self) -> char ** | [
"r",
"GetMetadataDomainList",
"(",
"MajorObject",
"self",
")",
"-",
">",
"char",
"**"
] | def GetMetadataDomainList(self, *args):
r"""GetMetadataDomainList(MajorObject self) -> char **"""
return _gdal.MajorObject_GetMetadataDomainList(self, *args) | [
"def",
"GetMetadataDomainList",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_gdal",
".",
"MajorObject_GetMetadataDomainList",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/gdal.py#L1865-L1867 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/longest-common-subpath.py | python | Solution2.longestCommonSubpath | (self, n, paths) | return right | :type n: int
:type paths: List[List[int]]
:rtype: int | :type n: int
:type paths: List[List[int]]
:rtype: int | [
":",
"type",
"n",
":",
"int",
":",
"type",
"paths",
":",
"List",
"[",
"List",
"[",
"int",
"]]",
":",
"rtype",
":",
"int"
] | def longestCommonSubpath(self, n, paths):
"""
:type n: int
:type paths: List[List[int]]
:rtype: int
"""
def RabinKarp(arr, x):
h = reduce(lambda h,x: (h*P+x)%MOD, (arr[i] for i in xrange(x)), 0)
power = pow(P, x, MOD)
lookup = {h}
... | [
"def",
"longestCommonSubpath",
"(",
"self",
",",
"n",
",",
"paths",
")",
":",
"def",
"RabinKarp",
"(",
"arr",
",",
"x",
")",
":",
"h",
"=",
"reduce",
"(",
"lambda",
"h",
",",
"x",
":",
"(",
"h",
"*",
"P",
"+",
"x",
")",
"%",
"MOD",
",",
"(",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/longest-common-subpath.py#L42-L73 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | v8_7_5/tools/v8_presubmit.py | python | SourceFileProcessor.RunOnPath | (self, path) | return self.ProcessFiles(all_files) | Runs processor on all files under the given path. | Runs processor on all files under the given path. | [
"Runs",
"processor",
"on",
"all",
"files",
"under",
"the",
"given",
"path",
"."
] | def RunOnPath(self, path):
"""Runs processor on all files under the given path."""
all_files = []
for file in self.GetPathsToSearch():
all_files += self.FindFilesIn(join(path, file))
return self.ProcessFiles(all_files) | [
"def",
"RunOnPath",
"(",
"self",
",",
"path",
")",
":",
"all_files",
"=",
"[",
"]",
"for",
"file",
"in",
"self",
".",
"GetPathsToSearch",
"(",
")",
":",
"all_files",
"+=",
"self",
".",
"FindFilesIn",
"(",
"join",
"(",
"path",
",",
"file",
")",
")",
... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/v8_7_5/tools/v8_presubmit.py#L188-L194 | |
tpfister/caffe-heatmap | 4db69ef53e6b8a0b3b4ebb29328b0ab3dbf67c4e | scripts/cpp_lint.py | python | CheckCaffeAlternatives | (filename, clean_lines, linenum, error) | Checks for C(++) functions for which a Caffe substitute should be used.
For certain native C functions (memset, memcpy), there is a Caffe alternative
which should be used instead.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The nu... | Checks for C(++) functions for which a Caffe substitute should be used. | [
"Checks",
"for",
"C",
"(",
"++",
")",
"functions",
"for",
"which",
"a",
"Caffe",
"substitute",
"should",
"be",
"used",
"."
] | def CheckCaffeAlternatives(filename, clean_lines, linenum, error):
"""Checks for C(++) functions for which a Caffe substitute should be used.
For certain native C functions (memset, memcpy), there is a Caffe alternative
which should be used instead.
Args:
filename: The name of the current file.
clean_... | [
"def",
"CheckCaffeAlternatives",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"for",
"function",
",",
"alts",
"in",
"caffe_alt_function_list",
":",
"ix",
"=",
"li... | https://github.com/tpfister/caffe-heatmap/blob/4db69ef53e6b8a0b3b4ebb29328b0ab3dbf67c4e/scripts/cpp_lint.py#L1572-L1592 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/keras/python/keras/engine/topology.py | python | Layer.__call__ | (self, inputs, **kwargs) | return output | Wrapper around self.call(), for handling internal references.
If a Keras tensor is passed:
- We call self._add_inbound_node().
- If necessary, we `build` the layer to match
the shape of the input(s).
- We update the _keras_history of the output tensor(s)
with the cur... | Wrapper around self.call(), for handling internal references. | [
"Wrapper",
"around",
"self",
".",
"call",
"()",
"for",
"handling",
"internal",
"references",
"."
] | def __call__(self, inputs, **kwargs):
"""Wrapper around self.call(), for handling internal references.
If a Keras tensor is passed:
- We call self._add_inbound_node().
- If necessary, we `build` the layer to match
the shape of the input(s).
- We update the _keras_history of ... | [
"def",
"__call__",
"(",
"self",
",",
"inputs",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"inputs",
",",
"list",
")",
":",
"inputs",
"=",
"inputs",
"[",
":",
"]",
"# Handle mask propagation.",
"previous_mask",
"=",
"_collect_previous_mask",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/keras/python/keras/engine/topology.py#L359-L432 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/pytables.py | python | Table.index_cols | (self) | return [(i.axis, i.cname) for i in self.index_axes] | return a list of my index cols | return a list of my index cols | [
"return",
"a",
"list",
"of",
"my",
"index",
"cols"
] | def index_cols(self):
""" return a list of my index cols """
# Note: each `i.cname` below is assured to be a str.
return [(i.axis, i.cname) for i in self.index_axes] | [
"def",
"index_cols",
"(",
"self",
")",
":",
"# Note: each `i.cname` below is assured to be a str.",
"return",
"[",
"(",
"i",
".",
"axis",
",",
"i",
".",
"cname",
")",
"for",
"i",
"in",
"self",
".",
"index_axes",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/pytables.py#L3315-L3318 | |
numworks/epsilon | 8952d2f8b1de1c3f064eec8ffcea804c5594ba4c | build/device/usb/backend/__init__.py | python | IBackend.bulk_write | (self, dev_handle, ep, intf, data, timeout) | r"""Perform a bulk write.
dev_handle is the value returned by the open_device() method.
The ep parameter is the bEndpointAddress field whose endpoint
the data will be sent to. intf is the bInterfaceNumber field
of the interface containing the endpoint. The data parameter
is the ... | r"""Perform a bulk write. | [
"r",
"Perform",
"a",
"bulk",
"write",
"."
] | def bulk_write(self, dev_handle, ep, intf, data, timeout):
r"""Perform a bulk write.
dev_handle is the value returned by the open_device() method.
The ep parameter is the bEndpointAddress field whose endpoint
the data will be sent to. intf is the bInterfaceNumber field
of the in... | [
"def",
"bulk_write",
"(",
"self",
",",
"dev_handle",
",",
"ep",
",",
"intf",
",",
"data",
",",
"timeout",
")",
":",
"_not_implemented",
"(",
"self",
".",
"bulk_write",
")"
] | https://github.com/numworks/epsilon/blob/8952d2f8b1de1c3f064eec8ffcea804c5594ba4c/build/device/usb/backend/__init__.py#L240-L253 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/tpu_feed.py | python | InfeedQueue.freeze | (self) | Freezes the InfeedQueue so it can no longer be modified.
The configuration is implicitly frozen before any host-side or
device-side Ops are generated. The configuration cannot be frozen
until the types and shapes of the tuple elements have been set.
Raises:
ValueError: if the types or shapes of ... | Freezes the InfeedQueue so it can no longer be modified. | [
"Freezes",
"the",
"InfeedQueue",
"so",
"it",
"can",
"no",
"longer",
"be",
"modified",
"."
] | def freeze(self):
"""Freezes the InfeedQueue so it can no longer be modified.
The configuration is implicitly frozen before any host-side or
device-side Ops are generated. The configuration cannot be frozen
until the types and shapes of the tuple elements have been set.
Raises:
ValueError: i... | [
"def",
"freeze",
"(",
"self",
")",
":",
"self",
".",
"_frozen",
"=",
"True",
"if",
"self",
".",
"_tuple_types",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Can't freeze an InfeedQueue without setting all tuple types.\"",
")",
"if",
"self",
".",
"_tuple_shape... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/tpu_feed.py#L434-L458 | ||
dmlc/treelite | df56babb6a4a2d7c29d719c28ce53acfa7dbab3c | python/treelite/sklearn/common.py | python | SKLConverterBase.process_leaf_node | (cls, treelite_tree, sklearn_tree, node_id, sklearn_model) | Process a test node with a given node ID. This method shall be implemented by the
mixin class that represents the converter for a particular model type. | Process a test node with a given node ID. This method shall be implemented by the
mixin class that represents the converter for a particular model type. | [
"Process",
"a",
"test",
"node",
"with",
"a",
"given",
"node",
"ID",
".",
"This",
"method",
"shall",
"be",
"implemented",
"by",
"the",
"mixin",
"class",
"that",
"represents",
"the",
"converter",
"for",
"a",
"particular",
"model",
"type",
"."
] | def process_leaf_node(cls, treelite_tree, sklearn_tree, node_id, sklearn_model):
"""Process a test node with a given node ID. This method shall be implemented by the
mixin class that represents the converter for a particular model type."""
raise NotImplementedError() | [
"def",
"process_leaf_node",
"(",
"cls",
",",
"treelite_tree",
",",
"sklearn_tree",
",",
"node_id",
",",
"sklearn_model",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/dmlc/treelite/blob/df56babb6a4a2d7c29d719c28ce53acfa7dbab3c/python/treelite/sklearn/common.py#L48-L51 | ||
yan99033/CNN-SVO | d5591ea88103f8d1b26e5296129bf3b3196a14f1 | rpg_vikit/vikit_py/src/vikit_py/transformations.py | python | orthogonalization_matrix | (lengths, angles) | return numpy.array((
( a*sinb*math.sqrt(1.0-co*co), 0.0, 0.0, 0.0),
(-a*sinb*co, b*sina, 0.0, 0.0),
( a*cosb, b*cosa, c, 0.0),
( 0.0, 0.0, 0.0, 1.0)),
dtype=numpy.float64) | Return orthogonalization matrix for crystallographic cell coordinates.
Angles are expected in degrees.
The de-orthogonalization matrix is the inverse.
>>> O = orthogonalization_matrix((10., 10., 10.), (90., 90., 90.))
>>> numpy.allclose(O[:3, :3], numpy.identity(3, float) * 10)
True
>>> O = o... | Return orthogonalization matrix for crystallographic cell coordinates. | [
"Return",
"orthogonalization",
"matrix",
"for",
"crystallographic",
"cell",
"coordinates",
"."
] | def orthogonalization_matrix(lengths, angles):
"""Return orthogonalization matrix for crystallographic cell coordinates.
Angles are expected in degrees.
The de-orthogonalization matrix is the inverse.
>>> O = orthogonalization_matrix((10., 10., 10.), (90., 90., 90.))
>>> numpy.allclose(O[:3, :3],... | [
"def",
"orthogonalization_matrix",
"(",
"lengths",
",",
"angles",
")",
":",
"a",
",",
"b",
",",
"c",
"=",
"lengths",
"angles",
"=",
"numpy",
".",
"radians",
"(",
"angles",
")",
"sina",
",",
"sinb",
",",
"_",
"=",
"numpy",
".",
"sin",
"(",
"angles",
... | https://github.com/yan99033/CNN-SVO/blob/d5591ea88103f8d1b26e5296129bf3b3196a14f1/rpg_vikit/vikit_py/src/vikit_py/transformations.py#L842-L867 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/cookielib.py | python | iso2time | (text) | return _str2time(day, mon, yr, hr, min, sec, tz) | As for http2time, but parses the ISO 8601 formats:
1994-02-03 14:15:29 -0100 -- ISO 8601 format
1994-02-03 14:15:29 -- zone is optional
1994-02-03 -- only date
1994-02-03T14:15:29 -- Use T as separator
19940203T141529Z -- ISO 8601 compact format
... | As for http2time, but parses the ISO 8601 formats: | [
"As",
"for",
"http2time",
"but",
"parses",
"the",
"ISO",
"8601",
"formats",
":"
] | def iso2time(text):
"""
As for http2time, but parses the ISO 8601 formats:
1994-02-03 14:15:29 -0100 -- ISO 8601 format
1994-02-03 14:15:29 -- zone is optional
1994-02-03 -- only date
1994-02-03T14:15:29 -- Use T as separator
19940203T141529Z ... | [
"def",
"iso2time",
"(",
"text",
")",
":",
"# clean up",
"text",
"=",
"text",
".",
"lstrip",
"(",
")",
"# tz is time zone specifier string",
"day",
",",
"mon",
",",
"yr",
",",
"hr",
",",
"min",
",",
"sec",
",",
"tz",
"=",
"[",
"None",
"]",
"*",
"7",
... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/cookielib.py#L284-L311 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/pyshell.py | python | ModifiedInterpreter.runcommand | (self, code) | return 1 | Run the code without invoking the debugger | Run the code without invoking the debugger | [
"Run",
"the",
"code",
"without",
"invoking",
"the",
"debugger"
] | def runcommand(self, code):
"Run the code without invoking the debugger"
# The code better not raise an exception!
if self.tkconsole.executing:
self.display_executing_dialog()
return 0
if self.rpcclt:
self.rpcclt.remotequeue("exec", "runcode", (code,),... | [
"def",
"runcommand",
"(",
"self",
",",
"code",
")",
":",
"# The code better not raise an exception!",
"if",
"self",
".",
"tkconsole",
".",
"executing",
":",
"self",
".",
"display_executing_dialog",
"(",
")",
"return",
"0",
"if",
"self",
".",
"rpcclt",
":",
"se... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/pyshell.py#L745-L755 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/mozbuild/mozbuild/jar.py | python | JarMaker.getCommandLineParser | (self) | return p | Get a optparse.OptionParser for jarmaker.
This OptionParser has the options for jarmaker as well as
the options for the inner PreProcessor. | Get a optparse.OptionParser for jarmaker. | [
"Get",
"a",
"optparse",
".",
"OptionParser",
"for",
"jarmaker",
"."
] | def getCommandLineParser(self):
'''Get a optparse.OptionParser for jarmaker.
This OptionParser has the options for jarmaker as well as
the options for the inner PreProcessor.
'''
# HACK, we need to unescape the string variables we get,
# the perl versions didn't grok st... | [
"def",
"getCommandLineParser",
"(",
"self",
")",
":",
"# HACK, we need to unescape the string variables we get,",
"# the perl versions didn't grok strings right",
"p",
"=",
"self",
".",
"pp",
".",
"getCommandLineParser",
"(",
"unescapeDefines",
"=",
"True",
")",
"p",
".",
... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/mozbuild/mozbuild/jar.py#L95-L136 | |
bh107/bohrium | 5b83e7117285fefc7779ed0e9acb0f8e74c7e068 | bridge/bh107/bh107/array_create.py | python | empty_like | (a, dtype=None) | return empty(a.shape, dtype) | Return a new array with the same shape and type as a given array.
Parameters
----------
a : array_like
The shape and data-type of `a` define these same attributes of the
returned array.
dtype : data-type, optional
Overrides the data type of the result.
Returns
-------
... | Return a new array with the same shape and type as a given array. | [
"Return",
"a",
"new",
"array",
"with",
"the",
"same",
"shape",
"and",
"type",
"as",
"a",
"given",
"array",
"."
] | def empty_like(a, dtype=None):
"""
Return a new array with the same shape and type as a given array.
Parameters
----------
a : array_like
The shape and data-type of `a` define these same attributes of the
returned array.
dtype : data-type, optional
Overrides the data typ... | [
"def",
"empty_like",
"(",
"a",
",",
"dtype",
"=",
"None",
")",
":",
"if",
"dtype",
"is",
"None",
":",
"dtype",
"=",
"a",
".",
"dtype",
"return",
"empty",
"(",
"a",
".",
"shape",
",",
"dtype",
")"
] | https://github.com/bh107/bohrium/blob/5b83e7117285fefc7779ed0e9acb0f8e74c7e068/bridge/bh107/bh107/array_create.py#L146-L193 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/control_flow_ops.py | python | ControlFlowState.GetGradState | (self, op, before) | return None | Return the grad state for this op if it's in a forward loop context. | Return the grad state for this op if it's in a forward loop context. | [
"Return",
"the",
"grad",
"state",
"for",
"this",
"op",
"if",
"it",
"s",
"in",
"a",
"forward",
"loop",
"context",
"."
] | def GetGradState(self, op, before):
"""Return the grad state for this op if it's in a forward loop context."""
if before and IsLoopExit(op):
forward_ctxt = op._get_control_flow_context()
forward_ctxt = forward_ctxt.outer_context
if forward_ctxt:
forward_ctxt = forward_ctxt.GetWhileCont... | [
"def",
"GetGradState",
"(",
"self",
",",
"op",
",",
"before",
")",
":",
"if",
"before",
"and",
"IsLoopExit",
"(",
"op",
")",
":",
"forward_ctxt",
"=",
"op",
".",
"_get_control_flow_context",
"(",
")",
"forward_ctxt",
"=",
"forward_ctxt",
".",
"outer_context"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/control_flow_ops.py#L1018-L1029 | |
NeoGeographyToolkit/StereoPipeline | eedf54a919fb5cce1ab0e280bb0df4050763aa11 | src/asp/IceBridge/icebridge_common.py | python | makeJpegFileName | (run, frame) | return ('%s_%05d.JPG' % (run.yyyy_mm_dd(), frame)) | Generate a file name like: 2016_07_19_00015.JPG | Generate a file name like: 2016_07_19_00015.JPG | [
"Generate",
"a",
"file",
"name",
"like",
":",
"2016_07_19_00015",
".",
"JPG"
] | def makeJpegFileName(run, frame):
'''Generate a file name like: 2016_07_19_00015.JPG'''
return ('%s_%05d.JPG' % (run.yyyy_mm_dd(), frame)) | [
"def",
"makeJpegFileName",
"(",
"run",
",",
"frame",
")",
":",
"return",
"(",
"'%s_%05d.JPG'",
"%",
"(",
"run",
".",
"yyyy_mm_dd",
"(",
")",
",",
"frame",
")",
")"
] | https://github.com/NeoGeographyToolkit/StereoPipeline/blob/eedf54a919fb5cce1ab0e280bb0df4050763aa11/src/asp/IceBridge/icebridge_common.py#L221-L223 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/stats/_tukeylambda_stats.py | python | tukeylambda_variance | (lam) | return v | Variance of the Tukey Lambda distribution.
Parameters
----------
lam : array_like
The lambda values at which to compute the variance.
Returns
-------
v : ndarray
The variance. For lam < -0.5, the variance is not defined, so
np.nan is returned. For lam = 0.5, np.inf is... | Variance of the Tukey Lambda distribution. | [
"Variance",
"of",
"the",
"Tukey",
"Lambda",
"distribution",
"."
] | def tukeylambda_variance(lam):
"""Variance of the Tukey Lambda distribution.
Parameters
----------
lam : array_like
The lambda values at which to compute the variance.
Returns
-------
v : ndarray
The variance. For lam < -0.5, the variance is not defined, so
np.nan ... | [
"def",
"tukeylambda_variance",
"(",
"lam",
")",
":",
"lam",
"=",
"np",
".",
"asarray",
"(",
"lam",
")",
"shp",
"=",
"lam",
".",
"shape",
"lam",
"=",
"np",
".",
"atleast_1d",
"(",
"lam",
")",
".",
"astype",
"(",
"np",
".",
"float64",
")",
"# For abs... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/stats/_tukeylambda_stats.py#L45-L102 | |
omnisci/omniscidb | b9c95f1bd602b4ffc8b0edf18bfad61031e08d86 | python/omnisci/thrift/OmniSci.py | python | Iface.get_databases | (self, session) | Parameters:
- session | Parameters:
- session | [
"Parameters",
":",
"-",
"session"
] | def get_databases(self, session):
"""
Parameters:
- session
"""
pass | [
"def",
"get_databases",
"(",
"self",
",",
"session",
")",
":",
"pass"
] | https://github.com/omnisci/omniscidb/blob/b9c95f1bd602b4ffc8b0edf18bfad61031e08d86/python/omnisci/thrift/OmniSci.py#L177-L183 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/urllib3/poolmanager.py | python | PoolManager.urlopen | (self, method, url, redirect=True, **kw) | return self.urlopen(method, redirect_location, **kw) | Same as :meth:`urllib3.connectionpool.HTTPConnectionPool.urlopen`
with custom cross-host redirect logic and only sends the request-uri
portion of the ``url``.
The given ``url`` parameter must be absolute, such that an appropriate
:class:`urllib3.connectionpool.ConnectionPool` can be cho... | Same as :meth:`urllib3.connectionpool.HTTPConnectionPool.urlopen`
with custom cross-host redirect logic and only sends the request-uri
portion of the ``url``. | [
"Same",
"as",
":",
"meth",
":",
"urllib3",
".",
"connectionpool",
".",
"HTTPConnectionPool",
".",
"urlopen",
"with",
"custom",
"cross",
"-",
"host",
"redirect",
"logic",
"and",
"only",
"sends",
"the",
"request",
"-",
"uri",
"portion",
"of",
"the",
"url",
"... | def urlopen(self, method, url, redirect=True, **kw):
"""
Same as :meth:`urllib3.connectionpool.HTTPConnectionPool.urlopen`
with custom cross-host redirect logic and only sends the request-uri
portion of the ``url``.
The given ``url`` parameter must be absolute, such that an appr... | [
"def",
"urlopen",
"(",
"self",
",",
"method",
",",
"url",
",",
"redirect",
"=",
"True",
",",
"*",
"*",
"kw",
")",
":",
"u",
"=",
"parse_url",
"(",
"url",
")",
"conn",
"=",
"self",
".",
"connection_from_host",
"(",
"u",
".",
"host",
",",
"port",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/urllib3/poolmanager.py#L309-L369 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/perf/metrics/__init__.py | python | Metric.CustomizeBrowserOptions | (cls, options) | Add browser options that are required by this metric.
Some metrics do not have any special browser options that need
to be added, and they do not need to override this method; by
default, no browser options are added.
To add options here, call options.AppendExtraBrowserArgs(arg). | Add browser options that are required by this metric. | [
"Add",
"browser",
"options",
"that",
"are",
"required",
"by",
"this",
"metric",
"."
] | def CustomizeBrowserOptions(cls, options):
"""Add browser options that are required by this metric.
Some metrics do not have any special browser options that need
to be added, and they do not need to override this method; by
default, no browser options are added.
To add options here, call options.... | [
"def",
"CustomizeBrowserOptions",
"(",
"cls",
",",
"options",
")",
":",
"pass"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/perf/metrics/__init__.py#L15-L24 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/strings.py | python | str_translate | (arr, table) | return _na_map(lambda x: x.translate(table), arr, dtype=str) | Map all characters in the string through the given mapping table.
Equivalent to standard :meth:`str.translate`.
Parameters
----------
table : dict
Table is a mapping of Unicode ordinals to Unicode ordinals, strings, or
None. Unmapped characters are left untouched.
Characters map... | Map all characters in the string through the given mapping table.
Equivalent to standard :meth:`str.translate`. | [
"Map",
"all",
"characters",
"in",
"the",
"string",
"through",
"the",
"given",
"mapping",
"table",
".",
"Equivalent",
"to",
"standard",
":",
"meth",
":",
"str",
".",
"translate",
"."
] | def str_translate(arr, table):
"""
Map all characters in the string through the given mapping table.
Equivalent to standard :meth:`str.translate`.
Parameters
----------
table : dict
Table is a mapping of Unicode ordinals to Unicode ordinals, strings, or
None. Unmapped characters... | [
"def",
"str_translate",
"(",
"arr",
",",
"table",
")",
":",
"return",
"_na_map",
"(",
"lambda",
"x",
":",
"x",
".",
"translate",
"(",
"table",
")",
",",
"arr",
",",
"dtype",
"=",
"str",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/strings.py#L1765-L1782 | |
lhmRyan/deep-supervised-hashing-DSH | 631901f82e2ab031fbac33f914a5b08ef8e21d57 | scripts/cpp_lint.py | python | IsErrorSuppressedByNolint | (category, linenum) | return (linenum in _error_suppressions.get(category, set()) or
linenum in _error_suppressions.get(None, set())) | Returns true if the specified error category is suppressed on this line.
Consults the global error_suppressions map populated by
ParseNolintSuppressions/ResetNolintSuppressions.
Args:
category: str, the category of the error.
linenum: int, the current line number.
Returns:
bool, True iff the error... | Returns true if the specified error category is suppressed on this line. | [
"Returns",
"true",
"if",
"the",
"specified",
"error",
"category",
"is",
"suppressed",
"on",
"this",
"line",
"."
] | def IsErrorSuppressedByNolint(category, linenum):
"""Returns true if the specified error category is suppressed on this line.
Consults the global error_suppressions map populated by
ParseNolintSuppressions/ResetNolintSuppressions.
Args:
category: str, the category of the error.
linenum: int, the curre... | [
"def",
"IsErrorSuppressedByNolint",
"(",
"category",
",",
"linenum",
")",
":",
"return",
"(",
"linenum",
"in",
"_error_suppressions",
".",
"get",
"(",
"category",
",",
"set",
"(",
")",
")",
"or",
"linenum",
"in",
"_error_suppressions",
".",
"get",
"(",
"None... | https://github.com/lhmRyan/deep-supervised-hashing-DSH/blob/631901f82e2ab031fbac33f914a5b08ef8e21d57/scripts/cpp_lint.py#L500-L513 | |
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/gdal-utils/osgeo_utils/auxiliary/color_palette.py | python | ColorPalette.read_file_txt | (self, filename: Optional[PathLikeOrStr] = None, lines: Optional[Sequence[str]] = None) | Read GDAL Text-based color configuration file | Read GDAL Text-based color configuration file | [
"Read",
"GDAL",
"Text",
"-",
"based",
"color",
"configuration",
"file"
] | def read_file_txt(self, filename: Optional[PathLikeOrStr] = None, lines: Optional[Sequence[str]] = None):
""" Read GDAL Text-based color configuration file """
if filename is not None:
lines = open(filename).readlines()
if not isinstance(lines, Sequence):
raise Exception(... | [
"def",
"read_file_txt",
"(",
"self",
",",
"filename",
":",
"Optional",
"[",
"PathLikeOrStr",
"]",
"=",
"None",
",",
"lines",
":",
"Optional",
"[",
"Sequence",
"[",
"str",
"]",
"]",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"not",
"None",
":",
"l... | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/gdal-utils/osgeo_utils/auxiliary/color_palette.py#L223-L249 | ||
tensorflow/minigo | 6d89c202cdceaf449aefc3149ab2110d44f1a6a4 | oneoffs/joseki/opening_freqs_export.py | python | create_top_report | (top_n=100) | Creates an html page showing the most common sequences in the database, and
charting their popularity over time. | Creates an html page showing the most common sequences in the database, and
charting their popularity over time. | [
"Creates",
"an",
"html",
"page",
"showing",
"the",
"most",
"common",
"sequences",
"in",
"the",
"database",
"and",
"charting",
"their",
"popularity",
"over",
"time",
"."
] | def create_top_report(top_n=100):
"""
Creates an html page showing the most common sequences in the database, and
charting their popularity over time.
"""
db = sqlite3.connect(FLAGS.db_path)
ts = lambda hr: int(dt.datetime.strptime(hr, "%Y-%m-%d-%H").timestamp())
print('querying')
ranges... | [
"def",
"create_top_report",
"(",
"top_n",
"=",
"100",
")",
":",
"db",
"=",
"sqlite3",
".",
"connect",
"(",
"FLAGS",
".",
"db_path",
")",
"ts",
"=",
"lambda",
"hr",
":",
"int",
"(",
"dt",
".",
"datetime",
".",
"strptime",
"(",
"hr",
",",
"\"%Y-%m-%d-%... | https://github.com/tensorflow/minigo/blob/6d89c202cdceaf449aefc3149ab2110d44f1a6a4/oneoffs/joseki/opening_freqs_export.py#L231-L273 | ||
jbehley/point_labeler | bf22e6f255fe5c9f01979d2d670d0ac543ae6460 | scripts/repair_labels.py | python | read_labels | (filename) | return arr | read labels from given file. | read labels from given file. | [
"read",
"labels",
"from",
"given",
"file",
"."
] | def read_labels(filename):
""" read labels from given file. """
contents = bytes()
with open(filename, "rb") as f:
f.seek(0, 2) # move the cursor to the end of the file
num_points = int(f.tell() / 4)
f.seek(0, 0)
contents = f.read()
arr = [struct.unpack('<I', contents[4 * i:4 * i + 4])[0] for ... | [
"def",
"read_labels",
"(",
"filename",
")",
":",
"contents",
"=",
"bytes",
"(",
")",
"with",
"open",
"(",
"filename",
",",
"\"rb\"",
")",
"as",
"f",
":",
"f",
".",
"seek",
"(",
"0",
",",
"2",
")",
"# move the cursor to the end of the file",
"num_points",
... | https://github.com/jbehley/point_labeler/blob/bf22e6f255fe5c9f01979d2d670d0ac543ae6460/scripts/repair_labels.py#L7-L18 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/imghdr.py | python | test_xbm | (h, f) | X bitmap (X10 or X11) | X bitmap (X10 or X11) | [
"X",
"bitmap",
"(",
"X10",
"or",
"X11",
")"
] | def test_xbm(h, f):
"""X bitmap (X10 or X11)"""
s = '#define '
if h[:len(s)] == s:
return 'xbm' | [
"def",
"test_xbm",
"(",
"h",
",",
"f",
")",
":",
"s",
"=",
"'#define '",
"if",
"h",
"[",
":",
"len",
"(",
"s",
")",
"]",
"==",
"s",
":",
"return",
"'xbm'"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/imghdr.py#L109-L113 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/base.py | python | SelectionMixin._get_cython_func | (self, arg: str) | return self._cython_table.get(arg) | if we define an internal function for this argument, return it | if we define an internal function for this argument, return it | [
"if",
"we",
"define",
"an",
"internal",
"function",
"for",
"this",
"argument",
"return",
"it"
] | def _get_cython_func(self, arg: str) -> Optional[str]:
"""
if we define an internal function for this argument, return it
"""
return self._cython_table.get(arg) | [
"def",
"_get_cython_func",
"(",
"self",
",",
"arg",
":",
"str",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_cython_table",
".",
"get",
"(",
"arg",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/base.py#L558-L562 | |
bundy-dns/bundy | 3d41934996b82b0cd2fe22dd74d2abc1daba835d | src/lib/python/bundy/config/cfgmgr.py | python | ConfigManager.handle_msg | (self, msg) | return answer | Handle a command from the cc channel to the configuration manager | Handle a command from the cc channel to the configuration manager | [
"Handle",
"a",
"command",
"from",
"the",
"cc",
"channel",
"to",
"the",
"configuration",
"manager"
] | def handle_msg(self, msg):
"""Handle a command from the cc channel to the configuration manager"""
answer = {}
cmd, arg = ccsession.parse_command(msg)
if cmd:
if cmd == ccsession.COMMAND_GET_COMMANDS_SPEC:
answer = ccsession.create_answer(0, self.get_commands_... | [
"def",
"handle_msg",
"(",
"self",
",",
"msg",
")",
":",
"answer",
"=",
"{",
"}",
"cmd",
",",
"arg",
"=",
"ccsession",
".",
"parse_command",
"(",
"msg",
")",
"if",
"cmd",
":",
"if",
"cmd",
"==",
"ccsession",
".",
"COMMAND_GET_COMMANDS_SPEC",
":",
"answe... | https://github.com/bundy-dns/bundy/blob/3d41934996b82b0cd2fe22dd74d2abc1daba835d/src/lib/python/bundy/config/cfgmgr.py#L587-L616 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/CodeWarrior/Standard_Suite.py | python | Standard_Suite_Events.set | (self, _object, _attributes={}, **_arguments) | set: set an object's data
Required argument: the object to change
Keyword argument to: the new value
Keyword argument _attributes: AppleEvent attribute dictionary | set: set an object's data
Required argument: the object to change
Keyword argument to: the new value
Keyword argument _attributes: AppleEvent attribute dictionary | [
"set",
":",
"set",
"an",
"object",
"s",
"data",
"Required",
"argument",
":",
"the",
"object",
"to",
"change",
"Keyword",
"argument",
"to",
":",
"the",
"new",
"value",
"Keyword",
"argument",
"_attributes",
":",
"AppleEvent",
"attribute",
"dictionary"
] | def set(self, _object, _attributes={}, **_arguments):
"""set: set an object's data
Required argument: the object to change
Keyword argument to: the new value
Keyword argument _attributes: AppleEvent attribute dictionary
"""
_code = 'core'
_subcode = 'setd'
... | [
"def",
"set",
"(",
"self",
",",
"_object",
",",
"_attributes",
"=",
"{",
"}",
",",
"*",
"*",
"_arguments",
")",
":",
"_code",
"=",
"'core'",
"_subcode",
"=",
"'setd'",
"aetools",
".",
"keysubst",
"(",
"_arguments",
",",
"self",
".",
"_argmap_set",
")",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/CodeWarrior/Standard_Suite.py#L153-L172 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/training/optimizer.py | python | _deduplicate_indexed_slices | (values, indices) | return (summed_values, unique_indices) | Sums `values` associated with any non-unique `indices`.
Args:
values: A `Tensor` with rank >= 1.
indices: A one-dimensional integer `Tensor`, indexing into the first
dimension of `values` (as in an IndexedSlices object).
Returns:
A tuple of (`summed_values`, `unique_indices`) where `unique_indice... | Sums `values` associated with any non-unique `indices`. | [
"Sums",
"values",
"associated",
"with",
"any",
"non",
"-",
"unique",
"indices",
"."
] | def _deduplicate_indexed_slices(values, indices):
"""Sums `values` associated with any non-unique `indices`.
Args:
values: A `Tensor` with rank >= 1.
indices: A one-dimensional integer `Tensor`, indexing into the first
dimension of `values` (as in an IndexedSlices object).
Returns:
A tuple of (... | [
"def",
"_deduplicate_indexed_slices",
"(",
"values",
",",
"indices",
")",
":",
"unique_indices",
",",
"new_index_positions",
"=",
"array_ops",
".",
"unique",
"(",
"indices",
")",
"summed_values",
"=",
"math_ops",
".",
"unsorted_segment_sum",
"(",
"values",
",",
"n... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/training/optimizer.py#L49-L65 | |
PixarAnimationStudios/USD | faed18ce62c8736b02413635b584a2f637156bad | pxr/usd/usdUtils/complianceChecker.py | python | BaseRuleChecker.ResetCaches | (self) | Reset any caches the rule owns. Called whenever stage authoring
occurs, such as when we iterate through VariantSet combinations. | Reset any caches the rule owns. Called whenever stage authoring
occurs, such as when we iterate through VariantSet combinations. | [
"Reset",
"any",
"caches",
"the",
"rule",
"owns",
".",
"Called",
"whenever",
"stage",
"authoring",
"occurs",
"such",
"as",
"when",
"we",
"iterate",
"through",
"VariantSet",
"combinations",
"."
] | def ResetCaches(self):
""" Reset any caches the rule owns. Called whenever stage authoring
occurs, such as when we iterate through VariantSet combinations.
"""
pass | [
"def",
"ResetCaches",
"(",
"self",
")",
":",
"pass"
] | https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/pxr/usd/usdUtils/complianceChecker.py#L131-L135 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextCtrl.IndicatorSetStyle | (*args, **kwargs) | return _stc.StyledTextCtrl_IndicatorSetStyle(*args, **kwargs) | IndicatorSetStyle(self, int indic, int style)
Set an indicator to plain, squiggle or TT. | IndicatorSetStyle(self, int indic, int style) | [
"IndicatorSetStyle",
"(",
"self",
"int",
"indic",
"int",
"style",
")"
] | def IndicatorSetStyle(*args, **kwargs):
"""
IndicatorSetStyle(self, int indic, int style)
Set an indicator to plain, squiggle or TT.
"""
return _stc.StyledTextCtrl_IndicatorSetStyle(*args, **kwargs) | [
"def",
"IndicatorSetStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_IndicatorSetStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L2865-L2871 | |
mblondel/svmlight-loader | e3d0a90676430e164486e6feffe0b8857532ee4e | svmlight_loader.py | python | load_svmlight_file | (file_path, n_features=None, dtype=None,
buffer_mb=40, zero_based="auto") | return (X_train, labels) | Load datasets in the svmlight / libsvm format into sparse CSR matrix
This format is a text-based format, with one sample per line. It does
not store zero valued features hence is suitable for sparse dataset.
The first element of each line can be used to store a target variable
to predict.
This fo... | Load datasets in the svmlight / libsvm format into sparse CSR matrix | [
"Load",
"datasets",
"in",
"the",
"svmlight",
"/",
"libsvm",
"format",
"into",
"sparse",
"CSR",
"matrix"
] | def load_svmlight_file(file_path, n_features=None, dtype=None,
buffer_mb=40, zero_based="auto"):
"""Load datasets in the svmlight / libsvm format into sparse CSR matrix
This format is a text-based format, with one sample per line. It does
not store zero valued features hence is suita... | [
"def",
"load_svmlight_file",
"(",
"file_path",
",",
"n_features",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"buffer_mb",
"=",
"40",
",",
"zero_based",
"=",
"\"auto\"",
")",
":",
"data",
",",
"indices",
",",
"indptr",
",",
"labels",
"=",
"_load_svmlight_... | https://github.com/mblondel/svmlight-loader/blob/e3d0a90676430e164486e6feffe0b8857532ee4e/svmlight_loader.py#L17-L71 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/evaluator.py | python | Evaluator.reset | (self, executor, reset_program=None) | reset metric states at the begin of each pass/user specified batch
Args:
executor(Executor|ParallelExecutor): a executor for executing the reset_program
reset_program(Program): a single Program for reset process | reset metric states at the begin of each pass/user specified batch | [
"reset",
"metric",
"states",
"at",
"the",
"begin",
"of",
"each",
"pass",
"/",
"user",
"specified",
"batch"
] | def reset(self, executor, reset_program=None):
"""
reset metric states at the begin of each pass/user specified batch
Args:
executor(Executor|ParallelExecutor): a executor for executing the reset_program
reset_program(Program): a single Program for reset process
... | [
"def",
"reset",
"(",
"self",
",",
"executor",
",",
"reset_program",
"=",
"None",
")",
":",
"if",
"reset_program",
"is",
"None",
":",
"reset_program",
"=",
"Program",
"(",
")",
"with",
"program_guard",
"(",
"main_program",
"=",
"reset_program",
")",
":",
"f... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/evaluator.py#L77-L95 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/masked/maskededit.py | python | MaskedEditMixin._SetKeycodeHandler | (self, keycode, func) | This function adds and/or replaces key event handling functions
used by the control. <func> should take the event as argument
and return False if no further action on the key is necessary. | This function adds and/or replaces key event handling functions
used by the control. <func> should take the event as argument
and return False if no further action on the key is necessary. | [
"This",
"function",
"adds",
"and",
"/",
"or",
"replaces",
"key",
"event",
"handling",
"functions",
"used",
"by",
"the",
"control",
".",
"<func",
">",
"should",
"take",
"the",
"event",
"as",
"argument",
"and",
"return",
"False",
"if",
"no",
"further",
"acti... | def _SetKeycodeHandler(self, keycode, func):
"""
This function adds and/or replaces key event handling functions
used by the control. <func> should take the event as argument
and return False if no further action on the key is necessary.
"""
if func:
self._ke... | [
"def",
"_SetKeycodeHandler",
"(",
"self",
",",
"keycode",
",",
"func",
")",
":",
"if",
"func",
":",
"self",
".",
"_keyhandlers",
"[",
"keycode",
"]",
"=",
"func",
"elif",
"self",
".",
"_keyhandlers",
".",
"has_key",
"(",
"keycode",
")",
":",
"del",
"se... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/masked/maskededit.py#L2183-L2192 | ||
lballabio/quantlib-old | 136336947ed4fea9ecc1da6edad188700e821739 | gensrc/gensrc/functions/function.py | python | Function.serialize | (self, serializer) | Load/unload class state to/from serializer object. | Load/unload class state to/from serializer object. | [
"Load",
"/",
"unload",
"class",
"state",
"to",
"/",
"from",
"serializer",
"object",
"."
] | def serialize(self, serializer):
"""Load/unload class state to/from serializer object."""
serializer.serializeAttribute(self, common.NAME)
serializer.serializeProperty(self, common.DESCRIPTION)
serializer.serializeProperty(self, common.LONG_DESC, self.description_)
serializer.ser... | [
"def",
"serialize",
"(",
"self",
",",
"serializer",
")",
":",
"serializer",
".",
"serializeAttribute",
"(",
"self",
",",
"common",
".",
"NAME",
")",
"serializer",
".",
"serializeProperty",
"(",
"self",
",",
"common",
".",
"DESCRIPTION",
")",
"serializer",
".... | https://github.com/lballabio/quantlib-old/blob/136336947ed4fea9ecc1da6edad188700e821739/gensrc/gensrc/functions/function.py#L119-L129 | ||
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Node/__init__.py | python | Node.set_noclean | (self, noclean = 1) | Set the Node's noclean value. | Set the Node's noclean value. | [
"Set",
"the",
"Node",
"s",
"noclean",
"value",
"."
] | def set_noclean(self, noclean = 1):
"""Set the Node's noclean value."""
# Make sure noclean is an integer so the --debug=stree
# output in Util.py can use it as an index.
self.noclean = noclean and 1 or 0 | [
"def",
"set_noclean",
"(",
"self",
",",
"noclean",
"=",
"1",
")",
":",
"# Make sure noclean is an integer so the --debug=stree",
"# output in Util.py can use it as an index.",
"self",
".",
"noclean",
"=",
"noclean",
"and",
"1",
"or",
"0"
] | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Node/__init__.py#L1198-L1202 | ||
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Node/FS.py | python | File.Dirs | (self, pathlist) | return [self.Dir(p) for p in pathlist] | Create a list of directories relative to the SConscript
directory of this file. | Create a list of directories relative to the SConscript
directory of this file. | [
"Create",
"a",
"list",
"of",
"directories",
"relative",
"to",
"the",
"SConscript",
"directory",
"of",
"this",
"file",
"."
] | def Dirs(self, pathlist):
"""Create a list of directories relative to the SConscript
directory of this file."""
return [self.Dir(p) for p in pathlist] | [
"def",
"Dirs",
"(",
"self",
",",
"pathlist",
")",
":",
"return",
"[",
"self",
".",
"Dir",
"(",
"p",
")",
"for",
"p",
"in",
"pathlist",
"]"
] | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Node/FS.py#L2654-L2657 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | PyWindow.DoMoveWindow | (*args, **kwargs) | return _windows_.PyWindow_DoMoveWindow(*args, **kwargs) | DoMoveWindow(self, int x, int y, int width, int height) | DoMoveWindow(self, int x, int y, int width, int height) | [
"DoMoveWindow",
"(",
"self",
"int",
"x",
"int",
"y",
"int",
"width",
"int",
"height",
")"
] | def DoMoveWindow(*args, **kwargs):
"""DoMoveWindow(self, int x, int y, int width, int height)"""
return _windows_.PyWindow_DoMoveWindow(*args, **kwargs) | [
"def",
"DoMoveWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PyWindow_DoMoveWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L4146-L4148 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/s3transfer/manager.py | python | TransferCoordinatorController.__init__ | (self) | Abstraction to control all transfer coordinators
This abstraction allows the manager to wait for inprogress transfers
to complete and cancel all inprogress transfers. | Abstraction to control all transfer coordinators | [
"Abstraction",
"to",
"control",
"all",
"transfer",
"coordinators"
] | def __init__(self):
"""Abstraction to control all transfer coordinators
This abstraction allows the manager to wait for inprogress transfers
to complete and cancel all inprogress transfers.
"""
self._lock = threading.Lock()
self._tracked_transfer_coordinators = set() | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_lock",
"=",
"threading",
".",
"Lock",
"(",
")",
"self",
".",
"_tracked_transfer_coordinators",
"=",
"set",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/s3transfer/manager.py#L577-L584 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/cgitb.py | python | html | (einfo, context=5) | return head + ''.join(frames) + ''.join(exception) + '''
<!-- The above is a description of an error in a Python program, formatted
for a Web browser because the 'cgitb' module was enabled. In case you
are not reading this in a Web browser, here is the original traceback:
%s
-->
''' % pydoc.html.escape(
... | Return a nice HTML document describing a given traceback. | Return a nice HTML document describing a given traceback. | [
"Return",
"a",
"nice",
"HTML",
"document",
"describing",
"a",
"given",
"traceback",
"."
] | def html(einfo, context=5):
"""Return a nice HTML document describing a given traceback."""
etype, evalue, etb = einfo
if type(etype) is types.ClassType:
etype = etype.__name__
pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable
date = time.ctime(time.time())
head = '<body... | [
"def",
"html",
"(",
"einfo",
",",
"context",
"=",
"5",
")",
":",
"etype",
",",
"evalue",
",",
"etb",
"=",
"einfo",
"if",
"type",
"(",
"etype",
")",
"is",
"types",
".",
"ClassType",
":",
"etype",
"=",
"etype",
".",
"__name__",
"pyver",
"=",
"'Python... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/cgitb.py#L102-L191 | |
LUX-Core/lux | 4e1ff7d34a9c76312135ddc869db09149c35170e | contrib/spendfrom/spendfrom.py | python | determine_db_dir | () | return os.path.expanduser("~/.lux") | Return the default location of the lux data directory | Return the default location of the lux data directory | [
"Return",
"the",
"default",
"location",
"of",
"the",
"lux",
"data",
"directory"
] | def determine_db_dir():
"""Return the default location of the lux data directory"""
if platform.system() == "Darwin":
return os.path.expanduser("~/Library/Application Support/LUX/")
elif platform.system() == "Windows":
return os.path.join(os.environ['APPDATA'], "LUX")
return os.path.expa... | [
"def",
"determine_db_dir",
"(",
")",
":",
"if",
"platform",
".",
"system",
"(",
")",
"==",
"\"Darwin\"",
":",
"return",
"os",
".",
"path",
".",
"expanduser",
"(",
"\"~/Library/Application Support/LUX/\"",
")",
"elif",
"platform",
".",
"system",
"(",
")",
"==... | https://github.com/LUX-Core/lux/blob/4e1ff7d34a9c76312135ddc869db09149c35170e/contrib/spendfrom/spendfrom.py#L35-L41 | |
fifengine/fifengine | 4b62c42e85bec19893cef8e63e6855927cff2c47 | engine/python/fife/extensions/pychan/widgets/slider.py | python | Slider._setScaleEnd | (self, end) | setScaleEnd(self, double scaleEnd) | setScaleEnd(self, double scaleEnd) | [
"setScaleEnd",
"(",
"self",
"double",
"scaleEnd",
")"
] | def _setScaleEnd(self, end):
"""setScaleEnd(self, double scaleEnd)"""
if type(end) != float:
raise RuntimeError("Slider expects float for end scale")
self.real_widget.setScaleEnd(end) | [
"def",
"_setScaleEnd",
"(",
"self",
",",
"end",
")",
":",
"if",
"type",
"(",
"end",
")",
"!=",
"float",
":",
"raise",
"RuntimeError",
"(",
"\"Slider expects float for end scale\"",
")",
"self",
".",
"real_widget",
".",
"setScaleEnd",
"(",
"end",
")"
] | https://github.com/fifengine/fifengine/blob/4b62c42e85bec19893cef8e63e6855927cff2c47/engine/python/fife/extensions/pychan/widgets/slider.py#L200-L204 | ||
MTG/gaia | 0f7214dbdec6f9b651ca34211824841ffba0bc77 | src/bindings/pygaia/utils.py | python | makedir | (path) | Create a directory and all the required parents. Do not raise an exception if the directory already existed.
This is the equivalent of 'mkdir -p'. | Create a directory and all the required parents. Do not raise an exception if the directory already existed. | [
"Create",
"a",
"directory",
"and",
"all",
"the",
"required",
"parents",
".",
"Do",
"not",
"raise",
"an",
"exception",
"if",
"the",
"directory",
"already",
"existed",
"."
] | def makedir(path):
"""Create a directory and all the required parents. Do not raise an exception if the directory already existed.
This is the equivalent of 'mkdir -p'."""
try:
os.makedirs(path)
except OSError as e:
if e.errno == errno.EEXIST:
pass
else: raise | [
"def",
"makedir",
"(",
"path",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"path",
")",
"except",
"OSError",
"as",
"e",
":",
"if",
"e",
".",
"errno",
"==",
"errno",
".",
"EEXIST",
":",
"pass",
"else",
":",
"raise"
] | https://github.com/MTG/gaia/blob/0f7214dbdec6f9b651ca34211824841ffba0bc77/src/bindings/pygaia/utils.py#L65-L74 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozpack/packager/__init__.py | python | SimpleManifestSink.__init__ | (self, finder, formatter) | Initialize the SimpleManifestSink. The given FileFinder is used to
get files matching the patterns given in the manifest. The given
formatter does the packaging job. | Initialize the SimpleManifestSink. The given FileFinder is used to
get files matching the patterns given in the manifest. The given
formatter does the packaging job. | [
"Initialize",
"the",
"SimpleManifestSink",
".",
"The",
"given",
"FileFinder",
"is",
"used",
"to",
"get",
"files",
"matching",
"the",
"patterns",
"given",
"in",
"the",
"manifest",
".",
"The",
"given",
"formatter",
"does",
"the",
"packaging",
"job",
"."
] | def __init__(self, finder, formatter):
'''
Initialize the SimpleManifestSink. The given FileFinder is used to
get files matching the patterns given in the manifest. The given
formatter does the packaging job.
'''
self._finder = finder
self.packager = SimplePackage... | [
"def",
"__init__",
"(",
"self",
",",
"finder",
",",
"formatter",
")",
":",
"self",
".",
"_finder",
"=",
"finder",
"self",
".",
"packager",
"=",
"SimplePackager",
"(",
"formatter",
")",
"self",
".",
"_closed",
"=",
"False",
"self",
".",
"_manifests",
"=",... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozpack/packager/__init__.py#L333-L342 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/data_flow_ops.py | python | Barrier.name | (self) | return self._barrier_ref.op.name | The name of the underlying barrier. | The name of the underlying barrier. | [
"The",
"name",
"of",
"the",
"underlying",
"barrier",
"."
] | def name(self):
"""The name of the underlying barrier."""
if context.executing_eagerly():
return self._name
return self._barrier_ref.op.name | [
"def",
"name",
"(",
"self",
")",
":",
"if",
"context",
".",
"executing_eagerly",
"(",
")",
":",
"return",
"self",
".",
"_name",
"return",
"self",
".",
"_barrier_ref",
".",
"op",
".",
"name"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/data_flow_ops.py#L1084-L1088 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_shapestrings.py | python | ShapeString.numericSSize | (self, ssize) | Validate the size in the user interface.
This function is called by the toolbar or taskpanel interface
when a valid size parameter has been entered in the input field. | Validate the size in the user interface. | [
"Validate",
"the",
"size",
"in",
"the",
"user",
"interface",
"."
] | def numericSSize(self, ssize):
"""Validate the size in the user interface.
This function is called by the toolbar or taskpanel interface
when a valid size parameter has been entered in the input field.
"""
self.SSSize = ssize
self.ui.STrackUi() | [
"def",
"numericSSize",
"(",
"self",
",",
"ssize",
")",
":",
"self",
".",
"SSSize",
"=",
"ssize",
"self",
".",
"ui",
".",
"STrackUi",
"(",
")"
] | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_shapestrings.py#L183-L190 | ||
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/position.py | python | Position.opening_cost | (self) | return self._opening_cost | Gets the opening_cost of this Position. # noqa: E501
:return: The opening_cost of this Position. # noqa: E501
:rtype: float | Gets the opening_cost of this Position. # noqa: E501 | [
"Gets",
"the",
"opening_cost",
"of",
"this",
"Position",
".",
"#",
"noqa",
":",
"E501"
] | def opening_cost(self):
"""Gets the opening_cost of this Position. # noqa: E501
:return: The opening_cost of this Position. # noqa: E501
:rtype: float
"""
return self._opening_cost | [
"def",
"opening_cost",
"(",
"self",
")",
":",
"return",
"self",
".",
"_opening_cost"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/position.py#L882-L889 | |
cinder/Cinder | e83f5bb9c01a63eec20168d02953a0879e5100f7 | src/freetype/tools/glnames.py | python | main | () | main program body | main program body | [
"main",
"program",
"body"
] | def main():
"""main program body"""
if len( sys.argv ) != 2:
print __doc__ % sys.argv[0]
sys.exit( 1 )
file = open( sys.argv[1], "wb" )
write = file.write
count_sid = len( sid_standard_names )
# `mac_extras' contains the list of glyph names in the Macintosh standard
# encoding which are not i... | [
"def",
"main",
"(",
")",
":",
"if",
"len",
"(",
"sys",
".",
"argv",
")",
"!=",
"2",
":",
"print",
"__doc__",
"%",
"sys",
".",
"argv",
"[",
"0",
"]",
"sys",
".",
"exit",
"(",
"1",
")",
"file",
"=",
"open",
"(",
"sys",
".",
"argv",
"[",
"1",
... | https://github.com/cinder/Cinder/blob/e83f5bb9c01a63eec20168d02953a0879e5100f7/src/freetype/tools/glnames.py#L5289-L5532 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/keras/python/keras/backend.py | python | cos | (x) | return math_ops.cos(x) | Computes cos of x element-wise.
Arguments:
x: Tensor or variable.
Returns:
A tensor. | Computes cos of x element-wise. | [
"Computes",
"cos",
"of",
"x",
"element",
"-",
"wise",
"."
] | def cos(x):
"""Computes cos of x element-wise.
Arguments:
x: Tensor or variable.
Returns:
A tensor.
"""
return math_ops.cos(x) | [
"def",
"cos",
"(",
"x",
")",
":",
"return",
"math_ops",
".",
"cos",
"(",
"x",
")"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/keras/python/keras/backend.py#L1781-L1790 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/ftplib.py | python | FTP.rmd | (self, dirname) | return self.voidcmd('RMD ' + dirname) | Remove a directory. | Remove a directory. | [
"Remove",
"a",
"directory",
"."
] | def rmd(self, dirname):
'''Remove a directory.'''
return self.voidcmd('RMD ' + dirname) | [
"def",
"rmd",
"(",
"self",
",",
"dirname",
")",
":",
"return",
"self",
".",
"voidcmd",
"(",
"'RMD '",
"+",
"dirname",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/ftplib.py#L571-L573 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2.py | python | recoverFile | (filename) | return xmlDoc(_obj=ret) | parse an XML file and build a tree. Automatic support for
ZLIB/Compress compressed document is provided by default if
found at compile-time. In the case the document is not Well
Formed, it attempts to build a tree anyway | parse an XML file and build a tree. Automatic support for
ZLIB/Compress compressed document is provided by default if
found at compile-time. In the case the document is not Well
Formed, it attempts to build a tree anyway | [
"parse",
"an",
"XML",
"file",
"and",
"build",
"a",
"tree",
".",
"Automatic",
"support",
"for",
"ZLIB",
"/",
"Compress",
"compressed",
"document",
"is",
"provided",
"by",
"default",
"if",
"found",
"at",
"compile",
"-",
"time",
".",
"In",
"the",
"case",
"t... | def recoverFile(filename):
"""parse an XML file and build a tree. Automatic support for
ZLIB/Compress compressed document is provided by default if
found at compile-time. In the case the document is not Well
Formed, it attempts to build a tree anyway """
ret = libxml2mod.xmlRecoverFile(filena... | [
"def",
"recoverFile",
"(",
"filename",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlRecoverFile",
"(",
"filename",
")",
"if",
"ret",
"is",
"None",
":",
"raise",
"treeError",
"(",
"'xmlRecoverFile() failed'",
")",
"return",
"xmlDoc",
"(",
"_obj",
"=",
"ret",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L1390-L1397 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/protobuf/python/google/protobuf/internal/python_message.py | python | _AddClearFieldMethod | (message_descriptor, cls) | Helper for _AddMessageMethods(). | Helper for _AddMessageMethods(). | [
"Helper",
"for",
"_AddMessageMethods",
"()",
"."
] | def _AddClearFieldMethod(message_descriptor, cls):
"""Helper for _AddMessageMethods()."""
def ClearField(self, field_name):
try:
field = message_descriptor.fields_by_name[field_name]
except KeyError:
raise ValueError('Protocol message has no "%s" field.' % field_name)
if field in self._fiel... | [
"def",
"_AddClearFieldMethod",
"(",
"message_descriptor",
",",
"cls",
")",
":",
"def",
"ClearField",
"(",
"self",
",",
"field_name",
")",
":",
"try",
":",
"field",
"=",
"message_descriptor",
".",
"fields_by_name",
"[",
"field_name",
"]",
"except",
"KeyError",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/protobuf/python/google/protobuf/internal/python_message.py#L608-L627 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/pipes.py | python | Template.__repr__ | (self) | return '<Template instance, steps=%r>' % (self.steps,) | t.__repr__() implements repr(t). | t.__repr__() implements repr(t). | [
"t",
".",
"__repr__",
"()",
"implements",
"repr",
"(",
"t",
")",
"."
] | def __repr__(self):
"""t.__repr__() implements repr(t)."""
return '<Template instance, steps=%r>' % (self.steps,) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'<Template instance, steps=%r>'",
"%",
"(",
"self",
".",
"steps",
",",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/pipes.py#L88-L90 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | ipc/ipdl/ipdl/parser.py | python | p_BridgesStmtsOpt | (p) | BridgesStmtsOpt : BridgesStmt BridgesStmtsOpt
| OpensStmtsOpt | BridgesStmtsOpt : BridgesStmt BridgesStmtsOpt
| OpensStmtsOpt | [
"BridgesStmtsOpt",
":",
"BridgesStmt",
"BridgesStmtsOpt",
"|",
"OpensStmtsOpt"
] | def p_BridgesStmtsOpt(p):
"""BridgesStmtsOpt : BridgesStmt BridgesStmtsOpt
| OpensStmtsOpt"""
if 2 == len(p):
p[0] = p[1]
else:
p[2].bridgesStmts.insert(0, p[1])
p[0] = p[2] | [
"def",
"p_BridgesStmtsOpt",
"(",
"p",
")",
":",
"if",
"2",
"==",
"len",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"p",
"[",
"1",
"]",
"else",
":",
"p",
"[",
"2",
"]",
".",
"bridgesStmts",
".",
"insert",
"(",
"0",
",",
"p",
"[",
"1",
"]... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/ipc/ipdl/ipdl/parser.py#L393-L400 | ||
borglab/gtsam | a5bee157efce6a0563704bce6a5d188c29817f39 | gtsam/3rdparty/Eigen/debug/gdb/printers.py | python | lookup_function | (val) | return None | Look-up and return a pretty-printer that can print va. | Look-up and return a pretty-printer that can print va. | [
"Look",
"-",
"up",
"and",
"return",
"a",
"pretty",
"-",
"printer",
"that",
"can",
"print",
"va",
"."
] | def lookup_function(val):
"Look-up and return a pretty-printer that can print va."
type = val.type
if type.code == gdb.TYPE_CODE_REF:
type = type.target()
type = type.unqualified().strip_typedefs()
typename = type.tag
if typename == None:
return None
for function in pretty_printers_dict:
if funct... | [
"def",
"lookup_function",
"(",
"val",
")",
":",
"type",
"=",
"val",
".",
"type",
"if",
"type",
".",
"code",
"==",
"gdb",
".",
"TYPE_CODE_REF",
":",
"type",
"=",
"type",
".",
"target",
"(",
")",
"type",
"=",
"type",
".",
"unqualified",
"(",
")",
"."... | https://github.com/borglab/gtsam/blob/a5bee157efce6a0563704bce6a5d188c29817f39/gtsam/3rdparty/Eigen/debug/gdb/printers.py#L192-L210 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/plat-mac/findertools.py | python | isactiveprocess | (processname) | return 0 | Check of processname is active. MacOS9 | Check of processname is active. MacOS9 | [
"Check",
"of",
"processname",
"is",
"active",
".",
"MacOS9"
] | def isactiveprocess(processname):
"""Check of processname is active. MacOS9"""
all = processes()
ok = 0
for n, c in all:
if n == processname:
return 1
return 0 | [
"def",
"isactiveprocess",
"(",
"processname",
")",
":",
"all",
"=",
"processes",
"(",
")",
"ok",
"=",
"0",
"for",
"n",
",",
"c",
"in",
"all",
":",
"if",
"n",
"==",
"processname",
":",
"return",
"1",
"return",
"0"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/plat-mac/findertools.py#L218-L225 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/dataset/vision/py_transforms.py | python | RandomResizedCrop.__call__ | (self, img) | return util.random_resize_crop(img, self.size, self.scale, self.ratio,
self.interpolation, self.max_attempts) | Call method.
Args:
img (PIL Image): Image to be randomly cropped and resized.
Returns:
PIL Image, randomly cropped and resized image. | Call method. | [
"Call",
"method",
"."
] | def __call__(self, img):
"""
Call method.
Args:
img (PIL Image): Image to be randomly cropped and resized.
Returns:
PIL Image, randomly cropped and resized image.
"""
return util.random_resize_crop(img, self.size, self.scale, self.ratio,
... | [
"def",
"__call__",
"(",
"self",
",",
"img",
")",
":",
"return",
"util",
".",
"random_resize_crop",
"(",
"img",
",",
"self",
".",
"size",
",",
"self",
".",
"scale",
",",
"self",
".",
"ratio",
",",
"self",
".",
"interpolation",
",",
"self",
".",
"max_a... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/vision/py_transforms.py#L666-L677 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/framemanager.py | python | AuiDockingHintWindow.SetShape | (self, region) | If the platform supports it, sets the shape of the window to that depicted by `region`.
The system will not display or respond to any mouse event for the pixels that lie
outside of the region. To reset the window to the normal rectangular shape simply call
:meth:`SetShape` again with an empty re... | If the platform supports it, sets the shape of the window to that depicted by `region`.
The system will not display or respond to any mouse event for the pixels that lie
outside of the region. To reset the window to the normal rectangular shape simply call
:meth:`SetShape` again with an empty re... | [
"If",
"the",
"platform",
"supports",
"it",
"sets",
"the",
"shape",
"of",
"the",
"window",
"to",
"that",
"depicted",
"by",
"region",
".",
"The",
"system",
"will",
"not",
"display",
"or",
"respond",
"to",
"any",
"mouse",
"event",
"for",
"the",
"pixels",
"t... | def SetShape(self, region):
"""
If the platform supports it, sets the shape of the window to that depicted by `region`.
The system will not display or respond to any mouse event for the pixels that lie
outside of the region. To reset the window to the normal rectangular shape simply call... | [
"def",
"SetShape",
"(",
"self",
",",
"region",
")",
":",
"if",
"wx",
".",
"Platform",
"==",
"'__WXMAC__'",
":",
"# HACK so we don't crash when SetShape is called",
"return",
"else",
":",
"super",
"(",
"AuiDockingHintWindow",
",",
"self",
")",
".",
"SetShape",
"(... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/framemanager.py#L2778-L2794 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/extras/msvs.py | python | msvs_generator.get_solution_node | (self) | return self.solution_node | The solution filename is required when writing the .vcproj files
return self.solution_node and if it does not exist, make one | The solution filename is required when writing the .vcproj files
return self.solution_node and if it does not exist, make one | [
"The",
"solution",
"filename",
"is",
"required",
"when",
"writing",
"the",
".",
"vcproj",
"files",
"return",
"self",
".",
"solution_node",
"and",
"if",
"it",
"does",
"not",
"exist",
"make",
"one"
] | def get_solution_node(self):
"""
The solution filename is required when writing the .vcproj files
return self.solution_node and if it does not exist, make one
"""
try:
return self.solution_node
except:
pass
solution_name = getattr(self, 'solution_name', None)
if not solution_name:
solution_nam... | [
"def",
"get_solution_node",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"solution_node",
"except",
":",
"pass",
"solution_name",
"=",
"getattr",
"(",
"self",
",",
"'solution_name'",
",",
"None",
")",
"if",
"not",
"solution_name",
":",
"solution... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/extras/msvs.py#L788-L805 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.