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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
shoaibrayeen/Programmers-Community | 1d352fb3e6ac5e2e7d9472d90527bdcc8d5ec355 | Data Structure/Array Or Vector/Sort An Array of 0s and 1s/SolutionByEnthusiastDeveloper.py | python | sortArray | (array) | return sorted_array | Sort a given array which should only include 0's and 1's
Raise a value error on the first value which is not 0 or 1, otherwise returns a sorted array
Logic:
1. Go over the supplied array once and:
a. verify the input values
b. count how many 1's are in there
2. Fill the sorted array with zeros (length of given... | Sort a given array which should only include 0's and 1's
Raise a value error on the first value which is not 0 or 1, otherwise returns a sorted array | [
"Sort",
"a",
"given",
"array",
"which",
"should",
"only",
"include",
"0",
"s",
"and",
"1",
"s",
"Raise",
"a",
"value",
"error",
"on",
"the",
"first",
"value",
"which",
"is",
"not",
"0",
"or",
"1",
"otherwise",
"returns",
"a",
"sorted",
"array"
] | def sortArray(array):
'''
Sort a given array which should only include 0's and 1's
Raise a value error on the first value which is not 0 or 1, otherwise returns a sorted array
Logic:
1. Go over the supplied array once and:
a. verify the input values
b. count how many 1's are in there
2. Fill the sorted array... | [
"def",
"sortArray",
"(",
"array",
")",
":",
"num_of_ones",
"=",
"0",
"for",
"x",
"in",
"array",
":",
"if",
"x",
"==",
"0",
":",
"pass",
"elif",
"x",
"==",
"1",
":",
"num_of_ones",
"+=",
"1",
"else",
":",
"raise",
"ValueError",
"sorted_array",
"=",
... | https://github.com/shoaibrayeen/Programmers-Community/blob/1d352fb3e6ac5e2e7d9472d90527bdcc8d5ec355/Data Structure/Array Or Vector/Sort An Array of 0s and 1s/SolutionByEnthusiastDeveloper.py#L5-L32 | |
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/FemToDemApplication/python_scripts/MainCouplingPfemFemDemAitken.py | python | KratosPrintInfo | (message) | This function prints info on screen | This function prints info on screen | [
"This",
"function",
"prints",
"info",
"on",
"screen"
] | def KratosPrintInfo(message):
"""This function prints info on screen
"""
KM.Logger.Print("", message)
KM.Logger.Flush() | [
"def",
"KratosPrintInfo",
"(",
"message",
")",
":",
"KM",
".",
"Logger",
".",
"Print",
"(",
"\"\"",
",",
"message",
")",
"KM",
".",
"Logger",
".",
"Flush",
"(",
")"
] | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/FemToDemApplication/python_scripts/MainCouplingPfemFemDemAitken.py#L13-L17 | ||
GoSSIP-SJTU/Armariris | ad5d868482956b2194a77b39c8d543c7c2318200 | tools/clang/bindings/python/clang/cindex.py | python | Cursor.get_usr | (self) | return conf.lib.clang_getCursorUSR(self) | Return the Unified Symbol Resultion (USR) for the entity referenced
by the given cursor (or None).
A Unified Symbol Resolution (USR) is a string that identifies a
particular entity (function, class, variable, etc.) within a
program. USRs can be compared across translation units to deter... | Return the Unified Symbol Resultion (USR) for the entity referenced
by the given cursor (or None). | [
"Return",
"the",
"Unified",
"Symbol",
"Resultion",
"(",
"USR",
")",
"for",
"the",
"entity",
"referenced",
"by",
"the",
"given",
"cursor",
"(",
"or",
"None",
")",
"."
] | def get_usr(self):
"""Return the Unified Symbol Resultion (USR) for the entity referenced
by the given cursor (or None).
A Unified Symbol Resolution (USR) is a string that identifies a
particular entity (function, class, variable, etc.) within a
program. USRs can be compared acr... | [
"def",
"get_usr",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getCursorUSR",
"(",
"self",
")"
] | https://github.com/GoSSIP-SJTU/Armariris/blob/ad5d868482956b2194a77b39c8d543c7c2318200/tools/clang/bindings/python/clang/cindex.py#L1257-L1266 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/ops/If.py | python | If.re_numerate_internal_id_and_get_if_id | (if_node) | return if_node.node | This method is called before IR generation. This method sets internal_layer_id.
:param if_node: The If node where is necessary to set internal_layer_id in bodies.
:return: if_node | This method is called before IR generation. This method sets internal_layer_id. | [
"This",
"method",
"is",
"called",
"before",
"IR",
"generation",
".",
"This",
"method",
"sets",
"internal_layer_id",
"."
] | def re_numerate_internal_id_and_get_if_id(if_node):
"""
This method is called before IR generation. This method sets internal_layer_id.
:param if_node: The If node where is necessary to set internal_layer_id in bodies.
:return: if_node
"""
then_graph_nodes = if_node.then... | [
"def",
"re_numerate_internal_id_and_get_if_id",
"(",
"if_node",
")",
":",
"then_graph_nodes",
"=",
"if_node",
".",
"then_graph",
".",
"nodes",
"(",
")",
"for",
"idx",
"in",
"range",
"(",
"len",
"(",
"if_node",
".",
"then_graph",
".",
"get_op_nodes",
"(",
")",
... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/ops/If.py#L273-L286 | |
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/core/df_protocol.py | python | _CuDFBuffer.bufsize | (self) | return self._buf.nbytes | Buffer size in bytes. | Buffer size in bytes. | [
"Buffer",
"size",
"in",
"bytes",
"."
] | def bufsize(self) -> int:
"""
Buffer size in bytes.
"""
return self._buf.nbytes | [
"def",
"bufsize",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_buf",
".",
"nbytes"
] | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/df_protocol.py#L79-L83 | |
facebookarchive/LogDevice | ce7726050edc49a1e15d9160e81c890736b779e2 | logdevice/ops/ldshell/autoload/commands/safety.py | python | location_up_to_scope | (
shard: ShardID,
location_per_scope: Mapping[LocationScope, str],
scope: LocationScope,
) | return ".".join(locs) | Generates a string of the location string up to a given scope. The input
scope is inclusive. | Generates a string of the location string up to a given scope. The input
scope is inclusive. | [
"Generates",
"a",
"string",
"of",
"the",
"location",
"string",
"up",
"to",
"a",
"given",
"scope",
".",
"The",
"input",
"scope",
"is",
"inclusive",
"."
] | def location_up_to_scope(
shard: ShardID,
location_per_scope: Mapping[LocationScope, str],
scope: LocationScope,
) -> str:
"""
Generates a string of the location string up to a given scope. The input
scope is inclusive.
"""
if not location_per_scope:
return "UNKNOWN"
locs = [... | [
"def",
"location_up_to_scope",
"(",
"shard",
":",
"ShardID",
",",
"location_per_scope",
":",
"Mapping",
"[",
"LocationScope",
",",
"str",
"]",
",",
"scope",
":",
"LocationScope",
",",
")",
"->",
"str",
":",
"if",
"not",
"location_per_scope",
":",
"return",
"... | https://github.com/facebookarchive/LogDevice/blob/ce7726050edc49a1e15d9160e81c890736b779e2/logdevice/ops/ldshell/autoload/commands/safety.py#L307-L329 | |
metashell/metashell | f4177e4854ea00c8dbc722cadab26ef413d798ea | 3rd/templight/clang/utils/check_cfc/check_cfc.py | python | get_output_file | (args) | return None | Return the output file specified by this command or None if not
specified. | Return the output file specified by this command or None if not
specified. | [
"Return",
"the",
"output",
"file",
"specified",
"by",
"this",
"command",
"or",
"None",
"if",
"not",
"specified",
"."
] | def get_output_file(args):
"""Return the output file specified by this command or None if not
specified."""
grabnext = False
for arg in args:
if grabnext:
return arg
if arg == '-o':
# Specified as a separate arg
grabnext = True
elif arg.startsw... | [
"def",
"get_output_file",
"(",
"args",
")",
":",
"grabnext",
"=",
"False",
"for",
"arg",
"in",
"args",
":",
"if",
"grabnext",
":",
"return",
"arg",
"if",
"arg",
"==",
"'-o'",
":",
"# Specified as a separate arg",
"grabnext",
"=",
"True",
"elif",
"arg",
"."... | https://github.com/metashell/metashell/blob/f4177e4854ea00c8dbc722cadab26ef413d798ea/3rd/templight/clang/utils/check_cfc/check_cfc.py#L130-L145 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | python | MockMethod.AndReturn | (self, return_value) | return return_value | Set the value to return when this method is called.
Args:
# return_value can be anything. | Set the value to return when this method is called. | [
"Set",
"the",
"value",
"to",
"return",
"when",
"this",
"method",
"is",
"called",
"."
] | def AndReturn(self, return_value):
"""Set the value to return when this method is called.
Args:
# return_value can be anything.
"""
self._return_value = return_value
return return_value | [
"def",
"AndReturn",
"(",
"self",
",",
"return_value",
")",
":",
"self",
".",
"_return_value",
"=",
"return_value",
"return",
"return_value"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L718-L726 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/utils/misc.py | python | dist_is_editable | (dist) | return False | Return True if given Distribution is an editable install. | [] | def dist_is_editable(dist):
# type: (Distribution) -> bool
"""
Return True if given Distribution is an editable install.
"""
for path_item in sys.path:
egg_link = os.path.join(path_item, dist.project_name + '.egg-link')
if os.path.isfile(egg_link):
return True
... | [
"def",
"dist_is_editable",
"(",
"dist",
")",
":",
"# type: (Distribution) -> bool",
"for",
"path_item",
"in",
"sys",
".",
"path",
":",
"egg_link",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path_item",
",",
"dist",
".",
"project_name",
"+",
"'.egg-link'",
")... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/utils/misc.py#L801-L819 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/logging/handlers.py | python | SocketHandler.makeSocket | (self, timeout=1) | return result | A factory method which allows subclasses to define the precise
type of socket they want. | A factory method which allows subclasses to define the precise
type of socket they want. | [
"A",
"factory",
"method",
"which",
"allows",
"subclasses",
"to",
"define",
"the",
"precise",
"type",
"of",
"socket",
"they",
"want",
"."
] | def makeSocket(self, timeout=1):
"""
A factory method which allows subclasses to define the precise
type of socket they want.
"""
if self.port is not None:
result = socket.create_connection(self.address, timeout=timeout)
else:
result = socket.socke... | [
"def",
"makeSocket",
"(",
"self",
",",
"timeout",
"=",
"1",
")",
":",
"if",
"self",
".",
"port",
"is",
"not",
"None",
":",
"result",
"=",
"socket",
".",
"create_connection",
"(",
"self",
".",
"address",
",",
"timeout",
"=",
"timeout",
")",
"else",
":... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/logging/handlers.py#L558-L573 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/histograms.py | python | histogram_bin_edges | (a, bins=10, range=None, weights=None) | return bin_edges | r"""
Function to calculate only the edges of the bins used by the `histogram`
function.
Parameters
----------
a : array_like
Input data. The histogram is computed over the flattened array.
bins : int or sequence of scalars or str, optional
If `bins` is an int, it defines the num... | r"""
Function to calculate only the edges of the bins used by the `histogram`
function. | [
"r",
"Function",
"to",
"calculate",
"only",
"the",
"edges",
"of",
"the",
"bins",
"used",
"by",
"the",
"histogram",
"function",
"."
] | def histogram_bin_edges(a, bins=10, range=None, weights=None):
r"""
Function to calculate only the edges of the bins used by the `histogram`
function.
Parameters
----------
a : array_like
Input data. The histogram is computed over the flattened array.
bins : int or sequence of scala... | [
"def",
"histogram_bin_edges",
"(",
"a",
",",
"bins",
"=",
"10",
",",
"range",
"=",
"None",
",",
"weights",
"=",
"None",
")",
":",
"a",
",",
"weights",
"=",
"_ravel_and_check_weights",
"(",
"a",
",",
"weights",
")",
"bin_edges",
",",
"_",
"=",
"_get_bin... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/histograms.py#L474-L672 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/signal/_peak_finding.py | python | _boolrelextrema | (data, comparator, axis=0, order=1, mode='clip') | return results | Calculate the relative extrema of `data`.
Relative extrema are calculated by finding locations where
``comparator(data[n], data[n+1:n+order+1])`` is True.
Parameters
----------
data : ndarray
Array in which to find the relative extrema.
comparator : callable
Function to use to ... | Calculate the relative extrema of `data`. | [
"Calculate",
"the",
"relative",
"extrema",
"of",
"data",
"."
] | def _boolrelextrema(data, comparator, axis=0, order=1, mode='clip'):
"""
Calculate the relative extrema of `data`.
Relative extrema are calculated by finding locations where
``comparator(data[n], data[n+1:n+order+1])`` is True.
Parameters
----------
data : ndarray
Array in which to... | [
"def",
"_boolrelextrema",
"(",
"data",
",",
"comparator",
",",
"axis",
"=",
"0",
",",
"order",
"=",
"1",
",",
"mode",
"=",
"'clip'",
")",
":",
"if",
"(",
"(",
"int",
"(",
"order",
")",
"!=",
"order",
")",
"or",
"(",
"order",
"<",
"1",
")",
")",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/signal/_peak_finding.py#L16-L72 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/codecs.py | python | iterencode | (iterator, encoding, errors='strict', **kwargs) | Encoding iterator.
Encodes the input strings from the iterator using a IncrementalEncoder.
errors and kwargs are passed through to the IncrementalEncoder
constructor. | Encoding iterator. | [
"Encoding",
"iterator",
"."
] | def iterencode(iterator, encoding, errors='strict', **kwargs):
"""
Encoding iterator.
Encodes the input strings from the iterator using a IncrementalEncoder.
errors and kwargs are passed through to the IncrementalEncoder
constructor.
"""
encoder = getincrementalencoder(encoding)(errors, **... | [
"def",
"iterencode",
"(",
"iterator",
",",
"encoding",
",",
"errors",
"=",
"'strict'",
",",
"*",
"*",
"kwargs",
")",
":",
"encoder",
"=",
"getincrementalencoder",
"(",
"encoding",
")",
"(",
"errors",
",",
"*",
"*",
"kwargs",
")",
"for",
"input",
"in",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/codecs.py#L996-L1012 | ||
bilibili/libyuv | 2e9f3e5cf5f3c71a4a34893ceb20c5d69689390f | tools/valgrind-libyuv/tsan/PRESUBMIT.py | python | CheckChange | (input_api, output_api) | return suppressions.PresubmitCheck(input_api, output_api) | Checks the TSan suppressions files for bad suppressions. | Checks the TSan suppressions files for bad suppressions. | [
"Checks",
"the",
"TSan",
"suppressions",
"files",
"for",
"bad",
"suppressions",
"."
] | def CheckChange(input_api, output_api):
"""Checks the TSan suppressions files for bad suppressions."""
# Add the path to the Chrome valgrind dir to the import path:
tools_vg_path = os.path.join(input_api.PresubmitLocalPath(), '..', '..',
'valgrind')
sys.path.append(tools_vg_path)... | [
"def",
"CheckChange",
"(",
"input_api",
",",
"output_api",
")",
":",
"# Add the path to the Chrome valgrind dir to the import path:",
"tools_vg_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"input_api",
".",
"PresubmitLocalPath",
"(",
")",
",",
"'..'",
",",
"'..'... | https://github.com/bilibili/libyuv/blob/2e9f3e5cf5f3c71a4a34893ceb20c5d69689390f/tools/valgrind-libyuv/tsan/PRESUBMIT.py#L21-L30 | |
1989Ryan/Semantic_SLAM | 0284b3f832ca431c494f9c134fe46c40ec86ee38 | Third_Part/PSPNet_Keras_tensorflow/caffe-tensorflow/examples/imagenet/validate.py | python | validate | (net, model_path, image_producer, top_k=5) | Compute the top_k classification accuracy for the given network and images. | Compute the top_k classification accuracy for the given network and images. | [
"Compute",
"the",
"top_k",
"classification",
"accuracy",
"for",
"the",
"given",
"network",
"and",
"images",
"."
] | def validate(net, model_path, image_producer, top_k=5):
'''Compute the top_k classification accuracy for the given network and images.'''
# Get the data specifications for given network
spec = models.get_data_spec(model_instance=net)
# Get the input node for feeding in the images
input_node = net.in... | [
"def",
"validate",
"(",
"net",
",",
"model_path",
",",
"image_producer",
",",
"top_k",
"=",
"5",
")",
":",
"# Get the data specifications for given network",
"spec",
"=",
"models",
".",
"get_data_spec",
"(",
"model_instance",
"=",
"net",
")",
"# Get the input node f... | https://github.com/1989Ryan/Semantic_SLAM/blob/0284b3f832ca431c494f9c134fe46c40ec86ee38/Third_Part/PSPNet_Keras_tensorflow/caffe-tensorflow/examples/imagenet/validate.py#L37-L73 | ||
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Variables/PathVariable.py | python | _PathVariableClass.PathIsFile | (self, key, val, env) | Validator to check if Path is a file | Validator to check if Path is a file | [
"Validator",
"to",
"check",
"if",
"Path",
"is",
"a",
"file"
] | def PathIsFile(self, key, val, env):
"""Validator to check if Path is a file"""
if not os.path.isfile(val):
if os.path.isdir(val):
m = 'File path for option %s is a directory: %s'
else:
m = 'File path for option %s does not exist: %s'
r... | [
"def",
"PathIsFile",
"(",
"self",
",",
"key",
",",
"val",
",",
"env",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"val",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"val",
")",
":",
"m",
"=",
"'File path for option %s ... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Variables/PathVariable.py#L104-L111 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py | python | Writer.AddToolFile | (self, path) | Adds a tool file to the project.
Args:
path: Relative path from project to tool file. | Adds a tool file to the project. | [
"Adds",
"a",
"tool",
"file",
"to",
"the",
"project",
"."
] | def AddToolFile(self, path):
"""Adds a tool file to the project.
Args:
path: Relative path from project to tool file.
"""
self.tool_files_section.append(["ToolFile", {"RelativePath": path}]) | [
"def",
"AddToolFile",
"(",
"self",
",",
"path",
")",
":",
"self",
".",
"tool_files_section",
".",
"append",
"(",
"[",
"\"ToolFile\"",
",",
"{",
"\"RelativePath\"",
":",
"path",
"}",
"]",
")"
] | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py#L84-L90 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/history.py | python | History.__init__ | (self, text) | Initialize data attributes and bind event methods.
.text - Idle wrapper of tk Text widget, with .bell().
.history - source statements, possibly with multiple lines.
.prefix - source already entered at prompt; filters history list.
.pointer - index into history.
.cyclic - wrap ar... | Initialize data attributes and bind event methods. | [
"Initialize",
"data",
"attributes",
"and",
"bind",
"event",
"methods",
"."
] | def __init__(self, text):
'''Initialize data attributes and bind event methods.
.text - Idle wrapper of tk Text widget, with .bell().
.history - source statements, possibly with multiple lines.
.prefix - source already entered at prompt; filters history list.
.pointer - index in... | [
"def",
"__init__",
"(",
"self",
",",
"text",
")",
":",
"self",
".",
"text",
"=",
"text",
"self",
".",
"history",
"=",
"[",
"]",
"self",
".",
"prefix",
"=",
"None",
"self",
".",
"pointer",
"=",
"None",
"self",
".",
"cyclic",
"=",
"idleConf",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/history.py#L14-L29 | ||
PrincetonUniversity/athena-public-version | 9c266692b9423743d8e23509b3ab266a232a92d2 | tst/style/cpplint.py | python | CheckForNonStandardConstructs | (filename, clean_lines, linenum,
nesting_state, error) | r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
Complain about several constructs which gcc-2 accepts, but which are
not standard C++. Warning about these in lint is one way to ease the
transition to new compilers.
- put storage class first (e.g. "static const" instead of "co... | r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2. | [
"r",
"Logs",
"an",
"error",
"if",
"we",
"see",
"certain",
"non",
"-",
"ANSI",
"constructs",
"ignored",
"by",
"gcc",
"-",
"2",
"."
] | def CheckForNonStandardConstructs(filename, clean_lines, linenum,
nesting_state, error):
r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
Complain about several constructs which gcc-2 accepts, but which are
not standard C++. Warning about these in... | [
"def",
"CheckForNonStandardConstructs",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"# Remove comments from the line, but leave in strings for now.",
"line",
"=",
"clean_lines",
".",
"lines",
"[",
"linenum",
"]",
"i... | https://github.com/PrincetonUniversity/athena-public-version/blob/9c266692b9423743d8e23509b3ab266a232a92d2/tst/style/cpplint.py#L3026-L3187 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | Gauge.SetValue | (*args, **kwargs) | return _controls_.Gauge_SetValue(*args, **kwargs) | SetValue(self, int pos) | SetValue(self, int pos) | [
"SetValue",
"(",
"self",
"int",
"pos",
")"
] | def SetValue(*args, **kwargs):
"""SetValue(self, int pos)"""
return _controls_.Gauge_SetValue(*args, **kwargs) | [
"def",
"SetValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"Gauge_SetValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L755-L757 | |
wyrover/book-code | 7f4883d9030d553bc6bcfa3da685e34789839900 | 3rdparty/protobuf/python/google/protobuf/internal/decoder.py | python | _ModifiedDecoder | (wire_type, decode_value, modify_value) | return _SimpleDecoder(wire_type, InnerDecode) | Like SimpleDecoder but additionally invokes modify_value on every value
before storing it. Usually modify_value is ZigZagDecode. | Like SimpleDecoder but additionally invokes modify_value on every value
before storing it. Usually modify_value is ZigZagDecode. | [
"Like",
"SimpleDecoder",
"but",
"additionally",
"invokes",
"modify_value",
"on",
"every",
"value",
"before",
"storing",
"it",
".",
"Usually",
"modify_value",
"is",
"ZigZagDecode",
"."
] | def _ModifiedDecoder(wire_type, decode_value, modify_value):
"""Like SimpleDecoder but additionally invokes modify_value on every value
before storing it. Usually modify_value is ZigZagDecode.
"""
# Reusing _SimpleDecoder is slightly slower than copying a bunch of code, but
# not enough to make a significan... | [
"def",
"_ModifiedDecoder",
"(",
"wire_type",
",",
"decode_value",
",",
"modify_value",
")",
":",
"# Reusing _SimpleDecoder is slightly slower than copying a bunch of code, but",
"# not enough to make a significant difference.",
"def",
"InnerDecode",
"(",
"buffer",
",",
"pos",
")"... | https://github.com/wyrover/book-code/blob/7f4883d9030d553bc6bcfa3da685e34789839900/3rdparty/protobuf/python/google/protobuf/internal/decoder.py#L249-L260 | |
Komnomnomnom/swigibpy | cfd307fdbfaffabc69a2dc037538d7e34a8b8daf | swigibpy.py | python | OrderComboLegList.__getslice__ | (self, i, j) | return _swigibpy.OrderComboLegList___getslice__(self, i, j) | __getslice__(OrderComboLegList self, std::vector< shared_ptr< OrderComboLeg > >::difference_type i, std::vector< shared_ptr< OrderComboLeg > >::difference_type j) -> OrderComboLegList | __getslice__(OrderComboLegList self, std::vector< shared_ptr< OrderComboLeg > >::difference_type i, std::vector< shared_ptr< OrderComboLeg > >::difference_type j) -> OrderComboLegList | [
"__getslice__",
"(",
"OrderComboLegList",
"self",
"std",
"::",
"vector<",
"shared_ptr<",
"OrderComboLeg",
">",
">",
"::",
"difference_type",
"i",
"std",
"::",
"vector<",
"shared_ptr<",
"OrderComboLeg",
">",
">",
"::",
"difference_type",
"j",
")",
"-",
">",
"Orde... | def __getslice__(self, i, j):
"""__getslice__(OrderComboLegList self, std::vector< shared_ptr< OrderComboLeg > >::difference_type i, std::vector< shared_ptr< OrderComboLeg > >::difference_type j) -> OrderComboLegList"""
return _swigibpy.OrderComboLegList___getslice__(self, i, j) | [
"def",
"__getslice__",
"(",
"self",
",",
"i",
",",
"j",
")",
":",
"return",
"_swigibpy",
".",
"OrderComboLegList___getslice__",
"(",
"self",
",",
"i",
",",
"j",
")"
] | https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L495-L497 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/tools/compatibility/ast_edits.py | python | _PastaEditVisitor._get_applicable_dict | (self, transformer_field, full_name, name) | return transformers | Get all dict entries indexed by name that apply to full_name or name. | Get all dict entries indexed by name that apply to full_name or name. | [
"Get",
"all",
"dict",
"entries",
"indexed",
"by",
"name",
"that",
"apply",
"to",
"full_name",
"or",
"name",
"."
] | def _get_applicable_dict(self, transformer_field, full_name, name):
"""Get all dict entries indexed by name that apply to full_name or name."""
# Transformers are indexed to full name, name, or no name
# as a performance optimization.
function_transformers = getattr(self._api_change_spec,
... | [
"def",
"_get_applicable_dict",
"(",
"self",
",",
"transformer_field",
",",
"full_name",
",",
"name",
")",
":",
"# Transformers are indexed to full name, name, or no name",
"# as a performance optimization.",
"function_transformers",
"=",
"getattr",
"(",
"self",
".",
"_api_cha... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/tools/compatibility/ast_edits.py#L314-L325 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | ArtProvider.GetBitmap | (*args, **kwargs) | return _misc_.ArtProvider_GetBitmap(*args, **kwargs) | GetBitmap(String id, String client=ART_OTHER, Size size=DefaultSize) -> Bitmap
Query the providers for bitmap with given ID and return it. Return
wx.NullBitmap if no provider provides it. | GetBitmap(String id, String client=ART_OTHER, Size size=DefaultSize) -> Bitmap | [
"GetBitmap",
"(",
"String",
"id",
"String",
"client",
"=",
"ART_OTHER",
"Size",
"size",
"=",
"DefaultSize",
")",
"-",
">",
"Bitmap"
] | def GetBitmap(*args, **kwargs):
"""
GetBitmap(String id, String client=ART_OTHER, Size size=DefaultSize) -> Bitmap
Query the providers for bitmap with given ID and return it. Return
wx.NullBitmap if no provider provides it.
"""
return _misc_.ArtProvider_GetBitmap(*args, ... | [
"def",
"GetBitmap",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"ArtProvider_GetBitmap",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L2819-L2826 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/reduction_workflow/instruments/sans/hfir_command_interface.py | python | SaveIqAscii | (reducer=None, process='') | Old command for backward compatibility | Old command for backward compatibility | [
"Old",
"command",
"for",
"backward",
"compatibility"
] | def SaveIqAscii(reducer=None, process=''):
""" Old command for backward compatibility """
msg = "SaveIqAscii is not longer used:\n "
msg += "Please use 'SaveIq' instead\n "
Logger("CommandInterface").warning(msg)
ReductionSingleton().reduction_properties["ProcessInfo"] = str(process) | [
"def",
"SaveIqAscii",
"(",
"reducer",
"=",
"None",
",",
"process",
"=",
"''",
")",
":",
"msg",
"=",
"\"SaveIqAscii is not longer used:\\n \"",
"msg",
"+=",
"\"Please use 'SaveIq' instead\\n \"",
"Logger",
"(",
"\"CommandInterface\"",
")",
".",
"warning",
"(",
"msg... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/reduction_workflow/instruments/sans/hfir_command_interface.py#L490-L495 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/__init__.py | python | PackageFinder._find_packages_iter | (cls, where, exclude, include) | All the packages found in 'where' that pass the 'include' filter, but
not the 'exclude' filter. | All the packages found in 'where' that pass the 'include' filter, but
not the 'exclude' filter. | [
"All",
"the",
"packages",
"found",
"in",
"where",
"that",
"pass",
"the",
"include",
"filter",
"but",
"not",
"the",
"exclude",
"filter",
"."
] | def _find_packages_iter(cls, where, exclude, include):
"""
All the packages found in 'where' that pass the 'include' filter, but
not the 'exclude' filter.
"""
for root, dirs, files in os.walk(where, followlinks=True):
# Copy dirs to iterate over it, then empty dirs.
... | [
"def",
"_find_packages_iter",
"(",
"cls",
",",
"where",
",",
"exclude",
",",
"include",
")",
":",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"where",
",",
"followlinks",
"=",
"True",
")",
":",
"# Copy dirs to iterate over it, t... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/__init__.py#L75-L100 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/datetime.py | python | time.replace | (self, hour=None, minute=None, second=None, microsecond=None,
tzinfo=True, *, fold=None) | return type(self)(hour, minute, second, microsecond, tzinfo, fold=fold) | Return a new time with new values for the specified fields. | Return a new time with new values for the specified fields. | [
"Return",
"a",
"new",
"time",
"with",
"new",
"values",
"for",
"the",
"specified",
"fields",
"."
] | def replace(self, hour=None, minute=None, second=None, microsecond=None,
tzinfo=True, *, fold=None):
"""Return a new time with new values for the specified fields."""
if hour is None:
hour = self.hour
if minute is None:
minute = self.minute
if seco... | [
"def",
"replace",
"(",
"self",
",",
"hour",
"=",
"None",
",",
"minute",
"=",
"None",
",",
"second",
"=",
"None",
",",
"microsecond",
"=",
"None",
",",
"tzinfo",
"=",
"True",
",",
"*",
",",
"fold",
"=",
"None",
")",
":",
"if",
"hour",
"is",
"None"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/datetime.py#L1452-L1467 | |
Slicer/SlicerGitSVNArchive | 65e92bb16c2b32ea47a1a66bee71f238891ee1ca | Modules/Scripted/SegmentEditor/SegmentEditor.py | python | SegmentEditorTest.test_SegmentEditor1 | (self) | Add test here later. | Add test here later. | [
"Add",
"test",
"here",
"later",
"."
] | def test_SegmentEditor1(self):
"""Add test here later.
"""
self.delayDisplay("Starting the test")
self.delayDisplay('Test passed!') | [
"def",
"test_SegmentEditor1",
"(",
"self",
")",
":",
"self",
".",
"delayDisplay",
"(",
"\"Starting the test\"",
")",
"self",
".",
"delayDisplay",
"(",
"'Test passed!'",
")"
] | https://github.com/Slicer/SlicerGitSVNArchive/blob/65e92bb16c2b32ea47a1a66bee71f238891ee1ca/Modules/Scripted/SegmentEditor/SegmentEditor.py#L183-L187 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/lib/utils.py | python | _lookfor_generate_cache | (module, import_modules, regenerate) | return cache | Generate docstring cache for given module.
Parameters
----------
module : str, None, module
Module for which to generate docstring cache
import_modules : bool
Whether to import sub-modules in packages.
regenerate : bool
Re-generate the docstring cache
Returns
------... | Generate docstring cache for given module. | [
"Generate",
"docstring",
"cache",
"for",
"given",
"module",
"."
] | def _lookfor_generate_cache(module, import_modules, regenerate):
"""
Generate docstring cache for given module.
Parameters
----------
module : str, None, module
Module for which to generate docstring cache
import_modules : bool
Whether to import sub-modules in packages.
rege... | [
"def",
"_lookfor_generate_cache",
"(",
"module",
",",
"import_modules",
",",
"regenerate",
")",
":",
"# Local import to speed up numpy's import time.",
"import",
"inspect",
"from",
"io",
"import",
"StringIO",
"if",
"module",
"is",
"None",
":",
"module",
"=",
"\"numpy\... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/lib/utils.py#L814-L947 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/core/fromnumeric.py | python | trace | (a, offset=0, axis1=0, axis2=1, dtype=None, out=None) | Return the sum along diagonals of the array.
If `a` is 2-D, the sum along its diagonal with the given offset
is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i.
If `a` has more than two dimensions, then the axes specified by axis1 and
axis2 are used to determine the 2-D sub-arrays whos... | Return the sum along diagonals of the array. | [
"Return",
"the",
"sum",
"along",
"diagonals",
"of",
"the",
"array",
"."
] | def trace(a, offset=0, axis1=0, axis2=1, dtype=None, out=None):
"""
Return the sum along diagonals of the array.
If `a` is 2-D, the sum along its diagonal with the given offset
is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i.
If `a` has more than two dimensions, then the axes sp... | [
"def",
"trace",
"(",
"a",
",",
"offset",
"=",
"0",
",",
"axis1",
"=",
"0",
",",
"axis2",
"=",
"1",
",",
"dtype",
"=",
"None",
",",
"out",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"a",
",",
"np",
".",
"matrix",
")",
":",
"# Get trace of m... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/core/fromnumeric.py#L1626-L1686 | ||
lballabio/quantlib-old | 136336947ed4fea9ecc1da6edad188700e821739 | gensrc/gensrc/configuration/configuration.py | python | Configuration.prefix | (self) | return self.prefix_ | Return text to be prefixed to addin function names. | Return text to be prefixed to addin function names. | [
"Return",
"text",
"to",
"be",
"prefixed",
"to",
"addin",
"function",
"names",
"."
] | def prefix(self):
"""Return text to be prefixed to addin function names."""
return self.prefix_ | [
"def",
"prefix",
"(",
"self",
")",
":",
"return",
"self",
".",
"prefix_"
] | https://github.com/lballabio/quantlib-old/blob/136336947ed4fea9ecc1da6edad188700e821739/gensrc/gensrc/configuration/configuration.py#L55-L57 | |
pgRouting/osm2pgrouting | 8491929fc4037d308f271e84d59bb96da3c28aa2 | tools/cpplint.py | python | CleansedLines.NumLines | (self) | return self.num_lines | Returns the number of lines represented. | Returns the number of lines represented. | [
"Returns",
"the",
"number",
"of",
"lines",
"represented",
"."
] | def NumLines(self):
"""Returns the number of lines represented."""
return self.num_lines | [
"def",
"NumLines",
"(",
"self",
")",
":",
"return",
"self",
".",
"num_lines"
] | https://github.com/pgRouting/osm2pgrouting/blob/8491929fc4037d308f271e84d59bb96da3c28aa2/tools/cpplint.py#L1311-L1313 | |
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/sfm/OpenSfM/opensfm/types.py | python | FisheyeCamera.pixel_bearing | (self, pixel) | return np.array([x / l, y / l, 1.0 / l]) | Unit vector pointing to the pixel viewing direction. | Unit vector pointing to the pixel viewing direction. | [
"Unit",
"vector",
"pointing",
"to",
"the",
"pixel",
"viewing",
"direction",
"."
] | def pixel_bearing(self, pixel):
"""Unit vector pointing to the pixel viewing direction."""
point = np.asarray(pixel).reshape((1, 1, 2))
distortion = np.array([self.k1, self.k2, 0., 0.])
x, y = cv2.fisheye.undistortPoints(point, self.get_K(), distortion).flat
l = np.sqrt(x * x + y... | [
"def",
"pixel_bearing",
"(",
"self",
",",
"pixel",
")",
":",
"point",
"=",
"np",
".",
"asarray",
"(",
"pixel",
")",
".",
"reshape",
"(",
"(",
"1",
",",
"1",
",",
"2",
")",
")",
"distortion",
"=",
"np",
".",
"array",
"(",
"[",
"self",
".",
"k1",... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/sfm/OpenSfM/opensfm/types.py#L479-L485 | |
microsoft/onnxruntime | f92e47e95b13a240e37caf7b36577983544f98fc | onnxruntime/python/onnxruntime_inference_collection.py | python | OrtValue.ortvalue_from_shape_and_type | (shape=None, element_type=None, device_type='cpu', device_id=0) | return OrtValue(C.OrtValue.ortvalue_from_shape_and_type(shape, element_type,
C.OrtDevice(get_ort_device_type(device_type), C.OrtDevice.default_memory(), device_id))) | Factory method to construct an OrtValue (which holds a Tensor) from given shape and element_type
:param shape: List of integers indicating the shape of the OrtValue
:param element_type: The data type of the elements in the OrtValue (numpy type)
:param device_type: e.g. cpu, cuda, cpu by default... | Factory method to construct an OrtValue (which holds a Tensor) from given shape and element_type | [
"Factory",
"method",
"to",
"construct",
"an",
"OrtValue",
"(",
"which",
"holds",
"a",
"Tensor",
")",
"from",
"given",
"shape",
"and",
"element_type"
] | def ortvalue_from_shape_and_type(shape=None, element_type=None, device_type='cpu', device_id=0):
'''
Factory method to construct an OrtValue (which holds a Tensor) from given shape and element_type
:param shape: List of integers indicating the shape of the OrtValue
:param element_type: ... | [
"def",
"ortvalue_from_shape_and_type",
"(",
"shape",
"=",
"None",
",",
"element_type",
"=",
"None",
",",
"device_type",
"=",
"'cpu'",
",",
"device_id",
"=",
"0",
")",
":",
"if",
"shape",
"is",
"None",
"or",
"element_type",
"is",
"None",
":",
"raise",
"Valu... | https://github.com/microsoft/onnxruntime/blob/f92e47e95b13a240e37caf7b36577983544f98fc/onnxruntime/python/onnxruntime_inference_collection.py#L554-L567 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | Joystick.GetPOVCTSPosition | (*args, **kwargs) | return _misc_.Joystick_GetPOVCTSPosition(*args, **kwargs) | GetPOVCTSPosition(self) -> int | GetPOVCTSPosition(self) -> int | [
"GetPOVCTSPosition",
"(",
"self",
")",
"-",
">",
"int"
] | def GetPOVCTSPosition(*args, **kwargs):
"""GetPOVCTSPosition(self) -> int"""
return _misc_.Joystick_GetPOVCTSPosition(*args, **kwargs) | [
"def",
"GetPOVCTSPosition",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Joystick_GetPOVCTSPosition",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L2142-L2144 | |
Yelp/MOE | 5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c | moe/views/pretty_view.py | python | PrettyView.form_response | (self, response_dict) | return self.response_schema.serialize(response_dict) | Return the serialized response object from a dict.
:param response_dict: a dict that can be serialized by self.response_schema
:type response_dict: dict
:returns: a serialized self.response_schema object | Return the serialized response object from a dict. | [
"Return",
"the",
"serialized",
"response",
"object",
"from",
"a",
"dict",
"."
] | def form_response(self, response_dict):
"""Return the serialized response object from a dict.
:param response_dict: a dict that can be serialized by self.response_schema
:type response_dict: dict
:returns: a serialized self.response_schema object
"""
self._create_moe_log... | [
"def",
"form_response",
"(",
"self",
",",
"response_dict",
")",
":",
"self",
".",
"_create_moe_log_line",
"(",
"type",
"=",
"'response'",
",",
"content",
"=",
"response_dict",
",",
")",
"return",
"self",
".",
"response_schema",
".",
"serialize",
"(",
"response... | https://github.com/Yelp/MOE/blob/5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c/moe/views/pretty_view.py#L74-L85 | |
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/agents/tools/mock_algorithm.py | python | MockAlgorithm.__init__ | (self, envs) | Produce random actions and empty summaries.
Args:
envs: List of in-graph environments. | Produce random actions and empty summaries. | [
"Produce",
"random",
"actions",
"and",
"empty",
"summaries",
"."
] | def __init__(self, envs):
"""Produce random actions and empty summaries.
Args:
envs: List of in-graph environments.
"""
self._envs = envs | [
"def",
"__init__",
"(",
"self",
",",
"envs",
")",
":",
"self",
".",
"_envs",
"=",
"envs"
] | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/agents/tools/mock_algorithm.py#L28-L34 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/framework/function.py | python | _DefinedFunction._create_definition_if_needed | (self) | Creates the function definition if it's not created yet. | Creates the function definition if it's not created yet. | [
"Creates",
"the",
"function",
"definition",
"if",
"it",
"s",
"not",
"created",
"yet",
"."
] | def _create_definition_if_needed(self):
"""Creates the function definition if it's not created yet."""
if self._definition is not None:
return
# Create the func_def object.
temp_graph = _FuncGraph()
with temp_graph.as_default():
# List of placeholders for the function_def.
inputs... | [
"def",
"_create_definition_if_needed",
"(",
"self",
")",
":",
"if",
"self",
".",
"_definition",
"is",
"not",
"None",
":",
"return",
"# Create the func_def object.",
"temp_graph",
"=",
"_FuncGraph",
"(",
")",
"with",
"temp_graph",
".",
"as_default",
"(",
")",
":"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/framework/function.py#L343-L399 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/frame.py | python | DataFrame.diff | (self, periods=1, axis=0) | return self._constructor(new_data) | First discrete difference of element.
Calculates the difference of a DataFrame element compared with another
element in the DataFrame (default is the element in the same column
of the previous row).
Parameters
----------
periods : int, default 1
Periods to s... | First discrete difference of element. | [
"First",
"discrete",
"difference",
"of",
"element",
"."
] | def diff(self, periods=1, axis=0) -> "DataFrame":
"""
First discrete difference of element.
Calculates the difference of a DataFrame element compared with another
element in the DataFrame (default is the element in the same column
of the previous row).
Parameters
... | [
"def",
"diff",
"(",
"self",
",",
"periods",
"=",
"1",
",",
"axis",
"=",
"0",
")",
"->",
"\"DataFrame\"",
":",
"bm_axis",
"=",
"self",
".",
"_get_block_manager_axis",
"(",
"axis",
")",
"new_data",
"=",
"self",
".",
"_data",
".",
"diff",
"(",
"n",
"=",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/frame.py#L6512-L6604 | |
RGF-team/rgf | 272afb85b4c91571f576e5fc83ecfacce3672eb4 | python-package/rgf/utils.py | python | RGFClassifierMixin.predict_proba | (self, X) | return y | Predict class probabilities for X.
The predicted class probabilities of an input sample are computed.
Parameters
----------
X : array-like or sparse matrix of shape = [n_samples, n_features]
The input samples.
Returns
-------
p : array of shape = [n... | Predict class probabilities for X. | [
"Predict",
"class",
"probabilities",
"for",
"X",
"."
] | def predict_proba(self, X):
"""
Predict class probabilities for X.
The predicted class probabilities of an input sample are computed.
Parameters
----------
X : array-like or sparse matrix of shape = [n_samples, n_features]
The input samples.
Returns... | [
"def",
"predict_proba",
"(",
"self",
",",
"X",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_fitted'",
")",
"or",
"not",
"self",
".",
"_fitted",
":",
"raise",
"NotFittedError",
"(",
"NOT_FITTED_ERROR_DESC",
")",
"X",
"=",
"check_array",
"(",
"X"... | https://github.com/RGF-team/rgf/blob/272afb85b4c91571f576e5fc83ecfacce3672eb4/python-package/rgf/utils.py#L589-L628 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/VBox/Devices/EFI/Firmware/AppPkg/Applications/Python/PyMod-2.7.2/Lib/pydoc.py | python | HTMLDoc.docother | (self, object, name=None, mod=None, *ignored) | return lhs + self.repr(object) | Produce HTML documentation for a data object. | Produce HTML documentation for a data object. | [
"Produce",
"HTML",
"documentation",
"for",
"a",
"data",
"object",
"."
] | def docother(self, object, name=None, mod=None, *ignored):
"""Produce HTML documentation for a data object."""
lhs = name and '<strong>%s</strong> = ' % name or ''
return lhs + self.repr(object) | [
"def",
"docother",
"(",
"self",
",",
"object",
",",
"name",
"=",
"None",
",",
"mod",
"=",
"None",
",",
"*",
"ignored",
")",
":",
"lhs",
"=",
"name",
"and",
"'<strong>%s</strong> = '",
"%",
"name",
"or",
"''",
"return",
"lhs",
"+",
"self",
".",
"repr"... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/VBox/Devices/EFI/Firmware/AppPkg/Applications/Python/PyMod-2.7.2/Lib/pydoc.py#L922-L925 | |
linyouhappy/kongkongxiyou | 7a69b2913eb29f4be77f9a62fb90cdd72c4160f1 | cocosjs/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py | python | Type.element_type | (self) | return result | Retrieve the Type of elements within this Type.
If accessed on a type that is not an array, complex, or vector type, an
exception will be raised. | Retrieve the Type of elements within this Type. | [
"Retrieve",
"the",
"Type",
"of",
"elements",
"within",
"this",
"Type",
"."
] | def element_type(self):
"""Retrieve the Type of elements within this Type.
If accessed on a type that is not an array, complex, or vector type, an
exception will be raised.
"""
result = conf.lib.clang_getElementType(self)
if result.kind == TypeKind.INVALID:
r... | [
"def",
"element_type",
"(",
"self",
")",
":",
"result",
"=",
"conf",
".",
"lib",
".",
"clang_getElementType",
"(",
"self",
")",
"if",
"result",
".",
"kind",
"==",
"TypeKind",
".",
"INVALID",
":",
"raise",
"Exception",
"(",
"'Element type not available on this ... | https://github.com/linyouhappy/kongkongxiyou/blob/7a69b2913eb29f4be77f9a62fb90cdd72c4160f1/cocosjs/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py#L1680-L1690 | |
AngoraFuzzer/Angora | 80e81c8590077bc0ac069dbd367da8ce405ff618 | llvm_mode/dfsan_rt/sanitizer_common/scripts/cpplint.py | python | FindNextMultiLineCommentStart | (lines, lineix) | return len(lines) | Find the beginning marker for a multiline comment. | Find the beginning marker for a multiline comment. | [
"Find",
"the",
"beginning",
"marker",
"for",
"a",
"multiline",
"comment",
"."
] | def FindNextMultiLineCommentStart(lines, lineix):
"""Find the beginning marker for a multiline comment."""
while lineix < len(lines):
if lines[lineix].strip().startswith('/*'):
# Only return this marker if the comment goes beyond this line
if lines[lineix].strip().find('*/', 2) < 0:
return l... | [
"def",
"FindNextMultiLineCommentStart",
"(",
"lines",
",",
"lineix",
")",
":",
"while",
"lineix",
"<",
"len",
"(",
"lines",
")",
":",
"if",
"lines",
"[",
"lineix",
"]",
".",
"strip",
"(",
")",
".",
"startswith",
"(",
"'/*'",
")",
":",
"# Only return this... | https://github.com/AngoraFuzzer/Angora/blob/80e81c8590077bc0ac069dbd367da8ce405ff618/llvm_mode/dfsan_rt/sanitizer_common/scripts/cpplint.py#L926-L934 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py | python | Misc.winfo_viewable | (self) | return self.tk.getint(
self.tk.call('winfo', 'viewable', self._w)) | Return true if the widget and all its higher ancestors are mapped. | Return true if the widget and all its higher ancestors are mapped. | [
"Return",
"true",
"if",
"the",
"widget",
"and",
"all",
"its",
"higher",
"ancestors",
"are",
"mapped",
"."
] | def winfo_viewable(self):
"""Return true if the widget and all its higher ancestors are mapped."""
return self.tk.getint(
self.tk.call('winfo', 'viewable', self._w)) | [
"def",
"winfo_viewable",
"(",
"self",
")",
":",
"return",
"self",
".",
"tk",
".",
"getint",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"'winfo'",
",",
"'viewable'",
",",
"self",
".",
"_w",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py#L1111-L1114 | |
Harick1/caffe-yolo | eea92bf3ddfe4d0ff6b0b3ba9b15c029a83ed9a3 | python/caffe/io.py | python | Transformer.set_mean | (self, in_, mean) | Set the mean to subtract for centering the data.
Parameters
----------
in_ : which input to assign this mean.
mean : mean ndarray (input dimensional or broadcastable) | Set the mean to subtract for centering the data. | [
"Set",
"the",
"mean",
"to",
"subtract",
"for",
"centering",
"the",
"data",
"."
] | def set_mean(self, in_, mean):
"""
Set the mean to subtract for centering the data.
Parameters
----------
in_ : which input to assign this mean.
mean : mean ndarray (input dimensional or broadcastable)
"""
self.__check_input(in_)
ms = mean.shape
... | [
"def",
"set_mean",
"(",
"self",
",",
"in_",
",",
"mean",
")",
":",
"self",
".",
"__check_input",
"(",
"in_",
")",
"ms",
"=",
"mean",
".",
"shape",
"if",
"mean",
".",
"ndim",
"==",
"1",
":",
"# broadcast channels",
"if",
"ms",
"[",
"0",
"]",
"!=",
... | https://github.com/Harick1/caffe-yolo/blob/eea92bf3ddfe4d0ff6b0b3ba9b15c029a83ed9a3/python/caffe/io.py#L236-L260 | ||
raymondlu/super-animation-samples | 04234269112ff0dc32447f27a761dbbb00b8ba17 | samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py | python | CursorKind.is_invalid | (self) | return conf.lib.clang_isInvalid(self) | Test if this is an invalid kind. | Test if this is an invalid kind. | [
"Test",
"if",
"this",
"is",
"an",
"invalid",
"kind",
"."
] | def is_invalid(self):
"""Test if this is an invalid kind."""
return conf.lib.clang_isInvalid(self) | [
"def",
"is_invalid",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_isInvalid",
"(",
"self",
")"
] | https://github.com/raymondlu/super-animation-samples/blob/04234269112ff0dc32447f27a761dbbb00b8ba17/samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py#L652-L654 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Hash/SHA224.py | python | SHA224Hash.new | (self, data=None) | return SHA224Hash(data) | Create a fresh SHA-224 hash object. | Create a fresh SHA-224 hash object. | [
"Create",
"a",
"fresh",
"SHA",
"-",
"224",
"hash",
"object",
"."
] | def new(self, data=None):
"""Create a fresh SHA-224 hash object."""
return SHA224Hash(data) | [
"def",
"new",
"(",
"self",
",",
"data",
"=",
"None",
")",
":",
"return",
"SHA224Hash",
"(",
"data",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Hash/SHA224.py#L143-L146 | |
google/usd_from_gltf | 6d288cce8b68744494a226574ae1d7ba6a9c46eb | tools/ufginstall/ufginstall.py | python | JpgDep.install | (self) | Installs libjpeg-turbo dependency. | Installs libjpeg-turbo dependency. | [
"Installs",
"libjpeg",
"-",
"turbo",
"dependency",
"."
] | def install(self):
"""Installs libjpeg-turbo dependency."""
url = 'https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.0.2.zip'
extra_args = ['-DCMAKE_POSITION_INDEPENDENT_CODE=1']
path = os.path.join(cfg.src_dir, 'jpg.zip')
force = self.forced()
dl_dir = download_archive(url, path, force)
... | [
"def",
"install",
"(",
"self",
")",
":",
"url",
"=",
"'https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.0.2.zip'",
"extra_args",
"=",
"[",
"'-DCMAKE_POSITION_INDEPENDENT_CODE=1'",
"]",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cfg",
".",
"src_dir",
... | https://github.com/google/usd_from_gltf/blob/6d288cce8b68744494a226574ae1d7ba6a9c46eb/tools/ufginstall/ufginstall.py#L182-L190 | ||
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | clang/bindings/python/clang/cindex.py | python | Cursor.linkage | (self) | return LinkageKind.from_id(self._linkage) | Return the linkage of this cursor. | Return the linkage of this cursor. | [
"Return",
"the",
"linkage",
"of",
"this",
"cursor",
"."
] | def linkage(self):
"""Return the linkage of this cursor."""
if not hasattr(self, '_linkage'):
self._linkage = conf.lib.clang_getCursorLinkage(self)
return LinkageKind.from_id(self._linkage) | [
"def",
"linkage",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_linkage'",
")",
":",
"self",
".",
"_linkage",
"=",
"conf",
".",
"lib",
".",
"clang_getCursorLinkage",
"(",
"self",
")",
"return",
"LinkageKind",
".",
"from_id",
"(",
... | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/clang/bindings/python/clang/cindex.py#L1585-L1590 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/stc.py | python | StyledTextCtrl.DocLineFromVisible | (*args, **kwargs) | return _stc.StyledTextCtrl_DocLineFromVisible(*args, **kwargs) | DocLineFromVisible(self, int lineDisplay) -> int
Find the document line of a display line taking hidden lines into account. | DocLineFromVisible(self, int lineDisplay) -> int | [
"DocLineFromVisible",
"(",
"self",
"int",
"lineDisplay",
")",
"-",
">",
"int"
] | def DocLineFromVisible(*args, **kwargs):
"""
DocLineFromVisible(self, int lineDisplay) -> int
Find the document line of a display line taking hidden lines into account.
"""
return _stc.StyledTextCtrl_DocLineFromVisible(*args, **kwargs) | [
"def",
"DocLineFromVisible",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_DocLineFromVisible",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/stc.py#L3880-L3886 | |
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/procrouting/response/scf_products.py | python | TDRSCFEngine.reset_for_state_symm | (self, symmetry) | Reset internal quantities so the object is prepared to deal with transition to state with symmetry given | Reset internal quantities so the object is prepared to deal with transition to state with symmetry given | [
"Reset",
"internal",
"quantities",
"so",
"the",
"object",
"is",
"prepared",
"to",
"deal",
"with",
"transition",
"to",
"state",
"with",
"symmetry",
"given"
] | def reset_for_state_symm(self, symmetry):
"""Reset internal quantities so the object is prepared to deal with transition to state with symmetry given
"""
self.G_es = symmetry
self._build_prec()
self.product_cache.reset() | [
"def",
"reset_for_state_symm",
"(",
"self",
",",
"symmetry",
")",
":",
"self",
".",
"G_es",
"=",
"symmetry",
"self",
".",
"_build_prec",
"(",
")",
"self",
".",
"product_cache",
".",
"reset",
"(",
")"
] | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/procrouting/response/scf_products.py#L232-L237 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | qa/tasks/ceph_manager.py | python | OSDThrasher.thrash_pg_upmap_items | (self) | Install or remove random pg_upmap_items entries in OSDMap | Install or remove random pg_upmap_items entries in OSDMap | [
"Install",
"or",
"remove",
"random",
"pg_upmap_items",
"entries",
"in",
"OSDMap"
] | def thrash_pg_upmap_items(self):
"""
Install or remove random pg_upmap_items entries in OSDMap
"""
from random import shuffle
out = self.ceph_manager.raw_cluster_cmd('osd', 'dump', '-f', 'json-pretty')
j = json.loads(out)
self.log('j is %s' % j)
try:
... | [
"def",
"thrash_pg_upmap_items",
"(",
"self",
")",
":",
"from",
"random",
"import",
"shuffle",
"out",
"=",
"self",
".",
"ceph_manager",
".",
"raw_cluster_cmd",
"(",
"'osd'",
",",
"'dump'",
",",
"'-f'",
",",
"'json-pretty'",
")",
"j",
"=",
"json",
".",
"load... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/qa/tasks/ceph_manager.py#L713-L753 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vendor/distlib/locators.py | python | Locator.locate | (self, requirement, prereleases=False) | return result | Find the most recent distribution which matches the given
requirement.
:param requirement: A requirement of the form 'foo (1.0)' or perhaps
'foo (>= 1.0, < 2.0, != 1.3)'
:param prereleases: If ``True``, allow pre-release versions
to be loc... | Find the most recent distribution which matches the given
requirement. | [
"Find",
"the",
"most",
"recent",
"distribution",
"which",
"matches",
"the",
"given",
"requirement",
"."
] | def locate(self, requirement, prereleases=False):
"""
Find the most recent distribution which matches the given
requirement.
:param requirement: A requirement of the form 'foo (1.0)' or perhaps
'foo (>= 1.0, < 2.0, != 1.3)'
:param prereleases: If ``Tr... | [
"def",
"locate",
"(",
"self",
",",
"requirement",
",",
"prereleases",
"=",
"False",
")",
":",
"result",
"=",
"None",
"scheme",
"=",
"get_scheme",
"(",
"self",
".",
"scheme",
")",
"r",
"=",
"parse_requirement",
"(",
"requirement",
")",
"if",
"r",
"is",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vendor/distlib/locators.py#L289-L336 | |
NERSC/timemory | 431912b360ff50d1a160d7826e2eea04fbd1037f | timemory/analyze/analyze.py | python | dump_flamegraph | (data, metric, file=None, echo_dart=False) | Dumps a flamegraph file | Dumps a flamegraph file | [
"Dumps",
"a",
"flamegraph",
"file"
] | def dump_flamegraph(data, metric, file=None, echo_dart=False):
"""Dumps a flamegraph file"""
from timemory.common import (
popen,
get_bin_script,
dart_measurement_file,
)
_files = dump_entity(
data,
lambda x: x.to_flamegraph(_get_metric(x, metric)),
file,... | [
"def",
"dump_flamegraph",
"(",
"data",
",",
"metric",
",",
"file",
"=",
"None",
",",
"echo_dart",
"=",
"False",
")",
":",
"from",
"timemory",
".",
"common",
"import",
"(",
"popen",
",",
"get_bin_script",
",",
"dart_measurement_file",
",",
")",
"_files",
"=... | https://github.com/NERSC/timemory/blob/431912b360ff50d1a160d7826e2eea04fbd1037f/timemory/analyze/analyze.py#L503-L570 | ||
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | bindings/python/cntk/ops/functions.py | python | Function.__str__ | (self) | return f_name + op_name + '(' + ", ".join([format_arg_spec(param) for param in args]) + ') -> ' + output_signature | Describes the Function and its signature as a string.
Example:
>>> f = C.log(C.input(1), name='f') # Function constructed as a graph
>>> print(f)
f: Log(Tensor[1]) -> Tensor[1]
>>> d = C.layers.Dense(10) # Function constructed as a layer
>>> print(d)
Dense(... | Describes the Function and its signature as a string. | [
"Describes",
"the",
"Function",
"and",
"its",
"signature",
"as",
"a",
"string",
"."
] | def __str__(self):
'''
Describes the Function and its signature as a string.
Example:
>>> f = C.log(C.input(1), name='f') # Function constructed as a graph
>>> print(f)
f: Log(Tensor[1]) -> Tensor[1]
>>> d = C.layers.Dense(10) # Function constructed as a laye... | [
"def",
"__str__",
"(",
"self",
")",
":",
"f_name",
"=",
"self",
".",
"name",
"op_name",
"=",
"self",
".",
"op_name",
"if",
"self",
".",
"is_composite",
":",
"if",
"self",
".",
"root_function",
"and",
"all",
"(",
"i",
".",
"uid",
"==",
"ri",
".",
"u... | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/ops/functions.py#L1148-L1191 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/xcode_emulation.py | python | XcodeSettings._GetTargetPostbuilds | (self, configname, output, output_binary,
quiet=False) | return (
self._GetDebugInfoPostbuilds(configname, output, output_binary, quiet) +
self._GetStripPostbuilds(configname, output_binary, quiet)) | Returns a list of shell commands that contain the shell commands
to run as postbuilds for this target, before the actual postbuilds. | Returns a list of shell commands that contain the shell commands
to run as postbuilds for this target, before the actual postbuilds. | [
"Returns",
"a",
"list",
"of",
"shell",
"commands",
"that",
"contain",
"the",
"shell",
"commands",
"to",
"run",
"as",
"postbuilds",
"for",
"this",
"target",
"before",
"the",
"actual",
"postbuilds",
"."
] | def _GetTargetPostbuilds(self, configname, output, output_binary,
quiet=False):
"""Returns a list of shell commands that contain the shell commands
to run as postbuilds for this target, before the actual postbuilds."""
# dSYMs need to build before stripping happens.
return (
... | [
"def",
"_GetTargetPostbuilds",
"(",
"self",
",",
"configname",
",",
"output",
",",
"output_binary",
",",
"quiet",
"=",
"False",
")",
":",
"# dSYMs need to build before stripping happens.",
"return",
"(",
"self",
".",
"_GetDebugInfoPostbuilds",
"(",
"configname",
",",
... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/xcode_emulation.py#L980-L987 | |
hszhao/PSPNet | cf7e5a99ba37e46118026e96be5821a9bc63bde0 | python/caffe/pycaffe.py | python | _Net_forward_backward_all | (self, blobs=None, diffs=None, **kwargs) | return all_outs, all_diffs | Run net forward + backward in batches.
Parameters
----------
blobs: list of blobs to extract as in forward()
diffs: list of diffs to extract as in backward()
kwargs: Keys are input (for forward) and output (for backward) blob names
and values are ndarrays. Refer to forward() and backwar... | Run net forward + backward in batches. | [
"Run",
"net",
"forward",
"+",
"backward",
"in",
"batches",
"."
] | def _Net_forward_backward_all(self, blobs=None, diffs=None, **kwargs):
"""
Run net forward + backward in batches.
Parameters
----------
blobs: list of blobs to extract as in forward()
diffs: list of diffs to extract as in backward()
kwargs: Keys are input (for forward) and output (for backw... | [
"def",
"_Net_forward_backward_all",
"(",
"self",
",",
"blobs",
"=",
"None",
",",
"diffs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Batch blobs and diffs.",
"all_outs",
"=",
"{",
"out",
":",
"[",
"]",
"for",
"out",
"in",
"set",
"(",
"self",
".... | https://github.com/hszhao/PSPNet/blob/cf7e5a99ba37e46118026e96be5821a9bc63bde0/python/caffe/pycaffe.py#L190-L232 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/linter/git_base.py | python | Repository.configure | (self, parameter, value) | return self._callgito("config", ["--local", parameter, value]) | Set a local configuration parameter. | Set a local configuration parameter. | [
"Set",
"a",
"local",
"configuration",
"parameter",
"."
] | def configure(self, parameter, value):
"""Set a local configuration parameter."""
return self._callgito("config", ["--local", parameter, value]) | [
"def",
"configure",
"(",
"self",
",",
"parameter",
",",
"value",
")",
":",
"return",
"self",
".",
"_callgito",
"(",
"\"config\"",
",",
"[",
"\"--local\"",
",",
"parameter",
",",
"value",
"]",
")"
] | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/linter/git_base.py#L100-L102 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/split-a-string-in-balanced-strings.py | python | Solution.balancedStringSplit | (self, s) | return result | :type s: str
:rtype: int | :type s: str
:rtype: int | [
":",
"type",
"s",
":",
"str",
":",
"rtype",
":",
"int"
] | def balancedStringSplit(self, s):
"""
:type s: str
:rtype: int
"""
result, count = 0, 0
for c in s:
count += 1 if c == 'L' else -1
if count == 0:
result += 1
return result | [
"def",
"balancedStringSplit",
"(",
"self",
",",
"s",
")",
":",
"result",
",",
"count",
"=",
"0",
",",
"0",
"for",
"c",
"in",
"s",
":",
"count",
"+=",
"1",
"if",
"c",
"==",
"'L'",
"else",
"-",
"1",
"if",
"count",
"==",
"0",
":",
"result",
"+=",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/split-a-string-in-balanced-strings.py#L5-L15 | |
alibaba/graph-learn | 54cafee9db3054dc310a28b856be7f97c7d5aee9 | graphlearn/python/data/values.py | python | Layers.set_layer_nodes | (self, layer_id, nodes) | Set `Nodes` of the given `Layer`. | Set `Nodes` of the given `Layer`. | [
"Set",
"Nodes",
"of",
"the",
"given",
"Layer",
"."
] | def set_layer_nodes(self, layer_id, nodes):
""" Set `Nodes` of the given `Layer`.
"""
layer_id -= 1
if isinstance(self.layers, list) and layer_id < len(self.layers):
if isinstance(self.layers[layer_id], Layer):
self.layers[layer_id].set_nodes(nodes)
else:
raise ValueError("la... | [
"def",
"set_layer_nodes",
"(",
"self",
",",
"layer_id",
",",
"nodes",
")",
":",
"layer_id",
"-=",
"1",
"if",
"isinstance",
"(",
"self",
".",
"layers",
",",
"list",
")",
"and",
"layer_id",
"<",
"len",
"(",
"self",
".",
"layers",
")",
":",
"if",
"isins... | https://github.com/alibaba/graph-learn/blob/54cafee9db3054dc310a28b856be7f97c7d5aee9/graphlearn/python/data/values.py#L726-L736 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/io.py | python | StringInput.read | (self) | return self.decode(self.source) | Decode and return the source string. | Decode and return the source string. | [
"Decode",
"and",
"return",
"the",
"source",
"string",
"."
] | def read(self):
"""Decode and return the source string."""
return self.decode(self.source) | [
"def",
"read",
"(",
"self",
")",
":",
"return",
"self",
".",
"decode",
"(",
"self",
".",
"source",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/io.py#L433-L435 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/polynomial/polynomial.py | python | polygrid2d | (x, y, c) | return pu._gridnd(polyval, c, x, y) | Evaluate a 2-D polynomial on the Cartesian product of x and y.
This function returns the values:
.. math:: p(a,b) = \\sum_{i,j} c_{i,j} * a^i * b^j
where the points `(a, b)` consist of all pairs formed by taking
`a` from `x` and `b` from `y`. The resulting points form a grid with
`x` in the first... | Evaluate a 2-D polynomial on the Cartesian product of x and y. | [
"Evaluate",
"a",
"2",
"-",
"D",
"polynomial",
"on",
"the",
"Cartesian",
"product",
"of",
"x",
"and",
"y",
"."
] | def polygrid2d(x, y, c):
"""
Evaluate a 2-D polynomial on the Cartesian product of x and y.
This function returns the values:
.. math:: p(a,b) = \\sum_{i,j} c_{i,j} * a^i * b^j
where the points `(a, b)` consist of all pairs formed by taking
`a` from `x` and `b` from `y`. The resulting points ... | [
"def",
"polygrid2d",
"(",
"x",
",",
"y",
",",
"c",
")",
":",
"return",
"pu",
".",
"_gridnd",
"(",
"polyval",
",",
"c",
",",
"x",
",",
"y",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/polynomial/polynomial.py#L898-L948 | |
NASA-SW-VnV/ikos | 71325dfb94737332542caa708d7537752021522d | analyzer/python/ikos/scan.py | python | run | (cmd) | return rc | Run the given command and return the exit code | Run the given command and return the exit code | [
"Run",
"the",
"given",
"command",
"and",
"return",
"the",
"exit",
"code"
] | def run(cmd):
''' Run the given command and return the exit code '''
log.debug('Running %s' % command_string(cmd))
try:
proc = subprocess.Popen(cmd)
rc = proc.wait()
except OSError as e:
printf('error: %s: %s\n', cmd[0], e.strerror, file=sys.stderr)
sys.exit(e.errno)
... | [
"def",
"run",
"(",
"cmd",
")",
":",
"log",
".",
"debug",
"(",
"'Running %s'",
"%",
"command_string",
"(",
"cmd",
")",
")",
"try",
":",
"proc",
"=",
"subprocess",
".",
"Popen",
"(",
"cmd",
")",
"rc",
"=",
"proc",
".",
"wait",
"(",
")",
"except",
"... | https://github.com/NASA-SW-VnV/ikos/blob/71325dfb94737332542caa708d7537752021522d/analyzer/python/ikos/scan.py#L419-L433 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/configobj/configobj.py | python | ConfigObj.reload | (self) | Reload a ConfigObj from file.
This method raises a ``ReloadError`` if the ConfigObj doesn't have
a filename attribute pointing to a file. | Reload a ConfigObj from file.
This method raises a ``ReloadError`` if the ConfigObj doesn't have
a filename attribute pointing to a file. | [
"Reload",
"a",
"ConfigObj",
"from",
"file",
".",
"This",
"method",
"raises",
"a",
"ReloadError",
"if",
"the",
"ConfigObj",
"doesn",
"t",
"have",
"a",
"filename",
"attribute",
"pointing",
"to",
"a",
"file",
"."
] | def reload(self):
"""
Reload a ConfigObj from file.
This method raises a ``ReloadError`` if the ConfigObj doesn't have
a filename attribute pointing to a file.
"""
if not isinstance(self.filename, basestring):
raise ReloadError()
filename = s... | [
"def",
"reload",
"(",
"self",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"filename",
",",
"basestring",
")",
":",
"raise",
"ReloadError",
"(",
")",
"filename",
"=",
"self",
".",
"filename",
"current_options",
"=",
"{",
"}",
"for",
"entry",
... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/configobj/configobj.py#L2334-L2356 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py | python | Decimal.fma | (self, other, third, context=None) | return product.__add__(third, context) | Fused multiply-add.
Returns self*other+third with no rounding of the intermediate
product self*other.
self and other are multiplied together, with no rounding of
the result. The third operand is then added to the result,
and a single final rounding is performed. | Fused multiply-add. | [
"Fused",
"multiply",
"-",
"add",
"."
] | def fma(self, other, third, context=None):
"""Fused multiply-add.
Returns self*other+third with no rounding of the intermediate
product self*other.
self and other are multiplied together, with no rounding of
the result. The third operand is then added to the result,
an... | [
"def",
"fma",
"(",
"self",
",",
"other",
",",
"third",
",",
"context",
"=",
"None",
")",
":",
"other",
"=",
"_convert_other",
"(",
"other",
",",
"raiseit",
"=",
"True",
")",
"# compute product; raise InvalidOperation if either operand is",
"# a signaling NaN or if t... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py#L1809-L1851 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/distribute/distribute_coordinator.py | python | _WorkerContext._is_chief | (self) | return False | Return whether the task is the chief worker. | Return whether the task is the chief worker. | [
"Return",
"whether",
"the",
"task",
"is",
"the",
"chief",
"worker",
"."
] | def _is_chief(self):
"""Return whether the task is the chief worker."""
if (not self._cluster_spec or
self._task_type in [_TaskType.CHIEF, _TaskType.EVALUATOR, None]):
return True
# If not local and chief not in the cluster_spec, use the first worker as
# chief.
if (_TaskType.CHIEF no... | [
"def",
"_is_chief",
"(",
"self",
")",
":",
"if",
"(",
"not",
"self",
".",
"_cluster_spec",
"or",
"self",
".",
"_task_type",
"in",
"[",
"_TaskType",
".",
"CHIEF",
",",
"_TaskType",
".",
"EVALUATOR",
",",
"None",
"]",
")",
":",
"return",
"True",
"# If no... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/distribute/distribute_coordinator.py#L194-L205 | |
facebook/fboss | 60063db1df37c2ec0e7dcd0955c54885ea9bf7f0 | fboss/py/fboss/cli/cli.py | python | RouteCli._ip | (cli_opts, ip, vrf) | Show the route to a specific IP | Show the route to a specific IP | [
"Show",
"the",
"route",
"to",
"a",
"specific",
"IP"
] | def _ip(cli_opts, ip, vrf):
"""Show the route to a specific IP"""
route.RouteIpCmd(cli_opts).run(ip, vrf) | [
"def",
"_ip",
"(",
"cli_opts",
",",
"ip",
",",
"vrf",
")",
":",
"route",
".",
"RouteIpCmd",
"(",
"cli_opts",
")",
".",
"run",
"(",
"ip",
",",
"vrf",
")"
] | https://github.com/facebook/fboss/blob/60063db1df37c2ec0e7dcd0955c54885ea9bf7f0/fboss/py/fboss/cli/cli.py#L561-L563 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/distutils/misc_util.py | python | generate_config_py | (target) | return target | Generate config.py file containing system_info information
used during building the package.
Usage:
config['py_modules'].append((packagename, '__config__',generate_config_py)) | Generate config.py file containing system_info information
used during building the package. | [
"Generate",
"config",
".",
"py",
"file",
"containing",
"system_info",
"information",
"used",
"during",
"building",
"the",
"package",
"."
] | def generate_config_py(target):
"""Generate config.py file containing system_info information
used during building the package.
Usage:
config['py_modules'].append((packagename, '__config__',generate_config_py))
"""
from numpy.distutils.system_info import system_info
from distutils.dir_u... | [
"def",
"generate_config_py",
"(",
"target",
")",
":",
"from",
"numpy",
".",
"distutils",
".",
"system_info",
"import",
"system_info",
"from",
"distutils",
".",
"dir_util",
"import",
"mkpath",
"mkpath",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"target",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/distutils/misc_util.py#L2308-L2359 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/WebOb/webob/dec.py | python | wsgify.__call__ | (self, req, *args, **kw) | Call this as a WSGI application or with a request | Call this as a WSGI application or with a request | [
"Call",
"this",
"as",
"a",
"WSGI",
"application",
"or",
"with",
"a",
"request"
] | def __call__(self, req, *args, **kw):
"""Call this as a WSGI application or with a request"""
func = self.func
if func is None:
if args or kw:
raise TypeError(
"Unbound %s can only be called with the function it "
"will wrap" % ... | [
"def",
"__call__",
"(",
"self",
",",
"req",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"func",
"=",
"self",
".",
"func",
"if",
"func",
"is",
"None",
":",
"if",
"args",
"or",
"kw",
":",
"raise",
"TypeError",
"(",
"\"Unbound %s can only be called... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/WebOb/webob/dec.py#L108-L148 | ||
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/physics/traveltime/plotting.py | python | drawFirstPicks | (ax, data, tt=None, plotva=False, **kwargs) | Plot first arrivals as lines. | Plot first arrivals as lines. | [
"Plot",
"first",
"arrivals",
"as",
"lines",
"."
] | def drawFirstPicks(ax, data, tt=None, plotva=False, **kwargs):
"""Plot first arrivals as lines."""
px = pg.x(data)
gx = np.array([px[int(g)] for g in data("g")])
sx = np.array([px[int(s)] for s in data("s")])
if tt is None:
tt = np.array(data("t"))
if plotva:
tt = np.absolute(gx ... | [
"def",
"drawFirstPicks",
"(",
"ax",
",",
"data",
",",
"tt",
"=",
"None",
",",
"plotva",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"px",
"=",
"pg",
".",
"x",
"(",
"data",
")",
"gx",
"=",
"np",
".",
"array",
"(",
"[",
"px",
"[",
"int",
... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/physics/traveltime/plotting.py#L72-L102 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | tools/DOI/doi.py | python | _http_request | (body, method, url, options, content_type=None) | return result | Issue an HTTP request with the given options.
We are forced to use a command line tool for this rather than use the
in-built Python libraries since httplib, urllib and urllib2 all seem to
have problems using HTTPS through the proxy at RAL. HTTP works fine,
but the DOI API is encrypted so that is not a... | Issue an HTTP request with the given options. | [
"Issue",
"an",
"HTTP",
"request",
"with",
"the",
"given",
"options",
"."
] | def _http_request(body, method, url, options, content_type=None):
'''Issue an HTTP request with the given options.
We are forced to use a command line tool for this rather than use the
in-built Python libraries since httplib, urllib and urllib2 all seem to
have problems using HTTPS through the proxy at... | [
"def",
"_http_request",
"(",
"body",
",",
"method",
",",
"url",
",",
"options",
",",
"content_type",
"=",
"None",
")",
":",
"args",
"=",
"[",
"'curl'",
",",
"'--user'",
",",
"options",
".",
"username",
"+",
"':'",
"+",
"options",
".",
"password",
",",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/tools/DOI/doi.py#L201-L241 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBData.GetDouble | (self, error, offset) | return _lldb.SBData_GetDouble(self, error, offset) | GetDouble(SBData self, SBError error, lldb::offset_t offset) -> double | GetDouble(SBData self, SBError error, lldb::offset_t offset) -> double | [
"GetDouble",
"(",
"SBData",
"self",
"SBError",
"error",
"lldb",
"::",
"offset_t",
"offset",
")",
"-",
">",
"double"
] | def GetDouble(self, error, offset):
"""GetDouble(SBData self, SBError error, lldb::offset_t offset) -> double"""
return _lldb.SBData_GetDouble(self, error, offset) | [
"def",
"GetDouble",
"(",
"self",
",",
"error",
",",
"offset",
")",
":",
"return",
"_lldb",
".",
"SBData_GetDouble",
"(",
"self",
",",
"error",
",",
"offset",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L3347-L3349 | |
fatih/subvim | 241b6d170597857105da219c9b7d36059e9f11fb | vim/base/YouCompleteMe/third_party/jedi/jedi/evaluate.py | python | find_assignments | (lhs, results, seek_name) | Check if `seek_name` is in the left hand side `lhs` of assignment.
`lhs` can simply be a variable (`pr.Call`) or a tuple/list (`pr.Array`)
representing the following cases::
a = 1 # lhs is pr.Call
(a, b) = 2 # lhs is pr.Array
:type lhs: pr.Call
:type results: list
:type s... | Check if `seek_name` is in the left hand side `lhs` of assignment. | [
"Check",
"if",
"seek_name",
"is",
"in",
"the",
"left",
"hand",
"side",
"lhs",
"of",
"assignment",
"."
] | def find_assignments(lhs, results, seek_name):
"""
Check if `seek_name` is in the left hand side `lhs` of assignment.
`lhs` can simply be a variable (`pr.Call`) or a tuple/list (`pr.Array`)
representing the following cases::
a = 1 # lhs is pr.Call
(a, b) = 2 # lhs is pr.Array
... | [
"def",
"find_assignments",
"(",
"lhs",
",",
"results",
",",
"seek_name",
")",
":",
"if",
"isinstance",
"(",
"lhs",
",",
"pr",
".",
"Array",
")",
":",
"return",
"assign_tuples",
"(",
"lhs",
",",
"results",
",",
"seek_name",
")",
"elif",
"lhs",
".",
"nam... | https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/jedi/jedi/evaluate.py#L573-L592 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/shape_base.py | python | kron | (a, b) | return result | Kronecker product of two arrays.
Computes the Kronecker product, a composite array made of blocks of the
second array scaled by the first.
Parameters
----------
a, b : array_like
Returns
-------
out : ndarray
See Also
--------
outer : The outer product
Notes
----... | Kronecker product of two arrays. | [
"Kronecker",
"product",
"of",
"two",
"arrays",
"."
] | def kron(a, b):
"""
Kronecker product of two arrays.
Computes the Kronecker product, a composite array made of blocks of the
second array scaled by the first.
Parameters
----------
a, b : array_like
Returns
-------
out : ndarray
See Also
--------
outer : The outer... | [
"def",
"kron",
"(",
"a",
",",
"b",
")",
":",
"b",
"=",
"asanyarray",
"(",
"b",
")",
"a",
"=",
"array",
"(",
"a",
",",
"copy",
"=",
"False",
",",
"subok",
"=",
"True",
",",
"ndmin",
"=",
"b",
".",
"ndim",
")",
"ndb",
",",
"nda",
"=",
"b",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/shape_base.py#L1066-L1162 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/tools/api/generator/create_python_api.py | python | get_module | (dir_path, relative_to_dir) | return dir_path.replace('/', '.').strip('.') | Get module that corresponds to path relative to relative_to_dir.
Args:
dir_path: Path to directory.
relative_to_dir: Get module relative to this directory.
Returns:
Name of module that corresponds to the given directory. | Get module that corresponds to path relative to relative_to_dir. | [
"Get",
"module",
"that",
"corresponds",
"to",
"path",
"relative",
"to",
"relative_to_dir",
"."
] | def get_module(dir_path, relative_to_dir):
"""Get module that corresponds to path relative to relative_to_dir.
Args:
dir_path: Path to directory.
relative_to_dir: Get module relative to this directory.
Returns:
Name of module that corresponds to the given directory.
"""
dir_path = dir_path[len(r... | [
"def",
"get_module",
"(",
"dir_path",
",",
"relative_to_dir",
")",
":",
"dir_path",
"=",
"dir_path",
"[",
"len",
"(",
"relative_to_dir",
")",
":",
"]",
"# Convert path separators to '/' for easier parsing below.",
"dir_path",
"=",
"dir_path",
".",
"replace",
"(",
"o... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/tools/api/generator/create_python_api.py#L523-L536 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/estimator/estimator.py | python | Estimator.__init__ | (self, model_fn, model_dir=None, config=None, params=None) | Constructs an `Estimator` instance.
Args:
model_fn: Model function. Follows the signature:
* Args:
* `features`: This is the first item returned from the `input_fn`
passed to `train`, `evaluate`, and `predict`. This should be a
single `Tensor` or `dict` o... | Constructs an `Estimator` instance. | [
"Constructs",
"an",
"Estimator",
"instance",
"."
] | def __init__(self, model_fn, model_dir=None, config=None, params=None):
"""Constructs an `Estimator` instance.
Args:
model_fn: Model function. Follows the signature:
* Args:
* `features`: This is the first item returned from the `input_fn`
passed to `train`, `evaluate... | [
"def",
"__init__",
"(",
"self",
",",
"model_fn",
",",
"model_dir",
"=",
"None",
",",
"config",
"=",
"None",
",",
"params",
"=",
"None",
")",
":",
"Estimator",
".",
"_assert_members_are_not_overridden",
"(",
"self",
")",
"if",
"config",
"is",
"None",
":",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/estimator/estimator.py#L93-L180 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/stc.py | python | StyledTextCtrl.SetMultiPaste | (*args, **kwargs) | return _stc.StyledTextCtrl_SetMultiPaste(*args, **kwargs) | SetMultiPaste(self, int multiPaste) | SetMultiPaste(self, int multiPaste) | [
"SetMultiPaste",
"(",
"self",
"int",
"multiPaste",
")"
] | def SetMultiPaste(*args, **kwargs):
"""SetMultiPaste(self, int multiPaste)"""
return _stc.StyledTextCtrl_SetMultiPaste(*args, **kwargs) | [
"def",
"SetMultiPaste",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_SetMultiPaste",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/stc.py#L4277-L4279 | |
wujian16/Cornell-MOE | df299d1be882d2af9796d7a68b3f9505cac7a53e | moe/optimal_learning/python/base_prior.py | python | NormalPrior.sample_from_prior | (self, n_samples) | return p0[:, np.newaxis] | Returns N samples from the prior.
Parameters
----------
n_samples : int
The number of samples that will be drawn.
Returns
-------
(N, D) np.array
The samples from the prior. | Returns N samples from the prior. | [
"Returns",
"N",
"samples",
"from",
"the",
"prior",
"."
] | def sample_from_prior(self, n_samples):
"""
Returns N samples from the prior.
Parameters
----------
n_samples : int
The number of samples that will be drawn.
Returns
-------
(N, D) np.array
The samples from the prior.
"""
... | [
"def",
"sample_from_prior",
"(",
"self",
",",
"n_samples",
")",
":",
"p0",
"=",
"np",
".",
"random",
".",
"normal",
"(",
"loc",
"=",
"self",
".",
"mean",
",",
"scale",
"=",
"self",
".",
"sigma",
",",
"size",
"=",
"n_samples",
")",
"return",
"p0",
"... | https://github.com/wujian16/Cornell-MOE/blob/df299d1be882d2af9796d7a68b3f9505cac7a53e/moe/optimal_learning/python/base_prior.py#L356-L374 | |
tzutalin/dlib-android | 989627cb7fe81cd1d41d73434b0e91ce1dd2683f | tools/lint/cpplint.py | python | FindStartOfExpressionInLine | (line, endpos, stack) | return (-1, stack) | Find position at the matching start of current expression.
This is almost the reverse of FindEndOfExpressionInLine, but note
that the input position and returned position differs by 1.
Args:
line: a CleansedLines line.
endpos: start searching at this position.
stack: nesting stack at endpos.
Returns... | Find position at the matching start of current expression.
This is almost the reverse of FindEndOfExpressionInLine, but note
that the input position and returned position differs by 1.
Args:
line: a CleansedLines line.
endpos: start searching at this position.
stack: nesting stack at endpos.
Returns... | [
"Find",
"position",
"at",
"the",
"matching",
"start",
"of",
"current",
"expression",
".",
"This",
"is",
"almost",
"the",
"reverse",
"of",
"FindEndOfExpressionInLine",
"but",
"note",
"that",
"the",
"input",
"position",
"and",
"returned",
"position",
"differs",
"b... | def FindStartOfExpressionInLine(line, endpos, stack):
"""Find position at the matching start of current expression.
This is almost the reverse of FindEndOfExpressionInLine, but note
that the input position and returned position differs by 1.
Args:
line: a CleansedLines line.
endpos: start searching at t... | [
"def",
"FindStartOfExpressionInLine",
"(",
"line",
",",
"endpos",
",",
"stack",
")",
":",
"i",
"=",
"endpos",
"while",
"i",
">=",
"0",
":",
"char",
"=",
"line",
"[",
"i",
"]",
"if",
"char",
"in",
"')]}'",
":",
"# Found end of expression, push to expression s... | https://github.com/tzutalin/dlib-android/blob/989627cb7fe81cd1d41d73434b0e91ce1dd2683f/tools/lint/cpplint.py#L1524-L1595 | |
yun-liu/RCF | 91bfb054ad04187dbbe21e539e165ad9bd3ff00b | scripts/cpp_lint.py | python | FileInfo.RepositoryName | (self) | return fullname | FullName after removing the local path to the repository.
If we have a real absolute path name here we can try to do something smart:
detecting the root of the checkout and truncating /path/to/checkout from
the name so that we get header guards that don't include things like
"C:\Documents and Settings\... | FullName after removing the local path to the repository. | [
"FullName",
"after",
"removing",
"the",
"local",
"path",
"to",
"the",
"repository",
"."
] | def RepositoryName(self):
"""FullName after removing the local path to the repository.
If we have a real absolute path name here we can try to do something smart:
detecting the root of the checkout and truncating /path/to/checkout from
the name so that we get header guards that don't include things lik... | [
"def",
"RepositoryName",
"(",
"self",
")",
":",
"fullname",
"=",
"self",
".",
"FullName",
"(",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"fullname",
")",
":",
"project_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"fullname",
")",
"if",
... | https://github.com/yun-liu/RCF/blob/91bfb054ad04187dbbe21e539e165ad9bd3ff00b/scripts/cpp_lint.py#L885-L928 | |
lammps/lammps | b75c3065430a75b1b5543a10e10f46d9b4c91913 | tools/amber2lmp/amber2lammps.py | python | Amber.Read_TOP | (self, Basename) | Read the Amber parameter/topology (.top) file | Read the Amber parameter/topology (.top) file | [
"Read",
"the",
"Amber",
"parameter",
"/",
"topology",
"(",
".",
"top",
")",
"file"
] | def Read_TOP(self, Basename):
'Read the Amber parameter/topology (.top) file'
Item_list = self.Read_data(Basename + '.top')
if Item_list == None:
return
elif len(Item_list) < 31:
print '(error: File too short!)'
return
# Parse the data
... | [
"def",
"Read_TOP",
"(",
"self",
",",
"Basename",
")",
":",
"Item_list",
"=",
"self",
".",
"Read_data",
"(",
"Basename",
"+",
"'.top'",
")",
"if",
"Item_list",
"==",
"None",
":",
"return",
"elif",
"len",
"(",
"Item_list",
")",
"<",
"31",
":",
"print",
... | https://github.com/lammps/lammps/blob/b75c3065430a75b1b5543a10e10f46d9b4c91913/tools/amber2lmp/amber2lammps.py#L476-L933 | ||
ouster-lidar/ouster_example | 13ea8e8b8a4951fb630dbc9108666995c8443bf6 | python/src/ouster/sdk/examples/pcap.py | python | main | () | Pcap examples runner. | Pcap examples runner. | [
"Pcap",
"examples",
"runner",
"."
] | def main():
"""Pcap examples runner."""
examples = {
"open3d-one-scan": pcap_3d_one_scan,
"plot-xyz-points": pcap_display_xyz_points,
"pcap-to-csv": pcap_to_csv,
"pcap-to-las": pcap_to_las,
"pcap-to-pcd": pcap_to_pcd,
"query-scan": pcap_query_scan,
"read-p... | [
"def",
"main",
"(",
")",
":",
"examples",
"=",
"{",
"\"open3d-one-scan\"",
":",
"pcap_3d_one_scan",
",",
"\"plot-xyz-points\"",
":",
"pcap_display_xyz_points",
",",
"\"pcap-to-csv\"",
":",
"pcap_to_csv",
",",
"\"pcap-to-las\"",
":",
"pcap_to_las",
",",
"\"pcap-to-pcd\... | https://github.com/ouster-lidar/ouster_example/blob/13ea8e8b8a4951fb630dbc9108666995c8443bf6/python/src/ouster/sdk/examples/pcap.py#L308-L358 | ||
toggl-open-source/toggldesktop | 91865205885531cc8fd9e8d613dad49d625d56e7 | third_party/cpplint/cpplint.py | python | CheckForNonStandardConstructs | (filename, clean_lines, linenum,
nesting_state, error) | r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
Complain about several constructs which gcc-2 accepts, but which are
not standard C++. Warning about these in lint is one way to ease the
transition to new compilers.
- put storage class first (e.g. "static const" instead of "const stat... | r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2. | [
"r",
"Logs",
"an",
"error",
"if",
"we",
"see",
"certain",
"non",
"-",
"ANSI",
"constructs",
"ignored",
"by",
"gcc",
"-",
"2",
"."
] | def CheckForNonStandardConstructs(filename, clean_lines, linenum,
nesting_state, error):
r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
Complain about several constructs which gcc-2 accepts, but which are
not standard C++. Warning about these in lint ... | [
"def",
"CheckForNonStandardConstructs",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"# Remove comments from the line, but leave in strings for now.",
"line",
"=",
"clean_lines",
".",
"lines",
"[",
"linenum",
"]",
"i... | https://github.com/toggl-open-source/toggldesktop/blob/91865205885531cc8fd9e8d613dad49d625d56e7/third_party/cpplint/cpplint.py#L2573-L2734 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/signal/ltisys.py | python | ZerosPolesGain.to_zpk | (self) | return copy.deepcopy(self) | Return a copy of the current 'ZerosPolesGain' system.
Returns
-------
sys : instance of `ZerosPolesGain`
The current system (copy) | Return a copy of the current 'ZerosPolesGain' system. | [
"Return",
"a",
"copy",
"of",
"the",
"current",
"ZerosPolesGain",
"system",
"."
] | def to_zpk(self):
"""
Return a copy of the current 'ZerosPolesGain' system.
Returns
-------
sys : instance of `ZerosPolesGain`
The current system (copy)
"""
return copy.deepcopy(self) | [
"def",
"to_zpk",
"(",
"self",
")",
":",
"return",
"copy",
".",
"deepcopy",
"(",
"self",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/signal/ltisys.py#L1045-L1055 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py | python | _get_elementwise_name_from_keras_layer | (keras_layer) | Get the keras layer name from the activation name. | Get the keras layer name from the activation name. | [
"Get",
"the",
"keras",
"layer",
"name",
"from",
"the",
"activation",
"name",
"."
] | def _get_elementwise_name_from_keras_layer(keras_layer):
"""
Get the keras layer name from the activation name.
"""
mode = keras_layer.mode
if mode == "sum":
return "ADD"
elif mode == "mul":
return "MULTIPLY"
elif mode == "concat":
if len(keras_layer.input_shape[0]) =... | [
"def",
"_get_elementwise_name_from_keras_layer",
"(",
"keras_layer",
")",
":",
"mode",
"=",
"keras_layer",
".",
"mode",
"if",
"mode",
"==",
"\"sum\"",
":",
"return",
"\"ADD\"",
"elif",
"mode",
"==",
"\"mul\"",
":",
"return",
"\"MULTIPLY\"",
"elif",
"mode",
"==",... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L73-L120 | ||
nyuwireless-unipd/ns3-mmwave | 4ff9e87e8079764e04cbeccd8e85bff15ae16fb3 | bindings/python/rad_util.py | python | is_rotated | (seq1, seq2) | return False | Return true if the first sequence is a rotation of the second sequence.
>>> seq1 = ['A', 'B', 'C', 'D']
>>> seq2 = ['C', 'D', 'A', 'B']
>>> int(is_rotated(seq1, seq2))
1
>>> seq2 = ['C', 'D', 'B', 'A']
>>> int(is_rotated(seq1, seq2))
0
>>> seq1 = ['A', 'B', 'C', 'A']
>>> seq2 = ['... | Return true if the first sequence is a rotation of the second sequence. | [
"Return",
"true",
"if",
"the",
"first",
"sequence",
"is",
"a",
"rotation",
"of",
"the",
"second",
"sequence",
"."
] | def is_rotated(seq1, seq2):
"""Return true if the first sequence is a rotation of the second sequence.
>>> seq1 = ['A', 'B', 'C', 'D']
>>> seq2 = ['C', 'D', 'A', 'B']
>>> int(is_rotated(seq1, seq2))
1
>>> seq2 = ['C', 'D', 'B', 'A']
>>> int(is_rotated(seq1, seq2))
0
>>> seq1 = ['A... | [
"def",
"is_rotated",
"(",
"seq1",
",",
"seq2",
")",
":",
"# Do a sanity check.",
"if",
"len",
"(",
"seq1",
")",
"!=",
"len",
"(",
"seq2",
")",
":",
"return",
"False",
"# Look for occurrences of second sequence head item in first sequence.",
"start_indexes",
"=",
"["... | https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/bindings/python/rad_util.py#L735-L775 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/command/build_py.py | python | build_py._get_platform_patterns | (spec, package, src_dir) | return (
# Each pattern has to be converted to a platform-specific path
os.path.join(src_dir, convert_path(pattern))
for pattern in raw_patterns
) | yield platform-specific path patterns (suitable for glob
or fn_match) from a glob-based spec (such as
self.package_data or self.exclude_package_data)
matching package in src_dir. | yield platform-specific path patterns (suitable for glob
or fn_match) from a glob-based spec (such as
self.package_data or self.exclude_package_data)
matching package in src_dir. | [
"yield",
"platform",
"-",
"specific",
"path",
"patterns",
"(",
"suitable",
"for",
"glob",
"or",
"fn_match",
")",
"from",
"a",
"glob",
"-",
"based",
"spec",
"(",
"such",
"as",
"self",
".",
"package_data",
"or",
"self",
".",
"exclude_package_data",
")",
"mat... | def _get_platform_patterns(spec, package, src_dir):
"""
yield platform-specific path patterns (suitable for glob
or fn_match) from a glob-based spec (such as
self.package_data or self.exclude_package_data)
matching package in src_dir.
"""
raw_patterns = itertools.... | [
"def",
"_get_platform_patterns",
"(",
"spec",
",",
"package",
",",
"src_dir",
")",
":",
"raw_patterns",
"=",
"itertools",
".",
"chain",
"(",
"spec",
".",
"get",
"(",
"''",
",",
"[",
"]",
")",
",",
"spec",
".",
"get",
"(",
"package",
",",
"[",
"]",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/command/build_py.py#L220-L235 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/min.py | python | min.is_atom_log_log_convex | (self) | return False | Is the atom log-log convex? | Is the atom log-log convex? | [
"Is",
"the",
"atom",
"log",
"-",
"log",
"convex?"
] | def is_atom_log_log_convex(self) -> bool:
"""Is the atom log-log convex?
"""
return False | [
"def",
"is_atom_log_log_convex",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/min.py#L84-L87 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/bintrees/bintrees/rbtree.py | python | RBTree.root | (self) | return self._root | root node of T | root node of T | [
"root",
"node",
"of",
"T"
] | def root(self):
""" root node of T """
return self._root | [
"def",
"root",
"(",
"self",
")",
":",
"return",
"self",
".",
"_root"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/bintrees/bintrees/rbtree.py#L142-L144 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/dataview.py | python | DataViewTreeCtrl.InsertItem | (*args, **kwargs) | return _dataview.DataViewTreeCtrl_InsertItem(*args, **kwargs) | InsertItem(self, DataViewItem parent, DataViewItem previous, String text,
int icon=-1, wxClientData data=None) -> DataViewItem | InsertItem(self, DataViewItem parent, DataViewItem previous, String text,
int icon=-1, wxClientData data=None) -> DataViewItem | [
"InsertItem",
"(",
"self",
"DataViewItem",
"parent",
"DataViewItem",
"previous",
"String",
"text",
"int",
"icon",
"=",
"-",
"1",
"wxClientData",
"data",
"=",
"None",
")",
"-",
">",
"DataViewItem"
] | def InsertItem(*args, **kwargs):
"""
InsertItem(self, DataViewItem parent, DataViewItem previous, String text,
int icon=-1, wxClientData data=None) -> DataViewItem
"""
return _dataview.DataViewTreeCtrl_InsertItem(*args, **kwargs) | [
"def",
"InsertItem",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewTreeCtrl_InsertItem",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/dataview.py#L2497-L2502 | |
libLAS/libLAS | e6a1aaed412d638687b8aec44f7b12df7ca2bbbb | python/liblas/point.py | python | Point.set_raw_z | (self, value) | return core.las.LASPoint_SetRawZ(self.handle, value) | Sets the Z coordinate of the LAS point to an integer value
value.
..note::
The point will be scaled according to the obj:`liblas.point.Point.header`'s
scale value for the Z dimension when returned as a double obj:`liblas.point.Point.y`. | Sets the Z coordinate of the LAS point to an integer value
value. | [
"Sets",
"the",
"Z",
"coordinate",
"of",
"the",
"LAS",
"point",
"to",
"an",
"integer",
"value",
"value",
"."
] | def set_raw_z(self, value):
"""Sets the Z coordinate of the LAS point to an integer value
value.
..note::
The point will be scaled according to the obj:`liblas.point.Point.header`'s
scale value for the Z dimension when returned as a double obj:`liblas.point.Point.y`.
... | [
"def",
"set_raw_z",
"(",
"self",
",",
"value",
")",
":",
"return",
"core",
".",
"las",
".",
"LASPoint_SetRawZ",
"(",
"self",
".",
"handle",
",",
"value",
")"
] | https://github.com/libLAS/libLAS/blob/e6a1aaed412d638687b8aec44f7b12df7ca2bbbb/python/liblas/point.py#L200-L208 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/core/fromnumeric.py | python | nonzero | (a) | return _wrapfunc(a, 'nonzero') | Return the indices of the elements that are non-zero.
Returns a tuple of arrays, one for each dimension of `a`,
containing the indices of the non-zero elements in that
dimension. The values in `a` are always tested and returned in
row-major, C-style order.
To group the indices by element, rather t... | Return the indices of the elements that are non-zero. | [
"Return",
"the",
"indices",
"of",
"the",
"elements",
"that",
"are",
"non",
"-",
"zero",
"."
] | def nonzero(a):
"""
Return the indices of the elements that are non-zero.
Returns a tuple of arrays, one for each dimension of `a`,
containing the indices of the non-zero elements in that
dimension. The values in `a` are always tested and returned in
row-major, C-style order.
To group the ... | [
"def",
"nonzero",
"(",
"a",
")",
":",
"return",
"_wrapfunc",
"(",
"a",
",",
"'nonzero'",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/core/fromnumeric.py#L1805-L1896 | |
NVIDIAGameWorks/kaolin | e5148d05e9c1e2ce92a07881ce3593b1c5c3f166 | kaolin/metrics/trianglemesh.py | python | average_edge_length | (vertices, faces) | return edge_length | r"""Returns the average length of each faces in a mesh.
Args:
vertices (torch.Tensor): Batched vertices, of shape
:math:`(\text{batch_size}, \text{num_vertices}, 3)`.
faces (torch.LongTensor): Faces, of shape :math:`(\text{num_faces}, 3)`.
Returns:
(torc... | r"""Returns the average length of each faces in a mesh. | [
"r",
"Returns",
"the",
"average",
"length",
"of",
"each",
"faces",
"in",
"a",
"mesh",
"."
] | def average_edge_length(vertices, faces):
r"""Returns the average length of each faces in a mesh.
Args:
vertices (torch.Tensor): Batched vertices, of shape
:math:`(\text{batch_size}, \text{num_vertices}, 3)`.
faces (torch.LongTensor): Faces, of shape :math:`(\te... | [
"def",
"average_edge_length",
"(",
"vertices",
",",
"faces",
")",
":",
"batch_size",
"=",
"vertices",
".",
"shape",
"[",
"0",
"]",
"p1",
"=",
"torch",
".",
"index_select",
"(",
"vertices",
",",
"1",
",",
"faces",
"[",
":",
",",
"0",
"]",
")",
"p2",
... | https://github.com/NVIDIAGameWorks/kaolin/blob/e5148d05e9c1e2ce92a07881ce3593b1c5c3f166/kaolin/metrics/trianglemesh.py#L265-L302 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/aui.py | python | AuiTabContainer.__init__ | (self, *args, **kwargs) | __init__(self) -> AuiTabContainer | __init__(self) -> AuiTabContainer | [
"__init__",
"(",
"self",
")",
"-",
">",
"AuiTabContainer"
] | def __init__(self, *args, **kwargs):
"""__init__(self) -> AuiTabContainer"""
_aui.AuiTabContainer_swiginit(self,_aui.new_AuiTabContainer(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_aui",
".",
"AuiTabContainer_swiginit",
"(",
"self",
",",
"_aui",
".",
"new_AuiTabContainer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/aui.py#L1124-L1126 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py | python | Environment.can_add | (self, dist) | return py_compat and compatible_platforms(dist.platform, self.platform) | Is distribution `dist` acceptable for this environment?
The distribution must match the platform and python version
requirements specified when this environment was created, or False
is returned. | Is distribution `dist` acceptable for this environment? | [
"Is",
"distribution",
"dist",
"acceptable",
"for",
"this",
"environment?"
] | def can_add(self, dist):
"""Is distribution `dist` acceptable for this environment?
The distribution must match the platform and python version
requirements specified when this environment was created, or False
is returned.
"""
py_compat = (
self.python is No... | [
"def",
"can_add",
"(",
"self",
",",
"dist",
")",
":",
"py_compat",
"=",
"(",
"self",
".",
"python",
"is",
"None",
"or",
"dist",
".",
"py_version",
"is",
"None",
"or",
"dist",
".",
"py_version",
"==",
"self",
".",
"python",
")",
"return",
"py_compat",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L986-L998 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_grad_experimental/grad_math_ops.py | python | get_bprop_index_addcmul | (self) | return bprop | Generate bprop for Addcmul | Generate bprop for Addcmul | [
"Generate",
"bprop",
"for",
"Addcmul"
] | def get_bprop_index_addcmul(self):
"""Generate bprop for Addcmul"""
mul_op = P.Mul()
def bprop(input_data, x1, x2, value, out, dout):
dx1 = mul_op(dout, mul_op(value, x2))
dx2 = mul_op(dout, mul_op(value, x1))
dvalue = mul_op(dout, mul_op(x1, x2))
return dout, dx1, dx2, dval... | [
"def",
"get_bprop_index_addcmul",
"(",
"self",
")",
":",
"mul_op",
"=",
"P",
".",
"Mul",
"(",
")",
"def",
"bprop",
"(",
"input_data",
",",
"x1",
",",
"x2",
",",
"value",
",",
"out",
",",
"dout",
")",
":",
"dx1",
"=",
"mul_op",
"(",
"dout",
",",
"... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_grad_experimental/grad_math_ops.py#L103-L113 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | FileTypeInfo.SetIcon | (*args, **kwargs) | return _misc_.FileTypeInfo_SetIcon(*args, **kwargs) | SetIcon(self, String iconFile, int iconIndex=0) | SetIcon(self, String iconFile, int iconIndex=0) | [
"SetIcon",
"(",
"self",
"String",
"iconFile",
"int",
"iconIndex",
"=",
"0",
")"
] | def SetIcon(*args, **kwargs):
"""SetIcon(self, String iconFile, int iconIndex=0)"""
return _misc_.FileTypeInfo_SetIcon(*args, **kwargs) | [
"def",
"SetIcon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"FileTypeInfo_SetIcon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L2507-L2509 | |
mozilla/DeepSpeech | aa1d28530d531d0d92289bf5f11a49fe516fdc86 | bin/import_gram_vaani.py | python | setup_logging | (level) | Setup basic logging
Args:
level (int): minimum log level for emitting messages | Setup basic logging
Args:
level (int): minimum log level for emitting messages | [
"Setup",
"basic",
"logging",
"Args",
":",
"level",
"(",
"int",
")",
":",
"minimum",
"log",
"level",
"for",
"emitting",
"messages"
] | def setup_logging(level):
"""Setup basic logging
Args:
level (int): minimum log level for emitting messages
"""
format = "[%(asctime)s] %(levelname)s:%(name)s:%(message)s"
logging.basicConfig(
level=level, stream=sys.stdout, format=format, datefmt="%Y-%m-%d %H:%M:%S"
) | [
"def",
"setup_logging",
"(",
"level",
")",
":",
"format",
"=",
"\"[%(asctime)s] %(levelname)s:%(name)s:%(message)s\"",
"logging",
".",
"basicConfig",
"(",
"level",
"=",
"level",
",",
"stream",
"=",
"sys",
".",
"stdout",
",",
"format",
"=",
"format",
",",
"datefm... | https://github.com/mozilla/DeepSpeech/blob/aa1d28530d531d0d92289bf5f11a49fe516fdc86/bin/import_gram_vaani.py#L78-L86 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/pot/openvino/tools/pot/api/samples/face_detection/face_detection_sample.py | python | MTCNNEngine.set_model | (self, model) | Loads NetworkX model into InferenceEngine and stores it in Engine class
:param model: CompressedModel instance | Loads NetworkX model into InferenceEngine and stores it in Engine class
:param model: CompressedModel instance | [
"Loads",
"NetworkX",
"model",
"into",
"InferenceEngine",
"and",
"stores",
"it",
"in",
"Engine",
"class",
":",
"param",
"model",
":",
"CompressedModel",
"instance"
] | def set_model(self, model):
""" Loads NetworkX model into InferenceEngine and stores it in Engine class
:param model: CompressedModel instance
"""
# save graph to IR and use it to initialize IE Network
self._model = self._set_model(model)
self._output_layers = {}
... | [
"def",
"set_model",
"(",
"self",
",",
"model",
")",
":",
"# save graph to IR and use it to initialize IE Network",
"self",
".",
"_model",
"=",
"self",
".",
"_set_model",
"(",
"model",
")",
"self",
".",
"_output_layers",
"=",
"{",
"}",
"stage_names",
"=",
"[",
... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/pot/openvino/tools/pot/api/samples/face_detection/face_detection_sample.py#L93-L105 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/cluster/hierarchical.py | python | FeatureAgglomeration.fit | (self, X, y=None, **params) | return AgglomerativeClustering.fit(self, X.T, **params) | Fit the hierarchical clustering on the data
Parameters
----------
X : array-like, shape = [n_samples, n_features]
The data
Returns
-------
self | Fit the hierarchical clustering on the data | [
"Fit",
"the",
"hierarchical",
"clustering",
"on",
"the",
"data"
] | def fit(self, X, y=None, **params):
"""Fit the hierarchical clustering on the data
Parameters
----------
X : array-like, shape = [n_samples, n_features]
The data
Returns
-------
self
"""
X = check_array(X, accept_sparse=['csr', 'csc',... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"*",
"*",
"params",
")",
":",
"X",
"=",
"check_array",
"(",
"X",
",",
"accept_sparse",
"=",
"[",
"'csr'",
",",
"'csc'",
",",
"'coo'",
"]",
",",
"ensure_min_features",
"=",
"2",
",",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/cluster/hierarchical.py#L823-L837 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.