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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
limbo018/DREAMPlace | 146c3b9fd003d1acd52c96d9fd02e3f0a05154e4 | dreamplace/ops/dct/dct_lee.py | python | idxst | (x, expk, buf, out) | return out.view(x.size()) | compute inverse discrete sine transformation
This is different from ordinary formulation for IDCT III
yk = Im { \sum_{n=0}^{N-1} xn exp(j*pi/(2N)*n*(2k+1)) } | compute inverse discrete sine transformation
This is different from ordinary formulation for IDCT III
yk = Im { \sum_{n=0}^{N-1} xn exp(j*pi/(2N)*n*(2k+1)) } | [
"compute",
"inverse",
"discrete",
"sine",
"transformation",
"This",
"is",
"different",
"from",
"ordinary",
"formulation",
"for",
"IDCT",
"III",
"yk",
"=",
"Im",
"{",
"\\",
"sum_",
"{",
"n",
"=",
"0",
"}",
"^",
"{",
"N",
"-",
"1",
"}",
"xn",
"exp",
"(... | def idxst(x, expk, buf, out):
"""compute inverse discrete sine transformation
This is different from ordinary formulation for IDCT III
yk = Im { \sum_{n=0}^{N-1} xn exp(j*pi/(2N)*n*(2k+1)) }
"""
if x.is_cuda:
dct_cuda.idxst(x.view([-1, x.size(-1)]), expk, buf, out)
else:
dct_cpp.... | [
"def",
"idxst",
"(",
"x",
",",
"expk",
",",
"buf",
",",
"out",
")",
":",
"if",
"x",
".",
"is_cuda",
":",
"dct_cuda",
".",
"idxst",
"(",
"x",
".",
"view",
"(",
"[",
"-",
"1",
",",
"x",
".",
"size",
"(",
"-",
"1",
")",
"]",
")",
",",
"expk"... | https://github.com/limbo018/DREAMPlace/blob/146c3b9fd003d1acd52c96d9fd02e3f0a05154e4/dreamplace/ops/dct/dct_lee.py#L267-L276 | |
Tencent/Pebble | 68315f176d9e328a233ace29b7579a829f89879f | tools/blade/src/blade/blade_platform.py | python | CcFlagsManager._filter_out_invalid_flags | (self, flag_list, language='') | return ret_flag_list | filter the unsupported compliation flags. | filter the unsupported compliation flags. | [
"filter",
"the",
"unsupported",
"compliation",
"flags",
"."
] | def _filter_out_invalid_flags(self, flag_list, language=''):
"""filter the unsupported compliation flags. """
flag_list_var = var_to_list(flag_list)
xlanguage = ''
if language:
xlanguage = '-x' + language
ret_flag_list = []
for flag in flag_list_var:
... | [
"def",
"_filter_out_invalid_flags",
"(",
"self",
",",
"flag_list",
",",
"language",
"=",
"''",
")",
":",
"flag_list_var",
"=",
"var_to_list",
"(",
"flag_list",
")",
"xlanguage",
"=",
"''",
"if",
"language",
":",
"xlanguage",
"=",
"'-x'",
"+",
"language",
"re... | https://github.com/Tencent/Pebble/blob/68315f176d9e328a233ace29b7579a829f89879f/tools/blade/src/blade/blade_platform.py#L180-L193 | |
apache/mesos | 97d9a4063332aae3825d78de71611657e05cf5e2 | support/post-reviews.py | python | main | () | Main function, post commits added to this branch as review requests. | Main function, post commits added to this branch as review requests. | [
"Main",
"function",
"post",
"commits",
"added",
"to",
"this",
"branch",
"as",
"review",
"requests",
"."
] | def main():
"""Main function, post commits added to this branch as review requests."""
# TODO(benh): Make sure this is a git repository, apologize if not.
# Choose 'rbt' if available, otherwise choose 'post-review'.
post_review = None
rbt_command = 'rbt'
# Windows command name must have `cmd` ... | [
"def",
"main",
"(",
")",
":",
"# TODO(benh): Make sure this is a git repository, apologize if not.",
"# Choose 'rbt' if available, otherwise choose 'post-review'.",
"post_review",
"=",
"None",
"rbt_command",
"=",
"'rbt'",
"# Windows command name must have `cmd` extension.",
"if",
"plat... | https://github.com/apache/mesos/blob/97d9a4063332aae3825d78de71611657e05cf5e2/support/post-reviews.py#L91-L435 | ||
RamadhanAmizudin/malware | 2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1 | Fuzzbunch/fuzzbunch/session.py | python | SessionItem.get_name | (self) | return self.name | Get the item name | Get the item name | [
"Get",
"the",
"item",
"name"
] | def get_name(self):
"""Get the item name"""
return self.name | [
"def",
"get_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"name"
] | https://github.com/RamadhanAmizudin/malware/blob/2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1/Fuzzbunch/fuzzbunch/session.py#L138-L140 | |
9miao/CrossApp | 1f5375e061bf69841eb19728598f5ae3f508d620 | tools/bindings-generator/clang/cindex.py | python | CursorKind.is_unexposed | (self) | return conf.lib.clang_isUnexposed(self) | Test if this is an unexposed kind. | Test if this is an unexposed kind. | [
"Test",
"if",
"this",
"is",
"an",
"unexposed",
"kind",
"."
] | def is_unexposed(self):
"""Test if this is an unexposed kind."""
return conf.lib.clang_isUnexposed(self) | [
"def",
"is_unexposed",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_isUnexposed",
"(",
"self",
")"
] | https://github.com/9miao/CrossApp/blob/1f5375e061bf69841eb19728598f5ae3f508d620/tools/bindings-generator/clang/cindex.py#L664-L666 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/shell.py | python | cp | (src, dest) | Copy src to dest | Copy src to dest | [
"Copy",
"src",
"to",
"dest"
] | def cp(src, dest):
""" Copy src to dest """
_shutil.copy2(native(src), native(dest)) | [
"def",
"cp",
"(",
"src",
",",
"dest",
")",
":",
"_shutil",
".",
"copy2",
"(",
"native",
"(",
"src",
")",
",",
"native",
"(",
"dest",
")",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/shell.py#L67-L69 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/debug/cli/base_ui.py | python | BaseUI.register_tab_comp_context | (self, *args, **kwargs) | Wrapper around TabCompletionRegistry.register_tab_comp_context(). | Wrapper around TabCompletionRegistry.register_tab_comp_context(). | [
"Wrapper",
"around",
"TabCompletionRegistry",
".",
"register_tab_comp_context",
"()",
"."
] | def register_tab_comp_context(self, *args, **kwargs):
"""Wrapper around TabCompletionRegistry.register_tab_comp_context()."""
self._tab_completion_registry.register_tab_comp_context(*args, **kwargs) | [
"def",
"register_tab_comp_context",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_tab_completion_registry",
".",
"register_tab_comp_context",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/debug/cli/base_ui.py#L109-L112 | ||
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/viewer/pv/show3d.py | python | Show3D.takeScreenShot | (self) | Save the scene as image.
Todo
----
+ might come in handy to open a dialog where one can choose between
black/white background and white/black axis grid and so on | Save the scene as image. | [
"Save",
"the",
"scene",
"as",
"image",
"."
] | def takeScreenShot(self):
"""
Save the scene as image.
Todo
----
+ might come in handy to open a dialog where one can choose between
black/white background and white/black axis grid and so on
"""
fname = QFileDialog.getSaveFileName(
self, 'Ope... | [
"def",
"takeScreenShot",
"(",
"self",
")",
":",
"fname",
"=",
"QFileDialog",
".",
"getSaveFileName",
"(",
"self",
",",
"'Open File'",
",",
"None",
",",
"\"Image files (*.jpg *.png)\"",
")",
"[",
"0",
"]",
"if",
"fname",
":",
"if",
"not",
"len",
"(",
"fname... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/viewer/pv/show3d.py#L373-L388 | ||
QMCPACK/qmcpack | d0948ab455e38364458740cc8e2239600a14c5cd | nexus/lib/grid_functions.py | python | spheroid_surface_grid_points | (axes,shape=None,cells=None,centered=False,endpoint=None,return_shape=False) | Generation of uniform grids over the surfaces of spheroidal volumes.
Parameters
----------
shape : `array_like, int, optional`
Number of points in the grid in each dimension. The dimension of
the grid is the number of entries in `shape`. Either `shape` or
`cells` must be provid... | Generation of uniform grids over the surfaces of spheroidal volumes. | [
"Generation",
"of",
"uniform",
"grids",
"over",
"the",
"surfaces",
"of",
"spheroidal",
"volumes",
"."
] | def spheroid_surface_grid_points(axes,shape=None,cells=None,centered=False,endpoint=None,return_shape=False):
"""
Generation of uniform grids over the surfaces of spheroidal volumes.
Parameters
----------
shape : `array_like, int, optional`
Number of points in the grid in each dimension. T... | [
"def",
"spheroid_surface_grid_points",
"(",
"axes",
",",
"shape",
"=",
"None",
",",
"cells",
"=",
"None",
",",
"centered",
"=",
"False",
",",
"endpoint",
"=",
"None",
",",
"return_shape",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"axes",
",... | https://github.com/QMCPACK/qmcpack/blob/d0948ab455e38364458740cc8e2239600a14c5cd/nexus/lib/grid_functions.py#L520-L591 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/s3transfer/futures.py | python | TransferCoordinator.add_failure_cleanup | (self, function, *args, **kwargs) | Adds a callback to call upon failure | Adds a callback to call upon failure | [
"Adds",
"a",
"callback",
"to",
"call",
"upon",
"failure"
] | def add_failure_cleanup(self, function, *args, **kwargs):
"""Adds a callback to call upon failure"""
with self._failure_cleanups_lock:
self._failure_cleanups.append(
FunctionContainer(function, *args, **kwargs)) | [
"def",
"add_failure_cleanup",
"(",
"self",
",",
"function",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"self",
".",
"_failure_cleanups_lock",
":",
"self",
".",
"_failure_cleanups",
".",
"append",
"(",
"FunctionContainer",
"(",
"function",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/s3transfer/futures.py#L321-L325 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/webapp2/webapp2_extras/local.py | python | Local.__call__ | (self, proxy) | return LocalProxy(self, proxy) | Creates a proxy for a name. | Creates a proxy for a name. | [
"Creates",
"a",
"proxy",
"for",
"a",
"name",
"."
] | def __call__(self, proxy):
"""Creates a proxy for a name."""
return LocalProxy(self, proxy) | [
"def",
"__call__",
"(",
"self",
",",
"proxy",
")",
":",
"return",
"LocalProxy",
"(",
"self",
",",
"proxy",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/webapp2/webapp2_extras/local.py#L53-L55 | |
lmb-freiburg/ogn | 974f72ef4bf840d6f6693d22d1843a79223e77ce | scripts/cpp_lint.py | python | _NestingState.InnermostClass | (self) | return None | Get class info on the top of the stack.
Returns:
A _ClassInfo object if we are inside a class, or None otherwise. | Get class info on the top of the stack. | [
"Get",
"class",
"info",
"on",
"the",
"top",
"of",
"the",
"stack",
"."
] | def InnermostClass(self):
"""Get class info on the top of the stack.
Returns:
A _ClassInfo object if we are inside a class, or None otherwise.
"""
for i in range(len(self.stack), 0, -1):
classinfo = self.stack[i - 1]
if isinstance(classinfo, _ClassInfo):
return classinfo
r... | [
"def",
"InnermostClass",
"(",
"self",
")",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"stack",
")",
",",
"0",
",",
"-",
"1",
")",
":",
"classinfo",
"=",
"self",
".",
"stack",
"[",
"i",
"-",
"1",
"]",
"if",
"isinstance",
"(",
... | https://github.com/lmb-freiburg/ogn/blob/974f72ef4bf840d6f6693d22d1843a79223e77ce/scripts/cpp_lint.py#L2160-L2170 | |
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | python/mxnet/symbol/symbol.py | python | Symbol.simple_bind | (self, ctx, grad_req='write', type_dict=None, stype_dict=None,
group2ctx=None, shared_arg_names=None, shared_exec=None,
shared_buffer=None, **kwargs) | return executor | Bind current symbol to get an executor, allocate all the arguments needed.
Allows specifying data types.
This function simplifies the binding procedure. You need to specify only input data shapes.
Before binding the executor, the function allocates arguments and auxiliary states
that we... | Bind current symbol to get an executor, allocate all the arguments needed.
Allows specifying data types. | [
"Bind",
"current",
"symbol",
"to",
"get",
"an",
"executor",
"allocate",
"all",
"the",
"arguments",
"needed",
".",
"Allows",
"specifying",
"data",
"types",
"."
] | def simple_bind(self, ctx, grad_req='write', type_dict=None, stype_dict=None,
group2ctx=None, shared_arg_names=None, shared_exec=None,
shared_buffer=None, **kwargs):
"""Bind current symbol to get an executor, allocate all the arguments needed.
Allows specifying da... | [
"def",
"simple_bind",
"(",
"self",
",",
"ctx",
",",
"grad_req",
"=",
"'write'",
",",
"type_dict",
"=",
"None",
",",
"stype_dict",
"=",
"None",
",",
"group2ctx",
"=",
"None",
",",
"shared_arg_names",
"=",
"None",
",",
"shared_exec",
"=",
"None",
",",
"sha... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/symbol/symbol.py#L1254-L1516 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/losses/util.py | python | squeeze_or_expand_dimensions | (y_pred, y_true=None, sample_weight=None) | return y_pred, y_true, sample_weight | Squeeze or expand last dimension if needed.
1. Squeezes last dim of `y_pred` or `y_true` if their rank differs by 1
(using `confusion_matrix.remove_squeezable_dimensions`).
2. Squeezes or expands last dim of `sample_weight` if its rank differs by 1
from the new rank of `y_pred`.
If `sample_weight` is scalar,... | Squeeze or expand last dimension if needed. | [
"Squeeze",
"or",
"expand",
"last",
"dimension",
"if",
"needed",
"."
] | def squeeze_or_expand_dimensions(y_pred, y_true=None, sample_weight=None):
"""Squeeze or expand last dimension if needed.
1. Squeezes last dim of `y_pred` or `y_true` if their rank differs by 1
(using `confusion_matrix.remove_squeezable_dimensions`).
2. Squeezes or expands last dim of `sample_weight` if its ra... | [
"def",
"squeeze_or_expand_dimensions",
"(",
"y_pred",
",",
"y_true",
"=",
"None",
",",
"sample_weight",
"=",
"None",
")",
":",
"y_pred_shape",
"=",
"y_pred",
".",
"shape",
"y_pred_rank",
"=",
"y_pred_shape",
".",
"ndims",
"if",
"y_true",
"is",
"not",
"None",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/losses/util.py#L30-L116 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/commands/install.py | python | reject_location_related_install_options | (requirements, options) | If any location-changing --install-option arguments were passed for
requirements or on the command-line, then show a deprecation warning. | If any location-changing --install-option arguments were passed for
requirements or on the command-line, then show a deprecation warning. | [
"If",
"any",
"location",
"-",
"changing",
"--",
"install",
"-",
"option",
"arguments",
"were",
"passed",
"for",
"requirements",
"or",
"on",
"the",
"command",
"-",
"line",
"then",
"show",
"a",
"deprecation",
"warning",
"."
] | def reject_location_related_install_options(requirements, options):
# type: (List[InstallRequirement], Optional[List[str]]) -> None
"""If any location-changing --install-option arguments were passed for
requirements or on the command-line, then show a deprecation warning.
"""
def format_options(opti... | [
"def",
"reject_location_related_install_options",
"(",
"requirements",
",",
"options",
")",
":",
"# type: (List[InstallRequirement], Optional[List[str]]) -> None",
"def",
"format_options",
"(",
"option_names",
")",
":",
"# type: (Iterable[str]) -> List[str]",
"return",
"[",
"\"--... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/commands/install.py#L657-L696 | ||
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/twitter.py | python | DirectMessage.SetSenderScreenName | (self, sender_screen_name) | Set the unique sender screen name of this direct message.
Args:
sender_screen_name: The unique sender screen name of this direct message | Set the unique sender screen name of this direct message. | [
"Set",
"the",
"unique",
"sender",
"screen",
"name",
"of",
"this",
"direct",
"message",
"."
] | def SetSenderScreenName(self, sender_screen_name):
'''Set the unique sender screen name of this direct message.
Args:
sender_screen_name: The unique sender screen name of this direct message
'''
self._sender_screen_name = sender_screen_name | [
"def",
"SetSenderScreenName",
"(",
"self",
",",
"sender_screen_name",
")",
":",
"self",
".",
"_sender_screen_name",
"=",
"sender_screen_name"
] | https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/twitter.py#L680-L686 | ||
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_ev_parser.py | python | p_optsubs_semi | (p) | optsubs : SEMI | optsubs : SEMI | [
"optsubs",
":",
"SEMI"
] | def p_optsubs_semi(p):
'optsubs : SEMI'
p[0] = Events() | [
"def",
"p_optsubs_semi",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"Events",
"(",
")"
] | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_ev_parser.py#L319-L321 | ||
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | sdhash-ui/cherrypy/lib/httpauth.py | python | calculateNonce | (realm, algorithm = MD5) | return encoder ("%d:%s" % (time.time(), realm)) | This is an auxaliary function that calculates 'nonce' value. It is used
to handle sessions. | This is an auxaliary function that calculates 'nonce' value. It is used
to handle sessions. | [
"This",
"is",
"an",
"auxaliary",
"function",
"that",
"calculates",
"nonce",
"value",
".",
"It",
"is",
"used",
"to",
"handle",
"sessions",
"."
] | def calculateNonce (realm, algorithm = MD5):
"""This is an auxaliary function that calculates 'nonce' value. It is used
to handle sessions."""
global SUPPORTED_ALGORITHM, DIGEST_AUTH_ENCODERS
assert algorithm in SUPPORTED_ALGORITHM
try:
encoder = DIGEST_AUTH_ENCODERS[algorithm]
except ... | [
"def",
"calculateNonce",
"(",
"realm",
",",
"algorithm",
"=",
"MD5",
")",
":",
"global",
"SUPPORTED_ALGORITHM",
",",
"DIGEST_AUTH_ENCODERS",
"assert",
"algorithm",
"in",
"SUPPORTED_ALGORITHM",
"try",
":",
"encoder",
"=",
"DIGEST_AUTH_ENCODERS",
"[",
"algorithm",
"]"... | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/sdhash-ui/cherrypy/lib/httpauth.py#L82-L95 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/sparse_ops.py | python | sparse_to_dense | (sparse_indices,
output_shape,
sparse_values,
default_value=0,
validate_indices=True,
name=None) | return gen_sparse_ops.sparse_to_dense(
sparse_indices,
output_shape,
sparse_values,
default_value=default_value,
validate_indices=validate_indices,
name=name) | Converts a sparse representation into a dense tensor.
Builds an array `dense` with shape `output_shape` such that
```python
# If sparse_indices is scalar
dense[i] = (i == sparse_indices ? sparse_values : default_value)
# If sparse_indices is a vector, then for each i
dense[sparse_indices[i]] = sparse_val... | Converts a sparse representation into a dense tensor. | [
"Converts",
"a",
"sparse",
"representation",
"into",
"a",
"dense",
"tensor",
"."
] | def sparse_to_dense(sparse_indices,
output_shape,
sparse_values,
default_value=0,
validate_indices=True,
name=None):
"""Converts a sparse representation into a dense tensor.
Builds an array `dense` with shape `outpu... | [
"def",
"sparse_to_dense",
"(",
"sparse_indices",
",",
"output_shape",
",",
"sparse_values",
",",
"default_value",
"=",
"0",
",",
"validate_indices",
"=",
"True",
",",
"name",
"=",
"None",
")",
":",
"return",
"gen_sparse_ops",
".",
"sparse_to_dense",
"(",
"sparse... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/sparse_ops.py#L1174-L1226 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | GLGenerator.GetTypeHandler | (self, name) | return self._empty_type_handler | Gets a type info for the given type. | Gets a type info for the given type. | [
"Gets",
"a",
"type",
"info",
"for",
"the",
"given",
"type",
"."
] | def GetTypeHandler(self, name):
"""Gets a type info for the given type."""
if name in self._type_handlers:
return self._type_handlers[name]
return self._empty_type_handler | [
"def",
"GetTypeHandler",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
".",
"_type_handlers",
":",
"return",
"self",
".",
"_type_handlers",
"[",
"name",
"]",
"return",
"self",
".",
"_empty_type_handler"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/gpu/command_buffer/build_gles2_cmd_buffer.py#L5623-L5627 | |
gwaldron/osgearth | 4c521857d59a69743e4a9cedba00afe570f984e8 | src/third_party/tinygltf/deps/cpplint.py | python | _CppLintState.SetCountingStyle | (self, counting_style) | Sets the module's counting options. | Sets the module's counting options. | [
"Sets",
"the",
"module",
"s",
"counting",
"options",
"."
] | def SetCountingStyle(self, counting_style):
"""Sets the module's counting options."""
self.counting = counting_style | [
"def",
"SetCountingStyle",
"(",
"self",
",",
"counting_style",
")",
":",
"self",
".",
"counting",
"=",
"counting_style"
] | https://github.com/gwaldron/osgearth/blob/4c521857d59a69743e4a9cedba00afe570f984e8/src/third_party/tinygltf/deps/cpplint.py#L785-L787 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextParagraphLayoutBox.DoGetStyle | (*args, **kwargs) | return _richtext.RichTextParagraphLayoutBox_DoGetStyle(*args, **kwargs) | DoGetStyle(self, long position, RichTextAttr style, bool combineStyles=True) -> bool | DoGetStyle(self, long position, RichTextAttr style, bool combineStyles=True) -> bool | [
"DoGetStyle",
"(",
"self",
"long",
"position",
"RichTextAttr",
"style",
"bool",
"combineStyles",
"=",
"True",
")",
"-",
">",
"bool"
] | def DoGetStyle(*args, **kwargs):
"""DoGetStyle(self, long position, RichTextAttr style, bool combineStyles=True) -> bool"""
return _richtext.RichTextParagraphLayoutBox_DoGetStyle(*args, **kwargs) | [
"def",
"DoGetStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextParagraphLayoutBox_DoGetStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L1740-L1742 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/cli/profile_analyzer_cli.py | python | ProfileAnalyzer.print_source | (self, args, screen_info=None) | return debugger_cli_common.rich_text_lines_from_rich_line_list(
lines, annotations=output_annotations) | Print a Python source file with line-level profile information.
Args:
args: Command-line arguments, excluding the command prefix, as a list of
str.
screen_info: Optional dict input containing screen information such as
cols.
Returns:
Output text lines as a RichTextLines objec... | Print a Python source file with line-level profile information. | [
"Print",
"a",
"Python",
"source",
"file",
"with",
"line",
"-",
"level",
"profile",
"information",
"."
] | def print_source(self, args, screen_info=None):
"""Print a Python source file with line-level profile information.
Args:
args: Command-line arguments, excluding the command prefix, as a list of
str.
screen_info: Optional dict input containing screen information such as
cols.
Re... | [
"def",
"print_source",
"(",
"self",
",",
"args",
",",
"screen_info",
"=",
"None",
")",
":",
"del",
"screen_info",
"parsed",
"=",
"self",
".",
"_arg_parsers",
"[",
"\"print_source\"",
"]",
".",
"parse_args",
"(",
"args",
")",
"device_name_regex",
"=",
"(",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/cli/profile_analyzer_cli.py#L601-L734 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Environment.py | python | Base.Prepend | (self, **kw) | Prepend values to existing construction variables
in an Environment. | Prepend values to existing construction variables
in an Environment. | [
"Prepend",
"values",
"to",
"existing",
"construction",
"variables",
"in",
"an",
"Environment",
"."
] | def Prepend(self, **kw):
"""Prepend values to existing construction variables
in an Environment.
"""
kw = copy_non_reserved_keywords(kw)
for key, val in kw.items():
# It would be easier on the eyes to write this using
# "continue" statements whenever we fi... | [
"def",
"Prepend",
"(",
"self",
",",
"*",
"*",
"kw",
")",
":",
"kw",
"=",
"copy_non_reserved_keywords",
"(",
"kw",
")",
"for",
"key",
",",
"val",
"in",
"kw",
".",
"items",
"(",
")",
":",
"# It would be easier on the eyes to write this using",
"# \"continue\" st... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Environment.py#L1637-L1700 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/decimal.py | python | Decimal._round_half_up | (self, prec) | Rounds 5 up (away from 0) | Rounds 5 up (away from 0) | [
"Rounds",
"5",
"up",
"(",
"away",
"from",
"0",
")"
] | def _round_half_up(self, prec):
"""Rounds 5 up (away from 0)"""
if self._int[prec] in '56789':
return 1
elif _all_zeros(self._int, prec):
return 0
else:
return -1 | [
"def",
"_round_half_up",
"(",
"self",
",",
"prec",
")",
":",
"if",
"self",
".",
"_int",
"[",
"prec",
"]",
"in",
"'56789'",
":",
"return",
"1",
"elif",
"_all_zeros",
"(",
"self",
".",
"_int",
",",
"prec",
")",
":",
"return",
"0",
"else",
":",
"retur... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/decimal.py#L1753-L1760 | ||
lmb-freiburg/ogn | 974f72ef4bf840d6f6693d22d1843a79223e77ce | python/caffe/draw.py | python | get_pydot_graph | (caffe_net, rankdir, label_edges=True, phase=None) | return pydot_graph | Create a data structure which represents the `caffe_net`.
Parameters
----------
caffe_net : object
rankdir : {'LR', 'TB', 'BT'}
Direction of graph layout.
label_edges : boolean, optional
Label the edges (default is True).
phase : {caffe_pb2.Phase.TRAIN, caffe_pb2.Phase.TEST, Non... | Create a data structure which represents the `caffe_net`. | [
"Create",
"a",
"data",
"structure",
"which",
"represents",
"the",
"caffe_net",
"."
] | def get_pydot_graph(caffe_net, rankdir, label_edges=True, phase=None):
"""Create a data structure which represents the `caffe_net`.
Parameters
----------
caffe_net : object
rankdir : {'LR', 'TB', 'BT'}
Direction of graph layout.
label_edges : boolean, optional
Label the edges (d... | [
"def",
"get_pydot_graph",
"(",
"caffe_net",
",",
"rankdir",
",",
"label_edges",
"=",
"True",
",",
"phase",
"=",
"None",
")",
":",
"pydot_graph",
"=",
"pydot",
".",
"Dot",
"(",
"caffe_net",
".",
"name",
"if",
"caffe_net",
".",
"name",
"else",
"'Net'",
","... | https://github.com/lmb-freiburg/ogn/blob/974f72ef4bf840d6f6693d22d1843a79223e77ce/python/caffe/draw.py#L130-L202 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_random_forest_classifier.py | python | convert | (model, feature_names, target) | return _MLModel(
_convert_tree_ensemble(
model, feature_names, target, mode="classifier", class_labels=model.classes_
)
) | Convert a boosted tree model to protobuf format.
Parameters
----------
decision_tree : RandomForestClassifier
A trained scikit-learn tree model.
feature_names: [str]
Name of the input columns.
target: str
Name of the output column.
Returns
-------
model_spec: ... | Convert a boosted tree model to protobuf format. | [
"Convert",
"a",
"boosted",
"tree",
"model",
"to",
"protobuf",
"format",
"."
] | def convert(model, feature_names, target):
"""Convert a boosted tree model to protobuf format.
Parameters
----------
decision_tree : RandomForestClassifier
A trained scikit-learn tree model.
feature_names: [str]
Name of the input columns.
target: str
Name of the output... | [
"def",
"convert",
"(",
"model",
",",
"feature_names",
",",
"target",
")",
":",
"if",
"not",
"(",
"_HAS_SKLEARN",
")",
":",
"raise",
"RuntimeError",
"(",
"\"scikit-learn not found. scikit-learn conversion API is disabled.\"",
")",
"_sklearn_util",
".",
"check_expected_ty... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_random_forest_classifier.py#L21-L63 | |
Ifsttar/I-Simpa | 2283385f4cac769a92e265edabb9c79cb6c42d03 | currentRelease/SystemScript/graphy/formatters.py | python | AutoLegend | (chart) | Automatically fill out the legend based on series labels. This will only
fill out the legend if is at least one series with a label. | Automatically fill out the legend based on series labels. This will only
fill out the legend if is at least one series with a label. | [
"Automatically",
"fill",
"out",
"the",
"legend",
"based",
"on",
"series",
"labels",
".",
"This",
"will",
"only",
"fill",
"out",
"the",
"legend",
"if",
"is",
"at",
"least",
"one",
"series",
"with",
"a",
"label",
"."
] | def AutoLegend(chart):
"""Automatically fill out the legend based on series labels. This will only
fill out the legend if is at least one series with a label.
"""
chart._show_legend = False
labels = []
for series in chart.data:
if series.label is None:
labels.append('')
else:
labels.app... | [
"def",
"AutoLegend",
"(",
"chart",
")",
":",
"chart",
".",
"_show_legend",
"=",
"False",
"labels",
"=",
"[",
"]",
"for",
"series",
"in",
"chart",
".",
"data",
":",
"if",
"series",
".",
"label",
"is",
"None",
":",
"labels",
".",
"append",
"(",
"''",
... | https://github.com/Ifsttar/I-Simpa/blob/2283385f4cac769a92e265edabb9c79cb6c42d03/currentRelease/SystemScript/graphy/formatters.py#L32-L45 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Misc.unbind_class | (self, className, sequence) | Unbind for a all widgets with bindtag CLASSNAME for event SEQUENCE
all functions. | Unbind for a all widgets with bindtag CLASSNAME for event SEQUENCE
all functions. | [
"Unbind",
"for",
"a",
"all",
"widgets",
"with",
"bindtag",
"CLASSNAME",
"for",
"event",
"SEQUENCE",
"all",
"functions",
"."
] | def unbind_class(self, className, sequence):
"""Unbind for a all widgets with bindtag CLASSNAME for event SEQUENCE
all functions."""
self.tk.call('bind', className , sequence, '') | [
"def",
"unbind_class",
"(",
"self",
",",
"className",
",",
"sequence",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"'bind'",
",",
"className",
",",
"sequence",
",",
"''",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L1062-L1065 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/python-gflags/gflags.py | python | FlagValues.ExtractFilename | (self, flagfile_str) | Returns filename from a flagfile_str of form -[-]flagfile=filename.
The cases of --flagfile foo and -flagfile foo shouldn't be hitting
this function, as they are dealt with in the level above this
function. | Returns filename from a flagfile_str of form -[-]flagfile=filename. | [
"Returns",
"filename",
"from",
"a",
"flagfile_str",
"of",
"form",
"-",
"[",
"-",
"]",
"flagfile",
"=",
"filename",
"."
] | def ExtractFilename(self, flagfile_str):
"""Returns filename from a flagfile_str of form -[-]flagfile=filename.
The cases of --flagfile foo and -flagfile foo shouldn't be hitting
this function, as they are dealt with in the level above this
function.
"""
if flagfile_str.startswith('--flagfile='... | [
"def",
"ExtractFilename",
"(",
"self",
",",
"flagfile_str",
")",
":",
"if",
"flagfile_str",
".",
"startswith",
"(",
"'--flagfile='",
")",
":",
"return",
"os",
".",
"path",
".",
"expanduser",
"(",
"(",
"flagfile_str",
"[",
"(",
"len",
"(",
"'--flagfile='",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/python-gflags/gflags.py#L1538-L1550 | ||
yuxng/PoseCNN | 9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04 | lib/datasets/ycb.py | python | ycb._process_label_image | (self, label_image) | return label_index | change label image to label index | change label image to label index | [
"change",
"label",
"image",
"to",
"label",
"index"
] | def _process_label_image(self, label_image):
"""
change label image to label index
"""
class_colors = self._class_colors
width = label_image.shape[1]
height = label_image.shape[0]
label_index = np.zeros((height, width), dtype=np.float32)
# label image is ... | [
"def",
"_process_label_image",
"(",
"self",
",",
"label_image",
")",
":",
"class_colors",
"=",
"self",
".",
"_class_colors",
"width",
"=",
"label_image",
".",
"shape",
"[",
"1",
"]",
"height",
"=",
"label_image",
".",
"shape",
"[",
"0",
"]",
"label_index",
... | https://github.com/yuxng/PoseCNN/blob/9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04/lib/datasets/ycb.py#L242-L259 | |
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/urllib3/connection.py | python | HTTPConnection._new_conn | (self) | return conn | Establish a socket connection and set nodelay settings on it.
:return: New socket connection. | Establish a socket connection and set nodelay settings on it. | [
"Establish",
"a",
"socket",
"connection",
"and",
"set",
"nodelay",
"settings",
"on",
"it",
"."
] | def _new_conn(self):
""" Establish a socket connection and set nodelay settings on it.
:return: New socket connection.
"""
extra_kw = {}
if self.source_address:
extra_kw['source_address'] = self.source_address
if self.socket_options:
extra_kw['so... | [
"def",
"_new_conn",
"(",
"self",
")",
":",
"extra_kw",
"=",
"{",
"}",
"if",
"self",
".",
"source_address",
":",
"extra_kw",
"[",
"'source_address'",
"]",
"=",
"self",
".",
"source_address",
"if",
"self",
".",
"socket_options",
":",
"extra_kw",
"[",
"'socke... | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/urllib3/connection.py#L145-L170 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/tools/jinja2/sandbox.py | python | safe_range | (*args) | return rng | A range that can't generate ranges with a length of more than
MAX_RANGE items. | A range that can't generate ranges with a length of more than
MAX_RANGE items. | [
"A",
"range",
"that",
"can",
"t",
"generate",
"ranges",
"with",
"a",
"length",
"of",
"more",
"than",
"MAX_RANGE",
"items",
"."
] | def safe_range(*args):
"""A range that can't generate ranges with a length of more than
MAX_RANGE items.
"""
rng = range(*args)
if len(rng) > MAX_RANGE:
raise OverflowError('range too big, maximum size for range is %d' %
MAX_RANGE)
return rng | [
"def",
"safe_range",
"(",
"*",
"args",
")",
":",
"rng",
"=",
"range",
"(",
"*",
"args",
")",
"if",
"len",
"(",
"rng",
")",
">",
"MAX_RANGE",
":",
"raise",
"OverflowError",
"(",
"'range too big, maximum size for range is %d'",
"%",
"MAX_RANGE",
")",
"return",... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/tools/jinja2/sandbox.py#L147-L155 | |
acristoffers/CEF3SimpleSample | d92baf53a9954996a87c81a675202ccdde126527 | CEF3SimpleSample/Mac/tools/change_mach_o_flags.py | python | ReadMachHeader | (file, endian) | return magic, cputype, cpusubtype, filetype, ncmds, sizeofcmds, flags | Reads an entire |mach_header| structure (<mach-o/loader.h>) from the
file-like |file| object, treating it as having endianness specified by
|endian| (per the |struct| module), and returns a 7-tuple of its members
as numbers. Raises a MachOError if the proper length of data can't be read
from |file|. | Reads an entire |mach_header| structure (<mach-o/loader.h>) from the
file-like |file| object, treating it as having endianness specified by
|endian| (per the |struct| module), and returns a 7-tuple of its members
as numbers. Raises a MachOError if the proper length of data can't be read
from |file|. | [
"Reads",
"an",
"entire",
"|mach_header|",
"structure",
"(",
"<mach",
"-",
"o",
"/",
"loader",
".",
"h",
">",
")",
"from",
"the",
"file",
"-",
"like",
"|file|",
"object",
"treating",
"it",
"as",
"having",
"endianness",
"specified",
"by",
"|endian|",
"(",
... | def ReadMachHeader(file, endian):
"""Reads an entire |mach_header| structure (<mach-o/loader.h>) from the
file-like |file| object, treating it as having endianness specified by
|endian| (per the |struct| module), and returns a 7-tuple of its members
as numbers. Raises a MachOError if the proper length of data c... | [
"def",
"ReadMachHeader",
"(",
"file",
",",
"endian",
")",
":",
"bytes",
"=",
"CheckedRead",
"(",
"file",
",",
"28",
")",
"magic",
",",
"cputype",
",",
"cpusubtype",
",",
"filetype",
",",
"ncmds",
",",
"sizeofcmds",
",",
"flags",
"=",
"struct",
".",
"un... | https://github.com/acristoffers/CEF3SimpleSample/blob/d92baf53a9954996a87c81a675202ccdde126527/CEF3SimpleSample/Mac/tools/change_mach_o_flags.py#L137-L148 | |
MIT-SPARK/Kimera-VIO | 641576fd86bdecbd663b4db3cb068f49502f3a2c | scripts/kalibr/kalibr_params_to_kimera_vio_params.py | python | main | () | Parse arguments and run everything. | Parse arguments and run everything. | [
"Parse",
"arguments",
"and",
"run",
"everything",
"."
] | def main():
"""Parse arguments and run everything."""
logging.basicConfig(
format="%(levelname)s [%(asctime)s]: %(message)s",
datefmt="%m/%d/%Y %I:%M:%S %p",
)
args = get_args()
input_files_valid = verify_args(args)
if input_files_valid:
kalibr_camera, kalibr_imu = load... | [
"def",
"main",
"(",
")",
":",
"logging",
".",
"basicConfig",
"(",
"format",
"=",
"\"%(levelname)s [%(asctime)s]: %(message)s\"",
",",
"datefmt",
"=",
"\"%m/%d/%Y %I:%M:%S %p\"",
",",
")",
"args",
"=",
"get_args",
"(",
")",
"input_files_valid",
"=",
"verify_args",
... | https://github.com/MIT-SPARK/Kimera-VIO/blob/641576fd86bdecbd663b4db3cb068f49502f3a2c/scripts/kalibr/kalibr_params_to_kimera_vio_params.py#L280-L325 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/compiler_machinery.py | python | PassManager.__init__ | (self, pipeline_name) | Create a new pipeline with name "pipeline_name" | Create a new pipeline with name "pipeline_name" | [
"Create",
"a",
"new",
"pipeline",
"with",
"name",
"pipeline_name"
] | def __init__(self, pipeline_name):
"""
Create a new pipeline with name "pipeline_name"
"""
self.passes = []
self.exec_times = OrderedDict()
self._finalized = False
self._analysis = None
self._print_after = None
self.pipeline_name = pipeline_name | [
"def",
"__init__",
"(",
"self",
",",
"pipeline_name",
")",
":",
"self",
".",
"passes",
"=",
"[",
"]",
"self",
".",
"exec_times",
"=",
"OrderedDict",
"(",
")",
"self",
".",
"_finalized",
"=",
"False",
"self",
".",
"_analysis",
"=",
"None",
"self",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/compiler_machinery.py#L170-L179 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rosmaster/src/rosmaster/validators.py | python | not_none | (param_name) | return validator | Validator that checks that parameter is not None | Validator that checks that parameter is not None | [
"Validator",
"that",
"checks",
"that",
"parameter",
"is",
"not",
"None"
] | def not_none(param_name):
"""Validator that checks that parameter is not None"""
def validator(param, context):
if param is None:
raise ParameterInvalid("ERROR: parameter [%s] must be specified"%param_name)
return param
return validator | [
"def",
"not_none",
"(",
"param_name",
")",
":",
"def",
"validator",
"(",
"param",
",",
"context",
")",
":",
"if",
"param",
"is",
"None",
":",
"raise",
"ParameterInvalid",
"(",
"\"ERROR: parameter [%s] must be specified\"",
"%",
"param_name",
")",
"return",
"para... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rosmaster/src/rosmaster/validators.py#L78-L84 | |
aimerykong/Low-Rank-Bilinear-Pooling | 487eb2c857fd9c95357a5166b0c15ad0fe135b28 | demo3_modelVisualization/vlfeat/docsrc/webdoc.py | python | calcRelURL | (toURL, fromURL) | return urlunparse(("", "", relPath, "", "", toURL.fragment)) | Calculates a relative URL. | Calculates a relative URL. | [
"Calculates",
"a",
"relative",
"URL",
"."
] | def calcRelURL(toURL, fromURL):
"""
Calculates a relative URL.
"""
fromURL = urlparse(fromURL)
toURL = urlparse(toURL)
if not fromURL.scheme == toURL.scheme: return urlunparse(toURL)
if not fromURL.netloc == toURL.netloc: return urlunparse(toURL)
fromPath = fromURL.path.split("/")
... | [
"def",
"calcRelURL",
"(",
"toURL",
",",
"fromURL",
")",
":",
"fromURL",
"=",
"urlparse",
"(",
"fromURL",
")",
"toURL",
"=",
"urlparse",
"(",
"toURL",
")",
"if",
"not",
"fromURL",
".",
"scheme",
"==",
"toURL",
".",
"scheme",
":",
"return",
"urlunparse",
... | https://github.com/aimerykong/Low-Rank-Bilinear-Pooling/blob/487eb2c857fd9c95357a5166b0c15ad0fe135b28/demo3_modelVisualization/vlfeat/docsrc/webdoc.py#L102-L138 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/plugins/Launch/launch/cfgdlg.py | python | OutputPanel.OnCheck | (self, evt) | Handle checkbox events | Handle checkbox events | [
"Handle",
"checkbox",
"events"
] | def OnCheck(self, evt):
"""Handle checkbox events"""
e_id = evt.GetId()
e_val = evt.GetEventObject().GetValue()
cfg = Profile_Get(handlers.CONFIG_KEY, default=dict())
if e_id == ID_AUTOCLEAR:
cfg['autoclear'] = e_val
Profile_Set(handlers.CONFIG_KEY, cfg)
... | [
"def",
"OnCheck",
"(",
"self",
",",
"evt",
")",
":",
"e_id",
"=",
"evt",
".",
"GetId",
"(",
")",
"e_val",
"=",
"evt",
".",
"GetEventObject",
"(",
")",
".",
"GetValue",
"(",
")",
"cfg",
"=",
"Profile_Get",
"(",
"handlers",
".",
"CONFIG_KEY",
",",
"d... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/plugins/Launch/launch/cfgdlg.py#L470-L485 | ||
scribusproject/scribus | 41ec7c775a060912cf251682a8b1437f753f80f4 | codegen/cheetah/Cheetah/CheetahWrapper.py | python | CheetahWrapper._expandSourceFiles | (self, files, recurse, addIextIfMissing) | return files | Calculate source paths from 'files' by applying the
command-line options. | Calculate source paths from 'files' by applying the
command-line options. | [
"Calculate",
"source",
"paths",
"from",
"files",
"by",
"applying",
"the",
"command",
"-",
"line",
"options",
"."
] | def _expandSourceFiles(self, files, recurse, addIextIfMissing):
"""Calculate source paths from 'files' by applying the
command-line options.
"""
C, D, W = self.chatter, self.debug, self.warn
idir = self.opts.idir
iext = self.opts.iext
files = []
for f... | [
"def",
"_expandSourceFiles",
"(",
"self",
",",
"files",
",",
"recurse",
",",
"addIextIfMissing",
")",
":",
"C",
",",
"D",
",",
"W",
"=",
"self",
".",
"chatter",
",",
"self",
".",
"debug",
",",
"self",
".",
"warn",
"idir",
"=",
"self",
".",
"opts",
... | https://github.com/scribusproject/scribus/blob/41ec7c775a060912cf251682a8b1437f753f80f4/codegen/cheetah/Cheetah/CheetahWrapper.py#L423-L453 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/debug/cli/curses_ui.py | python | CursesUI._screen_color_init | (self) | Initialization of screen colors. | Initialization of screen colors. | [
"Initialization",
"of",
"screen",
"colors",
"."
] | def _screen_color_init(self):
"""Initialization of screen colors."""
curses.start_color()
curses.use_default_colors()
self._color_pairs = {}
color_index = 0
# Prepare color pairs.
for fg_color in self._FOREGROUND_COLORS:
for bg_color in self._BACKGROUND_COLORS:
color_index += ... | [
"def",
"_screen_color_init",
"(",
"self",
")",
":",
"curses",
".",
"start_color",
"(",
")",
"curses",
".",
"use_default_colors",
"(",
")",
"self",
".",
"_color_pairs",
"=",
"{",
"}",
"color_index",
"=",
"0",
"# Prepare color pairs.",
"for",
"fg_color",
"in",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/debug/cli/curses_ui.py#L404-L441 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/summary/summary_iterator.py | python | _EventLoggerThread.__init__ | (self, queue, ev_writer, flush_secs) | Creates an _EventLoggerThread.
Args:
queue: A Queue from which to dequeue events.
ev_writer: An event writer. Used to log brain events for
the visualizer.
flush_secs: How often, in seconds, to flush the
pending file to disk. | Creates an _EventLoggerThread. | [
"Creates",
"an",
"_EventLoggerThread",
"."
] | def __init__(self, queue, ev_writer, flush_secs):
"""Creates an _EventLoggerThread.
Args:
queue: A Queue from which to dequeue events.
ev_writer: An event writer. Used to log brain events for
the visualizer.
flush_secs: How often, in seconds, to flush the
pending file to disk.
... | [
"def",
"__init__",
"(",
"self",
",",
"queue",
",",
"ev_writer",
",",
"flush_secs",
")",
":",
"threading",
".",
"Thread",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"daemon",
"=",
"True",
"self",
".",
"_queue",
"=",
"queue",
"self",
".",
"_ev_write... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/summary/summary_iterator.py#L280-L296 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/debug/debug_data.py | python | get_tensor_watch_key | (node_name, output_slot, debug_op) | return "%s:%s" % (get_tensor_name(node_name, output_slot), debug_op) | Get the string representation of a debug watch on a tensor.
Args:
node_name: Name of the node by which the watched tensor is produced, as a
string.
output_slot: Output slot index of the tensor, as an integer.
debug_op: Name of the debug op that is used to watch the tensor, as a
string.
... | Get the string representation of a debug watch on a tensor. | [
"Get",
"the",
"string",
"representation",
"of",
"a",
"debug",
"watch",
"on",
"a",
"tensor",
"."
] | def get_tensor_watch_key(node_name, output_slot, debug_op):
"""Get the string representation of a debug watch on a tensor.
Args:
node_name: Name of the node by which the watched tensor is produced, as a
string.
output_slot: Output slot index of the tensor, as an integer.
debug_op: Name of the d... | [
"def",
"get_tensor_watch_key",
"(",
"node_name",
",",
"output_slot",
",",
"debug_op",
")",
":",
"return",
"\"%s:%s\"",
"%",
"(",
"get_tensor_name",
"(",
"node_name",
",",
"output_slot",
")",
",",
"debug_op",
")"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/debug/debug_data.py#L95-L109 | |
cyberbotics/webots | af7fa7d68dcf7b4550f1f2e132092b41e83698fc | resources/web/server/simulation_server.py | python | update_snapshot | () | Compute a monitoring snapshot. | Compute a monitoring snapshot. | [
"Compute",
"a",
"monitoring",
"snapshot",
"."
] | def update_snapshot():
"""Compute a monitoring snapshot."""
global current_load
global network_sent
global network_received
global cpu_load
global gpu_load_compute
global gpu_load_memory
memory = psutil.virtual_memory()
swap = psutil.swap_memory()
disk = psutil.disk_usage('/')
... | [
"def",
"update_snapshot",
"(",
")",
":",
"global",
"current_load",
"global",
"network_sent",
"global",
"network_received",
"global",
"cpu_load",
"global",
"gpu_load_compute",
"global",
"gpu_load_memory",
"memory",
"=",
"psutil",
".",
"virtual_memory",
"(",
")",
"swap"... | https://github.com/cyberbotics/webots/blob/af7fa7d68dcf7b4550f1f2e132092b41e83698fc/resources/web/server/simulation_server.py#L624-L688 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/data/python/ops/dataset_ops.py | python | _should_unpack_args | (args) | return nest.is_sequence(args) and not isinstance(args, dict) | Returns `True` if `args` should be `*args` when passed to a callable. | Returns `True` if `args` should be `*args` when passed to a callable. | [
"Returns",
"True",
"if",
"args",
"should",
"be",
"*",
"args",
"when",
"passed",
"to",
"a",
"callable",
"."
] | def _should_unpack_args(args):
"""Returns `True` if `args` should be `*args` when passed to a callable."""
return nest.is_sequence(args) and not isinstance(args, dict) | [
"def",
"_should_unpack_args",
"(",
"args",
")",
":",
"return",
"nest",
".",
"is_sequence",
"(",
"args",
")",
"and",
"not",
"isinstance",
"(",
"args",
",",
"dict",
")"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/data/python/ops/dataset_ops.py#L1605-L1607 | |
pybox2d/pybox2d | 09643321fd363f0850087d1bde8af3f4afd82163 | library/Box2D/examples/pgu/gui/button.py | python | Button.__init__ | (self, value=None, **params) | Button constructor, which takes either a string label or widget.
See Widget documentation for additional style parameters. | Button constructor, which takes either a string label or widget.
See Widget documentation for additional style parameters. | [
"Button",
"constructor",
"which",
"takes",
"either",
"a",
"string",
"label",
"or",
"widget",
".",
"See",
"Widget",
"documentation",
"for",
"additional",
"style",
"parameters",
"."
] | def __init__(self, value=None, **params):
"""Button constructor, which takes either a string label or widget.
See Widget documentation for additional style parameters.
"""
params.setdefault('cls', 'button')
_button.__init__(self, **params)
self.value = value | [
"def",
"__init__",
"(",
"self",
",",
"value",
"=",
"None",
",",
"*",
"*",
"params",
")",
":",
"params",
".",
"setdefault",
"(",
"'cls'",
",",
"'button'",
")",
"_button",
".",
"__init__",
"(",
"self",
",",
"*",
"*",
"params",
")",
"self",
".",
"valu... | https://github.com/pybox2d/pybox2d/blob/09643321fd363f0850087d1bde8af3f4afd82163/library/Box2D/examples/pgu/gui/button.py#L62-L70 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/model_selection/_search.py | python | BaseSearchCV.predict_proba | (self, X) | return self.best_estimator_.predict_proba(X) | Call predict_proba on the estimator with the best found parameters.
Only available if ``refit=True`` and the underlying estimator supports
``predict_proba``.
Parameters
-----------
X : indexable, length n_samples
Must fulfill the input assumptions of the
... | Call predict_proba on the estimator with the best found parameters. | [
"Call",
"predict_proba",
"on",
"the",
"estimator",
"with",
"the",
"best",
"found",
"parameters",
"."
] | def predict_proba(self, X):
"""Call predict_proba on the estimator with the best found parameters.
Only available if ``refit=True`` and the underlying estimator supports
``predict_proba``.
Parameters
-----------
X : indexable, length n_samples
Must fulfill t... | [
"def",
"predict_proba",
"(",
"self",
",",
"X",
")",
":",
"self",
".",
"_check_is_fitted",
"(",
"'predict_proba'",
")",
"return",
"self",
".",
"best_estimator_",
".",
"predict_proba",
"(",
"X",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/model_selection/_search.py#L451-L465 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/backend.py | python | learning_phase | () | Returns the learning phase flag.
The learning phase flag is a bool tensor (0 = test, 1 = train)
to be passed as input to any Keras function
that uses a different behavior at train time and test time.
Returns:
Learning phase (scalar integer tensor or Python integer). | Returns the learning phase flag. | [
"Returns",
"the",
"learning",
"phase",
"flag",
"."
] | def learning_phase():
"""Returns the learning phase flag.
The learning phase flag is a bool tensor (0 = test, 1 = train)
to be passed as input to any Keras function
that uses a different behavior at train time and test time.
Returns:
Learning phase (scalar integer tensor or Python integer).
"""
gr... | [
"def",
"learning_phase",
"(",
")",
":",
"graph",
"=",
"ops",
".",
"get_default_graph",
"(",
")",
"if",
"graph",
"is",
"_GRAPH",
":",
"# Don't enter an init_scope for the learning phase if eager execution",
"# is enabled but we're inside the Keras workspace graph.",
"learning_ph... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/backend.py#L265-L297 | ||
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | clang/utils/check_cfc/check_cfc.py | python | add_output_file | (args, output_file) | return args + ['-o', output_file] | Append an output file to args, presuming not already specified. | Append an output file to args, presuming not already specified. | [
"Append",
"an",
"output",
"file",
"to",
"args",
"presuming",
"not",
"already",
"specified",
"."
] | def add_output_file(args, output_file):
"""Append an output file to args, presuming not already specified."""
return args + ['-o', output_file] | [
"def",
"add_output_file",
"(",
"args",
",",
"output_file",
")",
":",
"return",
"args",
"+",
"[",
"'-o'",
",",
"output_file",
"]"
] | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/clang/utils/check_cfc/check_cfc.py#L172-L174 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/commands.py | python | InstallLib.initialize_options | (self) | Prepare for new options | Prepare for new options | [
"Prepare",
"for",
"new",
"options"
] | def initialize_options(self):
""" Prepare for new options """
_install_lib.install_lib.initialize_options(self)
if 'install_lib' in _option_defaults:
for opt_name, default in _option_defaults['install_lib']:
setattr(self, opt_name, default) | [
"def",
"initialize_options",
"(",
"self",
")",
":",
"_install_lib",
".",
"install_lib",
".",
"initialize_options",
"(",
"self",
")",
"if",
"'install_lib'",
"in",
"_option_defaults",
":",
"for",
"opt_name",
",",
"default",
"in",
"_option_defaults",
"[",
"'install_l... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/commands.py#L153-L158 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/fftpack/helper.py | python | rfftfreq | (n, d=1.0) | return (arange(1, n + 1, dtype=int) // 2) / float(n * d) | DFT sample frequencies (for usage with rfft, irfft).
The returned float array contains the frequency bins in
cycles/unit (with zero at the start) given a window length `n` and a
sample spacing `d`::
f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2]/(d*n) if n is even
f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2,n/2... | DFT sample frequencies (for usage with rfft, irfft). | [
"DFT",
"sample",
"frequencies",
"(",
"for",
"usage",
"with",
"rfft",
"irfft",
")",
"."
] | def rfftfreq(n, d=1.0):
"""DFT sample frequencies (for usage with rfft, irfft).
The returned float array contains the frequency bins in
cycles/unit (with zero at the start) given a window length `n` and a
sample spacing `d`::
f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2]/(d*n) if n is even
f = [0,... | [
"def",
"rfftfreq",
"(",
"n",
",",
"d",
"=",
"1.0",
")",
":",
"n",
"=",
"operator",
".",
"index",
"(",
"n",
")",
"if",
"n",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"n = %s is not valid. \"",
"\"n must be a nonnegative integer.\"",
"%",
"n",
")",
"ret... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/fftpack/helper.py#L12-L51 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/frame.py | python | DataFrame.explode | (self, column: Union[str, Tuple]) | return result | Transform each element of a list-like to a row, replicating index values.
.. versionadded:: 0.25.0
Parameters
----------
column : str or tuple
Column to explode.
Returns
-------
DataFrame
Exploded lists to rows of the subset columns;
... | Transform each element of a list-like to a row, replicating index values. | [
"Transform",
"each",
"element",
"of",
"a",
"list",
"-",
"like",
"to",
"a",
"row",
"replicating",
"index",
"values",
"."
] | def explode(self, column: Union[str, Tuple]) -> "DataFrame":
"""
Transform each element of a list-like to a row, replicating index values.
.. versionadded:: 0.25.0
Parameters
----------
column : str or tuple
Column to explode.
Returns
------... | [
"def",
"explode",
"(",
"self",
",",
"column",
":",
"Union",
"[",
"str",
",",
"Tuple",
"]",
")",
"->",
"\"DataFrame\"",
":",
"if",
"not",
"(",
"is_scalar",
"(",
"column",
")",
"or",
"isinstance",
"(",
"column",
",",
"tuple",
")",
")",
":",
"raise",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/frame.py#L6253-L6323 | |
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/tools/gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.GetToolchainEnv | (self, additional_settings=None) | return env | Returns the variables toolchain would set for build steps. | Returns the variables toolchain would set for build steps. | [
"Returns",
"the",
"variables",
"toolchain",
"would",
"set",
"for",
"build",
"steps",
"."
] | def GetToolchainEnv(self, additional_settings=None):
"""Returns the variables toolchain would set for build steps."""
env = self.GetSortedXcodeEnv(additional_settings=additional_settings)
if self.flavor == 'win':
env = self.GetMsvsToolchainEnv(
additional_settings=additional_settings)
re... | [
"def",
"GetToolchainEnv",
"(",
"self",
",",
"additional_settings",
"=",
"None",
")",
":",
"env",
"=",
"self",
".",
"GetSortedXcodeEnv",
"(",
"additional_settings",
"=",
"additional_settings",
")",
"if",
"self",
".",
"flavor",
"==",
"'win'",
":",
"env",
"=",
... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/generator/ninja.py#L1391-L1397 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/control/utils.py | python | Promise.error | (self) | return self._error | Returns a previously set error result, or None if no error
occurred. | Returns a previously set error result, or None if no error
occurred. | [
"Returns",
"a",
"previously",
"set",
"error",
"result",
"or",
"None",
"if",
"no",
"error",
"occurred",
"."
] | def error(self):
"""Returns a previously set error result, or None if no error
occurred."""
return self._error | [
"def",
"error",
"(",
"self",
")",
":",
"return",
"self",
".",
"_error"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/control/utils.py#L248-L251 | |
llvm-mirror/lldb | d01083a850f577b85501a0902b52fd0930de72c7 | third_party/Python/module/pexpect-4.6/pexpect/pty_spawn.py | python | spawn.__interact_writen | (self, fd, data) | This is used by the interact() method. | This is used by the interact() method. | [
"This",
"is",
"used",
"by",
"the",
"interact",
"()",
"method",
"."
] | def __interact_writen(self, fd, data):
'''This is used by the interact() method.
'''
while data != b'' and self.isalive():
n = os.write(fd, data)
data = data[n:] | [
"def",
"__interact_writen",
"(",
"self",
",",
"fd",
",",
"data",
")",
":",
"while",
"data",
"!=",
"b''",
"and",
"self",
".",
"isalive",
"(",
")",
":",
"n",
"=",
"os",
".",
"write",
"(",
"fd",
",",
"data",
")",
"data",
"=",
"data",
"[",
"n",
":"... | https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/third_party/Python/module/pexpect-4.6/pexpect/pty_spawn.py#L770-L776 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/distributed/auto_parallel/reshard.py | python | parse_op_desc | (program, rank_id, op_desc_seq, var_name, reshard_op,
dist_context) | Parse op desc sequence and insert op in the block | Parse op desc sequence and insert op in the block | [
"Parse",
"op",
"desc",
"sequence",
"and",
"insert",
"op",
"in",
"the",
"block"
] | def parse_op_desc(program, rank_id, op_desc_seq, var_name, reshard_op,
dist_context):
"""Parse op desc sequence and insert op in the block"""
global HAS_SENT
global HAS_RECV
global HAS_ALLGATHER
tensor_list = []
partition_tensor_list = []
if rank_id not in op_desc_seq.keys(... | [
"def",
"parse_op_desc",
"(",
"program",
",",
"rank_id",
",",
"op_desc_seq",
",",
"var_name",
",",
"reshard_op",
",",
"dist_context",
")",
":",
"global",
"HAS_SENT",
"global",
"HAS_RECV",
"global",
"HAS_ALLGATHER",
"tensor_list",
"=",
"[",
"]",
"partition_tensor_li... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/auto_parallel/reshard.py#L695-L814 | ||
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/utils/pyparsing.py | python | srange | (s) | r"""Helper to easily define string ranges for use in Word construction. Borrows
syntax from regexp '[]' string range definitions::
srange("[0-9]") -> "0123456789"
srange("[a-z]") -> "abcdefghijklmnopqrstuvwxyz"
srange("[a-z$_]") -> "abcdefghijklmnopqrstuvwxyz$_"
The input string must b... | r"""Helper to easily define string ranges for use in Word construction. Borrows
syntax from regexp '[]' string range definitions::
srange("[0-9]") -> "0123456789"
srange("[a-z]") -> "abcdefghijklmnopqrstuvwxyz"
srange("[a-z$_]") -> "abcdefghijklmnopqrstuvwxyz$_"
The input string must b... | [
"r",
"Helper",
"to",
"easily",
"define",
"string",
"ranges",
"for",
"use",
"in",
"Word",
"construction",
".",
"Borrows",
"syntax",
"from",
"regexp",
"[]",
"string",
"range",
"definitions",
"::",
"srange",
"(",
"[",
"0",
"-",
"9",
"]",
")",
"-",
">",
"0... | def srange(s):
r"""Helper to easily define string ranges for use in Word construction. Borrows
syntax from regexp '[]' string range definitions::
srange("[0-9]") -> "0123456789"
srange("[a-z]") -> "abcdefghijklmnopqrstuvwxyz"
srange("[a-z$_]") -> "abcdefghijklmnopqrstuvwxyz$_"
The ... | [
"def",
"srange",
"(",
"s",
")",
":",
"try",
":",
"return",
"\"\"",
".",
"join",
"(",
"[",
"_expanded",
"(",
"part",
")",
"for",
"part",
"in",
"_reBracketExpr",
".",
"parseString",
"(",
"s",
")",
".",
"body",
"]",
")",
"except",
":",
"return",
"\"\"... | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/utils/pyparsing.py#L3082-L3101 | ||
mickem/nscp | 79f89fdbb6da63f91bc9dedb7aea202fe938f237 | scripts/python/lib/google/protobuf/message.py | python | Message.ParseFromString | (self, serialized) | Like MergeFromString(), except we clear the object first. | Like MergeFromString(), except we clear the object first. | [
"Like",
"MergeFromString",
"()",
"except",
"we",
"clear",
"the",
"object",
"first",
"."
] | def ParseFromString(self, serialized):
"""Like MergeFromString(), except we clear the object first."""
self.Clear()
self.MergeFromString(serialized) | [
"def",
"ParseFromString",
"(",
"self",
",",
"serialized",
")",
":",
"self",
".",
"Clear",
"(",
")",
"self",
".",
"MergeFromString",
"(",
"serialized",
")"
] | https://github.com/mickem/nscp/blob/79f89fdbb6da63f91bc9dedb7aea202fe938f237/scripts/python/lib/google/protobuf/message.py#L176-L179 | ||
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/traci/_vehicle.py | python | VehicleDomain.isStoppedParking | (self, vehID) | return (self.getStopState(vehID) & 2) == 2 | isStoppedParking(string) -> bool
Return whether the vehicle is parking (implies stopped) | isStoppedParking(string) -> bool
Return whether the vehicle is parking (implies stopped) | [
"isStoppedParking",
"(",
"string",
")",
"-",
">",
"bool",
"Return",
"whether",
"the",
"vehicle",
"is",
"parking",
"(",
"implies",
"stopped",
")"
] | def isStoppedParking(self, vehID):
"""isStoppedParking(string) -> bool
Return whether the vehicle is parking (implies stopped)
"""
return (self.getStopState(vehID) & 2) == 2 | [
"def",
"isStoppedParking",
"(",
"self",
",",
"vehID",
")",
":",
"return",
"(",
"self",
".",
"getStopState",
"(",
"vehID",
")",
"&",
"2",
")",
"==",
"2"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/traci/_vehicle.py#L922-L926 | |
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/contrib/imports/mirobridge/mirobridge/mirobridge_interpreter_2_5_2.py | python | MiroInterpreter.do_pause | (self, line) | pause <name> -- Pauses a download by name. | pause <name> -- Pauses a download by name. | [
"pause",
"<name",
">",
"--",
"Pauses",
"a",
"download",
"by",
"name",
"."
] | def do_pause(self, line):
"""pause <name> -- Pauses a download by name."""
if self.selection_type is None:
print "Error: No feed/playlist selected"
return
item = self._find_item(line)
if item is None:
print "No item named %r" % line
return
... | [
"def",
"do_pause",
"(",
"self",
",",
"line",
")",
":",
"if",
"self",
".",
"selection_type",
"is",
"None",
":",
"print",
"\"Error: No feed/playlist selected\"",
"return",
"item",
"=",
"self",
".",
"_find_item",
"(",
"line",
")",
"if",
"item",
"is",
"None",
... | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/contrib/imports/mirobridge/mirobridge/mirobridge_interpreter_2_5_2.py#L638-L650 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/Jinja2/py2/jinja2/parser.py | python | Parser.parse_if | (self) | return result | Parse an if construct. | Parse an if construct. | [
"Parse",
"an",
"if",
"construct",
"."
] | def parse_if(self):
"""Parse an if construct."""
node = result = nodes.If(lineno=self.stream.expect("name:if").lineno)
while 1:
node.test = self.parse_tuple(with_condexpr=False)
node.body = self.parse_statements(("name:elif", "name:else", "name:endif"))
node.e... | [
"def",
"parse_if",
"(",
"self",
")",
":",
"node",
"=",
"result",
"=",
"nodes",
".",
"If",
"(",
"lineno",
"=",
"self",
".",
"stream",
".",
"expect",
"(",
"\"name:if\"",
")",
".",
"lineno",
")",
"while",
"1",
":",
"node",
".",
"test",
"=",
"self",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Jinja2/py2/jinja2/parser.py#L217-L233 | |
stan-dev/math | 5fd79f89933269a4ca4d8dd1fde2a36d53d4768c | lib/benchmark_1.5.1/tools/gbench/report.py | python | color_format | (use_color, fmt_str, *args, **kwargs) | return fmt_str.format(*args, **kwargs) | Return the result of 'fmt_str.format(*args, **kwargs)' after transforming
'args' and 'kwargs' according to the value of 'use_color'. If 'use_color'
is False then all color codes in 'args' and 'kwargs' are replaced with
the empty string. | Return the result of 'fmt_str.format(*args, **kwargs)' after transforming
'args' and 'kwargs' according to the value of 'use_color'. If 'use_color'
is False then all color codes in 'args' and 'kwargs' are replaced with
the empty string. | [
"Return",
"the",
"result",
"of",
"fmt_str",
".",
"format",
"(",
"*",
"args",
"**",
"kwargs",
")",
"after",
"transforming",
"args",
"and",
"kwargs",
"according",
"to",
"the",
"value",
"of",
"use_color",
".",
"If",
"use_color",
"is",
"False",
"then",
"all",
... | def color_format(use_color, fmt_str, *args, **kwargs):
"""
Return the result of 'fmt_str.format(*args, **kwargs)' after transforming
'args' and 'kwargs' according to the value of 'use_color'. If 'use_color'
is False then all color codes in 'args' and 'kwargs' are replaced with
the empty string.
... | [
"def",
"color_format",
"(",
"use_color",
",",
"fmt_str",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"use_color",
"is",
"True",
"or",
"use_color",
"is",
"False",
"if",
"not",
"use_color",
":",
"args",
"=",
"[",
"arg",
"if",
"not",
... | https://github.com/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/lib/benchmark_1.5.1/tools/gbench/report.py#L43-L56 | |
jackaudio/jack2 | 21b293dbc37d42446141a08922cdec0d2550c6a0 | waflib/Task.py | python | Task.__str__ | (self) | return '%s: %s%s%s' % (self.__class__.__name__, src_str, sep, tgt_str) | string to display to the user | string to display to the user | [
"string",
"to",
"display",
"to",
"the",
"user"
] | def __str__(self):
"string to display to the user"
name = self.__class__.__name__
if self.outputs:
if name.endswith(('lib', 'program')) or not self.inputs:
node = self.outputs[0]
return node.path_from(node.ctx.launch_node())
if not (self.inputs or self.outputs):
return self.__class__.__name__
if... | [
"def",
"__str__",
"(",
"self",
")",
":",
"name",
"=",
"self",
".",
"__class__",
".",
"__name__",
"if",
"self",
".",
"outputs",
":",
"if",
"name",
".",
"endswith",
"(",
"(",
"'lib'",
",",
"'program'",
")",
")",
"or",
"not",
"self",
".",
"inputs",
":... | https://github.com/jackaudio/jack2/blob/21b293dbc37d42446141a08922cdec0d2550c6a0/waflib/Task.py#L499-L518 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/minimum-garden-perimeter-to-collect-enough-apples.py | python | Solution3.minimumPerimeter | (self, neededApples) | return 8*left | :type neededApples: int
:rtype: int | :type neededApples: int
:rtype: int | [
":",
"type",
"neededApples",
":",
"int",
":",
"rtype",
":",
"int"
] | def minimumPerimeter(self, neededApples):
"""
:type neededApples: int
:rtype: int
"""
# 2r , 2r-1, ..., r+1, r , r+1, ..., 2*r-1, 2*r
# 2r-1, r-1, 2r-1
# . . .
# . ... | [
"def",
"minimumPerimeter",
"(",
"self",
",",
"neededApples",
")",
":",
"# 2r , 2r-1, ..., r+1, r , r+1, ..., 2*r-1, 2*r",
"# 2r-1, r-1, 2r-1",
"# . . . ",
"# . . . ",
"# .... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/minimum-garden-perimeter-to-collect-enough-apples.py#L83-L122 | |
chromiumembedded/cef | 80caf947f3fe2210e5344713c5281d8af9bdc295 | tools/cefbuilds/cef_json_builder.py | python | cef_json_builder.get_platforms | () | return ('linux32', 'linux64', 'linuxarm', 'linuxarm64', 'macosarm64', 'macosx64',
'windows32', 'windows64', 'windowsarm64') | Returns the list of supported platforms. | Returns the list of supported platforms. | [
"Returns",
"the",
"list",
"of",
"supported",
"platforms",
"."
] | def get_platforms():
""" Returns the list of supported platforms. """
return ('linux32', 'linux64', 'linuxarm', 'linuxarm64', 'macosarm64', 'macosx64',
'windows32', 'windows64', 'windowsarm64') | [
"def",
"get_platforms",
"(",
")",
":",
"return",
"(",
"'linux32'",
",",
"'linux64'",
",",
"'linuxarm'",
",",
"'linuxarm64'",
",",
"'macosarm64'",
",",
"'macosx64'",
",",
"'windows32'",
",",
"'windows64'",
",",
"'windowsarm64'",
")"
] | https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/cefbuilds/cef_json_builder.py#L100-L103 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pkg_resources/_vendor/six.py | python | _add_doc | (func, doc) | Add documentation to a function. | Add documentation to a function. | [
"Add",
"documentation",
"to",
"a",
"function",
"."
] | def _add_doc(func, doc):
"""Add documentation to a function."""
func.__doc__ = doc | [
"def",
"_add_doc",
"(",
"func",
",",
"doc",
")",
":",
"func",
".",
"__doc__",
"=",
"doc"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pkg_resources/_vendor/six.py#L75-L77 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/email/parser.py | python | BytesParser.parsebytes | (self, text, headersonly=False) | return self.parser.parsestr(text, headersonly) | Create a message structure from a byte string.
Returns the root of the message structure. Optional headersonly is a
flag specifying whether to stop parsing after reading the headers or
not. The default is False, meaning it parses the entire contents of
the file. | Create a message structure from a byte string. | [
"Create",
"a",
"message",
"structure",
"from",
"a",
"byte",
"string",
"."
] | def parsebytes(self, text, headersonly=False):
"""Create a message structure from a byte string.
Returns the root of the message structure. Optional headersonly is a
flag specifying whether to stop parsing after reading the headers or
not. The default is False, meaning it parses the e... | [
"def",
"parsebytes",
"(",
"self",
",",
"text",
",",
"headersonly",
"=",
"False",
")",
":",
"text",
"=",
"text",
".",
"decode",
"(",
"'ASCII'",
",",
"errors",
"=",
"'surrogateescape'",
")",
"return",
"self",
".",
"parser",
".",
"parsestr",
"(",
"text",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/email/parser.py#L114-L123 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/gyp/pylib/gyp/generator/android.py | python | AndroidMkWriter.WriteCopies | (self, copies, extra_outputs) | Write Makefile code for any 'copies' from the gyp input.
extra_outputs: a list that will be filled in with any outputs of this action
(used to make other pieces dependent on this action) | Write Makefile code for any 'copies' from the gyp input. | [
"Write",
"Makefile",
"code",
"for",
"any",
"copies",
"from",
"the",
"gyp",
"input",
"."
] | def WriteCopies(self, copies, extra_outputs):
"""Write Makefile code for any 'copies' from the gyp input.
extra_outputs: a list that will be filled in with any outputs of this action
(used to make other pieces dependent on this action)
"""
self.WriteLn("### Genera... | [
"def",
"WriteCopies",
"(",
"self",
",",
"copies",
",",
"extra_outputs",
")",
":",
"self",
".",
"WriteLn",
"(",
"\"### Generated for copy rule.\"",
")",
"variable",
"=",
"make",
".",
"StringToMakefileVariable",
"(",
"self",
".",
"relative_target",
"+",
"\"_copies\"... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/generator/android.py#L459-L499 | ||
MVIG-SJTU/RMPE | 5188c230ec800c12be7369c3619615bc9b020aa4 | scripts/cpp_lint.py | python | _SetFilters | (filters) | Sets the module's error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "whitespace/indent").
Each filter should start with + or -; else we die. | Sets the module's error-message filters. | [
"Sets",
"the",
"module",
"s",
"error",
"-",
"message",
"filters",
"."
] | def _SetFilters(filters):
"""Sets the module's error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "whitespace/indent").
Each filter should start with + or -; else we die.
"""
_cpplint... | [
"def",
"_SetFilters",
"(",
"filters",
")",
":",
"_cpplint_state",
".",
"SetFilters",
"(",
"filters",
")"
] | https://github.com/MVIG-SJTU/RMPE/blob/5188c230ec800c12be7369c3619615bc9b020aa4/scripts/cpp_lint.py#L797-L807 | ||
google/sling | f408a148a06bc2d62e853a292a8ba7266c642839 | python/task/wiki.py | python | WikiWorkflow.wikipedia | (self, dump=None, language=None) | Convert Wikipedia dump to SLING articles and store them in a set of
record files. Returns output resources for articles and redirects. | Convert Wikipedia dump to SLING articles and store them in a set of
record files. Returns output resources for articles and redirects. | [
"Convert",
"Wikipedia",
"dump",
"to",
"SLING",
"articles",
"and",
"store",
"them",
"in",
"a",
"set",
"of",
"record",
"files",
".",
"Returns",
"output",
"resources",
"for",
"articles",
"and",
"redirects",
"."
] | def wikipedia(self, dump=None, language=None):
"""Convert Wikipedia dump to SLING articles and store them in a set of
record files. Returns output resources for articles and redirects."""
if language == None: language = flags.arg.language
if dump == None: dump = self.wikipedia_dump(language)
with se... | [
"def",
"wikipedia",
"(",
"self",
",",
"dump",
"=",
"None",
",",
"language",
"=",
"None",
")",
":",
"if",
"language",
"==",
"None",
":",
"language",
"=",
"flags",
".",
"arg",
".",
"language",
"if",
"dump",
"==",
"None",
":",
"dump",
"=",
"self",
"."... | https://github.com/google/sling/blob/f408a148a06bc2d62e853a292a8ba7266c642839/python/task/wiki.py#L298-L319 | ||
facebook/proxygen | a9ca025af207787815cb01eee1971cd572c7a81e | build/fbcode_builder/getdeps/manifest.py | python | ManifestParser.update_hash | (self, hasher, ctx) | Compute a hash over the configuration for the given
context. The goal is for the hash to change if the config
for that context changes, but not if a change is made to
the config only for a different platform than that expressed
by ctx. The hash is intended to be used to help invalidate... | Compute a hash over the configuration for the given
context. The goal is for the hash to change if the config
for that context changes, but not if a change is made to
the config only for a different platform than that expressed
by ctx. The hash is intended to be used to help invalidate... | [
"Compute",
"a",
"hash",
"over",
"the",
"configuration",
"for",
"the",
"given",
"context",
".",
"The",
"goal",
"is",
"for",
"the",
"hash",
"to",
"change",
"if",
"the",
"config",
"for",
"that",
"context",
"changes",
"but",
"not",
"if",
"a",
"change",
"is",... | def update_hash(self, hasher, ctx):
"""Compute a hash over the configuration for the given
context. The goal is for the hash to change if the config
for that context changes, but not if a change is made to
the config only for a different platform than that expressed
by ctx. The... | [
"def",
"update_hash",
"(",
"self",
",",
"hasher",
",",
"ctx",
")",
":",
"for",
"section",
"in",
"sorted",
"(",
"SCHEMA",
".",
"keys",
"(",
")",
")",
":",
"hasher",
".",
"update",
"(",
"section",
".",
"encode",
"(",
"\"utf-8\"",
")",
")",
"# Note: at ... | https://github.com/facebook/proxygen/blob/a9ca025af207787815cb01eee1971cd572c7a81e/build/fbcode_builder/getdeps/manifest.py#L328-L352 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Spinbox.scan | (self, *args) | return self._getints(
self.tk.call((self._w, 'scan') + args)) or () | Internal function. | Internal function. | [
"Internal",
"function",
"."
] | def scan(self, *args):
"""Internal function."""
return self._getints(
self.tk.call((self._w, 'scan') + args)) or () | [
"def",
"scan",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"self",
".",
"_getints",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"(",
"self",
".",
"_w",
",",
"'scan'",
")",
"+",
"args",
")",
")",
"or",
"(",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py#L3466-L3469 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/training/basic_session_run_hooks.py | python | _HookTimer.reset | (self) | Resets the timer. | Resets the timer. | [
"Resets",
"the",
"timer",
"."
] | def reset(self):
"""Resets the timer."""
pass | [
"def",
"reset",
"(",
"self",
")",
":",
"pass"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/training/basic_session_run_hooks.py#L59-L61 | ||
NVIDIA/nvvl | a94c7493ec9f309cc54acf81a66c62a068a06962 | pytorch1.0/nvvl/dataset.py | python | VideoDataset.set_log_level | (self, level) | Sets the log level from now forward
Parameters
----------
level : string
The log level, one of "debug", "info", "warn", "error", or "none" | Sets the log level from now forward | [
"Sets",
"the",
"log",
"level",
"from",
"now",
"forward"
] | def set_log_level(self, level):
"""Sets the log level from now forward
Parameters
----------
level : string
The log level, one of "debug", "info", "warn", "error", or "none"
"""
self.loader.set_log_level(log_levels[level]) | [
"def",
"set_log_level",
"(",
"self",
",",
"level",
")",
":",
"self",
".",
"loader",
".",
"set_log_level",
"(",
"log_levels",
"[",
"level",
"]",
")"
] | https://github.com/NVIDIA/nvvl/blob/a94c7493ec9f309cc54acf81a66c62a068a06962/pytorch1.0/nvvl/dataset.py#L260-L268 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/cli/ui_factory.py | python | get_ui | (ui_type,
on_ui_exit=None,
available_ui_types=None,
config=None) | Create a `base_ui.BaseUI` subtype.
This factory method attempts to fallback to other available ui_types on
ImportError. For example, if `ui_type` is `curses`, but `curses` cannot be
imported properly, e.g., on Windows, will fallback to `readline`.
Args:
ui_type: (`str`) requested UI type. Currently suppor... | Create a `base_ui.BaseUI` subtype. | [
"Create",
"a",
"base_ui",
".",
"BaseUI",
"subtype",
"."
] | def get_ui(ui_type,
on_ui_exit=None,
available_ui_types=None,
config=None):
"""Create a `base_ui.BaseUI` subtype.
This factory method attempts to fallback to other available ui_types on
ImportError. For example, if `ui_type` is `curses`, but `curses` cannot be
imported properly... | [
"def",
"get_ui",
"(",
"ui_type",
",",
"on_ui_exit",
"=",
"None",
",",
"available_ui_types",
"=",
"None",
",",
"config",
"=",
"None",
")",
":",
"if",
"available_ui_types",
"is",
"None",
":",
"available_ui_types",
"=",
"copy",
".",
"deepcopy",
"(",
"SUPPORTED_... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/cli/ui_factory.py#L26-L71 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/ops/losses_ops.py | python | softmax_classifier | (tensor_in,
labels,
weights,
biases,
class_weight=None,
name=None) | Returns prediction and loss for softmax classifier.
This function returns "probabilities" and a cross entropy loss. To obtain
predictions, use `tf.argmax` on the returned probabilities.
This function requires labels to be passed in one-hot encoding.
Args:
tensor_in: Input tensor, [batch_size, feature_siz... | Returns prediction and loss for softmax classifier. | [
"Returns",
"prediction",
"and",
"loss",
"for",
"softmax",
"classifier",
"."
] | def softmax_classifier(tensor_in,
labels,
weights,
biases,
class_weight=None,
name=None):
"""Returns prediction and loss for softmax classifier.
This function returns "probabilities" and a cross entro... | [
"def",
"softmax_classifier",
"(",
"tensor_in",
",",
"labels",
",",
"weights",
",",
"biases",
",",
"class_weight",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"'softmax_classifier'",
",",
"[",
"tensor... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/ops/losses_ops.py#L49-L80 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | python | _interpretations_class.categorical__list | (self, column_name, output_column_prefix) | return [
_TransformToFlatDictionary(
features=[column_name], output_column_prefix=output_column_prefix
)
] | Interprets a list of categories as a sparse vector. | Interprets a list of categories as a sparse vector. | [
"Interprets",
"a",
"list",
"of",
"categories",
"as",
"a",
"sparse",
"vector",
"."
] | def categorical__list(self, column_name, output_column_prefix):
"""
Interprets a list of categories as a sparse vector.
"""
return [
_TransformToFlatDictionary(
features=[column_name], output_column_prefix=output_column_prefix
)
] | [
"def",
"categorical__list",
"(",
"self",
",",
"column_name",
",",
"output_column_prefix",
")",
":",
"return",
"[",
"_TransformToFlatDictionary",
"(",
"features",
"=",
"[",
"column_name",
"]",
",",
"output_column_prefix",
"=",
"output_column_prefix",
")",
"]"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L344-L353 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/neural_network/rbm.py | python | BernoulliRBM.transform | (self, X) | return self._mean_hiddens(X) | Compute the hidden layer activation probabilities, P(h=1|v=X).
Parameters
----------
X : {array-like, sparse matrix} shape (n_samples, n_features)
The data to be transformed.
Returns
-------
h : array, shape (n_samples, n_components)
Latent repre... | Compute the hidden layer activation probabilities, P(h=1|v=X). | [
"Compute",
"the",
"hidden",
"layer",
"activation",
"probabilities",
"P",
"(",
"h",
"=",
"1|v",
"=",
"X",
")",
"."
] | def transform(self, X):
"""Compute the hidden layer activation probabilities, P(h=1|v=X).
Parameters
----------
X : {array-like, sparse matrix} shape (n_samples, n_features)
The data to be transformed.
Returns
-------
h : array, shape (n_samples, n_c... | [
"def",
"transform",
"(",
"self",
",",
"X",
")",
":",
"check_is_fitted",
"(",
"self",
",",
"\"components_\"",
")",
"X",
"=",
"check_array",
"(",
"X",
",",
"accept_sparse",
"=",
"'csr'",
",",
"dtype",
"=",
"np",
".",
"float64",
")",
"return",
"self",
"."... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/neural_network/rbm.py#L109-L125 | |
stitchEm/stitchEm | 0f399501d41ab77933677f2907f41f80ceb704d7 | lib/bindings/samples/server/glfw.py | python | set_clipboard_string | (window, string) | Sets the clipboard to the specified string.
Wrapper for:
void glfwSetClipboardString(GLFWwindow* window, const char* string); | Sets the clipboard to the specified string. | [
"Sets",
"the",
"clipboard",
"to",
"the",
"specified",
"string",
"."
] | def set_clipboard_string(window, string):
"""
Sets the clipboard to the specified string.
Wrapper for:
void glfwSetClipboardString(GLFWwindow* window, const char* string);
"""
_glfw.glfwSetClipboardString(window, _to_char_p(string)) | [
"def",
"set_clipboard_string",
"(",
"window",
",",
"string",
")",
":",
"_glfw",
".",
"glfwSetClipboardString",
"(",
"window",
",",
"_to_char_p",
"(",
"string",
")",
")"
] | https://github.com/stitchEm/stitchEm/blob/0f399501d41ab77933677f2907f41f80ceb704d7/lib/bindings/samples/server/glfw.py#L1738-L1745 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/ttk.py | python | Widget.state | (self, statespec=None) | return self.tk.splitlist(str(self.tk.call(self._w, "state", statespec))) | Modify or inquire widget state.
Widget state is returned if statespec is None, otherwise it is
set according to the statespec flags and then a new state spec
is returned indicating which flags were changed. statespec is
expected to be a sequence. | Modify or inquire widget state. | [
"Modify",
"or",
"inquire",
"widget",
"state",
"."
] | def state(self, statespec=None):
"""Modify or inquire widget state.
Widget state is returned if statespec is None, otherwise it is
set according to the statespec flags and then a new state spec
is returned indicating which flags were changed. statespec is
expected to be a sequen... | [
"def",
"state",
"(",
"self",
",",
"statespec",
"=",
"None",
")",
":",
"if",
"statespec",
"is",
"not",
"None",
":",
"statespec",
"=",
"' '",
".",
"join",
"(",
"statespec",
")",
"return",
"self",
".",
"tk",
".",
"splitlist",
"(",
"str",
"(",
"self",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/ttk.py#L580-L590 | |
telefonicaid/fiware-orion | 27c3202b9ddcfb9e3635a0af8d373f76e89b1d24 | scripts/cpplint.py | python | CheckSpacingForFunctionCall | (filename, line, linenum, error) | Checks for the correctness of various spacing around function calls.
Args:
filename: The name of the current file.
line: The text of the line to check.
linenum: The number of the line to check.
error: The function to call with any errors found. | Checks for the correctness of various spacing around function calls. | [
"Checks",
"for",
"the",
"correctness",
"of",
"various",
"spacing",
"around",
"function",
"calls",
"."
] | def CheckSpacingForFunctionCall(filename, line, linenum, error):
"""Checks for the correctness of various spacing around function calls.
Args:
filename: The name of the current file.
line: The text of the line to check.
linenum: The number of the line to check.
error: The function to call with any ... | [
"def",
"CheckSpacingForFunctionCall",
"(",
"filename",
",",
"line",
",",
"linenum",
",",
"error",
")",
":",
"# Since function calls often occur inside if/for/while/switch",
"# expressions - which have their own, more liberal conventions - we",
"# first see if we should be looking inside ... | https://github.com/telefonicaid/fiware-orion/blob/27c3202b9ddcfb9e3635a0af8d373f76e89b1d24/scripts/cpplint.py#L1488-L1551 | ||
facebookincubator/BOLT | 88c70afe9d388ad430cc150cc158641701397f70 | clang/tools/scan-build-py/lib/libscanbuild/compilation.py | python | classify_source | (filename, c_compiler=True) | return mapping.get(extension) | Return the language from file name extension. | Return the language from file name extension. | [
"Return",
"the",
"language",
"from",
"file",
"name",
"extension",
"."
] | def classify_source(filename, c_compiler=True):
""" Return the language from file name extension. """
mapping = {
'.c': 'c' if c_compiler else 'c++',
'.i': 'c-cpp-output' if c_compiler else 'c++-cpp-output',
'.ii': 'c++-cpp-output',
'.m': 'objective-c',
'.mi': 'objective... | [
"def",
"classify_source",
"(",
"filename",
",",
"c_compiler",
"=",
"True",
")",
":",
"mapping",
"=",
"{",
"'.c'",
":",
"'c'",
"if",
"c_compiler",
"else",
"'c++'",
",",
"'.i'",
":",
"'c-cpp-output'",
"if",
"c_compiler",
"else",
"'c++-cpp-output'",
",",
"'.ii'... | https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/clang/tools/scan-build-py/lib/libscanbuild/compilation.py#L103-L126 | |
QMCPACK/qmcpack | d0948ab455e38364458740cc8e2239600a14c5cd | utils/afqmctools/afqmctools/hamiltonian/converter.py | python | read_qmcpack_dense | (filename) | return hcore, chol, enuc | Read in integrals from qmcpack hdf5 format.
Parameters
----------
filename : string
File containing integrals in qmcpack format.
Returns
-------
hcore : :class:`numpy.ndarray`
One-body part of the Hamiltonian.
chol_vecs : :class:`numpy.ndarray`
Two-electron integral... | Read in integrals from qmcpack hdf5 format. | [
"Read",
"in",
"integrals",
"from",
"qmcpack",
"hdf5",
"format",
"."
] | def read_qmcpack_dense(filename):
"""Read in integrals from qmcpack hdf5 format.
Parameters
----------
filename : string
File containing integrals in qmcpack format.
Returns
-------
hcore : :class:`numpy.ndarray`
One-body part of the Hamiltonian.
chol_vecs : :class:`num... | [
"def",
"read_qmcpack_dense",
"(",
"filename",
")",
":",
"real_ints",
"=",
"False",
"enuc",
",",
"dims",
",",
"hcore",
",",
"real_ints",
"=",
"read_common_input",
"(",
"filename",
")",
"with",
"h5py",
".",
"File",
"(",
"filename",
",",
"'r'",
")",
"as",
"... | https://github.com/QMCPACK/qmcpack/blob/d0948ab455e38364458740cc8e2239600a14c5cd/utils/afqmctools/afqmctools/hamiltonian/converter.py#L465-L500 | |
stepcode/stepcode | 2a50010e6f6b8bd4843561e48fdb0fd4e8b87f39 | src/exp2python/python/SCL/AggregationDataTypes.py | python | BAG.get_size | (self) | return INTEGER(len(self._container)) | When V is a bag, list or set, the returned value is the actual number of elements in
the aggregate value. | When V is a bag, list or set, the returned value is the actual number of elements in
the aggregate value. | [
"When",
"V",
"is",
"a",
"bag",
"list",
"or",
"set",
"the",
"returned",
"value",
"is",
"the",
"actual",
"number",
"of",
"elements",
"in",
"the",
"aggregate",
"value",
"."
] | def get_size(self):
''' When V is a bag, list or set, the returned value is the actual number of elements in
the aggregate value.'''
return INTEGER(len(self._container)) | [
"def",
"get_size",
"(",
"self",
")",
":",
"return",
"INTEGER",
"(",
"len",
"(",
"self",
".",
"_container",
")",
")"
] | https://github.com/stepcode/stepcode/blob/2a50010e6f6b8bd4843561e48fdb0fd4e8b87f39/src/exp2python/python/SCL/AggregationDataTypes.py#L450-L453 | |
fatih/subvim | 241b6d170597857105da219c9b7d36059e9f11fb | vim/base/YouCompleteMe/third_party/jedi/jedi/evaluate.py | python | follow_call_list | (call_list, follow_array=False) | return set(result) | `call_list` can be either `pr.Array` or `list of list`.
It is used to evaluate a two dimensional object, that has calls, arrays and
operators in it. | `call_list` can be either `pr.Array` or `list of list`.
It is used to evaluate a two dimensional object, that has calls, arrays and
operators in it. | [
"call_list",
"can",
"be",
"either",
"pr",
".",
"Array",
"or",
"list",
"of",
"list",
".",
"It",
"is",
"used",
"to",
"evaluate",
"a",
"two",
"dimensional",
"object",
"that",
"has",
"calls",
"arrays",
"and",
"operators",
"in",
"it",
"."
] | def follow_call_list(call_list, follow_array=False):
"""
`call_list` can be either `pr.Array` or `list of list`.
It is used to evaluate a two dimensional object, that has calls, arrays and
operators in it.
"""
def evaluate_list_comprehension(lc, parent=None):
input = lc.input
nes... | [
"def",
"follow_call_list",
"(",
"call_list",
",",
"follow_array",
"=",
"False",
")",
":",
"def",
"evaluate_list_comprehension",
"(",
"lc",
",",
"parent",
"=",
"None",
")",
":",
"input",
"=",
"lc",
".",
"input",
"nested_lc",
"=",
"lc",
".",
"input",
".",
... | https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/jedi/jedi/evaluate.py#L624-L689 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/dist.py | python | Distribution._finalize_requires | (self) | Set `metadata.python_requires` and fix environment markers
in `install_requires` and `extras_require`. | Set `metadata.python_requires` and fix environment markers
in `install_requires` and `extras_require`. | [
"Set",
"metadata",
".",
"python_requires",
"and",
"fix",
"environment",
"markers",
"in",
"install_requires",
"and",
"extras_require",
"."
] | def _finalize_requires(self):
"""
Set `metadata.python_requires` and fix environment markers
in `install_requires` and `extras_require`.
"""
if getattr(self, 'python_requires', None):
self.metadata.python_requires = self.python_requires
self._convert_extras_re... | [
"def",
"_finalize_requires",
"(",
"self",
")",
":",
"if",
"getattr",
"(",
"self",
",",
"'python_requires'",
",",
"None",
")",
":",
"self",
".",
"metadata",
".",
"python_requires",
"=",
"self",
".",
"python_requires",
"self",
".",
"_convert_extras_requirements",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/dist.py#L368-L376 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/other_ops.py | python | PushWeight.__init__ | (self) | Initialize PushWeight | Initialize PushWeight | [
"Initialize",
"PushWeight"
] | def __init__(self):
"""Initialize PushWeight"""
self.add_prim_attr("primitive_target", "CPU")
self.init_prim_io_names(inputs=["weight", "name", "index"], outputs=["output"]) | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"add_prim_attr",
"(",
"\"primitive_target\"",
",",
"\"CPU\"",
")",
"self",
".",
"init_prim_io_names",
"(",
"inputs",
"=",
"[",
"\"weight\"",
",",
"\"name\"",
",",
"\"index\"",
"]",
",",
"outputs",
"=",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/other_ops.py#L757-L760 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/nn_ops.py | python | softmax_cross_entropy_with_logits | (_sentinel=None, # pylint: disable=invalid-name
labels=None, logits=None,
dim=-1, name=None) | Computes softmax cross entropy between `logits` and `labels`.
Measures the probability error in discrete classification tasks in which the
classes are mutually exclusive (each entry is in exactly one class). For
example, each CIFAR-10 image is labeled with one and only one label: an image
can be a dog or a tr... | Computes softmax cross entropy between `logits` and `labels`. | [
"Computes",
"softmax",
"cross",
"entropy",
"between",
"logits",
"and",
"labels",
"."
] | def softmax_cross_entropy_with_logits(_sentinel=None, # pylint: disable=invalid-name
labels=None, logits=None,
dim=-1, name=None):
"""Computes softmax cross entropy between `logits` and `labels`.
Measures the probability error in discrete... | [
"def",
"softmax_cross_entropy_with_logits",
"(",
"_sentinel",
"=",
"None",
",",
"# pylint: disable=invalid-name",
"labels",
"=",
"None",
",",
"logits",
"=",
"None",
",",
"dim",
"=",
"-",
"1",
",",
"name",
"=",
"None",
")",
":",
"_ensure_xent_args",
"(",
"\"sof... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/nn_ops.py#L1517-L1614 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/_abcoll.py | python | MutableSet.clear | (self) | This is slow (creates N new iterators!) but effective. | This is slow (creates N new iterators!) but effective. | [
"This",
"is",
"slow",
"(",
"creates",
"N",
"new",
"iterators!",
")",
"but",
"effective",
"."
] | def clear(self):
"""This is slow (creates N new iterators!) but effective."""
try:
while True:
self.pop()
except KeyError:
pass | [
"def",
"clear",
"(",
"self",
")",
":",
"try",
":",
"while",
"True",
":",
"self",
".",
"pop",
"(",
")",
"except",
"KeyError",
":",
"pass"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/_abcoll.py#L320-L326 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/mozbuild/mozpack/mozjar.py | python | JarLog.canonicalize | (url) | The jar path is stored in a MOZ_JAR_LOG_FILE log as a url. This method
returns a unique value corresponding to such urls.
- file:///{path} becomes {path}
- jar:file:///{path}!/{subpath} becomes ({path}, {subpath})
- jar:jar:file:///{path}!/{subpath}!/{subpath2} becomes
({path}... | The jar path is stored in a MOZ_JAR_LOG_FILE log as a url. This method
returns a unique value corresponding to such urls.
- file:///{path} becomes {path}
- jar:file:///{path}!/{subpath} becomes ({path}, {subpath})
- jar:jar:file:///{path}!/{subpath}!/{subpath2} becomes
({path}... | [
"The",
"jar",
"path",
"is",
"stored",
"in",
"a",
"MOZ_JAR_LOG_FILE",
"log",
"as",
"a",
"url",
".",
"This",
"method",
"returns",
"a",
"unique",
"value",
"corresponding",
"to",
"such",
"urls",
".",
"-",
"file",
":",
"///",
"{",
"path",
"}",
"becomes",
"{... | def canonicalize(url):
'''
The jar path is stored in a MOZ_JAR_LOG_FILE log as a url. This method
returns a unique value corresponding to such urls.
- file:///{path} becomes {path}
- jar:file:///{path}!/{subpath} becomes ({path}, {subpath})
- jar:jar:file:///{path}!/{subp... | [
"def",
"canonicalize",
"(",
"url",
")",
":",
"if",
"not",
"isinstance",
"(",
"url",
",",
"ParseResult",
")",
":",
"# Assume that if it doesn't start with jar: or file:, it's a path.",
"if",
"not",
"url",
".",
"startswith",
"(",
"(",
"'jar:'",
",",
"'file:'",
")",
... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/mozbuild/mozpack/mozjar.py#L776-L806 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/rcnn/symimdb/coco.py | python | coco._load_annotation | (self, _coco, coco_ind_to_class_ind, index) | return roi_rec | coco ann: [u'segmentation', u'area', u'iscrowd', u'image_id', u'bbox', u'category_id', u'id']
iscrowd:
crowd instances are handled by marking their overlaps with all categories to -1
and later excluded in training
bbox:
[x1, y1, w, h]
:param index: coco image ... | coco ann: [u'segmentation', u'area', u'iscrowd', u'image_id', u'bbox', u'category_id', u'id']
iscrowd:
crowd instances are handled by marking their overlaps with all categories to -1
and later excluded in training
bbox:
[x1, y1, w, h]
:param index: coco image ... | [
"coco",
"ann",
":",
"[",
"u",
"segmentation",
"u",
"area",
"u",
"iscrowd",
"u",
"image_id",
"u",
"bbox",
"u",
"category_id",
"u",
"id",
"]",
"iscrowd",
":",
"crowd",
"instances",
"are",
"handled",
"by",
"marking",
"their",
"overlaps",
"with",
"all",
"cat... | def _load_annotation(self, _coco, coco_ind_to_class_ind, index):
"""
coco ann: [u'segmentation', u'area', u'iscrowd', u'image_id', u'bbox', u'category_id', u'id']
iscrowd:
crowd instances are handled by marking their overlaps with all categories to -1
and later excluded i... | [
"def",
"_load_annotation",
"(",
"self",
",",
"_coco",
",",
"coco_ind_to_class_ind",
",",
"index",
")",
":",
"im_ann",
"=",
"_coco",
".",
"loadImgs",
"(",
"index",
")",
"[",
"0",
"]",
"filename",
"=",
"self",
".",
"_image_file_tmpl",
".",
"format",
"(",
"... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/rcnn/symimdb/coco.py#L78-L125 | |
quarnster/SublimeClang | 6823e7f0904e60680ac9f898108e301582ec5505 | internals/clang/cindex.py | python | Cursor.result_type | (self) | return self._resulttype | Retrieve the result type (if any) of the entity pointed at by the
cursor. | Retrieve the result type (if any) of the entity pointed at by the
cursor. | [
"Retrieve",
"the",
"result",
"type",
"(",
"if",
"any",
")",
"of",
"the",
"entity",
"pointed",
"at",
"by",
"the",
"cursor",
"."
] | def result_type(self):
"""
Retrieve the result type (if any) of the entity pointed at by the
cursor.
"""
if not hasattr(self, '_resulttype'):
self._resulttype = _clang_getCursorResultType(self)
return self._resulttype | [
"def",
"result_type",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_resulttype'",
")",
":",
"self",
".",
"_resulttype",
"=",
"_clang_getCursorResultType",
"(",
"self",
")",
"return",
"self",
".",
"_resulttype"
] | https://github.com/quarnster/SublimeClang/blob/6823e7f0904e60680ac9f898108e301582ec5505/internals/clang/cindex.py#L1067-L1074 | |
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/utils.py | python | EventHandlingBase.__init__ | (self) | Initializes the object. | Initializes the object. | [
"Initializes",
"the",
"object",
"."
] | def __init__(self):
'''Initializes the object.
'''
self._EventHandlerObj = None
self._DefaultEventHandlers = {}
self._EventHandlers = {}
self._EventThreads = {}
for event in self._EventNames:
self._EventHandlers[event] = [] | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_EventHandlerObj",
"=",
"None",
"self",
".",
"_DefaultEventHandlers",
"=",
"{",
"}",
"self",
".",
"_EventHandlers",
"=",
"{",
"}",
"self",
".",
"_EventThreads",
"=",
"{",
"}",
"for",
"event",
"in",
... | https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/utils.py#L329-L338 | ||
mysql/mysql-router | cc0179f982bb9739a834eb6fd205a56224616133 | ext/gmock/scripts/upload.py | python | AbstractRpcServer.__init__ | (self, host, auth_function, host_override=None, extra_headers={},
save_cookies=False) | Creates a new HttpRpcServer.
Args:
host: The host to send requests to.
auth_function: A function that takes no arguments and returns an
(email, password) tuple when called. Will be called if authentication
is required.
host_override: The host header to send to the server (defaults... | Creates a new HttpRpcServer. | [
"Creates",
"a",
"new",
"HttpRpcServer",
"."
] | def __init__(self, host, auth_function, host_override=None, extra_headers={},
save_cookies=False):
"""Creates a new HttpRpcServer.
Args:
host: The host to send requests to.
auth_function: A function that takes no arguments and returns an
(email, password) tuple when called. W... | [
"def",
"__init__",
"(",
"self",
",",
"host",
",",
"auth_function",
",",
"host_override",
"=",
"None",
",",
"extra_headers",
"=",
"{",
"}",
",",
"save_cookies",
"=",
"False",
")",
":",
"self",
".",
"host",
"=",
"host",
"self",
".",
"host_override",
"=",
... | https://github.com/mysql/mysql-router/blob/cc0179f982bb9739a834eb6fd205a56224616133/ext/gmock/scripts/upload.py#L127-L152 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/traitlets/py3/traitlets/config/configurable.py | python | Configurable.class_config_section | (cls, classes=None) | return '\n'.join(lines) | Get the config section for this class.
Parameters
----------
classes : list, optional
The list of other classes in the config file.
Used to reduce redundant information. | Get the config section for this class. | [
"Get",
"the",
"config",
"section",
"for",
"this",
"class",
"."
] | def class_config_section(cls, classes=None):
"""Get the config section for this class.
Parameters
----------
classes : list, optional
The list of other classes in the config file.
Used to reduce redundant information.
"""
def c(s):
"""... | [
"def",
"class_config_section",
"(",
"cls",
",",
"classes",
"=",
"None",
")",
":",
"def",
"c",
"(",
"s",
")",
":",
"\"\"\"return a commented, wrapped block.\"\"\"",
"s",
"=",
"'\\n\\n'",
".",
"join",
"(",
"wrap_paragraphs",
"(",
"s",
",",
"78",
")",
")",
"r... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/traitlets/py3/traitlets/config/configurable.py#L330-L389 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/threading.py | python | _Semaphore.acquire | (self, blocking=1) | return rc | Acquire a semaphore, decrementing the internal counter by one.
When invoked without arguments: if the internal counter is larger than
zero on entry, decrement it by one and return immediately. If it is zero
on entry, block, waiting until some other thread has called release() to
make it... | Acquire a semaphore, decrementing the internal counter by one. | [
"Acquire",
"a",
"semaphore",
"decrementing",
"the",
"internal",
"counter",
"by",
"one",
"."
] | def acquire(self, blocking=1):
"""Acquire a semaphore, decrementing the internal counter by one.
When invoked without arguments: if the internal counter is larger than
zero on entry, decrement it by one and return immediately. If it is zero
on entry, block, waiting until some other thre... | [
"def",
"acquire",
"(",
"self",
",",
"blocking",
"=",
"1",
")",
":",
"rc",
"=",
"False",
"with",
"self",
".",
"__cond",
":",
"while",
"self",
".",
"__value",
"==",
"0",
":",
"if",
"not",
"blocking",
":",
"break",
"if",
"__debug__",
":",
"self",
".",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/threading.py#L440-L475 | |
baidu/sofa-pbrpc | fb1a1cbf0b3b0e09706eefdbca8335f48df2f5aa | python/sofa/pbrpc/client.py | python | Channel.CallMethod | (self, method_descriptor, rpc_controller,
request, response_class, done=None) | Calls the method identified by the descriptor.
Only blocking mode is supported now, so the `done' param is not used.
If some rpc error occured, then raise exception. Especially, if timeout the
`sofa.pbrpc.TimeoutError' will be raised.
If no rpc error occurred, but controller.SetFailed() is invoked in... | Calls the method identified by the descriptor. | [
"Calls",
"the",
"method",
"identified",
"by",
"the",
"descriptor",
"."
] | def CallMethod(self, method_descriptor, rpc_controller,
request, response_class, done=None):
"""Calls the method identified by the descriptor.
Only blocking mode is supported now, so the `done' param is not used.
If some rpc error occured, then raise exception. Especially, if timeout the
... | [
"def",
"CallMethod",
"(",
"self",
",",
"method_descriptor",
",",
"rpc_controller",
",",
"request",
",",
"response_class",
",",
"done",
"=",
"None",
")",
":",
"if",
"rpc_controller",
".",
"timeout",
"==",
"None",
":",
"deadline",
"=",
"None",
"else",
":",
"... | https://github.com/baidu/sofa-pbrpc/blob/fb1a1cbf0b3b0e09706eefdbca8335f48df2f5aa/python/sofa/pbrpc/client.py#L252-L279 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PropertyGrid.GetCaptionFont | (*args) | return _propgrid.PropertyGrid_GetCaptionFont(*args) | GetCaptionFont(self) -> Font
GetCaptionFont(self) -> Font | GetCaptionFont(self) -> Font
GetCaptionFont(self) -> Font | [
"GetCaptionFont",
"(",
"self",
")",
"-",
">",
"Font",
"GetCaptionFont",
"(",
"self",
")",
"-",
">",
"Font"
] | def GetCaptionFont(*args):
"""
GetCaptionFont(self) -> Font
GetCaptionFont(self) -> Font
"""
return _propgrid.PropertyGrid_GetCaptionFont(*args) | [
"def",
"GetCaptionFont",
"(",
"*",
"args",
")",
":",
"return",
"_propgrid",
".",
"PropertyGrid_GetCaptionFont",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L2048-L2053 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | EraseEvent.__init__ | (self, *args, **kwargs) | __init__(self, int Id=0, DC dc=None) -> EraseEvent
Constructor | __init__(self, int Id=0, DC dc=None) -> EraseEvent | [
"__init__",
"(",
"self",
"int",
"Id",
"=",
"0",
"DC",
"dc",
"=",
"None",
")",
"-",
">",
"EraseEvent"
] | def __init__(self, *args, **kwargs):
"""
__init__(self, int Id=0, DC dc=None) -> EraseEvent
Constructor
"""
_core_.EraseEvent_swiginit(self,_core_.new_EraseEvent(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_core_",
".",
"EraseEvent_swiginit",
"(",
"self",
",",
"_core_",
".",
"new_EraseEvent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L6266-L6272 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/optimizer/momentum.py | python | Momentum._multi_tensor_init | (self, target_block, parameters) | All parameters used for optimizer (such as: parameters, master_weight, velocity_acc for momentum) calculations are grouped into a python list by data type (float16, float32).
This function will be overridden in the corresponding optimizer file.
Args:
target_block: the block in which the los... | All parameters used for optimizer (such as: parameters, master_weight, velocity_acc for momentum) calculations are grouped into a python list by data type (float16, float32).
This function will be overridden in the corresponding optimizer file. | [
"All",
"parameters",
"used",
"for",
"optimizer",
"(",
"such",
"as",
":",
"parameters",
"master_weight",
"velocity_acc",
"for",
"momentum",
")",
"calculations",
"are",
"grouped",
"into",
"a",
"python",
"list",
"by",
"data",
"type",
"(",
"float16",
"float32",
")... | def _multi_tensor_init(self, target_block, parameters):
"""
All parameters used for optimizer (such as: parameters, master_weight, velocity_acc for momentum) calculations are grouped into a python list by data type (float16, float32).
This function will be overridden in the corresponding optimiz... | [
"def",
"_multi_tensor_init",
"(",
"self",
",",
"target_block",
",",
"parameters",
")",
":",
"self",
".",
"_create_accumulators",
"(",
"target_block",
",",
"parameters",
")",
"for",
"param",
"in",
"parameters",
":",
"velocity_acc",
"=",
"self",
".",
"_get_accumul... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/optimizer/momentum.py#L364-L409 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.