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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jackaudio/jack2 | 21b293dbc37d42446141a08922cdec0d2550c6a0 | waflib/Configure.py | python | ConfigurationContext.setenv | (self, name, env=None) | Set a new config set for conf.env. If a config set of that name already exists,
recall it without modification.
The name is the filename prefix to save to ``c4che/NAME_cache.py``, and it
is also used as *variants* by the build commands.
Though related to variants, whatever kind of data may be stored in the con... | Set a new config set for conf.env. If a config set of that name already exists,
recall it without modification. | [
"Set",
"a",
"new",
"config",
"set",
"for",
"conf",
".",
"env",
".",
"If",
"a",
"config",
"set",
"of",
"that",
"name",
"already",
"exists",
"recall",
"it",
"without",
"modification",
"."
] | def setenv(self, name, env=None):
"""
Set a new config set for conf.env. If a config set of that name already exists,
recall it without modification.
The name is the filename prefix to save to ``c4che/NAME_cache.py``, and it
is also used as *variants* by the build commands.
Though related to variants, what... | [
"def",
"setenv",
"(",
"self",
",",
"name",
",",
"env",
"=",
"None",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"all_envs",
"or",
"env",
":",
"if",
"not",
"env",
":",
"env",
"=",
"ConfigSet",
".",
"ConfigSet",
"(",
")",
"self",
".",
"prepar... | https://github.com/jackaudio/jack2/blob/21b293dbc37d42446141a08922cdec0d2550c6a0/waflib/Configure.py#L56-L85 | ||
tomahawk-player/tomahawk-resolvers | 7f827bbe410ccfdb0446f7d6a91acc2199c9cc8d | archive/spotify/breakpad/third_party/protobuf/protobuf/python/ez_setup.py | python | main | (argv, version=DEFAULT_VERSION) | Install or upgrade setuptools and EasyInstall | Install or upgrade setuptools and EasyInstall | [
"Install",
"or",
"upgrade",
"setuptools",
"and",
"EasyInstall"
] | def main(argv, version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall"""
try:
import setuptools
except ImportError:
egg = None
try:
egg = download_setuptools(version, delay=0)
sys.path.insert(0,egg)
from setuptools.command.easy_... | [
"def",
"main",
"(",
"argv",
",",
"version",
"=",
"DEFAULT_VERSION",
")",
":",
"try",
":",
"import",
"setuptools",
"except",
"ImportError",
":",
"egg",
"=",
"None",
"try",
":",
"egg",
"=",
"download_setuptools",
"(",
"version",
",",
"delay",
"=",
"0",
")"... | https://github.com/tomahawk-player/tomahawk-resolvers/blob/7f827bbe410ccfdb0446f7d6a91acc2199c9cc8d/archive/spotify/breakpad/third_party/protobuf/protobuf/python/ez_setup.py#L208-L247 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/converters/mil/frontend/torch/ops.py | python | _ifzo_to_ifoz | (weights, name) | return mb.transpose(
x=weights_concat, perm=([1, 0] if len(weights.shape) > 1 else [0]), name=name
) | i, f, z, o -> i, f, o, z
where weights_split[0] == i, etc.
Used to transform lstm weights from pytorch
to CoreML format | i, f, z, o -> i, f, o, z
where weights_split[0] == i, etc.
Used to transform lstm weights from pytorch
to CoreML format | [
"i",
"f",
"z",
"o",
"-",
">",
"i",
"f",
"o",
"z",
"where",
"weights_split",
"[",
"0",
"]",
"==",
"i",
"etc",
".",
"Used",
"to",
"transform",
"lstm",
"weights",
"from",
"pytorch",
"to",
"CoreML",
"format"
] | def _ifzo_to_ifoz(weights, name):
"""
i, f, z, o -> i, f, o, z
where weights_split[0] == i, etc.
Used to transform lstm weights from pytorch
to CoreML format
"""
split_size = weights.shape[0] // 4
weights_split = mb.split(x=weights, split_sizes=_np.array([split_size] * 4)... | [
"def",
"_ifzo_to_ifoz",
"(",
"weights",
",",
"name",
")",
":",
"split_size",
"=",
"weights",
".",
"shape",
"[",
"0",
"]",
"//",
"4",
"weights_split",
"=",
"mb",
".",
"split",
"(",
"x",
"=",
"weights",
",",
"split_sizes",
"=",
"_np",
".",
"array",
"("... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/frontend/torch/ops.py#L971-L987 | |
rdiankov/openrave | d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7 | python/ikfast_sympy0_6.py | python | IKFastSolver.solve6DIntersectingAxes | (self, T0links, T1links, transvars,rotvars,solveRotationFirst,endbranchtree) | Solve 6D equations using fact that 3 axes are intersecting. The 3 intersecting axes are all part of T0links and will be used to compute the rotation of the robot. The other 3 axes are part of T1links and will be used to first compute the position. | Solve 6D equations using fact that 3 axes are intersecting. The 3 intersecting axes are all part of T0links and will be used to compute the rotation of the robot. The other 3 axes are part of T1links and will be used to first compute the position. | [
"Solve",
"6D",
"equations",
"using",
"fact",
"that",
"3",
"axes",
"are",
"intersecting",
".",
"The",
"3",
"intersecting",
"axes",
"are",
"all",
"part",
"of",
"T0links",
"and",
"will",
"be",
"used",
"to",
"compute",
"the",
"rotation",
"of",
"the",
"robot",
... | def solve6DIntersectingAxes(self, T0links, T1links, transvars,rotvars,solveRotationFirst,endbranchtree):
"""Solve 6D equations using fact that 3 axes are intersecting. The 3 intersecting axes are all part of T0links and will be used to compute the rotation of the robot. The other 3 axes are part of T1links and ... | [
"def",
"solve6DIntersectingAxes",
"(",
"self",
",",
"T0links",
",",
"T1links",
",",
"transvars",
",",
"rotvars",
",",
"solveRotationFirst",
",",
"endbranchtree",
")",
":",
"assert",
"(",
"len",
"(",
"transvars",
")",
"==",
"3",
"and",
"len",
"(",
"rotvars",
... | https://github.com/rdiankov/openrave/blob/d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7/python/ikfast_sympy0_6.py#L2169-L2225 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/threading.py | python | Barrier.reset | (self) | Reset the barrier to the initial state.
Any threads currently waiting will get the BrokenBarrier exception
raised. | Reset the barrier to the initial state. | [
"Reset",
"the",
"barrier",
"to",
"the",
"initial",
"state",
"."
] | def reset(self):
"""Reset the barrier to the initial state.
Any threads currently waiting will get the BrokenBarrier exception
raised.
"""
with self._cond:
if self._count > 0:
if self._state == 0:
#reset the barrier, waking up thr... | [
"def",
"reset",
"(",
"self",
")",
":",
"with",
"self",
".",
"_cond",
":",
"if",
"self",
".",
"_count",
">",
"0",
":",
"if",
"self",
".",
"_state",
"==",
"0",
":",
"#reset the barrier, waking up threads",
"self",
".",
"_state",
"=",
"-",
"1",
"elif",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/threading.py#L687-L705 | ||
danxuhk/ContinuousCRF-CNN | 2b6dcaf179620f118b225ed12c890414ca828e21 | scripts/cpp_lint.py | python | ReverseCloseExpression | (clean_lines, linenum, pos) | return (line, 0, -1) | If input points to ) or } or ] or >, finds the position that opens it.
If lines[linenum][pos] points to a ')' or '}' or ']' or '>', finds the
linenum/pos that correspond to the opening of the expression.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to ... | If input points to ) or } or ] or >, finds the position that opens it. | [
"If",
"input",
"points",
"to",
")",
"or",
"}",
"or",
"]",
"or",
">",
"finds",
"the",
"position",
"that",
"opens",
"it",
"."
] | def ReverseCloseExpression(clean_lines, linenum, pos):
"""If input points to ) or } or ] or >, finds the position that opens it.
If lines[linenum][pos] points to a ')' or '}' or ']' or '>', finds the
linenum/pos that correspond to the opening of the expression.
Args:
clean_lines: A CleansedLines instance ... | [
"def",
"ReverseCloseExpression",
"(",
"clean_lines",
",",
"linenum",
",",
"pos",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"endchar",
"=",
"line",
"[",
"pos",
"]",
"if",
"endchar",
"not",
"in",
"')}]>'",
":",
"return",
"("... | https://github.com/danxuhk/ContinuousCRF-CNN/blob/2b6dcaf179620f118b225ed12c890414ca828e21/scripts/cpp_lint.py#L1331-L1373 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TIntV.QSort | (self, *args) | return _snap.TIntV_QSort(self, *args) | QSort(TIntV self, int const & MnLValN, int const & MxRValN, bool const & Asc)
Parameters:
MnLValN: int const &
MxRValN: int const &
Asc: bool const & | QSort(TIntV self, int const & MnLValN, int const & MxRValN, bool const & Asc) | [
"QSort",
"(",
"TIntV",
"self",
"int",
"const",
"&",
"MnLValN",
"int",
"const",
"&",
"MxRValN",
"bool",
"const",
"&",
"Asc",
")"
] | def QSort(self, *args):
"""
QSort(TIntV self, int const & MnLValN, int const & MxRValN, bool const & Asc)
Parameters:
MnLValN: int const &
MxRValN: int const &
Asc: bool const &
"""
return _snap.TIntV_QSort(self, *args) | [
"def",
"QSort",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TIntV_QSort",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L15936-L15946 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/html.py | python | HtmlWindow.__init__ | (self, *args, **kwargs) | __init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, int style=HW_DEFAULT_STYLE,
String name=HtmlWindowNameStr) -> HtmlWindow | __init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, int style=HW_DEFAULT_STYLE,
String name=HtmlWindowNameStr) -> HtmlWindow | [
"__init__",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"int",
"style",
"=",
"HW_DEFAULT_STYLE",
"String",
"name",
"=",
"HtmlWindowNameStr",
")",
"-",
">",
"HtmlWind... | def __init__(self, *args, **kwargs):
"""
__init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, int style=HW_DEFAULT_STYLE,
String name=HtmlWindowNameStr) -> HtmlWindow
"""
_html.HtmlWindow_swiginit(self,_html.new_HtmlWindow(... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_html",
".",
"HtmlWindow_swiginit",
"(",
"self",
",",
"_html",
".",
"new_HtmlWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"self",
".",
"_setOORInfo... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/html.py#L965-L972 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | grc/gui/PropsDialog.py | python | PropsDialog._update_docs_page | (self) | Show documentation from XML and try to display best matching docstring | Show documentation from XML and try to display best matching docstring | [
"Show",
"documentation",
"from",
"XML",
"and",
"try",
"to",
"display",
"best",
"matching",
"docstring"
] | def _update_docs_page(self):
"""Show documentation from XML and try to display best matching docstring"""
buf = self._docs_text_display.get_buffer()
buf.delete(buf.get_start_iter(), buf.get_end_iter())
pos = buf.get_end_iter()
# Add link to wiki page for this block, at the top, ... | [
"def",
"_update_docs_page",
"(",
"self",
")",
":",
"buf",
"=",
"self",
".",
"_docs_text_display",
".",
"get_buffer",
"(",
")",
"buf",
".",
"delete",
"(",
"buf",
".",
"get_start_iter",
"(",
")",
",",
"buf",
".",
"get_end_iter",
"(",
")",
")",
"pos",
"="... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/grc/gui/PropsDialog.py#L208-L250 | ||
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | Tools/ecl_ekf/plotting/data_plots.py | python | InnovationPlot.plot | (self) | plots the Innovation data.
:return: | plots the Innovation data.
:return: | [
"plots",
"the",
"Innovation",
"data",
".",
":",
"return",
":"
] | def plot(self):
"""
plots the Innovation data.
:return:
"""
if self.fig is None:
return
for i in range(len(self._variable_names)):
# create a subplot for every variable
plt.subplot(len(self._variable_names), 1, i + 1)
if s... | [
"def",
"plot",
"(",
"self",
")",
":",
"if",
"self",
".",
"fig",
"is",
"None",
":",
"return",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"_variable_names",
")",
")",
":",
"# create a subplot for every variable",
"plt",
".",
"subplot",
"(",
... | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/Tools/ecl_ekf/plotting/data_plots.py#L208-L252 | ||
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | kratos/python_scripts/python_solver.py | python | PythonSolver.__init__ | (self, model, settings) | The constructor of the PythonSolver-Object.
It is intended to be called from the constructor
of deriving classes:
super().__init__(settings)
Keyword arguments:
self -- It signifies an instance of a class.
model -- The Model to be used
settings -- The solver sett... | The constructor of the PythonSolver-Object. | [
"The",
"constructor",
"of",
"the",
"PythonSolver",
"-",
"Object",
"."
] | def __init__(self, model, settings):
"""The constructor of the PythonSolver-Object.
It is intended to be called from the constructor
of deriving classes:
super().__init__(settings)
Keyword arguments:
self -- It signifies an instance of a class.
model -- The Mode... | [
"def",
"__init__",
"(",
"self",
",",
"model",
",",
"settings",
")",
":",
"if",
"not",
"isinstance",
"(",
"model",
",",
"KratosMultiphysics",
".",
"Model",
")",
":",
"raise",
"Exception",
"(",
"\"Input is expected to be provided as a Kratos Model object\"",
")",
"i... | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/kratos/python_scripts/python_solver.py#L12-L35 | ||
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | tools/response_file.py | python | read_response_file | (response_filename) | return args | Reads a response file, and returns the list of cmdline params found in the
file.
The encoding that the response filename should be read with can be specified
as a suffix to the file, e.g. "foo.rsp.utf-8" or "foo.rsp.cp1252". If not
specified, first UTF-8 and then Python locale.getpreferredencoding() are
atte... | Reads a response file, and returns the list of cmdline params found in the
file. | [
"Reads",
"a",
"response",
"file",
"and",
"returns",
"the",
"list",
"of",
"cmdline",
"params",
"found",
"in",
"the",
"file",
"."
] | def read_response_file(response_filename):
"""Reads a response file, and returns the list of cmdline params found in the
file.
The encoding that the response filename should be read with can be specified
as a suffix to the file, e.g. "foo.rsp.utf-8" or "foo.rsp.cp1252". If not
specified, first UTF-8 and then... | [
"def",
"read_response_file",
"(",
"response_filename",
")",
":",
"if",
"response_filename",
".",
"startswith",
"(",
"'@'",
")",
":",
"response_filename",
"=",
"response_filename",
"[",
"1",
":",
"]",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"respo... | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/tools/response_file.py#L68-L108 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py | python | Decimal.__rdivmod__ | (self, other, context=None) | return other.__divmod__(self, context=context) | Swaps self/other and returns __divmod__. | Swaps self/other and returns __divmod__. | [
"Swaps",
"self",
"/",
"other",
"and",
"returns",
"__divmod__",
"."
] | def __rdivmod__(self, other, context=None):
"""Swaps self/other and returns __divmod__."""
other = _convert_other(other)
if other is NotImplemented:
return other
return other.__divmod__(self, context=context) | [
"def",
"__rdivmod__",
"(",
"self",
",",
"other",
",",
"context",
"=",
"None",
")",
":",
"other",
"=",
"_convert_other",
"(",
"other",
")",
"if",
"other",
"is",
"NotImplemented",
":",
"return",
"other",
"return",
"other",
".",
"__divmod__",
"(",
"self",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py#L1459-L1464 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | TopLevelWindow.ShowWithoutActivating | (*args, **kwargs) | return _windows_.TopLevelWindow_ShowWithoutActivating(*args, **kwargs) | ShowWithoutActivating(self) | ShowWithoutActivating(self) | [
"ShowWithoutActivating",
"(",
"self",
")"
] | def ShowWithoutActivating(*args, **kwargs):
"""ShowWithoutActivating(self)"""
return _windows_.TopLevelWindow_ShowWithoutActivating(*args, **kwargs) | [
"def",
"ShowWithoutActivating",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"TopLevelWindow_ShowWithoutActivating",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L445-L447 | |
JoseExposito/touchegg | 1f3fda214358d071c05da4bf17c070c33d67b5eb | cmake/cpplint.py | python | CheckForHeaderGuard | (filename, clean_lines, error) | Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used.
Args:
filename: The name of the C++ header file.
clean_lines: A CleansedLines instance containing the file.
error: The function to call with a... | Checks that the file contains a header guard. | [
"Checks",
"that",
"the",
"file",
"contains",
"a",
"header",
"guard",
"."
] | def CheckForHeaderGuard(filename, clean_lines, error):
"""Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used.
Args:
filename: The name of the C++ header file.
clean_lines: A CleansedLines instance... | [
"def",
"CheckForHeaderGuard",
"(",
"filename",
",",
"clean_lines",
",",
"error",
")",
":",
"# Don't check for header guards if there are error suppression",
"# comments somewhere in this file.",
"#",
"# Because this is silencing a warning for a nonexistent line, we",
"# only support the ... | https://github.com/JoseExposito/touchegg/blob/1f3fda214358d071c05da4bf17c070c33d67b5eb/cmake/cpplint.py#L1885-L1980 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/SANS/isis_reducer.py | python | ISISReducer.get_instrument | (self) | return self.instrument | Convenience function used by the inst property to make
calls shorter | Convenience function used by the inst property to make
calls shorter | [
"Convenience",
"function",
"used",
"by",
"the",
"inst",
"property",
"to",
"make",
"calls",
"shorter"
] | def get_instrument(self):
"""
Convenience function used by the inst property to make
calls shorter
"""
return self.instrument | [
"def",
"get_instrument",
"(",
"self",
")",
":",
"return",
"self",
".",
"instrument"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/SANS/isis_reducer.py#L684-L689 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/Cookie.py | python | BaseCookie.output | (self, attrs=None, header="Set-Cookie:", sep="\015\012") | return sep.join(result) | Return a string suitable for HTTP. | Return a string suitable for HTTP. | [
"Return",
"a",
"string",
"suitable",
"for",
"HTTP",
"."
] | def output(self, attrs=None, header="Set-Cookie:", sep="\015\012"):
"""Return a string suitable for HTTP."""
result = []
items = self.items()
items.sort()
for K,V in items:
result.append( V.output(attrs, header) )
return sep.join(result) | [
"def",
"output",
"(",
"self",
",",
"attrs",
"=",
"None",
",",
"header",
"=",
"\"Set-Cookie:\"",
",",
"sep",
"=",
"\"\\015\\012\"",
")",
":",
"result",
"=",
"[",
"]",
"items",
"=",
"self",
".",
"items",
"(",
")",
"items",
".",
"sort",
"(",
")",
"for... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/Cookie.py#L595-L602 | |
rrwick/Unicycler | 96ffea71e3a78d63ade19d6124946773e65cf129 | unicycler/string_graph.py | python | StringGraphSegment.rotate_sequence | (self, start_pos, flip) | Rotates the sequence so it begins at start_pos. If flip is True, it also switches the
forward and reverse strands. This function assumes that the segment is a circular
completed replicon with no overlap. | Rotates the sequence so it begins at start_pos. If flip is True, it also switches the
forward and reverse strands. This function assumes that the segment is a circular
completed replicon with no overlap. | [
"Rotates",
"the",
"sequence",
"so",
"it",
"begins",
"at",
"start_pos",
".",
"If",
"flip",
"is",
"True",
"it",
"also",
"switches",
"the",
"forward",
"and",
"reverse",
"strands",
".",
"This",
"function",
"assumes",
"that",
"the",
"segment",
"is",
"a",
"circu... | def rotate_sequence(self, start_pos, flip):
"""
Rotates the sequence so it begins at start_pos. If flip is True, it also switches the
forward and reverse strands. This function assumes that the segment is a circular
completed replicon with no overlap.
"""
unrotated_seq = ... | [
"def",
"rotate_sequence",
"(",
"self",
",",
"start_pos",
",",
"flip",
")",
":",
"unrotated_seq",
"=",
"self",
".",
"forward_sequence",
"rotated_seq",
"=",
"unrotated_seq",
"[",
"start_pos",
":",
"]",
"+",
"unrotated_seq",
"[",
":",
"start_pos",
"]",
"rev_comp_... | https://github.com/rrwick/Unicycler/blob/96ffea71e3a78d63ade19d6124946773e65cf129/unicycler/string_graph.py#L462-L477 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/interpolate/_bsplines.py | python | _as_float_array | (x, check_finite=False) | return x | Convert the input into a C contiguous float array.
NB: Upcasts half- and single-precision floats to double precision. | Convert the input into a C contiguous float array. | [
"Convert",
"the",
"input",
"into",
"a",
"C",
"contiguous",
"float",
"array",
"."
] | def _as_float_array(x, check_finite=False):
"""Convert the input into a C contiguous float array.
NB: Upcasts half- and single-precision floats to double precision.
"""
x = np.ascontiguousarray(x)
dtyp = _get_dtype(x.dtype)
x = x.astype(dtyp, copy=False)
if check_finite and not np.isfinite(... | [
"def",
"_as_float_array",
"(",
"x",
",",
"check_finite",
"=",
"False",
")",
":",
"x",
"=",
"np",
".",
"ascontiguousarray",
"(",
"x",
")",
"dtyp",
"=",
"_get_dtype",
"(",
"x",
".",
"dtype",
")",
"x",
"=",
"x",
".",
"astype",
"(",
"dtyp",
",",
"copy"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/interpolate/_bsplines.py#L33-L43 | |
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/scripts/exomerge2.py | python | ExodusModel._get_thickness_from_volume_and_area | (self, volume, area) | return height | Return the thickness of a disk given the volume and area. | Return the thickness of a disk given the volume and area. | [
"Return",
"the",
"thickness",
"of",
"a",
"disk",
"given",
"the",
"volume",
"and",
"area",
"."
] | def _get_thickness_from_volume_and_area(self, volume, area):
"""Return the thickness of a disk given the volume and area."""
# max phi (for a sphere) is 6^(-1/3) * pi^(-1/6)
phi = math.pow(volume, 1 / 3.0) / math.pow(area, 1 / 2.0)
# find a solution, if possible
max_alpha = math.... | [
"def",
"_get_thickness_from_volume_and_area",
"(",
"self",
",",
"volume",
",",
"area",
")",
":",
"# max phi (for a sphere) is 6^(-1/3) * pi^(-1/6)",
"phi",
"=",
"math",
".",
"pow",
"(",
"volume",
",",
"1",
"/",
"3.0",
")",
"/",
"math",
".",
"pow",
"(",
"area",... | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exomerge2.py#L8173-L8199 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/dateutil/rrule.py | python | rruleset.exdate | (self, exdate) | Include the given datetime instance in the recurrence set
exclusion list. Dates included that way will not be generated,
even if some inclusive rrule or rdate matches them. | Include the given datetime instance in the recurrence set
exclusion list. Dates included that way will not be generated,
even if some inclusive rrule or rdate matches them. | [
"Include",
"the",
"given",
"datetime",
"instance",
"in",
"the",
"recurrence",
"set",
"exclusion",
"list",
".",
"Dates",
"included",
"that",
"way",
"will",
"not",
"be",
"generated",
"even",
"if",
"some",
"inclusive",
"rrule",
"or",
"rdate",
"matches",
"them",
... | def exdate(self, exdate):
""" Include the given datetime instance in the recurrence set
exclusion list. Dates included that way will not be generated,
even if some inclusive rrule or rdate matches them. """
self._exdate.append(exdate) | [
"def",
"exdate",
"(",
"self",
",",
"exdate",
")",
":",
"self",
".",
"_exdate",
".",
"append",
"(",
"exdate",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/dateutil/rrule.py#L1375-L1379 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/dataview.py | python | DataViewEvent.IsEditCancelled | (*args, **kwargs) | return _dataview.DataViewEvent_IsEditCancelled(*args, **kwargs) | IsEditCancelled(self) -> bool | IsEditCancelled(self) -> bool | [
"IsEditCancelled",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsEditCancelled(*args, **kwargs):
"""IsEditCancelled(self) -> bool"""
return _dataview.DataViewEvent_IsEditCancelled(*args, **kwargs) | [
"def",
"IsEditCancelled",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewEvent_IsEditCancelled",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/dataview.py#L1932-L1934 | |
apache/qpid-proton | 6bcdfebb55ea3554bc29b1901422532db331a591 | python/proton/_utils.py | python | SyncRequestResponse.reply_to | (self) | return self.receiver.remote_source.address | The dynamic address of our receiver. | The dynamic address of our receiver. | [
"The",
"dynamic",
"address",
"of",
"our",
"receiver",
"."
] | def reply_to(self) -> str:
"""
The dynamic address of our receiver.
"""
return self.receiver.remote_source.address | [
"def",
"reply_to",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"receiver",
".",
"remote_source",
".",
"address"
] | https://github.com/apache/qpid-proton/blob/6bcdfebb55ea3554bc29b1901422532db331a591/python/proton/_utils.py#L627-L631 | |
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | python/mxnet/kvstore.py | python | _ctype_key_value | (keys, vals) | Returns ctype arrays for the key-value args, and the whether string keys are used.
For internal use only. | Returns ctype arrays for the key-value args, and the whether string keys are used.
For internal use only. | [
"Returns",
"ctype",
"arrays",
"for",
"the",
"key",
"-",
"value",
"args",
"and",
"the",
"whether",
"string",
"keys",
"are",
"used",
".",
"For",
"internal",
"use",
"only",
"."
] | def _ctype_key_value(keys, vals):
"""
Returns ctype arrays for the key-value args, and the whether string keys are used.
For internal use only.
"""
if isinstance(keys, (tuple, list)):
assert(len(keys) == len(vals))
c_keys = []
c_vals = []
use_str_keys = None
f... | [
"def",
"_ctype_key_value",
"(",
"keys",
",",
"vals",
")",
":",
"if",
"isinstance",
"(",
"keys",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"assert",
"(",
"len",
"(",
"keys",
")",
"==",
"len",
"(",
"vals",
")",
")",
"c_keys",
"=",
"[",
"]",
... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/kvstore.py#L32-L65 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | tools/nightly.py | python | _ensure_commit | (git_sha1: str) | Make sure that we actually have the commit locally | Make sure that we actually have the commit locally | [
"Make",
"sure",
"that",
"we",
"actually",
"have",
"the",
"commit",
"locally"
] | def _ensure_commit(git_sha1: str) -> None:
"""Make sure that we actually have the commit locally"""
cmd = ["git", "cat-file", "-e", git_sha1 + "^{commit}"]
p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=False)
if p.returncode == 0:
# we have the commit locally
... | [
"def",
"_ensure_commit",
"(",
"git_sha1",
":",
"str",
")",
"->",
"None",
":",
"cmd",
"=",
"[",
"\"git\"",
",",
"\"cat-file\"",
",",
"\"-e\"",
",",
"git_sha1",
"+",
"\"^{commit}\"",
"]",
"p",
"=",
"subprocess",
".",
"run",
"(",
"cmd",
",",
"stdout",
"="... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/tools/nightly.py#L344-L353 | ||
p4lang/behavioral-model | 81ce0163f0770c6b9d6056a28ce2e0cc035bb6e9 | tools/cpplint.py | python | ProcessFile | (filename, vlevel, extra_check_functions=None) | Does google-lint on a single file.
Args:
filename: The name of the file to parse.
vlevel: The level of errors to report. Every error of confidence
>= verbose_level will be reported. 0 is a good default.
extra_check_functions: An array of additional check functions that will be
... | Does google-lint on a single file. | [
"Does",
"google",
"-",
"lint",
"on",
"a",
"single",
"file",
"."
] | def ProcessFile(filename, vlevel, extra_check_functions=None):
"""Does google-lint on a single file.
Args:
filename: The name of the file to parse.
vlevel: The level of errors to report. Every error of confidence
>= verbose_level will be reported. 0 is a good default.
extra_check_functions: An ... | [
"def",
"ProcessFile",
"(",
"filename",
",",
"vlevel",
",",
"extra_check_functions",
"=",
"None",
")",
":",
"_SetVerboseLevel",
"(",
"vlevel",
")",
"_BackupFilters",
"(",
")",
"old_errors",
"=",
"_cpplint_state",
".",
"error_count",
"if",
"not",
"ProcessConfigOverr... | https://github.com/p4lang/behavioral-model/blob/81ce0163f0770c6b9d6056a28ce2e0cc035bb6e9/tools/cpplint.py#L6591-L6681 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/copy_reg.py | python | add_extension | (module, name, code) | Register an extension code. | Register an extension code. | [
"Register",
"an",
"extension",
"code",
"."
] | def add_extension(module, name, code):
"""Register an extension code."""
code = int(code)
if not 1 <= code <= 0x7fffffff:
raise ValueError, "code out of range"
key = (module, name)
if (_extension_registry.get(key) == code and
_inverted_registry.get(code) == key):
return # Red... | [
"def",
"add_extension",
"(",
"module",
",",
"name",
",",
"code",
")",
":",
"code",
"=",
"int",
"(",
"code",
")",
"if",
"not",
"1",
"<=",
"code",
"<=",
"0x7fffffff",
":",
"raise",
"ValueError",
",",
"\"code out of range\"",
"key",
"=",
"(",
"module",
",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/copy_reg.py#L157-L173 | ||
apiaryio/drafter | 4634ebd07f6c6f257cc656598ccd535492fdfb55 | tools/gyp/pylib/gyp/generator/xcode.py | python | EscapeXcodeDefine | (s) | return re.sub(_xcode_define_re, r'\\\1', s) | We must escape the defines that we give to XCode so that it knows not to
split on spaces and to respect backslash and quote literals. However, we
must not quote the define, or Xcode will incorrectly intepret variables
especially $(inherited). | We must escape the defines that we give to XCode so that it knows not to
split on spaces and to respect backslash and quote literals. However, we
must not quote the define, or Xcode will incorrectly intepret variables
especially $(inherited). | [
"We",
"must",
"escape",
"the",
"defines",
"that",
"we",
"give",
"to",
"XCode",
"so",
"that",
"it",
"knows",
"not",
"to",
"split",
"on",
"spaces",
"and",
"to",
"respect",
"backslash",
"and",
"quote",
"literals",
".",
"However",
"we",
"must",
"not",
"quote... | def EscapeXcodeDefine(s):
"""We must escape the defines that we give to XCode so that it knows not to
split on spaces and to respect backslash and quote literals. However, we
must not quote the define, or Xcode will incorrectly intepret variables
especially $(inherited)."""
return re.sub(_xcode_defin... | [
"def",
"EscapeXcodeDefine",
"(",
"s",
")",
":",
"return",
"re",
".",
"sub",
"(",
"_xcode_define_re",
",",
"r'\\\\\\1'",
",",
"s",
")"
] | https://github.com/apiaryio/drafter/blob/4634ebd07f6c6f257cc656598ccd535492fdfb55/tools/gyp/pylib/gyp/generator/xcode.py#L557-L562 | |
kevin-ssy/Optical-Flow-Guided-Feature | 07d4501a29002ee7821c38c1820e4a64c1acf6e8 | lib/caffe-action/scripts/cpp_lint.py | python | _NestingState.InnermostClass | (self) | return None | Get class info on the top of the stack.
Returns:
A _ClassInfo object if we are inside a class, or None otherwise. | Get class info on the top of the stack. | [
"Get",
"class",
"info",
"on",
"the",
"top",
"of",
"the",
"stack",
"."
] | def InnermostClass(self):
"""Get class info on the top of the stack.
Returns:
A _ClassInfo object if we are inside a class, or None otherwise.
"""
for i in range(len(self.stack), 0, -1):
classinfo = self.stack[i - 1]
if isinstance(classinfo, _ClassInfo):
return classinfo
r... | [
"def",
"InnermostClass",
"(",
"self",
")",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"stack",
")",
",",
"0",
",",
"-",
"1",
")",
":",
"classinfo",
"=",
"self",
".",
"stack",
"[",
"i",
"-",
"1",
"]",
"if",
"isinstance",
"(",
... | https://github.com/kevin-ssy/Optical-Flow-Guided-Feature/blob/07d4501a29002ee7821c38c1820e4a64c1acf6e8/lib/caffe-action/scripts/cpp_lint.py#L2160-L2170 | |
indutny/candor | 48e7260618f5091c80a3416828e2808cad3ea22e | tools/gyp/pylib/gyp/easy_xml.py | python | XmlToString | (content, encoding='utf-8', pretty=False) | return ''.join(xml_parts) | Writes the XML content to disk, touching the file only if it has changed.
Visual Studio files have a lot of pre-defined structures. This function makes
it easy to represent these structures as Python data structures, instead of
having to create a lot of function calls.
Each XML element of the content is repr... | Writes the XML content to disk, touching the file only if it has changed. | [
"Writes",
"the",
"XML",
"content",
"to",
"disk",
"touching",
"the",
"file",
"only",
"if",
"it",
"has",
"changed",
"."
] | def XmlToString(content, encoding='utf-8', pretty=False):
""" Writes the XML content to disk, touching the file only if it has changed.
Visual Studio files have a lot of pre-defined structures. This function makes
it easy to represent these structures as Python data structures, instead of
having to create a l... | [
"def",
"XmlToString",
"(",
"content",
",",
"encoding",
"=",
"'utf-8'",
",",
"pretty",
"=",
"False",
")",
":",
"# We create a huge list of all the elements of the file.",
"xml_parts",
"=",
"[",
"'<?xml version=\"1.0\" encoding=\"%s\"?>'",
"%",
"encoding",
"]",
"if",
"pre... | https://github.com/indutny/candor/blob/48e7260618f5091c80a3416828e2808cad3ea22e/tools/gyp/pylib/gyp/easy_xml.py#L9-L54 | |
physercoe/starquant | c00cad64d1de2da05081b3dc320ef264c6295e08 | source/data/data_board.py | python | ArrayManager.sma | (self, n, array=False) | return result[-1] | Simple moving average. | Simple moving average. | [
"Simple",
"moving",
"average",
"."
] | def sma(self, n, array=False):
"""
Simple moving average.
"""
result = talib.SMA(self.close, n)
if array:
return result
return result[-1] | [
"def",
"sma",
"(",
"self",
",",
"n",
",",
"array",
"=",
"False",
")",
":",
"result",
"=",
"talib",
".",
"SMA",
"(",
"self",
".",
"close",
",",
"n",
")",
"if",
"array",
":",
"return",
"result",
"return",
"result",
"[",
"-",
"1",
"]"
] | https://github.com/physercoe/starquant/blob/c00cad64d1de2da05081b3dc320ef264c6295e08/source/data/data_board.py#L245-L252 | |
NicknineTheEagle/TF2-Base | 20459c5a7fbc995b6bf54fa85c2f62a101e9fb64 | src/thirdparty/protobuf-2.3.0/python/google/protobuf/service.py | python | Service.GetResponseClass | (self, method_descriptor) | Returns the class of the response message for the specified method.
This method isn't really needed, as the RpcChannel's CallMethod constructs
the response protocol message. It's provided anyway in case it is useful
for the caller to know the response type in advance. | Returns the class of the response message for the specified method. | [
"Returns",
"the",
"class",
"of",
"the",
"response",
"message",
"for",
"the",
"specified",
"method",
"."
] | def GetResponseClass(self, method_descriptor):
"""Returns the class of the response message for the specified method.
This method isn't really needed, as the RpcChannel's CallMethod constructs
the response protocol message. It's provided anyway in case it is useful
for the caller to know the response t... | [
"def",
"GetResponseClass",
"(",
"self",
",",
"method_descriptor",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/NicknineTheEagle/TF2-Base/blob/20459c5a7fbc995b6bf54fa85c2f62a101e9fb64/src/thirdparty/protobuf-2.3.0/python/google/protobuf/service.py#L108-L115 | ||
gnina/gnina | b9ae032f52fc7a8153987bde09c0efa3620d8bb6 | caffe/scripts/cpp_lint.py | python | CheckForIncludeWhatYouUse | (filename, clean_lines, include_state, error,
io=codecs) | Reports for missing stl includes.
This function will output warnings to make sure you are including the headers
necessary for the stl containers and functions that you use. We only give one
reason to include a header. For example, if you use both equal_to<> and
less<> in a .h file, only one (the latter in the ... | Reports for missing stl includes. | [
"Reports",
"for",
"missing",
"stl",
"includes",
"."
] | def CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error,
io=codecs):
"""Reports for missing stl includes.
This function will output warnings to make sure you are including the headers
necessary for the stl containers and functions that you use. We only give one
r... | [
"def",
"CheckForIncludeWhatYouUse",
"(",
"filename",
",",
"clean_lines",
",",
"include_state",
",",
"error",
",",
"io",
"=",
"codecs",
")",
":",
"required",
"=",
"{",
"}",
"# A map of header name to linenumber and the template entity.",
"# Example of required: { '<functiona... | https://github.com/gnina/gnina/blob/b9ae032f52fc7a8153987bde09c0efa3620d8bb6/caffe/scripts/cpp_lint.py#L4487-L4577 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/sgmllib.py | python | SGMLParser.setnomoretags | (self) | Enter literal mode (CDATA) till EOF.
Intended for derived classes only. | Enter literal mode (CDATA) till EOF. | [
"Enter",
"literal",
"mode",
"(",
"CDATA",
")",
"till",
"EOF",
"."
] | def setnomoretags(self):
"""Enter literal mode (CDATA) till EOF.
Intended for derived classes only.
"""
self.nomoretags = self.literal = 1 | [
"def",
"setnomoretags",
"(",
"self",
")",
":",
"self",
".",
"nomoretags",
"=",
"self",
".",
"literal",
"=",
"1"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/sgmllib.py#L81-L86 | ||
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | bindings/python/cntk/axis.py | python | Axis.is_sequence_axis | (self) | return super(Axis, self).is_sequence_axis() | Returns True if the axis is a sequence axis and False otherwise
Returns:
bool: True if this axis is a sequence axis and False otherwise | Returns True if the axis is a sequence axis and False otherwise | [
"Returns",
"True",
"if",
"the",
"axis",
"is",
"a",
"sequence",
"axis",
"and",
"False",
"otherwise"
] | def is_sequence_axis(self):
'''
Returns True if the axis is a sequence axis and False otherwise
Returns:
bool: True if this axis is a sequence axis and False otherwise
'''
return super(Axis, self).is_sequence_axis() | [
"def",
"is_sequence_axis",
"(",
"self",
")",
":",
"return",
"super",
"(",
"Axis",
",",
"self",
")",
".",
"is_sequence_axis",
"(",
")"
] | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/axis.py#L51-L58 | |
amrayn/easyloggingpp | 8489989bb26c6371df103f6cbced3fbee1bc3c2f | tools/cpplint.py | python | CheckIncludeLine | (filename, clean_lines, linenum, include_state, error) | Check rules that are applicable to #include lines.
Strings on #include lines are NOT removed from elided line, to make
certain tasks easier. However, to prevent false positives, checks
applicable to #include lines in CheckLanguage must be put here.
Args:
filename: The name of the current file.
clean_l... | Check rules that are applicable to #include lines. | [
"Check",
"rules",
"that",
"are",
"applicable",
"to",
"#include",
"lines",
"."
] | def CheckIncludeLine(filename, clean_lines, linenum, include_state, error):
"""Check rules that are applicable to #include lines.
Strings on #include lines are NOT removed from elided line, to make
certain tasks easier. However, to prevent false positives, checks
applicable to #include lines in CheckLanguage m... | [
"def",
"CheckIncludeLine",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"include_state",
",",
"error",
")",
":",
"fileinfo",
"=",
"FileInfo",
"(",
"filename",
")",
"line",
"=",
"clean_lines",
".",
"lines",
"[",
"linenum",
"]",
"# \"include\" shoul... | https://github.com/amrayn/easyloggingpp/blob/8489989bb26c6371df103f6cbced3fbee1bc3c2f/tools/cpplint.py#L3557-L3626 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | RichTextHTMLHandler.SetFileCounter | (*args, **kwargs) | return _richtext.RichTextHTMLHandler_SetFileCounter(*args, **kwargs) | SetFileCounter(int counter)
Reset the file counter, in case, for example, the same names are required each
time | SetFileCounter(int counter) | [
"SetFileCounter",
"(",
"int",
"counter",
")"
] | def SetFileCounter(*args, **kwargs):
"""
SetFileCounter(int counter)
Reset the file counter, in case, for example, the same names are required each
time
"""
return _richtext.RichTextHTMLHandler_SetFileCounter(*args, **kwargs) | [
"def",
"SetFileCounter",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextHTMLHandler_SetFileCounter",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L4356-L4363 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/PublicKey/DSA.py | python | DsaKey.export_key | (self, format='PEM', pkcs8=None, passphrase=None,
protection=None, randfunc=None) | Export this DSA key.
Args:
format (string):
The encoding for the output:
- *'PEM'* (default). ASCII as per `RFC1421`_/ `RFC1423`_.
- *'DER'*. Binary ASN.1 encoding.
- *'OpenSSH'*. ASCII one-liner as per `RFC4253`_.
Only suitable for publi... | Export this DSA key. | [
"Export",
"this",
"DSA",
"key",
"."
] | def export_key(self, format='PEM', pkcs8=None, passphrase=None,
protection=None, randfunc=None):
"""Export this DSA key.
Args:
format (string):
The encoding for the output:
- *'PEM'* (default). ASCII as per `RFC1421`_/ `RFC1423`_.
- *'DER... | [
"def",
"export_key",
"(",
"self",
",",
"format",
"=",
"'PEM'",
",",
"pkcs8",
"=",
"None",
",",
"passphrase",
"=",
"None",
",",
"protection",
"=",
"None",
",",
"randfunc",
"=",
"None",
")",
":",
"if",
"passphrase",
"is",
"not",
"None",
":",
"passphrase"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/PublicKey/DSA.py#L208-L331 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/xcode_emulation.py | python | XcodeSettings.GetCflagsC | (self, configname) | return cflags_c | Returns flags that need to be added to .c, and .m compilations. | Returns flags that need to be added to .c, and .m compilations. | [
"Returns",
"flags",
"that",
"need",
"to",
"be",
"added",
"to",
".",
"c",
"and",
".",
"m",
"compilations",
"."
] | def GetCflagsC(self, configname):
"""Returns flags that need to be added to .c, and .m compilations."""
self.configname = configname
cflags_c = []
self._Appendf(cflags_c, 'GCC_C_LANGUAGE_STANDARD', '-std=%s')
cflags_c += self._Settings().get('OTHER_CFLAGS', [])
self.configname = None
return ... | [
"def",
"GetCflagsC",
"(",
"self",
",",
"configname",
")",
":",
"self",
".",
"configname",
"=",
"configname",
"cflags_c",
"=",
"[",
"]",
"self",
".",
"_Appendf",
"(",
"cflags_c",
",",
"'GCC_C_LANGUAGE_STANDARD'",
",",
"'-std=%s'",
")",
"cflags_c",
"+=",
"self... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/xcode_emulation.py#L344-L351 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/help.py | python | _implementation | () | return {'name': implementation, 'version': implementation_version} | Return a dict with the Python implementation and version.
Provide both the name and the version of the Python implementation
currently running. For example, on CPython 2.7.5 it will return
{'name': 'CPython', 'version': '2.7.5'}.
This function works best on CPython and PyPy: in particular, it probably... | Return a dict with the Python implementation and version. | [
"Return",
"a",
"dict",
"with",
"the",
"Python",
"implementation",
"and",
"version",
"."
] | def _implementation():
"""Return a dict with the Python implementation and version.
Provide both the name and the version of the Python implementation
currently running. For example, on CPython 2.7.5 it will return
{'name': 'CPython', 'version': '2.7.5'}.
This function works best on CPython and Py... | [
"def",
"_implementation",
"(",
")",
":",
"implementation",
"=",
"platform",
".",
"python_implementation",
"(",
")",
"if",
"implementation",
"==",
"'CPython'",
":",
"implementation_version",
"=",
"platform",
".",
"python_version",
"(",
")",
"elif",
"implementation",
... | 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/requests/help.py#L26-L56 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/backports.shutil-get-terminal-size/backports/shutil_get_terminal_size/get_terminal_size.py | python | get_terminal_size | (fallback=(80, 24)) | return terminal_size(columns, lines) | Get the size of the terminal window.
For each of the two dimensions, the environment variable, COLUMNS
and LINES respectively, is checked. If the variable is defined and
the value is a positive integer, it is used.
When COLUMNS or LINES is not defined, which is the common case,
the terminal connec... | Get the size of the terminal window. | [
"Get",
"the",
"size",
"of",
"the",
"terminal",
"window",
"."
] | def get_terminal_size(fallback=(80, 24)):
"""Get the size of the terminal window.
For each of the two dimensions, the environment variable, COLUMNS
and LINES respectively, is checked. If the variable is defined and
the value is a positive integer, it is used.
When COLUMNS or LINES is not defined, ... | [
"def",
"get_terminal_size",
"(",
"fallback",
"=",
"(",
"80",
",",
"24",
")",
")",
":",
"# Try the environment first",
"try",
":",
"columns",
"=",
"int",
"(",
"os",
".",
"environ",
"[",
"\"COLUMNS\"",
"]",
")",
"except",
"(",
"KeyError",
",",
"ValueError",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/backports.shutil-get-terminal-size/backports/shutil_get_terminal_size/get_terminal_size.py#L58-L100 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/training/saver.py | python | BaseSaverBuilder.restore_op | (self, filename_tensor, saveable, preferred_shard) | return tensors | Create ops to restore 'saveable'.
This is intended to be overridden by subclasses that want to generate
different Ops.
Args:
filename_tensor: String Tensor.
saveable: A BaseSaverBuilder.SaveableObject object.
preferred_shard: Int. Shard to open first when loading a sharded file.
Re... | Create ops to restore 'saveable'. | [
"Create",
"ops",
"to",
"restore",
"saveable",
"."
] | def restore_op(self, filename_tensor, saveable, preferred_shard):
"""Create ops to restore 'saveable'.
This is intended to be overridden by subclasses that want to generate
different Ops.
Args:
filename_tensor: String Tensor.
saveable: A BaseSaverBuilder.SaveableObject object.
prefer... | [
"def",
"restore_op",
"(",
"self",
",",
"filename_tensor",
",",
"saveable",
",",
"preferred_shard",
")",
":",
"# pylint: disable=protected-access",
"tensors",
"=",
"[",
"]",
"for",
"spec",
"in",
"saveable",
".",
"specs",
":",
"tensors",
".",
"append",
"(",
"io_... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/training/saver.py#L224-L249 | |
OpenLightingProject/ola | d1433a1bed73276fbe55ce18c03b1c208237decc | python/ola/RDMAPI.py | python | RDMAPI._GenericHandler | (self, callback, uid, response) | Args:
callback: the function to run
uid: The uid the request was for
response: A RDMResponse object | [] | def _GenericHandler(self, callback, uid, response):
"""
Args:
callback: the function to run
uid: The uid the request was for
response: A RDMResponse object
"""
obj = None
unpack_exception = None
if response.WasAcked():
request_type = self.COMMAND_CLASS_DICT[response.com... | [
"def",
"_GenericHandler",
"(",
"self",
",",
"callback",
",",
"uid",
",",
"response",
")",
":",
"obj",
"=",
"None",
"unpack_exception",
"=",
"None",
"if",
"response",
".",
"WasAcked",
"(",
")",
":",
"request_type",
"=",
"self",
".",
"COMMAND_CLASS_DICT",
"[... | https://github.com/OpenLightingProject/ola/blob/d1433a1bed73276fbe55ce18c03b1c208237decc/python/ola/RDMAPI.py#L242-L266 | |||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/urllib3/connection.py | python | HTTPSConnection._connect_tls_proxy | (self, hostname, conn) | return ssl_wrap_socket(
sock=conn,
ca_certs=self.ca_certs,
ca_cert_dir=self.ca_cert_dir,
ca_cert_data=self.ca_cert_data,
server_hostname=hostname,
ssl_context=ssl_context,
) | Establish a TLS connection to the proxy using the provided SSL context. | Establish a TLS connection to the proxy using the provided SSL context. | [
"Establish",
"a",
"TLS",
"connection",
"to",
"the",
"proxy",
"using",
"the",
"provided",
"SSL",
"context",
"."
] | def _connect_tls_proxy(self, hostname, conn):
"""
Establish a TLS connection to the proxy using the provided SSL context.
"""
proxy_config = self.proxy_config
ssl_context = proxy_config.ssl_context
if ssl_context:
# If the user provided a proxy context, we ass... | [
"def",
"_connect_tls_proxy",
"(",
"self",
",",
"hostname",
",",
"conn",
")",
":",
"proxy_config",
"=",
"self",
".",
"proxy_config",
"ssl_context",
"=",
"proxy_config",
".",
"ssl_context",
"if",
"ssl_context",
":",
"# If the user provided a proxy context, we assume CA an... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/urllib3/connection.py#L471-L503 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/plugins/codebrowser/codebrowser/gentag/taglib.py | python | DocStruct.GetLastClass | (self) | return self.lastclass | Gets the last L{Class} that was added to the document
@return: L{Class} | Gets the last L{Class} that was added to the document
@return: L{Class} | [
"Gets",
"the",
"last",
"L",
"{",
"Class",
"}",
"that",
"was",
"added",
"to",
"the",
"document",
"@return",
":",
"L",
"{",
"Class",
"}"
] | def GetLastClass(self):
"""Gets the last L{Class} that was added to the document
@return: L{Class}
"""
return self.lastclass | [
"def",
"GetLastClass",
"(",
"self",
")",
":",
"return",
"self",
".",
"lastclass"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/plugins/codebrowser/codebrowser/gentag/taglib.py#L387-L392 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pythonwin/pywin/framework/intpyapp.py | python | InteractivePythonApp.OnFileCheck | ( self, id, code ) | Called when a FileCheck message is received. Check the current file. | Called when a FileCheck message is received. Check the current file. | [
"Called",
"when",
"a",
"FileCheck",
"message",
"is",
"received",
".",
"Check",
"the",
"current",
"file",
"."
] | def OnFileCheck( self, id, code ):
" Called when a FileCheck message is received. Check the current file."
import scriptutils
scriptutils.CheckFile() | [
"def",
"OnFileCheck",
"(",
"self",
",",
"id",
",",
"code",
")",
":",
"import",
"scriptutils",
"scriptutils",
".",
"CheckFile",
"(",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pythonwin/pywin/framework/intpyapp.py#L332-L335 | ||
potassco/clingo | e0c91d8f95cc28de1c480a871f9c97c30de83d40 | scratch/mypy.py | python | TypeTemplate.render | (self, *args, **kwargs) | return s.replace("{TYPES}", ", ".join(type_list)) | This heuristicly adds types from a curated list used in the template to
the import list. | This heuristicly adds types from a curated list used in the template to
the import list. | [
"This",
"heuristicly",
"adds",
"types",
"from",
"a",
"curated",
"list",
"used",
"in",
"the",
"template",
"to",
"the",
"import",
"list",
"."
] | def render(self, *args, **kwargs):
'''
This heuristicly adds types from a curated list used in the template to
the import list.
'''
s = Template.render(self, *args, **kwargs)
type_list = []
for x in TYPING_TYPES:
if re.search(r'\b{}\b'.format(x), s):
... | [
"def",
"render",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"s",
"=",
"Template",
".",
"render",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"type_list",
"=",
"[",
"]",
"for",
"x",
"in",
"TYPING_TYPES",
"... | https://github.com/potassco/clingo/blob/e0c91d8f95cc28de1c480a871f9c97c30de83d40/scratch/mypy.py#L32-L43 | |
PyMesh/PyMesh | 384ba882b7558ba6e8653ed263c419226c22bddf | python/pymesh/wires/WireNetwork.py | python | WireNetwork.load_from_raw | (self, raw_wires) | Load vertex and edges from raw C++ wire data structure. | Load vertex and edges from raw C++ wire data structure. | [
"Load",
"vertex",
"and",
"edges",
"from",
"raw",
"C",
"++",
"wire",
"data",
"structure",
"."
] | def load_from_raw(self, raw_wires):
""" Load vertex and edges from raw C++ wire data structure.
"""
self.raw_wires = raw_wires
self.__initialize_wires() | [
"def",
"load_from_raw",
"(",
"self",
",",
"raw_wires",
")",
":",
"self",
".",
"raw_wires",
"=",
"raw_wires",
"self",
".",
"__initialize_wires",
"(",
")"
] | https://github.com/PyMesh/PyMesh/blob/384ba882b7558ba6e8653ed263c419226c22bddf/python/pymesh/wires/WireNetwork.py#L122-L126 | ||
devpack/android-python27 | d42dd67565e104cf7b0b50eb473f615db3e69901 | python-build-with-qt/sip-4.11.2/siputils.py | python | ModuleMakefile.__init__ | (self, configuration, build_file, install_dir=None, static=0,
console=0, qt=0, opengl=0, threaded=0, warnings=1, debug=0,
dir=None, makefile="Makefile", installs=None, strip=1,
export_all=0, universal=None, arch=None) | Initialise an instance of a module Makefile.
build_file is the file containing the target specific information. If
it is a dictionary instead then its contents are validated.
install_dir is the directory the target will be installed in.
static is set if the module should be built as a ... | Initialise an instance of a module Makefile. | [
"Initialise",
"an",
"instance",
"of",
"a",
"module",
"Makefile",
"."
] | def __init__(self, configuration, build_file, install_dir=None, static=0,
console=0, qt=0, opengl=0, threaded=0, warnings=1, debug=0,
dir=None, makefile="Makefile", installs=None, strip=1,
export_all=0, universal=None, arch=None):
"""Initialise an instance of a... | [
"def",
"__init__",
"(",
"self",
",",
"configuration",
",",
"build_file",
",",
"install_dir",
"=",
"None",
",",
"static",
"=",
"0",
",",
"console",
"=",
"0",
",",
"qt",
"=",
"0",
",",
"opengl",
"=",
"0",
",",
"threaded",
"=",
"0",
",",
"warnings",
"... | https://github.com/devpack/android-python27/blob/d42dd67565e104cf7b0b50eb473f615db3e69901/python-build-with-qt/sip-4.11.2/siputils.py#L1331-L1378 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TChA.ToUc | (self) | return _snap.TChA_ToUc(self) | ToUc(TChA self) -> TChA
Parameters:
self: TChA * | ToUc(TChA self) -> TChA | [
"ToUc",
"(",
"TChA",
"self",
")",
"-",
">",
"TChA"
] | def ToUc(self):
"""
ToUc(TChA self) -> TChA
Parameters:
self: TChA *
"""
return _snap.TChA_ToUc(self) | [
"def",
"ToUc",
"(",
"self",
")",
":",
"return",
"_snap",
".",
"TChA_ToUc",
"(",
"self",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L8984-L8992 | |
nvdla/sw | 79538ba1b52b040a4a4645f630e457fa01839e90 | umd/external/protobuf-2.6/python/google/protobuf/symbol_database.py | python | SymbolDatabase.GetPrototype | (self, descriptor) | return self.GetSymbol(descriptor.full_name) | Builds a proto2 message class based on the passed in descriptor.
Passing a descriptor with a fully qualified name matching a previous
invocation will cause the same class to be returned.
Args:
descriptor: The descriptor to build from.
Returns:
A class describing the passed in descriptor. | Builds a proto2 message class based on the passed in descriptor. | [
"Builds",
"a",
"proto2",
"message",
"class",
"based",
"on",
"the",
"passed",
"in",
"descriptor",
"."
] | def GetPrototype(self, descriptor):
"""Builds a proto2 message class based on the passed in descriptor.
Passing a descriptor with a fully qualified name matching a previous
invocation will cause the same class to be returned.
Args:
descriptor: The descriptor to build from.
Returns:
A ... | [
"def",
"GetPrototype",
"(",
"self",
",",
"descriptor",
")",
":",
"return",
"self",
".",
"GetSymbol",
"(",
"descriptor",
".",
"full_name",
")"
] | https://github.com/nvdla/sw/blob/79538ba1b52b040a4a4645f630e457fa01839e90/umd/external/protobuf-2.6/python/google/protobuf/symbol_database.py#L141-L154 | |
KhronosGroup/SPIRV-LLVM | 1eb85593f3fe2c39379b9a9b088d51eda4f42b8b | examples/Kaleidoscope/MCJIT/lazy/genk-timing.py | python | KScriptGenerator.updateFunctionCallMap | (self, caller, callee) | Maintains a map of functions that are called from other functions | Maintains a map of functions that are called from other functions | [
"Maintains",
"a",
"map",
"of",
"functions",
"that",
"are",
"called",
"from",
"other",
"functions"
] | def updateFunctionCallMap(self, caller, callee):
"""Maintains a map of functions that are called from other functions"""
if not caller in self.calledFunctionTable:
self.calledFunctionTable[caller] = []
if not callee in self.calledFunctionTable[caller]:
self.calledFunction... | [
"def",
"updateFunctionCallMap",
"(",
"self",
",",
"caller",
",",
"callee",
")",
":",
"if",
"not",
"caller",
"in",
"self",
".",
"calledFunctionTable",
":",
"self",
".",
"calledFunctionTable",
"[",
"caller",
"]",
"=",
"[",
"]",
"if",
"not",
"callee",
"in",
... | https://github.com/KhronosGroup/SPIRV-LLVM/blob/1eb85593f3fe2c39379b9a9b088d51eda4f42b8b/examples/Kaleidoscope/MCJIT/lazy/genk-timing.py#L56-L64 | ||
OAID/Caffe-HRT | aae71e498ab842c6f92bcc23fc668423615a4d65 | scripts/cpp_lint.py | python | CloseExpression | (clean_lines, linenum, pos) | return (line, clean_lines.NumLines(), -1) | If input points to ( or { or [ or <, finds the position that closes it.
If lines[linenum][pos] points to a '(' or '{' or '[' or '<', finds the
linenum/pos that correspond to the closing of the expression.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to... | If input points to ( or { or [ or <, finds the position that closes it. | [
"If",
"input",
"points",
"to",
"(",
"or",
"{",
"or",
"[",
"or",
"<",
"finds",
"the",
"position",
"that",
"closes",
"it",
"."
] | def CloseExpression(clean_lines, linenum, pos):
"""If input points to ( or { or [ or <, finds the position that closes it.
If lines[linenum][pos] points to a '(' or '{' or '[' or '<', finds the
linenum/pos that correspond to the closing of the expression.
Args:
clean_lines: A CleansedLines instance contai... | [
"def",
"CloseExpression",
"(",
"clean_lines",
",",
"linenum",
",",
"pos",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"startchar",
"=",
"line",
"[",
"pos",
"]",
"if",
"startchar",
"not",
"in",
"'({[<'",
":",
"return",
"(",
... | https://github.com/OAID/Caffe-HRT/blob/aae71e498ab842c6f92bcc23fc668423615a4d65/scripts/cpp_lint.py#L1254-L1297 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/SocketServer.py | python | ForkingMixIn.process_request | (self, request, client_address) | Fork a new subprocess to process the request. | Fork a new subprocess to process the request. | [
"Fork",
"a",
"new",
"subprocess",
"to",
"process",
"the",
"request",
"."
] | def process_request(self, request, client_address):
"""Fork a new subprocess to process the request."""
self.collect_children()
pid = os.fork()
if pid:
# Parent process
if self.active_children is None:
self.active_children = []
self.act... | [
"def",
"process_request",
"(",
"self",
",",
"request",
",",
"client_address",
")",
":",
"self",
".",
"collect_children",
"(",
")",
"pid",
"=",
"os",
".",
"fork",
"(",
")",
"if",
"pid",
":",
"# Parent process",
"if",
"self",
".",
"active_children",
"is",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/SocketServer.py#L553-L576 | ||
zhaoweicai/mscnn | 534bcac5710a579d60827f192035f7eef6d8c585 | scripts/cpp_lint.py | python | _FunctionState.End | (self) | Stop analyzing function body. | Stop analyzing function body. | [
"Stop",
"analyzing",
"function",
"body",
"."
] | def End(self):
"""Stop analyzing function body."""
self.in_a_function = False | [
"def",
"End",
"(",
"self",
")",
":",
"self",
".",
"in_a_function",
"=",
"False"
] | https://github.com/zhaoweicai/mscnn/blob/534bcac5710a579d60827f192035f7eef6d8c585/scripts/cpp_lint.py#L861-L863 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/lib/io/file_io.py | python | list_directory | (dirname) | return [
compat.as_str_any(pywrap_tensorflow.Basename(compat.as_bytes(filename)))
for filename in file_list
] | Returns a list of entries contained within a directory.
The list is in arbitrary order. It does not contain the special entries "."
and "..".
Args:
dirname: string, path to a directory
Returns:
[filename1, filename2, ... filenameN] as strings
Raises:
errors.NotFoundError if directory doesn't e... | Returns a list of entries contained within a directory. | [
"Returns",
"a",
"list",
"of",
"entries",
"contained",
"within",
"a",
"directory",
"."
] | def list_directory(dirname):
"""Returns a list of entries contained within a directory.
The list is in arbitrary order. It does not contain the special entries "."
and "..".
Args:
dirname: string, path to a directory
Returns:
[filename1, filename2, ... filenameN] as strings
Raises:
errors.No... | [
"def",
"list_directory",
"(",
"dirname",
")",
":",
"if",
"not",
"is_directory",
"(",
"dirname",
")",
":",
"raise",
"errors",
".",
"NotFoundError",
"(",
"None",
",",
"None",
",",
"\"Could not find directory\"",
")",
"file_list",
"=",
"get_matching_files",
"(",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/lib/io/file_io.py#L350-L371 | |
resiprocate/resiprocate | b3943ce9ed412e2302121f6cc766125a7746edc1 | contrib/fmt/support/docopt.py | python | parse_atom | (tokens, options) | atom ::= '(' expr ')' | '[' expr ']' | 'options'
| long | shorts | argument | command ; | atom ::= '(' expr ')' | '[' expr ']' | 'options'
| long | shorts | argument | command ; | [
"atom",
"::",
"=",
"(",
"expr",
")",
"|",
"[",
"expr",
"]",
"|",
"options",
"|",
"long",
"|",
"shorts",
"|",
"argument",
"|",
"command",
";"
] | def parse_atom(tokens, options):
"""atom ::= '(' expr ')' | '[' expr ']' | 'options'
| long | shorts | argument | command ;
"""
token = tokens.current()
result = []
if token in '([':
tokens.move()
matching, pattern = {'(': [')', Required], '[': [']', Optional]}[token]
... | [
"def",
"parse_atom",
"(",
"tokens",
",",
"options",
")",
":",
"token",
"=",
"tokens",
".",
"current",
"(",
")",
"result",
"=",
"[",
"]",
"if",
"token",
"in",
"'(['",
":",
"tokens",
".",
"move",
"(",
")",
"matching",
",",
"pattern",
"=",
"{",
"'('",... | https://github.com/resiprocate/resiprocate/blob/b3943ce9ed412e2302121f6cc766125a7746edc1/contrib/fmt/support/docopt.py#L402-L425 | ||
telefonicaid/fiware-orion | 27c3202b9ddcfb9e3635a0af8d373f76e89b1d24 | scripts/cpplint.py | python | CheckForHeaderGuard | (filename, lines, error) | Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used.
Args:
filename: The name of the C++ header file.
lines: An array of strings, each representing a line of the file.
error: The function to call... | Checks that the file contains a header guard. | [
"Checks",
"that",
"the",
"file",
"contains",
"a",
"header",
"guard",
"."
] | def CheckForHeaderGuard(filename, lines, error):
"""Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used.
Args:
filename: The name of the C++ header file.
lines: An array of strings, each representi... | [
"def",
"CheckForHeaderGuard",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"cppvar",
"=",
"GetHeaderGuardCPPVariable",
"(",
"filename",
")",
"ifndef",
"=",
"None",
"ifndef_linenum",
"=",
"0",
"define",
"=",
"None",
"endif",
"=",
"None",
"endif_linenu... | https://github.com/telefonicaid/fiware-orion/blob/27c3202b9ddcfb9e3635a0af8d373f76e89b1d24/scripts/cpplint.py#L1040-L1112 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/distutils/ccompiler.py | python | CCompiler.add_library | (self, libname) | Add 'libname' to the list of libraries that will be included in
all links driven by this compiler object. Note that 'libname'
should *not* be the name of a file containing a library, but the
name of the library itself: the actual filename will be inferred by
the linker, the compiler, or... | Add 'libname' to the list of libraries that will be included in
all links driven by this compiler object. Note that 'libname'
should *not* be the name of a file containing a library, but the
name of the library itself: the actual filename will be inferred by
the linker, the compiler, or... | [
"Add",
"libname",
"to",
"the",
"list",
"of",
"libraries",
"that",
"will",
"be",
"included",
"in",
"all",
"links",
"driven",
"by",
"this",
"compiler",
"object",
".",
"Note",
"that",
"libname",
"should",
"*",
"not",
"*",
"be",
"the",
"name",
"of",
"a",
"... | def add_library(self, libname):
"""Add 'libname' to the list of libraries that will be included in
all links driven by this compiler object. Note that 'libname'
should *not* be the name of a file containing a library, but the
name of the library itself: the actual filename will be infer... | [
"def",
"add_library",
"(",
"self",
",",
"libname",
")",
":",
"self",
".",
"libraries",
".",
"append",
"(",
"libname",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/distutils/ccompiler.py#L235-L249 | ||
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/NinjaWriter.py | python | NinjaWriter._WriteLinkForArch | (self, ninja_file, spec, config_name, config, link_deps, compile_deps, arch=None) | return linked_binary | Write out a link step. Fills out target.binary. | Write out a link step. Fills out target.binary. | [
"Write",
"out",
"a",
"link",
"step",
".",
"Fills",
"out",
"target",
".",
"binary",
"."
] | def _WriteLinkForArch(self, ninja_file, spec, config_name, config, link_deps, compile_deps, arch=None):
"""Write out a link step. Fills out target.binary. """
command = {
'executable': 'link',
'loadable_module': 'solink_module',
'shared_library': 'solink',
}[spec['type']]
command... | [
"def",
"_WriteLinkForArch",
"(",
"self",
",",
"ninja_file",
",",
"spec",
",",
"config_name",
",",
"config",
",",
"link_deps",
",",
"compile_deps",
",",
"arch",
"=",
"None",
")",
":",
"command",
"=",
"{",
"'executable'",
":",
"'link'",
",",
"'loadable_module'... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/NinjaWriter.py#L800-L956 | |
Project-OSRM/osrm-backend | f2e284623e25b5570dd2a5e6985abcb3790fd348 | third_party/flatbuffers/python/flatbuffers/builder.py | python | Builder.PrependInt16 | (self, x) | Prepend an `int16` to the Builder buffer.
Note: aligns and checks for space. | Prepend an `int16` to the Builder buffer. | [
"Prepend",
"an",
"int16",
"to",
"the",
"Builder",
"buffer",
"."
] | def PrependInt16(self, x):
"""Prepend an `int16` to the Builder buffer.
Note: aligns and checks for space.
"""
self.Prepend(N.Int16Flags, x) | [
"def",
"PrependInt16",
"(",
"self",
",",
"x",
")",
":",
"self",
".",
"Prepend",
"(",
"N",
".",
"Int16Flags",
",",
"x",
")"
] | https://github.com/Project-OSRM/osrm-backend/blob/f2e284623e25b5570dd2a5e6985abcb3790fd348/third_party/flatbuffers/python/flatbuffers/builder.py#L659-L664 | ||
chanyn/3Dpose_ssl | 585696676279683a279b1ecca136c0e0d02aef2a | caffe-3dssl/scripts/cpp_lint.py | python | CheckForMultilineCommentsAndStrings | (filename, clean_lines, linenum, error) | Logs an error if we see /* ... */ or "..." that extend past one line.
/* ... */ comments are legit inside macros, for one line.
Otherwise, we prefer // comments, so it's ok to warn about the
other. Likewise, it's ok for strings to extend across multiple
lines, as long as a line continuation character (backsla... | Logs an error if we see /* ... */ or "..." that extend past one line. | [
"Logs",
"an",
"error",
"if",
"we",
"see",
"/",
"*",
"...",
"*",
"/",
"or",
"...",
"that",
"extend",
"past",
"one",
"line",
"."
] | def CheckForMultilineCommentsAndStrings(filename, clean_lines, linenum, error):
"""Logs an error if we see /* ... */ or "..." that extend past one line.
/* ... */ comments are legit inside macros, for one line.
Otherwise, we prefer // comments, so it's ok to warn about the
other. Likewise, it's ok for strings... | [
"def",
"CheckForMultilineCommentsAndStrings",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Remove all \\\\ (escaped backslashes) from the line. They are OK, and the",
"# secon... | https://github.com/chanyn/3Dpose_ssl/blob/585696676279683a279b1ecca136c0e0d02aef2a/caffe-3dssl/scripts/cpp_lint.py#L1526-L1561 | ||
fasiondog/hikyuu | 842751aa25283f9fdafc6f560ea262f79e67a307 | hikyuu/data/common_mysql.py | python | update_extern_data | (connect, market, code, data_type) | 更新周线、月线、15分钟线等扩展数据索引 | 更新周线、月线、15分钟线等扩展数据索引 | [
"更新周线、月线、15分钟线等扩展数据索引"
] | def update_extern_data(connect, market, code, data_type):
"""更新周线、月线、15分钟线等扩展数据索引"""
def getWeekDate(olddate):
y = olddate // 100000000
m = olddate // 1000000 - y * 100
d = olddate // 10000 - (y * 10000 + m * 100)
tempdate = datetime.date(y, m, d)
# python中周一是第0天,周五的第4天
... | [
"def",
"update_extern_data",
"(",
"connect",
",",
"market",
",",
"code",
",",
"data_type",
")",
":",
"def",
"getWeekDate",
"(",
"olddate",
")",
":",
"y",
"=",
"olddate",
"//",
"100000000",
"m",
"=",
"olddate",
"//",
"1000000",
"-",
"y",
"*",
"100",
"d"... | https://github.com/fasiondog/hikyuu/blob/842751aa25283f9fdafc6f560ea262f79e67a307/hikyuu/data/common_mysql.py#L183-L445 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/indexes/base.py | python | Index._validate_fill_value | (self, value) | return value | Check if the value can be inserted into our array without casting,
and convert it to an appropriate native type if necessary.
Raises
------
TypeError
If the value cannot be inserted into an array of this dtype. | Check if the value can be inserted into our array without casting,
and convert it to an appropriate native type if necessary. | [
"Check",
"if",
"the",
"value",
"can",
"be",
"inserted",
"into",
"our",
"array",
"without",
"casting",
"and",
"convert",
"it",
"to",
"an",
"appropriate",
"native",
"type",
"if",
"necessary",
"."
] | def _validate_fill_value(self, value):
"""
Check if the value can be inserted into our array without casting,
and convert it to an appropriate native type if necessary.
Raises
------
TypeError
If the value cannot be inserted into an array of this dtype.
... | [
"def",
"_validate_fill_value",
"(",
"self",
",",
"value",
")",
":",
"if",
"not",
"can_hold_element",
"(",
"self",
".",
"_values",
",",
"value",
")",
":",
"raise",
"TypeError",
"return",
"value"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/indexes/base.py#L4493-L4505 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/traitlets/py2/traitlets/traitlets.py | python | EventHandler.__call__ | (self, *args, **kwargs) | Pass `*args` and `**kwargs` to the handler's function if it exists. | Pass `*args` and `**kwargs` to the handler's function if it exists. | [
"Pass",
"*",
"args",
"and",
"**",
"kwargs",
"to",
"the",
"handler",
"s",
"function",
"if",
"it",
"exists",
"."
] | def __call__(self, *args, **kwargs):
"""Pass `*args` and `**kwargs` to the handler's function if it exists."""
if hasattr(self, 'func'):
return self.func(*args, **kwargs)
else:
return self._init_call(*args, **kwargs) | [
"def",
"__call__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'func'",
")",
":",
"return",
"self",
".",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"else",
":",
"return",
"s... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/traitlets/py2/traitlets/traitlets.py#L904-L909 | ||
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/gdal.py | python | DecToDMS | (*args) | return _gdal.DecToDMS(*args) | r"""DecToDMS(double arg1, char const * arg2, int arg3=2) -> char const * | r"""DecToDMS(double arg1, char const * arg2, int arg3=2) -> char const * | [
"r",
"DecToDMS",
"(",
"double",
"arg1",
"char",
"const",
"*",
"arg2",
"int",
"arg3",
"=",
"2",
")",
"-",
">",
"char",
"const",
"*"
] | def DecToDMS(*args):
r"""DecToDMS(double arg1, char const * arg2, int arg3=2) -> char const *"""
return _gdal.DecToDMS(*args) | [
"def",
"DecToDMS",
"(",
"*",
"args",
")",
":",
"return",
"_gdal",
".",
"DecToDMS",
"(",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/gdal.py#L4089-L4091 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/ndarray/ndarray.py | python | NDArray._basic_indexing_key_int_to_slice | (idcs) | return tuple(conv_idcs), tuple(int_axes) | Return the converted indexing tuple and the integer axes. | Return the converted indexing tuple and the integer axes. | [
"Return",
"the",
"converted",
"indexing",
"tuple",
"and",
"the",
"integer",
"axes",
"."
] | def _basic_indexing_key_int_to_slice(idcs):
"""Return the converted indexing tuple and the integer axes."""
int_axes = []
conv_idcs = []
for ax, idx in enumerate(idcs):
if isinstance(idx, integer_types):
conv_idcs.append(_int_to_slice(idx))
int... | [
"def",
"_basic_indexing_key_int_to_slice",
"(",
"idcs",
")",
":",
"int_axes",
"=",
"[",
"]",
"conv_idcs",
"=",
"[",
"]",
"for",
"ax",
",",
"idx",
"in",
"enumerate",
"(",
"idcs",
")",
":",
"if",
"isinstance",
"(",
"idx",
",",
"integer_types",
")",
":",
... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/ndarray/ndarray.py#L837-L848 | |
ukoethe/vigra | 093d57d15c8c237adf1704d96daa6393158ce299 | vigranumpy/lib/arraytypes.py | python | VigraArray.dropChannelAxis | (self, ignoreMultiChannel=False) | return self.bindAxis(ci, 0) | Drop the channel axis when it is a singleton.
This function is for easy transformation of an array shaped
(width, height, 1) into (width, height). A RuntimeError
is raised when there is more than one channel, unless ignoreMultiChannel=True,
in which case 'self' is returned. | Drop the channel axis when it is a singleton.
This function is for easy transformation of an array shaped
(width, height, 1) into (width, height). A RuntimeError
is raised when there is more than one channel, unless ignoreMultiChannel=True,
in which case 'self' is returned. | [
"Drop",
"the",
"channel",
"axis",
"when",
"it",
"is",
"a",
"singleton",
".",
"This",
"function",
"is",
"for",
"easy",
"transformation",
"of",
"an",
"array",
"shaped",
"(",
"width",
"height",
"1",
")",
"into",
"(",
"width",
"height",
")",
".",
"A",
"Run... | def dropChannelAxis(self, ignoreMultiChannel=False):
'''
Drop the channel axis when it is a singleton.
This function is for easy transformation of an array shaped
(width, height, 1) into (width, height). A RuntimeError
is raised when there is more than one channel, unless ignoreM... | [
"def",
"dropChannelAxis",
"(",
"self",
",",
"ignoreMultiChannel",
"=",
"False",
")",
":",
"ci",
"=",
"self",
".",
"channelIndex",
"if",
"ci",
"==",
"self",
".",
"ndim",
":",
"return",
"self",
"if",
"self",
".",
"shape",
"[",
"ci",
"]",
"!=",
"1",
":"... | https://github.com/ukoethe/vigra/blob/093d57d15c8c237adf1704d96daa6393158ce299/vigranumpy/lib/arraytypes.py#L1004-L1020 | |
vnpy/vnpy | f50f2535ed39dd33272e0985ed40c7078e4c19f6 | vnpy/chart/widget.py | python | ChartCursor._update_after_move | (self) | Update cursor after moved by left/right. | Update cursor after moved by left/right. | [
"Update",
"cursor",
"after",
"moved",
"by",
"left",
"/",
"right",
"."
] | def _update_after_move(self) -> None:
"""
Update cursor after moved by left/right.
"""
bar = self._manager.get_bar(self._x)
self._y = bar.close_price
self._update_line()
self._update_label() | [
"def",
"_update_after_move",
"(",
"self",
")",
"->",
"None",
":",
"bar",
"=",
"self",
".",
"_manager",
".",
"get_bar",
"(",
"self",
".",
"_x",
")",
"self",
".",
"_y",
"=",
"bar",
".",
"close_price",
"self",
".",
"_update_line",
"(",
")",
"self",
".",... | https://github.com/vnpy/vnpy/blob/f50f2535ed39dd33272e0985ed40c7078e4c19f6/vnpy/chart/widget.py#L513-L521 | ||
albertz/openlierox | d316c14a8eb57848ef56e9bfa7b23a56f694a51b | tools/DedicatedServerVideo/gdata/apps/service.py | python | AppsService.__init__ | (self, email=None, password=None, domain=None, source=None,
server='apps-apis.google.com', additional_headers=None,
**kwargs) | Creates a client for the Google Apps Provisioning service.
Args:
email: string (optional) The user's email address, used for
authentication.
password: string (optional) The user's password.
domain: string (optional) The Google Apps domain name.
source: string (optional) The name o... | Creates a client for the Google Apps Provisioning service. | [
"Creates",
"a",
"client",
"for",
"the",
"Google",
"Apps",
"Provisioning",
"service",
"."
] | def __init__(self, email=None, password=None, domain=None, source=None,
server='apps-apis.google.com', additional_headers=None,
**kwargs):
"""Creates a client for the Google Apps Provisioning service.
Args:
email: string (optional) The user's email address, used for
... | [
"def",
"__init__",
"(",
"self",
",",
"email",
"=",
"None",
",",
"password",
"=",
"None",
",",
"domain",
"=",
"None",
",",
"source",
"=",
"None",
",",
"server",
"=",
"'apps-apis.google.com'",
",",
"additional_headers",
"=",
"None",
",",
"*",
"*",
"kwargs"... | https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/gdata/apps/service.py#L81-L102 | ||
lammps/lammps | b75c3065430a75b1b5543a10e10f46d9b4c91913 | tools/i-pi/ipi/engine/properties.py | python | getall | (pstring) | return (pstring, unit, arglist, kwarglist) | Returns the keyword, units and argument list separately.
Args:
pstring: The string input by the user that specifies an output,
which in general will specify units and argument lists.
Returns: A tuple giving the keyword for the property, and its units
argument list and key word argument list... | Returns the keyword, units and argument list separately. | [
"Returns",
"the",
"keyword",
"units",
"and",
"argument",
"list",
"separately",
"."
] | def getall(pstring):
"""Returns the keyword, units and argument list separately.
Args:
pstring: The string input by the user that specifies an output,
which in general will specify units and argument lists.
Returns: A tuple giving the keyword for the property, and its units
argument list... | [
"def",
"getall",
"(",
"pstring",
")",
":",
"unit",
"=",
"\"\"",
"arglist",
"=",
"(",
")",
"kwarglist",
"=",
"{",
"}",
"unstart",
"=",
"len",
"(",
"pstring",
")",
"argstart",
"=",
"unstart",
"if",
"'}'",
"in",
"pstring",
":",
"# the property has a user-de... | https://github.com/lammps/lammps/blob/b75c3065430a75b1b5543a10e10f46d9b4c91913/tools/i-pi/ipi/engine/properties.py#L68-L110 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/groupby/groupby.py | python | GroupBy.ohlc | (self) | return self._apply_to_column_groupbys(
lambda x: x.ohlc(), self._obj_with_exclusions
) | Compute open, high, low and close values of a group, excluding missing values.
For multiple groupings, the result index will be a MultiIndex
Returns
-------
DataFrame
Open, high, low and close values within each group. | Compute open, high, low and close values of a group, excluding missing values. | [
"Compute",
"open",
"high",
"low",
"and",
"close",
"values",
"of",
"a",
"group",
"excluding",
"missing",
"values",
"."
] | def ohlc(self) -> DataFrame:
"""
Compute open, high, low and close values of a group, excluding missing values.
For multiple groupings, the result index will be a MultiIndex
Returns
-------
DataFrame
Open, high, low and close values within each group.
... | [
"def",
"ohlc",
"(",
"self",
")",
"->",
"DataFrame",
":",
"if",
"self",
".",
"obj",
".",
"ndim",
"==",
"1",
":",
"# self._iterate_slices() yields only self._selected_obj",
"obj",
"=",
"self",
".",
"_selected_obj",
"is_numeric",
"=",
"is_numeric_dtype",
"(",
"obj"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/groupby/groupby.py#L1936-L1967 | |
scribusproject/scribus | 41ec7c775a060912cf251682a8b1437f753f80f4 | scribus/plugins/scriptplugin/scripts/ColorChart.py | python | getColorsFromDocument | () | gets colors from opend document. if there is no document, display dialog to chose a file. returns a list[name,c,m,y,k] | gets colors from opend document. if there is no document, display dialog to chose a file. returns a list[name,c,m,y,k] | [
"gets",
"colors",
"from",
"opend",
"document",
".",
"if",
"there",
"is",
"no",
"document",
"display",
"dialog",
"to",
"chose",
"a",
"file",
".",
"returns",
"a",
"list",
"[",
"name",
"c",
"m",
"y",
"k",
"]"
] | def getColorsFromDocument():
"""gets colors from opend document. if there is no document, display dialog to chose a file. returns a list[name,c,m,y,k]"""
def getColors():
"""gets the colors and returns a list[name,c,m,y,k]"""
colorNames=scribus.getColorNames()
list=[]
scribus.sta... | [
"def",
"getColorsFromDocument",
"(",
")",
":",
"def",
"getColors",
"(",
")",
":",
"\"\"\"gets the colors and returns a list[name,c,m,y,k]\"\"\"",
"colorNames",
"=",
"scribus",
".",
"getColorNames",
"(",
")",
"list",
"=",
"[",
"]",
"scribus",
".",
"statusMessage",
"(... | https://github.com/scribusproject/scribus/blob/41ec7c775a060912cf251682a8b1437f753f80f4/scribus/plugins/scriptplugin/scripts/ColorChart.py#L114-L149 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/docview.py | python | Document.OnCloseDocument | (self) | return True | The default implementation calls DeleteContents (an empty
implementation) sets the modified flag to false. Override this to
supply additional behaviour when the document is closed with Close. | The default implementation calls DeleteContents (an empty
implementation) sets the modified flag to false. Override this to
supply additional behaviour when the document is closed with Close. | [
"The",
"default",
"implementation",
"calls",
"DeleteContents",
"(",
"an",
"empty",
"implementation",
")",
"sets",
"the",
"modified",
"flag",
"to",
"false",
".",
"Override",
"this",
"to",
"supply",
"additional",
"behaviour",
"when",
"the",
"document",
"is",
"clos... | def OnCloseDocument(self):
"""
The default implementation calls DeleteContents (an empty
implementation) sets the modified flag to false. Override this to
supply additional behaviour when the document is closed with Close.
"""
self.NotifyClosing()
self.DeleteConte... | [
"def",
"OnCloseDocument",
"(",
"self",
")",
":",
"self",
".",
"NotifyClosing",
"(",
")",
"self",
".",
"DeleteContents",
"(",
")",
"self",
".",
"Modify",
"(",
"False",
")",
"return",
"True"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/docview.py#L307-L316 | |
deepmodeling/deepmd-kit | 159e45d248b0429844fb6a8cb3b3a201987c8d79 | deepmd/entrypoints/config.py | python | suggest_sel | (
all_type: List[np.ndarray],
all_box: List[np.ndarray],
rcut: float,
ratio: float = 1.5,
) | return [int(ii) for ii in max_den * 4.0 / 3.0 * np.pi * rcut ** 3 * ratio] | Suggest selection parameter.
Parameters
----------
all_type : List[np.ndarray]
list with arrays specifying elements of structures
all_box : List[np.ndarray]
list with arrays specifying cells for all structures
rcut : float
cutoff radius
ratio : float, optional
sa... | Suggest selection parameter. | [
"Suggest",
"selection",
"parameter",
"."
] | def suggest_sel(
all_type: List[np.ndarray],
all_box: List[np.ndarray],
rcut: float,
ratio: float = 1.5,
) -> List[int]:
"""Suggest selection parameter.
Parameters
----------
all_type : List[np.ndarray]
list with arrays specifying elements of structures
all_box : List[np.nda... | [
"def",
"suggest_sel",
"(",
"all_type",
":",
"List",
"[",
"np",
".",
"ndarray",
"]",
",",
"all_box",
":",
"List",
"[",
"np",
".",
"ndarray",
"]",
",",
"rcut",
":",
"float",
",",
"ratio",
":",
"float",
"=",
"1.5",
",",
")",
"->",
"List",
"[",
"int"... | https://github.com/deepmodeling/deepmd-kit/blob/159e45d248b0429844fb6a8cb3b3a201987c8d79/deepmd/entrypoints/config.py#L240-L265 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_controls.py | python | PickerBase.SetPickerCtrlGrowable | (*args, **kwargs) | return _controls_.PickerBase_SetPickerCtrlGrowable(*args, **kwargs) | SetPickerCtrlGrowable(self, bool grow=True) | SetPickerCtrlGrowable(self, bool grow=True) | [
"SetPickerCtrlGrowable",
"(",
"self",
"bool",
"grow",
"=",
"True",
")"
] | def SetPickerCtrlGrowable(*args, **kwargs):
"""SetPickerCtrlGrowable(self, bool grow=True)"""
return _controls_.PickerBase_SetPickerCtrlGrowable(*args, **kwargs) | [
"def",
"SetPickerCtrlGrowable",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"PickerBase_SetPickerCtrlGrowable",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L6802-L6804 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | demo/PropertyGrid.py | python | LargeImageEditor.OnEvent | (self, propgrid, property, ctrl, event) | return False | Return True if modified editor value should be committed to
the property. To just mark the property value modified, call
propgrid.EditorsValueWasModified(). | Return True if modified editor value should be committed to
the property. To just mark the property value modified, call
propgrid.EditorsValueWasModified(). | [
"Return",
"True",
"if",
"modified",
"editor",
"value",
"should",
"be",
"committed",
"to",
"the",
"property",
".",
"To",
"just",
"mark",
"the",
"property",
"value",
"modified",
"call",
"propgrid",
".",
"EditorsValueWasModified",
"()",
"."
] | def OnEvent(self, propgrid, property, ctrl, event):
""" Return True if modified editor value should be committed to
the property. To just mark the property value modified, call
propgrid.EditorsValueWasModified().
"""
if not ctrl:
return False
evtType ... | [
"def",
"OnEvent",
"(",
"self",
",",
"propgrid",
",",
"property",
",",
"ctrl",
",",
"event",
")",
":",
"if",
"not",
"ctrl",
":",
"return",
"False",
"evtType",
"=",
"event",
".",
"GetEventType",
"(",
")",
"if",
"evtType",
"==",
"wx",
".",
"wxEVT_COMMAND_... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/demo/PropertyGrid.py#L606-L630 | |
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | imperative/python/megengine/functional/loss.py | python | cross_entropy | (
pred: Tensor,
label: Tensor,
axis: int = 1,
with_logits: bool = True,
label_smooth: float = 0,
reduction: str = "mean",
) | return logZ - ls * pred.mean(axis) - (1 - ls) * primary_term | r"""Computes the multi-class cross entropy loss (using logits by default).
By default(``with_logitis`` is True), ``pred`` is assumed to be logits,
class probabilities are given by softmax.
It has better numerical stability compared with sequential calls to :func:`~.softmax` and :func:`~.cross_entropy`.
... | r"""Computes the multi-class cross entropy loss (using logits by default). | [
"r",
"Computes",
"the",
"multi",
"-",
"class",
"cross",
"entropy",
"loss",
"(",
"using",
"logits",
"by",
"default",
")",
"."
] | def cross_entropy(
pred: Tensor,
label: Tensor,
axis: int = 1,
with_logits: bool = True,
label_smooth: float = 0,
reduction: str = "mean",
) -> Tensor:
r"""Computes the multi-class cross entropy loss (using logits by default).
By default(``with_logitis`` is True), ``pred`` is assumed to... | [
"def",
"cross_entropy",
"(",
"pred",
":",
"Tensor",
",",
"label",
":",
"Tensor",
",",
"axis",
":",
"int",
"=",
"1",
",",
"with_logits",
":",
"bool",
"=",
"True",
",",
"label_smooth",
":",
"float",
"=",
"0",
",",
"reduction",
":",
"str",
"=",
"\"mean\... | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/functional/loss.py#L155-L228 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/auibar.py | python | AuiDefaultToolBarArt.DrawBackground | (self, dc, wnd, _rect, horizontal=True) | Draws a toolbar background with a gradient shading.
:param `dc`: a :class:`DC` device context;
:param `wnd`: a :class:`Window` derived window;
:param Rect `_rect`: the :class:`AuiToolBarItem` rectangle;
:param bool `horizontal`: ``True`` if the toolbar is horizontal, ``False`` if it is ... | Draws a toolbar background with a gradient shading. | [
"Draws",
"a",
"toolbar",
"background",
"with",
"a",
"gradient",
"shading",
"."
] | def DrawBackground(self, dc, wnd, _rect, horizontal=True):
"""
Draws a toolbar background with a gradient shading.
:param `dc`: a :class:`DC` device context;
:param `wnd`: a :class:`Window` derived window;
:param Rect `_rect`: the :class:`AuiToolBarItem` rectangle;
:para... | [
"def",
"DrawBackground",
"(",
"self",
",",
"dc",
",",
"wnd",
",",
"_rect",
",",
"horizontal",
"=",
"True",
")",
":",
"rect",
"=",
"wx",
".",
"Rect",
"(",
"*",
"_rect",
")",
"start_colour",
"=",
"StepColour",
"(",
"self",
".",
"_base_colour",
",",
"18... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/auibar.py#L889-L917 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/html2.py | python | WebView.LoadURL | (*args, **kwargs) | return _html2.WebView_LoadURL(*args, **kwargs) | LoadURL(self, String url) | LoadURL(self, String url) | [
"LoadURL",
"(",
"self",
"String",
"url",
")"
] | def LoadURL(*args, **kwargs):
"""LoadURL(self, String url)"""
return _html2.WebView_LoadURL(*args, **kwargs) | [
"def",
"LoadURL",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html2",
".",
"WebView_LoadURL",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/html2.py#L179-L181 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/PostprocessorViewer/plugins/PostprocessorTableWidget.py | python | PostprocessorTableWidget.initialize | (self, data) | Called when the data is changed ,this updates the visible data.
@see OutputPlugin | Called when the data is changed ,this updates the visible data. | [
"Called",
"when",
"the",
"data",
"is",
"changed",
"this",
"updates",
"the",
"visible",
"data",
"."
] | def initialize(self, data):
"""
Called when the data is changed ,this updates the visible data.
@see OutputPlugin
"""
self._data = data | [
"def",
"initialize",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"_data",
"=",
"data"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/PostprocessorViewer/plugins/PostprocessorTableWidget.py#L42-L48 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/turtle.py | python | readconfig | (cfgdict) | Read config-files, change configuration-dict accordingly.
If there is a turtle.cfg file in the current working directory,
read it from there. If this contains an importconfig-value,
say 'myway', construct filename turtle_mayway.cfg else use
turtle.cfg and read it from the import-directory, where
tu... | Read config-files, change configuration-dict accordingly. | [
"Read",
"config",
"-",
"files",
"change",
"configuration",
"-",
"dict",
"accordingly",
"."
] | def readconfig(cfgdict):
"""Read config-files, change configuration-dict accordingly.
If there is a turtle.cfg file in the current working directory,
read it from there. If this contains an importconfig-value,
say 'myway', construct filename turtle_mayway.cfg else use
turtle.cfg and read it from th... | [
"def",
"readconfig",
"(",
"cfgdict",
")",
":",
"default_cfg",
"=",
"\"turtle.cfg\"",
"cfgdict1",
"=",
"{",
"}",
"cfgdict2",
"=",
"{",
"}",
"if",
"isfile",
"(",
"default_cfg",
")",
":",
"cfgdict1",
"=",
"config_dict",
"(",
"default_cfg",
")",
"#print \"1. Loa... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/turtle.py#L213-L247 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py | python | BigBracket.getcell | (self, index) | return TaggedBit().constant(piece, span) | Get the bracket piece as an array cell. | Get the bracket piece as an array cell. | [
"Get",
"the",
"bracket",
"piece",
"as",
"an",
"array",
"cell",
"."
] | def getcell(self, index):
"Get the bracket piece as an array cell."
piece = self.getpiece(index)
span = 'span class="bracket align-' + self.alignment + '"'
return TaggedBit().constant(piece, span) | [
"def",
"getcell",
"(",
"self",
",",
"index",
")",
":",
"piece",
"=",
"self",
".",
"getpiece",
"(",
"index",
")",
"span",
"=",
"'span class=\"bracket align-'",
"+",
"self",
".",
"alignment",
"+",
"'\"'",
"return",
"TaggedBit",
"(",
")",
".",
"constant",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py#L4372-L4376 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/polynomial/_polybase.py | python | ABCPolyBase.roots | (self) | return pu.mapdomain(roots, self.window, self.domain) | Return the roots of the series polynomial.
Compute the roots for the series. Note that the accuracy of the
roots decrease the further outside the domain they lie.
Returns
-------
roots : ndarray
Array containing the roots of the series. | Return the roots of the series polynomial. | [
"Return",
"the",
"roots",
"of",
"the",
"series",
"polynomial",
"."
] | def roots(self):
"""Return the roots of the series polynomial.
Compute the roots for the series. Note that the accuracy of the
roots decrease the further outside the domain they lie.
Returns
-------
roots : ndarray
Array containing the roots of the series.
... | [
"def",
"roots",
"(",
"self",
")",
":",
"roots",
"=",
"self",
".",
"_roots",
"(",
"self",
".",
"coef",
")",
"return",
"pu",
".",
"mapdomain",
"(",
"roots",
",",
"self",
".",
"window",
",",
"self",
".",
"domain",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/polynomial/_polybase.py#L763-L776 | |
larroy/clearskies_core | 3574ddf0edc8555454c7044126e786a6c29444dc | tools/gyp/pylib/gyp/MSVSVersion.py | python | VisualStudioVersion.SetupScript | (self, target_arch) | Returns a command (with arguments) to be used to set up the
environment. | Returns a command (with arguments) to be used to set up the
environment. | [
"Returns",
"a",
"command",
"(",
"with",
"arguments",
")",
"to",
"be",
"used",
"to",
"set",
"up",
"the",
"environment",
"."
] | def SetupScript(self, target_arch):
"""Returns a command (with arguments) to be used to set up the
environment."""
# Check if we are running in the SDK command line environment and use
# the setup script from the SDK if so. |target_arch| should be either
# 'x86' or 'x64'.
assert target_arch in (... | [
"def",
"SetupScript",
"(",
"self",
",",
"target_arch",
")",
":",
"# Check if we are running in the SDK command line environment and use",
"# the setup script from the SDK if so. |target_arch| should be either",
"# 'x86' or 'x64'.",
"assert",
"target_arch",
"in",
"(",
"'x86'",
",",
... | https://github.com/larroy/clearskies_core/blob/3574ddf0edc8555454c7044126e786a6c29444dc/tools/gyp/pylib/gyp/MSVSVersion.py#L71-L106 | ||
turi-code/SFrame | 796b9bdfb2fa1b881d82080754643c7e68629cd2 | oss_src/unity/python/sframe/data_structures/sarray.py | python | SArray.random_split | (self, fraction, seed=None) | return (train['X1'], test['X1']) | Randomly split the rows of an SArray into two SArrays. The first SArray
contains *M* rows, sampled uniformly (without replacement) from the
original SArray. *M* is approximately the fraction times the original
number of rows. The second SArray contains the remaining rows of the
original ... | Randomly split the rows of an SArray into two SArrays. The first SArray
contains *M* rows, sampled uniformly (without replacement) from the
original SArray. *M* is approximately the fraction times the original
number of rows. The second SArray contains the remaining rows of the
original ... | [
"Randomly",
"split",
"the",
"rows",
"of",
"an",
"SArray",
"into",
"two",
"SArrays",
".",
"The",
"first",
"SArray",
"contains",
"*",
"M",
"*",
"rows",
"sampled",
"uniformly",
"(",
"without",
"replacement",
")",
"from",
"the",
"original",
"SArray",
".",
"*",... | def random_split(self, fraction, seed=None):
"""
Randomly split the rows of an SArray into two SArrays. The first SArray
contains *M* rows, sampled uniformly (without replacement) from the
original SArray. *M* is approximately the fraction times the original
number of rows. The s... | [
"def",
"random_split",
"(",
"self",
",",
"fraction",
",",
"seed",
"=",
"None",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"temporary_sf",
"=",
"SFrame",
"(",
")",
"temporary_sf",
"[",
"'X1'",
"]",
"=",
"self",
"(",
"train",
",",
"test",
")",
... | https://github.com/turi-code/SFrame/blob/796b9bdfb2fa1b881d82080754643c7e68629cd2/oss_src/unity/python/sframe/data_structures/sarray.py#L2894-L2930 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_texts.py | python | Text.action | (self, arg) | Handle the 3D scene events.
This is installed as an EventCallback in the Inventor view.
Parameters
----------
arg: dict
Dictionary with strings that indicates the type of event received
from the 3D view. | Handle the 3D scene events. | [
"Handle",
"the",
"3D",
"scene",
"events",
"."
] | def action(self, arg):
"""Handle the 3D scene events.
This is installed as an EventCallback in the Inventor view.
Parameters
----------
arg: dict
Dictionary with strings that indicates the type of event received
from the 3D view.
"""
if a... | [
"def",
"action",
"(",
"self",
",",
"arg",
")",
":",
"if",
"arg",
"[",
"\"Type\"",
"]",
"==",
"\"SoKeyboardEvent\"",
":",
"if",
"arg",
"[",
"\"Key\"",
"]",
"==",
"\"ESCAPE\"",
":",
"self",
".",
"finish",
"(",
")",
"elif",
"arg",
"[",
"\"Type\"",
"]",
... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_texts.py#L125-L151 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | ArtProvider.Insert | (*args, **kwargs) | return _misc_.ArtProvider_Insert(*args, **kwargs) | Insert(ArtProvider provider)
Add new provider to the bottom of providers stack. | Insert(ArtProvider provider) | [
"Insert",
"(",
"ArtProvider",
"provider",
")"
] | def Insert(*args, **kwargs):
"""
Insert(ArtProvider provider)
Add new provider to the bottom of providers stack.
"""
return _misc_.ArtProvider_Insert(*args, **kwargs) | [
"def",
"Insert",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"ArtProvider_Insert",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L2786-L2792 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/pycc/cc.py | python | _CCExtension.monkey_patch_distutils | (cls) | Monkey-patch distutils with our own build_ext class knowing
about pycc-compiled extensions modules. | Monkey-patch distutils with our own build_ext class knowing
about pycc-compiled extensions modules. | [
"Monkey",
"-",
"patch",
"distutils",
"with",
"our",
"own",
"build_ext",
"class",
"knowing",
"about",
"pycc",
"-",
"compiled",
"extensions",
"modules",
"."
] | def monkey_patch_distutils(cls):
"""
Monkey-patch distutils with our own build_ext class knowing
about pycc-compiled extensions modules.
"""
if cls._distutils_monkey_patched:
return
_orig_build_ext = build_ext.build_ext
class _CC_build_ext(_orig_buil... | [
"def",
"monkey_patch_distutils",
"(",
"cls",
")",
":",
"if",
"cls",
".",
"_distutils_monkey_patched",
":",
"return",
"_orig_build_ext",
"=",
"build_ext",
".",
"build_ext",
"class",
"_CC_build_ext",
"(",
"_orig_build_ext",
")",
":",
"def",
"build_extension",
"(",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/pycc/cc.py#L283-L303 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | tools/sort-headers.py | python | IncludeCompareKey | (line) | return '4' + line | Sorting comparator key used for comparing two #include lines.
Returns the filename without the #include/#import prefix. | Sorting comparator key used for comparing two #include lines.
Returns the filename without the #include/#import prefix. | [
"Sorting",
"comparator",
"key",
"used",
"for",
"comparing",
"two",
"#include",
"lines",
".",
"Returns",
"the",
"filename",
"without",
"the",
"#include",
"/",
"#import",
"prefix",
"."
] | def IncludeCompareKey(line):
"""Sorting comparator key used for comparing two #include lines.
Returns the filename without the #include/#import prefix.
"""
for prefix in ('#include ', '#import '):
if line.startswith(prefix):
line = line[len(prefix):]
break
# The win32 api has all sorts of imp... | [
"def",
"IncludeCompareKey",
"(",
"line",
")",
":",
"for",
"prefix",
"in",
"(",
"'#include '",
",",
"'#import '",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"prefix",
")",
":",
"line",
"=",
"line",
"[",
"len",
"(",
"prefix",
")",
":",
"]",
"break... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/tools/sort-headers.py#L36-L60 | |
fengbingchun/NN_Test | d6305825d5273e4569ccd1eda9ffa2a9c72e18d2 | src/tiny-dnn/third_party/cpplint.py | python | CheckComment | (line, filename, linenum, next_line_start, error) | Checks for common mistakes in comments.
Args:
line: The line in question.
filename: The name of the current file.
linenum: The number of the line to check.
next_line_start: The first non-whitespace column of the next line.
error: The function to call with any errors found. | Checks for common mistakes in comments. | [
"Checks",
"for",
"common",
"mistakes",
"in",
"comments",
"."
] | def CheckComment(line, filename, linenum, next_line_start, error):
"""Checks for common mistakes in comments.
Args:
line: The line in question.
filename: The name of the current file.
linenum: The number of the line to check.
next_line_start: The first non-whitespace column of the next line.
er... | [
"def",
"CheckComment",
"(",
"line",
",",
"filename",
",",
"linenum",
",",
"next_line_start",
",",
"error",
")",
":",
"commentpos",
"=",
"line",
".",
"find",
"(",
"'//'",
")",
"if",
"commentpos",
"!=",
"-",
"1",
":",
"# Check if the // may be in quotes. If so,... | https://github.com/fengbingchun/NN_Test/blob/d6305825d5273e4569ccd1eda9ffa2a9c72e18d2/src/tiny-dnn/third_party/cpplint.py#L3228-L3279 | ||
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/SCons/exitfuncs.py | python | register | (func, *targs, **kargs) | register a function to be executed upon normal program termination
func - function to be called at exit
targs - optional arguments to pass to func
kargs - optional keyword arguments to pass to func | register a function to be executed upon normal program termination | [
"register",
"a",
"function",
"to",
"be",
"executed",
"upon",
"normal",
"program",
"termination"
] | def register(func, *targs, **kargs):
"""register a function to be executed upon normal program termination
func - function to be called at exit
targs - optional arguments to pass to func
kargs - optional keyword arguments to pass to func
"""
_exithandlers.append((func, targs, kargs)) | [
"def",
"register",
"(",
"func",
",",
"*",
"targs",
",",
"*",
"*",
"kargs",
")",
":",
"_exithandlers",
".",
"append",
"(",
"(",
"func",
",",
"targs",
",",
"kargs",
")",
")"
] | https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/exitfuncs.py#L47-L54 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/multiprocessing/forkserver.py | python | ForkServer.get_inherited_fds | (self) | return self._inherited_fds | Return list of fds inherited from parent process.
This returns None if the current process was not started by fork
server. | Return list of fds inherited from parent process. | [
"Return",
"list",
"of",
"fds",
"inherited",
"from",
"parent",
"process",
"."
] | def get_inherited_fds(self):
'''Return list of fds inherited from parent process.
This returns None if the current process was not started by fork
server.
'''
return self._inherited_fds | [
"def",
"get_inherited_fds",
"(",
"self",
")",
":",
"return",
"self",
".",
"_inherited_fds"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/multiprocessing/forkserver.py#L67-L73 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/pystache/setup.py | python | strip_html_comments | (text) | return "".join(new_lines) | Strip HTML comments from a unicode string. | Strip HTML comments from a unicode string. | [
"Strip",
"HTML",
"comments",
"from",
"a",
"unicode",
"string",
"."
] | def strip_html_comments(text):
"""Strip HTML comments from a unicode string."""
lines = text.splitlines(True) # preserve line endings.
# Remove HTML comments (which we only allow to take a special form).
new_lines = filter(lambda line: not line.startswith("<!--"), lines)
return "".join(new_lines) | [
"def",
"strip_html_comments",
"(",
"text",
")",
":",
"lines",
"=",
"text",
".",
"splitlines",
"(",
"True",
")",
"# preserve line endings.",
"# Remove HTML comments (which we only allow to take a special form).",
"new_lines",
"=",
"filter",
"(",
"lambda",
"line",
":",
"n... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/pystache/setup.py#L198-L205 | |
ArduPilot/ardupilot | 6e684b3496122b8158ac412b609d00004b7ac306 | libraries/AP_MSP/Tools/pymsp.py | python | MSPItem.parse | (self, msp, dataSize) | parse data | parse data | [
"parse",
"data"
] | def parse(self, msp, dataSize):
'''parse data'''
ofs = msp.p
for i in range(len(self.format)):
fmt = self.format[i]
fields = self.fields[i].split(',')
if fmt[0] == '{':
# we have a repeat count from an earlier variable
right = f... | [
"def",
"parse",
"(",
"self",
",",
"msp",
",",
"dataSize",
")",
":",
"ofs",
"=",
"msp",
".",
"p",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"format",
")",
")",
":",
"fmt",
"=",
"self",
".",
"format",
"[",
"i",
"]",
"fields",
"="... | https://github.com/ArduPilot/ardupilot/blob/6e684b3496122b8158ac412b609d00004b7ac306/libraries/AP_MSP/Tools/pymsp.py#L25-L56 | ||
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_parser.py | python | p_places_places_comma_symbol | (p) | places : places COMMA SYMBOL | places : places COMMA SYMBOL | [
"places",
":",
"places",
"COMMA",
"SYMBOL"
] | def p_places_places_comma_symbol(p):
'places : places COMMA SYMBOL'
p[0] = p[1]
p[0].append(Atom(p[3]))
p[0][-1].lineno = get_lineno(p,3) | [
"def",
"p_places_places_comma_symbol",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"p",
"[",
"1",
"]",
"p",
"[",
"0",
"]",
".",
"append",
"(",
"Atom",
"(",
"p",
"[",
"3",
"]",
")",
")",
"p",
"[",
"0",
"]",
"[",
"-",
"1",
"]",
".",
"linen... | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_parser.py#L1941-L1945 | ||
livecode/livecode | 4606a10ea10b16d5071d0f9f263ccdd7ede8b31d | gyp/pylib/gyp/common.py | python | AllTargets | (target_list, target_dicts, build_file) | return bftargets + deptargets | Returns all targets (direct and dependencies) for the specified build_file. | Returns all targets (direct and dependencies) for the specified build_file. | [
"Returns",
"all",
"targets",
"(",
"direct",
"and",
"dependencies",
")",
"for",
"the",
"specified",
"build_file",
"."
] | def AllTargets(target_list, target_dicts, build_file):
"""Returns all targets (direct and dependencies) for the specified build_file.
"""
bftargets = BuildFileTargets(target_list, build_file)
deptargets = DeepDependencyTargets(target_dicts, bftargets)
return bftargets + deptargets | [
"def",
"AllTargets",
"(",
"target_list",
",",
"target_dicts",
",",
"build_file",
")",
":",
"bftargets",
"=",
"BuildFileTargets",
"(",
"target_list",
",",
"build_file",
")",
"deptargets",
"=",
"DeepDependencyTargets",
"(",
"target_dicts",
",",
"bftargets",
")",
"re... | https://github.com/livecode/livecode/blob/4606a10ea10b16d5071d0f9f263ccdd7ede8b31d/gyp/pylib/gyp/common.py#L314-L319 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/ma/core.py | python | left_shift | (a, n) | Shift the bits of an integer to the left.
This is the masked array version of `numpy.left_shift`, for details
see that function.
See Also
--------
numpy.left_shift | Shift the bits of an integer to the left. | [
"Shift",
"the",
"bits",
"of",
"an",
"integer",
"to",
"the",
"left",
"."
] | def left_shift (a, n):
"""
Shift the bits of an integer to the left.
This is the masked array version of `numpy.left_shift`, for details
see that function.
See Also
--------
numpy.left_shift
"""
m = getmask(a)
if m is nomask:
d = umath.left_shift(filled(a), n)
... | [
"def",
"left_shift",
"(",
"a",
",",
"n",
")",
":",
"m",
"=",
"getmask",
"(",
"a",
")",
"if",
"m",
"is",
"nomask",
":",
"d",
"=",
"umath",
".",
"left_shift",
"(",
"filled",
"(",
"a",
")",
",",
"n",
")",
"return",
"masked_array",
"(",
"d",
")",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/ma/core.py#L6331-L6349 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | ListBox.GetClassDefaultAttributes | (*args, **kwargs) | return _controls_.ListBox_GetClassDefaultAttributes(*args, **kwargs) | GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
Get the default attributes for this class. This is useful if you want
to use the same font or colour in your own control as in a standard
control -- which is a much better idea than hard coding specific
co... | GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes | [
"GetClassDefaultAttributes",
"(",
"int",
"variant",
"=",
"WINDOW_VARIANT_NORMAL",
")",
"-",
">",
"VisualAttributes"
] | def GetClassDefaultAttributes(*args, **kwargs):
"""
GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
Get the default attributes for this class. This is useful if you want
to use the same font or colour in your own control as in a standard
control... | [
"def",
"GetClassDefaultAttributes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ListBox_GetClassDefaultAttributes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L1257-L1272 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/metrics_impl.py | python | _streaming_sparse_average_precision_at_top_k | (labels,
predictions_idx,
weights=None,
metrics_collections=None,
updates_collections=None,
... | Computes average precision@k of predictions with respect to sparse labels.
`sparse_average_precision_at_top_k` creates two local variables,
`average_precision_at_<k>/total` and `average_precision_at_<k>/max`, that
are used to compute the frequency. This frequency is ultimately returned as
`average_precision_at... | Computes average precision@k of predictions with respect to sparse labels. | [
"Computes",
"average",
"precision@k",
"of",
"predictions",
"with",
"respect",
"to",
"sparse",
"labels",
"."
] | def _streaming_sparse_average_precision_at_top_k(labels,
predictions_idx,
weights=None,
metrics_collections=None,
updates_co... | [
"def",
"_streaming_sparse_average_precision_at_top_k",
"(",
"labels",
",",
"predictions_idx",
",",
"weights",
"=",
"None",
",",
"metrics_collections",
"=",
"None",
",",
"updates_collections",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/metrics_impl.py#L3083-L3173 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.