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
pmq20/node-packer
12c46c6e44fbc14d9ee645ebd17d5296b324f7e0
lts/deps/v8/third_party/jinja2/compiler.py
python
Frame.copy
(self)
return rv
Create a copy of the current one.
Create a copy of the current one.
[ "Create", "a", "copy", "of", "the", "current", "one", "." ]
def copy(self): """Create a copy of the current one.""" rv = object.__new__(self.__class__) rv.__dict__.update(self.__dict__) rv.symbols = self.symbols.copy() return rv
[ "def", "copy", "(", "self", ")", ":", "rv", "=", "object", ".", "__new__", "(", "self", ".", "__class__", ")", "rv", ".", "__dict__", ".", "update", "(", "self", ".", "__dict__", ")", "rv", ".", "symbols", "=", "self", ".", "symbols", ".", "copy", ...
https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/v8/third_party/jinja2/compiler.py#L165-L170
apache/incubator-weex
5c25f0b59f7ac90703c363e7261f60bd06356dbe
weex_core/Source/base/android/jniprebuild/jni_generator.py
python
InlHeaderFileGenerator.GetLazyCalledByNativeMethodStub
(self, called_by_native)
return template.substitute(values)
Returns a string.
Returns a string.
[ "Returns", "a", "string", "." ]
def GetLazyCalledByNativeMethodStub(self, called_by_native): """Returns a string.""" function_signature_template = Template("""\ static ${RETURN_TYPE} Java_${JAVA_CLASS}_${METHOD_ID_VAR_NAME}(\ JNIEnv* env${FIRST_PARAM_IN_DECLARATION}${PARAMS_IN_DECLARATION})""") function_header_template = Template("""\ ${F...
[ "def", "GetLazyCalledByNativeMethodStub", "(", "self", ",", "called_by_native", ")", ":", "function_signature_template", "=", "Template", "(", "\"\"\"\\\nstatic ${RETURN_TYPE} Java_${JAVA_CLASS}_${METHOD_ID_VAR_NAME}(\\\nJNIEnv* env${FIRST_PARAM_IN_DECLARATION}${PARAMS_IN_DECLARATION})\"\"\"...
https://github.com/apache/incubator-weex/blob/5c25f0b59f7ac90703c363e7261f60bd06356dbe/weex_core/Source/base/android/jniprebuild/jni_generator.py#L1225-L1257
microsoft/TSS.MSR
0f2516fca2cd9929c31d5450e39301c9bde43688
TSS.Py/src/TpmTypes.py
python
TPMS_SYMCIPHER_PARMS.__init__
(self, sym = None)
This structure contains the parameters for a symmetric block cipher object. Attributes: sym (TPMT_SYM_DEF_OBJECT): A symmetric block cipher
This structure contains the parameters for a symmetric block cipher object.
[ "This", "structure", "contains", "the", "parameters", "for", "a", "symmetric", "block", "cipher", "object", "." ]
def __init__(self, sym = None): """ This structure contains the parameters for a symmetric block cipher object. Attributes: sym (TPMT_SYM_DEF_OBJECT): A symmetric block cipher """ self.sym = sym
[ "def", "__init__", "(", "self", ",", "sym", "=", "None", ")", ":", "self", ".", "sym", "=", "sym" ]
https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L5926-L5932
nyuwireless-unipd/ns3-mmwave
4ff9e87e8079764e04cbeccd8e85bff15ae16fb3
src/visualizer/visualizer/hud.py
python
Axes.__init__
(self, viz)
! Initializer function @param self: this object @param viz: visualization object @return none
! Initializer function
[ "!", "Initializer", "function" ]
def __init__(self, viz): """! Initializer function @param self: this object @param viz: visualization object @return none """ self.viz = viz self.color = 0x8080C0FF self.hlines = GooCanvas.CanvasPath(parent=viz.canvas.get_root_item(), stroke_color...
[ "def", "__init__", "(", "self", ",", "viz", ")", ":", "self", ".", "viz", "=", "viz", "self", ".", "color", "=", "0x8080C0FF", "self", ".", "hlines", "=", "GooCanvas", ".", "CanvasPath", "(", "parent", "=", "viz", ".", "canvas", ".", "get_root_item", ...
https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/src/visualizer/visualizer/hud.py#L22-L47
google/clif
cab24d6a105609a65c95a36a1712ae3c20c7b5df
clif/python/gen.py
python
Headlines
(src_file, hdr_files=(), sys_hdr_files=(), open_ns=None)
Generate header comment and #includes. Args: src_file: str - full name of the source file (C++ header) hdr_files: [str] - additional c++ headers to #include "str" If the first name is PYTHON, #include <Python.h>. If str == PYOBJ, forward declare PyObject. sys_hdr_files: set(str) - additional ...
Generate header comment and #includes.
[ "Generate", "header", "comment", "and", "#includes", "." ]
def Headlines(src_file, hdr_files=(), sys_hdr_files=(), open_ns=None): """Generate header comment and #includes. Args: src_file: str - full name of the source file (C++ header) hdr_files: [str] - additional c++ headers to #include "str" If the first name is PYTHON, #include <Python.h>. If str =...
[ "def", "Headlines", "(", "src_file", ",", "hdr_files", "=", "(", ")", ",", "sys_hdr_files", "=", "(", ")", ",", "open_ns", "=", "None", ")", ":", "yield", "'/'", "*", "70", "yield", "'// This file was automatically generated by PyCLIF.'", "yield", "'// Version %...
https://github.com/google/clif/blob/cab24d6a105609a65c95a36a1712ae3c20c7b5df/clif/python/gen.py#L83-L121
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/distutils/command/install.py
python
install.has_lib
(self)
return (self.distribution.has_pure_modules() or self.distribution.has_ext_modules())
Return true if the current distribution has any Python modules to install.
Return true if the current distribution has any Python modules to install.
[ "Return", "true", "if", "the", "current", "distribution", "has", "any", "Python", "modules", "to", "install", "." ]
def has_lib (self): """Return true if the current distribution has any Python modules to install.""" return (self.distribution.has_pure_modules() or self.distribution.has_ext_modules())
[ "def", "has_lib", "(", "self", ")", ":", "return", "(", "self", ".", "distribution", ".", "has_pure_modules", "(", ")", "or", "self", ".", "distribution", ".", "has_ext_modules", "(", ")", ")" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/distutils/command/install.py#L684-L688
hpi-xnor/BMXNet-v2
af2b1859eafc5c721b1397cef02f946aaf2ce20d
example/svrg_module/linear_regression/common.py
python
calc_variance
(grad_dict, num_batches, param_names)
Calculates the variance of the gradients per epoch for each parameter w.r.t number of batches Parameters ---------- grad_dict: dict dictionary that maps parameter name to gradients in the mod executor group num_batches: int number of batches param_names: str parameter name i...
Calculates the variance of the gradients per epoch for each parameter w.r.t number of batches
[ "Calculates", "the", "variance", "of", "the", "gradients", "per", "epoch", "for", "each", "parameter", "w", ".", "r", ".", "t", "number", "of", "batches" ]
def calc_variance(grad_dict, num_batches, param_names): """Calculates the variance of the gradients per epoch for each parameter w.r.t number of batches Parameters ---------- grad_dict: dict dictionary that maps parameter name to gradients in the mod executor group num_batches: int ...
[ "def", "calc_variance", "(", "grad_dict", ",", "num_batches", ",", "param_names", ")", ":", "for", "i", "in", "range", "(", "len", "(", "param_names", ")", ")", ":", "diff_sqr", "=", "mx", ".", "ndarray", ".", "square", "(", "mx", ".", "nd", ".", "su...
https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/svrg_module/linear_regression/common.py#L96-L117
xhzdeng/crpn
a5aef0f80dbe486103123f740c634fb01e6cc9a1
caffe-fast-rcnn/scripts/cpp_lint.py
python
PrintUsage
(message)
Prints a brief usage string and exits, optionally with an error message. Args: message: The optional error message.
Prints a brief usage string and exits, optionally with an error message.
[ "Prints", "a", "brief", "usage", "string", "and", "exits", "optionally", "with", "an", "error", "message", "." ]
def PrintUsage(message): """Prints a brief usage string and exits, optionally with an error message. Args: message: The optional error message. """ sys.stderr.write(_USAGE) if message: sys.exit('\nFATAL ERROR: ' + message) else: sys.exit(1)
[ "def", "PrintUsage", "(", "message", ")", ":", "sys", ".", "stderr", ".", "write", "(", "_USAGE", ")", "if", "message", ":", "sys", ".", "exit", "(", "'\\nFATAL ERROR: '", "+", "message", ")", "else", ":", "sys", ".", "exit", "(", "1", ")" ]
https://github.com/xhzdeng/crpn/blob/a5aef0f80dbe486103123f740c634fb01e6cc9a1/caffe-fast-rcnn/scripts/cpp_lint.py#L4761-L4771
chanyn/3Dpose_ssl
585696676279683a279b1ecca136c0e0d02aef2a
caffe-3dssl/tools/fully_connected_feed.py
python
do_eval
(sess, eval_correct, images_placeholder, labels_placeholder, data_set)
Runs one evaluation against the full epoch of data. Args: sess: The session in which the model has been trained. eval_correct: The Tensor that returns the number of correct predictions. images_placeholder: The images placeholder. labels_placeholder: The labels placeholder. data_set: The set of im...
Runs one evaluation against the full epoch of data.
[ "Runs", "one", "evaluation", "against", "the", "full", "epoch", "of", "data", "." ]
def do_eval(sess, eval_correct, images_placeholder, labels_placeholder, data_set): """Runs one evaluation against the full epoch of data. Args: sess: The session in which the model has been trained. eval_correct: The Tensor that returns the number of correct ...
[ "def", "do_eval", "(", "sess", ",", "eval_correct", ",", "images_placeholder", ",", "labels_placeholder", ",", "data_set", ")", ":", "# And run one epoch of eval.", "true_count", "=", "0", "# Counts the number of correct predictions.", "steps_per_epoch", "=", "data_set", ...
https://github.com/chanyn/3Dpose_ssl/blob/585696676279683a279b1ecca136c0e0d02aef2a/caffe-3dssl/tools/fully_connected_feed.py#L87-L113
mapnik/mapnik
f3da900c355e1d15059c4a91b00203dcc9d9f0ef
scons/scons-local-4.1.0/SCons/Tool/gnulink.py
python
generate
(env)
Add Builders and construction variables for gnulink to an Environment.
Add Builders and construction variables for gnulink to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "gnulink", "to", "an", "Environment", "." ]
def generate(env): """Add Builders and construction variables for gnulink to an Environment.""" link.generate(env) if env['PLATFORM'] == 'hpux': env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared -fPIC') # __RPATH is set to $_RPATH in the platform specification if that # platform su...
[ "def", "generate", "(", "env", ")", ":", "link", ".", "generate", "(", "env", ")", "if", "env", "[", "'PLATFORM'", "]", "==", "'hpux'", ":", "env", "[", "'SHLINKFLAGS'", "]", "=", "SCons", ".", "Util", ".", "CLVar", "(", "'$LINKFLAGS -shared -fPIC'", "...
https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Tool/gnulink.py#L42-L53
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/saving/saved_model/serialized_attributes.py
python
SerializedAttributes.with_attributes
( name, checkpointable_objects=None, functions=None, copy_from=None)
return type(name, (SerializedAttributes,), classdict)
Creates a subclass with all attributes as specified in the arguments. Args: name: Name of subclass checkpointable_objects: List of checkpointable objects to be serialized in the SavedModel. functions: List of functions to be serialized in the SavedModel. copy_from: List of other Ser...
Creates a subclass with all attributes as specified in the arguments.
[ "Creates", "a", "subclass", "with", "all", "attributes", "as", "specified", "in", "the", "arguments", "." ]
def with_attributes( name, checkpointable_objects=None, functions=None, copy_from=None): """Creates a subclass with all attributes as specified in the arguments. Args: name: Name of subclass checkpointable_objects: List of checkpointable objects to be serialized in the SavedModel. ...
[ "def", "with_attributes", "(", "name", ",", "checkpointable_objects", "=", "None", ",", "functions", "=", "None", ",", "copy_from", "=", "None", ")", ":", "checkpointable_objects", "=", "checkpointable_objects", "or", "[", "]", "functions", "=", "functions", "or...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/saving/saved_model/serialized_attributes.py#L108-L135
google/llvm-propeller
45c226984fe8377ebfb2ad7713c680d652ba678d
lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py
python
PtyProcess.__del__
(self)
This makes sure that no system resources are left open. Python only garbage collects Python objects. OS file descriptors are not Python objects, so they must be handled explicitly. If the child file descriptor was opened outside of this class (passed to the constructor) then this does no...
This makes sure that no system resources are left open. Python only garbage collects Python objects. OS file descriptors are not Python objects, so they must be handled explicitly. If the child file descriptor was opened outside of this class (passed to the constructor) then this does no...
[ "This", "makes", "sure", "that", "no", "system", "resources", "are", "left", "open", ".", "Python", "only", "garbage", "collects", "Python", "objects", ".", "OS", "file", "descriptors", "are", "not", "Python", "objects", "so", "they", "must", "be", "handled"...
def __del__(self): '''This makes sure that no system resources are left open. Python only garbage collects Python objects. OS file descriptors are not Python objects, so they must be handled explicitly. If the child file descriptor was opened outside of this class (passed to the construc...
[ "def", "__del__", "(", "self", ")", ":", "if", "not", "self", ".", "closed", ":", "# It is possible for __del__ methods to execute during the", "# teardown of the Python VM itself. Thus self.close() may", "# trigger an exception because os.close may be None.", "try", ":", "self", ...
https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py#L364-L379
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/graph_transformations/model_transformer.py
python
ModelTransformer._replace
(self, match_layer_node, replacement_layer_node)
Replace the tree or chain of match_layer_node with replacement_layer_node.
Replace the tree or chain of match_layer_node with replacement_layer_node.
[ "Replace", "the", "tree", "or", "chain", "of", "match_layer_node", "with", "replacement_layer_node", "." ]
def _replace(self, match_layer_node, replacement_layer_node): """Replace the tree or chain of match_layer_node with replacement_layer_node.""" if self._is_functional_model(self.model): self._replace_functional(match_layer_node, replacement_layer_node) else: self._replace_sequential(match_layer_n...
[ "def", "_replace", "(", "self", ",", "match_layer_node", ",", "replacement_layer_node", ")", ":", "if", "self", ".", "_is_functional_model", "(", "self", ".", "model", ")", ":", "self", ".", "_replace_functional", "(", "match_layer_node", ",", "replacement_layer_n...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/graph_transformations/model_transformer.py#L270-L275
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/cli/parser.py
python
ConfigOptionParser._update_defaults
(self, defaults)
return defaults
Updates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).
Updates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).
[ "Updates", "the", "given", "defaults", "with", "values", "from", "the", "config", "files", "and", "the", "environ", ".", "Does", "a", "little", "special", "handling", "for", "certain", "types", "of", "options", "(", "lists", ")", "." ]
def _update_defaults(self, defaults): """Updates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).""" # Accumulate complex default state. self.values = optparse.Values(self.defaults) ...
[ "def", "_update_defaults", "(", "self", ",", "defaults", ")", ":", "# Accumulate complex default state.", "self", ".", "values", "=", "optparse", ".", "Values", "(", "self", ".", "defaults", ")", "late_eval", "=", "set", "(", ")", "# Then set the options with thos...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/cli/parser.py#L197-L256
stan-dev/math
5fd79f89933269a4ca4d8dd1fde2a36d53d4768c
lib/cpplint_1.4.5/cpplint.py
python
IsErrorSuppressedByNolint
(category, linenum)
return (_global_error_suppressions.get(category, False) or linenum in _error_suppressions.get(category, set()) or linenum in _error_suppressions.get(None, set()))
Returns true if the specified error category is suppressed on this line. Consults the global error_suppressions map populated by ParseNolintSuppressions/ProcessGlobalSuppresions/ResetNolintSuppressions. Args: category: str, the category of the error. linenum: int, the current line number. Returns: ...
Returns true if the specified error category is suppressed on this line.
[ "Returns", "true", "if", "the", "specified", "error", "category", "is", "suppressed", "on", "this", "line", "." ]
def IsErrorSuppressedByNolint(category, linenum): """Returns true if the specified error category is suppressed on this line. Consults the global error_suppressions map populated by ParseNolintSuppressions/ProcessGlobalSuppresions/ResetNolintSuppressions. Args: category: str, the category of the error. ...
[ "def", "IsErrorSuppressedByNolint", "(", "category", ",", "linenum", ")", ":", "return", "(", "_global_error_suppressions", ".", "get", "(", "category", ",", "False", ")", "or", "linenum", "in", "_error_suppressions", ".", "get", "(", "category", ",", "set", "...
https://github.com/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/lib/cpplint_1.4.5/cpplint.py#L779-L794
SOUI2/soui.backup
dd361ee06ed82d6c5ea249b40e39e858aa6b0bb5
third-part/jsoncpp/makerelease.py
python
download
(url, target_path)
Download file represented by url to target_path.
Download file represented by url to target_path.
[ "Download", "file", "represented", "by", "url", "to", "target_path", "." ]
def download(url, target_path): """Download file represented by url to target_path. """ f = urllib2.urlopen(url) try: data = f.read() finally: f.close() fout = open(target_path, 'wb') try: fout.write(data) finally: fout.close()
[ "def", "download", "(", "url", ",", "target_path", ")", ":", "f", "=", "urllib2", ".", "urlopen", "(", "url", ")", "try", ":", "data", "=", "f", ".", "read", "(", ")", "finally", ":", "f", ".", "close", "(", ")", "fout", "=", "open", "(", "targ...
https://github.com/SOUI2/soui.backup/blob/dd361ee06ed82d6c5ea249b40e39e858aa6b0bb5/third-part/jsoncpp/makerelease.py#L142-L154
goldeneye-source/ges-code
2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d
thirdparty/protobuf-2.3.0/python/google/protobuf/internal/wire_format.py
python
IsTypePackable
(field_type)
return field_type not in NON_PACKABLE_TYPES
Return true iff packable = true is valid for fields of this type. Args: field_type: a FieldDescriptor::Type value. Returns: True iff fields of this type are packable.
Return true iff packable = true is valid for fields of this type.
[ "Return", "true", "iff", "packable", "=", "true", "is", "valid", "for", "fields", "of", "this", "type", "." ]
def IsTypePackable(field_type): """Return true iff packable = true is valid for fields of this type. Args: field_type: a FieldDescriptor::Type value. Returns: True iff fields of this type are packable. """ return field_type not in NON_PACKABLE_TYPES
[ "def", "IsTypePackable", "(", "field_type", ")", ":", "return", "field_type", "not", "in", "NON_PACKABLE_TYPES" ]
https://github.com/goldeneye-source/ges-code/blob/2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/wire_format.py#L259-L268
memkind/memkind
cbbf843ba63d852914f665064b6bf74cdc07ac54
utils/qemu/main.py
python
GuestConnection._memkind_configure_params
(self)
return config_params
Memkind configure parameters
Memkind configure parameters
[ "Memkind", "configure", "parameters" ]
def _memkind_configure_params(self) -> str: """ Memkind configure parameters """ config_params = '--prefix=/usr' if not self.hwloc: config_params += ' --disable-hwloc' if self.codecov: config_params += ' --enable-gcov' return config_params
[ "def", "_memkind_configure_params", "(", "self", ")", "->", "str", ":", "config_params", "=", "'--prefix=/usr'", "if", "not", "self", ".", "hwloc", ":", "config_params", "+=", "' --disable-hwloc'", "if", "self", ".", "codecov", ":", "config_params", "+=", "' --e...
https://github.com/memkind/memkind/blob/cbbf843ba63d852914f665064b6bf74cdc07ac54/utils/qemu/main.py#L101-L110
Kitware/ParaView
f760af9124ff4634b23ebbeab95a4f56e0261955
Wrapping/Python/paraview/coprocessing.py
python
CoProcessor.SetImageRootDirectory
(self, root_directory)
Specify root directory for image extracts
Specify root directory for image extracts
[ "Specify", "root", "directory", "for", "image", "extracts" ]
def SetImageRootDirectory(self, root_directory): """Specify root directory for image extracts""" if root_directory and not root_directory.endswith("/"): root_directory = root_directory + "/" self.__ImageRootDirectory = root_directory
[ "def", "SetImageRootDirectory", "(", "self", ",", "root_directory", ")", ":", "if", "root_directory", "and", "not", "root_directory", ".", "endswith", "(", "\"/\"", ")", ":", "root_directory", "=", "root_directory", "+", "\"/\"", "self", ".", "__ImageRootDirectory...
https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Wrapping/Python/paraview/coprocessing.py#L885-L889
interpretml/interpret
29466bffc04505fe4f836a83fcfebfd313ac8454
python/interpret-core/interpret/glassbox/ebm/ebm.py
python
DPExplainableBoostingClassifier.__init__
( self, # Explainer feature_names=None, feature_types=None, # Preprocessor max_bins=32, binning="private", # Stages mains="all", # Ensemble outer_bags=1, # Boosting learning_rate=0.01, validation_size=0, ...
Differentially Private Explainable Boosting Classifier. Note that many arguments are defaulted differently than regular EBMs. Args: feature_names: List of feature names. feature_types: List of feature types. max_bins: Max number of bins per feature for pre-processing stage. ...
Differentially Private Explainable Boosting Classifier. Note that many arguments are defaulted differently than regular EBMs.
[ "Differentially", "Private", "Explainable", "Boosting", "Classifier", ".", "Note", "that", "many", "arguments", "are", "defaulted", "differently", "than", "regular", "EBMs", "." ]
def __init__( self, # Explainer feature_names=None, feature_types=None, # Preprocessor max_bins=32, binning="private", # Stages mains="all", # Ensemble outer_bags=1, # Boosting learning_rate=0.01, validation_...
[ "def", "__init__", "(", "self", ",", "# Explainer", "feature_names", "=", "None", ",", "feature_types", "=", "None", ",", "# Preprocessor", "max_bins", "=", "32", ",", "binning", "=", "\"private\"", ",", "# Stages", "mains", "=", "\"all\"", ",", "# Ensemble", ...
https://github.com/interpretml/interpret/blob/29466bffc04505fe4f836a83fcfebfd313ac8454/python/interpret-core/interpret/glassbox/ebm/ebm.py#L1528-L1612
rootm0s/Protectors
5b3f4d11687a5955caf9c3af30666c4bfc2c19ab
OWASP-ZSC/module/readline_windows/pyreadline/console/ironpython_console.py
python
Console.title
(self, txt=None)
Set/get title.
Set/get title.
[ "Set", "/", "get", "title", "." ]
def title(self, txt=None): '''Set/get title.''' if txt: System.Console.Title = txt else: return System.Console.Title
[ "def", "title", "(", "self", ",", "txt", "=", "None", ")", ":", "if", "txt", ":", "System", ".", "Console", ".", "Title", "=", "txt", "else", ":", "return", "System", ".", "Console", ".", "Title" ]
https://github.com/rootm0s/Protectors/blob/5b3f4d11687a5955caf9c3af30666c4bfc2c19ab/OWASP-ZSC/module/readline_windows/pyreadline/console/ironpython_console.py#L339-L344
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/numbers.py
python
Real.__le__
(self, other)
self <= other
self <= other
[ "self", "<", "=", "other" ]
def __le__(self, other): """self <= other""" raise NotImplementedError
[ "def", "__le__", "(", "self", ",", "other", ")", ":", "raise", "NotImplementedError" ]
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/numbers.py#L244-L246
polyworld/polyworld
eb7e6bbc82fe77ba79e3bc48c3da2ad8c8238c26
scripts/agent/agent.py
python
average_step
(population)
return sum(steps) / float(len(steps))
Calculates the peak timestep of the population.
Calculates the peak timestep of the population.
[ "Calculates", "the", "peak", "timestep", "of", "the", "population", "." ]
def average_step(population): ''' Calculates the peak timestep of the population. ''' steps = [] for a in population: steps.extend(range(a.birth, a.death)) return sum(steps) / float(len(steps))
[ "def", "average_step", "(", "population", ")", ":", "steps", "=", "[", "]", "for", "a", "in", "population", ":", "steps", ".", "extend", "(", "range", "(", "a", ".", "birth", ",", "a", ".", "death", ")", ")", "return", "sum", "(", "steps", ")", "...
https://github.com/polyworld/polyworld/blob/eb7e6bbc82fe77ba79e3bc48c3da2ad8c8238c26/scripts/agent/agent.py#L451-L457
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/keras/_impl/keras/backend.py
python
function
(inputs, outputs, updates=None, **kwargs)
return Function(inputs, outputs, updates=updates, **kwargs)
Instantiates a Keras function. Arguments: inputs: List of placeholder tensors. outputs: List of output tensors. updates: List of update ops. **kwargs: Passed to `tf.Session.run`. Returns: Output values as Numpy arrays. Raises: ValueError: if invalid kwargs are passed in.
Instantiates a Keras function.
[ "Instantiates", "a", "Keras", "function", "." ]
def function(inputs, outputs, updates=None, **kwargs): """Instantiates a Keras function. Arguments: inputs: List of placeholder tensors. outputs: List of output tensors. updates: List of update ops. **kwargs: Passed to `tf.Session.run`. Returns: Output values as Numpy arrays. Ra...
[ "def", "function", "(", "inputs", ",", "outputs", ",", "updates", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ":", "for", "key", "in", "kwargs", ":", "if", "(", "key", "not", "in", "tf_inspect", ".", "getargspec", "(", "session_mo...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/keras/_impl/keras/backend.py#L2481-L2503
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_controls.py
python
ListBox.GetClassDefaultAttributes
(*args, **kwargs)
return _controls_.ListBox_GetClassDefaultAttributes(*args, **kwargs)
GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes Get the default attributes for this class. This is useful if you want to use the same font or colour in your own control as in a standard control -- which is a much better idea than hard coding specific co...
GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
[ "GetClassDefaultAttributes", "(", "int", "variant", "=", "WINDOW_VARIANT_NORMAL", ")", "-", ">", "VisualAttributes" ]
def GetClassDefaultAttributes(*args, **kwargs): """ GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes Get the default attributes for this class. This is useful if you want to use the same font or colour in your own control as in a standard control...
[ "def", "GetClassDefaultAttributes", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_controls_", ".", "ListBox_GetClassDefaultAttributes", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L1257-L1272
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/py_vulcanize/py_vulcanize/strip_js_comments.py
python
_TokenizeJS
(text)
Splits source code text into segments in preparation for comment stripping. Note that this doesn't tokenize for parsing. There is no notion of statements, variables, etc. The only tokens of interest are comment-related tokens. Args: text: The contents of a JavaScript file. Yields: A succession of str...
Splits source code text into segments in preparation for comment stripping.
[ "Splits", "source", "code", "text", "into", "segments", "in", "preparation", "for", "comment", "stripping", "." ]
def _TokenizeJS(text): """Splits source code text into segments in preparation for comment stripping. Note that this doesn't tokenize for parsing. There is no notion of statements, variables, etc. The only tokens of interest are comment-related tokens. Args: text: The contents of a JavaScript file. Yie...
[ "def", "_TokenizeJS", "(", "text", ")", ":", "rest", "=", "text", "tokens", "=", "[", "'//'", ",", "'/*'", ",", "'*/'", ",", "'\\n'", "]", "next_tok", "=", "re", ".", "compile", "(", "'|'", ".", "join", "(", "re", ".", "escape", "(", "x", ")", ...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/py_vulcanize/py_vulcanize/strip_js_comments.py#L10-L38
eerolanguage/clang
91360bee004a1cbdb95fe5eb605ef243152da41b
bindings/python/clang/cindex.py
python
TranslationUnit.save
(self, filename)
Saves the TranslationUnit to a file. This is equivalent to passing -emit-ast to the clang frontend. The saved file can be loaded back into a TranslationUnit. Or, if it corresponds to a header, it can be used as a pre-compiled header file. If an error occurs while saving, a TranslationU...
Saves the TranslationUnit to a file.
[ "Saves", "the", "TranslationUnit", "to", "a", "file", "." ]
def save(self, filename): """Saves the TranslationUnit to a file. This is equivalent to passing -emit-ast to the clang frontend. The saved file can be loaded back into a TranslationUnit. Or, if it corresponds to a header, it can be used as a pre-compiled header file. If an erro...
[ "def", "save", "(", "self", ",", "filename", ")", ":", "options", "=", "conf", ".", "lib", ".", "clang_defaultSaveOptions", "(", "self", ")", "result", "=", "int", "(", "conf", ".", "lib", ".", "clang_saveTranslationUnit", "(", "self", ",", "filename", "...
https://github.com/eerolanguage/clang/blob/91360bee004a1cbdb95fe5eb605ef243152da41b/bindings/python/clang/cindex.py#L2361-L2381
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/agw/aui/auibook.py
python
AuiTabContainer.MovePage
(self, page, new_idx)
return True
Moves a page in a new position specified by `new_idx`. :param Window `page`: the window associated with this tab; :param integer `new_idx`: the new page position.
Moves a page in a new position specified by `new_idx`.
[ "Moves", "a", "page", "in", "a", "new", "position", "specified", "by", "new_idx", "." ]
def MovePage(self, page, new_idx): """ Moves a page in a new position specified by `new_idx`. :param Window `page`: the window associated with this tab; :param integer `new_idx`: the new page position. """ idx = self.GetIdxFromWindow(page) if idx == -1: ...
[ "def", "MovePage", "(", "self", ",", "page", ",", "new_idx", ")", ":", "idx", "=", "self", ".", "GetIdxFromWindow", "(", "page", ")", "if", "idx", "==", "-", "1", ":", "return", "False", "# get page entry, make a copy of it", "p", "=", "self", ".", "GetP...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/auibook.py#L1050-L1071
natanielruiz/android-yolo
1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f
jni-build/jni/include/tensorflow/python/client/timeline.py
python
Timeline._analyze_tensors
(self, show_memory)
Analyze tensor references to track dataflow.
Analyze tensor references to track dataflow.
[ "Analyze", "tensor", "references", "to", "track", "dataflow", "." ]
def _analyze_tensors(self, show_memory): """Analyze tensor references to track dataflow.""" for dev_stats in self._step_stats.dev_stats: device_pid = self._device_pids[dev_stats.device] tensors_pid = self._tensor_pids[dev_stats.device] for node_stats in dev_stats.node_stats: tid = node...
[ "def", "_analyze_tensors", "(", "self", ",", "show_memory", ")", ":", "for", "dev_stats", "in", "self", ".", "_step_stats", ".", "dev_stats", ":", "device_pid", "=", "self", ".", "_device_pids", "[", "dev_stats", ".", "device", "]", "tensors_pid", "=", "self...
https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/client/timeline.py#L478-L508
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/nn/probability/distribution/poisson.py
python
Poisson._var
(self, rate=None)
return rate
r""" .. math:: VAR(POISSON) = \lambda.
r""" .. math:: VAR(POISSON) = \lambda.
[ "r", "..", "math", "::", "VAR", "(", "POISSON", ")", "=", "\\", "lambda", "." ]
def _var(self, rate=None): r""" .. math:: VAR(POISSON) = \lambda. """ rate = self._check_param_type(rate) return rate
[ "def", "_var", "(", "self", ",", "rate", "=", "None", ")", ":", "rate", "=", "self", ".", "_check_param_type", "(", "rate", ")", "return", "rate" ]
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/probability/distribution/poisson.py#L214-L220
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/mailbox.py
python
Maildir.next
(self)
Return the next message in a one-time iteration.
Return the next message in a one-time iteration.
[ "Return", "the", "next", "message", "in", "a", "one", "-", "time", "iteration", "." ]
def next(self): """Return the next message in a one-time iteration.""" if not hasattr(self, '_onetime_keys'): self._onetime_keys = self.iterkeys() while True: try: return self[self._onetime_keys.next()] except StopIteration: ret...
[ "def", "next", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_onetime_keys'", ")", ":", "self", ".", "_onetime_keys", "=", "self", ".", "iterkeys", "(", ")", "while", "True", ":", "try", ":", "return", "self", "[", "self", ".", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/mailbox.py#L551-L561
nyuwireless-unipd/ns3-mmwave
4ff9e87e8079764e04cbeccd8e85bff15ae16fb3
waf-tools/boost.py
python
__boost_get_libs_path
(self, *k, **kw)
return path, files
return the lib path and all the files in it
return the lib path and all the files in it
[ "return", "the", "lib", "path", "and", "all", "the", "files", "in", "it" ]
def __boost_get_libs_path(self, *k, **kw): ''' return the lib path and all the files in it ''' if 'files' in kw: return self.root.find_dir('.'), Utils.to_list(kw['files']) libs = k and k[0] or kw.get('libs', None) if libs: path = self.root.find_dir(libs) files = path.ant_glob('*boost_*') if not libs or not f...
[ "def", "__boost_get_libs_path", "(", "self", ",", "*", "k", ",", "*", "*", "kw", ")", ":", "if", "'files'", "in", "kw", ":", "return", "self", ".", "root", ".", "find_dir", "(", "'.'", ")", ",", "Utils", ".", "to_list", "(", "kw", "[", "'files'", ...
https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/waf-tools/boost.py#L190-L223
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/html5lib/serializer.py
python
HTMLSerializer.render
(self, treewalker, encoding=None)
Serializes the stream from the treewalker into a string :arg treewalker: the treewalker to serialize :arg encoding: the string encoding to use :returns: the serialized tree Example: >>> from html5lib import parse, getTreeWalker >>> from html5lib.serializer import HTM...
Serializes the stream from the treewalker into a string
[ "Serializes", "the", "stream", "from", "the", "treewalker", "into", "a", "string" ]
def render(self, treewalker, encoding=None): """Serializes the stream from the treewalker into a string :arg treewalker: the treewalker to serialize :arg encoding: the string encoding to use :returns: the serialized tree Example: >>> from html5lib import parse, getTr...
[ "def", "render", "(", "self", ",", "treewalker", ",", "encoding", "=", "None", ")", ":", "if", "encoding", ":", "return", "b\"\"", ".", "join", "(", "list", "(", "self", ".", "serialize", "(", "treewalker", ",", "encoding", ")", ")", ")", "else", ":"...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/html5lib/serializer.py#L375-L398
microsoft/onnxruntime
f92e47e95b13a240e37caf7b36577983544f98fc
onnxruntime/python/onnxruntime_inference_collection.py
python
Session.get_session_options
(self)
return self._sess_options
Return the session options. See :class:`onnxruntime.SessionOptions`.
Return the session options. See :class:`onnxruntime.SessionOptions`.
[ "Return", "the", "session", "options", ".", "See", ":", "class", ":", "onnxruntime", ".", "SessionOptions", "." ]
def get_session_options(self): "Return the session options. See :class:`onnxruntime.SessionOptions`." return self._sess_options
[ "def", "get_session_options", "(", "self", ")", ":", "return", "self", ".", "_sess_options" ]
https://github.com/microsoft/onnxruntime/blob/f92e47e95b13a240e37caf7b36577983544f98fc/onnxruntime/python/onnxruntime_inference_collection.py#L107-L109
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scikit-learn/py3/sklearn/decomposition/_fastica.py
python
_sym_decorrelation
(W)
return np.dot(np.dot(u * (1. / np.sqrt(s)), u.T), W)
Symmetric decorrelation i.e. W <- (W * W.T) ^{-1/2} * W
Symmetric decorrelation i.e. W <- (W * W.T) ^{-1/2} * W
[ "Symmetric", "decorrelation", "i", ".", "e", ".", "W", "<", "-", "(", "W", "*", "W", ".", "T", ")", "^", "{", "-", "1", "/", "2", "}", "*", "W" ]
def _sym_decorrelation(W): """ Symmetric decorrelation i.e. W <- (W * W.T) ^{-1/2} * W """ s, u = linalg.eigh(np.dot(W, W.T)) # u (resp. s) contains the eigenvectors (resp. square roots of # the eigenvalues) of W * W.T return np.dot(np.dot(u * (1. / np.sqrt(s)), u.T), W)
[ "def", "_sym_decorrelation", "(", "W", ")", ":", "s", ",", "u", "=", "linalg", ".", "eigh", "(", "np", ".", "dot", "(", "W", ",", "W", ".", "T", ")", ")", "# u (resp. s) contains the eigenvectors (resp. square roots of", "# the eigenvalues) of W * W.T", "return"...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/decomposition/_fastica.py#L52-L59
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/grid.py
python
GridTableMessage.GetCommandInt2
(*args, **kwargs)
return _grid.GridTableMessage_GetCommandInt2(*args, **kwargs)
GetCommandInt2(self) -> int
GetCommandInt2(self) -> int
[ "GetCommandInt2", "(", "self", ")", "-", ">", "int" ]
def GetCommandInt2(*args, **kwargs): """GetCommandInt2(self) -> int""" return _grid.GridTableMessage_GetCommandInt2(*args, **kwargs)
[ "def", "GetCommandInt2", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_grid", ".", "GridTableMessage_GetCommandInt2", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/grid.py#L1103-L1105
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
samples/pySketch/pySketch.py
python
EditTextObjectDialog.objectToDialog
(self, obj)
Copy the properties of the given text object into the dialog box.
Copy the properties of the given text object into the dialog box.
[ "Copy", "the", "properties", "of", "the", "given", "text", "object", "into", "the", "dialog", "box", "." ]
def objectToDialog(self, obj): """ Copy the properties of the given text object into the dialog box. """ self.textCtrl.SetValue(obj.getText()) self.textCtrl.SetSelection(0, len(obj.getText())) self.curFont = obj.getFont() self.textCtrl.SetFont(self.curFont)
[ "def", "objectToDialog", "(", "self", ",", "obj", ")", ":", "self", ".", "textCtrl", ".", "SetValue", "(", "obj", ".", "getText", "(", ")", ")", "self", ".", "textCtrl", ".", "SetSelection", "(", "0", ",", "len", "(", "obj", ".", "getText", "(", ")...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/samples/pySketch/pySketch.py#L3377-L3384
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/stringold.py
python
center
(s, width)
return ' '*half + s + ' '*(n-half)
center(s, width) -> string Return a center version of s, in a field of the specified width. padded with spaces as needed. The string is never truncated.
center(s, width) -> string
[ "center", "(", "s", "width", ")", "-", ">", "string" ]
def center(s, width): """center(s, width) -> string Return a center version of s, in a field of the specified width. padded with spaces as needed. The string is never truncated. """ n = width - len(s) if n <= 0: return s half = n/2 if n%2 and width%2: # This ensures that c...
[ "def", "center", "(", "s", ",", "width", ")", ":", "n", "=", "width", "-", "len", "(", "s", ")", "if", "n", "<=", "0", ":", "return", "s", "half", "=", "n", "/", "2", "if", "n", "%", "2", "and", "width", "%", "2", ":", "# This ensures that ce...
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/stringold.py#L291-L305
Polidea/SiriusObfuscator
b0e590d8130e97856afe578869b83a209e2b19be
SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py
python
SBTypeFormat.GetFormat
(self)
return _lldb.SBTypeFormat_GetFormat(self)
GetFormat(self) -> Format
GetFormat(self) -> Format
[ "GetFormat", "(", "self", ")", "-", ">", "Format" ]
def GetFormat(self): """GetFormat(self) -> Format""" return _lldb.SBTypeFormat_GetFormat(self)
[ "def", "GetFormat", "(", "self", ")", ":", "return", "_lldb", ".", "SBTypeFormat_GetFormat", "(", "self", ")" ]
https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L11210-L11212
freeorion/freeorion
c266a40eccd3a99a17de8fe57c36ef6ba3771665
default/python/AI/FleetUtilsAI.py
python
issue_fleet_orders_for_fleet_missions
()
Issues fleet orders.
Issues fleet orders.
[ "Issues", "fleet", "orders", "." ]
def issue_fleet_orders_for_fleet_missions(): """Issues fleet orders.""" debug("") universe = fo.getUniverse() aistate = get_aistate() fleet_missions = list(aistate.get_all_fleet_missions()) thisround = 0 while thisround < 3: thisround += 1 debug("Issuing fleet orders round %d...
[ "def", "issue_fleet_orders_for_fleet_missions", "(", ")", ":", "debug", "(", "\"\"", ")", "universe", "=", "fo", ".", "getUniverse", "(", ")", "aistate", "=", "get_aistate", "(", ")", "fleet_missions", "=", "list", "(", "aistate", ".", "get_all_fleet_missions", ...
https://github.com/freeorion/freeorion/blob/c266a40eccd3a99a17de8fe57c36ef6ba3771665/default/python/AI/FleetUtilsAI.py#L585-L604
chromiumembedded/cef
80caf947f3fe2210e5344713c5281d8af9bdc295
tools/cefbuilds/cef_json_builder.py
python
cef_json_builder.has_chromium_version
(self, cef_version)
return cef_version in self._versions
Return True if a matching Chromium version is known.
Return True if a matching Chromium version is known.
[ "Return", "True", "if", "a", "matching", "Chromium", "version", "is", "known", "." ]
def has_chromium_version(self, cef_version): """ Return True if a matching Chromium version is known. """ return cef_version in self._versions
[ "def", "has_chromium_version", "(", "self", ",", "cef_version", ")", ":", "return", "cef_version", "in", "self", ".", "_versions" ]
https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/cefbuilds/cef_json_builder.py#L228-L230
LiquidPlayer/LiquidCore
9405979363f2353ac9a71ad8ab59685dd7f919c9
deps/node-10.15.3/tools/jinja2/compiler.py
python
CodeGenerator.simple_write
(self, s, frame, node=None)
Simple shortcut for start_write + write + end_write.
Simple shortcut for start_write + write + end_write.
[ "Simple", "shortcut", "for", "start_write", "+", "write", "+", "end_write", "." ]
def simple_write(self, s, frame, node=None): """Simple shortcut for start_write + write + end_write.""" self.start_write(frame, node) self.write(s) self.end_write(frame)
[ "def", "simple_write", "(", "self", ",", "s", ",", "frame", ",", "node", "=", "None", ")", ":", "self", ".", "start_write", "(", "frame", ",", "node", ")", "self", ".", "write", "(", "s", ")", "self", ".", "end_write", "(", "frame", ")" ]
https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/tools/jinja2/compiler.py#L365-L369
ricardoquesada/Spidermonkey
4a75ea2543408bd1b2c515aa95901523eeef7858
dom/bindings/Codegen.py
python
CGNativeMember.getArgType
(self, type, optional, isMember)
return (decl, ref)
Get the type of an argument declaration. Returns the type CGThing, and whether this should be a const ref. isMember can be False, "Sequence", or "Variadic"
Get the type of an argument declaration. Returns the type CGThing, and whether this should be a const ref.
[ "Get", "the", "type", "of", "an", "argument", "declaration", ".", "Returns", "the", "type", "CGThing", "and", "whether", "this", "should", "be", "a", "const", "ref", "." ]
def getArgType(self, type, optional, isMember): """ Get the type of an argument declaration. Returns the type CGThing, and whether this should be a const ref. isMember can be False, "Sequence", or "Variadic" """ decl, ref, handleNullable = self.doGetArgType(type, option...
[ "def", "getArgType", "(", "self", ",", "type", ",", "optional", ",", "isMember", ")", ":", "decl", ",", "ref", ",", "handleNullable", "=", "self", ".", "doGetArgType", "(", "type", ",", "optional", ",", "isMember", ")", "decl", "=", "CGGeneric", "(", "...
https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/dom/bindings/Codegen.py#L12522-L12543
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/setuptools/py3/setuptools/extern/__init__.py
python
VendorImporter.find_spec
(self, fullname, path=None, target=None)
return ( importlib.util.spec_from_loader(fullname, self) if self._module_matches_namespace(fullname) else None )
Return a module spec for vendored names.
Return a module spec for vendored names.
[ "Return", "a", "module", "spec", "for", "vendored", "names", "." ]
def find_spec(self, fullname, path=None, target=None): """Return a module spec for vendored names.""" return ( importlib.util.spec_from_loader(fullname, self) if self._module_matches_namespace(fullname) else None )
[ "def", "find_spec", "(", "self", ",", "fullname", ",", "path", "=", "None", ",", "target", "=", "None", ")", ":", "return", "(", "importlib", ".", "util", ".", "spec_from_loader", "(", "fullname", ",", "self", ")", "if", "self", ".", "_module_matches_nam...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/extern/__init__.py#L57-L62
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/tensorflow/contrib/learn/python/learn/estimators/autoencoder.py
python
TensorFlowDNNAutoencoder.bias_
(self)
return biases
Returns bias of the autoencoder's bias layers.
Returns bias of the autoencoder's bias layers.
[ "Returns", "bias", "of", "the", "autoencoder", "s", "bias", "layers", "." ]
def bias_(self): """Returns bias of the autoencoder's bias layers.""" biases = [] for layer in range(len(self.hidden_units)): biases.append(self.get_tensor_value( "encoder/dnn/layer%d/Linear/Bias:0" % layer)) for layer in range(len(self.hidden_units)): biases.append(self.get_tensor...
[ "def", "bias_", "(", "self", ")", ":", "biases", "=", "[", "]", "for", "layer", "in", "range", "(", "len", "(", "self", ".", "hidden_units", ")", ")", ":", "biases", ".", "append", "(", "self", ".", "get_tensor_value", "(", "\"encoder/dnn/layer%d/Linear/...
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/learn/python/learn/estimators/autoencoder.py#L116-L126
ablab/spades
3a754192b88540524ce6fb69eef5ea9273a38465
assembler/ext/src/python_libs/joblib3/memory.py
python
MemorizedFunc.load_output
(self, output_dir)
return _load_output(output_dir, _get_func_fullname(self.func), timestamp=self.timestamp, mmap_mode=self.mmap_mode, verbose=self._verbose)
Read the results of a previous calculation from the directory it was cached in.
Read the results of a previous calculation from the directory it was cached in.
[ "Read", "the", "results", "of", "a", "previous", "calculation", "from", "the", "directory", "it", "was", "cached", "in", "." ]
def load_output(self, output_dir): """ Read the results of a previous calculation from the directory it was cached in. """ warnings.warn("MemorizedFunc.load_output is deprecated and will be " "removed in a future version\n" "of joblib. A Me...
[ "def", "load_output", "(", "self", ",", "output_dir", ")", ":", "warnings", ".", "warn", "(", "\"MemorizedFunc.load_output is deprecated and will be \"", "\"removed in a future version\\n\"", "\"of joblib. A MemorizedResult provides similar features\"", ",", "DeprecationWarning", "...
https://github.com/ablab/spades/blob/3a754192b88540524ce6fb69eef5ea9273a38465/assembler/ext/src/python_libs/joblib3/memory.py#L756-L767
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
qt/applications/workbench/workbench/projectrecovery/projectrecovery.py
python
ProjectRecovery.check_for_recover_checkpoint
(self)
Should a recovery attempt/offer occur? :return: Boolean; True if recover else False
Should a recovery attempt/offer occur? :return: Boolean; True if recover else False
[ "Should", "a", "recovery", "attempt", "/", "offer", "occur?", ":", "return", ":", "Boolean", ";", "True", "if", "recover", "else", "False" ]
def check_for_recover_checkpoint(self): """ Should a recovery attempt/offer occur? :return: Boolean; True if recover else False """ try: # Clean directory first self._remove_empty_folders_from_dir(self.recovery_directory_hostname) # One pid_ch...
[ "def", "check_for_recover_checkpoint", "(", "self", ")", ":", "try", ":", "# Clean directory first", "self", ".", "_remove_empty_folders_from_dir", "(", "self", ".", "recovery_directory_hostname", ")", "# One pid_checkpoint equals one mantid process. If the number of checkpoints is...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/applications/workbench/workbench/projectrecovery/projectrecovery.py#L212-L232
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/random_seed.py
python
set_seed
(seed)
Sets the graph-level random seed. Operations that rely on a random seed actually derive it from two seeds: the graph-level and operation-level seeds. This sets the graph-level seed. Its interactions with operation-level seeds is as follows: 1. If neither the graph-level nor the operation seed is set: ...
Sets the graph-level random seed.
[ "Sets", "the", "graph", "-", "level", "random", "seed", "." ]
def set_seed(seed): """Sets the graph-level random seed. Operations that rely on a random seed actually derive it from two seeds: the graph-level and operation-level seeds. This sets the graph-level seed. Its interactions with operation-level seeds is as follows: 1. If neither the graph-level nor the ope...
[ "def", "set_seed", "(", "seed", ")", ":", "# TODO(go/tf2-random): change doc, update to match design doc", "set_random_seed", "(", "seed", ")" ]
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/random_seed.py#L190-L286
bigartm/bigartm
47e37f982de87aa67bfd475ff1f39da696b181b3
3rdparty/protobuf-3.0.0/python/mox.py
python
SameElementsAs.__init__
(self, expected_seq)
Initialize. Args: expected_seq: a sequence
Initialize.
[ "Initialize", "." ]
def __init__(self, expected_seq): """Initialize. Args: expected_seq: a sequence """ self._expected_seq = expected_seq
[ "def", "__init__", "(", "self", ",", "expected_seq", ")", ":", "self", ".", "_expected_seq", "=", "expected_seq" ]
https://github.com/bigartm/bigartm/blob/47e37f982de87aa67bfd475ff1f39da696b181b3/3rdparty/protobuf-3.0.0/python/mox.py#L1012-L1019
ros-controls/ros_control
53c2487d1b56a40f1d00b06c49512aa7fd2bf465
controller_manager_msgs/src/controller_manager_msgs/utils.py
python
ControllerLister.__init__
(self, namespace='/controller_manager')
@param namespace Namespace of controller manager to monitor. @type namespace str
[]
def __init__(self, namespace='/controller_manager'): """ @param namespace Namespace of controller manager to monitor. @type namespace str """ self._srv_name = namespace + '/' + _LIST_CONTROLLERS_STR self._srv = self._make_srv()
[ "def", "__init__", "(", "self", ",", "namespace", "=", "'/controller_manager'", ")", ":", "self", ".", "_srv_name", "=", "namespace", "+", "'/'", "+", "_LIST_CONTROLLERS_STR", "self", ".", "_srv", "=", "self", ".", "_make_srv", "(", ")" ]
https://github.com/ros-controls/ros_control/blob/53c2487d1b56a40f1d00b06c49512aa7fd2bf465/controller_manager_msgs/src/controller_manager_msgs/utils.py#L219-L225
chromiumembedded/cef
80caf947f3fe2210e5344713c5281d8af9bdc295
tools/yapf/yapf/yapflib/format_decision_state.py
python
FormatDecisionState.AddTokenToState
(self, newline, dry_run, must_split=False)
return self.MoveStateToNextToken() + penalty
Add a token to the format decision state. Allow the heuristic to try out adding the token with and without a newline. Later on, the algorithm will determine which one has the lowest penalty. Arguments: newline: (bool) Add the token on a new line if True. dry_run: (bool) Don't commit whitespace...
Add a token to the format decision state.
[ "Add", "a", "token", "to", "the", "format", "decision", "state", "." ]
def AddTokenToState(self, newline, dry_run, must_split=False): """Add a token to the format decision state. Allow the heuristic to try out adding the token with and without a newline. Later on, the algorithm will determine which one has the lowest penalty. Arguments: newline: (bool) Add the toke...
[ "def", "AddTokenToState", "(", "self", ",", "newline", ",", "dry_run", ",", "must_split", "=", "False", ")", ":", "penalty", "=", "0", "if", "newline", ":", "penalty", "=", "self", ".", "_AddTokenOnNewline", "(", "dry_run", ",", "must_split", ")", "else", ...
https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/yapf/yapf/yapflib/format_decision_state.py#L416-L437
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/dataset/engine/validators.py
python
check_repeat
(method)
return new_method
check the input arguments of repeat.
check the input arguments of repeat.
[ "check", "the", "input", "arguments", "of", "repeat", "." ]
def check_repeat(method): """check the input arguments of repeat.""" @wraps(method) def new_method(self, *args, **kwargs): [count], _ = parse_user_args(method, *args, **kwargs) type_check(count, (int, type(None)), "repeat") if isinstance(count, int): if (count <= 0 and ...
[ "def", "check_repeat", "(", "method", ")", ":", "@", "wraps", "(", "method", ")", "def", "new_method", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "[", "count", "]", ",", "_", "=", "parse_user_args", "(", "method", ",", "*", ...
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/engine/validators.py#L1146-L1159
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/ipython/py2/IPython/terminal/ipapp.py
python
TerminalIPythonApp.parse_command_line
(self, argv=None)
return super(TerminalIPythonApp, self).parse_command_line(argv)
override to allow old '-pylab' flag with deprecation warning
override to allow old '-pylab' flag with deprecation warning
[ "override", "to", "allow", "old", "-", "pylab", "flag", "with", "deprecation", "warning" ]
def parse_command_line(self, argv=None): """override to allow old '-pylab' flag with deprecation warning""" argv = sys.argv[1:] if argv is None else argv if '-pylab' in argv: # deprecated `-pylab` given, # warn and transform into current syntax argv = argv[:...
[ "def", "parse_command_line", "(", "self", ",", "argv", "=", "None", ")", ":", "argv", "=", "sys", ".", "argv", "[", "1", ":", "]", "if", "argv", "is", "None", "else", "argv", "if", "'-pylab'", "in", "argv", ":", "# deprecated `-pylab` given,", "# warn an...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/terminal/ipapp.py#L288-L302
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/tensorflow/python/framework/ops.py
python
Graph.container
(self, container_name)
Returns a context manager that specifies the resource container to use. Stateful operations, such as variables and queues, can maintain their states on devices so that they can be shared by multiple processes. A resource container is a string name under which these stateful operations are tracked. Thes...
Returns a context manager that specifies the resource container to use.
[ "Returns", "a", "context", "manager", "that", "specifies", "the", "resource", "container", "to", "use", "." ]
def container(self, container_name): """Returns a context manager that specifies the resource container to use. Stateful operations, such as variables and queues, can maintain their states on devices so that they can be shared by multiple processes. A resource container is a string name under which the...
[ "def", "container", "(", "self", ",", "container_name", ")", ":", "original_container", "=", "self", ".", "_container", "try", ":", "self", ".", "_container", "=", "container_name", "yield", "self", ".", "_container", "finally", ":", "self", ".", "_container",...
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/framework/ops.py#L3021-L3070
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/monitors.py
python
get_default_monitors
(loss_op=None, summary_op=None, save_summary_steps=100, output_dir=None, summary_writer=None)
return monitors
Returns a default set of typically-used monitors. Args: loss_op: `Tensor`, the loss tensor. This will be printed using `PrintTensor` at the default interval. summary_op: See `SummarySaver`. save_summary_steps: See `SummarySaver`. output_dir: See `SummarySaver`. summary_writer: See `Summ...
Returns a default set of typically-used monitors.
[ "Returns", "a", "default", "set", "of", "typically", "-", "used", "monitors", "." ]
def get_default_monitors(loss_op=None, summary_op=None, save_summary_steps=100, output_dir=None, summary_writer=None): """Returns a default set of typically-used monitors. Args: loss_op: `Tensor`, the loss tenso...
[ "def", "get_default_monitors", "(", "loss_op", "=", "None", ",", "summary_op", "=", "None", ",", "save_summary_steps", "=", "100", ",", "output_dir", "=", "None", ",", "summary_writer", "=", "None", ")", ":", "monitors", "=", "[", "]", "if", "loss_op", "is...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/monitors.py#L831-L859
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/tensorflow/python/ops/linalg_ops.py
python
batch_self_adjoint_eig
(tensor, name=None)
return e, v
Computes the eigen decomposition of a batch of self-adjoint matrices. Computes the eigenvalues and eigenvectors of the innermost N-by-N matrices in `tensor` such that `tensor[...,:,:] * v[..., :,i] = e(..., i) * v[...,:,i]`, for i=0...N-1. Args: tensor: `Tensor` of shape `[..., N, N]`. name: string, o...
Computes the eigen decomposition of a batch of self-adjoint matrices.
[ "Computes", "the", "eigen", "decomposition", "of", "a", "batch", "of", "self", "-", "adjoint", "matrices", "." ]
def batch_self_adjoint_eig(tensor, name=None): """Computes the eigen decomposition of a batch of self-adjoint matrices. Computes the eigenvalues and eigenvectors of the innermost N-by-N matrices in `tensor` such that `tensor[...,:,:] * v[..., :,i] = e(..., i) * v[...,:,i]`, for i=0...N-1. Args: tensor: ...
[ "def", "batch_self_adjoint_eig", "(", "tensor", ",", "name", "=", "None", ")", ":", "e", ",", "v", "=", "gen_linalg_ops", ".", "batch_self_adjoint_eig_v2", "(", "tensor", ",", "compute_v", "=", "True", ",", "name", "=", "name", ")", "return", "e", ",", "...
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/linalg_ops.py#L427-L446
FreeCAD/FreeCAD
ba42231b9c6889b89e064d6d563448ed81e376ec
src/Mod/Arch/ArchVRM.py
python
Renderer.isVisible
(self,face)
return False
returns True if the given face points in the view direction
returns True if the given face points in the view direction
[ "returns", "True", "if", "the", "given", "face", "points", "in", "the", "view", "direction" ]
def isVisible(self,face): "returns True if the given face points in the view direction" normal = face[0].normalAt(0,0) if DEBUG: print("checking face normal ", normal, " against ", self.wp.axis, " : ", math.degrees(normal.getAngle(self.wp.axis))) if normal.getAngle(self.wp.axis) < math.p...
[ "def", "isVisible", "(", "self", ",", "face", ")", ":", "normal", "=", "face", "[", "0", "]", ".", "normalAt", "(", "0", ",", "0", ")", "if", "DEBUG", ":", "print", "(", "\"checking face normal \"", ",", "normal", ",", "\" against \"", ",", "self", "...
https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Arch/ArchVRM.py#L147-L153
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/_controls.py
python
ListCtrl.SetImageList
(*args, **kwargs)
return _controls_.ListCtrl_SetImageList(*args, **kwargs)
SetImageList(self, ImageList imageList, int which)
SetImageList(self, ImageList imageList, int which)
[ "SetImageList", "(", "self", "ImageList", "imageList", "int", "which", ")" ]
def SetImageList(*args, **kwargs): """SetImageList(self, ImageList imageList, int which)""" return _controls_.ListCtrl_SetImageList(*args, **kwargs)
[ "def", "SetImageList", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_controls_", ".", "ListCtrl_SetImageList", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L4613-L4615
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/media.py
python
MediaCtrl.LoadURIWithProxy
(*args, **kwargs)
return _media.MediaCtrl_LoadURIWithProxy(*args, **kwargs)
LoadURIWithProxy(self, String fileName, String proxy) -> bool
LoadURIWithProxy(self, String fileName, String proxy) -> bool
[ "LoadURIWithProxy", "(", "self", "String", "fileName", "String", "proxy", ")", "-", ">", "bool" ]
def LoadURIWithProxy(*args, **kwargs): """LoadURIWithProxy(self, String fileName, String proxy) -> bool""" return _media.MediaCtrl_LoadURIWithProxy(*args, **kwargs)
[ "def", "LoadURIWithProxy", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_media", ".", "MediaCtrl_LoadURIWithProxy", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/media.py#L165-L167
kamyu104/LeetCode-Solutions
77605708a927ea3b85aee5a479db733938c7c211
Python/unique-substrings-with-equal-digit-frequency.py
python
Solution.equalDigitFrequency
(self, s)
return len(lookup)
:type s: str :rtype: int
:type s: str :rtype: int
[ ":", "type", "s", ":", "str", ":", "rtype", ":", "int" ]
def equalDigitFrequency(self, s): """ :type s: str :rtype: int """ MOD = 10**9+7 D = 27 lookup = set() for i in xrange(len(s)): cnt = collections.Counter() h = max_cnt = 0 for j in xrange(i, len(s)): d = ...
[ "def", "equalDigitFrequency", "(", "self", ",", "s", ")", ":", "MOD", "=", "10", "**", "9", "+", "7", "D", "=", "27", "lookup", "=", "set", "(", ")", "for", "i", "in", "xrange", "(", "len", "(", "s", ")", ")", ":", "cnt", "=", "collections", ...
https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/unique-substrings-with-equal-digit-frequency.py#L9-L27
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/model.py
python
DenormalizedStructureBuilder.with_members
(self, members)
return self
:type members: dict :param members: The denormalized members. :return: self
[]
def with_members(self, members): """ :type members: dict :param members: The denormalized members. :return: self """ self._members = members return self
[ "def", "with_members", "(", "self", ",", "members", ")", ":", "self", ".", "_members", "=", "members", "return", "self" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/model.py#L649-L659
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/python/ops/control_flow_ops.py
python
ControlFlowState.ZerosLikeForExit
(self, val)
return result
Create zeros_like gradient for a loop exit. If the result of a loop variable is not used but is involved in computing the result of some needed loop variable, we create a zero-valued tensor that is fed as gradient for the Exit node of that loop variable. Note that val.op is an Exit, and this method mus...
Create zeros_like gradient for a loop exit.
[ "Create", "zeros_like", "gradient", "for", "a", "loop", "exit", "." ]
def ZerosLikeForExit(self, val): """Create zeros_like gradient for a loop exit. If the result of a loop variable is not used but is involved in computing the result of some needed loop variable, we create a zero-valued tensor that is fed as gradient for the Exit node of that loop variable. Note tha...
[ "def", "ZerosLikeForExit", "(", "self", ",", "val", ")", ":", "val_shape", "=", "val", ".", "get_shape", "(", ")", "forward_ctxt", "=", "val", ".", "op", ".", "_get_control_flow_context", "(", ")", "outer_forward_ctxt", "=", "forward_ctxt", ".", "outer_context...
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/control_flow_ops.py#L1105-L1158
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/xml/dom/expatbuilder.py
python
Namespaces.createParser
(self)
return parser
Create a new namespace-handling parser.
Create a new namespace-handling parser.
[ "Create", "a", "new", "namespace", "-", "handling", "parser", "." ]
def createParser(self): """Create a new namespace-handling parser.""" parser = expat.ParserCreate(namespace_separator=" ") parser.namespace_prefixes = True return parser
[ "def", "createParser", "(", "self", ")", ":", "parser", "=", "expat", ".", "ParserCreate", "(", "namespace_separator", "=", "\" \"", ")", "parser", ".", "namespace_prefixes", "=", "True", "return", "parser" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/xml/dom/expatbuilder.py#L719-L723
microsoft/EdgeML
ef9f8a77f096acbdeb941014791f8eda1c1bc35b
applications/GesturePod/training/generateFeatures.py
python
threadFeatureExtractor
(df, hyperParams, isDebug, collapse=True, NUM_THREADS = 1)
return df
Takes the given data frame and breaks it down into smaller chunks
Takes the given data frame and breaks it down into smaller chunks
[ "Takes", "the", "given", "data", "frame", "and", "breaks", "it", "down", "into", "smaller", "chunks" ]
def threadFeatureExtractor(df, hyperParams, isDebug, collapse=True, NUM_THREADS = 1): ''' Takes the given data frame and breaks it down into smaller chunks ''' # split dataframe print("\n Starting splitting of data frame") numDataFrames = NUM_THREADS dataFrame...
[ "def", "threadFeatureExtractor", "(", "df", ",", "hyperParams", ",", "isDebug", ",", "collapse", "=", "True", ",", "NUM_THREADS", "=", "1", ")", ":", "# split dataframe", "print", "(", "\"\\n Starting splitting of data frame\"", ")", "numDataFrames", "=", "NUM_THREA...
https://github.com/microsoft/EdgeML/blob/ef9f8a77f096acbdeb941014791f8eda1c1bc35b/applications/GesturePod/training/generateFeatures.py#L305-L332
quantOS-org/DataCore
e2ef9bd2c22ee9e2845675b6435a14fa607f3551
mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/text_format.py
python
ParseBool
(text)
Parse a boolean value. Args: text: Text to parse. Returns: Boolean values parsed Raises: ValueError: If text is not a valid boolean.
Parse a boolean value.
[ "Parse", "a", "boolean", "value", "." ]
def ParseBool(text): """Parse a boolean value. Args: text: Text to parse. Returns: Boolean values parsed Raises: ValueError: If text is not a valid boolean. """ if text in ('true', 't', '1'): return True elif text in ('false', 'f', '0'): return False else: raise ValueError('Ex...
[ "def", "ParseBool", "(", "text", ")", ":", "if", "text", "in", "(", "'true'", ",", "'t'", ",", "'1'", ")", ":", "return", "True", "elif", "text", "in", "(", "'false'", ",", "'f'", ",", "'0'", ")", ":", "return", "False", "else", ":", "raise", "Va...
https://github.com/quantOS-org/DataCore/blob/e2ef9bd2c22ee9e2845675b6435a14fa607f3551/mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/text_format.py#L686-L703
facebook/ThreatExchange
31914a51820c73c8a0daffe62ccca29a6e3d359e
hasher-matcher-actioner/hmalib/scripts/cli/soak.py
python
SoakShell.do_update_batch_size
(self, arg)
Update batch size: update_batch_size 5
Update batch size: update_batch_size 5
[ "Update", "batch", "size", ":", "update_batch_size", "5" ]
def do_update_batch_size(self, arg): "Update batch size: update_batch_size 5" if self._valid_update(arg): self.submitter.set_batch_size(int(arg)) self.batch_size_cache = int(arg) print(f"Updated batch_size to {self.batch_size_cache}")
[ "def", "do_update_batch_size", "(", "self", ",", "arg", ")", ":", "if", "self", ".", "_valid_update", "(", "arg", ")", ":", "self", ".", "submitter", ".", "set_batch_size", "(", "int", "(", "arg", ")", ")", "self", ".", "batch_size_cache", "=", "int", ...
https://github.com/facebook/ThreatExchange/blob/31914a51820c73c8a0daffe62ccca29a6e3d359e/hasher-matcher-actioner/hmalib/scripts/cli/soak.py#L297-L302
calamares/calamares
9f6f82405b3074af7c99dc26487d2e46e4ece3e5
src/modules/packages/main.py
python
PackageManager.operation_remove
(self, package_list)
Removes the list of packages named in @p package_list . These can be strings -- plain package names -- or structures (with a pre- and post-install step). This operation is called for "critical" packages, which are expected to succeed or fail all together. However, if there are p...
Removes the list of packages named in @p package_list . These can be strings -- plain package names -- or structures (with a pre- and post-install step).
[ "Removes", "the", "list", "of", "packages", "named", "in", "@p", "package_list", ".", "These", "can", "be", "strings", "--", "plain", "package", "names", "--", "or", "structures", "(", "with", "a", "pre", "-", "and", "post", "-", "install", "step", ")", ...
def operation_remove(self, package_list): """ Removes the list of packages named in @p package_list . These can be strings -- plain package names -- or structures (with a pre- and post-install step). This operation is called for "critical" packages, which are expected to...
[ "def", "operation_remove", "(", "self", ",", "package_list", ")", ":", "if", "all", "(", "[", "isinstance", "(", "x", ",", "str", ")", "for", "x", "in", "package_list", "]", ")", ":", "self", ".", "remove", "(", "package_list", ")", "else", ":", "for...
https://github.com/calamares/calamares/blob/9f6f82405b3074af7c99dc26487d2e46e4ece3e5/src/modules/packages/main.py#L203-L221
sigmaai/self-driving-golf-cart
8d891600af3d851add27a10ae45cf3c2108bb87c
ros/src/ros_carla_bridge/carla_ros_bridge/src/carla_ros_bridge/carla_status_publisher.py
python
CarlaStatusPublisher.set_frame
(self, frame)
set the value 'synchronous_mode_running'
set the value 'synchronous_mode_running'
[ "set", "the", "value", "synchronous_mode_running" ]
def set_frame(self, frame): """ set the value 'synchronous_mode_running' """ if self.frame != frame: self.frame = frame self.publish()
[ "def", "set_frame", "(", "self", ",", "frame", ")", ":", "if", "self", ".", "frame", "!=", "frame", ":", "self", ".", "frame", "=", "frame", "self", ".", "publish", "(", ")" ]
https://github.com/sigmaai/self-driving-golf-cart/blob/8d891600af3d851add27a10ae45cf3c2108bb87c/ros/src/ros_carla_bridge/carla_ros_bridge/src/carla_ros_bridge/carla_status_publisher.py#L57-L63
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/site-packages/urllib3/util/retry.py
python
Retry._is_connection_error
(self, err)
return isinstance(err, ConnectTimeoutError)
Errors when we're fairly sure that the server did not receive the request, so it should be safe to retry.
Errors when we're fairly sure that the server did not receive the request, so it should be safe to retry.
[ "Errors", "when", "we", "re", "fairly", "sure", "that", "the", "server", "did", "not", "receive", "the", "request", "so", "it", "should", "be", "safe", "to", "retry", "." ]
def _is_connection_error(self, err): """ Errors when we're fairly sure that the server did not receive the request, so it should be safe to retry. """ return isinstance(err, ConnectTimeoutError)
[ "def", "_is_connection_error", "(", "self", ",", "err", ")", ":", "return", "isinstance", "(", "err", ",", "ConnectTimeoutError", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/urllib3/util/retry.py#L305-L309
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/protobuf/py2/google/protobuf/internal/well_known_types.py
python
Any.Is
(self, descriptor)
return '/' in self.type_url and self.TypeName() == descriptor.full_name
Checks if this Any represents the given protobuf type.
Checks if this Any represents the given protobuf type.
[ "Checks", "if", "this", "Any", "represents", "the", "given", "protobuf", "type", "." ]
def Is(self, descriptor): """Checks if this Any represents the given protobuf type.""" return '/' in self.type_url and self.TypeName() == descriptor.full_name
[ "def", "Is", "(", "self", ",", "descriptor", ")", ":", "return", "'/'", "in", "self", ".", "type_url", "and", "self", ".", "TypeName", "(", ")", "==", "descriptor", ".", "full_name" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py2/google/protobuf/internal/well_known_types.py#L94-L96
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/layers/recurrent.py
python
_is_multiple_state
(state_size)
return (hasattr(state_size, '__len__') and not isinstance(state_size, tensor_shape.TensorShape))
Check whether the state_size contains multiple states.
Check whether the state_size contains multiple states.
[ "Check", "whether", "the", "state_size", "contains", "multiple", "states", "." ]
def _is_multiple_state(state_size): """Check whether the state_size contains multiple states.""" return (hasattr(state_size, '__len__') and not isinstance(state_size, tensor_shape.TensorShape))
[ "def", "_is_multiple_state", "(", "state_size", ")", ":", "return", "(", "hasattr", "(", "state_size", ",", "'__len__'", ")", "and", "not", "isinstance", "(", "state_size", ",", "tensor_shape", ".", "TensorShape", ")", ")" ]
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/layers/recurrent.py#L2742-L2745
gem5/gem5
141cc37c2d4b93959d4c249b8f7e6a8b2ef75338
src/mem/slicc/parser.py
python
SLICC.p_idents__braced
(self, p)
idents : '{' identx '}
idents : '{' identx '}
[ "idents", ":", "{", "identx", "}" ]
def p_idents__braced(self, p): "idents : '{' identx '}'" p[0] = p[2]
[ "def", "p_idents__braced", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "p", "[", "2", "]" ]
https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/mem/slicc/parser.py#L508-L510
FEniCS/dolfinx
3dfdf038cccdb70962865b58a63bf29c2e55ec6e
utils/pylit/pylit.py
python
Code2Text.header_handler
(self, lines)
Format leading code block
Format leading code block
[ "Format", "leading", "code", "block" ]
def header_handler(self, lines): """Format leading code block""" if self.strip == True: return # get iterator over the lines that formats them as code-block lines = iter(self.code_block_handler(lines)) # prepend header string to first line yield self.header_st...
[ "def", "header_handler", "(", "self", ",", "lines", ")", ":", "if", "self", ".", "strip", "==", "True", ":", "return", "# get iterator over the lines that formats them as code-block", "lines", "=", "iter", "(", "self", ".", "code_block_handler", "(", "lines", ")",...
https://github.com/FEniCS/dolfinx/blob/3dfdf038cccdb70962865b58a63bf29c2e55ec6e/utils/pylit/pylit.py#L908-L918
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mhlib.py
python
MH.listsubfolders
(self, name)
return subfolders
Return the names of the subfolders in a given folder (prefixed with the given folder name).
Return the names of the subfolders in a given folder (prefixed with the given folder name).
[ "Return", "the", "names", "of", "the", "subfolders", "in", "a", "given", "folder", "(", "prefixed", "with", "the", "given", "folder", "name", ")", "." ]
def listsubfolders(self, name): """Return the names of the subfolders in a given folder (prefixed with the given folder name).""" fullname = os.path.join(self.path, name) # Get the link count so we can avoid listing folders # that have no subfolders. nlinks = os.stat(full...
[ "def", "listsubfolders", "(", "self", ",", "name", ")", ":", "fullname", "=", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "name", ")", "# Get the link count so we can avoid listing folders", "# that have no subfolders.", "nlinks", "=", "os", "...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mhlib.py#L155-L177
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/_extends/parse/standard_method.py
python
const_tensor_to_bool
(x)
convert bool tensor to bool condition
convert bool tensor to bool condition
[ "convert", "bool", "tensor", "to", "bool", "condition" ]
def const_tensor_to_bool(x): """convert bool tensor to bool condition""" if x is None: raise ValueError("Only tensor which shape is () or (1,) can be converted to bool, but got None") x = x.asnumpy() if x.shape == (): return bool(x) if x.shape == (1,): return bool(x[0]) r...
[ "def", "const_tensor_to_bool", "(", "x", ")", ":", "if", "x", "is", "None", ":", "raise", "ValueError", "(", "\"Only tensor which shape is () or (1,) can be converted to bool, but got None\"", ")", "x", "=", "x", ".", "asnumpy", "(", ")", "if", "x", ".", "shape", ...
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/_extends/parse/standard_method.py#L1614-L1624
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/importlib/abc.py
python
PathEntryFinder.invalidate_caches
(self)
An optional method for clearing the finder's cache, if any. This method is used by PathFinder.invalidate_caches().
An optional method for clearing the finder's cache, if any. This method is used by PathFinder.invalidate_caches().
[ "An", "optional", "method", "for", "clearing", "the", "finder", "s", "cache", "if", "any", ".", "This", "method", "is", "used", "by", "PathFinder", ".", "invalidate_caches", "()", "." ]
def invalidate_caches(self): """An optional method for clearing the finder's cache, if any. This method is used by PathFinder.invalidate_caches(). """
[ "def", "invalidate_caches", "(", "self", ")", ":" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/importlib/abc.py#L128-L131
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/contrib/factorization/python/ops/clustering_ops.py
python
KMeans.__init__
(self, inputs, num_clusters, initial_clusters=RANDOM_INIT, distance_metric=SQUARED_EUCLIDEAN_DISTANCE, use_mini_batch=False, random_seed=0, kmeans_plus_plus_num_retries=2)
Creates an object for generating KMeans clustering graph. Args: inputs: An input tensor or list of input tensors num_clusters: number of clusters. initial_clusters: Specifies the clusters used during initialization. Can be a tensor or numpy array, or a function that generates the cluster...
Creates an object for generating KMeans clustering graph.
[ "Creates", "an", "object", "for", "generating", "KMeans", "clustering", "graph", "." ]
def __init__(self, inputs, num_clusters, initial_clusters=RANDOM_INIT, distance_metric=SQUARED_EUCLIDEAN_DISTANCE, use_mini_batch=False, random_seed=0, kmeans_plus_plus_num_retries=2): """Creates an object for g...
[ "def", "__init__", "(", "self", ",", "inputs", ",", "num_clusters", ",", "initial_clusters", "=", "RANDOM_INIT", ",", "distance_metric", "=", "SQUARED_EUCLIDEAN_DISTANCE", ",", "use_mini_batch", "=", "False", ",", "random_seed", "=", "0", ",", "kmeans_plus_plus_num_...
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/factorization/python/ops/clustering_ops.py#L52-L87
sailing-pmls/bosen
06cb58902d011fbea5f9428f10ce30e621492204
style_script/cpplint.py
python
NestingState.InClassDeclaration
(self)
return self.stack and isinstance(self.stack[-1], _ClassInfo)
Check if we are currently one level inside a class or struct declaration. Returns: True if top of the stack is a class/struct, False otherwise.
Check if we are currently one level inside a class or struct declaration.
[ "Check", "if", "we", "are", "currently", "one", "level", "inside", "a", "class", "or", "struct", "declaration", "." ]
def InClassDeclaration(self): """Check if we are currently one level inside a class or struct declaration. Returns: True if top of the stack is a class/struct, False otherwise. """ return self.stack and isinstance(self.stack[-1], _ClassInfo)
[ "def", "InClassDeclaration", "(", "self", ")", ":", "return", "self", ".", "stack", "and", "isinstance", "(", "self", ".", "stack", "[", "-", "1", "]", ",", "_ClassInfo", ")" ]
https://github.com/sailing-pmls/bosen/blob/06cb58902d011fbea5f9428f10ce30e621492204/style_script/cpplint.py#L2250-L2256
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Source/ThirdParty/CEF3/cef_source/tools/cef_parser.py
python
obj_analysis.is_byaddr
(self)
return self.isbyaddr
Returns true if the argument is passed by address.
Returns true if the argument is passed by address.
[ "Returns", "true", "if", "the", "argument", "is", "passed", "by", "address", "." ]
def is_byaddr(self): """ Returns true if the argument is passed by address. """ return self.isbyaddr
[ "def", "is_byaddr", "(", "self", ")", ":", "return", "self", ".", "isbyaddr" ]
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Source/ThirdParty/CEF3/cef_source/tools/cef_parser.py#L1767-L1769
wujixiu/helmet-detection
8eff5c59ddfba5a29e0b76aeb48babcb49246178
hardhat-wearing-detection/SSD-RPA/python/caffe/io.py
python
Transformer.set_channel_swap
(self, in_, order)
Set the input channel order for e.g. RGB to BGR conversion as needed for the reference ImageNet model. N.B. this assumes the channels are the first dimension AFTER transpose. Parameters ---------- in_ : which input to assign this channel order order : the order to take t...
Set the input channel order for e.g. RGB to BGR conversion as needed for the reference ImageNet model. N.B. this assumes the channels are the first dimension AFTER transpose.
[ "Set", "the", "input", "channel", "order", "for", "e", ".", "g", ".", "RGB", "to", "BGR", "conversion", "as", "needed", "for", "the", "reference", "ImageNet", "model", ".", "N", ".", "B", ".", "this", "assumes", "the", "channels", "are", "the", "first"...
def set_channel_swap(self, in_, order): """ Set the input channel order for e.g. RGB to BGR conversion as needed for the reference ImageNet model. N.B. this assumes the channels are the first dimension AFTER transpose. Parameters ---------- in_ : which input to a...
[ "def", "set_channel_swap", "(", "self", ",", "in_", ",", "order", ")", ":", "self", ".", "__check_input", "(", "in_", ")", "if", "len", "(", "order", ")", "!=", "self", ".", "inputs", "[", "in_", "]", "[", "1", "]", ":", "raise", "Exception", "(", ...
https://github.com/wujixiu/helmet-detection/blob/8eff5c59ddfba5a29e0b76aeb48babcb49246178/hardhat-wearing-detection/SSD-RPA/python/caffe/io.py#L203-L219
facebookincubator/profilo
d3a275d0e7897cc4e3507d543459f3227e85c67f
python/profilo/model/intervals.py
python
Interval.find_interval
(self, interval)
return self
Find the smallest containing interval nested under this interval.
Find the smallest containing interval nested under this interval.
[ "Find", "the", "smallest", "containing", "interval", "nested", "under", "this", "interval", "." ]
def find_interval(self, interval): """Find the smallest containing interval nested under this interval.""" if not interval in self: return None begin = interval.begin if isinstance(interval, Interval) else interval child_idx = bisect.bisect_right(self.__children_begins, be...
[ "def", "find_interval", "(", "self", ",", "interval", ")", ":", "if", "not", "interval", "in", "self", ":", "return", "None", "begin", "=", "interval", ".", "begin", "if", "isinstance", "(", "interval", ",", "Interval", ")", "else", "interval", "child_idx"...
https://github.com/facebookincubator/profilo/blob/d3a275d0e7897cc4e3507d543459f3227e85c67f/python/profilo/model/intervals.py#L49-L65
oracle/graaljs
36a56e8e993d45fc40939a3a4d9c0c24990720f1
graal-nodejs/tools/inspector_protocol/jinja2/parser.py
python
Parser.parse_set
(self)
return nodes.AssignBlock(target, filter_node, body, lineno=lineno)
Parse an assign statement.
Parse an assign statement.
[ "Parse", "an", "assign", "statement", "." ]
def parse_set(self): """Parse an assign statement.""" lineno = next(self.stream).lineno target = self.parse_assign_target(with_namespace=True) if self.stream.skip_if('assign'): expr = self.parse_tuple() return nodes.Assign(target, expr, lineno=lineno) filt...
[ "def", "parse_set", "(", "self", ")", ":", "lineno", "=", "next", "(", "self", ".", "stream", ")", ".", "lineno", "target", "=", "self", ".", "parse_assign_target", "(", "with_namespace", "=", "True", ")", "if", "self", ".", "stream", ".", "skip_if", "...
https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/inspector_protocol/jinja2/parser.py#L176-L186
PyMesh/PyMesh
384ba882b7558ba6e8653ed263c419226c22bddf
python/pymesh/map_attributes.py
python
map_corner_attribute
(mesh1, mesh2, attr_name, bvh=None)
Map per-vertex per-face attribute from mesh1 to mesh2 based on closest points. Args: mesh1 (:class:`Mesh`): Source mesh, where the attribute is defined. mesh2 (:class:`Mesh`): Target mesh, where the attribute is mapped to. attr_name (``string``): Attribute name. bvh (:class:`BVH`): ...
Map per-vertex per-face attribute from mesh1 to mesh2 based on closest points.
[ "Map", "per", "-", "vertex", "per", "-", "face", "attribute", "from", "mesh1", "to", "mesh2", "based", "on", "closest", "points", "." ]
def map_corner_attribute(mesh1, mesh2, attr_name, bvh=None): """ Map per-vertex per-face attribute from mesh1 to mesh2 based on closest points. Args: mesh1 (:class:`Mesh`): Source mesh, where the attribute is defined. mesh2 (:class:`Mesh`): Target mesh, where the attribute is mapped to. ...
[ "def", "map_corner_attribute", "(", "mesh1", ",", "mesh2", ",", "attr_name", ",", "bvh", "=", "None", ")", ":", "assert", "(", "mesh1", ".", "dim", "==", "mesh2", ".", "dim", ")", "assert", "(", "mesh1", ".", "vertex_per_face", "==", "3", ")", "assert"...
https://github.com/PyMesh/PyMesh/blob/384ba882b7558ba6e8653ed263c419226c22bddf/python/pymesh/map_attributes.py#L82-L147
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/XRCed/XMLTree.py
python
XMLTree.FlushSubtree
(self, item, node)
Update all items after changes in model.
Update all items after changes in model.
[ "Update", "all", "items", "after", "changes", "in", "model", "." ]
def FlushSubtree(self, item, node): '''Update all items after changes in model.''' if item is None or item == self.root: self.Flush() return self.DeleteChildren(item) className = node.getAttribute('class') try: comp = Manager.components[classNa...
[ "def", "FlushSubtree", "(", "self", ",", "item", ",", "node", ")", ":", "if", "item", "is", "None", "or", "item", "==", "self", ".", "root", ":", "self", ".", "Flush", "(", ")", "return", "self", ".", "DeleteChildren", "(", "item", ")", "className", ...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/XRCed/XMLTree.py#L137-L151
scribusproject/scribus
41ec7c775a060912cf251682a8b1437f753f80f4
codegen/cheetah/Cheetah/CacheRegion.py
python
CacheItem.renderOutput
(self)
return self.getData() or ""
Can be overridden to implement edge-caching
Can be overridden to implement edge-caching
[ "Can", "be", "overridden", "to", "implement", "edge", "-", "caching" ]
def renderOutput(self): """Can be overridden to implement edge-caching""" return self.getData() or ""
[ "def", "renderOutput", "(", "self", ")", ":", "return", "self", ".", "getData", "(", ")", "or", "\"\"" ]
https://github.com/scribusproject/scribus/blob/41ec7c775a060912cf251682a8b1437f753f80f4/codegen/cheetah/Cheetah/CacheRegion.py#L65-L67
priyankchheda/algorithms
c361aa9071573fa9966d5b02d05e524815abcf2b
segment_tree/lazy_propagation.py
python
LazyPropagation.range_update
(self, query_left, query_right, value)
update segment tree
update segment tree
[ "update", "segment", "tree" ]
def range_update(self, query_left, query_right, value): """ update segment tree """ def _range_update(query_left, query_right, value, node_left, node_right, node_index): """ internal recursive function """ if self.lazy_tree[node_index] != 0: # complete the pending...
[ "def", "range_update", "(", "self", ",", "query_left", ",", "query_right", ",", "value", ")", ":", "def", "_range_update", "(", "query_left", ",", "query_right", ",", "value", ",", "node_left", ",", "node_right", ",", "node_index", ")", ":", "\"\"\" internal r...
https://github.com/priyankchheda/algorithms/blob/c361aa9071573fa9966d5b02d05e524815abcf2b/segment_tree/lazy_propagation.py#L72-L110
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
tools/python/google/platform_utils_linux.py
python
PlatformUtility.GetStopHttpdCommand
(self)
return [self._bash, "-c", self._httpd_cmd_string + ' -k stop && sleep 5']
Returns a list of strings that contains the command line+args needed to stop the http server used in the http tests. This tries to fetch the pid of httpd (if available) and returns the command to kill it. If pid is not available, kill all httpd processes
Returns a list of strings that contains the command line+args needed to stop the http server used in the http tests.
[ "Returns", "a", "list", "of", "strings", "that", "contains", "the", "command", "line", "+", "args", "needed", "to", "stop", "the", "http", "server", "used", "in", "the", "http", "tests", "." ]
def GetStopHttpdCommand(self): """Returns a list of strings that contains the command line+args needed to stop the http server used in the http tests. This tries to fetch the pid of httpd (if available) and returns the command to kill it. If pid is not available, kill all httpd processes """ i...
[ "def", "GetStopHttpdCommand", "(", "self", ")", ":", "if", "not", "self", ".", "_httpd_cmd_string", ":", "return", "[", "\"true\"", "]", "# Haven't been asked for the start cmd yet. Just pass.", "# Add a sleep after the shutdown because sometimes it takes some time for", "# the p...
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/python/google/platform_utils_linux.py#L136-L148
Illumina/strelka
d7377443b62319f7c7bd70c241c4b2df3459e29a
src/python/lib/strelkaSequenceErrorEstimation.py
python
countSequenceEvidenceUntilTargetIsReached
(self, estimationIntervals, sampleIndex, segFiles, taskPrefix="", dependencies=None)
return waitForTasks
This routine organizes the process of launching sequence error count jobs until a specific total evidence count has been gathered from the genome (or no genome segments are left) Note that this function will not return until its tasks are completed, so it will block conventional task parallelization
This routine organizes the process of launching sequence error count jobs until a specific total evidence count has been gathered from the genome (or no genome segments are left)
[ "This", "routine", "organizes", "the", "process", "of", "launching", "sequence", "error", "count", "jobs", "until", "a", "specific", "total", "evidence", "count", "has", "been", "gathered", "from", "the", "genome", "(", "or", "no", "genome", "segments", "are",...
def countSequenceEvidenceUntilTargetIsReached(self, estimationIntervals, sampleIndex, segFiles, taskPrefix="", dependencies=None) : """ This routine organizes the process of launching sequence error count jobs until a specific total evidence count has been gathe...
[ "def", "countSequenceEvidenceUntilTargetIsReached", "(", "self", ",", "estimationIntervals", ",", "sampleIndex", ",", "segFiles", ",", "taskPrefix", "=", "\"\"", ",", "dependencies", "=", "None", ")", ":", "class", "Constants", ":", "Megabase", "=", "1000000", "to...
https://github.com/Illumina/strelka/blob/d7377443b62319f7c7bd70c241c4b2df3459e29a/src/python/lib/strelkaSequenceErrorEstimation.py#L210-L343
ApolloAuto/apollo-platform
86d9dc6743b496ead18d597748ebabd34a513289
ros/ros_comm/rospy/src/rospy/impl/tcpros_service.py
python
ServiceProxy._get_service_uri
(self, request)
return self.uri
private routine for getting URI of service to call @param request: request message @type request: L{rospy.Message}
private routine for getting URI of service to call
[ "private", "routine", "for", "getting", "URI", "of", "service", "to", "call" ]
def _get_service_uri(self, request): """ private routine for getting URI of service to call @param request: request message @type request: L{rospy.Message} """ if not isinstance(request, genpy.Message): raise TypeError("request object is not a valid request m...
[ "def", "_get_service_uri", "(", "self", ",", "request", ")", ":", "if", "not", "isinstance", "(", "request", ",", "genpy", ".", "Message", ")", ":", "raise", "TypeError", "(", "\"request object is not a valid request message instance\"", ")", "# in order to support mo...
https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rospy/src/rospy/impl/tcpros_service.py#L438-L473
bh107/bohrium
5b83e7117285fefc7779ed0e9acb0f8e74c7e068
bridge/py_api/bohrium_api/__init__.py
python
get_include
()
return stack_info.header_dir()
Return the directory that contains the Bohrium-API *.h header files. Extension modules that need to compile against Bohrium-API should use this function to locate the appropriate include directory. Notes ----- When using ``distutils``, for example in ``setup.py``. :: import bohrium_ap...
Return the directory that contains the Bohrium-API *.h header files.
[ "Return", "the", "directory", "that", "contains", "the", "Bohrium", "-", "API", "*", ".", "h", "header", "files", "." ]
def get_include(): """Return the directory that contains the Bohrium-API *.h header files. Extension modules that need to compile against Bohrium-API should use this function to locate the appropriate include directory. Notes ----- When using ``distutils``, for example in ``setup.py``. :: ...
[ "def", "get_include", "(", ")", ":", "return", "stack_info", ".", "header_dir", "(", ")" ]
https://github.com/bh107/bohrium/blob/5b83e7117285fefc7779ed0e9acb0f8e74c7e068/bridge/py_api/bohrium_api/__init__.py#L41-L58
y123456yz/reading-and-annotate-mongodb-3.6
93280293672ca7586dc24af18132aa61e4ed7fcf
mongo/buildscripts/errorcodes.py
python
parseSourceFiles
( callback )
Walks MongoDB sourcefiles and invokes callback for each AssertLocation found.
Walks MongoDB sourcefiles and invokes callback for each AssertLocation found.
[ "Walks", "MongoDB", "sourcefiles", "and", "invokes", "callback", "for", "each", "AssertLocation", "found", "." ]
def parseSourceFiles( callback ): """Walks MongoDB sourcefiles and invokes callback for each AssertLocation found.""" quick = ["assert", "Exception", "ErrorCodes::Error"] patterns = [ re.compile( r"(?:u|m(?:sg)?)asser(?:t|ted)(?:NoTrace)?\s*\(\s*(\d+)", re.MULTILINE ) , re.compile( r"(?:DB...
[ "def", "parseSourceFiles", "(", "callback", ")", ":", "quick", "=", "[", "\"assert\"", ",", "\"Exception\"", ",", "\"ErrorCodes::Error\"", "]", "patterns", "=", "[", "re", ".", "compile", "(", "r\"(?:u|m(?:sg)?)asser(?:t|ted)(?:NoTrace)?\\s*\\(\\s*(\\d+)\"", ",", "re"...
https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/errorcodes.py#L54-L91
lyxok1/Tiny-DSOD
94d15450699bea0dd3720e75e2d273e476174fba
scripts/cpp_lint.py
python
FindPreviousMatchingAngleBracket
(clean_lines, linenum, init_prefix)
return False
Find the corresponding < that started a template. Args: clean_lines: A CleansedLines instance containing the file. linenum: Current line number. init_prefix: Part of the current line before the initial >. Returns: True if a matching bracket exists.
Find the corresponding < that started a template.
[ "Find", "the", "corresponding", "<", "that", "started", "a", "template", "." ]
def FindPreviousMatchingAngleBracket(clean_lines, linenum, init_prefix): """Find the corresponding < that started a template. Args: clean_lines: A CleansedLines instance containing the file. linenum: Current line number. init_prefix: Part of the current line before the initial >. Returns: True i...
[ "def", "FindPreviousMatchingAngleBracket", "(", "clean_lines", ",", "linenum", ",", "init_prefix", ")", ":", "line", "=", "init_prefix", "nesting_stack", "=", "[", "'>'", "]", "while", "True", ":", "# Find the previous operator", "match", "=", "Search", "(", "r'^(...
https://github.com/lyxok1/Tiny-DSOD/blob/94d15450699bea0dd3720e75e2d273e476174fba/scripts/cpp_lint.py#L2590-L2644
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/protobuf/py3/google/protobuf/json_format.py
python
_Parser._ConvertMapFieldValue
(self, value, message, field)
Convert map field value for a message map field. Args: value: A JSON object to convert the map field value. message: A protocol message to record the converted data. field: The descriptor of the map field to be converted. Raises: ParseError: In case of convert problems.
Convert map field value for a message map field.
[ "Convert", "map", "field", "value", "for", "a", "message", "map", "field", "." ]
def _ConvertMapFieldValue(self, value, message, field): """Convert map field value for a message map field. Args: value: A JSON object to convert the map field value. message: A protocol message to record the converted data. field: The descriptor of the map field to be converted. Raises:...
[ "def", "_ConvertMapFieldValue", "(", "self", ",", "value", ",", "message", ",", "field", ")", ":", "if", "not", "isinstance", "(", "value", ",", "dict", ")", ":", "raise", "ParseError", "(", "'Map field {0} must be in a dict which is {1}.'", ".", "format", "(", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py3/google/protobuf/json_format.py#L683-L707
rsummers11/CADLab
976ed959a0b5208bb4173127a7ef732ac73a9b6f
lesion_detector_3DCE/rcnn/dataset/pascal_voc.py
python
PascalVOC.load_selective_search_roidb
(self, gt_roidb)
return self.create_roidb_from_box_list(box_list, gt_roidb)
turn selective search proposals into selective search roidb :param gt_roidb: [image_index]['boxes', 'gt_classes', 'gt_overlaps', 'flipped'] :return: roidb: [image_index]['boxes', 'gt_classes', 'gt_overlaps', 'flipped']
turn selective search proposals into selective search roidb :param gt_roidb: [image_index]['boxes', 'gt_classes', 'gt_overlaps', 'flipped'] :return: roidb: [image_index]['boxes', 'gt_classes', 'gt_overlaps', 'flipped']
[ "turn", "selective", "search", "proposals", "into", "selective", "search", "roidb", ":", "param", "gt_roidb", ":", "[", "image_index", "]", "[", "boxes", "gt_classes", "gt_overlaps", "flipped", "]", ":", "return", ":", "roidb", ":", "[", "image_index", "]", ...
def load_selective_search_roidb(self, gt_roidb): """ turn selective search proposals into selective search roidb :param gt_roidb: [image_index]['boxes', 'gt_classes', 'gt_overlaps', 'flipped'] :return: roidb: [image_index]['boxes', 'gt_classes', 'gt_overlaps', 'flipped'] """ ...
[ "def", "load_selective_search_roidb", "(", "self", ",", "gt_roidb", ")", ":", "import", "scipy", ".", "io", "matfile", "=", "os", ".", "path", ".", "join", "(", "self", ".", "root_path", ",", "'selective_search_data'", ",", "self", ".", "name", "+", "'.mat...
https://github.com/rsummers11/CADLab/blob/976ed959a0b5208bb4173127a7ef732ac73a9b6f/lesion_detector_3DCE/rcnn/dataset/pascal_voc.py#L138-L158
y123456yz/reading-and-annotate-mongodb-3.6
93280293672ca7586dc24af18132aa61e4ed7fcf
mongo/buildscripts/hang_analyzer.py
python
WindowsDumper.dump_info
(self, root_logger, logger, pid, process_name, take_dump)
Dump useful information to the console
Dump useful information to the console
[ "Dump", "useful", "information", "to", "the", "console" ]
def dump_info(self, root_logger, logger, pid, process_name, take_dump): """Dump useful information to the console""" debugger = "cdb.exe" dbg = self.__find_debugger(root_logger, debugger) if dbg is None: root_logger.warning("Debugger %s not found, skipping dumping of %d" % (...
[ "def", "dump_info", "(", "self", ",", "root_logger", ",", "logger", ",", "pid", ",", "process_name", ",", "take_dump", ")", ":", "debugger", "=", "\"cdb.exe\"", "dbg", "=", "self", ".", "__find_debugger", "(", "root_logger", ",", "debugger", ")", "if", "db...
https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/hang_analyzer.py#L123-L160
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/ops/__init__.py
python
dispatch_to_series
(left, right, func, str_rep=None, axis=None)
return new_data
Evaluate the frame operation func(left, right) by evaluating column-by-column, dispatching to the Series implementation. Parameters ---------- left : DataFrame right : scalar or DataFrame func : arithmetic or comparison operator str_rep : str or None, default None axis : {None, 0, 1, "i...
Evaluate the frame operation func(left, right) by evaluating column-by-column, dispatching to the Series implementation.
[ "Evaluate", "the", "frame", "operation", "func", "(", "left", "right", ")", "by", "evaluating", "column", "-", "by", "-", "column", "dispatching", "to", "the", "Series", "implementation", "." ]
def dispatch_to_series(left, right, func, str_rep=None, axis=None): """ Evaluate the frame operation func(left, right) by evaluating column-by-column, dispatching to the Series implementation. Parameters ---------- left : DataFrame right : scalar or DataFrame func : arithmetic or compar...
[ "def", "dispatch_to_series", "(", "left", ",", "right", ",", "func", ",", "str_rep", "=", "None", ",", "axis", "=", "None", ")", ":", "# Note: we use iloc to access columns for compat with cases", "# with non-unique columns.", "import", "pandas", ".", "core", "....
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/ops/__init__.py#L355-L420
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/seq2seq/python/ops/helper.py
python
TrainingHelper.__init__
(self, inputs, sequence_length, time_major=False, name=None)
Initializer. Args: inputs: A (structure of) input tensors. sequence_length: An int32 vector tensor. time_major: Python bool. Whether the tensors in `inputs` are time major. If `False` (default), they are assumed to be batch major. name: Name scope for any created operations. R...
Initializer.
[ "Initializer", "." ]
def __init__(self, inputs, sequence_length, time_major=False, name=None): """Initializer. Args: inputs: A (structure of) input tensors. sequence_length: An int32 vector tensor. time_major: Python bool. Whether the tensors in `inputs` are time major. If `False` (default), they are ass...
[ "def", "__init__", "(", "self", ",", "inputs", ",", "sequence_length", ",", "time_major", "=", "False", ",", "name", "=", "None", ")", ":", "with", "ops", ".", "name_scope", "(", "name", ",", "\"TrainingHelper\"", ",", "[", "inputs", ",", "sequence_length"...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/seq2seq/python/ops/helper.py#L233-L263
openvinotoolkit/openvino
dedcbeafa8b84cccdc55ca64b8da516682b381c7
tools/mo/openvino/tools/mo/middle/ONNXRNNSequenceNormalize.py
python
ONNXRNNSequenceNormalize.repack_weights
(graph: Graph, match: dict)
Repack weights into general format (described above) and reorder gates.
Repack weights into general format (described above) and reorder gates.
[ "Repack", "weights", "into", "general", "format", "(", "described", "above", ")", "and", "reorder", "gates", "." ]
def repack_weights(graph: Graph, match: dict): """ Repack weights into general format (described above) and reorder gates. """ rnn_layer = match['rnn_layer'] W = match['W'].value.copy() R = match['R'].value.copy() num_directions = 2 if rnn_layer.direction == 'bidi...
[ "def", "repack_weights", "(", "graph", ":", "Graph", ",", "match", ":", "dict", ")", ":", "rnn_layer", "=", "match", "[", "'rnn_layer'", "]", "W", "=", "match", "[", "'W'", "]", ".", "value", ".", "copy", "(", ")", "R", "=", "match", "[", "'R'", ...
https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/middle/ONNXRNNSequenceNormalize.py#L71-L123
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/tensorflow/python/framework/errors.py
python
UnknownError.__init__
(self, node_def, op, message, error_code=UNKNOWN)
Creates an `UnknownError`.
Creates an `UnknownError`.
[ "Creates", "an", "UnknownError", "." ]
def __init__(self, node_def, op, message, error_code=UNKNOWN): """Creates an `UnknownError`.""" super(UnknownError, self).__init__(node_def, op, message, error_code)
[ "def", "__init__", "(", "self", ",", "node_def", ",", "op", ",", "message", ",", "error_code", "=", "UNKNOWN", ")", ":", "super", "(", "UnknownError", ",", "self", ")", ".", "__init__", "(", "node_def", ",", "op", ",", "message", ",", "error_code", ")"...
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/framework/errors.py#L182-L184
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/html.py
python
HtmlWinParser.GetFontFixed
(*args, **kwargs)
return _html.HtmlWinParser_GetFontFixed(*args, **kwargs)
GetFontFixed(self) -> int
GetFontFixed(self) -> int
[ "GetFontFixed", "(", "self", ")", "-", ">", "int" ]
def GetFontFixed(*args, **kwargs): """GetFontFixed(self) -> int""" return _html.HtmlWinParser_GetFontFixed(*args, **kwargs)
[ "def", "GetFontFixed", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_html", ".", "HtmlWinParser_GetFontFixed", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/html.py#L324-L326