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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
qboticslabs/mastering_ros | d83e78f30acc45b0f18522c1d5fae3a7f52974b9 | chapter_4_codes/seven_dof_arm_gazebo/scripts/pick_and_place_working_1.py | python | CokeCanPickAndPlace._publish_places | (self, places) | Publish places as poses, using a PoseArray message | Publish places as poses, using a PoseArray message | [
"Publish",
"places",
"as",
"poses",
"using",
"a",
"PoseArray",
"message"
] | def _publish_places(self, places):
"""
Publish places as poses, using a PoseArray message
"""
if self._places_pub.get_num_connections() > 0:
msg = PoseArray()
msg.header.frame_id = self._robot.get_planning_frame()
msg.header.stamp = rospy.Time.now()
... | [
"def",
"_publish_places",
"(",
"self",
",",
"places",
")",
":",
"if",
"self",
".",
"_places_pub",
".",
"get_num_connections",
"(",
")",
">",
"0",
":",
"msg",
"=",
"PoseArray",
"(",
")",
"msg",
".",
"header",
".",
"frame_id",
"=",
"self",
".",
"_robot",... | https://github.com/qboticslabs/mastering_ros/blob/d83e78f30acc45b0f18522c1d5fae3a7f52974b9/chapter_4_codes/seven_dof_arm_gazebo/scripts/pick_and_place_working_1.py#L368-L381 | ||
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/value_iteration.py | python | _get_future_states | (possibilities, state, reach=1.0) | Does a lookahead over chance nodes to all next states after (s,a).
Also works if there are no chance nodes (i.e. base case).
Arguments:
possibilities: an empty list, that will be filled with (str(next_state),
transition probability) pairs for all possible next states
state: the state following some... | Does a lookahead over chance nodes to all next states after (s,a). | [
"Does",
"a",
"lookahead",
"over",
"chance",
"nodes",
"to",
"all",
"next",
"states",
"after",
"(",
"s",
"a",
")",
"."
] | def _get_future_states(possibilities, state, reach=1.0):
"""Does a lookahead over chance nodes to all next states after (s,a).
Also works if there are no chance nodes (i.e. base case).
Arguments:
possibilities: an empty list, that will be filled with (str(next_state),
transition probability) pairs fo... | [
"def",
"_get_future_states",
"(",
"possibilities",
",",
"state",
",",
"reach",
"=",
"1.0",
")",
":",
"if",
"not",
"state",
".",
"is_chance_node",
"(",
")",
"or",
"state",
".",
"is_terminal",
"(",
")",
":",
"# Base case",
"possibilities",
".",
"append",
"("... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/value_iteration.py#L26-L45 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/array_ops.py | python | _slice_helper | (tensor, slice_spec, var=None) | Overload for Tensor.__getitem__.
This operation extracts the specified region from the tensor.
The notation is similar to NumPy with the restriction that
currently only support basic indexing. That means that
using a non-scalar tensor as input is not currently allowed.
Some useful examples:
```python
#... | Overload for Tensor.__getitem__. | [
"Overload",
"for",
"Tensor",
".",
"__getitem__",
"."
] | def _slice_helper(tensor, slice_spec, var=None):
"""Overload for Tensor.__getitem__.
This operation extracts the specified region from the tensor.
The notation is similar to NumPy with the restriction that
currently only support basic indexing. That means that
using a non-scalar tensor as input is not curren... | [
"def",
"_slice_helper",
"(",
"tensor",
",",
"slice_spec",
",",
"var",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"slice_spec",
",",
"bool",
")",
"or",
"(",
"isinstance",
"(",
"slice_spec",
",",
"ops",
".",
"Tensor",
")",
"and",
"slice_spec",
".",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/array_ops.py#L658-L802 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/decimal.py | python | Decimal.quantize | (self, exp, rounding=None, context=None, watchexp=True) | return ans | Quantize self so its exponent is the same as that of exp.
Similar to self._rescale(exp._exp) but with error checking. | Quantize self so its exponent is the same as that of exp. | [
"Quantize",
"self",
"so",
"its",
"exponent",
"is",
"the",
"same",
"as",
"that",
"of",
"exp",
"."
] | def quantize(self, exp, rounding=None, context=None, watchexp=True):
"""Quantize self so its exponent is the same as that of exp.
Similar to self._rescale(exp._exp) but with error checking.
"""
exp = _convert_other(exp, raiseit=True)
if context is None:
context = ge... | [
"def",
"quantize",
"(",
"self",
",",
"exp",
",",
"rounding",
"=",
"None",
",",
"context",
"=",
"None",
",",
"watchexp",
"=",
"True",
")",
":",
"exp",
"=",
"_convert_other",
"(",
"exp",
",",
"raiseit",
"=",
"True",
")",
"if",
"context",
"is",
"None",
... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/decimal.py#L2268-L2336 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/tornado/tornado-6/tornado/locale.py | python | load_gettext_translations | (directory: str, domain: str) | Loads translations from `gettext`'s locale tree
Locale tree is similar to system's ``/usr/share/locale``, like::
{directory}/{lang}/LC_MESSAGES/{domain}.mo
Three steps are required to have your app translated:
1. Generate POT translation file::
xgettext --language=Python --keyword=_:1,2... | Loads translations from `gettext`'s locale tree | [
"Loads",
"translations",
"from",
"gettext",
"s",
"locale",
"tree"
] | def load_gettext_translations(directory: str, domain: str) -> None:
"""Loads translations from `gettext`'s locale tree
Locale tree is similar to system's ``/usr/share/locale``, like::
{directory}/{lang}/LC_MESSAGES/{domain}.mo
Three steps are required to have your app translated:
1. Generate... | [
"def",
"load_gettext_translations",
"(",
"directory",
":",
"str",
",",
"domain",
":",
"str",
")",
"->",
"None",
":",
"global",
"_translations",
"global",
"_supported_locales",
"global",
"_use_gettext",
"_translations",
"=",
"{",
"}",
"for",
"lang",
"in",
"os",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/locale.py#L176-L216 | ||
Mahlet-Inc/hobbits | 071d7a542f1af0a7791bcaab17b08224df9ecd4e | src/hobbits-plugins/analyzers/KaitaiStruct/ksy_py/macos/mac_os_resource_snd.py | python | MacOsResourceSnd.midi_note_to_frequency | (self) | return self._m_midi_note_to_frequency if hasattr(self, '_m_midi_note_to_frequency') else None | Lookup table to convert a MIDI note into a frequency in Hz
The lookup table represents the formula (2 ** ((midi_note - 69) / 12)) * 440
.. seealso::
Source - https://en.wikipedia.org/wiki/MIDI_tuning_standard | Lookup table to convert a MIDI note into a frequency in Hz
The lookup table represents the formula (2 ** ((midi_note - 69) / 12)) * 440
.. seealso::
Source - https://en.wikipedia.org/wiki/MIDI_tuning_standard | [
"Lookup",
"table",
"to",
"convert",
"a",
"MIDI",
"note",
"into",
"a",
"frequency",
"in",
"Hz",
"The",
"lookup",
"table",
"represents",
"the",
"formula",
"(",
"2",
"**",
"((",
"midi_note",
"-",
"69",
")",
"/",
"12",
"))",
"*",
"440",
"..",
"seealso",
... | def midi_note_to_frequency(self):
"""Lookup table to convert a MIDI note into a frequency in Hz
The lookup table represents the formula (2 ** ((midi_note - 69) / 12)) * 440
.. seealso::
Source - https://en.wikipedia.org/wiki/MIDI_tuning_standard
"""
if hasattr... | [
"def",
"midi_note_to_frequency",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'_m_midi_note_to_frequency'",
")",
":",
"return",
"self",
".",
"_m_midi_note_to_frequency",
"if",
"hasattr",
"(",
"self",
",",
"'_m_midi_note_to_frequency'",
")",
"else",
"... | https://github.com/Mahlet-Inc/hobbits/blob/071d7a542f1af0a7791bcaab17b08224df9ecd4e/src/hobbits-plugins/analyzers/KaitaiStruct/ksy_py/macos/mac_os_resource_snd.py#L480-L491 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py | python | Scrollbar.__init__ | (self, master=None, cnf={}, **kw) | Construct a scrollbar widget with the parent MASTER.
Valid resource names: activebackground, activerelief,
background, bd, bg, borderwidth, command, cursor,
elementborderwidth, highlightbackground,
highlightcolor, highlightthickness, jump, orient,
relief, repeatdelay, repeatinte... | Construct a scrollbar widget with the parent MASTER. | [
"Construct",
"a",
"scrollbar",
"widget",
"with",
"the",
"parent",
"MASTER",
"."
] | def __init__(self, master=None, cnf={}, **kw):
"""Construct a scrollbar widget with the parent MASTER.
Valid resource names: activebackground, activerelief,
background, bd, bg, borderwidth, command, cursor,
elementborderwidth, highlightbackground,
highlightcolor, highlightthickn... | [
"def",
"__init__",
"(",
"self",
",",
"master",
"=",
"None",
",",
"cnf",
"=",
"{",
"}",
",",
"*",
"*",
"kw",
")",
":",
"Widget",
".",
"__init__",
"(",
"self",
",",
"master",
",",
"'scrollbar'",
",",
"cnf",
",",
"kw",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py#L3034-L3043 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/xrc.py | python | XmlDocument.SetRoot | (*args, **kwargs) | return _xrc.XmlDocument_SetRoot(*args, **kwargs) | SetRoot(self, XmlNode node) | SetRoot(self, XmlNode node) | [
"SetRoot",
"(",
"self",
"XmlNode",
"node",
")"
] | def SetRoot(*args, **kwargs):
"""SetRoot(self, XmlNode node)"""
return _xrc.XmlDocument_SetRoot(*args, **kwargs) | [
"def",
"SetRoot",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_xrc",
".",
"XmlDocument_SetRoot",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/xrc.py#L551-L553 | |
yrnkrn/zapcc | c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50 | tools/clang/tools/scan-view/share/ScanView.py | python | ScanViewRequestHandler.do_POST | (self) | Serve a POST request. | Serve a POST request. | [
"Serve",
"a",
"POST",
"request",
"."
] | def do_POST(self):
"""Serve a POST request."""
try:
length = self.headers.getheader('content-length') or "0"
try:
length = int(length)
except:
length = 0
content = self.rfile.read(length)
fields = parse_query(con... | [
"def",
"do_POST",
"(",
"self",
")",
":",
"try",
":",
"length",
"=",
"self",
".",
"headers",
".",
"getheader",
"(",
"'content-length'",
")",
"or",
"\"0\"",
"try",
":",
"length",
"=",
"int",
"(",
"length",
")",
"except",
":",
"length",
"=",
"0",
"conte... | https://github.com/yrnkrn/zapcc/blob/c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50/tools/clang/tools/scan-view/share/ScanView.py#L219-L234 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/archive_util.py | python | _get_gid | (name) | return None | Returns a gid, given a group name. | Returns a gid, given a group name. | [
"Returns",
"a",
"gid",
"given",
"a",
"group",
"name",
"."
] | def _get_gid(name):
"""Returns a gid, given a group name."""
if getgrnam is None or name is None:
return None
try:
result = getgrnam(name)
except KeyError:
result = None
if result is not None:
return result[2]
return None | [
"def",
"_get_gid",
"(",
"name",
")",
":",
"if",
"getgrnam",
"is",
"None",
"or",
"name",
"is",
"None",
":",
"return",
"None",
"try",
":",
"result",
"=",
"getgrnam",
"(",
"name",
")",
"except",
"KeyError",
":",
"result",
"=",
"None",
"if",
"result",
"i... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/archive_util.py#L31-L41 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/boost_1_66_0/tools/build/src/util/regex.py | python | transform | (list, pattern, indices = [1]) | return result | Matches all elements of 'list' agains the 'pattern'
and returns a list of the elements indicated by indices of
all successfull matches. If 'indices' is omitted returns
a list of first paranthethised groups of all successfull
matches. | Matches all elements of 'list' agains the 'pattern'
and returns a list of the elements indicated by indices of
all successfull matches. If 'indices' is omitted returns
a list of first paranthethised groups of all successfull
matches. | [
"Matches",
"all",
"elements",
"of",
"list",
"agains",
"the",
"pattern",
"and",
"returns",
"a",
"list",
"of",
"the",
"elements",
"indicated",
"by",
"indices",
"of",
"all",
"successfull",
"matches",
".",
"If",
"indices",
"is",
"omitted",
"returns",
"a",
"list"... | def transform (list, pattern, indices = [1]):
""" Matches all elements of 'list' agains the 'pattern'
and returns a list of the elements indicated by indices of
all successfull matches. If 'indices' is omitted returns
a list of first paranthethised groups of all successfull
matches.
... | [
"def",
"transform",
"(",
"list",
",",
"pattern",
",",
"indices",
"=",
"[",
"1",
"]",
")",
":",
"result",
"=",
"[",
"]",
"for",
"e",
"in",
"list",
":",
"m",
"=",
"re",
".",
"match",
"(",
"pattern",
",",
"e",
")",
"if",
"m",
":",
"for",
"i",
... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/boost_1_66_0/tools/build/src/util/regex.py#L11-L27 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/incubate/fleet/base/role_maker.py | python | MPIRoleMaker.get_local_ip | (self) | return self._ip | Return get local ip. | Return get local ip. | [
"Return",
"get",
"local",
"ip",
"."
] | def get_local_ip(self):
"""Return get local ip."""
import socket
self._ip = socket.gethostbyname(socket.gethostname())
return self._ip | [
"def",
"get_local_ip",
"(",
"self",
")",
":",
"import",
"socket",
"self",
".",
"_ip",
"=",
"socket",
".",
"gethostbyname",
"(",
"socket",
".",
"gethostname",
"(",
")",
")",
"return",
"self",
".",
"_ip"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/incubate/fleet/base/role_maker.py#L252-L256 | |
takemaru/graphillion | 51879f92bb96b53ef8f914ef37a05252ce383617 | graphillion/graphset.py | python | GraphSet.show_messages | (flag=True) | return _graphillion._show_messages(flag) | Enables/disables status messages.
Args:
flag: Optional. True or False. If True, status messages are
enabled. If False, they are disabled (initial setting).
Returns:
The setting before the method call. True (enabled) or
False (disabled). | Enables/disables status messages. | [
"Enables",
"/",
"disables",
"status",
"messages",
"."
] | def show_messages(flag=True):
"""Enables/disables status messages.
Args:
flag: Optional. True or False. If True, status messages are
enabled. If False, they are disabled (initial setting).
Returns:
The setting before the method call. True (enabled) or
... | [
"def",
"show_messages",
"(",
"flag",
"=",
"True",
")",
":",
"return",
"_graphillion",
".",
"_show_messages",
"(",
"flag",
")"
] | https://github.com/takemaru/graphillion/blob/51879f92bb96b53ef8f914ef37a05252ce383617/graphillion/graphset.py#L1976-L1987 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/estimator/inputs/pandas_io.py | python | pandas_input_fn | (x,
y=None,
batch_size=128,
num_epochs=1,
shuffle=None,
queue_capacity=1000,
num_threads=1,
target_column='target') | return input_fn | Returns input function that would feed Pandas DataFrame into the model.
Note: `y`'s index must match `x`'s index.
Args:
x: pandas `DataFrame` object.
y: pandas `Series` object. `None` if absent.
batch_size: int, size of batches to return.
num_epochs: int, number of epochs to iterate over data. If ... | Returns input function that would feed Pandas DataFrame into the model. | [
"Returns",
"input",
"function",
"that",
"would",
"feed",
"Pandas",
"DataFrame",
"into",
"the",
"model",
"."
] | def pandas_input_fn(x,
y=None,
batch_size=128,
num_epochs=1,
shuffle=None,
queue_capacity=1000,
num_threads=1,
target_column='target'):
"""Returns input function that would feed ... | [
"def",
"pandas_input_fn",
"(",
"x",
",",
"y",
"=",
"None",
",",
"batch_size",
"=",
"128",
",",
"num_epochs",
"=",
"1",
",",
"shuffle",
"=",
"None",
",",
"queue_capacity",
"=",
"1000",
",",
"num_threads",
"=",
"1",
",",
"target_column",
"=",
"'target'",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/estimator/inputs/pandas_io.py#L37-L121 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/imputil.py | python | ImportManager.uninstall | (self) | Restore the previous import mechanism. | Restore the previous import mechanism. | [
"Restore",
"the",
"previous",
"import",
"mechanism",
"."
] | def uninstall(self):
"Restore the previous import mechanism."
self.namespace['__import__'] = self.previous_importer | [
"def",
"uninstall",
"(",
"self",
")",
":",
"self",
".",
"namespace",
"[",
"'__import__'",
"]",
"=",
"self",
".",
"previous_importer"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/imputil.py#L49-L51 | ||
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | FWCore/ParameterSet/python/SequenceTypes.py | python | _ModuleSequenceType.copyAndExclude | (self,listOfModulesToExclude) | return result | Returns a copy of the sequence which excludes those module in 'listOfModulesToExclude | Returns a copy of the sequence which excludes those module in 'listOfModulesToExclude | [
"Returns",
"a",
"copy",
"of",
"the",
"sequence",
"which",
"excludes",
"those",
"module",
"in",
"listOfModulesToExclude"
] | def copyAndExclude(self,listOfModulesToExclude):
"""Returns a copy of the sequence which excludes those module in 'listOfModulesToExclude'"""
# You can exclude instances of these types EDProducer, EDFilter, OutputModule,
# EDAnalyzer, ESSource, ESProducer, Service, Sequence, SequencePlaceholder,... | [
"def",
"copyAndExclude",
"(",
"self",
",",
"listOfModulesToExclude",
")",
":",
"# You can exclude instances of these types EDProducer, EDFilter, OutputModule,",
"# EDAnalyzer, ESSource, ESProducer, Service, Sequence, SequencePlaceholder, Task,",
"# _SequenceNegation, and _SequenceIgnore.",
"# ... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/FWCore/ParameterSet/python/SequenceTypes.py#L406-L418 | |
grpc/grpc | 27bc6fe7797e43298dc931b96dc57322d0852a9f | src/python/grpcio/grpc/__init__.py | python | secure_channel | (target, credentials, options=None, compression=None) | return _channel.Channel(target, () if options is None else options,
credentials._credentials, compression) | Creates a secure Channel to a server.
The returned Channel is thread-safe.
Args:
target: The server address.
credentials: A ChannelCredentials instance.
options: An optional list of key-value pairs (:term:`channel_arguments`
in gRPC Core runtime) to configure the channel.
compr... | Creates a secure Channel to a server. | [
"Creates",
"a",
"secure",
"Channel",
"to",
"a",
"server",
"."
] | def secure_channel(target, credentials, options=None, compression=None):
"""Creates a secure Channel to a server.
The returned Channel is thread-safe.
Args:
target: The server address.
credentials: A ChannelCredentials instance.
options: An optional list of key-value pairs (:term:`channe... | [
"def",
"secure_channel",
"(",
"target",
",",
"credentials",
",",
"options",
"=",
"None",
",",
"compression",
"=",
"None",
")",
":",
"from",
"grpc",
"import",
"_channel",
"# pylint: disable=cyclic-import",
"from",
"grpc",
".",
"experimental",
"import",
"_insecure_c... | https://github.com/grpc/grpc/blob/27bc6fe7797e43298dc931b96dc57322d0852a9f/src/python/grpcio/grpc/__init__.py#L1982-L2005 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/nccl_ops.py | python | reduce_sum | (tensors) | return _apply_reduce('sum', tensors) | Returns a tensor with the reduce sum across `tensors`.
The computation is done with a reduce operation, so only one tensor is
returned.
Args:
tensors: The input tensors across which to sum; must be assigned
to GPU devices.
Returns:
A tensor containing the sum of the input tensors.
Raises:
... | Returns a tensor with the reduce sum across `tensors`. | [
"Returns",
"a",
"tensor",
"with",
"the",
"reduce",
"sum",
"across",
"tensors",
"."
] | def reduce_sum(tensors):
"""Returns a tensor with the reduce sum across `tensors`.
The computation is done with a reduce operation, so only one tensor is
returned.
Args:
tensors: The input tensors across which to sum; must be assigned
to GPU devices.
Returns:
A tensor containing the sum of th... | [
"def",
"reduce_sum",
"(",
"tensors",
")",
":",
"return",
"_apply_reduce",
"(",
"'sum'",
",",
"tensors",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/nccl_ops.py#L127-L143 | |
RoboJackets/robocup-software | bce13ce53ddb2ecb9696266d980722c34617dc15 | rj_gameplay/stp/rc.py | python | Field.center_radius_m | (self) | return self.__center_radius_m | :return: returns the radius of the center of the field | :return: returns the radius of the center of the field | [
":",
"return",
":",
"returns",
"the",
"radius",
"of",
"the",
"center",
"of",
"the",
"field"
] | def center_radius_m(self) -> float:
"""
:return: returns the radius of the center of the field
"""
return self.__center_radius_m | [
"def",
"center_radius_m",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"__center_radius_m"
] | https://github.com/RoboJackets/robocup-software/blob/bce13ce53ddb2ecb9696266d980722c34617dc15/rj_gameplay/stp/rc.py#L406-L410 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/eclib/ctrlbox.py | python | SegmentBar.OnMouseMove | (self, evt) | Handle when the mouse moves over the bar | Handle when the mouse moves over the bar | [
"Handle",
"when",
"the",
"mouse",
"moves",
"over",
"the",
"bar"
] | def OnMouseMove(self, evt):
"""Handle when the mouse moves over the bar"""
epos = evt.GetPosition()
where, index = self.HitTest(epos)
if index == -1:
return
if not self.SegmentHasCloseButton(index):
self._RestartTimer()
return
# Update... | [
"def",
"OnMouseMove",
"(",
"self",
",",
"evt",
")",
":",
"epos",
"=",
"evt",
".",
"GetPosition",
"(",
")",
"where",
",",
"index",
"=",
"self",
".",
"HitTest",
"(",
"epos",
")",
"if",
"index",
"==",
"-",
"1",
":",
"return",
"if",
"not",
"self",
".... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/eclib/ctrlbox.py#L1017-L1058 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/pystache/pystache/renderer.py | python | Renderer._make_load_partial | (self) | return load_partial | Return a function that loads a partial by name. | Return a function that loads a partial by name. | [
"Return",
"a",
"function",
"that",
"loads",
"a",
"partial",
"by",
"name",
"."
] | def _make_load_partial(self):
"""
Return a function that loads a partial by name.
"""
if self.partials is None:
return self._make_load_template()
# Otherwise, create a function from the custom partial loader.
partials = self.partials
def load_partia... | [
"def",
"_make_load_partial",
"(",
"self",
")",
":",
"if",
"self",
".",
"partials",
"is",
"None",
":",
"return",
"self",
".",
"_make_load_template",
"(",
")",
"# Otherwise, create a function from the custom partial loader.",
"partials",
"=",
"self",
".",
"partials",
... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/pystache/pystache/renderer.py#L247-L271 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TMOut.GetSIn | (self, *args) | return _snap.TMOut_GetSIn(self, *args) | GetSIn(TMOut self, bool const & IsCut=True, int const & CutBfL=-1) -> PSIn
Parameters:
IsCut: bool const &
CutBfL: int const &
GetSIn(TMOut self, bool const & IsCut=True) -> PSIn
Parameters:
IsCut: bool const &
GetSIn(TMOut self) -> PSIn
P... | GetSIn(TMOut self, bool const & IsCut=True, int const & CutBfL=-1) -> PSIn | [
"GetSIn",
"(",
"TMOut",
"self",
"bool",
"const",
"&",
"IsCut",
"=",
"True",
"int",
"const",
"&",
"CutBfL",
"=",
"-",
"1",
")",
"-",
">",
"PSIn"
] | def GetSIn(self, *args):
"""
GetSIn(TMOut self, bool const & IsCut=True, int const & CutBfL=-1) -> PSIn
Parameters:
IsCut: bool const &
CutBfL: int const &
GetSIn(TMOut self, bool const & IsCut=True) -> PSIn
Parameters:
IsCut: bool const &
... | [
"def",
"GetSIn",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TMOut_GetSIn",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L3068-L3087 | |
facebook/ThreatExchange | 31914a51820c73c8a0daffe62ccca29a6e3d359e | python-threatexchange/threatexchange/hashing/pdq_hasher.py | python | pdq_from_bytes | (file_bytes: bytes) | return _pdq_from_numpy_array(np_array) | For the bytestream from an image file, compute PDQ Hash and quality. | For the bytestream from an image file, compute PDQ Hash and quality. | [
"For",
"the",
"bytestream",
"from",
"an",
"image",
"file",
"compute",
"PDQ",
"Hash",
"and",
"quality",
"."
] | def pdq_from_bytes(file_bytes: bytes) -> PDQOutput:
"""
For the bytestream from an image file, compute PDQ Hash and quality.
"""
np_array = _check_dimension_and_expand_if_needed(
np.asarray(Image.open(io.BytesIO(file_bytes)))
)
return _pdq_from_numpy_array(np_array) | [
"def",
"pdq_from_bytes",
"(",
"file_bytes",
":",
"bytes",
")",
"->",
"PDQOutput",
":",
"np_array",
"=",
"_check_dimension_and_expand_if_needed",
"(",
"np",
".",
"asarray",
"(",
"Image",
".",
"open",
"(",
"io",
".",
"BytesIO",
"(",
"file_bytes",
")",
")",
")"... | https://github.com/facebook/ThreatExchange/blob/31914a51820c73c8a0daffe62ccca29a6e3d359e/python-threatexchange/threatexchange/hashing/pdq_hasher.py#L27-L34 | |
ROCmSoftwarePlatform/hipCaffe | 4ec5d482515cce532348553b6db6d00d015675d5 | scripts/cpp_lint.py | python | _CppLintState.PrintErrorCounts | (self) | Print a summary of errors by category, and the total. | Print a summary of errors by category, and the total. | [
"Print",
"a",
"summary",
"of",
"errors",
"by",
"category",
"and",
"the",
"total",
"."
] | def PrintErrorCounts(self):
"""Print a summary of errors by category, and the total."""
for category, count in self.errors_by_category.iteritems():
sys.stderr.write('Category \'%s\' errors found: %d\n' %
(category, count))
sys.stderr.write('Total errors found: %d\n' % self.error... | [
"def",
"PrintErrorCounts",
"(",
"self",
")",
":",
"for",
"category",
",",
"count",
"in",
"self",
".",
"errors_by_category",
".",
"iteritems",
"(",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"'Category \\'%s\\' errors found: %d\\n'",
"%",
"(",
"category... | https://github.com/ROCmSoftwarePlatform/hipCaffe/blob/4ec5d482515cce532348553b6db6d00d015675d5/scripts/cpp_lint.py#L757-L762 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/distutils/command/build_ext.py | python | build_ext.find_swig | (self) | Return the name of the SWIG executable. On Unix, this is
just "swig" -- it should be in the PATH. Tries a bit harder on
Windows. | Return the name of the SWIG executable. On Unix, this is
just "swig" -- it should be in the PATH. Tries a bit harder on
Windows. | [
"Return",
"the",
"name",
"of",
"the",
"SWIG",
"executable",
".",
"On",
"Unix",
"this",
"is",
"just",
"swig",
"--",
"it",
"should",
"be",
"in",
"the",
"PATH",
".",
"Tries",
"a",
"bit",
"harder",
"on",
"Windows",
"."
] | def find_swig (self):
"""Return the name of the SWIG executable. On Unix, this is
just "swig" -- it should be in the PATH. Tries a bit harder on
Windows.
"""
if os.name == "posix":
return "swig"
elif os.name == "nt":
# Look for SWIG in its stan... | [
"def",
"find_swig",
"(",
"self",
")",
":",
"if",
"os",
".",
"name",
"==",
"\"posix\"",
":",
"return",
"\"swig\"",
"elif",
"os",
".",
"name",
"==",
"\"nt\"",
":",
"# Look for SWIG in its standard installation directory on",
"# Windows (or so I presume!). If we find it t... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/distutils/command/build_ext.py#L594-L621 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/command/sdist.py | python | sdist._remove_os_link | () | In a context, remove and restore os.link if it exists | In a context, remove and restore os.link if it exists | [
"In",
"a",
"context",
"remove",
"and",
"restore",
"os",
".",
"link",
"if",
"it",
"exists"
] | def _remove_os_link():
"""
In a context, remove and restore os.link if it exists
"""
class NoValue:
pass
orig_val = getattr(os, 'link', NoValue)
try:
del os.link
except Exception:
pass
try:
yield
fi... | [
"def",
"_remove_os_link",
"(",
")",
":",
"class",
"NoValue",
":",
"pass",
"orig_val",
"=",
"getattr",
"(",
"os",
",",
"'link'",
",",
"NoValue",
")",
"try",
":",
"del",
"os",
".",
"link",
"except",
"Exception",
":",
"pass",
"try",
":",
"yield",
"finally... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/command/sdist.py#L82-L99 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/training/saver.py | python | Saver.save | (self,
sess,
save_path,
global_step=None,
latest_filename=None,
meta_graph_suffix="meta",
write_meta_graph=True,
write_state=True) | Saves variables.
This method runs the ops added by the constructor for saving variables.
It requires a session in which the graph was launched. The variables to
save must also have been initialized.
The method returns the path of the newly created checkpoint file. This
path can be passed directl... | Saves variables. | [
"Saves",
"variables",
"."
] | def save(self,
sess,
save_path,
global_step=None,
latest_filename=None,
meta_graph_suffix="meta",
write_meta_graph=True,
write_state=True):
"""Saves variables.
This method runs the ops added by the constructor for saving variables.
... | [
"def",
"save",
"(",
"self",
",",
"sess",
",",
"save_path",
",",
"global_step",
"=",
"None",
",",
"latest_filename",
"=",
"None",
",",
"meta_graph_suffix",
"=",
"\"meta\"",
",",
"write_meta_graph",
"=",
"True",
",",
"write_state",
"=",
"True",
")",
":",
"if... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/training/saver.py#L1387-L1501 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | dom/bindings/parser/WebIDL.py | python | Parser.p_ExtendedAttributeNoArgs | (self, p) | ExtendedAttributeNoArgs : IDENTIFIER | ExtendedAttributeNoArgs : IDENTIFIER | [
"ExtendedAttributeNoArgs",
":",
"IDENTIFIER"
] | def p_ExtendedAttributeNoArgs(self, p):
"""
ExtendedAttributeNoArgs : IDENTIFIER
"""
p[0] = (p[1],) | [
"def",
"p_ExtendedAttributeNoArgs",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"(",
"p",
"[",
"1",
"]",
",",
")"
] | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/dom/bindings/parser/WebIDL.py#L5511-L5515 | ||
synfig/synfig | a5ec91db5b751dc12e4400ccfb5c063fd6d2d928 | synfig-studio/plugins/lottie-exporter/canvas.py | python | calc_time | (root, lottie, which) | Converts the starting time and ending time to lottie format
Args:
root (lxml.etree._Element) : Synfig format animation file
lottie (dict) : Lottie format animation file
which (str) : Differentiates between in time and out time
Returns:
(None) | Converts the starting time and ending time to lottie format | [
"Converts",
"the",
"starting",
"time",
"and",
"ending",
"time",
"to",
"lottie",
"format"
] | def calc_time(root, lottie, which):
"""
Converts the starting time and ending time to lottie format
Args:
root (lxml.etree._Element) : Synfig format animation file
lottie (dict) : Lottie format animation file
which (str) : Differentiates between in ... | [
"def",
"calc_time",
"(",
"root",
",",
"lottie",
",",
"which",
")",
":",
"if",
"which",
"==",
"\"ip\"",
":",
"phase",
"=",
"\"begin-time\"",
"elif",
"which",
"==",
"\"op\"",
":",
"phase",
"=",
"\"end-time\"",
"time",
"=",
"root",
".",
"attrib",
"[",
"ph... | https://github.com/synfig/synfig/blob/a5ec91db5b751dc12e4400ccfb5c063fd6d2d928/synfig-studio/plugins/lottie-exporter/canvas.py#L38-L59 | ||
ros-planning/moveit | ee48dc5cedc981d0869352aa3db0b41469c2735c | moveit_commander/src/moveit_commander/planning_scene_interface.py | python | PlanningSceneInterface.remove_attached_object | (self, link=None, name=None) | Remove an attached object from the robot, or all objects attached to the link if no name is provided,
or all attached objects in the scene if neither link nor name are provided.
Removed attached objects remain in the scene as world objects.
Call remove_world_object afterwards to remove them fro... | Remove an attached object from the robot, or all objects attached to the link if no name is provided,
or all attached objects in the scene if neither link nor name are provided. | [
"Remove",
"an",
"attached",
"object",
"from",
"the",
"robot",
"or",
"all",
"objects",
"attached",
"to",
"the",
"link",
"if",
"no",
"name",
"is",
"provided",
"or",
"all",
"attached",
"objects",
"in",
"the",
"scene",
"if",
"neither",
"link",
"nor",
"name",
... | def remove_attached_object(self, link=None, name=None):
"""
Remove an attached object from the robot, or all objects attached to the link if no name is provided,
or all attached objects in the scene if neither link nor name are provided.
Removed attached objects remain in the scene as w... | [
"def",
"remove_attached_object",
"(",
"self",
",",
"link",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"aco",
"=",
"AttachedCollisionObject",
"(",
")",
"aco",
".",
"object",
".",
"operation",
"=",
"CollisionObject",
".",
"REMOVE",
"if",
"link",
"is",
... | https://github.com/ros-planning/moveit/blob/ee48dc5cedc981d0869352aa3db0b41469c2735c/moveit_commander/src/moveit_commander/planning_scene_interface.py#L178-L192 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/keras/python/keras/utils/layer_utils.py | python | convert_all_kernels_in_model | (model) | Converts all convolution kernels in a model from Theano to TensorFlow.
Also works from TensorFlow to Theano.
Arguments:
model: target model for the conversion. | Converts all convolution kernels in a model from Theano to TensorFlow. | [
"Converts",
"all",
"convolution",
"kernels",
"in",
"a",
"model",
"from",
"Theano",
"to",
"TensorFlow",
"."
] | def convert_all_kernels_in_model(model):
"""Converts all convolution kernels in a model from Theano to TensorFlow.
Also works from TensorFlow to Theano.
Arguments:
model: target model for the conversion.
"""
# Note: SeparableConvolution not included
# since only supported by TF.
conv_classes = {
... | [
"def",
"convert_all_kernels_in_model",
"(",
"model",
")",
":",
"# Note: SeparableConvolution not included",
"# since only supported by TF.",
"conv_classes",
"=",
"{",
"'Conv1D'",
",",
"'Conv2D'",
",",
"'Conv3D'",
",",
"'Conv2DTranspose'",
",",
"}",
"to_assign",
"=",
"[",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/keras/python/keras/utils/layer_utils.py#L158-L180 | ||
cztomczak/cefpython | 5679f28cec18a57a56e298da2927aac8d8f83ad6 | tools/build.py | python | compile_cpp_projects_windows_DEPRECATED | () | DEPRECATED. Not used currently.
Build C++ projects using .vcproj files. | DEPRECATED. Not used currently.
Build C++ projects using .vcproj files. | [
"DEPRECATED",
".",
"Not",
"used",
"currently",
".",
"Build",
"C",
"++",
"projects",
"using",
".",
"vcproj",
"files",
"."
] | def compile_cpp_projects_windows_DEPRECATED():
"""DEPRECATED. Not used currently.
Build C++ projects using .vcproj files."""
# TODO: Remove code after setuptools compilation was tested for some time
print("[build.py] Compile C++ projects")
print("[build.py] ~~ Build CLIENT_HANDLER vcproj")
vc... | [
"def",
"compile_cpp_projects_windows_DEPRECATED",
"(",
")",
":",
"# TODO: Remove code after setuptools compilation was tested for some time",
"print",
"(",
"\"[build.py] Compile C++ projects\"",
")",
"print",
"(",
"\"[build.py] ~~ Build CLIENT_HANDLER vcproj\"",
")",
"vcproj",
"=",
"... | https://github.com/cztomczak/cefpython/blob/5679f28cec18a57a56e298da2927aac8d8f83ad6/tools/build.py#L415-L458 | ||
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | openmp/runtime/tools/summarizeStats.py | python | drawChart | (data, kind, filebase) | Draw a summary bar chart for the requested data frame into the specified file | Draw a summary bar chart for the requested data frame into the specified file | [
"Draw",
"a",
"summary",
"bar",
"chart",
"for",
"the",
"requested",
"data",
"frame",
"into",
"the",
"specified",
"file"
] | def drawChart(data, kind, filebase):
"""Draw a summary bar chart for the requested data frame into the specified file"""
data["Mean"].plot(kind="bar", logy=True, grid=True, colormap="GnBu",
yerr=data["SD"], ecolor="black")
plt.xlabel("OMP Constructs")
plt.ylabel(statProperties[kind... | [
"def",
"drawChart",
"(",
"data",
",",
"kind",
",",
"filebase",
")",
":",
"data",
"[",
"\"Mean\"",
"]",
".",
"plot",
"(",
"kind",
"=",
"\"bar\"",
",",
"logy",
"=",
"True",
",",
"grid",
"=",
"True",
",",
"colormap",
"=",
"\"GnBu\"",
",",
"yerr",
"=",... | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/openmp/runtime/tools/summarizeStats.py#L162-L170 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Source/ThirdParty/CEF3/cef_source/tools/cefbuilds/cef_html_builder.py | python | cef_html_builder.generate | (self, json_builder) | return root_str | Generate HTML output based on the contents of |json_builder|. | Generate HTML output based on the contents of |json_builder|. | [
"Generate",
"HTML",
"output",
"based",
"on",
"the",
"contents",
"of",
"|json_builder|",
"."
] | def generate(self, json_builder):
""" Generate HTML output based on the contents of |json_builder|. """
if not isinstance(json_builder, cef_json_builder):
raise Exception('Invalid argument')
# Substitution values are augmented at each nesting level.
subs = {
'year': '2016',
'branding'... | [
"def",
"generate",
"(",
"self",
",",
"json_builder",
")",
":",
"if",
"not",
"isinstance",
"(",
"json_builder",
",",
"cef_json_builder",
")",
":",
"raise",
"Exception",
"(",
"'Invalid argument'",
")",
"# Substitution values are augmented at each nesting level.",
"subs",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Source/ThirdParty/CEF3/cef_source/tools/cefbuilds/cef_html_builder.py#L185-L259 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/LoadAndMerge.py | python | LoadAndMerge._load | (self, run, runnumber) | Loads the single run using the specific loader
@param run : the full file path
@param runnumber : the run number | Loads the single run using the specific loader | [
"Loads",
"the",
"single",
"run",
"using",
"the",
"specific",
"loader"
] | def _load(self, run, runnumber):
"""
Loads the single run using the specific loader
@param run : the full file path
@param runnumber : the run number
"""
self._progress.report('Loading '+runnumber)
alg = self._create_fresh_loader()
alg.setPrope... | [
"def",
"_load",
"(",
"self",
",",
"run",
",",
"runnumber",
")",
":",
"self",
".",
"_progress",
".",
"report",
"(",
"'Loading '",
"+",
"runnumber",
")",
"alg",
"=",
"self",
".",
"_create_fresh_loader",
"(",
")",
"alg",
".",
"setPropertyValue",
"(",
"'File... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/LoadAndMerge.py#L60-L70 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/aui.py | python | PyAuiTabArt.GetMeasuringFont | (*args, **kwargs) | return _aui.PyAuiTabArt_GetMeasuringFont(*args, **kwargs) | GetMeasuringFont(self) -> Font | GetMeasuringFont(self) -> Font | [
"GetMeasuringFont",
"(",
"self",
")",
"-",
">",
"Font"
] | def GetMeasuringFont(*args, **kwargs):
"""GetMeasuringFont(self) -> Font"""
return _aui.PyAuiTabArt_GetMeasuringFont(*args, **kwargs) | [
"def",
"GetMeasuringFont",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"PyAuiTabArt_GetMeasuringFont",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/aui.py#L2443-L2445 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/contrib/onnx/onnx2mx/_op_translations.py | python | sigmoid | (attrs, inputs, proto_obj) | return 'sigmoid', attrs, inputs | Computes elementwise sigmoid of the input array | Computes elementwise sigmoid of the input array | [
"Computes",
"elementwise",
"sigmoid",
"of",
"the",
"input",
"array"
] | def sigmoid(attrs, inputs, proto_obj):
"""Computes elementwise sigmoid of the input array"""
return 'sigmoid', attrs, inputs | [
"def",
"sigmoid",
"(",
"attrs",
",",
"inputs",
",",
"proto_obj",
")",
":",
"return",
"'sigmoid'",
",",
"attrs",
",",
"inputs"
] | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/contrib/onnx/onnx2mx/_op_translations.py#L229-L231 | |
kripken/BananaBread | 455191d2e289f6d67f22c9ec44477ff0814d9aa3 | tools/websockify/websockify/websocket.py | python | WebSocketServer.encode_hybi | (buf, opcode, base64=False) | return header + buf, len(header), 0 | Encode a HyBi style WebSocket frame.
Optional opcode:
0x0 - continuation
0x1 - text frame (base64 encode buf)
0x2 - binary frame (use raw buf)
0x8 - connection close
0x9 - ping
0xA - pong | Encode a HyBi style WebSocket frame.
Optional opcode:
0x0 - continuation
0x1 - text frame (base64 encode buf)
0x2 - binary frame (use raw buf)
0x8 - connection close
0x9 - ping
0xA - pong | [
"Encode",
"a",
"HyBi",
"style",
"WebSocket",
"frame",
".",
"Optional",
"opcode",
":",
"0x0",
"-",
"continuation",
"0x1",
"-",
"text",
"frame",
"(",
"base64",
"encode",
"buf",
")",
"0x2",
"-",
"binary",
"frame",
"(",
"use",
"raw",
"buf",
")",
"0x8",
"-"... | def encode_hybi(buf, opcode, base64=False):
""" Encode a HyBi style WebSocket frame.
Optional opcode:
0x0 - continuation
0x1 - text frame (base64 encode buf)
0x2 - binary frame (use raw buf)
0x8 - connection close
0x9 - ping
0xA - p... | [
"def",
"encode_hybi",
"(",
"buf",
",",
"opcode",
",",
"base64",
"=",
"False",
")",
":",
"if",
"base64",
":",
"buf",
"=",
"b64encode",
"(",
"buf",
")",
"b1",
"=",
"0x80",
"|",
"(",
"opcode",
"&",
"0x0f",
")",
"# FIN + opcode",
"payload_len",
"=",
"len... | https://github.com/kripken/BananaBread/blob/455191d2e289f6d67f22c9ec44477ff0814d9aa3/tools/websockify/websockify/websocket.py#L276-L300 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/distributions/util.py | python | gen_new_seed | (seed, salt) | return int(hashlib.md5(string).hexdigest()[:8], 16) & 0x7FFFFFFF | Generate a new seed, from the given seed and salt. | Generate a new seed, from the given seed and salt. | [
"Generate",
"a",
"new",
"seed",
"from",
"the",
"given",
"seed",
"and",
"salt",
"."
] | def gen_new_seed(seed, salt):
"""Generate a new seed, from the given seed and salt."""
if seed is None:
return None
string = (str(seed) + salt).encode("utf-8")
return int(hashlib.md5(string).hexdigest()[:8], 16) & 0x7FFFFFFF | [
"def",
"gen_new_seed",
"(",
"seed",
",",
"salt",
")",
":",
"if",
"seed",
"is",
"None",
":",
"return",
"None",
"string",
"=",
"(",
"str",
"(",
"seed",
")",
"+",
"salt",
")",
".",
"encode",
"(",
"\"utf-8\"",
")",
"return",
"int",
"(",
"hashlib",
".",... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/distributions/util.py#L787-L792 | |
hunterlew/mstar_deeplearning_project | 3761624dcbd7d44af257200542d13d1444dc634a | classification/caffe/python/caffe/io.py | python | Transformer.set_input_scale | (self, in_, scale) | Set the scale of preprocessed inputs s.t. the blob = blob * scale.
N.B. input_scale is done AFTER mean subtraction and other preprocessing
while raw_scale is done BEFORE.
Parameters
----------
in_ : which input to assign this scale factor
scale : scale coefficient | Set the scale of preprocessed inputs s.t. the blob = blob * scale.
N.B. input_scale is done AFTER mean subtraction and other preprocessing
while raw_scale is done BEFORE. | [
"Set",
"the",
"scale",
"of",
"preprocessed",
"inputs",
"s",
".",
"t",
".",
"the",
"blob",
"=",
"blob",
"*",
"scale",
".",
"N",
".",
"B",
".",
"input_scale",
"is",
"done",
"AFTER",
"mean",
"subtraction",
"and",
"other",
"preprocessing",
"while",
"raw_scal... | def set_input_scale(self, in_, scale):
"""
Set the scale of preprocessed inputs s.t. the blob = blob * scale.
N.B. input_scale is done AFTER mean subtraction and other preprocessing
while raw_scale is done BEFORE.
Parameters
----------
in_ : which input to assign... | [
"def",
"set_input_scale",
"(",
"self",
",",
"in_",
",",
"scale",
")",
":",
"self",
".",
"__check_input",
"(",
"in_",
")",
"self",
".",
"input_scale",
"[",
"in_",
"]",
"=",
"scale"
] | https://github.com/hunterlew/mstar_deeplearning_project/blob/3761624dcbd7d44af257200542d13d1444dc634a/classification/caffe/python/caffe/io.py#L262-L274 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/cloudformation/connection.py | python | CloudFormationConnection.set_stack_policy | (self, stack_name_or_id, stack_policy_body=None,
stack_policy_url=None) | return response['SetStackPolicyResponse'] | Sets a stack policy for a specified stack.
:type stack_name_or_id: string
:param stack_name_or_id: The name or stack ID that you want to
associate a policy with.
:type stack_policy_body: string
:param stack_policy_body: Structure containing the stack policy body.
... | Sets a stack policy for a specified stack. | [
"Sets",
"a",
"stack",
"policy",
"for",
"a",
"specified",
"stack",
"."
] | def set_stack_policy(self, stack_name_or_id, stack_policy_body=None,
stack_policy_url=None):
"""
Sets a stack policy for a specified stack.
:type stack_name_or_id: string
:param stack_name_or_id: The name or stack ID that you want to
associate a poli... | [
"def",
"set_stack_policy",
"(",
"self",
",",
"stack_name_or_id",
",",
"stack_policy_body",
"=",
"None",
",",
"stack_policy_url",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'ContentType'",
":",
"\"JSON\"",
",",
"'StackName'",
":",
"stack_name_or_id",
",",
"}",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/cloudformation/connection.py#L891-L922 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/ops/variables.py | python | Variable.ref | (self) | return self._variable | Returns a reference to this variable.
You usually do not need to call this method as all ops that need a reference
to the variable call it automatically.
Returns is a `Tensor` which holds a reference to the variable. You can
assign a new value to the variable by passing the tensor to an assign op.
... | Returns a reference to this variable. | [
"Returns",
"a",
"reference",
"to",
"this",
"variable",
"."
] | def ref(self):
"""Returns a reference to this variable.
You usually do not need to call this method as all ops that need a reference
to the variable call it automatically.
Returns is a `Tensor` which holds a reference to the variable. You can
assign a new value to the variable by passing the tens... | [
"def",
"ref",
"(",
"self",
")",
":",
"return",
"self",
".",
"_variable"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/variables.py#L395-L409 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/indexes/base.py | python | Index.join | (
self,
other,
how: str_t = "left",
level=None,
return_indexers: bool = False,
sort: bool = False,
) | return join_index, lindexer, rindexer | Compute join_index and indexers to conform data
structures to the new index.
Parameters
----------
other : Index
how : {'left', 'right', 'inner', 'outer'}
level : int or level name, default None
return_indexers : bool, default False
sort : bool, default F... | Compute join_index and indexers to conform data
structures to the new index. | [
"Compute",
"join_index",
"and",
"indexers",
"to",
"conform",
"data",
"structures",
"to",
"the",
"new",
"index",
"."
] | def join(
self,
other,
how: str_t = "left",
level=None,
return_indexers: bool = False,
sort: bool = False,
):
"""
Compute join_index and indexers to conform data
structures to the new index.
Parameters
----------
other ... | [
"def",
"join",
"(",
"self",
",",
"other",
",",
"how",
":",
"str_t",
"=",
"\"left\"",
",",
"level",
"=",
"None",
",",
"return_indexers",
":",
"bool",
"=",
"False",
",",
"sort",
":",
"bool",
"=",
"False",
",",
")",
":",
"other",
"=",
"ensure_index",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/indexes/base.py#L3919-L4037 | |
NASA-Tensegrity-Robotics-Toolkit/NTRTsim | 0443cbd542e12e23c04adf79ea0d8d003c428baa | scripts/learning/src/interfaces/ntrt_job.py | python | NTRTJob.cleanup | (self) | You can override this if you want and handle cleaning up any output files from this job. Not really necessary
though, I can take care of that myself later. | You can override this if you want and handle cleaning up any output files from this job. Not really necessary
though, I can take care of that myself later. | [
"You",
"can",
"override",
"this",
"if",
"you",
"want",
"and",
"handle",
"cleaning",
"up",
"any",
"output",
"files",
"from",
"this",
"job",
".",
"Not",
"really",
"necessary",
"though",
"I",
"can",
"take",
"care",
"of",
"that",
"myself",
"later",
"."
] | def cleanup(self):
"""
You can override this if you want and handle cleaning up any output files from this job. Not really necessary
though, I can take care of that myself later.
"""
pass | [
"def",
"cleanup",
"(",
"self",
")",
":",
"pass"
] | https://github.com/NASA-Tensegrity-Robotics-Toolkit/NTRTsim/blob/0443cbd542e12e23c04adf79ea0d8d003c428baa/scripts/learning/src/interfaces/ntrt_job.py#L35-L40 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | base/android/jni_generator/jni_generator.py | python | MangleCalledByNatives | (called_by_natives) | return called_by_natives | Mangles all the overloads from the call_by_natives list. | Mangles all the overloads from the call_by_natives list. | [
"Mangles",
"all",
"the",
"overloads",
"from",
"the",
"call_by_natives",
"list",
"."
] | def MangleCalledByNatives(called_by_natives):
"""Mangles all the overloads from the call_by_natives list."""
method_counts = collections.defaultdict(
lambda: collections.defaultdict(lambda: 0))
for called_by_native in called_by_natives:
java_class_name = called_by_native.java_class_name
name = calle... | [
"def",
"MangleCalledByNatives",
"(",
"called_by_natives",
")",
":",
"method_counts",
"=",
"collections",
".",
"defaultdict",
"(",
"lambda",
":",
"collections",
".",
"defaultdict",
"(",
"lambda",
":",
"0",
")",
")",
"for",
"called_by_native",
"in",
"called_by_nativ... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/base/android/jni_generator/jni_generator.py#L314-L332 | |
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/lacros/lacros_resource_sizes.py | python | _run_resource_sizes | (args) | Main flow to extract and output size data. | Main flow to extract and output size data. | [
"Main",
"flow",
"to",
"extract",
"and",
"output",
"size",
"data",
"."
] | def _run_resource_sizes(args):
"""Main flow to extract and output size data."""
chartjson = _BASE_CHART.copy()
report_func = perf_tests_results_helper.ReportPerfResult
total_sizes = collections.Counter()
def report_sizes(sizes, title, track_stripped, track_compressed):
report_func(chart_data=chartjson,
... | [
"def",
"_run_resource_sizes",
"(",
"args",
")",
":",
"chartjson",
"=",
"_BASE_CHART",
".",
"copy",
"(",
")",
"report_func",
"=",
"perf_tests_results_helper",
".",
"ReportPerfResult",
"total_sizes",
"=",
"collections",
".",
"Counter",
"(",
")",
"def",
"report_sizes... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/lacros/lacros_resource_sizes.py#L247-L295 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/optimize/_tstutils.py | python | f1 | (x) | return x * (x - 1.) | r"""f1 is a quadratic with roots at 0 and 1 | r"""f1 is a quadratic with roots at 0 and 1 | [
"r",
"f1",
"is",
"a",
"quadratic",
"with",
"roots",
"at",
"0",
"and",
"1"
] | def f1(x):
r"""f1 is a quadratic with roots at 0 and 1"""
return x * (x - 1.) | [
"def",
"f1",
"(",
"x",
")",
":",
"return",
"x",
"*",
"(",
"x",
"-",
"1.",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/optimize/_tstutils.py#L63-L65 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/robotsim.py | python | Appearance.setSilhouette | (self, radius: float, r: float=0, g: float=0, b: float=0, a: float=1) | return _robotsim.Appearance_setSilhouette(self, radius, r, g, b, a) | r"""
For meshes sets a silhouette radius and color. Set the radius to 0 to disable
silhouette drawing.
Args:
radius (float)
r (float, optional): default value 0
g (float, optional): default value 0
b (float, optional): default value 0
... | r"""
For meshes sets a silhouette radius and color. Set the radius to 0 to disable
silhouette drawing. | [
"r",
"For",
"meshes",
"sets",
"a",
"silhouette",
"radius",
"and",
"color",
".",
"Set",
"the",
"radius",
"to",
"0",
"to",
"disable",
"silhouette",
"drawing",
"."
] | def setSilhouette(self, radius: float, r: float=0, g: float=0, b: float=0, a: float=1) ->None:
r"""
For meshes sets a silhouette radius and color. Set the radius to 0 to disable
silhouette drawing.
Args:
radius (float)
r (float, optional): default value 0
... | [
"def",
"setSilhouette",
"(",
"self",
",",
"radius",
":",
"float",
",",
"r",
":",
"float",
"=",
"0",
",",
"g",
":",
"float",
"=",
"0",
",",
"b",
":",
"float",
"=",
"0",
",",
"a",
":",
"float",
"=",
"1",
")",
"->",
"None",
":",
"return",
"_robo... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/robotsim.py#L3087-L3099 | |
facebook/mysql-5.6 | 65a650660ec7b4d627d1b738f397252ff4706207 | arcanist/lint/cpp_linter/cpplint.py | python | _SetFilters | (filters) | Sets the module's error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "whitespace/indent").
Each filter should start with + or -; else we die. | Sets the module's error-message filters. | [
"Sets",
"the",
"module",
"s",
"error",
"-",
"message",
"filters",
"."
] | def _SetFilters(filters):
"""Sets the module's error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "whitespace/indent").
Each filter should start with + or -; else we die.
"""
_cpplint... | [
"def",
"_SetFilters",
"(",
"filters",
")",
":",
"_cpplint_state",
".",
"SetFilters",
"(",
"filters",
")"
] | https://github.com/facebook/mysql-5.6/blob/65a650660ec7b4d627d1b738f397252ff4706207/arcanist/lint/cpp_linter/cpplint.py#L791-L801 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/learn/python/learn/learn_io/dask_io.py | python | extract_dask_data | (data) | Extract data from dask.Series or dask.DataFrame for predictors. | Extract data from dask.Series or dask.DataFrame for predictors. | [
"Extract",
"data",
"from",
"dask",
".",
"Series",
"or",
"dask",
".",
"DataFrame",
"for",
"predictors",
"."
] | def extract_dask_data(data):
"""Extract data from dask.Series or dask.DataFrame for predictors."""
if isinstance(data, allowed_classes):
return _construct_dask_df_with_divisions(data)
else:
return data | [
"def",
"extract_dask_data",
"(",
"data",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"allowed_classes",
")",
":",
"return",
"_construct_dask_df_with_divisions",
"(",
"data",
")",
"else",
":",
"return",
"data"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/learn/python/learn/learn_io/dask_io.py#L63-L68 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/html2.py | python | WebView.CanUndo | (*args, **kwargs) | return _html2.WebView_CanUndo(*args, **kwargs) | CanUndo(self) -> bool | CanUndo(self) -> bool | [
"CanUndo",
"(",
"self",
")",
"-",
">",
"bool"
] | def CanUndo(*args, **kwargs):
"""CanUndo(self) -> bool"""
return _html2.WebView_CanUndo(*args, **kwargs) | [
"def",
"CanUndo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html2",
".",
"WebView_CanUndo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/html2.py#L294-L296 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/util/tf_decorator.py | python | make_decorator | (target,
decorator_func,
decorator_name=None,
decorator_doc='',
decorator_argspec=None) | return decorator_func | Make a decorator from a wrapper and a target.
Args:
target: The final callable to be wrapped.
decorator_func: The wrapper function.
decorator_name: The name of the decorator. If `None`, the name of the
function calling make_decorator.
decorator_doc: Documentation specific to this application of... | Make a decorator from a wrapper and a target. | [
"Make",
"a",
"decorator",
"from",
"a",
"wrapper",
"and",
"a",
"target",
"."
] | def make_decorator(target,
decorator_func,
decorator_name=None,
decorator_doc='',
decorator_argspec=None):
"""Make a decorator from a wrapper and a target.
Args:
target: The final callable to be wrapped.
decorator_func: The wrapper... | [
"def",
"make_decorator",
"(",
"target",
",",
"decorator_func",
",",
"decorator_name",
"=",
"None",
",",
"decorator_doc",
"=",
"''",
",",
"decorator_argspec",
"=",
"None",
")",
":",
"if",
"decorator_name",
"is",
"None",
":",
"frame",
"=",
"_traceback",
".",
"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/util/tf_decorator.py#L66-L96 | |
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/core.py | python | CherryTree.replace_in_all_nodes | (self, *args) | Replace the pattern in all the Tree Nodes | Replace the pattern in all the Tree Nodes | [
"Replace",
"the",
"pattern",
"in",
"all",
"the",
"Tree",
"Nodes"
] | def replace_in_all_nodes(self, *args):
"""Replace the pattern in all the Tree Nodes"""
if not self.is_tree_not_empty_or_error(): return
self.find_handler.replace_in_all_nodes(None) | [
"def",
"replace_in_all_nodes",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"not",
"self",
".",
"is_tree_not_empty_or_error",
"(",
")",
":",
"return",
"self",
".",
"find_handler",
".",
"replace_in_all_nodes",
"(",
"None",
")"
] | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/core.py#L3362-L3365 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/utils/misc.py | python | ask_password | (message) | return getpass.getpass(message) | Ask for a password interactively. | Ask for a password interactively. | [
"Ask",
"for",
"a",
"password",
"interactively",
"."
] | def ask_password(message):
# type: (str) -> str
"""Ask for a password interactively."""
_check_no_input(message)
return getpass.getpass(message) | [
"def",
"ask_password",
"(",
"message",
")",
":",
"# type: (str) -> str",
"_check_no_input",
"(",
"message",
")",
"return",
"getpass",
".",
"getpass",
"(",
"message",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/utils/misc.py#L240-L244 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/states.py | python | Body.check_attribution | (self, indented, attribution_start) | return i, (indent or 0) | Check attribution shape.
Return the index past the end of the attribution, and the indent. | Check attribution shape.
Return the index past the end of the attribution, and the indent. | [
"Check",
"attribution",
"shape",
".",
"Return",
"the",
"index",
"past",
"the",
"end",
"of",
"the",
"attribution",
"and",
"the",
"indent",
"."
] | def check_attribution(self, indented, attribution_start):
"""
Check attribution shape.
Return the index past the end of the attribution, and the indent.
"""
indent = None
i = attribution_start + 1
for i in range(attribution_start + 1, len(indented)):
l... | [
"def",
"check_attribution",
"(",
"self",
",",
"indented",
",",
"attribution_start",
")",
":",
"indent",
"=",
"None",
"i",
"=",
"attribution_start",
"+",
"1",
"for",
"i",
"in",
"range",
"(",
"attribution_start",
"+",
"1",
",",
"len",
"(",
"indented",
")",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/states.py#L1217-L1235 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/bindings/named_commands.py | python | downcase_word | (event: E) | Lowercase the current (or following) word. | Lowercase the current (or following) word. | [
"Lowercase",
"the",
"current",
"(",
"or",
"following",
")",
"word",
"."
] | def downcase_word(event: E) -> None:
"""
Lowercase the current (or following) word.
"""
buff = event.current_buffer
for i in range(event.arg): # XXX: not DRY: see meta_c and meta_u!!
pos = buff.document.find_next_word_ending()
words = buff.document.text_after_cursor[:pos]
b... | [
"def",
"downcase_word",
"(",
"event",
":",
"E",
")",
"->",
"None",
":",
"buff",
"=",
"event",
".",
"current_buffer",
"for",
"i",
"in",
"range",
"(",
"event",
".",
"arg",
")",
":",
"# XXX: not DRY: see meta_c and meta_u!!",
"pos",
"=",
"buff",
".",
"documen... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/bindings/named_commands.py#L306-L315 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/tpu/tpu_embedding.py | python | ProximalAdagradParameters.__init__ | (
self,
learning_rate: float,
initial_accumulator: float = 0.1,
l1_regularization_strength: float = 0.0,
l2_regularization_strength: float = 0.0,
use_gradient_accumulation: bool = True,
clip_weight_min: Optional[float] = None,
clip_weight_max: Optional[float] = None,
... | Optimization parameters for Adagrad.
Args:
learning_rate: used for updating embedding table.
initial_accumulator: initial accumulator for Adagrad.
l1_regularization_strength: A float value, must be greater than or equal
to zero.
l2_regularization_strength: A float value, must be gre... | Optimization parameters for Adagrad. | [
"Optimization",
"parameters",
"for",
"Adagrad",
"."
] | def __init__(
self,
learning_rate: float,
initial_accumulator: float = 0.1,
l1_regularization_strength: float = 0.0,
l2_regularization_strength: float = 0.0,
use_gradient_accumulation: bool = True,
clip_weight_min: Optional[float] = None,
clip_weight_max: Optional[float] ... | [
"def",
"__init__",
"(",
"self",
",",
"learning_rate",
":",
"float",
",",
"initial_accumulator",
":",
"float",
"=",
"0.1",
",",
"l1_regularization_strength",
":",
"float",
"=",
"0.0",
",",
"l2_regularization_strength",
":",
"float",
"=",
"0.0",
",",
"use_gradient... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/tpu/tpu_embedding.py#L562-L623 | ||
toggl-open-source/toggldesktop | 91865205885531cc8fd9e8d613dad49d625d56e7 | third_party/cpplint/cpplint.py | python | _BlockInfo.IsBlockInfo | (self) | return self.__class__ == _BlockInfo | Returns true if this block is a _BlockInfo.
This is convenient for verifying that an object is an instance of
a _BlockInfo, but not an instance of any of the derived classes.
Returns:
True for this class, False for derived classes. | Returns true if this block is a _BlockInfo. | [
"Returns",
"true",
"if",
"this",
"block",
"is",
"a",
"_BlockInfo",
"."
] | def IsBlockInfo(self):
"""Returns true if this block is a _BlockInfo.
This is convenient for verifying that an object is an instance of
a _BlockInfo, but not an instance of any of the derived classes.
Returns:
True for this class, False for derived classes.
"""
return self.__class__ == _... | [
"def",
"IsBlockInfo",
"(",
"self",
")",
":",
"return",
"self",
".",
"__class__",
"==",
"_BlockInfo"
] | https://github.com/toggl-open-source/toggldesktop/blob/91865205885531cc8fd9e8d613dad49d625d56e7/third_party/cpplint/cpplint.py#L2034-L2043 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/dtypes/common.py | python | _get_dtype | (arr_or_dtype) | return pandas_dtype(arr_or_dtype) | Get the dtype instance associated with an array
or dtype object.
Parameters
----------
arr_or_dtype : array-like
The array-like or dtype object whose dtype we want to extract.
Returns
-------
obj_dtype : The extract dtype instance from the
passed in array or dtype o... | Get the dtype instance associated with an array
or dtype object. | [
"Get",
"the",
"dtype",
"instance",
"associated",
"with",
"an",
"array",
"or",
"dtype",
"object",
"."
] | def _get_dtype(arr_or_dtype):
"""
Get the dtype instance associated with an array
or dtype object.
Parameters
----------
arr_or_dtype : array-like
The array-like or dtype object whose dtype we want to extract.
Returns
-------
obj_dtype : The extract dtype instance from the
... | [
"def",
"_get_dtype",
"(",
"arr_or_dtype",
")",
":",
"if",
"arr_or_dtype",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"\"Cannot deduce dtype from null object\"",
")",
"# fastpath",
"elif",
"isinstance",
"(",
"arr_or_dtype",
",",
"np",
".",
"dtype",
")",
":",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/dtypes/common.py#L1672-L1705 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBBreakpointName.SetThreadIndex | (self, index) | return _lldb.SBBreakpointName_SetThreadIndex(self, index) | SetThreadIndex(SBBreakpointName self, uint32_t index) | SetThreadIndex(SBBreakpointName self, uint32_t index) | [
"SetThreadIndex",
"(",
"SBBreakpointName",
"self",
"uint32_t",
"index",
")"
] | def SetThreadIndex(self, index):
"""SetThreadIndex(SBBreakpointName self, uint32_t index)"""
return _lldb.SBBreakpointName_SetThreadIndex(self, index) | [
"def",
"SetThreadIndex",
"(",
"self",
",",
"index",
")",
":",
"return",
"_lldb",
".",
"SBBreakpointName_SetThreadIndex",
"(",
"self",
",",
"index",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L2269-L2271 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/dataview.py | python | DataViewItemAttr.HasColour | (*args, **kwargs) | return _dataview.DataViewItemAttr_HasColour(*args, **kwargs) | HasColour(self) -> bool | HasColour(self) -> bool | [
"HasColour",
"(",
"self",
")",
"-",
">",
"bool"
] | def HasColour(*args, **kwargs):
"""HasColour(self) -> bool"""
return _dataview.DataViewItemAttr_HasColour(*args, **kwargs) | [
"def",
"HasColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewItemAttr_HasColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/dataview.py#L349-L351 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/lib2to3/pygram.py | python | Symbols.__init__ | (self, grammar) | Initializer.
Creates an attribute for each grammar symbol (nonterminal),
whose value is the symbol's type (an int >= 256). | Initializer. | [
"Initializer",
"."
] | def __init__(self, grammar):
"""Initializer.
Creates an attribute for each grammar symbol (nonterminal),
whose value is the symbol's type (an int >= 256).
"""
for name, symbol in grammar.symbol2number.items():
setattr(self, name, symbol) | [
"def",
"__init__",
"(",
"self",
",",
"grammar",
")",
":",
"for",
"name",
",",
"symbol",
"in",
"grammar",
".",
"symbol2number",
".",
"items",
"(",
")",
":",
"setattr",
"(",
"self",
",",
"name",
",",
"symbol",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/lib2to3/pygram.py#L22-L29 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/data_structures/sframe.py | python | SFrame._save_reference | (self, filename) | Performs an incomplete save of an existing SFrame into a directory.
This saved SFrame may reference SFrames in other locations in the same
filesystem for certain resources.
Parameters
----------
filename : string
The location to save the SFrame. Either a local direct... | Performs an incomplete save of an existing SFrame into a directory.
This saved SFrame may reference SFrames in other locations in the same
filesystem for certain resources. | [
"Performs",
"an",
"incomplete",
"save",
"of",
"an",
"existing",
"SFrame",
"into",
"a",
"directory",
".",
"This",
"saved",
"SFrame",
"may",
"reference",
"SFrames",
"in",
"other",
"locations",
"in",
"the",
"same",
"filesystem",
"for",
"certain",
"resources",
"."... | def _save_reference(self, filename):
"""
Performs an incomplete save of an existing SFrame into a directory.
This saved SFrame may reference SFrames in other locations in the same
filesystem for certain resources.
Parameters
----------
filename : string
... | [
"def",
"_save_reference",
"(",
"self",
",",
"filename",
")",
":",
"## Save the SFrame",
"url",
"=",
"_make_internal_url",
"(",
"filename",
")",
"with",
"cython_context",
"(",
")",
":",
"self",
".",
"__proxy__",
".",
"save_reference",
"(",
"url",
")"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/data_structures/sframe.py#L3255-L3280 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | xmlTextReader.NewWalker | (self, doc) | return ret | Setup an xmltextReader to parse a preparsed XML document.
This reuses the existing @reader xmlTextReader. | Setup an xmltextReader to parse a preparsed XML document.
This reuses the existing | [
"Setup",
"an",
"xmltextReader",
"to",
"parse",
"a",
"preparsed",
"XML",
"document",
".",
"This",
"reuses",
"the",
"existing"
] | def NewWalker(self, doc):
"""Setup an xmltextReader to parse a preparsed XML document.
This reuses the existing @reader xmlTextReader. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlReaderNewWalker(self._o, doc__o)
return ret | [
"def",
"NewWalker",
"(",
"self",
",",
"doc",
")",
":",
"if",
"doc",
"is",
"None",
":",
"doc__o",
"=",
"None",
"else",
":",
"doc__o",
"=",
"doc",
".",
"_o",
"ret",
"=",
"libxml2mod",
".",
"xmlReaderNewWalker",
"(",
"self",
".",
"_o",
",",
"doc__o",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L5977-L5983 | |
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | python/mxnet/gluon/parameter.py | python | Parameter.zero_grad | (self) | Sets gradient buffer on all contexts to 0. No action is taken if
parameter is uninitialized or doesn't require gradient. | Sets gradient buffer on all contexts to 0. No action is taken if
parameter is uninitialized or doesn't require gradient. | [
"Sets",
"gradient",
"buffer",
"on",
"all",
"contexts",
"to",
"0",
".",
"No",
"action",
"is",
"taken",
"if",
"parameter",
"is",
"uninitialized",
"or",
"doesn",
"t",
"require",
"gradient",
"."
] | def zero_grad(self):
"""Sets gradient buffer on all contexts to 0. No action is taken if
parameter is uninitialized or doesn't require gradient."""
if self._grad is None:
return
for i in self._grad:
i[:] = 0 | [
"def",
"zero_grad",
"(",
"self",
")",
":",
"if",
"self",
".",
"_grad",
"is",
"None",
":",
"return",
"for",
"i",
"in",
"self",
".",
"_grad",
":",
"i",
"[",
":",
"]",
"=",
"0"
] | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/gluon/parameter.py#L427-L433 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/array_grad.py | python | _StridedSliceGradGrad | (op, grad) | return None, None, None, None, array_ops.strided_slice(
grad,
begin,
end,
strides,
begin_mask=op.get_attr("begin_mask"),
end_mask=op.get_attr("end_mask"),
ellipsis_mask=op.get_attr("ellipsis_mask"),
new_axis_mask=op.get_attr("new_axis_mask"),
shrink_axis_mask=op.get... | Gradient for StridedSliceGrad op. | Gradient for StridedSliceGrad op. | [
"Gradient",
"for",
"StridedSliceGrad",
"op",
"."
] | def _StridedSliceGradGrad(op, grad):
"""Gradient for StridedSliceGrad op."""
begin = op.inputs[1]
end = op.inputs[2]
strides = op.inputs[3]
return None, None, None, None, array_ops.strided_slice(
grad,
begin,
end,
strides,
begin_mask=op.get_attr("begin_mask"),
end_mask=op.... | [
"def",
"_StridedSliceGradGrad",
"(",
"op",
",",
"grad",
")",
":",
"begin",
"=",
"op",
".",
"inputs",
"[",
"1",
"]",
"end",
"=",
"op",
".",
"inputs",
"[",
"2",
"]",
"strides",
"=",
"op",
".",
"inputs",
"[",
"3",
"]",
"return",
"None",
",",
"None",... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/array_grad.py#L195-L210 | |
QMCPACK/qmcpack | d0948ab455e38364458740cc8e2239600a14c5cd | nexus/lib/structure.py | python | Structure.rotate | (self,r,rp=None,passive=False,units="radians",check=True) | Arbitrary rotation of the structure.
Parameters
----------
r : `array_like, float, shape (3,3)` or `array_like, float, shape (3,)` or `str`
If a 3x3 matrix, then code executes rotation consistent with this matrix --
it is assumed that the matrix acts on a column-major v... | Arbitrary rotation of the structure.
Parameters
----------
r : `array_like, float, shape (3,3)` or `array_like, float, shape (3,)` or `str`
If a 3x3 matrix, then code executes rotation consistent with this matrix --
it is assumed that the matrix acts on a column-major v... | [
"Arbitrary",
"rotation",
"of",
"the",
"structure",
".",
"Parameters",
"----------",
"r",
":",
"array_like",
"float",
"shape",
"(",
"3",
"3",
")",
"or",
"array_like",
"float",
"shape",
"(",
"3",
")",
"or",
"str",
"If",
"a",
"3x3",
"matrix",
"then",
"code"... | def rotate(self,r,rp=None,passive=False,units="radians",check=True):
"""
Arbitrary rotation of the structure.
Parameters
----------
r : `array_like, float, shape (3,3)` or `array_like, float, shape (3,)` or `str`
If a 3x3 matrix, then code executes rotation consisten... | [
"def",
"rotate",
"(",
"self",
",",
"r",
",",
"rp",
"=",
"None",
",",
"passive",
"=",
"False",
",",
"units",
"=",
"\"radians\"",
",",
"check",
"=",
"True",
")",
":",
"if",
"rp",
"is",
"not",
"None",
":",
"dirmap",
"=",
"dict",
"(",
"x",
"=",
"["... | https://github.com/QMCPACK/qmcpack/blob/d0948ab455e38364458740cc8e2239600a14c5cd/nexus/lib/structure.py#L1567-L1666 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/distributions/bijector_impl.py | python | _Mapping._merge | (self, old, new) | return old | Helper to merge which handles merging one value. | Helper to merge which handles merging one value. | [
"Helper",
"to",
"merge",
"which",
"handles",
"merging",
"one",
"value",
"."
] | def _merge(self, old, new):
"""Helper to merge which handles merging one value."""
if old is None:
return new
elif new is not None and old != new:
raise ValueError("Incompatible values: %s != %s" % (old, new))
return old | [
"def",
"_merge",
"(",
"self",
",",
"old",
",",
"new",
")",
":",
"if",
"old",
"is",
"None",
":",
"return",
"new",
"elif",
"new",
"is",
"not",
"None",
"and",
"old",
"!=",
"new",
":",
"raise",
"ValueError",
"(",
"\"Incompatible values: %s != %s\"",
"%",
"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/distributions/bijector_impl.py#L99-L105 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozpack/files.py | python | BaseFile.mode | (self) | return None | Return the file's unix mode, or None if it has no meaning. | Return the file's unix mode, or None if it has no meaning. | [
"Return",
"the",
"file",
"s",
"unix",
"mode",
"or",
"None",
"if",
"it",
"has",
"no",
"meaning",
"."
] | def mode(self):
'''
Return the file's unix mode, or None if it has no meaning.
'''
return None | [
"def",
"mode",
"(",
"self",
")",
":",
"return",
"None"
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozpack/files.py#L193-L197 | |
openthread/openthread | 9fcdbed9c526c70f1556d1ed84099c1535c7cd32 | tools/harness-automation/autothreadharness/pdu_controller.py | python | ApcPduController.open | (self, **params) | Open telnet connection
Args:
params (dict), must contain two parameters "ip" - ip address or hostname and "port" - port number
Example:
params = {'port': 23, 'ip': 'localhost'} | Open telnet connection
Args:
params (dict), must contain two parameters "ip" - ip address or hostname and "port" - port number
Example:
params = {'port': 23, 'ip': 'localhost'} | [
"Open",
"telnet",
"connection",
"Args",
":",
"params",
"(",
"dict",
")",
"must",
"contain",
"two",
"parameters",
"ip",
"-",
"ip",
"address",
"or",
"hostname",
"and",
"port",
"-",
"port",
"number",
"Example",
":",
"params",
"=",
"{",
"port",
":",
"23",
... | def open(self, **params):
"""Open telnet connection
Args:
params (dict), must contain two parameters "ip" - ip address or hostname and "port" - port number
Example:
params = {'port': 23, 'ip': 'localhost'}
"""
logger.info('opening tel... | [
"def",
"open",
"(",
"self",
",",
"*",
"*",
"params",
")",
":",
"logger",
".",
"info",
"(",
"'opening telnet'",
")",
"self",
".",
"port",
"=",
"params",
"[",
"'port'",
"]",
"self",
".",
"ip",
"=",
"params",
"[",
"'ip'",
"]",
"self",
".",
"tn",
"="... | https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/tools/harness-automation/autothreadharness/pdu_controller.py#L97-L110 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/setuptools/_vendor/packaging/version.py | python | parse | (version) | Parse the given version string and return either a :class:`Version` object
or a :class:`LegacyVersion` object depending on if the given version is
a valid PEP 440 version or a legacy version. | Parse the given version string and return either a :class:`Version` object
or a :class:`LegacyVersion` object depending on if the given version is
a valid PEP 440 version or a legacy version. | [
"Parse",
"the",
"given",
"version",
"string",
"and",
"return",
"either",
"a",
":",
"class",
":",
"Version",
"object",
"or",
"a",
":",
"class",
":",
"LegacyVersion",
"object",
"depending",
"on",
"if",
"the",
"given",
"version",
"is",
"a",
"valid",
"PEP",
... | def parse(version):
"""
Parse the given version string and return either a :class:`Version` object
or a :class:`LegacyVersion` object depending on if the given version is
a valid PEP 440 version or a legacy version.
"""
try:
return Version(version)
except InvalidVersion:
retu... | [
"def",
"parse",
"(",
"version",
")",
":",
"try",
":",
"return",
"Version",
"(",
"version",
")",
"except",
"InvalidVersion",
":",
"return",
"LegacyVersion",
"(",
"version",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/_vendor/packaging/version.py#L21-L30 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/stc.py | python | StyledTextCtrl.CharLeftRectExtend | (*args, **kwargs) | return _stc.StyledTextCtrl_CharLeftRectExtend(*args, **kwargs) | CharLeftRectExtend(self)
Move caret left one character, extending rectangular selection to new caret position. | CharLeftRectExtend(self) | [
"CharLeftRectExtend",
"(",
"self",
")"
] | def CharLeftRectExtend(*args, **kwargs):
"""
CharLeftRectExtend(self)
Move caret left one character, extending rectangular selection to new caret position.
"""
return _stc.StyledTextCtrl_CharLeftRectExtend(*args, **kwargs) | [
"def",
"CharLeftRectExtend",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_CharLeftRectExtend",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/stc.py#L5383-L5389 | |
xhzdeng/crpn | a5aef0f80dbe486103123f740c634fb01e6cc9a1 | caffe-fast-rcnn/python/caffe/pycaffe.py | python | _Net_layer_dict | (self) | return self._layer_dict | An OrderedDict (bottom to top, i.e., input to output) of network
layers indexed by name | An OrderedDict (bottom to top, i.e., input to output) of network
layers indexed by name | [
"An",
"OrderedDict",
"(",
"bottom",
"to",
"top",
"i",
".",
"e",
".",
"input",
"to",
"output",
")",
"of",
"network",
"layers",
"indexed",
"by",
"name"
] | def _Net_layer_dict(self):
"""
An OrderedDict (bottom to top, i.e., input to output) of network
layers indexed by name
"""
if not hasattr(self, '_layer_dict'):
self._layer_dict = OrderedDict(zip(self._layer_names, self.layers))
return self._layer_dict | [
"def",
"_Net_layer_dict",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_layer_dict'",
")",
":",
"self",
".",
"_layer_dict",
"=",
"OrderedDict",
"(",
"zip",
"(",
"self",
".",
"_layer_names",
",",
"self",
".",
"layers",
")",
")",
"r... | https://github.com/xhzdeng/crpn/blob/a5aef0f80dbe486103123f740c634fb01e6cc9a1/caffe-fast-rcnn/python/caffe/pycaffe.py#L47-L54 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/contrib/slim/quantization/quantize_transpiler_v2.py | python | QuantizeTranspilerV2._transform_forward | (self, block, op, var_rename_map, is_test) | Insert fake quant op before the target ops. | Insert fake quant op before the target ops. | [
"Insert",
"fake",
"quant",
"op",
"before",
"the",
"target",
"ops",
"."
] | def _transform_forward(self, block, op, var_rename_map, is_test):
"""
Insert fake quant op before the target ops.
"""
op._set_attr("quantization_type", "qat_with_weight")
# insert fake quant op before the quantized op
for in_name in op.input_arg_names:
block_... | [
"def",
"_transform_forward",
"(",
"self",
",",
"block",
",",
"op",
",",
"var_rename_map",
",",
"is_test",
")",
":",
"op",
".",
"_set_attr",
"(",
"\"quantization_type\"",
",",
"\"qat_with_weight\"",
")",
"# insert fake quant op before the quantized op",
"for",
"in_name... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/contrib/slim/quantization/quantize_transpiler_v2.py#L173-L230 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | ColourData.GetCustomColour | (*args, **kwargs) | return _windows_.ColourData_GetCustomColour(*args, **kwargs) | GetCustomColour(self, int i) -> Colour
Gets the i'th custom colour associated with the colour dialog. i
should be an integer between 0 and 15. The default custom colours are
all invalid colours. | GetCustomColour(self, int i) -> Colour | [
"GetCustomColour",
"(",
"self",
"int",
"i",
")",
"-",
">",
"Colour"
] | def GetCustomColour(*args, **kwargs):
"""
GetCustomColour(self, int i) -> Colour
Gets the i'th custom colour associated with the colour dialog. i
should be an integer between 0 and 15. The default custom colours are
all invalid colours.
"""
return _windows_.Colou... | [
"def",
"GetCustomColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"ColourData_GetCustomColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L2949-L2957 | |
hzl123456/LibyuvDemo | d02b6500d0cf111bdd8778c56983154e6d14bdb4 | libyuv/src/main/cpp/libyuv/tools_libyuv/get_landmines.py | python | print_landmines | () | ALL LANDMINES ARE EMITTED FROM HERE. | ALL LANDMINES ARE EMITTED FROM HERE. | [
"ALL",
"LANDMINES",
"ARE",
"EMITTED",
"FROM",
"HERE",
"."
] | def print_landmines():
"""
ALL LANDMINES ARE EMITTED FROM HERE.
"""
# DO NOT add landmines as part of a regular CL. Landmines are a last-effort
# bandaid fix if a CL that got landed has a build dependency bug and all bots
# need to be cleaned up. If you're writing a new CL that causes build
# dependency p... | [
"def",
"print_landmines",
"(",
")",
":",
"# DO NOT add landmines as part of a regular CL. Landmines are a last-effort",
"# bandaid fix if a CL that got landed has a build dependency bug and all bots",
"# need to be cleaned up. If you're writing a new CL that causes build",
"# dependency problems, fi... | https://github.com/hzl123456/LibyuvDemo/blob/d02b6500d0cf111bdd8778c56983154e6d14bdb4/libyuv/src/main/cpp/libyuv/tools_libyuv/get_landmines.py#L30-L41 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py | python | CudnnParamsFormatConverterGRU._cudnn_to_tf_biases | (self, *biases) | return (
# Save only the sum instead of individual biases. When recovering,
# return two biases each with half the value. Since RNN does not
# regularize by weight decay, it has no side effect in training or
# inference.
array_ops.concat([b_wi, b_wr], axis=0) +
array_ops.... | r"""Stitching cudnn canonical biases to generate tf canonical biases. | r"""Stitching cudnn canonical biases to generate tf canonical biases. | [
"r",
"Stitching",
"cudnn",
"canonical",
"biases",
"to",
"generate",
"tf",
"canonical",
"biases",
"."
] | def _cudnn_to_tf_biases(self, *biases):
r"""Stitching cudnn canonical biases to generate tf canonical biases."""
b_wi, b_wr, b_wh, b_ri, b_rr, b_rh = biases
return (
# Save only the sum instead of individual biases. When recovering,
# return two biases each with half the value. Since RNN doe... | [
"def",
"_cudnn_to_tf_biases",
"(",
"self",
",",
"*",
"biases",
")",
":",
"b_wi",
",",
"b_wr",
",",
"b_wh",
",",
"b_ri",
",",
"b_rr",
",",
"b_rh",
"=",
"biases",
"return",
"(",
"# Save only the sum instead of individual biases. When recovering,",
"# return two biases... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py#L625-L636 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/slim/python/slim/nets/inception_v2.py | python | inception_v2_arg_scope | (weight_decay=0.00004,
batch_norm_var_collection='moving_vars') | Defines the default InceptionV2 arg scope.
Args:
weight_decay: The weight decay to use for regularizing the model.
batch_norm_var_collection: The name of the collection for the batch norm
variables.
Returns:
An `arg_scope` to use for the inception v3 model. | Defines the default InceptionV2 arg scope. | [
"Defines",
"the",
"default",
"InceptionV2",
"arg",
"scope",
"."
] | def inception_v2_arg_scope(weight_decay=0.00004,
batch_norm_var_collection='moving_vars'):
"""Defines the default InceptionV2 arg scope.
Args:
weight_decay: The weight decay to use for regularizing the model.
batch_norm_var_collection: The name of the collection for the batch nor... | [
"def",
"inception_v2_arg_scope",
"(",
"weight_decay",
"=",
"0.00004",
",",
"batch_norm_var_collection",
"=",
"'moving_vars'",
")",
":",
"batch_norm_params",
"=",
"{",
"# Decay for the moving averages.",
"'decay'",
":",
"0.9997",
",",
"# epsilon to prevent 0s in variance.",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/slim/python/slim/nets/inception_v2.py#L605-L643 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/boost_1_66_0/tools/build/src/build/virtual_target.py | python | Action.actualize_sources | (self, sources, prop_set) | Creates actual jam targets for sources. Initializes two member
variables:
'self.actual_sources_' -- sources which are passed to updating action
'self.dependency_only_sources_' -- sources which are made dependencies, but
are not used otherwise.
New values will... | Creates actual jam targets for sources. Initializes two member
variables:
'self.actual_sources_' -- sources which are passed to updating action
'self.dependency_only_sources_' -- sources which are made dependencies, but
are not used otherwise. | [
"Creates",
"actual",
"jam",
"targets",
"for",
"sources",
".",
"Initializes",
"two",
"member",
"variables",
":",
"self",
".",
"actual_sources_",
"--",
"sources",
"which",
"are",
"passed",
"to",
"updating",
"action",
"self",
".",
"dependency_only_sources_",
"--",
... | def actualize_sources (self, sources, prop_set):
""" Creates actual jam targets for sources. Initializes two member
variables:
'self.actual_sources_' -- sources which are passed to updating action
'self.dependency_only_sources_' -- sources which are made dependencies, but
... | [
"def",
"actualize_sources",
"(",
"self",
",",
"sources",
",",
"prop_set",
")",
":",
"assert",
"is_iterable_typed",
"(",
"sources",
",",
"VirtualTarget",
")",
"assert",
"isinstance",
"(",
"prop_set",
",",
"property_set",
".",
"PropertySet",
")",
"dependencies",
"... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/boost_1_66_0/tools/build/src/build/virtual_target.py#L886-L917 | ||
eclipse/upm | d6f76ff8c231417666594214679c49399513112e | src/doxy2swig.py | python | Doxy2SWIG.generic_parse | (self, node, pad=0) | A Generic parser for arbitrary tags in a node.
Parameters:
- node: A node in the DOM.
- pad: `int` (default: 0)
If 0 the node data is not padded with newlines. If 1 it
appends a newline after parsing the childNodes. If 2 it
pads before and after the nodes... | A Generic parser for arbitrary tags in a node. | [
"A",
"Generic",
"parser",
"for",
"arbitrary",
"tags",
"in",
"a",
"node",
"."
] | def generic_parse(self, node, pad=0):
"""A Generic parser for arbitrary tags in a node.
Parameters:
- node: A node in the DOM.
- pad: `int` (default: 0)
If 0 the node data is not padded with newlines. If 1 it
appends a newline after parsing the childNodes. I... | [
"def",
"generic_parse",
"(",
"self",
",",
"node",
",",
"pad",
"=",
"0",
")",
":",
"npiece",
"=",
"0",
"if",
"pad",
":",
"npiece",
"=",
"len",
"(",
"self",
".",
"pieces",
")",
"if",
"pad",
"==",
"2",
":",
"self",
".",
"add_text",
"(",
"'\\n'",
"... | https://github.com/eclipse/upm/blob/d6f76ff8c231417666594214679c49399513112e/src/doxy2swig.py#L169-L192 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | grc/gui/PropsDialog.py | python | PropsDialog.__init__ | (self, parent, block) | Properties dialog constructor.
Args:%
block: a block instance | Properties dialog constructor. | [
"Properties",
"dialog",
"constructor",
"."
] | def __init__(self, parent, block):
"""
Properties dialog constructor.
Args:%
block: a block instance
"""
Gtk.Dialog.__init__(
self,
title='Properties: ' + block.label,
transient_for=parent,
modal=True,
dest... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
",",
"block",
")",
":",
"Gtk",
".",
"Dialog",
".",
"__init__",
"(",
"self",
",",
"title",
"=",
"'Properties: '",
"+",
"block",
".",
"label",
",",
"transient_for",
"=",
"parent",
",",
"modal",
"=",
"True",
... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/grc/gui/PropsDialog.py#L20-L105 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/html.py | python | HtmlWinParser.SetFontBold | (*args, **kwargs) | return _html.HtmlWinParser_SetFontBold(*args, **kwargs) | SetFontBold(self, int x) | SetFontBold(self, int x) | [
"SetFontBold",
"(",
"self",
"int",
"x",
")"
] | def SetFontBold(*args, **kwargs):
"""SetFontBold(self, int x)"""
return _html.HtmlWinParser_SetFontBold(*args, **kwargs) | [
"def",
"SetFontBold",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlWinParser_SetFontBold",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/html.py#L304-L306 | |
choasup/caffe-yolo9000 | e8a476c4c23d756632f7a26c681a96e3ab672544 | python/caffe/coord_map.py | python | inverse | (coord_map) | return ax, 1 / a, -b / a | Invert a coord map by de-scaling and un-shifting;
this gives the backward mapping for the gradient. | Invert a coord map by de-scaling and un-shifting;
this gives the backward mapping for the gradient. | [
"Invert",
"a",
"coord",
"map",
"by",
"de",
"-",
"scaling",
"and",
"un",
"-",
"shifting",
";",
"this",
"gives",
"the",
"backward",
"mapping",
"for",
"the",
"gradient",
"."
] | def inverse(coord_map):
"""
Invert a coord map by de-scaling and un-shifting;
this gives the backward mapping for the gradient.
"""
ax, a, b = coord_map
return ax, 1 / a, -b / a | [
"def",
"inverse",
"(",
"coord_map",
")",
":",
"ax",
",",
"a",
",",
"b",
"=",
"coord_map",
"return",
"ax",
",",
"1",
"/",
"a",
",",
"-",
"b",
"/",
"a"
] | https://github.com/choasup/caffe-yolo9000/blob/e8a476c4c23d756632f7a26c681a96e3ab672544/python/caffe/coord_map.py#L106-L112 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/ogl/_basic.py | python | Shape.GetDisableLabel | (self) | return self._disableLabel | TRUE if the default region will not be shown, FALSE otherwise. | TRUE if the default region will not be shown, FALSE otherwise. | [
"TRUE",
"if",
"the",
"default",
"region",
"will",
"not",
"be",
"shown",
"FALSE",
"otherwise",
"."
] | def GetDisableLabel(self):
"""TRUE if the default region will not be shown, FALSE otherwise."""
return self._disableLabel | [
"def",
"GetDisableLabel",
"(",
"self",
")",
":",
"return",
"self",
".",
"_disableLabel"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/ogl/_basic.py#L2030-L2032 | |
google/fhir | d77f57706c1a168529b0b87ca7ccb1c0113e83c2 | py/google/fhir/json_format/wrappers/_primitive_wrappers.py | python | PrimitiveWrapper.get_element | (self) | return element | Returns the raw Element underlying the wrapped primitive.
Note that conversion-only extensions are removed prior to returning. | Returns the raw Element underlying the wrapped primitive. | [
"Returns",
"the",
"raw",
"Element",
"underlying",
"the",
"wrapped",
"primitive",
"."
] | def get_element(self) -> Optional[message.Message]:
"""Returns the raw Element underlying the wrapped primitive.
Note that conversion-only extensions are removed prior to returning.
"""
if not (proto_utils.field_is_set(self.wrapped, 'id') or
proto_utils.field_is_set(self.wrapped, 'extension... | [
"def",
"get_element",
"(",
"self",
")",
"->",
"Optional",
"[",
"message",
".",
"Message",
"]",
":",
"if",
"not",
"(",
"proto_utils",
".",
"field_is_set",
"(",
"self",
".",
"wrapped",
",",
"'id'",
")",
"or",
"proto_utils",
".",
"field_is_set",
"(",
"self"... | https://github.com/google/fhir/blob/d77f57706c1a168529b0b87ca7ccb1c0113e83c2/py/google/fhir/json_format/wrappers/_primitive_wrappers.py#L214-L234 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/gslib/gcs_json_api.py | python | GcsJsonApi._TranslateApitoolsException | (self, e, bucket_name=None, object_name=None,
generation=None, not_found_exception=None) | Translates apitools exceptions into their gsutil Cloud Api equivalents.
Args:
e: Any exception in TRANSLATABLE_APITOOLS_EXCEPTIONS.
bucket_name: Optional bucket name in request that caused the exception.
object_name: Optional object name in request that caused the exception.
generation: Opt... | Translates apitools exceptions into their gsutil Cloud Api equivalents. | [
"Translates",
"apitools",
"exceptions",
"into",
"their",
"gsutil",
"Cloud",
"Api",
"equivalents",
"."
] | def _TranslateApitoolsException(self, e, bucket_name=None, object_name=None,
generation=None, not_found_exception=None):
"""Translates apitools exceptions into their gsutil Cloud Api equivalents.
Args:
e: Any exception in TRANSLATABLE_APITOOLS_EXCEPTIONS.
bucket_na... | [
"def",
"_TranslateApitoolsException",
"(",
"self",
",",
"e",
",",
"bucket_name",
"=",
"None",
",",
"object_name",
"=",
"None",
",",
"generation",
"=",
"None",
",",
"not_found_exception",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"e",
",",
"apitools_exc... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/gslib/gcs_json_api.py#L1353-L1443 | ||
Tom94/practical-path-guiding | fcf01afb436184e8a74bf300aa89f69b03ab25a2 | mitsuba/data/scons/icl12.py | python | merge_script_vars | (env,script,args=None,vars=None) | This merges the data retieved from the script in to the Enviroment
by prepending it.
script is the name of the script, args is optional arguments to pass
vars are var we want to retrieve, if None it will retieve everything found | This merges the data retieved from the script in to the Enviroment
by prepending it.
script is the name of the script, args is optional arguments to pass
vars are var we want to retrieve, if None it will retieve everything found | [
"This",
"merges",
"the",
"data",
"retieved",
"from",
"the",
"script",
"in",
"to",
"the",
"Enviroment",
"by",
"prepending",
"it",
".",
"script",
"is",
"the",
"name",
"of",
"the",
"script",
"args",
"is",
"optional",
"arguments",
"to",
"pass",
"vars",
"are",
... | def merge_script_vars(env,script,args=None,vars=None):
'''
This merges the data retieved from the script in to the Enviroment
by prepending it.
script is the name of the script, args is optional arguments to pass
vars are var we want to retrieve, if None it will retieve everything found
'''
shell_env=get_script_... | [
"def",
"merge_script_vars",
"(",
"env",
",",
"script",
",",
"args",
"=",
"None",
",",
"vars",
"=",
"None",
")",
":",
"shell_env",
"=",
"get_script_env",
"(",
"env",
",",
"script",
",",
"args",
",",
"vars",
")",
"for",
"k",
",",
"v",
"in",
"shell_env"... | https://github.com/Tom94/practical-path-guiding/blob/fcf01afb436184e8a74bf300aa89f69b03ab25a2/mitsuba/data/scons/icl12.py#L84-L93 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/tools/pretty_vcproj.py | python | FlattenFilter | (node) | return node_list | Returns a list of all the node and sub nodes. | Returns a list of all the node and sub nodes. | [
"Returns",
"a",
"list",
"of",
"all",
"the",
"node",
"and",
"sub",
"nodes",
"."
] | def FlattenFilter(node):
"""Returns a list of all the node and sub nodes."""
node_list = []
if (node.attributes and
node.getAttribute('Name') == '_excluded_files'):
# We don't add the "_excluded_files" filter.
return []
for current in node.childNodes:
if current.nodeName == 'Filter':
... | [
"def",
"FlattenFilter",
"(",
"node",
")",
":",
"node_list",
"=",
"[",
"]",
"if",
"(",
"node",
".",
"attributes",
"and",
"node",
".",
"getAttribute",
"(",
"'Name'",
")",
"==",
"'_excluded_files'",
")",
":",
"# We don't add the \"_excluded_files\" filter.",
"retur... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/tools/pretty_vcproj.py#L95-L110 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/html.py | python | HtmlRenderingState.SetFgColour | (*args, **kwargs) | return _html.HtmlRenderingState_SetFgColour(*args, **kwargs) | SetFgColour(self, Colour c) | SetFgColour(self, Colour c) | [
"SetFgColour",
"(",
"self",
"Colour",
"c",
")"
] | def SetFgColour(*args, **kwargs):
"""SetFgColour(self, Colour c)"""
return _html.HtmlRenderingState_SetFgColour(*args, **kwargs) | [
"def",
"SetFgColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlRenderingState_SetFgColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/html.py#L517-L519 | |
gwaldron/osgearth | 4c521857d59a69743e4a9cedba00afe570f984e8 | src/third_party/tinygltf/deps/cpplint.py | python | FileInfo.NoExtension | (self) | return '/'.join(self.Split()[0:2]) | File has no source file extension. | File has no source file extension. | [
"File",
"has",
"no",
"source",
"file",
"extension",
"."
] | def NoExtension(self):
"""File has no source file extension."""
return '/'.join(self.Split()[0:2]) | [
"def",
"NoExtension",
"(",
"self",
")",
":",
"return",
"'/'",
".",
"join",
"(",
"self",
".",
"Split",
"(",
")",
"[",
"0",
":",
"2",
"]",
")"
] | https://github.com/gwaldron/osgearth/blob/4c521857d59a69743e4a9cedba00afe570f984e8/src/third_party/tinygltf/deps/cpplint.py#L1055-L1057 | |
yushroom/FishEngine | a4b9fb9b0a6dc202f7990e75f4b7d8d5163209d9 | Script/reflect/clang/cindex.py | python | SourceRange.__contains__ | (self, other) | return False | Useful to detect the Token/Lexer bug | Useful to detect the Token/Lexer bug | [
"Useful",
"to",
"detect",
"the",
"Token",
"/",
"Lexer",
"bug"
] | def __contains__(self, other):
"""Useful to detect the Token/Lexer bug"""
if not isinstance(other, SourceLocation):
return False
if other.file is None and self.start.file is None:
pass
elif ( self.start.file.name != other.file.name or
other.file.nam... | [
"def",
"__contains__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"SourceLocation",
")",
":",
"return",
"False",
"if",
"other",
".",
"file",
"is",
"None",
"and",
"self",
".",
"start",
".",
"file",
"is",
"None",
... | https://github.com/yushroom/FishEngine/blob/a4b9fb9b0a6dc202f7990e75f4b7d8d5163209d9/Script/reflect/clang/cindex.py#L269-L290 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/deep_memory_profiler/lib/bucket.py | python | BucketSet.load | (self, prefix) | Loads all related bucket files.
Args:
prefix: A prefix string for bucket file names. | Loads all related bucket files. | [
"Loads",
"all",
"related",
"bucket",
"files",
"."
] | def load(self, prefix):
"""Loads all related bucket files.
Args:
prefix: A prefix string for bucket file names.
"""
LOGGER.info('Loading bucket files.')
n = 0
skipped = 0
while True:
path = '%s.%04d.buckets' % (prefix, n)
if not os.path.exists(path) or not os.stat(path)... | [
"def",
"load",
"(",
"self",
",",
"prefix",
")",
":",
"LOGGER",
".",
"info",
"(",
"'Loading bucket files.'",
")",
"n",
"=",
"0",
"skipped",
"=",
"0",
"while",
"True",
":",
"path",
"=",
"'%s.%04d.buckets'",
"%",
"(",
"prefix",
",",
"n",
")",
"if",
"not... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/deep_memory_profiler/lib/bucket.py#L120-L142 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/platform/self_check.py | python | preload_check | () | Raises an exception if the environment is not correctly configured.
Raises:
ImportError: If the check detects that the environment is not correctly
configured, and attempting to load the TensorFlow runtime will fail. | Raises an exception if the environment is not correctly configured. | [
"Raises",
"an",
"exception",
"if",
"the",
"environment",
"is",
"not",
"correctly",
"configured",
"."
] | def preload_check():
"""Raises an exception if the environment is not correctly configured.
Raises:
ImportError: If the check detects that the environment is not correctly
configured, and attempting to load the TensorFlow runtime will fail.
"""
if os.name == "nt":
# Attempt to load any DLLs that ... | [
"def",
"preload_check",
"(",
")",
":",
"if",
"os",
".",
"name",
"==",
"\"nt\"",
":",
"# Attempt to load any DLLs that the Python extension depends on before",
"# we load the Python extension, so that we can raise an actionable error",
"# message if they are not found.",
"if",
"MSVCP_... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/platform/self_check.py#L31-L65 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/feature_column/feature_column.py | python | indicator_column | (categorical_column) | return _IndicatorColumn(categorical_column) | Represents multi-hot representation of given categorical column.
Used to wrap any `categorical_column_*` (e.g., to feed to DNN). Use
`embedding_column` if the inputs are sparse.
```python
name = indicator_column(categorical_column_with_vocabulary_list(
'name', ['bob', 'george', 'wanda'])
columns = [na... | Represents multi-hot representation of given categorical column. | [
"Represents",
"multi",
"-",
"hot",
"representation",
"of",
"given",
"categorical",
"column",
"."
] | def indicator_column(categorical_column):
"""Represents multi-hot representation of given categorical column.
Used to wrap any `categorical_column_*` (e.g., to feed to DNN). Use
`embedding_column` if the inputs are sparse.
```python
name = indicator_column(categorical_column_with_vocabulary_list(
'nam... | [
"def",
"indicator_column",
"(",
"categorical_column",
")",
":",
"return",
"_IndicatorColumn",
"(",
"categorical_column",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/feature_column/feature_column.py#L1061-L1086 | |
tangzhenyu/Scene-Text-Understanding | 0f7ffc7aea5971a50cdc03d33d0a41075285948b | SynthText_Chinese/colorize3_poisson.py | python | FontColor.sample_normal | (self, col_mean, col_std) | return np.clip(col_sample, 0, 255).astype('uint8') | sample from a normal distribution centered around COL_MEAN
with standard deviation = COL_STD. | sample from a normal distribution centered around COL_MEAN
with standard deviation = COL_STD. | [
"sample",
"from",
"a",
"normal",
"distribution",
"centered",
"around",
"COL_MEAN",
"with",
"standard",
"deviation",
"=",
"COL_STD",
"."
] | def sample_normal(self, col_mean, col_std):
"""
sample from a normal distribution centered around COL_MEAN
with standard deviation = COL_STD.
"""
col_sample = col_mean + col_std * np.random.randn()
return np.clip(col_sample, 0, 255).astype('uint8') | [
"def",
"sample_normal",
"(",
"self",
",",
"col_mean",
",",
"col_std",
")",
":",
"col_sample",
"=",
"col_mean",
"+",
"col_std",
"*",
"np",
".",
"random",
".",
"randn",
"(",
")",
"return",
"np",
".",
"clip",
"(",
"col_sample",
",",
"0",
",",
"255",
")"... | https://github.com/tangzhenyu/Scene-Text-Understanding/blob/0f7ffc7aea5971a50cdc03d33d0a41075285948b/SynthText_Chinese/colorize3_poisson.py#L57-L63 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | parserCtxt.parseEndTag | (self) | parse an end of tag [42] ETag ::= '</' Name S? '>' With
namespace [NS 9] ETag ::= '</' QName S? '>' | parse an end of tag [42] ETag ::= '</' Name S? '>' With
namespace [NS 9] ETag ::= '</' QName S? '>' | [
"parse",
"an",
"end",
"of",
"tag",
"[",
"42",
"]",
"ETag",
"::",
"=",
"<",
"/",
"Name",
"S?",
">",
"With",
"namespace",
"[",
"NS",
"9",
"]",
"ETag",
"::",
"=",
"<",
"/",
"QName",
"S?",
">"
] | def parseEndTag(self):
"""parse an end of tag [42] ETag ::= '</' Name S? '>' With
namespace [NS 9] ETag ::= '</' QName S? '>' """
libxml2mod.xmlParseEndTag(self._o) | [
"def",
"parseEndTag",
"(",
"self",
")",
":",
"libxml2mod",
".",
"xmlParseEndTag",
"(",
"self",
".",
"_o",
")"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L5277-L5280 | ||
dmlc/nnvm | dab5ce8ab6adbf4edd8bd2fa89f1a99f343b6e38 | python/nnvm/compiler/build_module.py | python | build | (graph, target=None, shape=None, dtype="float32",
params=None, target_host=None, layout=None) | return graph, libmod, params | Build graph into runtime library.
The build function will optimize the graph and do the compilation.
When params is provided, the compiler might split the graph to
pre-compute certain values, so the final execution graph can
be different from the original one.
Parameters
----------
graph ... | Build graph into runtime library. | [
"Build",
"graph",
"into",
"runtime",
"library",
"."
] | def build(graph, target=None, shape=None, dtype="float32",
params=None, target_host=None, layout=None):
"""Build graph into runtime library.
The build function will optimize the graph and do the compilation.
When params is provided, the compiler might split the graph to
pre-compute certain v... | [
"def",
"build",
"(",
"graph",
",",
"target",
"=",
"None",
",",
"shape",
"=",
"None",
",",
"dtype",
"=",
"\"float32\"",
",",
"params",
"=",
"None",
",",
"target_host",
"=",
"None",
",",
"layout",
"=",
"None",
")",
":",
"target",
"=",
"target",
"if",
... | https://github.com/dmlc/nnvm/blob/dab5ce8ab6adbf4edd8bd2fa89f1a99f343b6e38/python/nnvm/compiler/build_module.py#L183-L297 | |
dfm/celerite | 62c8ce6f5816c655ad2a2d1b3eaaaf9fc7ca7908 | celerite/celerite.py | python | GP.log_likelihood | (self, y, _const=math.log(2.0 * math.pi), quiet=False) | return loglike | Compute the marginalized likelihood of the GP model
The factorized matrix from the previous call to :func:`GP.compute` is
used so ``compute`` must be called first.
Args:
y (array[n]): The observations at coordinates ``x`` from
:func:`GP.compute`.
quiet (... | Compute the marginalized likelihood of the GP model | [
"Compute",
"the",
"marginalized",
"likelihood",
"of",
"the",
"GP",
"model"
] | def log_likelihood(self, y, _const=math.log(2.0 * math.pi), quiet=False):
"""
Compute the marginalized likelihood of the GP model
The factorized matrix from the previous call to :func:`GP.compute` is
used so ``compute`` must be called first.
Args:
y (array[n]): The ... | [
"def",
"log_likelihood",
"(",
"self",
",",
"y",
",",
"_const",
"=",
"math",
".",
"log",
"(",
"2.0",
"*",
"math",
".",
"pi",
")",
",",
"quiet",
"=",
"False",
")",
":",
"y",
"=",
"self",
".",
"_process_input",
"(",
"y",
")",
"resid",
"=",
"y",
"-... | https://github.com/dfm/celerite/blob/62c8ce6f5816c655ad2a2d1b3eaaaf9fc7ca7908/celerite/celerite.py#L180-L219 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/typing.py | python | _check_generic | (cls, parameters, elen) | Check correct count for parameters of a generic cls (internal helper).
This gives a nice error message in case of count mismatch. | Check correct count for parameters of a generic cls (internal helper).
This gives a nice error message in case of count mismatch. | [
"Check",
"correct",
"count",
"for",
"parameters",
"of",
"a",
"generic",
"cls",
"(",
"internal",
"helper",
")",
".",
"This",
"gives",
"a",
"nice",
"error",
"message",
"in",
"case",
"of",
"count",
"mismatch",
"."
] | def _check_generic(cls, parameters, elen):
"""Check correct count for parameters of a generic cls (internal helper).
This gives a nice error message in case of count mismatch.
"""
if not elen:
raise TypeError(f"{cls} is not a generic class")
alen = len(parameters)
if alen != elen:
... | [
"def",
"_check_generic",
"(",
"cls",
",",
"parameters",
",",
"elen",
")",
":",
"if",
"not",
"elen",
":",
"raise",
"TypeError",
"(",
"f\"{cls} is not a generic class\"",
")",
"alen",
"=",
"len",
"(",
"parameters",
")",
"if",
"alen",
"!=",
"elen",
":",
"rais... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/typing.py#L206-L215 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILLDiagnostics.py | python | _reportBeamStopMask | (reportWS, maskWS) | return _reportMasking(reportWS, maskWS, 'BeamStopMask') | Return masked spectrum numbers and add default mask information to a report workspace. | Return masked spectrum numbers and add default mask information to a report workspace. | [
"Return",
"masked",
"spectrum",
"numbers",
"and",
"add",
"default",
"mask",
"information",
"to",
"a",
"report",
"workspace",
"."
] | def _reportBeamStopMask(reportWS, maskWS):
"""Return masked spectrum numbers and add default mask information to a report workspace."""
return _reportMasking(reportWS, maskWS, 'BeamStopMask') | [
"def",
"_reportBeamStopMask",
"(",
"reportWS",
",",
"maskWS",
")",
":",
"return",
"_reportMasking",
"(",
"reportWS",
",",
"maskWS",
",",
"'BeamStopMask'",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILLDiagnostics.py#L240-L242 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.