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
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/turtle.py
python
TurtleScreenBase.mainloop
(self)
Starts event loop - calling Tkinter's mainloop function. No argument. Must be last statement in a turtle graphics program. Must NOT be used if a script is run from within IDLE in -n mode (No subprocess) - for interactive use of turtle graphics. Example (for a TurtleScreen inst...
Starts event loop - calling Tkinter's mainloop function.
[ "Starts", "event", "loop", "-", "calling", "Tkinter", "s", "mainloop", "function", "." ]
def mainloop(self): """Starts event loop - calling Tkinter's mainloop function. No argument. Must be last statement in a turtle graphics program. Must NOT be used if a script is run from within IDLE in -n mode (No subprocess) - for interactive use of turtle graphics. E...
[ "def", "mainloop", "(", "self", ")", ":", "TK", ".", "mainloop", "(", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/turtle.py#L800-L813
openvinotoolkit/openvino
dedcbeafa8b84cccdc55ca64b8da516682b381c7
tools/mo/openvino/tools/mo/graph/port.py
python
Port.is_data_type_defined
(self)
return self._get_data_type() is not None
Check if the data-type is already defined for the port. :return: the result of the check
Check if the data-type is already defined for the port. :return: the result of the check
[ "Check", "if", "the", "data", "-", "type", "is", "already", "defined", "for", "the", "port", ".", ":", "return", ":", "the", "result", "of", "the", "check" ]
def is_data_type_defined(self): """ Check if the data-type is already defined for the port. :return: the result of the check """ return self._get_data_type() is not None
[ "def", "is_data_type_defined", "(", "self", ")", ":", "return", "self", ".", "_get_data_type", "(", ")", "is", "not", "None" ]
https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/graph/port.py#L482-L487
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/dataview.py
python
DataViewTreeStoreNode.__init__
(self, *args, **kwargs)
__init__(self, DataViewTreeStoreNode parent, String text, Icon icon=wxNullIcon, wxClientData data=None) -> DataViewTreeStoreNode
__init__(self, DataViewTreeStoreNode parent, String text, Icon icon=wxNullIcon, wxClientData data=None) -> DataViewTreeStoreNode
[ "__init__", "(", "self", "DataViewTreeStoreNode", "parent", "String", "text", "Icon", "icon", "=", "wxNullIcon", "wxClientData", "data", "=", "None", ")", "-", ">", "DataViewTreeStoreNode" ]
def __init__(self, *args, **kwargs): """ __init__(self, DataViewTreeStoreNode parent, String text, Icon icon=wxNullIcon, wxClientData data=None) -> DataViewTreeStoreNode """ _dataview.DataViewTreeStoreNode_swiginit(self,_dataview.new_DataViewTreeStoreNode(*args, **kwargs))
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "_dataview", ".", "DataViewTreeStoreNode_swiginit", "(", "self", ",", "_dataview", ".", "new_DataViewTreeStoreNode", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/dataview.py#L2219-L2224
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/tarfile.py
python
TarFile.list
(self, verbose=True, *, members=None)
Print a table of contents to sys.stdout. If `verbose' is False, only the names of the members are printed. If it is True, an `ls -l'-like output is produced. `members' is optional and must be a subset of the list returned by getmembers().
Print a table of contents to sys.stdout. If `verbose' is False, only the names of the members are printed. If it is True, an `ls -l'-like output is produced. `members' is optional and must be a subset of the list returned by getmembers().
[ "Print", "a", "table", "of", "contents", "to", "sys", ".", "stdout", ".", "If", "verbose", "is", "False", "only", "the", "names", "of", "the", "members", "are", "printed", ".", "If", "it", "is", "True", "an", "ls", "-", "l", "-", "like", "output", ...
def list(self, verbose=True, *, members=None): """Print a table of contents to sys.stdout. If `verbose' is False, only the names of the members are printed. If it is True, an `ls -l'-like output is produced. `members' is optional and must be a subset of the list returned by getm...
[ "def", "list", "(", "self", ",", "verbose", "=", "True", ",", "*", ",", "members", "=", "None", ")", ":", "self", ".", "_check", "(", ")", "if", "members", "is", "None", ":", "members", "=", "self", "for", "tarinfo", "in", "members", ":", "if", "...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/tarfile.py#L1908-L1938
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/retrying.py
python
Retrying.stop_after_attempt
(self, previous_attempt_number, delay_since_first_attempt_ms)
return previous_attempt_number >= self._stop_max_attempt_number
Stop after the previous attempt >= stop_max_attempt_number.
Stop after the previous attempt >= stop_max_attempt_number.
[ "Stop", "after", "the", "previous", "attempt", ">", "=", "stop_max_attempt_number", "." ]
def stop_after_attempt(self, previous_attempt_number, delay_since_first_attempt_ms): """Stop after the previous attempt >= stop_max_attempt_number.""" return previous_attempt_number >= self._stop_max_attempt_number
[ "def", "stop_after_attempt", "(", "self", ",", "previous_attempt_number", ",", "delay_since_first_attempt_ms", ")", ":", "return", "previous_attempt_number", ">=", "self", ".", "_stop_max_attempt_number" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/retrying.py#L141-L143
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/dispatcher.py
python
LiftedWith.get_call_template
(self, args, kws)
return call_template, pysig, args, kws
Get a typing.ConcreteTemplate for this dispatcher and the given *args* and *kws* types. This enables the resolving of the return type. A (template, pysig, args, kws) tuple is returned.
Get a typing.ConcreteTemplate for this dispatcher and the given *args* and *kws* types. This enables the resolving of the return type.
[ "Get", "a", "typing", ".", "ConcreteTemplate", "for", "this", "dispatcher", "and", "the", "given", "*", "args", "*", "and", "*", "kws", "*", "types", ".", "This", "enables", "the", "resolving", "of", "the", "return", "type", "." ]
def get_call_template(self, args, kws): """ Get a typing.ConcreteTemplate for this dispatcher and the given *args* and *kws* types. This enables the resolving of the return type. A (template, pysig, args, kws) tuple is returned. """ # Ensure an overload is available ...
[ "def", "get_call_template", "(", "self", ",", "args", ",", "kws", ")", ":", "# Ensure an overload is available", "if", "self", ".", "_can_compile", ":", "self", ".", "compile", "(", "tuple", "(", "args", ")", ")", "pysig", "=", "None", "# Create function type ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/dispatcher.py#L908-L927
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/profiler/parser/memory_usage_parser.py
python
MemoryUsageParser._get_file_path
(self)
return file_path
Get the proto file path.
Get the proto file path.
[ "Get", "the", "proto", "file", "path", "." ]
def _get_file_path(self): """Get the proto file path.""" file_path = os.path.join( self._profiling_dir, self._proto_file_path.format(self._device_id) ) file_path = validate_and_normalize_path(file_path) if not os.path.exists(file_path): logger...
[ "def", "_get_file_path", "(", "self", ")", ":", "file_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_profiling_dir", ",", "self", ".", "_proto_file_path", ".", "format", "(", "self", ".", "_device_id", ")", ")", "file_path", "=", "valida...
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/profiler/parser/memory_usage_parser.py#L61-L74
snap-stanford/snap-python
d53c51b0a26aa7e3e7400b014cdf728948fde80a
setup/snap.py
python
LoadDyNet
(*args)
return _snap.LoadDyNet(*args)
LoadDyNet(TStr FNm) -> PNGraph Parameters: FNm: TStr const &
LoadDyNet(TStr FNm) -> PNGraph
[ "LoadDyNet", "(", "TStr", "FNm", ")", "-", ">", "PNGraph" ]
def LoadDyNet(*args): """ LoadDyNet(TStr FNm) -> PNGraph Parameters: FNm: TStr const & """ return _snap.LoadDyNet(*args)
[ "def", "LoadDyNet", "(", "*", "args", ")", ":", "return", "_snap", ".", "LoadDyNet", "(", "*", "args", ")" ]
https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L5641-L5649
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/autograph/pyct/gast_util.py
python
is_literal
(node)
return False
Tests whether node represents a Python literal.
Tests whether node represents a Python literal.
[ "Tests", "whether", "node", "represents", "a", "Python", "literal", "." ]
def is_literal(node): """Tests whether node represents a Python literal.""" # Normal literals, True/False/None/Etc. in Python3 if is_constant(node): return True # True/False/None/Etc. in Python2 if isinstance(node, gast.Name) and node.id in ['True', 'False', 'None']: return True return False
[ "def", "is_literal", "(", "node", ")", ":", "# Normal literals, True/False/None/Etc. in Python3", "if", "is_constant", "(", "node", ")", ":", "return", "True", "# True/False/None/Etc. in Python2", "if", "isinstance", "(", "node", ",", "gast", ".", "Name", ")", "and"...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/autograph/pyct/gast_util.py#L36-L46
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/cffi/api.py
python
FFI.verify
(self, source='', tmpdir=None, **kwargs)
return lib
Verify that the current ffi signatures compile on this machine, and return a dynamic library object. The dynamic library can be used to call functions and access global variables declared in this 'ffi'. The library is compiled by the C compiler: it gives you C-level API compatibility ...
Verify that the current ffi signatures compile on this machine, and return a dynamic library object. The dynamic library can be used to call functions and access global variables declared in this 'ffi'. The library is compiled by the C compiler: it gives you C-level API compatibility ...
[ "Verify", "that", "the", "current", "ffi", "signatures", "compile", "on", "this", "machine", "and", "return", "a", "dynamic", "library", "object", ".", "The", "dynamic", "library", "can", "be", "used", "to", "call", "functions", "and", "access", "global", "v...
def verify(self, source='', tmpdir=None, **kwargs): """Verify that the current ffi signatures compile on this machine, and return a dynamic library object. The dynamic library can be used to call functions and access global variables declared in this 'ffi'. The library is compiled ...
[ "def", "verify", "(", "self", ",", "source", "=", "''", ",", "tmpdir", "=", "None", ",", "*", "*", "kwargs", ")", ":", "from", ".", "verifier", "import", "Verifier", ",", "_caller_dir_pycache", "#", "# If set_unicode(True) was called, insert the UNICODE and", "#...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/cffi/api.py#L445-L473
bulletphysics/bullet3
f0f2a952e146f016096db6f85cf0c44ed75b0b9a
examples/pybullet/gym/pybullet_envs/minitaur/agents/baseline_controller/minitaur_raibert_controller_utils.py
python
leg_pose_to_foot_position
(leg_pose)
return (x, -y)
The forward kinematics.
The forward kinematics.
[ "The", "forward", "kinematics", "." ]
def leg_pose_to_foot_position(leg_pose): """The forward kinematics.""" l1 = UPPER_LEG_LEN l2 = LOWER_SHORT_LEG_LEN l3 = LOWER_LONG_LEG_LEN ext = leg_pose[1] alpha = math.asin(l1 * math.sin(ext) / l2) sw = -leg_pose[0] x = l3 * math.sin(alpha + sw) - l1 * math.sin(ext + sw) y = l3 * math.cos(alpha + ...
[ "def", "leg_pose_to_foot_position", "(", "leg_pose", ")", ":", "l1", "=", "UPPER_LEG_LEN", "l2", "=", "LOWER_SHORT_LEG_LEN", "l3", "=", "LOWER_LONG_LEG_LEN", "ext", "=", "leg_pose", "[", "1", "]", "alpha", "=", "math", ".", "asin", "(", "l1", "*", "math", ...
https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/minitaur/agents/baseline_controller/minitaur_raibert_controller_utils.py#L14-L27
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
python
convert_gru
(builder, layer, input_names, output_names, keras_layer, respect_train)
Convert a GRU layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. respect_train: boolean Whether to honor Keras' "trainable" flag (unsupported).
Convert a GRU layer from keras to coreml.
[ "Convert", "a", "GRU", "layer", "from", "keras", "to", "coreml", "." ]
def convert_gru(builder, layer, input_names, output_names, keras_layer, respect_train): """ Convert a GRU layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. respect_train:...
[ "def", "convert_gru", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ",", "respect_train", ")", ":", "hidden_size", "=", "keras_layer", ".", "units", "input_size", "=", "keras_layer", ".", "input_shape", "[", "-", "1...
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L1347-L1417
google/syzygy
8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5
third_party/numpy/files/numpy/polynomial/hermite.py
python
hermmul
(c1, c2)
return hermadd(c0, hermmulx(c1)*2)
Multiply one Hermite series by another. Returns the product of two Hermite series `c1` * `c2`. The arguments are sequences of coefficients, from lowest order "term" to highest, e.g., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``. Parameters ---------- c1, c2 : array_like 1-d a...
Multiply one Hermite series by another.
[ "Multiply", "one", "Hermite", "series", "by", "another", "." ]
def hermmul(c1, c2): """ Multiply one Hermite series by another. Returns the product of two Hermite series `c1` * `c2`. The arguments are sequences of coefficients, from lowest order "term" to highest, e.g., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``. Parameters ---------- ...
[ "def", "hermmul", "(", "c1", ",", "c2", ")", ":", "# s1, s2 are trimmed copies", "[", "c1", ",", "c2", "]", "=", "pu", ".", "as_series", "(", "[", "c1", ",", "c2", "]", ")", "if", "len", "(", "c1", ")", ">", "len", "(", "c2", ")", ":", "cs", ...
https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/polynomial/hermite.py#L432-L495
vtraag/leidenalg
b53366829360e10922a2dbf57eb405a516c23bc9
src/leidenalg/Optimiser.py
python
Optimiser.merge_nodes
(self, partition, is_membership_fixed=None, consider_comms=None)
return diff
Merge nodes for *optimising* the partition. Parameters ---------- partition The partition for which to merge nodes. is_membership_fixed: list of bools or None Boolean list of nodes that are not allowed to change community. The length of this list must be equal to the number of nodes....
Merge nodes for *optimising* the partition.
[ "Merge", "nodes", "for", "*", "optimising", "*", "the", "partition", "." ]
def merge_nodes(self, partition, is_membership_fixed=None, consider_comms=None): """ Merge nodes for *optimising* the partition. Parameters ---------- partition The partition for which to merge nodes. is_membership_fixed: list of bools or None Boolean list of nodes that are not allowed...
[ "def", "merge_nodes", "(", "self", ",", "partition", ",", "is_membership_fixed", "=", "None", ",", "consider_comms", "=", "None", ")", ":", "if", "(", "consider_comms", "is", "None", ")", ":", "consider_comms", "=", "self", ".", "consider_comms", "diff", "="...
https://github.com/vtraag/leidenalg/blob/b53366829360e10922a2dbf57eb405a516c23bc9/src/leidenalg/Optimiser.py#L509-L557
psnonis/FinBERT
c0c555d833a14e2316a3701e59c0b5156f804b4e
bert/tokenization.py
python
whitespace_tokenize
(text)
return tokens
Runs basic whitespace cleaning and splitting on a piece of text.
Runs basic whitespace cleaning and splitting on a piece of text.
[ "Runs", "basic", "whitespace", "cleaning", "and", "splitting", "on", "a", "piece", "of", "text", "." ]
def whitespace_tokenize(text): """Runs basic whitespace cleaning and splitting on a piece of text.""" text = text.strip() if not text: return [] tokens = text.split() return tokens
[ "def", "whitespace_tokenize", "(", "text", ")", ":", "text", "=", "text", ".", "strip", "(", ")", "if", "not", "text", ":", "return", "[", "]", "tokens", "=", "text", ".", "split", "(", ")", "return", "tokens" ]
https://github.com/psnonis/FinBERT/blob/c0c555d833a14e2316a3701e59c0b5156f804b4e/bert/tokenization.py#L152-L158
llvm-mirror/lldb
d01083a850f577b85501a0902b52fd0930de72c7
third_party/Python/module/pexpect-4.6/pexpect/pty_spawn.py
python
spawn.__interact_copy
( self, escape_character=None, input_filter=None, output_filter=None )
This is used by the interact() method.
This is used by the interact() method.
[ "This", "is", "used", "by", "the", "interact", "()", "method", "." ]
def __interact_copy( self, escape_character=None, input_filter=None, output_filter=None ): '''This is used by the interact() method. ''' while self.isalive(): if self.use_poll: r = poll_ignore_interrupts([self.child_fd, self.STDIN_FILENO]) el...
[ "def", "__interact_copy", "(", "self", ",", "escape_character", "=", "None", ",", "input_filter", "=", "None", ",", "output_filter", "=", "None", ")", ":", "while", "self", ".", "isalive", "(", ")", ":", "if", "self", ".", "use_poll", ":", "r", "=", "p...
https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/third_party/Python/module/pexpect-4.6/pexpect/pty_spawn.py#L784-L827
livecode/livecode
4606a10ea10b16d5071d0f9f263ccdd7ede8b31d
gyp/pylib/gyp/generator/msvs.py
python
_ConvertSourcesToFilterHierarchy
(sources, prefix=None, excluded=None, list_excluded=True, msvs_version=None)
return result
Converts a list split source file paths into a vcproj folder hierarchy. Arguments: sources: A list of source file paths split. prefix: A list of source file path layers meant to apply to each of sources. excluded: A set of excluded files. msvs_version: A MSVSVersion object. Returns: A hierarch...
Converts a list split source file paths into a vcproj folder hierarchy.
[ "Converts", "a", "list", "split", "source", "file", "paths", "into", "a", "vcproj", "folder", "hierarchy", "." ]
def _ConvertSourcesToFilterHierarchy(sources, prefix=None, excluded=None, list_excluded=True, msvs_version=None): """Converts a list split source file paths into a vcproj folder hierarchy. Arguments: sources: A list of source file paths split. prefix: A list of source f...
[ "def", "_ConvertSourcesToFilterHierarchy", "(", "sources", ",", "prefix", "=", "None", ",", "excluded", "=", "None", ",", "list_excluded", "=", "True", ",", "msvs_version", "=", "None", ")", ":", "if", "not", "prefix", ":", "prefix", "=", "[", "]", "result...
https://github.com/livecode/livecode/blob/4606a10ea10b16d5071d0f9f263ccdd7ede8b31d/gyp/pylib/gyp/generator/msvs.py#L176-L238
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/ipython-genutils/ipython_genutils/encoding.py
python
getdefaultencoding
(prefer_stream=True)
return enc
Return IPython's guess for the default encoding for bytes as text. If prefer_stream is True (default), asks for stdin.encoding first, to match the calling Terminal, but that is often None for subprocesses. Then fall back on locale.getpreferredencoding(), which should be a sensible platform def...
Return IPython's guess for the default encoding for bytes as text. If prefer_stream is True (default), asks for stdin.encoding first, to match the calling Terminal, but that is often None for subprocesses. Then fall back on locale.getpreferredencoding(), which should be a sensible platform def...
[ "Return", "IPython", "s", "guess", "for", "the", "default", "encoding", "for", "bytes", "as", "text", ".", "If", "prefer_stream", "is", "True", "(", "default", ")", "asks", "for", "stdin", ".", "encoding", "first", "to", "match", "the", "calling", "Termina...
def getdefaultencoding(prefer_stream=True): """Return IPython's guess for the default encoding for bytes as text. If prefer_stream is True (default), asks for stdin.encoding first, to match the calling Terminal, but that is often None for subprocesses. Then fall back on locale.getpreferredenco...
[ "def", "getdefaultencoding", "(", "prefer_stream", "=", "True", ")", ":", "enc", "=", "None", "if", "prefer_stream", ":", "enc", "=", "get_stream_enc", "(", "sys", ".", "stdin", ")", "if", "not", "enc", "or", "enc", "==", "'ascii'", ":", "try", ":", "#...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython-genutils/ipython_genutils/encoding.py#L38-L69
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/database.py
python
InstalledDistribution.get_distinfo_file
(self, path)
return os.path.join(self.path, path)
Returns a path located under the ``.dist-info`` directory. Returns a string representing the path. :parameter path: a ``'/'``-separated path relative to the ``.dist-info`` directory or an absolute path; If *path* is an absolute path and doesn't sta...
[]
def get_distinfo_file(self, path): """ Returns a path located under the ``.dist-info`` directory. Returns a string representing the path. :parameter path: a ``'/'``-separated path relative to the ``.dist-info`` directory or an absolute path; ...
[ "def", "get_distinfo_file", "(", "self", ",", "path", ")", ":", "# Check if it is an absolute path # XXX use relpath, add tests", "if", "path", ".", "find", "(", "os", ".", "sep", ")", ">=", "0", ":", "# it's an absolute path?", "distinfo_dirname", ",", "path", "="...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/database.py#L1607-L1661
tiny-dnn/tiny-dnn
c0f576f5cb7b35893f62127cb7aec18f77a3bcc5
third_party/gemmlowp/meta/generators/mul_1x8_Mx8_neon.py
python
GenerateAndClearAggregators
(emitter, registers, count)
return aggregators
Prepare aggregators and emit aggregator clear code.
Prepare aggregators and emit aggregator clear code.
[ "Prepare", "aggregators", "and", "emit", "aggregator", "clear", "code", "." ]
def GenerateAndClearAggregators(emitter, registers, count): """Prepare aggregators and emit aggregator clear code.""" emitter.EmitNewline() emitter.EmitComment('Clear aggregators.') aggregators = [registers.QuadRegister() for unused_i in range(count)] for i in range(count): if i < 3: emitter.EmitVMo...
[ "def", "GenerateAndClearAggregators", "(", "emitter", ",", "registers", ",", "count", ")", ":", "emitter", ".", "EmitNewline", "(", ")", "emitter", ".", "EmitComment", "(", "'Clear aggregators.'", ")", "aggregators", "=", "[", "registers", ".", "QuadRegister", "...
https://github.com/tiny-dnn/tiny-dnn/blob/c0f576f5cb7b35893f62127cb7aec18f77a3bcc5/third_party/gemmlowp/meta/generators/mul_1x8_Mx8_neon.py#L173-L184
yarny/gbdt
c99d90d7de57705c30b05d520a32e458985fd834
gbdt/_forest.py
python
Forest.feature_importance
(self)
return self._forest.feature_importance()
Outputs list of feature importances in descending order.
Outputs list of feature importances in descending order.
[ "Outputs", "list", "of", "feature", "importances", "in", "descending", "order", "." ]
def feature_importance(self): """Outputs list of feature importances in descending order.""" return self._forest.feature_importance()
[ "def", "feature_importance", "(", "self", ")", ":", "return", "self", ".", "_forest", ".", "feature_importance", "(", ")" ]
https://github.com/yarny/gbdt/blob/c99d90d7de57705c30b05d520a32e458985fd834/gbdt/_forest.py#L31-L33
pmq20/node-packer
12c46c6e44fbc14d9ee645ebd17d5296b324f7e0
lts/deps/v8/third_party/jinja2/nodes.py
python
Node.set_environment
(self, environment)
return self
Set the environment for all nodes.
Set the environment for all nodes.
[ "Set", "the", "environment", "for", "all", "nodes", "." ]
def set_environment(self, environment): """Set the environment for all nodes.""" todo = deque([self]) while todo: node = todo.popleft() node.environment = environment todo.extend(node.iter_child_nodes()) return self
[ "def", "set_environment", "(", "self", ",", "environment", ")", ":", "todo", "=", "deque", "(", "[", "self", "]", ")", "while", "todo", ":", "node", "=", "todo", ".", "popleft", "(", ")", "node", ".", "environment", "=", "environment", "todo", ".", "...
https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/v8/third_party/jinja2/nodes.py#L219-L226
Tencent/CMONGO
c40380caa14e05509f46993aa8b8da966b09b0b5
buildscripts/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/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/buildscripts/cpplint.py#L2239-L2245
rodeofx/OpenWalter
6116fbe3f04f1146c854afbfbdbe944feaee647e
walter/common/walterWidgets/walterBaseTreeView.py
python
BaseTreeView.mousePressEvent
(self, event)
Receive mouse press events for the widget.
Receive mouse press events for the widget.
[ "Receive", "mouse", "press", "events", "for", "the", "widget", "." ]
def mousePressEvent(self, event): """Receive mouse press events for the widget.""" index = self.indexAt(event.pos()) # RND-495: Show the current object properties when middle click on it. # We don't want `QtGui.QTreeView.mousePressEvent` to be called since we # don't want to se...
[ "def", "mousePressEvent", "(", "self", ",", "event", ")", ":", "index", "=", "self", ".", "indexAt", "(", "event", ".", "pos", "(", ")", ")", "# RND-495: Show the current object properties when middle click on it.", "# We don't want `QtGui.QTreeView.mousePressEvent` to be c...
https://github.com/rodeofx/OpenWalter/blob/6116fbe3f04f1146c854afbfbdbe944feaee647e/walter/common/walterWidgets/walterBaseTreeView.py#L55-L70
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/eager/custom_gradient.py
python
custom_gradient
(f)
return tf_decorator.make_decorator(f, decorated)
Decorator to define a function with a custom gradient. The input function is expected to return the tuple (results, gradient_function). The output function will return results while possibly recording the gradient_function and inputs in the tape. Args: f: function to be decorated. Returns: dec...
Decorator to define a function with a custom gradient.
[ "Decorator", "to", "define", "a", "function", "with", "a", "custom", "gradient", "." ]
def custom_gradient(f): """Decorator to define a function with a custom gradient. The input function is expected to return the tuple (results, gradient_function). The output function will return results while possibly recording the gradient_function and inputs in the tape. Args: f: function to be d...
[ "def", "custom_gradient", "(", "f", ")", ":", "def", "decorated", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"Decorated function with custom gradient.\"\"\"", "if", "context", ".", "in_graph_mode", "(", ")", ":", "if", "kwargs", ":", "raise", ...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/eager/custom_gradient.py#L29-L88
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/stc.py
python
StyledTextCtrl.GetBufferedDraw
(*args, **kwargs)
return _stc.StyledTextCtrl_GetBufferedDraw(*args, **kwargs)
GetBufferedDraw(self) -> bool Is drawing done first into a buffer or direct to the screen?
GetBufferedDraw(self) -> bool
[ "GetBufferedDraw", "(", "self", ")", "-", ">", "bool" ]
def GetBufferedDraw(*args, **kwargs): """ GetBufferedDraw(self) -> bool Is drawing done first into a buffer or direct to the screen? """ return _stc.StyledTextCtrl_GetBufferedDraw(*args, **kwargs)
[ "def", "GetBufferedDraw", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_stc", ".", "StyledTextCtrl_GetBufferedDraw", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/stc.py#L2287-L2293
ApolloAuto/apollo-platform
86d9dc6743b496ead18d597748ebabd34a513289
ros/ros/roslib/src/roslib/msgs.py
python
list_msg_types
(package, include_depends)
return [x[:-len(EXT)] for x in types]
List all messages in the specified package @param package str: name of package to search @param include_depends bool: if True, will also list messages in package dependencies @return [str]: message type names
List all messages in the specified package
[ "List", "all", "messages", "in", "the", "specified", "package" ]
def list_msg_types(package, include_depends): """ List all messages in the specified package @param package str: name of package to search @param include_depends bool: if True, will also list messages in package dependencies @return [str]: message type names """ types = roslib.resources.list...
[ "def", "list_msg_types", "(", "package", ",", "include_depends", ")", ":", "types", "=", "roslib", ".", "resources", ".", "list_package_resources", "(", "package", ",", "include_depends", ",", "'msg'", ",", "_msg_filter", ")", "return", "[", "x", "[", ":", "...
https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros/roslib/src/roslib/msgs.py#L406-L414
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py
python
Image.height
(self)
return getint( self.tk.call('image', 'height', self.name))
Return the height of the image.
Return the height of the image.
[ "Return", "the", "height", "of", "the", "image", "." ]
def height(self): """Return the height of the image.""" return getint( self.tk.call('image', 'height', self.name))
[ "def", "height", "(", "self", ")", ":", "return", "getint", "(", "self", ".", "tk", ".", "call", "(", "'image'", ",", "'height'", ",", "self", ".", "name", ")", ")" ]
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py#L3287-L3290
glotzerlab/hoomd-blue
f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a
hoomd/hpmc/external/field.py
python
Harmonic.energy
(self)
return sum(self._cpp_obj.getEnergies(timestep))
float: The total energy of the harmonic field \ [\\mathrm{energy}]`. :math:`V_\\mathrm{translational} + V_\\mathrm{rotational}`
float: The total energy of the harmonic field \ [\\mathrm{energy}]`.
[ "float", ":", "The", "total", "energy", "of", "the", "harmonic", "field", "\\", "[", "\\\\", "mathrm", "{", "energy", "}", "]", "." ]
def energy(self): """float: The total energy of the harmonic field \ [\\mathrm{energy}]`. :math:`V_\\mathrm{translational} + V_\\mathrm{rotational}` """ timestep = self._simulation.timestep return sum(self._cpp_obj.getEnergies(timestep))
[ "def", "energy", "(", "self", ")", ":", "timestep", "=", "self", ".", "_simulation", ".", "timestep", "return", "sum", "(", "self", ".", "_cpp_obj", ".", "getEnergies", "(", "timestep", ")", ")" ]
https://github.com/glotzerlab/hoomd-blue/blob/f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a/hoomd/hpmc/external/field.py#L170-L177
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
catboost/python-package/catboost/datasets.py
python
higgs
()
return ( _load_numeric_only_dataset(train_path, 10500000, 29, sep='\t'), _load_numeric_only_dataset(test_path, 500000, 29, sep='\t'))
Download "higgs" [1] data set. Will return two pandas.DataFrame-s, first with train part and second with test part of the dataset. Object class will be located in the first column of dataset. [1]: https://archive.ics.uci.edu/ml/datasets/HIGGS
Download "higgs" [1] data set.
[ "Download", "higgs", "[", "1", "]", "data", "set", "." ]
def higgs(): """ Download "higgs" [1] data set. Will return two pandas.DataFrame-s, first with train part and second with test part of the dataset. Object class will be located in the first column of dataset. [1]: https://archive.ics.uci.edu/ml/datasets/HIGGS """ url = 'https://storage...
[ "def", "higgs", "(", ")", ":", "url", "=", "'https://storage.mds.yandex.net/get-devtools-opensource/250854/higgs.tar.gz'", "md5", "=", "'ad59ba8328a9afa3837d7bf1a0e10e7b'", "dataset_name", ",", "train_file", ",", "test_file", "=", "'higgs'", ",", "'train.tsv'", ",", "'test....
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/catboost/python-package/catboost/datasets.py#L316-L332
natanielruiz/android-yolo
1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f
jni-build/jni/include/tensorflow/contrib/learn/python/learn/monitors.py
python
EveryN.every_n_step_begin
(self, step)
return []
Callback before every n'th step begins. Args: step: `int`, the current value of the global step. Returns: A `list` of tensors that will be evaluated at this step.
Callback before every n'th step begins.
[ "Callback", "before", "every", "n", "th", "step", "begins", "." ]
def every_n_step_begin(self, step): # pylint: disable=unused-argument """Callback before every n'th step begins. Args: step: `int`, the current value of the global step. Returns: A `list` of tensors that will be evaluated at this step. """ return []
[ "def", "every_n_step_begin", "(", "self", ",", "step", ")", ":", "# pylint: disable=unused-argument", "return", "[", "]" ]
https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/learn/python/learn/monitors.py#L315-L324
ricardoquesada/Spidermonkey
4a75ea2543408bd1b2c515aa95901523eeef7858
toolkit/crashreporter/tools/symbolstore.py
python
Dumper.ProcessFilesFinished
(self, res)
Callback from multiprocesing when ProcessFilesWork finishes; run the cleanup work, if any
Callback from multiprocesing when ProcessFilesWork finishes; run the cleanup work, if any
[ "Callback", "from", "multiprocesing", "when", "ProcessFilesWork", "finishes", ";", "run", "the", "cleanup", "work", "if", "any" ]
def ProcessFilesFinished(self, res): """Callback from multiprocesing when ProcessFilesWork finishes; run the cleanup work, if any""" self.JobFinished(res['files'][-1]) # only run the cleanup function once per tuple of files self.files_record[res['files']] += 1 if self.fil...
[ "def", "ProcessFilesFinished", "(", "self", ",", "res", ")", ":", "self", ".", "JobFinished", "(", "res", "[", "'files'", "]", "[", "-", "1", "]", ")", "# only run the cleanup function once per tuple of files", "self", ".", "files_record", "[", "res", "[", "'f...
https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/toolkit/crashreporter/tools/symbolstore.py#L578-L587
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/numpy/py3/numpy/polynomial/_polybase.py
python
ABCPolyBase.has_sametype
(self, other)
return isinstance(other, self.__class__)
Check if types match. .. versionadded:: 1.7.0 Parameters ---------- other : object Class instance. Returns ------- bool : boolean True if other is same class as self
Check if types match.
[ "Check", "if", "types", "match", "." ]
def has_sametype(self, other): """Check if types match. .. versionadded:: 1.7.0 Parameters ---------- other : object Class instance. Returns ------- bool : boolean True if other is same class as self """ return i...
[ "def", "has_sametype", "(", "self", ",", "other", ")", ":", "return", "isinstance", "(", "other", ",", "self", ".", "__class__", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/polynomial/_polybase.py#L236-L252
eventql/eventql
7ca0dbb2e683b525620ea30dc40540a22d5eb227
deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/make.py
python
MakefileWriter.WriteAndroidNdkModuleRule
(self, module_name, all_sources, link_deps)
Write a set of LOCAL_XXX definitions for Android NDK. These variable definitions will be used by Android NDK but do nothing for non-Android applications. Arguments: module_name: Android NDK module name, which must be unique among all module names. all_sources: A list of source files ...
Write a set of LOCAL_XXX definitions for Android NDK.
[ "Write", "a", "set", "of", "LOCAL_XXX", "definitions", "for", "Android", "NDK", "." ]
def WriteAndroidNdkModuleRule(self, module_name, all_sources, link_deps): """Write a set of LOCAL_XXX definitions for Android NDK. These variable definitions will be used by Android NDK but do nothing for non-Android applications. Arguments: module_name: Android NDK module name, which must be un...
[ "def", "WriteAndroidNdkModuleRule", "(", "self", ",", "module_name", ",", "all_sources", ",", "link_deps", ")", ":", "if", "self", ".", "type", "not", "in", "(", "'executable'", ",", "'shared_library'", ",", "'static_library'", ")", ":", "return", "self", ".",...
https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/make.py#L1726-L1806
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/lib2to3/pgen2/tokenize.py
python
tokenize
(readline, tokeneater=printtoken)
The tokenize() function accepts two parameters: one representing the input stream, and one providing an output mechanism for tokenize(). The first parameter, readline, must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the functio...
The tokenize() function accepts two parameters: one representing the input stream, and one providing an output mechanism for tokenize().
[ "The", "tokenize", "()", "function", "accepts", "two", "parameters", ":", "one", "representing", "the", "input", "stream", "and", "one", "providing", "an", "output", "mechanism", "for", "tokenize", "()", "." ]
def tokenize(readline, tokeneater=printtoken): """ The tokenize() function accepts two parameters: one representing the input stream, and one providing an output mechanism for tokenize(). The first parameter, readline, must be a callable object which provides the same interface as the readline() me...
[ "def", "tokenize", "(", "readline", ",", "tokeneater", "=", "printtoken", ")", ":", "try", ":", "tokenize_loop", "(", "readline", ",", "tokeneater", ")", "except", "StopTokenizing", ":", "pass" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/lib2to3/pgen2/tokenize.py#L148-L164
apache/incubator-mxnet
f03fb23f1d103fec9541b5ae59ee06b1734a51d9
python/mxnet/symbol/symbol.py
python
Symbol.__rmod__
(self, other)
x.__rmod__(y) <=> y%x Only `NDArray` is supported for now. Example ------- >>> x = mx.nd.ones((2,3))*3 >>> y = mx.nd.ones((2,3)) >>> x.__rmod__(y).asnumpy() array([[ 1., 1., 1., [ 1., 1., 1., dtype=float32)
x.__rmod__(y) <=> y%x
[ "x", ".", "__rmod__", "(", "y", ")", "<", "=", ">", "y%x" ]
def __rmod__(self, other): """x.__rmod__(y) <=> y%x Only `NDArray` is supported for now. Example ------- >>> x = mx.nd.ones((2,3))*3 >>> y = mx.nd.ones((2,3)) >>> x.__rmod__(y).asnumpy() array([[ 1., 1., 1., [ 1., 1., 1., dtype=float32...
[ "def", "__rmod__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "Symbol", ")", ":", "return", "other", ".", "__mod__", "(", "self", ")", "if", "isinstance", "(", "other", ",", "Number", ")", ":", "return", "_internal", ...
https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/symbol.py#L233-L251
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/contrib/metrics/python/ops/metric_ops.py
python
_streaming_sparse_false_positive_at_k
(predictions_idx, labels, k, class_id=None, weights=None, name=None)
Calculates weighted per step false positives for precision@k. If `class_id` is specified, calculate binary true positives for `class_id` only. If `class_id` is not specified, calculate metrics for `k` predicted vs `n` label classes, where `n` is the 2nd dimension of `labels`. If `weights` is `None`,...
Calculates weighted per step false positives for precision@k.
[ "Calculates", "weighted", "per", "step", "false", "positives", "for", "precision@k", "." ]
def _streaming_sparse_false_positive_at_k(predictions_idx, labels, k, class_id=None, weights=None, name=None):...
[ "def", "_streaming_sparse_false_positive_at_k", "(", "predictions_idx", ",", "labels", ",", "k", ",", "class_id", "=", "None", ",", "weights", "=", "None", ",", "name", "=", "None", ")", ":", "default_name", "=", "_at_k_name", "(", "'false_positive'", ",", "k"...
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/metrics/python/ops/metric_ops.py#L1947-L1992
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/gan/python/features/python/virtual_batchnorm_impl.py
python
_validate_call_input
(tensor_list, batch_dim)
Verifies that tensor shapes are compatible, except for `batch_dim`.
Verifies that tensor shapes are compatible, except for `batch_dim`.
[ "Verifies", "that", "tensor", "shapes", "are", "compatible", "except", "for", "batch_dim", "." ]
def _validate_call_input(tensor_list, batch_dim): """Verifies that tensor shapes are compatible, except for `batch_dim`.""" def _get_shape(tensor): shape = tensor.shape.as_list() del shape[batch_dim] return shape base_shape = tensor_shape.TensorShape(_get_shape(tensor_list[0])) for tensor in tensor_...
[ "def", "_validate_call_input", "(", "tensor_list", ",", "batch_dim", ")", ":", "def", "_get_shape", "(", "tensor", ")", ":", "shape", "=", "tensor", ".", "shape", ".", "as_list", "(", ")", "del", "shape", "[", "batch_dim", "]", "return", "shape", "base_sha...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/gan/python/features/python/virtual_batchnorm_impl.py#L98-L106
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py
python
_rshift_nearest
(x, shift)
return q + (2*(x & (b-1)) + (q&1) > b)
Given an integer x and a nonnegative integer shift, return closest integer to x / 2**shift; use round-to-even in case of a tie.
Given an integer x and a nonnegative integer shift, return closest integer to x / 2**shift; use round-to-even in case of a tie.
[ "Given", "an", "integer", "x", "and", "a", "nonnegative", "integer", "shift", "return", "closest", "integer", "to", "x", "/", "2", "**", "shift", ";", "use", "round", "-", "to", "-", "even", "in", "case", "of", "a", "tie", "." ]
def _rshift_nearest(x, shift): """Given an integer x and a nonnegative integer shift, return closest integer to x / 2**shift; use round-to-even in case of a tie. """ b, q = 1 << shift, x >> shift return q + (2*(x & (b-1)) + (q&1) > b)
[ "def", "_rshift_nearest", "(", "x", ",", "shift", ")", ":", "b", ",", "q", "=", "1", "<<", "shift", ",", "x", ">>", "shift", "return", "q", "+", "(", "2", "*", "(", "x", "&", "(", "b", "-", "1", ")", ")", "+", "(", "q", "&", "1", ")", "...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py#L5710-L5716
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/locators.py
python
PyPIRPCLocator.get_distribution_names
(self)
return set(self.client.list_packages())
Return all the distribution names known to this locator.
[]
def get_distribution_names(self): """ Return all the distribution names known to this locator. """ return set(self.client.list_packages())
[ "def", "get_distribution_names", "(", "self", ")", ":", "return", "set", "(", "self", ".", "client", ".", "list_packages", "(", ")", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/locators.py#L853-L861
google/llvm-propeller
45c226984fe8377ebfb2ad7713c680d652ba678d
mlir/utils/spirv/gen_spirv_dialect.py
python
snake_casify
(name)
return '_'.join(name)
Turns the given name to follow snake_case convention.
Turns the given name to follow snake_case convention.
[ "Turns", "the", "given", "name", "to", "follow", "snake_case", "convention", "." ]
def snake_casify(name): """Turns the given name to follow snake_case convention.""" name = re.sub('\W+', '', name).split() name = [s.lower() for s in name] return '_'.join(name)
[ "def", "snake_casify", "(", "name", ")", ":", "name", "=", "re", ".", "sub", "(", "'\\W+'", ",", "''", ",", "name", ")", ".", "split", "(", ")", "name", "=", "[", "s", ".", "lower", "(", ")", "for", "s", "in", "name", "]", "return", "'_'", "....
https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/mlir/utils/spirv/gen_spirv_dialect.py#L592-L596
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/distribute/cross_device_ops.py
python
_ConcatAndSplitPacker.__init__
(self, num_packs=1)
Initialize the _ConcatAndSplitPacker object. Args: num_packs: specifies the number of split packs that will be formed. Raises: ValueError: if num_packs is not greater than 0.
Initialize the _ConcatAndSplitPacker object.
[ "Initialize", "the", "_ConcatAndSplitPacker", "object", "." ]
def __init__(self, num_packs=1): """Initialize the _ConcatAndSplitPacker object. Args: num_packs: specifies the number of split packs that will be formed. Raises: ValueError: if num_packs is not greater than 0. """ if num_packs <= 0: raise ValueError("num_packs must be gr...
[ "def", "__init__", "(", "self", ",", "num_packs", "=", "1", ")", ":", "if", "num_packs", "<=", "0", ":", "raise", "ValueError", "(", "\"num_packs must be greater than zero.\"", ")", "self", ".", "num_packs", "=", "num_packs" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/cross_device_ops.py#L712-L724
SpenceKonde/megaTinyCore
1c4a70b18a149fe6bcb551dfa6db11ca50b8997b
megaavr/tools/libs/pymcuprog/backend.py
python
Backend.disconnect_from_tool
(self)
Disconnect the connected tool If no tool is connected nothing is done (i.e. no exception raised when not connected)
Disconnect the connected tool
[ "Disconnect", "the", "connected", "tool" ]
def disconnect_from_tool(self): """ Disconnect the connected tool If no tool is connected nothing is done (i.e. no exception raised when not connected) """ if self._is_connected_to_hid_tool(): self.housekeeper.end_session() self.transport.disconnect() ...
[ "def", "disconnect_from_tool", "(", "self", ")", ":", "if", "self", ".", "_is_connected_to_hid_tool", "(", ")", ":", "self", ".", "housekeeper", ".", "end_session", "(", ")", "self", ".", "transport", ".", "disconnect", "(", ")", "self", ".", "connected_to_t...
https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/pymcuprog/backend.py#L170-L180
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/_gdi.py
python
DCTextColourChanger.__init__
(self, *args, **kwargs)
__init__(self, DC dc, Colour col) -> DCTextColourChanger wx.DCTextColourChanger can be used to temporarily change the DC text colour and restore it automatically when the object goes out of scope
__init__(self, DC dc, Colour col) -> DCTextColourChanger
[ "__init__", "(", "self", "DC", "dc", "Colour", "col", ")", "-", ">", "DCTextColourChanger" ]
def __init__(self, *args, **kwargs): """ __init__(self, DC dc, Colour col) -> DCTextColourChanger wx.DCTextColourChanger can be used to temporarily change the DC text colour and restore it automatically when the object goes out of scope """ _gdi_.DCTextColourChanger_swi...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "_gdi_", ".", "DCTextColourChanger_swiginit", "(", "self", ",", "_gdi_", ".", "new_DCTextColourChanger", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L4868-L4875
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/ops/operations/array_ops.py
python
Slice.__init__
(self)
Initialize slice
Initialize slice
[ "Initialize", "slice" ]
def __init__(self): """Initialize slice""" self.init_prim_io_names(inputs=['x', 'begin', 'size'], outputs=['output'])
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "init_prim_io_names", "(", "inputs", "=", "[", "'x'", ",", "'begin'", ",", "'size'", "]", ",", "outputs", "=", "[", "'output'", "]", ")" ]
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/array_ops.py#L2867-L2869
bulletphysics/bullet3
f0f2a952e146f016096db6f85cf0c44ed75b0b9a
examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur.py
python
Minitaur.GetTrueBaseRollPitchYaw
(self)
return np.asarray(roll_pitch_yaw)
Get minitaur's base orientation in euler angle in the world frame. Returns: A tuple (roll, pitch, yaw) of the base in world frame.
Get minitaur's base orientation in euler angle in the world frame.
[ "Get", "minitaur", "s", "base", "orientation", "in", "euler", "angle", "in", "the", "world", "frame", "." ]
def GetTrueBaseRollPitchYaw(self): """Get minitaur's base orientation in euler angle in the world frame. Returns: A tuple (roll, pitch, yaw) of the base in world frame. """ orientation = self.GetTrueBaseOrientation() roll_pitch_yaw = self._pybullet_client.getEulerFromQuaternion(orientation) ...
[ "def", "GetTrueBaseRollPitchYaw", "(", "self", ")", ":", "orientation", "=", "self", ".", "GetTrueBaseOrientation", "(", ")", "roll_pitch_yaw", "=", "self", ".", "_pybullet_client", ".", "getEulerFromQuaternion", "(", "orientation", ")", "return", "np", ".", "asar...
https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur.py#L428-L436
hpi-xnor/BMXNet-v2
af2b1859eafc5c721b1397cef02f946aaf2ce20d
python/mxnet/ndarray/sparse.py
python
BaseSparseNDArray.copyto
(self, other)
Copies the value of this array to another array. Parameters ---------- other : NDArray or CSRNDArray or RowSparseNDArray or Context The destination array or context. Returns ------- NDArray or CSRNDArray or RowSparseNDArray The copied array.
Copies the value of this array to another array.
[ "Copies", "the", "value", "of", "this", "array", "to", "another", "array", "." ]
def copyto(self, other): """Copies the value of this array to another array. Parameters ---------- other : NDArray or CSRNDArray or RowSparseNDArray or Context The destination array or context. Returns ------- NDArray or CSRNDArray or RowSparseNDArra...
[ "def", "copyto", "(", "self", ",", "other", ")", ":", "# pylint: disable= no-member, protected-access", "if", "isinstance", "(", "other", ",", "NDArray", ")", ":", "if", "other", ".", "handle", "is", "self", ".", "handle", ":", "warnings", ".", "warn", "(", ...
https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/ndarray/sparse.py#L225-L249
PaddlePaddle/Paddle
1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c
python/paddle/fluid/contrib/slim/quantization/imperative/utils.py
python
load_variable_data
(scope, var_name)
return np.array(var_node.get_tensor())
Load variable value from scope
Load variable value from scope
[ "Load", "variable", "value", "from", "scope" ]
def load_variable_data(scope, var_name): """ Load variable value from scope """ var_node = scope.find_var(var_name) assert var_node is not None, \ "Can not find " + var_name + " in the scope." return np.array(var_node.get_tensor())
[ "def", "load_variable_data", "(", "scope", ",", "var_name", ")", ":", "var_node", "=", "scope", ".", "find_var", "(", "var_name", ")", "assert", "var_node", "is", "not", "None", ",", "\"Can not find \"", "+", "var_name", "+", "\" in the scope.\"", "return", "n...
https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/contrib/slim/quantization/imperative/utils.py#L89-L96
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/logging/__init__.py
python
captureWarnings
(capture)
If capture is true, redirect all warnings to the logging package. If capture is False, ensure that warnings are not redirected to logging but to their original destinations.
If capture is true, redirect all warnings to the logging package. If capture is False, ensure that warnings are not redirected to logging but to their original destinations.
[ "If", "capture", "is", "true", "redirect", "all", "warnings", "to", "the", "logging", "package", ".", "If", "capture", "is", "False", "ensure", "that", "warnings", "are", "not", "redirected", "to", "logging", "but", "to", "their", "original", "destinations", ...
def captureWarnings(capture): """ If capture is true, redirect all warnings to the logging package. If capture is False, ensure that warnings are not redirected to logging but to their original destinations. """ global _warnings_showwarning if capture: if _warnings_showwarning is Non...
[ "def", "captureWarnings", "(", "capture", ")", ":", "global", "_warnings_showwarning", "if", "capture", ":", "if", "_warnings_showwarning", "is", "None", ":", "_warnings_showwarning", "=", "warnings", ".", "showwarning", "warnings", ".", "showwarning", "=", "_showwa...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/logging/__init__.py#L2098-L2112
ricardoquesada/Spidermonkey
4a75ea2543408bd1b2c515aa95901523eeef7858
python/mozbuild/mozpack/manifests.py
python
InstallManifest.add_symlink
(self, source, dest)
Add a symlink to this manifest. dest will be a symlink to source.
Add a symlink to this manifest.
[ "Add", "a", "symlink", "to", "this", "manifest", "." ]
def add_symlink(self, source, dest): """Add a symlink to this manifest. dest will be a symlink to source. """ self._add_entry(dest, (self.SYMLINK, source))
[ "def", "add_symlink", "(", "self", ",", "source", ",", "dest", ")", ":", "self", ".", "_add_entry", "(", "dest", ",", "(", "self", ".", "SYMLINK", ",", "source", ")", ")" ]
https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/mozbuild/mozpack/manifests.py#L231-L236
nyuwireless-unipd/ns3-mmwave
4ff9e87e8079764e04cbeccd8e85bff15ae16fb3
utils/grid.py
python
Timeline.get_bounds
(self)
return(lo, hi)
! Get Bounds @param self this object @return the bounds
! Get Bounds
[ "!", "Get", "Bounds" ]
def get_bounds(self): """! Get Bounds @param self this object @return the bounds """ lo = 0 hi = 0 for range in self.ranges: (range_lo, range_hi) = range.get_bounds() if range_lo < lo: lo = range_lo if range_hi >...
[ "def", "get_bounds", "(", "self", ")", ":", "lo", "=", "0", "hi", "=", "0", "for", "range", "in", "self", ".", "ranges", ":", "(", "range_lo", ",", "range_hi", ")", "=", "range", ".", "get_bounds", "(", ")", "if", "range_lo", "<", "lo", ":", "lo"...
https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/utils/grid.py#L349-L374
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/graph_actions.py
python
clear_summary_writers
()
return summary_io.SummaryWriterCache.clear()
Clear cached summary writers. Currently only used for unit tests.
Clear cached summary writers. Currently only used for unit tests.
[ "Clear", "cached", "summary", "writers", ".", "Currently", "only", "used", "for", "unit", "tests", "." ]
def clear_summary_writers(): """Clear cached summary writers. Currently only used for unit tests.""" return summary_io.SummaryWriterCache.clear()
[ "def", "clear_summary_writers", "(", ")", ":", "return", "summary_io", ".", "SummaryWriterCache", ".", "clear", "(", ")" ]
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/graph_actions.py#L71-L73
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/richtext.py
python
RichTextRange.Swap
(*args, **kwargs)
return _richtext.RichTextRange_Swap(*args, **kwargs)
Swap(self) Swaps the start and end
Swap(self)
[ "Swap", "(", "self", ")" ]
def Swap(*args, **kwargs): """ Swap(self) Swaps the start and end """ return _richtext.RichTextRange_Swap(*args, **kwargs)
[ "def", "Swap", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_richtext", ".", "RichTextRange_Swap", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L1029-L1035
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/boosted_trees/estimator_batch/dnn_tree_combined_estimator.py
python
_dnn_tree_combined_model_fn
( features, labels, mode, head, dnn_hidden_units, dnn_feature_columns, tree_learner_config, num_trees, tree_examples_per_layer, config=None, dnn_optimizer="Adagrad", dnn_activation_fn=nn.relu, dnn_dropout=None, dnn_input_layer_partitioner=None, dnn_input_layer...
DNN and GBDT combined model_fn. Args: features: `dict` of `Tensor` objects. labels: Labels used to train on. mode: Mode we are in. (TRAIN/EVAL/INFER) head: A `Head` instance. dnn_hidden_units: List of hidden units per layer. dnn_feature_columns: An iterable containing all the feature columns ...
DNN and GBDT combined model_fn.
[ "DNN", "and", "GBDT", "combined", "model_fn", "." ]
def _dnn_tree_combined_model_fn( features, labels, mode, head, dnn_hidden_units, dnn_feature_columns, tree_learner_config, num_trees, tree_examples_per_layer, config=None, dnn_optimizer="Adagrad", dnn_activation_fn=nn.relu, dnn_dropout=None, dnn_input_layer_partit...
[ "def", "_dnn_tree_combined_model_fn", "(", "features", ",", "labels", ",", "mode", ",", "head", ",", "dnn_hidden_units", ",", "dnn_feature_columns", ",", "tree_learner_config", ",", "num_trees", ",", "tree_examples_per_layer", ",", "config", "=", "None", ",", "dnn_o...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/boosted_trees/estimator_batch/dnn_tree_combined_estimator.py#L66-L387
weolar/miniblink49
1c4678db0594a4abde23d3ebbcc7cd13c3170777
third_party/jinja2/parser.py
python
Parser.parse_assign_target
(self, with_tuple=True, name_only=False, extra_end_rules=None)
return target
Parse an assignment target. As Jinja2 allows assignments to tuples, this function can parse all allowed assignment targets. Per default assignments to tuples are parsed, that can be disable however by setting `with_tuple` to `False`. If only assignments to names are wanted `name_only`...
Parse an assignment target. As Jinja2 allows assignments to tuples, this function can parse all allowed assignment targets. Per default assignments to tuples are parsed, that can be disable however by setting `with_tuple` to `False`. If only assignments to names are wanted `name_only`...
[ "Parse", "an", "assignment", "target", ".", "As", "Jinja2", "allows", "assignments", "to", "tuples", "this", "function", "can", "parse", "all", "allowed", "assignment", "targets", ".", "Per", "default", "assignments", "to", "tuples", "are", "parsed", "that", "...
def parse_assign_target(self, with_tuple=True, name_only=False, extra_end_rules=None): """Parse an assignment target. As Jinja2 allows assignments to tuples, this function can parse all allowed assignment targets. Per default assignments to tuples are parsed, that c...
[ "def", "parse_assign_target", "(", "self", ",", "with_tuple", "=", "True", ",", "name_only", "=", "False", ",", "extra_end_rules", "=", "None", ")", ":", "if", "name_only", ":", "token", "=", "self", ".", "stream", ".", "expect", "(", "'name'", ")", "tar...
https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/jinja2/parser.py#L356-L378
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/gsutil/third_party/boto/boto/sdb/connection.py
python
SDBConnection.create_domain
(self, domain_name)
return d
Create a SimpleDB domain. :type domain_name: string :param domain_name: The name of the new domain :rtype: :class:`boto.sdb.domain.Domain` object :return: The newly created domain
Create a SimpleDB domain.
[ "Create", "a", "SimpleDB", "domain", "." ]
def create_domain(self, domain_name): """ Create a SimpleDB domain. :type domain_name: string :param domain_name: The name of the new domain :rtype: :class:`boto.sdb.domain.Domain` object :return: The newly created domain """ params = {'DomainName': doma...
[ "def", "create_domain", "(", "self", ",", "domain_name", ")", ":", "params", "=", "{", "'DomainName'", ":", "domain_name", "}", "d", "=", "self", ".", "get_object", "(", "'CreateDomain'", ",", "params", ",", "Domain", ")", "d", ".", "name", "=", "domain_...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/sdb/connection.py#L310-L323
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/py3/scipy/stats/morestats.py
python
_yeojohnson_transform
(x, lmbda)
return out
Return x transformed by the Yeo-Johnson power transform with given parameter lmbda.
Return x transformed by the Yeo-Johnson power transform with given parameter lmbda.
[ "Return", "x", "transformed", "by", "the", "Yeo", "-", "Johnson", "power", "transform", "with", "given", "parameter", "lmbda", "." ]
def _yeojohnson_transform(x, lmbda): """Return x transformed by the Yeo-Johnson power transform with given parameter lmbda.""" out = np.zeros_like(x) pos = x >= 0 # binary mask # when x >= 0 if abs(lmbda) < np.spacing(1.): out[pos] = np.log1p(x[pos]) else: # lmbda != 0 ou...
[ "def", "_yeojohnson_transform", "(", "x", ",", "lmbda", ")", ":", "out", "=", "np", ".", "zeros_like", "(", "x", ")", "pos", "=", "x", ">=", "0", "# binary mask", "# when x >= 0", "if", "abs", "(", "lmbda", ")", "<", "np", ".", "spacing", "(", "1.", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/stats/morestats.py#L1346-L1365
sideeffects/HoudiniEngineForUnreal
a52be617d90495bda6072fe732f0d2eec33b54f3
Content/Python/HoudiniEngineV2/asyncprocessor.py
python
ProcessHDA.houdini_asset
(self)
return self._houdini_asset
The HDA to instantiate.
The HDA to instantiate.
[ "The", "HDA", "to", "instantiate", "." ]
def houdini_asset(self): """ The HDA to instantiate. """ return self._houdini_asset
[ "def", "houdini_asset", "(", "self", ")", ":", "return", "self", ".", "_houdini_asset" ]
https://github.com/sideeffects/HoudiniEngineForUnreal/blob/a52be617d90495bda6072fe732f0d2eec33b54f3/Content/Python/HoudiniEngineV2/asyncprocessor.py#L150-L152
deepmind/open_spiel
4ca53bea32bb2875c7385d215424048ae92f78c8
open_spiel/python/algorithms/psro_v2/psro_v2.py
python
PSROSolver.get_meta_game
(self)
return self._meta_games
Returns the meta game matrix.
Returns the meta game matrix.
[ "Returns", "the", "meta", "game", "matrix", "." ]
def get_meta_game(self): """Returns the meta game matrix.""" return self._meta_games
[ "def", "get_meta_game", "(", "self", ")", ":", "return", "self", ".", "_meta_games" ]
https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/psro_v2/psro_v2.py#L462-L464
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/collections/__init__.py
python
OrderedDict.__repr__
(self)
return '%s(%r)' % (self.__class__.__name__, list(self.items()))
od.__repr__() <==> repr(od)
od.__repr__() <==> repr(od)
[ "od", ".", "__repr__", "()", "<", "==", ">", "repr", "(", "od", ")" ]
def __repr__(self): 'od.__repr__() <==> repr(od)' if not self: return '%s()' % (self.__class__.__name__,) return '%s(%r)' % (self.__class__.__name__, list(self.items()))
[ "def", "__repr__", "(", "self", ")", ":", "if", "not", "self", ":", "return", "'%s()'", "%", "(", "self", ".", "__class__", ".", "__name__", ",", ")", "return", "'%s(%r)'", "%", "(", "self", ".", "__class__", ".", "__name__", ",", "list", "(", "self"...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/collections/__init__.py#L267-L271
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/s3transfer/manager.py
python
TransferCoordinatorController.add_transfer_coordinator
(self, transfer_coordinator)
Adds a transfer coordinator of a transfer to be canceled if needed :type transfer_coordinator: s3transfer.futures.TransferCoordinator :param transfer_coordinator: The transfer coordinator for the particular transfer
Adds a transfer coordinator of a transfer to be canceled if needed
[ "Adds", "a", "transfer", "coordinator", "of", "a", "transfer", "to", "be", "canceled", "if", "needed" ]
def add_transfer_coordinator(self, transfer_coordinator): """Adds a transfer coordinator of a transfer to be canceled if needed :type transfer_coordinator: s3transfer.futures.TransferCoordinator :param transfer_coordinator: The transfer coordinator for the particular transfer ...
[ "def", "add_transfer_coordinator", "(", "self", ",", "transfer_coordinator", ")", ":", "with", "self", ".", "_lock", ":", "self", ".", "_tracked_transfer_coordinators", ".", "add", "(", "transfer_coordinator", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/s3transfer/manager.py#L602-L610
krishauser/Klampt
972cc83ea5befac3f653c1ba20f80155768ad519
Python/klampt/vis/glinterface.py
python
GLPluginInterface.eventfunc
(self,type,args="")
return False
Generic hook for other events, e.g., button presses, from the GUI
Generic hook for other events, e.g., button presses, from the GUI
[ "Generic", "hook", "for", "other", "events", "e", ".", "g", ".", "button", "presses", "from", "the", "GUI" ]
def eventfunc(self,type,args="") -> bool: """Generic hook for other events, e.g., button presses, from the GUI""" return False
[ "def", "eventfunc", "(", "self", ",", "type", ",", "args", "=", "\"\"", ")", "->", "bool", ":", "return", "False" ]
https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/vis/glinterface.py#L46-L48
miyosuda/TensorFlowAndroidMNIST
7b5a4603d2780a8a2834575706e9001977524007
jni-build/jni/include/tensorflow/python/ops/control_flow_ops.py
python
IsSwitch
(op)
return op.type == "Switch" or op.type == "RefSwitch"
Return true if `op` is the Switch.
Return true if `op` is the Switch.
[ "Return", "true", "if", "op", "is", "the", "Switch", "." ]
def IsSwitch(op): """Return true if `op` is the Switch.""" return op.type == "Switch" or op.type == "RefSwitch"
[ "def", "IsSwitch", "(", "op", ")", ":", "return", "op", ".", "type", "==", "\"Switch\"", "or", "op", ".", "type", "==", "\"RefSwitch\"" ]
https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/control_flow_ops.py#L1040-L1042
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py3/pandas/core/indexes/base.py
python
Index.argsort
(self, *args, **kwargs)
return self._data.argsort(*args, **kwargs)
Return the integer indices that would sort the index. Parameters ---------- *args Passed to `numpy.ndarray.argsort`. **kwargs Passed to `numpy.ndarray.argsort`. Returns ------- np.ndarray[np.intp] Integer indices that would so...
Return the integer indices that would sort the index.
[ "Return", "the", "integer", "indices", "that", "would", "sort", "the", "index", "." ]
def argsort(self, *args, **kwargs) -> np.ndarray: """ Return the integer indices that would sort the index. Parameters ---------- *args Passed to `numpy.ndarray.argsort`. **kwargs Passed to `numpy.ndarray.argsort`. Returns -------...
[ "def", "argsort", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "np", ".", "ndarray", ":", "# This works for either ndarray or EA, is overridden", "# by RangeIndex, MultIIndex", "return", "self", ".", "_data", ".", "argsort", "(", "*", "arg...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/indexes/base.py#L5084-L5121
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/dataview.py
python
DataViewItemAttr.SetColour
(*args, **kwargs)
return _dataview.DataViewItemAttr_SetColour(*args, **kwargs)
SetColour(self, Colour colour)
SetColour(self, Colour colour)
[ "SetColour", "(", "self", "Colour", "colour", ")" ]
def SetColour(*args, **kwargs): """SetColour(self, Colour colour)""" return _dataview.DataViewItemAttr_SetColour(*args, **kwargs)
[ "def", "SetColour", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_dataview", ".", "DataViewItemAttr_SetColour", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/dataview.py#L333-L335
echronos/echronos
c996f1d2c8af6c6536205eb319c1bf1d4d84569c
external_tools/pystache/common.py
python
read
(path)
Return the contents of a text file as a byte string.
Return the contents of a text file as a byte string.
[ "Return", "the", "contents", "of", "a", "text", "file", "as", "a", "byte", "string", "." ]
def read(path): """ Return the contents of a text file as a byte string. """ with open(path, 'rb') as f: return f.read()
[ "def", "read", "(", "path", ")", ":", "with", "open", "(", "path", ",", "'rb'", ")", "as", "f", ":", "return", "f", ".", "read", "(", ")" ]
https://github.com/echronos/echronos/blob/c996f1d2c8af6c6536205eb319c1bf1d4d84569c/external_tools/pystache/common.py#L24-L30
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/tkinter/ttk.py
python
Treeview.delete
(self, *items)
Delete all specified items and all their descendants. The root item may not be deleted.
Delete all specified items and all their descendants. The root item may not be deleted.
[ "Delete", "all", "specified", "items", "and", "all", "their", "descendants", ".", "The", "root", "item", "may", "not", "be", "deleted", "." ]
def delete(self, *items): """Delete all specified items and all their descendants. The root item may not be deleted.""" self.tk.call(self._w, "delete", items)
[ "def", "delete", "(", "self", ",", "*", "items", ")", ":", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "\"delete\"", ",", "items", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/ttk.py#L1250-L1253
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/python/training/input.py
python
_shapes
(tensor_list_list, shapes, enqueue_many)
return shapes
Calculate and merge the shapes of incoming tensors. Args: tensor_list_list: List of tensor lists. shapes: List of shape tuples corresponding to tensors within the lists. enqueue_many: Boolean describing whether shapes will be enqueued as batches or individual entries. Returns: A list of shap...
Calculate and merge the shapes of incoming tensors.
[ "Calculate", "and", "merge", "the", "shapes", "of", "incoming", "tensors", "." ]
def _shapes(tensor_list_list, shapes, enqueue_many): """Calculate and merge the shapes of incoming tensors. Args: tensor_list_list: List of tensor lists. shapes: List of shape tuples corresponding to tensors within the lists. enqueue_many: Boolean describing whether shapes will be enqueued as bat...
[ "def", "_shapes", "(", "tensor_list_list", ",", "shapes", ",", "enqueue_many", ")", ":", "if", "shapes", "is", "None", ":", "len0", "=", "len", "(", "tensor_list_list", "[", "0", "]", ")", "for", "tl", "in", "tensor_list_list", ":", "for", "i", "in", "...
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/training/input.py#L613-L641
miyosuda/TensorFlowAndroidMNIST
7b5a4603d2780a8a2834575706e9001977524007
jni-build/jni/include/external/bazel_tools/tools/android/merge_manifests.py
python
MergeManifests._ReplaceArgumentHelper
(self, placeholders, attr)
return attr
Replaces argument placeholders within a single string. Args: placeholders: A dict mapping between placeholder names and their replacement values. attr: A string in which to replace argument placeholders. Returns: A string with placeholders replaced, or the same string if ...
Replaces argument placeholders within a single string.
[ "Replaces", "argument", "placeholders", "within", "a", "single", "string", "." ]
def _ReplaceArgumentHelper(self, placeholders, attr): """Replaces argument placeholders within a single string. Args: placeholders: A dict mapping between placeholder names and their replacement values. attr: A string in which to replace argument placeholders. Returns: ...
[ "def", "_ReplaceArgumentHelper", "(", "self", ",", "placeholders", ",", "attr", ")", ":", "match_placeholder", "=", "'\\\\${([a-zA-Z]*)}'", "# Returns the replacement string for found matches.", "def", "PlaceholderReplacer", "(", "matchobj", ")", ":", "found_placeholder", "...
https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/external/bazel_tools/tools/android/merge_manifests.py#L272-L297
libornovax/master_thesis_code
6eca474ed3cae673afde010caef338cf7349f839
caffe/scripts/download_model_binary.py
python
reporthook
(count, block_size, total_size)
From http://blog.moleculea.com/2012/10/04/urlretrieve-progres-indicator/
From http://blog.moleculea.com/2012/10/04/urlretrieve-progres-indicator/
[ "From", "http", ":", "//", "blog", ".", "moleculea", ".", "com", "/", "2012", "/", "10", "/", "04", "/", "urlretrieve", "-", "progres", "-", "indicator", "/" ]
def reporthook(count, block_size, total_size): """ From http://blog.moleculea.com/2012/10/04/urlretrieve-progres-indicator/ """ global start_time if count == 0: start_time = time.time() return duration = (time.time() - start_time) or 0.01 progress_size = int(count * block_siz...
[ "def", "reporthook", "(", "count", ",", "block_size", ",", "total_size", ")", ":", "global", "start_time", "if", "count", "==", "0", ":", "start_time", "=", "time", ".", "time", "(", ")", "return", "duration", "=", "(", "time", ".", "time", "(", ")", ...
https://github.com/libornovax/master_thesis_code/blob/6eca474ed3cae673afde010caef338cf7349f839/caffe/scripts/download_model_binary.py#L14-L28
tensorflow/deepmath
b5b721f54de1d5d6a02d78f5da5995237f9995f9
deepmath/deephol/deephol_loop/loop_pipeline.py
python
LoopPipeline.perform_round
(self, initial_examples)
Perform a single round of the loop and advance the loop counter.
Perform a single round of the loop and advance the loop counter.
[ "Perform", "a", "single", "round", "of", "the", "loop", "and", "advance", "the", "loop", "counter", "." ]
def perform_round(self, initial_examples): """Perform a single round of the loop and advance the loop counter.""" current_round = self.loop_meta.status.current_round if current_round == 0: self.setup_examples(initial_examples) if not self.prover_tasks: logging.info('No tasks for proving...')...
[ "def", "perform_round", "(", "self", ",", "initial_examples", ")", ":", "current_round", "=", "self", ".", "loop_meta", ".", "status", ".", "current_round", "if", "current_round", "==", "0", ":", "self", ".", "setup_examples", "(", "initial_examples", ")", "if...
https://github.com/tensorflow/deepmath/blob/b5b721f54de1d5d6a02d78f5da5995237f9995f9/deepmath/deephol/deephol_loop/loop_pipeline.py#L357-L383
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/training/python/training/training.py
python
create_train_op
(total_loss, optimizer, global_step=_USE_GLOBAL_STEP, update_ops=None, variables_to_train=None, transform_grads_fn=None, summarize_gradients=False, gate_gradients=tf_optimizer.Opti...
return train_op
Creates an `Operation` that evaluates the gradients and returns the loss. Args: total_loss: A `Tensor` representing the total loss. optimizer: A tf.Optimizer to use for computing the gradients. global_step: A `Tensor` representing the global step variable. If left as `_USE_GLOBAL_STEP`, then tf.con...
Creates an `Operation` that evaluates the gradients and returns the loss.
[ "Creates", "an", "Operation", "that", "evaluates", "the", "gradients", "and", "returns", "the", "loss", "." ]
def create_train_op(total_loss, optimizer, global_step=_USE_GLOBAL_STEP, update_ops=None, variables_to_train=None, transform_grads_fn=None, summarize_gradients=False, gate_gradient...
[ "def", "create_train_op", "(", "total_loss", ",", "optimizer", ",", "global_step", "=", "_USE_GLOBAL_STEP", ",", "update_ops", "=", "None", ",", "variables_to_train", "=", "None", ",", "transform_grads_fn", "=", "None", ",", "summarize_gradients", "=", "False", ",...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/training/python/training/training.py#L370-L474
okex/V3-Open-API-SDK
c5abb0db7e2287718e0055e17e57672ce0ec7fd9
okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_internal/cli/cmdoptions.py
python
make_option_group
(group, parser)
return option_group
Return an OptionGroup object group -- assumed to be dict with 'name' and 'options' keys parser -- an optparse Parser
Return an OptionGroup object group -- assumed to be dict with 'name' and 'options' keys parser -- an optparse Parser
[ "Return", "an", "OptionGroup", "object", "group", "--", "assumed", "to", "be", "dict", "with", "name", "and", "options", "keys", "parser", "--", "an", "optparse", "Parser" ]
def make_option_group(group, parser): # type: (Dict[str, Any], ConfigOptionParser) -> OptionGroup """ Return an OptionGroup object group -- assumed to be dict with 'name' and 'options' keys parser -- an optparse Parser """ option_group = OptionGroup(parser, group['name']) for option in ...
[ "def", "make_option_group", "(", "group", ",", "parser", ")", ":", "# type: (Dict[str, Any], ConfigOptionParser) -> OptionGroup", "option_group", "=", "OptionGroup", "(", "parser", ",", "group", "[", "'name'", "]", ")", "for", "option", "in", "group", "[", "'options...
https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_internal/cli/cmdoptions.py#L46-L56
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/gsutil/third_party/python-gflags/gflags.py
python
FlagValues.SetDefault
(self, name, value)
Changes the default value of the named flag object.
Changes the default value of the named flag object.
[ "Changes", "the", "default", "value", "of", "the", "named", "flag", "object", "." ]
def SetDefault(self, name, value): """Changes the default value of the named flag object.""" fl = self.FlagDict() if name not in fl: raise AttributeError(name) fl[name].SetDefault(value) self._AssertValidators(fl[name].validators)
[ "def", "SetDefault", "(", "self", ",", "name", ",", "value", ")", ":", "fl", "=", "self", ".", "FlagDict", "(", ")", "if", "name", "not", "in", "fl", ":", "raise", "AttributeError", "(", "name", ")", "fl", "[", "name", "]", ".", "SetDefault", "(", ...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/python-gflags/gflags.py#L1172-L1178
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/examples/how_tos/reading_data/fully_connected_preloaded.py
python
run_training
()
Train MNIST for a number of epochs.
Train MNIST for a number of epochs.
[ "Train", "MNIST", "for", "a", "number", "of", "epochs", "." ]
def run_training(): """Train MNIST for a number of epochs.""" # Get the sets of images and labels for training, validation, and # test on MNIST. data_sets = input_data.read_data_sets(FLAGS.train_dir, FLAGS.fake_data) # Tell TensorFlow that the model will be built into the default Graph. with tf.Graph().as_...
[ "def", "run_training", "(", ")", ":", "# Get the sets of images and labels for training, validation, and", "# test on MNIST.", "data_sets", "=", "input_data", ".", "read_data_sets", "(", "FLAGS", ".", "train_dir", ",", "FLAGS", ".", "fake_data", ")", "# Tell TensorFlow that...
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/examples/how_tos/reading_data/fully_connected_preloaded.py#L45-L136
OSGeo/gdal
3748fc4ba4fba727492774b2b908a2130c864a83
swig/python/osgeo/gdal.py
python
Band.GetUnitType
(self, *args)
return _gdal.Band_GetUnitType(self, *args)
r"""GetUnitType(Band self) -> char const *
r"""GetUnitType(Band self) -> char const *
[ "r", "GetUnitType", "(", "Band", "self", ")", "-", ">", "char", "const", "*" ]
def GetUnitType(self, *args): r"""GetUnitType(Band self) -> char const *""" return _gdal.Band_GetUnitType(self, *args)
[ "def", "GetUnitType", "(", "self", ",", "*", "args", ")", ":", "return", "_gdal", ".", "Band_GetUnitType", "(", "self", ",", "*", "args", ")" ]
https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/gdal.py#L3424-L3426
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/ops/composite/math_ops.py
python
resize_nearest_neighbor
(input_x, size, align_corners=False)
return resize(input_x, size)
r""" Resizes the input tensor by using the nearest neighbor algorithm. Resizes the input tensor to a given size by using the nearest neighbor algorithm. The nearest neighbor algorithm selects the value of the nearest point and does not consider the values of neighboring points at all, yielding a piecew...
r""" Resizes the input tensor by using the nearest neighbor algorithm.
[ "r", "Resizes", "the", "input", "tensor", "by", "using", "the", "nearest", "neighbor", "algorithm", "." ]
def resize_nearest_neighbor(input_x, size, align_corners=False): r""" Resizes the input tensor by using the nearest neighbor algorithm. Resizes the input tensor to a given size by using the nearest neighbor algorithm. The nearest neighbor algorithm selects the value of the nearest point and does not co...
[ "def", "resize_nearest_neighbor", "(", "input_x", ",", "size", ",", "align_corners", "=", "False", ")", ":", "if", "size", "is", "None", ":", "raise", "ValueError", "(", "f'For ResizeNearestNeighbor, size could not be None.'", ")", "if", "isinstance", "(", "size", ...
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/composite/math_ops.py#L924-L969
hpi-xnor/BMXNet-v2
af2b1859eafc5c721b1397cef02f946aaf2ce20d
python/mxnet/module/base_module.py
python
BaseModule.update_metric
(self, eval_metric, labels, pre_sliced=False)
Evaluates and accumulates evaluation metric on outputs of the last forward computation. Parameters ---------- eval_metric : EvalMetric Evaluation metric to use. labels : list of NDArray if `pre_sliced` parameter is set to `False`, list of lists of NDArray...
Evaluates and accumulates evaluation metric on outputs of the last forward computation.
[ "Evaluates", "and", "accumulates", "evaluation", "metric", "on", "outputs", "of", "the", "last", "forward", "computation", "." ]
def update_metric(self, eval_metric, labels, pre_sliced=False): """Evaluates and accumulates evaluation metric on outputs of the last forward computation. Parameters ---------- eval_metric : EvalMetric Evaluation metric to use. labels : list of NDArray if `pr...
[ "def", "update_metric", "(", "self", ",", "eval_metric", ",", "labels", ",", "pre_sliced", "=", "False", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/module/base_module.py#L966-L985
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/devil/devil/android/valgrind_tools/base_tool.py
python
BaseTool.GetTimeoutScale
(self)
return 1.0
Returns a multiplier that should be applied to timeout values.
Returns a multiplier that should be applied to timeout values.
[ "Returns", "a", "multiplier", "that", "should", "be", "applied", "to", "timeout", "values", "." ]
def GetTimeoutScale(self): """Returns a multiplier that should be applied to timeout values.""" return 1.0
[ "def", "GetTimeoutScale", "(", "self", ")", ":", "return", "1.0" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/devil/devil/android/valgrind_tools/base_tool.py#L43-L45
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/training/tensorboard_logging.py
python
set_summary_writer
(summary_writer)
Sets the summary writer that events will be logged to. Calling any logging methods inside this module without calling this method will fail. If you don't want to log, call `set_summary_writer(None)`. Args: summary_writer: Either a SummaryWriter or None. None will cause messages not to be logged to any S...
Sets the summary writer that events will be logged to.
[ "Sets", "the", "summary", "writer", "that", "events", "will", "be", "logged", "to", "." ]
def set_summary_writer(summary_writer): """Sets the summary writer that events will be logged to. Calling any logging methods inside this module without calling this method will fail. If you don't want to log, call `set_summary_writer(None)`. Args: summary_writer: Either a SummaryWriter or None. None will...
[ "def", "set_summary_writer", "(", "summary_writer", ")", ":", "global", "_summary_writer", "_summary_writer", "=", "summary_writer" ]
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/training/tensorboard_logging.py#L92-L104
fasiondog/hikyuu
842751aa25283f9fdafc6f560ea262f79e67a307
hikyuu/data/pytdx_finance_to_sqlite.py
python
pytdx_import_finance
(db_connect, pytdx_connect, market)
return len(records)
导入公司财务信息
导入公司财务信息
[ "导入公司财务信息" ]
def pytdx_import_finance(db_connect, pytdx_connect, market): """导入公司财务信息""" marketid = get_marketid(db_connect, market) sql = "select stockid, marketid, code, valid, type from stock where marketid={} and type = {} and valid=1"\ .format(marketid, STOCKTYPE.A) cur = db_connect.cursor() al...
[ "def", "pytdx_import_finance", "(", "db_connect", ",", "pytdx_connect", ",", "market", ")", ":", "marketid", "=", "get_marketid", "(", "db_connect", ",", "market", ")", "sql", "=", "\"select stockid, marketid, code, valid, type from stock where marketid={} and type = {} and v...
https://github.com/fasiondog/hikyuu/blob/842751aa25283f9fdafc6f560ea262f79e67a307/hikyuu/data/pytdx_finance_to_sqlite.py#L29-L136
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/saved_model/builder_impl.py
python
copy_assets_to_destination_dir
(asset_filename_map, destination_dir)
Copy all assets from source path to destination path.
Copy all assets from source path to destination path.
[ "Copy", "all", "assets", "from", "source", "path", "to", "destination", "path", "." ]
def copy_assets_to_destination_dir(asset_filename_map, destination_dir): """Copy all assets from source path to destination path.""" assets_destination_dir = saved_model_utils.get_or_create_assets_dir( destination_dir) # Copy each asset from source path to destination path. for asset_basename, asset_sour...
[ "def", "copy_assets_to_destination_dir", "(", "asset_filename_map", ",", "destination_dir", ")", ":", "assets_destination_dir", "=", "saved_model_utils", ".", "get_or_create_assets_dir", "(", "destination_dir", ")", "# Copy each asset from source path to destination path.", "for", ...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/saved_model/builder_impl.py#L756-L774
tensorflow/io
92b44e180674a8af0e12e405530f7343e3e693e4
tensorflow_io/python/experimental/io_dataset_ops.py
python
IODataset.from_numpy
(cls, a, **kwargs)
Creates an `IODataset` from Numpy arrays. The `from_numpy` allows user to create a Dataset from a dict, tuple, or individual element of numpy array_like. The `Dataset` created through `from_numpy` has the same dtypes as the input elements of array_like. The shapes of the `Dataset` ...
Creates an `IODataset` from Numpy arrays.
[ "Creates", "an", "IODataset", "from", "Numpy", "arrays", "." ]
def from_numpy(cls, a, **kwargs): """Creates an `IODataset` from Numpy arrays. The `from_numpy` allows user to create a Dataset from a dict, tuple, or individual element of numpy array_like. The `Dataset` created through `from_numpy` has the same dtypes as the input elements of ...
[ "def", "from_numpy", "(", "cls", ",", "a", ",", "*", "*", "kwargs", ")", ":", "with", "tf", ".", "name_scope", "(", "kwargs", ".", "get", "(", "\"name\"", ",", "\"IOFromNumpy\"", ")", ")", ":", "return", "numpy_dataset_ops", ".", "NumpyIODataset", "(", ...
https://github.com/tensorflow/io/blob/92b44e180674a8af0e12e405530f7343e3e693e4/tensorflow_io/python/experimental/io_dataset_ops.py#L118-L158
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/ssl.py
python
match_hostname
(cert, hostname)
Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function returns nothing.
Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*.
[ "Verify", "that", "*", "cert", "*", "(", "in", "decoded", "format", "as", "returned", "by", "SSLSocket", ".", "getpeercert", "()", ")", "matches", "the", "*", "hostname", "*", ".", "RFC", "2818", "and", "RFC", "6125", "rules", "are", "followed", "but", ...
def match_hostname(cert, hostname): """Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function r...
[ "def", "match_hostname", "(", "cert", ",", "hostname", ")", ":", "if", "not", "cert", ":", "raise", "ValueError", "(", "\"empty or no certificate, match_hostname needs a \"", "\"SSL socket or SSL context with either \"", "\"CERT_OPTIONAL or CERT_REQUIRED\"", ")", "dnsnames", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/ssl.py#L255-L295
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py2/pandas/core/dtypes/common.py
python
is_numeric_v_string_like
(a, b)
return ((is_a_numeric_array and is_b_scalar_string_like) or (is_b_numeric_array and is_a_scalar_string_like) or (is_a_numeric_array and is_b_string_array) or (is_b_numeric_array and is_a_string_array))
Check if we are comparing a string-like object to a numeric ndarray. NumPy doesn't like to compare such objects, especially numeric arrays and scalar string-likes. Parameters ---------- a : array-like, scalar The first object to check. b : array-like, scalar The second object t...
Check if we are comparing a string-like object to a numeric ndarray.
[ "Check", "if", "we", "are", "comparing", "a", "string", "-", "like", "object", "to", "a", "numeric", "ndarray", "." ]
def is_numeric_v_string_like(a, b): """ Check if we are comparing a string-like object to a numeric ndarray. NumPy doesn't like to compare such objects, especially numeric arrays and scalar string-likes. Parameters ---------- a : array-like, scalar The first object to check. b ...
[ "def", "is_numeric_v_string_like", "(", "a", ",", "b", ")", ":", "is_a_array", "=", "isinstance", "(", "a", ",", "np", ".", "ndarray", ")", "is_b_array", "=", "isinstance", "(", "b", ",", "np", ".", "ndarray", ")", "is_a_numeric_array", "=", "is_a_array", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/dtypes/common.py#L1262-L1317
tpfister/caffe-heatmap
4db69ef53e6b8a0b3b4ebb29328b0ab3dbf67c4e
scripts/cpp_lint.py
python
CheckForNonStandardConstructs
(filename, clean_lines, linenum, nesting_state, error)
r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2. Complain about several constructs which gcc-2 accepts, but which are not standard C++. Warning about these in lint is one way to ease the transition to new compilers. - put storage class first (e.g. "static const" instead of "const stat...
r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
[ "r", "Logs", "an", "error", "if", "we", "see", "certain", "non", "-", "ANSI", "constructs", "ignored", "by", "gcc", "-", "2", "." ]
def CheckForNonStandardConstructs(filename, clean_lines, linenum, nesting_state, error): r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2. Complain about several constructs which gcc-2 accepts, but which are not standard C++. Warning about these in lint ...
[ "def", "CheckForNonStandardConstructs", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "nesting_state", ",", "error", ")", ":", "# Remove comments from the line, but leave in strings for now.", "line", "=", "clean_lines", ".", "lines", "[", "linenum", "]", "i...
https://github.com/tpfister/caffe-heatmap/blob/4db69ef53e6b8a0b3b4ebb29328b0ab3dbf67c4e/scripts/cpp_lint.py#L2194-L2298
microsoft/TSS.MSR
0f2516fca2cd9929c31d5450e39301c9bde43688
TSS.Py/src/TpmTypes.py
python
TPMS_TAGGED_PROPERTY.__init__
(self, property = 0, value = 0)
This structure is used to report the properties that are UINT32 values. It is returned in response to a TPM2_GetCapability(). Attributes: property (TPM_PT): A property identifier value (int): The value of the property
This structure is used to report the properties that are UINT32 values. It is returned in response to a TPM2_GetCapability().
[ "This", "structure", "is", "used", "to", "report", "the", "properties", "that", "are", "UINT32", "values", ".", "It", "is", "returned", "in", "response", "to", "a", "TPM2_GetCapability", "()", "." ]
def __init__(self, property = 0, value = 0): """ This structure is used to report the properties that are UINT32 values. It is returned in response to a TPM2_GetCapability(). Attributes: property (TPM_PT): A property identifier value (int): The value of the property ...
[ "def", "__init__", "(", "self", ",", "property", "=", "0", ",", "value", "=", "0", ")", ":", "self", ".", "property", "=", "property", "self", ".", "value", "=", "value" ]
https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L4294-L4303
idaholab/moose
9eeebc65e098b4c30f8205fb41591fd5b61eb6ff
python/moosesqa/check_requirements.py
python
_has_file
(filename, file_list)
return False
Test if the filename is located in the list
Test if the filename is located in the list
[ "Test", "if", "the", "filename", "is", "located", "in", "the", "list" ]
def _has_file(filename, file_list): """Test if the filename is located in the list""" for f in file_list: if f.endswith(filename): return True return False
[ "def", "_has_file", "(", "filename", ",", "file_list", ")", ":", "for", "f", "in", "file_list", ":", "if", "f", ".", "endswith", "(", "filename", ")", ":", "return", "True", "return", "False" ]
https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/moosesqa/check_requirements.py#L260-L265
ApolloAuto/apollo-platform
86d9dc6743b496ead18d597748ebabd34a513289
ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/f2py/f2py2e.py
python
filter_files
(prefix,suffix,files,remove_prefix=None)
return filtered, rest
Filter files by prefix and suffix.
Filter files by prefix and suffix.
[ "Filter", "files", "by", "prefix", "and", "suffix", "." ]
def filter_files(prefix,suffix,files,remove_prefix=None): """ Filter files by prefix and suffix. """ filtered, rest = [], [] match = re.compile(prefix+r'.*'+suffix+r'\Z').match if remove_prefix: ind = len(prefix) else: ind = 0 for file in [x.strip() for x in files]: ...
[ "def", "filter_files", "(", "prefix", ",", "suffix", ",", "files", ",", "remove_prefix", "=", "None", ")", ":", "filtered", ",", "rest", "=", "[", "]", ",", "[", "]", "match", "=", "re", ".", "compile", "(", "prefix", "+", "r'.*'", "+", "suffix", "...
https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/f2py/f2py2e.py#L394-L407
llvm/llvm-project
ffa6262cb4e2a335d26416fad39a581b4f98c5f4
llvm/bindings/python/llvm/core.py
python
Module.datalayout
(self, new_data_layout)
new_data_layout is a string.
new_data_layout is a string.
[ "new_data_layout", "is", "a", "string", "." ]
def datalayout(self, new_data_layout): """new_data_layout is a string.""" lib.LLVMSetDataLayout(self, new_data_layout)
[ "def", "datalayout", "(", "self", ",", "new_data_layout", ")", ":", "lib", ".", "LLVMSetDataLayout", "(", "self", ",", "new_data_layout", ")" ]
https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/llvm/bindings/python/llvm/core.py#L212-L214
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py
python
Environment.__iadd__
(self, other)
return self
In-place addition of a distribution or environment
In-place addition of a distribution or environment
[ "In", "-", "place", "addition", "of", "a", "distribution", "or", "environment" ]
def __iadd__(self, other): """In-place addition of a distribution or environment""" if isinstance(other, Distribution): self.add(other) elif isinstance(other, Environment): for project in other: for dist in other[project]: self.add(dist...
[ "def", "__iadd__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "Distribution", ")", ":", "self", ".", "add", "(", "other", ")", "elif", "isinstance", "(", "other", ",", "Environment", ")", ":", "for", "project", "in", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py#L1086-L1096
rapidsai/cudf
d5b2448fc69f17509304d594f029d0df56984962
python/cudf/cudf/core/series.py
python
Series.describe
( self, percentiles=None, include=None, exclude=None, datetime_is_numeric=False, )
{docstring}
{docstring}
[ "{", "docstring", "}" ]
def describe( self, percentiles=None, include=None, exclude=None, datetime_is_numeric=False, ): """{docstring}""" def _prepare_percentiles(percentiles): percentiles = list(percentiles) if not all(0 <= x <= 1 for x in percentiles): ...
[ "def", "describe", "(", "self", ",", "percentiles", "=", "None", ",", "include", "=", "None", ",", "exclude", "=", "None", ",", "datetime_is_numeric", "=", "False", ",", ")", ":", "def", "_prepare_percentiles", "(", "percentiles", ")", ":", "percentiles", ...
https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/series.py#L2995-L3148
pytorch/pytorch
7176c92687d3cc847cc046bf002269c6949a21c2
benchmarks/distributed/rpc/parameter_server/server/server.py
python
ParameterServerBase.process_gradient
(self)
return
r""" A method to be implemented by child class that will process a gradient received by a server.
r""" A method to be implemented by child class that will process a gradient received by a server.
[ "r", "A", "method", "to", "be", "implemented", "by", "child", "class", "that", "will", "process", "a", "gradient", "received", "by", "a", "server", "." ]
def process_gradient(self): r""" A method to be implemented by child class that will process a gradient received by a server. """ return
[ "def", "process_gradient", "(", "self", ")", ":", "return" ]
https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/benchmarks/distributed/rpc/parameter_server/server/server.py#L29-L34
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/wsgiref/headers.py
python
Headers.__len__
(self)
return len(self._headers)
Return the total number of headers, including duplicates.
Return the total number of headers, including duplicates.
[ "Return", "the", "total", "number", "of", "headers", "including", "duplicates", "." ]
def __len__(self): """Return the total number of headers, including duplicates.""" return len(self._headers)
[ "def", "__len__", "(", "self", ")", ":", "return", "len", "(", "self", ".", "_headers", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/wsgiref/headers.py#L39-L41
mit-nlp/MITIE
bf8c532c9bbd23f2aea7c3b88a3ebfe03c1e0878
dlib/python_examples/svm_struct.py
python
ThreeClassClassifierProblem.make_psi
(self, x, label)
return psi
Compute PSI(x,label).
Compute PSI(x,label).
[ "Compute", "PSI", "(", "x", "label", ")", "." ]
def make_psi(self, x, label): """Compute PSI(x,label).""" # All we are doing here is taking x, which is a 3 dimensional sample # vector in this example program, and putting it into one of 3 places in # a 9 dimensional PSI vector, which we then return. So this function # returns ...
[ "def", "make_psi", "(", "self", ",", "x", ",", "label", ")", ":", "# All we are doing here is taking x, which is a 3 dimensional sample", "# vector in this example program, and putting it into one of 3 places in", "# a 9 dimensional PSI vector, which we then return. So this function", "# ...
https://github.com/mit-nlp/MITIE/blob/bf8c532c9bbd23f2aea7c3b88a3ebfe03c1e0878/dlib/python_examples/svm_struct.py#L208-L254
apple/swift-lldb
d74be846ef3e62de946df343e8c234bde93a8912
scripts/Python/static-binding/lldb.py
python
SBCompileUnit.__ne__
(self, rhs)
return _lldb.SBCompileUnit___ne__(self, rhs)
__ne__(SBCompileUnit self, SBCompileUnit rhs) -> bool
__ne__(SBCompileUnit self, SBCompileUnit rhs) -> bool
[ "__ne__", "(", "SBCompileUnit", "self", "SBCompileUnit", "rhs", ")", "-", ">", "bool" ]
def __ne__(self, rhs): """__ne__(SBCompileUnit self, SBCompileUnit rhs) -> bool""" return _lldb.SBCompileUnit___ne__(self, rhs)
[ "def", "__ne__", "(", "self", ",", "rhs", ")", ":", "return", "_lldb", ".", "SBCompileUnit___ne__", "(", "self", ",", "rhs", ")" ]
https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L3241-L3243
jiaxiang-wu/quantized-cnn
4d020e17026df90e40111d219e3eb74e0afb1588
cpplint.py
python
NestingState.InNamespaceBody
(self)
return self.stack and isinstance(self.stack[-1], _NamespaceInfo)
Check if we are currently one level inside a namespace body. Returns: True if top of the stack is a namespace block, False otherwise.
Check if we are currently one level inside a namespace body.
[ "Check", "if", "we", "are", "currently", "one", "level", "inside", "a", "namespace", "body", "." ]
def InNamespaceBody(self): """Check if we are currently one level inside a namespace body. Returns: True if top of the stack is a namespace block, False otherwise. """ return self.stack and isinstance(self.stack[-1], _NamespaceInfo)
[ "def", "InNamespaceBody", "(", "self", ")", ":", "return", "self", ".", "stack", "and", "isinstance", "(", "self", ".", "stack", "[", "-", "1", "]", ",", "_NamespaceInfo", ")" ]
https://github.com/jiaxiang-wu/quantized-cnn/blob/4d020e17026df90e40111d219e3eb74e0afb1588/cpplint.py#L2234-L2240
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py3/pandas/core/indexes/base.py
python
Index._intersection
(self, other: Index, sort=False)
return res_values
intersection specialized to the case with matching dtypes.
intersection specialized to the case with matching dtypes.
[ "intersection", "specialized", "to", "the", "case", "with", "matching", "dtypes", "." ]
def _intersection(self, other: Index, sort=False): """ intersection specialized to the case with matching dtypes. """ if ( self.is_monotonic and other.is_monotonic and not is_interval_dtype(self.dtype) ): # For IntervalIndex _inner_...
[ "def", "_intersection", "(", "self", ",", "other", ":", "Index", ",", "sort", "=", "False", ")", ":", "if", "(", "self", ".", "is_monotonic", "and", "other", ".", "is_monotonic", "and", "not", "is_interval_dtype", "(", "self", ".", "dtype", ")", ")", "...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/indexes/base.py#L3098-L3120
openvinotoolkit/openvino
dedcbeafa8b84cccdc55ca64b8da516682b381c7
tools/mo/openvino/tools/mo/ops/If.py
python
If.generate_port_map
(if_node: Node, condition: bool, dir: str)
return port_map
Extract port_map attributes from if_node and its subgraphs attributes. :param if_node: The If node :param condition: the boolean defining a condition (then/else) graph :param dir: the str value defining type (for inputs or for putputs) of port_map :return: port_map -> list of dictionari...
Extract port_map attributes from if_node and its subgraphs attributes.
[ "Extract", "port_map", "attributes", "from", "if_node", "and", "its", "subgraphs", "attributes", "." ]
def generate_port_map(if_node: Node, condition: bool, dir: str): """ Extract port_map attributes from if_node and its subgraphs attributes. :param if_node: The If node :param condition: the boolean defining a condition (then/else) graph :param dir: the str value defining type (f...
[ "def", "generate_port_map", "(", "if_node", ":", "Node", ",", "condition", ":", "bool", ",", "dir", ":", "str", ")", ":", "port_map", "=", "[", "]", "subgraph", "=", "if_node", ".", "then_graph", "if", "condition", "else", "if_node", ".", "else_graph", "...
https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/ops/If.py#L319-L337
tensorflow/io
92b44e180674a8af0e12e405530f7343e3e693e4
tensorflow_io/python/experimental/video_dataset_ops.py
python
VideoCaptureIODataset.__init__
(self, device, internal=True)
VideoCaptureIODataset
VideoCaptureIODataset
[ "VideoCaptureIODataset" ]
def __init__(self, device, internal=True): """VideoCaptureIODataset""" with tf.name_scope("VideoCaptureIODataset"): assert internal resource = core_ops.io_video_capture_readable_init(device) self._resource = resource dataset = tf.data.experimental.Count...
[ "def", "__init__", "(", "self", ",", "device", ",", "internal", "=", "True", ")", ":", "with", "tf", ".", "name_scope", "(", "\"VideoCaptureIODataset\"", ")", ":", "assert", "internal", "resource", "=", "core_ops", ".", "io_video_capture_readable_init", "(", "...
https://github.com/tensorflow/io/blob/92b44e180674a8af0e12e405530f7343e3e693e4/tensorflow_io/python/experimental/video_dataset_ops.py#L24-L45