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
koth/kcws
88efbd36a7022de4e6e90f5a1fb880cf87cfae9f
third_party/python/cpplint/cpplint.py
python
CheckDefaultLambdaCaptures
(filename, clean_lines, linenum, error)
Check that default lambda captures are not used. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. error: The function to call with any errors found.
Check that default lambda captures are not used.
[ "Check", "that", "default", "lambda", "captures", "are", "not", "used", "." ]
def CheckDefaultLambdaCaptures(filename, clean_lines, linenum, error): """Check that default lambda captures are not used. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. error: The function to call w...
[ "def", "CheckDefaultLambdaCaptures", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "error", ")", ":", "line", "=", "clean_lines", ".", "elided", "[", "linenum", "]", "# A lambda introducer specifies a default capture if it starts with \"[=\"", "# or if it starts...
https://github.com/koth/kcws/blob/88efbd36a7022de4e6e90f5a1fb880cf87cfae9f/third_party/python/cpplint/cpplint.py#L5723-L5745
leela-zero/leela-zero
e3ed6310d33d75078ba74c3adf887d18439fc2e3
training/tf/mixprec.py
python
float32_variable_storage_getter
(getter, name, shape=None, dtype=None, initializer=None, regularizer=None, trainable=True, *args, **kwargs)
return variable
Custom variable getter that forces trainable variables to be stored in float32 precision and then casts them to the training precision.
Custom variable getter that forces trainable variables to be stored in float32 precision and then casts them to the training precision.
[ "Custom", "variable", "getter", "that", "forces", "trainable", "variables", "to", "be", "stored", "in", "float32", "precision", "and", "then", "casts", "them", "to", "the", "training", "precision", "." ]
def float32_variable_storage_getter(getter, name, shape=None, dtype=None, initializer=None, regularizer=None, trainable=True, *args, **kwargs): """Custom variable getter that forces trainable variables to be ...
[ "def", "float32_variable_storage_getter", "(", "getter", ",", "name", ",", "shape", "=", "None", ",", "dtype", "=", "None", ",", "initializer", "=", "None", ",", "regularizer", "=", "None", ",", "trainable", "=", "True", ",", "*", "args", ",", "*", "*", ...
https://github.com/leela-zero/leela-zero/blob/e3ed6310d33d75078ba74c3adf887d18439fc2e3/training/tf/mixprec.py#L4-L25
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/idlelib/iomenu.py
python
IOBinding.updaterecentfileslist
(self,filename)
Update recent file list on all editor windows
Update recent file list on all editor windows
[ "Update", "recent", "file", "list", "on", "all", "editor", "windows" ]
def updaterecentfileslist(self,filename): "Update recent file list on all editor windows" if self.editwin.flist: self.editwin.update_recent_files_list(filename)
[ "def", "updaterecentfileslist", "(", "self", ",", "filename", ")", ":", "if", "self", ".", "editwin", ".", "flist", ":", "self", ".", "editwin", ".", "update_recent_files_list", "(", "filename", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/iomenu.py#L527-L530
wyrover/book-code
7f4883d9030d553bc6bcfa3da685e34789839900
3rdparty/protobuf/python/google/protobuf/descriptor_pool.py
python
DescriptorPool._MakeEnumValueDescriptor
(self, value_proto, index)
return descriptor.EnumValueDescriptor( name=value_proto.name, index=index, number=value_proto.number, options=value_proto.options, type=None)
Creates a enum value descriptor object from a enum value proto. Args: value_proto: The proto describing the enum value. index: The index of the enum value. Returns: An initialized EnumValueDescriptor object.
Creates a enum value descriptor object from a enum value proto.
[ "Creates", "a", "enum", "value", "descriptor", "object", "from", "a", "enum", "value", "proto", "." ]
def _MakeEnumValueDescriptor(self, value_proto, index): """Creates a enum value descriptor object from a enum value proto. Args: value_proto: The proto describing the enum value. index: The index of the enum value. Returns: An initialized EnumValueDescriptor object. """ return d...
[ "def", "_MakeEnumValueDescriptor", "(", "self", ",", "value_proto", ",", "index", ")", ":", "return", "descriptor", ".", "EnumValueDescriptor", "(", "name", "=", "value_proto", ".", "name", ",", "index", "=", "index", ",", "number", "=", "value_proto", ".", ...
https://github.com/wyrover/book-code/blob/7f4883d9030d553bc6bcfa3da685e34789839900/3rdparty/protobuf/python/google/protobuf/descriptor_pool.py#L669-L685
FreeCAD/FreeCAD
ba42231b9c6889b89e064d6d563448ed81e376ec
src/Mod/Arch/ArchStructure.py
python
_StructuralSystem.execute
(self,obj)
creates the structure shape
creates the structure shape
[ "creates", "the", "structure", "shape" ]
def execute(self,obj): "creates the structure shape" import Part, DraftGeomUtils # creating base shape pl = obj.Placement if obj.Base: if hasattr(obj.Base,'Shape'): if obj.Base.Shape.isNull(): return if not obj.Bas...
[ "def", "execute", "(", "self", ",", "obj", ")", ":", "import", "Part", ",", "DraftGeomUtils", "# creating base shape", "pl", "=", "obj", ".", "Placement", "if", "obj", ".", "Base", ":", "if", "hasattr", "(", "obj", ".", "Base", ",", "'Shape'", ")", ":"...
https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Arch/ArchStructure.py#L1361-L1414
FreeCAD/FreeCAD
ba42231b9c6889b89e064d6d563448ed81e376ec
src/Mod/Draft/draftobjects/label.py
python
Label.set_properties
(self, obj)
Set properties only if they don't exist.
Set properties only if they don't exist.
[ "Set", "properties", "only", "if", "they", "don", "t", "exist", "." ]
def set_properties(self, obj): """Set properties only if they don't exist.""" self.set_target_properties(obj) self.set_leader_properties(obj) self.set_label_properties(obj)
[ "def", "set_properties", "(", "self", ",", "obj", ")", ":", "self", ".", "set_target_properties", "(", "obj", ")", "self", ".", "set_leader_properties", "(", "obj", ")", "self", ".", "set_label_properties", "(", "obj", ")" ]
https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftobjects/label.py#L49-L53
daijifeng001/caffe-rfcn
543f8f6a4b7c88256ea1445ae951a12d1ad9cffd
scripts/cpp_lint.py
python
CheckVlogArguments
(filename, clean_lines, linenum, error)
Checks that VLOG() is only used for defining a logging level. For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and VLOG(FATAL) are not. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to ...
Checks that VLOG() is only used for defining a logging level.
[ "Checks", "that", "VLOG", "()", "is", "only", "used", "for", "defining", "a", "logging", "level", "." ]
def CheckVlogArguments(filename, clean_lines, linenum, error): """Checks that VLOG() is only used for defining a logging level. For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and VLOG(FATAL) are not. Args: filename: The name of the current file. clean_lines: A CleansedLines i...
[ "def", "CheckVlogArguments", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "error", ")", ":", "line", "=", "clean_lines", ".", "elided", "[", "linenum", "]", "if", "Search", "(", "r'\\bVLOG\\((INFO|ERROR|WARNING|DFATAL|FATAL)\\)'", ",", "line", ")", ...
https://github.com/daijifeng001/caffe-rfcn/blob/543f8f6a4b7c88256ea1445ae951a12d1ad9cffd/scripts/cpp_lint.py#L1708-L1724
klzgrad/naiveproxy
ed2c513637c77b18721fe428d7ed395b4d284c83
src/build/android/pylib/utils/dexdump.py
python
_ParseClassNode
(class_node)
return {'methods': methods, 'superclass': class_node.attrib['extends']}
Parses a <class> node from the dexdump xml output. Returns: A dict in the format: { 'methods': [<method_1>, <method_2>] }
Parses a <class> node from the dexdump xml output.
[ "Parses", "a", "<class", ">", "node", "from", "the", "dexdump", "xml", "output", "." ]
def _ParseClassNode(class_node): """Parses a <class> node from the dexdump xml output. Returns: A dict in the format: { 'methods': [<method_1>, <method_2>] } """ methods = [] for child in class_node: if child.tag == 'method': methods.append(child.attrib['name']) return {'m...
[ "def", "_ParseClassNode", "(", "class_node", ")", ":", "methods", "=", "[", "]", "for", "child", "in", "class_node", ":", "if", "child", ".", "tag", "==", "'method'", ":", "methods", ".", "append", "(", "child", ".", "attrib", "[", "'name'", "]", ")", ...
https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/android/pylib/utils/dexdump.py#L123-L136
PlatformLab/RAMCloud
b1866af19124325a6dfd8cbc267e2e3ef1f965d1
cpplint.py
python
_CppLintState.SetCountingStyle
(self, counting_style)
Sets the module's counting options.
Sets the module's counting options.
[ "Sets", "the", "module", "s", "counting", "options", "." ]
def SetCountingStyle(self, counting_style): """Sets the module's counting options.""" self.counting = counting_style
[ "def", "SetCountingStyle", "(", "self", ",", "counting_style", ")", ":", "self", ".", "counting", "=", "counting_style" ]
https://github.com/PlatformLab/RAMCloud/blob/b1866af19124325a6dfd8cbc267e2e3ef1f965d1/cpplint.py#L468-L470
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/typing/ctypes_utils.py
python
get_pointer
(ctypes_func)
return ctypes.cast(ctypes_func, ctypes.c_void_p).value
Get a pointer to the underlying function for a ctypes function as an integer.
Get a pointer to the underlying function for a ctypes function as an integer.
[ "Get", "a", "pointer", "to", "the", "underlying", "function", "for", "a", "ctypes", "function", "as", "an", "integer", "." ]
def get_pointer(ctypes_func): """ Get a pointer to the underlying function for a ctypes function as an integer. """ return ctypes.cast(ctypes_func, ctypes.c_void_p).value
[ "def", "get_pointer", "(", "ctypes_func", ")", ":", "return", "ctypes", ".", "cast", "(", "ctypes_func", ",", "ctypes", ".", "c_void_p", ")", ".", "value" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/typing/ctypes_utils.py#L97-L102
adobe/chromium
cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7
gpu/command_buffer/build_gles2_cmd_buffer.py
python
BucketPointerArgument.WriteValidationCode
(self, file, func)
Overridden from Argument.
Overridden from Argument.
[ "Overridden", "from", "Argument", "." ]
def WriteValidationCode(self, file, func): """Overridden from Argument.""" pass
[ "def", "WriteValidationCode", "(", "self", ",", "file", ",", "func", ")", ":", "pass" ]
https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/gpu/command_buffer/build_gles2_cmd_buffer.py#L4897-L4899
infinit/elle
a8154593c42743f45b9df09daf62b44630c24a02
drake/src/drake/__init__.py
python
Rule.__lshift__
(self, nodes)
Add a node to build when the rule is built. >>> rule = Rule('name') >>> created = drake.touch('/tmp/.drake.rule.add') >>> created.path().remove() >>> rule << created >>> rule.build() Touch /tmp/.drake.rule.add
Add a node to build when the rule is built.
[ "Add", "a", "node", "to", "build", "when", "the", "rule", "is", "built", "." ]
def __lshift__(self, nodes): '''Add a node to build when the rule is built. >>> rule = Rule('name') >>> created = drake.touch('/tmp/.drake.rule.add') >>> created.path().remove() >>> rule << created >>> rule.build() Touch /tmp/.drake.rule.add ''' if isinstance(nodes, (list, types.Gen...
[ "def", "__lshift__", "(", "self", ",", "nodes", ")", ":", "if", "isinstance", "(", "nodes", ",", "(", "list", ",", "types", ".", "GeneratorType", ")", ")", ":", "for", "node", "in", "nodes", ":", "self", "<<", "node", "else", ":", "self", ".", "dep...
https://github.com/infinit/elle/blob/a8154593c42743f45b9df09daf62b44630c24a02/drake/src/drake/__init__.py#L3546-L3560
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/_core.py
python
Window.SetScrollbar
(*args, **kwargs)
return _core_.Window_SetScrollbar(*args, **kwargs)
SetScrollbar(self, int orientation, int position, int thumbSize, int range, bool refresh=True) Sets the scrollbar properties of a built-in scrollbar.
SetScrollbar(self, int orientation, int position, int thumbSize, int range, bool refresh=True)
[ "SetScrollbar", "(", "self", "int", "orientation", "int", "position", "int", "thumbSize", "int", "range", "bool", "refresh", "=", "True", ")" ]
def SetScrollbar(*args, **kwargs): """ SetScrollbar(self, int orientation, int position, int thumbSize, int range, bool refresh=True) Sets the scrollbar properties of a built-in scrollbar. """ return _core_.Window_SetScrollbar(*args, **kwargs)
[ "def", "SetScrollbar", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "Window_SetScrollbar", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L11219-L11226
chanyn/3Dpose_ssl
585696676279683a279b1ecca136c0e0d02aef2a
caffe-3dssl/scripts/cpp_lint.py
python
CheckLanguage
(filename, clean_lines, linenum, file_extension, include_state, nesting_state, error)
Checks rules from the 'C++ language rules' section of cppguide.html. Some of these rules are hard to test (function overloading, using uint32 inappropriately), but we do the best we can. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum:...
Checks rules from the 'C++ language rules' section of cppguide.html.
[ "Checks", "rules", "from", "the", "C", "++", "language", "rules", "section", "of", "cppguide", ".", "html", "." ]
def CheckLanguage(filename, clean_lines, linenum, file_extension, include_state, nesting_state, error): """Checks rules from the 'C++ language rules' section of cppguide.html. Some of these rules are hard to test (function overloading, using uint32 inappropriately), but we do the best we can. ...
[ "def", "CheckLanguage", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "file_extension", ",", "include_state", ",", "nesting_state", ",", "error", ")", ":", "# If the line is empty or consists of entirely a comment, no need to", "# check it.", "line", "=", "cle...
https://github.com/chanyn/3Dpose_ssl/blob/585696676279683a279b1ecca136c0e0d02aef2a/caffe-3dssl/scripts/cpp_lint.py#L3834-L4132
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py
python
CallWrapper.__call__
(self, *args)
Apply first function SUBST to arguments, than FUNC.
Apply first function SUBST to arguments, than FUNC.
[ "Apply", "first", "function", "SUBST", "to", "arguments", "than", "FUNC", "." ]
def __call__(self, *args): """Apply first function SUBST to arguments, than FUNC.""" try: if self.subst: args = self.subst(*args) return self.func(*args) except SystemExit, msg: raise SystemExit, msg except: self.widget._rep...
[ "def", "__call__", "(", "self", ",", "*", "args", ")", ":", "try", ":", "if", "self", ".", "subst", ":", "args", "=", "self", ".", "subst", "(", "*", "args", ")", "return", "self", ".", "func", "(", "*", "args", ")", "except", "SystemExit", ",", ...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py#L1465-L1474
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/python/framework/registry.py
python
Registry.list
(self)
return self._registry.keys()
Lists registered items. Returns: A list of names of registered objects.
Lists registered items.
[ "Lists", "registered", "items", "." ]
def list(self): """Lists registered items. Returns: A list of names of registered objects. """ return self._registry.keys()
[ "def", "list", "(", "self", ")", ":", "return", "self", ".", "_registry", ".", "keys", "(", ")" ]
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/framework/registry.py#L70-L76
netket/netket
0d534e54ecbf25b677ea72af6b85947979420652
netket/nn/utils.py
python
_to_array_rank
(apply_fun, variables, σ_rank, n_states, normalize, allgather):
return psi
Computes apply_fun(variables, σ_rank) and gathers all results across all ranks. The input σ_rank should be a slice of all states in the hilbert space of equal length across all ranks because mpi4jax does not support allgatherv (yet). Args: n_states: total number of elements in the hilbert space.
Computes apply_fun(variables, σ_rank) and gathers all results across all ranks. The input σ_rank should be a slice of all states in the hilbert space of equal length across all ranks because mpi4jax does not support allgatherv (yet).
[ "Computes", "apply_fun", "(", "variables", "σ_rank", ")", "and", "gathers", "all", "results", "across", "all", "ranks", ".", "The", "input", "σ_rank", "should", "be", "a", "slice", "of", "all", "states", "in", "the", "hilbert", "space", "of", "equal", "len...
def _to_array_rank(apply_fun, variables, σ_rank, n_states, normalize, allgather): """ Computes apply_fun(variables, σ_rank) and gathers all results across all ranks. The input σ_rank should be a slice of all states in the hilbert space of equal length across all ranks because mpi4jax does not support al...
[ "def", "_to_array_rank", "(", "apply_fun", ",", "variables", ",", "σ_rank,", " ", "_states,", " ", "ormalize,", " ", "llgather)", ":", "", "# number of 'fake' states, in the last rank.", "n_fake_states", "=", "σ_rank.", "s", "hape[", "0", "]", " ", " ", "pi.", "...
https://github.com/netket/netket/blob/0d534e54ecbf25b677ea72af6b85947979420652/netket/nn/utils.py#L65-L105
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/ops/array_grad.py
python
_CheckNumericsGrad
(op, grad)
return array_ops.check_numerics( grad, "Not a number (NaN) or infinity (Inf) values detected in gradient. %s" % op.get_attr("message"))
Gradient for check_numerics op.
Gradient for check_numerics op.
[ "Gradient", "for", "check_numerics", "op", "." ]
def _CheckNumericsGrad(op, grad): """Gradient for check_numerics op.""" return array_ops.check_numerics( grad, "Not a number (NaN) or infinity (Inf) values detected in gradient. %s" % op.get_attr("message"))
[ "def", "_CheckNumericsGrad", "(", "op", ",", "grad", ")", ":", "return", "array_ops", ".", "check_numerics", "(", "grad", ",", "\"Not a number (NaN) or infinity (Inf) values detected in gradient. %s\"", "%", "op", ".", "get_attr", "(", "\"message\"", ")", ")" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/array_grad.py#L746-L751
mhammond/pywin32
44afd86ba8485194df93234639243252deeb40d5
com/win32comext/authorization/demos/EditSecurity.py
python
SecurityInformation.MapGeneric
(self, guid, aceflags, mask)
return win32security.MapGenericMask( mask, ( FILE_GENERIC_READ, FILE_GENERIC_WRITE, FILE_GENERIC_EXECUTE, FILE_ALL_ACCESS, ), )
Converts generic access rights to specific rights. This implementation uses standard file system rights, but you can map them any way that suits your application.
Converts generic access rights to specific rights. This implementation uses standard file system rights, but you can map them any way that suits your application.
[ "Converts", "generic", "access", "rights", "to", "specific", "rights", ".", "This", "implementation", "uses", "standard", "file", "system", "rights", "but", "you", "can", "map", "them", "any", "way", "that", "suits", "your", "application", "." ]
def MapGeneric(self, guid, aceflags, mask): """Converts generic access rights to specific rights. This implementation uses standard file system rights, but you can map them any way that suits your application. """ return win32security.MapGenericMask( mask, ( ...
[ "def", "MapGeneric", "(", "self", ",", "guid", ",", "aceflags", ",", "mask", ")", ":", "return", "win32security", ".", "MapGenericMask", "(", "mask", ",", "(", "FILE_GENERIC_READ", ",", "FILE_GENERIC_WRITE", ",", "FILE_GENERIC_EXECUTE", ",", "FILE_ALL_ACCESS", "...
https://github.com/mhammond/pywin32/blob/44afd86ba8485194df93234639243252deeb40d5/com/win32comext/authorization/demos/EditSecurity.py#L195-L207
apache/impala
8ddac48f3428c86f2cbd037ced89cfb903298b12
bin/diagnostics/experimental/plan-graph.py
python
DotParser.parse_exec_summ
(self, line)
Parse execution summary section. This section begins with 'ExecSummary:' line in query profile.
Parse execution summary section. This section begins with 'ExecSummary:' line in query profile.
[ "Parse", "execution", "summary", "section", ".", "This", "section", "begins", "with", "ExecSummary", ":", "line", "in", "query", "profile", "." ]
def parse_exec_summ(self, line): """Parse execution summary section. This section begins with 'ExecSummary:' line in query profile.""" self.exec_summ_ct += 1 if self.exec_summ_ct <= 2: return parts = list( map(lambda x: x.strip(), filter(None, line.strip().replac...
[ "def", "parse_exec_summ", "(", "self", ",", "line", ")", ":", "self", ".", "exec_summ_ct", "+=", "1", "if", "self", ".", "exec_summ_ct", "<=", "2", ":", "return", "parts", "=", "list", "(", "map", "(", "lambda", "x", ":", "x", ".", "strip", "(", ")...
https://github.com/apache/impala/blob/8ddac48f3428c86f2cbd037ced89cfb903298b12/bin/diagnostics/experimental/plan-graph.py#L510-L538
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/train/train_thor/model_thor.py
python
ModelThor._train_gpu_sink_step
(self, cb_params, inputs, list_callback, iter_first_order, run_context)
train gpu sink step
train gpu sink step
[ "train", "gpu", "sink", "step" ]
def _train_gpu_sink_step(self, cb_params, inputs, list_callback, iter_first_order, run_context): """train gpu sink step""" if self.switch_branch_one: cb_params.cur_step_num += 1 if self.train_network_init_flag: self._train_network.add_flags_recursive(thor=True) ...
[ "def", "_train_gpu_sink_step", "(", "self", ",", "cb_params", ",", "inputs", ",", "list_callback", ",", "iter_first_order", ",", "run_context", ")", ":", "if", "self", ".", "switch_branch_one", ":", "cb_params", ".", "cur_step_num", "+=", "1", "if", "self", "....
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/train/train_thor/model_thor.py#L144-L167
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/build/waf-1.7.13/lmbrwaflib/lumberyard.py
python
update_target_uid_map
(ctx)
Update the cached target uid map
Update the cached target uid map
[ "Update", "the", "cached", "target", "uid", "map" ]
def update_target_uid_map(ctx): """ Update the cached target uid map """ global UID_MAP_TO_TARGET target_uid_cache_file = ctx.bldnode.make_node('target_uid.json') uid_map_to_target_json = json.dumps(UID_MAP_TO_TARGET, indent=1, sort_keys=True) target_uid_cache_file.write(uid_map_to_target_js...
[ "def", "update_target_uid_map", "(", "ctx", ")", ":", "global", "UID_MAP_TO_TARGET", "target_uid_cache_file", "=", "ctx", ".", "bldnode", ".", "make_node", "(", "'target_uid.json'", ")", "uid_map_to_target_json", "=", "json", ".", "dumps", "(", "UID_MAP_TO_TARGET", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/lmbrwaflib/lumberyard.py#L1035-L1042
oracle/graaljs
36a56e8e993d45fc40939a3a4d9c0c24990720f1
graal-nodejs/tools/gyp/pylib/gyp/generator/msvs.py
python
_GetMSBuildPropertyGroup
(spec, label, properties)
return [group]
Returns a PropertyGroup definition for the specified properties. Arguments: spec: The target project dict. label: An optional label for the PropertyGroup. properties: The dictionary to be converted. The key is the name of the property. The value is itself a dictionary; its key is the value and ...
Returns a PropertyGroup definition for the specified properties.
[ "Returns", "a", "PropertyGroup", "definition", "for", "the", "specified", "properties", "." ]
def _GetMSBuildPropertyGroup(spec, label, properties): """Returns a PropertyGroup definition for the specified properties. Arguments: spec: The target project dict. label: An optional label for the PropertyGroup. properties: The dictionary to be converted. The key is the name of the property...
[ "def", "_GetMSBuildPropertyGroup", "(", "spec", ",", "label", ",", "properties", ")", ":", "group", "=", "[", "\"PropertyGroup\"", "]", "if", "label", ":", "group", ".", "append", "(", "{", "\"Label\"", ":", "label", "}", ")", "num_configurations", "=", "l...
https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/generator/msvs.py#L3259-L3312
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/telemetry/third_party/pyfakefs/pyfakefs/fake_filesystem.py
python
FakeFile.SetContents
(self, contents)
Sets the file contents and size. Args: contents: string, new content of file.
Sets the file contents and size.
[ "Sets", "the", "file", "contents", "and", "size", "." ]
def SetContents(self, contents): """Sets the file contents and size. Args: contents: string, new content of file. """ # convert a byte array to a string if sys.version_info >= (3, 0) and isinstance(contents, bytes): contents = ''.join(chr(i) for i in contents) self.contents = conten...
[ "def", "SetContents", "(", "self", ",", "contents", ")", ":", "# convert a byte array to a string", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "0", ")", "and", "isinstance", "(", "contents", ",", "bytes", ")", ":", "contents", "=", "''", ".", ...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/pyfakefs/pyfakefs/fake_filesystem.py#L221-L232
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/saved_model/save.py
python
_SaveableView._add_function_to_graph
(self, function)
Adds a function to serialize to the object graph. If `function` is a concrete function, it will be added to the list of concrete functions tracked by `_SaveableView`. If the function is a tf.function, any underlying concrete functions will be added to the list of concrete functions for later serializat...
Adds a function to serialize to the object graph.
[ "Adds", "a", "function", "to", "serialize", "to", "the", "object", "graph", "." ]
def _add_function_to_graph(self, function): """Adds a function to serialize to the object graph. If `function` is a concrete function, it will be added to the list of concrete functions tracked by `_SaveableView`. If the function is a tf.function, any underlying concrete functions will be added to the ...
[ "def", "_add_function_to_graph", "(", "self", ",", "function", ")", ":", "# Add the function to the graph", "if", "function", "not", "in", "self", ".", "node_ids", ":", "self", ".", "node_ids", "[", "function", "]", "=", "len", "(", "self", ".", "nodes", ")"...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/saved_model/save.py#L286-L319
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/aui.py
python
AuiManager.GetFlags
(*args, **kwargs)
return _aui.AuiManager_GetFlags(*args, **kwargs)
GetFlags(self) -> int
GetFlags(self) -> int
[ "GetFlags", "(", "self", ")", "-", ">", "int" ]
def GetFlags(*args, **kwargs): """GetFlags(self) -> int""" return _aui.AuiManager_GetFlags(*args, **kwargs)
[ "def", "GetFlags", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_aui", ".", "AuiManager_GetFlags", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/aui.py#L602-L604
dmlc/decord
96b750c7221322391969929e855b942d2fdcd06b
python/decord/av_reader.py
python
AVReader.get_batch
(self, indices)
return (audio_arr, self.__video_reader.get_batch(indices))
Get entire batch of audio samples and video frames. Parameters ---------- indices : list of integers A list of frame indices. If negative indices detected, the indices will be indexed from backward Returns ------- (list of ndarray, ndarray) First ...
Get entire batch of audio samples and video frames.
[ "Get", "entire", "batch", "of", "audio", "samples", "and", "video", "frames", "." ]
def get_batch(self, indices): """Get entire batch of audio samples and video frames. Parameters ---------- indices : list of integers A list of frame indices. If negative indices detected, the indices will be indexed from backward Returns ------- (lis...
[ "def", "get_batch", "(", "self", ",", "indices", ")", ":", "assert", "self", ".", "__video_reader", "is", "not", "None", "and", "self", ".", "__audio_reader", "is", "not", "None", "indices", "=", "self", ".", "_validate_indices", "(", "indices", ")", "audi...
https://github.com/dmlc/decord/blob/96b750c7221322391969929e855b942d2fdcd06b/python/decord/av_reader.py#L92-L127
kamyu104/LeetCode-Solutions
77605708a927ea3b85aee5a479db733938c7c211
Python/best-time-to-buy-and-sell-stock-iv.py
python
Solution.maxProfit
(self, k, prices)
return sum(profits[i] for i in xrange(k))
:type k: int :type prices: List[int] :rtype: int
:type k: int :type prices: List[int] :rtype: int
[ ":", "type", "k", ":", "int", ":", "type", "prices", ":", "List", "[", "int", "]", ":", "rtype", ":", "int" ]
def maxProfit(self, k, prices): """ :type k: int :type prices: List[int] :rtype: int """ def nth_element(nums, n, compare=lambda a, b: a < b): def tri_partition(nums, left, right, target, compare): mid = left while mid <= right:...
[ "def", "maxProfit", "(", "self", ",", "k", ",", "prices", ")", ":", "def", "nth_element", "(", "nums", ",", "n", ",", "compare", "=", "lambda", "a", ",", "b", ":", "a", "<", "b", ")", ":", "def", "tri_partition", "(", "nums", ",", "left", ",", ...
https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/best-time-to-buy-and-sell-stock-iv.py#L8-L71
synfig/synfig
a5ec91db5b751dc12e4400ccfb5c063fd6d2d928
synfig-studio/plugins/lottie-exporter/properties/offsetKeyframe.py
python
calc_tangent
(animated, lottie, i)
return out_val, in_val
Calculates the tangent, given two waypoints and there interpolation methods Args: animated (lxml.etree._Element) : Synfig format animation lottie (dict) : Lottie format animation stored here i (int) : Iterator for animation Returns: (comm...
Calculates the tangent, given two waypoints and there interpolation methods
[ "Calculates", "the", "tangent", "given", "two", "waypoints", "and", "there", "interpolation", "methods" ]
def calc_tangent(animated, lottie, i): """ Calculates the tangent, given two waypoints and there interpolation methods Args: animated (lxml.etree._Element) : Synfig format animation lottie (dict) : Lottie format animation stored here i (int) :...
[ "def", "calc_tangent", "(", "animated", ",", "lottie", ",", "i", ")", ":", "waypoint", ",", "next_waypoint", "=", "animated", "[", "i", "]", ",", "animated", "[", "i", "+", "1", "]", "cur_get_after", ",", "next_get_before", "=", "waypoint", ".", "attrib"...
https://github.com/synfig/synfig/blob/a5ec91db5b751dc12e4400ccfb5c063fd6d2d928/synfig-studio/plugins/lottie-exporter/properties/offsetKeyframe.py#L151-L311
google/clif
cab24d6a105609a65c95a36a1712ae3c20c7b5df
clif/pybind11/function_lib.py
python
generate_function_suffixes
(func_decl: ast_pb2.FuncDecl)
return suffix
Generates py_args, docstrings and return value policys.
Generates py_args, docstrings and return value policys.
[ "Generates", "py_args", "docstrings", "and", "return", "value", "policys", "." ]
def generate_function_suffixes(func_decl: ast_pb2.FuncDecl) -> str: """Generates py_args, docstrings and return value policys.""" py_args = generate_py_args(func_decl) suffix = '' if py_args: suffix += f'{py_args}, ' suffix += f'{generate_return_value_policy(func_decl)}' if func_decl.docstring: suff...
[ "def", "generate_function_suffixes", "(", "func_decl", ":", "ast_pb2", ".", "FuncDecl", ")", "->", "str", ":", "py_args", "=", "generate_py_args", "(", "func_decl", ")", "suffix", "=", "''", "if", "py_args", ":", "suffix", "+=", "f'{py_args}, '", "suffix", "+=...
https://github.com/google/clif/blob/cab24d6a105609a65c95a36a1712ae3c20c7b5df/clif/pybind11/function_lib.py#L70-L80
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pexpect/pexpect/spawnbase.py
python
SpawnBase.read
(self, size=-1)
return self.before
This reads at most "size" bytes from the file (less if the read hits EOF before obtaining size bytes). If the size argument is negative or omitted, read all data until EOF is reached. The bytes are returned as a string object. An empty string is returned when EOF is encountered immediate...
This reads at most "size" bytes from the file (less if the read hits EOF before obtaining size bytes). If the size argument is negative or omitted, read all data until EOF is reached. The bytes are returned as a string object. An empty string is returned when EOF is encountered immediate...
[ "This", "reads", "at", "most", "size", "bytes", "from", "the", "file", "(", "less", "if", "the", "read", "hits", "EOF", "before", "obtaining", "size", "bytes", ")", ".", "If", "the", "size", "argument", "is", "negative", "or", "omitted", "read", "all", ...
def read(self, size=-1): '''This reads at most "size" bytes from the file (less if the read hits EOF before obtaining size bytes). If the size argument is negative or omitted, read all data until EOF is reached. The bytes are returned as a string object. An empty string is returned when ...
[ "def", "read", "(", "self", ",", "size", "=", "-", "1", ")", ":", "if", "size", "==", "0", ":", "return", "self", ".", "string_type", "(", ")", "if", "size", "<", "0", ":", "# delimiter default is EOF", "self", ".", "expect", "(", "self", ".", "del...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pexpect/pexpect/spawnbase.py#L433-L460
llvm/llvm-project
ffa6262cb4e2a335d26416fad39a581b4f98c5f4
clang/utils/creduce-clang-crash.py
python
Reduce.simplify_clang_args
(self)
Simplify clang arguments before running C-Reduce to reduce the time the interestingness test takes to run.
Simplify clang arguments before running C-Reduce to reduce the time the interestingness test takes to run.
[ "Simplify", "clang", "arguments", "before", "running", "C", "-", "Reduce", "to", "reduce", "the", "time", "the", "interestingness", "test", "takes", "to", "run", "." ]
def simplify_clang_args(self): """Simplify clang arguments before running C-Reduce to reduce the time the interestingness test takes to run. """ print("\nSimplifying the clang command...") # Remove some clang arguments to speed up the interestingness test new_args = self.clang_args new_args...
[ "def", "simplify_clang_args", "(", "self", ")", ":", "print", "(", "\"\\nSimplifying the clang command...\"", ")", "# Remove some clang arguments to speed up the interestingness test", "new_args", "=", "self", ".", "clang_args", "new_args", "=", "self", ".", "try_remove_args"...
https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/clang/utils/creduce-clang-crash.py#L293-L333
lmb-freiburg/flownet2
b92e198b56b0e52e1ba0a5a98dc0e39fa5ae70cc
scripts/cpp_lint.py
python
FileInfo.BaseName
(self)
return self.Split()[1]
File base name - text after the final slash, before the final period.
File base name - text after the final slash, before the final period.
[ "File", "base", "name", "-", "text", "after", "the", "final", "slash", "before", "the", "final", "period", "." ]
def BaseName(self): """File base name - text after the final slash, before the final period.""" return self.Split()[1]
[ "def", "BaseName", "(", "self", ")", ":", "return", "self", ".", "Split", "(", ")", "[", "1", "]" ]
https://github.com/lmb-freiburg/flownet2/blob/b92e198b56b0e52e1ba0a5a98dc0e39fa5ae70cc/scripts/cpp_lint.py#L944-L946
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
tools/android/loading/cloud/frontend/clovis_frontend.py
python
Finalize
(tag, email_address, status, task_url)
Cleans up the remaining ComputeEngine resources and notifies the user. Args: tag (str): Tag of the task to finalize. email_address (str): Email address of the user to be notified. status (str): Status of the task, indicating the success or the cause of failure. task_url (str): URL w...
Cleans up the remaining ComputeEngine resources and notifies the user.
[ "Cleans", "up", "the", "remaining", "ComputeEngine", "resources", "and", "notifies", "the", "user", "." ]
def Finalize(tag, email_address, status, task_url): """Cleans up the remaining ComputeEngine resources and notifies the user. Args: tag (str): Tag of the task to finalize. email_address (str): Email address of the user to be notified. status (str): Status of the task, indicating the success or the caus...
[ "def", "Finalize", "(", "tag", ",", "email_address", ",", "status", ",", "task_url", ")", ":", "email_helper", ".", "SendEmailTaskComplete", "(", "to_address", "=", "email_address", ",", "tag", "=", "tag", ",", "status", "=", "status", ",", "task_url", "=", ...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/android/loading/cloud/frontend/clovis_frontend.py#L91-L106
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/urllib3/_collections.py
python
HTTPHeaderDict.pop
(self, key, default=__marker)
D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised.
D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised.
[ "D", ".", "pop", "(", "k", "[", "d", "]", ")", "-", ">", "v", "remove", "specified", "key", "and", "return", "the", "corresponding", "value", ".", "If", "key", "is", "not", "found", "d", "is", "returned", "if", "given", "otherwise", "KeyError", "is",...
def pop(self, key, default=__marker): """D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. """ # Using the MutableMapping function directly fails due to the private marker. # Usin...
[ "def", "pop", "(", "self", ",", "key", ",", "default", "=", "__marker", ")", ":", "# Using the MutableMapping function directly fails due to the private marker.", "# Using ordinary dict.pop would expose the internal structures.", "# So let's reinvent the wheel.", "try", ":", "value...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/urllib3/_collections.py#L192-L207
mongodb/mongo
d8ff665343ad29cf286ee2cf4a1960d29371937b
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Node/FS.py
python
FS.chdir
(self, dir, change_os_dir=0)
Change the current working directory for lookups. If change_os_dir is true, we will also change the "real" cwd to match.
Change the current working directory for lookups. If change_os_dir is true, we will also change the "real" cwd to match.
[ "Change", "the", "current", "working", "directory", "for", "lookups", ".", "If", "change_os_dir", "is", "true", "we", "will", "also", "change", "the", "real", "cwd", "to", "match", "." ]
def chdir(self, dir, change_os_dir=0): """Change the current working directory for lookups. If change_os_dir is true, we will also change the "real" cwd to match. """ curr=self._cwd try: if dir is not None: self._cwd = dir if ch...
[ "def", "chdir", "(", "self", ",", "dir", ",", "change_os_dir", "=", "0", ")", ":", "curr", "=", "self", ".", "_cwd", "try", ":", "if", "dir", "is", "not", "None", ":", "self", ".", "_cwd", "=", "dir", "if", "change_os_dir", ":", "os", ".", "chdir...
https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Node/FS.py#L1195-L1208
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/numpy/py3/numpy/core/function_base.py
python
geomspace
(start, stop, num=50, endpoint=True, dtype=None, axis=0)
return result.astype(dtype, copy=False)
Return numbers spaced evenly on a log scale (a geometric progression). This is similar to `logspace`, but with endpoints specified directly. Each output sample is a constant multiple of the previous. .. versionchanged:: 1.16.0 Non-scalar `start` and `stop` are now supported. Parameters --...
Return numbers spaced evenly on a log scale (a geometric progression).
[ "Return", "numbers", "spaced", "evenly", "on", "a", "log", "scale", "(", "a", "geometric", "progression", ")", "." ]
def geomspace(start, stop, num=50, endpoint=True, dtype=None, axis=0): """ Return numbers spaced evenly on a log scale (a geometric progression). This is similar to `logspace`, but with endpoints specified directly. Each output sample is a constant multiple of the previous. .. versionchanged:: 1.1...
[ "def", "geomspace", "(", "start", ",", "stop", ",", "num", "=", "50", ",", "endpoint", "=", "True", ",", "dtype", "=", "None", ",", "axis", "=", "0", ")", ":", "start", "=", "asanyarray", "(", "start", ")", "stop", "=", "asanyarray", "(", "stop", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/core/function_base.py#L287-L440
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/python/tools/saved_model_cli.py
python
load_inputs_from_input_arg_string
(inputs_str, input_exprs_str)
return tensor_key_feed_dict
Parses input arg strings and create inputs feed_dict. Parses '--inputs' string for inputs to be loaded from file, and parses '--input_exprs' string for inputs to be evaluated from python expression. Args: inputs_str: A string that specified where to load inputs. Each input is separated by semicolon....
Parses input arg strings and create inputs feed_dict.
[ "Parses", "input", "arg", "strings", "and", "create", "inputs", "feed_dict", "." ]
def load_inputs_from_input_arg_string(inputs_str, input_exprs_str): """Parses input arg strings and create inputs feed_dict. Parses '--inputs' string for inputs to be loaded from file, and parses '--input_exprs' string for inputs to be evaluated from python expression. Args: inputs_str: A string that spec...
[ "def", "load_inputs_from_input_arg_string", "(", "inputs_str", ",", "input_exprs_str", ")", ":", "tensor_key_feed_dict", "=", "{", "}", "inputs", "=", "preprocess_inputs_arg_string", "(", "inputs_str", ")", "input_exprs", "=", "preprocess_input_exprs_arg_string", "(", "in...
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/tools/saved_model_cli.py#L398-L487
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
src/python/turicreate/toolkits/regression/decision_tree_regression.py
python
DecisionTreeRegression.evaluate
(self, dataset, metric="auto", missing_value_action="auto")
return super(DecisionTreeRegression, self).evaluate( dataset, missing_value_action=missing_value_action, metric=metric )
Evaluate the model on the given dataset. Parameters ---------- dataset : SFrame Dataset in the same format used for training. The columns names and types of the dataset must be the same as that used in training. metric : str, optional Name of the eva...
Evaluate the model on the given dataset.
[ "Evaluate", "the", "model", "on", "the", "given", "dataset", "." ]
def evaluate(self, dataset, metric="auto", missing_value_action="auto"): """ Evaluate the model on the given dataset. Parameters ---------- dataset : SFrame Dataset in the same format used for training. The columns names and types of the dataset must be t...
[ "def", "evaluate", "(", "self", ",", "dataset", ",", "metric", "=", "\"auto\"", ",", "missing_value_action", "=", "\"auto\"", ")", ":", "_raise_error_evaluation_metric_is_valid", "(", "metric", ",", "[", "\"auto\"", ",", "\"rmse\"", ",", "\"max_error\"", "]", ")...
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/regression/decision_tree_regression.py#L191-L239
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/data/experimental/ops/take_while_ops.py
python
take_while
(predicate)
return _apply_fn
A transformation that stops dataset iteration based on a `predicate`. Args: predicate: A function that maps a nested structure of tensors (having shapes and types defined by `self.output_shapes` and `self.output_types`) to a scalar `tf.bool` tensor. Returns: A `Dataset` transformation function...
A transformation that stops dataset iteration based on a `predicate`.
[ "A", "transformation", "that", "stops", "dataset", "iteration", "based", "on", "a", "predicate", "." ]
def take_while(predicate): """A transformation that stops dataset iteration based on a `predicate`. Args: predicate: A function that maps a nested structure of tensors (having shapes and types defined by `self.output_shapes` and `self.output_types`) to a scalar `tf.bool` tensor. Returns: A `...
[ "def", "take_while", "(", "predicate", ")", ":", "def", "_apply_fn", "(", "dataset", ")", ":", "return", "dataset", ".", "take_while", "(", "predicate", "=", "predicate", ")", "return", "_apply_fn" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/data/experimental/ops/take_while_ops.py#L22-L38
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/tensorflow/python/ops/data_flow_ops.py
python
_as_type_list
(dtypes)
Convert dtypes to a list of types.
Convert dtypes to a list of types.
[ "Convert", "dtypes", "to", "a", "list", "of", "types", "." ]
def _as_type_list(dtypes): """Convert dtypes to a list of types.""" assert dtypes is not None if not (isinstance(dtypes, list) or isinstance(dtypes, tuple)): # We have a single type. return [dtypes] else: # We have a list or tuple of types. return list(dtypes)
[ "def", "_as_type_list", "(", "dtypes", ")", ":", "assert", "dtypes", "is", "not", "None", "if", "not", "(", "isinstance", "(", "dtypes", ",", "list", ")", "or", "isinstance", "(", "dtypes", ",", "tuple", ")", ")", ":", "# We have a single type.", "return",...
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/data_flow_ops.py#L40-L48
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/eclib/colorsetter.py
python
ColorSetter.OnValidateTxt
(self, evt)
Validate text to ensure only valid hex characters are entered @param evt: wxEVT_KEY_DOWN
Validate text to ensure only valid hex characters are entered @param evt: wxEVT_KEY_DOWN
[ "Validate", "text", "to", "ensure", "only", "valid", "hex", "characters", "are", "entered", "@param", "evt", ":", "wxEVT_KEY_DOWN" ]
def OnValidateTxt(self, evt): """Validate text to ensure only valid hex characters are entered @param evt: wxEVT_KEY_DOWN """ code = evt.GetKeyCode() if code in (wx.WXK_DELETE, wx.WXK_BACK, wx.WXK_LEFT, wx.WXK_RIGHT, wx.WXK_TAB) or evt.CmdDown(): ...
[ "def", "OnValidateTxt", "(", "self", ",", "evt", ")", ":", "code", "=", "evt", ".", "GetKeyCode", "(", ")", "if", "code", "in", "(", "wx", ".", "WXK_DELETE", ",", "wx", ".", "WXK_BACK", ",", "wx", ".", "WXK_LEFT", ",", "wx", ".", "WXK_RIGHT", ",", ...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/eclib/colorsetter.py#L178-L197
lammps/lammps
b75c3065430a75b1b5543a10e10f46d9b4c91913
tools/amber2lmp/dump2trj.py
python
NumericalSort
(String_list)
return Return_list
Sort a list of strings by the integer value of the first element
Sort a list of strings by the integer value of the first element
[ "Sort", "a", "list", "of", "strings", "by", "the", "integer", "value", "of", "the", "first", "element" ]
def NumericalSort(String_list): 'Sort a list of strings by the integer value of the first element' import string Working_list = [] for s in String_list: Working_list.append((int(string.split(s)[0]), s)) Working_list.sort() Return_list = [] for Tuple in Working_list: Retur...
[ "def", "NumericalSort", "(", "String_list", ")", ":", "import", "string", "Working_list", "=", "[", "]", "for", "s", "in", "String_list", ":", "Working_list", ".", "append", "(", "(", "int", "(", "string", ".", "split", "(", "s", ")", "[", "0", "]", ...
https://github.com/lammps/lammps/blob/b75c3065430a75b1b5543a10e10f46d9b4c91913/tools/amber2lmp/dump2trj.py#L288-L302
weolar/miniblink49
1c4678db0594a4abde23d3ebbcc7cd13c3170777
tools/idl_parser/idl_ppapi_parser.py
python
IDLPPAPIParser.p_LabelCont
(self, p)
LabelCont : ',' LabelList |
LabelCont : ',' LabelList |
[ "LabelCont", ":", "LabelList", "|" ]
def p_LabelCont(self, p): """LabelCont : ',' LabelList |""" if len(p) > 1: p[0] = p[2]
[ "def", "p_LabelCont", "(", "self", ",", "p", ")", ":", "if", "len", "(", "p", ")", ">", "1", ":", "p", "[", "0", "]", "=", "p", "[", "2", "]" ]
https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/tools/idl_parser/idl_ppapi_parser.py#L102-L106
stan-dev/math
5fd79f89933269a4ca4d8dd1fde2a36d53d4768c
lib/boost_1.75.0/tools/build/src/util/utility.py
python
get_grist
(value)
Returns the grist of a string. If value is a sequence, does it for every value and returns the result as a sequence.
Returns the grist of a string. If value is a sequence, does it for every value and returns the result as a sequence.
[ "Returns", "the", "grist", "of", "a", "string", ".", "If", "value", "is", "a", "sequence", "does", "it", "for", "every", "value", "and", "returns", "the", "result", "as", "a", "sequence", "." ]
def get_grist (value): """ Returns the grist of a string. If value is a sequence, does it for every value and returns the result as a sequence. """ assert is_iterable_typed(value, basestring) or isinstance(value, basestring) def get_grist_one (name): split = __re_grist_and_value.match (n...
[ "def", "get_grist", "(", "value", ")", ":", "assert", "is_iterable_typed", "(", "value", ",", "basestring", ")", "or", "isinstance", "(", "value", ",", "basestring", ")", "def", "get_grist_one", "(", "name", ")", ":", "split", "=", "__re_grist_and_value", "....
https://github.com/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/lib/boost_1.75.0/tools/build/src/util/utility.py#L91-L106
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/lib/polynomial.py
python
polysub
(a1, a2)
return val
Difference (subtraction) of two polynomials. Given two polynomials `a1` and `a2`, returns ``a1 - a2``. `a1` and `a2` can be either array_like sequences of the polynomials' coefficients (including coefficients equal to zero), or `poly1d` objects. Parameters ---------- a1, a2 : array_like or pol...
Difference (subtraction) of two polynomials.
[ "Difference", "(", "subtraction", ")", "of", "two", "polynomials", "." ]
def polysub(a1, a2): """ Difference (subtraction) of two polynomials. Given two polynomials `a1` and `a2`, returns ``a1 - a2``. `a1` and `a2` can be either array_like sequences of the polynomials' coefficients (including coefficients equal to zero), or `poly1d` objects. Parameters --------...
[ "def", "polysub", "(", "a1", ",", "a2", ")", ":", "truepoly", "=", "(", "isinstance", "(", "a1", ",", "poly1d", ")", "or", "isinstance", "(", "a2", ",", "poly1d", ")", ")", "a1", "=", "atleast_1d", "(", "a1", ")", "a2", "=", "atleast_1d", "(", "a...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/lib/polynomial.py#L807-L851
qt/qtcharts
944a88f7a7e033eebcd599ecc1ef5973762ab215
conanfile.py
python
QtCharts.get_qt_leaf_module_default_options
(self)
return {item.replace("-", "_"): None for item in _qtcharts_features}
Implements abstractmethod from qt-conan-common.QtLeafModule
Implements abstractmethod from qt-conan-common.QtLeafModule
[ "Implements", "abstractmethod", "from", "qt", "-", "conan", "-", "common", ".", "QtLeafModule" ]
def get_qt_leaf_module_default_options(self) -> Dict[str, Any]: """Implements abstractmethod from qt-conan-common.QtLeafModule""" return {item.replace("-", "_"): None for item in _qtcharts_features}
[ "def", "get_qt_leaf_module_default_options", "(", "self", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "{", "item", ".", "replace", "(", "\"-\"", ",", "\"_\"", ")", ":", "None", "for", "item", "in", "_qtcharts_features", "}" ]
https://github.com/qt/qtcharts/blob/944a88f7a7e033eebcd599ecc1ef5973762ab215/conanfile.py#L80-L82
RamadhanAmizudin/malware
2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1
Fuzzbunch/fuzzbunch/pyreadline/modes/vi.py
python
ViMode.init_editing_mode
(self, e)
Initialize vi editingmode
Initialize vi editingmode
[ "Initialize", "vi", "editingmode" ]
def init_editing_mode(self, e): # (M-C-j) '''Initialize vi editingmode''' self.show_all_if_ambiguous = 'on' self.key_dispatch = {} self.__vi_insert_mode = None self._vi_command = None self._vi_command_edit = None self._vi_key_find_char = None self._vi_key_...
[ "def", "init_editing_mode", "(", "self", ",", "e", ")", ":", "# (M-C-j)", "self", ".", "show_all_if_ambiguous", "=", "'on'", "self", ".", "key_dispatch", "=", "{", "}", "self", ".", "__vi_insert_mode", "=", "None", "self", ".", "_vi_command", "=", "None", ...
https://github.com/RamadhanAmizudin/malware/blob/2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1/Fuzzbunch/fuzzbunch/pyreadline/modes/vi.py#L95-L133
baidu/AnyQ
d94d450d2aaa5f7ed73424b10aa4539835b97527
tools/simnet/train/tf/tools/tf_record_reader.py
python
read_tfrecords_pairwise
(config)
read tf records
read tf records
[ "read", "tf", "records" ]
def read_tfrecords_pairwise(config): """ read tf records """ datafeed = datafeeds.TFPairwisePaddingData(config) query, pos, neg = datafeed.ops() init_op = tf.group(tf.global_variables_initializer(), tf.local_variables_initializer()) start_time = time.time() sess = ...
[ "def", "read_tfrecords_pairwise", "(", "config", ")", ":", "datafeed", "=", "datafeeds", ".", "TFPairwisePaddingData", "(", "config", ")", "query", ",", "pos", ",", "neg", "=", "datafeed", ".", "ops", "(", ")", "init_op", "=", "tf", ".", "group", "(", "t...
https://github.com/baidu/AnyQ/blob/d94d450d2aaa5f7ed73424b10aa4539835b97527/tools/simnet/train/tf/tools/tf_record_reader.py#L76-L101
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Editor/Python/windows/Lib/site-packages/setuptools/namespaces.py
python
Installer._pkg_names
(pkg)
Given a namespace package, yield the components of that package. >>> names = Installer._pkg_names('a.b.c') >>> set(names) == set(['a', 'a.b', 'a.b.c']) True
Given a namespace package, yield the components of that package.
[ "Given", "a", "namespace", "package", "yield", "the", "components", "of", "that", "package", "." ]
def _pkg_names(pkg): """ Given a namespace package, yield the components of that package. >>> names = Installer._pkg_names('a.b.c') >>> set(names) == set(['a', 'a.b', 'a.b.c']) True """ parts = pkg.split('.') while parts: yield '.'.joi...
[ "def", "_pkg_names", "(", "pkg", ")", ":", "parts", "=", "pkg", ".", "split", "(", "'.'", ")", "while", "parts", ":", "yield", "'.'", ".", "join", "(", "parts", ")", "parts", ".", "pop", "(", ")" ]
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/setuptools/namespaces.py#L87-L99
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/profiler/internal/flops_registry.py
python
_assign_sub_flops
(graph, node)
return _unary_op_flops(graph, node)
Compute flops for AssignSub operation.
Compute flops for AssignSub operation.
[ "Compute", "flops", "for", "AssignSub", "operation", "." ]
def _assign_sub_flops(graph, node): """Compute flops for AssignSub operation.""" return _unary_op_flops(graph, node)
[ "def", "_assign_sub_flops", "(", "graph", ",", "node", ")", ":", "return", "_unary_op_flops", "(", "graph", ",", "node", ")" ]
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/profiler/internal/flops_registry.py#L103-L105
pytorch/pytorch
7176c92687d3cc847cc046bf002269c6949a21c2
torch/ao/quantization/_dbr/fusion.py
python
get_module_fusion_fqns
( module: torch.nn.Module, )
return results
Input: a module with auto quantization state Walks the subgraphs and determines which modules should be fused. Output: a list of FQNs of modules which should be fused.
Input: a module with auto quantization state
[ "Input", ":", "a", "module", "with", "auto", "quantization", "state" ]
def get_module_fusion_fqns( module: torch.nn.Module, ) -> List[List[str]]: """ Input: a module with auto quantization state Walks the subgraphs and determines which modules should be fused. Output: a list of FQNs of modules which should be fused. """ results = [] for _, child in mo...
[ "def", "get_module_fusion_fqns", "(", "module", ":", "torch", ".", "nn", ".", "Module", ",", ")", "->", "List", "[", "List", "[", "str", "]", "]", ":", "results", "=", "[", "]", "for", "_", ",", "child", "in", "module", ".", "named_modules", "(", "...
https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/ao/quantization/_dbr/fusion.py#L15-L56
neoml-lib/neoml
a0d370fba05269a1b2258cef126f77bbd2054a3e
NeoML/Python/neoml/Dnn/Irnn.py
python
Irnn.reverse_sequence
(self)
return self._internal.get_reverse_sequence()
Checks if the input sequence should be taken in reverse order.
Checks if the input sequence should be taken in reverse order.
[ "Checks", "if", "the", "input", "sequence", "should", "be", "taken", "in", "reverse", "order", "." ]
def reverse_sequence(self): """Checks if the input sequence should be taken in reverse order. """ return self._internal.get_reverse_sequence()
[ "def", "reverse_sequence", "(", "self", ")", ":", "return", "self", ".", "_internal", ".", "get_reverse_sequence", "(", ")" ]
https://github.com/neoml-lib/neoml/blob/a0d370fba05269a1b2258cef126f77bbd2054a3e/NeoML/Python/neoml/Dnn/Irnn.py#L128-L131
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/grid.py
python
Grid.SetGridCursor
(*args, **kwargs)
return _grid.Grid_SetGridCursor(*args, **kwargs)
SetGridCursor(self, int row, int col)
SetGridCursor(self, int row, int col)
[ "SetGridCursor", "(", "self", "int", "row", "int", "col", ")" ]
def SetGridCursor(*args, **kwargs): """SetGridCursor(self, int row, int col)""" return _grid.Grid_SetGridCursor(*args, **kwargs)
[ "def", "SetGridCursor", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_grid", ".", "Grid_SetGridCursor", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/grid.py#L1422-L1424
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/richtext.py
python
RichTextBuffer_SetBulletProportion
(*args, **kwargs)
return _richtext.RichTextBuffer_SetBulletProportion(*args, **kwargs)
RichTextBuffer_SetBulletProportion(float prop)
RichTextBuffer_SetBulletProportion(float prop)
[ "RichTextBuffer_SetBulletProportion", "(", "float", "prop", ")" ]
def RichTextBuffer_SetBulletProportion(*args, **kwargs): """RichTextBuffer_SetBulletProportion(float prop)""" return _richtext.RichTextBuffer_SetBulletProportion(*args, **kwargs)
[ "def", "RichTextBuffer_SetBulletProportion", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_richtext", ".", "RichTextBuffer_SetBulletProportion", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/richtext.py#L2725-L2727
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/x86/toolchain/lib/python2.7/cookielib.py
python
DefaultCookiePolicy.return_ok
(self, cookie, request)
return True
If you override .return_ok(), be sure to call this method. If it returns false, so should your subclass (assuming your subclass wants to be more strict about which cookies to return).
If you override .return_ok(), be sure to call this method. If it returns false, so should your subclass (assuming your subclass wants to be more strict about which cookies to return).
[ "If", "you", "override", ".", "return_ok", "()", "be", "sure", "to", "call", "this", "method", ".", "If", "it", "returns", "false", "so", "should", "your", "subclass", "(", "assuming", "your", "subclass", "wants", "to", "be", "more", "strict", "about", "...
def return_ok(self, cookie, request): """ If you override .return_ok(), be sure to call this method. If it returns false, so should your subclass (assuming your subclass wants to be more strict about which cookies to return). """ # Path has already been checked by .path...
[ "def", "return_ok", "(", "self", ",", "cookie", ",", "request", ")", ":", "# Path has already been checked by .path_return_ok(), and domain", "# blocking done by .domain_return_ok().", "_debug", "(", "\" - checking cookie %s=%s\"", ",", "cookie", ".", "name", ",", "cookie", ...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/cookielib.py#L1057-L1073
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/agw/aui/auibar.py
python
AuiToolBarItem.Assign
(self, c)
Assigns the properties of the :class:`AuiToolBarItem` `c` to `self`. :param `c`: another instance of :class:`AuiToolBarItem`.
Assigns the properties of the :class:`AuiToolBarItem` `c` to `self`.
[ "Assigns", "the", "properties", "of", "the", ":", "class", ":", "AuiToolBarItem", "c", "to", "self", "." ]
def Assign(self, c): """ Assigns the properties of the :class:`AuiToolBarItem` `c` to `self`. :param `c`: another instance of :class:`AuiToolBarItem`. """ self.window = c.window self.label = c.label self.bitmap = c.bitmap self.disabled_bitmap = c.disable...
[ "def", "Assign", "(", "self", ",", "c", ")", ":", "self", ".", "window", "=", "c", ".", "window", "self", ".", "label", "=", "c", ".", "label", "self", ".", "bitmap", "=", "c", ".", "bitmap", "self", ".", "disabled_bitmap", "=", "c", ".", "disabl...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/auibar.py#L308-L335
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/ops/rnn_cell_impl.py
python
RNNCell.output_size
(self)
Integer or TensorShape: size of outputs produced by this cell.
Integer or TensorShape: size of outputs produced by this cell.
[ "Integer", "or", "TensorShape", ":", "size", "of", "outputs", "produced", "by", "this", "cell", "." ]
def output_size(self): """Integer or TensorShape: size of outputs produced by this cell.""" raise NotImplementedError("Abstract method")
[ "def", "output_size", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"Abstract method\"", ")" ]
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/rnn_cell_impl.py#L214-L216
trilinos/Trilinos
6168be6dd51e35e1cd681e9c4b24433e709df140
packages/seacas/scripts/exodus2.in.py
python
exodus.put_elem_id_map
(self, map)
return self.__ex_put_id_map(objType, inqType, map)
status = exo.put_elem_id_map(elem_id_map) -> store mapping of exodus element index to user- or application- defined element id; elem_id_map is ordered by the element *INDEX* ordering, a 1-based system going from 1 to exo.num_elems(), used by exodus for storage and input/ou...
status = exo.put_elem_id_map(elem_id_map)
[ "status", "=", "exo", ".", "put_elem_id_map", "(", "elem_id_map", ")" ]
def put_elem_id_map(self, map): """ status = exo.put_elem_id_map(elem_id_map) -> store mapping of exodus element index to user- or application- defined element id; elem_id_map is ordered by the element *INDEX* ordering, a 1-based system going from 1 to exo....
[ "def", "put_elem_id_map", "(", "self", ",", "map", ")", ":", "objType", "=", "ex_entity_type", "(", "\"EX_ELEM_MAP\"", ")", "inqType", "=", "ex_inquiry", "(", "\"EX_INQ_ELEM\"", ")", "return", "self", ".", "__ex_put_id_map", "(", "objType", ",", "inqType", ","...
https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exodus2.in.py#L1128-L1149
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/distutils/msvccompiler.py
python
get_build_version
()
return None
Return the version of MSVC that was used to build Python. For Python 2.3 and up, the version number is included in sys.version. For earlier versions, assume the compiler is MSVC 6.
Return the version of MSVC that was used to build Python.
[ "Return", "the", "version", "of", "MSVC", "that", "was", "used", "to", "build", "Python", "." ]
def get_build_version(): """Return the version of MSVC that was used to build Python. For Python 2.3 and up, the version number is included in sys.version. For earlier versions, assume the compiler is MSVC 6. """ prefix = "MSC v." i = string.find(sys.version, prefix) if i == -1: r...
[ "def", "get_build_version", "(", ")", ":", "prefix", "=", "\"MSC v.\"", "i", "=", "string", ".", "find", "(", "sys", ".", "version", ",", "prefix", ")", "if", "i", "==", "-", "1", ":", "return", "6", "i", "=", "i", "+", "len", "(", "prefix", ")",...
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/distutils/msvccompiler.py#L153-L174
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
remoting/tools/me2me_virtual_host.py
python
Authentication.copy_from
(self, config)
return True
Loads the config and returns false if the config is invalid.
Loads the config and returns false if the config is invalid.
[ "Loads", "the", "config", "and", "returns", "false", "if", "the", "config", "is", "invalid", "." ]
def copy_from(self, config): """Loads the config and returns false if the config is invalid.""" try: self.login = config["xmpp_login"] self.oauth_refresh_token = config["oauth_refresh_token"] except KeyError: return False return True
[ "def", "copy_from", "(", "self", ",", "config", ")", ":", "try", ":", "self", ".", "login", "=", "config", "[", "\"xmpp_login\"", "]", "self", ".", "oauth_refresh_token", "=", "config", "[", "\"oauth_refresh_token\"", "]", "except", "KeyError", ":", "return"...
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/remoting/tools/me2me_virtual_host.py#L155-L162
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/contrib/learn/python/learn/estimators/dnn.py
python
DNNClassifier.export
(self, export_dir, input_fn=None, input_feature_key=None, use_deprecated_input_fn=True, signature_fn=None, default_batch_size=1, exports_to_keep=None)
return super(DNNClassifier, self).export( export_dir=export_dir, input_fn=input_fn or default_input_fn, input_feature_key=input_feature_key, use_deprecated_input_fn=use_deprecated_input_fn, signature_fn=(signature_fn or export.classification_signature_fn_wit...
See BaseEstimator.export.
See BaseEstimator.export.
[ "See", "BaseEstimator", ".", "export", "." ]
def export(self, export_dir, input_fn=None, input_feature_key=None, use_deprecated_input_fn=True, signature_fn=None, default_batch_size=1, exports_to_keep=None): """See BaseEstimator.export.""" def default_input_fn(unuse...
[ "def", "export", "(", "self", ",", "export_dir", ",", "input_fn", "=", "None", ",", "input_feature_key", "=", "None", ",", "use_deprecated_input_fn", "=", "True", ",", "signature_fn", "=", "None", ",", "default_batch_size", "=", "1", ",", "exports_to_keep", "=...
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/learn/python/learn/estimators/dnn.py#L493-L516
mapsme/omim
1892903b63f2c85b16ed4966d21fe76aba06b9ba
tools/python/planet_checks/validate_countries.py
python
map_reference_countries_to_osm
(osm_countries, reference_countries)
return ref2osm_country_mapping
For each country name from reference_countries find corresponding country from OSM, or set None if not found.
For each country name from reference_countries find corresponding country from OSM, or set None if not found.
[ "For", "each", "country", "name", "from", "reference_countries", "find", "corresponding", "country", "from", "OSM", "or", "set", "None", "if", "not", "found", "." ]
def map_reference_countries_to_osm(osm_countries, reference_countries): """For each country name from reference_countries find corresponding country from OSM, or set None if not found. """ # Country name:en => osm country object ref2osm_country_mapping = dict.fromkeys(reference_countries.keys()) ...
[ "def", "map_reference_countries_to_osm", "(", "osm_countries", ",", "reference_countries", ")", ":", "# Country name:en => osm country object", "ref2osm_country_mapping", "=", "dict", ".", "fromkeys", "(", "reference_countries", ".", "keys", "(", ")", ")", "for", "country...
https://github.com/mapsme/omim/blob/1892903b63f2c85b16ed4966d21fe76aba06b9ba/tools/python/planet_checks/validate_countries.py#L398-L430
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/graph_editor/transform.py
python
TransformerInfo._original_elem
(self, transformed_top, missing_fn=None)
return None if missing_fn is None else missing_fn(transformed_top)
Return the original op/tensor corresponding to the transformed one. Args: transformed_top: the transformed tensor/operation. missing_fn: function handling the case where the counterpart cannot be found. By default, None is returned. Returns: the original tensor/operation (or None if n...
Return the original op/tensor corresponding to the transformed one.
[ "Return", "the", "original", "op", "/", "tensor", "corresponding", "to", "the", "transformed", "one", "." ]
def _original_elem(self, transformed_top, missing_fn=None): """Return the original op/tensor corresponding to the transformed one. Args: transformed_top: the transformed tensor/operation. missing_fn: function handling the case where the counterpart cannot be found. By default, None is retur...
[ "def", "_original_elem", "(", "self", ",", "transformed_top", ",", "missing_fn", "=", "None", ")", ":", "transformed_map", "=", "self", ".", "_get_transformed_map", "(", "transformed_top", ")", "if", "isinstance", "(", "transformed_top", ",", "string_types", ")", ...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/graph_editor/transform.py#L231-L249
miyosuda/TensorFlowAndroidMNIST
7b5a4603d2780a8a2834575706e9001977524007
jni-build/jni/include/tensorflow/python/training/queue_runner.py
python
start_queue_runners
(sess=None, coord=None, daemon=True, start=True, collection=ops.GraphKeys.QUEUE_RUNNERS)
return threads
Starts all queue runners collected in the graph. This is a companion method to `add_queue_runner()`. It just starts threads for all queue runners collected in the graph. It returns the list of all threads. Args: sess: `Session` used to run the queue ops. Defaults to the default session. coord...
Starts all queue runners collected in the graph.
[ "Starts", "all", "queue", "runners", "collected", "in", "the", "graph", "." ]
def start_queue_runners(sess=None, coord=None, daemon=True, start=True, collection=ops.GraphKeys.QUEUE_RUNNERS): """Starts all queue runners collected in the graph. This is a companion method to `add_queue_runner()`. It just starts threads for all queue runners collected in the graph. I...
[ "def", "start_queue_runners", "(", "sess", "=", "None", ",", "coord", "=", "None", ",", "daemon", "=", "True", ",", "start", "=", "True", ",", "collection", "=", "ops", ".", "GraphKeys", ".", "QUEUE_RUNNERS", ")", ":", "if", "sess", "is", "None", ":", ...
https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/training/queue_runner.py#L319-L351
mhammond/pywin32
44afd86ba8485194df93234639243252deeb40d5
com/win32com/client/gencache.py
python
MakeModuleForTypelib
( typelibCLSID, lcid, major, minor, progressInstance=None, bForDemand=bForDemandDefault, bBuildHidden=1, )
return GetModuleForTypelib(typelibCLSID, lcid, major, minor)
Generate support for a type library. Given the IID, LCID and version information for a type library, generate and import the necessary support files. Returns the Python module. No exceptions are caught. Params typelibCLSID -- IID of the type library. major -- Integer major version. minor...
Generate support for a type library.
[ "Generate", "support", "for", "a", "type", "library", "." ]
def MakeModuleForTypelib( typelibCLSID, lcid, major, minor, progressInstance=None, bForDemand=bForDemandDefault, bBuildHidden=1, ): """Generate support for a type library. Given the IID, LCID and version information for a type library, generate and import the necessary support f...
[ "def", "MakeModuleForTypelib", "(", "typelibCLSID", ",", "lcid", ",", "major", ",", "minor", ",", "progressInstance", "=", "None", ",", "bForDemand", "=", "bForDemandDefault", ",", "bBuildHidden", "=", "1", ",", ")", ":", "from", ".", "import", "makepy", "ma...
https://github.com/mhammond/pywin32/blob/44afd86ba8485194df93234639243252deeb40d5/com/win32com/client/gencache.py#L289-L321
coinapi/coinapi-sdk
854f21e7f69ea8599ae35c5403565cf299d8b795
oeml-sdk/python/openapi_client/model/balance.py
python
Balance._from_openapi_data
(cls, *args, **kwargs)
return self
Balance - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defa...
Balance - a model defined in OpenAPI
[ "Balance", "-", "a", "model", "defined", "in", "OpenAPI" ]
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 """Balance - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be ...
[ "def", "_from_openapi_data", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "_check_type", "=", "kwargs", ".", "pop", "(", "'_check_type'", ",", "True", ")", "_spec_property_naming", "=", "kwargs", ".", "pop", "(", "'_spec...
https://github.com/coinapi/coinapi-sdk/blob/854f21e7f69ea8599ae35c5403565cf299d8b795/oeml-sdk/python/openapi_client/model/balance.py#L112-L183
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/lib2to3/fixer_util.py
python
Subscript
(index_node)
return Node(syms.trailer, [Leaf(token.LBRACE, u"["), index_node, Leaf(token.RBRACE, u"]")])
A numeric or string subscript
A numeric or string subscript
[ "A", "numeric", "or", "string", "subscript" ]
def Subscript(index_node): """A numeric or string subscript""" return Node(syms.trailer, [Leaf(token.LBRACE, u"["), index_node, Leaf(token.RBRACE, u"]")])
[ "def", "Subscript", "(", "index_node", ")", ":", "return", "Node", "(", "syms", ".", "trailer", ",", "[", "Leaf", "(", "token", ".", "LBRACE", ",", "u\"[\"", ")", ",", "index_node", ",", "Leaf", "(", "token", ".", "RBRACE", ",", "u\"]\"", ")", "]", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib2to3/fixer_util.py#L79-L83
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Editor/Python/windows/Lib/site-packages/pip/_vendor/requests/packages/urllib3/packages/ordered_dict.py
python
OrderedDict.__iter__
(self)
od.__iter__() <==> iter(od)
od.__iter__() <==> iter(od)
[ "od", ".", "__iter__", "()", "<", "==", ">", "iter", "(", "od", ")" ]
def __iter__(self): 'od.__iter__() <==> iter(od)' root = self.__root curr = root[1] while curr is not root: yield curr[2] curr = curr[1]
[ "def", "__iter__", "(", "self", ")", ":", "root", "=", "self", ".", "__root", "curr", "=", "root", "[", "1", "]", "while", "curr", "is", "not", "root", ":", "yield", "curr", "[", "2", "]", "curr", "=", "curr", "[", "1", "]" ]
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pip/_vendor/requests/packages/urllib3/packages/ordered_dict.py#L63-L69
Tencent/CMONGO
c40380caa14e05509f46993aa8b8da966b09b0b5
src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/__init__.py
python
ToolInitializerMethod.get_builder
(self, env)
return builder
Returns the appropriate real Builder for this method name after having the associated ToolInitializer object apply the appropriate Tool module.
Returns the appropriate real Builder for this method name after having the associated ToolInitializer object apply the appropriate Tool module.
[ "Returns", "the", "appropriate", "real", "Builder", "for", "this", "method", "name", "after", "having", "the", "associated", "ToolInitializer", "object", "apply", "the", "appropriate", "Tool", "module", "." ]
def get_builder(self, env): """ Returns the appropriate real Builder for this method name after having the associated ToolInitializer object apply the appropriate Tool module. """ builder = getattr(env, self.__name__) self.initializer.apply_tools(env) builder = getattr(env, ...
[ "def", "get_builder", "(", "self", ",", "env", ")", ":", "builder", "=", "getattr", "(", "env", ",", "self", ".", "__name__", ")", "self", ".", "initializer", ".", "apply_tools", "(", "env", ")", "builder", "=", "getattr", "(", "env", ",", "self", "....
https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/__init__.py#L891-L911
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py3/pandas/core/arrays/sparse/array.py
python
SparseArray.density
(self)
return self.sp_index.npoints / self.sp_index.length
The percent of non- ``fill_value`` points, as decimal. Examples -------- >>> s = SparseArray([0, 0, 1, 1, 1], fill_value=0) >>> s.density 0.6
The percent of non- ``fill_value`` points, as decimal.
[ "The", "percent", "of", "non", "-", "fill_value", "points", "as", "decimal", "." ]
def density(self) -> float: """ The percent of non- ``fill_value`` points, as decimal. Examples -------- >>> s = SparseArray([0, 0, 1, 1, 1], fill_value=0) >>> s.density 0.6 """ return self.sp_index.npoints / self.sp_index.length
[ "def", "density", "(", "self", ")", "->", "float", ":", "return", "self", ".", "sp_index", ".", "npoints", "/", "self", ".", "sp_index", ".", "length" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/arrays/sparse/array.py#L619-L629
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/android_platform/development/scripts/symbol.py
python
ToolPath
(tool, toolchain_info=None)
return os.path.join(CHROME_SRC, toolchain_subdir, toolchain_prefix + "-" + tool)
Return a full qualified path to the specified tool
Return a full qualified path to the specified tool
[ "Return", "a", "full", "qualified", "path", "to", "the", "specified", "tool" ]
def ToolPath(tool, toolchain_info=None): """Return a full qualified path to the specified tool""" # ToolPath looks for the tools in the completely incorrect directory. # This looks in the checked in android_tools. if ARCH == "arm": toolchain_source = "arm-linux-androideabi-4.9" toolchain_prefix = "arm-l...
[ "def", "ToolPath", "(", "tool", ",", "toolchain_info", "=", "None", ")", ":", "# ToolPath looks for the tools in the completely incorrect directory.", "# This looks in the checked in android_tools.", "if", "ARCH", "==", "\"arm\"", ":", "toolchain_source", "=", "\"arm-linux-andr...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/android_platform/development/scripts/symbol.py#L72-L105
RobotLocomotion/drake
0e18a34604c45ed65bc9018a54f7610f91cdad5b
doc/defs.py
python
symlink_input
(filegroup_resource_path, temp_dir, strip_prefix=None)
Symlinks a rule's input data into a temporary directory. This is useful both to create a hermetic set of inputs to pass to a documentation builder, or also in case we need to adjust the input data before passing it along. Args: filegroup_resource_path: Names a file created by enumerate_filegro...
Symlinks a rule's input data into a temporary directory.
[ "Symlinks", "a", "rule", "s", "input", "data", "into", "a", "temporary", "directory", "." ]
def symlink_input(filegroup_resource_path, temp_dir, strip_prefix=None): """Symlinks a rule's input data into a temporary directory. This is useful both to create a hermetic set of inputs to pass to a documentation builder, or also in case we need to adjust the input data before passing it along. ...
[ "def", "symlink_input", "(", "filegroup_resource_path", ",", "temp_dir", ",", "strip_prefix", "=", "None", ")", ":", "assert", "os", ".", "path", ".", "isdir", "(", "temp_dir", ")", "manifest", "=", "runfiles", ".", "Create", "(", ")", "with", "open", "(",...
https://github.com/RobotLocomotion/drake/blob/0e18a34604c45ed65bc9018a54f7610f91cdad5b/doc/defs.py#L27-L56
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/_gdi.py
python
FontMapper.SetConfigPath
(*args, **kwargs)
return _gdi_.FontMapper_SetConfigPath(*args, **kwargs)
SetConfigPath(self, String prefix)
SetConfigPath(self, String prefix)
[ "SetConfigPath", "(", "self", "String", "prefix", ")" ]
def SetConfigPath(*args, **kwargs): """SetConfigPath(self, String prefix)""" return _gdi_.FontMapper_SetConfigPath(*args, **kwargs)
[ "def", "SetConfigPath", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_gdi_", ".", "FontMapper_SetConfigPath", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L2049-L2051
krishauser/Klampt
972cc83ea5befac3f653c1ba20f80155768ad519
Python/python2_version/klampt/src/robotsim.py
python
RobotModelLink.setAxis
(self, axis)
return _robotsim.RobotModelLink_setAxis(self, axis)
setAxis(RobotModelLink self, double const [3] axis) Sets the local rotational / translational axis.
setAxis(RobotModelLink self, double const [3] axis)
[ "setAxis", "(", "RobotModelLink", "self", "double", "const", "[", "3", "]", "axis", ")" ]
def setAxis(self, axis): """ setAxis(RobotModelLink self, double const [3] axis) Sets the local rotational / translational axis. """ return _robotsim.RobotModelLink_setAxis(self, axis)
[ "def", "setAxis", "(", "self", ",", "axis", ")", ":", "return", "_robotsim", ".", "RobotModelLink_setAxis", "(", "self", ",", "axis", ")" ]
https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/src/robotsim.py#L3863-L3872
kamyu104/LeetCode-Solutions
77605708a927ea3b85aee5a479db733938c7c211
Python/reverse-string.py
python
Solution.reverseString
(self, s)
:type s: List[str] :rtype: None Do not return anything, modify s in-place instead.
:type s: List[str] :rtype: None Do not return anything, modify s in-place instead.
[ ":", "type", "s", ":", "List", "[", "str", "]", ":", "rtype", ":", "None", "Do", "not", "return", "anything", "modify", "s", "in", "-", "place", "instead", "." ]
def reverseString(self, s): """ :type s: List[str] :rtype: None Do not return anything, modify s in-place instead. """ i, j = 0, len(s) - 1 while i < j: s[i], s[j] = s[j], s[i] i += 1 j -= 1
[ "def", "reverseString", "(", "self", ",", "s", ")", ":", "i", ",", "j", "=", "0", ",", "len", "(", "s", ")", "-", "1", "while", "i", "<", "j", ":", "s", "[", "i", "]", ",", "s", "[", "j", "]", "=", "s", "[", "j", "]", ",", "s", "[", ...
https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/reverse-string.py#L5-L14
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/grid.py
python
Grid.SetSelectionForeground
(*args, **kwargs)
return _grid.Grid_SetSelectionForeground(*args, **kwargs)
SetSelectionForeground(self, Colour c)
SetSelectionForeground(self, Colour c)
[ "SetSelectionForeground", "(", "self", "Colour", "c", ")" ]
def SetSelectionForeground(*args, **kwargs): """SetSelectionForeground(self, Colour c)""" return _grid.Grid_SetSelectionForeground(*args, **kwargs)
[ "def", "SetSelectionForeground", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_grid", ".", "Grid_SetSelectionForeground", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/grid.py#L2105-L2107
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/bdb.py
python
Bdb.user_exception
(self, frame, exc_info)
This method is called if an exception occurs, but only if we are to stop at or just below this level.
This method is called if an exception occurs, but only if we are to stop at or just below this level.
[ "This", "method", "is", "called", "if", "an", "exception", "occurs", "but", "only", "if", "we", "are", "to", "stop", "at", "or", "just", "below", "this", "level", "." ]
def user_exception(self, frame, exc_info): exc_type, exc_value, exc_traceback = exc_info """This method is called if an exception occurs, but only if we are to stop at or just below this level.""" pass
[ "def", "user_exception", "(", "self", ",", "frame", ",", "exc_info", ")", ":", "exc_type", ",", "exc_value", ",", "exc_traceback", "=", "exc_info", "pass" ]
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/bdb.py#L170-L174
kevin-ssy/Optical-Flow-Guided-Feature
07d4501a29002ee7821c38c1820e4a64c1acf6e8
lib/caffe-action/python/caffe/draw.py
python
get_edge_label
(layer)
return edge_label
Define edge label based on layer type.
Define edge label based on layer type.
[ "Define", "edge", "label", "based", "on", "layer", "type", "." ]
def get_edge_label(layer): """Define edge label based on layer type. """ if layer.type == 'Data': edge_label = 'Batch ' + str(layer.data_param.batch_size) elif layer.type == 'Convolution': edge_label = str(layer.convolution_param.num_output) elif layer.type == 'InnerProduct': ...
[ "def", "get_edge_label", "(", "layer", ")", ":", "if", "layer", ".", "type", "==", "'Data'", ":", "edge_label", "=", "'Batch '", "+", "str", "(", "layer", ".", "data_param", ".", "batch_size", ")", "elif", "layer", ".", "type", "==", "'Convolution'", ":"...
https://github.com/kevin-ssy/Optical-Flow-Guided-Feature/blob/07d4501a29002ee7821c38c1820e4a64c1acf6e8/lib/caffe-action/python/caffe/draw.py#L37-L50
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/idlelib/calltip_w.py
python
CalltipWindow.showcontents
(self)
Create the call-tip widget.
Create the call-tip widget.
[ "Create", "the", "call", "-", "tip", "widget", "." ]
def showcontents(self): """Create the call-tip widget.""" self.label = Label(self.tipwindow, text=self.text, justify=LEFT, background="#ffffd0", foreground="black", relief=SOLID, borderwidth=1, font=self.anchor_widget['font...
[ "def", "showcontents", "(", "self", ")", ":", "self", ".", "label", "=", "Label", "(", "self", ".", "tipwindow", ",", "text", "=", "self", ".", "text", ",", "justify", "=", "LEFT", ",", "background", "=", "\"#ffffd0\"", ",", "foreground", "=", "\"black...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/calltip_w.py#L80-L86
SFTtech/openage
d6a08c53c48dc1e157807471df92197f6ca9e04d
openage/convert/processor/conversion/aoc/processor.py
python
AoCProcessor.extract_genie_units
(gamespec, full_data_set)
Extract units from the game data. :param gamespec: Gamedata from empires.dat file. :type gamespec: ...dataformat.value_members.ArrayMember
Extract units from the game data.
[ "Extract", "units", "from", "the", "game", "data", "." ]
def extract_genie_units(gamespec, full_data_set): """ Extract units from the game data. :param gamespec: Gamedata from empires.dat file. :type gamespec: ...dataformat.value_members.ArrayMember """ # Units are stored in the civ container. # All civs point to the s...
[ "def", "extract_genie_units", "(", "gamespec", ",", "full_data_set", ")", ":", "# Units are stored in the civ container.", "# All civs point to the same units (?) except for Gaia which has more.", "# Gaia also seems to have the most units, so we only read from Gaia", "#", "# call hierarchy: ...
https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/processor/conversion/aoc/processor.py#L180-L216
mongodb/mongo
d8ff665343ad29cf286ee2cf4a1960d29371937b
buildscripts/idl/idl_check_compatibility.py
python
check_param_or_type_validator
(ctxt: IDLCompatibilityContext, old_field: syntax.Field, new_field: syntax.Field, cmd_name: str, new_idl_file_path: str, type_name: Optional[str], is_command_parameter: bool)
Check compatibility between old and new validators. Check compatibility between old and new validators in command parameter type and command type struct fields.
Check compatibility between old and new validators.
[ "Check", "compatibility", "between", "old", "and", "new", "validators", "." ]
def check_param_or_type_validator(ctxt: IDLCompatibilityContext, old_field: syntax.Field, new_field: syntax.Field, cmd_name: str, new_idl_file_path: str, type_name: Optional[str], is_command_parameter: bool): """ Check compatibility between old...
[ "def", "check_param_or_type_validator", "(", "ctxt", ":", "IDLCompatibilityContext", ",", "old_field", ":", "syntax", ".", "Field", ",", "new_field", ":", "syntax", ".", "Field", ",", "cmd_name", ":", "str", ",", "new_idl_file_path", ":", "str", ",", "type_name"...
https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/idl/idl_check_compatibility.py#L776-L793
Polidea/SiriusObfuscator
b0e590d8130e97856afe578869b83a209e2b19be
SymbolExtractorAndRenamer/lldb/scripts/Python/prepare_binding_Python.py
python
get_header_files
(options)
return header_file_paths
Returns a list of paths to C++ header files for the LLDB API. These are the files that define the C++ API that will be wrapped by Python. @param options the dictionary of options parsed from the command line. @return a list of full paths to the include files used to define the public LLDB C++ API.
Returns a list of paths to C++ header files for the LLDB API.
[ "Returns", "a", "list", "of", "paths", "to", "C", "++", "header", "files", "for", "the", "LLDB", "API", "." ]
def get_header_files(options): """Returns a list of paths to C++ header files for the LLDB API. These are the files that define the C++ API that will be wrapped by Python. @param options the dictionary of options parsed from the command line. @return a list of full paths to the include files used to ...
[ "def", "get_header_files", "(", "options", ")", ":", "header_file_paths", "=", "[", "]", "header_base_dir", "=", "os", ".", "path", ".", "join", "(", "options", ".", "src_root", ",", "\"include\"", ",", "\"lldb\"", ")", "# Specify the include files in include/lldb...
https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/prepare_binding_Python.py#L107-L145
pytorch/pytorch
7176c92687d3cc847cc046bf002269c6949a21c2
torch/utils/tensorboard/writer.py
python
SummaryWriter.add_image_with_boxes
(self, tag, img_tensor, box_tensor, global_step=None, walltime=None, rescale=1, dataformats='CHW', labels=None)
Add image and draw bounding boxes on the image. Args: tag (string): Data identifier img_tensor (torch.Tensor, numpy.array, or string/blobname): Image data box_tensor (torch.Tensor, numpy.array, or string/blobname): Box data (for detected objects) box should be ...
Add image and draw bounding boxes on the image.
[ "Add", "image", "and", "draw", "bounding", "boxes", "on", "the", "image", "." ]
def add_image_with_boxes(self, tag, img_tensor, box_tensor, global_step=None, walltime=None, rescale=1, dataformats='CHW', labels=None): """Add image and draw bounding boxes on the image. Args: tag (string): Data identifier img_tensor (torch.Tensor, ...
[ "def", "add_image_with_boxes", "(", "self", ",", "tag", ",", "img_tensor", ",", "box_tensor", ",", "global_step", "=", "None", ",", "walltime", "=", "None", ",", "rescale", "=", "1", ",", "dataformats", "=", "'CHW'", ",", "labels", "=", "None", ")", ":",...
https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/utils/tensorboard/writer.py#L603-L639
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/grid.py
python
GridTableBase.GetColLabelValue
(*args, **kwargs)
return _grid.GridTableBase_GetColLabelValue(*args, **kwargs)
GetColLabelValue(self, int col) -> String
GetColLabelValue(self, int col) -> String
[ "GetColLabelValue", "(", "self", "int", "col", ")", "-", ">", "String" ]
def GetColLabelValue(*args, **kwargs): """GetColLabelValue(self, int col) -> String""" return _grid.GridTableBase_GetColLabelValue(*args, **kwargs)
[ "def", "GetColLabelValue", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_grid", ".", "GridTableBase_GetColLabelValue", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/grid.py#L890-L892
qt/qt
0a2f2382541424726168804be2c90b91381608c6
src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSSettings.py
python
_MovedAndRenamed
(tool, msvs_settings_name, msbuild_tool_name, msbuild_settings_name, type)
Defines a setting that may have moved to a new section. Args: tool: a dictionary that gives the names of the tool for MSVS and MSBuild. msvs_settings_name: the MSVS name of the setting. msbuild_tool_name: the name of the MSBuild tool to place the setting under. msbuild_settings_name: the MSBuild name...
Defines a setting that may have moved to a new section.
[ "Defines", "a", "setting", "that", "may", "have", "moved", "to", "a", "new", "section", "." ]
def _MovedAndRenamed(tool, msvs_settings_name, msbuild_tool_name, msbuild_settings_name, type): """ Defines a setting that may have moved to a new section. Args: tool: a dictionary that gives the names of the tool for MSVS and MSBuild. msvs_settings_name: the MSVS name of the setting. ...
[ "def", "_MovedAndRenamed", "(", "tool", ",", "msvs_settings_name", ",", "msbuild_tool_name", ",", "msbuild_settings_name", ",", "type", ")", ":", "def", "_Translate", "(", "value", ",", "msbuild_settings", ")", ":", "tool_settings", "=", "_GetOrCreateSubDictionary", ...
https://github.com/qt/qt/blob/0a2f2382541424726168804be2c90b91381608c6/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSSettings.py#L226-L245
ApolloAuto/apollo-platform
86d9dc6743b496ead18d597748ebabd34a513289
ros/ros_comm/roslaunch/src/roslaunch/remoteprocess.py
python
SSHChildROSLaunchProcess.stop
(self, errors=None)
Terminate this process, including the SSH connection.
Terminate this process, including the SSH connection.
[ "Terminate", "this", "process", "including", "the", "SSH", "connection", "." ]
def stop(self, errors=None): """ Terminate this process, including the SSH connection. """ if errors is None: errors = [] with self.lock: if not self.ssh: return # call the shutdown API first as closing the SSH connection ...
[ "def", "stop", "(", "self", ",", "errors", "=", "None", ")", ":", "if", "errors", "is", "None", ":", "errors", "=", "[", "]", "with", "self", ".", "lock", ":", "if", "not", "self", ".", "ssh", ":", "return", "# call the shutdown API first as closing the ...
https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/roslaunch/src/roslaunch/remoteprocess.py#L295-L334
kushview/Element
1cc16380caa2ab79461246ba758b9de1f46db2a5
waflib/Node.py
python
Node.find_dir
(self, lst)
return node
Searches for a folder on the filesystem (see :py:meth:`waflib.Node.Node.find_node`) :param lst: relative path :type lst: string or list of string :returns: The corresponding Node object or None if there is no such folder :rtype: :py:class:`waflib.Node.Node`
Searches for a folder on the filesystem (see :py:meth:`waflib.Node.Node.find_node`)
[ "Searches", "for", "a", "folder", "on", "the", "filesystem", "(", "see", ":", "py", ":", "meth", ":", "waflib", ".", "Node", ".", "Node", ".", "find_node", ")" ]
def find_dir(self, lst): """ Searches for a folder on the filesystem (see :py:meth:`waflib.Node.Node.find_node`) :param lst: relative path :type lst: string or list of string :returns: The corresponding Node object or None if there is no such folder :rtype: :py:class:`waflib.Node.Node` """ if isinstanc...
[ "def", "find_dir", "(", "self", ",", "lst", ")", ":", "if", "isinstance", "(", "lst", ",", "str", ")", ":", "lst", "=", "[", "x", "for", "x", "in", "Utils", ".", "split_path", "(", "lst", ")", "if", "x", "and", "x", "!=", "'.'", "]", "node", ...
https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/Node.py#L849-L864
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/targets/setobj.py
python
get_entry_size
(context, set_type)
return context.get_abi_sizeof(llty)
Return the entry size for the given set type.
Return the entry size for the given set type.
[ "Return", "the", "entry", "size", "for", "the", "given", "set", "type", "." ]
def get_entry_size(context, set_type): """ Return the entry size for the given set type. """ llty = context.get_data_type(types.SetEntry(set_type)) return context.get_abi_sizeof(llty)
[ "def", "get_entry_size", "(", "context", ",", "set_type", ")", ":", "llty", "=", "context", ".", "get_data_type", "(", "types", ".", "SetEntry", "(", "set_type", ")", ")", "return", "context", ".", "get_abi_sizeof", "(", "llty", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/targets/setobj.py#L33-L38
dmlc/treelite
df56babb6a4a2d7c29d719c28ce53acfa7dbab3c
python/treelite/frontend.py
python
Model.num_class
(self)
return out.value
Number of classes of the model (1 if the model is not a multi-class classifier
Number of classes of the model (1 if the model is not a multi-class classifier
[ "Number", "of", "classes", "of", "the", "model", "(", "1", "if", "the", "model", "is", "not", "a", "multi", "-", "class", "classifier" ]
def num_class(self): """Number of classes of the model (1 if the model is not a multi-class classifier""" if self.handle is None: raise AttributeError('Model not loaded yet') out = ctypes.c_size_t() _check_call(_LIB.TreeliteQueryNumClass(self.handle, ctypes.byref(out))) ...
[ "def", "num_class", "(", "self", ")", ":", "if", "self", ".", "handle", "is", "None", ":", "raise", "AttributeError", "(", "'Model not loaded yet'", ")", "out", "=", "ctypes", ".", "c_size_t", "(", ")", "_check_call", "(", "_LIB", ".", "TreeliteQueryNumClass...
https://github.com/dmlc/treelite/blob/df56babb6a4a2d7c29d719c28ce53acfa7dbab3c/python/treelite/frontend.py#L147-L153
giuspen/cherrytree
84712f206478fcf9acf30174009ad28c648c6344
pygtk2/modules/machines.py
python
StateMachine.update_curr_state_cursor_pos
(self, node_id)
If the buffer is still not modified update cursor pos
If the buffer is still not modified update cursor pos
[ "If", "the", "buffer", "is", "still", "not", "modified", "update", "cursor", "pos" ]
def update_curr_state_cursor_pos(self, node_id): """If the buffer is still not modified update cursor pos""" if not node_id in self.nodes_indexes: return curr_index = self.nodes_indexes[node_id] cursor_pos = self.dad.curr_buffer.get_property(cons.STR_CURSOR_POSITION) self.nodes_v...
[ "def", "update_curr_state_cursor_pos", "(", "self", ",", "node_id", ")", ":", "if", "not", "node_id", "in", "self", ".", "nodes_indexes", ":", "return", "curr_index", "=", "self", ".", "nodes_indexes", "[", "node_id", "]", "cursor_pos", "=", "self", ".", "da...
https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/machines.py#L944-L949
hpi-xnor/BMXNet
ed0b201da6667887222b8e4b5f997c4f6b61943d
python/mxnet/ndarray/ndarray.py
python
lesser
(lhs, rhs)
return _ufunc_helper( lhs, rhs, op.broadcast_lesser, lambda x, y: 1 if x < y else 0, _internal._lesser_scalar, _internal._greater_scalar)
Returns the result of element-wise **lesser than** (<) comparison operation with broadcasting. For each element in input arrays, return 1(true) if lhs elements are less than rhs, otherwise return 0(false). Equivalent to ``lhs < rhs`` and ``mx.nd.broadcast_lesser(lhs, rhs)``. .. note:: If ...
Returns the result of element-wise **lesser than** (<) comparison operation with broadcasting.
[ "Returns", "the", "result", "of", "element", "-", "wise", "**", "lesser", "than", "**", "(", "<", ")", "comparison", "operation", "with", "broadcasting", "." ]
def lesser(lhs, rhs): """Returns the result of element-wise **lesser than** (<) comparison operation with broadcasting. For each element in input arrays, return 1(true) if lhs elements are less than rhs, otherwise return 0(false). Equivalent to ``lhs < rhs`` and ``mx.nd.broadcast_lesser(lhs, rhs)`...
[ "def", "lesser", "(", "lhs", ",", "rhs", ")", ":", "# pylint: disable= no-member, protected-access", "return", "_ufunc_helper", "(", "lhs", ",", "rhs", ",", "op", ".", "broadcast_lesser", ",", "lambda", "x", ",", "y", ":", "1", "if", "x", "<", "y", "else",...
https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/ndarray/ndarray.py#L3119-L3179
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py
python
Misc.winfo_atom
(self, name, displayof=0)
return getint(self.tk.call(args))
Return integer which represents atom NAME.
Return integer which represents atom NAME.
[ "Return", "integer", "which", "represents", "atom", "NAME", "." ]
def winfo_atom(self, name, displayof=0): """Return integer which represents atom NAME.""" args = ('winfo', 'atom') + self._displayof(displayof) + (name,) return getint(self.tk.call(args))
[ "def", "winfo_atom", "(", "self", ",", "name", ",", "displayof", "=", "0", ")", ":", "args", "=", "(", "'winfo'", ",", "'atom'", ")", "+", "self", ".", "_displayof", "(", "displayof", ")", "+", "(", "name", ",", ")", "return", "getint", "(", "self"...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L724-L727
esphome/esphome
40e06c9819f17409615d4f4eec5cfe4dc9a3776d
esphome/pins.py
python
gpio_flags_expr
(mode)
return reduce(operator.or_, active_flags)
Convert the given mode dict to a gpio Flags expression
Convert the given mode dict to a gpio Flags expression
[ "Convert", "the", "given", "mode", "dict", "to", "a", "gpio", "Flags", "expression" ]
def gpio_flags_expr(mode): """Convert the given mode dict to a gpio Flags expression""" import esphome.codegen as cg FLAGS_MAPPING = { CONF_INPUT: cg.gpio_Flags.FLAG_INPUT, CONF_OUTPUT: cg.gpio_Flags.FLAG_OUTPUT, CONF_OPEN_DRAIN: cg.gpio_Flags.FLAG_OPEN_DRAIN, CONF_PULLUP: c...
[ "def", "gpio_flags_expr", "(", "mode", ")", ":", "import", "esphome", ".", "codegen", "as", "cg", "FLAGS_MAPPING", "=", "{", "CONF_INPUT", ":", "cg", ".", "gpio_Flags", ".", "FLAG_INPUT", ",", "CONF_OUTPUT", ":", "cg", ".", "gpio_Flags", ".", "FLAG_OUTPUT", ...
https://github.com/esphome/esphome/blob/40e06c9819f17409615d4f4eec5cfe4dc9a3776d/esphome/pins.py#L81-L96
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/logging/__init__.py
python
Handler.setFormatter
(self, fmt)
Set the formatter for this handler.
Set the formatter for this handler.
[ "Set", "the", "formatter", "for", "this", "handler", "." ]
def setFormatter(self, fmt): """ Set the formatter for this handler. """ self.formatter = fmt
[ "def", "setFormatter", "(", "self", ",", "fmt", ")", ":", "self", ".", "formatter", "=", "fmt" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/logging/__init__.py#L899-L903
CoolProp/CoolProp
381c8535e5dec3eec27ad430ebbfff8bc9dfc008
wrappers/Python/CoolProp/Plots/ConsistencyPlots_pcsaft.py
python
ConsistencyFigure.add_to_pdf
(self, pdf)
Add this figure to the pdf instance
Add this figure to the pdf instance
[ "Add", "this", "figure", "to", "the", "pdf", "instance" ]
def add_to_pdf(self, pdf): """ Add this figure to the pdf instance """ pdf.savefig(self.fig)
[ "def", "add_to_pdf", "(", "self", ",", "pdf", ")", ":", "pdf", ".", "savefig", "(", "self", ".", "fig", ")" ]
https://github.com/CoolProp/CoolProp/blob/381c8535e5dec3eec27ad430ebbfff8bc9dfc008/wrappers/Python/CoolProp/Plots/ConsistencyPlots_pcsaft.py#L259-L261
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/stc.py
python
StyledTextCtrl.GetZoom
(*args, **kwargs)
return _stc.StyledTextCtrl_GetZoom(*args, **kwargs)
GetZoom(self) -> int Retrieve the zoom level.
GetZoom(self) -> int
[ "GetZoom", "(", "self", ")", "-", ">", "int" ]
def GetZoom(*args, **kwargs): """ GetZoom(self) -> int Retrieve the zoom level. """ return _stc.StyledTextCtrl_GetZoom(*args, **kwargs)
[ "def", "GetZoom", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_stc", ".", "StyledTextCtrl_GetZoom", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L4981-L4987
cvmfs/cvmfs
4637bdb5153178eadf885c1acf37bdc5c685bf8a
cpplint.py
python
_SetOutputFormat
(output_format)
Sets the module's output format.
Sets the module's output format.
[ "Sets", "the", "module", "s", "output", "format", "." ]
def _SetOutputFormat(output_format): """Sets the module's output format.""" _cpplint_state.SetOutputFormat(output_format)
[ "def", "_SetOutputFormat", "(", "output_format", ")", ":", "_cpplint_state", ".", "SetOutputFormat", "(", "output_format", ")" ]
https://github.com/cvmfs/cvmfs/blob/4637bdb5153178eadf885c1acf37bdc5c685bf8a/cpplint.py#L856-L858
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/debug/cli/debugger_cli_common.py
python
TabCompletionRegistry.register_tab_comp_context
(self, context_words, comp_items)
Register a tab-completion context. Register that, for each word in context_words, the potential tab-completions are the words in comp_items. A context word is a pre-existing, completed word in the command line that determines how tab-completion works for another, incomplete word in the same comman...
Register a tab-completion context.
[ "Register", "a", "tab", "-", "completion", "context", "." ]
def register_tab_comp_context(self, context_words, comp_items): """Register a tab-completion context. Register that, for each word in context_words, the potential tab-completions are the words in comp_items. A context word is a pre-existing, completed word in the command line that determines how t...
[ "def", "register_tab_comp_context", "(", "self", ",", "context_words", ",", "comp_items", ")", ":", "if", "not", "isinstance", "(", "context_words", ",", "list", ")", ":", "raise", "TypeError", "(", "\"Incorrect type in context_list: Expected list, got %s\"", "%", "ty...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/debug/cli/debugger_cli_common.py#L851-L892
idaholab/moose
9eeebc65e098b4c30f8205fb41591fd5b61eb6ff
python/MooseDocs/base/Extension.py
python
Extension.postExecute
(self)
Called by Translator after all conversion is complete.
Called by Translator after all conversion is complete.
[ "Called", "by", "Translator", "after", "all", "conversion", "is", "complete", "." ]
def postExecute(self): """ Called by Translator after all conversion is complete. """ pass
[ "def", "postExecute", "(", "self", ")", ":", "pass" ]
https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/MooseDocs/base/Extension.py#L83-L87