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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/profiler/parser/framework_parser.py | python | FrameworkParser._construct_task_id_op_attr_dict | (self, prof_tensor_data) | return task_id_op_attr_dict | prof_tensor_data is a list[tensor_data], tensor_data is a dict, key is same as TENSOR_DATA_STRUCT. | prof_tensor_data is a list[tensor_data], tensor_data is a dict, key is same as TENSOR_DATA_STRUCT. | [
"prof_tensor_data",
"is",
"a",
"list",
"[",
"tensor_data",
"]",
"tensor_data",
"is",
"a",
"dict",
"key",
"is",
"same",
"as",
"TENSOR_DATA_STRUCT",
"."
] | def _construct_task_id_op_attr_dict(self, prof_tensor_data):
"""prof_tensor_data is a list[tensor_data], tensor_data is a dict, key is same as TENSOR_DATA_STRUCT."""
task_id_op_attr_dict = defaultdict(list)
for tensor_data in prof_tensor_data:
task_id = combine_stream_task_id(tensor_... | [
"def",
"_construct_task_id_op_attr_dict",
"(",
"self",
",",
"prof_tensor_data",
")",
":",
"task_id_op_attr_dict",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"tensor_data",
"in",
"prof_tensor_data",
":",
"task_id",
"=",
"combine_stream_task_id",
"(",
"tensor_data",
"... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/profiler/parser/framework_parser.py#L316-L347 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/layers/local.py | python | local_conv_matmul | (inputs, kernel, kernel_mask, output_shape) | return output | Apply N-D convolution with un-shared weights using a single matmul call.
This method outputs `inputs . (kernel * kernel_mask)`
(with `.` standing for matrix-multiply and `*` for element-wise multiply)
and requires a precomputed `kernel_mask` to zero-out weights in `kernel` and
hence perform the same operation ... | Apply N-D convolution with un-shared weights using a single matmul call. | [
"Apply",
"N",
"-",
"D",
"convolution",
"with",
"un",
"-",
"shared",
"weights",
"using",
"a",
"single",
"matmul",
"call",
"."
] | def local_conv_matmul(inputs, kernel, kernel_mask, output_shape):
"""Apply N-D convolution with un-shared weights using a single matmul call.
This method outputs `inputs . (kernel * kernel_mask)`
(with `.` standing for matrix-multiply and `*` for element-wise multiply)
and requires a precomputed `kernel_mask` ... | [
"def",
"local_conv_matmul",
"(",
"inputs",
",",
"kernel",
",",
"kernel_mask",
",",
"output_shape",
")",
":",
"inputs_flat",
"=",
"K",
".",
"reshape",
"(",
"inputs",
",",
"(",
"K",
".",
"shape",
"(",
"inputs",
")",
"[",
"0",
"]",
",",
"-",
"1",
")",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/layers/local.py#L721-L772 | |
JumpingYang001/webrtc | c03d6e965e1f54aeadd670e491eabe5fdb8db968 | PRESUBMIT.py | python | CheckApprovedFilesLintClean | (input_api, output_api,
source_file_filter=None) | return result | Checks that all new or non-exempt .cc and .h files pass cpplint.py.
This check is based on CheckChangeLintsClean in
depot_tools/presubmit_canned_checks.py but has less filters and only checks
added files. | Checks that all new or non-exempt .cc and .h files pass cpplint.py.
This check is based on CheckChangeLintsClean in
depot_tools/presubmit_canned_checks.py but has less filters and only checks
added files. | [
"Checks",
"that",
"all",
"new",
"or",
"non",
"-",
"exempt",
".",
"cc",
"and",
".",
"h",
"files",
"pass",
"cpplint",
".",
"py",
".",
"This",
"check",
"is",
"based",
"on",
"CheckChangeLintsClean",
"in",
"depot_tools",
"/",
"presubmit_canned_checks",
".",
"py... | def CheckApprovedFilesLintClean(input_api, output_api,
source_file_filter=None):
"""Checks that all new or non-exempt .cc and .h files pass cpplint.py.
This check is based on CheckChangeLintsClean in
depot_tools/presubmit_canned_checks.py but has less filters and only checks
ad... | [
"def",
"CheckApprovedFilesLintClean",
"(",
"input_api",
",",
"output_api",
",",
"source_file_filter",
"=",
"None",
")",
":",
"result",
"=",
"[",
"]",
"# Initialize cpplint.",
"import",
"cpplint",
"# Access to a protected member _XX of a client class",
"# pylint: disable=W0212... | https://github.com/JumpingYang001/webrtc/blob/c03d6e965e1f54aeadd670e491eabe5fdb8db968/PRESUBMIT.py#L280-L325 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/document.py | python | Document.find | (
self,
sub: str,
in_current_line: bool = False,
include_current_position: bool = False,
ignore_case: bool = False,
count: int = 1,
) | return None | Find `text` after the cursor, return position relative to the cursor
position. Return `None` if nothing was found.
:param count: Find the n-th occurrence. | Find `text` after the cursor, return position relative to the cursor
position. Return `None` if nothing was found. | [
"Find",
"text",
"after",
"the",
"cursor",
"return",
"position",
"relative",
"to",
"the",
"cursor",
"position",
".",
"Return",
"None",
"if",
"nothing",
"was",
"found",
"."
] | def find(
self,
sub: str,
in_current_line: bool = False,
include_current_position: bool = False,
ignore_case: bool = False,
count: int = 1,
) -> Optional[int]:
"""
Find `text` after the cursor, return position relative to the cursor
position. R... | [
"def",
"find",
"(",
"self",
",",
"sub",
":",
"str",
",",
"in_current_line",
":",
"bool",
"=",
"False",
",",
"include_current_position",
":",
"bool",
"=",
"False",
",",
"ignore_case",
":",
"bool",
"=",
"False",
",",
"count",
":",
"int",
"=",
"1",
",",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/document.py#L368-L407 | |
alibaba/graph-learn | 54cafee9db3054dc310a28b856be7f97c7d5aee9 | graphlearn/python/nn/dataset.py | python | Dataset._get_mask | (self, alias) | return feat_masks, id_masks, sparse_masks | The masks for features, ids and offsets.
feat_masks: a list of boolean, each element indicates that data
has int_attrs, float_attrs, string_attrs, lables, weights.
id_masks: for Nodes is [True, False], for Edges is [True, True].
sparse_masks: one boolean element list that indicates whether the object
... | The masks for features, ids and offsets.
feat_masks: a list of boolean, each element indicates that data
has int_attrs, float_attrs, string_attrs, lables, weights.
id_masks: for Nodes is [True, False], for Edges is [True, True].
sparse_masks: one boolean element list that indicates whether the object
... | [
"The",
"masks",
"for",
"features",
"ids",
"and",
"offsets",
".",
"feat_masks",
":",
"a",
"list",
"of",
"boolean",
"each",
"element",
"indicates",
"that",
"data",
"has",
"int_attrs",
"float_attrs",
"string_attrs",
"lables",
"weights",
".",
"id_masks",
":",
"for... | def _get_mask(self, alias):
"""The masks for features, ids and offsets.
feat_masks: a list of boolean, each element indicates that data
has int_attrs, float_attrs, string_attrs, lables, weights.
id_masks: for Nodes is [True, False], for Edges is [True, True].
sparse_masks: one boolean element list t... | [
"def",
"_get_mask",
"(",
"self",
",",
"alias",
")",
":",
"node",
"=",
"self",
".",
"_dag",
".",
"get_node",
"(",
"alias",
")",
"node_decoder",
"=",
"node",
".",
"decoder",
"feats",
"=",
"(",
"'int_attr_num'",
",",
"'float_attr_num'",
",",
"'string_attr_num... | https://github.com/alibaba/graph-learn/blob/54cafee9db3054dc310a28b856be7f97c7d5aee9/graphlearn/python/nn/dataset.py#L177-L211 | |
koth/kcws | 88efbd36a7022de4e6e90f5a1fb880cf87cfae9f | third_party/setuptools/pkg_resources.py | python | ContextualZipFile.__new__ | (cls, *args, **kwargs) | return super(ContextualZipFile, cls).__new__(cls) | Construct a ZipFile or ContextualZipFile as appropriate | Construct a ZipFile or ContextualZipFile as appropriate | [
"Construct",
"a",
"ZipFile",
"or",
"ContextualZipFile",
"as",
"appropriate"
] | def __new__(cls, *args, **kwargs):
"""
Construct a ZipFile or ContextualZipFile as appropriate
"""
if hasattr(zipfile.ZipFile, '__exit__'):
return zipfile.ZipFile(*args, **kwargs)
return super(ContextualZipFile, cls).__new__(cls) | [
"def",
"__new__",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"hasattr",
"(",
"zipfile",
".",
"ZipFile",
",",
"'__exit__'",
")",
":",
"return",
"zipfile",
".",
"ZipFile",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
... | https://github.com/koth/kcws/blob/88efbd36a7022de4e6e90f5a1fb880cf87cfae9f/third_party/setuptools/pkg_resources.py#L1573-L1579 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/mantid/kernel/plugins.py | python | check_for_plugins | (top_dir) | return False | Runs a quick check to see if any plugin files exist in the given directory
@returns True if any plugins are found, false otherwise | Runs a quick check to see if any plugin files exist in the given directory | [
"Runs",
"a",
"quick",
"check",
"to",
"see",
"if",
"any",
"plugin",
"files",
"exist",
"in",
"the",
"given",
"directory"
] | def check_for_plugins(top_dir):
"""
Runs a quick check to see if any plugin files exist in the given directory
@returns True if any plugins are found, false otherwise
"""
if not _os.path.isdir(top_dir):
return False
for root, dirs, files in _os.walk(top_dir):
for f in f... | [
"def",
"check_for_plugins",
"(",
"top_dir",
")",
":",
"if",
"not",
"_os",
".",
"path",
".",
"isdir",
"(",
"top_dir",
")",
":",
"return",
"False",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"_os",
".",
"walk",
"(",
"top_dir",
")",
":",
"for",
"... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/mantid/kernel/plugins.py#L70-L84 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/nn_ops.py | python | with_space_to_batch | (
input, # pylint: disable=redefined-builtin
dilation_rate,
padding,
op,
filter_shape=None,
spatial_dims=None,
data_format=None) | return result_converted | Performs `op` on the space-to-batch representation of `input`.
This has the effect of transforming sliding window operations into the
corresponding "atrous" operation in which the input is sampled at the
specified `dilation_rate`.
In the special case that `dilation_rate` is uniformly 1, this simply returns:
... | Performs `op` on the space-to-batch representation of `input`. | [
"Performs",
"op",
"on",
"the",
"space",
"-",
"to",
"-",
"batch",
"representation",
"of",
"input",
"."
] | def with_space_to_batch(
input, # pylint: disable=redefined-builtin
dilation_rate,
padding,
op,
filter_shape=None,
spatial_dims=None,
data_format=None):
"""Performs `op` on the space-to-batch representation of `input`.
This has the effect of transforming sliding window operations into ... | [
"def",
"with_space_to_batch",
"(",
"input",
",",
"# pylint: disable=redefined-builtin",
"dilation_rate",
",",
"padding",
",",
"op",
",",
"filter_shape",
"=",
"None",
",",
"spatial_dims",
"=",
"None",
",",
"data_format",
"=",
"None",
")",
":",
"input",
"=",
"ops"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/nn_ops.py#L149-L457 | |
zeakey/DeepSkeleton | dc70170f8fd2ec8ca1157484ce66129981104486 | scripts/cpp_lint.py | python | CheckStyle | (filename, clean_lines, linenum, file_extension, nesting_state,
error) | Checks rules from the 'C++ style rules' section of cppguide.html.
Most of these rules are hard to test (naming, comment style), but we
do what we can. In particular we check for 2-space indents, line lengths,
tab usage, spaces inside code, etc.
Args:
filename: The name of the current file.
clean_line... | Checks rules from the 'C++ style rules' section of cppguide.html. | [
"Checks",
"rules",
"from",
"the",
"C",
"++",
"style",
"rules",
"section",
"of",
"cppguide",
".",
"html",
"."
] | def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state,
error):
"""Checks rules from the 'C++ style rules' section of cppguide.html.
Most of these rules are hard to test (naming, comment style), but we
do what we can. In particular we check for 2-space indents, line lengths,... | [
"def",
"CheckStyle",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"file_extension",
",",
"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 ... | https://github.com/zeakey/DeepSkeleton/blob/dc70170f8fd2ec8ca1157484ce66129981104486/scripts/cpp_lint.py#L3459-L3563 | ||
p4lang/behavioral-model | 81ce0163f0770c6b9d6056a28ce2e0cc035bb6e9 | tools/cpplint.py | python | CheckStyle | (filename, clean_lines, linenum, file_extension, nesting_state,
error) | Checks rules from the 'C++ style rules' section of cppguide.html.
Most of these rules are hard to test (naming, comment style), but we
do what we can. In particular we check for 2-space indents, line lengths,
tab usage, spaces inside code, etc.
Args:
filename: The name of the current file.
clean_line... | Checks rules from the 'C++ style rules' section of cppguide.html. | [
"Checks",
"rules",
"from",
"the",
"C",
"++",
"style",
"rules",
"section",
"of",
"cppguide",
".",
"html",
"."
] | def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state,
error):
"""Checks rules from the 'C++ style rules' section of cppguide.html.
Most of these rules are hard to test (naming, comment style), but we
do what we can. In particular we check for 2-space indents, line lengths,... | [
"def",
"CheckStyle",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"file_extension",
",",
"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 ... | https://github.com/p4lang/behavioral-model/blob/81ce0163f0770c6b9d6056a28ce2e0cc035bb6e9/tools/cpplint.py#L4807-L4930 | ||
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | Wrapping/Python/paraview/servermanager.py | python | ProxyManager.__getattr__ | (self, name) | return getattr(self.SMProxyManager, name) | Returns attribute from the ProxyManager | Returns attribute from the ProxyManager | [
"Returns",
"attribute",
"from",
"the",
"ProxyManager"
] | def __getattr__(self, name):
"""Returns attribute from the ProxyManager"""
try:
pmAttr = getattr(self.SMProxyManager, name)
self.__LastAttrName = name
return self.__ConvertArgumentsAndCall
except:
pass
return getattr(self.SMProxyManager, na... | [
"def",
"__getattr__",
"(",
"self",
",",
"name",
")",
":",
"try",
":",
"pmAttr",
"=",
"getattr",
"(",
"self",
".",
"SMProxyManager",
",",
"name",
")",
"self",
".",
"__LastAttrName",
"=",
"name",
"return",
"self",
".",
"__ConvertArgumentsAndCall",
"except",
... | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Wrapping/Python/paraview/servermanager.py#L1887-L1895 | |
PyMesh/PyMesh | 384ba882b7558ba6e8653ed263c419226c22bddf | python/pymesh/wires/merge_wires.py | python | merge_wires | (wire_networks) | return form_wires(vertices, edges) | Merge multiple wire networks into a single WireNetwork object. | Merge multiple wire networks into a single WireNetwork object. | [
"Merge",
"multiple",
"wire",
"networks",
"into",
"a",
"single",
"WireNetwork",
"object",
"."
] | def merge_wires(wire_networks):
""" Merge multiple wire networks into a single WireNetwork object.
"""
vertices = [w.vertices for w in wire_networks]
num_vertices = [w.num_vertices for w in wire_networks]
offsets = np.cumsum([0] + num_vertices)
edges = [w.edges.reshape((-1, 2)) + offsets[i]
... | [
"def",
"merge_wires",
"(",
"wire_networks",
")",
":",
"vertices",
"=",
"[",
"w",
".",
"vertices",
"for",
"w",
"in",
"wire_networks",
"]",
"num_vertices",
"=",
"[",
"w",
".",
"num_vertices",
"for",
"w",
"in",
"wire_networks",
"]",
"offsets",
"=",
"np",
".... | https://github.com/PyMesh/PyMesh/blob/384ba882b7558ba6e8653ed263c419226c22bddf/python/pymesh/wires/merge_wires.py#L5-L17 | |
NervanaSystems/ngraph | f677a119765ca30636cf407009dabd118664951f | python/src/ngraph/ops.py | python | reduce_logical_and | (
node: NodeInput, reduction_axes: NodeInput, keep_dims: bool = False, name: Optional[str] = None
) | return _get_node_factory().create(
"ReduceLogicalAnd", as_nodes(node, reduction_axes), {"keep_dims": keep_dims}
) | Logical AND reduction operation on input tensor, eliminating the specified reduction axes.
:param node: The tensor we want to reduce.
:param reduction_axes: The axes to eliminate through AND operation.
:param keep_dims: If set to True it holds axes that are used for reduction
:param name... | Logical AND reduction operation on input tensor, eliminating the specified reduction axes. | [
"Logical",
"AND",
"reduction",
"operation",
"on",
"input",
"tensor",
"eliminating",
"the",
"specified",
"reduction",
"axes",
"."
] | def reduce_logical_and(
node: NodeInput, reduction_axes: NodeInput, keep_dims: bool = False, name: Optional[str] = None
) -> Node:
"""Logical AND reduction operation on input tensor, eliminating the specified reduction axes.
:param node: The tensor we want to reduce.
:param reduction_axes: Th... | [
"def",
"reduce_logical_and",
"(",
"node",
":",
"NodeInput",
",",
"reduction_axes",
":",
"NodeInput",
",",
"keep_dims",
":",
"bool",
"=",
"False",
",",
"name",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"Node",
":",
"return",
"_get_node_facto... | https://github.com/NervanaSystems/ngraph/blob/f677a119765ca30636cf407009dabd118664951f/python/src/ngraph/ops.py#L2014-L2027 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/setuptools/command/egg_info.py | python | write_file | (filename, contents) | Create a file with the specified name and write 'contents' (a
sequence of strings without line terminators) to it. | Create a file with the specified name and write 'contents' (a
sequence of strings without line terminators) to it. | [
"Create",
"a",
"file",
"with",
"the",
"specified",
"name",
"and",
"write",
"contents",
"(",
"a",
"sequence",
"of",
"strings",
"without",
"line",
"terminators",
")",
"to",
"it",
"."
] | def write_file(filename, contents):
"""Create a file with the specified name and write 'contents' (a
sequence of strings without line terminators) to it.
"""
contents = "\n".join(contents)
# assuming the contents has been vetted for utf-8 encoding
contents = contents.encode("utf-8")
with o... | [
"def",
"write_file",
"(",
"filename",
",",
"contents",
")",
":",
"contents",
"=",
"\"\\n\"",
".",
"join",
"(",
"contents",
")",
"# assuming the contents has been vetted for utf-8 encoding",
"contents",
"=",
"contents",
".",
"encode",
"(",
"\"utf-8\"",
")",
"with",
... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/setuptools/command/egg_info.py#L598-L608 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | DateSpan.Subtract | (*args, **kwargs) | return _misc_.DateSpan_Subtract(*args, **kwargs) | Subtract(self, DateSpan other) -> DateSpan | Subtract(self, DateSpan other) -> DateSpan | [
"Subtract",
"(",
"self",
"DateSpan",
"other",
")",
"-",
">",
"DateSpan"
] | def Subtract(*args, **kwargs):
"""Subtract(self, DateSpan other) -> DateSpan"""
return _misc_.DateSpan_Subtract(*args, **kwargs) | [
"def",
"Subtract",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DateSpan_Subtract",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L4693-L4695 | |
google/ion | ef47f3b824050499ce5c6f774b366f6c4dbce0af | ion/build.py | python | BuildState.__init__ | (self, argv) | Initializes a BuildState object.
When a BuildState object is initialized, argv is parsed for command-line
flags and positional parameters. If invalid or unknown flags are passed,
script execution may halt there without returning back to main. Otherwise,
all the accessor methods may then be used to ge... | Initializes a BuildState object. | [
"Initializes",
"a",
"BuildState",
"object",
"."
] | def __init__(self, argv):
"""Initializes a BuildState object.
When a BuildState object is initialized, argv is parsed for command-line
flags and positional parameters. If invalid or unknown flags are passed,
script execution may halt there without returning back to main. Otherwise,
all the access... | [
"def",
"__init__",
"(",
"self",
",",
"argv",
")",
":",
"# Build OS is the OS of the machine this script is being run on.",
"try",
":",
"self",
".",
"host_os",
"=",
"GetHostOS",
"(",
")",
"except",
"KeyError",
":",
"ExitWithError",
"(",
"'Unknown build OS returned by pla... | https://github.com/google/ion/blob/ef47f3b824050499ce5c6f774b366f6c4dbce0af/ion/build.py#L1517-L1547 | ||
freesurfer/freesurfer | 6dbe527d43ffa611acb2cd112e9469f9bfec8e36 | sscnn_skullstripping/sscnn_skullstripping/deeplearn_utils/unet_model.py | python | unet_model_2d | (input_shape, num_filters, unet_depth, downsize_filters_factor=1, pool_size=(2, 2), n_labels=0,
loss='mean_squared_error', initial_learning_rate=0.00001, deconvolution=False, use_patches=True,
num_gpus=1, num_outputs=1) | Builds the 3D UNet Keras model.
:param input_shape: Shape of the input data (x_size, y_size, z_size).
:param downsize_filters_factor: Factor to which to reduce the number of filters. Making this value larger will
reduce the amount of memory the model will need during training.
:param pool_size: Pool siz... | Builds the 3D UNet Keras model.
:param input_shape: Shape of the input data (x_size, y_size, z_size).
:param downsize_filters_factor: Factor to which to reduce the number of filters. Making this value larger will
reduce the amount of memory the model will need during training.
:param pool_size: Pool siz... | [
"Builds",
"the",
"3D",
"UNet",
"Keras",
"model",
".",
":",
"param",
"input_shape",
":",
"Shape",
"of",
"the",
"input",
"data",
"(",
"x_size",
"y_size",
"z_size",
")",
".",
":",
"param",
"downsize_filters_factor",
":",
"Factor",
"to",
"which",
"to",
"reduce... | def unet_model_2d(input_shape, num_filters, unet_depth, downsize_filters_factor=1, pool_size=(2, 2), n_labels=0,
loss='mean_squared_error', initial_learning_rate=0.00001, deconvolution=False, use_patches=True,
num_gpus=1, num_outputs=1):
"""
Builds the 3D UNet Keras model.
... | [
"def",
"unet_model_2d",
"(",
"input_shape",
",",
"num_filters",
",",
"unet_depth",
",",
"downsize_filters_factor",
"=",
"1",
",",
"pool_size",
"=",
"(",
"2",
",",
"2",
")",
",",
"n_labels",
"=",
"0",
",",
"loss",
"=",
"'mean_squared_error'",
",",
"initial_le... | https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/sscnn_skullstripping/sscnn_skullstripping/deeplearn_utils/unet_model.py#L386-L554 | ||
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | platforms/nuttx/Debug/Nuttx.py | python | NX_my_bt.readmem | (self,addr) | return int(resp[idx:],16) | read memory at addr and return nr | read memory at addr and return nr | [
"read",
"memory",
"at",
"addr",
"and",
"return",
"nr"
] | def readmem(self,addr):
'''
read memory at addr and return nr
'''
str_to_eval = "x/x "+hex(addr)
resp = gdb.execute(str_to_eval,to_string = True)
idx = resp.find('\t')
return int(resp[idx:],16) | [
"def",
"readmem",
"(",
"self",
",",
"addr",
")",
":",
"str_to_eval",
"=",
"\"x/x \"",
"+",
"hex",
"(",
"addr",
")",
"resp",
"=",
"gdb",
".",
"execute",
"(",
"str_to_eval",
",",
"to_string",
"=",
"True",
")",
"idx",
"=",
"resp",
".",
"find",
"(",
"'... | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/platforms/nuttx/Debug/Nuttx.py#L638-L645 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/linalg_grad.py | python | _LeftShift | (x) | return array_ops.pad(x[..., 1:, :], pad) | Shifts next-to-last dimension to the left, adding zero on the right. | Shifts next-to-last dimension to the left, adding zero on the right. | [
"Shifts",
"next",
"-",
"to",
"-",
"last",
"dimension",
"to",
"the",
"left",
"adding",
"zero",
"on",
"the",
"right",
"."
] | def _LeftShift(x):
"""Shifts next-to-last dimension to the left, adding zero on the right."""
rank = array_ops.rank(x)
zeros = array_ops.zeros((rank - 2, 2), dtype=dtypes.int32)
pad = array_ops.concat([zeros, array_ops.constant([[0, 1], [0, 0]])], axis=0)
return array_ops.pad(x[..., 1:, :], pad) | [
"def",
"_LeftShift",
"(",
"x",
")",
":",
"rank",
"=",
"array_ops",
".",
"rank",
"(",
"x",
")",
"zeros",
"=",
"array_ops",
".",
"zeros",
"(",
"(",
"rank",
"-",
"2",
",",
"2",
")",
",",
"dtype",
"=",
"dtypes",
".",
"int32",
")",
"pad",
"=",
"arra... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/linalg_grad.py#L471-L476 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/pytorch/losses/rl_losses.py | python | BatchRPGLoss.loss | (self, policy_logits, action_values) | return total_loss | Constructs a PyTorch Crierion that computes the RPG loss for batches.
Args:
policy_logits: `B x A` tensor corresponding to policy logits.
action_values: `B x A` tensor corresponding to Q-values.
Returns:
loss: A 0-D `float` tensor corresponding the loss. | Constructs a PyTorch Crierion that computes the RPG loss for batches. | [
"Constructs",
"a",
"PyTorch",
"Crierion",
"that",
"computes",
"the",
"RPG",
"loss",
"for",
"batches",
"."
] | def loss(self, policy_logits, action_values):
"""Constructs a PyTorch Crierion that computes the RPG loss for batches.
Args:
policy_logits: `B x A` tensor corresponding to policy logits.
action_values: `B x A` tensor corresponding to Q-values.
Returns:
loss: A 0-D `float` tensor correspo... | [
"def",
"loss",
"(",
"self",
",",
"policy_logits",
",",
"action_values",
")",
":",
"_assert_rank_and_shape_compatibility",
"(",
"[",
"policy_logits",
",",
"action_values",
"]",
",",
"2",
")",
"regrets",
"=",
"compute_regrets",
"(",
"policy_logits",
",",
"action_val... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/pytorch/losses/rl_losses.py#L171-L192 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/optimize/nonlin.py | python | _nonlin_wrapper | (name, jac) | return func | Construct a solver wrapper with given name and jacobian approx.
It inspects the keyword arguments of ``jac.__init__``, and allows to
use the same arguments in the wrapper function, in addition to the
keyword arguments of `nonlin_solve` | Construct a solver wrapper with given name and jacobian approx. | [
"Construct",
"a",
"solver",
"wrapper",
"with",
"given",
"name",
"and",
"jacobian",
"approx",
"."
] | def _nonlin_wrapper(name, jac):
"""
Construct a solver wrapper with given name and jacobian approx.
It inspects the keyword arguments of ``jac.__init__``, and allows to
use the same arguments in the wrapper function, in addition to the
keyword arguments of `nonlin_solve`
"""
args, varargs,... | [
"def",
"_nonlin_wrapper",
"(",
"name",
",",
"jac",
")",
":",
"args",
",",
"varargs",
",",
"varkw",
",",
"defaults",
"=",
"_getargspec",
"(",
"jac",
".",
"__init__",
")",
"kwargs",
"=",
"list",
"(",
"zip",
"(",
"args",
"[",
"-",
"len",
"(",
"defaults"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/optimize/nonlin.py#L1498-L1536 | |
lmb-freiburg/flownet2 | b92e198b56b0e52e1ba0a5a98dc0e39fa5ae70cc | scripts/cpp_lint.py | python | CheckCaffeRandom | (filename, clean_lines, linenum, error) | Checks for calls to C random functions (rand, rand_r, random, ...).
Caffe code should (almost) always use the caffe_rng_* functions rather
than these, as the internal state of these C functions is independent of the
native Caffe RNG system which should produce deterministic results for a
fixed Caffe seed set u... | Checks for calls to C random functions (rand, rand_r, random, ...). | [
"Checks",
"for",
"calls",
"to",
"C",
"random",
"functions",
"(",
"rand",
"rand_r",
"random",
"...",
")",
"."
] | def CheckCaffeRandom(filename, clean_lines, linenum, error):
"""Checks for calls to C random functions (rand, rand_r, random, ...).
Caffe code should (almost) always use the caffe_rng_* functions rather
than these, as the internal state of these C functions is independent of the
native Caffe RNG system which s... | [
"def",
"CheckCaffeRandom",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"for",
"function",
"in",
"c_random_function_list",
":",
"ix",
"=",
"line",
".",
"find",
... | https://github.com/lmb-freiburg/flownet2/blob/b92e198b56b0e52e1ba0a5a98dc0e39fa5ae70cc/scripts/cpp_lint.py#L1640-L1663 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/metrics/histograms/extract_histograms.py | python | _NormalizeAllAttributeValues | (node) | return node | Recursively normalizes all tag attribute values in the given tree.
Args:
node: The minidom node to be normalized.
Returns:
The normalized minidom node. | Recursively normalizes all tag attribute values in the given tree. | [
"Recursively",
"normalizes",
"all",
"tag",
"attribute",
"values",
"in",
"the",
"given",
"tree",
"."
] | def _NormalizeAllAttributeValues(node):
"""Recursively normalizes all tag attribute values in the given tree.
Args:
node: The minidom node to be normalized.
Returns:
The normalized minidom node.
"""
if node.nodeType == xml.dom.minidom.Node.ELEMENT_NODE:
for a in node.attributes.keys():
nod... | [
"def",
"_NormalizeAllAttributeValues",
"(",
"node",
")",
":",
"if",
"node",
".",
"nodeType",
"==",
"xml",
".",
"dom",
".",
"minidom",
".",
"Node",
".",
"ELEMENT_NODE",
":",
"for",
"a",
"in",
"node",
".",
"attributes",
".",
"keys",
"(",
")",
":",
"node"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/metrics/histograms/extract_histograms.py#L99-L114 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/dateutil/relativedelta.py | python | relativedelta.normalized | (self) | return self.__class__(years=self.years, months=self.months,
days=days, hours=hours, minutes=minutes,
seconds=seconds, microseconds=microseconds,
leapdays=self.leapdays, year=self.year,
month=self.mont... | Return a version of this object represented entirely using integer
values for the relative attributes.
>>> relativedelta(days=1.5, hours=2).normalized()
relativedelta(days=1, hours=14)
:return:
Returns a :class:`dateutil.relativedelta.relativedelta` object. | Return a version of this object represented entirely using integer
values for the relative attributes. | [
"Return",
"a",
"version",
"of",
"this",
"object",
"represented",
"entirely",
"using",
"integer",
"values",
"for",
"the",
"relative",
"attributes",
"."
] | def normalized(self):
"""
Return a version of this object represented entirely using integer
values for the relative attributes.
>>> relativedelta(days=1.5, hours=2).normalized()
relativedelta(days=1, hours=14)
:return:
Returns a :class:`dateutil.relativedel... | [
"def",
"normalized",
"(",
"self",
")",
":",
"# Cascade remainders down (rounding each to roughly nearest microsecond)",
"days",
"=",
"int",
"(",
"self",
".",
"days",
")",
"hours_f",
"=",
"round",
"(",
"self",
".",
"hours",
"+",
"24",
"*",
"(",
"self",
".",
"da... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/dateutil/relativedelta.py#L268-L301 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/special/basic.py | python | agm | (a, b) | return (pi / 4) * s / ellipkm1(4 * a * b / s ** 2) | Arithmetic, Geometric Mean.
Start with a_0=a and b_0=b and iteratively compute
a_{n+1} = (a_n+b_n)/2
b_{n+1} = sqrt(a_n*b_n)
until a_n=b_n. The result is agm(a, b)
agm(a, b)=agm(b, a)
agm(a, a) = a
min(a, b) < agm(a, b) < max(a, b) | Arithmetic, Geometric Mean. | [
"Arithmetic",
"Geometric",
"Mean",
"."
] | def agm(a, b):
"""Arithmetic, Geometric Mean.
Start with a_0=a and b_0=b and iteratively compute
a_{n+1} = (a_n+b_n)/2
b_{n+1} = sqrt(a_n*b_n)
until a_n=b_n. The result is agm(a, b)
agm(a, b)=agm(b, a)
agm(a, a) = a
min(a, b) < agm(a, b) < max(a, b)
"""
s = a + b + 0.0
... | [
"def",
"agm",
"(",
"a",
",",
"b",
")",
":",
"s",
"=",
"a",
"+",
"b",
"+",
"0.0",
"return",
"(",
"pi",
"/",
"4",
")",
"*",
"s",
"/",
"ellipkm1",
"(",
"4",
"*",
"a",
"*",
"b",
"/",
"s",
"**",
"2",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/special/basic.py#L2104-L2119 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/array_ops.py | python | guarantee_const | (input, name=None) | return gen_array_ops.guarantee_const(input=input, name=name) | Promise to the TF runtime that the input tensor is a constant.
The runtime is then free to make optimizations based on this.
Returns the input tensor without modification.
Args:
input: A `Tensor`.
name: A name for this operation.
Returns:
A `Tensor`. Has the same dtype as `input`. | Promise to the TF runtime that the input tensor is a constant. | [
"Promise",
"to",
"the",
"TF",
"runtime",
"that",
"the",
"input",
"tensor",
"is",
"a",
"constant",
"."
] | def guarantee_const(input, name=None): # pylint: disable=redefined-builtin
"""Promise to the TF runtime that the input tensor is a constant.
The runtime is then free to make optimizations based on this.
Returns the input tensor without modification.
Args:
input: A `Tensor`.
name: A name for this o... | [
"def",
"guarantee_const",
"(",
"input",
",",
"name",
"=",
"None",
")",
":",
"# pylint: disable=redefined-builtin",
"return",
"gen_array_ops",
".",
"guarantee_const",
"(",
"input",
"=",
"input",
",",
"name",
"=",
"name",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/array_ops.py#L6949-L6963 | |
PaddlePaddle/PaddleOCR | b756bf5f8c90142e0d89d3db0163965c686b6ffe | ppocr/data/imaug/copy_paste.py | python | rotate_bbox | (img, text_polys, angle, scale=1) | return np.array(rot_text_polys, dtype=np.float32) | from https://github.com/WenmuZhou/DBNet.pytorch/blob/master/data_loader/modules/augment.py
Args:
img: np.ndarray
text_polys: np.ndarray N*4*2
angle: int
scale: int
Returns: | from https://github.com/WenmuZhou/DBNet.pytorch/blob/master/data_loader/modules/augment.py
Args:
img: np.ndarray
text_polys: np.ndarray N*4*2
angle: int
scale: int | [
"from",
"https",
":",
"//",
"github",
".",
"com",
"/",
"WenmuZhou",
"/",
"DBNet",
".",
"pytorch",
"/",
"blob",
"/",
"master",
"/",
"data_loader",
"/",
"modules",
"/",
"augment",
".",
"py",
"Args",
":",
"img",
":",
"np",
".",
"ndarray",
"text_polys",
... | def rotate_bbox(img, text_polys, angle, scale=1):
"""
from https://github.com/WenmuZhou/DBNet.pytorch/blob/master/data_loader/modules/augment.py
Args:
img: np.ndarray
text_polys: np.ndarray N*4*2
angle: int
scale: int
Returns:
"""
w = img.shape[1]
h = img.sh... | [
"def",
"rotate_bbox",
"(",
"img",
",",
"text_polys",
",",
"angle",
",",
"scale",
"=",
"1",
")",
":",
"w",
"=",
"img",
".",
"shape",
"[",
"1",
"]",
"h",
"=",
"img",
".",
"shape",
"[",
"0",
"]",
"rangle",
"=",
"np",
".",
"deg2rad",
"(",
"angle",
... | https://github.com/PaddlePaddle/PaddleOCR/blob/b756bf5f8c90142e0d89d3db0163965c686b6ffe/ppocr/data/imaug/copy_paste.py#L139-L170 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/prometheus/module.py | python | HealthHistory.as_yaml | (self) | return yaml.safe_dump(self.as_dict(), explicit_start=True, default_flow_style=False) | Return the healthcheck history in yaml format.
Returns:
str: YAML representation of the healthcheck history | Return the healthcheck history in yaml format. | [
"Return",
"the",
"healthcheck",
"history",
"in",
"yaml",
"format",
"."
] | def as_yaml(self) -> str:
"""Return the healthcheck history in yaml format.
Returns:
str: YAML representation of the healthcheck history
"""
return yaml.safe_dump(self.as_dict(), explicit_start=True, default_flow_style=False) | [
"def",
"as_yaml",
"(",
"self",
")",
"->",
"str",
":",
"return",
"yaml",
".",
"safe_dump",
"(",
"self",
".",
"as_dict",
"(",
")",
",",
"explicit_start",
"=",
"True",
",",
"default_flow_style",
"=",
"False",
")"
] | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/prometheus/module.py#L299-L305 | |
rdiankov/openrave | d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7 | python/ikfast.py | python | IKFastSolver.solveLiWoernleHiller | (self,rawpolyeqs,solvejointvars,endbranchtree,AllEquationsExtra=[], currentcases=None, currentcasesubs=None) | return preprocesssolutiontree+solutiontree+endbranchtree,usedvars | Li-Woernle-Hiller procedure covered in
Jorge Angeles, "Fundamentals of Robotics Mechanical Systems", Springer, 2007. | Li-Woernle-Hiller procedure covered in
Jorge Angeles, "Fundamentals of Robotics Mechanical Systems", Springer, 2007. | [
"Li",
"-",
"Woernle",
"-",
"Hiller",
"procedure",
"covered",
"in",
"Jorge",
"Angeles",
"Fundamentals",
"of",
"Robotics",
"Mechanical",
"Systems",
"Springer",
"2007",
"."
] | def solveLiWoernleHiller(self,rawpolyeqs,solvejointvars,endbranchtree,AllEquationsExtra=[], currentcases=None, currentcasesubs=None):
"""Li-Woernle-Hiller procedure covered in
Jorge Angeles, "Fundamentals of Robotics Mechanical Systems", Springer, 2007.
"""
log.info('attempting li/woern... | [
"def",
"solveLiWoernleHiller",
"(",
"self",
",",
"rawpolyeqs",
",",
"solvejointvars",
",",
"endbranchtree",
",",
"AllEquationsExtra",
"=",
"[",
"]",
",",
"currentcases",
"=",
"None",
",",
"currentcasesubs",
"=",
"None",
")",
":",
"log",
".",
"info",
"(",
"'a... | https://github.com/rdiankov/openrave/blob/d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7/python/ikfast.py#L4418-L5827 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/server/wsgi/search/plugin/poi_search_handler.py | python | POISearch.__QueryPOIInfo | (self, target_path) | return query_status, poi_info_data | Gets POI info data for specified target.
Queries gestream database to get database info (host_name, db_name)
by target path, then queries gesearch database to get poi info data
from poi_table by database info.
Args:
target_path: Published target path.
Returns:
query_status: True if POI... | Gets POI info data for specified target. | [
"Gets",
"POI",
"info",
"data",
"for",
"specified",
"target",
"."
] | def __QueryPOIInfo(self, target_path):
"""Gets POI info data for specified target.
Queries gestream database to get database info (host_name, db_name)
by target path, then queries gesearch database to get poi info data
from poi_table by database info.
Args:
target_path: Published target pat... | [
"def",
"__QueryPOIInfo",
"(",
"self",
",",
"target_path",
")",
":",
"query_status",
"=",
"False",
"poi_info_data",
"=",
"[",
"]",
"# Get host_name and db_name from gestream database for a target path.",
"query_status",
",",
"query_data",
"=",
"self",
".",
"__RunPGSQLQuery... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/server/wsgi/search/plugin/poi_search_handler.py#L234-L274 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py | python | _maximum_operation.outer | (self, a, b) | return masked_array(d, m) | Return the function applied to the outer product of a and b. | Return the function applied to the outer product of a and b. | [
"Return",
"the",
"function",
"applied",
"to",
"the",
"outer",
"product",
"of",
"a",
"and",
"b",
"."
] | def outer (self, a, b):
"Return the function applied to the outer product of a and b."
ma = getmask(a)
mb = getmask(b)
if ma is nomask and mb is nomask:
m = nomask
else:
ma = getmaskarray(a)
mb = getmaskarray(b)
m = logical_or.outer... | [
"def",
"outer",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"ma",
"=",
"getmask",
"(",
"a",
")",
"mb",
"=",
"getmask",
"(",
"b",
")",
"if",
"ma",
"is",
"nomask",
"and",
"mb",
"is",
"nomask",
":",
"m",
"=",
"nomask",
"else",
":",
"ma",
"=",
"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py#L2059-L2070 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/multiprocessing/__init__.py | python | get_logger | () | return get_logger() | Return package logger -- if it does not already exist then it is created | Return package logger -- if it does not already exist then it is created | [
"Return",
"package",
"logger",
"--",
"if",
"it",
"does",
"not",
"already",
"exist",
"then",
"it",
"is",
"created"
] | def get_logger():
'''
Return package logger -- if it does not already exist then it is created
'''
from multiprocessing.util import get_logger
return get_logger() | [
"def",
"get_logger",
"(",
")",
":",
"from",
"multiprocessing",
".",
"util",
"import",
"get_logger",
"return",
"get_logger",
"(",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/multiprocessing/__init__.py#L147-L152 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | NavigationKeyEvent.SetFlags | (*args, **kwargs) | return _core_.NavigationKeyEvent_SetFlags(*args, **kwargs) | SetFlags(self, long flags)
Set the navigation flags to a combination of the following:
* wx.NavigationKeyEvent.IsBackward
* wx.NavigationKeyEvent.IsForward
* wx.NavigationKeyEvent.WinChange
* wx.NavigationKeyEvent.FromTab | SetFlags(self, long flags) | [
"SetFlags",
"(",
"self",
"long",
"flags",
")"
] | def SetFlags(*args, **kwargs):
"""
SetFlags(self, long flags)
Set the navigation flags to a combination of the following:
* wx.NavigationKeyEvent.IsBackward
* wx.NavigationKeyEvent.IsForward
* wx.NavigationKeyEvent.WinChange
* wx.NavigationKeyEve... | [
"def",
"SetFlags",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"NavigationKeyEvent_SetFlags",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L7284-L7296 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/generator/xcode.py | python | EscapeXcodeDefine | (s) | return re.sub(_xcode_define_re, r'\\\1', s) | We must escape the defines that we give to XCode so that it knows not to
split on spaces and to respect backslash and quote literals. However, we
must not quote the define, or Xcode will incorrectly intepret variables
especially $(inherited). | We must escape the defines that we give to XCode so that it knows not to
split on spaces and to respect backslash and quote literals. However, we
must not quote the define, or Xcode will incorrectly intepret variables
especially $(inherited). | [
"We",
"must",
"escape",
"the",
"defines",
"that",
"we",
"give",
"to",
"XCode",
"so",
"that",
"it",
"knows",
"not",
"to",
"split",
"on",
"spaces",
"and",
"to",
"respect",
"backslash",
"and",
"quote",
"literals",
".",
"However",
"we",
"must",
"not",
"quote... | def EscapeXcodeDefine(s):
"""We must escape the defines that we give to XCode so that it knows not to
split on spaces and to respect backslash and quote literals. However, we
must not quote the define, or Xcode will incorrectly intepret variables
especially $(inherited)."""
return re.sub(_xcode_defin... | [
"def",
"EscapeXcodeDefine",
"(",
"s",
")",
":",
"return",
"re",
".",
"sub",
"(",
"_xcode_define_re",
",",
"r'\\\\\\1'",
",",
"s",
")"
] | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/generator/xcode.py#L560-L565 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/OpenSSL/_util.py | python | text | (charp) | return native(ffi.string(charp)) | Get a native string type representing of the given CFFI ``char*`` object.
:param charp: A C-style string represented using CFFI.
:return: :class:`str` | Get a native string type representing of the given CFFI ``char*`` object. | [
"Get",
"a",
"native",
"string",
"type",
"representing",
"of",
"the",
"given",
"CFFI",
"char",
"*",
"object",
"."
] | def text(charp):
"""
Get a native string type representing of the given CFFI ``char*`` object.
:param charp: A C-style string represented using CFFI.
:return: :class:`str`
"""
if not charp:
return ""
return native(ffi.string(charp)) | [
"def",
"text",
"(",
"charp",
")",
":",
"if",
"not",
"charp",
":",
"return",
"\"\"",
"return",
"native",
"(",
"ffi",
".",
"string",
"(",
"charp",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/OpenSSL/_util.py#L21-L31 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/losses.py | python | categorical_hinge | (y_true, y_pred) | return math_ops.maximum(neg - pos + 1., zero) | Computes the categorical hinge loss between `y_true` and `y_pred`.
`loss = maximum(neg - pos + 1, 0)`
where `neg=maximum((1-y_true)*y_pred) and pos=sum(y_true*y_pred)`
Standalone usage:
>>> y_true = np.random.randint(0, 3, size=(2,))
>>> y_true = tf.keras.utils.to_categorical(y_true, num_classes=3)
>>> y... | Computes the categorical hinge loss between `y_true` and `y_pred`. | [
"Computes",
"the",
"categorical",
"hinge",
"loss",
"between",
"y_true",
"and",
"y_pred",
"."
] | def categorical_hinge(y_true, y_pred):
"""Computes the categorical hinge loss between `y_true` and `y_pred`.
`loss = maximum(neg - pos + 1, 0)`
where `neg=maximum((1-y_true)*y_pred) and pos=sum(y_true*y_pred)`
Standalone usage:
>>> y_true = np.random.randint(0, 3, size=(2,))
>>> y_true = tf.keras.utils.t... | [
"def",
"categorical_hinge",
"(",
"y_true",
",",
"y_pred",
")",
":",
"y_pred",
"=",
"ops",
".",
"convert_to_tensor_v2_with_dispatch",
"(",
"y_pred",
")",
"y_true",
"=",
"math_ops",
".",
"cast",
"(",
"y_true",
",",
"y_pred",
".",
"dtype",
")",
"pos",
"=",
"m... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/losses.py#L1527-L1557 | |
MADEAPPS/newton-dynamics | 4c4016f65d6b59acfaff915f74dc142d4f2b9a90 | newton-3.14/applications/blenderPlugin/import_scene_alchemedia.py | python | LoadNodesScene | (scene, rootNode, blenderScene, chidrenList) | recusivally load convert a scene to a blender scene | recusivally load convert a scene to a blender scene | [
"recusivally",
"load",
"convert",
"a",
"scene",
"to",
"a",
"blender",
"scene"
] | def LoadNodesScene(scene, rootNode, blenderScene, chidrenList):
''' recusivally load convert a scene to a blender scene'''
blenderObject = None
meshNode = GetMeshNode(scene, rootNode)
if meshNode != None:
blenderObject = CreateBlenderMeshObjectFromNode (scene, meshNode, blenderScene)
else:
blenderObject = Cre... | [
"def",
"LoadNodesScene",
"(",
"scene",
",",
"rootNode",
",",
"blenderScene",
",",
"chidrenList",
")",
":",
"blenderObject",
"=",
"None",
"meshNode",
"=",
"GetMeshNode",
"(",
"scene",
",",
"rootNode",
")",
"if",
"meshNode",
"!=",
"None",
":",
"blenderObject",
... | https://github.com/MADEAPPS/newton-dynamics/blob/4c4016f65d6b59acfaff915f74dc142d4f2b9a90/newton-3.14/applications/blenderPlugin/import_scene_alchemedia.py#L180-L237 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/indexes/base.py | python | Index.argsort | (self, *args, **kwargs) | return result.argsort(*args, **kwargs) | Return the integer indices that would sort the index.
Parameters
----------
*args
Passed to `numpy.ndarray.argsort`.
**kwargs
Passed to `numpy.ndarray.argsort`.
Returns
-------
numpy.ndarray
Integer indices that would sort the... | Return the integer indices that would sort the index. | [
"Return",
"the",
"integer",
"indices",
"that",
"would",
"sort",
"the",
"index",
"."
] | def argsort(self, *args, **kwargs):
"""
Return the integer indices that would sort the index.
Parameters
----------
*args
Passed to `numpy.ndarray.argsort`.
**kwargs
Passed to `numpy.ndarray.argsort`.
Returns
-------
numpy... | [
"def",
"argsort",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"self",
".",
"asi8",
"if",
"result",
"is",
"None",
":",
"result",
"=",
"np",
".",
"array",
"(",
"self",
")",
"return",
"result",
".",
"argsort",
"(... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/indexes/base.py#L4320-L4358 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/summary/impl/reservoir.py | python | _ReservoirBucket.Items | (self) | Get all the items in the bucket. | Get all the items in the bucket. | [
"Get",
"all",
"the",
"items",
"in",
"the",
"bucket",
"."
] | def Items(self):
"""Get all the items in the bucket."""
with self._mutex:
return self.items | [
"def",
"Items",
"(",
"self",
")",
":",
"with",
"self",
".",
"_mutex",
":",
"return",
"self",
".",
"items"
] | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/summary/impl/reservoir.py#L231-L234 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | site_scons/libdeps.py | python | LibdepLinter.linter_rule_leaf_node_no_deps | (self, libdep) | LIBDEP RULE:
Nodes marked explicitly as a leaf node should not have any dependencies,
unless those dependencies are explicitly marked as allowed as leaf node
dependencies. | LIBDEP RULE:
Nodes marked explicitly as a leaf node should not have any dependencies,
unless those dependencies are explicitly marked as allowed as leaf node
dependencies. | [
"LIBDEP",
"RULE",
":",
"Nodes",
"marked",
"explicitly",
"as",
"a",
"leaf",
"node",
"should",
"not",
"have",
"any",
"dependencies",
"unless",
"those",
"dependencies",
"are",
"explicitly",
"marked",
"as",
"allowed",
"as",
"leaf",
"node",
"dependencies",
"."
] | def linter_rule_leaf_node_no_deps(self, libdep):
"""
LIBDEP RULE:
Nodes marked explicitly as a leaf node should not have any dependencies,
unless those dependencies are explicitly marked as allowed as leaf node
dependencies.
"""
if not self._check_for_... | [
"def",
"linter_rule_leaf_node_no_deps",
"(",
"self",
",",
"libdep",
")",
":",
"if",
"not",
"self",
".",
"_check_for_lint_tags",
"(",
"'lint-leaf-node-no-deps'",
",",
"inclusive_tag",
"=",
"True",
")",
":",
"return",
"# Ignore dependencies that explicitly exempt themselves... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/site_scons/libdeps.py#L382-L407 | ||
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/meshtools/mesh.py | python | merge2Meshes | (m1, m2) | return mesh | Merge two meshes into one new mesh and return the combined mesh.
Merge two meshes into a new mesh and return the combined mesh.
Note that there is a duplicate check for all nodes which should reuse
existing node but NO cells or boundaries.
Parameters
----------
m1: :gimliapi:`GIMLI::Mesh`
... | Merge two meshes into one new mesh and return the combined mesh. | [
"Merge",
"two",
"meshes",
"into",
"one",
"new",
"mesh",
"and",
"return",
"the",
"combined",
"mesh",
"."
] | def merge2Meshes(m1, m2):
"""Merge two meshes into one new mesh and return the combined mesh.
Merge two meshes into a new mesh and return the combined mesh.
Note that there is a duplicate check for all nodes which should reuse
existing node but NO cells or boundaries.
Parameters
----------
... | [
"def",
"merge2Meshes",
"(",
"m1",
",",
"m2",
")",
":",
"mesh",
"=",
"pg",
".",
"Mesh",
"(",
"m1",
")",
"mesh",
".",
"translate",
"(",
"-",
"m1",
".",
"node",
"(",
"0",
")",
".",
"pos",
"(",
")",
")",
"m3",
"=",
"pg",
".",
"Mesh",
"(",
"m2",... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/meshtools/mesh.py#L1816-L1856 | |
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/HDF5Application/python_scripts/core/xdmf.py | python | DataItem.dimensions | (self) | Return a shape tuple of the HDF5 data set.
For example the return value for the data set dset[0:100,0:3] would be
(100, 3). | Return a shape tuple of the HDF5 data set. | [
"Return",
"a",
"shape",
"tuple",
"of",
"the",
"HDF5",
"data",
"set",
"."
] | def dimensions(self):
"""Return a shape tuple of the HDF5 data set.
For example the return value for the data set dset[0:100,0:3] would be
(100, 3).
"""
pass | [
"def",
"dimensions",
"(",
"self",
")",
":",
"pass"
] | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/HDF5Application/python_scripts/core/xdmf.py#L88-L94 | ||
msftguy/ssh-rd | a5f3a79daeac5844edebf01916c9613563f1c390 | _3rd/boost_1_48_0/tools/build/v2/kernel/bootstrap.py | python | bootstrap | (root_path) | return b2.build_system.main() | Performs python-side bootstrapping of Boost.Build/Python.
This function arranges for 'b2.whatever' package names to work, while also
allowing to put python files alongside corresponding jam modules. | Performs python-side bootstrapping of Boost.Build/Python. | [
"Performs",
"python",
"-",
"side",
"bootstrapping",
"of",
"Boost",
".",
"Build",
"/",
"Python",
"."
] | def bootstrap(root_path):
"""Performs python-side bootstrapping of Boost.Build/Python.
This function arranges for 'b2.whatever' package names to work, while also
allowing to put python files alongside corresponding jam modules.
"""
m = imp.new_module("b2")
# Note that:
# 1. If __path__ is ... | [
"def",
"bootstrap",
"(",
"root_path",
")",
":",
"m",
"=",
"imp",
".",
"new_module",
"(",
"\"b2\"",
")",
"# Note that:",
"# 1. If __path__ is not list of strings, nothing will work",
"# 2. root_path is already list of strings.",
"m",
".",
"__path__",
"=",
"root_path",
"sys... | https://github.com/msftguy/ssh-rd/blob/a5f3a79daeac5844edebf01916c9613563f1c390/_3rd/boost_1_48_0/tools/build/v2/kernel/bootstrap.py#L9-L24 | |
telefonicaid/fiware-orion | 27c3202b9ddcfb9e3635a0af8d373f76e89b1d24 | scripts/managedb/upgrade-1.5.0/change_attr_id_separator.py | python | update_ok | (doc, check_attrs) | return True | Check that entity document was updated correctly at DB.
:param doc: the doc to check
:param check_attrs: list of attributes which existente is checked | Check that entity document was updated correctly at DB. | [
"Check",
"that",
"entity",
"document",
"was",
"updated",
"correctly",
"at",
"DB",
"."
] | def update_ok(doc, check_attrs):
"""
Check that entity document was updated correctly at DB.
:param doc: the doc to check
:param check_attrs: list of attributes which existente is checked
"""
if not ATTRS in doc:
#print "debug1: no attrs"
return False
for attr in check_att... | [
"def",
"update_ok",
"(",
"doc",
",",
"check_attrs",
")",
":",
"if",
"not",
"ATTRS",
"in",
"doc",
":",
"#print \"debug1: no attrs\"",
"return",
"False",
"for",
"attr",
"in",
"check_attrs",
":",
"if",
"attr",
"not",
"in",
"doc",
"[",
"ATTRS",
"]",
":",
"#p... | https://github.com/telefonicaid/fiware-orion/blob/27c3202b9ddcfb9e3635a0af8d373f76e89b1d24/scripts/managedb/upgrade-1.5.0/change_attr_id_separator.py#L57-L75 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | AboutDialogInfo.SetTranslators | (*args, **kwargs) | return _misc_.AboutDialogInfo_SetTranslators(*args, **kwargs) | SetTranslators(self, list translators)
Sets the list of program translators. | SetTranslators(self, list translators) | [
"SetTranslators",
"(",
"self",
"list",
"translators",
")"
] | def SetTranslators(*args, **kwargs):
"""
SetTranslators(self, list translators)
Sets the list of program translators.
"""
return _misc_.AboutDialogInfo_SetTranslators(*args, **kwargs) | [
"def",
"SetTranslators",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"AboutDialogInfo_SetTranslators",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L6898-L6904 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/debug/lib/dumping_callback.py | python | _debug_identity_v2_grad | (op, dy) | return dy | Gradient function for the DebugIdentityV2 op. | Gradient function for the DebugIdentityV2 op. | [
"Gradient",
"function",
"for",
"the",
"DebugIdentityV2",
"op",
"."
] | def _debug_identity_v2_grad(op, dy):
"""Gradient function for the DebugIdentityV2 op."""
del op # Unused
return dy | [
"def",
"_debug_identity_v2_grad",
"(",
"op",
",",
"dy",
")",
":",
"del",
"op",
"# Unused",
"return",
"dy"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/debug/lib/dumping_callback.py#L60-L63 | |
epam/Indigo | 30e40b4b1eb9bae0207435a26cfcb81ddcc42be1 | api/python/indigo/__init__.py | python | IndigoObject.close | (self) | return self.dispatcher._checkResult(Indigo._lib.indigoClose(self.id)) | FileOutput method closes file descriptor
Returns:
int: 1 if file is closed successfully. -1 otherwise | FileOutput method closes file descriptor | [
"FileOutput",
"method",
"closes",
"file",
"descriptor"
] | def close(self):
"""FileOutput method closes file descriptor
Returns:
int: 1 if file is closed successfully. -1 otherwise
"""
self.dispatcher._setSessionId()
return self.dispatcher._checkResult(Indigo._lib.indigoClose(self.id)) | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"dispatcher",
".",
"_setSessionId",
"(",
")",
"return",
"self",
".",
"dispatcher",
".",
"_checkResult",
"(",
"Indigo",
".",
"_lib",
".",
"indigoClose",
"(",
"self",
".",
"id",
")",
")"
] | https://github.com/epam/Indigo/blob/30e40b4b1eb9bae0207435a26cfcb81ddcc42be1/api/python/indigo/__init__.py#L235-L242 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Arch/importIFCHelper.py | python | get2DShape | (representation,scaling=1000) | return result | Returns a shape from a 2D IfcShapeRepresentation | Returns a shape from a 2D IfcShapeRepresentation | [
"Returns",
"a",
"shape",
"from",
"a",
"2D",
"IfcShapeRepresentation"
] | def get2DShape(representation,scaling=1000):
"""Returns a shape from a 2D IfcShapeRepresentation"""
import Part
import DraftVecUtils
import Draft
def getPolyline(ent):
pts = []
for p in ent.Points:
c = p.Coordinates
c = FreeCAD.Vector(c[0],c[1],c[2] if len(c... | [
"def",
"get2DShape",
"(",
"representation",
",",
"scaling",
"=",
"1000",
")",
":",
"import",
"Part",
"import",
"DraftVecUtils",
"import",
"Draft",
"def",
"getPolyline",
"(",
"ent",
")",
":",
"pts",
"=",
"[",
"]",
"for",
"p",
"in",
"ent",
".",
"Points",
... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Arch/importIFCHelper.py#L732-L867 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/arrays/sparse.py | python | SparseArray.__setstate__ | (self, state) | Necessary for making this object picklable | Necessary for making this object picklable | [
"Necessary",
"for",
"making",
"this",
"object",
"picklable"
] | def __setstate__(self, state):
"""Necessary for making this object picklable"""
if isinstance(state, tuple):
# Compat for pandas < 0.24.0
nd_state, (fill_value, sp_index) = state
sparse_values = np.array([])
sparse_values.__setstate__(nd_state)
... | [
"def",
"__setstate__",
"(",
"self",
",",
"state",
")",
":",
"if",
"isinstance",
"(",
"state",
",",
"tuple",
")",
":",
"# Compat for pandas < 0.24.0",
"nd_state",
",",
"(",
"fill_value",
",",
"sp_index",
")",
"=",
"state",
"sparse_values",
"=",
"np",
".",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/arrays/sparse.py#L1398-L1410 | ||
dmlc/nnvm | dab5ce8ab6adbf4edd8bd2fa89f1a99f343b6e38 | python/nnvm/frontend/darknet.py | python | _darknet_reorg | (inputs, attrs) | return _darknet_get_nnvm_op(op_name)(*inputs, **new_attrs), None | Process the reorg operation. | Process the reorg operation. | [
"Process",
"the",
"reorg",
"operation",
"."
] | def _darknet_reorg(inputs, attrs):
"""Process the reorg operation."""
op_name, new_attrs = 'yolo2_reorg', {}
if 'stride' in attrs:
new_attrs = {'stride': attrs.get('stride', 1)}
return _darknet_get_nnvm_op(op_name)(*inputs, **new_attrs), None | [
"def",
"_darknet_reorg",
"(",
"inputs",
",",
"attrs",
")",
":",
"op_name",
",",
"new_attrs",
"=",
"'yolo2_reorg'",
",",
"{",
"}",
"if",
"'stride'",
"in",
"attrs",
":",
"new_attrs",
"=",
"{",
"'stride'",
":",
"attrs",
".",
"get",
"(",
"'stride'",
",",
"... | https://github.com/dmlc/nnvm/blob/dab5ce8ab6adbf4edd8bd2fa89f1a99f343b6e38/python/nnvm/frontend/darknet.py#L272-L277 | |
happynear/caffe-windows | 967eedf25009e334b7f6f933bb5e17aaaff5bef6 | python/caffe/coord_map.py | python | crop | (top_from, top_to) | return L.Crop(top_from, top_to,
crop_param=dict(axis=ax + 1, # +1 for first cropping dim.
offset=list(-np.round(b).astype(int)))) | Define a Crop layer to crop a top (from) to another top (to) by
determining the coordinate mapping between the two and net spec'ing
the axis and shift parameters of the crop. | Define a Crop layer to crop a top (from) to another top (to) by
determining the coordinate mapping between the two and net spec'ing
the axis and shift parameters of the crop. | [
"Define",
"a",
"Crop",
"layer",
"to",
"crop",
"a",
"top",
"(",
"from",
")",
"to",
"another",
"top",
"(",
"to",
")",
"by",
"determining",
"the",
"coordinate",
"mapping",
"between",
"the",
"two",
"and",
"net",
"spec",
"ing",
"the",
"axis",
"and",
"shift"... | def crop(top_from, top_to):
"""
Define a Crop layer to crop a top (from) to another top (to) by
determining the coordinate mapping between the two and net spec'ing
the axis and shift parameters of the crop.
"""
ax, a, b = coord_map_from_to(top_from, top_to)
assert (a == 1).all(), 'scale mism... | [
"def",
"crop",
"(",
"top_from",
",",
"top_to",
")",
":",
"ax",
",",
"a",
",",
"b",
"=",
"coord_map_from_to",
"(",
"top_from",
",",
"top_to",
")",
"assert",
"(",
"a",
"==",
"1",
")",
".",
"all",
"(",
")",
",",
"'scale mismatch on crop (a = {})'",
".",
... | https://github.com/happynear/caffe-windows/blob/967eedf25009e334b7f6f933bb5e17aaaff5bef6/python/caffe/coord_map.py#L172-L185 | |
opencv/opencv | 76aff8478883858f0e46746044348ebb16dc3c67 | samples/dnn/siamrpnpp.py | python | SiamRPNTracker._bbox_clip | (self, cx, cy, width, height, boundary) | return cx, cy, width, height | Adjusting the bounding box | Adjusting the bounding box | [
"Adjusting",
"the",
"bounding",
"box"
] | def _bbox_clip(self, cx, cy, width, height, boundary):
"""
Adjusting the bounding box
"""
bbox_h, bbox_w = boundary
cx = max(0, min(cx, bbox_w))
cy = max(0, min(cy, bbox_h))
width = max(10, min(width, bbox_w))
height = max(10, min(height, bbox_h))
... | [
"def",
"_bbox_clip",
"(",
"self",
",",
"cx",
",",
"cy",
",",
"width",
",",
"height",
",",
"boundary",
")",
":",
"bbox_h",
",",
"bbox_w",
"=",
"boundary",
"cx",
"=",
"max",
"(",
"0",
",",
"min",
"(",
"cx",
",",
"bbox_w",
")",
")",
"cy",
"=",
"ma... | https://github.com/opencv/opencv/blob/76aff8478883858f0e46746044348ebb16dc3c67/samples/dnn/siamrpnpp.py#L222-L231 | |
LUX-Core/lux | 4e1ff7d34a9c76312135ddc869db09149c35170e | contrib/spendfrom/spendfrom.py | python | read_bitcoin_config | (dbdir) | return dict(config_parser.items("all")) | Read the lux.conf file from dbdir, returns dictionary of settings | Read the lux.conf file from dbdir, returns dictionary of settings | [
"Read",
"the",
"lux",
".",
"conf",
"file",
"from",
"dbdir",
"returns",
"dictionary",
"of",
"settings"
] | def read_bitcoin_config(dbdir):
"""Read the lux.conf file from dbdir, returns dictionary of settings"""
from ConfigParser import SafeConfigParser
class FakeSecHead(object):
def __init__(self, fp):
self.fp = fp
self.sechead = '[all]\n'
def readline(self):
... | [
"def",
"read_bitcoin_config",
"(",
"dbdir",
")",
":",
"from",
"ConfigParser",
"import",
"SafeConfigParser",
"class",
"FakeSecHead",
"(",
"object",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"fp",
")",
":",
"self",
".",
"fp",
"=",
"fp",
"self",
".",
"... | https://github.com/LUX-Core/lux/blob/4e1ff7d34a9c76312135ddc869db09149c35170e/contrib/spendfrom/spendfrom.py#L43-L63 | |
ablab/spades | 3a754192b88540524ce6fb69eef5ea9273a38465 | assembler/ext/src/python_libs/pyyaml2/__init__.py | python | add_constructor | (tag, constructor, Loader=Loader) | Add a constructor for the given tag.
Constructor is a function that accepts a Loader instance
and a node object and produces the corresponding Python object. | Add a constructor for the given tag.
Constructor is a function that accepts a Loader instance
and a node object and produces the corresponding Python object. | [
"Add",
"a",
"constructor",
"for",
"the",
"given",
"tag",
".",
"Constructor",
"is",
"a",
"function",
"that",
"accepts",
"a",
"Loader",
"instance",
"and",
"a",
"node",
"object",
"and",
"produces",
"the",
"corresponding",
"Python",
"object",
"."
] | def add_constructor(tag, constructor, Loader=Loader):
"""
Add a constructor for the given tag.
Constructor is a function that accepts a Loader instance
and a node object and produces the corresponding Python object.
"""
Loader.add_constructor(tag, constructor) | [
"def",
"add_constructor",
"(",
"tag",
",",
"constructor",
",",
"Loader",
"=",
"Loader",
")",
":",
"Loader",
".",
"add_constructor",
"(",
"tag",
",",
"constructor",
")"
] | https://github.com/ablab/spades/blob/3a754192b88540524ce6fb69eef5ea9273a38465/assembler/ext/src/python_libs/pyyaml2/__init__.py#L249-L255 | ||
genn-team/genn | 75e1eb218cafa228bf36ae4613d1ce26e877b12c | generate_swig_interfaces.py | python | SwigModuleGenerator.addSwigTemplate | ( self, tSpec, newName ) | Adds a template specification tSpec and renames it as newName | Adds a template specification tSpec and renames it as newName | [
"Adds",
"a",
"template",
"specification",
"tSpec",
"and",
"renames",
"it",
"as",
"newName"
] | def addSwigTemplate( self, tSpec, newName ):
'''Adds a template specification tSpec and renames it as newName'''
self.write( '%template({}) {};\n'.format( newName, tSpec ) ) | [
"def",
"addSwigTemplate",
"(",
"self",
",",
"tSpec",
",",
"newName",
")",
":",
"self",
".",
"write",
"(",
"'%template({}) {};\\n'",
".",
"format",
"(",
"newName",
",",
"tSpec",
")",
")"
] | https://github.com/genn-team/genn/blob/75e1eb218cafa228bf36ae4613d1ce26e877b12c/generate_swig_interfaces.py#L178-L180 | ||
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPMS_AUTH_RESPONSE.toTpm | (self, buf) | TpmMarshaller method | TpmMarshaller method | [
"TpmMarshaller",
"method"
] | def toTpm(self, buf):
""" TpmMarshaller method """
buf.writeSizedByteBuf(self.nonce)
buf.writeByte(self.sessionAttributes)
buf.writeSizedByteBuf(self.hmac) | [
"def",
"toTpm",
"(",
"self",
",",
"buf",
")",
":",
"buf",
".",
"writeSizedByteBuf",
"(",
"self",
".",
"nonce",
")",
"buf",
".",
"writeByte",
"(",
"self",
".",
"sessionAttributes",
")",
"buf",
".",
"writeSizedByteBuf",
"(",
"self",
".",
"hmac",
")"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L5572-L5576 | ||
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/util/fslike/abstract.py | python | FSLikeObject.resolve_r | (self, parts) | return Path(self, parts) if self.exists(parts) else None | Returns a new, flattened, Path if the target exists.
The fslike parts in between may be skipped,
so that just the resulting path is returned.
Returns None if the path does not exist. | Returns a new, flattened, Path if the target exists.
The fslike parts in between may be skipped,
so that just the resulting path is returned. | [
"Returns",
"a",
"new",
"flattened",
"Path",
"if",
"the",
"target",
"exists",
".",
"The",
"fslike",
"parts",
"in",
"between",
"may",
"be",
"skipped",
"so",
"that",
"just",
"the",
"resulting",
"path",
"is",
"returned",
"."
] | def resolve_r(self, parts):
"""
Returns a new, flattened, Path if the target exists.
The fslike parts in between may be skipped,
so that just the resulting path is returned.
Returns None if the path does not exist.
"""
return Path(self, parts) if self.exists(part... | [
"def",
"resolve_r",
"(",
"self",
",",
"parts",
")",
":",
"return",
"Path",
"(",
"self",
",",
"parts",
")",
"if",
"self",
".",
"exists",
"(",
"parts",
")",
"else",
"None"
] | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/util/fslike/abstract.py#L75-L83 | |
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | ProcessGlobalSuppresions | (lines) | Updates the list of global error suppressions.
Parses any lint directives in the file that have global effect.
Args:
lines: An array of strings, each representing a line of the file, with the
last element being empty if the file is terminated with a newline. | Updates the list of global error suppressions. | [
"Updates",
"the",
"list",
"of",
"global",
"error",
"suppressions",
"."
] | def ProcessGlobalSuppresions(lines):
"""Updates the list of global error suppressions.
Parses any lint directives in the file that have global effect.
Args:
lines: An array of strings, each representing a line of the file, with the
last element being empty if the file is terminated with a newline... | [
"def",
"ProcessGlobalSuppresions",
"(",
"lines",
")",
":",
"for",
"line",
"in",
"lines",
":",
"if",
"_SEARCH_C_FILE",
".",
"search",
"(",
"line",
")",
":",
"for",
"category",
"in",
"_DEFAULT_C_SUPPRESSED_CATEGORIES",
":",
"_global_error_suppressions",
"[",
"catego... | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L615-L630 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/math_ops.py | python | to_bfloat16 | (x, name="ToBFloat16") | return cast(x, dtypes.bfloat16, name=name) | Casts a tensor to type `bfloat16`.
Args:
x: A `Tensor` or `SparseTensor`.
name: A name for the operation (optional).
Returns:
A `Tensor` or `SparseTensor` with same shape as `x` with type `bfloat16`.
Raises:
TypeError: If `x` cannot be cast to the `bfloat16`. | Casts a tensor to type `bfloat16`. | [
"Casts",
"a",
"tensor",
"to",
"type",
"bfloat16",
"."
] | def to_bfloat16(x, name="ToBFloat16"):
"""Casts a tensor to type `bfloat16`.
Args:
x: A `Tensor` or `SparseTensor`.
name: A name for the operation (optional).
Returns:
A `Tensor` or `SparseTensor` with same shape as `x` with type `bfloat16`.
Raises:
TypeError: If `x` cannot be cast to the `bf... | [
"def",
"to_bfloat16",
"(",
"x",
",",
"name",
"=",
"\"ToBFloat16\"",
")",
":",
"return",
"cast",
"(",
"x",
",",
"dtypes",
".",
"bfloat16",
",",
"name",
"=",
"name",
")"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/math_ops.py#L816-L829 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/distributions/bijector_impl.py | python | Bijector.forward_event_shape_tensor | (self,
input_shape,
name="forward_event_shape_tensor") | Shape of a single sample from a single batch as an `int32` 1D `Tensor`.
Args:
input_shape: `Tensor`, `int32` vector indicating event-portion shape
passed into `forward` function.
name: name to give to the op
Returns:
forward_event_shape_tensor: `Tensor`, `int32` vector indicating
... | Shape of a single sample from a single batch as an `int32` 1D `Tensor`. | [
"Shape",
"of",
"a",
"single",
"sample",
"from",
"a",
"single",
"batch",
"as",
"an",
"int32",
"1D",
"Tensor",
"."
] | def forward_event_shape_tensor(self,
input_shape,
name="forward_event_shape_tensor"):
"""Shape of a single sample from a single batch as an `int32` 1D `Tensor`.
Args:
input_shape: `Tensor`, `int32` vector indicating event-portion shape
... | [
"def",
"forward_event_shape_tensor",
"(",
"self",
",",
"input_shape",
",",
"name",
"=",
"\"forward_event_shape_tensor\"",
")",
":",
"with",
"self",
".",
"_name_scope",
"(",
"name",
",",
"[",
"input_shape",
"]",
")",
":",
"input_shape",
"=",
"ops",
".",
"conver... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/distributions/bijector_impl.py#L647-L664 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/markdown/extensions/meta.py | python | MetaPreprocessor.run | (self, lines) | return lines | Parse Meta-Data and store in Markdown.Meta. | Parse Meta-Data and store in Markdown.Meta. | [
"Parse",
"Meta",
"-",
"Data",
"and",
"store",
"in",
"Markdown",
".",
"Meta",
"."
] | def run(self, lines):
""" Parse Meta-Data and store in Markdown.Meta. """
meta = {}
key = None
while 1:
line = lines.pop(0)
if line.strip() == '':
break # blank line - done
m1 = META_RE.match(line)
if m1:
key... | [
"def",
"run",
"(",
"self",
",",
"lines",
")",
":",
"meta",
"=",
"{",
"}",
"key",
"=",
"None",
"while",
"1",
":",
"line",
"=",
"lines",
".",
"pop",
"(",
"0",
")",
"if",
"line",
".",
"strip",
"(",
")",
"==",
"''",
":",
"break",
"# blank line - do... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/markdown/extensions/meta.py#L96-L121 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/oauth2client/oauth2client/multistore_file.py | python | _MultiStore._locked_json_write | (self, data) | Write a JSON serializable data structure to the multistore.
The multistore must be locked when this is called.
Args:
data: The data to be serialized and written. | Write a JSON serializable data structure to the multistore. | [
"Write",
"a",
"JSON",
"serializable",
"data",
"structure",
"to",
"the",
"multistore",
"."
] | def _locked_json_write(self, data):
"""Write a JSON serializable data structure to the multistore.
The multistore must be locked when this is called.
Args:
data: The data to be serialized and written.
"""
assert self._thread_lock.locked()
if self._read_only:
return
self._file.f... | [
"def",
"_locked_json_write",
"(",
"self",
",",
"data",
")",
":",
"assert",
"self",
".",
"_thread_lock",
".",
"locked",
"(",
")",
"if",
"self",
".",
"_read_only",
":",
"return",
"self",
".",
"_file",
".",
"file_handle",
"(",
")",
".",
"seek",
"(",
"0",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/oauth2client/oauth2client/multistore_file.py#L330-L343 | ||
albertz/openlierox | d316c14a8eb57848ef56e9bfa7b23a56f694a51b | tools/DedicatedServerVideo/gdata/spreadsheets/client.py | python | SpreadsheetsClient.add_worksheet | (self, spreadsheet_key, title, rows, cols,
auth_token=None, **kwargs) | return self.post(new_worksheet, WORKSHEETS_URL % spreadsheet_key,
auth_token=auth_token, **kwargs) | Creates a new worksheet entry in the spreadsheet.
Args:
spreadsheet_key: str, The unique ID of this containing spreadsheet. This
can be the ID from the URL or as provided in a
Spreadsheet entry.
title: str, The title to be used in for the worksheet.
r... | Creates a new worksheet entry in the spreadsheet. | [
"Creates",
"a",
"new",
"worksheet",
"entry",
"in",
"the",
"spreadsheet",
"."
] | def add_worksheet(self, spreadsheet_key, title, rows, cols,
auth_token=None, **kwargs):
"""Creates a new worksheet entry in the spreadsheet.
Args:
spreadsheet_key: str, The unique ID of this containing spreadsheet. This
can be the ID from the URL or as provided ... | [
"def",
"add_worksheet",
"(",
"self",
",",
"spreadsheet_key",
",",
"title",
",",
"rows",
",",
"cols",
",",
"auth_token",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"new_worksheet",
"=",
"gdata",
".",
"spreadsheets",
".",
"data",
".",
"WorksheetEntry",
... | https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/gdata/spreadsheets/client.py#L106-L129 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/multiprocessing/__init__.py | python | Pool | (processes=None, initializer=None, initargs=(), maxtasksperchild=None) | return Pool(processes, initializer, initargs, maxtasksperchild) | Returns a process pool object | Returns a process pool object | [
"Returns",
"a",
"process",
"pool",
"object"
] | def Pool(processes=None, initializer=None, initargs=(), maxtasksperchild=None):
'''
Returns a process pool object
'''
from multiprocessing.pool import Pool
return Pool(processes, initializer, initargs, maxtasksperchild) | [
"def",
"Pool",
"(",
"processes",
"=",
"None",
",",
"initializer",
"=",
"None",
",",
"initargs",
"=",
"(",
")",
",",
"maxtasksperchild",
"=",
"None",
")",
":",
"from",
"multiprocessing",
".",
"pool",
"import",
"Pool",
"return",
"Pool",
"(",
"processes",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/multiprocessing/__init__.py#L227-L232 | |
microsoft/LightGBM | 904b2d5158703c4900b68008617951dd2f9ff21b | python-package/lightgbm/basic.py | python | _normalize_native_string | (func: Callable[[str], None]) | return wrapper | Join log messages from native library which come by chunks. | Join log messages from native library which come by chunks. | [
"Join",
"log",
"messages",
"from",
"native",
"library",
"which",
"come",
"by",
"chunks",
"."
] | def _normalize_native_string(func: Callable[[str], None]) -> Callable[[str], None]:
"""Join log messages from native library which come by chunks."""
msg_normalized: List[str] = []
@wraps(func)
def wrapper(msg: str) -> None:
nonlocal msg_normalized
if msg.strip() == '':
msg ... | [
"def",
"_normalize_native_string",
"(",
"func",
":",
"Callable",
"[",
"[",
"str",
"]",
",",
"None",
"]",
")",
"->",
"Callable",
"[",
"[",
"str",
"]",
",",
"None",
"]",
":",
"msg_normalized",
":",
"List",
"[",
"str",
"]",
"=",
"[",
"]",
"@",
"wraps"... | https://github.com/microsoft/LightGBM/blob/904b2d5158703c4900b68008617951dd2f9ff21b/python-package/lightgbm/basic.py#L62-L76 | |
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Node/__init__.py | python | Node.alter_targets | (self) | return [], None | Return a list of alternate targets for this Node. | Return a list of alternate targets for this Node. | [
"Return",
"a",
"list",
"of",
"alternate",
"targets",
"for",
"this",
"Node",
"."
] | def alter_targets(self):
"""Return a list of alternate targets for this Node.
"""
return [], None | [
"def",
"alter_targets",
"(",
"self",
")",
":",
"return",
"[",
"]",
",",
"None"
] | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Node/__init__.py#L950-L953 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_grad/grad_array_ops.py | python | _concat_grad_uniform | (input_shapes, input_nums) | return is_uniform | Helper function for bprop of Concat | Helper function for bprop of Concat | [
"Helper",
"function",
"for",
"bprop",
"of",
"Concat"
] | def _concat_grad_uniform(input_shapes, input_nums):
"""Helper function for bprop of Concat"""
is_uniform = True
for i in range(1, input_nums):
if input_shapes[i - 1] != input_shapes[i]:
is_uniform = False
break
return is_uniform | [
"def",
"_concat_grad_uniform",
"(",
"input_shapes",
",",
"input_nums",
")",
":",
"is_uniform",
"=",
"True",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"input_nums",
")",
":",
"if",
"input_shapes",
"[",
"i",
"-",
"1",
"]",
"!=",
"input_shapes",
"[",
"i",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_grad/grad_array_ops.py#L357-L364 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | Brush.__init__ | (self, *args, **kwargs) | __init__(self, Colour colour, int style=SOLID) -> Brush
Constructs a brush from a `wx.Colour` object and a style. | __init__(self, Colour colour, int style=SOLID) -> Brush | [
"__init__",
"(",
"self",
"Colour",
"colour",
"int",
"style",
"=",
"SOLID",
")",
"-",
">",
"Brush"
] | def __init__(self, *args, **kwargs):
"""
__init__(self, Colour colour, int style=SOLID) -> Brush
Constructs a brush from a `wx.Colour` object and a style.
"""
_gdi_.Brush_swiginit(self,_gdi_.new_Brush(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_gdi_",
".",
"Brush_swiginit",
"(",
"self",
",",
"_gdi_",
".",
"new_Brush",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L517-L523 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/macosx.py | python | isCarbonTk | () | return _tk_type == "carbon" | Returns True if IDLE is using a Carbon Aqua Tk (instead of the
newer Cocoa Aqua Tk). | Returns True if IDLE is using a Carbon Aqua Tk (instead of the
newer Cocoa Aqua Tk). | [
"Returns",
"True",
"if",
"IDLE",
"is",
"using",
"a",
"Carbon",
"Aqua",
"Tk",
"(",
"instead",
"of",
"the",
"newer",
"Cocoa",
"Aqua",
"Tk",
")",
"."
] | def isCarbonTk():
"""
Returns True if IDLE is using a Carbon Aqua Tk (instead of the
newer Cocoa Aqua Tk).
"""
if not _tk_type:
_init_tk_type()
return _tk_type == "carbon" | [
"def",
"isCarbonTk",
"(",
")",
":",
"if",
"not",
"_tk_type",
":",
"_init_tk_type",
"(",
")",
"return",
"_tk_type",
"==",
"\"carbon\""
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/macosx.py#L45-L52 | |
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPM2_TestParms_REQUEST.parametersType | (self) | return parameters.GetUnionSelector() | The algorithm to be tested | The algorithm to be tested | [
"The",
"algorithm",
"to",
"be",
"tested"
] | def parametersType(self): # TPM_ALG_ID
""" The algorithm to be tested """
return parameters.GetUnionSelector() | [
"def",
"parametersType",
"(",
"self",
")",
":",
"# TPM_ALG_ID",
"return",
"parameters",
".",
"GetUnionSelector",
"(",
")"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L16529-L16531 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/dqn.py | python | DQN._create_target_network_update_op | (self, q_network, target_q_network) | return tf.group([
tf.assign(target_v, v)
for (target_v, v) in zip(self._target_variables, self._variables)
]) | Create TF ops copying the params of the Q-network to the target network.
Args:
q_network: A q-network object that implements provides the `variables`
property representing the TF variable list.
target_q_network: A target q-net object that provides the `variables`
... | Create TF ops copying the params of the Q-network to the target network. | [
"Create",
"TF",
"ops",
"copying",
"the",
"params",
"of",
"the",
"Q",
"-",
"network",
"to",
"the",
"target",
"network",
"."
] | def _create_target_network_update_op(self, q_network, target_q_network):
"""Create TF ops copying the params of the Q-network to the target network.
Args:
q_network: A q-network object that implements provides the `variables`
property representing the TF variable list.
target_q_net... | [
"def",
"_create_target_network_update_op",
"(",
"self",
",",
"q_network",
",",
"target_q_network",
")",
":",
"self",
".",
"_variables",
"=",
"q_network",
".",
"variables",
"[",
":",
"]",
"self",
".",
"_target_variables",
"=",
"target_q_network",
".",
"variables",
... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/dqn.py#L252-L271 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2.py | python | uCSIsTelugu | (code) | return ret | Check whether the character is part of Telugu UCS Block | Check whether the character is part of Telugu UCS Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"Telugu",
"UCS",
"Block"
] | def uCSIsTelugu(code):
"""Check whether the character is part of Telugu UCS Block """
ret = libxml2mod.xmlUCSIsTelugu(code)
return ret | [
"def",
"uCSIsTelugu",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsTelugu",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L2936-L2939 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/pyshell.py | python | PyShell.ispythonsource | (self, filename) | return True | Override EditorWindow method: never remove the colorizer | Override EditorWindow method: never remove the colorizer | [
"Override",
"EditorWindow",
"method",
":",
"never",
"remove",
"the",
"colorizer"
] | def ispythonsource(self, filename):
"Override EditorWindow method: never remove the colorizer"
return True | [
"def",
"ispythonsource",
"(",
"self",
",",
"filename",
")",
":",
"return",
"True"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/pyshell.py#L1034-L1036 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/difflib.py | python | HtmlDiff._make_prefix | (self) | Create unique anchor prefixes | Create unique anchor prefixes | [
"Create",
"unique",
"anchor",
"prefixes"
] | def _make_prefix(self):
"""Create unique anchor prefixes"""
# Generate a unique anchor prefix so multiple tables
# can exist on the same HTML page without conflicts.
fromprefix = "from%d_" % HtmlDiff._default_prefix
toprefix = "to%d_" % HtmlDiff._default_prefix
HtmlDiff.... | [
"def",
"_make_prefix",
"(",
"self",
")",
":",
"# Generate a unique anchor prefix so multiple tables",
"# can exist on the same HTML page without conflicts.",
"fromprefix",
"=",
"\"from%d_\"",
"%",
"HtmlDiff",
".",
"_default_prefix",
"toprefix",
"=",
"\"to%d_\"",
"%",
"HtmlDiff"... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/difflib.py#L1885-L1894 | ||
tkn-tub/ns3-gym | 19bfe0a583e641142609939a090a09dfc63a095f | utils/grid.py | python | GraphicRenderer.get_width | (self) | return self.__width | ! Get Width
@param self: this object
@return width | ! Get Width | [
"!",
"Get",
"Width"
] | def get_width(self):
"""! Get Width
@param self: this object
@return width
"""
return self.__width | [
"def",
"get_width",
"(",
"self",
")",
":",
"return",
"self",
".",
"__width"
] | https://github.com/tkn-tub/ns3-gym/blob/19bfe0a583e641142609939a090a09dfc63a095f/utils/grid.py#L1021-L1026 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/requests/models.py | python | RequestHooksMixin.deregister_hook | (self, event, hook) | Deregister a previously registered hook.
Returns True if the hook existed, False if not. | Deregister a previously registered hook.
Returns True if the hook existed, False if not. | [
"Deregister",
"a",
"previously",
"registered",
"hook",
".",
"Returns",
"True",
"if",
"the",
"hook",
"existed",
"False",
"if",
"not",
"."
] | def deregister_hook(self, event, hook):
"""Deregister a previously registered hook.
Returns True if the hook existed, False if not.
"""
try:
self.hooks[event].remove(hook)
return True
except ValueError:
return False | [
"def",
"deregister_hook",
"(",
"self",
",",
"event",
",",
"hook",
")",
":",
"try",
":",
"self",
".",
"hooks",
"[",
"event",
"]",
".",
"remove",
"(",
"hook",
")",
"return",
"True",
"except",
"ValueError",
":",
"return",
"False"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/requests/models.py#L186-L195 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/task_generation/evg_config_builder.py | python | EvgConfigBuilder.get_build_variant | (self, build_variant: str) | return self.build_variants[build_variant] | Get the build variant object, creating it if it doesn't exist.
NOTE: The `lock` should be held by any functions calling this one.
:param build_variant: Name of build variant.
:return: BuildVariant object being created. | Get the build variant object, creating it if it doesn't exist. | [
"Get",
"the",
"build",
"variant",
"object",
"creating",
"it",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | def get_build_variant(self, build_variant: str) -> BuildVariant:
"""
Get the build variant object, creating it if it doesn't exist.
NOTE: The `lock` should be held by any functions calling this one.
:param build_variant: Name of build variant.
:return: BuildVariant object being... | [
"def",
"get_build_variant",
"(",
"self",
",",
"build_variant",
":",
"str",
")",
"->",
"BuildVariant",
":",
"if",
"build_variant",
"not",
"in",
"self",
".",
"build_variants",
":",
"self",
".",
"build_variants",
"[",
"build_variant",
"]",
"=",
"BuildVariant",
"(... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/task_generation/evg_config_builder.py#L50-L61 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/models/rnn/translate/data_utils.py | python | basic_tokenizer | (sentence) | return [w for w in words if w] | Very basic tokenizer: split the sentence into a list of tokens. | Very basic tokenizer: split the sentence into a list of tokens. | [
"Very",
"basic",
"tokenizer",
":",
"split",
"the",
"sentence",
"into",
"a",
"list",
"of",
"tokens",
"."
] | def basic_tokenizer(sentence):
"""Very basic tokenizer: split the sentence into a list of tokens."""
words = []
for space_separated_fragment in sentence.strip().split():
words.extend(re.split(_WORD_SPLIT, space_separated_fragment))
return [w for w in words if w] | [
"def",
"basic_tokenizer",
"(",
"sentence",
")",
":",
"words",
"=",
"[",
"]",
"for",
"space_separated_fragment",
"in",
"sentence",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
":",
"words",
".",
"extend",
"(",
"re",
".",
"split",
"(",
"_WORD_SPLIT",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/models/rnn/translate/data_utils.py#L105-L110 | |
zhaoweicai/hwgq | ebc706bee3e2d145de1da4be446ce8de8740738f | scripts/cpp_lint.py | python | _Filters | () | return _cpplint_state.filters | Returns the module's list of output filters, as a list. | Returns the module's list of output filters, as a list. | [
"Returns",
"the",
"module",
"s",
"list",
"of",
"output",
"filters",
"as",
"a",
"list",
"."
] | def _Filters():
"""Returns the module's list of output filters, as a list."""
return _cpplint_state.filters | [
"def",
"_Filters",
"(",
")",
":",
"return",
"_cpplint_state",
".",
"filters"
] | https://github.com/zhaoweicai/hwgq/blob/ebc706bee3e2d145de1da4be446ce8de8740738f/scripts/cpp_lint.py#L792-L794 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | AboutDialogInfo._GetWebSiteDescription | (*args, **kwargs) | return _misc_.AboutDialogInfo__GetWebSiteDescription(*args, **kwargs) | _GetWebSiteDescription(self) -> String | _GetWebSiteDescription(self) -> String | [
"_GetWebSiteDescription",
"(",
"self",
")",
"-",
">",
"String"
] | def _GetWebSiteDescription(*args, **kwargs):
"""_GetWebSiteDescription(self) -> String"""
return _misc_.AboutDialogInfo__GetWebSiteDescription(*args, **kwargs) | [
"def",
"_GetWebSiteDescription",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"AboutDialogInfo__GetWebSiteDescription",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L6763-L6765 | |
bigartm/bigartm | 47e37f982de87aa67bfd475ff1f39da696b181b3 | 3rdparty/protobuf-3.0.0/python/google/protobuf/service.py | python | RpcController.NotifyOnCancel | (self, callback) | Sets a callback to invoke on cancel.
Asks that the given callback be called when the RPC is canceled. The
callback will always be called exactly once. If the RPC completes without
being canceled, the callback will be called after completion. If the RPC
has already been canceled when NotifyOnCancel()... | Sets a callback to invoke on cancel. | [
"Sets",
"a",
"callback",
"to",
"invoke",
"on",
"cancel",
"."
] | def NotifyOnCancel(self, callback):
"""Sets a callback to invoke on cancel.
Asks that the given callback be called when the RPC is canceled. The
callback will always be called exactly once. If the RPC completes without
being canceled, the callback will be called after completion. If the RPC
has ... | [
"def",
"NotifyOnCancel",
"(",
"self",
",",
"callback",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/bigartm/bigartm/blob/47e37f982de87aa67bfd475ff1f39da696b181b3/3rdparty/protobuf-3.0.0/python/google/protobuf/service.py#L187-L198 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py2/prompt_toolkit/eventloop/posix.py | python | PosixEventLoop.received_winch | (self) | Notify the event loop that SIGWINCH has been received | Notify the event loop that SIGWINCH has been received | [
"Notify",
"the",
"event",
"loop",
"that",
"SIGWINCH",
"has",
"been",
"received"
] | def received_winch(self):
"""
Notify the event loop that SIGWINCH has been received
"""
# Process signal asynchronously, because this handler can write to the
# output, and doing this inside the signal handler causes easily
# reentrant calls, giving runtime errors..
... | [
"def",
"received_winch",
"(",
"self",
")",
":",
"# Process signal asynchronously, because this handler can write to the",
"# output, and doing this inside the signal handler causes easily",
"# reentrant calls, giving runtime errors..",
"# Furthur, this has to be thread safe. When the CommandLineIn... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py2/prompt_toolkit/eventloop/posix.py#L191-L207 | ||
francinexue/xuefu | b6ff79747a42e020588c0c0a921048e08fe4680c | ctpx/ctp2/ctptd.py | python | CtpTd.onRspQuoteAction | (self, InputQuoteActionField, RspInfoField, requestId, final) | 报价操作请求响应 | 报价操作请求响应 | [
"报价操作请求响应"
] | def onRspQuoteAction(self, InputQuoteActionField, RspInfoField, requestId, final):
"""报价操作请求响应"""
pass | [
"def",
"onRspQuoteAction",
"(",
"self",
",",
"InputQuoteActionField",
",",
"RspInfoField",
",",
"requestId",
",",
"final",
")",
":",
"pass"
] | https://github.com/francinexue/xuefu/blob/b6ff79747a42e020588c0c0a921048e08fe4680c/ctpx/ctp2/ctptd.py#L160-L162 | ||
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | scripts/mk_genfile_common.py | python | mk_gparams_register_modules_internal | (h_files_full_path, path) | return fullname | Generate a ``gparams_register_modules.cpp`` file in the directory ``path``.
Returns the path to the generated file.
This file implements the procedure
```
void gparams_register_modules()
```
This procedure is invoked by gparams::init() | Generate a ``gparams_register_modules.cpp`` file in the directory ``path``.
Returns the path to the generated file. | [
"Generate",
"a",
"gparams_register_modules",
".",
"cpp",
"file",
"in",
"the",
"directory",
"path",
".",
"Returns",
"the",
"path",
"to",
"the",
"generated",
"file",
"."
] | def mk_gparams_register_modules_internal(h_files_full_path, path):
"""
Generate a ``gparams_register_modules.cpp`` file in the directory ``path``.
Returns the path to the generated file.
This file implements the procedure
```
void gparams_register_modules()
```
... | [
"def",
"mk_gparams_register_modules_internal",
"(",
"h_files_full_path",
",",
"path",
")",
":",
"assert",
"isinstance",
"(",
"h_files_full_path",
",",
"list",
")",
"assert",
"check_dir_exists",
"(",
"path",
")",
"cmds",
"=",
"[",
"]",
"mod_cmds",
"=",
"[",
"]",
... | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/scripts/mk_genfile_common.py#L599-L652 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/codecs.py | python | IncrementalEncoder.__init__ | (self, errors='strict') | Creates an IncrementalEncoder instance.
The IncrementalEncoder may use different error handling schemes by
providing the errors keyword argument. See the module docstring
for a list of possible values. | Creates an IncrementalEncoder instance. | [
"Creates",
"an",
"IncrementalEncoder",
"instance",
"."
] | def __init__(self, errors='strict'):
"""
Creates an IncrementalEncoder instance.
The IncrementalEncoder may use different error handling schemes by
providing the errors keyword argument. See the module docstring
for a list of possible values.
"""
self.errors = er... | [
"def",
"__init__",
"(",
"self",
",",
"errors",
"=",
"'strict'",
")",
":",
"self",
".",
"errors",
"=",
"errors",
"self",
".",
"buffer",
"=",
"\"\""
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/codecs.py#L186-L195 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/eager/function.py | python | capture_value | (tensor_map, value, dtype, name) | return captured_value | Capture a value from outside the function, to pass in as an extra arg. | Capture a value from outside the function, to pass in as an extra arg. | [
"Capture",
"a",
"value",
"from",
"outside",
"the",
"function",
"to",
"pass",
"in",
"as",
"an",
"extra",
"arg",
"."
] | def capture_value(tensor_map, value, dtype, name):
"""Capture a value from outside the function, to pass in as an extra arg."""
captured_value = tensor_map.get(ops.tensor_id(value), None)
if captured_value is None:
captured_value = graph_placeholder(
dtype=dtype or value.dtype, shape=value.shape, name... | [
"def",
"capture_value",
"(",
"tensor_map",
",",
"value",
",",
"dtype",
",",
"name",
")",
":",
"captured_value",
"=",
"tensor_map",
".",
"get",
"(",
"ops",
".",
"tensor_id",
"(",
"value",
")",
",",
"None",
")",
"if",
"captured_value",
"is",
"None",
":",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/eager/function.py#L82-L95 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/contexts/fitting_contexts/basic_fitting_context.py | python | BasicFittingContext.chi_squared_for_undo | (self) | return self._chi_squared_for_undo | Returns the chi squared from previous fits used for single fitting. | Returns the chi squared from previous fits used for single fitting. | [
"Returns",
"the",
"chi",
"squared",
"from",
"previous",
"fits",
"used",
"for",
"single",
"fitting",
"."
] | def chi_squared_for_undo(self) -> list:
"""Returns the chi squared from previous fits used for single fitting."""
return self._chi_squared_for_undo | [
"def",
"chi_squared_for_undo",
"(",
"self",
")",
"->",
"list",
":",
"return",
"self",
".",
"_chi_squared_for_undo"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/contexts/fitting_contexts/basic_fitting_context.py#L197-L199 | |
interpretml/interpret | 29466bffc04505fe4f836a83fcfebfd313ac8454 | python/interpret-core/interpret/glassbox/decisiontree.py | python | RegressionTree.fit | (self, X, y) | return super().fit(X, y) | Fits model to provided instances.
Args:
X: Numpy array for training instances.
y: Numpy array as training labels.
Returns:
Itself. | Fits model to provided instances. | [
"Fits",
"model",
"to",
"provided",
"instances",
"."
] | def fit(self, X, y):
""" Fits model to provided instances.
Args:
X: Numpy array for training instances.
y: Numpy array as training labels.
Returns:
Itself.
"""
self.sk_model_ = SKRT(max_depth=self.max_depth, **self.kwargs)
return supe... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
")",
":",
"self",
".",
"sk_model_",
"=",
"SKRT",
"(",
"max_depth",
"=",
"self",
".",
"max_depth",
",",
"*",
"*",
"self",
".",
"kwargs",
")",
"return",
"super",
"(",
")",
".",
"fit",
"(",
"X",
",",
... | https://github.com/interpretml/interpret/blob/29466bffc04505fe4f836a83fcfebfd313ac8454/python/interpret-core/interpret/glassbox/decisiontree.py#L497-L508 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/mozbuild/mozpack/mozjar.py | python | JarReader.__init__ | (self, file=None, fileobj=None) | Opens the given file as a Jar archive. Use the given file-like object
if one is given instead of opening the given file name. | Opens the given file as a Jar archive. Use the given file-like object
if one is given instead of opening the given file name. | [
"Opens",
"the",
"given",
"file",
"as",
"a",
"Jar",
"archive",
".",
"Use",
"the",
"given",
"file",
"-",
"like",
"object",
"if",
"one",
"is",
"given",
"instead",
"of",
"opening",
"the",
"given",
"file",
"name",
"."
] | def __init__(self, file=None, fileobj=None):
'''
Opens the given file as a Jar archive. Use the given file-like object
if one is given instead of opening the given file name.
'''
if fileobj:
data = fileobj.read()
else:
data = open(file, 'rb').read(... | [
"def",
"__init__",
"(",
"self",
",",
"file",
"=",
"None",
",",
"fileobj",
"=",
"None",
")",
":",
"if",
"fileobj",
":",
"data",
"=",
"fileobj",
".",
"read",
"(",
")",
"else",
":",
"data",
"=",
"open",
"(",
"file",
",",
"'rb'",
")",
".",
"read",
... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/mozbuild/mozpack/mozjar.py#L333-L353 | ||
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/osr.py | python | SpatialReference.ImportFromMICoordSys | (self, *args) | return _osr.SpatialReference_ImportFromMICoordSys(self, *args) | r"""ImportFromMICoordSys(SpatialReference self, char const * pszCoordSys) -> OGRErr | r"""ImportFromMICoordSys(SpatialReference self, char const * pszCoordSys) -> OGRErr | [
"r",
"ImportFromMICoordSys",
"(",
"SpatialReference",
"self",
"char",
"const",
"*",
"pszCoordSys",
")",
"-",
">",
"OGRErr"
] | def ImportFromMICoordSys(self, *args):
r"""ImportFromMICoordSys(SpatialReference self, char const * pszCoordSys) -> OGRErr"""
return _osr.SpatialReference_ImportFromMICoordSys(self, *args) | [
"def",
"ImportFromMICoordSys",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_osr",
".",
"SpatialReference_ImportFromMICoordSys",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/osr.py#L794-L796 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/custom_ops.py | python | Custom._check_func | (self) | Check the validity of func_type and type of func | Check the validity of func_type and type of func | [
"Check",
"the",
"validity",
"of",
"func_type",
"and",
"type",
"of",
"func"
] | def _check_func(self):
"""Check the validity of func_type and type of func"""
if self.func_type not in self.supported_func_type:
raise ValueError("func_type should be one of {}, but got {}"
.format(self.supported_func_type, self.func_type))
if self.func_t... | [
"def",
"_check_func",
"(",
"self",
")",
":",
"if",
"self",
".",
"func_type",
"not",
"in",
"self",
".",
"supported_func_type",
":",
"raise",
"ValueError",
"(",
"\"func_type should be one of {}, but got {}\"",
".",
"format",
"(",
"self",
".",
"supported_func_type",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/custom_ops.py#L350-L361 | ||
hakuna-m/wubiuefi | caec1af0a09c78fd5a345180ada1fe45e0c63493 | src/pypack/altgraph/Graph.py | python | Graph.__contains__ | (self, node) | return node in self.nodes | Test whether a node is in the graph | Test whether a node is in the graph | [
"Test",
"whether",
"a",
"node",
"is",
"in",
"the",
"graph"
] | def __contains__(self, node):
"""
Test whether a node is in the graph
"""
return node in self.nodes | [
"def",
"__contains__",
"(",
"self",
",",
"node",
")",
":",
"return",
"node",
"in",
"self",
".",
"nodes"
] | https://github.com/hakuna-m/wubiuefi/blob/caec1af0a09c78fd5a345180ada1fe45e0c63493/src/pypack/altgraph/Graph.py#L176-L180 | |
albertz/openlierox | d316c14a8eb57848ef56e9bfa7b23a56f694a51b | tools/DedicatedServerVideo/gdata/tlslite/TLSRecordLayer.py | python | TLSRecordLayer.makefile | (self, mode='r', bufsize=-1) | return FileObject(self, mode, bufsize) | Create a file object for the TLS connection (socket emulation).
@rtype: L{tlslite.FileObject.FileObject} | Create a file object for the TLS connection (socket emulation). | [
"Create",
"a",
"file",
"object",
"for",
"the",
"TLS",
"connection",
"(",
"socket",
"emulation",
")",
"."
] | def makefile(self, mode='r', bufsize=-1):
"""Create a file object for the TLS connection (socket emulation).
@rtype: L{tlslite.FileObject.FileObject}
"""
self._refCount += 1
return FileObject(self, mode, bufsize) | [
"def",
"makefile",
"(",
"self",
",",
"mode",
"=",
"'r'",
",",
"bufsize",
"=",
"-",
"1",
")",
":",
"self",
".",
"_refCount",
"+=",
"1",
"return",
"FileObject",
"(",
"self",
",",
"mode",
",",
"bufsize",
")"
] | https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/gdata/tlslite/TLSRecordLayer.py#L395-L401 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/session_ops.py | python | TensorHandle.get_raw_handle | (self) | return self._handle | Return the raw handle of the tensor.
Note that the method disables the automatic garbage collection of this
persistent tensor. The caller is now responsible for managing the life
time of the tensor. | Return the raw handle of the tensor. | [
"Return",
"the",
"raw",
"handle",
"of",
"the",
"tensor",
"."
] | def get_raw_handle(self):
"""Return the raw handle of the tensor.
Note that the method disables the automatic garbage collection of this
persistent tensor. The caller is now responsible for managing the life
time of the tensor.
"""
self._auto_gc_enabled = False
return self._handle | [
"def",
"get_raw_handle",
"(",
"self",
")",
":",
"self",
".",
"_auto_gc_enabled",
"=",
"False",
"return",
"self",
".",
"_handle"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/session_ops.py#L87-L95 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/s3transfer/utils.py | python | CallArgs.__init__ | (self, **kwargs) | A class that records call arguments
The call arguments must be passed as keyword arguments. It will set
each keyword argument as an attribute of the object along with its
associated value. | A class that records call arguments | [
"A",
"class",
"that",
"records",
"call",
"arguments"
] | def __init__(self, **kwargs):
"""A class that records call arguments
The call arguments must be passed as keyword arguments. It will set
each keyword argument as an attribute of the object along with its
associated value.
"""
for arg, value in kwargs.items():
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"arg",
",",
"value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"setattr",
"(",
"self",
",",
"arg",
",",
"value",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/s3transfer/utils.py#L163-L171 | ||
junhyukoh/caffe-lstm | 598d45456fa2a1b127a644f4aa38daa8fb9fc722 | examples/finetune_flickr_style/assemble_data.py | python | download_image | (args_tuple) | For use with multiprocessing map. Returns filename on fail. | For use with multiprocessing map. Returns filename on fail. | [
"For",
"use",
"with",
"multiprocessing",
"map",
".",
"Returns",
"filename",
"on",
"fail",
"."
] | def download_image(args_tuple):
"For use with multiprocessing map. Returns filename on fail."
try:
url, filename = args_tuple
if not os.path.exists(filename):
urllib.urlretrieve(url, filename)
with open(filename) as f:
assert hashlib.sha1(f.read()).hexdigest() != ... | [
"def",
"download_image",
"(",
"args_tuple",
")",
":",
"try",
":",
"url",
",",
"filename",
"=",
"args_tuple",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"urllib",
".",
"urlretrieve",
"(",
"url",
",",
"filename",
")",
"with... | https://github.com/junhyukoh/caffe-lstm/blob/598d45456fa2a1b127a644f4aa38daa8fb9fc722/examples/finetune_flickr_style/assemble_data.py#L23-L36 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/arrays/timedeltas.py | python | ints_to_td64ns | (data, unit="ns") | return data, copy_made | Convert an ndarray with integer-dtype to timedelta64[ns] dtype, treating
the integers as multiples of the given timedelta unit.
Parameters
----------
data : numpy.ndarray with integer-dtype
unit : str, default "ns"
The timedelta unit to treat integers as multiples of.
Returns
-----... | Convert an ndarray with integer-dtype to timedelta64[ns] dtype, treating
the integers as multiples of the given timedelta unit. | [
"Convert",
"an",
"ndarray",
"with",
"integer",
"-",
"dtype",
"to",
"timedelta64",
"[",
"ns",
"]",
"dtype",
"treating",
"the",
"integers",
"as",
"multiples",
"of",
"the",
"given",
"timedelta",
"unit",
"."
] | def ints_to_td64ns(data, unit="ns"):
"""
Convert an ndarray with integer-dtype to timedelta64[ns] dtype, treating
the integers as multiples of the given timedelta unit.
Parameters
----------
data : numpy.ndarray with integer-dtype
unit : str, default "ns"
The timedelta unit to treat... | [
"def",
"ints_to_td64ns",
"(",
"data",
",",
"unit",
"=",
"\"ns\"",
")",
":",
"copy_made",
"=",
"False",
"unit",
"=",
"unit",
"if",
"unit",
"is",
"not",
"None",
"else",
"\"ns\"",
"if",
"data",
".",
"dtype",
"!=",
"np",
".",
"int64",
":",
"# converting to... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/arrays/timedeltas.py#L981-L1018 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/mfg/games/dynamic_routing.py | python | MeanFieldRoutingGameState._legal_actions | (self, player: pyspiel.PlayerId) | return sorted(actions) | Return the legal actions of the vehicle.
Legal actions are the succesor road section of the vehicle current road
section.
Args:
player: the vehicle id.
Returns:
list_legal_actions: a list of legal actions. If the game is finished then
the list is empty. If the vehicle is at its des... | Return the legal actions of the vehicle. | [
"Return",
"the",
"legal",
"actions",
"of",
"the",
"vehicle",
"."
] | def _legal_actions(self, player: pyspiel.PlayerId) -> List[int]:
"""Return the legal actions of the vehicle.
Legal actions are the succesor road section of the vehicle current road
section.
Args:
player: the vehicle id.
Returns:
list_legal_actions: a list of legal actions. If the game ... | [
"def",
"_legal_actions",
"(",
"self",
",",
"player",
":",
"pyspiel",
".",
"PlayerId",
")",
"->",
"List",
"[",
"int",
"]",
":",
"if",
"self",
".",
"_is_terminal",
":",
"return",
"[",
"]",
"if",
"self",
".",
"get_game",
"(",
")",
".",
"perform_sanity_che... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/mfg/games/dynamic_routing.py#L382-L419 | |
soui3/soui | c588024b2f4f6d3fadb53c1bfed5ccf00d0b7046 | third-part/jsoncpp/devtools/licenseupdater.py | python | update_license | (path, dry_run, show_diff) | return False | Update the license statement in the specified file.
Parameters:
path: path of the C++ source file to update.
dry_run: if True, just print the path of the file that would be updated,
but don't change it.
show_diff: if True, print the path of the file that would be modified,
... | Update the license statement in the specified file.
Parameters:
path: path of the C++ source file to update.
dry_run: if True, just print the path of the file that would be updated,
but don't change it.
show_diff: if True, print the path of the file that would be modified,
... | [
"Update",
"the",
"license",
"statement",
"in",
"the",
"specified",
"file",
".",
"Parameters",
":",
"path",
":",
"path",
"of",
"the",
"C",
"++",
"source",
"file",
"to",
"update",
".",
"dry_run",
":",
"if",
"True",
"just",
"print",
"the",
"path",
"of",
"... | def update_license(path, dry_run, show_diff):
"""Update the license statement in the specified file.
Parameters:
path: path of the C++ source file to update.
dry_run: if True, just print the path of the file that would be updated,
but don't change it.
show_diff: if True, print t... | [
"def",
"update_license",
"(",
"path",
",",
"dry_run",
",",
"show_diff",
")",
":",
"with",
"open",
"(",
"path",
",",
"'rt'",
")",
"as",
"fin",
":",
"original_text",
"=",
"fin",
".",
"read",
"(",
")",
".",
"replace",
"(",
"'\\r\\n'",
",",
"'\\n'",
")",... | https://github.com/soui3/soui/blob/c588024b2f4f6d3fadb53c1bfed5ccf00d0b7046/third-part/jsoncpp/devtools/licenseupdater.py#L16-L44 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/turtle.py | python | TurtleScreenBase._update | (self) | Redraw graphics items on canvas | Redraw graphics items on canvas | [
"Redraw",
"graphics",
"items",
"on",
"canvas"
] | def _update(self):
"""Redraw graphics items on canvas
"""
self.cv.update() | [
"def",
"_update",
"(",
"self",
")",
":",
"self",
".",
"cv",
".",
"update",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/turtle.py#L559-L562 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.