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
microsoft/ivy
9f3c7ecc0b2383129fdd0953e10890d98d09a82d
ivy/ivy_parser.py
python
p_callatoms_callatoms_callatom
(p)
callatoms : callatoms COMMA callatom
callatoms : callatoms COMMA callatom
[ "callatoms", ":", "callatoms", "COMMA", "callatom" ]
def p_callatoms_callatoms_callatom(p): 'callatoms : callatoms COMMA callatom' p[0] = p[1] p[0].append(p[3])
[ "def", "p_callatoms_callatoms_callatom", "(", "p", ")", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]", "p", "[", "0", "]", ".", "append", "(", "p", "[", "3", "]", ")" ]
https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_parser.py#L2319-L2322
snap-stanford/snap-python
d53c51b0a26aa7e3e7400b014cdf728948fde80a
setup/snap.py
python
TInt.TestFrugalInt
()
return _snap.TInt_TestFrugalInt()
TestFrugalInt()
TestFrugalInt()
[ "TestFrugalInt", "()" ]
def TestFrugalInt(): """TestFrugalInt()""" return _snap.TInt_TestFrugalInt()
[ "def", "TestFrugalInt", "(", ")", ":", "return", "_snap", ".", "TInt_TestFrugalInt", "(", ")" ]
https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L13283-L13285
weichengkuo/DeepBox
c4f8c065b6a51cf296540cc453a44f0519aaacc9
caffe-fast-rcnn/scripts/cpp_lint.py
python
_FunctionState.End
(self)
Stop analyzing function body.
Stop analyzing function body.
[ "Stop", "analyzing", "function", "body", "." ]
def End(self): """Stop analyzing function body.""" self.in_a_function = False
[ "def", "End", "(", "self", ")", ":", "self", ".", "in_a_function", "=", "False" ]
https://github.com/weichengkuo/DeepBox/blob/c4f8c065b6a51cf296540cc453a44f0519aaacc9/caffe-fast-rcnn/scripts/cpp_lint.py#L861-L863
openmm/openmm
cb293447c4fc8b03976dfe11399f107bab70f3d9
wrappers/python/openmm/app/topology.py
python
Topology.bonds
(self)
return iter(self._bonds)
Iterate over all bonds (each represented as a tuple of two Atoms) in the Topology.
Iterate over all bonds (each represented as a tuple of two Atoms) in the Topology.
[ "Iterate", "over", "all", "bonds", "(", "each", "represented", "as", "a", "tuple", "of", "two", "Atoms", ")", "in", "the", "Topology", "." ]
def bonds(self): """Iterate over all bonds (each represented as a tuple of two Atoms) in the Topology.""" return iter(self._bonds)
[ "def", "bonds", "(", "self", ")", ":", "return", "iter", "(", "self", ".", "_bonds", ")" ]
https://github.com/openmm/openmm/blob/cb293447c4fc8b03976dfe11399f107bab70f3d9/wrappers/python/openmm/app/topology.py#L232-L234
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/lite/g3doc/tools/build_java_api_docs.py
python
overlay
(from_root: pathlib.Path, to_root: pathlib.Path)
Recursively copy from_root/* into to_root/.
Recursively copy from_root/* into to_root/.
[ "Recursively", "copy", "from_root", "/", "*", "into", "to_root", "/", "." ]
def overlay(from_root: pathlib.Path, to_root: pathlib.Path): """Recursively copy from_root/* into to_root/.""" # When Python3.8 lands, replace with shutil.copytree(..., dirs_exist_ok=True) for from_path in from_root.rglob('*'): to_path = to_root / from_path.relative_to(from_root) if from_path.is_file(): ...
[ "def", "overlay", "(", "from_root", ":", "pathlib", ".", "Path", ",", "to_root", ":", "pathlib", ".", "Path", ")", ":", "# When Python3.8 lands, replace with shutil.copytree(..., dirs_exist_ok=True)", "for", "from_path", "in", "from_root", ".", "rglob", "(", "'*'", ...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/lite/g3doc/tools/build_java_api_docs.py#L71-L80
mongodb/mongo
d8ff665343ad29cf286ee2cf4a1960d29371937b
buildscripts/resmokelib/logging/loggers.py
python
_add_handler
(logger, handler_info, formatter)
Add non-buildlogger handlers to a logger based on configuration.
Add non-buildlogger handlers to a logger based on configuration.
[ "Add", "non", "-", "buildlogger", "handlers", "to", "a", "logger", "based", "on", "configuration", "." ]
def _add_handler(logger, handler_info, formatter): """Add non-buildlogger handlers to a logger based on configuration.""" handler_class = handler_info["class"] if handler_class == "logging.FileHandler": handler = logging.FileHandler(filename=handler_info["filename"], mode=handler_info.get( ...
[ "def", "_add_handler", "(", "logger", ",", "handler_info", ",", "formatter", ")", ":", "handler_class", "=", "handler_info", "[", "\"class\"", "]", "if", "handler_class", "==", "\"logging.FileHandler\"", ":", "handler", "=", "logging", ".", "FileHandler", "(", "...
https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/logging/loggers.py#L255-L270
rrwick/Porechop
109e437280436d1ec27e5a5b7a34ffb752176390
porechop/adapters.py
python
Adapter.get_barcode_name
(self)
return barcode_name.replace(' ', '_')
Gets the barcode name for the output files. We want a concise name, so it looks at all options and chooses the shortest.
Gets the barcode name for the output files. We want a concise name, so it looks at all options and chooses the shortest.
[ "Gets", "the", "barcode", "name", "for", "the", "output", "files", ".", "We", "want", "a", "concise", "name", "so", "it", "looks", "at", "all", "options", "and", "chooses", "the", "shortest", "." ]
def get_barcode_name(self): """ Gets the barcode name for the output files. We want a concise name, so it looks at all options and chooses the shortest. """ possible_names = [self.name] if self.start_sequence: possible_names.append(self.start_sequence[0]) ...
[ "def", "get_barcode_name", "(", "self", ")", ":", "possible_names", "=", "[", "self", ".", "name", "]", "if", "self", ".", "start_sequence", ":", "possible_names", ".", "append", "(", "self", ".", "start_sequence", "[", "0", "]", ")", "if", "self", ".", ...
https://github.com/rrwick/Porechop/blob/109e437280436d1ec27e5a5b7a34ffb752176390/porechop/adapters.py#L41-L52
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/contrib/keras/python/keras/applications/inception_v3.py
python
InceptionV3
(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000)
return model
Instantiates the Inception v3 architecture. Optionally loads weights pre-trained on ImageNet. Note that when using TensorFlow, for best performance you should set `image_data_format="channels_last"` in your Keras config at ~/.keras/keras.json. The model and the weights are compatible with both TensorFlow...
Instantiates the Inception v3 architecture.
[ "Instantiates", "the", "Inception", "v3", "architecture", "." ]
def InceptionV3(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000): """Instantiates the Inception v3 architecture. Optionally loads weights pre-trained on ImageNet. Note that when u...
[ "def", "InceptionV3", "(", "include_top", "=", "True", ",", "weights", "=", "'imagenet'", ",", "input_tensor", "=", "None", ",", "input_shape", "=", "None", ",", "pooling", "=", "None", ",", "classes", "=", "1000", ")", ":", "if", "weights", "not", "in",...
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/keras/python/keras/applications/inception_v3.py#L98-L384
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/cython/Cython/Compiler/Code.py
python
UtilityCode.inject_unbound_methods
(self, impl, output)
return True, impl
Replace 'UNBOUND_METHOD(type, "name")' by a constant Python identifier cname.
Replace 'UNBOUND_METHOD(type, "name")' by a constant Python identifier cname.
[ "Replace", "UNBOUND_METHOD", "(", "type", "name", ")", "by", "a", "constant", "Python", "identifier", "cname", "." ]
def inject_unbound_methods(self, impl, output): """Replace 'UNBOUND_METHOD(type, "name")' by a constant Python identifier cname. """ if 'CALL_UNBOUND_METHOD(' not in impl: return False, impl def externalise(matchobj): type_cname, method_name, obj_cname, args = ma...
[ "def", "inject_unbound_methods", "(", "self", ",", "impl", ",", "output", ")", ":", "if", "'CALL_UNBOUND_METHOD('", "not", "in", "impl", ":", "return", "False", ",", "impl", "def", "externalise", "(", "matchobj", ")", ":", "type_cname", ",", "method_name", "...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/cython/Cython/Compiler/Code.py#L552-L573
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/compileall.py
python
expand_args
(args, flist)
return expanded
read names in flist and append to args
read names in flist and append to args
[ "read", "names", "in", "flist", "and", "append", "to", "args" ]
def expand_args(args, flist): """read names in flist and append to args""" expanded = args[:] if flist: try: if flist == '-': fd = sys.stdin else: fd = open(flist) while 1: line = fd.readline() if not...
[ "def", "expand_args", "(", "args", ",", "flist", ")", ":", "expanded", "=", "args", "[", ":", "]", "if", "flist", ":", "try", ":", "if", "flist", "==", "'-'", ":", "fd", "=", "sys", ".", "stdin", "else", ":", "fd", "=", "open", "(", "flist", ")...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/compileall.py#L134-L151
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/gsutil/third_party/boto/boto/sqs/queue.py
python
Queue.write
(self, message, delay_seconds=None)
return message
Add a single message to the queue. :type message: Message :param message: The message to be written to the queue :rtype: :class:`boto.sqs.message.Message` :return: The :class:`boto.sqs.message.Message` object that was written.
Add a single message to the queue.
[ "Add", "a", "single", "message", "to", "the", "queue", "." ]
def write(self, message, delay_seconds=None): """ Add a single message to the queue. :type message: Message :param message: The message to be written to the queue :rtype: :class:`boto.sqs.message.Message` :return: The :class:`boto.sqs.message.Message` object that was wr...
[ "def", "write", "(", "self", ",", "message", ",", "delay_seconds", "=", "None", ")", ":", "new_msg", "=", "self", ".", "connection", ".", "send_message", "(", "self", ",", "message", ".", "get_body_encoded", "(", ")", ",", "delay_seconds", "=", "delay_seco...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/sqs/queue.py#L214-L229
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/eager/tape.py
python
should_record
(tensors)
return any(x.should_record(tensors) for x in _tape_stack.stack)
Returns true if any tape in the stack watches any of these tensors.
Returns true if any tape in the stack watches any of these tensors.
[ "Returns", "true", "if", "any", "tape", "in", "the", "stack", "watches", "any", "of", "these", "tensors", "." ]
def should_record(tensors): """Returns true if any tape in the stack watches any of these tensors.""" if not _tape_stack.stack: return False return any(x.should_record(tensors) for x in _tape_stack.stack)
[ "def", "should_record", "(", "tensors", ")", ":", "if", "not", "_tape_stack", ".", "stack", ":", "return", "False", "return", "any", "(", "x", ".", "should_record", "(", "tensors", ")", "for", "x", "in", "_tape_stack", ".", "stack", ")" ]
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/eager/tape.py#L170-L174
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/distribute/distribution_strategy_context.py
python
get_replica_context
()
return _get_per_thread_mode().replica_context
Returns the current `tf.distribute.ReplicaContext` or `None`. Returns `None` if in a cross-replica context. Note that execution: 1. starts in the default (single-replica) replica context (this function will return the default `ReplicaContext` object); 2. switches to cross-replica context (in which case ...
Returns the current `tf.distribute.ReplicaContext` or `None`.
[ "Returns", "the", "current", "tf", ".", "distribute", ".", "ReplicaContext", "or", "None", "." ]
def get_replica_context(): """Returns the current `tf.distribute.ReplicaContext` or `None`. Returns `None` if in a cross-replica context. Note that execution: 1. starts in the default (single-replica) replica context (this function will return the default `ReplicaContext` object); 2. switches to cross...
[ "def", "get_replica_context", "(", ")", ":", "return", "_get_per_thread_mode", "(", ")", ".", "replica_context" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/distribution_strategy_context.py#L145-L189
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/propgrid.py
python
PropertyGrid.SetVerticalSpacing
(*args, **kwargs)
return _propgrid.PropertyGrid_SetVerticalSpacing(*args, **kwargs)
SetVerticalSpacing(self, int vspacing)
SetVerticalSpacing(self, int vspacing)
[ "SetVerticalSpacing", "(", "self", "int", "vspacing", ")" ]
def SetVerticalSpacing(*args, **kwargs): """SetVerticalSpacing(self, int vspacing)""" return _propgrid.PropertyGrid_SetVerticalSpacing(*args, **kwargs)
[ "def", "SetVerticalSpacing", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_propgrid", ".", "PropertyGrid_SetVerticalSpacing", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L2308-L2310
garbear/kodi-steamlink
3f8e5970b01607cdb3c2688fbaa78e08f2d9c561
tools/EventClients/lib/python/xbmcclient.py
python
XBMCClient.ping
(self)
Send a PING packet
Send a PING packet
[ "Send", "a", "PING", "packet" ]
def ping(self): """Send a PING packet""" packet = PacketPING() packet.send(self.sock, self.addr, self.uid)
[ "def", "ping", "(", "self", ")", ":", "packet", "=", "PacketPING", "(", ")", "packet", ".", "send", "(", "self", ".", "sock", ",", "self", ".", "addr", ",", "self", ".", "uid", ")" ]
https://github.com/garbear/kodi-steamlink/blob/3f8e5970b01607cdb3c2688fbaa78e08f2d9c561/tools/EventClients/lib/python/xbmcclient.py#L513-L516
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/perspective.py
python
PerspectiveManager.GetPrimaryDisplayOrigin
(self)
Get the origin on the primary display to use as a default window placement position. @return: position tuple
Get the origin on the primary display to use as a default window placement position. @return: position tuple
[ "Get", "the", "origin", "on", "the", "primary", "display", "to", "use", "as", "a", "default", "window", "placement", "position", ".", "@return", ":", "position", "tuple" ]
def GetPrimaryDisplayOrigin(self): """Get the origin on the primary display to use as a default window placement position. @return: position tuple """ # NOTE: don't default to 0,0 otherwise on osx the frame will be # stuck behind the menubar. for idx in ran...
[ "def", "GetPrimaryDisplayOrigin", "(", "self", ")", ":", "# NOTE: don't default to 0,0 otherwise on osx the frame will be", "# stuck behind the menubar.", "for", "idx", "in", "range", "(", "wx", ".", "Display", ".", "GetCount", "(", ")", ")", ":", "disp", "=", "...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/perspective.py#L195-L209
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/ops/session_ops.py
python
TensorHandle.handle
(self)
return self._handle
The string representation of this handle.
The string representation of this handle.
[ "The", "string", "representation", "of", "this", "handle", "." ]
def handle(self): """The string representation of this handle.""" return self._handle
[ "def", "handle", "(", "self", ")", ":", "return", "self", ".", "_handle" ]
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/session_ops.py#L94-L96
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pkg_resources/__init__.py
python
WorkingSet.__init__
(self, entries=None)
Create working set from list of path entries (default=sys.path)
Create working set from list of path entries (default=sys.path)
[ "Create", "working", "set", "from", "list", "of", "path", "entries", "(", "default", "=", "sys", ".", "path", ")" ]
def __init__(self, entries=None): """Create working set from list of path entries (default=sys.path)""" self.entries = [] self.entry_keys = {} self.by_key = {} self.callbacks = [] if entries is None: entries = sys.path for entry in entries: ...
[ "def", "__init__", "(", "self", ",", "entries", "=", "None", ")", ":", "self", ".", "entries", "=", "[", "]", "self", ".", "entry_keys", "=", "{", "}", "self", ".", "by_key", "=", "{", "}", "self", ".", "callbacks", "=", "[", "]", "if", "entries"...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pkg_resources/__init__.py#L557-L568
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/html5lib-python/html5lib/serializer/htmlserializer.py
python
SerializeError
(Exception)
Error in serialized tree
Error in serialized tree
[ "Error", "in", "serialized", "tree" ]
def SerializeError(Exception): """Error in serialized tree""" pass
[ "def", "SerializeError", "(", "Exception", ")", ":", "pass" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/html5lib-python/html5lib/serializer/htmlserializer.py#L315-L317
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/stc.py
python
StyledTextCtrl.GetKeysUnicode
(*args, **kwargs)
return _stc.StyledTextCtrl_GetKeysUnicode(*args, **kwargs)
GetKeysUnicode(self) -> bool Are keys always interpreted as Unicode?
GetKeysUnicode(self) -> bool
[ "GetKeysUnicode", "(", "self", ")", "-", ">", "bool" ]
def GetKeysUnicode(*args, **kwargs): """ GetKeysUnicode(self) -> bool Are keys always interpreted as Unicode? """ return _stc.StyledTextCtrl_GetKeysUnicode(*args, **kwargs)
[ "def", "GetKeysUnicode", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_stc", ".", "StyledTextCtrl_GetKeysUnicode", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/stc.py#L5767-L5773
apache/incubator-mxnet
f03fb23f1d103fec9541b5ae59ee06b1734a51d9
python/mxnet/contrib/quantization.py
python
_generate_list_of_data_desc
(data_shapes, data_types)
Convert list ot tuples to list of DataDesc.
Convert list ot tuples to list of DataDesc.
[ "Convert", "list", "ot", "tuples", "to", "list", "of", "DataDesc", "." ]
def _generate_list_of_data_desc(data_shapes, data_types): """"Convert list ot tuples to list of DataDesc.""" if isinstance(data_shapes, list): if all(isinstance(x, DataDesc) for x in data_shapes): return data_shapes if all(isinstance(x, tuple) for x in data_shapes): if le...
[ "def", "_generate_list_of_data_desc", "(", "data_shapes", ",", "data_types", ")", ":", "if", "isinstance", "(", "data_shapes", ",", "list", ")", ":", "if", "all", "(", "isinstance", "(", "x", ",", "DataDesc", ")", "for", "x", "in", "data_shapes", ")", ":",...
https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/contrib/quantization.py#L370-L382
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/extern/aui/auibook.py
python
AuiNotebook.AddTabAreaButton
(self, id, location, normal_bitmap=wx.NullBitmap, disabled_bitmap=wx.NullBitmap)
Adds a button in the tab area. :param integer `id`: the button identifier. This can be one of the following: ============================== ================================= Button Identifier Description ============================== ================================...
Adds a button in the tab area.
[ "Adds", "a", "button", "in", "the", "tab", "area", "." ]
def AddTabAreaButton(self, id, location, normal_bitmap=wx.NullBitmap, disabled_bitmap=wx.NullBitmap): """ Adds a button in the tab area. :param integer `id`: the button identifier. This can be one of the following: ============================== ================================= ...
[ "def", "AddTabAreaButton", "(", "self", ",", "id", ",", "location", ",", "normal_bitmap", "=", "wx", ".", "NullBitmap", ",", "disabled_bitmap", "=", "wx", ".", "NullBitmap", ")", ":", "active_tabctrl", "=", "self", ".", "GetActiveTabCtrl", "(", ")", "active_...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/auibook.py#L5673-L5694
plaidml/plaidml
f3c6681db21460e5fdc11ae651d6d7b6c27f8262
plaidml/edsl/__init__.py
python
TensorIndex.__mul__
(self, rhs)
return TensorIndex(_poly_op(lib.PLAIDML_INT_OP_MUL, self, rhs))
Performs a multiplication between a TensorIndex and another operand in a polynomial expression. Example: >>> i, j = TensorIndexes(2) >>> A = Placeholder(DType.FLOAT32, [3, 3]) >>> R = Contraction().sum() >>> R = Contraction().sum(A[i * 5, j]).build()
Performs a multiplication between a TensorIndex and another operand in a polynomial expression.
[ "Performs", "a", "multiplication", "between", "a", "TensorIndex", "and", "another", "operand", "in", "a", "polynomial", "expression", "." ]
def __mul__(self, rhs): """Performs a multiplication between a TensorIndex and another operand in a polynomial expression. Example: >>> i, j = TensorIndexes(2) >>> A = Placeholder(DType.FLOAT32, [3, 3]) >>> R = Contraction().sum() >>> R = Contract...
[ "def", "__mul__", "(", "self", ",", "rhs", ")", ":", "return", "TensorIndex", "(", "_poly_op", "(", "lib", ".", "PLAIDML_INT_OP_MUL", ",", "self", ",", "rhs", ")", ")" ]
https://github.com/plaidml/plaidml/blob/f3c6681db21460e5fdc11ae651d6d7b6c27f8262/plaidml/edsl/__init__.py#L246-L256
weolar/miniblink49
1c4678db0594a4abde23d3ebbcc7cd13c3170777
third_party/WebKit/Tools/Scripts/webkitpy/style/optparser.py
python
ArgumentParser._exit_with_categories
(self)
Exit and print the style categories and default filter rules.
Exit and print the style categories and default filter rules.
[ "Exit", "and", "print", "the", "style", "categories", "and", "default", "filter", "rules", "." ]
def _exit_with_categories(self): """Exit and print the style categories and default filter rules.""" self.stderr_write('\nAll categories:\n') for category in sorted(self._all_categories): self.stderr_write(' ' + category + '\n') self.stderr_write('\nDefault filter rules**...
[ "def", "_exit_with_categories", "(", "self", ")", ":", "self", ".", "stderr_write", "(", "'\\nAll categories:\\n'", ")", "for", "category", "in", "sorted", "(", "self", ".", "_all_categories", ")", ":", "self", ".", "stderr_write", "(", "' '", "+", "categor...
https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/style/optparser.py#L374-L386
cocos-creator/engine-native
984c4c9f5838253313b44ccd429bd8fac4ec8a6a
tools/bindings-generator/clang/cindex.py
python
Cursor.exception_specification_kind
(self)
return self._exception_specification_kind
Retrieve the exception specification kind, which is one of the values from the ExceptionSpecificationKind enumeration.
Retrieve the exception specification kind, which is one of the values from the ExceptionSpecificationKind enumeration.
[ "Retrieve", "the", "exception", "specification", "kind", "which", "is", "one", "of", "the", "values", "from", "the", "ExceptionSpecificationKind", "enumeration", "." ]
def exception_specification_kind(self): ''' Retrieve the exception specification kind, which is one of the values from the ExceptionSpecificationKind enumeration. ''' if not hasattr(self, '_exception_specification_kind'): exc_kind = conf.lib.clang_getCursorExceptionSp...
[ "def", "exception_specification_kind", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_exception_specification_kind'", ")", ":", "exc_kind", "=", "conf", ".", "lib", ".", "clang_getCursorExceptionSpecificationType", "(", "self", ")", "self", "....
https://github.com/cocos-creator/engine-native/blob/984c4c9f5838253313b44ccd429bd8fac4ec8a6a/tools/bindings-generator/clang/cindex.py#L1676-L1685
NVIDIA/TensorRT
42805f078052daad1a98bc5965974fcffaad0960
demo/BERT/helpers/tokenization.py
python
_is_control
(char)
return False
Checks whether `chars` is a control character.
Checks whether `chars` is a control character.
[ "Checks", "whether", "chars", "is", "a", "control", "character", "." ]
def _is_control(char): """Checks whether `chars` is a control character.""" # These are technically control characters but we count them as whitespace # characters. if char == "\t" or char == "\n" or char == "\r": return False cat = unicodedata.category(char) if cat.startswith("C"): return True re...
[ "def", "_is_control", "(", "char", ")", ":", "# These are technically control characters but we count them as whitespace", "# characters.", "if", "char", "==", "\"\\t\"", "or", "char", "==", "\"\\n\"", "or", "char", "==", "\"\\r\"", ":", "return", "False", "cat", "=",...
https://github.com/NVIDIA/TensorRT/blob/42805f078052daad1a98bc5965974fcffaad0960/demo/BERT/helpers/tokenization.py#L404-L413
BlzFans/wke
b0fa21158312e40c5fbd84682d643022b6c34a93
cygwin/lib/python2.6/Bastion.py
python
BastionClass.__repr__
(self)
return "<Bastion for %s>" % self._name_
Return a representation string. This includes the name passed in to the constructor, so that if you print the bastion during debugging, at least you have some idea of what it is.
Return a representation string.
[ "Return", "a", "representation", "string", "." ]
def __repr__(self): """Return a representation string. This includes the name passed in to the constructor, so that if you print the bastion during debugging, at least you have some idea of what it is. """ return "<Bastion for %s>" % self._name_
[ "def", "__repr__", "(", "self", ")", ":", "return", "\"<Bastion for %s>\"", "%", "self", ".", "_name_" ]
https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/Bastion.py#L60-L68
genn-team/genn
75e1eb218cafa228bf36ae4613d1ce26e877b12c
pygenn/genn_groups.py
python
Group._pull_extra_global_param_from_device
(self, egp_name, size=None, egp_dict=None)
Wrapper around GeNNModel.pull_extra_global_param_from_device Args: egp_name -- string with the name of the variable size -- number of entries in EGP array
Wrapper around GeNNModel.pull_extra_global_param_from_device
[ "Wrapper", "around", "GeNNModel", ".", "pull_extra_global_param_from_device" ]
def _pull_extra_global_param_from_device(self, egp_name, size=None, egp_dict=None): """Wrapper around GeNNModel.pull_extra_global_param_from_device Args: egp_name -- string with the name of the variable size -- number of entries in ...
[ "def", "_pull_extra_global_param_from_device", "(", "self", ",", "egp_name", ",", "size", "=", "None", ",", "egp_dict", "=", "None", ")", ":", "# If no extra global parameters dictionary", "# is specified, use standard one", "if", "egp_dict", "is", "None", ":", "egp_dic...
https://github.com/genn-team/genn/blob/75e1eb218cafa228bf36ae4613d1ce26e877b12c/pygenn/genn_groups.py#L196-L226
timi-liuliang/echo
40a5a24d430eee4118314459ab7e03afcb3b8719
thirdparty/protobuf/python/google/protobuf/symbol_database.py
python
SymbolDatabase.__init__
(self)
Constructor.
Constructor.
[ "Constructor", "." ]
def __init__(self): """Constructor.""" self._symbols = {} self._symbols_by_file = {} self.pool = descriptor_pool.DescriptorPool()
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_symbols", "=", "{", "}", "self", ".", "_symbols_by_file", "=", "{", "}", "self", ".", "pool", "=", "descriptor_pool", ".", "DescriptorPool", "(", ")" ]
https://github.com/timi-liuliang/echo/blob/40a5a24d430eee4118314459ab7e03afcb3b8719/thirdparty/protobuf/python/google/protobuf/symbol_database.py#L75-L80
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/prompt-toolkit/py3/prompt_toolkit/filters/base.py
python
Filter.__invert__
(self)
return _invert_cache[self]
Inverting of filters using the ~ operator.
Inverting of filters using the ~ operator.
[ "Inverting", "of", "filters", "using", "the", "~", "operator", "." ]
def __invert__(self) -> "Filter": """ Inverting of filters using the ~ operator. """ return _invert_cache[self]
[ "def", "__invert__", "(", "self", ")", "->", "\"Filter\"", ":", "return", "_invert_cache", "[", "self", "]" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/filters/base.py#L34-L38
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/optimizelatticewindow.py
python
OptimizeLatticeWindow.do_ok
(self)
return
User decide to go on and then send a signal to parent :return:
User decide to go on and then send a signal to parent :return:
[ "User", "decide", "to", "go", "on", "and", "then", "send", "a", "signal", "to", "parent", ":", "return", ":" ]
def do_ok(self): """ User decide to go on and then send a signal to parent :return: """ tolerance = self.get_tolerance() if tolerance is None: raise RuntimeError('Tolerance cannot be left blank!') # set up a hand-shaking signal signal_value =...
[ "def", "do_ok", "(", "self", ")", ":", "tolerance", "=", "self", ".", "get_tolerance", "(", ")", "if", "tolerance", "is", "None", ":", "raise", "RuntimeError", "(", "'Tolerance cannot be left blank!'", ")", "# set up a hand-shaking signal", "signal_value", "=", "1...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/optimizelatticewindow.py#L64-L81
manutdzou/KITTI_SSD
5b620c2f291d36a0fe14489214f22a992f173f44
scripts/cpp_lint.py
python
ProcessFile
(filename, vlevel, extra_check_functions=[])
Does google-lint on a single file. Args: filename: The name of the file to parse. vlevel: The level of errors to report. Every error of confidence >= verbose_level will be reported. 0 is a good default. extra_check_functions: An array of additional check functions that will be ...
Does google-lint on a single file.
[ "Does", "google", "-", "lint", "on", "a", "single", "file", "." ]
def ProcessFile(filename, vlevel, extra_check_functions=[]): """Does google-lint on a single file. Args: filename: The name of the file to parse. vlevel: The level of errors to report. Every error of confidence >= verbose_level will be reported. 0 is a good default. extra_check_functions: An ar...
[ "def", "ProcessFile", "(", "filename", ",", "vlevel", ",", "extra_check_functions", "=", "[", "]", ")", ":", "_SetVerboseLevel", "(", "vlevel", ")", "try", ":", "# Support the UNIX convention of using \"-\" for stdin. Note that", "# we are not opening the file with universal...
https://github.com/manutdzou/KITTI_SSD/blob/5b620c2f291d36a0fe14489214f22a992f173f44/scripts/cpp_lint.py#L4693-L4758
mandiant/flare-wmi
b0a5a094ff9ca7d7a1c4fc711dc00c74dec4b6b1
python-cim/cim/objects.py
python
ClassDefinition.class_name
(self)
return self.property_data.get_string(self.header.offset_class_name)
:rtype: str
:rtype: str
[ ":", "rtype", ":", "str" ]
def class_name(self): """ :rtype: str """ return self.property_data.get_string(self.header.offset_class_name)
[ "def", "class_name", "(", "self", ")", ":", "return", "self", ".", "property_data", ".", "get_string", "(", "self", ".", "header", ".", "offset_class_name", ")" ]
https://github.com/mandiant/flare-wmi/blob/b0a5a094ff9ca7d7a1c4fc711dc00c74dec4b6b1/python-cim/cim/objects.py#L630-L632
vslavik/poedit
f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a
deps/boost/tools/build/src/build/virtual_target.py
python
Action.actualize
(self)
return actual_targets
Generates actual build instructions.
Generates actual build instructions.
[ "Generates", "actual", "build", "instructions", "." ]
def actualize (self): """ Generates actual build instructions. """ if self.actualized_: return self.actualized_ = True ps = self.properties () properties = self.adjust_properties (ps) actual_targets = [] for i in self.targets (): ...
[ "def", "actualize", "(", "self", ")", ":", "if", "self", ".", "actualized_", ":", "return", "self", ".", "actualized_", "=", "True", "ps", "=", "self", ".", "properties", "(", ")", "properties", "=", "self", ".", "adjust_properties", "(", "ps", ")", "a...
https://github.com/vslavik/poedit/blob/f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a/deps/boost/tools/build/src/build/virtual_target.py#L818-L861
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/screen.py
python
Screen.get_menu_position
(self, window: "Window")
Get the menu position for a given window. (This falls back to the cursor position if no menu position was set.)
Get the menu position for a given window. (This falls back to the cursor position if no menu position was set.)
[ "Get", "the", "menu", "position", "for", "a", "given", "window", ".", "(", "This", "falls", "back", "to", "the", "cursor", "position", "if", "no", "menu", "position", "was", "set", ".", ")" ]
def get_menu_position(self, window: "Window") -> Point: """ Get the menu position for a given window. (This falls back to the cursor position if no menu position was set.) """ try: return self.menu_positions[window] except KeyError: try: ...
[ "def", "get_menu_position", "(", "self", ",", "window", ":", "\"Window\"", ")", "->", "Point", ":", "try", ":", "return", "self", ".", "menu_positions", "[", "window", "]", "except", "KeyError", ":", "try", ":", "return", "self", ".", "cursor_positions", "...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/screen.py#L227-L238
google/shaka-player-embedded
dabbeb5b47cc257b37b9a254661546352aaf0afe
shaka/tools/webidl/webidl/parser.py
python
IdlParser.p_Dictionary_error
(self, p)
return self._dictionary_common(p, p[2], [], p[3], False)
r"""Dictionary : DICTIONARY IDENTIFIER Inheritance '{' error '}' ';
r"""Dictionary : DICTIONARY IDENTIFIER Inheritance '{' error '}' ';
[ "r", "Dictionary", ":", "DICTIONARY", "IDENTIFIER", "Inheritance", "{", "error", "}", ";" ]
def p_Dictionary_error(self, p): r"""Dictionary : DICTIONARY IDENTIFIER Inheritance '{' error '}' ';'""" return self._dictionary_common(p, p[2], [], p[3], False)
[ "def", "p_Dictionary_error", "(", "self", ",", "p", ")", ":", "return", "self", ".", "_dictionary_common", "(", "p", ",", "p", "[", "2", "]", ",", "[", "]", ",", "p", "[", "3", "]", ",", "False", ")" ]
https://github.com/google/shaka-player-embedded/blob/dabbeb5b47cc257b37b9a254661546352aaf0afe/shaka/tools/webidl/webidl/parser.py#L277-L279
facebookresearch/minirts
859e747a5e2fab2355bea083daffa6a36820a7f2
scripts/behavior_clone/onehot_coach.py
python
ConvOneHotCoach.rl_forward
(self, batch, mode='')
return output
forward function use by RL
forward function use by RL
[ "forward", "function", "use", "by", "RL" ]
def rl_forward(self, batch, mode=''): """forward function use by RL """ # if not isinstance(batch, dict): # batch = self.format_coach_input(batch) # In RL, the data is always in one-hot format, need to process batch = self._format_rl_language_input(batch) glo...
[ "def", "rl_forward", "(", "self", ",", "batch", ",", "mode", "=", "''", ")", ":", "# if not isinstance(batch, dict):", "# batch = self.format_coach_input(batch)", "# In RL, the data is always in one-hot format, need to process", "batch", "=", "self", ".", "_format_rl_langua...
https://github.com/facebookresearch/minirts/blob/859e747a5e2fab2355bea083daffa6a36820a7f2/scripts/behavior_clone/onehot_coach.py#L68-L86
wujian16/Cornell-MOE
df299d1be882d2af9796d7a68b3f9505cac7a53e
moe/optimal_learning/python/python_version/optimization.py
python
COBYLAOptimizer._optimize_core
(self, **kwargs)
return scipy.optimize.fmin_cobyla( func=self._scipy_decorator(self.objective_function.compute_objective_function, **kwargs), x0=self.objective_function.current_point.flatten(), cons=self.domain.get_constraint_list(), disp=0, # Suppresses output from the routine. ...
Perform a COBYLA optimization given the parameters in ``self.optimization_parameters``.
Perform a COBYLA optimization given the parameters in ``self.optimization_parameters``.
[ "Perform", "a", "COBYLA", "optimization", "given", "the", "parameters", "in", "self", ".", "optimization_parameters", "." ]
def _optimize_core(self, **kwargs): """Perform a COBYLA optimization given the parameters in ``self.optimization_parameters``.""" # Parameters defined above in :class:`~moe.optimal_learning.python.python_version.optimization.COBYLAParameters` class. return scipy.optimize.fmin_cobyla( ...
[ "def", "_optimize_core", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# Parameters defined above in :class:`~moe.optimal_learning.python.python_version.optimization.COBYLAParameters` class.", "return", "scipy", ".", "optimize", ".", "fmin_cobyla", "(", "func", "=", "self"...
https://github.com/wujian16/Cornell-MOE/blob/df299d1be882d2af9796d7a68b3f9505cac7a53e/moe/optimal_learning/python/python_version/optimization.py#L772-L781
Kitware/VTK
5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8
Wrapping/Python/vtkmodules/util/vtkAlgorithm.py
python
VTKPythonAlgorithmBase.RequestUpdateExtent
(self, request, inInfo, outInfo)
return 1
Overwritten by subclass to modify data request going to upstream pipeline.
Overwritten by subclass to modify data request going to upstream pipeline.
[ "Overwritten", "by", "subclass", "to", "modify", "data", "request", "going", "to", "upstream", "pipeline", "." ]
def RequestUpdateExtent(self, request, inInfo, outInfo): """Overwritten by subclass to modify data request going to upstream pipeline.""" return 1
[ "def", "RequestUpdateExtent", "(", "self", ",", "request", ",", "inInfo", ",", "outInfo", ")", ":", "return", "1" ]
https://github.com/Kitware/VTK/blob/5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8/Wrapping/Python/vtkmodules/util/vtkAlgorithm.py#L213-L216
git-artes/gr-tempest
cb87b347f60e6483220b65366f83d1cc92033d3f
docs/doxygen/doxyxml/generated/index.py
python
DoxygenTypeSub.find_compounds_and_members
(self, details)
return results
Returns a list of all compounds and their members which match details
Returns a list of all compounds and their members which match details
[ "Returns", "a", "list", "of", "all", "compounds", "and", "their", "members", "which", "match", "details" ]
def find_compounds_and_members(self, details): """ Returns a list of all compounds and their members which match details """ results = [] for compound in self.compound: members = compound.find_members(details) if members: results.append([c...
[ "def", "find_compounds_and_members", "(", "self", ",", "details", ")", ":", "results", "=", "[", "]", "for", "compound", "in", "self", ".", "compound", ":", "members", "=", "compound", ".", "find_members", "(", "details", ")", "if", "members", ":", "result...
https://github.com/git-artes/gr-tempest/blob/cb87b347f60e6483220b65366f83d1cc92033d3f/docs/doxygen/doxyxml/generated/index.py#L21-L35
tiny-dnn/tiny-dnn
c0f576f5cb7b35893f62127cb7aec18f77a3bcc5
third_party/gemmlowp/meta/generators/gemm_MxNxK.py
python
GenerateZipRhs
(emitter, aligned, cols, leftovers)
Emits the code responsible for zipping the rhs matrix.
Emits the code responsible for zipping the rhs matrix.
[ "Emits", "the", "code", "responsible", "for", "zipping", "the", "rhs", "matrix", "." ]
def GenerateZipRhs(emitter, aligned, cols, leftovers): """Emits the code responsible for zipping the rhs matrix.""" emitter.EmitOpenBracket('for (int i = 0; i < col_chunks; ++i)') emitter.EmitCall( ZipName(3, leftovers, aligned), ['rhs_chunk', 'k', 'k', 'zipped_rhs_chunk', 'lhs_offset', 0]) emitter....
[ "def", "GenerateZipRhs", "(", "emitter", ",", "aligned", ",", "cols", ",", "leftovers", ")", ":", "emitter", ".", "EmitOpenBracket", "(", "'for (int i = 0; i < col_chunks; ++i)'", ")", "emitter", ".", "EmitCall", "(", "ZipName", "(", "3", ",", "leftovers", ",", ...
https://github.com/tiny-dnn/tiny-dnn/blob/c0f576f5cb7b35893f62127cb7aec18f77a3bcc5/third_party/gemmlowp/meta/generators/gemm_MxNxK.py#L81-L95
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/extern/aui/auibar.py
python
AuiToolBar.GetArtProvider
(self)
return self._art
Returns the current art provider being used.
Returns the current art provider being used.
[ "Returns", "the", "current", "art", "provider", "being", "used", "." ]
def GetArtProvider(self): """ Returns the current art provider being used. """ return self._art
[ "def", "GetArtProvider", "(", "self", ")", ":", "return", "self", ".", "_art" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/auibar.py#L1713-L1716
macchina-io/macchina.io
ef24ba0e18379c3dd48fb84e6dbf991101cb8db0
platform/JS/V8/tools/gyp/pylib/gyp/msvs_emulation.py
python
GetGlobalVSMacroEnv
(vs_version)
return env
Get a dict of variables mapping internal VS macro names to their gyp equivalents. Returns all variables that are independent of the target.
Get a dict of variables mapping internal VS macro names to their gyp equivalents. Returns all variables that are independent of the target.
[ "Get", "a", "dict", "of", "variables", "mapping", "internal", "VS", "macro", "names", "to", "their", "gyp", "equivalents", ".", "Returns", "all", "variables", "that", "are", "independent", "of", "the", "target", "." ]
def GetGlobalVSMacroEnv(vs_version): """Get a dict of variables mapping internal VS macro names to their gyp equivalents. Returns all variables that are independent of the target.""" env = {} # '$(VSInstallDir)' and '$(VCInstallDir)' are available when and only when # Visual Studio is actually installed. if...
[ "def", "GetGlobalVSMacroEnv", "(", "vs_version", ")", ":", "env", "=", "{", "}", "# '$(VSInstallDir)' and '$(VCInstallDir)' are available when and only when", "# Visual Studio is actually installed.", "if", "vs_version", ".", "Path", "(", ")", ":", "env", "[", "'$(VSInstall...
https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/msvs_emulation.py#L142-L160
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/propgrid.py
python
PGProperty.UpdateParentValues
(*args, **kwargs)
return _propgrid.PGProperty_UpdateParentValues(*args, **kwargs)
UpdateParentValues(self) -> PGProperty
UpdateParentValues(self) -> PGProperty
[ "UpdateParentValues", "(", "self", ")", "-", ">", "PGProperty" ]
def UpdateParentValues(*args, **kwargs): """UpdateParentValues(self) -> PGProperty""" return _propgrid.PGProperty_UpdateParentValues(*args, **kwargs)
[ "def", "UpdateParentValues", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_propgrid", ".", "PGProperty_UpdateParentValues", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L612-L614
natanielruiz/android-yolo
1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f
jni-build/jni/include/tensorflow/python/ops/io_ops.py
python
_ReaderReadShape
(op)
return [tensor_shape.scalar(), tensor_shape.scalar()]
Shape function for the ReaderBase.Read op.
Shape function for the ReaderBase.Read op.
[ "Shape", "function", "for", "the", "ReaderBase", ".", "Read", "op", "." ]
def _ReaderReadShape(op): """Shape function for the ReaderBase.Read op.""" unused_handle_shape = op.inputs[0].get_shape().merge_with( tensor_shape.scalar()) unused_queue_shape = op.inputs[1].get_shape().merge_with( tensor_shape.scalar()) return [tensor_shape.scalar(), tensor_shape.scalar()]
[ "def", "_ReaderReadShape", "(", "op", ")", ":", "unused_handle_shape", "=", "op", ".", "inputs", "[", "0", "]", ".", "get_shape", "(", ")", ".", "merge_with", "(", "tensor_shape", ".", "scalar", "(", ")", ")", "unused_queue_shape", "=", "op", ".", "input...
https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/io_ops.py#L587-L593
pytorch/pytorch
7176c92687d3cc847cc046bf002269c6949a21c2
benchmarks/distributed/rpc/parameter_server/trainer/trainer.py
python
TrainerBase.__init__
(self, rank)
r""" Inits TrainerBase class. Args: rank (int): worker rank
r""" Inits TrainerBase class. Args: rank (int): worker rank
[ "r", "Inits", "TrainerBase", "class", ".", "Args", ":", "rank", "(", "int", ")", ":", "worker", "rank" ]
def __init__(self, rank): r""" Inits TrainerBase class. Args: rank (int): worker rank """ self.__metrics_logger = MetricsLogger(rank)
[ "def", "__init__", "(", "self", ",", "rank", ")", ":", "self", ".", "__metrics_logger", "=", "MetricsLogger", "(", "rank", ")" ]
https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/benchmarks/distributed/rpc/parameter_server/trainer/trainer.py#L19-L25
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/calendar.py
python
TextCalendar.prweek
(self, theweek, width)
Print a single week (no newline).
Print a single week (no newline).
[ "Print", "a", "single", "week", "(", "no", "newline", ")", "." ]
def prweek(self, theweek, width): """ Print a single week (no newline). """ print(self.formatweek(theweek, width), end='')
[ "def", "prweek", "(", "self", ",", "theweek", ",", "width", ")", ":", "print", "(", "self", ".", "formatweek", "(", "theweek", ",", "width", ")", ",", "end", "=", "''", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/calendar.py#L299-L303
mickem/nscp
79f89fdbb6da63f91bc9dedb7aea202fe938f237
scripts/python/lib/google/protobuf/internal/containers.py
python
BaseContainer.__getitem__
(self, key)
return self._values[key]
Retrieves item by the specified key.
Retrieves item by the specified key.
[ "Retrieves", "item", "by", "the", "specified", "key", "." ]
def __getitem__(self, key): """Retrieves item by the specified key.""" return self._values[key]
[ "def", "__getitem__", "(", "self", ",", "key", ")", ":", "return", "self", ".", "_values", "[", "key", "]" ]
https://github.com/mickem/nscp/blob/79f89fdbb6da63f91bc9dedb7aea202fe938f237/scripts/python/lib/google/protobuf/internal/containers.py#L62-L64
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/distutils/system_info.py
python
system_info.check_libs2
(self, lib_dirs, libs, opt_libs=[])
return info
If static or shared libraries are available then return their info dictionary. Checks each library for shared or static.
If static or shared libraries are available then return their info dictionary.
[ "If", "static", "or", "shared", "libraries", "are", "available", "then", "return", "their", "info", "dictionary", "." ]
def check_libs2(self, lib_dirs, libs, opt_libs=[]): """If static or shared libraries are available then return their info dictionary. Checks each library for shared or static. """ exts = self.library_extensions() info = self._check_libs(lib_dirs, libs, opt_libs, exts) ...
[ "def", "check_libs2", "(", "self", ",", "lib_dirs", ",", "libs", ",", "opt_libs", "=", "[", "]", ")", ":", "exts", "=", "self", ".", "library_extensions", "(", ")", "info", "=", "self", ".", "_check_libs", "(", "lib_dirs", ",", "libs", ",", "opt_libs",...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/distutils/system_info.py#L878-L890
klzgrad/naiveproxy
ed2c513637c77b18721fe428d7ed395b4d284c83
src/build/android/diff_resource_sizes.py
python
DiffResults
(chartjson, base_results, diff_results)
Reports the diff between the two given results. Args: chartjson: A dictionary that chartjson results will be placed in, or None to only print results. base_results: The chartjson-formatted size results of the base APK. diff_results: The chartjson-formatted size results of the diff APK.
Reports the diff between the two given results.
[ "Reports", "the", "diff", "between", "the", "two", "given", "results", "." ]
def DiffResults(chartjson, base_results, diff_results): """Reports the diff between the two given results. Args: chartjson: A dictionary that chartjson results will be placed in, or None to only print results. base_results: The chartjson-formatted size results of the base APK. diff_results: The...
[ "def", "DiffResults", "(", "chartjson", ",", "base_results", ",", "diff_results", ")", ":", "for", "graph_title", ",", "graph", "in", "base_results", "[", "'charts'", "]", ".", "items", "(", ")", ":", "for", "trace_title", ",", "trace", "in", "graph", ".",...
https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/android/diff_resource_sizes.py#L43-L59
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/masked/timectrl.py
python
TimeCtrl.GetBounds
(self, as_string = False)
return (self.GetMin(as_string), self.GetMax(as_string))
This function returns a two-tuple (min,max), indicating the current bounds of the control. Each value can be None if that bound is not set.
This function returns a two-tuple (min,max), indicating the current bounds of the control. Each value can be None if that bound is not set.
[ "This", "function", "returns", "a", "two", "-", "tuple", "(", "min", "max", ")", "indicating", "the", "current", "bounds", "of", "the", "control", ".", "Each", "value", "can", "be", "None", "if", "that", "bound", "is", "not", "set", "." ]
def GetBounds(self, as_string = False): """ This function returns a two-tuple (min,max), indicating the current bounds of the control. Each value can be None if that bound is not set. """ return (self.GetMin(as_string), self.GetMax(as_string))
[ "def", "GetBounds", "(", "self", ",", "as_string", "=", "False", ")", ":", "return", "(", "self", ".", "GetMin", "(", "as_string", ")", ",", "self", ".", "GetMax", "(", "as_string", ")", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/masked/timectrl.py#L931-L937
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/pathlib.py
python
Path.chmod
(self, mode)
Change the permissions of the path, like os.chmod().
Change the permissions of the path, like os.chmod().
[ "Change", "the", "permissions", "of", "the", "path", "like", "os", ".", "chmod", "()", "." ]
def chmod(self, mode): """ Change the permissions of the path, like os.chmod(). """ self._accessor.chmod(self, mode)
[ "def", "chmod", "(", "self", ",", "mode", ")", ":", "self", ".", "_accessor", ".", "chmod", "(", "self", ",", "mode", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/pathlib.py#L1335-L1339
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scikit-learn/py2/sklearn/utils/stats.py
python
_rankdata
(a, method="average")
return rank
Assign ranks to data, dealing with ties appropriately. Ranks begin at 1. The method argument controls how ranks are assigned to equal values. Parameters ---------- a : array_like The array of values to be ranked. The array is first flattened. method : str, optional The method ...
Assign ranks to data, dealing with ties appropriately.
[ "Assign", "ranks", "to", "data", "dealing", "with", "ties", "appropriately", "." ]
def _rankdata(a, method="average"): """Assign ranks to data, dealing with ties appropriately. Ranks begin at 1. The method argument controls how ranks are assigned to equal values. Parameters ---------- a : array_like The array of values to be ranked. The array is first flattened. ...
[ "def", "_rankdata", "(", "a", ",", "method", "=", "\"average\"", ")", ":", "if", "method", "!=", "\"max\"", ":", "raise", "NotImplementedError", "(", ")", "unique_all", ",", "inverse", "=", "np", ".", "unique", "(", "a", ",", "return_inverse", "=", "True...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/utils/stats.py#L7-L41
rampageX/firmware-mod-kit
c94cd6aeee50d92ec5280a6dba6d74828fd3606b
src/binwalk-2.1.1/src/binwalk/core/module.py
python
Module.run
(self)
return False
Executes the main module routine. Must be overridden by the module sub-class. Returns True on success, False on failure.
Executes the main module routine. Must be overridden by the module sub-class.
[ "Executes", "the", "main", "module", "routine", ".", "Must", "be", "overridden", "by", "the", "module", "sub", "-", "class", "." ]
def run(self): ''' Executes the main module routine. Must be overridden by the module sub-class. Returns True on success, False on failure. ''' return False
[ "def", "run", "(", "self", ")", ":", "return", "False" ]
https://github.com/rampageX/firmware-mod-kit/blob/c94cd6aeee50d92ec5280a6dba6d74828fd3606b/src/binwalk-2.1.1/src/binwalk/core/module.py#L287-L294
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/imputils.py
python
Registry.lower_getattr
(self, ty, attr)
return decorate
Decorate an implementation of __getattr__ for type *ty* and the attribute *attr*. The decorated implementation will have the signature (context, builder, typ, val).
Decorate an implementation of __getattr__ for type *ty* and the attribute *attr*.
[ "Decorate", "an", "implementation", "of", "__getattr__", "for", "type", "*", "ty", "*", "and", "the", "attribute", "*", "attr", "*", "." ]
def lower_getattr(self, ty, attr): """ Decorate an implementation of __getattr__ for type *ty* and the attribute *attr*. The decorated implementation will have the signature (context, builder, typ, val). """ def decorate(impl): return self._decorate_a...
[ "def", "lower_getattr", "(", "self", ",", "ty", ",", "attr", ")", ":", "def", "decorate", "(", "impl", ")", ":", "return", "self", ".", "_decorate_attr", "(", "impl", ",", "ty", ",", "attr", ",", "self", ".", "getattrs", ",", "_decorate_getattr", ")", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/imputils.py#L47-L58
GoSSIP-SJTU/Armariris
ad5d868482956b2194a77b39c8d543c7c2318200
examples/Kaleidoscope/MCJIT/cached/split-lib.py
python
TimingScriptGenerator.writeTimingCall
(self, irname, callname)
Echo some comments and invoke both versions of toy
Echo some comments and invoke both versions of toy
[ "Echo", "some", "comments", "and", "invoke", "both", "versions", "of", "toy" ]
def writeTimingCall(self, irname, callname): """Echo some comments and invoke both versions of toy""" rootname = irname if '.' in irname: rootname = irname[:irname.rfind('.')] self.shfile.write("echo \"%s: Calls %s\" >> %s\n" % (callname, irname, self.timeFile)) self....
[ "def", "writeTimingCall", "(", "self", ",", "irname", ",", "callname", ")", ":", "rootname", "=", "irname", "if", "'.'", "in", "irname", ":", "rootname", "=", "irname", "[", ":", "irname", ".", "rfind", "(", "'.'", ")", "]", "self", ".", "shfile", "....
https://github.com/GoSSIP-SJTU/Armariris/blob/ad5d868482956b2194a77b39c8d543c7c2318200/examples/Kaleidoscope/MCJIT/cached/split-lib.py#L10-L32
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/utils/misc.py
python
is_wheel_installed
()
return True
Return whether the wheel package is installed.
Return whether the wheel package is installed.
[ "Return", "whether", "the", "wheel", "package", "is", "installed", "." ]
def is_wheel_installed(): """ Return whether the wheel package is installed. """ try: import wheel # noqa: F401 except ImportError: return False return True
[ "def", "is_wheel_installed", "(", ")", ":", "try", ":", "import", "wheel", "# noqa: F401", "except", "ImportError", ":", "return", "False", "return", "True" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/utils/misc.py#L891-L900
CanalTP/navitia
cb84ce9859070187e708818b058e6a7e0b7f891b
source/tyr/tyr/binarisation.py
python
gtfs2ed
(self, instance_config, gtfs_filename, job_id, dataset_uid)
Unzip gtfs file launch gtfs2ed
Unzip gtfs file launch gtfs2ed
[ "Unzip", "gtfs", "file", "launch", "gtfs2ed" ]
def gtfs2ed(self, instance_config, gtfs_filename, job_id, dataset_uid): """ Unzip gtfs file launch gtfs2ed """ job = models.Job.query.get(job_id) dataset = _retrieve_dataset_and_set_state("gtfs", job.id) instance = job.instance logger = get_instance_logger(instance, task_id=job_id) try: ...
[ "def", "gtfs2ed", "(", "self", ",", "instance_config", ",", "gtfs_filename", ",", "job_id", ",", "dataset_uid", ")", ":", "job", "=", "models", ".", "Job", ".", "query", ".", "get", "(", "job_id", ")", "dataset", "=", "_retrieve_dataset_and_set_state", "(", ...
https://github.com/CanalTP/navitia/blob/cb84ce9859070187e708818b058e6a7e0b7f891b/source/tyr/tyr/binarisation.py#L254-L292
panda3d/panda3d
833ad89ebad58395d0af0b7ec08538e5e4308265
direct/src/showbase/PythonUtil.py
python
getShortestRotation
(start, end)
return (start, end)
Given two heading values, return a tuple describing the shortest interval from 'start' to 'end'. This tuple can be used to lerp a camera between two rotations while avoiding the 'spin' problem.
Given two heading values, return a tuple describing the shortest interval from 'start' to 'end'. This tuple can be used to lerp a camera between two rotations while avoiding the 'spin' problem.
[ "Given", "two", "heading", "values", "return", "a", "tuple", "describing", "the", "shortest", "interval", "from", "start", "to", "end", ".", "This", "tuple", "can", "be", "used", "to", "lerp", "a", "camera", "between", "two", "rotations", "while", "avoiding"...
def getShortestRotation(start, end): """ Given two heading values, return a tuple describing the shortest interval from 'start' to 'end'. This tuple can be used to lerp a camera between two rotations while avoiding the 'spin' problem. """ start, end = start % 360, end % 360 if abs(end -...
[ "def", "getShortestRotation", "(", "start", ",", "end", ")", ":", "start", ",", "end", "=", "start", "%", "360", ",", "end", "%", "360", "if", "abs", "(", "end", "-", "start", ")", ">", "180", ":", "if", "end", "<", "start", ":", "end", "+=", "...
https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/showbase/PythonUtil.py#L861-L874
albertz/openlierox
d316c14a8eb57848ef56e9bfa7b23a56f694a51b
tools/DedicatedServerVideo/gdata/Crypto/PublicKey/DSA.py
python
DSAobj.can_encrypt
(self)
return 0
Return a Boolean value recording whether this algorithm can encrypt data.
Return a Boolean value recording whether this algorithm can encrypt data.
[ "Return", "a", "Boolean", "value", "recording", "whether", "this", "algorithm", "can", "encrypt", "data", "." ]
def can_encrypt(self): """Return a Boolean value recording whether this algorithm can encrypt data.""" return 0
[ "def", "can_encrypt", "(", "self", ")", ":", "return", "0" ]
https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/gdata/Crypto/PublicKey/DSA.py#L161-L163
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Tools/msi/msilib.py
python
change_sequence
(seq, action, seqno=_Unspecified, cond = _Unspecified)
Change the sequence number of an action in a sequence list
Change the sequence number of an action in a sequence list
[ "Change", "the", "sequence", "number", "of", "an", "action", "in", "a", "sequence", "list" ]
def change_sequence(seq, action, seqno=_Unspecified, cond = _Unspecified): "Change the sequence number of an action in a sequence list" for i in range(len(seq)): if seq[i][0] == action: if cond is _Unspecified: cond = seq[i][1] if seqno is _Unspecified: ...
[ "def", "change_sequence", "(", "seq", ",", "action", ",", "seqno", "=", "_Unspecified", ",", "cond", "=", "_Unspecified", ")", ":", "for", "i", "in", "range", "(", "len", "(", "seq", ")", ")", ":", "if", "seq", "[", "i", "]", "[", "0", "]", "==",...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Tools/msi/msilib.py#L247-L257
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/dataview.py
python
DataViewModel.GetValue
(*args, **kwargs)
return _dataview.DataViewModel_GetValue(*args, **kwargs)
GetValue(self, DataViewItem item, unsigned int col) -> wxVariant Override this and return the value to be used for the item, in the given column. The type of the return value should match that given by `GetColumnType`.
GetValue(self, DataViewItem item, unsigned int col) -> wxVariant
[ "GetValue", "(", "self", "DataViewItem", "item", "unsigned", "int", "col", ")", "-", ">", "wxVariant" ]
def GetValue(*args, **kwargs): """ GetValue(self, DataViewItem item, unsigned int col) -> wxVariant Override this and return the value to be used for the item, in the given column. The type of the return value should match that given by `GetColumnType`. """ retu...
[ "def", "GetValue", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_dataview", ".", "DataViewModel_GetValue", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/dataview.py#L472-L480
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/configure.py
python
cleanup_makefile
()
Delete any leftover BUILD files from the Makefile build. These files could interfere with Bazel parsing.
Delete any leftover BUILD files from the Makefile build.
[ "Delete", "any", "leftover", "BUILD", "files", "from", "the", "Makefile", "build", "." ]
def cleanup_makefile(): """Delete any leftover BUILD files from the Makefile build. These files could interfere with Bazel parsing. """ makefile_download_dir = os.path.join(_TF_WORKSPACE_ROOT, 'tensorflow', 'contrib', 'makefile', 'downloads') if os.path.isdir(makefile_d...
[ "def", "cleanup_makefile", "(", ")", ":", "makefile_download_dir", "=", "os", ".", "path", ".", "join", "(", "_TF_WORKSPACE_ROOT", ",", "'tensorflow'", ",", "'contrib'", ",", "'makefile'", ",", "'downloads'", ")", "if", "os", ".", "path", ".", "isdir", "(", ...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/configure.py#L272-L283
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/python/framework/tensor_shape.py
python
Dimension.__sub__
(self, other)
Returns the subtraction of `other` from `self`. Dimensions are subtracted as follows: Dimension(m) - Dimension(n) == Dimension(m - n) Dimension(m) - Dimension(None) == Dimension(None) Dimension(None) - Dimension(n) == Dimension(None) Dimension(None) - Dimension(None) == Dimensi...
Returns the subtraction of `other` from `self`.
[ "Returns", "the", "subtraction", "of", "other", "from", "self", "." ]
def __sub__(self, other): """Returns the subtraction of `other` from `self`. Dimensions are subtracted as follows: Dimension(m) - Dimension(n) == Dimension(m - n) Dimension(m) - Dimension(None) == Dimension(None) Dimension(None) - Dimension(n) == Dimension(None) Dimension(N...
[ "def", "__sub__", "(", "self", ",", "other", ")", ":", "other", "=", "as_dimension", "(", "other", ")", "if", "self", ".", "_value", "is", "None", "or", "other", ".", "value", "is", "None", ":", "return", "Dimension", "(", "None", ")", "else", ":", ...
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/framework/tensor_shape.py#L166-L186
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/_windows.py
python
SplitterWindow.GetSplitMode
(*args, **kwargs)
return _windows_.SplitterWindow_GetSplitMode(*args, **kwargs)
GetSplitMode(self) -> int Gets the split mode
GetSplitMode(self) -> int
[ "GetSplitMode", "(", "self", ")", "-", ">", "int" ]
def GetSplitMode(*args, **kwargs): """ GetSplitMode(self) -> int Gets the split mode """ return _windows_.SplitterWindow_GetSplitMode(*args, **kwargs)
[ "def", "GetSplitMode", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_windows_", ".", "SplitterWindow_GetSplitMode", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_windows.py#L1432-L1438
hpi-xnor/BMXNet
ed0b201da6667887222b8e4b5f997c4f6b61943d
python/mxnet/rnn/rnn_cell.py
python
BaseRNNCell.state_shape
(self)
return [ele['shape'] for ele in self.state_info]
shape(s) of states
shape(s) of states
[ "shape", "(", "s", ")", "of", "states" ]
def state_shape(self): """shape(s) of states""" return [ele['shape'] for ele in self.state_info]
[ "def", "state_shape", "(", "self", ")", ":", "return", "[", "ele", "[", "'shape'", "]", "for", "ele", "in", "self", ".", "state_info", "]" ]
https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/rnn/rnn_cell.py#L181-L183
apache/qpid-proton
6bcdfebb55ea3554bc29b1901422532db331a591
python/proton/_delivery.py
python
Delivery.update
(self, state: Union[int, DispositionType])
Set the local state of the delivery e.g. :const:`ACCEPTED`, :const:`REJECTED`, :const:`RELEASED`. :param state: State of delivery
Set the local state of the delivery e.g. :const:`ACCEPTED`, :const:`REJECTED`, :const:`RELEASED`.
[ "Set", "the", "local", "state", "of", "the", "delivery", "e", ".", "g", ".", ":", "const", ":", "ACCEPTED", ":", "const", ":", "REJECTED", ":", "const", ":", "RELEASED", "." ]
def update(self, state: Union[int, DispositionType]) -> None: """ Set the local state of the delivery e.g. :const:`ACCEPTED`, :const:`REJECTED`, :const:`RELEASED`. :param state: State of delivery """ obj2dat(self.local._data, pn_disposition_data(self.local._impl)) ...
[ "def", "update", "(", "self", ",", "state", ":", "Union", "[", "int", ",", "DispositionType", "]", ")", "->", "None", ":", "obj2dat", "(", "self", ".", "local", ".", "_data", ",", "pn_disposition_data", "(", "self", ".", "local", ".", "_impl", ")", "...
https://github.com/apache/qpid-proton/blob/6bcdfebb55ea3554bc29b1901422532db331a591/python/proton/_delivery.py#L352-L362
cyberbotics/webots
af7fa7d68dcf7b4550f1f2e132092b41e83698fc
resources/osm_importer/parser_objects.py
python
Parser.parse_file
(self, file, disableMultipolygonBuildings=False)
Parse the OSM file.
Parse the OSM file.
[ "Parse", "the", "OSM", "file", "." ]
def parse_file(self, file, disableMultipolygonBuildings=False): """Parse the OSM file.""" tree = etree.parse(file) root = tree.getroot() if not etree.iselement(root): sys.exit("Error while parsing '" + file + "' file.\n") for node in root.findall('node'): ...
[ "def", "parse_file", "(", "self", ",", "file", ",", "disableMultipolygonBuildings", "=", "False", ")", ":", "tree", "=", "etree", ".", "parse", "(", "file", ")", "root", "=", "tree", ".", "getroot", "(", ")", "if", "not", "etree", ".", "iselement", "("...
https://github.com/cyberbotics/webots/blob/af7fa7d68dcf7b4550f1f2e132092b41e83698fc/resources/osm_importer/parser_objects.py#L43-L67
PyMesh/PyMesh
384ba882b7558ba6e8653ed263c419226c22bddf
python/pymesh/compression.py
python
compress
(mesh, engine_name="draco")
return data
Compress mesh data. Args: mesh (:class:`Mesh`): Input mesh. engine_name (``string``): Valid engines are: * ``draco``: `Google's Draco engine <https://google.github.io/draco/>`_ [#]_ Returns: A binary string representing the compressed mesh data. A simple...
Compress mesh data.
[ "Compress", "mesh", "data", "." ]
def compress(mesh, engine_name="draco"): """ Compress mesh data. Args: mesh (:class:`Mesh`): Input mesh. engine_name (``string``): Valid engines are: * ``draco``: `Google's Draco engine <https://google.github.io/draco/>`_ [#]_ Returns: A binary string rep...
[ "def", "compress", "(", "mesh", ",", "engine_name", "=", "\"draco\"", ")", ":", "engine", "=", "PyMesh", ".", "CompressionEngine", ".", "create", "(", "engine_name", ")", "data", "=", "engine", ".", "compress", "(", "mesh", ".", "raw_mesh", ")", "return", ...
https://github.com/PyMesh/PyMesh/blob/384ba882b7558ba6e8653ed263c419226c22bddf/python/pymesh/compression.py#L6-L33
devpack/android-python27
d42dd67565e104cf7b0b50eb473f615db3e69901
python-build-with-qt/PyQt-x11-gpl-4.8/pyqtconfig.py
python
QtDeclarativeModuleMakefile.__init__
(self, *args, **kw)
Initialise an instance of a module Makefile.
Initialise an instance of a module Makefile.
[ "Initialise", "an", "instance", "of", "a", "module", "Makefile", "." ]
def __init__(self, *args, **kw): """Initialise an instance of a module Makefile. """ if "qt" not in kw: kw["qt"] = ["QtCore", "QtGui", "QtNetwork", "QtDeclarative"] QtNetworkModuleMakefile.__init__(self, *args, **kw)
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "if", "\"qt\"", "not", "in", "kw", ":", "kw", "[", "\"qt\"", "]", "=", "[", "\"QtCore\"", ",", "\"QtGui\"", ",", "\"QtNetwork\"", ",", "\"QtDeclarative\"", "]", "QtNetwo...
https://github.com/devpack/android-python27/blob/d42dd67565e104cf7b0b50eb473f615db3e69901/python-build-with-qt/PyQt-x11-gpl-4.8/pyqtconfig.py#L233-L239
weolar/miniblink49
1c4678db0594a4abde23d3ebbcc7cd13c3170777
third_party/jinja2/compiler.py
python
CodeGenerator.visit_Import
(self, node, frame)
Visit regular imports.
Visit regular imports.
[ "Visit", "regular", "imports", "." ]
def visit_Import(self, node, frame): """Visit regular imports.""" if node.with_context: self.unoptimize_scope(frame) self.writeline('l_%s = ' % node.target, node) if frame.toplevel: self.write('context.vars[%r] = ' % node.target) self.write('environment.ge...
[ "def", "visit_Import", "(", "self", ",", "node", ",", "frame", ")", ":", "if", "node", ".", "with_context", ":", "self", ".", "unoptimize_scope", "(", "frame", ")", "self", ".", "writeline", "(", "'l_%s = '", "%", "node", ".", "target", ",", "node", ")...
https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/jinja2/compiler.py#L965-L981
etotheipi/BitcoinArmory
2a6fc5355bb0c6fe26e387ccba30a5baafe8cd98
qtdefines.py
python
MsgBoxWithDNAA
(parent, main, wtype, title, msg, dnaaMsg, wCancel=False, \ yesStr='Yes', noStr='No', dnaaStartChk=False)
return (result, dlg.chkDnaa.isChecked())
Creates a warning/question/critical dialog, but with a "Do not ask again" checkbox. Will return a pair (response, DNAA-is-checked)
Creates a warning/question/critical dialog, but with a "Do not ask again" checkbox. Will return a pair (response, DNAA-is-checked)
[ "Creates", "a", "warning", "/", "question", "/", "critical", "dialog", "but", "with", "a", "Do", "not", "ask", "again", "checkbox", ".", "Will", "return", "a", "pair", "(", "response", "DNAA", "-", "is", "-", "checked", ")" ]
def MsgBoxWithDNAA(parent, main, wtype, title, msg, dnaaMsg, wCancel=False, \ yesStr='Yes', noStr='No', dnaaStartChk=False): """ Creates a warning/question/critical dialog, but with a "Do not ask again" checkbox. Will return a pair (response, DNAA-is-checked) """ class dlgWarn(Armor...
[ "def", "MsgBoxWithDNAA", "(", "parent", ",", "main", ",", "wtype", ",", "title", ",", "msg", ",", "dnaaMsg", ",", "wCancel", "=", "False", ",", "yesStr", "=", "'Yes'", ",", "noStr", "=", "'No'", ",", "dnaaStartChk", "=", "False", ")", ":", "class", "...
https://github.com/etotheipi/BitcoinArmory/blob/2a6fc5355bb0c6fe26e387ccba30a5baafe8cd98/qtdefines.py#L531-L611
natanielruiz/android-yolo
1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f
jni-build/jni/include/tensorflow/contrib/tensor_forest/python/tensor_forest.py
python
RandomTreeGraphs._weighted_gini
(self, class_counts)
return sums - sum_squares / sums
Our split score is the Gini impurity times the number of examples. If c(i) denotes the i-th class count and c = sum_i c(i) then score = c * (1 - sum_i ( c(i) / c )^2 ) = c - sum_i c(i)^2 / c Args: class_counts: A 2-D tensor of per-class counts, usually a slice or gather from var...
Our split score is the Gini impurity times the number of examples.
[ "Our", "split", "score", "is", "the", "Gini", "impurity", "times", "the", "number", "of", "examples", "." ]
def _weighted_gini(self, class_counts): """Our split score is the Gini impurity times the number of examples. If c(i) denotes the i-th class count and c = sum_i c(i) then score = c * (1 - sum_i ( c(i) / c )^2 ) = c - sum_i c(i)^2 / c Args: class_counts: A 2-D tensor of per-class cou...
[ "def", "_weighted_gini", "(", "self", ",", "class_counts", ")", ":", "smoothed", "=", "1.0", "+", "array_ops", ".", "slice", "(", "class_counts", ",", "[", "0", ",", "1", "]", ",", "[", "-", "1", ",", "-", "1", "]", ")", "sums", "=", "math_ops", ...
https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/tensor_forest/python/tensor_forest.py#L489-L506
MythTV/mythtv
d282a209cb8be85d036f85a62a8ec971b67d45f4
mythtv/programs/scripts/internetcontent/nv_python_libs/xsltfunctions/revision3XSL_api.py
python
xpathFunctions.revision3checkIfDBItem
(self, context, arg)
return common.checkIfDBItem('dummy', {'title': self.revision3Episode(context, arg)[0].find('title').text, })
Use a unique key value pairing to find out if the 'internetcontentarticles' table already has a matching item. This is done to save accessing the Internet when not required. Call example: 'mnvXpath:revision3checkIfDBItem(.)' return True if a match was found return False if a match was no...
Use a unique key value pairing to find out if the 'internetcontentarticles' table already has a matching item. This is done to save accessing the Internet when not required. Call example: 'mnvXpath:revision3checkIfDBItem(.)' return True if a match was found return False if a match was no...
[ "Use", "a", "unique", "key", "value", "pairing", "to", "find", "out", "if", "the", "internetcontentarticles", "table", "already", "has", "a", "matching", "item", ".", "This", "is", "done", "to", "save", "accessing", "the", "Internet", "when", "not", "require...
def revision3checkIfDBItem(self, context, arg): '''Use a unique key value pairing to find out if the 'internetcontentarticles' table already has a matching item. This is done to save accessing the Internet when not required. Call example: 'mnvXpath:revision3checkIfDBItem(.)' return True ...
[ "def", "revision3checkIfDBItem", "(", "self", ",", "context", ",", "arg", ")", ":", "return", "common", ".", "checkIfDBItem", "(", "'dummy'", ",", "{", "'title'", ":", "self", ".", "revision3Episode", "(", "context", ",", "arg", ")", "[", "0", "]", ".", ...
https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/programs/scripts/internetcontent/nv_python_libs/xsltfunctions/revision3XSL_api.py#L168-L175
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/Jinja2/py2/jinja2/filters.py
python
do_wordwrap
( environment, s, width=79, break_long_words=True, wrapstring=None, break_on_hyphens=True, )
return wrapstring.join( [ wrapstring.join( textwrap.wrap( line, width=width, expand_tabs=False, replace_whitespace=False, break_long_words=break_long_words, break_o...
Wrap a string to the given width. Existing newlines are treated as paragraphs to be wrapped separately. :param s: Original text to wrap. :param width: Maximum length of wrapped lines. :param break_long_words: If a word is longer than ``width``, break it across lines. :param break_on_hyphens...
Wrap a string to the given width. Existing newlines are treated as paragraphs to be wrapped separately.
[ "Wrap", "a", "string", "to", "the", "given", "width", ".", "Existing", "newlines", "are", "treated", "as", "paragraphs", "to", "be", "wrapped", "separately", "." ]
def do_wordwrap( environment, s, width=79, break_long_words=True, wrapstring=None, break_on_hyphens=True, ): """Wrap a string to the given width. Existing newlines are treated as paragraphs to be wrapped separately. :param s: Original text to wrap. :param width: Maximum length o...
[ "def", "do_wordwrap", "(", "environment", ",", "s", ",", "width", "=", "79", ",", "break_long_words", "=", "True", ",", "wrapstring", "=", "None", ",", "break_on_hyphens", "=", "True", ",", ")", ":", "import", "textwrap", "if", "not", "wrapstring", ":", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Jinja2/py2/jinja2/filters.py#L706-L759
microsoft/AirSim
8057725712c0cd46979135396381784075ffc0f3
PythonClient/airsim/client.py
python
VehicleClient.simPlotLineList
(self, points, color_rgba=[1.0, 0.0, 0.0, 1.0], thickness = 5.0, duration = -1.0, is_persistent = False)
Plots a line strip in World NED frame, defined from points[0] to points[1], points[2] to points[3], ... , points[n-2] to points[n-1] Args: points (list[Vector3r]): List of 3D locations of line start and end points, specified as Vector3r objects. Must be even color_rgba (list, optional):...
Plots a line strip in World NED frame, defined from points[0] to points[1], points[2] to points[3], ... , points[n-2] to points[n-1]
[ "Plots", "a", "line", "strip", "in", "World", "NED", "frame", "defined", "from", "points", "[", "0", "]", "to", "points", "[", "1", "]", "points", "[", "2", "]", "to", "points", "[", "3", "]", "...", "points", "[", "n", "-", "2", "]", "to", "po...
def simPlotLineList(self, points, color_rgba=[1.0, 0.0, 0.0, 1.0], thickness = 5.0, duration = -1.0, is_persistent = False): """ Plots a line strip in World NED frame, defined from points[0] to points[1], points[2] to points[3], ... , points[n-2] to points[n-1] Args: points (list[Ve...
[ "def", "simPlotLineList", "(", "self", ",", "points", ",", "color_rgba", "=", "[", "1.0", ",", "0.0", ",", "0.0", ",", "1.0", "]", ",", "thickness", "=", "5.0", ",", "duration", "=", "-", "1.0", ",", "is_persistent", "=", "False", ")", ":", "self", ...
https://github.com/microsoft/AirSim/blob/8057725712c0cd46979135396381784075ffc0f3/PythonClient/airsim/client.py#L953-L964
apple/swift-lldb
d74be846ef3e62de946df343e8c234bde93a8912
scripts/Python/static-binding/lldb.py
python
SBTarget.FindBreakpointsByName
(self, name, bkpt_list)
return _lldb.SBTarget_FindBreakpointsByName(self, name, bkpt_list)
FindBreakpointsByName(SBTarget self, char const * name, SBBreakpointList bkpt_list) -> bool
FindBreakpointsByName(SBTarget self, char const * name, SBBreakpointList bkpt_list) -> bool
[ "FindBreakpointsByName", "(", "SBTarget", "self", "char", "const", "*", "name", "SBBreakpointList", "bkpt_list", ")", "-", ">", "bool" ]
def FindBreakpointsByName(self, name, bkpt_list): """FindBreakpointsByName(SBTarget self, char const * name, SBBreakpointList bkpt_list) -> bool""" return _lldb.SBTarget_FindBreakpointsByName(self, name, bkpt_list)
[ "def", "FindBreakpointsByName", "(", "self", ",", "name", ",", "bkpt_list", ")", ":", "return", "_lldb", ".", "SBTarget_FindBreakpointsByName", "(", "self", ",", "name", ",", "bkpt_list", ")" ]
https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L11036-L11038
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
chromeos/ime/gen_input_methods.py
python
CreateEngineHeader
(engines)
return "".join(output)
Create the header file from a list of engines. Arguments: engines: list of engine objects Returns: The text of a C++ header file containing the engine data.
Create the header file from a list of engines.
[ "Create", "the", "header", "file", "from", "a", "list", "of", "engines", "." ]
def CreateEngineHeader(engines): """Create the header file from a list of engines. Arguments: engines: list of engine objects Returns: The text of a C++ header file containing the engine data. """ output = [] output.append(OUTPUT_HEADER) for engine in engines: if engine.has_key('if'): o...
[ "def", "CreateEngineHeader", "(", "engines", ")", ":", "output", "=", "[", "]", "output", ".", "append", "(", "OUTPUT_HEADER", ")", "for", "engine", "in", "engines", ":", "if", "engine", ".", "has_key", "(", "'if'", ")", ":", "output", ".", "append", "...
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/chromeos/ime/gen_input_methods.py#L82-L100
PaddlePaddle/Paddle
1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c
python/paddle/fluid/dygraph/dygraph_to_static/error.py
python
ErrorData._simplify_error_value
(self)
Simplifies error value to improve readability if error is raised in runtime. NOTE(liym27): The op callstack information about transformed static code has been replaced with original dygraph code. TODO(liym27): 1. Need a more robust way because the code of start_trace may change. ...
Simplifies error value to improve readability if error is raised in runtime.
[ "Simplifies", "error", "value", "to", "improve", "readability", "if", "error", "is", "raised", "in", "runtime", "." ]
def _simplify_error_value(self): """ Simplifies error value to improve readability if error is raised in runtime. NOTE(liym27): The op callstack information about transformed static code has been replaced with original dygraph code. TODO(liym27): 1. Need a more robust way b...
[ "def", "_simplify_error_value", "(", "self", ")", ":", "assert", "self", ".", "in_runtime", "is", "True", "error_value_lines", "=", "str", "(", "self", ".", "error_value", ")", ".", "split", "(", "\"\\n\"", ")", "error_value_lines_strip", "=", "[", "mes", "....
https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/dygraph/dygraph_to_static/error.py#L249-L320
cms-sw/cmssw
fd9de012d503d3405420bcbeec0ec879baa57cf2
DQM/Integration/scripts/harvesting_tools/cmsHarvester.py
python
CMSHarvester.option_handler_debug
(self, option, opt_str, value, parser)
Switch to debug mode. This both increases the amount of output generated, as well as changes the format used (more detailed information is given).
Switch to debug mode.
[ "Switch", "to", "debug", "mode", "." ]
def option_handler_debug(self, option, opt_str, value, parser): """Switch to debug mode. This both increases the amount of output generated, as well as changes the format used (more detailed information is given). """ # Switch to a more informative log formatter for debugging....
[ "def", "option_handler_debug", "(", "self", ",", "option", ",", "opt_str", ",", "value", ",", "parser", ")", ":", "# Switch to a more informative log formatter for debugging.", "log_formatter_debug", "=", "logging", ".", "Formatter", "(", "\"[%(levelname)s] \"", "# NOTE: ...
https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/DQM/Integration/scripts/harvesting_tools/cmsHarvester.py#L660-L681
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
tools/generate_stubs/generate_stubs.py
python
PosixStubWriter.StubFunctionPointer
(cls, signature)
return 'static %s (*%s_ptr)(%s) = NULL;' % (signature['return_type'], signature['name'], ', '.join(signature['params']))
Generates a function pointer declaration for the given signature. Args: signature: A signature hash, as produced by ParseSignatures, representating the function signature. Returns: A string with the declaration of the function pointer for the signature.
Generates a function pointer declaration for the given signature.
[ "Generates", "a", "function", "pointer", "declaration", "for", "the", "given", "signature", "." ]
def StubFunctionPointer(cls, signature): """Generates a function pointer declaration for the given signature. Args: signature: A signature hash, as produced by ParseSignatures, representating the function signature. Returns: A string with the declaration of the function pointe...
[ "def", "StubFunctionPointer", "(", "cls", ",", "signature", ")", ":", "return", "'static %s (*%s_ptr)(%s) = NULL;'", "%", "(", "signature", "[", "'return_type'", "]", ",", "signature", "[", "'name'", "]", ",", "', '", ".", "join", "(", "signature", "[", "'para...
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/generate_stubs/generate_stubs.py#L609-L621
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/fractions.py
python
Fraction._sub
(a, b)
return Fraction(a.numerator * db - b.numerator * da, da * db)
a - b
a - b
[ "a", "-", "b" ]
def _sub(a, b): """a - b""" da, db = a.denominator, b.denominator return Fraction(a.numerator * db - b.numerator * da, da * db)
[ "def", "_sub", "(", "a", ",", "b", ")", ":", "da", ",", "db", "=", "a", ".", "denominator", ",", "b", ".", "denominator", "return", "Fraction", "(", "a", ".", "numerator", "*", "db", "-", "b", ".", "numerator", "*", "da", ",", "da", "*", "db", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/fractions.py#L409-L413
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/view/DrillSettingsDialog.py
python
DrillSettingsDialog.setSettings
(self, settings)
Fill the settings with values by providing a dictionnary. Args: settings (dict(str: any)): settings name and value. Value can be anything, other that bool will be converted to str.
Fill the settings with values by providing a dictionnary.
[ "Fill", "the", "settings", "with", "values", "by", "providing", "a", "dictionnary", "." ]
def setSettings(self, settings): """ Fill the settings with values by providing a dictionnary. Args: settings (dict(str: any)): settings name and value. Value can be anything, other that bool will be conve...
[ "def", "setSettings", "(", "self", ",", "settings", ")", ":", "for", "(", "k", ",", "v", ")", "in", "settings", ".", "items", "(", ")", ":", "if", "k", "in", "self", ".", "settings", ":", "self", ".", "settings", "[", "k", "]", ".", "setter", "...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/view/DrillSettingsDialog.py#L247-L258
Polidea/SiriusObfuscator
b0e590d8130e97856afe578869b83a209e2b19be
SymbolExtractorAndRenamer/lldb/examples/python/gdbremote.py
python
TerminalColors.underline
(self, on=True)
return ''
Enable or disable underline depending on the "on" parameter.
Enable or disable underline depending on the "on" parameter.
[ "Enable", "or", "disable", "underline", "depending", "on", "the", "on", "parameter", "." ]
def underline(self, on=True): '''Enable or disable underline depending on the "on" parameter.''' if self.enabled: if on: return "\x1b[4m" else: return "\x1b[24m" return ''
[ "def", "underline", "(", "self", ",", "on", "=", "True", ")", ":", "if", "self", ".", "enabled", ":", "if", "on", ":", "return", "\"\\x1b[4m\"", "else", ":", "return", "\"\\x1b[24m\"", "return", "''" ]
https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/examples/python/gdbremote.py#L73-L80
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/py2/scipy/io/idl.py
python
_read_uint16
(f)
return np.uint16(struct.unpack('>H', f.read(4)[2:4])[0])
Read an unsigned 16-bit integer
Read an unsigned 16-bit integer
[ "Read", "an", "unsigned", "16", "-", "bit", "integer" ]
def _read_uint16(f): '''Read an unsigned 16-bit integer''' return np.uint16(struct.unpack('>H', f.read(4)[2:4])[0])
[ "def", "_read_uint16", "(", "f", ")", ":", "return", "np", ".", "uint16", "(", "struct", ".", "unpack", "(", "'>H'", ",", "f", ".", "read", "(", "4", ")", "[", "2", ":", "4", "]", ")", "[", "0", "]", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/io/idl.py#L123-L125
shedskin/shedskin
ae88dbca7b1d9671cd8be448cb0b497122758936
examples/voronoi.py
python
closest
(x,y,points)
return sqrt(best) / sqrt(good)
Function to find the closest of the vi.
Function to find the closest of the vi.
[ "Function", "to", "find", "the", "closest", "of", "the", "vi", "." ]
def closest(x,y,points): """Function to find the closest of the vi.""" best,good = 99.0*99.0, 99.0*99.0 for px, py in points: dist = (x-px)*(x-px) + (y-py)*(y-py) if dist < best: best, good = dist, best elif dist < good: good = dist return sqrt(best) / sqr...
[ "def", "closest", "(", "x", ",", "y", ",", "points", ")", ":", "best", ",", "good", "=", "99.0", "*", "99.0", ",", "99.0", "*", "99.0", "for", "px", ",", "py", "in", "points", ":", "dist", "=", "(", "x", "-", "px", ")", "*", "(", "x", "-", ...
https://github.com/shedskin/shedskin/blob/ae88dbca7b1d9671cd8be448cb0b497122758936/examples/voronoi.py#L20-L29
snap-stanford/snap-python
d53c51b0a26aa7e3e7400b014cdf728948fde80a
setup/snap.py
python
TPairHashImpl2.GetHashCd
(*args)
return _snap.TPairHashImpl2_GetHashCd(*args)
GetHashCd(int const hc1, int const hc2) -> int Parameters: hc1: int const hc2: int const
GetHashCd(int const hc1, int const hc2) -> int
[ "GetHashCd", "(", "int", "const", "hc1", "int", "const", "hc2", ")", "-", ">", "int" ]
def GetHashCd(*args): """ GetHashCd(int const hc1, int const hc2) -> int Parameters: hc1: int const hc2: int const """ return _snap.TPairHashImpl2_GetHashCd(*args)
[ "def", "GetHashCd", "(", "*", "args", ")", ":", "return", "_snap", ".", "TPairHashImpl2_GetHashCd", "(", "*", "args", ")" ]
https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L505-L514
okex/V3-Open-API-SDK
c5abb0db7e2287718e0055e17e57672ce0ec7fd9
okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/distlib/_backport/tarfile.py
python
TarInfo._block
(self, count)
return blocks * BLOCKSIZE
Round up a byte count by BLOCKSIZE and return it, e.g. _block(834) => 1024.
Round up a byte count by BLOCKSIZE and return it, e.g. _block(834) => 1024.
[ "Round", "up", "a", "byte", "count", "by", "BLOCKSIZE", "and", "return", "it", "e", ".", "g", ".", "_block", "(", "834", ")", "=", ">", "1024", "." ]
def _block(self, count): """Round up a byte count by BLOCKSIZE and return it, e.g. _block(834) => 1024. """ blocks, remainder = divmod(count, BLOCKSIZE) if remainder: blocks += 1 return blocks * BLOCKSIZE
[ "def", "_block", "(", "self", ",", "count", ")", ":", "blocks", ",", "remainder", "=", "divmod", "(", "count", ",", "BLOCKSIZE", ")", "if", "remainder", ":", "blocks", "+=", "1", "return", "blocks", "*", "BLOCKSIZE" ]
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/_vendor/distlib/_backport/tarfile.py#L1549-L1556
RamadhanAmizudin/malware
2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1
Fuzzbunch/fuzzbunch/deployablemanager.py
python
DeployableManager.do_execute
(self, input)
Execute the current plugin
Execute the current plugin
[ "Execute", "the", "current", "plugin" ]
def do_execute(self, input): """Execute the current plugin""" session = None self.io.newline() inputList = input.strip().split() if len(inputList) > 0: consolemode = inputList[0].lower() consolemode = util.convert_consolemode(consolemode) else: ...
[ "def", "do_execute", "(", "self", ",", "input", ")", ":", "session", "=", "None", "self", ".", "io", ".", "newline", "(", ")", "inputList", "=", "input", ".", "strip", "(", ")", ".", "split", "(", ")", "if", "len", "(", "inputList", ")", ">", "0"...
https://github.com/RamadhanAmizudin/malware/blob/2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1/Fuzzbunch/fuzzbunch/deployablemanager.py#L31-L157
RLBot/RLBot
34332b12cf158b3ef8dbf174ae67c53683368a9d
src/main/python/rlbot/botmanager/helper_process_manager.py
python
run_helper_process
(python_file, metadata_queue, quit_event, options)
:param python_file: The absolute path of a python file containing the helper process that should be run. It must define a class which is a subclass of BotHelperProcess. :param metadata_queue: A queue from which the helper process will read AgentMetadata updates. :param quit_event: An event which should be s...
:param python_file: The absolute path of a python file containing the helper process that should be run. It must define a class which is a subclass of BotHelperProcess. :param metadata_queue: A queue from which the helper process will read AgentMetadata updates. :param quit_event: An event which should be s...
[ ":", "param", "python_file", ":", "The", "absolute", "path", "of", "a", "python", "file", "containing", "the", "helper", "process", "that", "should", "be", "run", ".", "It", "must", "define", "a", "class", "which", "is", "a", "subclass", "of", "BotHelperPr...
def run_helper_process(python_file, metadata_queue, quit_event, options): """ :param python_file: The absolute path of a python file containing the helper process that should be run. It must define a class which is a subclass of BotHelperProcess. :param metadata_queue: A queue from which the helper proc...
[ "def", "run_helper_process", "(", "python_file", ",", "metadata_queue", ",", "quit_event", ",", "options", ")", ":", "class_wrapper", "=", "import_class_with_base", "(", "python_file", ",", "BotHelperProcess", ")", "helper_class", "=", "class_wrapper", ".", "get_loade...
https://github.com/RLBot/RLBot/blob/34332b12cf158b3ef8dbf174ae67c53683368a9d/src/main/python/rlbot/botmanager/helper_process_manager.py#L60-L71
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/graphy/graphy/backends/google_chart_api/util.py
python
EncodeData
(chart, series, y_min, y_max, encoder)
return result
Format the given data series in plain or extended format. Use the chart's encoder to determine the format. The formatted data will be scaled to fit within the range of values supported by the chosen encoding. Args: chart: The chart. series: A list of the the data series to format; each list element is...
Format the given data series in plain or extended format.
[ "Format", "the", "given", "data", "series", "in", "plain", "or", "extended", "format", "." ]
def EncodeData(chart, series, y_min, y_max, encoder): """Format the given data series in plain or extended format. Use the chart's encoder to determine the format. The formatted data will be scaled to fit within the range of values supported by the chosen encoding. Args: chart: The chart. series: A ...
[ "def", "EncodeData", "(", "chart", ",", "series", ",", "y_min", ",", "y_max", ",", "encoder", ")", ":", "assert", "(", "y_min", "is", "None", ")", "==", "(", "y_max", "is", "None", ")", "if", "y_min", "is", "not", "None", ":", "def", "_ScaleAndEncode...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/graphy/graphy/backends/google_chart_api/util.py#L188-L214
BlzFans/wke
b0fa21158312e40c5fbd84682d643022b6c34a93
cygwin/lib/python2.6/mhlib.py
python
Message.getbodyparts
(self)
return parts
Only for multipart messages: return the message's body as a list of SubMessage objects. Each submessage object behaves (almost) as a Message object.
Only for multipart messages: return the message's body as a list of SubMessage objects. Each submessage object behaves (almost) as a Message object.
[ "Only", "for", "multipart", "messages", ":", "return", "the", "message", "s", "body", "as", "a", "list", "of", "SubMessage", "objects", ".", "Each", "submessage", "object", "behaves", "(", "almost", ")", "as", "a", "Message", "object", "." ]
def getbodyparts(self): """Only for multipart messages: return the message's body as a list of SubMessage objects. Each submessage object behaves (almost) as a Message object.""" if self.getmaintype() != 'multipart': raise Error, 'Content-Type is not multipart/*' bdr...
[ "def", "getbodyparts", "(", "self", ")", ":", "if", "self", ".", "getmaintype", "(", ")", "!=", "'multipart'", ":", "raise", "Error", ",", "'Content-Type is not multipart/*'", "bdry", "=", "self", ".", "getparam", "(", "'boundary'", ")", "if", "not", "bdry",...
https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/mhlib.py#L712-L730
Caffe-MPI/Caffe-MPI.github.io
df5992af571a2a19981b69635115c393f18d1c76
examples/pycaffe/layers/pascal_multilabel_datalayers.py
python
PascalMultilabelDataLayerSync.reshape
(self, bottom, top)
There is no need to reshape the data, since the input is of fixed size (rows and columns)
There is no need to reshape the data, since the input is of fixed size (rows and columns)
[ "There", "is", "no", "need", "to", "reshape", "the", "data", "since", "the", "input", "is", "of", "fixed", "size", "(", "rows", "and", "columns", ")" ]
def reshape(self, bottom, top): """ There is no need to reshape the data, since the input is of fixed size (rows and columns) """ pass
[ "def", "reshape", "(", "self", ",", "bottom", ",", "top", ")", ":", "pass" ]
https://github.com/Caffe-MPI/Caffe-MPI.github.io/blob/df5992af571a2a19981b69635115c393f18d1c76/examples/pycaffe/layers/pascal_multilabel_datalayers.py#L67-L72
klzgrad/naiveproxy
ed2c513637c77b18721fe428d7ed395b4d284c83
src/tools/grit/grit/node/message.py
python
MessageNode.SetReplaceEllipsis
(self, value)
r'''Sets whether to replace ... with \u2026.
r'''Sets whether to replace ... with \u2026.
[ "r", "Sets", "whether", "to", "replace", "...", "with", "\\", "u2026", "." ]
def SetReplaceEllipsis(self, value): r'''Sets whether to replace ... with \u2026. ''' self._replace_ellipsis = value
[ "def", "SetReplaceEllipsis", "(", "self", ",", "value", ")", ":", "self", ".", "_replace_ellipsis", "=", "value" ]
https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/tools/grit/grit/node/message.py#L105-L108
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/tensorflow/contrib/linear_optimizer/python/ops/sdca_ops.py
python
SdcaModel.minimize
(self, global_step=None, name=None)
Add operations to train a linear model by minimizing the loss function. Args: global_step: Optional `Variable` to increment by one after the variables have been updated. name: Optional name for the returned operation. Returns: An Operation that updates the variables passed in the con...
Add operations to train a linear model by minimizing the loss function.
[ "Add", "operations", "to", "train", "a", "linear", "model", "by", "minimizing", "the", "loss", "function", "." ]
def minimize(self, global_step=None, name=None): """Add operations to train a linear model by minimizing the loss function. Args: global_step: Optional `Variable` to increment by one after the variables have been updated. name: Optional name for the returned operation. Returns: A...
[ "def", "minimize", "(", "self", ",", "global_step", "=", "None", ",", "name", "=", "None", ")", ":", "# Technically, the op depends on a lot more than the variables,", "# but we'll keep the list short.", "with", "op_scope", "(", "[", "]", ",", "name", ",", "'sdca/mini...
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/linear_optimizer/python/ops/sdca_ops.py#L470-L558
cmu-db/noisepage
79276e68fe83322f1249e8a8be96bd63c583ae56
build-support/cpplint.py
python
ParseNolintSuppressions
(filename, raw_line, linenum, error)
Updates the global list of line error-suppressions. Parses any NOLINT comments on the current line, updating the global error_suppressions store. Reports an error if the NOLINT comment was malformed. Args: filename: str, the name of the input file. raw_line: str, the line of input text, with comments...
Updates the global list of line error-suppressions.
[ "Updates", "the", "global", "list", "of", "line", "error", "-", "suppressions", "." ]
def ParseNolintSuppressions(filename, raw_line, linenum, error): """Updates the global list of line error-suppressions. Parses any NOLINT comments on the current line, updating the global error_suppressions store. Reports an error if the NOLINT comment was malformed. Args: filename: str, the name of ...
[ "def", "ParseNolintSuppressions", "(", "filename", ",", "raw_line", ",", "linenum", ",", "error", ")", ":", "matched", "=", "Search", "(", "r'\\bNOLINT(NEXTLINE)?\\b(\\([^)]+\\))?'", ",", "raw_line", ")", "if", "matched", ":", "if", "matched", ".", "group", "(",...
https://github.com/cmu-db/noisepage/blob/79276e68fe83322f1249e8a8be96bd63c583ae56/build-support/cpplint.py#L723-L752
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/_gdi.py
python
MirrorDC.__init__
(self, *args, **kwargs)
__init__(self, DC dc, bool mirror) -> MirrorDC Creates a mirrored DC associated with the real *dc*. Everything drawn on the wx.MirrorDC will appear on the *dc*, and will be mirrored if *mirror* is True.
__init__(self, DC dc, bool mirror) -> MirrorDC
[ "__init__", "(", "self", "DC", "dc", "bool", "mirror", ")", "-", ">", "MirrorDC" ]
def __init__(self, *args, **kwargs): """ __init__(self, DC dc, bool mirror) -> MirrorDC Creates a mirrored DC associated with the real *dc*. Everything drawn on the wx.MirrorDC will appear on the *dc*, and will be mirrored if *mirror* is True. """ _gdi_.MirrorD...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "_gdi_", ".", "MirrorDC_swiginit", "(", "self", ",", "_gdi_", ".", "new_MirrorDC", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L5353-L5361
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_controls.py
python
RadioBox.GetItemToolTip
(*args, **kwargs)
return _controls_.RadioBox_GetItemToolTip(*args, **kwargs)
GetItemToolTip(self, unsigned int item) -> ToolTip
GetItemToolTip(self, unsigned int item) -> ToolTip
[ "GetItemToolTip", "(", "self", "unsigned", "int", "item", ")", "-", ">", "ToolTip" ]
def GetItemToolTip(*args, **kwargs): """GetItemToolTip(self, unsigned int item) -> ToolTip""" return _controls_.RadioBox_GetItemToolTip(*args, **kwargs)
[ "def", "GetItemToolTip", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_controls_", ".", "RadioBox_GetItemToolTip", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L2669-L2671
s9xie/hed
94fb22f10cbfec8d84fbc0642b224022014b6bd6
scripts/cpp_lint.py
python
FindPreviousMatchingAngleBracket
(clean_lines, linenum, init_prefix)
return False
Find the corresponding < that started a template. Args: clean_lines: A CleansedLines instance containing the file. linenum: Current line number. init_prefix: Part of the current line before the initial >. Returns: True if a matching bracket exists.
Find the corresponding < that started a template.
[ "Find", "the", "corresponding", "<", "that", "started", "a", "template", "." ]
def FindPreviousMatchingAngleBracket(clean_lines, linenum, init_prefix): """Find the corresponding < that started a template. Args: clean_lines: A CleansedLines instance containing the file. linenum: Current line number. init_prefix: Part of the current line before the initial >. Returns: True i...
[ "def", "FindPreviousMatchingAngleBracket", "(", "clean_lines", ",", "linenum", ",", "init_prefix", ")", ":", "line", "=", "init_prefix", "nesting_stack", "=", "[", "'>'", "]", "while", "True", ":", "# Find the previous operator", "match", "=", "Search", "(", "r'^(...
https://github.com/s9xie/hed/blob/94fb22f10cbfec8d84fbc0642b224022014b6bd6/scripts/cpp_lint.py#L2586-L2640
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/ops/array_ops.py
python
concat
(values, axis, name="concat")
return gen_array_ops._concat_v2(values=values, axis=axis, name=name)
Concatenates tensors along one dimension. Concatenates the list of tensors `values` along dimension `axis`. If `values[i].shape = [D0, D1, ... Daxis(i), ...Dn]`, the concatenated result has shape [D0, D1, ... Raxis, ...Dn] where Raxis = sum(Daxis(i)) That is, the data from the input tensors ...
Concatenates tensors along one dimension.
[ "Concatenates", "tensors", "along", "one", "dimension", "." ]
def concat(values, axis, name="concat"): """Concatenates tensors along one dimension. Concatenates the list of tensors `values` along dimension `axis`. If `values[i].shape = [D0, D1, ... Daxis(i), ...Dn]`, the concatenated result has shape [D0, D1, ... Raxis, ...Dn] where Raxis = sum(Daxis(i)...
[ "def", "concat", "(", "values", ",", "axis", ",", "name", "=", "\"concat\"", ")", ":", "if", "not", "isinstance", "(", "values", ",", "(", "list", ",", "tuple", ")", ")", ":", "values", "=", "[", "values", "]", "# TODO(mrry): Change to return values?", "...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/array_ops.py#L1036-L1105