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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/exponential.py | python | Exponential.__init__ | (
self, lam, validate_args=True, allow_nan_stats=False, name="Exponential") | Construct Exponential distribution with parameter `lam`.
Args:
lam: Floating point tensor, the rate of the distribution(s).
`lam` must contain only positive values.
validate_args: Whether to assert that `lam > 0`, and that `x > 0` in the
methods `prob(x)` and `log_prob(x)`. If `validat... | Construct Exponential distribution with parameter `lam`. | [
"Construct",
"Exponential",
"distribution",
"with",
"parameter",
"lam",
"."
] | def __init__(
self, lam, validate_args=True, allow_nan_stats=False, name="Exponential"):
"""Construct Exponential distribution with parameter `lam`.
Args:
lam: Floating point tensor, the rate of the distribution(s).
`lam` must contain only positive values.
validate_args: Whether to as... | [
"def",
"__init__",
"(",
"self",
",",
"lam",
",",
"validate_args",
"=",
"True",
",",
"allow_nan_stats",
"=",
"False",
",",
"name",
"=",
"\"Exponential\"",
")",
":",
"# Even though all statistics of are defined for valid inputs, this is not",
"# true in the parent class \"Gam... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/exponential.py#L44-L71 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/preprocessing/label.py | python | MultiLabelBinarizer.fit_transform | (self, y) | return yt | Fit the label sets binarizer and transform the given label sets
Parameters
----------
y : iterable of iterables
A set of labels (any orderable and hashable object) for each
sample. If the `classes` parameter is set, `y` will not be
iterated.
Returns
... | Fit the label sets binarizer and transform the given label sets | [
"Fit",
"the",
"label",
"sets",
"binarizer",
"and",
"transform",
"the",
"given",
"label",
"sets"
] | def fit_transform(self, y):
"""Fit the label sets binarizer and transform the given label sets
Parameters
----------
y : iterable of iterables
A set of labels (any orderable and hashable object) for each
sample. If the `classes` parameter is set, `y` will not be
... | [
"def",
"fit_transform",
"(",
"self",
",",
"y",
")",
":",
"if",
"self",
".",
"classes",
"is",
"not",
"None",
":",
"return",
"self",
".",
"fit",
"(",
"y",
")",
".",
"transform",
"(",
"y",
")",
"# Automatically increment on new class",
"class_mapping",
"=",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/preprocessing/label.py#L703-L742 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/optimize/_differentialevolution.py | python | DifferentialEvolutionSolver._calculate_population_energies | (self, population) | return energies | Calculate the energies of all the population members at the same time.
Parameters
----------
population : ndarray
An array of parameter vectors normalised to [0, 1] using lower
and upper limits. Has shape ``(np.size(population, 0), len(x))``.
Returns
---... | Calculate the energies of all the population members at the same time. | [
"Calculate",
"the",
"energies",
"of",
"all",
"the",
"population",
"members",
"at",
"the",
"same",
"time",
"."
] | def _calculate_population_energies(self, population):
"""
Calculate the energies of all the population members at the same time.
Parameters
----------
population : ndarray
An array of parameter vectors normalised to [0, 1] using lower
and upper limits. Ha... | [
"def",
"_calculate_population_energies",
"(",
"self",
",",
"population",
")",
":",
"num_members",
"=",
"np",
".",
"size",
"(",
"population",
",",
"0",
")",
"nfevs",
"=",
"min",
"(",
"num_members",
",",
"self",
".",
"maxfun",
"-",
"num_members",
")",
"energ... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/_differentialevolution.py#L748-L786 | |
microsoft/bond | 48dfc058380d88b85daa0165ad66d15e4205601a | tools/ci-scripts/linux/image-cleanup/collector/live_images.py | python | live_tags | (repo_path: str,
roots: RevListRoots) | return frozenset((ImageTag(image_name.split(':')[1])
for image_name in live_images(repo_path, roots)
if matches_expected_prefix(image_name))) | Return the image tags that are referenced by .travis.yml or Linux GitHub
Action workflow files in the commits specified by the given `roots`.
:param repo_path: Path to the repository to inspect.
:param roots: A collection of argument lists to pass to ``git rev-list``
to limit the matched commits. | Return the image tags that are referenced by .travis.yml or Linux GitHub
Action workflow files in the commits specified by the given `roots`. | [
"Return",
"the",
"image",
"tags",
"that",
"are",
"referenced",
"by",
".",
"travis",
".",
"yml",
"or",
"Linux",
"GitHub",
"Action",
"workflow",
"files",
"in",
"the",
"commits",
"specified",
"by",
"the",
"given",
"roots",
"."
] | def live_tags(repo_path: str,
roots: RevListRoots) -> AbstractSet[ImageTag]:
"""Return the image tags that are referenced by .travis.yml or Linux GitHub
Action workflow files in the commits specified by the given `roots`.
:param repo_path: Path to the repository to inspect.
:param roots: A c... | [
"def",
"live_tags",
"(",
"repo_path",
":",
"str",
",",
"roots",
":",
"RevListRoots",
")",
"->",
"AbstractSet",
"[",
"ImageTag",
"]",
":",
"expected_prefix",
"=",
"'{}.azurecr.io/{}'",
".",
"format",
"(",
"REGISTRY_NAME",
",",
"REPOSITORY_NAME",
")",
"def",
"ma... | https://github.com/microsoft/bond/blob/48dfc058380d88b85daa0165ad66d15e4205601a/tools/ci-scripts/linux/image-cleanup/collector/live_images.py#L145-L169 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/importbench/importbench.py | python | bench | (name, cleanup=lambda: None, *, seconds=1, repeat=3) | Bench the given statement as many times as necessary until total
executions take one second. | Bench the given statement as many times as necessary until total
executions take one second. | [
"Bench",
"the",
"given",
"statement",
"as",
"many",
"times",
"as",
"necessary",
"until",
"total",
"executions",
"take",
"one",
"second",
"."
] | def bench(name, cleanup=lambda: None, *, seconds=1, repeat=3):
"""Bench the given statement as many times as necessary until total
executions take one second."""
stmt = "__import__({!r})".format(name)
timer = timeit.Timer(stmt)
for x in range(repeat):
total_time = 0
count = 0
... | [
"def",
"bench",
"(",
"name",
",",
"cleanup",
"=",
"lambda",
":",
"None",
",",
"*",
",",
"seconds",
"=",
"1",
",",
"repeat",
"=",
"3",
")",
":",
"stmt",
"=",
"\"__import__({!r})\"",
".",
"format",
"(",
"name",
")",
"timer",
"=",
"timeit",
".",
"Time... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/importbench/importbench.py#L20-L38 | ||
vgough/encfs | c444f9b9176beea1ad41a7b2e29ca26e709b57f7 | vendor/github.com/muflihun/easyloggingpp/tools/cpplint.py | python | _CppLintState.SetFilters | (self, filters) | Sets the error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "+whitespace/indent").
Each filter should start with + or -; else we die.
Raises:
ValueError: The comma-sepa... | Sets the error-message filters. | [
"Sets",
"the",
"error",
"-",
"message",
"filters",
"."
] | def SetFilters(self, filters):
"""Sets the error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "+whitespace/indent").
Each filter should start with + or -; else we die.
Ra... | [
"def",
"SetFilters",
"(",
"self",
",",
"filters",
")",
":",
"# Default filters always have less priority than the flag ones.",
"self",
".",
"filters",
"=",
"_DEFAULT_FILTERS",
"[",
":",
"]",
"for",
"filt",
"in",
"filters",
".",
"split",
"(",
"','",
")",
":",
"cl... | https://github.com/vgough/encfs/blob/c444f9b9176beea1ad41a7b2e29ca26e709b57f7/vendor/github.com/muflihun/easyloggingpp/tools/cpplint.py#L694-L717 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/email/_parseaddr.py | python | quote | (str) | return str.replace('\\', '\\\\').replace('"', '\\"') | Prepare string to be used in a quoted string.
Turns backslash and double quote characters into quoted pairs. These
are the only characters that need to be quoted inside a quoted string.
Does not add the surrounding double quotes. | Prepare string to be used in a quoted string. | [
"Prepare",
"string",
"to",
"be",
"used",
"in",
"a",
"quoted",
"string",
"."
] | def quote(str):
"""Prepare string to be used in a quoted string.
Turns backslash and double quote characters into quoted pairs. These
are the only characters that need to be quoted inside a quoted string.
Does not add the surrounding double quotes.
"""
return str.replace('\\', '\\\\').replace(... | [
"def",
"quote",
"(",
"str",
")",
":",
"return",
"str",
".",
"replace",
"(",
"'\\\\'",
",",
"'\\\\\\\\'",
")",
".",
"replace",
"(",
"'\"'",
",",
"'\\\\\"'",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/email/_parseaddr.py#L162-L169 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | dom/bindings/parser/WebIDL.py | python | Parser.p_Attribute | (self, p) | Attribute : Inherit AttributeRest | Attribute : Inherit AttributeRest | [
"Attribute",
":",
"Inherit",
"AttributeRest"
] | def p_Attribute(self, p):
"""
Attribute : Inherit AttributeRest
"""
(location, identifier, type, readonly) = p[2]
p[0] = IDLAttribute(location, identifier, type, readonly, inherit=p[1]) | [
"def",
"p_Attribute",
"(",
"self",
",",
"p",
")",
":",
"(",
"location",
",",
"identifier",
",",
"type",
",",
"readonly",
")",
"=",
"p",
"[",
"2",
"]",
"p",
"[",
"0",
"]",
"=",
"IDLAttribute",
"(",
"location",
",",
"identifier",
",",
"type",
",",
... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/dom/bindings/parser/WebIDL.py#L4636-L4641 | ||
alibaba/weex_js_engine | 2bdf4b6f020c1fc99c63f649718f6faf7e27fdde | jni/v8core/v8/build/gyp/pylib/gyp/MSVSProject.py | python | Writer.AddFiles | (self, files) | Adds files to the project.
Args:
files: A list of Filter objects and/or relative paths to files.
This makes a copy of the file/filter tree at the time of this call. If you
later add files to a Filter object which was passed into a previous call
to AddFiles(), it will not be reflected in this pr... | Adds files to the project. | [
"Adds",
"files",
"to",
"the",
"project",
"."
] | def AddFiles(self, files):
"""Adds files to the project.
Args:
files: A list of Filter objects and/or relative paths to files.
This makes a copy of the file/filter tree at the time of this call. If you
later add files to a Filter object which was passed into a previous call
to AddFiles(), i... | [
"def",
"AddFiles",
"(",
"self",
",",
"files",
")",
":",
"self",
".",
"_AddFilesToNode",
"(",
"self",
".",
"files_section",
",",
"files",
")"
] | https://github.com/alibaba/weex_js_engine/blob/2bdf4b6f020c1fc99c63f649718f6faf7e27fdde/jni/v8core/v8/build/gyp/pylib/gyp/MSVSProject.py#L152-L162 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/pydocview.py | python | DocApp.OnInit | (self) | return True | Initializes the DocApp. | Initializes the DocApp. | [
"Initializes",
"the",
"DocApp",
"."
] | def OnInit(self):
"""
Initializes the DocApp.
"""
self._services = []
self._defaultIcon = None
self._registeredCloseEvent = False
self._useTabbedMDI = True
if not hasattr(self, "_debug"): # only set if not already initialized
self._debug = Fa... | [
"def",
"OnInit",
"(",
"self",
")",
":",
"self",
".",
"_services",
"=",
"[",
"]",
"self",
".",
"_defaultIcon",
"=",
"None",
"self",
".",
"_registeredCloseEvent",
"=",
"False",
"self",
".",
"_useTabbedMDI",
"=",
"True",
"if",
"not",
"hasattr",
"(",
"self",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/pydocview.py#L1664-L1719 | |
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriMpiUtilities.py | python | ReadAndMpiBroadcastJsonFile | (inJsonFileName) | return returnJson | given a json format file, read in the contents using the python json
library on process zero, use MPI to broadcast the contents to all
processes (via converting to a long char string) | given a json format file, read in the contents using the python json
library on process zero, use MPI to broadcast the contents to all
processes (via converting to a long char string) | [
"given",
"a",
"json",
"format",
"file",
"read",
"in",
"the",
"contents",
"using",
"the",
"python",
"json",
"library",
"on",
"process",
"zero",
"use",
"MPI",
"to",
"broadcast",
"the",
"contents",
"to",
"all",
"processes",
"(",
"via",
"converting",
"to",
"a"... | def ReadAndMpiBroadcastJsonFile(inJsonFileName):
"""given a json format file, read in the contents using the python json
library on process zero, use MPI to broadcast the contents to all
processes (via converting to a long char string)"""
if SmartGetLocalProcessId() == 0:
#process zero loads json scri... | [
"def",
"ReadAndMpiBroadcastJsonFile",
"(",
"inJsonFileName",
")",
":",
"if",
"SmartGetLocalProcessId",
"(",
")",
"==",
"0",
":",
"#process zero loads json script and broadcasts",
"returnJson",
"=",
"HandleJsonScriptLoadProcessZero",
"(",
"inJsonFileName",
")",
"else",
":",
... | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriMpiUtilities.py#L220-L230 | |
google/omaha | 61e8c2833fd69c9a13978400108e5b9ebff24a09 | omaha/site_scons/site_tools/atlmfc_vc15_0.py | python | generate | (env) | SCons entry point for this tool. | SCons entry point for this tool. | [
"SCons",
"entry",
"point",
"for",
"this",
"tool",
"."
] | def generate(env):
# NOTE: SCons requires the use of this name, which fails gpylint.
"""SCons entry point for this tool."""
if not env.get('ATLMFC_VC15_0_DIR'):
env['ATLMFC_VC15_0_DIR'] = _FindLocalInstall()
env.AppendENVPath('INCLUDE', env.Dir('$ATLMFC_VC15_0_DIR/include').abspath)
env.AppendENVPath('L... | [
"def",
"generate",
"(",
"env",
")",
":",
"# NOTE: SCons requires the use of this name, which fails gpylint.",
"if",
"not",
"env",
".",
"get",
"(",
"'ATLMFC_VC15_0_DIR'",
")",
":",
"env",
"[",
"'ATLMFC_VC15_0_DIR'",
"]",
"=",
"_FindLocalInstall",
"(",
")",
"env",
"."... | https://github.com/google/omaha/blob/61e8c2833fd69c9a13978400108e5b9ebff24a09/omaha/site_scons/site_tools/atlmfc_vc15_0.py#L34-L42 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_offset.py | python | Offset.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.
"""
impo... | [
"def",
"action",
"(",
"self",
",",
"arg",
")",
":",
"import",
"DraftGeomUtils",
"plane",
"=",
"App",
".",
"DraftWorkingPlane",
"if",
"arg",
"[",
"\"Type\"",
"]",
"==",
"\"SoKeyboardEvent\"",
":",
"if",
"arg",
"[",
"\"Key\"",
"]",
"==",
"\"ESCAPE\"",
":",
... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_offset.py#L148-L265 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | TextEntryBase.CanCut | (*args, **kwargs) | return _core_.TextEntryBase_CanCut(*args, **kwargs) | CanCut(self) -> bool
Returns True if the text field is editable and there is a text
selection to copy to the clipboard. | CanCut(self) -> bool | [
"CanCut",
"(",
"self",
")",
"-",
">",
"bool"
] | def CanCut(*args, **kwargs):
"""
CanCut(self) -> bool
Returns True if the text field is editable and there is a text
selection to copy to the clipboard.
"""
return _core_.TextEntryBase_CanCut(*args, **kwargs) | [
"def",
"CanCut",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"TextEntryBase_CanCut",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L13193-L13200 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/framework/tensor_shape.py | python | TensorShape.with_rank_at_least | (self, rank) | Returns a shape based on `self` with at least the given rank.
Args:
rank: An integer.
Returns:
A shape that is at least as specific as `self` with at least the given
rank.
Raises:
ValueError: If `self` does not represent a shape with at least the given
`rank`. | Returns a shape based on `self` with at least the given rank. | [
"Returns",
"a",
"shape",
"based",
"on",
"self",
"with",
"at",
"least",
"the",
"given",
"rank",
"."
] | def with_rank_at_least(self, rank):
"""Returns a shape based on `self` with at least the given rank.
Args:
rank: An integer.
Returns:
A shape that is at least as specific as `self` with at least the given
rank.
Raises:
ValueError: If `self` does not represent a shape with at l... | [
"def",
"with_rank_at_least",
"(",
"self",
",",
"rank",
")",
":",
"if",
"self",
".",
"ndims",
"is",
"not",
"None",
"and",
"self",
".",
"ndims",
"<",
"rank",
":",
"raise",
"ValueError",
"(",
"\"Shape %s must have rank at least %d\"",
"%",
"(",
"self",
",",
"... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/framework/tensor_shape.py#L656-L673 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/fmcustomizedlg.py | python | FMCustomizeDlg.CreateOptionsPage | (self) | return options | Creates the :class:`LabelBook` option page which holds the :class:`FlatMenu` styles. | Creates the :class:`LabelBook` option page which holds the :class:`FlatMenu` styles. | [
"Creates",
"the",
":",
"class",
":",
"LabelBook",
"option",
"page",
"which",
"holds",
"the",
":",
"class",
":",
"FlatMenu",
"styles",
"."
] | def CreateOptionsPage(self):
""" Creates the :class:`LabelBook` option page which holds the :class:`FlatMenu` styles. """
options = wx.Panel(self._book, wx.ID_ANY, wx.DefaultPosition, wx.Size(300, 300))
# Create some options here
vsizer = wx.BoxSizer(wx.VERTICAL)
options.Se... | [
"def",
"CreateOptionsPage",
"(",
"self",
")",
":",
"options",
"=",
"wx",
".",
"Panel",
"(",
"self",
".",
"_book",
",",
"wx",
".",
"ID_ANY",
",",
"wx",
".",
"DefaultPosition",
",",
"wx",
".",
"Size",
"(",
"300",
",",
"300",
")",
")",
"# Create some op... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/fmcustomizedlg.py#L298-L397 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/pythonapi.py | python | PythonAPI.get_c_object | (self, name) | return self.context.get_c_value(self.builder, self.pyobj.pointee, name,
dllimport=True) | Get a Python object through its C-accessible *name*
(e.g. "PyExc_ValueError"). The underlying variable must be
a `PyObject *`, and the value of that pointer is returned. | Get a Python object through its C-accessible *name*
(e.g. "PyExc_ValueError"). The underlying variable must be
a `PyObject *`, and the value of that pointer is returned. | [
"Get",
"a",
"Python",
"object",
"through",
"its",
"C",
"-",
"accessible",
"*",
"name",
"*",
"(",
"e",
".",
"g",
".",
"PyExc_ValueError",
")",
".",
"The",
"underlying",
"variable",
"must",
"be",
"a",
"PyObject",
"*",
"and",
"the",
"value",
"of",
"that",... | def get_c_object(self, name):
"""
Get a Python object through its C-accessible *name*
(e.g. "PyExc_ValueError"). The underlying variable must be
a `PyObject *`, and the value of that pointer is returned.
"""
# A LLVM global variable is implicitly a pointer to the declare... | [
"def",
"get_c_object",
"(",
"self",
",",
"name",
")",
":",
"# A LLVM global variable is implicitly a pointer to the declared",
"# type, so fix up by using pyobj.pointee.",
"return",
"self",
".",
"context",
".",
"get_c_value",
"(",
"self",
".",
"builder",
",",
"self",
".",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/pythonapi.py#L360-L369 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/prepare_binding_Python.py | python | run_python_script | (script_and_args) | Runs a python script, logging appropriately.
If the command returns anything non-zero, it is registered as
an error and exits the program.
@param script_and_args the python script to execute, along with
the command line arguments to pass to it. | Runs a python script, logging appropriately. | [
"Runs",
"a",
"python",
"script",
"logging",
"appropriately",
"."
] | def run_python_script(script_and_args):
"""Runs a python script, logging appropriately.
If the command returns anything non-zero, it is registered as
an error and exits the program.
@param script_and_args the python script to execute, along with
the command line arguments to pass to it.
"""
... | [
"def",
"run_python_script",
"(",
"script_and_args",
")",
":",
"command",
"=",
"[",
"sys",
".",
"executable",
"]",
"+",
"script_and_args",
"process",
"=",
"subprocess",
".",
"Popen",
"(",
"command",
")",
"script_stdout",
",",
"script_stderr",
"=",
"process",
".... | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/prepare_binding_Python.py#L345-L364 | ||
larroy/clearskies_core | 3574ddf0edc8555454c7044126e786a6c29444dc | tools/gyp/pylib/gyp/ordered_dict.py | python | OrderedDict.items | (self) | return [(key, self[key]) for key in self] | od.items() -> list of (key, value) pairs in od | od.items() -> list of (key, value) pairs in od | [
"od",
".",
"items",
"()",
"-",
">",
"list",
"of",
"(",
"key",
"value",
")",
"pairs",
"in",
"od"
] | def items(self):
'od.items() -> list of (key, value) pairs in od'
return [(key, self[key]) for key in self] | [
"def",
"items",
"(",
"self",
")",
":",
"return",
"[",
"(",
"key",
",",
"self",
"[",
"key",
"]",
")",
"for",
"key",
"in",
"self",
"]"
] | https://github.com/larroy/clearskies_core/blob/3574ddf0edc8555454c7044126e786a6c29444dc/tools/gyp/pylib/gyp/ordered_dict.py#L151-L153 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/commands.py | python | Build.finalize_options | (self) | Finalize options | Finalize options | [
"Finalize",
"options"
] | def finalize_options(self):
""" Finalize options """
_build.build.finalize_options(self)
if _option_inherits.has_key('build'):
for parent, opt_name in _option_inherits['build']:
self.set_undefined_options(parent, (opt_name, opt_name))
if _option_finalizers.has... | [
"def",
"finalize_options",
"(",
"self",
")",
":",
"_build",
".",
"build",
".",
"finalize_options",
"(",
"self",
")",
"if",
"_option_inherits",
".",
"has_key",
"(",
"'build'",
")",
":",
"for",
"parent",
",",
"opt_name",
"in",
"_option_inherits",
"[",
"'build'... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/commands.py#L259-L267 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | ImmediateFunction.WriteFormatTest | (self, file) | Overridden from Function | Overridden from Function | [
"Overridden",
"from",
"Function"
] | def WriteFormatTest(self, file):
"""Overridden from Function"""
self.type_handler.WriteImmediateFormatTest(self, file) | [
"def",
"WriteFormatTest",
"(",
"self",
",",
"file",
")",
":",
"self",
".",
"type_handler",
".",
"WriteImmediateFormatTest",
"(",
"self",
",",
"file",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/gpu/command_buffer/build_gles2_cmd_buffer.py#L6750-L6752 | ||
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/server/wsgi/serve/snippets/util/path_utils.py | python | MakeOldStyle | (newstyle_fieldpath) | return oldstyle | New style: a.b.000003.c -> old style: a.b[3].c .
Args:
newstyle_fieldpath: new-style path to convert.
Returns:
Old-style version of path. | New style: a.b.000003.c -> old style: a.b[3].c . | [
"New",
"style",
":",
"a",
".",
"b",
".",
"000003",
".",
"c",
"-",
">",
"old",
"style",
":",
"a",
".",
"b",
"[",
"3",
"]",
".",
"c",
"."
] | def MakeOldStyle(newstyle_fieldpath):
"""New style: a.b.000003.c -> old style: a.b[3].c .
Args:
newstyle_fieldpath: new-style path to convert.
Returns:
Old-style version of path.
"""
tokens = newstyle_fieldpath.split(".")
oldstyle = ""
is_first = True
for token in tokens:
if token.isdig... | [
"def",
"MakeOldStyle",
"(",
"newstyle_fieldpath",
")",
":",
"tokens",
"=",
"newstyle_fieldpath",
".",
"split",
"(",
"\".\"",
")",
"oldstyle",
"=",
"\"\"",
"is_first",
"=",
"True",
"for",
"token",
"in",
"tokens",
":",
"if",
"token",
".",
"isdigit",
"(",
")"... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/server/wsgi/serve/snippets/util/path_utils.py#L271-L289 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | IndividualLayoutConstraint.Below | (*args, **kwargs) | return _core_.IndividualLayoutConstraint_Below(*args, **kwargs) | Below(self, Window sibling, int marg=0)
Constrains this edge to be below the given window, with an optional
margin. Implicitly, this is relative to the bottom edge of the other
window. | Below(self, Window sibling, int marg=0) | [
"Below",
"(",
"self",
"Window",
"sibling",
"int",
"marg",
"=",
"0",
")"
] | def Below(*args, **kwargs):
"""
Below(self, Window sibling, int marg=0)
Constrains this edge to be below the given window, with an optional
margin. Implicitly, this is relative to the bottom edge of the other
window.
"""
return _core_.IndividualLayoutConstraint_B... | [
"def",
"Below",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"IndividualLayoutConstraint_Below",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L16162-L16170 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Source/ThirdParty/CEF3/pristine/cef_source/tools/cefbuilds/cef_json_builder.py | python | cef_json_builder.get_files | (self, platform=None, version=None, type=None) | return results | Return the files that match the input parameters.
All parameters are optional. Version will do partial matching. | Return the files that match the input parameters.
All parameters are optional. Version will do partial matching. | [
"Return",
"the",
"files",
"that",
"match",
"the",
"input",
"parameters",
".",
"All",
"parameters",
"are",
"optional",
".",
"Version",
"will",
"do",
"partial",
"matching",
"."
] | def get_files(self, platform=None, version=None, type=None):
""" Return the files that match the input parameters.
All parameters are optional. Version will do partial matching. """
results = []
if platform is None:
platforms = self._data.keys()
else:
platforms = [platform]
for... | [
"def",
"get_files",
"(",
"self",
",",
"platform",
"=",
"None",
",",
"version",
"=",
"None",
",",
"type",
"=",
"None",
")",
":",
"results",
"=",
"[",
"]",
"if",
"platform",
"is",
"None",
":",
"platforms",
"=",
"self",
".",
"_data",
".",
"keys",
"(",... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Source/ThirdParty/CEF3/pristine/cef_source/tools/cefbuilds/cef_json_builder.py#L408-L430 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/_extends/parse/standard_method.py | python | scalar_floordiv | (x, y) | return x.__floordiv__(y) | Implementation of `scalar_floordiv`. | Implementation of `scalar_floordiv`. | [
"Implementation",
"of",
"scalar_floordiv",
"."
] | def scalar_floordiv(x, y):
"""Implementation of `scalar_floordiv`."""
return x.__floordiv__(y) | [
"def",
"scalar_floordiv",
"(",
"x",
",",
"y",
")",
":",
"return",
"x",
".",
"__floordiv__",
"(",
"y",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/_extends/parse/standard_method.py#L1473-L1475 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/bitstring/bitstring.py | python | Bits._set | (self, pos) | Set bit at pos to 1. | Set bit at pos to 1. | [
"Set",
"bit",
"at",
"pos",
"to",
"1",
"."
] | def _set(self, pos):
"""Set bit at pos to 1."""
assert 0 <= pos < self.len
self._datastore.setbit(pos) | [
"def",
"_set",
"(",
"self",
",",
"pos",
")",
":",
"assert",
"0",
"<=",
"pos",
"<",
"self",
".",
"len",
"self",
".",
"_datastore",
".",
"setbit",
"(",
"pos",
")"
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/bitstring/bitstring.py#L2153-L2156 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/cpplint.py | python | NestingState.SeenOpenBrace | (self) | return (not self.stack) or self.stack[-1].seen_open_brace | Check if we have seen the opening brace for the innermost block.
Returns:
True if we have seen the opening brace, False if the innermost
block is still expecting an opening brace. | Check if we have seen the opening brace for the innermost block. | [
"Check",
"if",
"we",
"have",
"seen",
"the",
"opening",
"brace",
"for",
"the",
"innermost",
"block",
"."
] | def SeenOpenBrace(self):
"""Check if we have seen the opening brace for the innermost block.
Returns:
True if we have seen the opening brace, False if the innermost
block is still expecting an opening brace.
"""
return (not self.stack) or self.stack[-1].seen_open_brace | [
"def",
"SeenOpenBrace",
"(",
"self",
")",
":",
"return",
"(",
"not",
"self",
".",
"stack",
")",
"or",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
".",
"seen_open_brace"
] | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/cpplint.py#L2951-L2958 | |
fatih/subvim | 241b6d170597857105da219c9b7d36059e9f11fb | vim/base/YouCompleteMe/third_party/requests/requests/api.py | python | head | (url, **kwargs) | return request('head', url, **kwargs) | Sends a HEAD request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes. | Sends a HEAD request. Returns :class:`Response` object. | [
"Sends",
"a",
"HEAD",
"request",
".",
"Returns",
":",
"class",
":",
"Response",
"object",
"."
] | def head(url, **kwargs):
"""Sends a HEAD request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
"""
kwargs.setdefault('allow_redirects', False)
return request('head', url, **kwargs) | [
"def",
"head",
"(",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'allow_redirects'",
",",
"False",
")",
"return",
"request",
"(",
"'head'",
",",
"url",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/requests/requests/api.py#L69-L77 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/ensemble/_stacking.py | python | StackingClassifier.predict_proba | (self, X) | return self.final_estimator_.predict_proba(self.transform(X)) | Predict class probabilities for X using
`final_estimator_.predict_proba`.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vectors, where n_samples is the number of samples and
n_features is the number of features.
... | Predict class probabilities for X using
`final_estimator_.predict_proba`. | [
"Predict",
"class",
"probabilities",
"for",
"X",
"using",
"final_estimator_",
".",
"predict_proba",
"."
] | def predict_proba(self, X):
"""Predict class probabilities for X using
`final_estimator_.predict_proba`.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vectors, where n_samples is the number of samples and
... | [
"def",
"predict_proba",
"(",
"self",
",",
"X",
")",
":",
"check_is_fitted",
"(",
"self",
")",
"return",
"self",
".",
"final_estimator_",
".",
"predict_proba",
"(",
"self",
".",
"transform",
"(",
"X",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/ensemble/_stacking.py#L440-L457 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/receptive_field/python/util/receptive_field.py | python | ReceptiveField.compute_input_center_coordinates | (self, y, axis=None) | return -self.padding[axis] + y * self.stride[axis] + (
self.size[axis] - 1) / 2 | Computes the center of the receptive field that generated a feature.
Args:
y: An array of feature coordinates with shape `(..., d)`, where `d` is the
number of dimensions of the coordinates.
axis: The dimensions for which to compute the input center coordinates. If
`None` (the default),... | Computes the center of the receptive field that generated a feature. | [
"Computes",
"the",
"center",
"of",
"the",
"receptive",
"field",
"that",
"generated",
"a",
"feature",
"."
] | def compute_input_center_coordinates(self, y, axis=None):
"""Computes the center of the receptive field that generated a feature.
Args:
y: An array of feature coordinates with shape `(..., d)`, where `d` is the
number of dimensions of the coordinates.
axis: The dimensions for which to compu... | [
"def",
"compute_input_center_coordinates",
"(",
"self",
",",
"y",
",",
"axis",
"=",
"None",
")",
":",
"# Use all dimensions.",
"if",
"axis",
"is",
"None",
":",
"axis",
"=",
"range",
"(",
"self",
".",
"size",
".",
"size",
")",
"# Ensure axis is a list because t... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/receptive_field/python/util/receptive_field.py#L88-L117 | |
facebookresearch/habitat-sim | 63b6c71d9ca8adaefb140b198196f5d0ca1f1e34 | examples/fairmotion_interface.py | python | FairmotionInterface.next_pose | (self, repeat=False, step_size=None) | Set the model state from the next frame in the motion trajectory. `repeat` is
set to `True` when the user would like to repeat the last frame. | Set the model state from the next frame in the motion trajectory. `repeat` is
set to `True` when the user would like to repeat the last frame. | [
"Set",
"the",
"model",
"state",
"from",
"the",
"next",
"frame",
"in",
"the",
"motion",
"trajectory",
".",
"repeat",
"is",
"set",
"to",
"True",
"when",
"the",
"user",
"would",
"like",
"to",
"repeat",
"the",
"last",
"frame",
"."
] | def next_pose(self, repeat=False, step_size=None) -> None:
"""
Set the model state from the next frame in the motion trajectory. `repeat` is
set to `True` when the user would like to repeat the last frame.
"""
# precondition
if not all([self.model, self.motion, self.activ... | [
"def",
"next_pose",
"(",
"self",
",",
"repeat",
"=",
"False",
",",
"step_size",
"=",
"None",
")",
"->",
"None",
":",
"# precondition",
"if",
"not",
"all",
"(",
"[",
"self",
".",
"model",
",",
"self",
".",
"motion",
",",
"self",
".",
"activity",
"==",... | https://github.com/facebookresearch/habitat-sim/blob/63b6c71d9ca8adaefb140b198196f5d0ca1f1e34/examples/fairmotion_interface.py#L346-L378 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/cli_api/module.py | python | CephCommander.to_ceph_signature | (self) | return {
'prefix': f'mgr cli {self.func.__name__}',
'perm': API.perm.get(self.func)
} | Generate CephCommand signature (dict-like) | Generate CephCommand signature (dict-like) | [
"Generate",
"CephCommand",
"signature",
"(",
"dict",
"-",
"like",
")"
] | def to_ceph_signature(self) -> Dict[str, str]:
"""
Generate CephCommand signature (dict-like)
"""
return {
'prefix': f'mgr cli {self.func.__name__}',
'perm': API.perm.get(self.func)
} | [
"def",
"to_ceph_signature",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"return",
"{",
"'prefix'",
":",
"f'mgr cli {self.func.__name__}'",
",",
"'perm'",
":",
"API",
".",
"perm",
".",
"get",
"(",
"self",
".",
"func",
")",
"}"
] | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/cli_api/module.py#L31-L38 | |
Constellation/iv | 64c3a9c7c517063f29d90d449180ea8f6f4d946f | tools/cpplint.py | python | FileInfo.NoExtension | (self) | return '/'.join(self.Split()[0:2]) | File has no source file extension. | File has no source file extension. | [
"File",
"has",
"no",
"source",
"file",
"extension",
"."
] | def NoExtension(self):
"""File has no source file extension."""
return '/'.join(self.Split()[0:2]) | [
"def",
"NoExtension",
"(",
"self",
")",
":",
"return",
"'/'",
".",
"join",
"(",
"self",
".",
"Split",
"(",
")",
"[",
"0",
":",
"2",
"]",
")"
] | https://github.com/Constellation/iv/blob/64c3a9c7c517063f29d90d449180ea8f6f4d946f/tools/cpplint.py#L940-L942 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/arrays/datetimes.py | python | _validate_dt64_dtype | (dtype) | return dtype | Check that a dtype, if passed, represents either a numpy datetime64[ns]
dtype or a pandas DatetimeTZDtype.
Parameters
----------
dtype : object
Returns
-------
dtype : None, numpy.dtype, or DatetimeTZDtype
Raises
------
ValueError : invalid dtype
Notes
-----
Unlik... | Check that a dtype, if passed, represents either a numpy datetime64[ns]
dtype or a pandas DatetimeTZDtype. | [
"Check",
"that",
"a",
"dtype",
"if",
"passed",
"represents",
"either",
"a",
"numpy",
"datetime64",
"[",
"ns",
"]",
"dtype",
"or",
"a",
"pandas",
"DatetimeTZDtype",
"."
] | def _validate_dt64_dtype(dtype):
"""
Check that a dtype, if passed, represents either a numpy datetime64[ns]
dtype or a pandas DatetimeTZDtype.
Parameters
----------
dtype : object
Returns
-------
dtype : None, numpy.dtype, or DatetimeTZDtype
Raises
------
ValueError :... | [
"def",
"_validate_dt64_dtype",
"(",
"dtype",
")",
":",
"if",
"dtype",
"is",
"not",
"None",
":",
"dtype",
"=",
"pandas_dtype",
"(",
"dtype",
")",
"if",
"is_dtype_equal",
"(",
"dtype",
",",
"np",
".",
"dtype",
"(",
"\"M8\"",
")",
")",
":",
"# no precision,... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/arrays/datetimes.py#L1979-L2017 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/closure_linter/closure_linter/statetracker.py | python | DocComment.CompareParameters | (self, params) | return distance[source_len][target_len], edit_lists[source_len][target_len] | Computes the edit distance and list from the function params to the docs.
Uses the Levenshtein edit distance algorithm, with code modified from
http://en.wikibooks.org/wiki/Algorithm_implementation/Strings/Levenshtein_distance#Python
Args:
params: The parameter list for the function declaration.
... | Computes the edit distance and list from the function params to the docs. | [
"Computes",
"the",
"edit",
"distance",
"and",
"list",
"from",
"the",
"function",
"params",
"to",
"the",
"docs",
"."
] | def CompareParameters(self, params):
"""Computes the edit distance and list from the function params to the docs.
Uses the Levenshtein edit distance algorithm, with code modified from
http://en.wikibooks.org/wiki/Algorithm_implementation/Strings/Levenshtein_distance#Python
Args:
params: The para... | [
"def",
"CompareParameters",
"(",
"self",
",",
"params",
")",
":",
"source_len",
",",
"target_len",
"=",
"len",
"(",
"self",
".",
"ordered_params",
")",
",",
"len",
"(",
"params",
")",
"edit_lists",
"=",
"[",
"[",
"]",
"]",
"distance",
"=",
"[",
"[",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/closure_linter/closure_linter/statetracker.py#L507-L567 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/syntax/_issuelist.py | python | SyntaxData.GetSyntaxSpec | (self) | return SYNTAX_ITEMS | Syntax Specifications | Syntax Specifications | [
"Syntax",
"Specifications"
] | def GetSyntaxSpec(self):
"""Syntax Specifications """
return SYNTAX_ITEMS | [
"def",
"GetSyntaxSpec",
"(",
"self",
")",
":",
"return",
"SYNTAX_ITEMS"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/syntax/_issuelist.py#L74-L76 | |
mozilla/DeepSpeech | aa1d28530d531d0d92289bf5f11a49fe516fdc86 | training/deepspeech_training/util/sample_collections.py | python | CSV.__init__ | (self, csv_filename, labeled=None, reverse=False) | Parameters
----------
csv_filename : str
Path to the CSV file containing sample audio paths and transcripts
labeled : bool or None
If True: Reads LabeledSample instances. Fails, if CSV file has no transcript column.
If False: Ignores transcripts (if available)... | Parameters
----------
csv_filename : str
Path to the CSV file containing sample audio paths and transcripts
labeled : bool or None
If True: Reads LabeledSample instances. Fails, if CSV file has no transcript column.
If False: Ignores transcripts (if available)... | [
"Parameters",
"----------",
"csv_filename",
":",
"str",
"Path",
"to",
"the",
"CSV",
"file",
"containing",
"sample",
"audio",
"paths",
"and",
"transcripts",
"labeled",
":",
"bool",
"or",
"None",
"If",
"True",
":",
"Reads",
"LabeledSample",
"instances",
".",
"Fa... | def __init__(self, csv_filename, labeled=None, reverse=False):
"""
Parameters
----------
csv_filename : str
Path to the CSV file containing sample audio paths and transcripts
labeled : bool or None
If True: Reads LabeledSample instances. Fails, if CSV file... | [
"def",
"__init__",
"(",
"self",
",",
"csv_filename",
",",
"labeled",
"=",
"None",
",",
"reverse",
"=",
"False",
")",
":",
"rows",
"=",
"[",
"]",
"with",
"open_remote",
"(",
"csv_filename",
",",
"'r'",
",",
"encoding",
"=",
"'utf8'",
")",
"as",
"csv_fil... | https://github.com/mozilla/DeepSpeech/blob/aa1d28530d531d0d92289bf5f11a49fe516fdc86/training/deepspeech_training/util/sample_collections.py#L519-L554 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/botocore/model.py | python | Shape.metadata | (self) | return metadata | Metadata about the shape.
This requires optional information about the shape, including:
* min
* max
* enum
* sensitive
* required
* idempotencyToken
:rtype: dict
:return: Metadata about the shape. | Metadata about the shape. | [
"Metadata",
"about",
"the",
"shape",
"."
] | def metadata(self):
"""Metadata about the shape.
This requires optional information about the shape, including:
* min
* max
* enum
* sensitive
* required
* idempotencyToken
:rtype: dict
:return: Metadata about the... | [
"def",
"metadata",
"(",
"self",
")",
":",
"model",
"=",
"self",
".",
"_shape_model",
"metadata",
"=",
"{",
"}",
"for",
"attr",
"in",
"self",
".",
"METADATA_ATTRS",
":",
"if",
"attr",
"in",
"self",
".",
"_shape_model",
":",
"metadata",
"[",
"attr",
"]",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/botocore/model.py#L129-L150 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/ContainerIO.py | python | ContainerIO.readline | (self) | return s | Read a line of text.
:returns: An 8-bit string. | Read a line of text. | [
"Read",
"a",
"line",
"of",
"text",
"."
] | def readline(self):
"""
Read a line of text.
:returns: An 8-bit string.
"""
s = b"" if "b" in self.fh.mode else ""
newline_character = b"\n" if "b" in self.fh.mode else "\n"
while True:
c = self.read(1)
if not c:
break
... | [
"def",
"readline",
"(",
"self",
")",
":",
"s",
"=",
"b\"\"",
"if",
"\"b\"",
"in",
"self",
".",
"fh",
".",
"mode",
"else",
"\"\"",
"newline_character",
"=",
"b\"\\n\"",
"if",
"\"b\"",
"in",
"self",
".",
"fh",
".",
"mode",
"else",
"\"\\n\"",
"while",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/ContainerIO.py#L89-L104 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/package_index.py | python | PackageIndex.check_hash | (self, checker, filename, tfp) | checker is a ContentChecker | checker is a ContentChecker | [
"checker",
"is",
"a",
"ContentChecker"
] | def check_hash(self, checker, filename, tfp):
"""
checker is a ContentChecker
"""
checker.report(
self.debug,
"Validating %%s checksum for %s" % filename)
if not checker.is_valid():
tfp.close()
os.unlink(filename)
raise ... | [
"def",
"check_hash",
"(",
"self",
",",
"checker",
",",
"filename",
",",
"tfp",
")",
":",
"checker",
".",
"report",
"(",
"self",
".",
"debug",
",",
"\"Validating %%s checksum for %s\"",
"%",
"filename",
")",
"if",
"not",
"checker",
".",
"is_valid",
"(",
")"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/package_index.py#L513-L527 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/metrics/pairwise.py | python | haversine_distances | (X, Y=None) | return DistanceMetric.get_metric('haversine').pairwise(X, Y) | Compute the Haversine distance between samples in X and Y
The Haversine (or great circle) distance is the angular distance between
two points on the surface of a sphere. The first distance of each point is
assumed to be the latitude, the second is the longitude, given in radians.
The dimension of the d... | Compute the Haversine distance between samples in X and Y | [
"Compute",
"the",
"Haversine",
"distance",
"between",
"samples",
"in",
"X",
"and",
"Y"
] | def haversine_distances(X, Y=None):
"""Compute the Haversine distance between samples in X and Y
The Haversine (or great circle) distance is the angular distance between
two points on the surface of a sphere. The first distance of each point is
assumed to be the latitude, the second is the longitude, g... | [
"def",
"haversine_distances",
"(",
"X",
",",
"Y",
"=",
"None",
")",
":",
"from",
"sklearn",
".",
"neighbors",
"import",
"DistanceMetric",
"return",
"DistanceMetric",
".",
"get_metric",
"(",
"'haversine'",
")",
".",
"pairwise",
"(",
"X",
",",
"Y",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/metrics/pairwise.py#L666-L711 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/fractions.py | python | Fraction.__neg__ | (a) | return Fraction(-a._numerator, a._denominator) | -a | -a | [
"-",
"a"
] | def __neg__(a):
"""-a"""
return Fraction(-a._numerator, a._denominator) | [
"def",
"__neg__",
"(",
"a",
")",
":",
"return",
"Fraction",
"(",
"-",
"a",
".",
"_numerator",
",",
"a",
".",
"_denominator",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/fractions.py#L493-L495 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | ResetNolintSuppressions | () | Resets the set of NOLINT suppressions to empty. | Resets the set of NOLINT suppressions to empty. | [
"Resets",
"the",
"set",
"of",
"NOLINT",
"suppressions",
"to",
"empty",
"."
] | def ResetNolintSuppressions():
"Resets the set of NOLINT suppressions to empty."
_error_suppressions.clear() | [
"def",
"ResetNolintSuppressions",
"(",
")",
":",
"_error_suppressions",
".",
"clear",
"(",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L389-L391 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/meta/asttools/visitors/cond_symbol_visitor.py | python | conditional_symbols | (node) | return lhs, rhs, undefined | Group lhs and rhs into conditional, stable and undefined
:param node: ast node
:returns: tuple of (conditional_lhs, stable_lhs),(conditional_rhs, stable_rhs), undefined | Group lhs and rhs into conditional, stable and undefined
:param node: ast node | [
"Group",
"lhs",
"and",
"rhs",
"into",
"conditional",
"stable",
"and",
"undefined",
":",
"param",
"node",
":",
"ast",
"node"
] | def conditional_symbols(node):
"""
Group lhs and rhs into conditional, stable and undefined
:param node: ast node
:returns: tuple of (conditional_lhs, stable_lhs),(conditional_rhs, stable_rhs), undefined
"""
gen = ConditionalSymbolVisitor()
gen.visit(node)
lhs = gen.cond_lhs, gen.stab... | [
"def",
"conditional_symbols",
"(",
"node",
")",
":",
"gen",
"=",
"ConditionalSymbolVisitor",
"(",
")",
"gen",
".",
"visit",
"(",
"node",
")",
"lhs",
"=",
"gen",
".",
"cond_lhs",
",",
"gen",
".",
"stable_lhs",
"rhs",
"=",
"gen",
".",
"cond_rhs",
",",
"g... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/meta/asttools/visitors/cond_symbol_visitor.py#L413-L427 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/io/loader.py | python | readMatrix3 | (text) | return so3.matrix(readSo3(text)) | Reads a 3x3 matrix from a string | Reads a 3x3 matrix from a string | [
"Reads",
"a",
"3x3",
"matrix",
"from",
"a",
"string"
] | def readMatrix3(text):
"""Reads a 3x3 matrix from a string"""
return so3.matrix(readSo3(text)) | [
"def",
"readMatrix3",
"(",
"text",
")",
":",
"return",
"so3",
".",
"matrix",
"(",
"readSo3",
"(",
"text",
")",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/io/loader.py#L196-L198 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/framework/ops.py | python | register_dense_tensor_like_type | (tensor_type) | EXPERIMENTAL: Registers `tensor_type` as implementing the tensor interface.
A "tensor-like type" can represent a single dense tensor, and implements
the `name` and `dtype` properties.
Args:
tensor_type: A type implementing the tensor interface.
Raises:
TypeError: If `tensor_type` does not implement t... | EXPERIMENTAL: Registers `tensor_type` as implementing the tensor interface. | [
"EXPERIMENTAL",
":",
"Registers",
"tensor_type",
"as",
"implementing",
"the",
"tensor",
"interface",
"."
] | def register_dense_tensor_like_type(tensor_type):
"""EXPERIMENTAL: Registers `tensor_type` as implementing the tensor interface.
A "tensor-like type" can represent a single dense tensor, and implements
the `name` and `dtype` properties.
Args:
tensor_type: A type implementing the tensor interface.
Raise... | [
"def",
"register_dense_tensor_like_type",
"(",
"tensor_type",
")",
":",
"try",
":",
"if",
"not",
"isinstance",
"(",
"tensor_type",
".",
"name",
",",
"property",
")",
":",
"raise",
"TypeError",
"(",
"\"Type %s does not define a `name` property\"",
")",
"except",
"Att... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/framework/ops.py#L146-L172 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/fastparquet/api.py | python | ParquetFile.info | (self) | return {'name': self.fn, 'columns': self.columns,
'partitions': list(self.cats), 'rows': self.count} | Some metadata details | Some metadata details | [
"Some",
"metadata",
"details"
] | def info(self):
""" Some metadata details """
return {'name': self.fn, 'columns': self.columns,
'partitions': list(self.cats), 'rows': self.count} | [
"def",
"info",
"(",
"self",
")",
":",
"return",
"{",
"'name'",
":",
"self",
".",
"fn",
",",
"'columns'",
":",
"self",
".",
"columns",
",",
"'partitions'",
":",
"list",
"(",
"self",
".",
"cats",
")",
",",
"'rows'",
":",
"self",
".",
"count",
"}"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/fastparquet/api.py#L447-L450 | |
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | external/tools/build/v2/build/property_set.py | python | create | (raw_properties = []) | return __cache [key] | Creates a new 'PropertySet' instance for the given raw properties,
or returns an already existing one. | Creates a new 'PropertySet' instance for the given raw properties,
or returns an already existing one. | [
"Creates",
"a",
"new",
"PropertySet",
"instance",
"for",
"the",
"given",
"raw",
"properties",
"or",
"returns",
"an",
"already",
"existing",
"one",
"."
] | def create (raw_properties = []):
""" Creates a new 'PropertySet' instance for the given raw properties,
or returns an already existing one.
"""
# FIXME: propagate to callers.
if len(raw_properties) > 0 and isinstance(raw_properties[0], property.Property):
x = raw_properties
else: ... | [
"def",
"create",
"(",
"raw_properties",
"=",
"[",
"]",
")",
":",
"# FIXME: propagate to callers.",
"if",
"len",
"(",
"raw_properties",
")",
">",
"0",
"and",
"isinstance",
"(",
"raw_properties",
"[",
"0",
"]",
",",
"property",
".",
"Property",
")",
":",
"x"... | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/external/tools/build/v2/build/property_set.py#L32-L51 | |
llvm-mirror/lldb | d01083a850f577b85501a0902b52fd0930de72c7 | third_party/Python/module/pexpect-4.6/pexpect/screen.py | python | screen.set_tab | (self) | Sets a tab at the current position. | Sets a tab at the current position. | [
"Sets",
"a",
"tab",
"at",
"the",
"current",
"position",
"."
] | def set_tab (self): # <ESC>H
'''Sets a tab at the current position.'''
pass | [
"def",
"set_tab",
"(",
"self",
")",
":",
"# <ESC>H",
"pass"
] | https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/third_party/Python/module/pexpect-4.6/pexpect/screen.py#L412-L415 | ||
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py | python | PtyProcess.wait | (self) | return self.exitstatus | This waits until the child exits. This is a blocking call. This will
not read any data from the child, so this will block forever if the
child has unread output and has terminated. In other words, the child
may have printed output then called exit(), but, the child is
technically still a... | This waits until the child exits. This is a blocking call. This will
not read any data from the child, so this will block forever if the
child has unread output and has terminated. In other words, the child
may have printed output then called exit(), but, the child is
technically still a... | [
"This",
"waits",
"until",
"the",
"child",
"exits",
".",
"This",
"is",
"a",
"blocking",
"call",
".",
"This",
"will",
"not",
"read",
"any",
"data",
"from",
"the",
"child",
"so",
"this",
"will",
"block",
"forever",
"if",
"the",
"child",
"has",
"unread",
"... | def wait(self):
'''This waits until the child exits. This is a blocking call. This will
not read any data from the child, so this will block forever if the
child has unread output and has terminated. In other words, the child
may have printed output then called exit(), but, the child is
... | [
"def",
"wait",
"(",
"self",
")",
":",
"if",
"self",
".",
"isalive",
"(",
")",
":",
"pid",
",",
"status",
"=",
"os",
".",
"waitpid",
"(",
"self",
".",
"pid",
",",
"0",
")",
"else",
":",
"return",
"self",
".",
"exitstatus",
"self",
".",
"exitstatus... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py#L656-L683 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/bigtable/python/ops/bigtable_api.py | python | BigtableTable._make_parallel_scan_dataset | (self, ds, num_parallel_scans,
normalized_probability, normalized_columns) | return ds | Builds a parallel dataset from a given range.
Args:
ds: A `_BigtableSampleKeyPairsDataset` returning ranges of keys to use.
num_parallel_scans: The number of concurrent parallel scans to use.
normalized_probability: A number between 0 and 1 for the keep probability.
normalized_columns: The ... | Builds a parallel dataset from a given range. | [
"Builds",
"a",
"parallel",
"dataset",
"from",
"a",
"given",
"range",
"."
] | def _make_parallel_scan_dataset(self, ds, num_parallel_scans,
normalized_probability, normalized_columns):
"""Builds a parallel dataset from a given range.
Args:
ds: A `_BigtableSampleKeyPairsDataset` returning ranges of keys to use.
num_parallel_scans: The number ... | [
"def",
"_make_parallel_scan_dataset",
"(",
"self",
",",
"ds",
",",
"num_parallel_scans",
",",
"normalized_probability",
",",
"normalized_columns",
")",
":",
"if",
"num_parallel_scans",
"is",
"None",
":",
"num_parallel_scans",
"=",
"50",
"ds",
"=",
"ds",
".",
"shuf... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/bigtable/python/ops/bigtable_api.py#L495-L529 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/metrics_impl.py | python | _maybe_expand_labels | (labels, predictions) | If necessary, expand `labels` along last dimension to match `predictions`.
Args:
labels: `Tensor` or `SparseTensor` with shape
[D1, ... DN, num_labels] or [D1, ... DN]. The latter implies
num_labels=1, in which case the result is an expanded `labels` with shape
[D1, ... DN, 1].
predictions:... | If necessary, expand `labels` along last dimension to match `predictions`. | [
"If",
"necessary",
"expand",
"labels",
"along",
"last",
"dimension",
"to",
"match",
"predictions",
"."
] | def _maybe_expand_labels(labels, predictions):
"""If necessary, expand `labels` along last dimension to match `predictions`.
Args:
labels: `Tensor` or `SparseTensor` with shape
[D1, ... DN, num_labels] or [D1, ... DN]. The latter implies
num_labels=1, in which case the result is an expanded `labels... | [
"def",
"_maybe_expand_labels",
"(",
"labels",
",",
"predictions",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"None",
",",
"'expand_labels'",
",",
"(",
"labels",
",",
"predictions",
")",
")",
"as",
"scope",
":",
"labels",
"=",
"sparse_tensor",
".",
"c... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/metrics_impl.py#L123-L171 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/prefilter.py | python | PrefilterManager.register_transformer | (self, transformer) | Register a transformer instance. | Register a transformer instance. | [
"Register",
"a",
"transformer",
"instance",
"."
] | def register_transformer(self, transformer):
"""Register a transformer instance."""
if transformer not in self._transformers:
self._transformers.append(transformer)
self.sort_transformers() | [
"def",
"register_transformer",
"(",
"self",
",",
"transformer",
")",
":",
"if",
"transformer",
"not",
"in",
"self",
".",
"_transformers",
":",
"self",
".",
"_transformers",
".",
"append",
"(",
"transformer",
")",
"self",
".",
"sort_transformers",
"(",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/prefilter.py#L152-L156 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TStr.IsWord | (self, WsPrefixP=True, FirstUcAllowedP=True) | return _snap.TStr_IsWord(self, WsPrefixP, FirstUcAllowedP) | IsWord(TStr self, bool const & WsPrefixP=True, bool const & FirstUcAllowedP=True) -> bool
Parameters:
WsPrefixP: bool const &
FirstUcAllowedP: bool const &
IsWord(TStr self, bool const & WsPrefixP=True) -> bool
Parameters:
WsPrefixP: bool const &
I... | IsWord(TStr self, bool const & WsPrefixP=True, bool const & FirstUcAllowedP=True) -> bool | [
"IsWord",
"(",
"TStr",
"self",
"bool",
"const",
"&",
"WsPrefixP",
"=",
"True",
"bool",
"const",
"&",
"FirstUcAllowedP",
"=",
"True",
")",
"-",
">",
"bool"
] | def IsWord(self, WsPrefixP=True, FirstUcAllowedP=True):
"""
IsWord(TStr self, bool const & WsPrefixP=True, bool const & FirstUcAllowedP=True) -> bool
Parameters:
WsPrefixP: bool const &
FirstUcAllowedP: bool const &
IsWord(TStr self, bool const & WsPrefixP=True)... | [
"def",
"IsWord",
"(",
"self",
",",
"WsPrefixP",
"=",
"True",
",",
"FirstUcAllowedP",
"=",
"True",
")",
":",
"return",
"_snap",
".",
"TStr_IsWord",
"(",
"self",
",",
"WsPrefixP",
",",
"FirstUcAllowedP",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L10605-L10624 | |
tzutalin/dlib-android | 989627cb7fe81cd1d41d73434b0e91ce1dd2683f | tools/lint/cpplint.py | python | Search | (pattern, s) | return _regexp_compile_cache[pattern].search(s) | Searches the string for the pattern, caching the compiled regexp. | Searches the string for the pattern, caching the compiled regexp. | [
"Searches",
"the",
"string",
"for",
"the",
"pattern",
"caching",
"the",
"compiled",
"regexp",
"."
] | def Search(pattern, s):
"""Searches the string for the pattern, caching the compiled regexp."""
if pattern not in _regexp_compile_cache:
_regexp_compile_cache[pattern] = sre_compile.compile(pattern)
return _regexp_compile_cache[pattern].search(s) | [
"def",
"Search",
"(",
"pattern",
",",
"s",
")",
":",
"if",
"pattern",
"not",
"in",
"_regexp_compile_cache",
":",
"_regexp_compile_cache",
"[",
"pattern",
"]",
"=",
"sre_compile",
".",
"compile",
"(",
"pattern",
")",
"return",
"_regexp_compile_cache",
"[",
"pat... | https://github.com/tzutalin/dlib-android/blob/989627cb7fe81cd1d41d73434b0e91ce1dd2683f/tools/lint/cpplint.py#L632-L636 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/docview.py | python | Document.OnNewDocument | (self) | The default implementation calls OnSaveModified and DeleteContents,
makes a default title for the document, and notifies the views that
the filename (in fact, the title) has changed. | The default implementation calls OnSaveModified and DeleteContents,
makes a default title for the document, and notifies the views that
the filename (in fact, the title) has changed. | [
"The",
"default",
"implementation",
"calls",
"OnSaveModified",
"and",
"DeleteContents",
"makes",
"a",
"default",
"title",
"for",
"the",
"document",
"and",
"notifies",
"the",
"views",
"that",
"the",
"filename",
"(",
"in",
"fact",
"the",
"title",
")",
"has",
"ch... | def OnNewDocument(self):
"""
The default implementation calls OnSaveModified and DeleteContents,
makes a default title for the document, and notifies the views that
the filename (in fact, the title) has changed.
"""
if not self.OnSaveModified() or not self.OnCloseDocument... | [
"def",
"OnNewDocument",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"OnSaveModified",
"(",
")",
"or",
"not",
"self",
".",
"OnCloseDocument",
"(",
")",
":",
"return",
"False",
"self",
".",
"DeleteContents",
"(",
")",
"self",
".",
"Modify",
"(",
"Fa... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/docview.py#L355-L368 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | PyApp_GetMacExitMenuItemId | (*args) | return _core_.PyApp_GetMacExitMenuItemId(*args) | PyApp_GetMacExitMenuItemId() -> long | PyApp_GetMacExitMenuItemId() -> long | [
"PyApp_GetMacExitMenuItemId",
"()",
"-",
">",
"long"
] | def PyApp_GetMacExitMenuItemId(*args):
"""PyApp_GetMacExitMenuItemId() -> long"""
return _core_.PyApp_GetMacExitMenuItemId(*args) | [
"def",
"PyApp_GetMacExitMenuItemId",
"(",
"*",
"args",
")",
":",
"return",
"_core_",
".",
"PyApp_GetMacExitMenuItemId",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L8286-L8288 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pluggy/py2/pluggy/hooks.py | python | HookimplMarker.__call__ | (
self,
function=None,
hookwrapper=False,
optionalhook=False,
tryfirst=False,
trylast=False,
) | if passed a function, directly sets attributes on the function
which will make it discoverable to :py:meth:`.PluginManager.register`.
If passed no function, returns a decorator which can be applied to a
function later using the attributes supplied.
If ``optionalhook`` is ``True`` a miss... | if passed a function, directly sets attributes on the function
which will make it discoverable to :py:meth:`.PluginManager.register`.
If passed no function, returns a decorator which can be applied to a
function later using the attributes supplied. | [
"if",
"passed",
"a",
"function",
"directly",
"sets",
"attributes",
"on",
"the",
"function",
"which",
"will",
"make",
"it",
"discoverable",
"to",
":",
"py",
":",
"meth",
":",
".",
"PluginManager",
".",
"register",
".",
"If",
"passed",
"no",
"function",
"ret... | def __call__(
self,
function=None,
hookwrapper=False,
optionalhook=False,
tryfirst=False,
trylast=False,
):
""" if passed a function, directly sets attributes on the function
which will make it discoverable to :py:meth:`.PluginManager.register`.
... | [
"def",
"__call__",
"(",
"self",
",",
"function",
"=",
"None",
",",
"hookwrapper",
"=",
"False",
",",
"optionalhook",
"=",
"False",
",",
"tryfirst",
"=",
"False",
",",
"trylast",
"=",
"False",
",",
")",
":",
"def",
"setattr_hookimpl_opts",
"(",
"func",
")... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pluggy/py2/pluggy/hooks.py#L69-L117 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | samples/ide/activegrid/tool/CodeEditor.py | python | CodeView.GetAutoCompleteHint | (self) | return context, hint | Replace this method with Editor specific method | Replace this method with Editor specific method | [
"Replace",
"this",
"method",
"with",
"Editor",
"specific",
"method"
] | def GetAutoCompleteHint(self):
""" Replace this method with Editor specific method """
pos = self.GetCtrl().GetCurrentPos()
if pos == 0:
return None, None
if chr(self.GetCtrl().GetCharAt(pos - 1)) == '.':
pos = pos - 1
hint = None
else:
... | [
"def",
"GetAutoCompleteHint",
"(",
"self",
")",
":",
"pos",
"=",
"self",
".",
"GetCtrl",
"(",
")",
".",
"GetCurrentPos",
"(",
")",
"if",
"pos",
"==",
"0",
":",
"return",
"None",
",",
"None",
"if",
"chr",
"(",
"self",
".",
"GetCtrl",
"(",
")",
".",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/samples/ide/activegrid/tool/CodeEditor.py#L335-L364 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/urllib3/util/connection.py | python | allowed_gai_family | () | return family | This function is designed to work in the context of
getaddrinfo, where family=socket.AF_UNSPEC is the default and
will perform a DNS search for both IPv6 and IPv4 records. | This function is designed to work in the context of
getaddrinfo, where family=socket.AF_UNSPEC is the default and
will perform a DNS search for both IPv6 and IPv4 records. | [
"This",
"function",
"is",
"designed",
"to",
"work",
"in",
"the",
"context",
"of",
"getaddrinfo",
"where",
"family",
"=",
"socket",
".",
"AF_UNSPEC",
"is",
"the",
"default",
"and",
"will",
"perform",
"a",
"DNS",
"search",
"for",
"both",
"IPv6",
"and",
"IPv4... | def allowed_gai_family():
"""This function is designed to work in the context of
getaddrinfo, where family=socket.AF_UNSPEC is the default and
will perform a DNS search for both IPv6 and IPv4 records."""
family = socket.AF_INET
if HAS_IPV6:
family = socket.AF_UNSPEC
return family | [
"def",
"allowed_gai_family",
"(",
")",
":",
"family",
"=",
"socket",
".",
"AF_INET",
"if",
"HAS_IPV6",
":",
"family",
"=",
"socket",
".",
"AF_UNSPEC",
"return",
"family"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/urllib3/util/connection.py#L97-L105 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/idlelib/CallTips.py | python | get_arg_text | (ob) | return arg_text | Get a string describing the arguments for the given object,
only if it is callable. | Get a string describing the arguments for the given object,
only if it is callable. | [
"Get",
"a",
"string",
"describing",
"the",
"arguments",
"for",
"the",
"given",
"object",
"only",
"if",
"it",
"is",
"callable",
"."
] | def get_arg_text(ob):
"""Get a string describing the arguments for the given object,
only if it is callable."""
arg_text = ""
if ob is not None and hasattr(ob, '__call__'):
arg_offset = 0
if type(ob) in (types.ClassType, types.TypeType):
# Look for the highest __init__ in ... | [
"def",
"get_arg_text",
"(",
"ob",
")",
":",
"arg_text",
"=",
"\"\"",
"if",
"ob",
"is",
"not",
"None",
"and",
"hasattr",
"(",
"ob",
",",
"'__call__'",
")",
":",
"arg_offset",
"=",
"0",
"if",
"type",
"(",
"ob",
")",
"in",
"(",
"types",
".",
"ClassTyp... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/idlelib/CallTips.py#L133-L177 | |
lmb-freiburg/flownet2 | b92e198b56b0e52e1ba0a5a98dc0e39fa5ae70cc | scripts/cpp_lint.py | python | CheckBraces | (filename, clean_lines, linenum, error) | Looks for misplaced braces (e.g. at the end of line).
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Looks for misplaced braces (e.g. at the end of line). | [
"Looks",
"for",
"misplaced",
"braces",
"(",
"e",
".",
"g",
".",
"at",
"the",
"end",
"of",
"line",
")",
"."
] | def CheckBraces(filename, clean_lines, linenum, error):
"""Looks for misplaced braces (e.g. at the end of line).
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any er... | [
"def",
"CheckBraces",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# get rid of comments and strings",
"if",
"Match",
"(",
"r'\\s*{\\s*$'",
",",
"line",
")",
":",
... | https://github.com/lmb-freiburg/flownet2/blob/b92e198b56b0e52e1ba0a5a98dc0e39fa5ae70cc/scripts/cpp_lint.py#L3069-L3240 | ||
twtygqyy/caffe-augmentation | c76600d247e5132fa5bd89d87bb5df458341fa84 | python/caffe/draw.py | python | choose_color_by_layertype | (layertype) | return color | Define colors for nodes based on the layer type. | Define colors for nodes based on the layer type. | [
"Define",
"colors",
"for",
"nodes",
"based",
"on",
"the",
"layer",
"type",
"."
] | def choose_color_by_layertype(layertype):
"""Define colors for nodes based on the layer type.
"""
color = '#6495ED' # Default
if layertype == 'Convolution' or layertype == 'Deconvolution':
color = '#FF5050'
elif layertype == 'Pooling':
color = '#FF9900'
elif layertype == 'InnerP... | [
"def",
"choose_color_by_layertype",
"(",
"layertype",
")",
":",
"color",
"=",
"'#6495ED'",
"# Default",
"if",
"layertype",
"==",
"'Convolution'",
"or",
"layertype",
"==",
"'Deconvolution'",
":",
"color",
"=",
"'#FF5050'",
"elif",
"layertype",
"==",
"'Pooling'",
":... | https://github.com/twtygqyy/caffe-augmentation/blob/c76600d247e5132fa5bd89d87bb5df458341fa84/python/caffe/draw.py#L117-L127 | |
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/SCons/Tool/MSCommon/vs.py | python | query_versions | () | return versions | Query the system to get available versions of VS. A version is
considered when a batfile is found. | Query the system to get available versions of VS. A version is
considered when a batfile is found. | [
"Query",
"the",
"system",
"to",
"get",
"available",
"versions",
"of",
"VS",
".",
"A",
"version",
"is",
"considered",
"when",
"a",
"batfile",
"is",
"found",
"."
] | def query_versions():
"""Query the system to get available versions of VS. A version is
considered when a batfile is found."""
msvs_list = get_installed_visual_studios()
versions = [msvs.version for msvs in msvs_list]
return versions | [
"def",
"query_versions",
"(",
")",
":",
"msvs_list",
"=",
"get_installed_visual_studios",
"(",
")",
"versions",
"=",
"[",
"msvs",
".",
"version",
"for",
"msvs",
"in",
"msvs_list",
"]",
"return",
"versions"
] | https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Tool/MSCommon/vs.py#L562-L567 | |
francinexue/xuefu | b6ff79747a42e020588c0c0a921048e08fe4680c | api/ctpx/ctptd.py | python | CtpTd.onRspQrySettlementInfo | (self, SettlementInfoField, RspInfoField, requestId, final) | 请求查询投资者结算结果响应 | 请求查询投资者结算结果响应 | [
"请求查询投资者结算结果响应"
] | def onRspQrySettlementInfo(self, SettlementInfoField, RspInfoField, requestId, final):
"""请求查询投资者结算结果响应"""
pass | [
"def",
"onRspQrySettlementInfo",
"(",
"self",
",",
"SettlementInfoField",
",",
"RspInfoField",
",",
"requestId",
",",
"final",
")",
":",
"pass"
] | https://github.com/francinexue/xuefu/blob/b6ff79747a42e020588c0c0a921048e08fe4680c/api/ctpx/ctptd.py#L241-L243 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/control_flow_ops.py | python | WhileContext.loop_exits | (self) | return self._loop_exits | The list of exit tensors for loop variables. | The list of exit tensors for loop variables. | [
"The",
"list",
"of",
"exit",
"tensors",
"for",
"loop",
"variables",
"."
] | def loop_exits(self):
"""The list of exit tensors for loop variables."""
return self._loop_exits | [
"def",
"loop_exits",
"(",
"self",
")",
":",
"return",
"self",
".",
"_loop_exits"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/control_flow_ops.py#L1862-L1864 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/boto3/resources/collection.py | python | ResourceCollection.limit | (self, count) | return self._clone(limit=count) | Return at most this many resources.
>>> for bucket in s3.buckets.limit(5):
... print(bucket.name)
'bucket1'
'bucket2'
'bucket3'
'bucket4'
'bucket5'
:type count: int
:param count: Return no more than this many items... | Return at most this many resources. | [
"Return",
"at",
"most",
"this",
"many",
"resources",
"."
] | def limit(self, count):
"""
Return at most this many resources.
>>> for bucket in s3.buckets.limit(5):
... print(bucket.name)
'bucket1'
'bucket2'
'bucket3'
'bucket4'
'bucket5'
:type count: int
:para... | [
"def",
"limit",
"(",
"self",
",",
"count",
")",
":",
"return",
"self",
".",
"_clone",
"(",
"limit",
"=",
"count",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/boto3/resources/collection.py#L228-L244 | |
metashell/metashell | f4177e4854ea00c8dbc722cadab26ef413d798ea | 3rd/templight/compiler-rt/lib/asan/scripts/asan_symbolize.py | python | AsanSymbolizerPlugInProxy.has_plugin | (self, name) | return name in self._plugin_names | Returns true iff the plugin name is currently
being managed by AsanSymbolizerPlugInProxy. | Returns true iff the plugin name is currently
being managed by AsanSymbolizerPlugInProxy. | [
"Returns",
"true",
"iff",
"the",
"plugin",
"name",
"is",
"currently",
"being",
"managed",
"by",
"AsanSymbolizerPlugInProxy",
"."
] | def has_plugin(self, name):
"""
Returns true iff the plugin name is currently
being managed by AsanSymbolizerPlugInProxy.
"""
return name in self._plugin_names | [
"def",
"has_plugin",
"(",
"self",
",",
"name",
")",
":",
"return",
"name",
"in",
"self",
".",
"_plugin_names"
] | https://github.com/metashell/metashell/blob/f4177e4854ea00c8dbc722cadab26ef413d798ea/3rd/templight/compiler-rt/lib/asan/scripts/asan_symbolize.py#L583-L588 | |
yrnkrn/zapcc | c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50 | tools/clang/bindings/python/clang/cindex.py | python | Type.get_pointee | (self) | return conf.lib.clang_getPointeeType(self) | For pointer types, returns the type of the pointee. | For pointer types, returns the type of the pointee. | [
"For",
"pointer",
"types",
"returns",
"the",
"type",
"of",
"the",
"pointee",
"."
] | def get_pointee(self):
"""
For pointer types, returns the type of the pointee.
"""
return conf.lib.clang_getPointeeType(self) | [
"def",
"get_pointee",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getPointeeType",
"(",
"self",
")"
] | https://github.com/yrnkrn/zapcc/blob/c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50/tools/clang/bindings/python/clang/cindex.py#L2303-L2307 | |
Samsung/veles | 95ed733c2e49bc011ad98ccf2416ecec23fbf352 | veles/external/freetype/__init__.py | python | Face.select_size | (self, strike_index) | Select a bitmap strike.
:param strike_index: The index of the bitmap strike in the
'available_sizes' field of Face object. | Select a bitmap strike. | [
"Select",
"a",
"bitmap",
"strike",
"."
] | def select_size(self, strike_index):
'''
Select a bitmap strike.
:param strike_index: The index of the bitmap strike in the
'available_sizes' field of Face object.
'''
error = FT_Select_Size(self._FT_Face, strike_index)
if error: raise FT_Exc... | [
"def",
"select_size",
"(",
"self",
",",
"strike_index",
")",
":",
"error",
"=",
"FT_Select_Size",
"(",
"self",
".",
"_FT_Face",
",",
"strike_index",
")",
"if",
"error",
":",
"raise",
"FT_Exception",
"(",
"error",
")"
] | https://github.com/Samsung/veles/blob/95ed733c2e49bc011ad98ccf2416ecec23fbf352/veles/external/freetype/__init__.py#L1246-L1254 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/burn_in_tags.py | python | main | (expansion_file: str, verbose: bool) | Run new or changed tests in repeated mode to validate their stability.
burn_in_tags detects jstests that are new or changed since the last git command and then
runs those tests in a loop to validate their reliability.
\f
:param expansion_file: The expansion file containing the configuration params. | Run new or changed tests in repeated mode to validate their stability. | [
"Run",
"new",
"or",
"changed",
"tests",
"in",
"repeated",
"mode",
"to",
"validate",
"their",
"stability",
"."
] | def main(expansion_file: str, verbose: bool):
"""
Run new or changed tests in repeated mode to validate their stability.
burn_in_tags detects jstests that are new or changed since the last git command and then
runs those tests in a loop to validate their reliability.
\f
:param expansion_file: ... | [
"def",
"main",
"(",
"expansion_file",
":",
"str",
",",
"verbose",
":",
"bool",
")",
":",
"_configure_logging",
"(",
"verbose",
")",
"evg_api",
"=",
"RetryingEvergreenApi",
".",
"get_api",
"(",
"config_file",
"=",
"EVG_CONFIG_FILE",
")",
"repos",
"=",
"[",
"R... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/burn_in_tags.py#L207-L223 | ||
facebookincubator/BOLT | 88c70afe9d388ad430cc150cc158641701397f70 | lldb/packages/Python/lldbsuite/support/seven.py | python | bitcast_to_bytes | (s) | return s if six.PY2 else s.encode("latin1") | Take a string and return a string(PY2) or a bytes(PY3) object. The returned
object contains the exact same bytes as the input string. (latin1 <->
unicode transformation is an identity operation for the first 256 code
points). | Take a string and return a string(PY2) or a bytes(PY3) object. The returned
object contains the exact same bytes as the input string. (latin1 <->
unicode transformation is an identity operation for the first 256 code
points). | [
"Take",
"a",
"string",
"and",
"return",
"a",
"string",
"(",
"PY2",
")",
"or",
"a",
"bytes",
"(",
"PY3",
")",
"object",
".",
"The",
"returned",
"object",
"contains",
"the",
"exact",
"same",
"bytes",
"as",
"the",
"input",
"string",
".",
"(",
"latin1",
... | def bitcast_to_bytes(s):
"""
Take a string and return a string(PY2) or a bytes(PY3) object. The returned
object contains the exact same bytes as the input string. (latin1 <->
unicode transformation is an identity operation for the first 256 code
points).
"""
return s if six.PY2 else s.encode... | [
"def",
"bitcast_to_bytes",
"(",
"s",
")",
":",
"return",
"s",
"if",
"six",
".",
"PY2",
"else",
"s",
".",
"encode",
"(",
"\"latin1\"",
")"
] | https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/lldb/packages/Python/lldbsuite/support/seven.py#L37-L44 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/ftplib.py | python | FTP.login | (self, user = '', passwd = '', acct = '') | return resp | Login, default anonymous. | Login, default anonymous. | [
"Login",
"default",
"anonymous",
"."
] | def login(self, user = '', passwd = '', acct = ''):
'''Login, default anonymous.'''
if not user: user = 'anonymous'
if not passwd: passwd = ''
if not acct: acct = ''
if user == 'anonymous' and passwd in ('', '-'):
# If there is no anonymous ftp password specified
... | [
"def",
"login",
"(",
"self",
",",
"user",
"=",
"''",
",",
"passwd",
"=",
"''",
",",
"acct",
"=",
"''",
")",
":",
"if",
"not",
"user",
":",
"user",
"=",
"'anonymous'",
"if",
"not",
"passwd",
":",
"passwd",
"=",
"''",
"if",
"not",
"acct",
":",
"a... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/ftplib.py#L358-L377 | |
learnforpractice/pyeos | 4f04eb982c86c1fdb413084af77c713a6fda3070 | libraries/vm/vm_cpython_ss/lib/abc.py | python | get_cache_token | () | return ABCMeta._abc_invalidation_counter | Returns the current ABC cache token.
The token is an opaque object (supporting equality testing) identifying the
current version of the ABC cache for virtual subclasses. The token changes
with every call to ``register()`` on any ABC. | Returns the current ABC cache token. | [
"Returns",
"the",
"current",
"ABC",
"cache",
"token",
"."
] | def get_cache_token():
"""Returns the current ABC cache token.
The token is an opaque object (supporting equality testing) identifying the
current version of the ABC cache for virtual subclasses. The token changes
with every call to ``register()`` on any ABC.
"""
return ABCMeta._abc_invalidatio... | [
"def",
"get_cache_token",
"(",
")",
":",
"return",
"ABCMeta",
".",
"_abc_invalidation_counter"
] | https://github.com/learnforpractice/pyeos/blob/4f04eb982c86c1fdb413084af77c713a6fda3070/libraries/vm/vm_cpython_ss/lib/abc.py#L241-L248 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/benchmark.py | python | Benchmark.SetupBenchmarkDefaultTraceRerunOptions | (self, tbm_options) | Setup tracing categories associated with default trace option. | Setup tracing categories associated with default trace option. | [
"Setup",
"tracing",
"categories",
"associated",
"with",
"default",
"trace",
"option",
"."
] | def SetupBenchmarkDefaultTraceRerunOptions(self, tbm_options):
"""Setup tracing categories associated with default trace option.""" | [
"def",
"SetupBenchmarkDefaultTraceRerunOptions",
"(",
"self",
",",
"tbm_options",
")",
":"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/benchmark.py#L165-L166 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/debug/debug_data.py | python | DebugTensorDatum.__init__ | (self, dump_root, debug_dump_rel_path) | DebugTensorDatum constructor.
Args:
dump_root: Debug dump root directory.
debug_dump_rel_path: Path to a debug dump file, relative to the debug
dump root directory. For example, suppose the debug dump root
directory is "/tmp/tfdbg_1" and the dump file is at
"/tmp/tfdbg_1/n... | DebugTensorDatum constructor. | [
"DebugTensorDatum",
"constructor",
"."
] | def __init__(self, dump_root, debug_dump_rel_path):
"""DebugTensorDatum constructor.
Args:
dump_root: Debug dump root directory.
debug_dump_rel_path: Path to a debug dump file, relative to the debug
dump root directory. For example, suppose the debug dump root
directory is "/tmp... | [
"def",
"__init__",
"(",
"self",
",",
"dump_root",
",",
"debug_dump_rel_path",
")",
":",
"base",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"debug_dump_rel_path",
")",
"# TODO(cais): Add hostname and pid to support dumps from distributed",
"# sessions.",
"se... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/debug/debug_data.py#L220-L248 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/io_ops.py | python | FixedLengthRecordReader.__init__ | (self, record_bytes, header_bytes=None, footer_bytes=None,
name=None) | Create a FixedLengthRecordReader.
Args:
record_bytes: An int.
header_bytes: An optional int. Defaults to 0.
footer_bytes: An optional int. Defaults to 0.
name: A name for the operation (optional). | Create a FixedLengthRecordReader. | [
"Create",
"a",
"FixedLengthRecordReader",
"."
] | def __init__(self, record_bytes, header_bytes=None, footer_bytes=None,
name=None):
"""Create a FixedLengthRecordReader.
Args:
record_bytes: An int.
header_bytes: An optional int. Defaults to 0.
footer_bytes: An optional int. Defaults to 0.
name: A name for the operation (... | [
"def",
"__init__",
"(",
"self",
",",
"record_bytes",
",",
"header_bytes",
"=",
"None",
",",
"footer_bytes",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"rr",
"=",
"gen_io_ops",
".",
"_fixed_length_record_reader",
"(",
"record_bytes",
"=",
"record_bytes",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/io_ops.py#L501-L514 | ||
wyrover/book-code | 7f4883d9030d553bc6bcfa3da685e34789839900 | 3rdparty/protobuf/python/google/protobuf/text_format.py | python | _Parser.ParseLines | (self, lines, message) | return message | Parses a text representation of a protocol message into a message. | Parses a text representation of a protocol message into a message. | [
"Parses",
"a",
"text",
"representation",
"of",
"a",
"protocol",
"message",
"into",
"a",
"message",
"."
] | def ParseLines(self, lines, message):
"""Parses a text representation of a protocol message into a message."""
self._allow_multiple_scalars = False
self._ParseOrMerge(lines, message)
return message | [
"def",
"ParseLines",
"(",
"self",
",",
"lines",
",",
"message",
")",
":",
"self",
".",
"_allow_multiple_scalars",
"=",
"False",
"self",
".",
"_ParseOrMerge",
"(",
"lines",
",",
"message",
")",
"return",
"message"
] | https://github.com/wyrover/book-code/blob/7f4883d9030d553bc6bcfa3da685e34789839900/3rdparty/protobuf/python/google/protobuf/text_format.py#L547-L551 | |
jiangxiluning/FOTS.PyTorch | b1851c170b4f1ad18406766352cb5171648ce603 | FOTS/utils/eval_tools/icdar2015/rrc_evaluation_funcs.py | python | decode_utf8 | (raw) | Returns a Unicode object on success, or None on failure | Returns a Unicode object on success, or None on failure | [
"Returns",
"a",
"Unicode",
"object",
"on",
"success",
"or",
"None",
"on",
"failure"
] | def decode_utf8(raw):
"""
Returns a Unicode object on success, or None on failure
"""
try:
raw = codecs.decode(raw,'utf-8', 'replace')
#extracts BOM if exists
raw = raw.encode('utf8')
if raw.startswith(codecs.BOM_UTF8):
raw = raw.replace(codecs.BOM_UTF8, '', 1... | [
"def",
"decode_utf8",
"(",
"raw",
")",
":",
"try",
":",
"raw",
"=",
"codecs",
".",
"decode",
"(",
"raw",
",",
"'utf-8'",
",",
"'replace'",
")",
"#extracts BOM if exists",
"raw",
"=",
"raw",
".",
"encode",
"(",
"'utf8'",
")",
"if",
"raw",
".",
"startswi... | https://github.com/jiangxiluning/FOTS.PyTorch/blob/b1851c170b4f1ad18406766352cb5171648ce603/FOTS/utils/eval_tools/icdar2015/rrc_evaluation_funcs.py#L78-L90 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/input_lib.py | python | _IterableInput.reduce | (self, initial_state, reduce_fn) | return final_state | Execute a `reduce_fn` over all the elements of the input. | Execute a `reduce_fn` over all the elements of the input. | [
"Execute",
"a",
"reduce_fn",
"over",
"all",
"the",
"elements",
"of",
"the",
"input",
"."
] | def reduce(self, initial_state, reduce_fn):
"""Execute a `reduce_fn` over all the elements of the input."""
iterator = iter(self)
optional_data = iterator.get_next_as_optional()
def cond(optional_data, state):
del state # Unused.
return optional_data.has_value()
def loop_body(optional... | [
"def",
"reduce",
"(",
"self",
",",
"initial_state",
",",
"reduce_fn",
")",
":",
"iterator",
"=",
"iter",
"(",
"self",
")",
"optional_data",
"=",
"iterator",
".",
"get_next_as_optional",
"(",
")",
"def",
"cond",
"(",
"optional_data",
",",
"state",
")",
":",... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/input_lib.py#L869-L889 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py2/google/protobuf/text_format.py | python | ParseFloat | (text) | Parse a floating point number.
Args:
text: Text to parse.
Returns:
The number parsed.
Raises:
ValueError: If a floating point number couldn't be parsed. | Parse a floating point number. | [
"Parse",
"a",
"floating",
"point",
"number",
"."
] | def ParseFloat(text):
"""Parse a floating point number.
Args:
text: Text to parse.
Returns:
The number parsed.
Raises:
ValueError: If a floating point number couldn't be parsed.
"""
try:
# Assume Python compatible syntax.
return float(text)
except ValueError:
# Check alternative... | [
"def",
"ParseFloat",
"(",
"text",
")",
":",
"try",
":",
"# Assume Python compatible syntax.",
"return",
"float",
"(",
"text",
")",
"except",
"ValueError",
":",
"# Check alternative spellings.",
"if",
"_FLOAT_INFINITY",
".",
"match",
"(",
"text",
")",
":",
"if",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py2/google/protobuf/text_format.py#L1738-L1767 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | DataObjectComposite.GetObject | (*args, **kwargs) | return _misc_.DataObjectComposite_GetObject(*args, **kwargs) | GetObject(self, DataFormat format, wxDataObjectBase::Direction dir=Get) -> DataObjectSimple
Returns the pointer to the object which supports this format or None.
TODO: Fix this to use OOR and return the right object type. | GetObject(self, DataFormat format, wxDataObjectBase::Direction dir=Get) -> DataObjectSimple | [
"GetObject",
"(",
"self",
"DataFormat",
"format",
"wxDataObjectBase",
"::",
"Direction",
"dir",
"=",
"Get",
")",
"-",
">",
"DataObjectSimple"
] | def GetObject(*args, **kwargs):
"""
GetObject(self, DataFormat format, wxDataObjectBase::Direction dir=Get) -> DataObjectSimple
Returns the pointer to the object which supports this format or None.
TODO: Fix this to use OOR and return the right object type.
"""
return _m... | [
"def",
"GetObject",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DataObjectComposite_GetObject",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L5154-L5161 | |
ZhouWeikuan/DouDiZhu | 0d84ff6c0bc54dba6ae37955de9ae9307513dc99 | code/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py | python | CursorKind.is_attribute | (self) | return conf.lib.clang_isAttribute(self) | Test if this is an attribute kind. | Test if this is an attribute kind. | [
"Test",
"if",
"this",
"is",
"an",
"attribute",
"kind",
"."
] | def is_attribute(self):
"""Test if this is an attribute kind."""
return conf.lib.clang_isAttribute(self) | [
"def",
"is_attribute",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_isAttribute",
"(",
"self",
")"
] | https://github.com/ZhouWeikuan/DouDiZhu/blob/0d84ff6c0bc54dba6ae37955de9ae9307513dc99/code/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py#L648-L650 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Path/PathScripts/PathSanity.py | python | CommandPathSanity.__toolData | (self, obj) | return data | Returns information about the tools used in the job, and associated
toolcontrollers
Returns information about issues and problems with the tools (squawks) | Returns information about the tools used in the job, and associated
toolcontrollers
Returns information about issues and problems with the tools (squawks) | [
"Returns",
"information",
"about",
"the",
"tools",
"used",
"in",
"the",
"job",
"and",
"associated",
"toolcontrollers",
"Returns",
"information",
"about",
"issues",
"and",
"problems",
"with",
"the",
"tools",
"(",
"squawks",
")"
] | def __toolData(self, obj):
"""
Returns information about the tools used in the job, and associated
toolcontrollers
Returns information about issues and problems with the tools (squawks)
"""
data = {}
try:
for TC in obj.Tools.Group:
if ... | [
"def",
"__toolData",
"(",
"self",
",",
"obj",
")",
":",
"data",
"=",
"{",
"}",
"try",
":",
"for",
"TC",
"in",
"obj",
".",
"Tools",
".",
"Group",
":",
"if",
"not",
"hasattr",
"(",
"TC",
".",
"Tool",
",",
"\"BitBody\"",
")",
":",
"self",
".",
"sq... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Path/PathScripts/PathSanity.py#L568-L653 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/jsonschema/_format.py | python | FormatChecker.check | (self, instance, format) | Check whether the instance conforms to the given format.
Arguments:
instance (*any primitive type*, i.e. str, number, bool):
The instance to check
format (str):
The format that instance should conform to
Raises:
FormatError: if ... | Check whether the instance conforms to the given format. | [
"Check",
"whether",
"the",
"instance",
"conforms",
"to",
"the",
"given",
"format",
"."
] | def check(self, instance, format):
"""
Check whether the instance conforms to the given format.
Arguments:
instance (*any primitive type*, i.e. str, number, bool):
The instance to check
format (str):
The format that instance should con... | [
"def",
"check",
"(",
"self",
",",
"instance",
",",
"format",
")",
":",
"if",
"format",
"not",
"in",
"self",
".",
"checkers",
":",
"return",
"func",
",",
"raises",
"=",
"self",
".",
"checkers",
"[",
"format",
"]",
"result",
",",
"cause",
"=",
"None",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/jsonschema/_format.py#L71-L103 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/sparse_grad.py | python | _SparseFillEmptyRowsGrad | (op, unused_grad_output_indices, output_grad_values,
unused_grad_empty_row_indicator,
unused_grad_reverse_index_map) | return [None, d_values, None, d_default_value] | Gradients for SparseFillEmptyRows. | Gradients for SparseFillEmptyRows. | [
"Gradients",
"for",
"SparseFillEmptyRows",
"."
] | def _SparseFillEmptyRowsGrad(op, unused_grad_output_indices, output_grad_values,
unused_grad_empty_row_indicator,
unused_grad_reverse_index_map):
"""Gradients for SparseFillEmptyRows."""
reverse_index_map = op.outputs[3]
# pylint: disable=protected-access... | [
"def",
"_SparseFillEmptyRowsGrad",
"(",
"op",
",",
"unused_grad_output_indices",
",",
"output_grad_values",
",",
"unused_grad_empty_row_indicator",
",",
"unused_grad_reverse_index_map",
")",
":",
"reverse_index_map",
"=",
"op",
".",
"outputs",
"[",
"3",
"]",
"# pylint: di... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/sparse_grad.py#L275-L286 | |
apache/madlib | be297fe6beada0640f93317e8948834032718e32 | src/madpack/upgrade_util.py | python | ChangeHandler._get_current_version | (self) | Get current version of MADlib
This currently assumes that version is available in
'$MADLIB_HOME/src/config/Version.yml' | Get current version of MADlib | [
"Get",
"current",
"version",
"of",
"MADlib"
] | def _get_current_version(self):
""" Get current version of MADlib
This currently assumes that version is available in
'$MADLIB_HOME/src/config/Version.yml'
"""
version_filepath = os.path.abspath(
os.path.join(self._maddir, 'config', 'Version.yml'))
with open(... | [
"def",
"_get_current_version",
"(",
"self",
")",
":",
"version_filepath",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_maddir",
",",
"'config'",
",",
"'Version.yml'",
")",
")",
"with",
"open",
"(",
"v... | https://github.com/apache/madlib/blob/be297fe6beada0640f93317e8948834032718e32/src/madpack/upgrade_util.py#L147-L157 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/converters/onnx/_operators_nd.py | python | _convert_mean | (builder, node, graph, err) | convert to CoreML Add Broadcastable Layer and Divide BroadCastable Layer:
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L4117 | convert to CoreML Add Broadcastable Layer and Divide BroadCastable Layer:
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L4117 | [
"convert",
"to",
"CoreML",
"Add",
"Broadcastable",
"Layer",
"and",
"Divide",
"BroadCastable",
"Layer",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"apple",
"/",
"coremltools",
"/",
"blob",
"/",
"655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492",
"/",
"mlmodel",
... | def _convert_mean(builder, node, graph, err):
"""
convert to CoreML Add Broadcastable Layer and Divide BroadCastable Layer:
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L4117
"""
number_of_inputs = len(node.inputs)
output_n... | [
"def",
"_convert_mean",
"(",
"builder",
",",
"node",
",",
"graph",
",",
"err",
")",
":",
"number_of_inputs",
"=",
"len",
"(",
"node",
".",
"inputs",
")",
"output_name",
"=",
"node",
".",
"outputs",
"[",
"0",
"]",
"node",
".",
"outputs",
"[",
"0",
"]"... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/converters/onnx/_operators_nd.py#L1671-L1691 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/front/onnx/loader.py | python | add_initializers_and_inputs_to_graph | (graph: Graph, graph_pb, data_nodes_map: dict) | return parameters | The function adds nodes specified in the 'initializer' attribute of the pb and input nodes.
:param graph: the Graph to add nodes to
:param graph_pb: the graph protobuf message
:param data_nodes_map: the dictionary with mapping of tensor names to node id and port
:return: the list of Parameter nodes | The function adds nodes specified in the 'initializer' attribute of the pb and input nodes.
:param graph: the Graph to add nodes to
:param graph_pb: the graph protobuf message
:param data_nodes_map: the dictionary with mapping of tensor names to node id and port
:return: the list of Parameter nodes | [
"The",
"function",
"adds",
"nodes",
"specified",
"in",
"the",
"initializer",
"attribute",
"of",
"the",
"pb",
"and",
"input",
"nodes",
".",
":",
"param",
"graph",
":",
"the",
"Graph",
"to",
"add",
"nodes",
"to",
":",
"param",
"graph_pb",
":",
"the",
"grap... | def add_initializers_and_inputs_to_graph(graph: Graph, graph_pb, data_nodes_map: dict):
"""
The function adds nodes specified in the 'initializer' attribute of the pb and input nodes.
:param graph: the Graph to add nodes to
:param graph_pb: the graph protobuf message
:param data_nodes_map: the dicti... | [
"def",
"add_initializers_and_inputs_to_graph",
"(",
"graph",
":",
"Graph",
",",
"graph_pb",
",",
"data_nodes_map",
":",
"dict",
")",
":",
"initializers",
"=",
"Graph",
"(",
")",
"fill_graph_with_nodes",
"(",
"initializers",
",",
"graph_pb",
".",
"initializer",
","... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/front/onnx/loader.py#L137-L170 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | ImageList.GetBitmap | (*args, **kwargs) | return _gdi_.ImageList_GetBitmap(*args, **kwargs) | GetBitmap(self, int index) -> Bitmap | GetBitmap(self, int index) -> Bitmap | [
"GetBitmap",
"(",
"self",
"int",
"index",
")",
"-",
">",
"Bitmap"
] | def GetBitmap(*args, **kwargs):
"""GetBitmap(self, int index) -> Bitmap"""
return _gdi_.ImageList_GetBitmap(*args, **kwargs) | [
"def",
"GetBitmap",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"ImageList_GetBitmap",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L6931-L6933 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/msvs_emulation.py | python | _AddPrefix | (element, prefix) | Add |prefix| to |element| or each subelement if element is iterable. | Add |prefix| to |element| or each subelement if element is iterable. | [
"Add",
"|prefix|",
"to",
"|element|",
"or",
"each",
"subelement",
"if",
"element",
"is",
"iterable",
"."
] | def _AddPrefix(element, prefix):
"""Add |prefix| to |element| or each subelement if element is iterable."""
if element is None:
return element
if isinstance(element, Iterable) and not isinstance(element, basestring):
return [prefix + e for e in element]
else:
return prefix + element | [
"def",
"_AddPrefix",
"(",
"element",
",",
"prefix",
")",
":",
"if",
"element",
"is",
"None",
":",
"return",
"element",
"if",
"isinstance",
"(",
"element",
",",
"Iterable",
")",
"and",
"not",
"isinstance",
"(",
"element",
",",
"basestring",
")",
":",
"ret... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/msvs_emulation.py#L103-L110 | ||
linyouhappy/kongkongxiyou | 7a69b2913eb29f4be77f9a62fb90cdd72c4160f1 | cocosjs/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py | python | Type.element_count | (self) | return result | Retrieve the number of elements in this type.
Returns an int.
If the Type is not an array or vector, this raises. | Retrieve the number of elements in this type. | [
"Retrieve",
"the",
"number",
"of",
"elements",
"in",
"this",
"type",
"."
] | def element_count(self):
"""Retrieve the number of elements in this type.
Returns an int.
If the Type is not an array or vector, this raises.
"""
result = conf.lib.clang_getNumElements(self)
if result < 0:
raise Exception('Type does not have elements.')
... | [
"def",
"element_count",
"(",
"self",
")",
":",
"result",
"=",
"conf",
".",
"lib",
".",
"clang_getNumElements",
"(",
"self",
")",
"if",
"result",
"<",
"0",
":",
"raise",
"Exception",
"(",
"'Type does not have elements.'",
")",
"return",
"result"
] | https://github.com/linyouhappy/kongkongxiyou/blob/7a69b2913eb29f4be77f9a62fb90cdd72c4160f1/cocosjs/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py#L1693-L1704 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/codecs.py | python | getincrementalencoder | (encoding) | return encoder | Lookup up the codec for the given encoding and return
its IncrementalEncoder class or factory function.
Raises a LookupError in case the encoding cannot be found
or the codecs doesn't provide an incremental encoder. | Lookup up the codec for the given encoding and return
its IncrementalEncoder class or factory function. | [
"Lookup",
"up",
"the",
"codec",
"for",
"the",
"given",
"encoding",
"and",
"return",
"its",
"IncrementalEncoder",
"class",
"or",
"factory",
"function",
"."
] | def getincrementalencoder(encoding):
""" Lookup up the codec for the given encoding and return
its IncrementalEncoder class or factory function.
Raises a LookupError in case the encoding cannot be found
or the codecs doesn't provide an incremental encoder.
"""
encoder = lookup(enc... | [
"def",
"getincrementalencoder",
"(",
"encoding",
")",
":",
"encoder",
"=",
"lookup",
"(",
"encoding",
")",
".",
"incrementalencoder",
"if",
"encoder",
"is",
"None",
":",
"raise",
"LookupError",
"(",
"encoding",
")",
"return",
"encoder"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/codecs.py#L976-L988 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/oauthlib/oauth1/rfc5849/request_validator.py | python | RequestValidator.get_client_secret | (self, client_key, request) | Retrieves the client secret associated with the client key.
:param client_key: The client/consumer key.
:param request: An oauthlib.common.Request object.
:returns: The client secret as a string.
This method must allow the use of a dummy client_key value.
Fetching the secret us... | Retrieves the client secret associated with the client key. | [
"Retrieves",
"the",
"client",
"secret",
"associated",
"with",
"the",
"client",
"key",
"."
] | def get_client_secret(self, client_key, request):
"""Retrieves the client secret associated with the client key.
:param client_key: The client/consumer key.
:param request: An oauthlib.common.Request object.
:returns: The client secret as a string.
This method must allow the us... | [
"def",
"get_client_secret",
"(",
"self",
",",
"client_key",
",",
"request",
")",
":",
"raise",
"self",
".",
"_subclass_must_implement",
"(",
"'get_client_secret'",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/oauthlib/oauth1/rfc5849/request_validator.py#L266-L299 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/configdialog.py | python | HighPage.var_changed_color | (self, *params) | Process change to color choice. | Process change to color choice. | [
"Process",
"change",
"to",
"color",
"choice",
"."
] | def var_changed_color(self, *params):
"Process change to color choice."
self.on_new_color_set() | [
"def",
"var_changed_color",
"(",
"self",
",",
"*",
"params",
")",
":",
"self",
".",
"on_new_color_set",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/configdialog.py#L1044-L1046 | ||
CanalTP/navitia | cb84ce9859070187e708818b058e6a7e0b7f891b | source/jormungandr/jormungandr/scenarios/helper_classes/helper_utils.py | python | _build_crowfly | (pt_journey, entry_point, mode, places_free_access, fallback_durations, fallback_type) | return _create_crowfly(pt_journey, crowfly_origin, crowfly_destination, begin, end, mode) | Return a new crowfly section for the current pt_journey.
If the pt section's boundary is the same as the entry_point or within places_free_access, we won't do anything | Return a new crowfly section for the current pt_journey. | [
"Return",
"a",
"new",
"crowfly",
"section",
"for",
"the",
"current",
"pt_journey",
"."
] | def _build_crowfly(pt_journey, entry_point, mode, places_free_access, fallback_durations, fallback_type):
"""
Return a new crowfly section for the current pt_journey.
If the pt section's boundary is the same as the entry_point or within places_free_access, we won't do anything
"""
fallback_logic = ... | [
"def",
"_build_crowfly",
"(",
"pt_journey",
",",
"entry_point",
",",
"mode",
",",
"places_free_access",
",",
"fallback_durations",
",",
"fallback_type",
")",
":",
"fallback_logic",
"=",
"_get_fallback_logic",
"(",
"fallback_type",
")",
"pt_obj",
"=",
"fallback_logic",... | https://github.com/CanalTP/navitia/blob/cb84ce9859070187e708818b058e6a7e0b7f891b/source/jormungandr/jormungandr/scenarios/helper_classes/helper_utils.py#L427-L453 | |
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/android/dump_apk_resource_strings.py | python | ResourceStringValues.ToStringList | (self, res_id) | return result | Convert entry to string list for human-friendly output. | Convert entry to string list for human-friendly output. | [
"Convert",
"entry",
"to",
"string",
"list",
"for",
"human",
"-",
"friendly",
"output",
"."
] | def ToStringList(self, res_id):
"""Convert entry to string list for human-friendly output."""
values = sorted([(str(config), value)
for config, value in self.res_values.items()])
if res_id is None:
# res_id will be None when the resource ID should not be part
# of the output... | [
"def",
"ToStringList",
"(",
"self",
",",
"res_id",
")",
":",
"values",
"=",
"sorted",
"(",
"[",
"(",
"str",
"(",
"config",
")",
",",
"value",
")",
"for",
"config",
",",
"value",
"in",
"self",
".",
"res_values",
".",
"items",
"(",
")",
"]",
")",
"... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/android/dump_apk_resource_strings.py#L220-L236 | |
rrwick/Unicycler | 96ffea71e3a78d63ade19d6124946773e65cf129 | unicycler/misc.py | python | weighted_average_list | (nums, weights) | return sum(num * (weights[i] / weight_sum) for i, num in enumerate(nums)) | A simple weighted mean of a list of numbers. | A simple weighted mean of a list of numbers. | [
"A",
"simple",
"weighted",
"mean",
"of",
"a",
"list",
"of",
"numbers",
"."
] | def weighted_average_list(nums, weights):
"""
A simple weighted mean of a list of numbers.
"""
weight_sum = sum(weights)
if weight_sum == 0.0:
weights = [1.0] * len(nums)
return sum(num * (weights[i] / weight_sum) for i, num in enumerate(nums)) | [
"def",
"weighted_average_list",
"(",
"nums",
",",
"weights",
")",
":",
"weight_sum",
"=",
"sum",
"(",
"weights",
")",
"if",
"weight_sum",
"==",
"0.0",
":",
"weights",
"=",
"[",
"1.0",
"]",
"*",
"len",
"(",
"nums",
")",
"return",
"sum",
"(",
"num",
"*... | https://github.com/rrwick/Unicycler/blob/96ffea71e3a78d63ade19d6124946773e65cf129/unicycler/misc.py#L216-L223 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/media.py | python | MediaCtrl.SetPlaybackRate | (*args, **kwargs) | return _media.MediaCtrl_SetPlaybackRate(*args, **kwargs) | SetPlaybackRate(self, double dRate) -> bool | SetPlaybackRate(self, double dRate) -> bool | [
"SetPlaybackRate",
"(",
"self",
"double",
"dRate",
")",
"-",
">",
"bool"
] | def SetPlaybackRate(*args, **kwargs):
"""SetPlaybackRate(self, double dRate) -> bool"""
return _media.MediaCtrl_SetPlaybackRate(*args, **kwargs) | [
"def",
"SetPlaybackRate",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_media",
".",
"MediaCtrl_SetPlaybackRate",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/media.py#L129-L131 | |
waymo-research/waymo-open-dataset | 5de359f3429e1496761790770868296140161b66 | waymo_open_dataset/metrics/python/detection_metrics.py | python | _get_box_dof | (box_type) | return -1 | Gets the desired number of box degree of freedom for a box type.
Args:
box_type: The type of the box.
Returns:
The desired degrees of freedom for the box type. | Gets the desired number of box degree of freedom for a box type. | [
"Gets",
"the",
"desired",
"number",
"of",
"box",
"degree",
"of",
"freedom",
"for",
"a",
"box",
"type",
"."
] | def _get_box_dof(box_type):
"""Gets the desired number of box degree of freedom for a box type.
Args:
box_type: The type of the box.
Returns:
The desired degrees of freedom for the box type.
"""
if box_type == label_pb2.Label.Box.Type.Value('TYPE_3D'):
return 7
if box_type == label_pb2.Label.B... | [
"def",
"_get_box_dof",
"(",
"box_type",
")",
":",
"if",
"box_type",
"==",
"label_pb2",
".",
"Label",
".",
"Box",
".",
"Type",
".",
"Value",
"(",
"'TYPE_3D'",
")",
":",
"return",
"7",
"if",
"box_type",
"==",
"label_pb2",
".",
"Label",
".",
"Box",
".",
... | https://github.com/waymo-research/waymo-open-dataset/blob/5de359f3429e1496761790770868296140161b66/waymo_open_dataset/metrics/python/detection_metrics.py#L57-L72 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.