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
quantOS-org/DataCore
e2ef9bd2c22ee9e2845675b6435a14fa607f3551
mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/service.py
python
Service.GetResponseClass
(self, method_descriptor)
Returns the class of the response message for the specified method. This method isn't really needed, as the RpcChannel's CallMethod constructs the response protocol message. It's provided anyway in case it is useful for the caller to know the response type in advance.
Returns the class of the response message for the specified method.
[ "Returns", "the", "class", "of", "the", "response", "message", "for", "the", "specified", "method", "." ]
def GetResponseClass(self, method_descriptor): """Returns the class of the response message for the specified method. This method isn't really needed, as the RpcChannel's CallMethod constructs the response protocol message. It's provided anyway in case it is useful for the caller to know the response type in advance. """ raise NotImplementedError
[ "def", "GetResponseClass", "(", "self", ",", "method_descriptor", ")", ":", "raise", "NotImplementedError" ]
https://github.com/quantOS-org/DataCore/blob/e2ef9bd2c22ee9e2845675b6435a14fa607f3551/mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/service.py#L108-L115
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/stc.py
python
StyledTextEvent.GetListType
(*args, **kwargs)
return _stc.StyledTextEvent_GetListType(*args, **kwargs)
GetListType(self) -> int
GetListType(self) -> int
[ "GetListType", "(", "self", ")", "-", ">", "int" ]
def GetListType(*args, **kwargs): """GetListType(self) -> int""" return _stc.StyledTextEvent_GetListType(*args, **kwargs)
[ "def", "GetListType", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_stc", ".", "StyledTextEvent_GetListType", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/stc.py#L7178-L7180
BlzFans/wke
b0fa21158312e40c5fbd84682d643022b6c34a93
cygwin/lib/python2.6/ftplib.py
python
FTP.storlines
(self, cmd, fp, callback=None)
return self.voidresp()
Store a file in line mode. A new port is created for you. Args: cmd: A STOR command. fp: A file-like object with a readline() method. callback: An optional single parameter callable that is called on on each line after it is sent. [default: None] Returns: The response code.
Store a file in line mode. A new port is created for you.
[ "Store", "a", "file", "in", "line", "mode", ".", "A", "new", "port", "is", "created", "for", "you", "." ]
def storlines(self, cmd, fp, callback=None): """Store a file in line mode. A new port is created for you. Args: cmd: A STOR command. fp: A file-like object with a readline() method. callback: An optional single parameter callable that is called on on each line after it is sent. [default: None] Returns: The response code. """ self.voidcmd('TYPE A') conn = self.transfercmd(cmd) while 1: buf = fp.readline() if not buf: break if buf[-2:] != CRLF: if buf[-1] in CRLF: buf = buf[:-1] buf = buf + CRLF conn.sendall(buf) if callback: callback(buf) conn.close() return self.voidresp()
[ "def", "storlines", "(", "self", ",", "cmd", ",", "fp", ",", "callback", "=", "None", ")", ":", "self", ".", "voidcmd", "(", "'TYPE A'", ")", "conn", "=", "self", ".", "transfercmd", "(", "cmd", ")", "while", "1", ":", "buf", "=", "fp", ".", "readline", "(", ")", "if", "not", "buf", ":", "break", "if", "buf", "[", "-", "2", ":", "]", "!=", "CRLF", ":", "if", "buf", "[", "-", "1", "]", "in", "CRLF", ":", "buf", "=", "buf", "[", ":", "-", "1", "]", "buf", "=", "buf", "+", "CRLF", "conn", ".", "sendall", "(", "buf", ")", "if", "callback", ":", "callback", "(", "buf", ")", "conn", ".", "close", "(", ")", "return", "self", ".", "voidresp", "(", ")" ]
https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/ftplib.py#L457-L480
weolar/miniblink49
1c4678db0594a4abde23d3ebbcc7cd13c3170777
third_party/skia/tools/skp/webpages_playback.py
python
SkPicturePlayback._RenameSkpFiles
(self, page_set)
Rename generated SKP files into more descriptive names. Look into the subdirectory of TMP_SKP_DIR and find the most interesting .skp in there to be this page_set's representative .skp.
Rename generated SKP files into more descriptive names.
[ "Rename", "generated", "SKP", "files", "into", "more", "descriptive", "names", "." ]
def _RenameSkpFiles(self, page_set): """Rename generated SKP files into more descriptive names. Look into the subdirectory of TMP_SKP_DIR and find the most interesting .skp in there to be this page_set's representative .skp. """ subdirs = glob.glob(os.path.join(TMP_SKP_DIR, '*')) for site in subdirs: if self._IsChromiumPageSet(page_set): filename = self._GetChromiumSkpFileName(page_set, site) else: filename = self._GetSkiaSkpFileName(page_set) filename = filename.lower() if self._skp_prefix: filename = '%s%s' % (self._skp_prefix, filename) # We choose the largest .skp as the most likely to be interesting. largest_skp = max(glob.glob(os.path.join(site, '*.skp')), key=lambda path: os.stat(path).st_size) dest = os.path.join(self._local_skp_dir, filename) print 'Moving', largest_skp, 'to', dest shutil.move(largest_skp, dest) self._skp_files.append(filename) shutil.rmtree(site)
[ "def", "_RenameSkpFiles", "(", "self", ",", "page_set", ")", ":", "subdirs", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "TMP_SKP_DIR", ",", "'*'", ")", ")", "for", "site", "in", "subdirs", ":", "if", "self", ".", "_IsChromiumPageSet", "(", "page_set", ")", ":", "filename", "=", "self", ".", "_GetChromiumSkpFileName", "(", "page_set", ",", "site", ")", "else", ":", "filename", "=", "self", ".", "_GetSkiaSkpFileName", "(", "page_set", ")", "filename", "=", "filename", ".", "lower", "(", ")", "if", "self", ".", "_skp_prefix", ":", "filename", "=", "'%s%s'", "%", "(", "self", ".", "_skp_prefix", ",", "filename", ")", "# We choose the largest .skp as the most likely to be interesting.", "largest_skp", "=", "max", "(", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "site", ",", "'*.skp'", ")", ")", ",", "key", "=", "lambda", "path", ":", "os", ".", "stat", "(", "path", ")", ".", "st_size", ")", "dest", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_local_skp_dir", ",", "filename", ")", "print", "'Moving'", ",", "largest_skp", ",", "'to'", ",", "dest", "shutil", ".", "move", "(", "largest_skp", ",", "dest", ")", "self", ".", "_skp_files", ".", "append", "(", "filename", ")", "shutil", ".", "rmtree", "(", "site", ")" ]
https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/skia/tools/skp/webpages_playback.py#L403-L427
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
deps/src/libxml2-2.9.1/python/libxml2.py
python
SAXCallback.reference
(self, name)
called when an entity reference has been found
called when an entity reference has been found
[ "called", "when", "an", "entity", "reference", "has", "been", "found" ]
def reference(self, name): """called when an entity reference has been found""" pass
[ "def", "reference", "(", "self", ",", "name", ")", ":", "pass" ]
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L194-L196
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/prompt-toolkit/py2/prompt_toolkit/buffer.py
python
Buffer.auto_down
(self, count=1, go_to_start_of_line_if_history_changes=False)
If we're not on the last line (of a multiline input) go a line down, otherwise go forward in history. (If nothing is selected.)
If we're not on the last line (of a multiline input) go a line down, otherwise go forward in history. (If nothing is selected.)
[ "If", "we", "re", "not", "on", "the", "last", "line", "(", "of", "a", "multiline", "input", ")", "go", "a", "line", "down", "otherwise", "go", "forward", "in", "history", ".", "(", "If", "nothing", "is", "selected", ".", ")" ]
def auto_down(self, count=1, go_to_start_of_line_if_history_changes=False): """ If we're not on the last line (of a multiline input) go a line down, otherwise go forward in history. (If nothing is selected.) """ if self.complete_state: self.complete_next(count=count) elif self.document.cursor_position_row < self.document.line_count - 1: self.cursor_down(count=count) elif not self.selection_state: self.history_forward(count=count) # Go to the start of the line? if go_to_start_of_line_if_history_changes: self.cursor_position += self.document.get_start_of_line_position()
[ "def", "auto_down", "(", "self", ",", "count", "=", "1", ",", "go_to_start_of_line_if_history_changes", "=", "False", ")", ":", "if", "self", ".", "complete_state", ":", "self", ".", "complete_next", "(", "count", "=", "count", ")", "elif", "self", ".", "document", ".", "cursor_position_row", "<", "self", ".", "document", ".", "line_count", "-", "1", ":", "self", ".", "cursor_down", "(", "count", "=", "count", ")", "elif", "not", "self", ".", "selection_state", ":", "self", ".", "history_forward", "(", "count", "=", "count", ")", "# Go to the start of the line?", "if", "go_to_start_of_line_if_history_changes", ":", "self", ".", "cursor_position", "+=", "self", ".", "document", ".", "get_start_of_line_position", "(", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py2/prompt_toolkit/buffer.py#L608-L622
idaholab/moose
9eeebc65e098b4c30f8205fb41591fd5b61eb6ff
python/peacock/Input/BlockInfo.py
python
BlockInfo.addParameter
(self, param)
Adds a parameter. Input: param[ParameterInfo]: New parameter to be added
Adds a parameter. Input: param[ParameterInfo]: New parameter to be added
[ "Adds", "a", "parameter", ".", "Input", ":", "param", "[", "ParameterInfo", "]", ":", "New", "parameter", "to", "be", "added" ]
def addParameter(self, param): """ Adds a parameter. Input: param[ParameterInfo]: New parameter to be added """ param.parent = self self.parameters[param.name] = param if param not in self.parameters_list: self.parameters_list.append(param.name)
[ "def", "addParameter", "(", "self", ",", "param", ")", ":", "param", ".", "parent", "=", "self", "self", ".", "parameters", "[", "param", ".", "name", "]", "=", "param", "if", "param", "not", "in", "self", ".", "parameters_list", ":", "self", ".", "parameters_list", ".", "append", "(", "param", ".", "name", ")" ]
https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/Input/BlockInfo.py#L202-L211
trailofbits/llvm-sanitizer-tutorial
d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99
llvm/tools/clang/tools/scan-build-py/libscanbuild/clang.py
python
get_active_checkers
(clang, plugins)
return frozenset(result)
Get the active checker list. :param clang: the compiler we are using :param plugins: list of plugins which was requested by the user :return: list of checker names which are active To get the default checkers we execute Clang to print how this compilation would be called. And take out the enabled checker from the arguments. For input file we specify stdin and pass only language information.
Get the active checker list.
[ "Get", "the", "active", "checker", "list", "." ]
def get_active_checkers(clang, plugins): """ Get the active checker list. :param clang: the compiler we are using :param plugins: list of plugins which was requested by the user :return: list of checker names which are active To get the default checkers we execute Clang to print how this compilation would be called. And take out the enabled checker from the arguments. For input file we specify stdin and pass only language information. """ def get_active_checkers_for(language): """ Returns a list of active checkers for the given language. """ load_args = [arg for plugin in plugins for arg in ['-Xclang', '-load', '-Xclang', plugin]] cmd = [clang, '--analyze'] + load_args + ['-x', language, '-'] return [ACTIVE_CHECKER_PATTERN.match(arg).group(1) for arg in get_arguments(cmd, '.') if ACTIVE_CHECKER_PATTERN.match(arg)] result = set() for language in ['c', 'c++', 'objective-c', 'objective-c++']: result.update(get_active_checkers_for(language)) return frozenset(result)
[ "def", "get_active_checkers", "(", "clang", ",", "plugins", ")", ":", "def", "get_active_checkers_for", "(", "language", ")", ":", "\"\"\" Returns a list of active checkers for the given language. \"\"\"", "load_args", "=", "[", "arg", "for", "plugin", "in", "plugins", "for", "arg", "in", "[", "'-Xclang'", ",", "'-load'", ",", "'-Xclang'", ",", "plugin", "]", "]", "cmd", "=", "[", "clang", ",", "'--analyze'", "]", "+", "load_args", "+", "[", "'-x'", ",", "language", ",", "'-'", "]", "return", "[", "ACTIVE_CHECKER_PATTERN", ".", "match", "(", "arg", ")", ".", "group", "(", "1", ")", "for", "arg", "in", "get_arguments", "(", "cmd", ",", "'.'", ")", "if", "ACTIVE_CHECKER_PATTERN", ".", "match", "(", "arg", ")", "]", "result", "=", "set", "(", ")", "for", "language", "in", "[", "'c'", ",", "'c++'", ",", "'objective-c'", ",", "'objective-c++'", "]", ":", "result", ".", "update", "(", "get_active_checkers_for", "(", "language", ")", ")", "return", "frozenset", "(", "result", ")" ]
https://github.com/trailofbits/llvm-sanitizer-tutorial/blob/d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99/llvm/tools/clang/tools/scan-build-py/libscanbuild/clang.py#L53-L79
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scikit-learn/py3/sklearn/linear_model/_bayes.py
python
BayesianRidge._update_coef_
(self, X, y, n_samples, n_features, XT_y, U, Vh, eigen_vals_, alpha_, lambda_)
return coef_, rmse_
Update posterior mean and compute corresponding rmse. Posterior mean is given by coef_ = scaled_sigma_ * X.T * y where scaled_sigma_ = (lambda_/alpha_ * np.eye(n_features) + np.dot(X.T, X))^-1
Update posterior mean and compute corresponding rmse.
[ "Update", "posterior", "mean", "and", "compute", "corresponding", "rmse", "." ]
def _update_coef_(self, X, y, n_samples, n_features, XT_y, U, Vh, eigen_vals_, alpha_, lambda_): """Update posterior mean and compute corresponding rmse. Posterior mean is given by coef_ = scaled_sigma_ * X.T * y where scaled_sigma_ = (lambda_/alpha_ * np.eye(n_features) + np.dot(X.T, X))^-1 """ if n_samples > n_features: coef_ = np.dot(Vh.T, Vh / (eigen_vals_ + lambda_ / alpha_)[:, np.newaxis]) coef_ = np.dot(coef_, XT_y) else: coef_ = np.dot(X.T, np.dot( U / (eigen_vals_ + lambda_ / alpha_)[None, :], U.T)) coef_ = np.dot(coef_, y) rmse_ = np.sum((y - np.dot(X, coef_)) ** 2) return coef_, rmse_
[ "def", "_update_coef_", "(", "self", ",", "X", ",", "y", ",", "n_samples", ",", "n_features", ",", "XT_y", ",", "U", ",", "Vh", ",", "eigen_vals_", ",", "alpha_", ",", "lambda_", ")", ":", "if", "n_samples", ">", "n_features", ":", "coef_", "=", "np", ".", "dot", "(", "Vh", ".", "T", ",", "Vh", "/", "(", "eigen_vals_", "+", "lambda_", "/", "alpha_", ")", "[", ":", ",", "np", ".", "newaxis", "]", ")", "coef_", "=", "np", ".", "dot", "(", "coef_", ",", "XT_y", ")", "else", ":", "coef_", "=", "np", ".", "dot", "(", "X", ".", "T", ",", "np", ".", "dot", "(", "U", "/", "(", "eigen_vals_", "+", "lambda_", "/", "alpha_", ")", "[", "None", ",", ":", "]", ",", "U", ".", "T", ")", ")", "coef_", "=", "np", ".", "dot", "(", "coef_", ",", "y", ")", "rmse_", "=", "np", ".", "sum", "(", "(", "y", "-", "np", ".", "dot", "(", "X", ",", "coef_", ")", ")", "**", "2", ")", "return", "coef_", ",", "rmse_" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/linear_model/_bayes.py#L326-L347
bigartm/bigartm
47e37f982de87aa67bfd475ff1f39da696b181b3
3rdparty/protobuf-3.0.0/python/google/protobuf/service_reflection.py
python
_ServiceStubBuilder.BuildServiceStub
(self, cls)
Constructs the stub class. Args: cls: The class that will be constructed.
Constructs the stub class.
[ "Constructs", "the", "stub", "class", "." ]
def BuildServiceStub(self, cls): """Constructs the stub class. Args: cls: The class that will be constructed. """ def _ServiceStubInit(stub, rpc_channel): stub.rpc_channel = rpc_channel self.cls = cls cls.__init__ = _ServiceStubInit for method in self.descriptor.methods: setattr(cls, method.name, self._GenerateStubMethod(method))
[ "def", "BuildServiceStub", "(", "self", ",", "cls", ")", ":", "def", "_ServiceStubInit", "(", "stub", ",", "rpc_channel", ")", ":", "stub", ".", "rpc_channel", "=", "rpc_channel", "self", ".", "cls", "=", "cls", "cls", ".", "__init__", "=", "_ServiceStubInit", "for", "method", "in", "self", ".", "descriptor", ".", "methods", ":", "setattr", "(", "cls", ",", "method", ".", "name", ",", "self", ".", "_GenerateStubMethod", "(", "method", ")", ")" ]
https://github.com/bigartm/bigartm/blob/47e37f982de87aa67bfd475ff1f39da696b181b3/3rdparty/protobuf-3.0.0/python/google/protobuf/service_reflection.py#L251-L263
BitMEX/api-connectors
37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812
auto-generated/python/swagger_client/api/execution_api.py
python
ExecutionApi.execution_get_with_http_info
(self, **kwargs)
return self.api_client.call_api( '/execution', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Execution]', # noqa: E501 auth_settings=auth_settings, async_req=params.get('async_req'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats)
Get all raw executions for your account. # noqa: E501 This returns all raw transactions, which includes order opening and cancelation, and order status changes. It can be quite noisy. More focused information is available at `/execution/tradeHistory`. You may also use the `filter` param to target your query. Specify an array as a filter value, such as `{\"execType\": [\"Settlement\", \"Trade\"]}` to filter on multiple values. See [the FIX Spec](http://www.onixs.biz/fix-dictionary/5.0.SP2/msgType_8_8.html) for explanations of these fields. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.execution_get_with_http_info(async_req=True) >>> result = thread.get() :param async_req bool :param str symbol: Instrument symbol. Send a bare series (e.g. XBT) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBT:quarterly`. Timeframes are `nearest`, `daily`, `weekly`, `monthly`, `quarterly`, `biquarterly`, and `perpetual`. :param str filter: Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#Timestamp-Filters) for more details. :param str columns: Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect. :param float count: Number of results to fetch. :param float start: Starting point for results. :param bool reverse: If true, will sort results newest first. :param datetime start_time: Starting date filter for results. :param datetime end_time: Ending date filter for results. :return: list[Execution] If the method is called asynchronously, returns the request thread.
Get all raw executions for your account. # noqa: E501
[ "Get", "all", "raw", "executions", "for", "your", "account", ".", "#", "noqa", ":", "E501" ]
def execution_get_with_http_info(self, **kwargs): # noqa: E501 """Get all raw executions for your account. # noqa: E501 This returns all raw transactions, which includes order opening and cancelation, and order status changes. It can be quite noisy. More focused information is available at `/execution/tradeHistory`. You may also use the `filter` param to target your query. Specify an array as a filter value, such as `{\"execType\": [\"Settlement\", \"Trade\"]}` to filter on multiple values. See [the FIX Spec](http://www.onixs.biz/fix-dictionary/5.0.SP2/msgType_8_8.html) for explanations of these fields. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.execution_get_with_http_info(async_req=True) >>> result = thread.get() :param async_req bool :param str symbol: Instrument symbol. Send a bare series (e.g. XBT) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBT:quarterly`. Timeframes are `nearest`, `daily`, `weekly`, `monthly`, `quarterly`, `biquarterly`, and `perpetual`. :param str filter: Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#Timestamp-Filters) for more details. :param str columns: Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect. :param float count: Number of results to fetch. :param float start: Starting point for results. :param bool reverse: If true, will sort results newest first. :param datetime start_time: Starting date filter for results. :param datetime end_time: Ending date filter for results. :return: list[Execution] If the method is called asynchronously, returns the request thread. """ all_params = ['symbol', 'filter', 'columns', 'count', 'start', 'reverse', 'start_time', 'end_time'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method execution_get" % key ) params[key] = val del params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'symbol' in params: query_params.append(('symbol', params['symbol'])) # noqa: E501 if 'filter' in params: query_params.append(('filter', params['filter'])) # noqa: E501 if 'columns' in params: query_params.append(('columns', params['columns'])) # noqa: E501 if 'count' in params: query_params.append(('count', params['count'])) # noqa: E501 if 'start' in params: query_params.append(('start', params['start'])) # noqa: E501 if 'reverse' in params: query_params.append(('reverse', params['reverse'])) # noqa: E501 if 'start_time' in params: query_params.append(('startTime', params['start_time'])) # noqa: E501 if 'end_time' in params: query_params.append(('endTime', params['end_time'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json', 'application/x-www-form-urlencoded']) # noqa: E501 # Authentication setting auth_settings = ['apiExpires', 'apiKey', 'apiSignature'] # noqa: E501 return self.api_client.call_api( '/execution', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Execution]', # noqa: E501 auth_settings=auth_settings, async_req=params.get('async_req'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats)
[ "def", "execution_get_with_http_info", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "all_params", "=", "[", "'symbol'", ",", "'filter'", ",", "'columns'", ",", "'count'", ",", "'start'", ",", "'reverse'", ",", "'start_time'", ",", "'end_time'", "]", "# noqa: E501", "all_params", ".", "append", "(", "'async_req'", ")", "all_params", ".", "append", "(", "'_return_http_data_only'", ")", "all_params", ".", "append", "(", "'_preload_content'", ")", "all_params", ".", "append", "(", "'_request_timeout'", ")", "params", "=", "locals", "(", ")", "for", "key", ",", "val", "in", "six", ".", "iteritems", "(", "params", "[", "'kwargs'", "]", ")", ":", "if", "key", "not", "in", "all_params", ":", "raise", "TypeError", "(", "\"Got an unexpected keyword argument '%s'\"", "\" to method execution_get\"", "%", "key", ")", "params", "[", "key", "]", "=", "val", "del", "params", "[", "'kwargs'", "]", "collection_formats", "=", "{", "}", "path_params", "=", "{", "}", "query_params", "=", "[", "]", "if", "'symbol'", "in", "params", ":", "query_params", ".", "append", "(", "(", "'symbol'", ",", "params", "[", "'symbol'", "]", ")", ")", "# noqa: E501", "if", "'filter'", "in", "params", ":", "query_params", ".", "append", "(", "(", "'filter'", ",", "params", "[", "'filter'", "]", ")", ")", "# noqa: E501", "if", "'columns'", "in", "params", ":", "query_params", ".", "append", "(", "(", "'columns'", ",", "params", "[", "'columns'", "]", ")", ")", "# noqa: E501", "if", "'count'", "in", "params", ":", "query_params", ".", "append", "(", "(", "'count'", ",", "params", "[", "'count'", "]", ")", ")", "# noqa: E501", "if", "'start'", "in", "params", ":", "query_params", ".", "append", "(", "(", "'start'", ",", "params", "[", "'start'", "]", ")", ")", "# noqa: E501", "if", "'reverse'", "in", "params", ":", "query_params", ".", "append", "(", "(", "'reverse'", ",", "params", "[", "'reverse'", "]", ")", ")", "# noqa: E501", "if", "'start_time'", "in", "params", ":", "query_params", ".", "append", "(", "(", "'startTime'", ",", "params", "[", "'start_time'", "]", ")", ")", "# noqa: E501", "if", "'end_time'", "in", "params", ":", "query_params", ".", "append", "(", "(", "'endTime'", ",", "params", "[", "'end_time'", "]", ")", ")", "# noqa: E501", "header_params", "=", "{", "}", "form_params", "=", "[", "]", "local_var_files", "=", "{", "}", "body_params", "=", "None", "# HTTP header `Accept`", "header_params", "[", "'Accept'", "]", "=", "self", ".", "api_client", ".", "select_header_accept", "(", "[", "'application/json'", ",", "'application/xml'", ",", "'text/xml'", ",", "'application/javascript'", ",", "'text/javascript'", "]", ")", "# noqa: E501", "# HTTP header `Content-Type`", "header_params", "[", "'Content-Type'", "]", "=", "self", ".", "api_client", ".", "select_header_content_type", "(", "# noqa: E501", "[", "'application/json'", ",", "'application/x-www-form-urlencoded'", "]", ")", "# noqa: E501", "# Authentication setting", "auth_settings", "=", "[", "'apiExpires'", ",", "'apiKey'", ",", "'apiSignature'", "]", "# noqa: E501", "return", "self", ".", "api_client", ".", "call_api", "(", "'/execution'", ",", "'GET'", ",", "path_params", ",", "query_params", ",", "header_params", ",", "body", "=", "body_params", ",", "post_params", "=", "form_params", ",", "files", "=", "local_var_files", ",", "response_type", "=", "'list[Execution]'", ",", "# noqa: E501", "auth_settings", "=", "auth_settings", ",", "async_req", "=", "params", ".", "get", "(", "'async_req'", ")", ",", "_return_http_data_only", "=", "params", ".", "get", "(", "'_return_http_data_only'", ")", ",", "_preload_content", "=", "params", ".", "get", "(", "'_preload_content'", ",", "True", ")", ",", "_request_timeout", "=", "params", ".", "get", "(", "'_request_timeout'", ")", ",", "collection_formats", "=", "collection_formats", ")" ]
https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/api/execution_api.py#L65-L157
xenia-project/xenia
9b1fdac98665ac091b9660a5d0fbb259ed79e578
third_party/google-styleguide/cpplint/cpplint.py
python
ProcessLine
(filename, file_extension, clean_lines, line, include_state, function_state, nesting_state, error, extra_check_functions=[])
Processes a single line in the file. Args: filename: Filename of the file that is being processed. file_extension: The extension (dot not included) of the file. clean_lines: An array of strings, each representing a line of the file, with comments stripped. line: Number of line being processed. include_state: An _IncludeState instance in which the headers are inserted. function_state: A _FunctionState instance which counts function lines, etc. nesting_state: A NestingState instance which maintains information about the current stack of nested blocks being parsed. error: A callable to which errors are reported, which takes 4 arguments: filename, line number, error level, and message extra_check_functions: An array of additional check functions that will be run on each source line. Each function takes 4 arguments: filename, clean_lines, line, error
Processes a single line in the file.
[ "Processes", "a", "single", "line", "in", "the", "file", "." ]
def ProcessLine(filename, file_extension, clean_lines, line, include_state, function_state, nesting_state, error, extra_check_functions=[]): """Processes a single line in the file. Args: filename: Filename of the file that is being processed. file_extension: The extension (dot not included) of the file. clean_lines: An array of strings, each representing a line of the file, with comments stripped. line: Number of line being processed. include_state: An _IncludeState instance in which the headers are inserted. function_state: A _FunctionState instance which counts function lines, etc. nesting_state: A NestingState instance which maintains information about the current stack of nested blocks being parsed. error: A callable to which errors are reported, which takes 4 arguments: filename, line number, error level, and message extra_check_functions: An array of additional check functions that will be run on each source line. Each function takes 4 arguments: filename, clean_lines, line, error """ raw_lines = clean_lines.raw_lines ParseNolintSuppressions(filename, raw_lines[line], line, error) nesting_state.Update(filename, clean_lines, line, error) if nesting_state.InAsmBlock(): return CheckForFunctionLengths(filename, clean_lines, line, function_state, error) CheckForMultilineCommentsAndStrings(filename, clean_lines, line, error) CheckStyle(filename, clean_lines, line, file_extension, nesting_state, error) CheckLanguage(filename, clean_lines, line, file_extension, include_state, nesting_state, error) CheckForNonConstReference(filename, clean_lines, line, nesting_state, error) CheckForNonStandardConstructs(filename, clean_lines, line, nesting_state, error) CheckVlogArguments(filename, clean_lines, line, error) CheckPosixThreading(filename, clean_lines, line, error) CheckInvalidIncrement(filename, clean_lines, line, error) CheckMakePairUsesDeduction(filename, clean_lines, line, error) CheckDefaultLambdaCaptures(filename, clean_lines, line, error) for check_fn in extra_check_functions: check_fn(filename, clean_lines, line, error)
[ "def", "ProcessLine", "(", "filename", ",", "file_extension", ",", "clean_lines", ",", "line", ",", "include_state", ",", "function_state", ",", "nesting_state", ",", "error", ",", "extra_check_functions", "=", "[", "]", ")", ":", "raw_lines", "=", "clean_lines", ".", "raw_lines", "ParseNolintSuppressions", "(", "filename", ",", "raw_lines", "[", "line", "]", ",", "line", ",", "error", ")", "nesting_state", ".", "Update", "(", "filename", ",", "clean_lines", ",", "line", ",", "error", ")", "if", "nesting_state", ".", "InAsmBlock", "(", ")", ":", "return", "CheckForFunctionLengths", "(", "filename", ",", "clean_lines", ",", "line", ",", "function_state", ",", "error", ")", "CheckForMultilineCommentsAndStrings", "(", "filename", ",", "clean_lines", ",", "line", ",", "error", ")", "CheckStyle", "(", "filename", ",", "clean_lines", ",", "line", ",", "file_extension", ",", "nesting_state", ",", "error", ")", "CheckLanguage", "(", "filename", ",", "clean_lines", ",", "line", ",", "file_extension", ",", "include_state", ",", "nesting_state", ",", "error", ")", "CheckForNonConstReference", "(", "filename", ",", "clean_lines", ",", "line", ",", "nesting_state", ",", "error", ")", "CheckForNonStandardConstructs", "(", "filename", ",", "clean_lines", ",", "line", ",", "nesting_state", ",", "error", ")", "CheckVlogArguments", "(", "filename", ",", "clean_lines", ",", "line", ",", "error", ")", "CheckPosixThreading", "(", "filename", ",", "clean_lines", ",", "line", ",", "error", ")", "CheckInvalidIncrement", "(", "filename", ",", "clean_lines", ",", "line", ",", "error", ")", "CheckMakePairUsesDeduction", "(", "filename", ",", "clean_lines", ",", "line", ",", "error", ")", "CheckDefaultLambdaCaptures", "(", "filename", ",", "clean_lines", ",", "line", ",", "error", ")", "for", "check_fn", "in", "extra_check_functions", ":", "check_fn", "(", "filename", ",", "clean_lines", ",", "line", ",", "error", ")" ]
https://github.com/xenia-project/xenia/blob/9b1fdac98665ac091b9660a5d0fbb259ed79e578/third_party/google-styleguide/cpplint/cpplint.py#L5291-L5330
rootm0s/Protectors
5b3f4d11687a5955caf9c3af30666c4bfc2c19ab
OWASP-ZSC/module/readline_windows/pyreadline/modes/notemacs.py
python
NotEmacsMode.backward_char
(self, e)
Move back a character.
Move back a character.
[ "Move", "back", "a", "character", "." ]
def backward_char(self, e): # (C-b) '''Move back a character. ''' self.l_buffer.backward_char()
[ "def", "backward_char", "(", "self", ",", "e", ")", ":", "# (C-b)", "self", ".", "l_buffer", ".", "backward_char", "(", ")" ]
https://github.com/rootm0s/Protectors/blob/5b3f4d11687a5955caf9c3af30666c4bfc2c19ab/OWASP-ZSC/module/readline_windows/pyreadline/modes/notemacs.py#L110-L112
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/dataset/engine/datasets.py
python
Dataset.is_sharded
(self)
return False
Returns True if the dataset or its children is sharded.
Returns True if the dataset or its children is sharded.
[ "Returns", "True", "if", "the", "dataset", "or", "its", "children", "is", "sharded", "." ]
def is_sharded(self): """Returns True if the dataset or its children is sharded.""" for input_dataset in self.children: if input_dataset.is_sharded(): return True return False
[ "def", "is_sharded", "(", "self", ")", ":", "for", "input_dataset", "in", "self", ".", "children", ":", "if", "input_dataset", ".", "is_sharded", "(", ")", ":", "return", "True", "return", "False" ]
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/engine/datasets.py#L1797-L1803
keyboardio/Kaleidoscope
d59604e98b2439d108647f15be52984a6837d360
bin/cpplint.py
python
_CppLintState.AddFilters
(self, filters)
Adds more filters to the existing list of error-message filters.
Adds more filters to the existing list of error-message filters.
[ "Adds", "more", "filters", "to", "the", "existing", "list", "of", "error", "-", "message", "filters", "." ]
def AddFilters(self, filters): """ Adds more filters to the existing list of error-message filters. """ for filt in filters.split(','): clean_filt = filt.strip() if clean_filt: self.filters.append(clean_filt) for filt in self.filters: if not (filt.startswith('+') or filt.startswith('-')): raise ValueError('Every filter in --filters must start with + or -' ' (%s does not)' % filt)
[ "def", "AddFilters", "(", "self", ",", "filters", ")", ":", "for", "filt", "in", "filters", ".", "split", "(", "','", ")", ":", "clean_filt", "=", "filt", ".", "strip", "(", ")", "if", "clean_filt", ":", "self", ".", "filters", ".", "append", "(", "clean_filt", ")", "for", "filt", "in", "self", ".", "filters", ":", "if", "not", "(", "filt", ".", "startswith", "(", "'+'", ")", "or", "filt", ".", "startswith", "(", "'-'", ")", ")", ":", "raise", "ValueError", "(", "'Every filter in --filters must start with + or -'", "' (%s does not)'", "%", "filt", ")" ]
https://github.com/keyboardio/Kaleidoscope/blob/d59604e98b2439d108647f15be52984a6837d360/bin/cpplint.py#L1059-L1068
google/shaka-packager
e1b0c7c45431327fd3ce193514a5407d07b39b22
packager/third_party/protobuf/python/google/protobuf/symbol_database.py
python
SymbolDatabase.RegisterFileDescriptor
(self, file_descriptor)
Registers the given file descriptor in the local database. Args: file_descriptor: a descriptor.FileDescriptor. Returns: The provided descriptor.
Registers the given file descriptor in the local database.
[ "Registers", "the", "given", "file", "descriptor", "in", "the", "local", "database", "." ]
def RegisterFileDescriptor(self, file_descriptor): """Registers the given file descriptor in the local database. Args: file_descriptor: a descriptor.FileDescriptor. Returns: The provided descriptor. """ self.pool.AddFileDescriptor(file_descriptor)
[ "def", "RegisterFileDescriptor", "(", "self", ",", "file_descriptor", ")", ":", "self", ".", "pool", ".", "AddFileDescriptor", "(", "file_descriptor", ")" ]
https://github.com/google/shaka-packager/blob/e1b0c7c45431327fd3ce193514a5407d07b39b22/packager/third_party/protobuf/python/google/protobuf/symbol_database.py#L108-L117
LiquidPlayer/LiquidCore
9405979363f2353ac9a71ad8ab59685dd7f919c9
deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py
python
MakefileWriter.ComputeOutputBasename
(self, spec)
return target_prefix + target + target_ext
Return the 'output basename' of a gyp spec. E.g., the loadable module 'foobar' in directory 'baz' will produce 'libfoobar.so'
Return the 'output basename' of a gyp spec.
[ "Return", "the", "output", "basename", "of", "a", "gyp", "spec", "." ]
def ComputeOutputBasename(self, spec): """Return the 'output basename' of a gyp spec. E.g., the loadable module 'foobar' in directory 'baz' will produce 'libfoobar.so' """ assert not self.is_mac_bundle if self.flavor == 'mac' and self.type in ( 'static_library', 'executable', 'shared_library', 'loadable_module'): return self.xcode_settings.GetExecutablePath() target = spec['target_name'] target_prefix = '' target_ext = '' if self.type == 'static_library': if target[:3] == 'lib': target = target[3:] target_prefix = 'lib' target_ext = '.a' elif self.type in ('loadable_module', 'shared_library'): if target[:3] == 'lib': target = target[3:] target_prefix = 'lib' if self.flavor == 'aix': target_ext = '.a' else: target_ext = '.so' elif self.type == 'none': target = '%s.stamp' % target elif self.type != 'executable': print ("ERROR: What output file should be generated?", "type", self.type, "target", target) target_prefix = spec.get('product_prefix', target_prefix) target = spec.get('product_name', target) product_ext = spec.get('product_extension') if product_ext: target_ext = '.' + product_ext return target_prefix + target + target_ext
[ "def", "ComputeOutputBasename", "(", "self", ",", "spec", ")", ":", "assert", "not", "self", ".", "is_mac_bundle", "if", "self", ".", "flavor", "==", "'mac'", "and", "self", ".", "type", "in", "(", "'static_library'", ",", "'executable'", ",", "'shared_library'", ",", "'loadable_module'", ")", ":", "return", "self", ".", "xcode_settings", ".", "GetExecutablePath", "(", ")", "target", "=", "spec", "[", "'target_name'", "]", "target_prefix", "=", "''", "target_ext", "=", "''", "if", "self", ".", "type", "==", "'static_library'", ":", "if", "target", "[", ":", "3", "]", "==", "'lib'", ":", "target", "=", "target", "[", "3", ":", "]", "target_prefix", "=", "'lib'", "target_ext", "=", "'.a'", "elif", "self", ".", "type", "in", "(", "'loadable_module'", ",", "'shared_library'", ")", ":", "if", "target", "[", ":", "3", "]", "==", "'lib'", ":", "target", "=", "target", "[", "3", ":", "]", "target_prefix", "=", "'lib'", "if", "self", ".", "flavor", "==", "'aix'", ":", "target_ext", "=", "'.a'", "else", ":", "target_ext", "=", "'.so'", "elif", "self", ".", "type", "==", "'none'", ":", "target", "=", "'%s.stamp'", "%", "target", "elif", "self", ".", "type", "!=", "'executable'", ":", "print", "(", "\"ERROR: What output file should be generated?\"", ",", "\"type\"", ",", "self", ".", "type", ",", "\"target\"", ",", "target", ")", "target_prefix", "=", "spec", ".", "get", "(", "'product_prefix'", ",", "target_prefix", ")", "target", "=", "spec", ".", "get", "(", "'product_name'", ",", "target", ")", "product_ext", "=", "spec", ".", "get", "(", "'product_extension'", ")", "if", "product_ext", ":", "target_ext", "=", "'.'", "+", "product_ext", "return", "target_prefix", "+", "target", "+", "target_ext" ]
https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py#L1353-L1393
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/iobench/iobench.py
python
modify_small_chunks
(f, source)
modify 20 units at a time
modify 20 units at a time
[ "modify", "20", "units", "at", "a", "time" ]
def modify_small_chunks(f, source): """ modify 20 units at a time """ f.seek(0) for i in xrange(0, len(source), 20): f.write(source[i:i+20])
[ "def", "modify_small_chunks", "(", "f", ",", "source", ")", ":", "f", ".", "seek", "(", "0", ")", "for", "i", "in", "xrange", "(", "0", ",", "len", "(", "source", ")", ",", "20", ")", ":", "f", ".", "write", "(", "source", "[", "i", ":", "i", "+", "20", "]", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/iobench/iobench.py#L175-L179
SFTtech/openage
d6a08c53c48dc1e157807471df92197f6ca9e04d
openage/convert/value_object/read/media/datfile/unit.py
python
UnitCommand.get_data_format_members
(cls, game_version)
return data_format
Return the members in this struct.
Return the members in this struct.
[ "Return", "the", "members", "in", "this", "struct", "." ]
def get_data_format_members(cls, game_version): """ Return the members in this struct. """ data_format = [ # Type (0 = Generic, 1 = Tribe) (READ_GEN, "command_used", StorageType.INT_MEMBER, "int16_t"), (READ_GEN, "command_id", StorageType.ID_MEMBER, "int16_t"), (SKIP, "is_default", StorageType.BOOLEAN_MEMBER, "int8_t"), (READ_GEN, "type", StorageType.ID_MEMBER, EnumLookupMember( raw_type="int16_t", type_name="command_ability", lookup_dict=COMMAND_ABILITY )), (READ_GEN, "class_id", StorageType.ID_MEMBER, "int16_t"), (READ_GEN, "unit_id", StorageType.ID_MEMBER, "int16_t"), (READ_GEN, "terrain_id", StorageType.ID_MEMBER, "int16_t"), (READ_GEN, "resource_in", StorageType.INT_MEMBER, "int16_t"), # carry resource # resource that multiplies the amount you can gather (READ_GEN, "resource_multiplier", StorageType.INT_MEMBER, "int16_t"), (READ_GEN, "resource_out", StorageType.INT_MEMBER, "int16_t"), # drop resource (SKIP, "unused_resource", StorageType.INT_MEMBER, "int16_t"), (READ_GEN, "work_value1", StorageType.FLOAT_MEMBER, "float"), # quantity (READ_GEN, "work_value2", StorageType.FLOAT_MEMBER, "float"), # execution radius? (READ_GEN, "work_range", StorageType.FLOAT_MEMBER, "float"), (READ_GEN, "search_mode", StorageType.BOOLEAN_MEMBER, "int8_t"), (READ_GEN, "search_time", StorageType.FLOAT_MEMBER, "float"), (READ_GEN, "enable_targeting", StorageType.BOOLEAN_MEMBER, "int8_t"), (READ_GEN, "combat_level_flag", StorageType.ID_MEMBER, "int8_t"), (READ_GEN, "gather_type", StorageType.INT_MEMBER, "int16_t"), (READ, "work_mode2", StorageType.INT_MEMBER, "int16_t"), (READ_GEN, "owner_type", StorageType.ID_MEMBER, EnumLookupMember( # what can be selected as a target for the unit command? raw_type="int8_t", type_name="selection_type", lookup_dict=OWNER_TYPE )), # checks if the targeted unit has > 0 resources (READ_GEN, "carry_check", StorageType.BOOLEAN_MEMBER, "int8_t"), (READ_GEN, "state_build", StorageType.BOOLEAN_MEMBER, "int8_t"), # walking with tool but no resource (READ_GEN, "move_sprite_id", StorageType.ID_MEMBER, "int16_t"), # proceeding resource gathering or attack (READ_GEN, "proceed_sprite_id", StorageType.ID_MEMBER, "int16_t"), # actual execution or transformation graphic (READ_GEN, "work_sprite_id", StorageType.ID_MEMBER, "int16_t"), # display resources in hands (READ_GEN, "carry_sprite_id", StorageType.ID_MEMBER, "int16_t"), # sound to play when execution starts (READ_GEN, "resource_gather_sound_id", StorageType.ID_MEMBER, "int16_t"), # sound to play on resource drop (READ_GEN, "resource_deposit_sound_id", StorageType.ID_MEMBER, "int16_t"), ] if game_version[0].game_id == "AOE2DE": data_format.extend([ (READ_GEN, "wwise_resource_gather_sound_id", StorageType.ID_MEMBER, "uint32_t"), # sound to play on resource drop (READ_GEN, "wwise_resource_deposit_sound_id", StorageType.ID_MEMBER, "uint32_t"), ]) return data_format
[ "def", "get_data_format_members", "(", "cls", ",", "game_version", ")", ":", "data_format", "=", "[", "# Type (0 = Generic, 1 = Tribe)", "(", "READ_GEN", ",", "\"command_used\"", ",", "StorageType", ".", "INT_MEMBER", ",", "\"int16_t\"", ")", ",", "(", "READ_GEN", ",", "\"command_id\"", ",", "StorageType", ".", "ID_MEMBER", ",", "\"int16_t\"", ")", ",", "(", "SKIP", ",", "\"is_default\"", ",", "StorageType", ".", "BOOLEAN_MEMBER", ",", "\"int8_t\"", ")", ",", "(", "READ_GEN", ",", "\"type\"", ",", "StorageType", ".", "ID_MEMBER", ",", "EnumLookupMember", "(", "raw_type", "=", "\"int16_t\"", ",", "type_name", "=", "\"command_ability\"", ",", "lookup_dict", "=", "COMMAND_ABILITY", ")", ")", ",", "(", "READ_GEN", ",", "\"class_id\"", ",", "StorageType", ".", "ID_MEMBER", ",", "\"int16_t\"", ")", ",", "(", "READ_GEN", ",", "\"unit_id\"", ",", "StorageType", ".", "ID_MEMBER", ",", "\"int16_t\"", ")", ",", "(", "READ_GEN", ",", "\"terrain_id\"", ",", "StorageType", ".", "ID_MEMBER", ",", "\"int16_t\"", ")", ",", "(", "READ_GEN", ",", "\"resource_in\"", ",", "StorageType", ".", "INT_MEMBER", ",", "\"int16_t\"", ")", ",", "# carry resource", "# resource that multiplies the amount you can gather", "(", "READ_GEN", ",", "\"resource_multiplier\"", ",", "StorageType", ".", "INT_MEMBER", ",", "\"int16_t\"", ")", ",", "(", "READ_GEN", ",", "\"resource_out\"", ",", "StorageType", ".", "INT_MEMBER", ",", "\"int16_t\"", ")", ",", "# drop resource", "(", "SKIP", ",", "\"unused_resource\"", ",", "StorageType", ".", "INT_MEMBER", ",", "\"int16_t\"", ")", ",", "(", "READ_GEN", ",", "\"work_value1\"", ",", "StorageType", ".", "FLOAT_MEMBER", ",", "\"float\"", ")", ",", "# quantity", "(", "READ_GEN", ",", "\"work_value2\"", ",", "StorageType", ".", "FLOAT_MEMBER", ",", "\"float\"", ")", ",", "# execution radius?", "(", "READ_GEN", ",", "\"work_range\"", ",", "StorageType", ".", "FLOAT_MEMBER", ",", "\"float\"", ")", ",", "(", "READ_GEN", ",", "\"search_mode\"", ",", "StorageType", ".", "BOOLEAN_MEMBER", ",", "\"int8_t\"", ")", ",", "(", "READ_GEN", ",", "\"search_time\"", ",", "StorageType", ".", "FLOAT_MEMBER", ",", "\"float\"", ")", ",", "(", "READ_GEN", ",", "\"enable_targeting\"", ",", "StorageType", ".", "BOOLEAN_MEMBER", ",", "\"int8_t\"", ")", ",", "(", "READ_GEN", ",", "\"combat_level_flag\"", ",", "StorageType", ".", "ID_MEMBER", ",", "\"int8_t\"", ")", ",", "(", "READ_GEN", ",", "\"gather_type\"", ",", "StorageType", ".", "INT_MEMBER", ",", "\"int16_t\"", ")", ",", "(", "READ", ",", "\"work_mode2\"", ",", "StorageType", ".", "INT_MEMBER", ",", "\"int16_t\"", ")", ",", "(", "READ_GEN", ",", "\"owner_type\"", ",", "StorageType", ".", "ID_MEMBER", ",", "EnumLookupMember", "(", "# what can be selected as a target for the unit command?", "raw_type", "=", "\"int8_t\"", ",", "type_name", "=", "\"selection_type\"", ",", "lookup_dict", "=", "OWNER_TYPE", ")", ")", ",", "# checks if the targeted unit has > 0 resources", "(", "READ_GEN", ",", "\"carry_check\"", ",", "StorageType", ".", "BOOLEAN_MEMBER", ",", "\"int8_t\"", ")", ",", "(", "READ_GEN", ",", "\"state_build\"", ",", "StorageType", ".", "BOOLEAN_MEMBER", ",", "\"int8_t\"", ")", ",", "# walking with tool but no resource", "(", "READ_GEN", ",", "\"move_sprite_id\"", ",", "StorageType", ".", "ID_MEMBER", ",", "\"int16_t\"", ")", ",", "# proceeding resource gathering or attack", "(", "READ_GEN", ",", "\"proceed_sprite_id\"", ",", "StorageType", ".", "ID_MEMBER", ",", "\"int16_t\"", ")", ",", "# actual execution or transformation graphic", "(", "READ_GEN", ",", "\"work_sprite_id\"", ",", "StorageType", ".", "ID_MEMBER", ",", "\"int16_t\"", ")", ",", "# display resources in hands", "(", "READ_GEN", ",", "\"carry_sprite_id\"", ",", "StorageType", ".", "ID_MEMBER", ",", "\"int16_t\"", ")", ",", "# sound to play when execution starts", "(", "READ_GEN", ",", "\"resource_gather_sound_id\"", ",", "StorageType", ".", "ID_MEMBER", ",", "\"int16_t\"", ")", ",", "# sound to play on resource drop", "(", "READ_GEN", ",", "\"resource_deposit_sound_id\"", ",", "StorageType", ".", "ID_MEMBER", ",", "\"int16_t\"", ")", ",", "]", "if", "game_version", "[", "0", "]", ".", "game_id", "==", "\"AOE2DE\"", ":", "data_format", ".", "extend", "(", "[", "(", "READ_GEN", ",", "\"wwise_resource_gather_sound_id\"", ",", "StorageType", ".", "ID_MEMBER", ",", "\"uint32_t\"", ")", ",", "# sound to play on resource drop", "(", "READ_GEN", ",", "\"wwise_resource_deposit_sound_id\"", ",", "StorageType", ".", "ID_MEMBER", ",", "\"uint32_t\"", ")", ",", "]", ")", "return", "data_format" ]
https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/value_object/read/media/datfile/unit.py#L24-L85
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/scipy/linalg/interpolative.py
python
rand
(*shape)
return backend.id_srand(np.prod(shape)).reshape(shape)
Generate standard uniform pseudorandom numbers via a very efficient lagged Fibonacci method. This routine is used for all random number generation in this package and can affect ID and SVD results. Parameters ---------- shape Shape of output array
Generate standard uniform pseudorandom numbers via a very efficient lagged Fibonacci method.
[ "Generate", "standard", "uniform", "pseudorandom", "numbers", "via", "a", "very", "efficient", "lagged", "Fibonacci", "method", "." ]
def rand(*shape): """ Generate standard uniform pseudorandom numbers via a very efficient lagged Fibonacci method. This routine is used for all random number generation in this package and can affect ID and SVD results. Parameters ---------- shape Shape of output array """ # For details, see :func:`backend.id_srand`, and :func:`backend.id_srando`. return backend.id_srand(np.prod(shape)).reshape(shape)
[ "def", "rand", "(", "*", "shape", ")", ":", "# For details, see :func:`backend.id_srand`, and :func:`backend.id_srando`.", "return", "backend", ".", "id_srand", "(", "np", ".", "prod", "(", "shape", ")", ")", ".", "reshape", "(", "shape", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/linalg/interpolative.py#L447-L462
y123456yz/reading-and-annotate-mongodb-3.6
93280293672ca7586dc24af18132aa61e4ed7fcf
mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Node/__init__.py
python
Node.add_wkid
(self, wkid)
Add a node to the list of kids waiting to be evaluated
Add a node to the list of kids waiting to be evaluated
[ "Add", "a", "node", "to", "the", "list", "of", "kids", "waiting", "to", "be", "evaluated" ]
def add_wkid(self, wkid): """Add a node to the list of kids waiting to be evaluated""" if self.wkids is not None: self.wkids.append(wkid)
[ "def", "add_wkid", "(", "self", ",", "wkid", ")", ":", "if", "self", ".", "wkids", "is", "not", "None", ":", "self", ".", "wkids", ".", "append", "(", "wkid", ")" ]
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/Node/__init__.py#L1299-L1302
sailing-pmls/bosen
06cb58902d011fbea5f9428f10ce30e621492204
style_script/cpplint.py
python
FileInfo.NoExtension
(self)
return '/'.join(self.Split()[0:2])
File has no source file extension.
File has no source file extension.
[ "File", "has", "no", "source", "file", "extension", "." ]
def NoExtension(self): """File has no source file extension.""" return '/'.join(self.Split()[0:2])
[ "def", "NoExtension", "(", "self", ")", ":", "return", "'/'", ".", "join", "(", "self", ".", "Split", "(", ")", "[", "0", ":", "2", "]", ")" ]
https://github.com/sailing-pmls/bosen/blob/06cb58902d011fbea5f9428f10ce30e621492204/style_script/cpplint.py#L1055-L1057
msftguy/ssh-rd
a5f3a79daeac5844edebf01916c9613563f1c390
_3rd/boost_1_48_0/tools/build/v2/build/feature.py
python
Feature.parent
(self)
return self._parent
For subfeatures, return pair of (parent_feature, value). Value may be None if this subfeature is not specific to any value of the parent feature.
For subfeatures, return pair of (parent_feature, value).
[ "For", "subfeatures", "return", "pair", "of", "(", "parent_feature", "value", ")", "." ]
def parent(self): """For subfeatures, return pair of (parent_feature, value). Value may be None if this subfeature is not specific to any value of the parent feature. """ return self._parent
[ "def", "parent", "(", "self", ")", ":", "return", "self", ".", "_parent" ]
https://github.com/msftguy/ssh-rd/blob/a5f3a79daeac5844edebf01916c9613563f1c390/_3rd/boost_1_48_0/tools/build/v2/build/feature.py#L66-L72
dmlc/treelite
df56babb6a4a2d7c29d719c28ce53acfa7dbab3c
python/treelite/sklearn/gbm_classifier.py
python
SKLGBMClassifierMixin.process_model
(cls, sklearn_model)
return builder.commit()
Process a GradientBoostingClassifier (binary classifier) to convert it into a Treelite model
Process a GradientBoostingClassifier (binary classifier) to convert it into a Treelite model
[ "Process", "a", "GradientBoostingClassifier", "(", "binary", "classifier", ")", "to", "convert", "it", "into", "a", "Treelite", "model" ]
def process_model(cls, sklearn_model): """Process a GradientBoostingClassifier (binary classifier) to convert it into a Treelite model""" # Check for init='zero' if sklearn_model.init != 'zero': raise treelite.TreeliteError("Gradient boosted trees must be trained with " "the option init='zero'") # Initialize Treelite model builder # Set average_tree_output=False for gradient boosted trees # Set pred_transform='sigmoid' to obtain probability predictions builder = treelite.ModelBuilder( num_feature=sklearn_model.n_features_, average_tree_output=False, pred_transform='sigmoid', threshold_type='float64', leaf_output_type='float64') for i in range(sklearn_model.n_estimators): # Process i-th tree and add to the builder builder.append(cls.process_tree(sklearn_model.estimators_[i][0].tree_, sklearn_model)) return builder.commit()
[ "def", "process_model", "(", "cls", ",", "sklearn_model", ")", ":", "# Check for init='zero'", "if", "sklearn_model", ".", "init", "!=", "'zero'", ":", "raise", "treelite", ".", "TreeliteError", "(", "\"Gradient boosted trees must be trained with \"", "\"the option init='zero'\"", ")", "# Initialize Treelite model builder", "# Set average_tree_output=False for gradient boosted trees", "# Set pred_transform='sigmoid' to obtain probability predictions", "builder", "=", "treelite", ".", "ModelBuilder", "(", "num_feature", "=", "sklearn_model", ".", "n_features_", ",", "average_tree_output", "=", "False", ",", "pred_transform", "=", "'sigmoid'", ",", "threshold_type", "=", "'float64'", ",", "leaf_output_type", "=", "'float64'", ")", "for", "i", "in", "range", "(", "sklearn_model", ".", "n_estimators", ")", ":", "# Process i-th tree and add to the builder", "builder", ".", "append", "(", "cls", ".", "process_tree", "(", "sklearn_model", ".", "estimators_", "[", "i", "]", "[", "0", "]", ".", "tree_", ",", "sklearn_model", ")", ")", "return", "builder", ".", "commit", "(", ")" ]
https://github.com/dmlc/treelite/blob/df56babb6a4a2d7c29d719c28ce53acfa7dbab3c/python/treelite/sklearn/gbm_classifier.py#L10-L28
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/_windows.py
python
Dialog.SetLayoutAdaptationLevel
(*args, **kwargs)
return _windows_.Dialog_SetLayoutAdaptationLevel(*args, **kwargs)
SetLayoutAdaptationLevel(self, int level)
SetLayoutAdaptationLevel(self, int level)
[ "SetLayoutAdaptationLevel", "(", "self", "int", "level", ")" ]
def SetLayoutAdaptationLevel(*args, **kwargs): """SetLayoutAdaptationLevel(self, int level)""" return _windows_.Dialog_SetLayoutAdaptationLevel(*args, **kwargs)
[ "def", "SetLayoutAdaptationLevel", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_windows_", ".", "Dialog_SetLayoutAdaptationLevel", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L843-L845
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/cudadrv/driver.py
python
Driver.reset
(self)
Reset all devices
Reset all devices
[ "Reset", "all", "devices" ]
def reset(self): """Reset all devices """ for dev in self.devices.values(): dev.reset()
[ "def", "reset", "(", "self", ")", ":", "for", "dev", "in", "self", ".", "devices", ".", "values", "(", ")", ":", "dev", ".", "reset", "(", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/cudadrv/driver.py#L348-L352
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/telemetry/build/linux_setup_msr.py
python
_CheckMsrKernelModule
()
return True
Return whether the 'msr' kernel module is loaded.
Return whether the 'msr' kernel module is loaded.
[ "Return", "whether", "the", "msr", "kernel", "module", "is", "loaded", "." ]
def _CheckMsrKernelModule(): """Return whether the 'msr' kernel module is loaded.""" proc = subprocess.Popen('/sbin/lsmod', stdout=subprocess.PIPE) stdout = proc.communicate()[0] ret = proc.wait() if ret != 0: raise OSError('lsmod failed') if not any([line.startswith('msr ') for line in stdout.splitlines()]): print 'Error: MSR module not loaded.' return False return True
[ "def", "_CheckMsrKernelModule", "(", ")", ":", "proc", "=", "subprocess", ".", "Popen", "(", "'/sbin/lsmod'", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", "stdout", "=", "proc", ".", "communicate", "(", ")", "[", "0", "]", "ret", "=", "proc", ".", "wait", "(", ")", "if", "ret", "!=", "0", ":", "raise", "OSError", "(", "'lsmod failed'", ")", "if", "not", "any", "(", "[", "line", ".", "startswith", "(", "'msr '", ")", "for", "line", "in", "stdout", ".", "splitlines", "(", ")", "]", ")", ":", "print", "'Error: MSR module not loaded.'", "return", "False", "return", "True" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/build/linux_setup_msr.py#L30-L42
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/ed_vim.py
python
EditraCommander.FindTillNextChar
(self, char, repeat)
Similar to FindNextChar, but stop one character short
Similar to FindNextChar, but stop one character short
[ "Similar", "to", "FindNextChar", "but", "stop", "one", "character", "short" ]
def FindTillNextChar(self, char, repeat): """Similar to FindNextChar, but stop one character short""" self.stc.FindChar(char, repeat, extra_offset=-1)
[ "def", "FindTillNextChar", "(", "self", ",", "char", ",", "repeat", ")", ":", "self", ".", "stc", ".", "FindChar", "(", "char", ",", "repeat", ",", "extra_offset", "=", "-", "1", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_vim.py#L736-L738
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py2/pandas/core/indexes/base.py
python
ensure_index_from_sequences
(sequences, names=None)
Construct an index from sequences of data. A single sequence returns an Index. Many sequences returns a MultiIndex. Parameters ---------- sequences : sequence of sequences names : sequence of str Returns ------- index : Index or MultiIndex Examples -------- >>> ensure_index_from_sequences([[1, 2, 3]], names=['name']) Int64Index([1, 2, 3], dtype='int64', name='name') >>> ensure_index_from_sequences([['a', 'a'], ['a', 'b']], names=['L1', 'L2']) MultiIndex(levels=[['a'], ['a', 'b']], codes=[[0, 0], [0, 1]], names=['L1', 'L2']) See Also -------- ensure_index
Construct an index from sequences of data.
[ "Construct", "an", "index", "from", "sequences", "of", "data", "." ]
def ensure_index_from_sequences(sequences, names=None): """ Construct an index from sequences of data. A single sequence returns an Index. Many sequences returns a MultiIndex. Parameters ---------- sequences : sequence of sequences names : sequence of str Returns ------- index : Index or MultiIndex Examples -------- >>> ensure_index_from_sequences([[1, 2, 3]], names=['name']) Int64Index([1, 2, 3], dtype='int64', name='name') >>> ensure_index_from_sequences([['a', 'a'], ['a', 'b']], names=['L1', 'L2']) MultiIndex(levels=[['a'], ['a', 'b']], codes=[[0, 0], [0, 1]], names=['L1', 'L2']) See Also -------- ensure_index """ from .multi import MultiIndex if len(sequences) == 1: if names is not None: names = names[0] return Index(sequences[0], name=names) else: return MultiIndex.from_arrays(sequences, names=names)
[ "def", "ensure_index_from_sequences", "(", "sequences", ",", "names", "=", "None", ")", ":", "from", ".", "multi", "import", "MultiIndex", "if", "len", "(", "sequences", ")", "==", "1", ":", "if", "names", "is", "not", "None", ":", "names", "=", "names", "[", "0", "]", "return", "Index", "(", "sequences", "[", "0", "]", ",", "name", "=", "names", ")", "else", ":", "return", "MultiIndex", ".", "from_arrays", "(", "sequences", ",", "names", "=", "names", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/indexes/base.py#L5277-L5315
FreeCAD/FreeCAD
ba42231b9c6889b89e064d6d563448ed81e376ec
src/Mod/Draft/draftguitools/gui_selectplane.py
python
Draft_SelectPlane.onSetExtension
(self, i)
Execute when setting grid extension.
Execute when setting grid extension.
[ "Execute", "when", "setting", "grid", "extension", "." ]
def onSetExtension(self, i): """Execute when setting grid extension.""" if i > 1: self.param.SetInt("gridSize", i) if hasattr(FreeCADGui, "Snapper"): FreeCADGui.Snapper.setGrid()
[ "def", "onSetExtension", "(", "self", ",", "i", ")", ":", "if", "i", ">", "1", ":", "self", ".", "param", ".", "SetInt", "(", "\"gridSize\"", ",", "i", ")", "if", "hasattr", "(", "FreeCADGui", ",", "\"Snapper\"", ")", ":", "FreeCADGui", ".", "Snapper", ".", "setGrid", "(", ")" ]
https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_selectplane.py#L491-L496
deepmodeling/deepmd-kit
159e45d248b0429844fb6a8cb3b3a201987c8d79
deepmd/utils/path.py
python
DPPath.__truediv__
(self, key: str)
Used for / operator.
Used for / operator.
[ "Used", "for", "/", "operator", "." ]
def __truediv__(self, key: str) -> "DPPath": """Used for / operator."""
[ "def", "__truediv__", "(", "self", ",", "key", ":", "str", ")", "->", "\"DPPath\"", ":" ]
https://github.com/deepmodeling/deepmd-kit/blob/159e45d248b0429844fb6a8cb3b3a201987c8d79/deepmd/utils/path.py#L90-L91
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/python/ops/nn.py
python
separable_conv2d
(input, depthwise_filter, pointwise_filter, strides, padding, name=None)
2-D convolution with separable filters. Performs a depthwise convolution that acts separately on channels followed by a pointwise convolution that mixes channels. Note that this is separability between dimensions `[1, 2]` and `3`, not spatial separability between dimensions `1` and `2`. In detail, output[b, i, j, k] = sum_{di, dj, q, r] input[b, strides[1] * i + di, strides[2] * j + dj, q] * depthwise_filter[di, dj, q, r] * pointwise_filter[0, 0, q * channel_multiplier + r, k] `strides` controls the strides for the depthwise convolution only, since the pointwise convolution has implicit strides of `[1, 1, 1, 1]`. Must have `strides[0] = strides[3] = 1`. For the most common case of the same horizontal and vertical strides, `strides = [1, stride, stride, 1]`. Args: input: 4-D `Tensor` with shape `[batch, in_height, in_width, in_channels]`. depthwise_filter: 4-D `Tensor` with shape `[filter_height, filter_width, in_channels, channel_multiplier]`. Contains `in_channels` convolutional filters of depth 1. pointwise_filter: 4-D `Tensor` with shape `[1, 1, channel_multiplier * in_channels, out_channels]`. Pointwise filter to mix channels after `depthwise_filter` has convolved spatially. strides: 1-D of size 4. The strides for the depthwise convolution for each dimension of `input`. padding: A string, either `'VALID'` or `'SAME'`. The padding algorithm. See the [comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) name: A name for this operation (optional). Returns: A 4-D `Tensor` of shape `[batch, out_height, out_width, out_channels]`. Raises: ValueError: If channel_multiplier * in_channels > out_channels, which means that the separable convolution is overparameterized.
2-D convolution with separable filters.
[ "2", "-", "D", "convolution", "with", "separable", "filters", "." ]
def separable_conv2d(input, depthwise_filter, pointwise_filter, strides, padding, name=None): """2-D convolution with separable filters. Performs a depthwise convolution that acts separately on channels followed by a pointwise convolution that mixes channels. Note that this is separability between dimensions `[1, 2]` and `3`, not spatial separability between dimensions `1` and `2`. In detail, output[b, i, j, k] = sum_{di, dj, q, r] input[b, strides[1] * i + di, strides[2] * j + dj, q] * depthwise_filter[di, dj, q, r] * pointwise_filter[0, 0, q * channel_multiplier + r, k] `strides` controls the strides for the depthwise convolution only, since the pointwise convolution has implicit strides of `[1, 1, 1, 1]`. Must have `strides[0] = strides[3] = 1`. For the most common case of the same horizontal and vertical strides, `strides = [1, stride, stride, 1]`. Args: input: 4-D `Tensor` with shape `[batch, in_height, in_width, in_channels]`. depthwise_filter: 4-D `Tensor` with shape `[filter_height, filter_width, in_channels, channel_multiplier]`. Contains `in_channels` convolutional filters of depth 1. pointwise_filter: 4-D `Tensor` with shape `[1, 1, channel_multiplier * in_channels, out_channels]`. Pointwise filter to mix channels after `depthwise_filter` has convolved spatially. strides: 1-D of size 4. The strides for the depthwise convolution for each dimension of `input`. padding: A string, either `'VALID'` or `'SAME'`. The padding algorithm. See the [comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) name: A name for this operation (optional). Returns: A 4-D `Tensor` of shape `[batch, out_height, out_width, out_channels]`. Raises: ValueError: If channel_multiplier * in_channels > out_channels, which means that the separable convolution is overparameterized. """ with ops.name_scope(name, "separable_conv2d", [input, depthwise_filter, pointwise_filter]) as name: input = ops.convert_to_tensor(input, name="tensor_in") depthwise_filter = ops.convert_to_tensor( depthwise_filter, name="depthwise_filter") pointwise_filter = ops.convert_to_tensor( pointwise_filter, name="pointwise_filter") pointwise_filter_shape = pointwise_filter.get_shape().with_rank(4) pointwise_filter_shape[0].assert_is_compatible_with(1) pointwise_filter_shape[1].assert_is_compatible_with(1) channel_multiplier = depthwise_filter.get_shape().with_rank(4)[3] in_channels = input.get_shape().with_rank(4)[3] out_channels = pointwise_filter_shape[3] # If any of channel numbers is unknown, then the comparison below returns # None. See TensorShape.__gt__(). if channel_multiplier * in_channels > out_channels: raise ValueError( "Refusing to perform an overparameterized separable " "convolution: channel_multiplier * in_channels = " "%d * %d = %d > %d = out_channels" % (channel_multiplier, in_channels, channel_multiplier * in_channels, out_channels)) # The layout of the ops in the graph are expected to be as follows: # depthwise_conv2d // Conv2D op corresponding to native deptwise conv. # separable_conv2d // Conv2D op corresponding to the pointwise conv. depthwise = nn_ops.depthwise_conv2d_native( input, depthwise_filter, strides, padding, name="depthwise") return nn_ops.conv2d( depthwise, pointwise_filter, [1, 1, 1, 1], padding="VALID", name=name)
[ "def", "separable_conv2d", "(", "input", ",", "depthwise_filter", ",", "pointwise_filter", ",", "strides", ",", "padding", ",", "name", "=", "None", ")", ":", "with", "ops", ".", "name_scope", "(", "name", ",", "\"separable_conv2d\"", ",", "[", "input", ",", "depthwise_filter", ",", "pointwise_filter", "]", ")", "as", "name", ":", "input", "=", "ops", ".", "convert_to_tensor", "(", "input", ",", "name", "=", "\"tensor_in\"", ")", "depthwise_filter", "=", "ops", ".", "convert_to_tensor", "(", "depthwise_filter", ",", "name", "=", "\"depthwise_filter\"", ")", "pointwise_filter", "=", "ops", ".", "convert_to_tensor", "(", "pointwise_filter", ",", "name", "=", "\"pointwise_filter\"", ")", "pointwise_filter_shape", "=", "pointwise_filter", ".", "get_shape", "(", ")", ".", "with_rank", "(", "4", ")", "pointwise_filter_shape", "[", "0", "]", ".", "assert_is_compatible_with", "(", "1", ")", "pointwise_filter_shape", "[", "1", "]", ".", "assert_is_compatible_with", "(", "1", ")", "channel_multiplier", "=", "depthwise_filter", ".", "get_shape", "(", ")", ".", "with_rank", "(", "4", ")", "[", "3", "]", "in_channels", "=", "input", ".", "get_shape", "(", ")", ".", "with_rank", "(", "4", ")", "[", "3", "]", "out_channels", "=", "pointwise_filter_shape", "[", "3", "]", "# If any of channel numbers is unknown, then the comparison below returns", "# None. See TensorShape.__gt__().", "if", "channel_multiplier", "*", "in_channels", ">", "out_channels", ":", "raise", "ValueError", "(", "\"Refusing to perform an overparameterized separable \"", "\"convolution: channel_multiplier * in_channels = \"", "\"%d * %d = %d > %d = out_channels\"", "%", "(", "channel_multiplier", ",", "in_channels", ",", "channel_multiplier", "*", "in_channels", ",", "out_channels", ")", ")", "# The layout of the ops in the graph are expected to be as follows:", "# depthwise_conv2d // Conv2D op corresponding to native deptwise conv.", "# separable_conv2d // Conv2D op corresponding to the pointwise conv.", "depthwise", "=", "nn_ops", ".", "depthwise_conv2d_native", "(", "input", ",", "depthwise_filter", ",", "strides", ",", "padding", ",", "name", "=", "\"depthwise\"", ")", "return", "nn_ops", ".", "conv2d", "(", "depthwise", ",", "pointwise_filter", ",", "[", "1", ",", "1", ",", "1", ",", "1", "]", ",", "padding", "=", "\"VALID\"", ",", "name", "=", "name", ")" ]
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/nn.py#L646-L722
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/tools/datetimes.py
python
should_cache
( arg: ArrayConvertible, unique_share: float = 0.7, check_count: Optional[int] = None )
return do_caching
Decides whether to do caching. If the percent of unique elements among `check_count` elements less than `unique_share * 100` then we can do caching. Parameters ---------- arg: listlike, tuple, 1-d array, Series unique_share: float, default=0.7, optional 0 < unique_share < 1 check_count: int, optional 0 <= check_count <= len(arg) Returns ------- do_caching: bool Notes ----- By default for a sequence of less than 50 items in size, we don't do caching; for the number of elements less than 5000, we take ten percent of all elements to check for a uniqueness share; if the sequence size is more than 5000, then we check only the first 500 elements. All constants were chosen empirically by.
Decides whether to do caching.
[ "Decides", "whether", "to", "do", "caching", "." ]
def should_cache( arg: ArrayConvertible, unique_share: float = 0.7, check_count: Optional[int] = None ) -> bool: """ Decides whether to do caching. If the percent of unique elements among `check_count` elements less than `unique_share * 100` then we can do caching. Parameters ---------- arg: listlike, tuple, 1-d array, Series unique_share: float, default=0.7, optional 0 < unique_share < 1 check_count: int, optional 0 <= check_count <= len(arg) Returns ------- do_caching: bool Notes ----- By default for a sequence of less than 50 items in size, we don't do caching; for the number of elements less than 5000, we take ten percent of all elements to check for a uniqueness share; if the sequence size is more than 5000, then we check only the first 500 elements. All constants were chosen empirically by. """ do_caching = True # default realization if check_count is None: # in this case, the gain from caching is negligible if len(arg) <= 50: return False if len(arg) <= 5000: check_count = int(len(arg) * 0.1) else: check_count = 500 else: assert ( 0 <= check_count <= len(arg) ), "check_count must be in next bounds: [0; len(arg)]" if check_count == 0: return False assert 0 < unique_share < 1, "unique_share must be in next bounds: (0; 1)" unique_elements = set(islice(arg, check_count)) if len(unique_elements) > check_count * unique_share: do_caching = False return do_caching
[ "def", "should_cache", "(", "arg", ":", "ArrayConvertible", ",", "unique_share", ":", "float", "=", "0.7", ",", "check_count", ":", "Optional", "[", "int", "]", "=", "None", ")", "->", "bool", ":", "do_caching", "=", "True", "# default realization", "if", "check_count", "is", "None", ":", "# in this case, the gain from caching is negligible", "if", "len", "(", "arg", ")", "<=", "50", ":", "return", "False", "if", "len", "(", "arg", ")", "<=", "5000", ":", "check_count", "=", "int", "(", "len", "(", "arg", ")", "*", "0.1", ")", "else", ":", "check_count", "=", "500", "else", ":", "assert", "(", "0", "<=", "check_count", "<=", "len", "(", "arg", ")", ")", ",", "\"check_count must be in next bounds: [0; len(arg)]\"", "if", "check_count", "==", "0", ":", "return", "False", "assert", "0", "<", "unique_share", "<", "1", ",", "\"unique_share must be in next bounds: (0; 1)\"", "unique_elements", "=", "set", "(", "islice", "(", "arg", ",", "check_count", ")", ")", "if", "len", "(", "unique_elements", ")", ">", "check_count", "*", "unique_share", ":", "do_caching", "=", "False", "return", "do_caching" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/tools/datetimes.py#L66-L119
apiaryio/snowcrash
b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3
tools/gyp/pylib/gyp/xcodeproj_file.py
python
XCConfigurationList.AppendBuildSetting
(self, key, value)
Appends value to the build setting for key, which is treated as a list, in all child XCBuildConfiguration objects.
Appends value to the build setting for key, which is treated as a list, in all child XCBuildConfiguration objects.
[ "Appends", "value", "to", "the", "build", "setting", "for", "key", "which", "is", "treated", "as", "a", "list", "in", "all", "child", "XCBuildConfiguration", "objects", "." ]
def AppendBuildSetting(self, key, value): """Appends value to the build setting for key, which is treated as a list, in all child XCBuildConfiguration objects. """ for configuration in self._properties['buildConfigurations']: configuration.AppendBuildSetting(key, value)
[ "def", "AppendBuildSetting", "(", "self", ",", "key", ",", "value", ")", ":", "for", "configuration", "in", "self", ".", "_properties", "[", "'buildConfigurations'", "]", ":", "configuration", ".", "AppendBuildSetting", "(", "key", ",", "value", ")" ]
https://github.com/apiaryio/snowcrash/blob/b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3/tools/gyp/pylib/gyp/xcodeproj_file.py#L1680-L1686
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/traitlets/py3/traitlets/traitlets.py
python
_add_all
()
add all trait types to `__all__` do in a function to avoid iterating through globals while defining local variables
add all trait types to `__all__`
[ "add", "all", "trait", "types", "to", "__all__" ]
def _add_all(): """add all trait types to `__all__` do in a function to avoid iterating through globals while defining local variables """ for _name, _value in globals().items(): if not _name.startswith('_') and isinstance(_value, type) and issubclass(_value, TraitType): __all__.append(_name)
[ "def", "_add_all", "(", ")", ":", "for", "_name", ",", "_value", "in", "globals", "(", ")", ".", "items", "(", ")", ":", "if", "not", "_name", ".", "startswith", "(", "'_'", ")", "and", "isinstance", "(", "_value", ",", "type", ")", "and", "issubclass", "(", "_value", ",", "TraitType", ")", ":", "__all__", ".", "append", "(", "_name", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/traitlets/py3/traitlets/traitlets.py#L3249-L3256
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/contrib/layers/python/layers/feature_column.py
python
_OneHotColumn._to_dnn_input_layer
(self, transformed_input_tensor, unused_weight_collections=None, unused_trainable=False, output_rank=2)
return math_ops.reduce_sum( one_hot_id_tensor, reduction_indices=[output_rank - 1])
Returns a Tensor as an input to the first layer of neural network. Args: transformed_input_tensor: A tensor that has undergone the transformations in `insert_transformed_feature`. Rank should be >= `output_rank`. unused_weight_collections: Unused. One hot encodings are not variable. unused_trainable: Unused. One hot encodings are not trainable. output_rank: the desired rank of the output `Tensor`. Returns: A multi-hot Tensor to be fed into the first layer of neural network. Raises: ValueError: When using one_hot_column with weighted_sparse_column. This is not yet supported.
Returns a Tensor as an input to the first layer of neural network.
[ "Returns", "a", "Tensor", "as", "an", "input", "to", "the", "first", "layer", "of", "neural", "network", "." ]
def _to_dnn_input_layer(self, transformed_input_tensor, unused_weight_collections=None, unused_trainable=False, output_rank=2): """Returns a Tensor as an input to the first layer of neural network. Args: transformed_input_tensor: A tensor that has undergone the transformations in `insert_transformed_feature`. Rank should be >= `output_rank`. unused_weight_collections: Unused. One hot encodings are not variable. unused_trainable: Unused. One hot encodings are not trainable. output_rank: the desired rank of the output `Tensor`. Returns: A multi-hot Tensor to be fed into the first layer of neural network. Raises: ValueError: When using one_hot_column with weighted_sparse_column. This is not yet supported. """ # Reshape ID column to `output_rank`. sparse_id_column = self.sparse_id_column.id_tensor(transformed_input_tensor) # pylint: disable=protected-access sparse_id_column = layers._inner_flatten(sparse_id_column, output_rank) weight_tensor = self.sparse_id_column.weight_tensor( transformed_input_tensor) if weight_tensor is not None: weighted_column = sparse_ops.sparse_merge(sp_ids=sparse_id_column, sp_values=weight_tensor, vocab_size=self.length) return sparse_ops.sparse_tensor_to_dense(weighted_column) dense_id_tensor = sparse_ops.sparse_tensor_to_dense(sparse_id_column, default_value=-1) # One hot must be float for tf.concat reasons since all other inputs to # input_layer are float32. one_hot_id_tensor = array_ops.one_hot( dense_id_tensor, depth=self.length, on_value=1.0, off_value=0.0) # Reduce to get a multi-hot per example. return math_ops.reduce_sum( one_hot_id_tensor, reduction_indices=[output_rank - 1])
[ "def", "_to_dnn_input_layer", "(", "self", ",", "transformed_input_tensor", ",", "unused_weight_collections", "=", "None", ",", "unused_trainable", "=", "False", ",", "output_rank", "=", "2", ")", ":", "# Reshape ID column to `output_rank`.", "sparse_id_column", "=", "self", ".", "sparse_id_column", ".", "id_tensor", "(", "transformed_input_tensor", ")", "# pylint: disable=protected-access", "sparse_id_column", "=", "layers", ".", "_inner_flatten", "(", "sparse_id_column", ",", "output_rank", ")", "weight_tensor", "=", "self", ".", "sparse_id_column", ".", "weight_tensor", "(", "transformed_input_tensor", ")", "if", "weight_tensor", "is", "not", "None", ":", "weighted_column", "=", "sparse_ops", ".", "sparse_merge", "(", "sp_ids", "=", "sparse_id_column", ",", "sp_values", "=", "weight_tensor", ",", "vocab_size", "=", "self", ".", "length", ")", "return", "sparse_ops", ".", "sparse_tensor_to_dense", "(", "weighted_column", ")", "dense_id_tensor", "=", "sparse_ops", ".", "sparse_tensor_to_dense", "(", "sparse_id_column", ",", "default_value", "=", "-", "1", ")", "# One hot must be float for tf.concat reasons since all other inputs to", "# input_layer are float32.", "one_hot_id_tensor", "=", "array_ops", ".", "one_hot", "(", "dense_id_tensor", ",", "depth", "=", "self", ".", "length", ",", "on_value", "=", "1.0", ",", "off_value", "=", "0.0", ")", "# Reduce to get a multi-hot per example.", "return", "math_ops", ".", "reduce_sum", "(", "one_hot_id_tensor", ",", "reduction_indices", "=", "[", "output_rank", "-", "1", "]", ")" ]
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/layers/python/layers/feature_column.py#L903-L948
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/ntpath.py
python
relpath
(path, start=None)
Return a relative version of a path
Return a relative version of a path
[ "Return", "a", "relative", "version", "of", "a", "path" ]
def relpath(path, start=None): """Return a relative version of a path""" path = os.fspath(path) if isinstance(path, bytes): sep = b'\\' curdir = b'.' pardir = b'..' else: sep = '\\' curdir = '.' pardir = '..' if start is None: start = curdir if not path: raise ValueError("no path specified") start = os.fspath(start) try: start_abs = abspath(normpath(start)) path_abs = abspath(normpath(path)) start_drive, start_rest = splitdrive(start_abs) path_drive, path_rest = splitdrive(path_abs) if normcase(start_drive) != normcase(path_drive): raise ValueError("path is on mount %r, start on mount %r" % ( path_drive, start_drive)) start_list = [x for x in start_rest.split(sep) if x] path_list = [x for x in path_rest.split(sep) if x] # Work out how much of the filepath is shared by start and path. i = 0 for e1, e2 in zip(start_list, path_list): if normcase(e1) != normcase(e2): break i += 1 rel_list = [pardir] * (len(start_list)-i) + path_list[i:] if not rel_list: return curdir return join(*rel_list) except (TypeError, ValueError, AttributeError, BytesWarning, DeprecationWarning): genericpath._check_arg_types('relpath', path, start) raise
[ "def", "relpath", "(", "path", ",", "start", "=", "None", ")", ":", "path", "=", "os", ".", "fspath", "(", "path", ")", "if", "isinstance", "(", "path", ",", "bytes", ")", ":", "sep", "=", "b'\\\\'", "curdir", "=", "b'.'", "pardir", "=", "b'..'", "else", ":", "sep", "=", "'\\\\'", "curdir", "=", "'.'", "pardir", "=", "'..'", "if", "start", "is", "None", ":", "start", "=", "curdir", "if", "not", "path", ":", "raise", "ValueError", "(", "\"no path specified\"", ")", "start", "=", "os", ".", "fspath", "(", "start", ")", "try", ":", "start_abs", "=", "abspath", "(", "normpath", "(", "start", ")", ")", "path_abs", "=", "abspath", "(", "normpath", "(", "path", ")", ")", "start_drive", ",", "start_rest", "=", "splitdrive", "(", "start_abs", ")", "path_drive", ",", "path_rest", "=", "splitdrive", "(", "path_abs", ")", "if", "normcase", "(", "start_drive", ")", "!=", "normcase", "(", "path_drive", ")", ":", "raise", "ValueError", "(", "\"path is on mount %r, start on mount %r\"", "%", "(", "path_drive", ",", "start_drive", ")", ")", "start_list", "=", "[", "x", "for", "x", "in", "start_rest", ".", "split", "(", "sep", ")", "if", "x", "]", "path_list", "=", "[", "x", "for", "x", "in", "path_rest", ".", "split", "(", "sep", ")", "if", "x", "]", "# Work out how much of the filepath is shared by start and path.", "i", "=", "0", "for", "e1", ",", "e2", "in", "zip", "(", "start_list", ",", "path_list", ")", ":", "if", "normcase", "(", "e1", ")", "!=", "normcase", "(", "e2", ")", ":", "break", "i", "+=", "1", "rel_list", "=", "[", "pardir", "]", "*", "(", "len", "(", "start_list", ")", "-", "i", ")", "+", "path_list", "[", "i", ":", "]", "if", "not", "rel_list", ":", "return", "curdir", "return", "join", "(", "*", "rel_list", ")", "except", "(", "TypeError", ",", "ValueError", ",", "AttributeError", ",", "BytesWarning", ",", "DeprecationWarning", ")", ":", "genericpath", ".", "_check_arg_types", "(", "'relpath'", ",", "path", ",", "start", ")", "raise" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/ntpath.py#L536-L579
adobe/chromium
cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7
build/android/emulator.py
python
Emulator.__init__
(self, fast_and_loose=False)
Init an Emulator. Args: fast_and_loose: Loosen up the rules for reliable running for speed. Intended for quick testing or re-testing.
Init an Emulator.
[ "Init", "an", "Emulator", "." ]
def __init__(self, fast_and_loose=False): """Init an Emulator. Args: fast_and_loose: Loosen up the rules for reliable running for speed. Intended for quick testing or re-testing. """ try: android_sdk_root = os.environ['ANDROID_SDK_ROOT'] except KeyError: logging.critical('The ANDROID_SDK_ROOT must be set to run the test on ' 'emulator.') raise self.emulator = os.path.join(android_sdk_root, 'tools', 'emulator') self.popen = None self.device = None self.fast_and_loose = fast_and_loose
[ "def", "__init__", "(", "self", ",", "fast_and_loose", "=", "False", ")", ":", "try", ":", "android_sdk_root", "=", "os", ".", "environ", "[", "'ANDROID_SDK_ROOT'", "]", "except", "KeyError", ":", "logging", ".", "critical", "(", "'The ANDROID_SDK_ROOT must be set to run the test on '", "'emulator.'", ")", "raise", "self", ".", "emulator", "=", "os", ".", "path", ".", "join", "(", "android_sdk_root", ",", "'tools'", ",", "'emulator'", ")", "self", ".", "popen", "=", "None", "self", ".", "device", "=", "None", "self", ".", "fast_and_loose", "=", "fast_and_loose" ]
https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/build/android/emulator.py#L115-L132
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/ir/builder.py
python
IRBuilder.fadd
(self, lhs, rhs, name='')
Floating-point addition: name = lhs + rhs
Floating-point addition: name = lhs + rhs
[ "Floating", "-", "point", "addition", ":", "name", "=", "lhs", "+", "rhs" ]
def fadd(self, lhs, rhs, name=''): """ Floating-point addition: name = lhs + rhs """
[ "def", "fadd", "(", "self", ",", "lhs", ",", "rhs", ",", "name", "=", "''", ")", ":" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/ir/builder.py#L367-L371
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py3/pandas/io/pytables.py
python
Table.indexables
(self)
return _indexables
create/cache the indexables if they don't exist
create/cache the indexables if they don't exist
[ "create", "/", "cache", "the", "indexables", "if", "they", "don", "t", "exist" ]
def indexables(self): """create/cache the indexables if they don't exist""" _indexables = [] desc = self.description table_attrs = self.table.attrs # Note: each of the `name` kwargs below are str, ensured # by the definition in index_cols. # index columns for i, (axis, name) in enumerate(self.attrs.index_cols): atom = getattr(desc, name) md = self.read_metadata(name) meta = "category" if md is not None else None kind_attr = f"{name}_kind" kind = getattr(table_attrs, kind_attr, None) index_col = IndexCol( name=name, axis=axis, pos=i, kind=kind, typ=atom, table=self.table, meta=meta, metadata=md, ) _indexables.append(index_col) # values columns dc = set(self.data_columns) base_pos = len(_indexables) def f(i, c): assert isinstance(c, str) klass = DataCol if c in dc: klass = DataIndexableCol atom = getattr(desc, c) adj_name = _maybe_adjust_name(c, self.version) # TODO: why kind_attr here? values = getattr(table_attrs, f"{adj_name}_kind", None) dtype = getattr(table_attrs, f"{adj_name}_dtype", None) kind = _dtype_to_kind(dtype) md = self.read_metadata(c) # TODO: figure out why these two versions of `meta` dont always match. # meta = "category" if md is not None else None meta = getattr(table_attrs, f"{adj_name}_meta", None) obj = klass( name=adj_name, cname=c, values=values, kind=kind, pos=base_pos + i, typ=atom, table=self.table, meta=meta, metadata=md, dtype=dtype, ) return obj # Note: the definition of `values_cols` ensures that each # `c` below is a str. _indexables.extend([f(i, c) for i, c in enumerate(self.attrs.values_cols)]) return _indexables
[ "def", "indexables", "(", "self", ")", ":", "_indexables", "=", "[", "]", "desc", "=", "self", ".", "description", "table_attrs", "=", "self", ".", "table", ".", "attrs", "# Note: each of the `name` kwargs below are str, ensured", "# by the definition in index_cols.", "# index columns", "for", "i", ",", "(", "axis", ",", "name", ")", "in", "enumerate", "(", "self", ".", "attrs", ".", "index_cols", ")", ":", "atom", "=", "getattr", "(", "desc", ",", "name", ")", "md", "=", "self", ".", "read_metadata", "(", "name", ")", "meta", "=", "\"category\"", "if", "md", "is", "not", "None", "else", "None", "kind_attr", "=", "f\"{name}_kind\"", "kind", "=", "getattr", "(", "table_attrs", ",", "kind_attr", ",", "None", ")", "index_col", "=", "IndexCol", "(", "name", "=", "name", ",", "axis", "=", "axis", ",", "pos", "=", "i", ",", "kind", "=", "kind", ",", "typ", "=", "atom", ",", "table", "=", "self", ".", "table", ",", "meta", "=", "meta", ",", "metadata", "=", "md", ",", ")", "_indexables", ".", "append", "(", "index_col", ")", "# values columns", "dc", "=", "set", "(", "self", ".", "data_columns", ")", "base_pos", "=", "len", "(", "_indexables", ")", "def", "f", "(", "i", ",", "c", ")", ":", "assert", "isinstance", "(", "c", ",", "str", ")", "klass", "=", "DataCol", "if", "c", "in", "dc", ":", "klass", "=", "DataIndexableCol", "atom", "=", "getattr", "(", "desc", ",", "c", ")", "adj_name", "=", "_maybe_adjust_name", "(", "c", ",", "self", ".", "version", ")", "# TODO: why kind_attr here?", "values", "=", "getattr", "(", "table_attrs", ",", "f\"{adj_name}_kind\"", ",", "None", ")", "dtype", "=", "getattr", "(", "table_attrs", ",", "f\"{adj_name}_dtype\"", ",", "None", ")", "kind", "=", "_dtype_to_kind", "(", "dtype", ")", "md", "=", "self", ".", "read_metadata", "(", "c", ")", "# TODO: figure out why these two versions of `meta` dont always match.", "# meta = \"category\" if md is not None else None", "meta", "=", "getattr", "(", "table_attrs", ",", "f\"{adj_name}_meta\"", ",", "None", ")", "obj", "=", "klass", "(", "name", "=", "adj_name", ",", "cname", "=", "c", ",", "values", "=", "values", ",", "kind", "=", "kind", ",", "pos", "=", "base_pos", "+", "i", ",", "typ", "=", "atom", ",", "table", "=", "self", ".", "table", ",", "meta", "=", "meta", ",", "metadata", "=", "md", ",", "dtype", "=", "dtype", ",", ")", "return", "obj", "# Note: the definition of `values_cols` ensures that each", "# `c` below is a str.", "_indexables", ".", "extend", "(", "[", "f", "(", "i", ",", "c", ")", "for", "i", ",", "c", "in", "enumerate", "(", "self", ".", "attrs", ".", "values_cols", ")", "]", ")", "return", "_indexables" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/pytables.py#L3548-L3619
trilinos/Trilinos
6168be6dd51e35e1cd681e9c4b24433e709df140
packages/seacas/scripts/exomerge3.py
python
ExodusModel.create_node_field
(self, node_field_name, value='auto')
Create a node field and assign it a default value. A default value can be passed. If no default value is given, 0.0 will be used if the element field appears to be a displacement field. Otherwise, NaN will be used. Example: >>> model.create_node_field('temperature', 298.15)
Create a node field and assign it a default value.
[ "Create", "a", "node", "field", "and", "assign", "it", "a", "default", "value", "." ]
def create_node_field(self, node_field_name, value='auto'): """ Create a node field and assign it a default value. A default value can be passed. If no default value is given, 0.0 will be used if the element field appears to be a displacement field. Otherwise, NaN will be used. Example: >>> model.create_node_field('temperature', 298.15) """ # issue warning if no timesteps exist if not self.get_timesteps(): self._empty_field_warning() # if it exists, no need to do anything if self.node_field_exists(node_field_name): self._exists_warning(node_field_name, 'node field') return # get the value if value == 'auto': value = self._get_default_field_value(node_field_name) # create the new field new_field_values = [] for _ in range(len(self.timesteps)): new_field_values.append([value] * len(self.nodes)) self.node_fields[node_field_name] = new_field_values
[ "def", "create_node_field", "(", "self", ",", "node_field_name", ",", "value", "=", "'auto'", ")", ":", "# issue warning if no timesteps exist", "if", "not", "self", ".", "get_timesteps", "(", ")", ":", "self", ".", "_empty_field_warning", "(", ")", "# if it exists, no need to do anything", "if", "self", ".", "node_field_exists", "(", "node_field_name", ")", ":", "self", ".", "_exists_warning", "(", "node_field_name", ",", "'node field'", ")", "return", "# get the value", "if", "value", "==", "'auto'", ":", "value", "=", "self", ".", "_get_default_field_value", "(", "node_field_name", ")", "# create the new field", "new_field_values", "=", "[", "]", "for", "_", "in", "range", "(", "len", "(", "self", ".", "timesteps", ")", ")", ":", "new_field_values", ".", "append", "(", "[", "value", "]", "*", "len", "(", "self", ".", "nodes", ")", ")", "self", ".", "node_fields", "[", "node_field_name", "]", "=", "new_field_values" ]
https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exomerge3.py#L4081-L4107
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py
python
_wrap
(new, old)
Simple substitute for functools.update_wrapper.
Simple substitute for functools.update_wrapper.
[ "Simple", "substitute", "for", "functools", ".", "update_wrapper", "." ]
def _wrap(new, old): """Simple substitute for functools.update_wrapper.""" for replace in ['__module__', '__name__', '__qualname__', '__doc__']: if hasattr(old, replace): setattr(new, replace, getattr(old, replace)) new.__dict__.update(old.__dict__)
[ "def", "_wrap", "(", "new", ",", "old", ")", ":", "for", "replace", "in", "[", "'__module__'", ",", "'__name__'", ",", "'__qualname__'", ",", "'__doc__'", "]", ":", "if", "hasattr", "(", "old", ",", "replace", ")", ":", "setattr", "(", "new", ",", "replace", ",", "getattr", "(", "old", ",", "replace", ")", ")", "new", ".", "__dict__", ".", "update", "(", "old", ".", "__dict__", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py#L27-L32
snap-stanford/snap-python
d53c51b0a26aa7e3e7400b014cdf728948fde80a
setup/snap.py
python
TNEGraph.Reserve
(self, *args)
return _snap.TNEGraph_Reserve(self, *args)
Reserve(TNEGraph self, int const & Nodes, int const & Edges) Parameters: Nodes: int const & Edges: int const &
Reserve(TNEGraph self, int const & Nodes, int const & Edges)
[ "Reserve", "(", "TNEGraph", "self", "int", "const", "&", "Nodes", "int", "const", "&", "Edges", ")" ]
def Reserve(self, *args): """ Reserve(TNEGraph self, int const & Nodes, int const & Edges) Parameters: Nodes: int const & Edges: int const & """ return _snap.TNEGraph_Reserve(self, *args)
[ "def", "Reserve", "(", "self", ",", "*", "args", ")", ":", "return", "_snap", ".", "TNEGraph_Reserve", "(", "self", ",", "*", "args", ")" ]
https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L4719-L4728
alibaba/weex_js_engine
2bdf4b6f020c1fc99c63f649718f6faf7e27fdde
jni/v8core/v8/build/gyp/pylib/gyp/xcode_emulation.py
python
XcodeSettings.GetFullProductName
(self)
Returns FULL_PRODUCT_NAME.
Returns FULL_PRODUCT_NAME.
[ "Returns", "FULL_PRODUCT_NAME", "." ]
def GetFullProductName(self): """Returns FULL_PRODUCT_NAME.""" if self._IsBundle(): return self.GetWrapperName() else: return self._GetStandaloneBinaryPath()
[ "def", "GetFullProductName", "(", "self", ")", ":", "if", "self", ".", "_IsBundle", "(", ")", ":", "return", "self", ".", "GetWrapperName", "(", ")", "else", ":", "return", "self", ".", "_GetStandaloneBinaryPath", "(", ")" ]
https://github.com/alibaba/weex_js_engine/blob/2bdf4b6f020c1fc99c63f649718f6faf7e27fdde/jni/v8core/v8/build/gyp/pylib/gyp/xcode_emulation.py#L88-L93
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/_misc.py
python
AboutDialogInfo.GetLicence
(*args, **kwargs)
return _misc_.AboutDialogInfo_GetLicence(*args, **kwargs)
GetLicence(self) -> String Returns the licence value.
GetLicence(self) -> String
[ "GetLicence", "(", "self", ")", "-", ">", "String" ]
def GetLicence(*args, **kwargs): """ GetLicence(self) -> String Returns the licence value. """ return _misc_.AboutDialogInfo_GetLicence(*args, **kwargs)
[ "def", "GetLicence", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_misc_", ".", "AboutDialogInfo_GetLicence", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L6724-L6730
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py
python
NeuralNetworkBuilder.set_optional_input
(self, input_idx, value=None, format="float")
Marks given input as optional input. Optionally, sets default value for optional input if value is not None Parameters ---------- input_idx: int Index of input to be marked and fill with default value value: int/double/float/None Value to be fill as default value format: str Format of default value Must be one of 'float', 'double' or 'int'
Marks given input as optional input. Optionally, sets default value for optional input if value is not None
[ "Marks", "given", "input", "as", "optional", "input", ".", "Optionally", "sets", "default", "value", "for", "optional", "input", "if", "value", "is", "not", "None" ]
def set_optional_input(self, input_idx, value=None, format="float"): """ Marks given input as optional input. Optionally, sets default value for optional input if value is not None Parameters ---------- input_idx: int Index of input to be marked and fill with default value value: int/double/float/None Value to be fill as default value format: str Format of default value Must be one of 'float', 'double' or 'int' """ if input_idx >= len(self.spec.description.input): msg = ( str(input_idx) + " out of " + str(len(self.spec.description.input)) + " inputs!" ) raise ValueError("Setting invalid input as optional! {}".format(msg)) self.spec.description.input[input_idx].type.isOptional = True if value is None: return # Default value is supported from CoreML 4 onwards. self.spec.specificationVersion = max( self.spec.specificationVersion, _SPECIFICATION_VERSION_IOS_14 ) format = format.lower() if format == "float": self.spec.description.input[ input_idx ].type.multiArrayType.floatDefaultValue = value elif format == "double": self.spec.description.input[ input_idx ].type.multiArrayType.doubleDefaultValue = value elif format == "int": self.spec.description.input[ input_idx ].type.multiArrayType.intDefaultValue = value else: raise ValueError( "Incorrect format for optional inputs! Expecting int/float/double, got {}!".format( format ) )
[ "def", "set_optional_input", "(", "self", ",", "input_idx", ",", "value", "=", "None", ",", "format", "=", "\"float\"", ")", ":", "if", "input_idx", ">=", "len", "(", "self", ".", "spec", ".", "description", ".", "input", ")", ":", "msg", "=", "(", "str", "(", "input_idx", ")", "+", "\" out of \"", "+", "str", "(", "len", "(", "self", ".", "spec", ".", "description", ".", "input", ")", ")", "+", "\" inputs!\"", ")", "raise", "ValueError", "(", "\"Setting invalid input as optional! {}\"", ".", "format", "(", "msg", ")", ")", "self", ".", "spec", ".", "description", ".", "input", "[", "input_idx", "]", ".", "type", ".", "isOptional", "=", "True", "if", "value", "is", "None", ":", "return", "# Default value is supported from CoreML 4 onwards.", "self", ".", "spec", ".", "specificationVersion", "=", "max", "(", "self", ".", "spec", ".", "specificationVersion", ",", "_SPECIFICATION_VERSION_IOS_14", ")", "format", "=", "format", ".", "lower", "(", ")", "if", "format", "==", "\"float\"", ":", "self", ".", "spec", ".", "description", ".", "input", "[", "input_idx", "]", ".", "type", ".", "multiArrayType", ".", "floatDefaultValue", "=", "value", "elif", "format", "==", "\"double\"", ":", "self", ".", "spec", ".", "description", ".", "input", "[", "input_idx", "]", ".", "type", ".", "multiArrayType", ".", "doubleDefaultValue", "=", "value", "elif", "format", "==", "\"int\"", ":", "self", ".", "spec", ".", "description", ".", "input", "[", "input_idx", "]", ".", "type", ".", "multiArrayType", ".", "intDefaultValue", "=", "value", "else", ":", "raise", "ValueError", "(", "\"Incorrect format for optional inputs! Expecting int/float/double, got {}!\"", ".", "format", "(", "format", ")", ")" ]
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py#L618-L666
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/contrib/ndlstm/python/misc.py
python
one_hot_mask
(labels, num_classes, scope=None)
Compute 1-hot encodings for masks. Given a label image, this computes the one hot encoding at each pixel. Args: labels: (batch_size, width, height, 1) tensor containing labels. num_classes: number of classes scope: optional scope name Returns: Tensor of shape (batch_size, width, height, num_classes) with a 1-hot encoding.
Compute 1-hot encodings for masks.
[ "Compute", "1", "-", "hot", "encodings", "for", "masks", "." ]
def one_hot_mask(labels, num_classes, scope=None): """Compute 1-hot encodings for masks. Given a label image, this computes the one hot encoding at each pixel. Args: labels: (batch_size, width, height, 1) tensor containing labels. num_classes: number of classes scope: optional scope name Returns: Tensor of shape (batch_size, width, height, num_classes) with a 1-hot encoding. """ with ops.name_scope(scope, "OneHotMask", [labels]): height, width, depth = _shape(labels) assert depth == 1 sparse_labels = math_ops.to_int32(array_ops.reshape(labels, [-1, 1])) sparse_size, _ = _shape(sparse_labels) indices = array_ops.reshape(math_ops.range(0, sparse_size, 1), [-1, 1]) concated = array_ops.concat([indices, sparse_labels], 1) dense_result = sparse_ops.sparse_to_dense(concated, [sparse_size, num_classes], 1.0, 0.0) result = array_ops.reshape(dense_result, [height, width, num_classes]) return result
[ "def", "one_hot_mask", "(", "labels", ",", "num_classes", ",", "scope", "=", "None", ")", ":", "with", "ops", ".", "name_scope", "(", "scope", ",", "\"OneHotMask\"", ",", "[", "labels", "]", ")", ":", "height", ",", "width", ",", "depth", "=", "_shape", "(", "labels", ")", "assert", "depth", "==", "1", "sparse_labels", "=", "math_ops", ".", "to_int32", "(", "array_ops", ".", "reshape", "(", "labels", ",", "[", "-", "1", ",", "1", "]", ")", ")", "sparse_size", ",", "_", "=", "_shape", "(", "sparse_labels", ")", "indices", "=", "array_ops", ".", "reshape", "(", "math_ops", ".", "range", "(", "0", ",", "sparse_size", ",", "1", ")", ",", "[", "-", "1", ",", "1", "]", ")", "concated", "=", "array_ops", ".", "concat", "(", "[", "indices", ",", "sparse_labels", "]", ",", "1", ")", "dense_result", "=", "sparse_ops", ".", "sparse_to_dense", "(", "concated", ",", "[", "sparse_size", ",", "num_classes", "]", ",", "1.0", ",", "0.0", ")", "result", "=", "array_ops", ".", "reshape", "(", "dense_result", ",", "[", "height", ",", "width", ",", "num_classes", "]", ")", "return", "result" ]
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/ndlstm/python/misc.py#L73-L99
mhammond/pywin32
44afd86ba8485194df93234639243252deeb40d5
Pythonwin/pywin/framework/interact.py
python
CreateMDIInteractiveWindow
(makeDoc=None, makeFrame=None)
Create a standard (non-docked) interactive window unconditionally
Create a standard (non-docked) interactive window unconditionally
[ "Create", "a", "standard", "(", "non", "-", "docked", ")", "interactive", "window", "unconditionally" ]
def CreateMDIInteractiveWindow(makeDoc=None, makeFrame=None): """Create a standard (non-docked) interactive window unconditionally""" global edit if makeDoc is None: makeDoc = InteractiveDocument if makeFrame is None: makeFrame = InteractiveFrame edit = CInteractivePython(makeDoc=makeDoc, makeFrame=makeFrame)
[ "def", "CreateMDIInteractiveWindow", "(", "makeDoc", "=", "None", ",", "makeFrame", "=", "None", ")", ":", "global", "edit", "if", "makeDoc", "is", "None", ":", "makeDoc", "=", "InteractiveDocument", "if", "makeFrame", "is", "None", ":", "makeFrame", "=", "InteractiveFrame", "edit", "=", "CInteractivePython", "(", "makeDoc", "=", "makeDoc", ",", "makeFrame", "=", "makeFrame", ")" ]
https://github.com/mhammond/pywin32/blob/44afd86ba8485194df93234639243252deeb40d5/Pythonwin/pywin/framework/interact.py#L914-L921
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/py2/scipy/spatial/distance.py
python
cityblock
(u, v, w=None)
return l1_diff.sum()
Compute the City Block (Manhattan) distance. Computes the Manhattan distance between two 1-D arrays `u` and `v`, which is defined as .. math:: \\sum_i {\\left| u_i - v_i \\right|}. Parameters ---------- u : (N,) array_like Input array. v : (N,) array_like Input array. w : (N,) array_like, optional The weights for each value in `u` and `v`. Default is None, which gives each value a weight of 1.0 Returns ------- cityblock : double The City Block (Manhattan) distance between vectors `u` and `v`. Examples -------- >>> from scipy.spatial import distance >>> distance.cityblock([1, 0, 0], [0, 1, 0]) 2 >>> distance.cityblock([1, 0, 0], [0, 2, 0]) 3 >>> distance.cityblock([1, 0, 0], [1, 1, 0]) 1
Compute the City Block (Manhattan) distance.
[ "Compute", "the", "City", "Block", "(", "Manhattan", ")", "distance", "." ]
def cityblock(u, v, w=None): """ Compute the City Block (Manhattan) distance. Computes the Manhattan distance between two 1-D arrays `u` and `v`, which is defined as .. math:: \\sum_i {\\left| u_i - v_i \\right|}. Parameters ---------- u : (N,) array_like Input array. v : (N,) array_like Input array. w : (N,) array_like, optional The weights for each value in `u` and `v`. Default is None, which gives each value a weight of 1.0 Returns ------- cityblock : double The City Block (Manhattan) distance between vectors `u` and `v`. Examples -------- >>> from scipy.spatial import distance >>> distance.cityblock([1, 0, 0], [0, 1, 0]) 2 >>> distance.cityblock([1, 0, 0], [0, 2, 0]) 3 >>> distance.cityblock([1, 0, 0], [1, 1, 0]) 1 """ u = _validate_vector(u) v = _validate_vector(v) l1_diff = abs(u - v) if w is not None: w = _validate_weights(w) l1_diff = w * l1_diff return l1_diff.sum()
[ "def", "cityblock", "(", "u", ",", "v", ",", "w", "=", "None", ")", ":", "u", "=", "_validate_vector", "(", "u", ")", "v", "=", "_validate_vector", "(", "v", ")", "l1_diff", "=", "abs", "(", "u", "-", "v", ")", "if", "w", "is", "not", "None", ":", "w", "=", "_validate_weights", "(", "w", ")", "l1_diff", "=", "w", "*", "l1_diff", "return", "l1_diff", ".", "sum", "(", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/spatial/distance.py#L976-L1019
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/_controls.py
python
GenericDirCtrl.SelectPath
(*args, **kwargs)
return _controls_.GenericDirCtrl_SelectPath(*args, **kwargs)
SelectPath(self, String path, bool select=True)
SelectPath(self, String path, bool select=True)
[ "SelectPath", "(", "self", "String", "path", "bool", "select", "=", "True", ")" ]
def SelectPath(*args, **kwargs): """SelectPath(self, String path, bool select=True)""" return _controls_.GenericDirCtrl_SelectPath(*args, **kwargs)
[ "def", "SelectPath", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_controls_", ".", "GenericDirCtrl_SelectPath", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L5701-L5703
natanielruiz/android-yolo
1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f
jni-build/jni/include/tensorflow/python/summary/impl/gcs.py
python
CheckIsSupported
()
Raises an OSError if the system isn't set up for Google Cloud Storage. Raises: OSError: If the system hasn't been set up so that TensorBoard can access Google Cloud Storage. The error's message contains installation instructions.
Raises an OSError if the system isn't set up for Google Cloud Storage.
[ "Raises", "an", "OSError", "if", "the", "system", "isn", "t", "set", "up", "for", "Google", "Cloud", "Storage", "." ]
def CheckIsSupported(): """Raises an OSError if the system isn't set up for Google Cloud Storage. Raises: OSError: If the system hasn't been set up so that TensorBoard can access Google Cloud Storage. The error's message contains installation instructions. """ try: subprocess.check_output(['gsutil', 'version']) except OSError as e: logging.error('Error while checking for gsutil: %s', e) raise OSError( 'Unable to execute the gsutil binary, which is required for Google ' 'Cloud Storage support. You can find installation instructions at ' 'https://goo.gl/sST520')
[ "def", "CheckIsSupported", "(", ")", ":", "try", ":", "subprocess", ".", "check_output", "(", "[", "'gsutil'", ",", "'version'", "]", ")", "except", "OSError", "as", "e", ":", "logging", ".", "error", "(", "'Error while checking for gsutil: %s'", ",", "e", ")", "raise", "OSError", "(", "'Unable to execute the gsutil binary, which is required for Google '", "'Cloud Storage support. You can find installation instructions at '", "'https://goo.gl/sST520'", ")" ]
https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/summary/impl/gcs.py#L117-L132
hpi-xnor/BMXNet-v2
af2b1859eafc5c721b1397cef02f946aaf2ce20d
python/mxnet/ndarray/ndarray.py
python
NDArray.expm1
(self, *args, **kwargs)
return op.expm1(self, *args, **kwargs)
Convenience fluent method for :py:func:`expm1`. The arguments are the same as for :py:func:`expm1`, with this array as data.
Convenience fluent method for :py:func:`expm1`.
[ "Convenience", "fluent", "method", "for", ":", "py", ":", "func", ":", "expm1", "." ]
def expm1(self, *args, **kwargs): """Convenience fluent method for :py:func:`expm1`. The arguments are the same as for :py:func:`expm1`, with this array as data. """ return op.expm1(self, *args, **kwargs)
[ "def", "expm1", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "op", ".", "expm1", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/ndarray/ndarray.py#L1598-L1604
nyuwireless-unipd/ns3-mmwave
4ff9e87e8079764e04cbeccd8e85bff15ae16fb3
src/visualizer/visualizer/core.py
python
Node.set_position
(self, x, y)
! Set position function. @param self: class object. @param x: x position @param y: y position @return none
! Set position function.
[ "!", "Set", "position", "function", "." ]
def set_position(self, x, y): """! Set position function. @param self: class object. @param x: x position @param y: y position @return none """ self.canvas_item.set_property("center_x", x) self.canvas_item.set_property("center_y", y) if self.svg_item is not None: self._update_svg_position(x, y) for link in self.links: link.update_points() if self._label_canvas_item is not None: self._label_canvas_item.set_properties(x=x, y=(y+self._size*3)) # If the location of the point is now beyond the bounds of the # canvas then those bounds now need to be increased try: bounds = self.visualizer.canvas.get_bounds() (min_x, min_y, max_x, max_y) = bounds min_x = min(x, min_x) min_y = min(y, min_y) max_x = max(x, max_x) max_y = max(y, max_y) new_bounds = (min_x, min_y, max_x, max_y) if new_bounds != bounds: self.visualizer.canvas.set_bounds(*new_bounds) except TypeError: # bug 2969: GooCanvas.Canvas.get_bounds() inconsistency pass
[ "def", "set_position", "(", "self", ",", "x", ",", "y", ")", ":", "self", ".", "canvas_item", ".", "set_property", "(", "\"center_x\"", ",", "x", ")", "self", ".", "canvas_item", ".", "set_property", "(", "\"center_y\"", ",", "y", ")", "if", "self", ".", "svg_item", "is", "not", "None", ":", "self", ".", "_update_svg_position", "(", "x", ",", "y", ")", "for", "link", "in", "self", ".", "links", ":", "link", ".", "update_points", "(", ")", "if", "self", ".", "_label_canvas_item", "is", "not", "None", ":", "self", ".", "_label_canvas_item", ".", "set_properties", "(", "x", "=", "x", ",", "y", "=", "(", "y", "+", "self", ".", "_size", "*", "3", ")", ")", "# If the location of the point is now beyond the bounds of the", "# canvas then those bounds now need to be increased", "try", ":", "bounds", "=", "self", ".", "visualizer", ".", "canvas", ".", "get_bounds", "(", ")", "(", "min_x", ",", "min_y", ",", "max_x", ",", "max_y", ")", "=", "bounds", "min_x", "=", "min", "(", "x", ",", "min_x", ")", "min_y", "=", "min", "(", "y", ",", "min_y", ")", "max_x", "=", "max", "(", "x", ",", "max_x", ")", "max_y", "=", "max", "(", "y", ",", "max_y", ")", "new_bounds", "=", "(", "min_x", ",", "min_y", ",", "max_x", ",", "max_y", ")", "if", "new_bounds", "!=", "bounds", ":", "self", ".", "visualizer", ".", "canvas", ".", "set_bounds", "(", "*", "new_bounds", ")", "except", "TypeError", ":", "# bug 2969: GooCanvas.Canvas.get_bounds() inconsistency", "pass" ]
https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/src/visualizer/visualizer/core.py#L402-L440
thalium/icebox
99d147d5b9269222225443ce171b4fd46d8985d4
third_party/virtualbox/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-data.py
python
Bs3Cg1EncodedTests.bytesToLines
(sPrefix, asBytes)
return asRet
Formats a series of bytes into one or more lines. A byte ending with a newline indicates that we should start a new line, and prefix it by len(sPrefix) spaces. Returns list of lines.
Formats a series of bytes into one or more lines. A byte ending with a newline indicates that we should start a new line, and prefix it by len(sPrefix) spaces.
[ "Formats", "a", "series", "of", "bytes", "into", "one", "or", "more", "lines", ".", "A", "byte", "ending", "with", "a", "newline", "indicates", "that", "we", "should", "start", "a", "new", "line", "and", "prefix", "it", "by", "len", "(", "sPrefix", ")", "spaces", "." ]
def bytesToLines(sPrefix, asBytes): """ Formats a series of bytes into one or more lines. A byte ending with a newline indicates that we should start a new line, and prefix it by len(sPrefix) spaces. Returns list of lines. """ asRet = []; sLine = sPrefix; for sByte in asBytes: if sByte[-1] == '\n': sLine += sByte[:-1] + ','; asRet.append(sLine); sLine = ' ' * len(sPrefix); else: if len(sLine) + 2 + len(sByte) > 132 and len(sLine) > len(sPrefix): asRet.append(sLine[:-1]); sLine = ' ' * len(sPrefix); sLine += sByte + ', '; if len(sLine) > len(sPrefix): asRet.append(sLine); return asRet;
[ "def", "bytesToLines", "(", "sPrefix", ",", "asBytes", ")", ":", "asRet", "=", "[", "]", "sLine", "=", "sPrefix", "for", "sByte", "in", "asBytes", ":", "if", "sByte", "[", "-", "1", "]", "==", "'\\n'", ":", "sLine", "+=", "sByte", "[", ":", "-", "1", "]", "+", "','", "asRet", ".", "append", "(", "sLine", ")", "sLine", "=", "' '", "*", "len", "(", "sPrefix", ")", "else", ":", "if", "len", "(", "sLine", ")", "+", "2", "+", "len", "(", "sByte", ")", ">", "132", "and", "len", "(", "sLine", ")", ">", "len", "(", "sPrefix", ")", ":", "asRet", ".", "append", "(", "sLine", "[", ":", "-", "1", "]", ")", "sLine", "=", "' '", "*", "len", "(", "sPrefix", ")", "sLine", "+=", "sByte", "+", "', '", "if", "len", "(", "sLine", ")", ">", "len", "(", "sPrefix", ")", ":", "asRet", ".", "append", "(", "sLine", ")", "return", "asRet" ]
https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-data.py#L252-L276
google/nucleus
68d3947fafba1337f294c0668a6e1c7f3f1273e3
nucleus/io/tfrecord.py
python
read_shard_sorted_tfrecords
(path, key, proto=None, max_records=None, compression_type=None)
Yields the parsed records in a TFRecord file path in sorted order. The input TFRecord file must have each shard already in sorted order when using the key function for comparison (but elements can be interleaved across shards). Under those constraints, the elements will be yielded in a global sorted order. Args: path: String. A path to a TFRecord-formatted file containing protos. key: Callable. A function that takes as input a single instance of the proto class and returns a value on which the comparison for sorted ordering is performed. proto: A proto class. proto.FromString() will be called on each serialized record in path to parse it. max_records: int >= 0 or None. Maximum number of records to read from path. If None, the default, all records will be read. compression_type: 'GZIP', 'ZLIB', '' (uncompressed), or None to autodetect based on file extension. Yields: proto.FromString() values on each record in path in sorted order.
Yields the parsed records in a TFRecord file path in sorted order.
[ "Yields", "the", "parsed", "records", "in", "a", "TFRecord", "file", "path", "in", "sorted", "order", "." ]
def read_shard_sorted_tfrecords(path, key, proto=None, max_records=None, compression_type=None): """Yields the parsed records in a TFRecord file path in sorted order. The input TFRecord file must have each shard already in sorted order when using the key function for comparison (but elements can be interleaved across shards). Under those constraints, the elements will be yielded in a global sorted order. Args: path: String. A path to a TFRecord-formatted file containing protos. key: Callable. A function that takes as input a single instance of the proto class and returns a value on which the comparison for sorted ordering is performed. proto: A proto class. proto.FromString() will be called on each serialized record in path to parse it. max_records: int >= 0 or None. Maximum number of records to read from path. If None, the default, all records will be read. compression_type: 'GZIP', 'ZLIB', '' (uncompressed), or None to autodetect based on file extension. Yields: proto.FromString() values on each record in path in sorted order. """ if sharded_file_utils.is_sharded_file_spec(path): paths = sharded_file_utils.generate_sharded_filenames(path) else: paths = [path] keyed_iterables = [] for path in paths: protos = Reader(path, proto, compression_type=compression_type).iterate() keyed_iterables.append(((key(elem), elem) for elem in protos)) for i, (_, value) in enumerate(heapq.merge(*keyed_iterables)): if max_records is not None and i >= max_records: return yield value
[ "def", "read_shard_sorted_tfrecords", "(", "path", ",", "key", ",", "proto", "=", "None", ",", "max_records", "=", "None", ",", "compression_type", "=", "None", ")", ":", "if", "sharded_file_utils", ".", "is_sharded_file_spec", "(", "path", ")", ":", "paths", "=", "sharded_file_utils", ".", "generate_sharded_filenames", "(", "path", ")", "else", ":", "paths", "=", "[", "path", "]", "keyed_iterables", "=", "[", "]", "for", "path", "in", "paths", ":", "protos", "=", "Reader", "(", "path", ",", "proto", ",", "compression_type", "=", "compression_type", ")", ".", "iterate", "(", ")", "keyed_iterables", ".", "append", "(", "(", "(", "key", "(", "elem", ")", ",", "elem", ")", "for", "elem", "in", "protos", ")", ")", "for", "i", ",", "(", "_", ",", "value", ")", "in", "enumerate", "(", "heapq", ".", "merge", "(", "*", "keyed_iterables", ")", ")", ":", "if", "max_records", "is", "not", "None", "and", "i", ">=", "max_records", ":", "return", "yield", "value" ]
https://github.com/google/nucleus/blob/68d3947fafba1337f294c0668a6e1c7f3f1273e3/nucleus/io/tfrecord.py#L90-L130
kamyu104/LeetCode-Solutions
77605708a927ea3b85aee5a479db733938c7c211
Python/design-circular-deque.py
python
MyCircularDeque.getFront
(self)
return -1 if self.isEmpty() else self.__buffer[self.__start]
Get the front item from the deque. :rtype: int
Get the front item from the deque. :rtype: int
[ "Get", "the", "front", "item", "from", "the", "deque", ".", ":", "rtype", ":", "int" ]
def getFront(self): """ Get the front item from the deque. :rtype: int """ return -1 if self.isEmpty() else self.__buffer[self.__start]
[ "def", "getFront", "(", "self", ")", ":", "return", "-", "1", "if", "self", ".", "isEmpty", "(", ")", "else", "self", ".", "__buffer", "[", "self", ".", "__start", "]" ]
https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/design-circular-deque.py#L61-L66
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/lib-tk/Tkinter.py
python
Misc.winfo_vrootwidth
(self)
return getint( self.tk.call('winfo', 'vrootwidth', self._w))
Return the width of the virtual root window associated with this widget in pixel. If there is no virtual root window return the width of the screen.
Return the width of the virtual root window associated with this widget in pixel. If there is no virtual root window return the width of the screen.
[ "Return", "the", "width", "of", "the", "virtual", "root", "window", "associated", "with", "this", "widget", "in", "pixel", ".", "If", "there", "is", "no", "virtual", "root", "window", "return", "the", "width", "of", "the", "screen", "." ]
def winfo_vrootwidth(self): """Return the width of the virtual root window associated with this widget in pixel. If there is no virtual root window return the width of the screen.""" return getint( self.tk.call('winfo', 'vrootwidth', self._w))
[ "def", "winfo_vrootwidth", "(", "self", ")", ":", "return", "getint", "(", "self", ".", "tk", ".", "call", "(", "'winfo'", ",", "'vrootwidth'", ",", "self", ".", "_w", ")", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib-tk/Tkinter.py#L997-L1002
mingchen/protobuf-ios
0958df34558cd54cb7b6e6ca5c8855bf3d475046
compiler/python/google/protobuf/reflection.py
python
_AddMergeFromStringMethod
(message_descriptor, cls)
Helper for _AddMessageMethods().
Helper for _AddMessageMethods().
[ "Helper", "for", "_AddMessageMethods", "()", "." ]
def _AddMergeFromStringMethod(message_descriptor, cls): """Helper for _AddMessageMethods().""" Decoder = decoder.Decoder def MergeFromString(self, serialized): decoder = Decoder(serialized) byte_count = 0 while not decoder.EndOfStream(): bytes_read = _DeserializeOneEntity(message_descriptor, self, decoder) if not bytes_read: break byte_count += bytes_read return byte_count cls.MergeFromString = MergeFromString
[ "def", "_AddMergeFromStringMethod", "(", "message_descriptor", ",", "cls", ")", ":", "Decoder", "=", "decoder", ".", "Decoder", "def", "MergeFromString", "(", "self", ",", "serialized", ")", ":", "decoder", "=", "Decoder", "(", "serialized", ")", "byte_count", "=", "0", "while", "not", "decoder", ".", "EndOfStream", "(", ")", ":", "bytes_read", "=", "_DeserializeOneEntity", "(", "message_descriptor", ",", "self", ",", "decoder", ")", "if", "not", "bytes_read", ":", "break", "byte_count", "+=", "bytes_read", "return", "byte_count", "cls", ".", "MergeFromString", "=", "MergeFromString" ]
https://github.com/mingchen/protobuf-ios/blob/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/python/google/protobuf/reflection.py#L1231-L1243
fifengine/fifengine
4b62c42e85bec19893cef8e63e6855927cff2c47
engine/python/fife/extensions/pychan/internal.py
python
Manager.addWidget
(self, widget)
Adds Widget to the manager. So the manager "owns" the Widget. Note: As long as the wiget is in self.allWidgets the Python GC can not free it.
Adds Widget to the manager. So the manager "owns" the Widget. Note: As long as the wiget is in self.allWidgets the Python GC can not free it.
[ "Adds", "Widget", "to", "the", "manager", ".", "So", "the", "manager", "owns", "the", "Widget", ".", "Note", ":", "As", "long", "as", "the", "wiget", "is", "in", "self", ".", "allWidgets", "the", "Python", "GC", "can", "not", "free", "it", "." ]
def addWidget(self, widget): """ Adds Widget to the manager. So the manager "owns" the Widget. Note: As long as the wiget is in self.allWidgets the Python GC can not free it. """ if not widget._added: widget._added = True self.allWidgets.add(widget)
[ "def", "addWidget", "(", "self", ",", "widget", ")", ":", "if", "not", "widget", ".", "_added", ":", "widget", ".", "_added", "=", "True", "self", ".", "allWidgets", ".", "add", "(", "widget", ")" ]
https://github.com/fifengine/fifengine/blob/4b62c42e85bec19893cef8e63e6855927cff2c47/engine/python/fife/extensions/pychan/internal.py#L89-L97
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/win32com/client/gencache.py
python
SplitGeneratedFileName
(fname)
return tuple(fname.split('x',4))
Reverse of GetGeneratedFileName()
Reverse of GetGeneratedFileName()
[ "Reverse", "of", "GetGeneratedFileName", "()" ]
def SplitGeneratedFileName(fname): """Reverse of GetGeneratedFileName() """ return tuple(fname.split('x',4))
[ "def", "SplitGeneratedFileName", "(", "fname", ")", ":", "return", "tuple", "(", "fname", ".", "split", "(", "'x'", ",", "4", ")", ")" ]
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/win32com/client/gencache.py#L122-L125
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/distutils/dir_util.py
python
_build_cmdtuple
(path, cmdtuples)
Helper for remove_tree().
Helper for remove_tree().
[ "Helper", "for", "remove_tree", "()", "." ]
def _build_cmdtuple(path, cmdtuples): """Helper for remove_tree().""" for f in os.listdir(path): real_f = os.path.join(path,f) if os.path.isdir(real_f) and not os.path.islink(real_f): _build_cmdtuple(real_f, cmdtuples) else: cmdtuples.append((os.remove, real_f)) cmdtuples.append((os.rmdir, path))
[ "def", "_build_cmdtuple", "(", "path", ",", "cmdtuples", ")", ":", "for", "f", "in", "os", ".", "listdir", "(", "path", ")", ":", "real_f", "=", "os", ".", "path", ".", "join", "(", "path", ",", "f", ")", "if", "os", ".", "path", ".", "isdir", "(", "real_f", ")", "and", "not", "os", ".", "path", ".", "islink", "(", "real_f", ")", ":", "_build_cmdtuple", "(", "real_f", ",", "cmdtuples", ")", "else", ":", "cmdtuples", ".", "append", "(", "(", "os", ".", "remove", ",", "real_f", ")", ")", "cmdtuples", ".", "append", "(", "(", "os", ".", "rmdir", ",", "path", ")", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/distutils/dir_util.py#L168-L176
ceph/ceph
959663007321a369c83218414a29bd9dbc8bda3a
qa/tasks/devstack.py
python
create_volume
(devstack_node, ceph_node, vol_name, size)
return vol_info['id']
:param size: The size of the volume, in GB
:param size: The size of the volume, in GB
[ ":", "param", "size", ":", "The", "size", "of", "the", "volume", "in", "GB" ]
def create_volume(devstack_node, ceph_node, vol_name, size): """ :param size: The size of the volume, in GB """ size = str(size) log.info("Creating a {size}GB volume named {name}...".format( name=vol_name, size=size)) args = ['source', 'devstack/openrc', run.Raw('&&'), 'cinder', 'create', '--display-name', vol_name, size] cinder_create = devstack_node.sh(args, wait=True) vol_info = parse_os_table(cinder_create) log.debug("Volume info: %s", str(vol_info)) try: rbd_output = ceph_node.sh("rbd --id cinder ls -l volumes", wait=True) except run.CommandFailedError: log.debug("Original rbd call failed; retrying without '--id cinder'") rbd_output = ceph_node.sh("rbd ls -l volumes", wait=True) assert vol_info['id'] in rbd_output, \ "Volume not found on Ceph cluster" assert vol_info['size'] == size, \ "Volume size on Ceph cluster is different than specified" return vol_info['id']
[ "def", "create_volume", "(", "devstack_node", ",", "ceph_node", ",", "vol_name", ",", "size", ")", ":", "size", "=", "str", "(", "size", ")", "log", ".", "info", "(", "\"Creating a {size}GB volume named {name}...\"", ".", "format", "(", "name", "=", "vol_name", ",", "size", "=", "size", ")", ")", "args", "=", "[", "'source'", ",", "'devstack/openrc'", ",", "run", ".", "Raw", "(", "'&&'", ")", ",", "'cinder'", ",", "'create'", ",", "'--display-name'", ",", "vol_name", ",", "size", "]", "cinder_create", "=", "devstack_node", ".", "sh", "(", "args", ",", "wait", "=", "True", ")", "vol_info", "=", "parse_os_table", "(", "cinder_create", ")", "log", ".", "debug", "(", "\"Volume info: %s\"", ",", "str", "(", "vol_info", ")", ")", "try", ":", "rbd_output", "=", "ceph_node", ".", "sh", "(", "\"rbd --id cinder ls -l volumes\"", ",", "wait", "=", "True", ")", "except", "run", ".", "CommandFailedError", ":", "log", ".", "debug", "(", "\"Original rbd call failed; retrying without '--id cinder'\"", ")", "rbd_output", "=", "ceph_node", ".", "sh", "(", "\"rbd ls -l volumes\"", ",", "wait", "=", "True", ")", "assert", "vol_info", "[", "'id'", "]", "in", "rbd_output", ",", "\"Volume not found on Ceph cluster\"", "assert", "vol_info", "[", "'size'", "]", "==", "size", ",", "\"Volume size on Ceph cluster is different than specified\"", "return", "vol_info", "[", "'id'", "]" ]
https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/qa/tasks/devstack.py#L338-L362
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/functools.py
python
update_wrapper
(wrapper, wrapped, assigned = WRAPPER_ASSIGNMENTS, updated = WRAPPER_UPDATES)
return wrapper
Update a wrapper function to look like the wrapped function wrapper is the function to be updated wrapped is the original function assigned is a tuple naming the attributes assigned directly from the wrapped function to the wrapper function (defaults to functools.WRAPPER_ASSIGNMENTS) updated is a tuple naming the attributes of the wrapper that are updated with the corresponding attribute from the wrapped function (defaults to functools.WRAPPER_UPDATES)
Update a wrapper function to look like the wrapped function
[ "Update", "a", "wrapper", "function", "to", "look", "like", "the", "wrapped", "function" ]
def update_wrapper(wrapper, wrapped, assigned = WRAPPER_ASSIGNMENTS, updated = WRAPPER_UPDATES): """Update a wrapper function to look like the wrapped function wrapper is the function to be updated wrapped is the original function assigned is a tuple naming the attributes assigned directly from the wrapped function to the wrapper function (defaults to functools.WRAPPER_ASSIGNMENTS) updated is a tuple naming the attributes of the wrapper that are updated with the corresponding attribute from the wrapped function (defaults to functools.WRAPPER_UPDATES) """ for attr in assigned: try: value = getattr(wrapped, attr) except AttributeError: pass else: setattr(wrapper, attr, value) for attr in updated: getattr(wrapper, attr).update(getattr(wrapped, attr, {})) # Issue #17482: set __wrapped__ last so we don't inadvertently copy it # from the wrapped function when updating __dict__ wrapper.__wrapped__ = wrapped # Return the wrapper so this can be used as a decorator via partial() return wrapper
[ "def", "update_wrapper", "(", "wrapper", ",", "wrapped", ",", "assigned", "=", "WRAPPER_ASSIGNMENTS", ",", "updated", "=", "WRAPPER_UPDATES", ")", ":", "for", "attr", "in", "assigned", ":", "try", ":", "value", "=", "getattr", "(", "wrapped", ",", "attr", ")", "except", "AttributeError", ":", "pass", "else", ":", "setattr", "(", "wrapper", ",", "attr", ",", "value", ")", "for", "attr", "in", "updated", ":", "getattr", "(", "wrapper", ",", "attr", ")", ".", "update", "(", "getattr", "(", "wrapped", ",", "attr", ",", "{", "}", ")", ")", "# Issue #17482: set __wrapped__ last so we don't inadvertently copy it", "# from the wrapped function when updating __dict__", "wrapper", ".", "__wrapped__", "=", "wrapped", "# Return the wrapper so this can be used as a decorator via partial()", "return", "wrapper" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/functools.py#L35-L63
sdhash/sdhash
b9eff63e4e5867e910f41fd69032bbb1c94a2a5e
external/tools/build/v2/build/targets.py
python
AbstractTarget.__init__
(self, name, project, manager = None)
manager: the Manager object name: name of the target project: the project target to which this one belongs manager:the manager object. If none, uses project.manager ()
manager: the Manager object name: name of the target project: the project target to which this one belongs manager:the manager object. If none, uses project.manager ()
[ "manager", ":", "the", "Manager", "object", "name", ":", "name", "of", "the", "target", "project", ":", "the", "project", "target", "to", "which", "this", "one", "belongs", "manager", ":", "the", "manager", "object", ".", "If", "none", "uses", "project", ".", "manager", "()" ]
def __init__ (self, name, project, manager = None): """ manager: the Manager object name: name of the target project: the project target to which this one belongs manager:the manager object. If none, uses project.manager () """ assert (isinstance (project, ProjectTarget)) # Note: it might seem that we don't need either name or project at all. # However, there are places where we really need it. One example is error # messages which should name problematic targets. Another is setting correct # paths for sources and generated files. # Why allow manager to be specified? Because otherwise project target could not derive # from this class. if manager: self.manager_ = manager else: self.manager_ = project.manager () self.name_ = name self.project_ = project
[ "def", "__init__", "(", "self", ",", "name", ",", "project", ",", "manager", "=", "None", ")", ":", "assert", "(", "isinstance", "(", "project", ",", "ProjectTarget", ")", ")", "# Note: it might seem that we don't need either name or project at all.", "# However, there are places where we really need it. One example is error", "# messages which should name problematic targets. Another is setting correct", "# paths for sources and generated files.", "# Why allow manager to be specified? Because otherwise project target could not derive", "# from this class.", "if", "manager", ":", "self", ".", "manager_", "=", "manager", "else", ":", "self", ".", "manager_", "=", "project", ".", "manager", "(", ")", "self", ".", "name_", "=", "name", "self", ".", "project_", "=", "project" ]
https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/external/tools/build/v2/build/targets.py#L271-L291
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/compiler/xla/xla.py
python
check_function_argument_count
(func, input_arity, infeed_queue)
return None
Validate the number of input arguments to an XLA function. Args: func: the Python function that will be called to generate the body of an XLA computation graph. input_arity: the number of explicit arguments supplied by the caller. infeed_queue: if not None, the infeed queue that will supply additional arguments to the function. Returns: None if function can be called with the supplied number of arguments, or an error string if it cannot.
Validate the number of input arguments to an XLA function.
[ "Validate", "the", "number", "of", "input", "arguments", "to", "an", "XLA", "function", "." ]
def check_function_argument_count(func, input_arity, infeed_queue): """Validate the number of input arguments to an XLA function. Args: func: the Python function that will be called to generate the body of an XLA computation graph. input_arity: the number of explicit arguments supplied by the caller. infeed_queue: if not None, the infeed queue that will supply additional arguments to the function. Returns: None if function can be called with the supplied number of arguments, or an error string if it cannot. """ def format_error(complaint, quantity): return '%s %d argument%s' % (complaint, quantity, '' if quantity == 1 else 's') num_args_supplied = input_arity if infeed_queue is not None: num_args_supplied += infeed_queue.number_of_tuple_elements arg_spec = tf_inspect.getargspec(func) num_func_args = len(arg_spec.args) if arg_spec.defaults is None: num_func_defaults = 0 else: num_func_defaults = len(arg_spec.defaults) min_func_args = num_func_args - num_func_defaults if num_args_supplied < min_func_args: # The required number of arguments is not enough to call the function. if num_func_defaults == 0 and arg_spec.varargs is None: return format_error('exactly', num_func_args) else: return format_error('at least', min_func_args) if arg_spec.varargs is None and num_args_supplied > num_func_args: # The required number of arguments is too many to call the function. if num_func_defaults == 0: return format_error('exactly', num_func_args) else: return format_error('at most', num_func_args) # Reaching here means either # 1) There are varargs, func can accept any number of arguments greater than # the minimum. # 2) Number of supplied arguments falls in range of acceptable argument count # of func. return None
[ "def", "check_function_argument_count", "(", "func", ",", "input_arity", ",", "infeed_queue", ")", ":", "def", "format_error", "(", "complaint", ",", "quantity", ")", ":", "return", "'%s %d argument%s'", "%", "(", "complaint", ",", "quantity", ",", "''", "if", "quantity", "==", "1", "else", "'s'", ")", "num_args_supplied", "=", "input_arity", "if", "infeed_queue", "is", "not", "None", ":", "num_args_supplied", "+=", "infeed_queue", ".", "number_of_tuple_elements", "arg_spec", "=", "tf_inspect", ".", "getargspec", "(", "func", ")", "num_func_args", "=", "len", "(", "arg_spec", ".", "args", ")", "if", "arg_spec", ".", "defaults", "is", "None", ":", "num_func_defaults", "=", "0", "else", ":", "num_func_defaults", "=", "len", "(", "arg_spec", ".", "defaults", ")", "min_func_args", "=", "num_func_args", "-", "num_func_defaults", "if", "num_args_supplied", "<", "min_func_args", ":", "# The required number of arguments is not enough to call the function.", "if", "num_func_defaults", "==", "0", "and", "arg_spec", ".", "varargs", "is", "None", ":", "return", "format_error", "(", "'exactly'", ",", "num_func_args", ")", "else", ":", "return", "format_error", "(", "'at least'", ",", "min_func_args", ")", "if", "arg_spec", ".", "varargs", "is", "None", "and", "num_args_supplied", ">", "num_func_args", ":", "# The required number of arguments is too many to call the function.", "if", "num_func_defaults", "==", "0", ":", "return", "format_error", "(", "'exactly'", ",", "num_func_args", ")", "else", ":", "return", "format_error", "(", "'at most'", ",", "num_func_args", ")", "# Reaching here means either", "# 1) There are varargs, func can accept any number of arguments greater than", "# the minimum.", "# 2) Number of supplied arguments falls in range of acceptable argument count", "# of func.", "return", "None" ]
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/compiler/xla/xla.py#L572-L617
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
tools/symsrc/pefile.py
python
PE.parse_import_directory
(self, rva, size)
return import_descs
Walk and parse the import directory.
Walk and parse the import directory.
[ "Walk", "and", "parse", "the", "import", "directory", "." ]
def parse_import_directory(self, rva, size): """Walk and parse the import directory.""" import_descs = [] while True: try: # If the RVA is invalid all would blow up. Some EXEs seem to be # specially nasty and have an invalid RVA. data = self.get_data(rva) except PEFormatError, e: self.__warnings.append( 'Error parsing the Import directory at RVA: 0x%x' % ( rva ) ) break import_desc = self.__unpack_data__( self.__IMAGE_IMPORT_DESCRIPTOR_format__, data, file_offset = self.get_offset_from_rva(rva) ) # If the structure is all zeores, we reached the end of the list if not import_desc or import_desc.all_zeroes(): break rva += import_desc.sizeof() try: import_data = self.parse_imports( import_desc.OriginalFirstThunk, import_desc.FirstThunk, import_desc.ForwarderChain) except PEFormatError, excp: self.__warnings.append( 'Error parsing the Import directory. ' + 'Invalid Import data at RVA: 0x%x' % ( rva ) ) break #raise excp if not import_data: continue dll = self.get_string_at_rva(import_desc.Name) if dll: import_descs.append( ImportDescData( struct = import_desc, imports = import_data, dll = dll)) return import_descs
[ "def", "parse_import_directory", "(", "self", ",", "rva", ",", "size", ")", ":", "import_descs", "=", "[", "]", "while", "True", ":", "try", ":", "# If the RVA is invalid all would blow up. Some EXEs seem to be", "# specially nasty and have an invalid RVA.", "data", "=", "self", ".", "get_data", "(", "rva", ")", "except", "PEFormatError", ",", "e", ":", "self", ".", "__warnings", ".", "append", "(", "'Error parsing the Import directory at RVA: 0x%x'", "%", "(", "rva", ")", ")", "break", "import_desc", "=", "self", ".", "__unpack_data__", "(", "self", ".", "__IMAGE_IMPORT_DESCRIPTOR_format__", ",", "data", ",", "file_offset", "=", "self", ".", "get_offset_from_rva", "(", "rva", ")", ")", "# If the structure is all zeores, we reached the end of the list", "if", "not", "import_desc", "or", "import_desc", ".", "all_zeroes", "(", ")", ":", "break", "rva", "+=", "import_desc", ".", "sizeof", "(", ")", "try", ":", "import_data", "=", "self", ".", "parse_imports", "(", "import_desc", ".", "OriginalFirstThunk", ",", "import_desc", ".", "FirstThunk", ",", "import_desc", ".", "ForwarderChain", ")", "except", "PEFormatError", ",", "excp", ":", "self", ".", "__warnings", ".", "append", "(", "'Error parsing the Import directory. '", "+", "'Invalid Import data at RVA: 0x%x'", "%", "(", "rva", ")", ")", "break", "#raise excp", "if", "not", "import_data", ":", "continue", "dll", "=", "self", ".", "get_string_at_rva", "(", "import_desc", ".", "Name", ")", "if", "dll", ":", "import_descs", ".", "append", "(", "ImportDescData", "(", "struct", "=", "import_desc", ",", "imports", "=", "import_data", ",", "dll", "=", "dll", ")", ")", "return", "import_descs" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/symsrc/pefile.py#L2744-L2791
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/tools/compatibility/ast_edits.py
python
_PastaEditVisitor.visit_Attribute
(self, node)
Handle bare Attributes i.e. [tf.foo, tf.bar].
Handle bare Attributes i.e. [tf.foo, tf.bar].
[ "Handle", "bare", "Attributes", "i", ".", "e", ".", "[", "tf", ".", "foo", "tf", ".", "bar", "]", "." ]
def visit_Attribute(self, node): # pylint: disable=invalid-name """Handle bare Attributes i.e. [tf.foo, tf.bar].""" assert self._stack[-1] is node full_name = self._get_full_name(node) if full_name: parent = self._stack[-2] # Make sure the warning comes first, otherwise the name may have changed self._maybe_add_warning(node, full_name) # Once we did a modification, node is invalid and not worth inspecting # further. Also, we only perform modifications for simple nodes, so # There'd be no point in descending further. if self._maybe_rename(parent, node, full_name): return if self._maybe_change_to_function_call(parent, node, full_name): return # The isinstance check is enough -- a bare Attribute is never root. i = 2 while isinstance(self._stack[-i], ast.Attribute): i += 1 whole_name = pasta.dump(self._stack[-(i-1)]) self._maybe_add_module_deprecation_warning(node, full_name, whole_name) self.generic_visit(node)
[ "def", "visit_Attribute", "(", "self", ",", "node", ")", ":", "# pylint: disable=invalid-name", "assert", "self", ".", "_stack", "[", "-", "1", "]", "is", "node", "full_name", "=", "self", ".", "_get_full_name", "(", "node", ")", "if", "full_name", ":", "parent", "=", "self", ".", "_stack", "[", "-", "2", "]", "# Make sure the warning comes first, otherwise the name may have changed", "self", ".", "_maybe_add_warning", "(", "node", ",", "full_name", ")", "# Once we did a modification, node is invalid and not worth inspecting", "# further. Also, we only perform modifications for simple nodes, so", "# There'd be no point in descending further.", "if", "self", ".", "_maybe_rename", "(", "parent", ",", "node", ",", "full_name", ")", ":", "return", "if", "self", ".", "_maybe_change_to_function_call", "(", "parent", ",", "node", ",", "full_name", ")", ":", "return", "# The isinstance check is enough -- a bare Attribute is never root.", "i", "=", "2", "while", "isinstance", "(", "self", ".", "_stack", "[", "-", "i", "]", ",", "ast", ".", "Attribute", ")", ":", "i", "+=", "1", "whole_name", "=", "pasta", ".", "dump", "(", "self", ".", "_stack", "[", "-", "(", "i", "-", "1", ")", "]", ")", "self", ".", "_maybe_add_module_deprecation_warning", "(", "node", ",", "full_name", ",", "whole_name", ")", "self", ".", "generic_visit", "(", "node", ")" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/tools/compatibility/ast_edits.py#L579-L606
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
third_party/closure_linter/closure_linter/statetracker.py
python
StateTracker.IsBlockClose
(self)
return self._is_block_close
Returns true if the current token is a block close. Returns: True if the current token is a block close.
Returns true if the current token is a block close.
[ "Returns", "true", "if", "the", "current", "token", "is", "a", "block", "close", "." ]
def IsBlockClose(self): """Returns true if the current token is a block close. Returns: True if the current token is a block close. """ return self._is_block_close
[ "def", "IsBlockClose", "(", "self", ")", ":", "return", "self", ".", "_is_block_close" ]
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/closure_linter/closure_linter/statetracker.py#L669-L675
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/re.py
python
purge
()
Clear the regular expression caches
Clear the regular expression caches
[ "Clear", "the", "regular", "expression", "caches" ]
def purge(): "Clear the regular expression caches" _cache.clear() _compile_repl.cache_clear()
[ "def", "purge", "(", ")", ":", "_cache", ".", "clear", "(", ")", "_compile_repl", ".", "cache_clear", "(", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/re.py#L238-L241
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/tpu/tpu_feed.py
python
InfeedQueue.split_inputs_and_generate_enqueue_ops
(self, inputs, device_assignment=None, placement_function=None, tpu_ordinal_function=None)
return [ self._generate_enqueue_op( shard, name_prefix, index, device=placement_function(index), tpu_ordinal=tpu_ordinal_function(index)) for (shard, index) in zip(sharded_inputs, range(self.number_of_shards)) ]
POORLY-PERFORMING ON MULTI-HOST SYSTEMS. Generates the host-side Ops to enqueue a tuple. This method performs poorly because it takes an entire input on a single host, splits it, and distributes it to all of the cores. It is present only to simplify tutorial examples. inputs is a list of Tensors to use to feed the queue. Each input is split into self.number_of_shards shards. Returns an Op for each shard to enqueue the shard. The Op for shard i is placed on device placement_function(i). Implicitly freezes the queue configuration if it is not already frozen. If the configuration has already been frozen, and is not compatible with the types and shapes of inputs, an error will be raised. Args: inputs: a list of Tensors which indicates the types and shapes of the queue tuple. device_assignment: if not `None`, a TPU `DeviceAssignment`. If device_assignment is not `None`, but `placement_function` and `ordinal_function` are None, then `device_assignment` will be used to place infeeds on the first k TPU shards, where k is the number of shards in the queue. If all three are `None`, then default placement and ordinal functions are used. placement_function: if not None, a function that takes the shard index as input and returns a device string indicating which device the shard's infeed should be placed on. If placement_function and tpu_ordinal_function are None, inputs are sharded round-robin across the devices in the system. tpu_ordinal_function: if not None, a function that takes the shard index as input and returns the ordinal of the TPU device the shard's infeed should be placed on. If placement_function and tpu_ordinal_function are None, inputs are sharded round-robin across the devices in the system. Returns: A list of host-side Ops, one for each shard, that when executed together will enqueue a full-size element of infeed. Raises: ValueError: if the queue configuration has previously been frozen and the shapes of the elements of inputs are not compatible with the frozen configuration. TypeError: if the queue configuration has previously been frozen and the types of the elements of inputs are not compatible with the frozen configuration.
POORLY-PERFORMING ON MULTI-HOST SYSTEMS.
[ "POORLY", "-", "PERFORMING", "ON", "MULTI", "-", "HOST", "SYSTEMS", "." ]
def split_inputs_and_generate_enqueue_ops(self, inputs, device_assignment=None, placement_function=None, tpu_ordinal_function=None): """POORLY-PERFORMING ON MULTI-HOST SYSTEMS. Generates the host-side Ops to enqueue a tuple. This method performs poorly because it takes an entire input on a single host, splits it, and distributes it to all of the cores. It is present only to simplify tutorial examples. inputs is a list of Tensors to use to feed the queue. Each input is split into self.number_of_shards shards. Returns an Op for each shard to enqueue the shard. The Op for shard i is placed on device placement_function(i). Implicitly freezes the queue configuration if it is not already frozen. If the configuration has already been frozen, and is not compatible with the types and shapes of inputs, an error will be raised. Args: inputs: a list of Tensors which indicates the types and shapes of the queue tuple. device_assignment: if not `None`, a TPU `DeviceAssignment`. If device_assignment is not `None`, but `placement_function` and `ordinal_function` are None, then `device_assignment` will be used to place infeeds on the first k TPU shards, where k is the number of shards in the queue. If all three are `None`, then default placement and ordinal functions are used. placement_function: if not None, a function that takes the shard index as input and returns a device string indicating which device the shard's infeed should be placed on. If placement_function and tpu_ordinal_function are None, inputs are sharded round-robin across the devices in the system. tpu_ordinal_function: if not None, a function that takes the shard index as input and returns the ordinal of the TPU device the shard's infeed should be placed on. If placement_function and tpu_ordinal_function are None, inputs are sharded round-robin across the devices in the system. Returns: A list of host-side Ops, one for each shard, that when executed together will enqueue a full-size element of infeed. Raises: ValueError: if the queue configuration has previously been frozen and the shapes of the elements of inputs are not compatible with the frozen configuration. TypeError: if the queue configuration has previously been frozen and the types of the elements of inputs are not compatible with the frozen configuration. """ if device_assignment is None: if placement_function is None: placement_function = self._default_placement_function if tpu_ordinal_function is None: tpu_ordinal_function = self._default_ordinal_function else: def _placement_function_from_map(index): return device_assignment.host_device(replica=index) def _ordinal_function_from_map(index): return device_assignment.tpu_ordinal(replica=index) if placement_function is None: placement_function = _placement_function_from_map if tpu_ordinal_function is None: tpu_ordinal_function = _ordinal_function_from_map self.set_configuration_from_input_tensors(inputs) self.freeze() if self._generated_enqueue_ops and not ops.inside_function(): raise ValueError("Can't generate two enqueue Ops from the same queue") self._generated_enqueue_ops = True split_name_prefix = "%s/split" % self._name if self.number_of_shards == 1: transposed_sharded_inputs = [[inp] for inp in inputs] else: def split_fn(inp, num_shards, axis, name): with ops.colocate_with(inp): return array_ops.split(inp, num_shards, axis=axis, name=name) transposed_sharded_inputs = [ split_fn( inp, self.number_of_shards, axis=policy.shard_dimension, name="%s/%d" % (split_name_prefix, index)) for (inp, policy, index) in zip(inputs, self._sharding_policies, range(self.number_of_tuple_elements)) ] sharded_inputs = [[shard[i] for shard in transposed_sharded_inputs] for i in range(self.number_of_shards)] name_prefix = "%s/enqueue" % self._name return [ self._generate_enqueue_op( shard, name_prefix, index, device=placement_function(index), tpu_ordinal=tpu_ordinal_function(index)) for (shard, index) in zip(sharded_inputs, range(self.number_of_shards)) ]
[ "def", "split_inputs_and_generate_enqueue_ops", "(", "self", ",", "inputs", ",", "device_assignment", "=", "None", ",", "placement_function", "=", "None", ",", "tpu_ordinal_function", "=", "None", ")", ":", "if", "device_assignment", "is", "None", ":", "if", "placement_function", "is", "None", ":", "placement_function", "=", "self", ".", "_default_placement_function", "if", "tpu_ordinal_function", "is", "None", ":", "tpu_ordinal_function", "=", "self", ".", "_default_ordinal_function", "else", ":", "def", "_placement_function_from_map", "(", "index", ")", ":", "return", "device_assignment", ".", "host_device", "(", "replica", "=", "index", ")", "def", "_ordinal_function_from_map", "(", "index", ")", ":", "return", "device_assignment", ".", "tpu_ordinal", "(", "replica", "=", "index", ")", "if", "placement_function", "is", "None", ":", "placement_function", "=", "_placement_function_from_map", "if", "tpu_ordinal_function", "is", "None", ":", "tpu_ordinal_function", "=", "_ordinal_function_from_map", "self", ".", "set_configuration_from_input_tensors", "(", "inputs", ")", "self", ".", "freeze", "(", ")", "if", "self", ".", "_generated_enqueue_ops", "and", "not", "ops", ".", "inside_function", "(", ")", ":", "raise", "ValueError", "(", "\"Can't generate two enqueue Ops from the same queue\"", ")", "self", ".", "_generated_enqueue_ops", "=", "True", "split_name_prefix", "=", "\"%s/split\"", "%", "self", ".", "_name", "if", "self", ".", "number_of_shards", "==", "1", ":", "transposed_sharded_inputs", "=", "[", "[", "inp", "]", "for", "inp", "in", "inputs", "]", "else", ":", "def", "split_fn", "(", "inp", ",", "num_shards", ",", "axis", ",", "name", ")", ":", "with", "ops", ".", "colocate_with", "(", "inp", ")", ":", "return", "array_ops", ".", "split", "(", "inp", ",", "num_shards", ",", "axis", "=", "axis", ",", "name", "=", "name", ")", "transposed_sharded_inputs", "=", "[", "split_fn", "(", "inp", ",", "self", ".", "number_of_shards", ",", "axis", "=", "policy", ".", "shard_dimension", ",", "name", "=", "\"%s/%d\"", "%", "(", "split_name_prefix", ",", "index", ")", ")", "for", "(", "inp", ",", "policy", ",", "index", ")", "in", "zip", "(", "inputs", ",", "self", ".", "_sharding_policies", ",", "range", "(", "self", ".", "number_of_tuple_elements", ")", ")", "]", "sharded_inputs", "=", "[", "[", "shard", "[", "i", "]", "for", "shard", "in", "transposed_sharded_inputs", "]", "for", "i", "in", "range", "(", "self", ".", "number_of_shards", ")", "]", "name_prefix", "=", "\"%s/enqueue\"", "%", "self", ".", "_name", "return", "[", "self", ".", "_generate_enqueue_op", "(", "shard", ",", "name_prefix", ",", "index", ",", "device", "=", "placement_function", "(", "index", ")", ",", "tpu_ordinal", "=", "tpu_ordinal_function", "(", "index", ")", ")", "for", "(", "shard", ",", "index", ")", "in", "zip", "(", "sharded_inputs", ",", "range", "(", "self", ".", "number_of_shards", ")", ")", "]" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/tpu/tpu_feed.py#L640-L746
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/gsutil/third_party/protorpc/protorpc/messages.py
python
Enum.def_enum
(dct, name)
return type(name, (Enum,), dct)
Define enum class from dictionary. Args: dct: Dictionary of enumerated values for type. name: Name of enum.
Define enum class from dictionary.
[ "Define", "enum", "class", "from", "dictionary", "." ]
def def_enum(dct, name): """Define enum class from dictionary. Args: dct: Dictionary of enumerated values for type. name: Name of enum. """ return type(name, (Enum,), dct)
[ "def", "def_enum", "(", "dct", ",", "name", ")", ":", "return", "type", "(", "name", ",", "(", "Enum", ",", ")", ",", "dct", ")" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/protorpc/protorpc/messages.py#L532-L539
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/prompt-toolkit/py3/prompt_toolkit/contrib/telnet/server.py
python
TelnetConnection.erase_screen
(self)
Erase the screen and move the cursor to the top.
Erase the screen and move the cursor to the top.
[ "Erase", "the", "screen", "and", "move", "the", "cursor", "to", "the", "top", "." ]
def erase_screen(self) -> None: """ Erase the screen and move the cursor to the top. """ if self.vt100_output is None: return self.vt100_output.erase_screen() self.vt100_output.cursor_goto(0, 0) self.vt100_output.flush()
[ "def", "erase_screen", "(", "self", ")", "->", "None", ":", "if", "self", ".", "vt100_output", "is", "None", ":", "return", "self", ".", "vt100_output", ".", "erase_screen", "(", ")", "self", ".", "vt100_output", ".", "cursor_goto", "(", "0", ",", "0", ")", "self", ".", "vt100_output", ".", "flush", "(", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/contrib/telnet/server.py#L253-L261
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/py/py/_path/local.py
python
LocalPath.dirpath
(self, *args, **kwargs)
return super(LocalPath, self).dirpath(*args, **kwargs)
return the directory path joined with any given path arguments.
return the directory path joined with any given path arguments.
[ "return", "the", "directory", "path", "joined", "with", "any", "given", "path", "arguments", "." ]
def dirpath(self, *args, **kwargs): """ return the directory path joined with any given path arguments. """ if not kwargs: path = object.__new__(self.__class__) path.strpath = dirname(self.strpath) if args: path = path.join(*args) return path return super(LocalPath, self).dirpath(*args, **kwargs)
[ "def", "dirpath", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "kwargs", ":", "path", "=", "object", ".", "__new__", "(", "self", ".", "__class__", ")", "path", ".", "strpath", "=", "dirname", "(", "self", ".", "strpath", ")", "if", "args", ":", "path", "=", "path", ".", "join", "(", "*", "args", ")", "return", "path", "return", "super", "(", "LocalPath", ",", "self", ")", ".", "dirpath", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/py/py/_path/local.py#L320-L328
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/util.py
python
IntValidator.Validate
(self, win)
return val.isdigit()
Validate an window value @param win: window to validate
Validate an window value @param win: window to validate
[ "Validate", "an", "window", "value", "@param", "win", ":", "window", "to", "validate" ]
def Validate(self, win): """Validate an window value @param win: window to validate """ val = win.GetValue() return val.isdigit()
[ "def", "Validate", "(", "self", ",", "win", ")", ":", "val", "=", "win", ".", "GetValue", "(", ")", "return", "val", ".", "isdigit", "(", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/util.py#L769-L775
epiqc/ScaffCC
66a79944ee4cd116b27bc1a69137276885461db8
clang/tools/scan-build-py/libscanbuild/report.py
python
encode_value
(container, key, encode)
Run 'encode' on 'container[key]' value and update it.
Run 'encode' on 'container[key]' value and update it.
[ "Run", "encode", "on", "container", "[", "key", "]", "value", "and", "update", "it", "." ]
def encode_value(container, key, encode): """ Run 'encode' on 'container[key]' value and update it. """ if key in container: value = encode(container[key]) container.update({key: value})
[ "def", "encode_value", "(", "container", ",", "key", ",", "encode", ")", ":", "if", "key", "in", "container", ":", "value", "=", "encode", "(", "container", "[", "key", "]", ")", "container", ".", "update", "(", "{", "key", ":", "value", "}", ")" ]
https://github.com/epiqc/ScaffCC/blob/66a79944ee4cd116b27bc1a69137276885461db8/clang/tools/scan-build-py/libscanbuild/report.py#L434-L439
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py
python
Misc.winfo_pointery
(self)
return getint( self.tk.call('winfo', 'pointery', self._w))
Return the y coordinate of the pointer on the root window.
Return the y coordinate of the pointer on the root window.
[ "Return", "the", "y", "coordinate", "of", "the", "pointer", "on", "the", "root", "window", "." ]
def winfo_pointery(self): """Return the y coordinate of the pointer on the root window.""" return getint( self.tk.call('winfo', 'pointery', self._w))
[ "def", "winfo_pointery", "(", "self", ")", ":", "return", "getint", "(", "self", ".", "tk", ".", "call", "(", "'winfo'", ",", "'pointery'", ",", "self", ".", "_w", ")", ")" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L821-L824
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/StringIO.py
python
StringIO.read
(self, n = -1)
return r
Read at most size bytes from the file (less if the read hits EOF before obtaining size bytes). If the size argument is negative or omitted, read all data until EOF is reached. The bytes are returned as a string object. An empty string is returned when EOF is encountered immediately.
Read at most size bytes from the file (less if the read hits EOF before obtaining size bytes).
[ "Read", "at", "most", "size", "bytes", "from", "the", "file", "(", "less", "if", "the", "read", "hits", "EOF", "before", "obtaining", "size", "bytes", ")", "." ]
def read(self, n = -1): """Read at most size bytes from the file (less if the read hits EOF before obtaining size bytes). If the size argument is negative or omitted, read all data until EOF is reached. The bytes are returned as a string object. An empty string is returned when EOF is encountered immediately. """ _complain_ifclosed(self.closed) if self.buflist: self.buf += ''.join(self.buflist) self.buflist = [] if n is None or n < 0: newpos = self.len else: newpos = min(self.pos+n, self.len) r = self.buf[self.pos:newpos] self.pos = newpos return r
[ "def", "read", "(", "self", ",", "n", "=", "-", "1", ")", ":", "_complain_ifclosed", "(", "self", ".", "closed", ")", "if", "self", ".", "buflist", ":", "self", ".", "buf", "+=", "''", ".", "join", "(", "self", ".", "buflist", ")", "self", ".", "buflist", "=", "[", "]", "if", "n", "is", "None", "or", "n", "<", "0", ":", "newpos", "=", "self", ".", "len", "else", ":", "newpos", "=", "min", "(", "self", ".", "pos", "+", "n", ",", "self", ".", "len", ")", "r", "=", "self", ".", "buf", "[", "self", ".", "pos", ":", "newpos", "]", "self", ".", "pos", "=", "newpos", "return", "r" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/StringIO.py#L119-L137
kamyu104/LeetCode-Solutions
77605708a927ea3b85aee5a479db733938c7c211
Python/minimum-possible-integer-after-at-most-k-adjacent-swaps-on-digits.py
python
Solution.minInteger
(self, num, k)
return "".join(map(str, result))
:type num: str :type k: int :rtype: str
:type num: str :type k: int :rtype: str
[ ":", "type", "num", ":", "str", ":", "type", "k", ":", "int", ":", "rtype", ":", "str" ]
def minInteger(self, num, k): """ :type num: str :type k: int :rtype: str """ lookup = collections.defaultdict(list) bit = BIT(len(num)+1) for i in reversed(xrange(len(num))): bit.add(i+1, 1) lookup[int(num[i])].append(i+1) result = [] for _ in xrange(len(num)): for d in xrange(10): if lookup[d] and bit.sum(lookup[d][-1]-1) <= k: k -= bit.sum(lookup[d][-1]-1) bit.add(lookup[d].pop(), -1) result.append(d) break return "".join(map(str, result))
[ "def", "minInteger", "(", "self", ",", "num", ",", "k", ")", ":", "lookup", "=", "collections", ".", "defaultdict", "(", "list", ")", "bit", "=", "BIT", "(", "len", "(", "num", ")", "+", "1", ")", "for", "i", "in", "reversed", "(", "xrange", "(", "len", "(", "num", ")", ")", ")", ":", "bit", ".", "add", "(", "i", "+", "1", ",", "1", ")", "lookup", "[", "int", "(", "num", "[", "i", "]", ")", "]", ".", "append", "(", "i", "+", "1", ")", "result", "=", "[", "]", "for", "_", "in", "xrange", "(", "len", "(", "num", ")", ")", ":", "for", "d", "in", "xrange", "(", "10", ")", ":", "if", "lookup", "[", "d", "]", "and", "bit", ".", "sum", "(", "lookup", "[", "d", "]", "[", "-", "1", "]", "-", "1", ")", "<=", "k", ":", "k", "-=", "bit", ".", "sum", "(", "lookup", "[", "d", "]", "[", "-", "1", "]", "-", "1", ")", "bit", ".", "add", "(", "lookup", "[", "d", "]", ".", "pop", "(", ")", ",", "-", "1", ")", "result", ".", "append", "(", "d", ")", "break", "return", "\"\"", ".", "join", "(", "map", "(", "str", ",", "result", ")", ")" ]
https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/minimum-possible-integer-after-at-most-k-adjacent-swaps-on-digits.py#L25-L44
rapidsai/cudf
d5b2448fc69f17509304d594f029d0df56984962
python/cudf/cudf/core/index.py
python
DatetimeIndex.dayofyear
(self)
return self._get_dt_field("day_of_year")
The day of the year, from 1-365 in non-leap years and from 1-366 in leap years. Examples -------- >>> import pandas as pd >>> import cudf >>> datetime_index = cudf.Index(pd.date_range("2016-12-31", ... "2017-01-08", freq="D")) >>> datetime_index DatetimeIndex(['2016-12-31', '2017-01-01', '2017-01-02', '2017-01-03', '2017-01-04', '2017-01-05', '2017-01-06', '2017-01-07', '2017-01-08'], dtype='datetime64[ns]') >>> datetime_index.dayofyear Int16Index([366, 1, 2, 3, 4, 5, 6, 7, 8], dtype='int16')
The day of the year, from 1-365 in non-leap years and from 1-366 in leap years.
[ "The", "day", "of", "the", "year", "from", "1", "-", "365", "in", "non", "-", "leap", "years", "and", "from", "1", "-", "366", "in", "leap", "years", "." ]
def dayofyear(self): """ The day of the year, from 1-365 in non-leap years and from 1-366 in leap years. Examples -------- >>> import pandas as pd >>> import cudf >>> datetime_index = cudf.Index(pd.date_range("2016-12-31", ... "2017-01-08", freq="D")) >>> datetime_index DatetimeIndex(['2016-12-31', '2017-01-01', '2017-01-02', '2017-01-03', '2017-01-04', '2017-01-05', '2017-01-06', '2017-01-07', '2017-01-08'], dtype='datetime64[ns]') >>> datetime_index.dayofyear Int16Index([366, 1, 2, 3, 4, 5, 6, 7, 8], dtype='int16') """ return self._get_dt_field("day_of_year")
[ "def", "dayofyear", "(", "self", ")", ":", "return", "self", ".", "_get_dt_field", "(", "\"day_of_year\"", ")" ]
https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/index.py#L1753-L1772
lukasmonk/lucaschess
13e2e5cb13b38a720ccf897af649054a64bcb914
Code/SQL/DBF.py
python
DBF.skip
(self, num=1)
return self.goto(num + self.recno)
Salta un registro.
Salta un registro.
[ "Salta", "un", "registro", "." ]
def skip(self, num=1): """ Salta un registro. """ return self.goto(num + self.recno)
[ "def", "skip", "(", "self", ",", "num", "=", "1", ")", ":", "return", "self", ".", "goto", "(", "num", "+", "self", ".", "recno", ")" ]
https://github.com/lukasmonk/lucaschess/blob/13e2e5cb13b38a720ccf897af649054a64bcb914/Code/SQL/DBF.py#L241-L245
envoyproxy/envoy-wasm
ab5d9381fdf92a1efa0b87cff80036b5b3e81198
source/extensions/filters/network/kafka/protocol/generator.py
python
StatefulProcessor.parse_type
(self, type_name, field_spec, highest_possible_version)
Parse a given type element - returns an array type, primitive (e.g. uint32_t) or complex one.
Parse a given type element - returns an array type, primitive (e.g. uint32_t) or complex one.
[ "Parse", "a", "given", "type", "element", "-", "returns", "an", "array", "type", "primitive", "(", "e", ".", "g", ".", "uint32_t", ")", "or", "complex", "one", "." ]
def parse_type(self, type_name, field_spec, highest_possible_version): """ Parse a given type element - returns an array type, primitive (e.g. uint32_t) or complex one. """ if (type_name.startswith('[]')): # In spec files, array types are defined as `[]underlying_type` instead of having its own # element with type inside. underlying_type = self.parse_type(type_name[2:], field_spec, highest_possible_version) return Array(underlying_type) else: if (type_name in Primitive.USABLE_PRIMITIVE_TYPE_NAMES): return Primitive(type_name, field_spec.get('default')) else: versions = Statics.parse_version_string(field_spec['versions'], highest_possible_version) return self.parse_complex_type(type_name, field_spec, versions)
[ "def", "parse_type", "(", "self", ",", "type_name", ",", "field_spec", ",", "highest_possible_version", ")", ":", "if", "(", "type_name", ".", "startswith", "(", "'[]'", ")", ")", ":", "# In spec files, array types are defined as `[]underlying_type` instead of having its own", "# element with type inside.", "underlying_type", "=", "self", ".", "parse_type", "(", "type_name", "[", "2", ":", "]", ",", "field_spec", ",", "highest_possible_version", ")", "return", "Array", "(", "underlying_type", ")", "else", ":", "if", "(", "type_name", "in", "Primitive", ".", "USABLE_PRIMITIVE_TYPE_NAMES", ")", ":", "return", "Primitive", "(", "type_name", ",", "field_spec", ".", "get", "(", "'default'", ")", ")", "else", ":", "versions", "=", "Statics", ".", "parse_version_string", "(", "field_spec", "[", "'versions'", "]", ",", "highest_possible_version", ")", "return", "self", ".", "parse_complex_type", "(", "type_name", ",", "field_spec", ",", "versions", ")" ]
https://github.com/envoyproxy/envoy-wasm/blob/ab5d9381fdf92a1efa0b87cff80036b5b3e81198/source/extensions/filters/network/kafka/protocol/generator.py#L229-L243
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/x86/toolchain/lib/python2.7/multiprocessing/process.py
python
Process.authkey
(self, authkey)
Set authorization key of process
Set authorization key of process
[ "Set", "authorization", "key", "of", "process" ]
def authkey(self, authkey): ''' Set authorization key of process ''' self._authkey = AuthenticationString(authkey)
[ "def", "authkey", "(", "self", ",", "authkey", ")", ":", "self", ".", "_authkey", "=", "AuthenticationString", "(", "authkey", ")" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/multiprocessing/process.py#L190-L194
google/syzygy
8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5
third_party/numpy/files/numpy/oldnumeric/ma.py
python
getmask
(a)
Mask of values in a; could be nomask. Returns nomask if a is not a masked array. To get an array for sure use getmaskarray.
Mask of values in a; could be nomask. Returns nomask if a is not a masked array. To get an array for sure use getmaskarray.
[ "Mask", "of", "values", "in", "a", ";", "could", "be", "nomask", ".", "Returns", "nomask", "if", "a", "is", "not", "a", "masked", "array", ".", "To", "get", "an", "array", "for", "sure", "use", "getmaskarray", "." ]
def getmask (a): """Mask of values in a; could be nomask. Returns nomask if a is not a masked array. To get an array for sure use getmaskarray.""" if isinstance(a, MaskedArray): return a.raw_mask() else: return nomask
[ "def", "getmask", "(", "a", ")", ":", "if", "isinstance", "(", "a", ",", "MaskedArray", ")", ":", "return", "a", ".", "raw_mask", "(", ")", "else", ":", "return", "nomask" ]
https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/oldnumeric/ma.py#L149-L156
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/python/ops/io_ops.py
python
ReaderBase.restore_state
(self, state, name=None)
return gen_io_ops._reader_restore_state(self._reader_ref, state, name=name)
Restore a reader to a previously saved state. Not all Readers support being restored, so this can produce an Unimplemented error. Args: state: A string Tensor. Result of a SerializeState of a Reader with matching type. name: A name for the operation (optional). Returns: The created Operation.
Restore a reader to a previously saved state.
[ "Restore", "a", "reader", "to", "a", "previously", "saved", "state", "." ]
def restore_state(self, state, name=None): """Restore a reader to a previously saved state. Not all Readers support being restored, so this can produce an Unimplemented error. Args: state: A string Tensor. Result of a SerializeState of a Reader with matching type. name: A name for the operation (optional). Returns: The created Operation. """ return gen_io_ops._reader_restore_state(self._reader_ref, state, name=name)
[ "def", "restore_state", "(", "self", ",", "state", ",", "name", "=", "None", ")", ":", "return", "gen_io_ops", ".", "_reader_restore_state", "(", "self", ".", "_reader_ref", ",", "state", ",", "name", "=", "name", ")" ]
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/io_ops.py#L349-L363
glotzerlab/hoomd-blue
f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a
hoomd/filter/set_.py
python
_ParticleFilterSetOperations._cpp_cls_name
(self)
The name of the C++ class in the `_hoomd` module. Used for Python class's inheritance.
The name of the C++ class in the `_hoomd` module.
[ "The", "name", "of", "the", "C", "++", "class", "in", "the", "_hoomd", "module", "." ]
def _cpp_cls_name(self): """The name of the C++ class in the `_hoomd` module. Used for Python class's inheritance. """ raise NotImplementedError
[ "def", "_cpp_cls_name", "(", "self", ")", ":", "raise", "NotImplementedError" ]
https://github.com/glotzerlab/hoomd-blue/blob/f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a/hoomd/filter/set_.py#L17-L22
neoml-lib/neoml
a0d370fba05269a1b2258cef126f77bbd2054a3e
NeoML/Python/neoml/Dnn/Loss.py
python
Loss.train_labels
(self, train)
Specifies if gradients should also be calculated for the second input, which contains the class labels.
Specifies if gradients should also be calculated for the second input, which contains the class labels.
[ "Specifies", "if", "gradients", "should", "also", "be", "calculated", "for", "the", "second", "input", "which", "contains", "the", "class", "labels", "." ]
def train_labels(self, train): """Specifies if gradients should also be calculated for the second input, which contains the class labels. """ self._internal.set_train_labels(train)
[ "def", "train_labels", "(", "self", ",", "train", ")", ":", "self", ".", "_internal", ".", "set_train_labels", "(", "train", ")" ]
https://github.com/neoml-lib/neoml/blob/a0d370fba05269a1b2258cef126f77bbd2054a3e/NeoML/Python/neoml/Dnn/Loss.py#L59-L63
apache/incubator-mxnet
f03fb23f1d103fec9541b5ae59ee06b1734a51d9
python/mxnet/symbol/numpy/_symbol.py
python
tri
(N, M=None, k=0, dtype=None, ctx=None)
return _npi.tri(N, M, k, dtype, ctx)
r""" An array with ones at and below the given diagonal and zeros elsewhere. Parameters ---------- N : int Number of rows in the array. M : int, optional Number of columns in the array. By default, `M` is taken equal to `N`. k : int, optional The sub-diagonal at and below which the array is filled. `k` = 0 is the main diagonal, while `k` < 0 is below it, and `k` > 0 is above. The default is 0. dtype : dtype, optional Data type of the returned array. The default is float. Returns ------- tri : Symbol of shape (N, M) Array with its lower triangle filled with ones and zero elsewhere; in other words ``T[i,j] == 1`` for ``i <= j + k``, 0 otherwise.
r""" An array with ones at and below the given diagonal and zeros elsewhere.
[ "r", "An", "array", "with", "ones", "at", "and", "below", "the", "given", "diagonal", "and", "zeros", "elsewhere", "." ]
def tri(N, M=None, k=0, dtype=None, ctx=None): r""" An array with ones at and below the given diagonal and zeros elsewhere. Parameters ---------- N : int Number of rows in the array. M : int, optional Number of columns in the array. By default, `M` is taken equal to `N`. k : int, optional The sub-diagonal at and below which the array is filled. `k` = 0 is the main diagonal, while `k` < 0 is below it, and `k` > 0 is above. The default is 0. dtype : dtype, optional Data type of the returned array. The default is float. Returns ------- tri : Symbol of shape (N, M) Array with its lower triangle filled with ones and zero elsewhere; in other words ``T[i,j] == 1`` for ``i <= j + k``, 0 otherwise. """ if dtype is None: dtype = 'float32' if M is None: M = N if ctx is None: ctx = current_context() return _npi.tri(N, M, k, dtype, ctx)
[ "def", "tri", "(", "N", ",", "M", "=", "None", ",", "k", "=", "0", ",", "dtype", "=", "None", ",", "ctx", "=", "None", ")", ":", "if", "dtype", "is", "None", ":", "dtype", "=", "'float32'", "if", "M", "is", "None", ":", "M", "=", "N", "if", "ctx", "is", "None", ":", "ctx", "=", "current_context", "(", ")", "return", "_npi", ".", "tri", "(", "N", ",", "M", ",", "k", ",", "dtype", ",", "ctx", ")" ]
https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/numpy/_symbol.py#L2500-L2530
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/oauthlib/oauth2/rfc6749/endpoints/resource.py
python
ResourceEndpoint.verify_request
(self, uri, http_method='GET', body=None, headers=None, scopes=None)
return token_type_handler.validate_request(request), request
Validate client, code etc, return body + headers
Validate client, code etc, return body + headers
[ "Validate", "client", "code", "etc", "return", "body", "+", "headers" ]
def verify_request(self, uri, http_method='GET', body=None, headers=None, scopes=None): """Validate client, code etc, return body + headers""" request = Request(uri, http_method, body, headers) request.token_type = self.find_token_type(request) request.scopes = scopes token_type_handler = self.tokens.get(request.token_type, self.default_token_type_handler) log.debug('Dispatching token_type %s request to %r.', request.token_type, token_type_handler) return token_type_handler.validate_request(request), request
[ "def", "verify_request", "(", "self", ",", "uri", ",", "http_method", "=", "'GET'", ",", "body", "=", "None", ",", "headers", "=", "None", ",", "scopes", "=", "None", ")", ":", "request", "=", "Request", "(", "uri", ",", "http_method", ",", "body", ",", "headers", ")", "request", ".", "token_type", "=", "self", ".", "find_token_type", "(", "request", ")", "request", ".", "scopes", "=", "scopes", "token_type_handler", "=", "self", ".", "tokens", ".", "get", "(", "request", ".", "token_type", ",", "self", ".", "default_token_type_handler", ")", "log", ".", "debug", "(", "'Dispatching token_type %s request to %r.'", ",", "request", ".", "token_type", ",", "token_type_handler", ")", "return", "token_type_handler", ".", "validate_request", "(", "request", ")", ",", "request" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/oauthlib/oauth2/rfc6749/endpoints/resource.py#L65-L75
gnina/gnina
b9ae032f52fc7a8153987bde09c0efa3620d8bb6
caffe/scripts/cpp_lint.py
python
CheckCaffeDataLayerSetUp
(filename, clean_lines, linenum, error)
Except the base classes, Caffe DataLayer should define DataLayerSetUp instead of LayerSetUp. The base DataLayers define common SetUp steps, the subclasses should not override them. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. error: The function to call with any errors found.
Except the base classes, Caffe DataLayer should define DataLayerSetUp instead of LayerSetUp. The base DataLayers define common SetUp steps, the subclasses should not override them. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. error: The function to call with any errors found.
[ "Except", "the", "base", "classes", "Caffe", "DataLayer", "should", "define", "DataLayerSetUp", "instead", "of", "LayerSetUp", ".", "The", "base", "DataLayers", "define", "common", "SetUp", "steps", "the", "subclasses", "should", "not", "override", "them", ".", "Args", ":", "filename", ":", "The", "name", "of", "the", "current", "file", ".", "clean_lines", ":", "A", "CleansedLines", "instance", "containing", "the", "file", ".", "linenum", ":", "The", "number", "of", "the", "line", "to", "check", ".", "error", ":", "The", "function", "to", "call", "with", "any", "errors", "found", "." ]
def CheckCaffeDataLayerSetUp(filename, clean_lines, linenum, error): """Except the base classes, Caffe DataLayer should define DataLayerSetUp instead of LayerSetUp. The base DataLayers define common SetUp steps, the subclasses should not override them. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. error: The function to call with any errors found. """ line = clean_lines.elided[linenum] ix = line.find('DataLayer<Dtype>::LayerSetUp') if ix >= 0 and ( line.find('void DataLayer<Dtype>::LayerSetUp') != -1 or line.find('void ImageDataLayer<Dtype>::LayerSetUp') != -1 or line.find('void MemoryDataLayer<Dtype>::LayerSetUp') != -1 or line.find('void WindowDataLayer<Dtype>::LayerSetUp') != -1): error(filename, linenum, 'caffe/data_layer_setup', 2, 'Except the base classes, Caffe DataLayer should define' + ' DataLayerSetUp instead of LayerSetUp. The base DataLayers' + ' define common SetUp steps, the subclasses should' + ' not override them.') ix = line.find('DataLayer<Dtype>::DataLayerSetUp') if ix >= 0 and ( line.find('void Base') == -1 and line.find('void DataLayer<Dtype>::DataLayerSetUp') == -1 and line.find('void ImageDataLayer<Dtype>::DataLayerSetUp') == -1 and line.find('void MemoryDataLayer<Dtype>::DataLayerSetUp') == -1 and line.find('void WindowDataLayer<Dtype>::DataLayerSetUp') == -1): error(filename, linenum, 'caffe/data_layer_setup', 2, 'Except the base classes, Caffe DataLayer should define' + ' DataLayerSetUp instead of LayerSetUp. The base DataLayers' + ' define common SetUp steps, the subclasses should' + ' not override them.')
[ "def", "CheckCaffeDataLayerSetUp", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "error", ")", ":", "line", "=", "clean_lines", ".", "elided", "[", "linenum", "]", "ix", "=", "line", ".", "find", "(", "'DataLayer<Dtype>::LayerSetUp'", ")", "if", "ix", ">=", "0", "and", "(", "line", ".", "find", "(", "'void DataLayer<Dtype>::LayerSetUp'", ")", "!=", "-", "1", "or", "line", ".", "find", "(", "'void ImageDataLayer<Dtype>::LayerSetUp'", ")", "!=", "-", "1", "or", "line", ".", "find", "(", "'void MemoryDataLayer<Dtype>::LayerSetUp'", ")", "!=", "-", "1", "or", "line", ".", "find", "(", "'void WindowDataLayer<Dtype>::LayerSetUp'", ")", "!=", "-", "1", ")", ":", "error", "(", "filename", ",", "linenum", ",", "'caffe/data_layer_setup'", ",", "2", ",", "'Except the base classes, Caffe DataLayer should define'", "+", "' DataLayerSetUp instead of LayerSetUp. The base DataLayers'", "+", "' define common SetUp steps, the subclasses should'", "+", "' not override them.'", ")", "ix", "=", "line", ".", "find", "(", "'DataLayer<Dtype>::DataLayerSetUp'", ")", "if", "ix", ">=", "0", "and", "(", "line", ".", "find", "(", "'void Base'", ")", "==", "-", "1", "and", "line", ".", "find", "(", "'void DataLayer<Dtype>::DataLayerSetUp'", ")", "==", "-", "1", "and", "line", ".", "find", "(", "'void ImageDataLayer<Dtype>::DataLayerSetUp'", ")", "==", "-", "1", "and", "line", ".", "find", "(", "'void MemoryDataLayer<Dtype>::DataLayerSetUp'", ")", "==", "-", "1", "and", "line", ".", "find", "(", "'void WindowDataLayer<Dtype>::DataLayerSetUp'", ")", "==", "-", "1", ")", ":", "error", "(", "filename", ",", "linenum", ",", "'caffe/data_layer_setup'", ",", "2", ",", "'Except the base classes, Caffe DataLayer should define'", "+", "' DataLayerSetUp instead of LayerSetUp. The base DataLayers'", "+", "' define common SetUp steps, the subclasses should'", "+", "' not override them.'", ")" ]
https://github.com/gnina/gnina/blob/b9ae032f52fc7a8153987bde09c0efa3620d8bb6/caffe/scripts/cpp_lint.py#L1599-L1635
mkeeter/antimony
ee525bbdad34ae94879fd055821f92bcef74e83f
py/fab/shapes.py
python
rounded_rectangle
(xmin, xmax, ymin, ymax, r)
return ( rectangle(xmin, xmax, ymin+r, ymax-r) | rectangle(xmin+r, xmax-r, ymin, ymax) | circle(xmin+r, ymin+r, r) | circle(xmin+r, ymax-r, r) | circle(xmax-r, ymin+r, r) | circle(xmax-r, ymax-r, r) )
Returns a rectangle with rounded corners. r is a roundedness fraction between 0 (not rounded) and 1 (completely rounded)
Returns a rectangle with rounded corners. r is a roundedness fraction between 0 (not rounded) and 1 (completely rounded)
[ "Returns", "a", "rectangle", "with", "rounded", "corners", ".", "r", "is", "a", "roundedness", "fraction", "between", "0", "(", "not", "rounded", ")", "and", "1", "(", "completely", "rounded", ")" ]
def rounded_rectangle(xmin, xmax, ymin, ymax, r): """ Returns a rectangle with rounded corners. r is a roundedness fraction between 0 (not rounded) and 1 (completely rounded) """ r *= min(xmax - xmin, ymax - ymin)/2 return ( rectangle(xmin, xmax, ymin+r, ymax-r) | rectangle(xmin+r, xmax-r, ymin, ymax) | circle(xmin+r, ymin+r, r) | circle(xmin+r, ymax-r, r) | circle(xmax-r, ymin+r, r) | circle(xmax-r, ymax-r, r) )
[ "def", "rounded_rectangle", "(", "xmin", ",", "xmax", ",", "ymin", ",", "ymax", ",", "r", ")", ":", "r", "*=", "min", "(", "xmax", "-", "xmin", ",", "ymax", "-", "ymin", ")", "/", "2", "return", "(", "rectangle", "(", "xmin", ",", "xmax", ",", "ymin", "+", "r", ",", "ymax", "-", "r", ")", "|", "rectangle", "(", "xmin", "+", "r", ",", "xmax", "-", "r", ",", "ymin", ",", "ymax", ")", "|", "circle", "(", "xmin", "+", "r", ",", "ymin", "+", "r", ",", "r", ")", "|", "circle", "(", "xmin", "+", "r", ",", "ymax", "-", "r", ",", "r", ")", "|", "circle", "(", "xmax", "-", "r", ",", "ymin", "+", "r", ",", "r", ")", "|", "circle", "(", "xmax", "-", "r", ",", "ymax", "-", "r", ",", "r", ")", ")" ]
https://github.com/mkeeter/antimony/blob/ee525bbdad34ae94879fd055821f92bcef74e83f/py/fab/shapes.py#L154-L167
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/build/waf-1.7.13/waflib/Tools/vala.py
python
configure
(self)
Use the following to enforce minimum vala version:: def configure(conf): conf.load('vala', funs='') conf.check_vala(min_version=(0,10,0))
Use the following to enforce minimum vala version::
[ "Use", "the", "following", "to", "enforce", "minimum", "vala", "version", "::" ]
def configure(self): """ Use the following to enforce minimum vala version:: def configure(conf): conf.load('vala', funs='') conf.check_vala(min_version=(0,10,0)) """ self.load('gnu_dirs') self.check_vala_deps() self.check_vala() self.env.VALAFLAGS = ['-C', '--quiet']
[ "def", "configure", "(", "self", ")", ":", "self", ".", "load", "(", "'gnu_dirs'", ")", "self", ".", "check_vala_deps", "(", ")", "self", ".", "check_vala", "(", ")", "self", ".", "env", ".", "VALAFLAGS", "=", "[", "'-C'", ",", "'--quiet'", "]" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/waflib/Tools/vala.py#L310-L321
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
samples/doodle/doodle.py
python
DoodleWindow.OnLeftDown
(self, event)
called when the left mouse button is pressed
called when the left mouse button is pressed
[ "called", "when", "the", "left", "mouse", "button", "is", "pressed" ]
def OnLeftDown(self, event): """called when the left mouse button is pressed""" self.curLine = [] self.pos = event.GetPosition() self.CaptureMouse()
[ "def", "OnLeftDown", "(", "self", ",", "event", ")", ":", "self", ".", "curLine", "=", "[", "]", "self", ".", "pos", "=", "event", ".", "GetPosition", "(", ")", "self", ".", "CaptureMouse", "(", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/samples/doodle/doodle.py#L144-L148
cms-sw/cmssw
fd9de012d503d3405420bcbeec0ec879baa57cf2
Validation/RecoTrack/python/plotting/ntupleDataFormat.py
python
Event.stripHits
(self)
return StripHits(self._tree)
Returns StripHits object.
Returns StripHits object.
[ "Returns", "StripHits", "object", "." ]
def stripHits(self): """Returns StripHits object.""" return StripHits(self._tree)
[ "def", "stripHits", "(", "self", ")", ":", "return", "StripHits", "(", "self", ".", "_tree", ")" ]
https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Validation/RecoTrack/python/plotting/ntupleDataFormat.py#L498-L500
Jittor/jittor
e9aca0444c2bdc8e2389d99122954cd0903eec46
python/jittor/misc.py
python
gather
(x, dim, index)
return x.getitem(tuple(indexes))
if x is a 3-D array, reindex x like: out[i][j][k] = input[index[i][j][k]][j][k] # if dim == 0 out[i][j][k] = input[i][index[i][j][k]][k] # if dim == 1 out[i][j][k] = input[i][j][index[i][j][k]] # if dim == 2 Parameters:: * x (jt.Var) – the source array * dim (int) – the axis along which to index * index (jt.Var) – the indices of elements to gather Example:: t = jt.array([[1, 2], [3, 4]]) data = t.gather(1, jt.array([[0, 0], [1, 0]])) assert (data.data == [[ 1, 1], [ 4, 3]]).all() data = t.gather(0, jt.array([[0, 0], [1, 0]])) assert (data.data == [[ 1, 2], [ 3, 2]]).all()
if x is a 3-D array, reindex x like:
[ "if", "x", "is", "a", "3", "-", "D", "array", "reindex", "x", "like", ":" ]
def gather(x, dim, index): ''' if x is a 3-D array, reindex x like: out[i][j][k] = input[index[i][j][k]][j][k] # if dim == 0 out[i][j][k] = input[i][index[i][j][k]][k] # if dim == 1 out[i][j][k] = input[i][j][index[i][j][k]] # if dim == 2 Parameters:: * x (jt.Var) – the source array * dim (int) – the axis along which to index * index (jt.Var) – the indices of elements to gather Example:: t = jt.array([[1, 2], [3, 4]]) data = t.gather(1, jt.array([[0, 0], [1, 0]])) assert (data.data == [[ 1, 1], [ 4, 3]]).all() data = t.gather(0, jt.array([[0, 0], [1, 0]])) assert (data.data == [[ 1, 2], [ 3, 2]]).all() ''' shape = index.shape indexes = [ f'i{i}' for i in range(len(shape)) ] indexes[dim] = index return x.getitem(tuple(indexes))
[ "def", "gather", "(", "x", ",", "dim", ",", "index", ")", ":", "shape", "=", "index", ".", "shape", "indexes", "=", "[", "f'i{i}'", "for", "i", "in", "range", "(", "len", "(", "shape", ")", ")", "]", "indexes", "[", "dim", "]", "=", "index", "return", "x", ".", "getitem", "(", "tuple", "(", "indexes", ")", ")" ]
https://github.com/Jittor/jittor/blob/e9aca0444c2bdc8e2389d99122954cd0903eec46/python/jittor/misc.py#L1243-L1269
limbo018/DREAMPlace
146c3b9fd003d1acd52c96d9fd02e3f0a05154e4
dreamplace/EvalMetrics.py
python
EvalMetrics.__repr__
(self)
return self.__str__()
@brief print
[]
def __repr__(self): """ @brief print """ return self.__str__()
[ "def", "__repr__", "(", "self", ")", ":", "return", "self", ".", "__str__", "(", ")" ]
https://github.com/limbo018/DREAMPlace/blob/146c3b9fd003d1acd52c96d9fd02e3f0a05154e4/dreamplace/EvalMetrics.py#L88-L92
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/dateutil/parser/isoparser.py
python
isoparser.__init__
(self, sep=None)
:param sep: A single character that separates date and time portions. If ``None``, the parser will accept any single character. For strict ISO-8601 adherence, pass ``'T'``.
:param sep: A single character that separates date and time portions. If ``None``, the parser will accept any single character. For strict ISO-8601 adherence, pass ``'T'``.
[ ":", "param", "sep", ":", "A", "single", "character", "that", "separates", "date", "and", "time", "portions", ".", "If", "None", "the", "parser", "will", "accept", "any", "single", "character", ".", "For", "strict", "ISO", "-", "8601", "adherence", "pass", "T", "." ]
def __init__(self, sep=None): """ :param sep: A single character that separates date and time portions. If ``None``, the parser will accept any single character. For strict ISO-8601 adherence, pass ``'T'``. """ if sep is not None: if (len(sep) != 1 or ord(sep) >= 128 or sep in '0123456789'): raise ValueError('Separator must be a single, non-numeric ' + 'ASCII character') sep = sep.encode('ascii') self._sep = sep
[ "def", "__init__", "(", "self", ",", "sep", "=", "None", ")", ":", "if", "sep", "is", "not", "None", ":", "if", "(", "len", "(", "sep", ")", "!=", "1", "or", "ord", "(", "sep", ")", ">=", "128", "or", "sep", "in", "'0123456789'", ")", ":", "raise", "ValueError", "(", "'Separator must be a single, non-numeric '", "+", "'ASCII character'", ")", "sep", "=", "sep", ".", "encode", "(", "'ascii'", ")", "self", ".", "_sep", "=", "sep" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/dateutil/parser/isoparser.py#L43-L57
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/_misc.py
python
GetTextFromUser
(*args, **kwargs)
return _misc_.GetTextFromUser(*args, **kwargs)
GetTextFromUser(String message, String caption=EmptyString, String default_value=EmptyString, Window parent=None, int x=-1, int y=-1, bool centre=True) -> String
GetTextFromUser(String message, String caption=EmptyString, String default_value=EmptyString, Window parent=None, int x=-1, int y=-1, bool centre=True) -> String
[ "GetTextFromUser", "(", "String", "message", "String", "caption", "=", "EmptyString", "String", "default_value", "=", "EmptyString", "Window", "parent", "=", "None", "int", "x", "=", "-", "1", "int", "y", "=", "-", "1", "bool", "centre", "=", "True", ")", "-", ">", "String" ]
def GetTextFromUser(*args, **kwargs): """ GetTextFromUser(String message, String caption=EmptyString, String default_value=EmptyString, Window parent=None, int x=-1, int y=-1, bool centre=True) -> String """ return _misc_.GetTextFromUser(*args, **kwargs)
[ "def", "GetTextFromUser", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_misc_", ".", "GetTextFromUser", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L454-L460
facebookincubator/mvfst
034a40c797485113d00127852d4df3c5bb44b3ed
build/fbcode_builder/getdeps/fetcher.py
python
ChangeStatus.__init__
(self, all_changed=False)
Construct a ChangeStatus object. The default is to create a status that indicates no changes, but passing all_changed=True will create one that indicates that everything changed
Construct a ChangeStatus object. The default is to create a status that indicates no changes, but passing all_changed=True will create one that indicates that everything changed
[ "Construct", "a", "ChangeStatus", "object", ".", "The", "default", "is", "to", "create", "a", "status", "that", "indicates", "no", "changes", "but", "passing", "all_changed", "=", "True", "will", "create", "one", "that", "indicates", "that", "everything", "changed" ]
def __init__(self, all_changed=False): """Construct a ChangeStatus object. The default is to create a status that indicates no changes, but passing all_changed=True will create one that indicates that everything changed""" if all_changed: self.source_files = 1 self.make_files = 1 else: self.source_files = 0 self.make_files = 0
[ "def", "__init__", "(", "self", ",", "all_changed", "=", "False", ")", ":", "if", "all_changed", ":", "self", ".", "source_files", "=", "1", "self", ".", "make_files", "=", "1", "else", ":", "self", ".", "source_files", "=", "0", "self", ".", "make_files", "=", "0" ]
https://github.com/facebookincubator/mvfst/blob/034a40c797485113d00127852d4df3c5bb44b3ed/build/fbcode_builder/getdeps/fetcher.py#L53-L62
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/init_ops_v2.py
python
VarianceScaling.__call__
(self, shape, dtype=dtypes.float32)
Returns a tensor object initialized as specified by the initializer. Args: shape: Shape of the tensor. dtype: Optional dtype of the tensor. Only floating point types are supported. Raises: ValueError: If the dtype is not floating point
Returns a tensor object initialized as specified by the initializer.
[ "Returns", "a", "tensor", "object", "initialized", "as", "specified", "by", "the", "initializer", "." ]
def __call__(self, shape, dtype=dtypes.float32): """Returns a tensor object initialized as specified by the initializer. Args: shape: Shape of the tensor. dtype: Optional dtype of the tensor. Only floating point types are supported. Raises: ValueError: If the dtype is not floating point """ partition_info = None # Keeps logic so can be readded later if necessary dtype = _assert_float_dtype(dtype) scale = self.scale scale_shape = shape if partition_info is not None: scale_shape = partition_info.full_shape fan_in, fan_out = _compute_fans(scale_shape) if self.mode == "fan_in": scale /= max(1., fan_in) elif self.mode == "fan_out": scale /= max(1., fan_out) else: scale /= max(1., (fan_in + fan_out) / 2.) if self.distribution == "truncated_normal": # constant from scipy.stats.truncnorm.std(a=-2, b=2, loc=0., scale=1.) stddev = math.sqrt(scale) / .87962566103423978 return self._random_generator.truncated_normal(shape, 0.0, stddev, dtype) elif self.distribution == "untruncated_normal": stddev = math.sqrt(scale) return self._random_generator.random_normal(shape, 0.0, stddev, dtype) else: limit = math.sqrt(3.0 * scale) return self._random_generator.random_uniform(shape, -limit, limit, dtype)
[ "def", "__call__", "(", "self", ",", "shape", ",", "dtype", "=", "dtypes", ".", "float32", ")", ":", "partition_info", "=", "None", "# Keeps logic so can be readded later if necessary", "dtype", "=", "_assert_float_dtype", "(", "dtype", ")", "scale", "=", "self", ".", "scale", "scale_shape", "=", "shape", "if", "partition_info", "is", "not", "None", ":", "scale_shape", "=", "partition_info", ".", "full_shape", "fan_in", ",", "fan_out", "=", "_compute_fans", "(", "scale_shape", ")", "if", "self", ".", "mode", "==", "\"fan_in\"", ":", "scale", "/=", "max", "(", "1.", ",", "fan_in", ")", "elif", "self", ".", "mode", "==", "\"fan_out\"", ":", "scale", "/=", "max", "(", "1.", ",", "fan_out", ")", "else", ":", "scale", "/=", "max", "(", "1.", ",", "(", "fan_in", "+", "fan_out", ")", "/", "2.", ")", "if", "self", ".", "distribution", "==", "\"truncated_normal\"", ":", "# constant from scipy.stats.truncnorm.std(a=-2, b=2, loc=0., scale=1.)", "stddev", "=", "math", ".", "sqrt", "(", "scale", ")", "/", ".87962566103423978", "return", "self", ".", "_random_generator", ".", "truncated_normal", "(", "shape", ",", "0.0", ",", "stddev", ",", "dtype", ")", "elif", "self", ".", "distribution", "==", "\"untruncated_normal\"", ":", "stddev", "=", "math", ".", "sqrt", "(", "scale", ")", "return", "self", ".", "_random_generator", ".", "random_normal", "(", "shape", ",", "0.0", ",", "stddev", ",", "dtype", ")", "else", ":", "limit", "=", "math", ".", "sqrt", "(", "3.0", "*", "scale", ")", "return", "self", ".", "_random_generator", ".", "random_uniform", "(", "shape", ",", "-", "limit", ",", "limit", ",", "dtype", ")" ]
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/init_ops_v2.py#L404-L437
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/dataview.py
python
DataViewListCtrl.GetToggleValue
(*args, **kwargs)
return _dataview.DataViewListCtrl_GetToggleValue(*args, **kwargs)
GetToggleValue(self, unsigned int row, unsigned int col) -> bool
GetToggleValue(self, unsigned int row, unsigned int col) -> bool
[ "GetToggleValue", "(", "self", "unsigned", "int", "row", "unsigned", "int", "col", ")", "-", ">", "bool" ]
def GetToggleValue(*args, **kwargs): """GetToggleValue(self, unsigned int row, unsigned int col) -> bool""" return _dataview.DataViewListCtrl_GetToggleValue(*args, **kwargs)
[ "def", "GetToggleValue", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_dataview", ".", "DataViewListCtrl_GetToggleValue", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/dataview.py#L2197-L2199