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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/mooseutils/PerfGraphReporterReader.py | python | PerfGraphNode.children | (self) | return self._children | Returns the nodes that are immediate children to this node. | Returns the nodes that are immediate children to this node. | [
"Returns",
"the",
"nodes",
"that",
"are",
"immediate",
"children",
"to",
"this",
"node",
"."
] | def children(self):
"""
Returns the nodes that are immediate children to this node.
"""
return self._children | [
"def",
"children",
"(",
"self",
")",
":",
"return",
"self",
".",
"_children"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/mooseutils/PerfGraphReporterReader.py#L209-L213 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TStrPool.GetPrimHashCd | (self, *args) | return _snap.TStrPool_GetPrimHashCd(self, *args) | GetPrimHashCd(TStrPool self, char const * CStr) -> int
Parameters:
CStr: char const *
GetPrimHashCd(TStrPool self, uint const & Offset) -> int
Parameters:
Offset: uint const & | GetPrimHashCd(TStrPool self, char const * CStr) -> int | [
"GetPrimHashCd",
"(",
"TStrPool",
"self",
"char",
"const",
"*",
"CStr",
")",
"-",
">",
"int"
] | def GetPrimHashCd(self, *args):
"""
GetPrimHashCd(TStrPool self, char const * CStr) -> int
Parameters:
CStr: char const *
GetPrimHashCd(TStrPool self, uint const & Offset) -> int
Parameters:
Offset: uint const &
"""
return _snap.TStrPoo... | [
"def",
"GetPrimHashCd",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TStrPool_GetPrimHashCd",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L11710-L11723 | |
vgough/encfs | c444f9b9176beea1ad41a7b2e29ca26e709b57f7 | vendor/github.com/muflihun/easyloggingpp/tools/cpplint.py | python | FileInfo.FullName | (self) | return os.path.abspath(self._filename).replace('\\', '/') | Make Windows paths like Unix. | Make Windows paths like Unix. | [
"Make",
"Windows",
"paths",
"like",
"Unix",
"."
] | def FullName(self):
"""Make Windows paths like Unix."""
return os.path.abspath(self._filename).replace('\\', '/') | [
"def",
"FullName",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"abspath",
"(",
"self",
".",
"_filename",
")",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")"
] | https://github.com/vgough/encfs/blob/c444f9b9176beea1ad41a7b2e29ca26e709b57f7/vendor/github.com/muflihun/easyloggingpp/tools/cpplint.py#L858-L860 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/dtypes/common.py | python | is_extension_type | (arr) | return False | Check whether an array-like is of a pandas extension class instance.
.. deprecated:: 1.0.0
Use ``is_extension_array_dtype`` instead.
Extension classes include categoricals, pandas sparse objects (i.e.
classes represented within the pandas library and not ones external
to it like scipy sparse m... | Check whether an array-like is of a pandas extension class instance. | [
"Check",
"whether",
"an",
"array",
"-",
"like",
"is",
"of",
"a",
"pandas",
"extension",
"class",
"instance",
"."
] | def is_extension_type(arr) -> bool:
"""
Check whether an array-like is of a pandas extension class instance.
.. deprecated:: 1.0.0
Use ``is_extension_array_dtype`` instead.
Extension classes include categoricals, pandas sparse objects (i.e.
classes represented within the pandas library and... | [
"def",
"is_extension_type",
"(",
"arr",
")",
"->",
"bool",
":",
"warnings",
".",
"warn",
"(",
"\"'is_extension_type' is deprecated and will be removed in a future \"",
"\"version. Use 'is_extension_array_dtype' instead.\"",
",",
"FutureWarning",
",",
"stacklevel",
"=",
"2",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/dtypes/common.py#L1500-L1562 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/inputtransformer.py | python | classic_prompt | () | return _strip_prompts(prompt_re, initial_re, turnoff_re) | Strip the >>>/... prompts of the Python interactive shell. | Strip the >>>/... prompts of the Python interactive shell. | [
"Strip",
"the",
">>>",
"/",
"...",
"prompts",
"of",
"the",
"Python",
"interactive",
"shell",
"."
] | def classic_prompt():
"""Strip the >>>/... prompts of the Python interactive shell."""
# FIXME: non-capturing version (?:...) usable?
prompt_re = re.compile(r'^(>>>|\.\.\.)( |$)')
initial_re = re.compile(r'^>>>( |$)')
# Any %magic/!system is IPython syntax, so we needn't look for >>> prompts
tur... | [
"def",
"classic_prompt",
"(",
")",
":",
"# FIXME: non-capturing version (?:...) usable?",
"prompt_re",
"=",
"re",
".",
"compile",
"(",
"r'^(>>>|\\.\\.\\.)( |$)'",
")",
"initial_re",
"=",
"re",
".",
"compile",
"(",
"r'^>>>( |$)'",
")",
"# Any %magic/!system is IPython synt... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/inputtransformer.py#L456-L463 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/writers/_html_base.py | python | HTMLTranslator.encode | (self, text) | return text.translate(self.special_characters) | Encode special characters in `text` & return. | Encode special characters in `text` & return. | [
"Encode",
"special",
"characters",
"in",
"text",
"&",
"return",
"."
] | def encode(self, text):
"""Encode special characters in `text` & return."""
# Use only named entities known in both XML and HTML
# other characters are automatically encoded "by number" if required.
# @@@ A codec to do these and all other HTML entities would be nice.
text = unico... | [
"def",
"encode",
"(",
"self",
",",
"text",
")",
":",
"# Use only named entities known in both XML and HTML",
"# other characters are automatically encoded \"by number\" if required.",
"# @@@ A codec to do these and all other HTML entities would be nice.",
"text",
"=",
"unicode",
"(",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/writers/_html_base.py#L265-L271 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | contrib/gizmos/gtk/gizmos.py | python | TreeListCtrl.GetItemData | (*args, **kwargs) | return _gizmos.TreeListCtrl_GetItemData(*args, **kwargs) | GetItemData(self, TreeItemId item) -> TreeItemData | GetItemData(self, TreeItemId item) -> TreeItemData | [
"GetItemData",
"(",
"self",
"TreeItemId",
"item",
")",
"-",
">",
"TreeItemData"
] | def GetItemData(*args, **kwargs):
"""GetItemData(self, TreeItemId item) -> TreeItemData"""
return _gizmos.TreeListCtrl_GetItemData(*args, **kwargs) | [
"def",
"GetItemData",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gizmos",
".",
"TreeListCtrl_GetItemData",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/contrib/gizmos/gtk/gizmos.py#L667-L669 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/s3transfer/processpool.py | python | ProcessTransferConfig.__init__ | (self,
multipart_threshold=8 * MB,
multipart_chunksize=8 * MB,
max_request_processes=10) | Configuration for the ProcessPoolDownloader
:param multipart_threshold: The threshold for which ranged downloads
occur.
:param multipart_chunksize: The chunk size of each ranged download.
:param max_request_processes: The maximum number of processes that
will be making... | Configuration for the ProcessPoolDownloader | [
"Configuration",
"for",
"the",
"ProcessPoolDownloader"
] | def __init__(self,
multipart_threshold=8 * MB,
multipart_chunksize=8 * MB,
max_request_processes=10):
"""Configuration for the ProcessPoolDownloader
:param multipart_threshold: The threshold for which ranged downloads
occur.
:param... | [
"def",
"__init__",
"(",
"self",
",",
"multipart_threshold",
"=",
"8",
"*",
"MB",
",",
"multipart_chunksize",
"=",
"8",
"*",
"MB",
",",
"max_request_processes",
"=",
"10",
")",
":",
"self",
".",
"multipart_threshold",
"=",
"multipart_threshold",
"self",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/s3transfer/processpool.py#L271-L287 | ||
HyeonwooNoh/caffe | d9e8494a2832d67b25dee37194c7bcb9d52d0e42 | scripts/cpp_lint.py | python | _NestingState.CheckCompletedBlocks | (self, filename, error) | Checks that all classes and namespaces have been completely parsed.
Call this when all lines in a file have been processed.
Args:
filename: The name of the current file.
error: The function to call with any errors found. | Checks that all classes and namespaces have been completely parsed. | [
"Checks",
"that",
"all",
"classes",
"and",
"namespaces",
"have",
"been",
"completely",
"parsed",
"."
] | def CheckCompletedBlocks(self, filename, error):
"""Checks that all classes and namespaces have been completely parsed.
Call this when all lines in a file have been processed.
Args:
filename: The name of the current file.
error: The function to call with any errors found.
"""
# Note: Th... | [
"def",
"CheckCompletedBlocks",
"(",
"self",
",",
"filename",
",",
"error",
")",
":",
"# Note: This test can result in false positives if #ifdef constructs",
"# get in the way of brace matching. See the testBuildClass test in",
"# cpplint_unittest.py for an example of this.",
"for",
"obj"... | https://github.com/HyeonwooNoh/caffe/blob/d9e8494a2832d67b25dee37194c7bcb9d52d0e42/scripts/cpp_lint.py#L2172-L2191 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/sparse/base.py | python | spmatrix.setdiag | (self, values, k=0) | Set diagonal or off-diagonal elements of the array.
Parameters
----------
values : array_like
New values of the diagonal elements.
Values may have any length. If the diagonal is longer than values,
then the remaining diagonal entries will not be set. If va... | Set diagonal or off-diagonal elements of the array. | [
"Set",
"diagonal",
"or",
"off",
"-",
"diagonal",
"elements",
"of",
"the",
"array",
"."
] | def setdiag(self, values, k=0):
"""
Set diagonal or off-diagonal elements of the array.
Parameters
----------
values : array_like
New values of the diagonal elements.
Values may have any length. If the diagonal is longer than values,
then th... | [
"def",
"setdiag",
"(",
"self",
",",
"values",
",",
"k",
"=",
"0",
")",
":",
"M",
",",
"N",
"=",
"self",
".",
"shape",
"if",
"(",
"k",
">",
"0",
"and",
"k",
">=",
"N",
")",
"or",
"(",
"k",
"<",
"0",
"and",
"-",
"k",
">=",
"M",
")",
":",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/sparse/base.py#L1122-L1145 | ||
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/lib/npyio.py | python | NpzFile.iteritems | (self) | Generator that returns tuples (filename, array in file). | Generator that returns tuples (filename, array in file). | [
"Generator",
"that",
"returns",
"tuples",
"(",
"filename",
"array",
"in",
"file",
")",
"."
] | def iteritems(self):
"""Generator that returns tuples (filename, array in file)."""
for f in self.files:
yield (f, self[f]) | [
"def",
"iteritems",
"(",
"self",
")",
":",
"for",
"f",
"in",
"self",
".",
"files",
":",
"yield",
"(",
"f",
",",
"self",
"[",
"f",
"]",
")"
] | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/lib/npyio.py#L248-L251 | ||
GoSSIP-SJTU/Armariris | ad5d868482956b2194a77b39c8d543c7c2318200 | tools/clang/tools/scan-build-py/libscanbuild/__init__.py | python | command_entry_point | (function) | return wrapper | Decorator for command entry points. | Decorator for command entry points. | [
"Decorator",
"for",
"command",
"entry",
"points",
"."
] | def command_entry_point(function):
""" Decorator for command entry points. """
import functools
import logging
@functools.wraps(function)
def wrapper(*args, **kwargs):
exit_code = 127
try:
exit_code = function(*args, **kwargs)
except KeyboardInterrupt:
... | [
"def",
"command_entry_point",
"(",
"function",
")",
":",
"import",
"functools",
"import",
"logging",
"@",
"functools",
".",
"wraps",
"(",
"function",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"exit_code",
"=",
"127",
"tr... | https://github.com/GoSSIP-SJTU/Armariris/blob/ad5d868482956b2194a77b39c8d543c7c2318200/tools/clang/tools/scan-build-py/libscanbuild/__init__.py#L57-L82 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/key_bindings.py | python | key_binding | (
filter: FilterOrBool = True,
eager: FilterOrBool = False,
is_global: FilterOrBool = False,
save_before: Callable[["KeyPressEvent"], bool] = (lambda event: True),
record_in_macro: FilterOrBool = True,
) | return decorator | Decorator that turn a function into a `Binding` object. This can be added
to a `KeyBindings` object when a key binding is assigned. | Decorator that turn a function into a `Binding` object. This can be added
to a `KeyBindings` object when a key binding is assigned. | [
"Decorator",
"that",
"turn",
"a",
"function",
"into",
"a",
"Binding",
"object",
".",
"This",
"can",
"be",
"added",
"to",
"a",
"KeyBindings",
"object",
"when",
"a",
"key",
"binding",
"is",
"assigned",
"."
] | def key_binding(
filter: FilterOrBool = True,
eager: FilterOrBool = False,
is_global: FilterOrBool = False,
save_before: Callable[["KeyPressEvent"], bool] = (lambda event: True),
record_in_macro: FilterOrBool = True,
) -> Callable[[KeyHandlerCallable], Binding]:
"""
Decorator that turn a fun... | [
"def",
"key_binding",
"(",
"filter",
":",
"FilterOrBool",
"=",
"True",
",",
"eager",
":",
"FilterOrBool",
"=",
"False",
",",
"is_global",
":",
"FilterOrBool",
"=",
"False",
",",
"save_before",
":",
"Callable",
"[",
"[",
"\"KeyPressEvent\"",
"]",
",",
"bool",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/key_bindings.py#L457-L488 | |
google/usd_from_gltf | 6d288cce8b68744494a226574ae1d7ba6a9c46eb | tools/ufgbatch/ufgvalidate.py | python | run_command | (cmd_args) | return output | Run validator command-line. | Run validator command-line. | [
"Run",
"validator",
"command",
"-",
"line",
"."
] | def run_command(cmd_args):
"""Run validator command-line."""
# Spawn the command.
command = get_process_command(cmd_args)
status(command, util.LOG_COLOR_DARK_CYAN)
# TODO: This doesn't interleave stdout and stderr in the correct
# order, and there appears to be no reasonable way to do that in Python. As a
... | [
"def",
"run_command",
"(",
"cmd_args",
")",
":",
"# Spawn the command.",
"command",
"=",
"get_process_command",
"(",
"cmd_args",
")",
"status",
"(",
"command",
",",
"util",
".",
"LOG_COLOR_DARK_CYAN",
")",
"# TODO: This doesn't interleave stdout and stderr in the correct",
... | https://github.com/google/usd_from_gltf/blob/6d288cce8b68744494a226574ae1d7ba6a9c46eb/tools/ufgbatch/ufgvalidate.py#L228-L256 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Action.py | python | FunctionAction.get_presig | (self, target, source, env) | Return the signature contents of this callable action. | Return the signature contents of this callable action. | [
"Return",
"the",
"signature",
"contents",
"of",
"this",
"callable",
"action",
"."
] | def get_presig(self, target, source, env):
"""Return the signature contents of this callable action."""
try:
return self.gc(target, source, env)
except AttributeError:
return self.funccontents | [
"def",
"get_presig",
"(",
"self",
",",
"target",
",",
"source",
",",
"env",
")",
":",
"try",
":",
"return",
"self",
".",
"gc",
"(",
"target",
",",
"source",
",",
"env",
")",
"except",
"AttributeError",
":",
"return",
"self",
".",
"funccontents"
] | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Action.py#L1090-L1095 | ||
papyrussolution/OpenPapyrus | bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91 | Src/OSF/protobuf-3.19.1/python/google/protobuf/descriptor_pool.py | python | DescriptorPool._InternalFindFileContainingSymbol | (self, symbol) | Gets the already built FileDescriptor containing the specified symbol.
Args:
symbol (str): The name of the symbol to search for.
Returns:
FileDescriptor: Descriptor for the file that contains the specified
symbol.
Raises:
KeyError: if the file cannot be found in the pool. | Gets the already built FileDescriptor containing the specified symbol. | [
"Gets",
"the",
"already",
"built",
"FileDescriptor",
"containing",
"the",
"specified",
"symbol",
"."
] | def _InternalFindFileContainingSymbol(self, symbol):
"""Gets the already built FileDescriptor containing the specified symbol.
Args:
symbol (str): The name of the symbol to search for.
Returns:
FileDescriptor: Descriptor for the file that contains the specified
symbol.
Raises:
... | [
"def",
"_InternalFindFileContainingSymbol",
"(",
"self",
",",
"symbol",
")",
":",
"try",
":",
"return",
"self",
".",
"_descriptors",
"[",
"symbol",
"]",
".",
"file",
"except",
"KeyError",
":",
"pass",
"try",
":",
"return",
"self",
".",
"_enum_descriptors",
"... | https://github.com/papyrussolution/OpenPapyrus/blob/bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91/Src/OSF/protobuf-3.19.1/python/google/protobuf/descriptor_pool.py#L452-L499 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/RNN/rnn_quantizer/pytorch_binding/pytorch_nndct/quantization/module_transform.py | python | NodePattern.__init__ | (self, module_name, inputs=None) | Construct pattern to match.
Args:
module_name: Type name of module. (such as Conv2d, Linear etc.)
inputs: input modules to the module. | Construct pattern to match. | [
"Construct",
"pattern",
"to",
"match",
"."
] | def __init__(self, module_name, inputs=None):
"""Construct pattern to match.
Args:
module_name: Type name of module. (such as Conv2d, Linear etc.)
inputs: input modules to the module.
"""
if inputs is None:
inputs = []
self.module_name = module_name
self.inputs = inputs | [
"def",
"__init__",
"(",
"self",
",",
"module_name",
",",
"inputs",
"=",
"None",
")",
":",
"if",
"inputs",
"is",
"None",
":",
"inputs",
"=",
"[",
"]",
"self",
".",
"module_name",
"=",
"module_name",
"self",
".",
"inputs",
"=",
"inputs"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/RNN/rnn_quantizer/pytorch_binding/pytorch_nndct/quantization/module_transform.py#L59-L70 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/supertooltip.py | python | SuperToolTip.GetDropShadow | (self) | return self._dropShadow | Returns whether a shadow below :class:`SuperToolTip` is drawn or not.
:note: This method is available only on Windows and requires Mark Hammond's
pywin32 package. | Returns whether a shadow below :class:`SuperToolTip` is drawn or not. | [
"Returns",
"whether",
"a",
"shadow",
"below",
":",
"class",
":",
"SuperToolTip",
"is",
"drawn",
"or",
"not",
"."
] | def GetDropShadow(self):
"""
Returns whether a shadow below :class:`SuperToolTip` is drawn or not.
:note: This method is available only on Windows and requires Mark Hammond's
pywin32 package.
"""
return self._dropShadow | [
"def",
"GetDropShadow",
"(",
"self",
")",
":",
"return",
"self",
".",
"_dropShadow"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/supertooltip.py#L1363-L1371 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/traitlets/py3/traitlets/traitlets.py | python | _validate_link | (*tuples) | Validate arguments for traitlet link functions | Validate arguments for traitlet link functions | [
"Validate",
"arguments",
"for",
"traitlet",
"link",
"functions"
] | def _validate_link(*tuples):
"""Validate arguments for traitlet link functions"""
for t in tuples:
if not len(t) == 2:
raise TypeError("Each linked traitlet must be specified as (HasTraits, 'trait_name'), not %r" % t)
obj, trait_name = t
if not isinstance(obj, HasTraits):
... | [
"def",
"_validate_link",
"(",
"*",
"tuples",
")",
":",
"for",
"t",
"in",
"tuples",
":",
"if",
"not",
"len",
"(",
"t",
")",
"==",
"2",
":",
"raise",
"TypeError",
"(",
"\"Each linked traitlet must be specified as (HasTraits, 'trait_name'), not %r\"",
"%",
"t",
")"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/traitlets/py3/traitlets/traitlets.py#L238-L247 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/plat-mac/EasyDialogs.py | python | Message | (msg, id=260, ok=None) | Display a MESSAGE string.
Return when the user clicks the OK button or presses Return.
The MESSAGE string can be at most 255 characters long. | Display a MESSAGE string. | [
"Display",
"a",
"MESSAGE",
"string",
"."
] | def Message(msg, id=260, ok=None):
"""Display a MESSAGE string.
Return when the user clicks the OK button or presses Return.
The MESSAGE string can be at most 255 characters long.
"""
_initialize()
_interact()
d = GetNewDialog(id, -1)
if not d:
print "EasyDialogs: Can't get DLO... | [
"def",
"Message",
"(",
"msg",
",",
"id",
"=",
"260",
",",
"ok",
"=",
"None",
")",
":",
"_initialize",
"(",
")",
"_interact",
"(",
")",
"d",
"=",
"GetNewDialog",
"(",
"id",
",",
"-",
"1",
")",
"if",
"not",
"d",
":",
"print",
"\"EasyDialogs: Can't ge... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/plat-mac/EasyDialogs.py#L70-L94 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/mox3/mox3/mox.py | python | MethodSignatureChecker.__init__ | (self, method, class_to_bind=None) | Creates a checker.
Args:
# method: A method to check.
# class_to_bind: optionally, a class used to type check first
# method parameter, only used with unbound methods
method: function
class_to_bind: type or None
Raises:
... | Creates a checker. | [
"Creates",
"a",
"checker",
"."
] | def __init__(self, method, class_to_bind=None):
"""Creates a checker.
Args:
# method: A method to check.
# class_to_bind: optionally, a class used to type check first
# method parameter, only used with unbound methods
method: function
... | [
"def",
"__init__",
"(",
"self",
",",
"method",
",",
"class_to_bind",
"=",
"None",
")",
":",
"try",
":",
"self",
".",
"_args",
",",
"varargs",
",",
"varkw",
",",
"defaults",
"=",
"inspect",
".",
"getargspec",
"(",
"method",
")",
"except",
"TypeError",
"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/mox3/mox3/mox.py#L893-L933 | ||
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/msvs_emulation.py | python | MsvsSettings.IsUseLibraryDependencyInputs | (self, config) | return uldi == 'true' | Returns whether the target should be linked via Use Library Dependency
Inputs (using component .objs of a given .lib). | Returns whether the target should be linked via Use Library Dependency
Inputs (using component .objs of a given .lib). | [
"Returns",
"whether",
"the",
"target",
"should",
"be",
"linked",
"via",
"Use",
"Library",
"Dependency",
"Inputs",
"(",
"using",
"component",
".",
"objs",
"of",
"a",
"given",
".",
"lib",
")",
"."
] | def IsUseLibraryDependencyInputs(self, config):
"""Returns whether the target should be linked via Use Library Dependency
Inputs (using component .objs of a given .lib)."""
config = self._TargetConfig(config)
uldi = self._Setting(('VCLinkerTool', 'UseLibraryDependencyInputs'), config)
return uldi ==... | [
"def",
"IsUseLibraryDependencyInputs",
"(",
"self",
",",
"config",
")",
":",
"config",
"=",
"self",
".",
"_TargetConfig",
"(",
"config",
")",
"uldi",
"=",
"self",
".",
"_Setting",
"(",
"(",
"'VCLinkerTool'",
",",
"'UseLibraryDependencyInputs'",
")",
",",
"conf... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/msvs_emulation.py#L684-L689 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/inspector_protocol/jinja2/ext.py | python | InternationalizationExtension._parse_block | (self, parser, allow_pluralize) | return referenced, concat(buf) | Parse until the next block tag with a given name. | Parse until the next block tag with a given name. | [
"Parse",
"until",
"the",
"next",
"block",
"tag",
"with",
"a",
"given",
"name",
"."
] | def _parse_block(self, parser, allow_pluralize):
"""Parse until the next block tag with a given name."""
referenced = []
buf = []
while 1:
if parser.stream.current.type == 'data':
buf.append(parser.stream.current.value.replace('%', '%%'))
next(... | [
"def",
"_parse_block",
"(",
"self",
",",
"parser",
",",
"allow_pluralize",
")",
":",
"referenced",
"=",
"[",
"]",
"buf",
"=",
"[",
"]",
"while",
"1",
":",
"if",
"parser",
".",
"stream",
".",
"current",
".",
"type",
"==",
"'data'",
":",
"buf",
".",
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/inspector_protocol/jinja2/ext.py#L325-L355 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/monitors.py | python | BaseMonitor.begin | (self, max_steps=None) | Called at the beginning of training.
When called, the default graph is the one we are executing.
Args:
max_steps: `int`, the maximum global step this training will run until.
Raises:
ValueError: if we've already begun a run. | Called at the beginning of training. | [
"Called",
"at",
"the",
"beginning",
"of",
"training",
"."
] | def begin(self, max_steps=None):
"""Called at the beginning of training.
When called, the default graph is the one we are executing.
Args:
max_steps: `int`, the maximum global step this training will run until.
Raises:
ValueError: if we've already begun a run.
"""
if self._begun:
... | [
"def",
"begin",
"(",
"self",
",",
"max_steps",
"=",
"None",
")",
":",
"if",
"self",
".",
"_begun",
":",
"raise",
"ValueError",
"(",
"\"begin called twice without end.\"",
")",
"self",
".",
"_max_steps",
"=",
"max_steps",
"self",
".",
"_begun",
"=",
"True"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/monitors.py#L105-L119 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/robotsim.py | python | SimRobotSensor.getSetting | (self, name) | return _robotsim.SimRobotSensor_getSetting(self, name) | getSetting(SimRobotSensor self, std::string const & name) -> std::string
Returns the value of the named setting (you will need to manually parse this) | getSetting(SimRobotSensor self, std::string const & name) -> std::string | [
"getSetting",
"(",
"SimRobotSensor",
"self",
"std",
"::",
"string",
"const",
"&",
"name",
")",
"-",
">",
"std",
"::",
"string"
] | def getSetting(self, name):
"""
getSetting(SimRobotSensor self, std::string const & name) -> std::string
Returns the value of the named setting (you will need to manually parse this)
"""
return _robotsim.SimRobotSensor_getSetting(self, name) | [
"def",
"getSetting",
"(",
"self",
",",
"name",
")",
":",
"return",
"_robotsim",
".",
"SimRobotSensor_getSetting",
"(",
"self",
",",
"name",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/robotsim.py#L7256-L7265 | |
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | clang/bindings/python/clang/cindex.py | python | CompileCommand.filename | (self) | return conf.lib.clang_CompileCommand_getFilename(self.cmd) | Get the working filename for this CompileCommand | Get the working filename for this CompileCommand | [
"Get",
"the",
"working",
"filename",
"for",
"this",
"CompileCommand"
] | def filename(self):
"""Get the working filename for this CompileCommand"""
return conf.lib.clang_CompileCommand_getFilename(self.cmd) | [
"def",
"filename",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_CompileCommand_getFilename",
"(",
"self",
".",
"cmd",
")"
] | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/clang/bindings/python/clang/cindex.py#L3185-L3187 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/learn/python/learn/learn_io/data_feeder.py | python | DataFeeder.make_epoch_variable | (self) | return self._epoch_placeholder | Adds a placeholder variable for the epoch to the graph.
Returns:
The epoch placeholder. | Adds a placeholder variable for the epoch to the graph. | [
"Adds",
"a",
"placeholder",
"variable",
"for",
"the",
"epoch",
"to",
"the",
"graph",
"."
] | def make_epoch_variable(self):
"""Adds a placeholder variable for the epoch to the graph.
Returns:
The epoch placeholder.
"""
self._epoch_placeholder = array_ops.placeholder(dtypes.int32, [1],
name='epoch')
return self._epoch_placeholder | [
"def",
"make_epoch_variable",
"(",
"self",
")",
":",
"self",
".",
"_epoch_placeholder",
"=",
"array_ops",
".",
"placeholder",
"(",
"dtypes",
".",
"int32",
",",
"[",
"1",
"]",
",",
"name",
"=",
"'epoch'",
")",
"return",
"self",
".",
"_epoch_placeholder"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/learn/python/learn/learn_io/data_feeder.py#L306-L314 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/logging/config.py | python | DictConfigurator.add_handlers | (self, logger, handlers) | Add handlers to a logger from a list of names. | Add handlers to a logger from a list of names. | [
"Add",
"handlers",
"to",
"a",
"logger",
"from",
"a",
"list",
"of",
"names",
"."
] | def add_handlers(self, logger, handlers):
"""Add handlers to a logger from a list of names."""
for h in handlers:
try:
logger.addHandler(self.config['handlers'][h])
except StandardError as e:
raise ValueError('Unable to add handler %r: %s' % (h, e)... | [
"def",
"add_handlers",
"(",
"self",
",",
"logger",
",",
"handlers",
")",
":",
"for",
"h",
"in",
"handlers",
":",
"try",
":",
"logger",
".",
"addHandler",
"(",
"self",
".",
"config",
"[",
"'handlers'",
"]",
"[",
"h",
"]",
")",
"except",
"StandardError",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/logging/config.py#L751-L757 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/xrc.py | python | XmlResourceHandler.GetResource | (*args, **kwargs) | return _xrc.XmlResourceHandler_GetResource(*args, **kwargs) | GetResource(self) -> XmlResource | GetResource(self) -> XmlResource | [
"GetResource",
"(",
"self",
")",
"-",
">",
"XmlResource"
] | def GetResource(*args, **kwargs):
"""GetResource(self) -> XmlResource"""
return _xrc.XmlResourceHandler_GetResource(*args, **kwargs) | [
"def",
"GetResource",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_xrc",
".",
"XmlResourceHandler_GetResource",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/xrc.py#L603-L605 | |
dmlc/treelite | df56babb6a4a2d7c29d719c28ce53acfa7dbab3c | python/treelite/frontend.py | python | Model.from_xgboost | (cls, booster) | return Model(handle) | Load a tree ensemble model from an XGBoost Booster object
Parameters
----------
booster : object of type :py:class:`xgboost.Booster`
Python handle to XGBoost model
Returns
-------
model : :py:class:`Model` object
loaded model
Example
... | Load a tree ensemble model from an XGBoost Booster object | [
"Load",
"a",
"tree",
"ensemble",
"model",
"from",
"an",
"XGBoost",
"Booster",
"object"
] | def from_xgboost(cls, booster):
"""
Load a tree ensemble model from an XGBoost Booster object
Parameters
----------
booster : object of type :py:class:`xgboost.Booster`
Python handle to XGBoost model
Returns
-------
model : :py:class:`Model` ... | [
"def",
"from_xgboost",
"(",
"cls",
",",
"booster",
")",
":",
"# attempt to import xgboost",
"try",
":",
"import",
"xgboost",
"except",
"ImportError",
"as",
"e",
":",
"raise",
"TreeliteError",
"(",
"'xgboost module must be installed to read from '",
"+",
"'`xgboost.Boost... | https://github.com/dmlc/treelite/blob/df56babb6a4a2d7c29d719c28ce53acfa7dbab3c/python/treelite/frontend.py#L351-L396 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/nn/functional/common.py | python | interpolate | (x,
size=None,
scale_factor=None,
mode='nearest',
align_corners=False,
align_mode=0,
data_format='NCHW',
name=None) | return out | This op resizes a batch of images.
The input must be a 3-D Tensor of the shape (num_batches, channels, in_w)
or 4-D (num_batches, channels, in_h, in_w), or a 5-D Tensor of the shape
(num_batches, channels, in_d, in_h, in_w) or (num_batches, in_d, in_h, in_w, channels),
Where in_w is width of the input t... | [] | def interpolate(x,
size=None,
scale_factor=None,
mode='nearest',
align_corners=False,
align_mode=0,
data_format='NCHW',
name=None):
"""
This op resizes a batch of images.
The input must be a 3-D ... | [
"def",
"interpolate",
"(",
"x",
",",
"size",
"=",
"None",
",",
"scale_factor",
"=",
"None",
",",
"mode",
"=",
"'nearest'",
",",
"align_corners",
"=",
"False",
",",
"align_mode",
"=",
"0",
",",
"data_format",
"=",
"'NCHW'",
",",
"name",
"=",
"None",
")"... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/nn/functional/common.py#L44-L481 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Hash/SHA3_224.py | python | SHA3_224_Hash.new | (self) | return type(self)(None, self._update_after_digest) | Create a fresh SHA3-224 hash object. | Create a fresh SHA3-224 hash object. | [
"Create",
"a",
"fresh",
"SHA3",
"-",
"224",
"hash",
"object",
"."
] | def new(self):
"""Create a fresh SHA3-224 hash object."""
return type(self)(None, self._update_after_digest) | [
"def",
"new",
"(",
"self",
")",
":",
"return",
"type",
"(",
"self",
")",
"(",
"None",
",",
"self",
".",
"_update_after_digest",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Hash/SHA3_224.py#L114-L117 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/kvstore/kvstore.py | python | KVStore.num_workers | (self) | return size.value | Returns the number of worker nodes.
Returns
-------
size :int
The number of worker nodes. | Returns the number of worker nodes. | [
"Returns",
"the",
"number",
"of",
"worker",
"nodes",
"."
] | def num_workers(self):
"""Returns the number of worker nodes.
Returns
-------
size :int
The number of worker nodes.
"""
size = ctypes.c_int()
check_call(_LIB.MXKVStoreGetGroupSize(self.handle, ctypes.byref(size)))
return size.value | [
"def",
"num_workers",
"(",
"self",
")",
":",
"size",
"=",
"ctypes",
".",
"c_int",
"(",
")",
"check_call",
"(",
"_LIB",
".",
"MXKVStoreGetGroupSize",
"(",
"self",
".",
"handle",
",",
"ctypes",
".",
"byref",
"(",
"size",
")",
")",
")",
"return",
"size",
... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/kvstore/kvstore.py#L635-L645 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/D7YIGPositionCalibration.py | python | D7YIGPositionCalibration._prettify | (self, elem) | return reparsed.toprettyxml(indent=" ") | Returns a pretty-printed XML string for the Element. | Returns a pretty-printed XML string for the Element. | [
"Returns",
"a",
"pretty",
"-",
"printed",
"XML",
"string",
"for",
"the",
"Element",
"."
] | def _prettify(self, elem):
"""Returns a pretty-printed XML string for the Element."""
rough_string = ET.tostring(elem, 'utf-8')
reparsed = minidom.parseString(rough_string)
return reparsed.toprettyxml(indent=" ") | [
"def",
"_prettify",
"(",
"self",
",",
"elem",
")",
":",
"rough_string",
"=",
"ET",
".",
"tostring",
"(",
"elem",
",",
"'utf-8'",
")",
"reparsed",
"=",
"minidom",
".",
"parseString",
"(",
"rough_string",
")",
"return",
"reparsed",
".",
"toprettyxml",
"(",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/D7YIGPositionCalibration.py#L570-L574 | |
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | sdhash-ui/cherrypy/process/win32.py | python | ConsoleCtrlHandler.handle | (self, event) | return 0 | Handle console control events (like Ctrl-C). | Handle console control events (like Ctrl-C). | [
"Handle",
"console",
"control",
"events",
"(",
"like",
"Ctrl",
"-",
"C",
")",
"."
] | def handle(self, event):
"""Handle console control events (like Ctrl-C)."""
if event in (win32con.CTRL_C_EVENT, win32con.CTRL_LOGOFF_EVENT,
win32con.CTRL_BREAK_EVENT, win32con.CTRL_SHUTDOWN_EVENT,
win32con.CTRL_CLOSE_EVENT):
self.bus.log('Console eve... | [
"def",
"handle",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
"in",
"(",
"win32con",
".",
"CTRL_C_EVENT",
",",
"win32con",
".",
"CTRL_LOGOFF_EVENT",
",",
"win32con",
".",
"CTRL_BREAK_EVENT",
",",
"win32con",
".",
"CTRL_SHUTDOWN_EVENT",
",",
"win32con",
... | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/sdhash-ui/cherrypy/process/win32.py#L51-L67 | |
googlearchive/tango-examples-c | b57d8c173664de569a7fec703091ff82684a2db5 | third_party/libfreetype/src/tools/docmaker/docmaker.py | python | main | ( argv ) | main program loop | main program loop | [
"main",
"program",
"loop"
] | def main( argv ):
"""main program loop"""
global output_dir
try:
opts, args = getopt.getopt( sys.argv[1:], \
"ht:o:p:", \
["help", "title=", "output=", "prefix="] )
except getopt.GetoptError:
usage()
sy... | [
"def",
"main",
"(",
"argv",
")",
":",
"global",
"output_dir",
"try",
":",
"opts",
",",
"args",
"=",
"getopt",
".",
"getopt",
"(",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
",",
"\"ht:o:p:\"",
",",
"[",
"\"help\"",
",",
"\"title=\"",
",",
"\"output=\"",... | https://github.com/googlearchive/tango-examples-c/blob/b57d8c173664de569a7fec703091ff82684a2db5/third_party/libfreetype/src/tools/docmaker/docmaker.py#L41-L97 | ||
apiaryio/snowcrash | b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3 | tools/gyp/pylib/gyp/generator/make.py | python | MakefileWriter.ComputeDeps | (self, spec) | return (gyp.common.uniquer(deps), gyp.common.uniquer(link_deps)) | Compute the dependencies of a gyp spec.
Returns a tuple (deps, link_deps), where each is a list of
filenames that will need to be put in front of make for either
building (deps) or linking (link_deps). | Compute the dependencies of a gyp spec. | [
"Compute",
"the",
"dependencies",
"of",
"a",
"gyp",
"spec",
"."
] | def ComputeDeps(self, spec):
"""Compute the dependencies of a gyp spec.
Returns a tuple (deps, link_deps), where each is a list of
filenames that will need to be put in front of make for either
building (deps) or linking (link_deps).
"""
deps = []
link_deps = []
if 'dependencies' in spe... | [
"def",
"ComputeDeps",
"(",
"self",
",",
"spec",
")",
":",
"deps",
"=",
"[",
"]",
"link_deps",
"=",
"[",
"]",
"if",
"'dependencies'",
"in",
"spec",
":",
"deps",
".",
"extend",
"(",
"[",
"target_outputs",
"[",
"dep",
"]",
"for",
"dep",
"in",
"spec",
... | https://github.com/apiaryio/snowcrash/blob/b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3/tools/gyp/pylib/gyp/generator/make.py#L1399-L1418 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/distutils/misc_util.py | python | get_info | (pkgname, dirs=None) | return info | Return an info dict for a given C library.
The info dict contains the necessary options to use the C library.
Parameters
----------
pkgname : str
Name of the package (should match the name of the .ini file, without
the extension, e.g. foo for the file foo.ini).
dirs : sequence, opt... | Return an info dict for a given C library. | [
"Return",
"an",
"info",
"dict",
"for",
"a",
"given",
"C",
"library",
"."
] | def get_info(pkgname, dirs=None):
"""
Return an info dict for a given C library.
The info dict contains the necessary options to use the C library.
Parameters
----------
pkgname : str
Name of the package (should match the name of the .ini file, without
the extension, e.g. foo f... | [
"def",
"get_info",
"(",
"pkgname",
",",
"dirs",
"=",
"None",
")",
":",
"from",
"numpy",
".",
"distutils",
".",
"npy_pkg_config",
"import",
"parse_flags",
"pkg_info",
"=",
"get_pkg_info",
"(",
"pkgname",
",",
"dirs",
")",
"# Translate LibraryInfo instance into a bu... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/distutils/misc_util.py#L2092-L2150 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | NativeFontInfo.GetStrikethrough | (*args, **kwargs) | return _gdi_.NativeFontInfo_GetStrikethrough(*args, **kwargs) | GetStrikethrough(self) -> bool | GetStrikethrough(self) -> bool | [
"GetStrikethrough",
"(",
"self",
")",
"-",
">",
"bool"
] | def GetStrikethrough(*args, **kwargs):
"""GetStrikethrough(self) -> bool"""
return _gdi_.NativeFontInfo_GetStrikethrough(*args, **kwargs) | [
"def",
"GetStrikethrough",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"NativeFontInfo_GetStrikethrough",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L1901-L1903 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/stc.py | python | StyledTextCtrl.GetTextRaw | (*args, **kwargs) | return _stc.StyledTextCtrl_GetTextRaw(*args, **kwargs) | GetTextRaw(self) -> wxCharBuffer
Retrieve all the text in the document. The returned value is a utf-8
encoded string in unicode builds of wxPython, or raw 8-bit text
otherwise. | GetTextRaw(self) -> wxCharBuffer | [
"GetTextRaw",
"(",
"self",
")",
"-",
">",
"wxCharBuffer"
] | def GetTextRaw(*args, **kwargs):
"""
GetTextRaw(self) -> wxCharBuffer
Retrieve all the text in the document. The returned value is a utf-8
encoded string in unicode builds of wxPython, or raw 8-bit text
otherwise.
"""
return _stc.StyledTextCtrl_GetTextRaw(*args,... | [
"def",
"GetTextRaw",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_GetTextRaw",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/stc.py#L6758-L6766 | |
netease-youdao/hex | d7b8773dae8dde63f3807cef1d48c017077db727 | tools/patch_util.py | python | PatchInfo.apply | (self, root_directory = None) | apply parsed patch | apply parsed patch | [
"apply",
"parsed",
"patch"
] | def apply(self, root_directory = None):
""" apply parsed patch """
total = len(self.source)
for fileno, filename in enumerate(self.source):
f2patch = filename
if not root_directory is None:
f2patch = root_directory + f2patch
if not exists(f2patch):
# if the patch contai... | [
"def",
"apply",
"(",
"self",
",",
"root_directory",
"=",
"None",
")",
":",
"total",
"=",
"len",
"(",
"self",
".",
"source",
")",
"for",
"fileno",
",",
"filename",
"in",
"enumerate",
"(",
"self",
".",
"source",
")",
":",
"f2patch",
"=",
"filename",
"i... | https://github.com/netease-youdao/hex/blob/d7b8773dae8dde63f3807cef1d48c017077db727/tools/patch_util.py#L308-L412 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/lib/backgroundjobs.py | python | BackgroundJobManager._group_flush | (self,group,name) | Flush a given job group
Return True if the group had any elements. | Flush a given job group | [
"Flush",
"a",
"given",
"job",
"group"
] | def _group_flush(self,group,name):
"""Flush a given job group
Return True if the group had any elements."""
njobs = len(group)
if njobs:
plural = {1:''}.setdefault(njobs,'s')
print('Flushing %s %s job%s.' % (njobs,name,plural))
group[:] = []
... | [
"def",
"_group_flush",
"(",
"self",
",",
"group",
",",
"name",
")",
":",
"njobs",
"=",
"len",
"(",
"group",
")",
"if",
"njobs",
":",
"plural",
"=",
"{",
"1",
":",
"''",
"}",
".",
"setdefault",
"(",
"njobs",
",",
"'s'",
")",
"print",
"(",
"'Flushi... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/lib/backgroundjobs.py#L256-L266 | ||
metashell/metashell | f4177e4854ea00c8dbc722cadab26ef413d798ea | 3rd/templight/clang/bindings/python/clang/cindex.py | python | Cursor.is_default_method | (self) | return conf.lib.clang_CXXMethod_isDefaulted(self) | Returns True if the cursor refers to a C++ member function or member
function template that is declared '= default'. | Returns True if the cursor refers to a C++ member function or member
function template that is declared '= default'. | [
"Returns",
"True",
"if",
"the",
"cursor",
"refers",
"to",
"a",
"C",
"++",
"member",
"function",
"or",
"member",
"function",
"template",
"that",
"is",
"declared",
"=",
"default",
"."
] | def is_default_method(self):
"""Returns True if the cursor refers to a C++ member function or member
function template that is declared '= default'.
"""
return conf.lib.clang_CXXMethod_isDefaulted(self) | [
"def",
"is_default_method",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_CXXMethod_isDefaulted",
"(",
"self",
")"
] | https://github.com/metashell/metashell/blob/f4177e4854ea00c8dbc722cadab26ef413d798ea/3rd/templight/clang/bindings/python/clang/cindex.py#L1470-L1474 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/turtle.py | python | TurtleScreen.setworldcoordinates | (self, llx, lly, urx, ury) | Set up a user defined coordinate-system.
Arguments:
llx -- a number, x-coordinate of lower left corner of canvas
lly -- a number, y-coordinate of lower left corner of canvas
urx -- a number, x-coordinate of upper right corner of canvas
ury -- a number, y-coordinate of upper righ... | Set up a user defined coordinate-system. | [
"Set",
"up",
"a",
"user",
"defined",
"coordinate",
"-",
"system",
"."
] | def setworldcoordinates(self, llx, lly, urx, ury):
"""Set up a user defined coordinate-system.
Arguments:
llx -- a number, x-coordinate of lower left corner of canvas
lly -- a number, y-coordinate of lower left corner of canvas
urx -- a number, x-coordinate of upper right corner... | [
"def",
"setworldcoordinates",
"(",
"self",
",",
"llx",
",",
"lly",
",",
"urx",
",",
"ury",
")",
":",
"if",
"self",
".",
"mode",
"(",
")",
"!=",
"\"world\"",
":",
"self",
".",
"mode",
"(",
"\"world\"",
")",
"xspan",
"=",
"float",
"(",
"urx",
"-",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/turtle.py#L1014-L1051 | ||
chihyaoma/regretful-agent | 5caf7b500667981bc7064e4d31b49e83db64c95a | tasks/R2R-pano/eval.py | python | Evaluation.score | (self, output_file) | return score_summary, self.scores | Evaluate each agent trajectory based on how close it got to the goal location | Evaluate each agent trajectory based on how close it got to the goal location | [
"Evaluate",
"each",
"agent",
"trajectory",
"based",
"on",
"how",
"close",
"it",
"got",
"to",
"the",
"goal",
"location"
] | def score(self, output_file):
''' Evaluate each agent trajectory based on how close it got to the goal location '''
self.scores = defaultdict(list)
instr_ids = set(self.instr_ids)
with open(output_file) as f:
for item in json.load(f):
# Check against expected... | [
"def",
"score",
"(",
"self",
",",
"output_file",
")",
":",
"self",
".",
"scores",
"=",
"defaultdict",
"(",
"list",
")",
"instr_ids",
"=",
"set",
"(",
"self",
".",
"instr_ids",
")",
"with",
"open",
"(",
"output_file",
")",
"as",
"f",
":",
"for",
"item... | https://github.com/chihyaoma/regretful-agent/blob/5caf7b500667981bc7064e4d31b49e83db64c95a/tasks/R2R-pano/eval.py#L71-L95 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/pubsub/core/topicmgr.py | python | _MasterTopicDefnProvider.addProvider | (self, provider) | Add given provider IF not already added. | Add given provider IF not already added. | [
"Add",
"given",
"provider",
"IF",
"not",
"already",
"added",
"."
] | def addProvider(self, provider):
"""Add given provider IF not already added. """
assert(isinstance(provider, ITopicDefnProvider))
if provider not in self.__providers:
self.__providers.append(provider) | [
"def",
"addProvider",
"(",
"self",
",",
"provider",
")",
":",
"assert",
"(",
"isinstance",
"(",
"provider",
",",
"ITopicDefnProvider",
")",
")",
"if",
"provider",
"not",
"in",
"self",
".",
"__providers",
":",
"self",
".",
"__providers",
".",
"append",
"(",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/pubsub/core/topicmgr.py#L416-L420 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/whichdb.py | python | whichdb | (filename) | return "" | Guess which db package to use to open a db file.
Return values:
- None if the database file can't be read;
- empty string if the file can be read but can't be recognized
- the module name (e.g. "dbm" or "gdbm") if recognized.
Importing the given module may still fail, and opening the
database... | Guess which db package to use to open a db file. | [
"Guess",
"which",
"db",
"package",
"to",
"use",
"to",
"open",
"a",
"db",
"file",
"."
] | def whichdb(filename):
"""Guess which db package to use to open a db file.
Return values:
- None if the database file can't be read;
- empty string if the file can be read but can't be recognized
- the module name (e.g. "dbm" or "gdbm") if recognized.
Importing the given module may still fail... | [
"def",
"whichdb",
"(",
"filename",
")",
":",
"# Check for dbm first -- this has a .pag and a .dir file",
"try",
":",
"f",
"=",
"open",
"(",
"filename",
"+",
"os",
".",
"extsep",
"+",
"\"pag\"",
",",
"\"rb\"",
")",
"f",
".",
"close",
"(",
")",
"# dbm linked wit... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/whichdb.py#L17-L113 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/grid.py | python | GridCellNumberRenderer.__init__ | (self, *args, **kwargs) | __init__(self) -> GridCellNumberRenderer | __init__(self) -> GridCellNumberRenderer | [
"__init__",
"(",
"self",
")",
"-",
">",
"GridCellNumberRenderer"
] | def __init__(self, *args, **kwargs):
"""__init__(self) -> GridCellNumberRenderer"""
_grid.GridCellNumberRenderer_swiginit(self,_grid.new_GridCellNumberRenderer(*args, **kwargs))
self._setOORInfo(self) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_grid",
".",
"GridCellNumberRenderer_swiginit",
"(",
"self",
",",
"_grid",
".",
"new_GridCellNumberRenderer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"self... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/grid.py#L165-L168 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/cli/command_parser.py | python | parse_tensor_name_with_slicing | (in_str) | return tensor_name, tensor_slicing | Parse tensor name, potentially suffixed by slicing string.
Args:
in_str: (str) Input name of the tensor, potentially followed by a slicing
string. E.g.: Without slicing string: "hidden/weights/Variable:0", with
slicing string: "hidden/weights/Variable:0[1, :]"
Returns:
(str) name of the tensor... | Parse tensor name, potentially suffixed by slicing string. | [
"Parse",
"tensor",
"name",
"potentially",
"suffixed",
"by",
"slicing",
"string",
"."
] | def parse_tensor_name_with_slicing(in_str):
"""Parse tensor name, potentially suffixed by slicing string.
Args:
in_str: (str) Input name of the tensor, potentially followed by a slicing
string. E.g.: Without slicing string: "hidden/weights/Variable:0", with
slicing string: "hidden/weights/Variable:... | [
"def",
"parse_tensor_name_with_slicing",
"(",
"in_str",
")",
":",
"if",
"in_str",
".",
"count",
"(",
"\"[\"",
")",
"==",
"1",
"and",
"in_str",
".",
"endswith",
"(",
"\"]\"",
")",
":",
"tensor_name",
"=",
"in_str",
"[",
":",
"in_str",
".",
"index",
"(",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/cli/command_parser.py#L151-L171 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | RichTextRange.ToInternal | (*args, **kwargs) | return _richtext.RichTextRange_ToInternal(*args, **kwargs) | ToInternal(self) -> RichTextRange
Convert to internal form: (n, n) is the range of a single character. | ToInternal(self) -> RichTextRange | [
"ToInternal",
"(",
"self",
")",
"-",
">",
"RichTextRange"
] | def ToInternal(*args, **kwargs):
"""
ToInternal(self) -> RichTextRange
Convert to internal form: (n, n) is the range of a single character.
"""
return _richtext.RichTextRange_ToInternal(*args, **kwargs) | [
"def",
"ToInternal",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextRange_ToInternal",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L1037-L1043 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/neighbors/approximate.py | python | LSHForest.kneighbors | (self, X, n_neighbors=None, return_distance=True) | Returns n_neighbors of approximate nearest neighbors.
Parameters
----------
X : array_like or sparse (CSR) matrix, shape (n_samples, n_features)
List of n_features-dimensional data points. Each row
corresponds to a single query.
n_neighbors : int, opitonal (def... | Returns n_neighbors of approximate nearest neighbors. | [
"Returns",
"n_neighbors",
"of",
"approximate",
"nearest",
"neighbors",
"."
] | def kneighbors(self, X, n_neighbors=None, return_distance=True):
"""Returns n_neighbors of approximate nearest neighbors.
Parameters
----------
X : array_like or sparse (CSR) matrix, shape (n_samples, n_features)
List of n_features-dimensional data points. Each row
... | [
"def",
"kneighbors",
"(",
"self",
",",
"X",
",",
"n_neighbors",
"=",
"None",
",",
"return_distance",
"=",
"True",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'hash_functions_'",
")",
":",
"raise",
"ValueError",
"(",
"\"estimator should be fitted.\"",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/neighbors/approximate.py#L401-L448 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/bulls-and-cows.py | python | Solution2.getHint | (self, secret, guess) | return "%dA%dB" % (A, B) | :type secret: str
:type guess: str
:rtype: str | :type secret: str
:type guess: str
:rtype: str | [
":",
"type",
"secret",
":",
"str",
":",
"type",
"guess",
":",
"str",
":",
"rtype",
":",
"str"
] | def getHint(self, secret, guess):
"""
:type secret: str
:type guess: str
:rtype: str
"""
A = sum(imap(operator.eq, secret, guess))
B = sum((Counter(secret) & Counter(guess)).values()) - A
return "%dA%dB" % (A, B) | [
"def",
"getHint",
"(",
"self",
",",
"secret",
",",
"guess",
")",
":",
"A",
"=",
"sum",
"(",
"imap",
"(",
"operator",
".",
"eq",
",",
"secret",
",",
"guess",
")",
")",
"B",
"=",
"sum",
"(",
"(",
"Counter",
"(",
"secret",
")",
"&",
"Counter",
"("... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/bulls-and-cows.py#L33-L41 | |
bumptop/BumpTop | 466d23597a07ae738f4265262fa01087fc6e257c | trunk/win/Source/Includes/QtIncludes/src/3rdparty/freetype/src/tools/docmaker/utils.py | python | make_file_list | ( args = None ) | return file_list | builds a list of input files from command-line arguments | builds a list of input files from command-line arguments | [
"builds",
"a",
"list",
"of",
"input",
"files",
"from",
"command",
"-",
"line",
"arguments"
] | def make_file_list( args = None ):
"""builds a list of input files from command-line arguments"""
file_list = []
# sys.stderr.write( repr( sys.argv[1 :] ) + '\n' )
if not args:
args = sys.argv[1 :]
for pathname in args:
if string.find( pathname, '*' ) >= 0:
newpath = g... | [
"def",
"make_file_list",
"(",
"args",
"=",
"None",
")",
":",
"file_list",
"=",
"[",
"]",
"# sys.stderr.write( repr( sys.argv[1 :] ) + '\\n' )",
"if",
"not",
"args",
":",
"args",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"for",
"pathname",
"in",
"args",
... | https://github.com/bumptop/BumpTop/blob/466d23597a07ae738f4265262fa01087fc6e257c/trunk/win/Source/Includes/QtIncludes/src/3rdparty/freetype/src/tools/docmaker/utils.py#L106-L130 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/protobuf/python/mox.py | python | MockAnything._CreateMockMethod | (self, method_name) | return MockMethod(method_name, self._expected_calls_queue,
self._replay_mode) | Create a new mock method call and return it.
Args:
# method name: the name of the method being called.
method_name: str
Returns:
A new MockMethod aware of MockAnything's state (record or replay). | Create a new mock method call and return it. | [
"Create",
"a",
"new",
"mock",
"method",
"call",
"and",
"return",
"it",
"."
] | def _CreateMockMethod(self, method_name):
"""Create a new mock method call and return it.
Args:
# method name: the name of the method being called.
method_name: str
Returns:
A new MockMethod aware of MockAnything's state (record or replay).
"""
return MockMethod(method_name, sel... | [
"def",
"_CreateMockMethod",
"(",
"self",
",",
"method_name",
")",
":",
"return",
"MockMethod",
"(",
"method_name",
",",
"self",
".",
"_expected_calls_queue",
",",
"self",
".",
"_replay_mode",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/protobuf/python/mox.py#L295-L307 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/mantid/plots/mantidaxes.py | python | _WorkspaceArtists.__init__ | (self,
artists,
data_replace_cb,
is_normalized,
workspace_name=None,
spec_num=None,
is_spec=True,
log_name=None,
filtered=True,
expt_info_index=None) | Initialize an instance
:param artists: A reference to a list of artists "attached" to a workspace
:param data_replace_cb: A reference to a callable with signature (artists, workspace) -> new_artists
:param is_normalized: bool specifying whether the line being plotted is a distribution
:p... | Initialize an instance
:param artists: A reference to a list of artists "attached" to a workspace
:param data_replace_cb: A reference to a callable with signature (artists, workspace) -> new_artists
:param is_normalized: bool specifying whether the line being plotted is a distribution
:p... | [
"Initialize",
"an",
"instance",
":",
"param",
"artists",
":",
"A",
"reference",
"to",
"a",
"list",
"of",
"artists",
"attached",
"to",
"a",
"workspace",
":",
"param",
"data_replace_cb",
":",
"A",
"reference",
"to",
"a",
"callable",
"with",
"signature",
"(",
... | def __init__(self,
artists,
data_replace_cb,
is_normalized,
workspace_name=None,
spec_num=None,
is_spec=True,
log_name=None,
filtered=True,
expt_info_index=None):
... | [
"def",
"__init__",
"(",
"self",
",",
"artists",
",",
"data_replace_cb",
",",
"is_normalized",
",",
"workspace_name",
"=",
"None",
",",
"spec_num",
"=",
"None",
",",
"is_spec",
"=",
"True",
",",
"log_name",
"=",
"None",
",",
"filtered",
"=",
"True",
",",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/mantid/plots/mantidaxes.py#L1548-L1581 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pyparsing.py | python | originalTextFor | (expr, asString=True) | return matchExpr | Helper to return the original, untokenized text for a given
expression. Useful to restore the parsed fields of an HTML start
tag into the raw tag text itself, or to revert separate tokens with
intervening whitespace back to the original matching input text. By
default, returns astring containing the or... | Helper to return the original, untokenized text for a given
expression. Useful to restore the parsed fields of an HTML start
tag into the raw tag text itself, or to revert separate tokens with
intervening whitespace back to the original matching input text. By
default, returns astring containing the or... | [
"Helper",
"to",
"return",
"the",
"original",
"untokenized",
"text",
"for",
"a",
"given",
"expression",
".",
"Useful",
"to",
"restore",
"the",
"parsed",
"fields",
"of",
"an",
"HTML",
"start",
"tag",
"into",
"the",
"raw",
"tag",
"text",
"itself",
"or",
"to",... | def originalTextFor(expr, asString=True):
"""Helper to return the original, untokenized text for a given
expression. Useful to restore the parsed fields of an HTML start
tag into the raw tag text itself, or to revert separate tokens with
intervening whitespace back to the original matching input text. ... | [
"def",
"originalTextFor",
"(",
"expr",
",",
"asString",
"=",
"True",
")",
":",
"locMarker",
"=",
"Empty",
"(",
")",
".",
"setParseAction",
"(",
"lambda",
"s",
",",
"loc",
",",
"t",
":",
"loc",
")",
"endlocMarker",
"=",
"locMarker",
".",
"copy",
"(",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pyparsing.py#L5588-L5628 | |
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/pyserial/serial/urlhandler/protocol_socket.py | python | Serial.cd | (self) | return True | Read terminal status line: Carrier Detect | Read terminal status line: Carrier Detect | [
"Read",
"terminal",
"status",
"line",
":",
"Carrier",
"Detect"
] | def cd(self):
"""Read terminal status line: Carrier Detect"""
if not self.is_open:
raise portNotOpenError
if self.logger:
self.logger.info('returning dummy for cd)')
return True | [
"def",
"cd",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_open",
":",
"raise",
"portNotOpenError",
"if",
"self",
".",
"logger",
":",
"self",
".",
"logger",
".",
"info",
"(",
"'returning dummy for cd)'",
")",
"return",
"True"
] | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/pyserial/serial/urlhandler/protocol_socket.py#L328-L334 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/training/saver.py | python | generate_checkpoint_state_proto | (save_dir,
model_checkpoint_path,
all_model_checkpoint_paths=None) | return coord_checkpoint_proto | Generates a checkpoint state proto.
Args:
save_dir: Directory where the model was saved.
model_checkpoint_path: The checkpoint file.
all_model_checkpoint_paths: List of strings. Paths to all not-yet-deleted
checkpoints, sorted from oldest to newest. If this is a non-empty list,
the last ele... | Generates a checkpoint state proto. | [
"Generates",
"a",
"checkpoint",
"state",
"proto",
"."
] | def generate_checkpoint_state_proto(save_dir,
model_checkpoint_path,
all_model_checkpoint_paths=None):
"""Generates a checkpoint state proto.
Args:
save_dir: Directory where the model was saved.
model_checkpoint_path: The checkpoint fi... | [
"def",
"generate_checkpoint_state_proto",
"(",
"save_dir",
",",
"model_checkpoint_path",
",",
"all_model_checkpoint_paths",
"=",
"None",
")",
":",
"if",
"all_model_checkpoint_paths",
"is",
"None",
":",
"all_model_checkpoint_paths",
"=",
"[",
"]",
"if",
"(",
"not",
"al... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/training/saver.py#L755-L796 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/layers/learning_rate_scheduler.py | python | cosine_decay | (learning_rate, step_each_epoch, epochs) | r"""
Applies cosine decay to the learning rate.
when training a model, it is often recommended to lower the learning rate as the
training progresses. By using this function, the learning rate will be decayed by
following cosine decay strategy.
.. math::
decayed\_lr = learning\_rate * 0.5... | r""" | [
"r"
] | def cosine_decay(learning_rate, step_each_epoch, epochs):
r"""
Applies cosine decay to the learning rate.
when training a model, it is often recommended to lower the learning rate as the
training progresses. By using this function, the learning rate will be decayed by
following cosine decay strate... | [
"def",
"cosine_decay",
"(",
"learning_rate",
",",
"step_each_epoch",
",",
"epochs",
")",
":",
"check_type",
"(",
"learning_rate",
",",
"'learning_rate'",
",",
"(",
"float",
",",
"tensor",
".",
"Variable",
")",
",",
"'cosine_decay'",
")",
"with",
"default_main_pr... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/layers/learning_rate_scheduler.py#L444-L487 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py | python | Writer._count_dollars_before_index | (self, s, i) | return dollar_count | Returns the number of '$' characters right in front of s[i]. | Returns the number of '$' characters right in front of s[i]. | [
"Returns",
"the",
"number",
"of",
"$",
"characters",
"right",
"in",
"front",
"of",
"s",
"[",
"i",
"]",
"."
] | def _count_dollars_before_index(self, s, i):
"""Returns the number of '$' characters right in front of s[i]."""
dollar_count = 0
dollar_index = i - 1
while dollar_index > 0 and s[dollar_index] == "$":
dollar_count += 1
dollar_index -= 1
return dollar_count | [
"def",
"_count_dollars_before_index",
"(",
"self",
",",
"s",
",",
"i",
")",
":",
"dollar_count",
"=",
"0",
"dollar_index",
"=",
"i",
"-",
"1",
"while",
"dollar_index",
">",
"0",
"and",
"s",
"[",
"dollar_index",
"]",
"==",
"\"$\"",
":",
"dollar_count",
"+... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py#L115-L122 | |
ledger/ledger | 8e79216887cf3c342dfca1ffa52cf4e6389d6de4 | contrib/non-profit-audit-reports/ooolib2/__init__.py | python | Calc.get_cell_value | (self, col, row) | Get a cell value tuple (type, value) for a given cell | Get a cell value tuple (type, value) for a given cell | [
"Get",
"a",
"cell",
"value",
"tuple",
"(",
"type",
"value",
")",
"for",
"a",
"given",
"cell"
] | def get_cell_value(self, col, row):
"Get a cell value tuple (type, value) for a given cell"
sheetvalue = self.sheets[self.sheet_index].get_sheet_value(col, row)
# We stop here if there is no value for sheetvalue
if sheetvalue == None: return sheetvalue
# Now check to see if we have a value tuple
if 'value' ... | [
"def",
"get_cell_value",
"(",
"self",
",",
"col",
",",
"row",
")",
":",
"sheetvalue",
"=",
"self",
".",
"sheets",
"[",
"self",
".",
"sheet_index",
"]",
".",
"get_sheet_value",
"(",
"col",
",",
"row",
")",
"# We stop here if there is no value for sheetvalue",
"... | https://github.com/ledger/ledger/blob/8e79216887cf3c342dfca1ffa52cf4e6389d6de4/contrib/non-profit-audit-reports/ooolib2/__init__.py#L1017-L1026 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/ftplib.py | python | parse150 | (resp) | return int(m.group(1)) | Parse the '150' response for a RETR request.
Returns the expected transfer size or None; size is not guaranteed to
be present in the 150 message. | Parse the '150' response for a RETR request.
Returns the expected transfer size or None; size is not guaranteed to
be present in the 150 message. | [
"Parse",
"the",
"150",
"response",
"for",
"a",
"RETR",
"request",
".",
"Returns",
"the",
"expected",
"transfer",
"size",
"or",
"None",
";",
"size",
"is",
"not",
"guaranteed",
"to",
"be",
"present",
"in",
"the",
"150",
"message",
"."
] | def parse150(resp):
'''Parse the '150' response for a RETR request.
Returns the expected transfer size or None; size is not guaranteed to
be present in the 150 message.
'''
if resp[:3] != '150':
raise error_reply(resp)
global _150_re
if _150_re is None:
import re
_150... | [
"def",
"parse150",
"(",
"resp",
")",
":",
"if",
"resp",
"[",
":",
"3",
"]",
"!=",
"'150'",
":",
"raise",
"error_reply",
"(",
"resp",
")",
"global",
"_150_re",
"if",
"_150_re",
"is",
"None",
":",
"import",
"re",
"_150_re",
"=",
"re",
".",
"compile",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/ftplib.py#L819-L834 | |
xlgames-inc/XLE | cdd8682367d9e9fdbdda9f79d72bb5b1499cec46 | Foreign/FreeType/src/tools/docmaker/content.py | python | ContentProcessor.__init__ | ( self ) | Initialize a block content processor. | Initialize a block content processor. | [
"Initialize",
"a",
"block",
"content",
"processor",
"."
] | def __init__( self ):
"""Initialize a block content processor."""
self.reset()
self.sections = {} # dictionary of documentation sections
self.section = None # current documentation section
self.chapters = [] # list of chapters
self.headers = {} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"reset",
"(",
")",
"self",
".",
"sections",
"=",
"{",
"}",
"# dictionary of documentation sections",
"self",
".",
"section",
"=",
"None",
"# current documentation section",
"self",
".",
"chapters",
"=",
"[... | https://github.com/xlgames-inc/XLE/blob/cdd8682367d9e9fdbdda9f79d72bb5b1499cec46/Foreign/FreeType/src/tools/docmaker/content.py#L385-L394 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/distutils/dep_util.py | python | newer_group | (sources, target, missing='error') | return False | Return true if 'target' is out-of-date with respect to any file
listed in 'sources'.
In other words, if 'target' exists and is newer
than every file in 'sources', return false; otherwise return true.
'missing' controls what we do when a source file is missing; the
default ("error") is to blow up wi... | Return true if 'target' is out-of-date with respect to any file
listed in 'sources'. | [
"Return",
"true",
"if",
"target",
"is",
"out",
"-",
"of",
"-",
"date",
"with",
"respect",
"to",
"any",
"file",
"listed",
"in",
"sources",
"."
] | def newer_group(sources, target, missing='error'):
"""Return true if 'target' is out-of-date with respect to any file
listed in 'sources'.
In other words, if 'target' exists and is newer
than every file in 'sources', return false; otherwise return true.
'missing' controls what we do when a source f... | [
"def",
"newer_group",
"(",
"sources",
",",
"target",
",",
"missing",
"=",
"'error'",
")",
":",
"# If the target doesn't even exist, then it's definitely out-of-date.",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"target",
")",
":",
"return",
"True",
"# Oth... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/distutils/dep_util.py#L52-L89 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/buttonpanel.py | python | ButtonPanel.DoGetBestSize | (self) | return wx.Size(w, h) | Gets the size which best suits :class:`ButtonPanel`: for a control, it would be
the minimal size which doesn't truncate the control, for a panel - the
same size as it would have after a call to `Fit()`.
:return: An instance of :class:`Size`.
:note: Overridden from :class:`PyPanel`. | Gets the size which best suits :class:`ButtonPanel`: for a control, it would be
the minimal size which doesn't truncate the control, for a panel - the
same size as it would have after a call to `Fit()`. | [
"Gets",
"the",
"size",
"which",
"best",
"suits",
":",
"class",
":",
"ButtonPanel",
":",
"for",
"a",
"control",
"it",
"would",
"be",
"the",
"minimal",
"size",
"which",
"doesn",
"t",
"truncate",
"the",
"control",
"for",
"a",
"panel",
"-",
"the",
"same",
... | def DoGetBestSize(self):
"""
Gets the size which best suits :class:`ButtonPanel`: for a control, it would be
the minimal size which doesn't truncate the control, for a panel - the
same size as it would have after a call to `Fit()`.
:return: An instance of :class:`Size`.
... | [
"def",
"DoGetBestSize",
"(",
"self",
")",
":",
"w",
"=",
"h",
"=",
"btnWidth",
"=",
"btnHeight",
"=",
"0",
"isVertical",
"=",
"self",
".",
"IsVertical",
"(",
")",
"padding",
"=",
"self",
".",
"_art",
".",
"GetMetric",
"(",
"BP_PADDING_SIZE",
")",
"bord... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/buttonpanel.py#L2187-L2247 | |
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/third_party/depot_tools/cpplint.py | python | ProcessFileData | (filename, file_extension, lines, error,
extra_check_functions=[]) | Performs lint checks and reports any errors to the given error function.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
lines: An array of strings, each representing a line of the file, with the
last element being emp... | Performs lint checks and reports any errors to the given error function. | [
"Performs",
"lint",
"checks",
"and",
"reports",
"any",
"errors",
"to",
"the",
"given",
"error",
"function",
"."
] | def ProcessFileData(filename, file_extension, lines, error,
extra_check_functions=[]):
"""Performs lint checks and reports any errors to the given error function.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
... | [
"def",
"ProcessFileData",
"(",
"filename",
",",
"file_extension",
",",
"lines",
",",
"error",
",",
"extra_check_functions",
"=",
"[",
"]",
")",
":",
"lines",
"=",
"(",
"[",
"'// marker so line numbers and indices both start at 1'",
"]",
"+",
"lines",
"+",
"[",
"... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/third_party/depot_tools/cpplint.py#L5762-L5811 | ||
greatscottgadgets/gr-bluetooth | c2a7d7d810e047f8a18902a4e3d1a152420655bb | docs/doxygen/doxyxml/generated/index.py | python | CompoundTypeSub.find_members | (self, details) | return results | Returns a list of all members which match details | Returns a list of all members which match details | [
"Returns",
"a",
"list",
"of",
"all",
"members",
"which",
"match",
"details"
] | def find_members(self, details):
"""
Returns a list of all members which match details
"""
results = []
for member in self.member:
if details.match(member):
results.append(member)
return results | [
"def",
"find_members",
"(",
"self",
",",
"details",
")",
":",
"results",
"=",
"[",
"]",
"for",
"member",
"in",
"self",
".",
"member",
":",
"if",
"details",
".",
"match",
"(",
"member",
")",
":",
"results",
".",
"append",
"(",
"member",
")",
"return",... | https://github.com/greatscottgadgets/gr-bluetooth/blob/c2a7d7d810e047f8a18902a4e3d1a152420655bb/docs/doxygen/doxyxml/generated/index.py#L43-L54 | |
SoarGroup/Soar | a1c5e249499137a27da60533c72969eef3b8ab6b | scons/scons-local-4.1.0/SCons/Tool/packaging/msi.py | python | build_wxsfile_file_section | (root, files, NAME, VERSION, VENDOR, filename_set, id_set) | Builds the Component sections of the wxs file with their included files.
Files need to be specified in 8.3 format and in the long name format, long
filenames will be converted automatically.
Features are specficied with the 'X_MSI_FEATURE' or 'DOC' FileTag. | Builds the Component sections of the wxs file with their included files. | [
"Builds",
"the",
"Component",
"sections",
"of",
"the",
"wxs",
"file",
"with",
"their",
"included",
"files",
"."
] | def build_wxsfile_file_section(root, files, NAME, VERSION, VENDOR, filename_set, id_set):
""" Builds the Component sections of the wxs file with their included files.
Files need to be specified in 8.3 format and in the long name format, long
filenames will be converted automatically.
Features are spec... | [
"def",
"build_wxsfile_file_section",
"(",
"root",
",",
"files",
",",
"NAME",
",",
"VERSION",
",",
"VENDOR",
",",
"filename_set",
",",
"id_set",
")",
":",
"root",
"=",
"create_default_directory_layout",
"(",
"root",
",",
"NAME",
",",
"VERSION",
",",
"VENDOR",
... | https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/Tool/packaging/msi.py#L269-L356 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/requests/sessions.py | python | SessionRedirectMixin.rebuild_method | (self, prepared_request, response) | When being redirected we may want to change the method of the request
based on certain specs or browser behavior. | When being redirected we may want to change the method of the request
based on certain specs or browser behavior. | [
"When",
"being",
"redirected",
"we",
"may",
"want",
"to",
"change",
"the",
"method",
"of",
"the",
"request",
"based",
"on",
"certain",
"specs",
"or",
"browser",
"behavior",
"."
] | def rebuild_method(self, prepared_request, response):
"""When being redirected we may want to change the method of the request
based on certain specs or browser behavior.
"""
method = prepared_request.method
# https://tools.ietf.org/html/rfc7231#section-6.4.4
if response... | [
"def",
"rebuild_method",
"(",
"self",
",",
"prepared_request",
",",
"response",
")",
":",
"method",
"=",
"prepared_request",
".",
"method",
"# https://tools.ietf.org/html/rfc7231#section-6.4.4",
"if",
"response",
".",
"status_code",
"==",
"codes",
".",
"see_other",
"a... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/requests/sessions.py#L314-L334 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | uCSIsHalfwidthandFullwidthForms | (code) | return ret | Check whether the character is part of
HalfwidthandFullwidthForms UCS Block | Check whether the character is part of
HalfwidthandFullwidthForms UCS Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"HalfwidthandFullwidthForms",
"UCS",
"Block"
] | def uCSIsHalfwidthandFullwidthForms(code):
"""Check whether the character is part of
HalfwidthandFullwidthForms UCS Block """
ret = libxml2mod.xmlUCSIsHalfwidthandFullwidthForms(code)
return ret | [
"def",
"uCSIsHalfwidthandFullwidthForms",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsHalfwidthandFullwidthForms",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L1777-L1781 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/graph_editor/util.py | python | get_generating_ops | (ts) | return [t.op for t in ts] | Return all the generating ops of the tensors in `ts`.
Args:
ts: a list of `tf.Tensor`
Returns:
A list of all the generating `tf.Operation` of the tensors in `ts`.
Raises:
TypeError: if `ts` cannot be converted to a list of `tf.Tensor`. | Return all the generating ops of the tensors in `ts`. | [
"Return",
"all",
"the",
"generating",
"ops",
"of",
"the",
"tensors",
"in",
"ts",
"."
] | def get_generating_ops(ts):
"""Return all the generating ops of the tensors in `ts`.
Args:
ts: a list of `tf.Tensor`
Returns:
A list of all the generating `tf.Operation` of the tensors in `ts`.
Raises:
TypeError: if `ts` cannot be converted to a list of `tf.Tensor`.
"""
ts = make_list_of_t(ts, ... | [
"def",
"get_generating_ops",
"(",
"ts",
")",
":",
"ts",
"=",
"make_list_of_t",
"(",
"ts",
",",
"allow_graph",
"=",
"False",
")",
"return",
"[",
"t",
".",
"op",
"for",
"t",
"in",
"ts",
"]"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/graph_editor/util.py#L286-L297 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/summary/writer/event_file_writer.py | python | EventFileWriter.reopen | (self) | Reopens the EventFileWriter.
Can be called after `close()` to add more events in the same directory.
The events will go into a new events file.
Does nothing if the EventFileWriter was not closed. | Reopens the EventFileWriter. | [
"Reopens",
"the",
"EventFileWriter",
"."
] | def reopen(self):
"""Reopens the EventFileWriter.
Can be called after `close()` to add more events in the same directory.
The events will go into a new events file.
Does nothing if the EventFileWriter was not closed.
"""
if self._closed:
self._worker = _EventLoggerThread(self._event_queu... | [
"def",
"reopen",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_worker",
"=",
"_EventLoggerThread",
"(",
"self",
".",
"_event_queue",
",",
"self",
".",
"_ev_writer",
",",
"self",
".",
"_flush_secs",
",",
"self",
".",
"_sentinel_... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/summary/writer/event_file_writer.py#L89-L101 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Tools/CryVersionSelector/crypath.py | python | get_exec_dir | () | return os.path.abspath(dir) | Returns the path to the current running script or frozen executable directory | Returns the path to the current running script or frozen executable directory | [
"Returns",
"the",
"path",
"to",
"the",
"current",
"running",
"script",
"or",
"frozen",
"executable",
"directory"
] | def get_exec_dir():
"""
Returns the path to the current running script or frozen executable directory
"""
if getattr(sys, 'frozen', False):
dir = os.path.dirname(sys.executable)
else:
dir = os.path.dirname(__file__)
return os.path.abspath(dir) | [
"def",
"get_exec_dir",
"(",
")",
":",
"if",
"getattr",
"(",
"sys",
",",
"'frozen'",
",",
"False",
")",
":",
"dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"sys",
".",
"executable",
")",
"else",
":",
"dir",
"=",
"os",
".",
"path",
".",
"dirna... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Tools/CryVersionSelector/crypath.py#L39-L47 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/transforms/references.py | python | InternalTargets.resolve_reference_ids | (self, target) | Given::
<paragraph>
<reference refname="direct internal">
direct internal
<target id="id1" name="direct internal">
The "refname" attribute is replaced by "refid" linking to the target's
"id"::
<paragraph>
<referen... | Given:: | [
"Given",
"::"
] | def resolve_reference_ids(self, target):
"""
Given::
<paragraph>
<reference refname="direct internal">
direct internal
<target id="id1" name="direct internal">
The "refname" attribute is replaced by "refid" linking to the target's
... | [
"def",
"resolve_reference_ids",
"(",
"self",
",",
"target",
")",
":",
"for",
"name",
"in",
"target",
"[",
"'names'",
"]",
":",
"refid",
"=",
"self",
".",
"document",
".",
"nameids",
".",
"get",
"(",
"name",
")",
"reflist",
"=",
"self",
".",
"document",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/transforms/references.py#L377-L405 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/dashboard/services/cephfs.py | python | CephFS.get_quotas | (self, path) | return {'max_bytes': max_bytes, 'max_files': max_files} | Get the quotas of the specified path.
:param path: The path of the directory/file.
:type path: str
:return: Returns a dictionary containing 'max_bytes'
and 'max_files'.
:rtype: dict | Get the quotas of the specified path.
:param path: The path of the directory/file.
:type path: str
:return: Returns a dictionary containing 'max_bytes'
and 'max_files'.
:rtype: dict | [
"Get",
"the",
"quotas",
"of",
"the",
"specified",
"path",
".",
":",
"param",
"path",
":",
"The",
"path",
"of",
"the",
"directory",
"/",
"file",
".",
":",
"type",
"path",
":",
"str",
":",
"return",
":",
"Returns",
"a",
"dictionary",
"containing",
"max_b... | def get_quotas(self, path):
"""
Get the quotas of the specified path.
:param path: The path of the directory/file.
:type path: str
:return: Returns a dictionary containing 'max_bytes'
and 'max_files'.
:rtype: dict
"""
try:
max_bytes... | [
"def",
"get_quotas",
"(",
"self",
",",
"path",
")",
":",
"try",
":",
"max_bytes",
"=",
"int",
"(",
"self",
".",
"cfs",
".",
"getxattr",
"(",
"path",
",",
"'ceph.quota.max_bytes'",
")",
")",
"except",
"cephfs",
".",
"NoData",
":",
"max_bytes",
"=",
"0",... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/dashboard/services/cephfs.py#L228-L245 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py | python | TargetCalculator.find_matching_test_target_names | (self) | return matching_target_names | Returns the set of output test targets. | Returns the set of output test targets. | [
"Returns",
"the",
"set",
"of",
"output",
"test",
"targets",
"."
] | def find_matching_test_target_names(self):
"""Returns the set of output test targets."""
assert self.is_build_impacted()
# Find the test targets first. 'all' is special cased to mean all the
# root targets. To deal with all the supplied |test_targets| are expanded
# to include the root targets durin... | [
"def",
"find_matching_test_target_names",
"(",
"self",
")",
":",
"assert",
"self",
".",
"is_build_impacted",
"(",
")",
"# Find the test targets first. 'all' is special cased to mean all the",
"# root targets. To deal with all the supplied |test_targets| are expanded",
"# to include the r... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py#L626-L667 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/waflib/Tools/xlcxx.py | python | xlcxx_common_flags | (conf) | Flags required for executing the Aix C++ compiler | Flags required for executing the Aix C++ compiler | [
"Flags",
"required",
"for",
"executing",
"the",
"Aix",
"C",
"++",
"compiler"
] | def xlcxx_common_flags(conf):
"""
Flags required for executing the Aix C++ compiler
"""
v = conf.env
v['CXX_SRC_F'] = []
v['CXX_TGT_F'] = ['-c', '-o']
# linker
if not v['LINK_CXX']: v['LINK_CXX'] = v['CXX']
v['CXXLNK_SRC_F'] = []
v['CXXLNK_TGT_F'] = ['-o']
v['CPPPATH_ST'] ... | [
"def",
"xlcxx_common_flags",
"(",
"conf",
")",
":",
"v",
"=",
"conf",
".",
"env",
"v",
"[",
"'CXX_SRC_F'",
"]",
"=",
"[",
"]",
"v",
"[",
"'CXX_TGT_F'",
"]",
"=",
"[",
"'-c'",
",",
"'-o'",
"]",
"# linker",
"if",
"not",
"v",
"[",
"'LINK_CXX'",
"]",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/waflib/Tools/xlcxx.py#L23-L60 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/sparse/dok.py | python | dok_matrix.getrow | (self, i) | return new | Returns the i-th row as a (1 x n) DOK matrix. | Returns the i-th row as a (1 x n) DOK matrix. | [
"Returns",
"the",
"i",
"-",
"th",
"row",
"as",
"a",
"(",
"1",
"x",
"n",
")",
"DOK",
"matrix",
"."
] | def getrow(self, i):
"""Returns the i-th row as a (1 x n) DOK matrix."""
new = dok_matrix((1, self.shape[1]), dtype=self.dtype)
dict.update(new, (((0, j), self[i, j]) for j in xrange(self.shape[1])))
return new | [
"def",
"getrow",
"(",
"self",
",",
"i",
")",
":",
"new",
"=",
"dok_matrix",
"(",
"(",
"1",
",",
"self",
".",
"shape",
"[",
"1",
"]",
")",
",",
"dtype",
"=",
"self",
".",
"dtype",
")",
"dict",
".",
"update",
"(",
"new",
",",
"(",
"(",
"(",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/sparse/dok.py#L455-L459 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/dirichlet.py | python | Dirichlet.name | (self) | return self._name | Name to prepend to all ops. | Name to prepend to all ops. | [
"Name",
"to",
"prepend",
"to",
"all",
"ops",
"."
] | def name(self):
"""Name to prepend to all ops."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/dirichlet.py#L162-L164 | |
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/pymcuprog/backend.py | python | Backend.read_tool_info | (self) | return read_tool_info(self.housekeeper) | Interrogates tool (debugger) for useful info
:returns: Dictionary with various info about the connected debugger
:raises PymcuprogToolConnectionError if not connected to any USB HID tool (connect_to_tool not run) | Interrogates tool (debugger) for useful info | [
"Interrogates",
"tool",
"(",
"debugger",
")",
"for",
"useful",
"info"
] | def read_tool_info(self):
"""
Interrogates tool (debugger) for useful info
:returns: Dictionary with various info about the connected debugger
:raises PymcuprogToolConnectionError if not connected to any USB HID tool (connect_to_tool not run)
"""
self._is_hid_tool_not_c... | [
"def",
"read_tool_info",
"(",
"self",
")",
":",
"self",
".",
"_is_hid_tool_not_connected_raise",
"(",
")",
"return",
"read_tool_info",
"(",
"self",
".",
"housekeeper",
")"
] | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/pymcuprog/backend.py#L182-L192 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/util/timeout.py | python | Timeout.start_connect | (self) | return self._start_connect | Start the timeout clock, used during a connect() attempt
:raises urllib3.exceptions.TimeoutStateError: if you attempt
to start a timer that has been started already. | Start the timeout clock, used during a connect() attempt | [
"Start",
"the",
"timeout",
"clock",
"used",
"during",
"a",
"connect",
"()",
"attempt"
] | def start_connect(self):
"""Start the timeout clock, used during a connect() attempt
:raises urllib3.exceptions.TimeoutStateError: if you attempt
to start a timer that has been started already.
"""
if self._start_connect is not None:
raise TimeoutStateError("Time... | [
"def",
"start_connect",
"(",
"self",
")",
":",
"if",
"self",
".",
"_start_connect",
"is",
"not",
"None",
":",
"raise",
"TimeoutStateError",
"(",
"\"Timeout timer has already been started.\"",
")",
"self",
".",
"_start_connect",
"=",
"current_time",
"(",
")",
"retu... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/util/timeout.py#L195-L204 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/contrib/model_stat.py | python | _verify_dependent_package | () | Verify whether `prettytable` is installed. | Verify whether `prettytable` is installed. | [
"Verify",
"whether",
"prettytable",
"is",
"installed",
"."
] | def _verify_dependent_package():
"""
Verify whether `prettytable` is installed.
"""
try:
from prettytable import PrettyTable
except ImportError:
raise ImportError(
"paddle.summary() requires package `prettytable`, place install it firstly using `pip install prettytable`. ... | [
"def",
"_verify_dependent_package",
"(",
")",
":",
"try",
":",
"from",
"prettytable",
"import",
"PrettyTable",
"except",
"ImportError",
":",
"raise",
"ImportError",
"(",
"\"paddle.summary() requires package `prettytable`, place install it firstly using `pip install prettytable`. \"... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/contrib/model_stat.py#L181-L190 | ||
sailing-pmls/bosen | 06cb58902d011fbea5f9428f10ce30e621492204 | style_script/cpplint.py | python | IsBlankLine | (line) | return not line or line.isspace() | Returns true if the given line is blank.
We consider a line to be blank if the line is empty or consists of
only white spaces.
Args:
line: A line of a string.
Returns:
True, if the given line is blank. | Returns true if the given line is blank. | [
"Returns",
"true",
"if",
"the",
"given",
"line",
"is",
"blank",
"."
] | def IsBlankLine(line):
"""Returns true if the given line is blank.
We consider a line to be blank if the line is empty or consists of
only white spaces.
Args:
line: A line of a string.
Returns:
True, if the given line is blank.
"""
return not line or line.isspace() | [
"def",
"IsBlankLine",
"(",
"line",
")",
":",
"return",
"not",
"line",
"or",
"line",
".",
"isspace",
"(",
")"
] | https://github.com/sailing-pmls/bosen/blob/06cb58902d011fbea5f9428f10ce30e621492204/style_script/cpplint.py#L2813-L2825 | |
OpenChemistry/tomviz | 0a903679318f191cb7dd3eb5ff5bc3a7d3320d9a | tomviz/python/tomviz/io/dm.py | python | FileDM.__enter__ | (self) | return self | Implement python's with statement | Implement python's with statement | [
"Implement",
"python",
"s",
"with",
"statement"
] | def __enter__(self):
"""Implement python's with statement
"""
return self | [
"def",
"__enter__",
"(",
"self",
")",
":",
"return",
"self"
] | https://github.com/OpenChemistry/tomviz/blob/0a903679318f191cb7dd3eb5ff5bc3a7d3320d9a/tomviz/python/tomviz/io/dm.py#L241-L245 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/framework/python/framework/checkpoint_utils.py | python | load_checkpoint | (filepattern) | return train.NewCheckpointReader(filename) | Returns CheckpointReader for latest checkpoint.
Args:
filepattern: Directory with checkpoints file or path to checkpoint.
Returns:
`CheckpointReader` object.
Raises:
ValueError: if checkpoint_dir doesn't have 'checkpoint' file or checkpoints. | Returns CheckpointReader for latest checkpoint. | [
"Returns",
"CheckpointReader",
"for",
"latest",
"checkpoint",
"."
] | def load_checkpoint(filepattern):
"""Returns CheckpointReader for latest checkpoint.
Args:
filepattern: Directory with checkpoints file or path to checkpoint.
Returns:
`CheckpointReader` object.
Raises:
ValueError: if checkpoint_dir doesn't have 'checkpoint' file or checkpoints.
"""
filename ... | [
"def",
"load_checkpoint",
"(",
"filepattern",
")",
":",
"filename",
"=",
"_get_checkpoint_filename",
"(",
"filepattern",
")",
"if",
"filename",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Couldn't find 'checkpoint' file or checkpoints in \"",
"\"given directory %s\"",... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/framework/python/framework/checkpoint_utils.py#L47-L63 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | Rect.SetHeight | (*args, **kwargs) | return _core_.Rect_SetHeight(*args, **kwargs) | SetHeight(self, int h) | SetHeight(self, int h) | [
"SetHeight",
"(",
"self",
"int",
"h",
")"
] | def SetHeight(*args, **kwargs):
"""SetHeight(self, int h)"""
return _core_.Rect_SetHeight(*args, **kwargs) | [
"def",
"SetHeight",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Rect_SetHeight",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L1297-L1299 | |
facebook/fbthrift | fb9c8562aba04c4fd9b17716eb5d970cc88a75bb | thrift/lib/py/transport/TSSLSocket.py | python | TSSLServerSocket.setCertfile | (self, certfile) | Set or change the server certificate file used to wrap new
connections.
@param certfile: The filename of the server certificate, i.e.
'/etc/certs/server.pem'
@type certfile: str
Raises an IOError exception if the certfile is not present or
unreadable. | Set or change the server certificate file used to wrap new
connections. | [
"Set",
"or",
"change",
"the",
"server",
"certificate",
"file",
"used",
"to",
"wrap",
"new",
"connections",
"."
] | def setCertfile(self, certfile):
"""Set or change the server certificate file used to wrap new
connections.
@param certfile: The filename of the server certificate, i.e.
'/etc/certs/server.pem'
@type certfile: str
Raises an IOError exception if the cert... | [
"def",
"setCertfile",
"(",
"self",
",",
"certfile",
")",
":",
"if",
"not",
"os",
".",
"access",
"(",
"certfile",
",",
"os",
".",
"R_OK",
")",
":",
"raise",
"IOError",
"(",
"'No such certfile found: %s'",
"%",
"(",
"certfile",
")",
")",
"self",
".",
"ce... | https://github.com/facebook/fbthrift/blob/fb9c8562aba04c4fd9b17716eb5d970cc88a75bb/thrift/lib/py/transport/TSSLSocket.py#L314-L327 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/sparse/construct.py | python | identity | (n, dtype='d', format=None) | return eye(n, n, dtype=dtype, format=format) | Identity matrix in sparse format
Returns an identity matrix with shape (n,n) using a given
sparse format and dtype.
Parameters
----------
n : int
Shape of the identity matrix.
dtype : dtype, optional
Data type of the matrix
format : str, optional
Sparse format of th... | Identity matrix in sparse format | [
"Identity",
"matrix",
"in",
"sparse",
"format"
] | def identity(n, dtype='d', format=None):
"""Identity matrix in sparse format
Returns an identity matrix with shape (n,n) using a given
sparse format and dtype.
Parameters
----------
n : int
Shape of the identity matrix.
dtype : dtype, optional
Data type of the matrix
fo... | [
"def",
"identity",
"(",
"n",
",",
"dtype",
"=",
"'d'",
",",
"format",
"=",
"None",
")",
":",
"return",
"eye",
"(",
"n",
",",
"n",
",",
"dtype",
"=",
"dtype",
",",
"format",
"=",
"format",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/sparse/construct.py#L190-L217 | |
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/scripts/exomerge2.py | python | ExodusModel._get_displacement_field_values | (self) | return displacement_field_list | Return a list of the displacement field names.
This will create them if they do not already exist. | Return a list of the displacement field names. | [
"Return",
"a",
"list",
"of",
"the",
"displacement",
"field",
"names",
"."
] | def _get_displacement_field_values(self):
"""
Return a list of the displacement field names.
This will create them if they do not already exist.
"""
self.create_displacement_field()
prefix = self._get_displacement_field_prefix()
displacement_field_list = []
... | [
"def",
"_get_displacement_field_values",
"(",
"self",
")",
":",
"self",
".",
"create_displacement_field",
"(",
")",
"prefix",
"=",
"self",
".",
"_get_displacement_field_prefix",
"(",
")",
"displacement_field_list",
"=",
"[",
"]",
"for",
"component",
"in",
"[",
"'x... | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exomerge2.py#L3036-L3049 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/chigger/filters/RotationalExtrusionFilter.py | python | RotationalExtrusionFilter.update | (self, **kwargs) | Computes the contour levels for the vtkContourFilter. | Computes the contour levels for the vtkContourFilter. | [
"Computes",
"the",
"contour",
"levels",
"for",
"the",
"vtkContourFilter",
"."
] | def update(self, **kwargs):
"""
Computes the contour levels for the vtkContourFilter.
"""
super(RotationalExtrusionFilter, self).update(**kwargs)
if self.isOptionValid('angle'):
self._vtkfilter.SetAngle(self.getOption('angle'))
if self.isOptionValid('resolut... | [
"def",
"update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"RotationalExtrusionFilter",
",",
"self",
")",
".",
"update",
"(",
"*",
"*",
"kwargs",
")",
"if",
"self",
".",
"isOptionValid",
"(",
"'angle'",
")",
":",
"self",
".",
"_vt... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/chigger/filters/RotationalExtrusionFilter.py#L32-L42 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextParagraphLayoutBox.GetParagraphCount | (*args, **kwargs) | return _richtext.RichTextParagraphLayoutBox_GetParagraphCount(*args, **kwargs) | GetParagraphCount(self) -> int | GetParagraphCount(self) -> int | [
"GetParagraphCount",
"(",
"self",
")",
"-",
">",
"int"
] | def GetParagraphCount(*args, **kwargs):
"""GetParagraphCount(self) -> int"""
return _richtext.RichTextParagraphLayoutBox_GetParagraphCount(*args, **kwargs) | [
"def",
"GetParagraphCount",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextParagraphLayoutBox_GetParagraphCount",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L1708-L1710 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/reshape/tile.py | python | _coerce_to_type | (x) | return x, dtype | if the passed data is of datetime/timedelta, bool or nullable int type,
this method converts it to numeric so that cut or qcut method can
handle it | if the passed data is of datetime/timedelta, bool or nullable int type,
this method converts it to numeric so that cut or qcut method can
handle it | [
"if",
"the",
"passed",
"data",
"is",
"of",
"datetime",
"/",
"timedelta",
"bool",
"or",
"nullable",
"int",
"type",
"this",
"method",
"converts",
"it",
"to",
"numeric",
"so",
"that",
"cut",
"or",
"qcut",
"method",
"can",
"handle",
"it"
] | def _coerce_to_type(x):
"""
if the passed data is of datetime/timedelta, bool or nullable int type,
this method converts it to numeric so that cut or qcut method can
handle it
"""
dtype = None
if is_datetime64tz_dtype(x):
dtype = x.dtype
elif is_datetime64_dtype(x):
x = ... | [
"def",
"_coerce_to_type",
"(",
"x",
")",
":",
"dtype",
"=",
"None",
"if",
"is_datetime64tz_dtype",
"(",
"x",
")",
":",
"dtype",
"=",
"x",
".",
"dtype",
"elif",
"is_datetime64_dtype",
"(",
"x",
")",
":",
"x",
"=",
"to_datetime",
"(",
"x",
")",
"dtype",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/reshape/tile.py#L429-L459 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/html5lib/treebuilders/base.py | python | TreeBuilder.getDocument | (self) | return self.document | Return the final tree | Return the final tree | [
"Return",
"the",
"final",
"tree"
] | def getDocument(self):
"""Return the final tree"""
return self.document | [
"def",
"getDocument",
"(",
"self",
")",
":",
"return",
"self",
".",
"document"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/html5lib/treebuilders/base.py#L400-L402 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBProcess.SetSelectedThreadByID | (self, tid) | return _lldb.SBProcess_SetSelectedThreadByID(self, tid) | SetSelectedThreadByID(SBProcess self, lldb::tid_t tid) -> bool | SetSelectedThreadByID(SBProcess self, lldb::tid_t tid) -> bool | [
"SetSelectedThreadByID",
"(",
"SBProcess",
"self",
"lldb",
"::",
"tid_t",
"tid",
")",
"-",
">",
"bool"
] | def SetSelectedThreadByID(self, tid):
"""SetSelectedThreadByID(SBProcess self, lldb::tid_t tid) -> bool"""
return _lldb.SBProcess_SetSelectedThreadByID(self, tid) | [
"def",
"SetSelectedThreadByID",
"(",
"self",
",",
"tid",
")",
":",
"return",
"_lldb",
".",
"SBProcess_SetSelectedThreadByID",
"(",
"self",
",",
"tid",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L8446-L8448 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py | python | convert_multinomial | (node, **kwargs) | return [node] | Map MXNet's multinomial operator attributes to onnx's
Multinomial operator and return the created node. | Map MXNet's multinomial operator attributes to onnx's
Multinomial operator and return the created node. | [
"Map",
"MXNet",
"s",
"multinomial",
"operator",
"attributes",
"to",
"onnx",
"s",
"Multinomial",
"operator",
"and",
"return",
"the",
"created",
"node",
"."
] | def convert_multinomial(node, **kwargs):
"""Map MXNet's multinomial operator attributes to onnx's
Multinomial operator and return the created node.
"""
name, input_nodes, attrs = get_inputs(node, kwargs)
dtype = onnx.mapping.NP_TYPE_TO_TENSOR_TYPE[np.dtype(attrs.get("dtype", 'int32'))]
sample_si... | [
"def",
"convert_multinomial",
"(",
"node",
",",
"*",
"*",
"kwargs",
")",
":",
"name",
",",
"input_nodes",
",",
"attrs",
"=",
"get_inputs",
"(",
"node",
",",
"kwargs",
")",
"dtype",
"=",
"onnx",
".",
"mapping",
".",
"NP_TYPE_TO_TENSOR_TYPE",
"[",
"np",
".... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py#L2578-L2597 | |
greenheartgames/greenworks | 3ea4ab490b56676de3f0a237c74bcfdb17323e60 | deps/cpplint/cpplint.py | python | CheckSpacing | (filename, clean_lines, linenum, nesting_state, error) | Checks for the correctness of various spacing issues in the code.
Things we check for: spaces around operators, spaces after
if/for/while/switch, no spaces around parens in function calls, two
spaces between code and comment, don't start a block with a blank
line, don't end a function with a blank line, don't ... | Checks for the correctness of various spacing issues in the code. | [
"Checks",
"for",
"the",
"correctness",
"of",
"various",
"spacing",
"issues",
"in",
"the",
"code",
"."
] | def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
"""Checks for the correctness of various spacing issues in the code.
Things we check for: spaces around operators, spaces after
if/for/while/switch, no spaces around parens in function calls, two
spaces between code and comment, don't star... | [
"def",
"CheckSpacing",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"# Don't use \"elided\" lines here, otherwise we can't check commented lines.",
"# Don't want to use \"raw\" either, because we don't want to check inside C++11",
... | https://github.com/greenheartgames/greenworks/blob/3ea4ab490b56676de3f0a237c74bcfdb17323e60/deps/cpplint/cpplint.py#L3105-L3230 | ||
etotheipi/BitcoinArmory | 2a6fc5355bb0c6fe26e387ccba30a5baafe8cd98 | armoryengine/torrentDL.py | python | TorrentDownloadManager.finishedFunc | (self) | This function must rename the ".partial" function to the correct name | This function must rename the ".partial" function to the correct name | [
"This",
"function",
"must",
"rename",
"the",
".",
"partial",
"function",
"to",
"the",
"correct",
"name"
] | def finishedFunc(self):
"""
This function must rename the ".partial" function to the correct name
"""
self.finishTime = RightNow()
LOGINFO('Download finished!')
LOGINFO("Moving file")
LOGINFO(" From: %s", self.savePath_temp)
LOGINFO(" To: %s", self.savePath... | [
"def",
"finishedFunc",
"(",
"self",
")",
":",
"self",
".",
"finishTime",
"=",
"RightNow",
"(",
")",
"LOGINFO",
"(",
"'Download finished!'",
")",
"LOGINFO",
"(",
"\"Moving file\"",
")",
"LOGINFO",
"(",
"\" From: %s\"",
",",
"self",
".",
"savePath_temp",
")",... | https://github.com/etotheipi/BitcoinArmory/blob/2a6fc5355bb0c6fe26e387ccba30a5baafe8cd98/armoryengine/torrentDL.py#L268-L285 | ||
apache/singa | 93fd9da72694e68bfe3fb29d0183a65263d238a1 | python/singa/autograd.py | python | CrossEntropy.backward | (self, dy=1.0) | Args:
dy (float or CTensor): scalar, accumulate gradient from outside
of current network, usually equal to 1.0
Returns:
dx (CTensor): data for the dL /dx, L is the loss, x is the output
of current network. note that this is true f... | Args:
dy (float or CTensor): scalar, accumulate gradient from outside
of current network, usually equal to 1.0
Returns:
dx (CTensor): data for the dL /dx, L is the loss, x is the output
of current network. note that this is true f... | [
"Args",
":",
"dy",
"(",
"float",
"or",
"CTensor",
")",
":",
"scalar",
"accumulate",
"gradient",
"from",
"outside",
"of",
"current",
"network",
"usually",
"equal",
"to",
"1",
".",
"0",
"Returns",
":",
"dx",
"(",
"CTensor",
")",
":",
"data",
"for",
"the"... | def backward(self, dy=1.0):
"""
Args:
dy (float or CTensor): scalar, accumulate gradient from outside
of current network, usually equal to 1.0
Returns:
dx (CTensor): data for the dL /dx, L is the loss, x is the output
... | [
"def",
"backward",
"(",
"self",
",",
"dy",
"=",
"1.0",
")",
":",
"dx",
"=",
"singa",
".",
"__div__",
"(",
"self",
".",
"t",
",",
"self",
".",
"x",
")",
"dx",
"*=",
"float",
"(",
"-",
"1.0",
"/",
"self",
".",
"x",
".",
"shape",
"(",
")",
"["... | https://github.com/apache/singa/blob/93fd9da72694e68bfe3fb29d0183a65263d238a1/python/singa/autograd.py#L1236-L1254 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/nn_ops.py | python | _AvgPoolGradShape | (op) | Shape function for the AvgPoolGrad op. | Shape function for the AvgPoolGrad op. | [
"Shape",
"function",
"for",
"the",
"AvgPoolGrad",
"op",
"."
] | def _AvgPoolGradShape(op):
"""Shape function for the AvgPoolGrad op."""
orig_input_shape = tensor_util.constant_value(op.inputs[0])
if orig_input_shape is not None:
return [tensor_shape.TensorShape(orig_input_shape.tolist())]
else:
# NOTE(mrry): We could in principle work out the shape from the
# gr... | [
"def",
"_AvgPoolGradShape",
"(",
"op",
")",
":",
"orig_input_shape",
"=",
"tensor_util",
".",
"constant_value",
"(",
"op",
".",
"inputs",
"[",
"0",
"]",
")",
"if",
"orig_input_shape",
"is",
"not",
"None",
":",
"return",
"[",
"tensor_shape",
".",
"TensorShape... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/nn_ops.py#L782-L792 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/oauthlib/oauth2/rfc6749/parameters.py | python | validate_token_parameters | (params) | Ensures token precence, token type, expiration and scope in params. | Ensures token precence, token type, expiration and scope in params. | [
"Ensures",
"token",
"precence",
"token",
"type",
"expiration",
"and",
"scope",
"in",
"params",
"."
] | def validate_token_parameters(params):
"""Ensures token precence, token type, expiration and scope in params."""
if 'error' in params:
raise_from_error(params.get('error'), params)
if not 'access_token' in params:
raise MissingTokenError(description="Missing access token parameter.")
i... | [
"def",
"validate_token_parameters",
"(",
"params",
")",
":",
"if",
"'error'",
"in",
"params",
":",
"raise_from_error",
"(",
"params",
".",
"get",
"(",
"'error'",
")",
",",
"params",
")",
"if",
"not",
"'access_token'",
"in",
"params",
":",
"raise",
"MissingTo... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/oauthlib/oauth2/rfc6749/parameters.py#L383-L409 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.