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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dmtcp/dmtcp | 48a23686e1ce6784829b783ced9c62a14d620507 | util/cpplint.py | python | FileInfo.IsSource | (self) | return _IsSourceExtension(self.Extension()[1:]) | File has a source file extension. | File has a source file extension. | [
"File",
"has",
"a",
"source",
"file",
"extension",
"."
] | def IsSource(self):
"""File has a source file extension."""
return _IsSourceExtension(self.Extension()[1:]) | [
"def",
"IsSource",
"(",
"self",
")",
":",
"return",
"_IsSourceExtension",
"(",
"self",
".",
"Extension",
"(",
")",
"[",
"1",
":",
"]",
")"
] | https://github.com/dmtcp/dmtcp/blob/48a23686e1ce6784829b783ced9c62a14d620507/util/cpplint.py#L1156-L1158 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/dispatch.py | python | Dispatcher.source_warnings | (self) | return self._source_warnings | Return warnings in sourcing handlers. | Return warnings in sourcing handlers. | [
"Return",
"warnings",
"in",
"sourcing",
"handlers",
"."
] | def source_warnings(self):
"""Return warnings in sourcing handlers."""
return self._source_warnings | [
"def",
"source_warnings",
"(",
"self",
")",
":",
"return",
"self",
".",
"_source_warnings"
] | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/dispatch.py#L231-L234 | |
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | gr-utils/modtool/core/base.py | python | validate_name | (kind, name) | Checks that block, module etc names are alphanumeric. | Checks that block, module etc names are alphanumeric. | [
"Checks",
"that",
"block",
"module",
"etc",
"names",
"are",
"alphanumeric",
"."
] | def validate_name(kind, name):
""" Checks that block, module etc names are alphanumeric. """
if not re.fullmatch('[a-zA-Z0-9_]+', name):
raise ModToolException(
"Invalid {} name '{}': names can only contain letters, numbers and underscores".format(kind, name)) | [
"def",
"validate_name",
"(",
"kind",
",",
"name",
")",
":",
"if",
"not",
"re",
".",
"fullmatch",
"(",
"'[a-zA-Z0-9_]+'",
",",
"name",
")",
":",
"raise",
"ModToolException",
"(",
"\"Invalid {} name '{}': names can only contain letters, numbers and underscores\"",
".",
... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/gr-utils/modtool/core/base.py#L47-L51 | ||
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_parser.py | python | p_moduleend | (p) | moduleend : | moduleend : | [
"moduleend",
":"
] | def p_moduleend(p):
'moduleend :'
p[0] = None | [
"def",
"p_moduleend",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"None"
] | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_parser.py#L455-L457 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | IconLocation.__init__ | (self, *args, **kwargs) | __init__(self, String filename=&wxPyEmptyString, int num=0) -> IconLocation | __init__(self, String filename=&wxPyEmptyString, int num=0) -> IconLocation | [
"__init__",
"(",
"self",
"String",
"filename",
"=",
"&wxPyEmptyString",
"int",
"num",
"=",
"0",
")",
"-",
">",
"IconLocation"
] | def __init__(self, *args, **kwargs):
"""__init__(self, String filename=&wxPyEmptyString, int num=0) -> IconLocation"""
_gdi_.IconLocation_swiginit(self,_gdi_.new_IconLocation(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_gdi_",
".",
"IconLocation_swiginit",
"(",
"self",
",",
"_gdi_",
".",
"new_IconLocation",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L1391-L1393 | ||
apache/arrow | af33dd1157eb8d7d9bfac25ebf61445b793b7943 | dev/archery/archery/utils/maven.py | python | MavenDefinition.build_arguments | (self) | return arguments | Return the arguments to maven invocation for build. | Return the arguments to maven invocation for build. | [
"Return",
"the",
"arguments",
"to",
"maven",
"invocation",
"for",
"build",
"."
] | def build_arguments(self):
"""" Return the arguments to maven invocation for build. """
arguments = self.build_definitions + [
"-B", "-DskipTests", "-Drat.skip=true",
"-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer."
"Slf4jMavenTransferListener=warn",
... | [
"def",
"build_arguments",
"(",
"self",
")",
":",
"arguments",
"=",
"self",
".",
"build_definitions",
"+",
"[",
"\"-B\"",
",",
"\"-DskipTests\"",
",",
"\"-Drat.skip=true\"",
",",
"\"-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.\"",
"\"Slf4jMavenTransferListener=w... | https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/dev/archery/archery/utils/maven.py#L64-L72 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/dummyarray.py | python | iter_strides_c_contig | (arr, shape=None) | yields the c-contiguous strides | yields the c-contiguous strides | [
"yields",
"the",
"c",
"-",
"contiguous",
"strides"
] | def iter_strides_c_contig(arr, shape=None):
"""yields the c-contiguous strides
"""
shape = arr.shape if shape is None else shape
itemsize = arr.itemsize
def gen():
yield itemsize
sum = 1
for s in reversed(shape[1:]):
sum *= s
yield sum * itemsize
... | [
"def",
"iter_strides_c_contig",
"(",
"arr",
",",
"shape",
"=",
"None",
")",
":",
"shape",
"=",
"arr",
".",
"shape",
"if",
"shape",
"is",
"None",
"else",
"shape",
"itemsize",
"=",
"arr",
".",
"itemsize",
"def",
"gen",
"(",
")",
":",
"yield",
"itemsize",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/dummyarray.py#L377-L391 | ||
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | example/gluon/style_transfer/utils.py | python | CenterCrop.__call__ | (self, img) | return img.crop((x1, y1, x1 + tw, y1 + th)) | Args:
img (PIL.Image): Image to be cropped.
Returns:
PIL.Image: Cropped image. | Args:
img (PIL.Image): Image to be cropped.
Returns:
PIL.Image: Cropped image. | [
"Args",
":",
"img",
"(",
"PIL",
".",
"Image",
")",
":",
"Image",
"to",
"be",
"cropped",
".",
"Returns",
":",
"PIL",
".",
"Image",
":",
"Cropped",
"image",
"."
] | def __call__(self, img):
"""
Args:
img (PIL.Image): Image to be cropped.
Returns:
PIL.Image: Cropped image.
"""
w, h = img.size
th, tw = self.size
x1 = int(round((w - tw) / 2.))
y1 = int(round((h - th) / 2.))
return img.crop... | [
"def",
"__call__",
"(",
"self",
",",
"img",
")",
":",
"w",
",",
"h",
"=",
"img",
".",
"size",
"th",
",",
"tw",
"=",
"self",
".",
"size",
"x1",
"=",
"int",
"(",
"round",
"(",
"(",
"w",
"-",
"tw",
")",
"/",
"2.",
")",
")",
"y1",
"=",
"int",... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/example/gluon/style_transfer/utils.py#L191-L202 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/grid.py | python | GridRangeSelectEvent.GetTopLeftCoords | (*args, **kwargs) | return _grid.GridRangeSelectEvent_GetTopLeftCoords(*args, **kwargs) | GetTopLeftCoords(self) -> GridCellCoords | GetTopLeftCoords(self) -> GridCellCoords | [
"GetTopLeftCoords",
"(",
"self",
")",
"-",
">",
"GridCellCoords"
] | def GetTopLeftCoords(*args, **kwargs):
"""GetTopLeftCoords(self) -> GridCellCoords"""
return _grid.GridRangeSelectEvent_GetTopLeftCoords(*args, **kwargs) | [
"def",
"GetTopLeftCoords",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"GridRangeSelectEvent_GetTopLeftCoords",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/grid.py#L2401-L2403 | |
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | imperative/python/megengine/functional/tensor.py | python | arange | (
start: Union[int, float, Tensor] = 0,
stop: Optional[Union[int, float, Tensor]] = None,
step: Union[int, float, Tensor] = 1,
dtype="float32",
device: Optional[CompNode] = None,
) | return result | r"""Returns evenly spaced values within the half-open interval ``[start, stop)`` as a one-dimensional tensor.
Note:
This function cannot guarantee that the interval does not include the stop value in those cases
where step is not an integer and floating-point rounding errors affect the length of th... | r"""Returns evenly spaced values within the half-open interval ``[start, stop)`` as a one-dimensional tensor. | [
"r",
"Returns",
"evenly",
"spaced",
"values",
"within",
"the",
"half",
"-",
"open",
"interval",
"[",
"start",
"stop",
")",
"as",
"a",
"one",
"-",
"dimensional",
"tensor",
"."
] | def arange(
start: Union[int, float, Tensor] = 0,
stop: Optional[Union[int, float, Tensor]] = None,
step: Union[int, float, Tensor] = 1,
dtype="float32",
device: Optional[CompNode] = None,
) -> Tensor:
r"""Returns evenly spaced values within the half-open interval ``[start, stop)`` as a one-dime... | [
"def",
"arange",
"(",
"start",
":",
"Union",
"[",
"int",
",",
"float",
",",
"Tensor",
"]",
"=",
"0",
",",
"stop",
":",
"Optional",
"[",
"Union",
"[",
"int",
",",
"float",
",",
"Tensor",
"]",
"]",
"=",
"None",
",",
"step",
":",
"Union",
"[",
"in... | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/functional/tensor.py#L1097-L1147 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | uCSIsCatCo | (code) | return ret | Check whether the character is part of Co UCS Category | Check whether the character is part of Co UCS Category | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"Co",
"UCS",
"Category"
] | def uCSIsCatCo(code):
"""Check whether the character is part of Co UCS Category """
ret = libxml2mod.xmlUCSIsCatCo(code)
return ret | [
"def",
"uCSIsCatCo",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsCatCo",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L1473-L1476 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/indexes/multi.py | python | MultiIndex.is_monotonic_increasing | (self) | return if the index is monotonic increasing (only equal or
increasing) values. | return if the index is monotonic increasing (only equal or
increasing) values. | [
"return",
"if",
"the",
"index",
"is",
"monotonic",
"increasing",
"(",
"only",
"equal",
"or",
"increasing",
")",
"values",
"."
] | def is_monotonic_increasing(self):
"""
return if the index is monotonic increasing (only equal or
increasing) values.
"""
# reversed() because lexsort() wants the most significant key last.
values = [self._get_level_values(i).values
for i in reversed(ra... | [
"def",
"is_monotonic_increasing",
"(",
"self",
")",
":",
"# reversed() because lexsort() wants the most significant key last.",
"values",
"=",
"[",
"self",
".",
"_get_level_values",
"(",
"i",
")",
".",
"values",
"for",
"i",
"in",
"reversed",
"(",
"range",
"(",
"len"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/indexes/multi.py#L1187-L1202 | ||
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | tools/filelock.py | python | BaseFileLock.release | (self, force = False) | return None | Releases the file lock.
Please note, that the lock is only completly released, if the lock
counter is 0.
Also note, that the lock file itself is not automatically deleted.
:arg bool force:
If true, the lock counter is ignored and the lock is released in
every c... | Releases the file lock. | [
"Releases",
"the",
"file",
"lock",
"."
] | def release(self, force = False):
"""
Releases the file lock.
Please note, that the lock is only completly released, if the lock
counter is 0.
Also note, that the lock file itself is not automatically deleted.
:arg bool force:
If true, the lock counter is i... | [
"def",
"release",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"with",
"self",
".",
"_thread_lock",
":",
"if",
"self",
".",
"is_locked",
":",
"self",
".",
"_lock_counter",
"-=",
"1",
"if",
"self",
".",
"_lock_counter",
"==",
"0",
"or",
"force",
... | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/tools/filelock.py#L300-L327 | |
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Tool/msvc.py | python | object_emitter | (target, source, env, parent_emitter) | return (target, source) | Sets up the PCH dependencies for an object file. | Sets up the PCH dependencies for an object file. | [
"Sets",
"up",
"the",
"PCH",
"dependencies",
"for",
"an",
"object",
"file",
"."
] | def object_emitter(target, source, env, parent_emitter):
"""Sets up the PCH dependencies for an object file."""
validate_vars(env)
parent_emitter(target, source, env)
# Add a dependency, but only if the target (e.g. 'Source1.obj')
# doesn't correspond to the pre-compiled header ('Source1.pch').
... | [
"def",
"object_emitter",
"(",
"target",
",",
"source",
",",
"env",
",",
"parent_emitter",
")",
":",
"validate_vars",
"(",
"env",
")",
"parent_emitter",
"(",
"target",
",",
"source",
",",
"env",
")",
"# Add a dependency, but only if the target (e.g. 'Source1.obj')",
... | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Tool/msvc.py#L98-L120 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/_pydecimal.py | python | Context.is_finite | (self, a) | return a.is_finite() | Return True if the operand is finite; otherwise return False.
A Decimal instance is considered finite if it is neither
infinite nor a NaN.
>>> ExtendedContext.is_finite(Decimal('2.50'))
True
>>> ExtendedContext.is_finite(Decimal('-0.3'))
True
>>> ExtendedContext... | Return True if the operand is finite; otherwise return False. | [
"Return",
"True",
"if",
"the",
"operand",
"is",
"finite",
";",
"otherwise",
"return",
"False",
"."
] | def is_finite(self, a):
"""Return True if the operand is finite; otherwise return False.
A Decimal instance is considered finite if it is neither
infinite nor a NaN.
>>> ExtendedContext.is_finite(Decimal('2.50'))
True
>>> ExtendedContext.is_finite(Decimal('-0.3'))
... | [
"def",
"is_finite",
"(",
"self",
",",
"a",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"is_finite",
"(",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/_pydecimal.py#L4499-L4519 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/command/build_py.py | python | build_py.exclude_data_files | (self, package, src_dir, files) | return list(_unique_everseen(keepers)) | Filter filenames for package's data files in 'src_dir | Filter filenames for package's data files in 'src_dir | [
"Filter",
"filenames",
"for",
"package",
"s",
"data",
"files",
"in",
"src_dir"
] | def exclude_data_files(self, package, src_dir, files):
"""Filter filenames for package's data files in 'src_dir'"""
files = list(files)
patterns = self._get_platform_patterns(
self.exclude_package_data,
package,
src_dir,
)
match_groups = (
... | [
"def",
"exclude_data_files",
"(",
"self",
",",
"package",
",",
"src_dir",
",",
"files",
")",
":",
"files",
"=",
"list",
"(",
"files",
")",
"patterns",
"=",
"self",
".",
"_get_platform_patterns",
"(",
"self",
".",
"exclude_package_data",
",",
"package",
",",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/command/build_py.py#L202-L223 | |
psnonis/FinBERT | c0c555d833a14e2316a3701e59c0b5156f804b4e | bert-gpu/tensorrt-inference-server/src/clients/python/__init__.py | python | InferContext.run | (self, inputs, outputs, batch_size=1, flags=0) | return self._get_results(outputs, batch_size) | Run inference using the supplied 'inputs' to calculate the outputs
specified by 'outputs'.
Parameters
----------
inputs : dict
Dictionary from input name to the value(s) for that
input. An input value is specified as a numpy array. Each
input in the d... | Run inference using the supplied 'inputs' to calculate the outputs
specified by 'outputs'. | [
"Run",
"inference",
"using",
"the",
"supplied",
"inputs",
"to",
"calculate",
"the",
"outputs",
"specified",
"by",
"outputs",
"."
] | def run(self, inputs, outputs, batch_size=1, flags=0):
"""Run inference using the supplied 'inputs' to calculate the outputs
specified by 'outputs'.
Parameters
----------
inputs : dict
Dictionary from input name to the value(s) for that
input. An input va... | [
"def",
"run",
"(",
"self",
",",
"inputs",
",",
"outputs",
",",
"batch_size",
"=",
"1",
",",
"flags",
"=",
"0",
")",
":",
"self",
".",
"_last_request_id",
"=",
"None",
"self",
".",
"_last_request_model_name",
"=",
"None",
"self",
".",
"_last_request_model_v... | https://github.com/psnonis/FinBERT/blob/c0c555d833a14e2316a3701e59c0b5156f804b4e/bert-gpu/tensorrt-inference-server/src/clients/python/__init__.py#L814-L878 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/bisect-builds.py | python | Bisect | (base_url,
platform,
official_builds,
is_aura,
good_rev=0,
bad_rev=0,
num_runs=1,
command="%p %a",
try_args=(),
profile=None,
flash_path=None,
pdf_path=None,
interactive=True,
e... | return (revlist[minrev], revlist[maxrev]) | Given known good and known bad revisions, run a binary search on all
archived revisions to determine the last known good revision.
@param platform Which build to download/run ('mac', 'win', 'linux64', etc.).
@param official_builds Specify build type (Chromium or Official build).
@param good_rev Number/tag of t... | Given known good and known bad revisions, run a binary search on all
archived revisions to determine the last known good revision. | [
"Given",
"known",
"good",
"and",
"known",
"bad",
"revisions",
"run",
"a",
"binary",
"search",
"on",
"all",
"archived",
"revisions",
"to",
"determine",
"the",
"last",
"known",
"good",
"revision",
"."
] | def Bisect(base_url,
platform,
official_builds,
is_aura,
good_rev=0,
bad_rev=0,
num_runs=1,
command="%p %a",
try_args=(),
profile=None,
flash_path=None,
pdf_path=None,
interactive=True,
... | [
"def",
"Bisect",
"(",
"base_url",
",",
"platform",
",",
"official_builds",
",",
"is_aura",
",",
"good_rev",
"=",
"0",
",",
"bad_rev",
"=",
"0",
",",
"num_runs",
"=",
"1",
",",
"command",
"=",
"\"%p %a\"",
",",
"try_args",
"=",
"(",
")",
",",
"profile",... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/bisect-builds.py#L461-L660 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Path/PathScripts/PathThreadMilling.py | python | _InternalThread.overshoots | (self, z) | return z + self.hPitch > self.zFinal | overshoots(z) ... returns true if adding another half helix goes beyond the thread bounds | overshoots(z) ... returns true if adding another half helix goes beyond the thread bounds | [
"overshoots",
"(",
"z",
")",
"...",
"returns",
"true",
"if",
"adding",
"another",
"half",
"helix",
"goes",
"beyond",
"the",
"thread",
"bounds"
] | def overshoots(self, z):
"""overshoots(z) ... returns true if adding another half helix goes beyond the thread bounds"""
if self.pitch < 0:
return z + self.hPitch < self.zFinal
return z + self.hPitch > self.zFinal | [
"def",
"overshoots",
"(",
"self",
",",
"z",
")",
":",
"if",
"self",
".",
"pitch",
"<",
"0",
":",
"return",
"z",
"+",
"self",
".",
"hPitch",
"<",
"self",
".",
"zFinal",
"return",
"z",
"+",
"self",
".",
"hPitch",
">",
"self",
".",
"zFinal"
] | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Path/PathScripts/PathThreadMilling.py#L88-L92 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/beta.py | python | Beta.log_prob | (self, x, name="log_prob") | `Log(P[counts])`, computed for every batch member.
Args:
x: Non-negative floating point tensor whose shape can
be broadcast with `self.a` and `self.b`. For fixed leading
dimensions, the last dimension represents counts for the corresponding
Beta distribution in `self.a` and `self.b`... | `Log(P[counts])`, computed for every batch member. | [
"Log",
"(",
"P",
"[",
"counts",
"]",
")",
"computed",
"for",
"every",
"batch",
"member",
"."
] | def log_prob(self, x, name="log_prob"):
"""`Log(P[counts])`, computed for every batch member.
Args:
x: Non-negative floating point tensor whose shape can
be broadcast with `self.a` and `self.b`. For fixed leading
dimensions, the last dimension represents counts for the corresponding
... | [
"def",
"log_prob",
"(",
"self",
",",
"x",
",",
"name",
"=",
"\"log_prob\"",
")",
":",
"a",
"=",
"self",
".",
"_a",
"b",
"=",
"self",
".",
"_b",
"with",
"ops",
".",
"name_scope",
"(",
"self",
".",
"name",
")",
":",
"with",
"ops",
".",
"op_scope",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/beta.py#L314-L340 | ||
CaoWGG/TensorRT-YOLOv4 | 4d7c2edce99e8794a4cb4ea3540d51ce91158a36 | onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py | python | SourceLocation.file | (self) | return self._get_instantiation()[0] | Get the file represented by this source location. | Get the file represented by this source location. | [
"Get",
"the",
"file",
"represented",
"by",
"this",
"source",
"location",
"."
] | def file(self):
"""Get the file represented by this source location."""
return self._get_instantiation()[0] | [
"def",
"file",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_instantiation",
"(",
")",
"[",
"0",
"]"
] | https://github.com/CaoWGG/TensorRT-YOLOv4/blob/4d7c2edce99e8794a4cb4ea3540d51ce91158a36/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py#L198-L200 | |
lmb-freiburg/ogn | 974f72ef4bf840d6f6693d22d1843a79223e77ce | python/caffe/detector.py | python | Detector.detect_windows | (self, images_windows) | return detections | Do windowed detection over given images and windows. Windows are
extracted then warped to the input dimensions of the net.
Parameters
----------
images_windows: (image filename, window list) iterable.
context_crop: size of context border to crop in pixels.
Returns
... | Do windowed detection over given images and windows. Windows are
extracted then warped to the input dimensions of the net. | [
"Do",
"windowed",
"detection",
"over",
"given",
"images",
"and",
"windows",
".",
"Windows",
"are",
"extracted",
"then",
"warped",
"to",
"the",
"input",
"dimensions",
"of",
"the",
"net",
"."
] | def detect_windows(self, images_windows):
"""
Do windowed detection over given images and windows. Windows are
extracted then warped to the input dimensions of the net.
Parameters
----------
images_windows: (image filename, window list) iterable.
context_crop: si... | [
"def",
"detect_windows",
"(",
"self",
",",
"images_windows",
")",
":",
"# Extract windows.",
"window_inputs",
"=",
"[",
"]",
"for",
"image_fname",
",",
"windows",
"in",
"images_windows",
":",
"image",
"=",
"caffe",
".",
"io",
".",
"load_image",
"(",
"image_fna... | https://github.com/lmb-freiburg/ogn/blob/974f72ef4bf840d6f6693d22d1843a79223e77ce/python/caffe/detector.py#L56-L99 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/model_selection/_split.py | python | BaseCrossValidator.split | (self, X, y=None, groups=None) | Generate indices to split data into training and test set.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Training data, where n_samples is the number of samples
and n_features is the number of features.
y : array-like, of length n_samples
... | Generate indices to split data into training and test set. | [
"Generate",
"indices",
"to",
"split",
"data",
"into",
"training",
"and",
"test",
"set",
"."
] | def split(self, X, y=None, groups=None):
"""Generate indices to split data into training and test set.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Training data, where n_samples is the number of samples
and n_features is the number of feat... | [
"def",
"split",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"groups",
"=",
"None",
")",
":",
"X",
",",
"y",
",",
"groups",
"=",
"indexable",
"(",
"X",
",",
"y",
",",
"groups",
")",
"indices",
"=",
"np",
".",
"arange",
"(",
"_num_samples"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/model_selection/_split.py#L65-L94 | ||
Illumina/manta | 75b5c38d4fcd2f6961197b28a41eb61856f2d976 | src/python/lib/workflowUtil.py | python | isLocalSmtp | () | return True | return true if a local smtp server is available | return true if a local smtp server is available | [
"return",
"true",
"if",
"a",
"local",
"smtp",
"server",
"is",
"available"
] | def isLocalSmtp() :
"""
return true if a local smtp server is available
"""
import smtplib
try :
smtplib.SMTP('localhost')
except :
return False
return True | [
"def",
"isLocalSmtp",
"(",
")",
":",
"import",
"smtplib",
"try",
":",
"smtplib",
".",
"SMTP",
"(",
"'localhost'",
")",
"except",
":",
"return",
"False",
"return",
"True"
] | https://github.com/Illumina/manta/blob/75b5c38d4fcd2f6961197b28a41eb61856f2d976/src/python/lib/workflowUtil.py#L392-L401 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/widgets/sliceviewer/lineplots.py | python | RectangleSelectionLinePlot.handle_key | (self, key) | Called if a keypress was accepted to export a region
:param key: str identifying key
:return: A string describing the result of the operation | Called if a keypress was accepted to export a region
:param key: str identifying key
:return: A string describing the result of the operation | [
"Called",
"if",
"a",
"keypress",
"was",
"accepted",
"to",
"export",
"a",
"region",
":",
"param",
"key",
":",
"str",
"identifying",
"key",
":",
"return",
":",
"A",
"string",
"describing",
"the",
"result",
"of",
"the",
"operation"
] | def handle_key(self, key):
"""
Called if a keypress was accepted to export a region
:param key: str identifying key
:return: A string describing the result of the operation
"""
# if the image has been moved and the selection is not visible then do nothing
if not s... | [
"def",
"handle_key",
"(",
"self",
",",
"key",
")",
":",
"# if the image has been moved and the selection is not visible then do nothing",
"if",
"not",
"self",
".",
"_selector",
".",
"artists",
"[",
"0",
"]",
".",
"get_visible",
"(",
")",
":",
"return",
"rect",
"="... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/sliceviewer/lineplots.py#L360-L377 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/v8/tools/release/common_includes.py | python | Step.Retry | (self, cb, retry_on=None, wait_plan=None) | Retry a function.
Params:
cb: The function to retry.
retry_on: A callback that takes the result of the function and returns
True if the function should be retried. A function throwing an
exception is always retried.
wait_plan: A list of waiting delays between retrie... | Retry a function.
Params:
cb: The function to retry.
retry_on: A callback that takes the result of the function and returns
True if the function should be retried. A function throwing an
exception is always retried.
wait_plan: A list of waiting delays between retrie... | [
"Retry",
"a",
"function",
".",
"Params",
":",
"cb",
":",
"The",
"function",
"to",
"retry",
".",
"retry_on",
":",
"A",
"callback",
"that",
"takes",
"the",
"result",
"of",
"the",
"function",
"and",
"returns",
"True",
"if",
"the",
"function",
"should",
"be"... | def Retry(self, cb, retry_on=None, wait_plan=None):
""" Retry a function.
Params:
cb: The function to retry.
retry_on: A callback that takes the result of the function and returns
True if the function should be retried. A function throwing an
exception is always retri... | [
"def",
"Retry",
"(",
"self",
",",
"cb",
",",
"retry_on",
"=",
"None",
",",
"wait_plan",
"=",
"None",
")",
":",
"retry_on",
"=",
"retry_on",
"or",
"(",
"lambda",
"x",
":",
"False",
")",
"wait_plan",
"=",
"list",
"(",
"wait_plan",
"or",
"[",
"]",
")"... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/v8/tools/release/common_includes.py#L461-L491 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/buttonpanel.py | python | ButtonPanel.SetAlignment | (self, alignment) | Sets the buttons alignment.
:param integer `alignment`: can be one of the following bits:
====================== ======= ==========================
Alignment Flag Value Description
====================== ======= ==========================
``BP_ALIGN_RIGHT`` ... | Sets the buttons alignment. | [
"Sets",
"the",
"buttons",
"alignment",
"."
] | def SetAlignment(self, alignment):
"""
Sets the buttons alignment.
:param integer `alignment`: can be one of the following bits:
====================== ======= ==========================
Alignment Flag Value Description
====================== ======= ======... | [
"def",
"SetAlignment",
"(",
"self",
",",
"alignment",
")",
":",
"if",
"alignment",
"==",
"self",
".",
"_alignment",
":",
"return",
"self",
".",
"Freeze",
"(",
")",
"text",
"=",
"self",
".",
"GetBarText",
"(",
")",
"# Remove the text in any case",
"self",
"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/buttonpanel.py#L2049-L2082 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/pkg_resources/__init__.py | python | IResourceProvider.resource_isdir | (resource_name) | Is the named resource a directory? (like ``os.path.isdir()``) | Is the named resource a directory? (like ``os.path.isdir()``) | [
"Is",
"the",
"named",
"resource",
"a",
"directory?",
"(",
"like",
"os",
".",
"path",
".",
"isdir",
"()",
")"
] | def resource_isdir(resource_name):
"""Is the named resource a directory? (like ``os.path.isdir()``)""" | [
"def",
"resource_isdir",
"(",
"resource_name",
")",
":"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/pkg_resources/__init__.py#L536-L537 | ||
GeometryCollective/boundary-first-flattening | 8250e5a0e85980ec50b5e8aa8f49dd6519f915cd | deps/nanogui/ext/pybind11/tools/clang/cindex.py | python | SourceLocation.offset | (self) | return self._get_instantiation()[3] | Get the file offset represented by this source location. | Get the file offset represented by this source location. | [
"Get",
"the",
"file",
"offset",
"represented",
"by",
"this",
"source",
"location",
"."
] | def offset(self):
"""Get the file offset represented by this source location."""
return self._get_instantiation()[3] | [
"def",
"offset",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_instantiation",
"(",
")",
"[",
"3",
"]"
] | https://github.com/GeometryCollective/boundary-first-flattening/blob/8250e5a0e85980ec50b5e8aa8f49dd6519f915cd/deps/nanogui/ext/pybind11/tools/clang/cindex.py#L213-L215 | |
facebook/ThreatExchange | 31914a51820c73c8a0daffe62ccca29a6e3d359e | api-reference-examples/python/pytx/pytx/common.py | python | Common.__init__ | (self, **kwargs) | Initialize the object. Set any attributes that were provided. | Initialize the object. Set any attributes that were provided. | [
"Initialize",
"the",
"object",
".",
"Set",
"any",
"attributes",
"that",
"were",
"provided",
"."
] | def __init__(self, **kwargs):
"""
Initialize the object. Set any attributes that were provided.
"""
for name, value in kwargs.items():
self.__setattr__(name, value) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"name",
",",
"value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"self",
".",
"__setattr__",
"(",
"name",
",",
"value",
")"
] | https://github.com/facebook/ThreatExchange/blob/31914a51820c73c8a0daffe62ccca29a6e3d359e/api-reference-examples/python/pytx/pytx/common.py#L56-L62 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ma/core.py | python | _MaskedBinaryOperation.__init__ | (self, mbfunc, fillx=0, filly=0) | abfunc(fillx, filly) must be defined.
abfunc(x, filly) = x for all x to enable reduce. | abfunc(fillx, filly) must be defined. | [
"abfunc",
"(",
"fillx",
"filly",
")",
"must",
"be",
"defined",
"."
] | def __init__(self, mbfunc, fillx=0, filly=0):
"""
abfunc(fillx, filly) must be defined.
abfunc(x, filly) = x for all x to enable reduce.
"""
super(_MaskedBinaryOperation, self).__init__(mbfunc)
self.fillx = fillx
self.filly = filly
ufunc_domain[mbfunc] =... | [
"def",
"__init__",
"(",
"self",
",",
"mbfunc",
",",
"fillx",
"=",
"0",
",",
"filly",
"=",
"0",
")",
":",
"super",
"(",
"_MaskedBinaryOperation",
",",
"self",
")",
".",
"__init__",
"(",
"mbfunc",
")",
"self",
".",
"fillx",
"=",
"fillx",
"self",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ma/core.py#L1003-L1014 | ||
asLody/whale | 6a661b27cc4cf83b7b5a3b02451597ee1ac7f264 | whale/cpplint.py | python | _BlockInfo.CheckEnd | (self, filename, clean_lines, linenum, error) | Run checks that applies to text after the closing brace.
This is mostly used for checking end of namespace comments.
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... | Run checks that applies to text after the closing brace. | [
"Run",
"checks",
"that",
"applies",
"to",
"text",
"after",
"the",
"closing",
"brace",
"."
] | def CheckEnd(self, filename, clean_lines, linenum, error):
"""Run checks that applies to text after the closing brace.
This is mostly used for checking end of namespace comments.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
line... | [
"def",
"CheckEnd",
"(",
"self",
",",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"pass"
] | https://github.com/asLody/whale/blob/6a661b27cc4cf83b7b5a3b02451597ee1ac7f264/whale/cpplint.py#L2230-L2241 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/optimizer/optimizer.py | python | Optimizer.fused_step | (self, indices, weights, grads, states) | Perform a fused optimization step using gradients and states.
New operators that fuses optimizer's update should be put in this function.
Parameters
----------
indices : list of int
List of unique indices of the parameters into the individual learning rates
and w... | Perform a fused optimization step using gradients and states.
New operators that fuses optimizer's update should be put in this function. | [
"Perform",
"a",
"fused",
"optimization",
"step",
"using",
"gradients",
"and",
"states",
".",
"New",
"operators",
"that",
"fuses",
"optimizer",
"s",
"update",
"should",
"be",
"put",
"in",
"this",
"function",
"."
] | def fused_step(self, indices, weights, grads, states):
"""Perform a fused optimization step using gradients and states.
New operators that fuses optimizer's update should be put in this function.
Parameters
----------
indices : list of int
List of unique indices of t... | [
"def",
"fused_step",
"(",
"self",
",",
"indices",
",",
"weights",
",",
"grads",
",",
"states",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/optimizer/optimizer.py#L276-L293 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/logging/__init__.py | python | Logger.debug | (self, msg, *args, **kwargs) | Log 'msg % args' with severity 'DEBUG'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.debug("Houston, we have a %s", "thorny problem", exc_info=1) | Log 'msg % args' with severity 'DEBUG'. | [
"Log",
"msg",
"%",
"args",
"with",
"severity",
"DEBUG",
"."
] | def debug(self, msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'DEBUG'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.debug("Houston, we have a %s", "thorny problem", exc_info=1)
"""
if self.isEnabledF... | [
"def",
"debug",
"(",
"self",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"isEnabledFor",
"(",
"DEBUG",
")",
":",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"msg",
",",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/logging/__init__.py#L1356-L1366 | ||
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/message.py | python | Message.IsInitialized | (self) | Checks if the message is initialized.
Returns:
The method returns True if the message is initialized (i.e. all of its
required fields are set). | Checks if the message is initialized. | [
"Checks",
"if",
"the",
"message",
"is",
"initialized",
"."
] | def IsInitialized(self):
"""Checks if the message is initialized.
Returns:
The method returns True if the message is initialized (i.e. all of its
required fields are set).
"""
raise NotImplementedError | [
"def",
"IsInitialized",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/message.py#L134-L141 | ||
alexgkendall/caffe-segnet | 344c113bf1832886f1cbe9f33ffe28a3beeaf412 | scripts/cpp_lint.py | python | CheckCaffeDataLayerSetUp | (filename, clean_lines, linenum, error) | Except the base classes, Caffe DataLayer should define DataLayerSetUp
instead of LayerSetUp.
The base DataLayers define common SetUp steps, the subclasses should
not override them.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
li... | Except the base classes, Caffe DataLayer should define DataLayerSetUp
instead of LayerSetUp.
The base DataLayers define common SetUp steps, the subclasses should
not override them.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
li... | [
"Except",
"the",
"base",
"classes",
"Caffe",
"DataLayer",
"should",
"define",
"DataLayerSetUp",
"instead",
"of",
"LayerSetUp",
".",
"The",
"base",
"DataLayers",
"define",
"common",
"SetUp",
"steps",
"the",
"subclasses",
"should",
"not",
"override",
"them",
".",
... | def CheckCaffeDataLayerSetUp(filename, clean_lines, linenum, error):
"""Except the base classes, Caffe DataLayer should define DataLayerSetUp
instead of LayerSetUp.
The base DataLayers define common SetUp steps, the subclasses should
not override them.
Args:
filename: The name of the current f... | [
"def",
"CheckCaffeDataLayerSetUp",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"ix",
"=",
"line",
".",
"find",
"(",
"'DataLayer<Dtype>::LayerSetUp'",
")",
"if",
... | https://github.com/alexgkendall/caffe-segnet/blob/344c113bf1832886f1cbe9f33ffe28a3beeaf412/scripts/cpp_lint.py#L1595-L1631 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | RadioButton.GetValue | (*args, **kwargs) | return _controls_.RadioButton_GetValue(*args, **kwargs) | GetValue(self) -> bool | GetValue(self) -> bool | [
"GetValue",
"(",
"self",
")",
"-",
">",
"bool"
] | def GetValue(*args, **kwargs):
"""GetValue(self) -> bool"""
return _controls_.RadioButton_GetValue(*args, **kwargs) | [
"def",
"GetValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"RadioButton_GetValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L2747-L2749 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/experimental/rpc/rpc_ops.py | python | GrpcClient._add_method | (self, method_name, output_specs, input_specs, client_handle,
doc_string) | Method to add RPC methods to the client object. | Method to add RPC methods to the client object. | [
"Method",
"to",
"add",
"RPC",
"methods",
"to",
"the",
"client",
"object",
"."
] | def _add_method(self, method_name, output_specs, input_specs, client_handle,
doc_string):
"""Method to add RPC methods to the client object."""
def validate_and_get_flat_inputs(*args):
if args is None:
args = []
if input_specs:
nest.assert_same_structure(args, inpu... | [
"def",
"_add_method",
"(",
"self",
",",
"method_name",
",",
"output_specs",
",",
"input_specs",
",",
"client_handle",
",",
"doc_string",
")",
":",
"def",
"validate_and_get_flat_inputs",
"(",
"*",
"args",
")",
":",
"if",
"args",
"is",
"None",
":",
"args",
"="... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/experimental/rpc/rpc_ops.py#L367-L406 | ||
llvm-dcpu16/llvm-dcpu16 | ae6b01fecd03219677e391d4421df5d966d80dcf | bindings/python/llvm/object.py | python | Relocation.expire | (self) | Expire this instance, making future API accesses fail. | Expire this instance, making future API accesses fail. | [
"Expire",
"this",
"instance",
"making",
"future",
"API",
"accesses",
"fail",
"."
] | def expire(self):
"""Expire this instance, making future API accesses fail."""
self.expired = True | [
"def",
"expire",
"(",
"self",
")",
":",
"self",
".",
"expired",
"=",
"True"
] | https://github.com/llvm-dcpu16/llvm-dcpu16/blob/ae6b01fecd03219677e391d4421df5d966d80dcf/bindings/python/llvm/object.py#L423-L425 | ||
dartsim/dart | 495c82120c836005f2d136d4a50c8cc997fb879b | tools/cpplint.py | python | _FunctionState.Count | (self) | Count line in current function body. | Count line in current function body. | [
"Count",
"line",
"in",
"current",
"function",
"body",
"."
] | def Count(self):
"""Count line in current function body."""
if self.in_a_function:
self.lines_in_function += 1 | [
"def",
"Count",
"(",
"self",
")",
":",
"if",
"self",
".",
"in_a_function",
":",
"self",
".",
"lines_in_function",
"+=",
"1"
] | https://github.com/dartsim/dart/blob/495c82120c836005f2d136d4a50c8cc997fb879b/tools/cpplint.py#L808-L811 | ||
lammps/lammps | b75c3065430a75b1b5543a10e10f46d9b4c91913 | tools/i-pi/ipi/engine/normalmodes.py | python | NormalModes.get_kins | (self) | return kmd | Gets the MD kinetic energy for all the normal modes.
Returns:
A list of the kinetic energy for each NM. | Gets the MD kinetic energy for all the normal modes. | [
"Gets",
"the",
"MD",
"kinetic",
"energy",
"for",
"all",
"the",
"normal",
"modes",
"."
] | def get_kins(self):
"""Gets the MD kinetic energy for all the normal modes.
Returns:
A list of the kinetic energy for each NM.
"""
kmd = np.zeros(self.nbeads,float)
sm = depstrip(self.beads.sm3[0])
pnm = depstrip(self.pnm)
nmf = depstrip(self.nm_factor)
# comp... | [
"def",
"get_kins",
"(",
"self",
")",
":",
"kmd",
"=",
"np",
".",
"zeros",
"(",
"self",
".",
"nbeads",
",",
"float",
")",
"sm",
"=",
"depstrip",
"(",
"self",
".",
"beads",
".",
"sm3",
"[",
"0",
"]",
")",
"pnm",
"=",
"depstrip",
"(",
"self",
".",... | https://github.com/lammps/lammps/blob/b75c3065430a75b1b5543a10e10f46d9b4c91913/tools/i-pi/ipi/engine/normalmodes.py#L344-L361 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | modules/stochastic_tools/python/stochastic/histogram.py | python | command_line_options | () | return parser.parse_args() | Command-line options for histogram tool. | Command-line options for histogram tool. | [
"Command",
"-",
"line",
"options",
"for",
"histogram",
"tool",
"."
] | def command_line_options():
"""
Command-line options for histogram tool.
"""
parser = argparse.ArgumentParser(description="Command-line utility for creating histograms from VectorPostprocessor data.")
parser.add_argument('filename', type=str, help="The VectorPostprocessor data file pattern to open, ... | [
"def",
"command_line_options",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"Command-line utility for creating histograms from VectorPostprocessor data.\"",
")",
"parser",
".",
"add_argument",
"(",
"'filename'",
",",
"type",
... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/modules/stochastic_tools/python/stochastic/histogram.py#L19-L33 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/extras/codelite.py | python | codelite_generator.collect_dirs | (self) | Create the folder structure in the CodeLite project view | Create the folder structure in the CodeLite project view | [
"Create",
"the",
"folder",
"structure",
"in",
"the",
"CodeLite",
"project",
"view"
] | def collect_dirs(self):
"""
Create the folder structure in the CodeLite project view
"""
seen = {}
def make_parents(proj):
# look at a project, try to make a parent
if getattr(proj, 'parent', ... | [
"def",
"collect_dirs",
"(",
"self",
")",
":",
"seen",
"=",
"{",
"}",
"def",
"make_parents",
"(",
"proj",
")",
":",
"# look at a project, try to make a parent",
"if",
"getattr",
"(",
"proj",
",",
"'parent'",
",",
"None",
")",
":",
"# aliases already have parents"... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/extras/codelite.py#L843-L875 | ||
facebookincubator/katran | 192eb988c398afc673620254097defb7035d669e | build/fbcode_builder/getdeps/copytree.py | python | prefetch_dir_if_eden | (dirpath) | After an amend/rebase, Eden may need to fetch a large number
of trees from the servers. The simplistic single threaded walk
performed by copytree makes this more expensive than is desirable
so we help accelerate things by performing a prefetch on the
source directory | After an amend/rebase, Eden may need to fetch a large number
of trees from the servers. The simplistic single threaded walk
performed by copytree makes this more expensive than is desirable
so we help accelerate things by performing a prefetch on the
source directory | [
"After",
"an",
"amend",
"/",
"rebase",
"Eden",
"may",
"need",
"to",
"fetch",
"a",
"large",
"number",
"of",
"trees",
"from",
"the",
"servers",
".",
"The",
"simplistic",
"single",
"threaded",
"walk",
"performed",
"by",
"copytree",
"makes",
"this",
"more",
"e... | def prefetch_dir_if_eden(dirpath):
"""After an amend/rebase, Eden may need to fetch a large number
of trees from the servers. The simplistic single threaded walk
performed by copytree makes this more expensive than is desirable
so we help accelerate things by performing a prefetch on the
source dir... | [
"def",
"prefetch_dir_if_eden",
"(",
"dirpath",
")",
":",
"global",
"PREFETCHED_DIRS",
"if",
"dirpath",
"in",
"PREFETCHED_DIRS",
":",
"return",
"root",
"=",
"find_eden_root",
"(",
"dirpath",
")",
"if",
"root",
"is",
"None",
":",
"return",
"glob",
"=",
"f\"{os.p... | https://github.com/facebookincubator/katran/blob/192eb988c398afc673620254097defb7035d669e/build/fbcode_builder/getdeps/copytree.py#L48-L65 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/distributed/fleet/data_generator/data_generator.py | python | MultiSlotDataGenerator._gen_str | (self, line) | return output + "\n" | Further processing the output of the process() function rewritten by
user, outputting data that can be directly read by the MultiSlotDataFeed,
and updating proto_info information.
The input line will be in this format:
>>> [(name, [feasign, ...]), ...]
>>> or ((name, [f... | Further processing the output of the process() function rewritten by
user, outputting data that can be directly read by the MultiSlotDataFeed,
and updating proto_info information. | [
"Further",
"processing",
"the",
"output",
"of",
"the",
"process",
"()",
"function",
"rewritten",
"by",
"user",
"outputting",
"data",
"that",
"can",
"be",
"directly",
"read",
"by",
"the",
"MultiSlotDataFeed",
"and",
"updating",
"proto_info",
"information",
"."
] | def _gen_str(self, line):
'''
Further processing the output of the process() function rewritten by
user, outputting data that can be directly read by the MultiSlotDataFeed,
and updating proto_info information.
The input line will be in this format:
>>> [(name, [feasi... | [
"def",
"_gen_str",
"(",
"self",
",",
"line",
")",
":",
"if",
"sys",
".",
"version",
">",
"'3'",
"and",
"isinstance",
"(",
"line",
",",
"zip",
")",
":",
"line",
"=",
"list",
"(",
"line",
")",
"if",
"not",
"isinstance",
"(",
"line",
",",
"list",
")... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/fleet/data_generator/data_generator.py#L284-L379 | |
jackaudio/jack2 | 21b293dbc37d42446141a08922cdec0d2550c6a0 | waflib/Tools/ar.py | python | find_ar | (conf) | Configuration helper used by C/C++ tools to enable the support for static libraries | Configuration helper used by C/C++ tools to enable the support for static libraries | [
"Configuration",
"helper",
"used",
"by",
"C",
"/",
"C",
"++",
"tools",
"to",
"enable",
"the",
"support",
"for",
"static",
"libraries"
] | def find_ar(conf):
"""Configuration helper used by C/C++ tools to enable the support for static libraries"""
conf.load('ar') | [
"def",
"find_ar",
"(",
"conf",
")",
":",
"conf",
".",
"load",
"(",
"'ar'",
")"
] | https://github.com/jackaudio/jack2/blob/21b293dbc37d42446141a08922cdec0d2550c6a0/waflib/Tools/ar.py#L14-L16 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/linalg/_interpolative_backend.py | python | iddr_asvd | (A, k) | return U, V, S | Compute SVD of a real matrix to a specified rank using random sampling.
:param A:
Matrix.
:type A: :class:`numpy.ndarray`
:param k:
Rank of SVD.
:type k: int
:return:
Left singular vectors.
:rtype: :class:`numpy.ndarray`
:return:
Right singular vectors.
... | Compute SVD of a real matrix to a specified rank using random sampling. | [
"Compute",
"SVD",
"of",
"a",
"real",
"matrix",
"to",
"a",
"specified",
"rank",
"using",
"random",
"sampling",
"."
] | def iddr_asvd(A, k):
"""
Compute SVD of a real matrix to a specified rank using random sampling.
:param A:
Matrix.
:type A: :class:`numpy.ndarray`
:param k:
Rank of SVD.
:type k: int
:return:
Left singular vectors.
:rtype: :class:`numpy.ndarray`
:return:
... | [
"def",
"iddr_asvd",
"(",
"A",
",",
"k",
")",
":",
"A",
"=",
"np",
".",
"asfortranarray",
"(",
"A",
")",
"m",
",",
"n",
"=",
"A",
".",
"shape",
"w",
"=",
"np",
".",
"empty",
"(",
"(",
"2",
"*",
"k",
"+",
"28",
")",
"*",
"m",
"+",
"(",
"6... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/linalg/_interpolative_backend.py#L761-L790 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/mturk/connection.py | python | MTurkConnection.set_rest_notification | (self, hit_type, url, event_types=None) | return self._set_notification(hit_type, 'REST', url,
'SetHITTypeNotification', event_types) | Performs a SetHITTypeNotification operation to set REST notification
for a specified HIT type | Performs a SetHITTypeNotification operation to set REST notification
for a specified HIT type | [
"Performs",
"a",
"SetHITTypeNotification",
"operation",
"to",
"set",
"REST",
"notification",
"for",
"a",
"specified",
"HIT",
"type"
] | def set_rest_notification(self, hit_type, url, event_types=None):
"""
Performs a SetHITTypeNotification operation to set REST notification
for a specified HIT type
"""
return self._set_notification(hit_type, 'REST', url,
'SetHITTypeNotificati... | [
"def",
"set_rest_notification",
"(",
"self",
",",
"hit_type",
",",
"url",
",",
"event_types",
"=",
"None",
")",
":",
"return",
"self",
".",
"_set_notification",
"(",
"hit_type",
",",
"'REST'",
",",
"url",
",",
"'SetHITTypeNotification'",
",",
"event_types",
")... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/mturk/connection.py#L112-L118 | |
GeometryCollective/boundary-first-flattening | 8250e5a0e85980ec50b5e8aa8f49dd6519f915cd | deps/nanogui/docs/exhale.py | python | ExhaleRoot.parse | (self) | The first method that should be called after creating an ExhaleRoot object. The
Breathe graph is parsed first, followed by the Doxygen xml documents. By the
end of this method, all of the ``self.<breathe_kind>``, ``self.all_compounds``,
and ``self.all_nodes`` lists as well as the ``self.node_b... | The first method that should be called after creating an ExhaleRoot object. The
Breathe graph is parsed first, followed by the Doxygen xml documents. By the
end of this method, all of the ``self.<breathe_kind>``, ``self.all_compounds``,
and ``self.all_nodes`` lists as well as the ``self.node_b... | [
"The",
"first",
"method",
"that",
"should",
"be",
"called",
"after",
"creating",
"an",
"ExhaleRoot",
"object",
".",
"The",
"Breathe",
"graph",
"is",
"parsed",
"first",
"followed",
"by",
"the",
"Doxygen",
"xml",
"documents",
".",
"By",
"the",
"end",
"of",
"... | def parse(self):
'''
The first method that should be called after creating an ExhaleRoot object. The
Breathe graph is parsed first, followed by the Doxygen xml documents. By the
end of this method, all of the ``self.<breathe_kind>``, ``self.all_compounds``,
and ``self.all_nodes... | [
"def",
"parse",
"(",
"self",
")",
":",
"# Find and reparent everything from the Breathe graph.",
"self",
".",
"discoverAllNodes",
"(",
")",
"self",
".",
"reparentAll",
"(",
")",
"# now that we have all of the nodes, store them in a convenient manner for refid",
"# lookup when par... | https://github.com/GeometryCollective/boundary-first-flattening/blob/8250e5a0e85980ec50b5e8aa8f49dd6519f915cd/deps/nanogui/docs/exhale.py#L1435-L1465 | ||
vslavik/poedit | f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a | deps/boost/tools/build/src/build/type.py | python | is_derived | (type, base) | Returns true if 'type' is 'base' or has 'base' as its direct or indirect base. | Returns true if 'type' is 'base' or has 'base' as its direct or indirect base. | [
"Returns",
"true",
"if",
"type",
"is",
"base",
"or",
"has",
"base",
"as",
"its",
"direct",
"or",
"indirect",
"base",
"."
] | def is_derived (type, base):
""" Returns true if 'type' is 'base' or has 'base' as its direct or indirect base.
"""
assert isinstance(type, basestring)
assert isinstance(base, basestring)
# TODO: this isn't very efficient, especially for bases close to type
if base in all_bases (type):
r... | [
"def",
"is_derived",
"(",
"type",
",",
"base",
")",
":",
"assert",
"isinstance",
"(",
"type",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"base",
",",
"basestring",
")",
"# TODO: this isn't very efficient, especially for bases close to type",
"if",
"base",
... | https://github.com/vslavik/poedit/blob/f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a/deps/boost/tools/build/src/build/type.py#L202-L211 | ||
SonarOpenCommunity/sonar-cxx | 6e1d456fdcd45d35bcdc61c980e34d85fe88971e | cxx-squid/dox/tools/grammar_parser/grammar_parser.py | python | GrammarParser.use | (self, search) | Search all rules using an expression and remove all other rules. | Search all rules using an expression and remove all other rules. | [
"Search",
"all",
"rules",
"using",
"an",
"expression",
"and",
"remove",
"all",
"other",
"rules",
"."
] | def use(self, search):
"""
Search all rules using an expression and remove all other rules.
"""
rules = {}
if search in self.rules:
rules[search] = self.rules[search]
for rulename, sequences in self.rules.items():
if self.__rule_use_expression(sear... | [
"def",
"use",
"(",
"self",
",",
"search",
")",
":",
"rules",
"=",
"{",
"}",
"if",
"search",
"in",
"self",
".",
"rules",
":",
"rules",
"[",
"search",
"]",
"=",
"self",
".",
"rules",
"[",
"search",
"]",
"for",
"rulename",
",",
"sequences",
"in",
"s... | https://github.com/SonarOpenCommunity/sonar-cxx/blob/6e1d456fdcd45d35bcdc61c980e34d85fe88971e/cxx-squid/dox/tools/grammar_parser/grammar_parser.py#L137-L147 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/image_ops_impl.py | python | adjust_gamma | (image, gamma=1, gain=1) | Performs Gamma Correction on the input image.
Also known as Power Law Transform. This function converts the
input images at first to float representation, then transforms them
pixelwise according to the equation `Out = gain * In**gamma`,
and then converts the back to the original data type.
Args:
image ... | Performs Gamma Correction on the input image. | [
"Performs",
"Gamma",
"Correction",
"on",
"the",
"input",
"image",
"."
] | def adjust_gamma(image, gamma=1, gain=1):
"""Performs Gamma Correction on the input image.
Also known as Power Law Transform. This function converts the
input images at first to float representation, then transforms them
pixelwise according to the equation `Out = gain * In**gamma`,
and then converts the back... | [
"def",
"adjust_gamma",
"(",
"image",
",",
"gamma",
"=",
"1",
",",
"gain",
"=",
"1",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"None",
",",
"'adjust_gamma'",
",",
"[",
"image",
",",
"gamma",
",",
"gain",
"]",
")",
"as",
"name",
":",
"image",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/image_ops_impl.py#L1675-L1725 | ||
apache/singa | 93fd9da72694e68bfe3fb29d0183a65263d238a1 | python/singa/autograd.py | python | pooling_2d | (handle, x, odd_padding=(0, 0, 0, 0)) | return _Pooling2d(handle, odd_padding)(x)[0] | Pooling 2d operator
Args:
handle (object): PoolingHandle for cpu or CudnnPoolingHandle for
gpu
x (Tensor): input
odd_padding (tuple of four int): the odd paddding is the value
that cannot be handled by the tuple padding (w, h) mode so
it needs to firstly h... | Pooling 2d operator
Args:
handle (object): PoolingHandle for cpu or CudnnPoolingHandle for
gpu
x (Tensor): input
odd_padding (tuple of four int): the odd paddding is the value
that cannot be handled by the tuple padding (w, h) mode so
it needs to firstly h... | [
"Pooling",
"2d",
"operator",
"Args",
":",
"handle",
"(",
"object",
")",
":",
"PoolingHandle",
"for",
"cpu",
"or",
"CudnnPoolingHandle",
"for",
"gpu",
"x",
"(",
"Tensor",
")",
":",
"input",
"odd_padding",
"(",
"tuple",
"of",
"four",
"int",
")",
":",
"the"... | def pooling_2d(handle, x, odd_padding=(0, 0, 0, 0)):
"""
Pooling 2d operator
Args:
handle (object): PoolingHandle for cpu or CudnnPoolingHandle for
gpu
x (Tensor): input
odd_padding (tuple of four int): the odd paddding is the value
that cannot be handled by t... | [
"def",
"pooling_2d",
"(",
"handle",
",",
"x",
",",
"odd_padding",
"=",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
")",
":",
"return",
"_Pooling2d",
"(",
"handle",
",",
"odd_padding",
")",
"(",
"x",
")",
"[",
"0",
"]"
] | https://github.com/apache/singa/blob/93fd9da72694e68bfe3fb29d0183a65263d238a1/python/singa/autograd.py#L1904-L1918 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/affine/promote.py | python | Promote.is_symmetric | (self) | return self.ndim == 2 and self.shape[0] == self.shape[1] | Is the expression symmetric? | Is the expression symmetric? | [
"Is",
"the",
"expression",
"symmetric?"
] | def is_symmetric(self) -> bool:
"""Is the expression symmetric?
"""
return self.ndim == 2 and self.shape[0] == self.shape[1] | [
"def",
"is_symmetric",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"ndim",
"==",
"2",
"and",
"self",
".",
"shape",
"[",
"0",
"]",
"==",
"self",
".",
"shape",
"[",
"1",
"]"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/affine/promote.py#L73-L76 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/python_gflags/gflags.py | python | DEFINE_enum | (name, default, enum_values, help, flag_values=FLAGS,
**args) | Registers a flag whose value can be any string from enum_values. | Registers a flag whose value can be any string from enum_values. | [
"Registers",
"a",
"flag",
"whose",
"value",
"can",
"be",
"any",
"string",
"from",
"enum_values",
"."
] | def DEFINE_enum(name, default, enum_values, help, flag_values=FLAGS,
**args):
"""Registers a flag whose value can be any string from enum_values."""
DEFINE_flag(EnumFlag(name, default, help, enum_values, ** args),
flag_values) | [
"def",
"DEFINE_enum",
"(",
"name",
",",
"default",
",",
"enum_values",
",",
"help",
",",
"flag_values",
"=",
"FLAGS",
",",
"*",
"*",
"args",
")",
":",
"DEFINE_flag",
"(",
"EnumFlag",
"(",
"name",
",",
"default",
",",
"help",
",",
"enum_values",
",",
"*... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/python_gflags/gflags.py#L2624-L2628 | ||
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/fuchsia/boot_data.py | python | _GetAuthorizedKeysPath | () | return os.path.join(_SSH_DIR, 'fuchsia_authorized_keys') | Returns a path to the authorized keys which get copied to your Fuchsia
device during paving | Returns a path to the authorized keys which get copied to your Fuchsia
device during paving | [
"Returns",
"a",
"path",
"to",
"the",
"authorized",
"keys",
"which",
"get",
"copied",
"to",
"your",
"Fuchsia",
"device",
"during",
"paving"
] | def _GetAuthorizedKeysPath():
"""Returns a path to the authorized keys which get copied to your Fuchsia
device during paving"""
return os.path.join(_SSH_DIR, 'fuchsia_authorized_keys') | [
"def",
"_GetAuthorizedKeysPath",
"(",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"_SSH_DIR",
",",
"'fuchsia_authorized_keys'",
")"
] | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/fuchsia/boot_data.py#L43-L47 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/image/image.py | python | scale_down | (src_size, size) | return int(w), int(h) | Scales down crop size if it's larger than image size.
If width/height of the crop is larger than the width/height of the image,
sets the width/height to the width/height of the image.
Parameters
----------
src_size : tuple of int
Size of the image in (width, height) format.
size : tupl... | Scales down crop size if it's larger than image size. | [
"Scales",
"down",
"crop",
"size",
"if",
"it",
"s",
"larger",
"than",
"image",
"size",
"."
] | def scale_down(src_size, size):
"""Scales down crop size if it's larger than image size.
If width/height of the crop is larger than the width/height of the image,
sets the width/height to the width/height of the image.
Parameters
----------
src_size : tuple of int
Size of the image in ... | [
"def",
"scale_down",
"(",
"src_size",
",",
"size",
")",
":",
"w",
",",
"h",
"=",
"size",
"sw",
",",
"sh",
"=",
"src_size",
"if",
"sh",
"<",
"h",
":",
"w",
",",
"h",
"=",
"float",
"(",
"w",
"*",
"sh",
")",
"/",
"h",
",",
"sh",
"if",
"sw",
... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/image/image.py#L201-L233 | |
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPM2_SelfTest_REQUEST.toTpm | (self, buf) | TpmMarshaller method | TpmMarshaller method | [
"TpmMarshaller",
"method"
] | def toTpm(self, buf):
""" TpmMarshaller method """
buf.writeByte(self.fullTest) | [
"def",
"toTpm",
"(",
"self",
",",
"buf",
")",
":",
"buf",
".",
"writeByte",
"(",
"self",
".",
"fullTest",
")"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L9136-L9138 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/utils/py3compat.py | python | safe_unicode | (e) | return u'Unrecoverably corrupt evalue' | unicode(e) with various fallbacks. Used for exceptions, which may not be
safe to call unicode() on. | unicode(e) with various fallbacks. Used for exceptions, which may not be
safe to call unicode() on. | [
"unicode",
"(",
"e",
")",
"with",
"various",
"fallbacks",
".",
"Used",
"for",
"exceptions",
"which",
"may",
"not",
"be",
"safe",
"to",
"call",
"unicode",
"()",
"on",
"."
] | def safe_unicode(e):
"""unicode(e) with various fallbacks. Used for exceptions, which may not be
safe to call unicode() on.
"""
try:
return unicode_type(e)
except UnicodeError:
pass
try:
return str_to_unicode(str(e))
except UnicodeError:
pass
try:
... | [
"def",
"safe_unicode",
"(",
"e",
")",
":",
"try",
":",
"return",
"unicode_type",
"(",
"e",
")",
"except",
"UnicodeError",
":",
"pass",
"try",
":",
"return",
"str_to_unicode",
"(",
"str",
"(",
"e",
")",
")",
"except",
"UnicodeError",
":",
"pass",
"try",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/utils/py3compat.py#L61-L80 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/combo.py | python | ComboCtrl.ShowPopup | (*args, **kwargs) | return _combo.ComboCtrl_ShowPopup(*args, **kwargs) | ShowPopup(self)
Show the popup window. | ShowPopup(self) | [
"ShowPopup",
"(",
"self",
")"
] | def ShowPopup(*args, **kwargs):
"""
ShowPopup(self)
Show the popup window.
"""
return _combo.ComboCtrl_ShowPopup(*args, **kwargs) | [
"def",
"ShowPopup",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_combo",
".",
"ComboCtrl_ShowPopup",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/combo.py#L132-L138 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/learn/python/learn/estimators/estimator.py | python | BaseEstimator._get_train_ops | (self, features, labels) | Method that builds model graph and returns trainer ops.
Expected to be overridden by sub-classes that require custom support.
Args:
features: `Tensor` or `dict` of `Tensor` objects.
labels: `Tensor` or `dict` of `Tensor` objects.
Returns:
A `ModelFnOps` object. | Method that builds model graph and returns trainer ops. | [
"Method",
"that",
"builds",
"model",
"graph",
"and",
"returns",
"trainer",
"ops",
"."
] | def _get_train_ops(self, features, labels):
"""Method that builds model graph and returns trainer ops.
Expected to be overridden by sub-classes that require custom support.
Args:
features: `Tensor` or `dict` of `Tensor` objects.
labels: `Tensor` or `dict` of `Tensor` objects.
Returns:
... | [
"def",
"_get_train_ops",
"(",
"self",
",",
"features",
",",
"labels",
")",
":",
"pass"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/learn/python/learn/estimators/estimator.py#L701-L713 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/email/__init__.py | python | message_from_file | (fp, *args, **kws) | return Parser(*args, **kws).parse(fp) | Read a file and parse its contents into a Message object model.
Optional _class and strict are passed to the Parser constructor. | Read a file and parse its contents into a Message object model. | [
"Read",
"a",
"file",
"and",
"parse",
"its",
"contents",
"into",
"a",
"Message",
"object",
"model",
"."
] | def message_from_file(fp, *args, **kws):
"""Read a file and parse its contents into a Message object model.
Optional _class and strict are passed to the Parser constructor.
"""
from email.parser import Parser
return Parser(*args, **kws).parse(fp) | [
"def",
"message_from_file",
"(",
"fp",
",",
"*",
"args",
",",
"*",
"*",
"kws",
")",
":",
"from",
"email",
".",
"parser",
"import",
"Parser",
"return",
"Parser",
"(",
"*",
"args",
",",
"*",
"*",
"kws",
")",
".",
"parse",
"(",
"fp",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/email/__init__.py#L48-L54 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/index.py | python | PackageIndex.upload_documentation | (self, metadata, doc_dir) | return self.send_request(request) | Upload documentation to the index.
:param metadata: A :class:`Metadata` instance defining at least a name
and version number for the documentation to be
uploaded.
:param doc_dir: The pathname of the directory which contains the
... | [] | def upload_documentation(self, metadata, doc_dir):
"""
Upload documentation to the index.
:param metadata: A :class:`Metadata` instance defining at least a name
and version number for the documentation to be
uploaded.
:param doc_d... | [
"def",
"upload_documentation",
"(",
"self",
",",
"metadata",
",",
"doc_dir",
")",
":",
"self",
".",
"check_credentials",
"(",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"doc_dir",
")",
":",
"raise",
"DistlibException",
"(",
"'not a directory: %r... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/index.py#L591-L643 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/volumes/fs/operations/versions/auth_metadata.py | python | AuthMetadataManager.subvol_metadata_lock | (self, group_name, subvol_name) | return self._lock(self._subvolume_metadata_path(group_name, subvol_name)) | Return a ContextManager which locks the authorization metadata for
a particular subvolume, and persists a flag to the metadata indicating
that it is currently locked, so that we can detect dirty situations
during recovery.
This lock isn't just to make access to the metadata safe: it's a... | Return a ContextManager which locks the authorization metadata for
a particular subvolume, and persists a flag to the metadata indicating
that it is currently locked, so that we can detect dirty situations
during recovery. | [
"Return",
"a",
"ContextManager",
"which",
"locks",
"the",
"authorization",
"metadata",
"for",
"a",
"particular",
"subvolume",
"and",
"persists",
"a",
"flag",
"to",
"the",
"metadata",
"indicating",
"that",
"it",
"is",
"currently",
"locked",
"so",
"that",
"we",
... | def subvol_metadata_lock(self, group_name, subvol_name):
"""
Return a ContextManager which locks the authorization metadata for
a particular subvolume, and persists a flag to the metadata indicating
that it is currently locked, so that we can detect dirty situations
during recove... | [
"def",
"subvol_metadata_lock",
"(",
"self",
",",
"group_name",
",",
"subvol_name",
")",
":",
"return",
"self",
".",
"_lock",
"(",
"self",
".",
"_subvolume_metadata_path",
"(",
"group_name",
",",
"subvol_name",
")",
")"
] | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/volumes/fs/operations/versions/auth_metadata.py#L166-L180 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/last-day-where-you-can-still-cross.py | python | Solution.latestDayToCross | (self, row, col, cells) | return -1 | :type row: int
:type col: int
:type cells: List[List[int]]
:rtype: int | :type row: int
:type col: int
:type cells: List[List[int]]
:rtype: int | [
":",
"type",
"row",
":",
"int",
":",
"type",
"col",
":",
"int",
":",
"type",
"cells",
":",
"List",
"[",
"List",
"[",
"int",
"]]",
":",
"rtype",
":",
"int"
] | def latestDayToCross(self, row, col, cells):
"""
:type row: int
:type col: int
:type cells: List[List[int]]
:rtype: int
"""
directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]
def index(n, i, j):
return i*n+j
start, end = row*col, row*col+... | [
"def",
"latestDayToCross",
"(",
"self",
",",
"row",
",",
"col",
",",
"cells",
")",
":",
"directions",
"=",
"[",
"(",
"0",
",",
"1",
")",
",",
"(",
"1",
",",
"0",
")",
",",
"(",
"0",
",",
"-",
"1",
")",
",",
"(",
"-",
"1",
",",
"0",
")",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/last-day-where-you-can-still-cross.py#L33-L62 | |
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/mac_tool.py | python | MacTool._InstallResourceRules | (self, resource_rules) | return target_path | Installs ResourceRules.plist from user or SDK into the bundle.
Args:
resource_rules: string, optional, path to the ResourceRules.plist file
to use, default to "${SDKROOT}/ResourceRules.plist"
Returns:
Path to the copy of ResourceRules.plist into the bundle. | Installs ResourceRules.plist from user or SDK into the bundle. | [
"Installs",
"ResourceRules",
".",
"plist",
"from",
"user",
"or",
"SDK",
"into",
"the",
"bundle",
"."
] | def _InstallResourceRules(self, resource_rules):
"""Installs ResourceRules.plist from user or SDK into the bundle.
Args:
resource_rules: string, optional, path to the ResourceRules.plist file
to use, default to "${SDKROOT}/ResourceRules.plist"
Returns:
Path to the copy of ResourceRules... | [
"def",
"_InstallResourceRules",
"(",
"self",
",",
"resource_rules",
")",
":",
"source_path",
"=",
"resource_rules",
"target_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"environ",
"[",
"'BUILT_PRODUCTS_DIR'",
"]",
",",
"os",
".",
"environ",
"[... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/mac_tool.py#L375-L394 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | samples/pySketch/pySketch.py | python | TextObjectValidator.Validate | (self, win) | Validate the contents of the given text control. | Validate the contents of the given text control. | [
"Validate",
"the",
"contents",
"of",
"the",
"given",
"text",
"control",
"."
] | def Validate(self, win):
""" Validate the contents of the given text control.
"""
textCtrl = self.GetWindow()
text = textCtrl.GetValue()
if len(text) == 0:
wx.MessageBox("A text object must contain some text!", "Error")
return False
else:
... | [
"def",
"Validate",
"(",
"self",
",",
"win",
")",
":",
"textCtrl",
"=",
"self",
".",
"GetWindow",
"(",
")",
"text",
"=",
"textCtrl",
".",
"GetValue",
"(",
")",
"if",
"len",
"(",
"text",
")",
"==",
"0",
":",
"wx",
".",
"MessageBox",
"(",
"\"A text ob... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/samples/pySketch/pySketch.py#L3426-L3436 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/feature_column/serialization.py | python | deserialize_feature_columns | (configs, custom_objects=None) | return [
deserialize_feature_column(c, custom_objects, columns_by_name)
for c in configs
] | Deserializes a list of FeatureColumns configs.
Returns a list of FeatureColumns given a list of config dicts acquired by
`serialize_feature_columns`.
Args:
configs: A list of Dicts with the serialization of feature columns acquired
by `serialize_feature_columns`.
custom_objects: A Dict from custom... | Deserializes a list of FeatureColumns configs. | [
"Deserializes",
"a",
"list",
"of",
"FeatureColumns",
"configs",
"."
] | def deserialize_feature_columns(configs, custom_objects=None):
"""Deserializes a list of FeatureColumns configs.
Returns a list of FeatureColumns given a list of config dicts acquired by
`serialize_feature_columns`.
Args:
configs: A list of Dicts with the serialization of feature columns acquired
by... | [
"def",
"deserialize_feature_columns",
"(",
"configs",
",",
"custom_objects",
"=",
"None",
")",
":",
"columns_by_name",
"=",
"{",
"}",
"return",
"[",
"deserialize_feature_column",
"(",
"c",
",",
"custom_objects",
",",
"columns_by_name",
")",
"for",
"c",
"in",
"co... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/feature_column/serialization.py#L164-L186 | |
NREL/EnergyPlus | fadc5973b85c70e8cc923efb69c144e808a26078 | third_party/ssc/jsoncpp/amalgamate.py | python | amalgamate_source | (source_top_dir=None,
target_source_path=None,
header_include_path=None) | Produces amalgamated source.
Parameters:
source_top_dir: top-directory
target_source_path: output .cpp path
header_include_path: generated header path relative to target_source_path. | Produces amalgamated source.
Parameters:
source_top_dir: top-directory
target_source_path: output .cpp path
header_include_path: generated header path relative to target_source_path. | [
"Produces",
"amalgamated",
"source",
".",
"Parameters",
":",
"source_top_dir",
":",
"top",
"-",
"directory",
"target_source_path",
":",
"output",
".",
"cpp",
"path",
"header_include_path",
":",
"generated",
"header",
"path",
"relative",
"to",
"target_source_path",
"... | def amalgamate_source(source_top_dir=None,
target_source_path=None,
header_include_path=None):
"""Produces amalgamated source.
Parameters:
source_top_dir: top-directory
target_source_path: output .cpp path
header_include_path: gen... | [
"def",
"amalgamate_source",
"(",
"source_top_dir",
"=",
"None",
",",
"target_source_path",
"=",
"None",
",",
"header_include_path",
"=",
"None",
")",
":",
"print",
"(",
"\"Amalgamating header...\"",
")",
"header",
"=",
"AmalgamationFile",
"(",
"source_top_dir",
")",... | https://github.com/NREL/EnergyPlus/blob/fadc5973b85c70e8cc923efb69c144e808a26078/third_party/ssc/jsoncpp/amalgamate.py#L55-L131 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | Image_RGBtoHSV | (*args, **kwargs) | return _core_.Image_RGBtoHSV(*args, **kwargs) | Image_RGBtoHSV(Image_RGBValue rgb) -> Image_HSVValue
Converts a color in RGB color space to HSV color space. | Image_RGBtoHSV(Image_RGBValue rgb) -> Image_HSVValue | [
"Image_RGBtoHSV",
"(",
"Image_RGBValue",
"rgb",
")",
"-",
">",
"Image_HSVValue"
] | def Image_RGBtoHSV(*args, **kwargs):
"""
Image_RGBtoHSV(Image_RGBValue rgb) -> Image_HSVValue
Converts a color in RGB color space to HSV color space.
"""
return _core_.Image_RGBtoHSV(*args, **kwargs) | [
"def",
"Image_RGBtoHSV",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Image_RGBtoHSV",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L3830-L3836 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | Brush.IsHatch | (*args, **kwargs) | return _gdi_.Brush_IsHatch(*args, **kwargs) | IsHatch(self) -> bool
Is the current style a hatch type? | IsHatch(self) -> bool | [
"IsHatch",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsHatch(*args, **kwargs):
"""
IsHatch(self) -> bool
Is the current style a hatch type?
"""
return _gdi_.Brush_IsHatch(*args, **kwargs) | [
"def",
"IsHatch",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Brush_IsHatch",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L586-L592 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/learn/python/learn/datasets/synthetic.py | python | _archimedes_spiral | (theta, theta_offset=0., *args, **kwargs) | return x, y | Return Archimedes spiral
Args:
theta: array-like, angles from polar coordinates to be converted
theta_offset: float, angle offset in radians (2*pi = 0) | Return Archimedes spiral | [
"Return",
"Archimedes",
"spiral"
] | def _archimedes_spiral(theta, theta_offset=0., *args, **kwargs):
"""Return Archimedes spiral
Args:
theta: array-like, angles from polar coordinates to be converted
theta_offset: float, angle offset in radians (2*pi = 0)
"""
x, y = theta*np.cos(theta + theta_offset), theta*np.sin(theta + theta_offset)
... | [
"def",
"_archimedes_spiral",
"(",
"theta",
",",
"theta_offset",
"=",
"0.",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"x",
",",
"y",
"=",
"theta",
"*",
"np",
".",
"cos",
"(",
"theta",
"+",
"theta_offset",
")",
",",
"theta",
"*",
"np",
"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/learn/python/learn/datasets/synthetic.py#L158-L169 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/turtle.py | python | TNavigator.home | (self) | Move turtle to the origin - coordinates (0,0).
No arguments.
Move turtle to the origin - coordinates (0,0) and set its
heading to its start-orientation (which depends on mode).
Example (for a Turtle instance named turtle):
>>> turtle.home() | Move turtle to the origin - coordinates (0,0). | [
"Move",
"turtle",
"to",
"the",
"origin",
"-",
"coordinates",
"(",
"0",
"0",
")",
"."
] | def home(self):
"""Move turtle to the origin - coordinates (0,0).
No arguments.
Move turtle to the origin - coordinates (0,0) and set its
heading to its start-orientation (which depends on mode).
Example (for a Turtle instance named turtle):
>>> turtle.home()
"... | [
"def",
"home",
"(",
"self",
")",
":",
"self",
".",
"goto",
"(",
"0",
",",
"0",
")",
"self",
".",
"setheading",
"(",
"0",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/turtle.py#L1778-L1790 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | FontEnumerator_GetEncodings | (*args) | return _gdi_.FontEnumerator_GetEncodings(*args) | FontEnumerator_GetEncodings() -> PyObject | FontEnumerator_GetEncodings() -> PyObject | [
"FontEnumerator_GetEncodings",
"()",
"-",
">",
"PyObject"
] | def FontEnumerator_GetEncodings(*args):
"""FontEnumerator_GetEncodings() -> PyObject"""
return _gdi_.FontEnumerator_GetEncodings(*args) | [
"def",
"FontEnumerator_GetEncodings",
"(",
"*",
"args",
")",
":",
"return",
"_gdi_",
".",
"FontEnumerator_GetEncodings",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L2683-L2685 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/framework/ops.py | python | Graph.graph_def_versions | (self) | return self._graph_def_versions | The GraphDef version information of this graph.
For details on the meaning of each version, see
[`GraphDef`](https://www.tensorflow.org/code/tensorflow/core/framework/graph.proto).
Returns:
A `VersionDef`. | The GraphDef version information of this graph. | [
"The",
"GraphDef",
"version",
"information",
"of",
"this",
"graph",
"."
] | def graph_def_versions(self):
# pylint: disable=line-too-long
"""The GraphDef version information of this graph.
For details on the meaning of each version, see
[`GraphDef`](https://www.tensorflow.org/code/tensorflow/core/framework/graph.proto).
Returns:
A `VersionDef`.
"""
# pylint:... | [
"def",
"graph_def_versions",
"(",
"self",
")",
":",
"# pylint: disable=line-too-long",
"# pylint: enable=line-too-long",
"return",
"self",
".",
"_graph_def_versions"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/framework/ops.py#L2341-L2352 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/sparse/scipy_sparse.py | python | _to_ijv | (ss, row_levels=(0, ), column_levels=(1, ), sort_labels=False) | return values, i_coord, j_coord, i_labels, j_labels | For arbitrary (MultiIndexed) SparseSeries return
(v, i, j, ilabels, jlabels) where (v, (i, j)) is suitable for
passing to scipy.sparse.coo constructor. | For arbitrary (MultiIndexed) SparseSeries return
(v, i, j, ilabels, jlabels) where (v, (i, j)) is suitable for
passing to scipy.sparse.coo constructor. | [
"For",
"arbitrary",
"(",
"MultiIndexed",
")",
"SparseSeries",
"return",
"(",
"v",
"i",
"j",
"ilabels",
"jlabels",
")",
"where",
"(",
"v",
"(",
"i",
"j",
"))",
"is",
"suitable",
"for",
"passing",
"to",
"scipy",
".",
"sparse",
".",
"coo",
"constructor",
... | def _to_ijv(ss, row_levels=(0, ), column_levels=(1, ), sort_labels=False):
""" For arbitrary (MultiIndexed) SparseSeries return
(v, i, j, ilabels, jlabels) where (v, (i, j)) is suitable for
passing to scipy.sparse.coo constructor. """
# index and column levels must be a partition of the index
_check... | [
"def",
"_to_ijv",
"(",
"ss",
",",
"row_levels",
"=",
"(",
"0",
",",
")",
",",
"column_levels",
"=",
"(",
"1",
",",
")",
",",
"sort_labels",
"=",
"False",
")",
":",
"# index and column levels must be a partition of the index",
"_check_is_partition",
"(",
"[",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/sparse/scipy_sparse.py#L22-L88 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_controls.py | python | TreeCtrl.GetPrevVisible | (*args, **kwargs) | return _controls_.TreeCtrl_GetPrevVisible(*args, **kwargs) | GetPrevVisible(self, TreeItemId item) -> TreeItemId | GetPrevVisible(self, TreeItemId item) -> TreeItemId | [
"GetPrevVisible",
"(",
"self",
"TreeItemId",
"item",
")",
"-",
">",
"TreeItemId"
] | def GetPrevVisible(*args, **kwargs):
"""GetPrevVisible(self, TreeItemId item) -> TreeItemId"""
return _controls_.TreeCtrl_GetPrevVisible(*args, **kwargs) | [
"def",
"GetPrevVisible",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TreeCtrl_GetPrevVisible",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L5415-L5417 | |
baidu/AnyQ | d94d450d2aaa5f7ed73424b10aa4539835b97527 | tools/simnet/train/paddle/optimizers/paddle_optimizers.py | python | AdamOptimizer.ops | (self, loss) | Adam optimizer operation | Adam optimizer operation | [
"Adam",
"optimizer",
"operation"
] | def ops(self, loss):
"""
Adam optimizer operation
"""
adam = fluid.optimizer.AdamOptimizer(
self.learning_rate, beta1=self.beta1, beta2=self.beta2, epsilon=self.epsilon)
adam.minimize(loss) | [
"def",
"ops",
"(",
"self",
",",
"loss",
")",
":",
"adam",
"=",
"fluid",
".",
"optimizer",
".",
"AdamOptimizer",
"(",
"self",
".",
"learning_rate",
",",
"beta1",
"=",
"self",
".",
"beta1",
",",
"beta2",
"=",
"self",
".",
"beta2",
",",
"epsilon",
"=",
... | https://github.com/baidu/AnyQ/blob/d94d450d2aaa5f7ed73424b10aa4539835b97527/tools/simnet/train/paddle/optimizers/paddle_optimizers.py#L51-L57 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/requests/cookies.py | python | RequestsCookieJar._find | (self, name, domain=None, path=None) | Requests uses this method internally to get cookie values.
If there are conflicting cookies, _find arbitrarily chooses one.
See _find_no_duplicates if you want an exception thrown if there are
conflicting cookies.
:param name: a string containing name of cookie
:param domain: (... | Requests uses this method internally to get cookie values. | [
"Requests",
"uses",
"this",
"method",
"internally",
"to",
"get",
"cookie",
"values",
"."
] | def _find(self, name, domain=None, path=None):
"""Requests uses this method internally to get cookie values.
If there are conflicting cookies, _find arbitrarily chooses one.
See _find_no_duplicates if you want an exception thrown if there are
conflicting cookies.
:param name: a... | [
"def",
"_find",
"(",
"self",
",",
"name",
",",
"domain",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"for",
"cookie",
"in",
"iter",
"(",
"self",
")",
":",
"if",
"cookie",
".",
"name",
"==",
"name",
":",
"if",
"domain",
"is",
"None",
"or",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/requests/cookies.py#L356-L374 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | ListBox_GetClassDefaultAttributes | (*args, **kwargs) | return _controls_.ListBox_GetClassDefaultAttributes(*args, **kwargs) | ListBox_GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
Get the default attributes for this class. This is useful if you want
to use the same font or colour in your own control as in a standard
control -- which is a much better idea than hard coding specific
colours or... | ListBox_GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes | [
"ListBox_GetClassDefaultAttributes",
"(",
"int",
"variant",
"=",
"WINDOW_VARIANT_NORMAL",
")",
"-",
">",
"VisualAttributes"
] | def ListBox_GetClassDefaultAttributes(*args, **kwargs):
"""
ListBox_GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
Get the default attributes for this class. This is useful if you want
to use the same font or colour in your own control as in a standard
control -- wh... | [
"def",
"ListBox_GetClassDefaultAttributes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ListBox_GetClassDefaultAttributes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L1284-L1299 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/ndlstm/python/lstm1d.py | python | ndlstm_base_unrolled | (inputs, noutput, scope=None, reverse=False) | Run an LSTM, either forward or backward.
This is a 1D LSTM implementation using unrolling and the TensorFlow
LSTM op.
Args:
inputs: input sequence (length, batch_size, ninput)
noutput: depth of output
scope: optional scope name
reverse: run LSTM in reverse
Returns:
Output sequence (length... | Run an LSTM, either forward or backward. | [
"Run",
"an",
"LSTM",
"either",
"forward",
"or",
"backward",
"."
] | def ndlstm_base_unrolled(inputs, noutput, scope=None, reverse=False):
"""Run an LSTM, either forward or backward.
This is a 1D LSTM implementation using unrolling and the TensorFlow
LSTM op.
Args:
inputs: input sequence (length, batch_size, ninput)
noutput: depth of output
scope: optional scope na... | [
"def",
"ndlstm_base_unrolled",
"(",
"inputs",
",",
"noutput",
",",
"scope",
"=",
"None",
",",
"reverse",
"=",
"False",
")",
":",
"with",
"variable_scope",
".",
"variable_scope",
"(",
"scope",
",",
"\"SeqLstmUnrolled\"",
",",
"[",
"inputs",
"]",
")",
":",
"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/ndlstm/python/lstm1d.py#L37-L69 | ||
google-ar/WebARonTango | e86965d2cbc652156b480e0fcf77c716745578cd | chromium/src/gpu/command_buffer/build_gles2_cmd_buffer.py | python | Function.WriteCmdFlag | (self, f) | Writes the cmd cmd_flags constant. | Writes the cmd cmd_flags constant. | [
"Writes",
"the",
"cmd",
"cmd_flags",
"constant",
"."
] | def WriteCmdFlag(self, f):
"""Writes the cmd cmd_flags constant."""
flags = []
# By default trace only at the highest level 3.
trace_level = int(self.GetInfo('trace_level', default = 3))
if trace_level not in xrange(0, 4):
raise KeyError("Unhandled trace_level: %d" % trace_level)
flags.ap... | [
"def",
"WriteCmdFlag",
"(",
"self",
",",
"f",
")",
":",
"flags",
"=",
"[",
"]",
"# By default trace only at the highest level 3.",
"trace_level",
"=",
"int",
"(",
"self",
".",
"GetInfo",
"(",
"'trace_level'",
",",
"default",
"=",
"3",
")",
")",
"if",
"trace_... | https://github.com/google-ar/WebARonTango/blob/e86965d2cbc652156b480e0fcf77c716745578cd/chromium/src/gpu/command_buffer/build_gles2_cmd_buffer.py#L9543-L9558 | ||
ApolloAuto/apollo | 463fb82f9e979d02dcb25044e60931293ab2dba0 | modules/tools/routing/debug_passage_region.py | python | plot_junction | (junction) | Plot junction | Plot junction | [
"Plot",
"junction"
] | def plot_junction(junction):
"""Plot junction"""
plot_region(junction.passage_region, 'red') | [
"def",
"plot_junction",
"(",
"junction",
")",
":",
"plot_region",
"(",
"junction",
".",
"passage_region",
",",
"'red'",
")"
] | https://github.com/ApolloAuto/apollo/blob/463fb82f9e979d02dcb25044e60931293ab2dba0/modules/tools/routing/debug_passage_region.py#L75-L77 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/protobuf/python/google/protobuf/internal/encoder.py | python | MapEncoder | (field_descriptor) | return EncodeField | Encoder for extensions of MessageSet.
Maps always have a wire format like this:
message MapEntry {
key_type key = 1;
value_type value = 2;
}
repeated MapEntry map = N; | Encoder for extensions of MessageSet. | [
"Encoder",
"for",
"extensions",
"of",
"MessageSet",
"."
] | def MapEncoder(field_descriptor):
"""Encoder for extensions of MessageSet.
Maps always have a wire format like this:
message MapEntry {
key_type key = 1;
value_type value = 2;
}
repeated MapEntry map = N;
"""
# Can't look at field_descriptor.message_type._concrete_class because it may
... | [
"def",
"MapEncoder",
"(",
"field_descriptor",
")",
":",
"# Can't look at field_descriptor.message_type._concrete_class because it may",
"# not have been initialized yet.",
"message_type",
"=",
"field_descriptor",
".",
"message_type",
"encode_message",
"=",
"MessageEncoder",
"(",
"f... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/protobuf/python/google/protobuf/internal/encoder.py#L803-L823 | |
OpenLightingProject/ola | d1433a1bed73276fbe55ce18c03b1c208237decc | scripts/enforce_licence.py | python | GetDirectoryLicences | (root_dir) | return licences | Walk the directory tree and determine the licence for each directory. | Walk the directory tree and determine the licence for each directory. | [
"Walk",
"the",
"directory",
"tree",
"and",
"determine",
"the",
"licence",
"for",
"each",
"directory",
"."
] | def GetDirectoryLicences(root_dir):
"""Walk the directory tree and determine the licence for each directory."""
LICENCE_FILE = 'LICENCE'
licences = {}
for dir_name, subdirs, files in os.walk(root_dir):
# skip the root_dir since the licence file is different there
if dir_name == root_dir:
continue... | [
"def",
"GetDirectoryLicences",
"(",
"root_dir",
")",
":",
"LICENCE_FILE",
"=",
"'LICENCE'",
"licences",
"=",
"{",
"}",
"for",
"dir_name",
",",
"subdirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"root_dir",
")",
":",
"# skip the root_dir since the licence fil... | https://github.com/OpenLightingProject/ola/blob/d1433a1bed73276fbe55ce18c03b1c208237decc/scripts/enforce_licence.py#L210-L244 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py | python | RegeneratableOptionParser.add_argument | (self, *args, **kw) | Add an option to the parser.
This accepts the same arguments as ArgumentParser.add_argument, plus the
following:
regenerate: can be set to False to prevent this option from being included
in regeneration.
env_name: name of environment variable that additional values for this
... | Add an option to the parser. | [
"Add",
"an",
"option",
"to",
"the",
"parser",
"."
] | def add_argument(self, *args, **kw):
"""Add an option to the parser.
This accepts the same arguments as ArgumentParser.add_argument, plus the
following:
regenerate: can be set to False to prevent this option from being included
in regeneration.
env_name: name of environmen... | [
"def",
"add_argument",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"env_name",
"=",
"kw",
".",
"pop",
"(",
"\"env_name\"",
",",
"None",
")",
"if",
"\"dest\"",
"in",
"kw",
"and",
"kw",
".",
"pop",
"(",
"\"regenerate\"",
",",
"True"... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py#L279-L308 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/robotsim.py | python | SpherePoser.get | (self) | return _robotsim.SpherePoser_get(self) | r""" | r""" | [
"r"
] | def get(self) ->None:
r"""
"""
return _robotsim.SpherePoser_get(self) | [
"def",
"get",
"(",
"self",
")",
"->",
"None",
":",
"return",
"_robotsim",
".",
"SpherePoser_get",
"(",
"self",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/robotsim.py#L3733-L3736 | |
physercoe/starquant | c00cad64d1de2da05081b3dc320ef264c6295e08 | cppsrc/fmt-5.3.0/support/docopt.py | python | parse_long | (tokens, options) | return [o] | long ::= '--' chars [ ( ' ' | '=' ) chars ] ; | long ::= '--' chars [ ( ' ' | '=' ) chars ] ; | [
"long",
"::",
"=",
"--",
"chars",
"[",
"(",
"|",
"=",
")",
"chars",
"]",
";"
] | def parse_long(tokens, options):
"""long ::= '--' chars [ ( ' ' | '=' ) chars ] ;"""
long, eq, value = tokens.move().partition('=')
assert long.startswith('--')
value = None if eq == value == '' else value
similar = [o for o in options if o.long == long]
if tokens.error is DocoptExit and similar... | [
"def",
"parse_long",
"(",
"tokens",
",",
"options",
")",
":",
"long",
",",
"eq",
",",
"value",
"=",
"tokens",
".",
"move",
"(",
")",
".",
"partition",
"(",
"'='",
")",
"assert",
"long",
".",
"startswith",
"(",
"'--'",
")",
"value",
"=",
"None",
"if... | https://github.com/physercoe/starquant/blob/c00cad64d1de2da05081b3dc320ef264c6295e08/cppsrc/fmt-5.3.0/support/docopt.py#L301-L331 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | registerHTTPPostCallbacks | () | By default, libxml submits HTTP output requests using the
"PUT" method. Calling this method changes the HTTP output
method to use the "POST" method instead. | By default, libxml submits HTTP output requests using the
"PUT" method. Calling this method changes the HTTP output
method to use the "POST" method instead. | [
"By",
"default",
"libxml",
"submits",
"HTTP",
"output",
"requests",
"using",
"the",
"PUT",
"method",
".",
"Calling",
"this",
"method",
"changes",
"the",
"HTTP",
"output",
"method",
"to",
"use",
"the",
"POST",
"method",
"instead",
"."
] | def registerHTTPPostCallbacks():
"""By default, libxml submits HTTP output requests using the
"PUT" method. Calling this method changes the HTTP output
method to use the "POST" method instead. """
libxml2mod.xmlRegisterHTTPPostCallbacks() | [
"def",
"registerHTTPPostCallbacks",
"(",
")",
":",
"libxml2mod",
".",
"xmlRegisterHTTPPostCallbacks",
"(",
")"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L1129-L1133 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/training/monitored_session.py | python | _HookedSession._call_hook_before_run | (self, run_context, fetch_dict, user_feed_dict,
options) | return hook_feeds | Calls hooks.before_run and handles requests from hooks. | Calls hooks.before_run and handles requests from hooks. | [
"Calls",
"hooks",
".",
"before_run",
"and",
"handles",
"requests",
"from",
"hooks",
"."
] | def _call_hook_before_run(self, run_context, fetch_dict, user_feed_dict,
options):
"""Calls hooks.before_run and handles requests from hooks."""
hook_feeds = {}
for hook in self._hooks:
request = hook.before_run(run_context)
if request is not None:
if request.... | [
"def",
"_call_hook_before_run",
"(",
"self",
",",
"run_context",
",",
"fetch_dict",
",",
"user_feed_dict",
",",
"options",
")",
":",
"hook_feeds",
"=",
"{",
"}",
"for",
"hook",
"in",
"self",
".",
"_hooks",
":",
"request",
"=",
"hook",
".",
"before_run",
"(... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/training/monitored_session.py#L1133-L1160 | |
apache/qpid-proton | 6bcdfebb55ea3554bc29b1901422532db331a591 | python/proton/_events.py | python | EventBase.handler | (self) | return None | The handler for this event type. Not implemented, always returns ``None``.
:type: ``None`` | The handler for this event type. Not implemented, always returns ``None``. | [
"The",
"handler",
"for",
"this",
"event",
"type",
".",
"Not",
"implemented",
"always",
"returns",
"None",
"."
] | def handler(self):
"""
The handler for this event type. Not implemented, always returns ``None``.
:type: ``None``
"""
return None | [
"def",
"handler",
"(",
"self",
")",
":",
"return",
"None"
] | https://github.com/apache/qpid-proton/blob/6bcdfebb55ea3554bc29b1901422532db331a591/python/proton/_events.py#L144-L150 | |
xenia-project/xenia | 9b1fdac98665ac091b9660a5d0fbb259ed79e578 | third_party/google-styleguide/cpplint/cpplint.py | python | FileInfo.Split | (self) | return (project,) + os.path.splitext(rest) | Splits the file into the directory, basename, and extension.
For 'chrome/browser/browser.cc', Split() would
return ('chrome/browser', 'browser', '.cc')
Returns:
A tuple of (directory, basename, extension). | Splits the file into the directory, basename, and extension. | [
"Splits",
"the",
"file",
"into",
"the",
"directory",
"basename",
"and",
"extension",
"."
] | def Split(self):
"""Splits the file into the directory, basename, and extension.
For 'chrome/browser/browser.cc', Split() would
return ('chrome/browser', 'browser', '.cc')
Returns:
A tuple of (directory, basename, extension).
"""
googlename = self.RepositoryName()
project, rest = os... | [
"def",
"Split",
"(",
"self",
")",
":",
"googlename",
"=",
"self",
".",
"RepositoryName",
"(",
")",
"project",
",",
"rest",
"=",
"os",
".",
"path",
".",
"split",
"(",
"googlename",
")",
"return",
"(",
"project",
",",
")",
"+",
"os",
".",
"path",
"."... | https://github.com/xenia-project/xenia/blob/9b1fdac98665ac091b9660a5d0fbb259ed79e578/third_party/google-styleguide/cpplint/cpplint.py#L920-L932 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/Input/InputFileEditorPlugin.py | python | InputFileEditorPlugin.onCurrentChanged | (self, index) | This is called when the tab is changed.
If the block editor window is open we want to raise it
to the front so it doesn't get lost. | This is called when the tab is changed.
If the block editor window is open we want to raise it
to the front so it doesn't get lost. | [
"This",
"is",
"called",
"when",
"the",
"tab",
"is",
"changed",
".",
"If",
"the",
"block",
"editor",
"window",
"is",
"open",
"we",
"want",
"to",
"raise",
"it",
"to",
"the",
"front",
"so",
"it",
"doesn",
"t",
"get",
"lost",
"."
] | def onCurrentChanged(self, index):
"""
This is called when the tab is changed.
If the block editor window is open we want to raise it
to the front so it doesn't get lost.
"""
if index == self._index:
if self.block_editor:
self.block_editor.rais... | [
"def",
"onCurrentChanged",
"(",
"self",
",",
"index",
")",
":",
"if",
"index",
"==",
"self",
".",
"_index",
":",
"if",
"self",
".",
"block_editor",
":",
"self",
".",
"block_editor",
".",
"raise_",
"(",
")"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/Input/InputFileEditorPlugin.py#L195-L203 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/tkMessageBox.py | python | askretrycancel | (title=None, message=None, **options) | return s == RETRY | Ask if operation should be retried; return true if the answer is yes | Ask if operation should be retried; return true if the answer is yes | [
"Ask",
"if",
"operation",
"should",
"be",
"retried",
";",
"return",
"true",
"if",
"the",
"answer",
"is",
"yes"
] | def askretrycancel(title=None, message=None, **options):
"Ask if operation should be retried; return true if the answer is yes"
s = _show(title, message, WARNING, RETRYCANCEL, **options)
return s == RETRY | [
"def",
"askretrycancel",
"(",
"title",
"=",
"None",
",",
"message",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"s",
"=",
"_show",
"(",
"title",
",",
"message",
",",
"WARNING",
",",
"RETRYCANCEL",
",",
"*",
"*",
"options",
")",
"return",
"s",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/tkMessageBox.py#L116-L119 | |
thunil/tempoGAN | a9b92181e28a82c2029049791f875a6c1341d62b | tensorflow/tools/fluiddataloader.py | python | FluidDataLoader.mogrifyFilenameIndex | (self, fn, idxOffset) | return fn | Parse, determine index, and change | Parse, determine index, and change | [
"Parse",
"determine",
"index",
"and",
"change"
] | def mogrifyFilenameIndex(self, fn, idxOffset):
""" Parse, determine index, and change
"""
match = re.search("(.*_)([\d]+)\.([\w]+)", fn) # split into groups: path/name_ , %04d , ext
if match:
if len(match.groups())!=3:
raise FluidDataLoaderError("FluidDataLoader error: got filename %s, but could not ful... | [
"def",
"mogrifyFilenameIndex",
"(",
"self",
",",
"fn",
",",
"idxOffset",
")",
":",
"match",
"=",
"re",
".",
"search",
"(",
"\"(.*_)([\\d]+)\\.([\\w]+)\"",
",",
"fn",
")",
"# split into groups: path/name_ , %04d , ext",
"if",
"match",
":",
"if",
"len",
"(",
"matc... | https://github.com/thunil/tempoGAN/blob/a9b92181e28a82c2029049791f875a6c1341d62b/tensorflow/tools/fluiddataloader.py#L279-L297 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/fancy-sequence.py | python | Fancy.addAll | (self, inc) | :type inc: int
:rtype: None | :type inc: int
:rtype: None | [
":",
"type",
"inc",
":",
"int",
":",
"rtype",
":",
"None"
] | def addAll(self, inc):
"""
:type inc: int
:rtype: None
"""
self.__ops[-1][1] = (self.__ops[-1][1]+inc) % MOD | [
"def",
"addAll",
"(",
"self",
",",
"inc",
")",
":",
"self",
".",
"__ops",
"[",
"-",
"1",
"]",
"[",
"1",
"]",
"=",
"(",
"self",
".",
"__ops",
"[",
"-",
"1",
"]",
"[",
"1",
"]",
"+",
"inc",
")",
"%",
"MOD"
] | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/fancy-sequence.py#L20-L25 | ||
baidu/lac | 3e10dbed9bfd87bea927c84a6627a167c17b5617 | python/LAC/models.py | python | Model.train | (self, model_save_dir, train_data, test_data, iter_num, thread_num) | 执行模型增量训练
Args:
model_save_dir: 训练结束后模型保存的路径
train_data: 训练数据路径
test_data: 测试数据路径,若为None则不进行测试
iter_num: 训练数据的迭代次数
thread_num: 执行训练的线程数 | 执行模型增量训练
Args:
model_save_dir: 训练结束后模型保存的路径
train_data: 训练数据路径
test_data: 测试数据路径,若为None则不进行测试
iter_num: 训练数据的迭代次数
thread_num: 执行训练的线程数 | [
"执行模型增量训练",
"Args",
":",
"model_save_dir",
":",
"训练结束后模型保存的路径",
"train_data",
":",
"训练数据路径",
"test_data",
":",
"测试数据路径,若为None则不进行测试",
"iter_num",
":",
"训练数据的迭代次数",
"thread_num",
":",
"执行训练的线程数"
] | def train(self, model_save_dir, train_data, test_data, iter_num, thread_num):
"""执行模型增量训练
Args:
model_save_dir: 训练结束后模型保存的路径
train_data: 训练数据路径
test_data: 测试数据路径,若为None则不进行测试
iter_num: 训练数据的迭代次数
thread_num: 执行训练的线程数
"""
self.arg... | [
"def",
"train",
"(",
"self",
",",
"model_save_dir",
",",
"train_data",
",",
"test_data",
",",
"iter_num",
",",
"thread_num",
")",
":",
"self",
".",
"args",
".",
"model",
"=",
"self",
".",
"mode",
"self",
".",
"args",
".",
"train_data",
"=",
"train_data",... | https://github.com/baidu/lac/blob/3e10dbed9bfd87bea927c84a6627a167c17b5617/python/LAC/models.py#L177-L210 | ||
evpo/EncryptPad | 156904860aaba8e7e8729b44e269b2992f9fe9f4 | deps/libencryptmsg/configure.py | python | lex_me_harder | (infofile, allowed_groups, allowed_maps, name_val_pairs) | return out | Generic lexer function for info.txt and src/build-data files | Generic lexer function for info.txt and src/build-data files | [
"Generic",
"lexer",
"function",
"for",
"info",
".",
"txt",
"and",
"src",
"/",
"build",
"-",
"data",
"files"
] | def lex_me_harder(infofile, allowed_groups, allowed_maps, name_val_pairs):
"""
Generic lexer function for info.txt and src/build-data files
"""
out = LexResult()
# Format as a nameable Python variable
def py_var(group):
return group.replace(':', '_')
lexer = shlex.shlex(open(infofi... | [
"def",
"lex_me_harder",
"(",
"infofile",
",",
"allowed_groups",
",",
"allowed_maps",
",",
"name_val_pairs",
")",
":",
"out",
"=",
"LexResult",
"(",
")",
"# Format as a nameable Python variable",
"def",
"py_var",
"(",
"group",
")",
":",
"return",
"group",
".",
"r... | https://github.com/evpo/EncryptPad/blob/156904860aaba8e7e8729b44e269b2992f9fe9f4/deps/libencryptmsg/configure.py#L63-L123 | |
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | lldb/examples/python/file_extract.py | python | FileExtract.get_n_uint8 | (self, n, fail_value=0) | Extract "n" uint8_t integers from the binary file at the current file position, returns a list of integers | Extract "n" uint8_t integers from the binary file at the current file position, returns a list of integers | [
"Extract",
"n",
"uint8_t",
"integers",
"from",
"the",
"binary",
"file",
"at",
"the",
"current",
"file",
"position",
"returns",
"a",
"list",
"of",
"integers"
] | def get_n_uint8(self, n, fail_value=0):
'''Extract "n" uint8_t integers from the binary file at the current file position, returns a list of integers'''
s = self.read_size(n)
if s:
return struct.unpack(self.byte_order + ("%u" % n) + 'B', s)
else:
return (fail_valu... | [
"def",
"get_n_uint8",
"(",
"self",
",",
"n",
",",
"fail_value",
"=",
"0",
")",
":",
"s",
"=",
"self",
".",
"read_size",
"(",
"n",
")",
"if",
"s",
":",
"return",
"struct",
".",
"unpack",
"(",
"self",
".",
"byte_order",
"+",
"(",
"\"%u\"",
"%",
"n"... | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/lldb/examples/python/file_extract.py#L172-L178 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | TextBoxAttr.GetClearMode | (*args, **kwargs) | return _richtext.TextBoxAttr_GetClearMode(*args, **kwargs) | GetClearMode(self) -> int | GetClearMode(self) -> int | [
"GetClearMode",
"(",
"self",
")",
"-",
">",
"int"
] | def GetClearMode(*args, **kwargs):
"""GetClearMode(self) -> int"""
return _richtext.TextBoxAttr_GetClearMode(*args, **kwargs) | [
"def",
"GetClearMode",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"TextBoxAttr_GetClearMode",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L592-L594 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.