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
openthread/openthread
9fcdbed9c526c70f1556d1ed84099c1535c7cd32
tools/harness-thci/OpenThread.py
python
OpenThreadTHCI.MGMT_COMM_GET
(self, Addr='ff02::1', TLVs=())
return self.__executeCommand(cmd)[-1] == 'Done'
send MGMT_COMM_GET command Returns: True: successful to send MGMT_COMM_GET False: fail to send MGMT_COMM_GET
send MGMT_COMM_GET command
[ "send", "MGMT_COMM_GET", "command" ]
def MGMT_COMM_GET(self, Addr='ff02::1', TLVs=()): """send MGMT_COMM_GET command Returns: True: successful to send MGMT_COMM_GET False: fail to send MGMT_COMM_GET """ print('%s call MGMT_COMM_GET' % self) cmd = 'commissioner mgmtget' if len(TLVs) ...
[ "def", "MGMT_COMM_GET", "(", "self", ",", "Addr", "=", "'ff02::1'", ",", "TLVs", "=", "(", ")", ")", ":", "print", "(", "'%s call MGMT_COMM_GET'", "%", "self", ")", "cmd", "=", "'commissioner mgmtget'", "if", "len", "(", "TLVs", ")", "!=", "0", ":", "t...
https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/tools/harness-thci/OpenThread.py#L2845-L2862
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/agw/hypertreelist.py
python
EditCtrl.Finish
(self)
Finish editing.
Finish editing.
[ "Finish", "editing", "." ]
def Finish(self): """Finish editing.""" if not self._finished: self._finished = True self._owner.SetFocusIgnoringChildren() self._owner.ResetEditControl()
[ "def", "Finish", "(", "self", ")", ":", "if", "not", "self", ".", "_finished", ":", "self", ".", "_finished", "=", "True", "self", ".", "_owner", ".", "SetFocusIgnoringChildren", "(", ")", "self", ".", "_owner", ".", "ResetEditControl", "(", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/hypertreelist.py#L1886-L1893
protocolbuffers/protobuf
b5ab0b7a18b7336c60130f4ddb2d97c51792f896
python/google/protobuf/service_reflection.py
python
_ServiceBuilder._CallMethod
(self, srvc, method_descriptor, rpc_controller, request, callback)
return method(rpc_controller, request, callback)
Calls the method described by a given method descriptor. Args: srvc: Instance of the service for which this method is called. method_descriptor: Descriptor that represent the method to call. rpc_controller: RPC controller to use for this method's execution. request: Request protocol message...
Calls the method described by a given method descriptor.
[ "Calls", "the", "method", "described", "by", "a", "given", "method", "descriptor", "." ]
def _CallMethod(self, srvc, method_descriptor, rpc_controller, request, callback): """Calls the method described by a given method descriptor. Args: srvc: Instance of the service for which this method is called. method_descriptor: Descriptor that represent the method to call. ...
[ "def", "_CallMethod", "(", "self", ",", "srvc", ",", "method_descriptor", ",", "rpc_controller", ",", "request", ",", "callback", ")", ":", "if", "method_descriptor", ".", "containing_service", "!=", "self", ".", "descriptor", ":", "raise", "RuntimeError", "(", ...
https://github.com/protocolbuffers/protobuf/blob/b5ab0b7a18b7336c60130f4ddb2d97c51792f896/python/google/protobuf/service_reflection.py#L166-L181
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pbr/git.py
python
generate_authors
(git_dir=None, dest_dir='.', option_dict=dict())
Create AUTHORS file using git commits.
Create AUTHORS file using git commits.
[ "Create", "AUTHORS", "file", "using", "git", "commits", "." ]
def generate_authors(git_dir=None, dest_dir='.', option_dict=dict()): """Create AUTHORS file using git commits.""" should_skip = options.get_boolean_option(option_dict, 'skip_authors', 'SKIP_GENERATE_AUTHORS') if should_skip: return start = time.time(...
[ "def", "generate_authors", "(", "git_dir", "=", "None", ",", "dest_dir", "=", "'.'", ",", "option_dict", "=", "dict", "(", ")", ")", ":", "should_skip", "=", "options", ".", "get_boolean_option", "(", "option_dict", ",", "'skip_authors'", ",", "'SKIP_GENERATE_...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pbr/git.py#L289-L331
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/_misc.py
python
Process_Kill
(*args, **kwargs)
return _misc_.Process_Kill(*args, **kwargs)
Process_Kill(int pid, int sig=SIGTERM, int flags=KILL_NOCHILDREN) -> int
Process_Kill(int pid, int sig=SIGTERM, int flags=KILL_NOCHILDREN) -> int
[ "Process_Kill", "(", "int", "pid", "int", "sig", "=", "SIGTERM", "int", "flags", "=", "KILL_NOCHILDREN", ")", "-", ">", "int" ]
def Process_Kill(*args, **kwargs): """Process_Kill(int pid, int sig=SIGTERM, int flags=KILL_NOCHILDREN) -> int""" return _misc_.Process_Kill(*args, **kwargs)
[ "def", "Process_Kill", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_misc_", ".", "Process_Kill", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L2055-L2057
avast/retdec
b9879088a5f0278508185ec645494e6c5c57a455
scripts/retdec-utils.py
python
has_thin_archive_signature
(path)
return ret == 0
Check if file has thin ar signature. 1 argument is needed - file path Returns - True if file has thin ar signature False no signature
Check if file has thin ar signature. 1 argument is needed - file path Returns - True if file has thin ar signature False no signature
[ "Check", "if", "file", "has", "thin", "ar", "signature", ".", "1", "argument", "is", "needed", "-", "file", "path", "Returns", "-", "True", "if", "file", "has", "thin", "ar", "signature", "False", "no", "signature" ]
def has_thin_archive_signature(path): """Check if file has thin ar signature. 1 argument is needed - file path Returns - True if file has thin ar signature False no signature """ _, ret, _ = CmdRunner.run_cmd([AR, path, '--thin-magic'], discard_stdout=True, discard_stderr=True) r...
[ "def", "has_thin_archive_signature", "(", "path", ")", ":", "_", ",", "ret", ",", "_", "=", "CmdRunner", ".", "run_cmd", "(", "[", "AR", ",", "path", ",", "'--thin-magic'", "]", ",", "discard_stdout", "=", "True", ",", "discard_stderr", "=", "True", ")",...
https://github.com/avast/retdec/blob/b9879088a5f0278508185ec645494e6c5c57a455/scripts/retdec-utils.py#L358-L365
smartdevicelink/sdl_core
68f082169e0a40fccd9eb0db3c83911c28870f07
tools/InterfaceGenerator/generator/generators/SmartFactoryJSONRPC.py
python
CodeGenerator._gen_schema_params_fill
(self, message_type_name)
return u"".join( [self._base_params, self._correlation_id_param if message_type_name != u"notification" else u"", self._additional_response_params if message_type_name == u"response" else u""])
Generate schema params fill code. Provides constant set of params for the function in accordance to the JSONRPC format. Keyword arguments: message_type_name -- Name of the messageType enum element. Returns: String with function schema params fill code.
Generate schema params fill code.
[ "Generate", "schema", "params", "fill", "code", "." ]
def _gen_schema_params_fill(self, message_type_name): """Generate schema params fill code. Provides constant set of params for the function in accordance to the JSONRPC format. Keyword arguments: message_type_name -- Name of the messageType enum element. Returns: ...
[ "def", "_gen_schema_params_fill", "(", "self", ",", "message_type_name", ")", ":", "return", "u\"\"", ".", "join", "(", "[", "self", ".", "_base_params", ",", "self", ".", "_correlation_id_param", "if", "message_type_name", "!=", "u\"notification\"", "else", "u\"\...
https://github.com/smartdevicelink/sdl_core/blob/68f082169e0a40fccd9eb0db3c83911c28870f07/tools/InterfaceGenerator/generator/generators/SmartFactoryJSONRPC.py#L74-L93
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Tools/CryVersionSelector/backup_project.py
python
set_title
(title)
Sets the title of the command line window this runs in.
Sets the title of the command line window this runs in.
[ "Sets", "the", "title", "of", "the", "command", "line", "window", "this", "runs", "in", "." ]
def set_title(title): """ Sets the title of the command line window this runs in. """ if not title: title = "Building..." # using the kernel32 should be better, but in case it's not working # it can switch to using os.system(). if HAS_WIN_MODULES: try: kernel32 =...
[ "def", "set_title", "(", "title", ")", ":", "if", "not", "title", ":", "title", "=", "\"Building...\"", "# using the kernel32 should be better, but in case it's not working", "# it can switch to using os.system().", "if", "HAS_WIN_MODULES", ":", "try", ":", "kernel32", "=",...
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Tools/CryVersionSelector/backup_project.py#L145-L162
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/profiler/parser/container.py
python
HWTSContainer.task_id
(self)
return self._task_id
Get the task id of the operator.
Get the task id of the operator.
[ "Get", "the", "task", "id", "of", "the", "operator", "." ]
def task_id(self): """Get the task id of the operator.""" return self._task_id
[ "def", "task_id", "(", "self", ")", ":", "return", "self", ".", "_task_id" ]
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/profiler/parser/container.py#L41-L43
deepmodeling/deepmd-kit
159e45d248b0429844fb6a8cb3b3a201987c8d79
deepmd/entrypoints/config.py
python
get_batch_size_rule
()
return matom
Get minimal batch size from user from stdin. Returns ------- int size of the batch Raises ------ ValueError if batch size is <= 0
Get minimal batch size from user from stdin.
[ "Get", "minimal", "batch", "size", "from", "user", "from", "stdin", "." ]
def get_batch_size_rule() -> int: """Get minimal batch size from user from stdin. Returns ------- int size of the batch Raises ------ ValueError if batch size is <= 0 """ dv = 32 matom_input = input( f"Enter the minimal number of atoms in a batch (defaul...
[ "def", "get_batch_size_rule", "(", ")", "->", "int", ":", "dv", "=", "32", "matom_input", "=", "input", "(", "f\"Enter the minimal number of atoms in a batch (default {dv:d}: \\n\"", ")", "try", ":", "matom", "=", "int", "(", "matom_input", ")", "except", "ValueErro...
https://github.com/deepmodeling/deepmd-kit/blob/159e45d248b0429844fb6a8cb3b3a201987c8d79/deepmd/entrypoints/config.py#L140-L164
crosslife/OpenBird
9e0198a1a2295f03fa1e8676e216e22c9c7d380b
cocos2d/tools/bindings-generator/clang/cindex.py
python
Cursor.result_type
(self)
return self._result_type
Retrieve the Type of the result for this Cursor.
Retrieve the Type of the result for this Cursor.
[ "Retrieve", "the", "Type", "of", "the", "result", "for", "this", "Cursor", "." ]
def result_type(self): """Retrieve the Type of the result for this Cursor.""" if not hasattr(self, '_result_type'): self._result_type = conf.lib.clang_getResultType(self.type) return self._result_type
[ "def", "result_type", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_result_type'", ")", ":", "self", ".", "_result_type", "=", "conf", ".", "lib", ".", "clang_getResultType", "(", "self", ".", "type", ")", "return", "self", ".", "...
https://github.com/crosslife/OpenBird/blob/9e0198a1a2295f03fa1e8676e216e22c9c7d380b/cocos2d/tools/bindings-generator/clang/cindex.py#L1323-L1328
ucsb-seclab/difuze
bb59a12ff87ad5ae45d9c60e349891bf80d72877
helper_scripts/components/base_component.py
python
Component.setup
(self)
return None
Perform setup. :return: msg if the Setup Failed else None.
Perform setup. :return: msg if the Setup Failed else None.
[ "Perform", "setup", ".", ":", "return", ":", "msg", "if", "the", "Setup", "Failed", "else", "None", "." ]
def setup(self): """ Perform setup. :return: msg if the Setup Failed else None. """ return None
[ "def", "setup", "(", "self", ")", ":", "return", "None" ]
https://github.com/ucsb-seclab/difuze/blob/bb59a12ff87ad5ae45d9c60e349891bf80d72877/helper_scripts/components/base_component.py#L5-L10
bumptop/BumpTop
466d23597a07ae738f4265262fa01087fc6e257c
trunk/win/Source/bin/jinja2/lexer.py
python
TokenStream.next
(self)
return rv
Go one token ahead and return the old one
Go one token ahead and return the old one
[ "Go", "one", "token", "ahead", "and", "return", "the", "old", "one" ]
def next(self): """Go one token ahead and return the old one""" rv = self.current if self._pushed: self.current = self._pushed.popleft() elif self.current.type is not TOKEN_EOF: try: self.current = self._next() except StopIteration: ...
[ "def", "next", "(", "self", ")", ":", "rv", "=", "self", ".", "current", "if", "self", ".", "_pushed", ":", "self", ".", "current", "=", "self", ".", "_pushed", ".", "popleft", "(", ")", "elif", "self", ".", "current", ".", "type", "is", "not", "...
https://github.com/bumptop/BumpTop/blob/466d23597a07ae738f4265262fa01087fc6e257c/trunk/win/Source/bin/jinja2/lexer.py#L299-L309
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/help.py
python
HelpText.__init__
(self, parent, filename)
Configure tags and feed file to parser.
Configure tags and feed file to parser.
[ "Configure", "tags", "and", "feed", "file", "to", "parser", "." ]
def __init__(self, parent, filename): "Configure tags and feed file to parser." uwide = idleConf.GetOption('main', 'EditorWindow', 'width', type='int') uhigh = idleConf.GetOption('main', 'EditorWindow', 'height', type='int') uhigh = 3 * uhigh // 4 # Lines average 4/3 of editor line heig...
[ "def", "__init__", "(", "self", ",", "parent", ",", "filename", ")", ":", "uwide", "=", "idleConf", ".", "GetOption", "(", "'main'", ",", "'EditorWindow'", ",", "'width'", ",", "type", "=", "'int'", ")", "uhigh", "=", "idleConf", ".", "GetOption", "(", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/help.py#L170-L197
cybermaggedon/cyberprobe
f826dbc35ad3a79019cb871c0bc3fb1236130b3e
indicators/cyberprobe/logictree.py
python
Element.__init__
(self)
Constructor
Constructor
[ "Constructor" ]
def __init__(self): """ Constructor """ self.id = "s" + str(Element.id) self.par = None Element.id = Element.id + 1
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "id", "=", "\"s\"", "+", "str", "(", "Element", ".", "id", ")", "self", ".", "par", "=", "None", "Element", ".", "id", "=", "Element", ".", "id", "+", "1" ]
https://github.com/cybermaggedon/cyberprobe/blob/f826dbc35ad3a79019cb871c0bc3fb1236130b3e/indicators/cyberprobe/logictree.py#L12-L16
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/training/python/training/hparam.py
python
HParams.__init__
(self, hparam_def=None, model_structure=None, **kwargs)
Create an instance of `HParams` from keyword arguments. The keyword arguments specify name-values pairs for the hyperparameters. The parameter types are inferred from the type of the values passed. The parameter names are added as attributes of `HParams` object, so they can be accessed directly with t...
Create an instance of `HParams` from keyword arguments.
[ "Create", "an", "instance", "of", "HParams", "from", "keyword", "arguments", "." ]
def __init__(self, hparam_def=None, model_structure=None, **kwargs): """Create an instance of `HParams` from keyword arguments. The keyword arguments specify name-values pairs for the hyperparameters. The parameter types are inferred from the type of the values passed. The parameter names are added as...
[ "def", "__init__", "(", "self", ",", "hparam_def", "=", "None", ",", "model_structure", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Register the hyperparameters and their type in _hparam_types.", "# This simplifies the implementation of parse().", "# _hparam_types maps...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/training/python/training/hparam.py#L312-L366
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/richtext.py
python
RichTextLine.GetAbsoluteRange
(*args, **kwargs)
return _richtext.RichTextLine_GetAbsoluteRange(*args, **kwargs)
GetAbsoluteRange(self) -> RichTextRange
GetAbsoluteRange(self) -> RichTextRange
[ "GetAbsoluteRange", "(", "self", ")", "-", ">", "RichTextRange" ]
def GetAbsoluteRange(*args, **kwargs): """GetAbsoluteRange(self) -> RichTextRange""" return _richtext.RichTextLine_GetAbsoluteRange(*args, **kwargs)
[ "def", "GetAbsoluteRange", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_richtext", ".", "RichTextLine_GetAbsoluteRange", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L1915-L1917
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
tools/symsrc/source_index.py
python
ReadSourceStream
(pdb_filename)
return data
Read the contents of the source information stream from a PDB.
Read the contents of the source information stream from a PDB.
[ "Read", "the", "contents", "of", "the", "source", "information", "stream", "from", "a", "PDB", "." ]
def ReadSourceStream(pdb_filename): """Read the contents of the source information stream from a PDB.""" srctool = subprocess.Popen([FindFile('pdbstr.exe'), '-r', '-s:srcsrv', '-p:%s' % pdb_filename], stdout=subprocess.PIPE, st...
[ "def", "ReadSourceStream", "(", "pdb_filename", ")", ":", "srctool", "=", "subprocess", ".", "Popen", "(", "[", "FindFile", "(", "'pdbstr.exe'", ")", ",", "'-r'", ",", "'-s:srcsrv'", ",", "'-p:%s'", "%", "pdb_filename", "]", ",", "stdout", "=", "subprocess",...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/symsrc/source_index.py#L193-L204
swift/swift
12d031cf8177fdec0137f9aa7e2912fa23c4416b
3rdParty/SCons/scons-3.0.1/engine/SCons/Node/__init__.py
python
Node.get_executor
(self, create=1)
return executor
Fetch the action executor for this node. Create one if there isn't already one, and requested to do so.
Fetch the action executor for this node. Create one if there isn't already one, and requested to do so.
[ "Fetch", "the", "action", "executor", "for", "this", "node", ".", "Create", "one", "if", "there", "isn", "t", "already", "one", "and", "requested", "to", "do", "so", "." ]
def get_executor(self, create=1): """Fetch the action executor for this node. Create one if there isn't already one, and requested to do so.""" try: executor = self.executor except AttributeError: if not create: raise try: ...
[ "def", "get_executor", "(", "self", ",", "create", "=", "1", ")", ":", "try", ":", "executor", "=", "self", ".", "executor", "except", "AttributeError", ":", "if", "not", "create", ":", "raise", "try", ":", "act", "=", "self", ".", "builder", ".", "a...
https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Node/__init__.py#L636-L655
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/setuptools/py2/setuptools/config.py
python
ConfigOptionsHandler.parse_section_package_data
(self, section_options)
Parses `package_data` configuration file section. :param dict section_options:
Parses `package_data` configuration file section.
[ "Parses", "package_data", "configuration", "file", "section", "." ]
def parse_section_package_data(self, section_options): """Parses `package_data` configuration file section. :param dict section_options: """ self['package_data'] = self._parse_package_data(section_options)
[ "def", "parse_section_package_data", "(", "self", ",", "section_options", ")", ":", "self", "[", "'package_data'", "]", "=", "self", ".", "_parse_package_data", "(", "section_options", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/config.py#L629-L634
microsoft/TSS.MSR
0f2516fca2cd9929c31d5450e39301c9bde43688
TSS.Py/src/Tpm.py
python
Tpm.PolicySecret
(self, authHandle, policySession, nonceTPM, cpHashA, policyRef, expiration)
return self.processResponse(respBuf, PolicySecretResponse)
This command includes a secret-based authorization to a policy. The caller proves knowledge of the secret value using an authorization session using the authValue associated with authHandle. A password session, an HMAC session, or a policy session containing TPM2_PolicyAuthValue() or TPM...
This command includes a secret-based authorization to a policy. The caller proves knowledge of the secret value using an authorization session using the authValue associated with authHandle. A password session, an HMAC session, or a policy session containing TPM2_PolicyAuthValue() or TPM...
[ "This", "command", "includes", "a", "secret", "-", "based", "authorization", "to", "a", "policy", ".", "The", "caller", "proves", "knowledge", "of", "the", "secret", "value", "using", "an", "authorization", "session", "using", "the", "authValue", "associated", ...
def PolicySecret(self, authHandle, policySession, nonceTPM, cpHashA, policyRef, expiration): """ This command includes a secret-based authorization to a policy. The caller proves knowledge of the secret value using an authorization session using the authValue associated with authHandle. A passwo...
[ "def", "PolicySecret", "(", "self", ",", "authHandle", ",", "policySession", ",", "nonceTPM", ",", "cpHashA", ",", "policyRef", ",", "expiration", ")", ":", "req", "=", "TPM2_PolicySecret_REQUEST", "(", "authHandle", ",", "policySession", ",", "nonceTPM", ",", ...
https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/Tpm.py#L1441-L1478
kamyu104/LeetCode-Solutions
77605708a927ea3b85aee5a479db733938c7c211
Python/find-first-palindromic-string-in-the-array.py
python
Solution.firstPalindrome
(self, words)
return ""
:type words: List[str] :rtype: str
:type words: List[str] :rtype: str
[ ":", "type", "words", ":", "List", "[", "str", "]", ":", "rtype", ":", "str" ]
def firstPalindrome(self, words): """ :type words: List[str] :rtype: str """ def is_palindrome(s): i, j = 0, len(s)-1 while i < j: if s[i] != s[j]: return False i += 1 j -= 1 r...
[ "def", "firstPalindrome", "(", "self", ",", "words", ")", ":", "def", "is_palindrome", "(", "s", ")", ":", "i", ",", "j", "=", "0", ",", "len", "(", "s", ")", "-", "1", "while", "i", "<", "j", ":", "if", "s", "[", "i", "]", "!=", "s", "[", ...
https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/find-first-palindromic-string-in-the-array.py#L5-L22
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py2/pandas/io/formats/format.py
python
FloatArrayFormatter.get_result_as_array
(self)
return formatted_values
Returns the float values converted into strings using the parameters given at initialisation, as a numpy array
Returns the float values converted into strings using the parameters given at initialisation, as a numpy array
[ "Returns", "the", "float", "values", "converted", "into", "strings", "using", "the", "parameters", "given", "at", "initialisation", "as", "a", "numpy", "array" ]
def get_result_as_array(self): """ Returns the float values converted into strings using the parameters given at initialisation, as a numpy array """ if self.formatter is not None: return np.array([self.formatter(x) for x in self.values]) if self.fixed_width...
[ "def", "get_result_as_array", "(", "self", ")", ":", "if", "self", ".", "formatter", "is", "not", "None", ":", "return", "np", ".", "array", "(", "[", "self", ".", "formatter", "(", "x", ")", "for", "x", "in", "self", ".", "values", "]", ")", "if",...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/io/formats/format.py#L1045-L1126
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/framework/ops.py
python
IndexedSlices.op
(self)
return self.values.op
The `Operation` that produces `values` as an output.
The `Operation` that produces `values` as an output.
[ "The", "Operation", "that", "produces", "values", "as", "an", "output", "." ]
def op(self): """The `Operation` that produces `values` as an output.""" return self.values.op
[ "def", "op", "(", "self", ")", ":", "return", "self", ".", "values", ".", "op" ]
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/framework/ops.py#L1301-L1303
panda3d/panda3d
833ad89ebad58395d0af0b7ec08538e5e4308265
direct/src/fsm/State.py
python
State.transitionsToAny
(self)
return self.__transitions is State.Any
returns true if State defines transitions to any other state
returns true if State defines transitions to any other state
[ "returns", "true", "if", "State", "defines", "transitions", "to", "any", "other", "state" ]
def transitionsToAny(self): """ returns true if State defines transitions to any other state """ return self.__transitions is State.Any
[ "def", "transitionsToAny", "(", "self", ")", ":", "return", "self", ".", "__transitions", "is", "State", ".", "Any" ]
https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/fsm/State.py#L82-L84
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/gsutil/third_party/httplib2/python2/httplib2/__init__.py
python
Authentication.request
(self, method, request_uri, headers, content)
Modify the request headers to add the appropriate Authorization header. Over-ride this in sub-classes.
Modify the request headers to add the appropriate Authorization header. Over-ride this in sub-classes.
[ "Modify", "the", "request", "headers", "to", "add", "the", "appropriate", "Authorization", "header", ".", "Over", "-", "ride", "this", "in", "sub", "-", "classes", "." ]
def request(self, method, request_uri, headers, content): """Modify the request headers to add the appropriate Authorization header. Over-ride this in sub-classes.""" pass
[ "def", "request", "(", "self", ",", "method", ",", "request_uri", ",", "headers", ",", "content", ")", ":", "pass" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/httplib2/python2/httplib2/__init__.py#L483-L486
SFTtech/openage
d6a08c53c48dc1e157807471df92197f6ca9e04d
openage/util/fslike/abstract.py
python
FSLikeObject.open_a
(self, parts)
Shall return a BufferedWriter for the given file ("mode 'a'").
Shall return a BufferedWriter for the given file ("mode 'a'").
[ "Shall", "return", "a", "BufferedWriter", "for", "the", "given", "file", "(", "mode", "a", ")", "." ]
def open_a(self, parts): """ Shall return a BufferedWriter for the given file ("mode 'a'"). """
[ "def", "open_a", "(", "self", ",", "parts", ")", ":" ]
https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/util/fslike/abstract.py#L65-L66
devsisters/libquic
8954789a056d8e7d5fcb6452fd1572ca57eb5c4e
src/third_party/protobuf/python/mox.py
python
MockMethod.__init__
(self, method_name, call_queue, replay_mode)
Construct a new mock method. Args: # method_name: the name of the method # call_queue: deque of calls, verify this call against the head, or add # this call to the queue. # replay_mode: False if we are recording, True if we are verifying calls # against the call queue. m...
Construct a new mock method.
[ "Construct", "a", "new", "mock", "method", "." ]
def __init__(self, method_name, call_queue, replay_mode): """Construct a new mock method. Args: # method_name: the name of the method # call_queue: deque of calls, verify this call against the head, or add # this call to the queue. # replay_mode: False if we are recording, True if w...
[ "def", "__init__", "(", "self", ",", "method_name", ",", "call_queue", ",", "replay_mode", ")", ":", "self", ".", "_name", "=", "method_name", "self", ".", "_call_queue", "=", "call_queue", "if", "not", "isinstance", "(", "call_queue", ",", "deque", ")", "...
https://github.com/devsisters/libquic/blob/8954789a056d8e7d5fcb6452fd1572ca57eb5c4e/src/third_party/protobuf/python/mox.py#L519-L543
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/ops/_op_impl/akg/ascend/less.py
python
_less_akg
()
return
Less Akg register
Less Akg register
[ "Less", "Akg", "register" ]
def _less_akg(): """Less Akg register""" return
[ "def", "_less_akg", "(", ")", ":", "return" ]
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/akg/ascend/less.py#L29-L31
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests/models.py
python
PreparedRequest.prepare_content_length
(self, body)
Prepare Content-Length header based on request method and body
Prepare Content-Length header based on request method and body
[ "Prepare", "Content", "-", "Length", "header", "based", "on", "request", "method", "and", "body" ]
def prepare_content_length(self, body): """Prepare Content-Length header based on request method and body""" if body is not None: length = super_len(body) if length: # If length exists, set it. Otherwise, we fallback # to Transfer-Encoding: chunked...
[ "def", "prepare_content_length", "(", "self", ",", "body", ")", ":", "if", "body", "is", "not", "None", ":", "length", "=", "super_len", "(", "body", ")", "if", "length", ":", "# If length exists, set it. Otherwise, we fallback", "# to Transfer-Encoding: chunked.", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests/models.py#L513-L524
klzgrad/naiveproxy
ed2c513637c77b18721fe428d7ed395b4d284c83
src/build/android/pylib/dex/dex_parser.py
python
_DexReader._ReadULeb128
(self, data_offset)
return value, cur_offset - data_offset
Returns a tuple of (uleb128 value, number of bytes occupied). From DWARF3 spec: http://dwarfstd.org/doc/Dwarf3.pdf Args: data_offset: Location of the unsigned LEB128.
Returns a tuple of (uleb128 value, number of bytes occupied).
[ "Returns", "a", "tuple", "of", "(", "uleb128", "value", "number", "of", "bytes", "occupied", ")", "." ]
def _ReadULeb128(self, data_offset): """Returns a tuple of (uleb128 value, number of bytes occupied). From DWARF3 spec: http://dwarfstd.org/doc/Dwarf3.pdf Args: data_offset: Location of the unsigned LEB128. """ value = 0 shift = 0 cur_offset = data_offset while True: byte =...
[ "def", "_ReadULeb128", "(", "self", ",", "data_offset", ")", ":", "value", "=", "0", "shift", "=", "0", "cur_offset", "=", "data_offset", "while", "True", ":", "byte", "=", "self", ".", "_data", "[", "cur_offset", "]", "cur_offset", "+=", "1", "value", ...
https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/android/pylib/dex/dex_parser.py#L265-L284
tangzhenyu/Scene-Text-Understanding
0f7ffc7aea5971a50cdc03d33d0a41075285948b
ctpn_crnn_ocr/CTPN/caffe/scripts/cpp_lint.py
python
FileInfo.RepositoryName
(self)
return fullname
FullName after removing the local path to the repository. If we have a real absolute path name here we can try to do something smart: detecting the root of the checkout and truncating /path/to/checkout from the name so that we get header guards that don't include things like "C:\Documents and Settings\...
FullName after removing the local path to the repository.
[ "FullName", "after", "removing", "the", "local", "path", "to", "the", "repository", "." ]
def RepositoryName(self): """FullName after removing the local path to the repository. If we have a real absolute path name here we can try to do something smart: detecting the root of the checkout and truncating /path/to/checkout from the name so that we get header guards that don't include things lik...
[ "def", "RepositoryName", "(", "self", ")", ":", "fullname", "=", "self", ".", "FullName", "(", ")", "if", "os", ".", "path", ".", "exists", "(", "fullname", ")", ":", "project_dir", "=", "os", ".", "path", ".", "dirname", "(", "fullname", ")", "if", ...
https://github.com/tangzhenyu/Scene-Text-Understanding/blob/0f7ffc7aea5971a50cdc03d33d0a41075285948b/ctpn_crnn_ocr/CTPN/caffe/scripts/cpp_lint.py#L885-L928
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/ops/metrics_impl.py
python
mean_per_class_accuracy
(labels, predictions, num_classes, weights=None, metrics_collections=None, updates_collections=None, name=None)
Calculates the mean of the per-class accuracies. Calculates the accuracy for each class, then takes the mean of that. For estimation of the metric over a stream of data, the function creates an `update_op` operation that updates these variables and returns the `mean_accuracy`. If `weights` is `None`, weigh...
Calculates the mean of the per-class accuracies.
[ "Calculates", "the", "mean", "of", "the", "per", "-", "class", "accuracies", "." ]
def mean_per_class_accuracy(labels, predictions, num_classes, weights=None, metrics_collections=None, updates_collections=None, name=None): """Calcula...
[ "def", "mean_per_class_accuracy", "(", "labels", ",", "predictions", ",", "num_classes", ",", "weights", "=", "None", ",", "metrics_collections", "=", "None", ",", "updates_collections", "=", "None", ",", "name", "=", "None", ")", ":", "with", "variable_scope", ...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/metrics_impl.py#L809-L885
microsoft/CNTK
e9396480025b9ca457d26b6f33dd07c474c6aa04
bindings/python/cntk/contrib/deeprl/agent/random_agent.py
python
RandomAgent.save
(self, filename)
Save best model to file.
Save best model to file.
[ "Save", "best", "model", "to", "file", "." ]
def save(self, filename): """Save best model to file.""" pass
[ "def", "save", "(", "self", ",", "filename", ")", ":", "pass" ]
https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/contrib/deeprl/agent/random_agent.py#L47-L49
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
build/toolchain/win/setup_toolchain.py
python
_CopyTool
(source_path)
Copies the given tool to the current directory, including a warning not to edit it.
Copies the given tool to the current directory, including a warning not to edit it.
[ "Copies", "the", "given", "tool", "to", "the", "current", "directory", "including", "a", "warning", "not", "to", "edit", "it", "." ]
def _CopyTool(source_path): """Copies the given tool to the current directory, including a warning not to edit it.""" with open(source_path) as source_file: tool_source = source_file.readlines() # Add header and write it out to the current directory (which should be the # root build dir). Don't write the...
[ "def", "_CopyTool", "(", "source_path", ")", ":", "with", "open", "(", "source_path", ")", "as", "source_file", ":", "tool_source", "=", "source_file", ".", "readlines", "(", ")", "# Add header and write it out to the current directory (which should be the", "# root build...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/build/toolchain/win/setup_toolchain.py#L147-L170
pytorch/pytorch
7176c92687d3cc847cc046bf002269c6949a21c2
benchmarks/operator_benchmark/benchmark_core.py
python
_register_test
(*test_metainfo)
save the metainfo needed to create a test. Currently test_metainfo takes two different inputs: 1) This input when adds single op to the benchmark _register_test(configs, pt_bench_op, create_pytorch_op_test_case, run_backward=True) 2) This input when addes a lis...
save the metainfo needed to create a test. Currently test_metainfo takes two different inputs: 1) This input when adds single op to the benchmark _register_test(configs, pt_bench_op, create_pytorch_op_test_case, run_backward=True) 2) This input when addes a lis...
[ "save", "the", "metainfo", "needed", "to", "create", "a", "test", ".", "Currently", "test_metainfo", "takes", "two", "different", "inputs", ":", "1", ")", "This", "input", "when", "adds", "single", "op", "to", "the", "benchmark", "_register_test", "(", "conf...
def _register_test(*test_metainfo): """ save the metainfo needed to create a test. Currently test_metainfo takes two different inputs: 1) This input when adds single op to the benchmark _register_test(configs, pt_bench_op, create_pytorch_op_test_case, run_backward=...
[ "def", "_register_test", "(", "*", "test_metainfo", ")", ":", "BENCHMARK_TESTER", ".", "append", "(", "test_metainfo", ")" ]
https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/benchmarks/operator_benchmark/benchmark_core.py#L30-L41
hszhao/PSPNet
cf7e5a99ba37e46118026e96be5821a9bc63bde0
scripts/cpp_lint.py
python
_IncludeState.IsInAlphabeticalOrder
(self, clean_lines, linenum, header_path)
return True
Check if a header is in alphabetical order with the previous header. Args: clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. header_path: Canonicalized header to be checked. Returns: Returns true if the header is in alphabetical order.
Check if a header is in alphabetical order with the previous header.
[ "Check", "if", "a", "header", "is", "in", "alphabetical", "order", "with", "the", "previous", "header", "." ]
def IsInAlphabeticalOrder(self, clean_lines, linenum, header_path): """Check if a header is in alphabetical order with the previous header. Args: clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. header_path: Canonicalized header to be checke...
[ "def", "IsInAlphabeticalOrder", "(", "self", ",", "clean_lines", ",", "linenum", ",", "header_path", ")", ":", "# If previous section is different from current section, _last_header will", "# be reset to empty string, so it's always less than current header.", "#", "# If previous line ...
https://github.com/hszhao/PSPNet/blob/cf7e5a99ba37e46118026e96be5821a9bc63bde0/scripts/cpp_lint.py#L612-L631
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/layers/base.py
python
Network._run_internal_graph
(self, inputs, masks=None)
return output_tensors, output_masks
Computes output tensors for new inputs. # Note: - Expects `inputs` to be a list (potentially with 1 element). - Can be run on non-Keras tensors. Arguments: inputs: List of tensors masks: List of masks (tensors or None). Returns: Three lists: output_tensors, output_...
Computes output tensors for new inputs.
[ "Computes", "output", "tensors", "for", "new", "inputs", "." ]
def _run_internal_graph(self, inputs, masks=None): """Computes output tensors for new inputs. # Note: - Expects `inputs` to be a list (potentially with 1 element). - Can be run on non-Keras tensors. Arguments: inputs: List of tensors masks: List of masks (tensors or None). ...
[ "def", "_run_internal_graph", "(", "self", ",", "inputs", ",", "masks", "=", "None", ")", ":", "# Note: masking support is relevant mainly for Keras.", "# It cannot be factored out without having the fully reimplement the", "# network calling logic on the Keras side. We choose to incorpo...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/layers/base.py#L2083-L2226
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/setuptools/py3/setuptools/config.py
python
ConfigOptionsHandler.parse_section_packages__find
(self, section_options)
return find_kwargs
Parses `packages.find` configuration file section. To be used in conjunction with _parse_packages(). :param dict section_options:
Parses `packages.find` configuration file section.
[ "Parses", "packages", ".", "find", "configuration", "file", "section", "." ]
def parse_section_packages__find(self, section_options): """Parses `packages.find` configuration file section. To be used in conjunction with _parse_packages(). :param dict section_options: """ section_data = self._parse_section_to_dict(section_options, self._parse_list) ...
[ "def", "parse_section_packages__find", "(", "self", ",", "section_options", ")", ":", "section_data", "=", "self", ".", "_parse_section_to_dict", "(", "section_options", ",", "self", ".", "_parse_list", ")", "valid_keys", "=", "[", "'where'", ",", "'include'", ","...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/config.py#L682-L701
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/base.py
python
ExtensionArray.view
(self, dtype=None)
return self[:]
Return a view on the array. Parameters ---------- dtype : str, np.dtype, or ExtensionDtype, optional Default None. Returns ------- ExtensionArray A view of the :class:`ExtensionArray`.
Return a view on the array.
[ "Return", "a", "view", "on", "the", "array", "." ]
def view(self, dtype=None) -> Union[ABCExtensionArray, np.ndarray]: """ Return a view on the array. Parameters ---------- dtype : str, np.dtype, or ExtensionDtype, optional Default None. Returns ------- ExtensionArray A view of th...
[ "def", "view", "(", "self", ",", "dtype", "=", "None", ")", "->", "Union", "[", "ABCExtensionArray", ",", "np", ".", "ndarray", "]", ":", "# NB:", "# - This must return a *new* object referencing the same data, not self.", "# - The only case that *must* be implemented is wi...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/base.py#L922-L942
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/propgrid.py
python
PGProperty.GetY
(*args, **kwargs)
return _propgrid.PGProperty_GetY(*args, **kwargs)
GetY(self) -> int
GetY(self) -> int
[ "GetY", "(", "self", ")", "-", ">", "int" ]
def GetY(*args, **kwargs): """GetY(self) -> int""" return _propgrid.PGProperty_GetY(*args, **kwargs)
[ "def", "GetY", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_propgrid", ".", "PGProperty_GetY", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L477-L479
apache/incubator-mxnet
f03fb23f1d103fec9541b5ae59ee06b1734a51d9
python/mxnet/io/io.py
python
DataIter.getdata
(self)
Get data of current batch. Returns ------- list of NDArray The data of the current batch.
Get data of current batch.
[ "Get", "data", "of", "current", "batch", "." ]
def getdata(self): """Get data of current batch. Returns ------- list of NDArray The data of the current batch. """ pass
[ "def", "getdata", "(", "self", ")", ":", "pass" ]
https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/io/io.py#L241-L249
KratosMultiphysics/Kratos
0000833054ed0503424eb28205d6508d9ca6cbbc
applications/MultilevelMonteCarloApplication/external_libraries/XMC/xmc/monteCarloSampler.py
python
MonteCarloSampler.updatePredictors
(self, predictorCoordinates=None)
For an entry of qoiPredictor, retrieve all index estimations for the corresponding entry of estimatorsForPredictor and pass to the update method of qoiPredictor. If self.isCostUpdated is True, then do the same for costPredictor as well
For an entry of qoiPredictor, retrieve all index estimations for the corresponding entry of estimatorsForPredictor and pass to the update method of qoiPredictor. If self.isCostUpdated is True, then do the same for costPredictor as well
[ "For", "an", "entry", "of", "qoiPredictor", "retrieve", "all", "index", "estimations", "for", "the", "corresponding", "entry", "of", "estimatorsForPredictor", "and", "pass", "to", "the", "update", "method", "of", "qoiPredictor", ".", "If", "self", ".", "isCostUp...
def updatePredictors(self, predictorCoordinates=None): """ For an entry of qoiPredictor, retrieve all index estimations for the corresponding entry of estimatorsForPredictor and pass to the update method of qoiPredictor. If self.isCostUpdated is True, then do the same for costPredictor a...
[ "def", "updatePredictors", "(", "self", ",", "predictorCoordinates", "=", "None", ")", ":", "# TODO - The implicit assumption here is that there is a one-to-one map", "# between levelwise estimations and model built upon that estimation. We", "# have not yet allowed for a mechanism similar t...
https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/MultilevelMonteCarloApplication/external_libraries/XMC/xmc/monteCarloSampler.py#L246-L317
ApolloAuto/apollo-platform
86d9dc6743b496ead18d597748ebabd34a513289
ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py
python
diagonal
(a, k = 0, axis1=0, axis2=1)
diagonal(a,k=0,axis1=0, axis2=1) = the k'th diagonal of a
diagonal(a,k=0,axis1=0, axis2=1) = the k'th diagonal of a
[ "diagonal", "(", "a", "k", "=", "0", "axis1", "=", "0", "axis2", "=", "1", ")", "=", "the", "k", "th", "diagonal", "of", "a" ]
def diagonal(a, k = 0, axis1=0, axis2=1): """diagonal(a,k=0,axis1=0, axis2=1) = the k'th diagonal of a""" d = fromnumeric.diagonal(filled(a), k, axis1, axis2) m = getmask(a) if m is nomask: return masked_array(d, m) else: return masked_array(d, fromnumeric.diagonal(m, k, axis1, axis2...
[ "def", "diagonal", "(", "a", ",", "k", "=", "0", ",", "axis1", "=", "0", ",", "axis2", "=", "1", ")", ":", "d", "=", "fromnumeric", ".", "diagonal", "(", "filled", "(", "a", ")", ",", "k", ",", "axis1", ",", "axis2", ")", "m", "=", "getmask",...
https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py#L2093-L2100
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/roc/hsadrv/driver.py
python
OwnedPointer.__getattr__
(self, fname)
return getattr(self._view, fname)
Proxy MemoryPointer methods
Proxy MemoryPointer methods
[ "Proxy", "MemoryPointer", "methods" ]
def __getattr__(self, fname): """Proxy MemoryPointer methods """ return getattr(self._view, fname)
[ "def", "__getattr__", "(", "self", ",", "fname", ")", ":", "return", "getattr", "(", "self", ".", "_view", ",", "fname", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/roc/hsadrv/driver.py#L1168-L1171
microsoft/ivy
9f3c7ecc0b2383129fdd0953e10890d98d09a82d
ivy/concept_interactive_session.py
python
ConceptInteractiveSession._materialize_node
(self, concept_name)
return c
Materialize a node, returns the witness constant
Materialize a node, returns the witness constant
[ "Materialize", "a", "node", "returns", "the", "witness", "constant" ]
def _materialize_node(self, concept_name): """ Materialize a node, returns the witness constant """ concept = self.domain.concepts[concept_name] assert concept.arity == 1 sort = concept.variables[0].sort assert sort != TopSort() witnesses = self._get_witne...
[ "def", "_materialize_node", "(", "self", ",", "concept_name", ")", ":", "concept", "=", "self", ".", "domain", ".", "concepts", "[", "concept_name", "]", "assert", "concept", ".", "arity", "==", "1", "sort", "=", "concept", ".", "variables", "[", "0", "]...
https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/concept_interactive_session.py#L161-L180
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/computation/pytables.py
python
BinOp.is_in_table
(self)
return self.queryables.get(self.lhs) is not None
return True if this is a valid column name for generation (e.g. an actual column in the table)
return True if this is a valid column name for generation (e.g. an actual column in the table)
[ "return", "True", "if", "this", "is", "a", "valid", "column", "name", "for", "generation", "(", "e", ".", "g", ".", "an", "actual", "column", "in", "the", "table", ")" ]
def is_in_table(self) -> bool: """ return True if this is a valid column name for generation (e.g. an actual column in the table) """ return self.queryables.get(self.lhs) is not None
[ "def", "is_in_table", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "queryables", ".", "get", "(", "self", ".", "lhs", ")", "is", "not", "None" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/computation/pytables.py#L152-L155
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/contrib/securetransport.py
python
inject_into_urllib3
()
Monkey-patch urllib3 with SecureTransport-backed SSL-support.
Monkey-patch urllib3 with SecureTransport-backed SSL-support.
[ "Monkey", "-", "patch", "urllib3", "with", "SecureTransport", "-", "backed", "SSL", "-", "support", "." ]
def inject_into_urllib3(): """ Monkey-patch urllib3 with SecureTransport-backed SSL-support. """ util.SSLContext = SecureTransportContext util.ssl_.SSLContext = SecureTransportContext util.HAS_SNI = HAS_SNI util.ssl_.HAS_SNI = HAS_SNI util.IS_SECURETRANSPORT = True util.ssl_.IS_SECUR...
[ "def", "inject_into_urllib3", "(", ")", ":", "util", ".", "SSLContext", "=", "SecureTransportContext", "util", ".", "ssl_", ".", "SSLContext", "=", "SecureTransportContext", "util", ".", "HAS_SNI", "=", "HAS_SNI", "util", ".", "ssl_", ".", "HAS_SNI", "=", "HAS...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/contrib/securetransport.py#L180-L189
SFTtech/openage
d6a08c53c48dc1e157807471df92197f6ca9e04d
openage/convert/tool/subtool/acquire_sourcedir.py
python
wine_to_real_path
(path)
return subprocess.check_output(('winepath', path)).strip().decode()
Turn a Wine file path (C:\\xyz) into a local filesystem path (~/.wine/xyz)
Turn a Wine file path (C:\\xyz) into a local filesystem path (~/.wine/xyz)
[ "Turn", "a", "Wine", "file", "path", "(", "C", ":", "\\\\", "xyz", ")", "into", "a", "local", "filesystem", "path", "(", "~", "/", ".", "wine", "/", "xyz", ")" ]
def wine_to_real_path(path): """ Turn a Wine file path (C:\\xyz) into a local filesystem path (~/.wine/xyz) """ return subprocess.check_output(('winepath', path)).strip().decode()
[ "def", "wine_to_real_path", "(", "path", ")", ":", "return", "subprocess", ".", "check_output", "(", "(", "'winepath'", ",", "path", ")", ")", ".", "strip", "(", ")", ".", "decode", "(", ")" ]
https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/tool/subtool/acquire_sourcedir.py#L200-L204
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/eclib/finddlg.py
python
FindPanel.SetLookinChoices
(self, paths)
Set the looking choices @param paths: list of strings
Set the looking choices @param paths: list of strings
[ "Set", "the", "looking", "choices", "@param", "paths", ":", "list", "of", "strings" ]
def SetLookinChoices(self, paths): """Set the looking choices @param paths: list of strings """ for path in paths: self.AddLookinPath(path)
[ "def", "SetLookinChoices", "(", "self", ",", "paths", ")", ":", "for", "path", "in", "paths", ":", "self", ".", "AddLookinPath", "(", "path", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/eclib/finddlg.py#L1263-L1269
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/protobuf/py3/google/protobuf/internal/wire_format.py
python
UnpackTag
(tag)
return (tag >> TAG_TYPE_BITS), (tag & TAG_TYPE_MASK)
The inverse of PackTag(). Given an unsigned 32-bit number, returns a (field_number, wire_type) tuple.
The inverse of PackTag(). Given an unsigned 32-bit number, returns a (field_number, wire_type) tuple.
[ "The", "inverse", "of", "PackTag", "()", ".", "Given", "an", "unsigned", "32", "-", "bit", "number", "returns", "a", "(", "field_number", "wire_type", ")", "tuple", "." ]
def UnpackTag(tag): """The inverse of PackTag(). Given an unsigned 32-bit number, returns a (field_number, wire_type) tuple. """ return (tag >> TAG_TYPE_BITS), (tag & TAG_TYPE_MASK)
[ "def", "UnpackTag", "(", "tag", ")", ":", "return", "(", "tag", ">>", "TAG_TYPE_BITS", ")", ",", "(", "tag", "&", "TAG_TYPE_MASK", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py3/google/protobuf/internal/wire_format.py#L93-L97
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/_gdi.py
python
NativeFontInfo.Init
(*args, **kwargs)
return _gdi_.NativeFontInfo_Init(*args, **kwargs)
Init(self)
Init(self)
[ "Init", "(", "self", ")" ]
def Init(*args, **kwargs): """Init(self)""" return _gdi_.NativeFontInfo_Init(*args, **kwargs)
[ "def", "Init", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_gdi_", ".", "NativeFontInfo_Init", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L1869-L1871
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/input.py
python
shuffle_batch_join
(tensors_list, batch_size, capacity, min_after_dequeue, seed=None, enqueue_many=False, shapes=None, allow_smaller_final_batch=False, shared_name=None, name=None)
return _shuffle_batch_join( tensors_list, batch_size, capacity, min_after_dequeue, keep_input=True, seed=seed, enqueue_many=enqueue_many, shapes=shapes, allow_smaller_final_batch=allow_smaller_final_batch, shared_name=shared_name, name=name)
Create batches by randomly shuffling tensors. The `tensors_list` argument is a list of tuples of tensors, or a list of dictionaries of tensors. Each element in the list is treated similarly to the `tensors` argument of `tf.compat.v1.train.shuffle_batch()`. This version enqueues a different list of tensors in...
Create batches by randomly shuffling tensors.
[ "Create", "batches", "by", "randomly", "shuffling", "tensors", "." ]
def shuffle_batch_join(tensors_list, batch_size, capacity, min_after_dequeue, seed=None, enqueue_many=False, shapes=None, allow_smaller_final_batch=False, shared_name=None, name=None): """Create batches by randomly shuffling tensors. The `tensors...
[ "def", "shuffle_batch_join", "(", "tensors_list", ",", "batch_size", ",", "capacity", ",", "min_after_dequeue", ",", "seed", "=", "None", ",", "enqueue_many", "=", "False", ",", "shapes", "=", "None", ",", "allow_smaller_final_batch", "=", "False", ",", "shared_...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/input.py#L1419-L1509
fatih/subvim
241b6d170597857105da219c9b7d36059e9f11fb
vim/base/YouCompleteMe/third_party/bottle/bottle.py
python
BaseRequest.__setitem__
(self, key, value)
Change an environ value and clear all caches that depend on it.
Change an environ value and clear all caches that depend on it.
[ "Change", "an", "environ", "value", "and", "clear", "all", "caches", "that", "depend", "on", "it", "." ]
def __setitem__(self, key, value): """ Change an environ value and clear all caches that depend on it. """ if self.environ.get('bottle.request.readonly'): raise KeyError('The environ dictionary is read-only.') self.environ[key] = value todelete = () if key == 'wsgi...
[ "def", "__setitem__", "(", "self", ",", "key", ",", "value", ")", ":", "if", "self", ".", "environ", ".", "get", "(", "'bottle.request.readonly'", ")", ":", "raise", "KeyError", "(", "'The environ dictionary is read-only.'", ")", "self", ".", "environ", "[", ...
https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/bottle/bottle.py#L1333-L1350
Tencent/TNN
7acca99f54c55747b415a4c57677403eebc7b706
third_party/flatbuffers/python/flatbuffers/flexbuffers.py
python
Type.ToTypedVector
(element_type, fixed_len=0)
Converts element type to corresponding vector type. Args: element_type: vector element type fixed_len: number of elements: 0 for typed vector; 2, 3, or 4 for fixed typed vector. Returns: Typed vector type or fixed typed vector type.
Converts element type to corresponding vector type.
[ "Converts", "element", "type", "to", "corresponding", "vector", "type", "." ]
def ToTypedVector(element_type, fixed_len=0): """Converts element type to corresponding vector type. Args: element_type: vector element type fixed_len: number of elements: 0 for typed vector; 2, 3, or 4 for fixed typed vector. Returns: Typed vector type or fixed typed vector type...
[ "def", "ToTypedVector", "(", "element_type", ",", "fixed_len", "=", "0", ")", ":", "if", "fixed_len", "==", "0", ":", "if", "not", "Type", ".", "IsTypedVectorElementType", "(", "element_type", ")", ":", "raise", "ValueError", "(", "'must be typed vector element ...
https://github.com/Tencent/TNN/blob/7acca99f54c55747b415a4c57677403eebc7b706/third_party/flatbuffers/python/flatbuffers/flexbuffers.py#L249-L277
Polidea/SiriusObfuscator
b0e590d8130e97856afe578869b83a209e2b19be
SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py
python
SBBreakpoint.SetScriptCallbackBody
(self, *args)
return _lldb.SBBreakpoint_SetScriptCallbackBody(self, *args)
SetScriptCallbackBody(self, str script_body_text) -> SBError Provide the body for the script function to be called when the breakpoint is hit. The body will be wrapped in a function, which be passed two arguments: 'frame' - which holds the bottom-most SBFrame of the thread that hit the breakpoi...
SetScriptCallbackBody(self, str script_body_text) -> SBError
[ "SetScriptCallbackBody", "(", "self", "str", "script_body_text", ")", "-", ">", "SBError" ]
def SetScriptCallbackBody(self, *args): """ SetScriptCallbackBody(self, str script_body_text) -> SBError Provide the body for the script function to be called when the breakpoint is hit. The body will be wrapped in a function, which be passed two arguments: 'frame' - which holds...
[ "def", "SetScriptCallbackBody", "(", "self", ",", "*", "args", ")", ":", "return", "_lldb", ".", "SBBreakpoint_SetScriptCallbackBody", "(", "self", ",", "*", "args", ")" ]
https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L1562-L1575
neoml-lib/neoml
a0d370fba05269a1b2258cef126f77bbd2054a3e
NeoML/Python/neoml/Dnn/Solver.py
python
AdaptiveGradient.decoupled_weight_decay
(self, value)
Enables using of Decoupled Weight Decay Regularization. May be called only before training starts. See https://openreview.net/pdf?id=Bkg6RiCqY7.
Enables using of Decoupled Weight Decay Regularization. May be called only before training starts. See https://openreview.net/pdf?id=Bkg6RiCqY7.
[ "Enables", "using", "of", "Decoupled", "Weight", "Decay", "Regularization", ".", "May", "be", "called", "only", "before", "training", "starts", ".", "See", "https", ":", "//", "openreview", ".", "net", "/", "pdf?id", "=", "Bkg6RiCqY7", "." ]
def decoupled_weight_decay(self, value): """Enables using of Decoupled Weight Decay Regularization. May be called only before training starts. See https://openreview.net/pdf?id=Bkg6RiCqY7. """ self._internal.set_decoupled_weight_decay(value)
[ "def", "decoupled_weight_decay", "(", "self", ",", "value", ")", ":", "self", ".", "_internal", ".", "set_decoupled_weight_decay", "(", "value", ")" ]
https://github.com/neoml-lib/neoml/blob/a0d370fba05269a1b2258cef126f77bbd2054a3e/NeoML/Python/neoml/Dnn/Solver.py#L247-L252
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tarfile.py
python
TarFile.extract
(self, member, path="", set_attrs=True, *, numeric_owner=False)
Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. `member' may be a filename or a TarInfo object. You can specify a different directory using `path'. File attributes (owner, mt...
Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. `member' may be a filename or a TarInfo object. You can specify a different directory using `path'. File attributes (owner, mt...
[ "Extract", "a", "member", "from", "the", "archive", "to", "the", "current", "working", "directory", "using", "its", "full", "name", ".", "Its", "file", "information", "is", "extracted", "as", "accurately", "as", "possible", ".", "member", "may", "be", "a", ...
def extract(self, member, path="", set_attrs=True, *, numeric_owner=False): """Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. `member' may be a filename or a TarInfo object. You can ...
[ "def", "extract", "(", "self", ",", "member", ",", "path", "=", "\"\"", ",", "set_attrs", "=", "True", ",", "*", ",", "numeric_owner", "=", "False", ")", ":", "self", ".", "_check", "(", "\"r\"", ")", "if", "isinstance", "(", "member", ",", "str", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tarfile.py#L2021-L2057
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/agw/flatnotebook.py
python
FNBRendererVC8.DrawTabs
(self, pageContainer, dc)
Draws all the tabs using `VC8` style. :param `pageContainer`: an instance of :class:`FlatNotebook`; :param `dc`: an instance of :class:`DC`.
Draws all the tabs using `VC8` style.
[ "Draws", "all", "the", "tabs", "using", "VC8", "style", "." ]
def DrawTabs(self, pageContainer, dc): """ Draws all the tabs using `VC8` style. :param `pageContainer`: an instance of :class:`FlatNotebook`; :param `dc`: an instance of :class:`DC`. """ pc = pageContainer if "__WXMAC__" in wx.PlatformInfo: # Works...
[ "def", "DrawTabs", "(", "self", ",", "pageContainer", ",", "dc", ")", ":", "pc", "=", "pageContainer", "if", "\"__WXMAC__\"", "in", "wx", ".", "PlatformInfo", ":", "# Works well on MSW & GTK, however this lines should be skipped on MAC", "if", "not", "pc", ".", "_pa...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/flatnotebook.py#L3043-L3193
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/states.py
python
Body.split_attribution
(self, indented, line_offset)
Check for a block quote attribution and split it off: * First line after a blank line must begin with a dash ("--", "---", em-dash; matches `self.attribution_pattern`). * Every line after that must have consistent indentation. * Attributions must be preceded by block quote content. ...
Check for a block quote attribution and split it off:
[ "Check", "for", "a", "block", "quote", "attribution", "and", "split", "it", "off", ":" ]
def split_attribution(self, indented, line_offset): """ Check for a block quote attribution and split it off: * First line after a blank line must begin with a dash ("--", "---", em-dash; matches `self.attribution_pattern`). * Every line after that must have consistent indenta...
[ "def", "split_attribution", "(", "self", ",", "indented", ",", "line_offset", ")", ":", "blank", "=", "None", "nonblank_seen", "=", "False", "for", "i", "in", "range", "(", "len", "(", "indented", ")", ")", ":", "line", "=", "indented", "[", "i", "]", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/states.py#L1182-L1215
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/__init__.py
python
cpu_times
(percpu=False)
Return system-wide CPU times as a namedtuple. Every CPU time represents the seconds the CPU has spent in the given mode. The namedtuple's fields availability varies depending on the platform: - user - system - idle - nice (UNIX) - iowait (Linux) - irq (Linux, FreeBSD) - s...
Return system-wide CPU times as a namedtuple. Every CPU time represents the seconds the CPU has spent in the given mode. The namedtuple's fields availability varies depending on the platform:
[ "Return", "system", "-", "wide", "CPU", "times", "as", "a", "namedtuple", ".", "Every", "CPU", "time", "represents", "the", "seconds", "the", "CPU", "has", "spent", "in", "the", "given", "mode", ".", "The", "namedtuple", "s", "fields", "availability", "var...
def cpu_times(percpu=False): """Return system-wide CPU times as a namedtuple. Every CPU time represents the seconds the CPU has spent in the given mode. The namedtuple's fields availability varies depending on the platform: - user - system - idle - nice (UNIX) - iowait (Linux) ...
[ "def", "cpu_times", "(", "percpu", "=", "False", ")", ":", "if", "not", "percpu", ":", "return", "_psplatform", ".", "cpu_times", "(", ")", "else", ":", "return", "_psplatform", ".", "per_cpu_times", "(", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/__init__.py#L1602-L1627
Polidea/SiriusObfuscator
b0e590d8130e97856afe578869b83a209e2b19be
SymbolExtractorAndRenamer/clang/bindings/python/clang/cindex.py
python
Cursor.walk_preorder
(self)
Depth-first preorder walk over the cursor and its descendants. Yields cursors.
Depth-first preorder walk over the cursor and its descendants.
[ "Depth", "-", "first", "preorder", "walk", "over", "the", "cursor", "and", "its", "descendants", "." ]
def walk_preorder(self): """Depth-first preorder walk over the cursor and its descendants. Yields cursors. """ yield self for child in self.get_children(): for descendant in child.walk_preorder(): yield descendant
[ "def", "walk_preorder", "(", "self", ")", ":", "yield", "self", "for", "child", "in", "self", ".", "get_children", "(", ")", ":", "for", "descendant", "in", "child", ".", "walk_preorder", "(", ")", ":", "yield", "descendant" ]
https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/clang/bindings/python/clang/cindex.py#L1692-L1700
pyne/pyne
0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3
pyne/r2s.py
python
tag_version
(m)
return m
This function tags the version of photon source to the PyMOAB mesh instance as a sparse tag for the purpose of photon source sampling. Parameters ---------- m : PyNE Mesh The object containing the mesh instance to be tagged. Returns ------- m : PyNE Mesh The mesh with versio...
This function tags the version of photon source to the PyMOAB mesh instance as a sparse tag for the purpose of photon source sampling.
[ "This", "function", "tags", "the", "version", "of", "photon", "source", "to", "the", "PyMOAB", "mesh", "instance", "as", "a", "sparse", "tag", "for", "the", "purpose", "of", "photon", "source", "sampling", "." ]
def tag_version(m): """This function tags the version of photon source to the PyMOAB mesh instance as a sparse tag for the purpose of photon source sampling. Parameters ---------- m : PyNE Mesh The object containing the mesh instance to be tagged. Returns ------- m : PyNE Mesh ...
[ "def", "tag_version", "(", "m", ")", ":", "# do not provide value when init a sparse tag", "m", ".", "tag", "(", "name", "=", "_SOURCE_VERSION_TAG_NAME", ",", "doc", "=", "'version of the photon source file'", ",", "tagtype", "=", "NativeMeshTag", ",", "size", "=", ...
https://github.com/pyne/pyne/blob/0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3/pyne/r2s.py#L332-L352
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
qt/python/mantidqtinterfaces/mantidqtinterfaces/PyChop/PyChop2.py
python
PyChop2.getFrequency
(self)
return self.object.getFrequency()
! Returns (a list of) the current chopper frequency(ies)
! Returns (a list of) the current chopper frequency(ies)
[ "!", "Returns", "(", "a", "list", "of", ")", "the", "current", "chopper", "frequency", "(", "ies", ")" ]
def getFrequency(self): """ ! Returns (a list of) the current chopper frequency(ies) """ return self.object.getFrequency()
[ "def", "getFrequency", "(", "self", ")", ":", "return", "self", ".", "object", ".", "getFrequency", "(", ")" ]
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/PyChop/PyChop2.py#L86-L90
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/telemetry/telemetry/web_perf/timeline_interaction_record.py
python
TimelineInteractionRecord.FromAsyncEvent
(cls, async_event)
return cls(label, async_event.start, async_event.end, async_event, flags)
Construct an timeline_interaction_record from an async event. Args: async_event: An instance of telemetry.timeline.async_slices.AsyncSlice
Construct an timeline_interaction_record from an async event. Args: async_event: An instance of telemetry.timeline.async_slices.AsyncSlice
[ "Construct", "an", "timeline_interaction_record", "from", "an", "async", "event", ".", "Args", ":", "async_event", ":", "An", "instance", "of", "telemetry", ".", "timeline", ".", "async_slices", ".", "AsyncSlice" ]
def FromAsyncEvent(cls, async_event): """Construct an timeline_interaction_record from an async event. Args: async_event: An instance of telemetry.timeline.async_slices.AsyncSlice """ assert async_event.start_thread == async_event.end_thread, ( 'Start thread of this record\'s async...
[ "def", "FromAsyncEvent", "(", "cls", ",", "async_event", ")", ":", "assert", "async_event", ".", "start_thread", "==", "async_event", ".", "end_thread", ",", "(", "'Start thread of this record\\'s async event is not the same as its '", "'end thread'", ")", "m", "=", "re...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/web_perf/timeline_interaction_record.py#L126-L140
BitMEX/api-connectors
37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812
auto-generated/python/swagger_client/models/execution.py
python
Execution.to_dict
(self)
return result
Returns the model properties as a dict
Returns the model properties as a dict
[ "Returns", "the", "model", "properties", "as", "a", "dict" ]
def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if has...
[ "def", "to_dict", "(", "self", ")", ":", "result", "=", "{", "}", "for", "attr", ",", "_", "in", "six", ".", "iteritems", "(", "self", ".", "swagger_types", ")", ":", "value", "=", "getattr", "(", "self", ",", "attr", ")", "if", "isinstance", "(", ...
https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/execution.py#L1268-L1293
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/distutils/command/sdist.py
python
sdist.make_distribution
(self)
Create the source distribution(s). First, we create the release tree with 'make_release_tree()'; then, we create all required archive files (according to 'self.formats') from the release tree. Finally, we clean up by blowing away the release tree (unless 'self.keep_temp' is true). The ...
Create the source distribution(s). First, we create the release tree with 'make_release_tree()'; then, we create all required archive files (according to 'self.formats') from the release tree. Finally, we clean up by blowing away the release tree (unless 'self.keep_temp' is true). The ...
[ "Create", "the", "source", "distribution", "(", "s", ")", ".", "First", "we", "create", "the", "release", "tree", "with", "make_release_tree", "()", ";", "then", "we", "create", "all", "required", "archive", "files", "(", "according", "to", "self", ".", "f...
def make_distribution(self): """Create the source distribution(s). First, we create the release tree with 'make_release_tree()'; then, we create all required archive files (according to 'self.formats') from the release tree. Finally, we clean up by blowing away the release tree (unless ...
[ "def", "make_distribution", "(", "self", ")", ":", "# Don't warn about missing meta-data here -- should be (and is!)", "# done elsewhere.", "base_dir", "=", "self", ".", "distribution", ".", "get_fullname", "(", ")", "base_name", "=", "os", ".", "path", ".", "join", "...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/distutils/command/sdist.py#L443-L471
krishauser/Klampt
972cc83ea5befac3f653c1ba20f80155768ad519
Python/klampt/robotsim.py
python
force_closure_2d
(*args)
return _robotsim.force_closure_2d(*args)
r""" Returns true if the list of 2D contact points has force closure. force_closure_2d (contacts,m,n): bool force_closure_2d (contactPositions,frictionCones): bool Returns: bool: In the 1-argument version, each contact point is given by a list of 4 floats, [x,y,theta,k] where (x,y...
r""" Returns true if the list of 2D contact points has force closure.
[ "r", "Returns", "true", "if", "the", "list", "of", "2D", "contact", "points", "has", "force", "closure", "." ]
def force_closure_2d(*args) ->bool: r""" Returns true if the list of 2D contact points has force closure. force_closure_2d (contacts,m,n): bool force_closure_2d (contactPositions,frictionCones): bool Returns: bool: In the 1-argument version, each contact point is given by a list o...
[ "def", "force_closure_2d", "(", "*", "args", ")", "->", "bool", ":", "return", "_robotsim", ".", "force_closure_2d", "(", "*", "args", ")" ]
https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/robotsim.py#L8346-L8383
zhaoweicai/mscnn
534bcac5710a579d60827f192035f7eef6d8c585
scripts/cpp_lint.py
python
CleansedLines.NumLines
(self)
return self.num_lines
Returns the number of lines represented.
Returns the number of lines represented.
[ "Returns", "the", "number", "of", "lines", "represented", "." ]
def NumLines(self): """Returns the number of lines represented.""" return self.num_lines
[ "def", "NumLines", "(", "self", ")", ":", "return", "self", ".", "num_lines" ]
https://github.com/zhaoweicai/mscnn/blob/534bcac5710a579d60827f192035f7eef6d8c585/scripts/cpp_lint.py#L1204-L1206
google/mysql-protobuf
467cda676afaa49e762c5c9164a43f6ad31a1fbf
protobuf/python/google/protobuf/service.py
python
RpcController.SetFailed
(self, reason)
Sets a failure reason. Causes Failed() to return true on the client side. "reason" will be incorporated into the message returned by ErrorText(). If you find you need to return machine-readable information about failures, you should incorporate it into your response protocol buffer and should NOT...
Sets a failure reason.
[ "Sets", "a", "failure", "reason", "." ]
def SetFailed(self, reason): """Sets a failure reason. Causes Failed() to return true on the client side. "reason" will be incorporated into the message returned by ErrorText(). If you find you need to return machine-readable information about failures, you should incorporate it into your respons...
[ "def", "SetFailed", "(", "self", ",", "reason", ")", ":", "raise", "NotImplementedError" ]
https://github.com/google/mysql-protobuf/blob/467cda676afaa49e762c5c9164a43f6ad31a1fbf/protobuf/python/google/protobuf/service.py#L167-L176
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
qt/applications/workbench/workbench/widgets/plotselector/view.py
python
PlotSelectorView._make_table_widget
(self)
return table_widget
Make a table showing the matplotlib figure number of the plots, the name with close and edit buttons, and a hidden column for sorting with the last actuve order :return: A QTableWidget object which will contain plot widgets
Make a table showing the matplotlib figure number of the plots, the name with close and edit buttons, and a hidden column for sorting with the last actuve order :return: A QTableWidget object which will contain plot widgets
[ "Make", "a", "table", "showing", "the", "matplotlib", "figure", "number", "of", "the", "plots", "the", "name", "with", "close", "and", "edit", "buttons", "and", "a", "hidden", "column", "for", "sorting", "with", "the", "last", "actuve", "order", ":", "retu...
def _make_table_widget(self): """ Make a table showing the matplotlib figure number of the plots, the name with close and edit buttons, and a hidden column for sorting with the last actuve order :return: A QTableWidget object which will contain plot widgets """ ta...
[ "def", "_make_table_widget", "(", "self", ")", ":", "table_widget", "=", "QTableWidget", "(", "0", ",", "3", ",", "self", ")", "table_widget", ".", "setHorizontalHeaderLabels", "(", "[", "'No.'", ",", "'Plot Name'", ",", "'Last Active Order (hidden)'", "]", ")",...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/applications/workbench/workbench/widgets/plotselector/view.py#L153-L189
chuckcho/video-caffe
fc232b3e3a90ea22dd041b9fc5c542f170581f20
python/caffe/io.py
python
resize_image
(im, new_dims, interp_order=1)
return resized_im.astype(np.float32)
Resize an image array with interpolation. Parameters ---------- im : (H x W x K) or (H x W x K x L) ndarray new_dims : (height, width) tuple of new dimensions. interp_order : interpolation order, default is linear. Returns ------- im : resized ndarray with shape (new_dims[0], new_dims[...
Resize an image array with interpolation.
[ "Resize", "an", "image", "array", "with", "interpolation", "." ]
def resize_image(im, new_dims, interp_order=1): """ Resize an image array with interpolation. Parameters ---------- im : (H x W x K) or (H x W x K x L) ndarray new_dims : (height, width) tuple of new dimensions. interp_order : interpolation order, default is linear. Returns -------...
[ "def", "resize_image", "(", "im", ",", "new_dims", ",", "interp_order", "=", "1", ")", ":", "# (H x W x K) case", "if", "im", ".", "ndim", "==", "3", ":", "if", "im", ".", "shape", "[", "-", "1", "]", "==", "1", "or", "im", ".", "shape", "[", "-"...
https://github.com/chuckcho/video-caffe/blob/fc232b3e3a90ea22dd041b9fc5c542f170581f20/python/caffe/io.py#L324-L379
eventql/eventql
7ca0dbb2e683b525620ea30dc40540a22d5eb227
deps/3rdparty/spidermonkey/mozjs/python/virtualenv/virtualenv.py
python
ConfigOptionParser.get_config_section
(self, name)
return []
Get a section of a configuration
Get a section of a configuration
[ "Get", "a", "section", "of", "a", "configuration" ]
def get_config_section(self, name): """ Get a section of a configuration """ if self.config.has_section(name): return self.config.items(name) return []
[ "def", "get_config_section", "(", "self", ",", "name", ")", ":", "if", "self", ".", "config", ".", "has_section", "(", "name", ")", ":", "return", "self", ".", "config", ".", "items", "(", "name", ")", "return", "[", "]" ]
https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/virtualenv/virtualenv.py#L611-L617
glotzerlab/hoomd-blue
f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a
hoomd/hpmc/external/wall.py
python
wall.remove_cylinder_wall
(self, index)
R"""Remove a particular cylinder wall from the simulation. # noqa Args: index (int): index of the cylinder wall to be removed. indices begin at 0 in the order the cylinder walls were added to the system. Example:: mc = hpmc.integrate.sphere(seed = 415236); ext_wal...
R"""Remove a particular cylinder wall from the simulation. # noqa
[ "R", "Remove", "a", "particular", "cylinder", "wall", "from", "the", "simulation", ".", "#", "noqa" ]
def remove_cylinder_wall(self, index): R"""Remove a particular cylinder wall from the simulation. # noqa Args: index (int): index of the cylinder wall to be removed. indices begin at 0 in the order the cylinder walls were added to the system. Example:: mc = hpmc.integ...
[ "def", "remove_cylinder_wall", "(", "self", ",", "index", ")", ":", "self", ".", "cpp_compute", ".", "RemoveCylinderWall", "(", "index", ")" ]
https://github.com/glotzerlab/hoomd-blue/blob/f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a/hoomd/hpmc/external/wall.py#L284-L298
alibaba/graph-learn
54cafee9db3054dc310a28b856be7f97c7d5aee9
graphlearn/python/gsl/dag_node.py
python
DagNode.where
(self, target, condition={})
return self
Add condition for negative samlpler. Used after `by`. Args: target (string): Alias of upstream TraverseVertexDagNode which is the postive sample that condition should match. condition (dict, optional): Keys are as following. "batch_share" (bool, optional): Whether sampled negative sampl...
Add condition for negative samlpler. Used after `by`.
[ "Add", "condition", "for", "negative", "samlpler", ".", "Used", "after", "by", "." ]
def where(self, target, condition={}): """ Add condition for negative samlpler. Used after `by`. Args: target (string): Alias of upstream TraverseVertexDagNode which is the postive sample that condition should match. condition (dict, optional): Keys are as following. "batch_share" (...
[ "def", "where", "(", "self", ",", "target", ",", "condition", "=", "{", "}", ")", ":", "if", "isinstance", "(", "target", ",", "str", ")", ":", "target", "=", "self", ".", "_dag", ".", "get_node", "(", "target", ")", "if", "not", "isinstance", "(",...
https://github.com/alibaba/graph-learn/blob/54cafee9db3054dc310a28b856be7f97c7d5aee9/graphlearn/python/gsl/dag_node.py#L232-L291
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/distribute/mirrored_strategy.py
python
MirroredExtended.read_var
(self, replica_local_var)
return array_ops.identity(replica_local_var._get())
Read the aggregate value of a replica-local variable.
Read the aggregate value of a replica-local variable.
[ "Read", "the", "aggregate", "value", "of", "a", "replica", "-", "local", "variable", "." ]
def read_var(self, replica_local_var): """Read the aggregate value of a replica-local variable.""" # pylint: disable=protected-access if distribute_utils.is_sync_on_read(replica_local_var): return replica_local_var._get_cross_replica() assert distribute_utils.is_mirrored(replica_local_var) ret...
[ "def", "read_var", "(", "self", ",", "replica_local_var", ")", ":", "# pylint: disable=protected-access", "if", "distribute_utils", ".", "is_sync_on_read", "(", "replica_local_var", ")", ":", "return", "replica_local_var", ".", "_get_cross_replica", "(", ")", "assert", ...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/mirrored_strategy.py#L838-L844
intel/llvm
e6d0547e9d99b5a56430c4749f6c7e328bf221ab
lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py
python
PtyProcess.isalive
(self)
return False
This tests if the child process is running or not. This is non-blocking. If the child was terminated then this will read the exitstatus or signalstatus of the child. This returns True if the child process appears to be running or False if not. It can take literally SECONDS for Solaris to...
This tests if the child process is running or not. This is non-blocking. If the child was terminated then this will read the exitstatus or signalstatus of the child. This returns True if the child process appears to be running or False if not. It can take literally SECONDS for Solaris to...
[ "This", "tests", "if", "the", "child", "process", "is", "running", "or", "not", ".", "This", "is", "non", "-", "blocking", ".", "If", "the", "child", "was", "terminated", "then", "this", "will", "read", "the", "exitstatus", "or", "signalstatus", "of", "t...
def isalive(self): '''This tests if the child process is running or not. This is non-blocking. If the child was terminated then this will read the exitstatus or signalstatus of the child. This returns True if the child process appears to be running or False if not. It can take literally ...
[ "def", "isalive", "(", "self", ")", ":", "if", "self", ".", "terminated", ":", "return", "False", "if", "self", ".", "flag_eof", ":", "# This is for Linux, which requires the blocking form", "# of waitpid to get the status of a defunct process.", "# This is super-lame. The fl...
https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py#L685-L760
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/extern/aui/auibook.py
python
AuiNotebook.OnSize
(self, event)
Handles the ``wx.EVT_SIZE`` event for :class:`AuiNotebook`. :param `event`: a :class:`SizeEvent` event to be processed.
Handles the ``wx.EVT_SIZE`` event for :class:`AuiNotebook`.
[ "Handles", "the", "wx", ".", "EVT_SIZE", "event", "for", ":", "class", ":", "AuiNotebook", "." ]
def OnSize(self, event): """ Handles the ``wx.EVT_SIZE`` event for :class:`AuiNotebook`. :param `event`: a :class:`SizeEvent` event to be processed. """ self.UpdateHintWindowSize() event.Skip()
[ "def", "OnSize", "(", "self", ",", "event", ")", ":", "self", ".", "UpdateHintWindowSize", "(", ")", "event", ".", "Skip", "(", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/auibook.py#L4484-L4492
Polidea/SiriusObfuscator
b0e590d8130e97856afe578869b83a209e2b19be
SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py
python
SBFileSpec.AppendPathComponent
(self, *args)
return _lldb.SBFileSpec_AppendPathComponent(self, *args)
AppendPathComponent(self, str file_or_directory)
AppendPathComponent(self, str file_or_directory)
[ "AppendPathComponent", "(", "self", "str", "file_or_directory", ")" ]
def AppendPathComponent(self, *args): """AppendPathComponent(self, str file_or_directory)""" return _lldb.SBFileSpec_AppendPathComponent(self, *args)
[ "def", "AppendPathComponent", "(", "self", ",", "*", "args", ")", ":", "return", "_lldb", ".", "SBFileSpec_AppendPathComponent", "(", "self", ",", "*", "args", ")" ]
https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L4362-L4364
eric612/MobileNet-YOLO
69b4441cb3ec8d553fbdef788ad033e246f901bd
scripts/cpp_lint.py
python
CheckForFunctionLengths
(filename, clean_lines, linenum, function_state, error)
Reports for long function bodies. For an overview why this is done, see: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions Uses a simplistic algorithm assuming other style guidelines (especially spacing) are followed. Only checks unindented functions, so class members are ...
Reports for long function bodies.
[ "Reports", "for", "long", "function", "bodies", "." ]
def CheckForFunctionLengths(filename, clean_lines, linenum, function_state, error): """Reports for long function bodies. For an overview why this is done, see: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions Uses a simplistic algorithm assuming ...
[ "def", "CheckForFunctionLengths", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "function_state", ",", "error", ")", ":", "lines", "=", "clean_lines", ".", "lines", "line", "=", "lines", "[", "linenum", "]", "raw", "=", "clean_lines", ".", "raw_l...
https://github.com/eric612/MobileNet-YOLO/blob/69b4441cb3ec8d553fbdef788ad033e246f901bd/scripts/cpp_lint.py#L2388-L2455
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pep517/wrappers.py
python
Pep517HookCaller.build_sdist
(self, sdist_directory, config_settings=None)
return self._call_hook('build_sdist', { 'sdist_directory': abspath(sdist_directory), 'config_settings': config_settings, })
Build an sdist from this project. Returns the name of the newly created file. This calls the 'build_sdist' backend hook in a subprocess.
Build an sdist from this project.
[ "Build", "an", "sdist", "from", "this", "project", "." ]
def build_sdist(self, sdist_directory, config_settings=None): """Build an sdist from this project. Returns the name of the newly created file. This calls the 'build_sdist' backend hook in a subprocess. """ return self._call_hook('build_sdist', { 'sdist_directory': a...
[ "def", "build_sdist", "(", "self", ",", "sdist_directory", ",", "config_settings", "=", "None", ")", ":", "return", "self", ".", "_call_hook", "(", "'build_sdist'", ",", "{", "'sdist_directory'", ":", "abspath", "(", "sdist_directory", ")", ",", "'config_setting...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pep517/wrappers.py#L234-L244
qgis/QGIS
15a77662d4bb712184f6aa60d0bd663010a76a75
python/plugins/grassprovider/ext/r_li.py
python
configFile
(alg, parameters, context, feedback, outputTxt=False)
Handle inline configuration :param parameters:
Handle inline configuration :param parameters:
[ "Handle", "inline", "configuration", ":", "param", "parameters", ":" ]
def configFile(alg, parameters, context, feedback, outputTxt=False): """Handle inline configuration :param parameters: """ # Where is the GRASS7 user directory ? userGrass7Path = rliPath() if not os.path.isdir(userGrass7Path): mkdir(userGrass7Path) if not os.path.isdir(os.path.join(u...
[ "def", "configFile", "(", "alg", ",", "parameters", ",", "context", ",", "feedback", ",", "outputTxt", "=", "False", ")", ":", "# Where is the GRASS7 user directory ?", "userGrass7Path", "=", "rliPath", "(", ")", "if", "not", "os", ".", "path", ".", "isdir", ...
https://github.com/qgis/QGIS/blob/15a77662d4bb712184f6aa60d0bd663010a76a75/python/plugins/grassprovider/ext/r_li.py#L83-L127
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/commands.py
python
add_option
(command, long_name, help_text, short_name=None, default=None, inherit=None)
Add an option
Add an option
[ "Add", "an", "option" ]
def add_option(command, long_name, help_text, short_name=None, default=None, inherit=None): """ Add an option """ try: command_class = globals()[_command_mapping[command]] except KeyError: raise ValueError("Unknown command %r" % (command,)) for opt in command_class.user_op...
[ "def", "add_option", "(", "command", ",", "long_name", ",", "help_text", ",", "short_name", "=", "None", ",", "default", "=", "None", ",", "inherit", "=", "None", ")", ":", "try", ":", "command_class", "=", "globals", "(", ")", "[", "_command_mapping", "...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/commands.py#L50-L86
NicknineTheEagle/TF2-Base
20459c5a7fbc995b6bf54fa85c2f62a101e9fb64
src/thirdparty/protobuf-2.3.0/python/google/protobuf/text_format.py
python
_Tokenizer.ConsumeBool
(self)
Consumes a boolean value. Returns: The bool parsed. Raises: ParseError: If a boolean value couldn't be consumed.
Consumes a boolean value.
[ "Consumes", "a", "boolean", "value", "." ]
def ConsumeBool(self): """Consumes a boolean value. Returns: The bool parsed. Raises: ParseError: If a boolean value couldn't be consumed. """ if self.token == 'true': self.NextToken() return True elif self.token == 'false': self.NextToken() return False ...
[ "def", "ConsumeBool", "(", "self", ")", ":", "if", "self", ".", "token", "==", "'true'", ":", "self", ".", "NextToken", "(", ")", "return", "True", "elif", "self", ".", "token", "==", "'false'", ":", "self", ".", "NextToken", "(", ")", "return", "Fal...
https://github.com/NicknineTheEagle/TF2-Base/blob/20459c5a7fbc995b6bf54fa85c2f62a101e9fb64/src/thirdparty/protobuf-2.3.0/python/google/protobuf/text_format.py#L501-L517
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
tools/cr/cr/loader.py
python
_ScanPackage
(package)
return modules
Scan a package for child packages and modules.
Scan a package for child packages and modules.
[ "Scan", "a", "package", "for", "child", "packages", "and", "modules", "." ]
def _ScanPackage(package): """Scan a package for child packages and modules.""" modules = [] # Recurse sub folders. for path in package.__path__: try: basenames = sorted(os.listdir(path)) except OSError: basenames = [] for basename in basenames: fullpath = os.path.join(path, basena...
[ "def", "_ScanPackage", "(", "package", ")", ":", "modules", "=", "[", "]", "# Recurse sub folders.", "for", "path", "in", "package", ".", "__path__", ":", "try", ":", "basenames", "=", "sorted", "(", "os", ".", "listdir", "(", "path", ")", ")", "except",...
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/cr/cr/loader.py#L62-L80
tfwu/FaceDetection-ConvNet-3D
f9251c48eb40c5aec8fba7455115c355466555be
python/mxnet/ndarray.py
python
NDArray._slice
(self, start, stop)
return NDArray(handle=handle, writable=self.writable)
Return a sliced NDArray that shares memory with current one. Parameters ---------- start : int Starting index of slice. stop : int Finishing index of slice.
Return a sliced NDArray that shares memory with current one.
[ "Return", "a", "sliced", "NDArray", "that", "shares", "memory", "with", "current", "one", "." ]
def _slice(self, start, stop): """Return a sliced NDArray that shares memory with current one. Parameters ---------- start : int Starting index of slice. stop : int Finishing index of slice. """ handle = NDArrayHandle() start = mx_...
[ "def", "_slice", "(", "self", ",", "start", ",", "stop", ")", ":", "handle", "=", "NDArrayHandle", "(", ")", "start", "=", "mx_uint", "(", "start", ")", "if", "start", "else", "mx_uint", "(", "0", ")", "stop", "=", "mx_uint", "(", "stop", ")", "if"...
https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/python/mxnet/ndarray.py#L240-L255
mysql/mysql-workbench
2f35f9034f015cbcd22139a60e1baa2e3e8e795c
plugins/wb.admin/backend/wb_server_management.py
python
ProcessOpsWindowsLocal.expand_path_variables
(self, path)
return path
Expand some special variables in the path, such as %ProgramFiles% and %ProgramFiles(x86)% in Windows. Uses self.target_shell_variables for the substitutions, which should have been filled when the ssh connection to the remote host was made.
Expand some special variables in the path, such as %ProgramFiles% and %ProgramFiles(x86)% in Windows. Uses self.target_shell_variables for the substitutions, which should have been filled when the ssh connection to the remote host was made.
[ "Expand", "some", "special", "variables", "in", "the", "path", "such", "as", "%ProgramFiles%", "and", "%ProgramFiles", "(", "x86", ")", "%", "in", "Windows", ".", "Uses", "self", ".", "target_shell_variables", "for", "the", "substitutions", "which", "should", ...
def expand_path_variables(self, path): """ Expand some special variables in the path, such as %ProgramFiles% and %ProgramFiles(x86)% in Windows. Uses self.target_shell_variables for the substitutions, which should have been filled when the ssh connection to the remote host was made. ...
[ "def", "expand_path_variables", "(", "self", ",", "path", ")", ":", "for", "k", ",", "v", "in", "self", ".", "target_shell_variables", ".", "items", "(", ")", ":", "path", "=", "path", ".", "replace", "(", "k", ",", "v", ")", "return", "path" ]
https://github.com/mysql/mysql-workbench/blob/2f35f9034f015cbcd22139a60e1baa2e3e8e795c/plugins/wb.admin/backend/wb_server_management.py#L636-L644
Slicer/SlicerGitSVNArchive
65e92bb16c2b32ea47a1a66bee71f238891ee1ca
Modules/Scripted/DICOM/DICOM.py
python
DICOMLoadingByDragAndDropEventFilter.dragEnterEvent
(self, event)
Actions to do when a drag enter event occurs in the Main Window. Read up on https://doc.qt.io/qt-5.12/dnd.html#dropping Input: Event (QEvent)
Actions to do when a drag enter event occurs in the Main Window.
[ "Actions", "to", "do", "when", "a", "drag", "enter", "event", "occurs", "in", "the", "Main", "Window", "." ]
def dragEnterEvent(self, event): """ Actions to do when a drag enter event occurs in the Main Window. Read up on https://doc.qt.io/qt-5.12/dnd.html#dropping Input: Event (QEvent) """ self.directoriesToAdd = DICOMFileDialog.foldersFromMimeData(event.mimeData(), acceptFiles=True) if self.dire...
[ "def", "dragEnterEvent", "(", "self", ",", "event", ")", ":", "self", ".", "directoriesToAdd", "=", "DICOMFileDialog", ".", "foldersFromMimeData", "(", "event", ".", "mimeData", "(", ")", ",", "acceptFiles", "=", "True", ")", "if", "self", ".", "directoriesT...
https://github.com/Slicer/SlicerGitSVNArchive/blob/65e92bb16c2b32ea47a1a66bee71f238891ee1ca/Modules/Scripted/DICOM/DICOM.py#L464-L475
crankyoldgit/IRremoteESP8266
6bc095af80e5aec47d66f8c6263f3a943ea3b4d5
tools/scrape_supported_devices.py
python
getdecodedprotocols
()
return ret
All protocols that include decoding support
All protocols that include decoding support
[ "All", "protocols", "that", "include", "decoding", "support" ]
def getdecodedprotocols(): """All protocols that include decoding support""" ret = set() for path in ARGS.directory.iterdir(): if path.suffix != ".cpp": continue matches = DECODED_PROTOCOLS.finditer(path.open(encoding="utf-8").read()) for match in matches: protocol = match.group(1) i...
[ "def", "getdecodedprotocols", "(", ")", ":", "ret", "=", "set", "(", ")", "for", "path", "in", "ARGS", ".", "directory", ".", "iterdir", "(", ")", ":", "if", "path", ".", "suffix", "!=", "\".cpp\"", ":", "continue", "matches", "=", "DECODED_PROTOCOLS", ...
https://github.com/crankyoldgit/IRremoteESP8266/blob/6bc095af80e5aec47d66f8c6263f3a943ea3b4d5/tools/scrape_supported_devices.py#L80-L91
ceph/ceph
959663007321a369c83218414a29bd9dbc8bda3a
src/pybind/mgr/dashboard/services/iscsi_cli.py
python
list_iscsi_gateways
(_)
return 0, json.dumps(IscsiGatewaysConfig.get_gateways_config()), ''
List iSCSI gateways
List iSCSI gateways
[ "List", "iSCSI", "gateways" ]
def list_iscsi_gateways(_): ''' List iSCSI gateways ''' return 0, json.dumps(IscsiGatewaysConfig.get_gateways_config()), ''
[ "def", "list_iscsi_gateways", "(", "_", ")", ":", "return", "0", ",", "json", ".", "dumps", "(", "IscsiGatewaysConfig", ".", "get_gateways_config", "(", ")", ")", ",", "''" ]
https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/dashboard/services/iscsi_cli.py#L17-L21
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/mailcap.py
python
_readmailcapfile
(fp, lineno)
return caps, lineno
Read a mailcap file and return a dictionary keyed by MIME type. Each MIME type is mapped to an entry consisting of a list of dictionaries; the list will contain more than one such dictionary if a given MIME type appears more than once in the mailcap file. Each dictionary contains key-value pairs for th...
Read a mailcap file and return a dictionary keyed by MIME type.
[ "Read", "a", "mailcap", "file", "and", "return", "a", "dictionary", "keyed", "by", "MIME", "type", "." ]
def _readmailcapfile(fp, lineno): """Read a mailcap file and return a dictionary keyed by MIME type. Each MIME type is mapped to an entry consisting of a list of dictionaries; the list will contain more than one such dictionary if a given MIME type appears more than once in the mailcap file. Each d...
[ "def", "_readmailcapfile", "(", "fp", ",", "lineno", ")", ":", "caps", "=", "{", "}", "while", "1", ":", "line", "=", "fp", ".", "readline", "(", ")", "if", "not", "line", ":", "break", "# Ignore comments and blank lines", "if", "line", "[", "0", "]", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/mailcap.py#L71-L110
include-what-you-use/include-what-you-use
208fbfffa5d69364b9f78e427caa443441279283
fix_includes.py
python
_DeleteDuplicateLines
(file_lines, line_ranges)
Goes through all lines in line_ranges, and if any are dups, deletes them. For all lines in line_ranges, if any is the same as a previously seen line, set its deleted bit to True. The purpose of line_ranges is to avoid lines in #ifdefs and namespaces, that may be identical syntactically but have different sema...
Goes through all lines in line_ranges, and if any are dups, deletes them.
[ "Goes", "through", "all", "lines", "in", "line_ranges", "and", "if", "any", "are", "dups", "deletes", "them", "." ]
def _DeleteDuplicateLines(file_lines, line_ranges): """Goes through all lines in line_ranges, and if any are dups, deletes them. For all lines in line_ranges, if any is the same as a previously seen line, set its deleted bit to True. The purpose of line_ranges is to avoid lines in #ifdefs and namespaces, that...
[ "def", "_DeleteDuplicateLines", "(", "file_lines", ",", "line_ranges", ")", ":", "seen_lines", "=", "set", "(", ")", "for", "line_range", "in", "line_ranges", ":", "for", "line_number", "in", "range", "(", "*", "line_range", ")", ":", "line_info", "=", "file...
https://github.com/include-what-you-use/include-what-you-use/blob/208fbfffa5d69364b9f78e427caa443441279283/fix_includes.py#L1135-L1174
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/x86/toolchain/lib/python2.7/logging/__init__.py
python
Handler.__init__
(self, level=NOTSET)
Initializes the instance - basically setting the formatter to None and the filter list to empty.
Initializes the instance - basically setting the formatter to None and the filter list to empty.
[ "Initializes", "the", "instance", "-", "basically", "setting", "the", "formatter", "to", "None", "and", "the", "filter", "list", "to", "empty", "." ]
def __init__(self, level=NOTSET): """ Initializes the instance - basically setting the formatter to None and the filter list to empty. """ Filterer.__init__(self) self._name = None self.level = _checkLevel(level) self.formatter = None # Add the han...
[ "def", "__init__", "(", "self", ",", "level", "=", "NOTSET", ")", ":", "Filterer", ".", "__init__", "(", "self", ")", "self", ".", "_name", "=", "None", "self", ".", "level", "=", "_checkLevel", "(", "level", ")", "self", ".", "formatter", "=", "None...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/logging/__init__.py#L655-L666
BlzFans/wke
b0fa21158312e40c5fbd84682d643022b6c34a93
cygwin/lib/python2.6/decimal.py
python
Context.copy_decimal
(self, a)
return Decimal(a)
Returns a copy of the decimal objet. >>> ExtendedContext.copy_decimal(Decimal('2.1')) Decimal('2.1') >>> ExtendedContext.copy_decimal(Decimal('-1.00')) Decimal('-1.00')
Returns a copy of the decimal objet.
[ "Returns", "a", "copy", "of", "the", "decimal", "objet", "." ]
def copy_decimal(self, a): """Returns a copy of the decimal objet. >>> ExtendedContext.copy_decimal(Decimal('2.1')) Decimal('2.1') >>> ExtendedContext.copy_decimal(Decimal('-1.00')) Decimal('-1.00') """ return Decimal(a)
[ "def", "copy_decimal", "(", "self", ",", "a", ")", ":", "return", "Decimal", "(", "a", ")" ]
https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/decimal.py#L3925-L3933
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/requests/utils.py
python
guess_json_utf
(data)
return None
:rtype: str
:rtype: str
[ ":", "rtype", ":", "str" ]
def guess_json_utf(data): """ :rtype: str """ # JSON always starts with two ASCII characters, so detection is as # easy as counting the nulls and from their location and count # determine the encoding. Also detect a BOM, if present. sample = data[:4] if sample in (codecs.BOM_UTF32_LE, co...
[ "def", "guess_json_utf", "(", "data", ")", ":", "# JSON always starts with two ASCII characters, so detection is as", "# easy as counting the nulls and from their location and count", "# determine the encoding. Also detect a BOM, if present.", "sample", "=", "data", "[", ":", "4", "]",...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/requests/utils.py#L862-L891
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/grid.py
python
GridCellEditor.Reset
(*args, **kwargs)
return _grid.GridCellEditor_Reset(*args, **kwargs)
Reset(self)
Reset(self)
[ "Reset", "(", "self", ")" ]
def Reset(*args, **kwargs): """Reset(self)""" return _grid.GridCellEditor_Reset(*args, **kwargs)
[ "def", "Reset", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_grid", ".", "GridCellEditor_Reset", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/grid.py#L300-L302
KratosMultiphysics/Kratos
0000833054ed0503424eb28205d6508d9ca6cbbc
applications/MultilevelMonteCarloApplication/external_libraries/XMC/xmc/monteCarloSampler.py
python
MonteCarloSampler.asynchronousUpdate
(self, newHierarchy)
Method called to initialize all new batches to launch, and to launch them.
Method called to initialize all new batches to launch, and to launch them.
[ "Method", "called", "to", "initialize", "all", "new", "batches", "to", "launch", "and", "to", "launch", "them", "." ]
def asynchronousUpdate(self, newHierarchy): """ Method called to initialize all new batches to launch, and to launch them. """ self.asynchronousInitialize(newHierarchy) self.asynchronousLaunchEpoch(newHierarchy)
[ "def", "asynchronousUpdate", "(", "self", ",", "newHierarchy", ")", ":", "self", ".", "asynchronousInitialize", "(", "newHierarchy", ")", "self", ".", "asynchronousLaunchEpoch", "(", "newHierarchy", ")" ]
https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/MultilevelMonteCarloApplication/external_libraries/XMC/xmc/monteCarloSampler.py#L533-L539
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/integrate/python/ops/odes.py
python
_interp_evaluate
(coefficients, t0, t1, t)
Evaluate polynomial interpolation at the given time point. Args: coefficients: list of Tensor coefficients as created by `interp_fit`. t0: scalar float64 Tensor giving the start of the interval. t1: scalar float64 Tensor giving the end of the interval. t: scalar float64 Tensor giving the desired inte...
Evaluate polynomial interpolation at the given time point.
[ "Evaluate", "polynomial", "interpolation", "at", "the", "given", "time", "point", "." ]
def _interp_evaluate(coefficients, t0, t1, t): """Evaluate polynomial interpolation at the given time point. Args: coefficients: list of Tensor coefficients as created by `interp_fit`. t0: scalar float64 Tensor giving the start of the interval. t1: scalar float64 Tensor giving the end of the interval. ...
[ "def", "_interp_evaluate", "(", "coefficients", ",", "t0", ",", "t1", ",", "t", ")", ":", "with", "ops", ".", "name_scope", "(", "'interp_evaluate'", ")", ":", "t0", "=", "ops", ".", "convert_to_tensor", "(", "t0", ")", "t1", "=", "ops", ".", "convert_...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/integrate/python/ops/odes.py#L184-L213
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/asyncio/streams.py
python
StreamReader._wakeup_waiter
(self)
Wakeup read*() functions waiting for data or EOF.
Wakeup read*() functions waiting for data or EOF.
[ "Wakeup", "read", "*", "()", "functions", "waiting", "for", "data", "or", "EOF", "." ]
def _wakeup_waiter(self): """Wakeup read*() functions waiting for data or EOF.""" waiter = self._waiter if waiter is not None: self._waiter = None if not waiter.cancelled(): waiter.set_result(None)
[ "def", "_wakeup_waiter", "(", "self", ")", ":", "waiter", "=", "self", ".", "_waiter", "if", "waiter", "is", "not", "None", ":", "self", ".", "_waiter", "=", "None", "if", "not", "waiter", ".", "cancelled", "(", ")", ":", "waiter", ".", "set_result", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/asyncio/streams.py#L402-L408
google/sandboxed-api
7004d59150c9fbfaa3e5fd1872affffd1ab14fe8
sandboxed_api/tools/generator2/code.py
python
Type._get_related_types_of_function
(self, result)
return result
Returns all types related to the function.
Returns all types related to the function.
[ "Returns", "all", "types", "related", "to", "the", "function", "." ]
def _get_related_types_of_function(self, result): # type: (Set[Type]) -> Set[Type] """Returns all types related to the function.""" for arg in self._clang_type.argument_types(): result.update(Type(self._tu, arg).get_related_types(result)) related = Type(self._tu, self._clang_typ...
[ "def", "_get_related_types_of_function", "(", "self", ",", "result", ")", ":", "# type: (Set[Type]) -> Set[Type]", "for", "arg", "in", "self", ".", "_clang_type", ".", "argument_types", "(", ")", ":", "result", ".", "update", "(", "Type", "(", "self", ".", "_t...
https://github.com/google/sandboxed-api/blob/7004d59150c9fbfaa3e5fd1872affffd1ab14fe8/sandboxed_api/tools/generator2/code.py#L307-L316