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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
google/mysql-protobuf | 467cda676afaa49e762c5c9164a43f6ad31a1fbf | protobuf/python/google/protobuf/internal/python_message.py | python | _Listener.__init__ | (self, parent_message) | Args:
parent_message: The message whose _Modified() method we should call when
we receive Modified() messages. | Args:
parent_message: The message whose _Modified() method we should call when
we receive Modified() messages. | [
"Args",
":",
"parent_message",
":",
"The",
"message",
"whose",
"_Modified",
"()",
"method",
"we",
"should",
"call",
"when",
"we",
"receive",
"Modified",
"()",
"messages",
"."
] | def __init__(self, parent_message):
"""Args:
parent_message: The message whose _Modified() method we should call when
we receive Modified() messages.
"""
# This listener establishes a back reference from a child (contained) object
# to its parent (containing) object. We make this a weak r... | [
"def",
"__init__",
"(",
"self",
",",
"parent_message",
")",
":",
"# This listener establishes a back reference from a child (contained) object",
"# to its parent (containing) object. We make this a weak reference to avoid",
"# creating cyclic garbage when the client finishes with the 'parent' o... | https://github.com/google/mysql-protobuf/blob/467cda676afaa49e762c5c9164a43f6ad31a1fbf/protobuf/python/google/protobuf/internal/python_message.py#L1279-L1296 | ||
HKUST-Aerial-Robotics/Fast-Planner | 2ddd7793eecd573dbb5b47e2c985aa06606df3cf | uav_simulator/Utils/multi_map_server/quadrotor_msgs/src/quadrotor_msgs/msg/_PPROutputData.py | python | PPROutputData.deserialize | (self, str) | unpack serialized message in str into this message instance
:param str: byte array of serialized message, ``str`` | unpack serialized message in str into this message instance
:param str: byte array of serialized message, ``str`` | [
"unpack",
"serialized",
"message",
"in",
"str",
"into",
"this",
"message",
"instance",
":",
"param",
"str",
":",
"byte",
"array",
"of",
"serialized",
"message",
"str"
] | def deserialize(self, str):
"""
unpack serialized message in str into this message instance
:param str: byte array of serialized message, ``str``
"""
try:
if self.header is None:
self.header = std_msgs.msg.Header()
end = 0
_x = self
start = end
end += 12
(... | [
"def",
"deserialize",
"(",
"self",
",",
"str",
")",
":",
"try",
":",
"if",
"self",
".",
"header",
"is",
"None",
":",
"self",
".",
"header",
"=",
"std_msgs",
".",
"msg",
".",
"Header",
"(",
")",
"end",
"=",
"0",
"_x",
"=",
"self",
"start",
"=",
... | https://github.com/HKUST-Aerial-Robotics/Fast-Planner/blob/2ddd7793eecd573dbb5b47e2c985aa06606df3cf/uav_simulator/Utils/multi_map_server/quadrotor_msgs/src/quadrotor_msgs/msg/_PPROutputData.py#L148-L179 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/asyncio/events.py | python | AbstractEventLoop.create_datagram_endpoint | (self, protocol_factory,
local_addr=None, remote_addr=None, *,
family=0, proto=0, flags=0,
reuse_address=None, reuse_port=None,
allow_broadcast=None, sock=None) | A coroutine which creates a datagram endpoint.
This method will try to establish the endpoint in the background.
When successful, the coroutine returns a (transport, protocol) pair.
protocol_factory must be a callable returning a protocol instance.
socket family AF_INET, socket.AF_INE... | A coroutine which creates a datagram endpoint. | [
"A",
"coroutine",
"which",
"creates",
"a",
"datagram",
"endpoint",
"."
] | async def create_datagram_endpoint(self, protocol_factory,
local_addr=None, remote_addr=None, *,
family=0, proto=0, flags=0,
reuse_address=None, reuse_port=None,
al... | [
"async",
"def",
"create_datagram_endpoint",
"(",
"self",
",",
"protocol_factory",
",",
"local_addr",
"=",
"None",
",",
"remote_addr",
"=",
"None",
",",
"*",
",",
"family",
"=",
"0",
",",
"proto",
"=",
"0",
",",
"flags",
"=",
"0",
",",
"reuse_address",
"=... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/asyncio/events.py#L422-L455 | ||
microsoft/DirectXShaderCompiler | 8348ff8d9e0287610ba05d3a828e10af981a1c05 | utils/lint/common_lint.py | python | VerifyTabs | (filename, lines) | return lint | Checks to make sure the file has no tab characters.
Args:
filename: the file under consideration as string
lines: contents of the file as string array
Returns:
A list of tuples with format [(line_number, msg), ...] with any violations
found. | Checks to make sure the file has no tab characters. | [
"Checks",
"to",
"make",
"sure",
"the",
"file",
"has",
"no",
"tab",
"characters",
"."
] | def VerifyTabs(filename, lines):
"""Checks to make sure the file has no tab characters.
Args:
filename: the file under consideration as string
lines: contents of the file as string array
Returns:
A list of tuples with format [(line_number, msg), ...] with any violations
found.
"""
lint = []
... | [
"def",
"VerifyTabs",
"(",
"filename",
",",
"lines",
")",
":",
"lint",
"=",
"[",
"]",
"tab_re",
"=",
"re",
".",
"compile",
"(",
"r'\\t'",
")",
"line_num",
"=",
"1",
"for",
"line",
"in",
"lines",
":",
"if",
"tab_re",
".",
"match",
"(",
"line",
".",
... | https://github.com/microsoft/DirectXShaderCompiler/blob/8348ff8d9e0287610ba05d3a828e10af981a1c05/utils/lint/common_lint.py#L30-L48 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/signal/fir_filter_design.py | python | remez | (numtaps, bands, desired, weight=None, Hz=None, type='bandpass',
maxiter=25, grid_density=16, fs=None) | return sigtools._remez(numtaps, bands, desired, weight, tnum, fs,
maxiter, grid_density) | Calculate the minimax optimal filter using the Remez exchange algorithm.
Calculate the filter-coefficients for the finite impulse response
(FIR) filter whose transfer function minimizes the maximum error
between the desired gain and the realized gain in the specified
frequency bands using the Remez exc... | Calculate the minimax optimal filter using the Remez exchange algorithm. | [
"Calculate",
"the",
"minimax",
"optimal",
"filter",
"using",
"the",
"Remez",
"exchange",
"algorithm",
"."
] | def remez(numtaps, bands, desired, weight=None, Hz=None, type='bandpass',
maxiter=25, grid_density=16, fs=None):
"""
Calculate the minimax optimal filter using the Remez exchange algorithm.
Calculate the filter-coefficients for the finite impulse response
(FIR) filter whose transfer function ... | [
"def",
"remez",
"(",
"numtaps",
",",
"bands",
",",
"desired",
",",
"weight",
"=",
"None",
",",
"Hz",
"=",
"None",
",",
"type",
"=",
"'bandpass'",
",",
"maxiter",
"=",
"25",
",",
"grid_density",
"=",
"16",
",",
"fs",
"=",
"None",
")",
":",
"if",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/signal/fir_filter_design.py#L639-L749 | |
ValveSoftware/source-sdk-2013 | 0d8dceea4310fde5706b3ce1c70609d72a38efdf | sp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/message.py | python | Message.SetInParent | (self) | Mark this as present in the parent.
This normally happens automatically when you assign a field of a
sub-message, but sometimes you want to make the sub-message
present while keeping it empty. If you find yourself using this,
you may want to reconsider your design. | Mark this as present in the parent. | [
"Mark",
"this",
"as",
"present",
"in",
"the",
"parent",
"."
] | def SetInParent(self):
"""Mark this as present in the parent.
This normally happens automatically when you assign a field of a
sub-message, but sometimes you want to make the sub-message
present while keeping it empty. If you find yourself using this,
you may want to reconsider your design."""
... | [
"def",
"SetInParent",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/message.py#L111-L118 | ||
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/tkwidgets/Valuator.py | python | Valuator.setEntry | (self, value, fCommand = 1) | Update value displayed in entry, fCommand flag controls
command execution | Update value displayed in entry, fCommand flag controls
command execution | [
"Update",
"value",
"displayed",
"in",
"entry",
"fCommand",
"flag",
"controls",
"command",
"execution"
] | def setEntry(self, value, fCommand = 1):
"""
Update value displayed in entry, fCommand flag controls
command execution
"""
# Clamp value
if self['min'] is not None:
if value < self['min']:
value = self['min']
if self['max'] is not None:... | [
"def",
"setEntry",
"(",
"self",
",",
"value",
",",
"fCommand",
"=",
"1",
")",
":",
"# Clamp value",
"if",
"self",
"[",
"'min'",
"]",
"is",
"not",
"None",
":",
"if",
"value",
"<",
"self",
"[",
"'min'",
"]",
":",
"value",
"=",
"self",
"[",
"'min'",
... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/tkwidgets/Valuator.py#L186-L211 | ||
gklz1982/caffe-yolov2 | ebb27029db4ddc0d40e520634633b0fa9cdcc10d | scripts/cpp_lint.py | python | _NestingState.Update | (self, filename, clean_lines, linenum, error) | Update nesting state with current line.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Update nesting state with current line. | [
"Update",
"nesting",
"state",
"with",
"current",
"line",
"."
] | def Update(self, filename, clean_lines, linenum, error):
"""Update nesting state with current line.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any err... | [
"def",
"Update",
"(",
"self",
",",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Update pp_stack first",
"self",
".",
"UpdatePreprocessor",
"(",
"line",
")",
"# Coun... | https://github.com/gklz1982/caffe-yolov2/blob/ebb27029db4ddc0d40e520634633b0fa9cdcc10d/scripts/cpp_lint.py#L2004-L2158 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/stc.py | python | StyledTextCtrl.SetTabWidth | (*args, **kwargs) | return _stc.StyledTextCtrl_SetTabWidth(*args, **kwargs) | SetTabWidth(self, int tabWidth)
Change the visible size of a tab to be a multiple of the width of a space character. | SetTabWidth(self, int tabWidth) | [
"SetTabWidth",
"(",
"self",
"int",
"tabWidth",
")"
] | def SetTabWidth(*args, **kwargs):
"""
SetTabWidth(self, int tabWidth)
Change the visible size of a tab to be a multiple of the width of a space character.
"""
return _stc.StyledTextCtrl_SetTabWidth(*args, **kwargs) | [
"def",
"SetTabWidth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_SetTabWidth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/stc.py#L2304-L2310 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/learn/python/learn/monitors.py | python | ValidationMonitor.__init__ | (self, x=None, y=None, input_fn=None, batch_size=None,
eval_steps=None,
every_n_steps=100, metrics=None, early_stopping_rounds=None,
early_stopping_metric="loss",
early_stopping_metric_minimize=True, name=None) | Initializes a ValidationMonitor.
Args:
x: See `BaseEstimator.evaluate`.
y: See `BaseEstimator.evaluate`.
input_fn: See `BaseEstimator.evaluate`.
batch_size: See `BaseEstimator.evaluate`.
eval_steps: See `BaseEstimator.evaluate`.
every_n_steps: Check for new checkpoints to evalua... | Initializes a ValidationMonitor. | [
"Initializes",
"a",
"ValidationMonitor",
"."
] | def __init__(self, x=None, y=None, input_fn=None, batch_size=None,
eval_steps=None,
every_n_steps=100, metrics=None, early_stopping_rounds=None,
early_stopping_metric="loss",
early_stopping_metric_minimize=True, name=None):
"""Initializes a ValidationMonit... | [
"def",
"__init__",
"(",
"self",
",",
"x",
"=",
"None",
",",
"y",
"=",
"None",
",",
"input_fn",
"=",
"None",
",",
"batch_size",
"=",
"None",
",",
"eval_steps",
"=",
"None",
",",
"every_n_steps",
"=",
"100",
",",
"metrics",
"=",
"None",
",",
"early_sto... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/learn/python/learn/monitors.py#L624-L676 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/dtypes/cast.py | python | construct_1d_object_array_from_listlike | (values) | return result | Transform any list-like object in a 1-dimensional numpy array of object
dtype.
Parameters
----------
values : any iterable which has a len()
Raises
------
TypeError
* If `values` does not have a len()
Returns
-------
1-dimensional numpy array of dtype object | Transform any list-like object in a 1-dimensional numpy array of object
dtype. | [
"Transform",
"any",
"list",
"-",
"like",
"object",
"in",
"a",
"1",
"-",
"dimensional",
"numpy",
"array",
"of",
"object",
"dtype",
"."
] | def construct_1d_object_array_from_listlike(values):
"""
Transform any list-like object in a 1-dimensional numpy array of object
dtype.
Parameters
----------
values : any iterable which has a len()
Raises
------
TypeError
* If `values` does not have a len()
Returns
... | [
"def",
"construct_1d_object_array_from_listlike",
"(",
"values",
")",
":",
"# numpy will try to interpret nested lists as further dimensions, hence",
"# making a 1D array that contains list-likes is a bit tricky:",
"result",
"=",
"np",
".",
"empty",
"(",
"len",
"(",
"values",
")",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/dtypes/cast.py#L1458-L1480 | |
rootm0s/Protectors | 5b3f4d11687a5955caf9c3af30666c4bfc2c19ab | OWASP-ZSC/module/readline_windows/pyreadline/lineeditor/lineobj.py | python | ReadLineTextBuffer.backward_kill_word | (self) | Kills to next word ending | Kills to next word ending | [
"Kills",
"to",
"next",
"word",
"ending"
] | def backward_kill_word(self):
"""Kills to next word ending"""
if not self.delete_selection():
del self[PrevWordStart:Point]
self.selection_mark = -1 | [
"def",
"backward_kill_word",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"delete_selection",
"(",
")",
":",
"del",
"self",
"[",
"PrevWordStart",
":",
"Point",
"]",
"self",
".",
"selection_mark",
"=",
"-",
"1"
] | https://github.com/rootm0s/Protectors/blob/5b3f4d11687a5955caf9c3af30666c4bfc2c19ab/OWASP-ZSC/module/readline_windows/pyreadline/lineeditor/lineobj.py#L728-L732 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/control_flow_ops.py | python | ControlFlowState.GetGradState | (self, op, before) | return None | Return the grad state for this op if it's in a forward loop context. | Return the grad state for this op if it's in a forward loop context. | [
"Return",
"the",
"grad",
"state",
"for",
"this",
"op",
"if",
"it",
"s",
"in",
"a",
"forward",
"loop",
"context",
"."
] | def GetGradState(self, op, before):
"""Return the grad state for this op if it's in a forward loop context."""
if before and IsLoopExit(op):
forward_ctxt = op._get_control_flow_context()
forward_ctxt = forward_ctxt.outer_context
if forward_ctxt:
forward_ctxt = forward_ctxt.GetWhileCont... | [
"def",
"GetGradState",
"(",
"self",
",",
"op",
",",
"before",
")",
":",
"if",
"before",
"and",
"IsLoopExit",
"(",
"op",
")",
":",
"forward_ctxt",
"=",
"op",
".",
"_get_control_flow_context",
"(",
")",
"forward_ctxt",
"=",
"forward_ctxt",
".",
"outer_context"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/control_flow_ops.py#L1043-L1054 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | Bitmap.GetMask | (*args, **kwargs) | return _gdi_.Bitmap_GetMask(*args, **kwargs) | GetMask(self) -> Mask
Gets the associated mask (if any) which may have been loaded from a
file or explpicitly set for the bitmap.
:see: `SetMask`, `wx.Mask` | GetMask(self) -> Mask | [
"GetMask",
"(",
"self",
")",
"-",
">",
"Mask"
] | def GetMask(*args, **kwargs):
"""
GetMask(self) -> Mask
Gets the associated mask (if any) which may have been loaded from a
file or explpicitly set for the bitmap.
:see: `SetMask`, `wx.Mask`
"""
return _gdi_.Bitmap_GetMask(*args, **kwargs) | [
"def",
"GetMask",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Bitmap_GetMask",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L686-L696 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TIntIntVV.Del | (self, *args) | return _snap.TIntIntVV_Del(self, *args) | Del(TIntIntVV self, int const & ValN)
Parameters:
ValN: int const &
Del(TIntIntVV self, int const & MnValN, int const & MxValN)
Parameters:
MnValN: int const &
MxValN: int const & | Del(TIntIntVV self, int const & ValN) | [
"Del",
"(",
"TIntIntVV",
"self",
"int",
"const",
"&",
"ValN",
")"
] | def Del(self, *args):
"""
Del(TIntIntVV self, int const & ValN)
Parameters:
ValN: int const &
Del(TIntIntVV self, int const & MnValN, int const & MxValN)
Parameters:
MnValN: int const &
MxValN: int const &
"""
return _snap.T... | [
"def",
"Del",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TIntIntVV_Del",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L16956-L16970 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/third_party/mlir/utils/spirv/gen_spirv_dialect.py | python | get_op_definition | (instruction, doc, existing_info) | return fmt_str.format(
opname=opname,
traits=existing_info.get('traits', ''),
summary=summary,
description=description,
assembly=assembly,
args=arguments,
results=results,
extras=existing_info.get('extras', '')) | Generates the TableGen op definition for the given SPIR-V instruction.
Arguments:
- instruction: the instruction's SPIR-V JSON grammar
- doc: the instruction's SPIR-V HTML doc
- existing_info: a dict containing potential manually specified sections for
this instruction
Returns:
- A string co... | Generates the TableGen op definition for the given SPIR-V instruction. | [
"Generates",
"the",
"TableGen",
"op",
"definition",
"for",
"the",
"given",
"SPIR",
"-",
"V",
"instruction",
"."
] | def get_op_definition(instruction, doc, existing_info):
"""Generates the TableGen op definition for the given SPIR-V instruction.
Arguments:
- instruction: the instruction's SPIR-V JSON grammar
- doc: the instruction's SPIR-V HTML doc
- existing_info: a dict containing potential manually specified sect... | [
"def",
"get_op_definition",
"(",
"instruction",
",",
"doc",
",",
"existing_info",
")",
":",
"fmt_str",
"=",
"'def SPV_{opname}Op : SPV_Op<\"{opname}\", [{traits}]> {{\\n'",
"' let summary = {summary};\\n\\n'",
"' let description = [{{\\n'",
"'{description}\\n\\n'",
"' ### Custom... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/third_party/mlir/utils/spirv/gen_spirv_dialect.py#L363-L447 | |
p4lang/p4c | 3272e79369f20813cc1a555a5eb26f44432f84a4 | tools/cpplint.py | python | CheckMissingOverrideOrFinal | (filename, clean_lines, linenum, nesting_state, error) | Check if a line is missing a required "override" or "final" virt-specifier.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
nesting_state: The _NestingState object that contains info about our state.
... | Check if a line is missing a required "override" or "final" virt-specifier. | [
"Check",
"if",
"a",
"line",
"is",
"missing",
"a",
"required",
"override",
"or",
"final",
"virt",
"-",
"specifier",
"."
] | def CheckMissingOverrideOrFinal(filename, clean_lines, linenum, nesting_state, error):
"""Check if a line is missing a required "override" or "final" virt-specifier.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line ... | [
"def",
"CheckMissingOverrideOrFinal",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"if",
"not",
"nesting_state",
".",
"InClassDeclaration",
"(",
")",
":",
"return",
"line",
"=",
"clean_lines",
".",
"elided",
... | https://github.com/p4lang/p4c/blob/3272e79369f20813cc1a555a5eb26f44432f84a4/tools/cpplint.py#L6249-L6271 | ||
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_cpp.py | python | add_impl | (code) | Adds code to the current implementation context. | Adds code to the current implementation context. | [
"Adds",
"code",
"to",
"the",
"current",
"implementation",
"context",
"."
] | def add_impl(code):
""" Adds code to the current implementation context. """
context.impls.write(code) | [
"def",
"add_impl",
"(",
"code",
")",
":",
"context",
".",
"impls",
".",
"write",
"(",
"code",
")"
] | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_cpp.py#L121-L123 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/lookup_ops.py | python | TableInitializerBase.initialize | (self, table) | Returns the table initialization op. | Returns the table initialization op. | [
"Returns",
"the",
"table",
"initialization",
"op",
"."
] | def initialize(self, table):
"""Returns the table initialization op."""
raise NotImplementedError | [
"def",
"initialize",
"(",
"self",
",",
"table",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/lookup_ops.py#L398-L400 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/optimize/_lsq/common.py | python | step_size_to_bound | (x, s, lb, ub) | return min_step, np.equal(steps, min_step) * np.sign(s).astype(int) | Compute a min_step size required to reach a bound.
The function computes a positive scalar t, such that x + s * t is on
the bound.
Returns
-------
step : float
Computed step. Non-negative value.
hits : ndarray of int with shape of x
Each element indicates whether a corr... | Compute a min_step size required to reach a bound.
The function computes a positive scalar t, such that x + s * t is on
the bound.
Returns
-------
step : float
Computed step. Non-negative value.
hits : ndarray of int with shape of x
Each element indicates whether a corr... | [
"Compute",
"a",
"min_step",
"size",
"required",
"to",
"reach",
"a",
"bound",
".",
"The",
"function",
"computes",
"a",
"positive",
"scalar",
"t",
"such",
"that",
"x",
"+",
"s",
"*",
"t",
"is",
"on",
"the",
"bound",
".",
"Returns",
"-------",
"step",
":"... | def step_size_to_bound(x, s, lb, ub):
"""Compute a min_step size required to reach a bound.
The function computes a positive scalar t, such that x + s * t is on
the bound.
Returns
-------
step : float
Computed step. Non-negative value.
hits : ndarray of int with shape of x
... | [
"def",
"step_size_to_bound",
"(",
"x",
",",
"s",
",",
"lb",
",",
"ub",
")",
":",
"non_zero",
"=",
"np",
".",
"nonzero",
"(",
"s",
")",
"s_non_zero",
"=",
"s",
"[",
"non_zero",
"]",
"steps",
"=",
"np",
".",
"empty_like",
"(",
"x",
")",
"steps",
".... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/optimize/_lsq/common.py#L373-L399 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/oldnumeric/ma.py | python | MaskedArray.__imul__ | (self, other) | return self | Add other to self in place. | Add other to self in place. | [
"Add",
"other",
"to",
"self",
"in",
"place",
"."
] | def __imul__(self, other):
"Add other to self in place."
t = self._data.dtype.char
f = filled(other, 0)
t1 = f.dtype.char
if t == t1:
pass
elif t in typecodes['Integer']:
if t1 in typecodes['Integer']:
f = f.astype(t)
el... | [
"def",
"__imul__",
"(",
"self",
",",
"other",
")",
":",
"t",
"=",
"self",
".",
"_data",
".",
"dtype",
".",
"char",
"f",
"=",
"filled",
"(",
"other",
",",
"0",
")",
"t1",
"=",
"f",
".",
"dtype",
".",
"char",
"if",
"t",
"==",
"t1",
":",
"pass",... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/oldnumeric/ma.py#L1008-L1049 | |
PlatformLab/RAMCloud | b1866af19124325a6dfd8cbc267e2e3ef1f965d1 | scripts/clusterperf.py | python | print_rcdf_from_log | (
index = 1 # Client index (1 for first client,
# which is usually the one that's wanted)
) | Given the index of a client, print in gnuplot format a reverse cumulative
distribution of the data in the client's log file (where "data" consists
of comma-separated numbers stored in all of the lines of the log file
that are not RAMCloud log messages). Each line in the printed output
will contain a fra... | Given the index of a client, print in gnuplot format a reverse cumulative
distribution of the data in the client's log file (where "data" consists
of comma-separated numbers stored in all of the lines of the log file
that are not RAMCloud log messages). Each line in the printed output
will contain a fra... | [
"Given",
"the",
"index",
"of",
"a",
"client",
"print",
"in",
"gnuplot",
"format",
"a",
"reverse",
"cumulative",
"distribution",
"of",
"the",
"data",
"in",
"the",
"client",
"s",
"log",
"file",
"(",
"where",
"data",
"consists",
"of",
"comma",
"-",
"separated... | def print_rcdf_from_log(
index = 1 # Client index (1 for first client,
# which is usually the one that's wanted)
):
"""
Given the index of a client, print in gnuplot format a reverse cumulative
distribution of the data in the client's log fil... | [
"def",
"print_rcdf_from_log",
"(",
"index",
"=",
"1",
"# Client index (1 for first client,",
"# which is usually the one that's wanted)",
")",
":",
"# Read the log file into an array of numbers.",
"numbers",
"=",
"[",
"]",
"globResult",
"=",
"glob",
".",
"glob",
"(",
"'%s/l... | https://github.com/PlatformLab/RAMCloud/blob/b1866af19124325a6dfd8cbc267e2e3ef1f965d1/scripts/clusterperf.py#L206-L244 | ||
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Node/__init__.py | python | Node.get_binfo | (self) | return binfo | Fetch a node's build information.
node - the node whose sources will be collected
cache - alternate node to use for the signature cache
returns - the build signature
This no longer handles the recursive descent of the
node's children's signatures. We expect that they're
... | Fetch a node's build information. | [
"Fetch",
"a",
"node",
"s",
"build",
"information",
"."
] | def get_binfo(self):
"""
Fetch a node's build information.
node - the node whose sources will be collected
cache - alternate node to use for the signature cache
returns - the build signature
This no longer handles the recursive descent of the
node's children's s... | [
"def",
"get_binfo",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"binfo",
"except",
"AttributeError",
":",
"pass",
"binfo",
"=",
"self",
".",
"new_binfo",
"(",
")",
"self",
".",
"binfo",
"=",
"binfo",
"executor",
"=",
"self",
".",
"get_exe... | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Node/__init__.py#L1144-L1194 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | schemaNewMemParserCtxt | (buffer, size) | return SchemaParserCtxt(_obj=ret) | Create an XML Schemas parse context for that memory buffer
expected to contain an XML Schemas file. | Create an XML Schemas parse context for that memory buffer
expected to contain an XML Schemas file. | [
"Create",
"an",
"XML",
"Schemas",
"parse",
"context",
"for",
"that",
"memory",
"buffer",
"expected",
"to",
"contain",
"an",
"XML",
"Schemas",
"file",
"."
] | def schemaNewMemParserCtxt(buffer, size):
"""Create an XML Schemas parse context for that memory buffer
expected to contain an XML Schemas file. """
ret = libxml2mod.xmlSchemaNewMemParserCtxt(buffer, size)
if ret is None:raise parserError('xmlSchemaNewMemParserCtxt() failed')
return SchemaParserC... | [
"def",
"schemaNewMemParserCtxt",
"(",
"buffer",
",",
"size",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlSchemaNewMemParserCtxt",
"(",
"buffer",
",",
"size",
")",
"if",
"ret",
"is",
"None",
":",
"raise",
"parserError",
"(",
"'xmlSchemaNewMemParserCtxt() failed'",... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L1208-L1213 | |
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/share/psi4/fsapt/fsapt.py | python | read_d3_fragments | (dirname: Optional[str] = '.') | return frags | Creates a dictionary of fragments from fsapt fragment files for post-analysis
Arguments
---------
dirname : Optional[str]
Path to directory containing F-SAPT fragment files
Default: '.'
Returns
-------
frags : Dict[str, Dict[str, List[int]]]
Dictionary of dictionaries w... | Creates a dictionary of fragments from fsapt fragment files for post-analysis | [
"Creates",
"a",
"dictionary",
"of",
"fragments",
"from",
"fsapt",
"fragment",
"files",
"for",
"post",
"-",
"analysis"
] | def read_d3_fragments(dirname: Optional[str] = '.') -> Dict[str, Dict[str, List[int]]]:
"""Creates a dictionary of fragments from fsapt fragment files for post-analysis
Arguments
---------
dirname : Optional[str]
Path to directory containing F-SAPT fragment files
Default: '.'
Retur... | [
"def",
"read_d3_fragments",
"(",
"dirname",
":",
"Optional",
"[",
"str",
"]",
"=",
"'.'",
")",
"->",
"Dict",
"[",
"str",
",",
"Dict",
"[",
"str",
",",
"List",
"[",
"int",
"]",
"]",
"]",
":",
"frags",
"=",
"{",
"'A'",
":",
"{",
"}",
",",
"'B'",
... | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/share/psi4/fsapt/fsapt.py#L172-L202 | |
stan-dev/math | 5fd79f89933269a4ca4d8dd1fde2a36d53d4768c | lib/cpplint_1.4.5/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/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/lib/cpplint_1.4.5/cpplint.py#L1401-L1403 | |
lballabio/quantlib-old | 136336947ed4fea9ecc1da6edad188700e821739 | gensrc/gensrc/addins/guile.py | python | GuileAddin.generateFunctions | (self) | Generate source for function implementations. | Generate source for function implementations. | [
"Generate",
"source",
"for",
"function",
"implementations",
"."
] | def generateFunctions(self):
"""Generate source for function implementations."""
for cat in self.categoryList_.categories(self.name_):
self.generateFuncHeaders(cat)
code = ''
for func in cat.functions(self.name_):
code += GuileAddin.BUF_HEADER % (func... | [
"def",
"generateFunctions",
"(",
"self",
")",
":",
"for",
"cat",
"in",
"self",
".",
"categoryList_",
".",
"categories",
"(",
"self",
".",
"name_",
")",
":",
"self",
".",
"generateFuncHeaders",
"(",
"cat",
")",
"code",
"=",
"''",
"for",
"func",
"in",
"c... | https://github.com/lballabio/quantlib-old/blob/136336947ed4fea9ecc1da6edad188700e821739/gensrc/gensrc/addins/guile.py#L101-L116 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/arrayobj.py | python | fancy_setslice | (context, builder, sig, args, index_types, indices) | return context.get_dummy_value() | Implement slice assignment for arrays. This implementation works for
basic as well as fancy indexing, since there's no functional difference
between the two for indexed assignment. | Implement slice assignment for arrays. This implementation works for
basic as well as fancy indexing, since there's no functional difference
between the two for indexed assignment. | [
"Implement",
"slice",
"assignment",
"for",
"arrays",
".",
"This",
"implementation",
"works",
"for",
"basic",
"as",
"well",
"as",
"fancy",
"indexing",
"since",
"there",
"s",
"no",
"functional",
"difference",
"between",
"the",
"two",
"for",
"indexed",
"assignment"... | def fancy_setslice(context, builder, sig, args, index_types, indices):
"""
Implement slice assignment for arrays. This implementation works for
basic as well as fancy indexing, since there's no functional difference
between the two for indexed assignment.
"""
aryty, _, srcty = sig.args
ary,... | [
"def",
"fancy_setslice",
"(",
"context",
",",
"builder",
",",
"sig",
",",
"args",
",",
"index_types",
",",
"indices",
")",
":",
"aryty",
",",
"_",
",",
"srcty",
"=",
"sig",
".",
"args",
"ary",
",",
"_",
",",
"src",
"=",
"args",
"ary",
"=",
"make_ar... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/arrayobj.py#L1292-L1411 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/pnorm.py | python | Pnorm.numeric | (self, values) | return np.linalg.norm(values, float(self.p), axis=self.axis,
keepdims=self.keepdims) | Returns the p-norm of x. | Returns the p-norm of x. | [
"Returns",
"the",
"p",
"-",
"norm",
"of",
"x",
"."
] | def numeric(self, values):
"""Returns the p-norm of x.
"""
if self.axis is None:
values = np.array(values[0]).flatten()
else:
values = np.array(values[0])
if self.p < 1 and np.any(values < 0):
return -np.inf
if self.p < 0 and np.any(v... | [
"def",
"numeric",
"(",
"self",
",",
"values",
")",
":",
"if",
"self",
".",
"axis",
"is",
"None",
":",
"values",
"=",
"np",
".",
"array",
"(",
"values",
"[",
"0",
"]",
")",
".",
"flatten",
"(",
")",
"else",
":",
"values",
"=",
"np",
".",
"array"... | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/pnorm.py#L141-L156 | |
freesurfer/freesurfer | 6dbe527d43ffa611acb2cd112e9469f9bfec8e36 | cnn_sphere_register/ext/neuron/neuron/models.py | python | design_dnn | (nb_features, input_shape, nb_levels, conv_size, nb_labels,
feat_mult=1,
pool_size=2,
padding='same',
activation='elu',
final_layer='dense-sigmoid',
conv_dropout=0,
conv_maxnorm=0,
nb_input_features=1... | return model | "deep" cnn with dense or global max pooling layer @ end...
Could use sequential... | "deep" cnn with dense or global max pooling layer @ end... | [
"deep",
"cnn",
"with",
"dense",
"or",
"global",
"max",
"pooling",
"layer",
"@",
"end",
"..."
] | def design_dnn(nb_features, input_shape, nb_levels, conv_size, nb_labels,
feat_mult=1,
pool_size=2,
padding='same',
activation='elu',
final_layer='dense-sigmoid',
conv_dropout=0,
conv_maxnorm=0,
nb_in... | [
"def",
"design_dnn",
"(",
"nb_features",
",",
"input_shape",
",",
"nb_levels",
",",
"conv_size",
",",
"nb_labels",
",",
"feat_mult",
"=",
"1",
",",
"pool_size",
"=",
"2",
",",
"padding",
"=",
"'same'",
",",
"activation",
"=",
"'elu'",
",",
"final_layer",
"... | https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/cnn_sphere_register/ext/neuron/neuron/models.py#L798-L945 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/task_generation/task_types/multiversion_decorator.py | python | MultiversionGenTaskDecorator.decorate_tasks_with_dynamically_generated_files | (
self, sub_tasks: Set[Task], params: MultiversionDecoratorParams) | return decorated_tasks | Make multiversion subtasks based on generated subtasks, for tasks with generated files. E.g. fuzzers.
@param sub_tasks: set of existing sub-tasks to be converted to multiversion.
@param params: decoration parameters.
@return: Set of multiversion tasks. | Make multiversion subtasks based on generated subtasks, for tasks with generated files. E.g. fuzzers. | [
"Make",
"multiversion",
"subtasks",
"based",
"on",
"generated",
"subtasks",
"for",
"tasks",
"with",
"generated",
"files",
".",
"E",
".",
"g",
".",
"fuzzers",
"."
] | def decorate_tasks_with_dynamically_generated_files(
self, sub_tasks: Set[Task], params: MultiversionDecoratorParams) -> Set[Task]:
"""
Make multiversion subtasks based on generated subtasks, for tasks with generated files. E.g. fuzzers.
@param sub_tasks: set of existing sub-tasks t... | [
"def",
"decorate_tasks_with_dynamically_generated_files",
"(",
"self",
",",
"sub_tasks",
":",
"Set",
"[",
"Task",
"]",
",",
"params",
":",
"MultiversionDecoratorParams",
")",
"->",
"Set",
"[",
"Task",
"]",
":",
"fixture_type",
"=",
"self",
".",
"_get_suite_fixture... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/task_generation/task_types/multiversion_decorator.py#L48-L75 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/frame.py | python | DataFrame.combine_first | (self, other) | return self.combine(other, combiner, overwrite=False) | Update null elements with value in the same location in `other`.
Combine two DataFrame objects by filling null values in one DataFrame
with non-null values from other DataFrame. The row and column indexes
of the resulting DataFrame will be the union of the two.
Parameters
-----... | Update null elements with value in the same location in `other`. | [
"Update",
"null",
"elements",
"with",
"value",
"in",
"the",
"same",
"location",
"in",
"other",
"."
] | def combine_first(self, other):
"""
Update null elements with value in the same location in `other`.
Combine two DataFrame objects by filling null values in one DataFrame
with non-null values from other DataFrame. The row and column indexes
of the resulting DataFrame will be the... | [
"def",
"combine_first",
"(",
"self",
",",
"other",
")",
":",
"import",
"pandas",
".",
"core",
".",
"computation",
".",
"expressions",
"as",
"expressions",
"def",
"extract_values",
"(",
"arr",
")",
":",
"# Does two things:",
"# 1. maybe gets the values from the Serie... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/frame.py#L5290-L5364 | |
lammps/lammps | b75c3065430a75b1b5543a10e10f46d9b4c91913 | python/lammps/pylammps.py | python | PyLammps.atoms | (self) | return AtomList(self) | All atoms of this LAMMPS instance
:getter: Returns a list of atoms currently in the system
:type: AtomList | All atoms of this LAMMPS instance | [
"All",
"atoms",
"of",
"this",
"LAMMPS",
"instance"
] | def atoms(self):
"""
All atoms of this LAMMPS instance
:getter: Returns a list of atoms currently in the system
:type: AtomList
"""
return AtomList(self) | [
"def",
"atoms",
"(",
"self",
")",
":",
"return",
"AtomList",
"(",
"self",
")"
] | https://github.com/lammps/lammps/blob/b75c3065430a75b1b5543a10e10f46d9b4c91913/python/lammps/pylammps.py#L598-L605 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/botocore/credentials.py | python | EnvProvider.__init__ | (self, environ=None, mapping=None) | :param environ: The environment variables (defaults to
``os.environ`` if no value is provided).
:param mapping: An optional mapping of variable names to
environment variable names. Use this if you want to
change the mapping of access_key->AWS_ACCESS_KEY_ID, etc.
... | [] | def __init__(self, environ=None, mapping=None):
"""
:param environ: The environment variables (defaults to
``os.environ`` if no value is provided).
:param mapping: An optional mapping of variable names to
environment variable names. Use this if you want to
c... | [
"def",
"__init__",
"(",
"self",
",",
"environ",
"=",
"None",
",",
"mapping",
"=",
"None",
")",
":",
"if",
"environ",
"is",
"None",
":",
"environ",
"=",
"os",
".",
"environ",
"self",
".",
"environ",
"=",
"environ",
"self",
".",
"_mapping",
"=",
"self"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/botocore/credentials.py#L1027-L1041 | |||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/mac/tweak_info_plist.py | python | _AddVersionKeys | (plist, version=None) | return True | Adds the product version number into the plist. Returns True on success and
False on error. The error will be printed to stderr. | Adds the product version number into the plist. Returns True on success and
False on error. The error will be printed to stderr. | [
"Adds",
"the",
"product",
"version",
"number",
"into",
"the",
"plist",
".",
"Returns",
"True",
"on",
"success",
"and",
"False",
"on",
"error",
".",
"The",
"error",
"will",
"be",
"printed",
"to",
"stderr",
"."
] | def _AddVersionKeys(plist, version=None):
"""Adds the product version number into the plist. Returns True on success and
False on error. The error will be printed to stderr."""
if version:
match = re.match('\d+\.\d+\.(\d+\.\d+)$', version)
if not match:
print >>sys.stderr, 'Invalid version string sp... | [
"def",
"_AddVersionKeys",
"(",
"plist",
",",
"version",
"=",
"None",
")",
":",
"if",
"version",
":",
"match",
"=",
"re",
".",
"match",
"(",
"'\\d+\\.\\d+\\.(\\d+\\.\\d+)$'",
",",
"version",
")",
"if",
"not",
"match",
":",
"print",
">>",
"sys",
".",
"stde... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/mac/tweak_info_plist.py#L65-L108 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/partitioned_variables.py | python | min_max_variable_partitioner | (max_partitions=1, axis=0,
min_slice_size=256 << 10,
bytes_per_string_element=16) | return _partitioner | Partitioner to allocate minimum size per slice.
Returns a partitioner that partitions the variable of given shape and dtype
such that each partition has a minimum of `min_slice_size` slice of the
variable. The maximum number of such partitions (upper bound) is given by
`max_partitions`.
Args:
max_partit... | Partitioner to allocate minimum size per slice. | [
"Partitioner",
"to",
"allocate",
"minimum",
"size",
"per",
"slice",
"."
] | def min_max_variable_partitioner(max_partitions=1, axis=0,
min_slice_size=256 << 10,
bytes_per_string_element=16):
"""Partitioner to allocate minimum size per slice.
Returns a partitioner that partitions the variable of given shape and dtype
such ... | [
"def",
"min_max_variable_partitioner",
"(",
"max_partitions",
"=",
"1",
",",
"axis",
"=",
"0",
",",
"min_slice_size",
"=",
"256",
"<<",
"10",
",",
"bytes_per_string_element",
"=",
"16",
")",
":",
"def",
"_partitioner",
"(",
"shape",
",",
"dtype",
")",
":",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/partitioned_variables.py#L154-L214 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/Explorer/Microsoft_Internet_Explorer.py | python | Microsoft_Internet_Explorer_Events.do_script | (self, _object, _attributes={}, **_arguments) | do script: Execute script commands
Required argument: JavaScript text to execute
Keyword argument window: optional Window Identifier (as supplied by the ListWindows event) specifying context in which to execute the script
Keyword argument _attributes: AppleEvent attribute dictionary
Retu... | do script: Execute script commands
Required argument: JavaScript text to execute
Keyword argument window: optional Window Identifier (as supplied by the ListWindows event) specifying context in which to execute the script
Keyword argument _attributes: AppleEvent attribute dictionary
Retu... | [
"do",
"script",
":",
"Execute",
"script",
"commands",
"Required",
"argument",
":",
"JavaScript",
"text",
"to",
"execute",
"Keyword",
"argument",
"window",
":",
"optional",
"Window",
"Identifier",
"(",
"as",
"supplied",
"by",
"the",
"ListWindows",
"event",
")",
... | def do_script(self, _object, _attributes={}, **_arguments):
"""do script: Execute script commands
Required argument: JavaScript text to execute
Keyword argument window: optional Window Identifier (as supplied by the ListWindows event) specifying context in which to execute the script
Key... | [
"def",
"do_script",
"(",
"self",
",",
"_object",
",",
"_attributes",
"=",
"{",
"}",
",",
"*",
"*",
"_arguments",
")",
":",
"_code",
"=",
"'misc'",
"_subcode",
"=",
"'dosc'",
"aetools",
".",
"keysubst",
"(",
"_arguments",
",",
"self",
".",
"_argmap_do_scr... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/Explorer/Microsoft_Internet_Explorer.py#L60-L80 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/core/numerictypes.py | python | issubdtype | (arg1, arg2) | return issubclass(dtype(arg1).type, val) | Returns True if first argument is a typecode lower/equal in type hierarchy.
Parameters
----------
arg1, arg2 : dtype_like
dtype or string representing a typecode.
Returns
-------
out : bool
See Also
--------
issubsctype, issubclass_
numpy.core.numerictypes : Overview o... | Returns True if first argument is a typecode lower/equal in type hierarchy. | [
"Returns",
"True",
"if",
"first",
"argument",
"is",
"a",
"typecode",
"lower",
"/",
"equal",
"in",
"type",
"hierarchy",
"."
] | def issubdtype(arg1, arg2):
"""
Returns True if first argument is a typecode lower/equal in type hierarchy.
Parameters
----------
arg1, arg2 : dtype_like
dtype or string representing a typecode.
Returns
-------
out : bool
See Also
--------
issubsctype, issubclass_
... | [
"def",
"issubdtype",
"(",
"arg1",
",",
"arg2",
")",
":",
"if",
"issubclass_",
"(",
"arg2",
",",
"generic",
")",
":",
"return",
"issubclass",
"(",
"dtype",
"(",
"arg1",
")",
".",
"type",
",",
"arg2",
")",
"mro",
"=",
"dtype",
"(",
"arg2",
")",
".",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/core/numerictypes.py#L735-L768 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/distutils/fcompiler/gnu.py | python | GnuFCompiler.gnu_version_match | (self, version_string) | Handle the different versions of GNU fortran compilers | Handle the different versions of GNU fortran compilers | [
"Handle",
"the",
"different",
"versions",
"of",
"GNU",
"fortran",
"compilers"
] | def gnu_version_match(self, version_string):
"""Handle the different versions of GNU fortran compilers"""
m = re.search(r'GNU Fortran', version_string)
if not m:
return None
m = re.search(r'GNU Fortran\s+95.*?([0-9-.]+)', version_string)
if m:
return ('gfo... | [
"def",
"gnu_version_match",
"(",
"self",
",",
"version_string",
")",
":",
"m",
"=",
"re",
".",
"search",
"(",
"r'GNU Fortran'",
",",
"version_string",
")",
"if",
"not",
"m",
":",
"return",
"None",
"m",
"=",
"re",
".",
"search",
"(",
"r'GNU Fortran\\s+95.*?... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/distutils/fcompiler/gnu.py#L36-L53 | ||
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | IsBlankLine | (line) | return not line or line.isspace() | Returns true if the given line is blank.
We consider a line to be blank if the line is empty or consists of
only white spaces.
Args:
line: A line of a string.
Returns:
True, if the given line is blank. | Returns true if the given line is blank. | [
"Returns",
"true",
"if",
"the",
"given",
"line",
"is",
"blank",
"."
] | def IsBlankLine(line):
"""Returns true if the given line is blank.
We consider a line to be blank if the line is empty or consists of
only white spaces.
Args:
line: A line of a string.
Returns:
True, if the given line is blank.
"""
return not line or line.isspace() | [
"def",
"IsBlankLine",
"(",
"line",
")",
":",
"return",
"not",
"line",
"or",
"line",
".",
"isspace",
"(",
")"
] | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L3017-L3029 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/sparse_ops.py | python | sparse_dense_cwise_add | (sp_t, dense_t) | return sparse_tensor.SparseTensor(sp_t.indices, result, sp_t.dense_shape) | Adds up a SparseTensor and a dense Tensor, using these special rules:
(1) Broadcasts the dense side to have the same shape as the sparse side, if
eligible;
(2) Then, only the dense values pointed to by the indices of the SparseTensor
participate in the cwise addition.
By the rules, the result is a l... | Adds up a SparseTensor and a dense Tensor, using these special rules: | [
"Adds",
"up",
"a",
"SparseTensor",
"and",
"a",
"dense",
"Tensor",
"using",
"these",
"special",
"rules",
":"
] | def sparse_dense_cwise_add(sp_t, dense_t):
"""Adds up a SparseTensor and a dense Tensor, using these special rules:
(1) Broadcasts the dense side to have the same shape as the sparse side, if
eligible;
(2) Then, only the dense values pointed to by the indices of the SparseTensor
participate in the cw... | [
"def",
"sparse_dense_cwise_add",
"(",
"sp_t",
",",
"dense_t",
")",
":",
"result",
"=",
"gen_sparse_ops",
".",
"sparse_dense_cwise_add",
"(",
"sp_t",
".",
"indices",
",",
"sp_t",
".",
"values",
",",
"sp_t",
".",
"dense_shape",
",",
"dense_t",
")",
"return",
"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/sparse_ops.py#L441-L463 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/imp.py | python | find_module | (name, path=None) | return file, file_path, (suffix, mode, type_) | **DEPRECATED**
Search for a module.
If path is omitted or None, search for a built-in, frozen or special
module and continue search in sys.path. The module name cannot
contain '.'; to search for a submodule of a package, pass the
submodule name and the package's __path__. | **DEPRECATED** | [
"**",
"DEPRECATED",
"**"
] | def find_module(name, path=None):
"""**DEPRECATED**
Search for a module.
If path is omitted or None, search for a built-in, frozen or special
module and continue search in sys.path. The module name cannot
contain '.'; to search for a submodule of a package, pass the
submodule name and the pack... | [
"def",
"find_module",
"(",
"name",
",",
"path",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"name",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"\"'name' must be a str, not {}\"",
".",
"format",
"(",
"type",
"(",
"name",
")",
")",
")",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/imp.py#L254-L303 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/timeseries/python/timeseries/input_pipeline.py | python | ReaderBaseTimeSeriesParser._process_records | (self, lines) | Given string items, return a processed dictionary of Tensors.
Args:
lines: A 1-dimensional string Tensor, each representing a record to parse
(source dependent, e.g. a line of a file, or a serialized protocol
buffer).
Returns:
A dictionary mapping feature names to their values. The... | Given string items, return a processed dictionary of Tensors. | [
"Given",
"string",
"items",
"return",
"a",
"processed",
"dictionary",
"of",
"Tensors",
"."
] | def _process_records(self, lines):
"""Given string items, return a processed dictionary of Tensors.
Args:
lines: A 1-dimensional string Tensor, each representing a record to parse
(source dependent, e.g. a line of a file, or a serialized protocol
buffer).
Returns:
A dictionary ... | [
"def",
"_process_records",
"(",
"self",
",",
"lines",
")",
":",
"pass"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/timeseries/python/timeseries/input_pipeline.py#L304-L316 | ||
NeoGeographyToolkit/StereoPipeline | eedf54a919fb5cce1ab0e280bb0df4050763aa11 | src/asp/Tools/crs2crs2grid.py | python | read_grid_crs_to_crs | (input_filename, output_filename, shape) | return grid | Read through the input/output files together to get data for
the output grid. | Read through the input/output files together to get data for
the output grid. | [
"Read",
"through",
"the",
"input",
"/",
"output",
"files",
"together",
"to",
"get",
"data",
"for",
"the",
"output",
"grid",
"."
] | def read_grid_crs_to_crs(input_filename, output_filename, shape):
'''Read through the input/output files together to get data for
the output grid.'''
fd_in = open(input_filename )
fd_out = open(output_filename)
grid = numpy.zeros(shape)
# Read/skip the output file header defining the tra... | [
"def",
"read_grid_crs_to_crs",
"(",
"input_filename",
",",
"output_filename",
",",
"shape",
")",
":",
"fd_in",
"=",
"open",
"(",
"input_filename",
")",
"fd_out",
"=",
"open",
"(",
"output_filename",
")",
"grid",
"=",
"numpy",
".",
"zeros",
"(",
"shape",
")",... | https://github.com/NeoGeographyToolkit/StereoPipeline/blob/eedf54a919fb5cce1ab0e280bb0df4050763aa11/src/asp/Tools/crs2crs2grid.py#L99-L138 | |
francinexue/xuefu | b6ff79747a42e020588c0c0a921048e08fe4680c | ctpx/ctp3/ctptd.py | python | CtpTd.onRspSettlementInfoConfirm | (self, SettlementInfoConfirmField, RspInfoField, requestId, final) | 投资者结算结果确认响应 | 投资者结算结果确认响应 | [
"投资者结算结果确认响应"
] | def onRspSettlementInfoConfirm(self, SettlementInfoConfirmField, RspInfoField, requestId, final):
"""投资者结算结果确认响应"""
logger.debug(u"onRspSettlementInfoConfirm --- brokerID:{0}, investorID:{1},confirmDate:{2},confirmTime:{3}.".format(
SettlementInfoConfirmField.brokerID, SettlementInfoConfirmF... | [
"def",
"onRspSettlementInfoConfirm",
"(",
"self",
",",
"SettlementInfoConfirmField",
",",
"RspInfoField",
",",
"requestId",
",",
"final",
")",
":",
"logger",
".",
"debug",
"(",
"u\"onRspSettlementInfoConfirm --- brokerID:{0}, investorID:{1},confirmDate:{2},confirmTime:{3}.\".for"... | https://github.com/francinexue/xuefu/blob/b6ff79747a42e020588c0c0a921048e08fe4680c/ctpx/ctp3/ctptd.py#L128-L134 | ||
ot/ds2i | 2cf8237f638f45da0b25caebd2b3c1fbfebf9149 | ext/baker.py | python | Baker.writeconfig | (self, iniconffile=sys.argv[0] + ".ini") | OVERWRITE an ini style config file that holds all of the default
command line options.
:param iniconffile: the file name of the ini file, defaults to
'{scriptname}.ini'. | OVERWRITE an ini style config file that holds all of the default
command line options. | [
"OVERWRITE",
"an",
"ini",
"style",
"config",
"file",
"that",
"holds",
"all",
"of",
"the",
"default",
"command",
"line",
"options",
"."
] | def writeconfig(self, iniconffile=sys.argv[0] + ".ini"):
"""
OVERWRITE an ini style config file that holds all of the default
command line options.
:param iniconffile: the file name of the ini file, defaults to
'{scriptname}.ini'.
"""
ret = []... | [
"def",
"writeconfig",
"(",
"self",
",",
"iniconffile",
"=",
"sys",
".",
"argv",
"[",
"0",
"]",
"+",
"\".ini\"",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"cmdname",
",",
"cmd",
"in",
"self",
".",
"commands",
".",
"items",
"(",
")",
":",
"ret",
".",
... | https://github.com/ot/ds2i/blob/2cf8237f638f45da0b25caebd2b3c1fbfebf9149/ext/baker.py#L343-L364 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_ops.py | python | divide | (x, y, name=None) | Computes Python style division of `x` by `y`. | Computes Python style division of `x` by `y`. | [
"Computes",
"Python",
"style",
"division",
"of",
"x",
"by",
"y",
"."
] | def divide(x, y, name=None):
"""Computes Python style division of `x` by `y`."""
if name is not None:
# Cannot use tensors operator overload, because it has no way to track
# override names. Use a dummy class to track the runtime division behavior
return DivideDelegateWithName(x, name) / y
else:
... | [
"def",
"divide",
"(",
"x",
",",
"y",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"not",
"None",
":",
"# Cannot use tensors operator overload, because it has no way to track",
"# override names. Use a dummy class to track the runtime division behavior",
"return",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_ops.py#L317-L325 | ||
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/python/m5/util/convert.py | python | toNum | (value, target_type, units, prefixes, converter) | return convert(magnitude) * scale, unit | Convert a string using units and prefixes to (typically) a float or
integer.
String values are assumed to either be a naked magnitude without a
unit or prefix, or a magnitude with a unit and an optional prefix.
:param value: String value to convert.
:param target_type: Type name for error messages... | Convert a string using units and prefixes to (typically) a float or
integer. | [
"Convert",
"a",
"string",
"using",
"units",
"and",
"prefixes",
"to",
"(",
"typically",
")",
"a",
"float",
"or",
"integer",
"."
] | def toNum(value, target_type, units, prefixes, converter):
'''Convert a string using units and prefixes to (typically) a float or
integer.
String values are assumed to either be a naked magnitude without a
unit or prefix, or a magnitude with a unit and an optional prefix.
:param value: String valu... | [
"def",
"toNum",
"(",
"value",
",",
"target_type",
",",
"units",
",",
"prefixes",
",",
"converter",
")",
":",
"assertStr",
"(",
"value",
")",
"def",
"convert",
"(",
"val",
")",
":",
"try",
":",
"return",
"converter",
"(",
"val",
")",
"except",
"ValueErr... | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/python/m5/util/convert.py#L120-L164 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | Sizer.GetPosition | (*args, **kwargs) | return _core_.Sizer_GetPosition(*args, **kwargs) | GetPosition(self) -> Point
Returns the current position of the sizer's managed space. | GetPosition(self) -> Point | [
"GetPosition",
"(",
"self",
")",
"-",
">",
"Point"
] | def GetPosition(*args, **kwargs):
"""
GetPosition(self) -> Point
Returns the current position of the sizer's managed space.
"""
return _core_.Sizer_GetPosition(*args, **kwargs) | [
"def",
"GetPosition",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Sizer_GetPosition",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L14784-L14790 | |
microsoft/EdgeML | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | pytorch/edgeml_pytorch/trainer/fastTrainer.py | python | FastTrainer.__init__ | (self, FastObj, numClasses, sW=1.0, sU=1.0,
learningRate=0.01, outFile=None, device=None, batch_first=False) | FastObj - Can be either FastRNN or FastGRNN or any of the RNN cells
in graph.rnn with proper initialisations
numClasses is the # of classes
sW and sU are the sparsity factors for Fast parameters
batchSize is the batchSize
learningRate is the initial learning rate | FastObj - Can be either FastRNN or FastGRNN or any of the RNN cells
in graph.rnn with proper initialisations
numClasses is the # of classes
sW and sU are the sparsity factors for Fast parameters
batchSize is the batchSize
learningRate is the initial learning rate | [
"FastObj",
"-",
"Can",
"be",
"either",
"FastRNN",
"or",
"FastGRNN",
"or",
"any",
"of",
"the",
"RNN",
"cells",
"in",
"graph",
".",
"rnn",
"with",
"proper",
"initialisations",
"numClasses",
"is",
"the",
"#",
"of",
"classes",
"sW",
"and",
"sU",
"are",
"the"... | def __init__(self, FastObj, numClasses, sW=1.0, sU=1.0,
learningRate=0.01, outFile=None, device=None, batch_first=False):
'''
FastObj - Can be either FastRNN or FastGRNN or any of the RNN cells
in graph.rnn with proper initialisations
numClasses is the # of classes
... | [
"def",
"__init__",
"(",
"self",
",",
"FastObj",
",",
"numClasses",
",",
"sW",
"=",
"1.0",
",",
"sU",
"=",
"1.0",
",",
"learningRate",
"=",
"0.01",
",",
"outFile",
"=",
"None",
",",
"device",
"=",
"None",
",",
"batch_first",
"=",
"False",
")",
":",
... | https://github.com/microsoft/EdgeML/blob/ef9f8a77f096acbdeb941014791f8eda1c1bc35b/pytorch/edgeml_pytorch/trainer/fastTrainer.py#L15-L62 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Hash/SHA3_384.py | python | SHA3_384_Hash.digest | (self) | return self._digest_value | Return the **binary** (non-printable) digest of the message that has been hashed so far.
:return: The hash digest, computed over the data processed so far.
Binary form.
:rtype: byte string | Return the **binary** (non-printable) digest of the message that has been hashed so far. | [
"Return",
"the",
"**",
"binary",
"**",
"(",
"non",
"-",
"printable",
")",
"digest",
"of",
"the",
"message",
"that",
"has",
"been",
"hashed",
"so",
"far",
"."
] | def digest(self):
"""Return the **binary** (non-printable) digest of the message that has been hashed so far.
:return: The hash digest, computed over the data processed so far.
Binary form.
:rtype: byte string
"""
self._digest_done = True
bfr = create_... | [
"def",
"digest",
"(",
"self",
")",
":",
"self",
".",
"_digest_done",
"=",
"True",
"bfr",
"=",
"create_string_buffer",
"(",
"self",
".",
"digest_size",
")",
"result",
"=",
"_raw_keccak_lib",
".",
"keccak_digest",
"(",
"self",
".",
"_state",
".",
"get",
"(",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Hash/SHA3_384.py#L83-L102 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/linalg_grad.py | python | _BatchMatrixDeterminantGrad | (op, grad) | return multipliers * a_adj_inv | Gradient for BatchMatrixDeterminant. | Gradient for BatchMatrixDeterminant. | [
"Gradient",
"for",
"BatchMatrixDeterminant",
"."
] | def _BatchMatrixDeterminantGrad(op, grad):
"""Gradient for BatchMatrixDeterminant."""
a = op.inputs[0]
c = op.outputs[0]
a_adj_inv = linalg_ops.batch_matrix_inverse(a, adjoint=True)
multipliers = array_ops.reshape(
grad * c, array_ops.concat(0, [array_ops.shape(c), [1, 1]]))
return multipliers * a_adj... | [
"def",
"_BatchMatrixDeterminantGrad",
"(",
"op",
",",
"grad",
")",
":",
"a",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
"c",
"=",
"op",
".",
"outputs",
"[",
"0",
"]",
"a_adj_inv",
"=",
"linalg_ops",
".",
"batch_matrix_inverse",
"(",
"a",
",",
"adjoint",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/linalg_grad.py#L75-L82 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/multiprocessing/context.py | python | BaseContext.cpu_count | (self) | Returns the number of CPUs in the system | Returns the number of CPUs in the system | [
"Returns",
"the",
"number",
"of",
"CPUs",
"in",
"the",
"system"
] | def cpu_count(self):
'''Returns the number of CPUs in the system'''
num = os.cpu_count()
if num is None:
raise NotImplementedError('cannot determine number of cpus')
else:
return num | [
"def",
"cpu_count",
"(",
"self",
")",
":",
"num",
"=",
"os",
".",
"cpu_count",
"(",
")",
"if",
"num",
"is",
"None",
":",
"raise",
"NotImplementedError",
"(",
"'cannot determine number of cpus'",
")",
"else",
":",
"return",
"num"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/multiprocessing/context.py#L40-L46 | ||
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | driver/python/pysequoiadb/client.py | python | client.close_all_cursors | (self) | Close all the cursors in current thread, we can't use those cursors to
get data again.
Exceptions:
pysequoiadb.error.SDBBaseError | Close all the cursors in current thread, we can't use those cursors to
get data again. | [
"Close",
"all",
"the",
"cursors",
"in",
"current",
"thread",
"we",
"can",
"t",
"use",
"those",
"cursors",
"to",
"get",
"data",
"again",
"."
] | def close_all_cursors(self):
"""Close all the cursors in current thread, we can't use those cursors to
get data again.
Exceptions:
pysequoiadb.error.SDBBaseError
"""
rc = sdb.sdb_close_all_cursors(self._client)
raise_if_error(rc, "Failed to close all cursors") | [
"def",
"close_all_cursors",
"(",
"self",
")",
":",
"rc",
"=",
"sdb",
".",
"sdb_close_all_cursors",
"(",
"self",
".",
"_client",
")",
"raise_if_error",
"(",
"rc",
",",
"\"Failed to close all cursors\"",
")"
] | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/driver/python/pysequoiadb/client.py#L1439-L1447 | ||
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/SConf.py | python | CheckCXXHeader | (context, header, include_quotes = '""') | return CheckHeader(context, header, include_quotes, language = "C++") | A test for a C++ header file. | A test for a C++ header file. | [
"A",
"test",
"for",
"a",
"C",
"++",
"header",
"file",
"."
] | def CheckCXXHeader(context, header, include_quotes = '""'):
"""
A test for a C++ header file.
"""
return CheckHeader(context, header, include_quotes, language = "C++") | [
"def",
"CheckCXXHeader",
"(",
"context",
",",
"header",
",",
"include_quotes",
"=",
"'\"\"'",
")",
":",
"return",
"CheckHeader",
"(",
"context",
",",
"header",
",",
"include_quotes",
",",
"language",
"=",
"\"C++\"",
")"
] | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/SConf.py#L987-L991 | |
ComputationalRadiationPhysics/picongpu | 59e9b53605f9a5c1bf271eeb055bc74370a99052 | lib/python/picongpu/plugins/plot_mpl/phase_space_visualizer.py | python | Visualizer._remove_colorbar | (self, idx) | Remove the colorbar for plot obj at idx. | Remove the colorbar for plot obj at idx. | [
"Remove",
"the",
"colorbar",
"for",
"plot",
"obj",
"at",
"idx",
"."
] | def _remove_colorbar(self, idx):
"""
Remove the colorbar for plot obj at idx.
"""
# do not call self.colorbars[idx].remove() since that removes the
# ax of the colorbar from the figure which we don't want
self.colorbars[idx].ax.clear()
# deactivate the axis labels... | [
"def",
"_remove_colorbar",
"(",
"self",
",",
"idx",
")",
":",
"# do not call self.colorbars[idx].remove() since that removes the",
"# ax of the colorbar from the figure which we don't want",
"self",
".",
"colorbars",
"[",
"idx",
"]",
".",
"ax",
".",
"clear",
"(",
")",
"# ... | https://github.com/ComputationalRadiationPhysics/picongpu/blob/59e9b53605f9a5c1bf271eeb055bc74370a99052/lib/python/picongpu/plugins/plot_mpl/phase_space_visualizer.py#L114-L124 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextEvent.GetModificationType | (*args, **kwargs) | return _stc.StyledTextEvent_GetModificationType(*args, **kwargs) | GetModificationType(self) -> int | GetModificationType(self) -> int | [
"GetModificationType",
"(",
"self",
")",
"-",
">",
"int"
] | def GetModificationType(*args, **kwargs):
"""GetModificationType(self) -> int"""
return _stc.StyledTextEvent_GetModificationType(*args, **kwargs) | [
"def",
"GetModificationType",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextEvent_GetModificationType",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L7134-L7136 | |
tkn-tub/ns3-gym | 19bfe0a583e641142609939a090a09dfc63a095f | src/visualizer/visualizer/ipython_view.py | python | ConsoleView.onKeyPress | (self, widget, event) | return self.onKeyPressExtend(event) | !
Key press callback used for correcting behavior for console-like
interfaces. For example 'home' should go to prompt, not to beginning of
line.
@param widget: Widget that key press accored in.
@param event: Event object
@return Return True if event should not trickle. | !
Key press callback used for correcting behavior for console-like
interfaces. For example 'home' should go to prompt, not to beginning of
line. | [
"!",
"Key",
"press",
"callback",
"used",
"for",
"correcting",
"behavior",
"for",
"console",
"-",
"like",
"interfaces",
".",
"For",
"example",
"home",
"should",
"go",
"to",
"prompt",
"not",
"to",
"beginning",
"of",
"line",
"."
] | def onKeyPress(self, widget, event):
"""!
Key press callback used for correcting behavior for console-like
interfaces. For example 'home' should go to prompt, not to beginning of
line.
@param widget: Widget that key press accored in.
@param event: Event object
@return Return True if ev... | [
"def",
"onKeyPress",
"(",
"self",
",",
"widget",
",",
"event",
")",
":",
"insert_mark",
"=",
"self",
".",
"text_buffer",
".",
"get_insert",
"(",
")",
"insert_iter",
"=",
"self",
".",
"text_buffer",
".",
"get_iter_at_mark",
"(",
"insert_mark",
")",
"selection... | https://github.com/tkn-tub/ns3-gym/blob/19bfe0a583e641142609939a090a09dfc63a095f/src/visualizer/visualizer/ipython_view.py#L513-L554 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/dashboard/dashboard/xsrf.py | python | _GenerateNewSecretKey | () | return str(os.urandom(16).encode('hex')) | Returns a random XSRF secret key. | Returns a random XSRF secret key. | [
"Returns",
"a",
"random",
"XSRF",
"secret",
"key",
"."
] | def _GenerateNewSecretKey():
"""Returns a random XSRF secret key."""
return str(os.urandom(16).encode('hex')) | [
"def",
"_GenerateNewSecretKey",
"(",
")",
":",
"return",
"str",
"(",
"os",
".",
"urandom",
"(",
"16",
")",
".",
"encode",
"(",
"'hex'",
")",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/dashboard/dashboard/xsrf.py#L31-L33 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/waflib/extras/codelite.py | python | codelite_generator.collect_projects | (self) | Fill the list self.all_projects with project objects
Fill the list of build targets | Fill the list self.all_projects with project objects
Fill the list of build targets | [
"Fill",
"the",
"list",
"self",
".",
"all_projects",
"with",
"project",
"objects",
"Fill",
"the",
"list",
"of",
"build",
"targets"
] | def collect_projects(self):
"""
Fill the list self.all_projects with project objects
Fill the list of build targets
"""
self.collect_targets()
#self.add_aliases()
#self.collect_dirs()
default_... | [
"def",
"collect_projects",
"(",
"self",
")",
":",
"self",
".",
"collect_targets",
"(",
")",
"#self.add_aliases()",
"#self.collect_dirs()",
"default_project",
"=",
"getattr",
"(",
"self",
",",
"'default_project'",
",",
"None",
")",
"def",
"sortfun",
"(",
"x",
")"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/waflib/extras/codelite.py#L726-L739 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/codecs.py | python | make_encoding_map | (decoding_map) | return m | Creates an encoding map from a decoding map.
If a target mapping in the decoding map occurs multiple
times, then that target is mapped to None (undefined mapping),
causing an exception when encountered by the charmap codec
during translation.
One example where this happens is c... | Creates an encoding map from a decoding map. | [
"Creates",
"an",
"encoding",
"map",
"from",
"a",
"decoding",
"map",
"."
] | def make_encoding_map(decoding_map):
""" Creates an encoding map from a decoding map.
If a target mapping in the decoding map occurs multiple
times, then that target is mapped to None (undefined mapping),
causing an exception when encountered by the charmap codec
during translation... | [
"def",
"make_encoding_map",
"(",
"decoding_map",
")",
":",
"m",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"decoding_map",
".",
"items",
"(",
")",
":",
"if",
"not",
"v",
"in",
"m",
":",
"m",
"[",
"v",
"]",
"=",
"k",
"else",
":",
"m",
"[",
"v"... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/codecs.py#L1047-L1066 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/ssd/tools/caffe_converter/caffe_proto_utils.py | python | read_caffe_mean | (caffe_mean_file) | return img_mean_np | Reads caffe formatted mean file
:param caffe_mean_file: path to caffe mean file, presumably with 'binaryproto' suffix
:return: mean image, converted from BGR to RGB format | Reads caffe formatted mean file
:param caffe_mean_file: path to caffe mean file, presumably with 'binaryproto' suffix
:return: mean image, converted from BGR to RGB format | [
"Reads",
"caffe",
"formatted",
"mean",
"file",
":",
"param",
"caffe_mean_file",
":",
"path",
"to",
"caffe",
"mean",
"file",
"presumably",
"with",
"binaryproto",
"suffix",
":",
"return",
":",
"mean",
"image",
"converted",
"from",
"BGR",
"to",
"RGB",
"format"
] | def read_caffe_mean(caffe_mean_file):
"""
Reads caffe formatted mean file
:param caffe_mean_file: path to caffe mean file, presumably with 'binaryproto' suffix
:return: mean image, converted from BGR to RGB format
"""
import caffe_parser
import numpy as np
mean_blob = caffe_parser.caffe... | [
"def",
"read_caffe_mean",
"(",
"caffe_mean_file",
")",
":",
"import",
"caffe_parser",
"import",
"numpy",
"as",
"np",
"mean_blob",
"=",
"caffe_parser",
".",
"caffe_pb2",
".",
"BlobProto",
"(",
")",
"with",
"open",
"(",
"caffe_mean_file",
",",
"'rb'",
")",
"as",... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/ssd/tools/caffe_converter/caffe_proto_utils.py#L185-L204 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/debug/lib/debug_gradients.py | python | GradientsDebugger.gradient_tensors | (self) | return self._gradient_tensors | Get the gradient tensors that this object is aware of.
Returns:
A dict mapping x-tensor names to gradient tensor objects. x-tensor refers
to the tensors on the denominator of the differentation. | Get the gradient tensors that this object is aware of. | [
"Get",
"the",
"gradient",
"tensors",
"that",
"this",
"object",
"is",
"aware",
"of",
"."
] | def gradient_tensors(self):
"""Get the gradient tensors that this object is aware of.
Returns:
A dict mapping x-tensor names to gradient tensor objects. x-tensor refers
to the tensors on the denominator of the differentation.
"""
return self._gradient_tensors | [
"def",
"gradient_tensors",
"(",
"self",
")",
":",
"return",
"self",
".",
"_gradient_tensors"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/debug/lib/debug_gradients.py#L336-L343 | |
InsightSoftwareConsortium/ITK | 87acfce9a93d928311c38bc371b666b515b9f19d | Modules/ThirdParty/pygccxml/src/pygccxml/declarations/declaration.py | python | declaration_t.cache | (self) | return self._cache | Implementation detail.
Reference to instance of :class:`algorithms_cache_t` class. | Implementation detail. | [
"Implementation",
"detail",
"."
] | def cache(self):
"""
Implementation detail.
Reference to instance of :class:`algorithms_cache_t` class.
"""
return self._cache | [
"def",
"cache",
"(",
"self",
")",
":",
"return",
"self",
".",
"_cache"
] | https://github.com/InsightSoftwareConsortium/ITK/blob/87acfce9a93d928311c38bc371b666b515b9f19d/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/declaration.py#L313-L321 | |
Genius-x/genius-x | 9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0 | cocos2d/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py | python | CursorKind.is_attribute | (self) | return conf.lib.clang_isAttribute(self) | Test if this is an attribute kind. | Test if this is an attribute kind. | [
"Test",
"if",
"this",
"is",
"an",
"attribute",
"kind",
"."
] | def is_attribute(self):
"""Test if this is an attribute kind."""
return conf.lib.clang_isAttribute(self) | [
"def",
"is_attribute",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_isAttribute",
"(",
"self",
")"
] | https://github.com/Genius-x/genius-x/blob/9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0/cocos2d/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py#L535-L537 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py3/google/protobuf/descriptor_pool.py | python | DescriptorPool.FindFileContainingSymbol | (self, symbol) | Gets the FileDescriptor for the file containing the specified symbol.
Args:
symbol (str): The name of the symbol to search for.
Returns:
FileDescriptor: Descriptor for the file that contains the specified
symbol.
Raises:
KeyError: if the file cannot be found in the pool. | Gets the FileDescriptor for the file containing the specified symbol. | [
"Gets",
"the",
"FileDescriptor",
"for",
"the",
"file",
"containing",
"the",
"specified",
"symbol",
"."
] | def FindFileContainingSymbol(self, symbol):
"""Gets the FileDescriptor for the file containing the specified symbol.
Args:
symbol (str): The name of the symbol to search for.
Returns:
FileDescriptor: Descriptor for the file that contains the specified
symbol.
Raises:
KeyError:... | [
"def",
"FindFileContainingSymbol",
"(",
"self",
",",
"symbol",
")",
":",
"symbol",
"=",
"_NormalizeFullyQualifiedName",
"(",
"symbol",
")",
"try",
":",
"return",
"self",
".",
"_InternalFindFileContainingSymbol",
"(",
"symbol",
")",
"except",
"KeyError",
":",
"pass... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py3/google/protobuf/descriptor_pool.py#L420-L445 | ||
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/cpplint.py | python | CheckForFunctionLengths | (filename, clean_lines, linenum,
function_state, error) | Reports for long function bodies.
For an overview why this is done, see:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions
Uses a simplistic algorithm assuming other style guidelines
(especially spacing) are followed.
Only checks unindented functions, so class members are ... | Reports for long function bodies. | [
"Reports",
"for",
"long",
"function",
"bodies",
"."
] | def CheckForFunctionLengths(filename, clean_lines, linenum,
function_state, error):
"""Reports for long function bodies.
For an overview why this is done, see:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions
Uses a simplistic algorithm assuming ... | [
"def",
"CheckForFunctionLengths",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"function_state",
",",
"error",
")",
":",
"lines",
"=",
"clean_lines",
".",
"lines",
"line",
"=",
"lines",
"[",
"linenum",
"]",
"joined_line",
"=",
"''",
"starting_func... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/cpplint.py#L2847-L2912 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PGArrayEditorDialog.OnDownClick | (*args, **kwargs) | return _propgrid.PGArrayEditorDialog_OnDownClick(*args, **kwargs) | OnDownClick(self, CommandEvent event) | OnDownClick(self, CommandEvent event) | [
"OnDownClick",
"(",
"self",
"CommandEvent",
"event",
")"
] | def OnDownClick(*args, **kwargs):
"""OnDownClick(self, CommandEvent event)"""
return _propgrid.PGArrayEditorDialog_OnDownClick(*args, **kwargs) | [
"def",
"OnDownClick",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGArrayEditorDialog_OnDownClick",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L3222-L3224 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/models/array_feature_extractor.py | python | create_array_feature_extractor | (
input_features, output_name, extract_indices, output_type=None
) | return spec | Creates a feature extractor from an input array feature, return
input_features is a list of one (name, array) tuple.
extract_indices is either an integer or a list. If it's an integer,
the output type is by default a double (but may also be an integer).
If a list, the output type is an array. | Creates a feature extractor from an input array feature, return | [
"Creates",
"a",
"feature",
"extractor",
"from",
"an",
"input",
"array",
"feature",
"return"
] | def create_array_feature_extractor(
input_features, output_name, extract_indices, output_type=None
):
"""
Creates a feature extractor from an input array feature, return
input_features is a list of one (name, array) tuple.
extract_indices is either an integer or a list. If it's an integer,
th... | [
"def",
"create_array_feature_extractor",
"(",
"input_features",
",",
"output_name",
",",
"extract_indices",
",",
"output_type",
"=",
"None",
")",
":",
"# Make sure that our starting stuff is in the proper form.",
"assert",
"len",
"(",
"input_features",
")",
"==",
"1",
"as... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/models/array_feature_extractor.py#L15-L59 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/rnn/rnn_cell.py | python | BaseRNNCell._get_activation | (self, inputs, activation, **kwargs) | Get activation function. Convert if is string | Get activation function. Convert if is string | [
"Get",
"activation",
"function",
".",
"Convert",
"if",
"is",
"string"
] | def _get_activation(self, inputs, activation, **kwargs):
"""Get activation function. Convert if is string"""
if isinstance(activation, string_types):
return symbol.Activation(inputs, act_type=activation, **kwargs)
else:
return activation(inputs, **kwargs) | [
"def",
"_get_activation",
"(",
"self",
",",
"inputs",
",",
"activation",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"activation",
",",
"string_types",
")",
":",
"return",
"symbol",
".",
"Activation",
"(",
"inputs",
",",
"act_type",
"=",
... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/rnn/rnn_cell.py#L354-L359 | ||
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/generators/FinishSource.py | python | FinishSource.getObj | (self) | return self.__obj | Return the object to the visitor. | Return the object to the visitor. | [
"Return",
"the",
"object",
"to",
"the",
"visitor",
"."
] | def getObj(self):
"""
Return the object to the visitor.
"""
return self.__obj | [
"def",
"getObj",
"(",
"self",
")",
":",
"return",
"self",
".",
"__obj"
] | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/generators/FinishSource.py#L101-L105 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/mutex.py | python | mutex.__init__ | (self) | Create a new mutex -- initially unlocked. | Create a new mutex -- initially unlocked. | [
"Create",
"a",
"new",
"mutex",
"--",
"initially",
"unlocked",
"."
] | def __init__(self):
"""Create a new mutex -- initially unlocked."""
self.locked = False
self.queue = deque() | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"locked",
"=",
"False",
"self",
".",
"queue",
"=",
"deque",
"(",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/mutex.py#L21-L24 | ||
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | interpreter/llvm/src/bindings/python/llvm/object.py | python | Symbol.cache | (self) | Cache all cacheable properties. | Cache all cacheable properties. | [
"Cache",
"all",
"cacheable",
"properties",
"."
] | def cache(self):
"""Cache all cacheable properties."""
getattr(self, 'name')
getattr(self, 'address')
getattr(self, 'size') | [
"def",
"cache",
"(",
"self",
")",
":",
"getattr",
"(",
"self",
",",
"'name'",
")",
"getattr",
"(",
"self",
",",
"'address'",
")",
"getattr",
"(",
"self",
",",
"'size'",
")"
] | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/interpreter/llvm/src/bindings/python/llvm/object.py#L343-L347 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | PyControl.__init__ | (self, *args, **kwargs) | __init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=0, Validator validator=DefaultValidator,
String name=ControlNameStr) -> PyControl | __init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=0, Validator validator=DefaultValidator,
String name=ControlNameStr) -> PyControl | [
"__init__",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"0",
"Validator",
"validator",
"=",
"DefaultValidator",
"String",
"name",
"=",
"Control... | def __init__(self, *args, **kwargs):
"""
__init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=0, Validator validator=DefaultValidator,
String name=ControlNameStr) -> PyControl
"""
_controls_.PyControl_swiginit(se... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_controls_",
".",
"PyControl_swiginit",
"(",
"self",
",",
"_controls_",
".",
"new_PyControl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"self",
".",
"_se... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L5824-L5831 | ||
Netflix/NfWebCrypto | 499faf4eb9f9ccf0b21dc728e974970f54bd6c52 | plugin/ppapi/ppapi/generators/idl_parser.py | python | IDLParser.p_struct_error | (self, p) | enum_block : modifiers STRUCT error '{' struct_list '}' '; | enum_block : modifiers STRUCT error '{' struct_list '}' '; | [
"enum_block",
":",
"modifiers",
"STRUCT",
"error",
"{",
"struct_list",
"}",
";"
] | def p_struct_error(self, p):
"""enum_block : modifiers STRUCT error '{' struct_list '}' ';'"""
p[0] = [] | [
"def",
"p_struct_error",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"[",
"]"
] | https://github.com/Netflix/NfWebCrypto/blob/499faf4eb9f9ccf0b21dc728e974970f54bd6c52/plugin/ppapi/ppapi/generators/idl_parser.py#L788-L790 | ||
xenia-project/xenia | 9b1fdac98665ac091b9660a5d0fbb259ed79e578 | third_party/google-styleguide/cpplint/cpplint.py | python | CheckEmptyBlockBody | (filename, clean_lines, linenum, error) | Look for empty loop/conditional body with only a single semicolon.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Look for empty loop/conditional body with only a single semicolon. | [
"Look",
"for",
"empty",
"loop",
"/",
"conditional",
"body",
"with",
"only",
"a",
"single",
"semicolon",
"."
] | def CheckEmptyBlockBody(filename, clean_lines, linenum, error):
"""Look for empty loop/conditional body with only a single semicolon.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The functio... | [
"def",
"CheckEmptyBlockBody",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"# Search for loop keywords at the beginning of the line. Because only",
"# whitespaces are allowed before the keywords, this will also ignore most",
"# do-while-loops, since those... | https://github.com/xenia-project/xenia/blob/9b1fdac98665ac091b9660a5d0fbb259ed79e578/third_party/google-styleguide/cpplint/cpplint.py#L3735-L3767 | ||
Kitware/VTK | 5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8 | Web/Python/vtkmodules/web/utils.py | python | mesh | (dataset, field_to_keep=None, point_arrays=None, cell_arrays=None) | return state | Expect any dataset and extract its surface into a dash_vtk.Mesh state property | Expect any dataset and extract its surface into a dash_vtk.Mesh state property | [
"Expect",
"any",
"dataset",
"and",
"extract",
"its",
"surface",
"into",
"a",
"dash_vtk",
".",
"Mesh",
"state",
"property"
] | def mesh(dataset, field_to_keep=None, point_arrays=None, cell_arrays=None):
"""Expect any dataset and extract its surface into a dash_vtk.Mesh state property"""
if dataset is None:
return None
# Make sure we have a polydata to export
polydata = None
if dataset.IsA("vtkPolyData"):
po... | [
"def",
"mesh",
"(",
"dataset",
",",
"field_to_keep",
"=",
"None",
",",
"point_arrays",
"=",
"None",
",",
"cell_arrays",
"=",
"None",
")",
":",
"if",
"dataset",
"is",
"None",
":",
"return",
"None",
"# Make sure we have a polydata to export",
"polydata",
"=",
"N... | https://github.com/Kitware/VTK/blob/5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8/Web/Python/vtkmodules/web/utils.py#L105-L173 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/employee-importance.py | python | Solution2.getImportance | (self, employees, id) | return result | :type employees: Employee
:type id: int
:rtype: int | :type employees: Employee
:type id: int
:rtype: int | [
":",
"type",
"employees",
":",
"Employee",
":",
"type",
"id",
":",
"int",
":",
"rtype",
":",
"int"
] | def getImportance(self, employees, id):
"""
:type employees: Employee
:type id: int
:rtype: int
"""
result, q = 0, collections.deque([id])
while q:
curr = q.popleft()
employee = employees[curr-1]
result += employee.importance
... | [
"def",
"getImportance",
"(",
"self",
",",
"employees",
",",
"id",
")",
":",
"result",
",",
"q",
"=",
"0",
",",
"collections",
".",
"deque",
"(",
"[",
"id",
"]",
")",
"while",
"q",
":",
"curr",
"=",
"q",
".",
"popleft",
"(",
")",
"employee",
"=",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/employee-importance.py#L37-L50 | |
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | platforms/nuttx/NuttX/tools/kconfiglib.py | python | Kconfig.enable_stderr_warnings | (self) | See Kconfig.__init__(). | See Kconfig.__init__(). | [
"See",
"Kconfig",
".",
"__init__",
"()",
"."
] | def enable_stderr_warnings(self):
"""
See Kconfig.__init__().
"""
self._warn_to_stderr = True | [
"def",
"enable_stderr_warnings",
"(",
"self",
")",
":",
"self",
".",
"_warn_to_stderr",
"=",
"True"
] | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/platforms/nuttx/NuttX/tools/kconfiglib.py#L1723-L1727 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/pipeline/pipeline/pipeline.py | python | _dereference_args | (pipeline_name, args, kwargs) | return (arg_list, kwarg_dict) | Dereference a Pipeline's arguments that are slots, validating them.
Each argument value passed in is assumed to be a dictionary with the format:
{'type': 'value', 'value': 'serializable'} # A resolved value.
{'type': 'slot', 'slot_key': 'str() on a db.Key'} # A pending Slot.
Args:
pipeline_name: The... | Dereference a Pipeline's arguments that are slots, validating them. | [
"Dereference",
"a",
"Pipeline",
"s",
"arguments",
"that",
"are",
"slots",
"validating",
"them",
"."
] | def _dereference_args(pipeline_name, args, kwargs):
"""Dereference a Pipeline's arguments that are slots, validating them.
Each argument value passed in is assumed to be a dictionary with the format:
{'type': 'value', 'value': 'serializable'} # A resolved value.
{'type': 'slot', 'slot_key': 'str() on a db... | [
"def",
"_dereference_args",
"(",
"pipeline_name",
",",
"args",
",",
"kwargs",
")",
":",
"lookup_slots",
"=",
"set",
"(",
")",
"for",
"arg",
"in",
"itertools",
".",
"chain",
"(",
"args",
",",
"kwargs",
".",
"itervalues",
"(",
")",
")",
":",
"if",
"arg",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/pipeline/pipeline/pipeline.py#L1266-L1319 | |
timi-liuliang/echo | 40a5a24d430eee4118314459ab7e03afcb3b8719 | thirdparty/protobuf/python/mox.py | python | MockObject.__getattr__ | (self, name) | Intercept attribute request on this object.
If the attribute is a public class variable, it will be returned and not
recorded as a call.
If the attribute is not a variable, it is handled like a method
call. The method name is checked against the set of mockable
methods, and a new MockMethod is ret... | Intercept attribute request on this object. | [
"Intercept",
"attribute",
"request",
"on",
"this",
"object",
"."
] | def __getattr__(self, name):
"""Intercept attribute request on this object.
If the attribute is a public class variable, it will be returned and not
recorded as a call.
If the attribute is not a variable, it is handled like a method
call. The method name is checked against the set of mockable
... | [
"def",
"__getattr__",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
".",
"_known_vars",
":",
"return",
"getattr",
"(",
"self",
".",
"_class_to_mock",
",",
"name",
")",
"if",
"name",
"in",
"self",
".",
"_known_methods",
":",
"return",
... | https://github.com/timi-liuliang/echo/blob/40a5a24d430eee4118314459ab7e03afcb3b8719/thirdparty/protobuf/python/mox.py#L386-L417 | ||
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | CheckHeaderFileIncluded | (filename, include_state, error) | Logs an error if a .cc file does not include its header. | Logs an error if a .cc file does not include its header. | [
"Logs",
"an",
"error",
"if",
"a",
".",
"cc",
"file",
"does",
"not",
"include",
"its",
"header",
"."
] | def CheckHeaderFileIncluded(filename, include_state, error):
"""Logs an error if a .cc file does not include its header."""
# Do not check test files
fileinfo = FileInfo(filename)
if Search(_TEST_FILE_SUFFIX, fileinfo.BaseName()):
return
headerfile = filename[0:len(filename) - len(fileinfo.Extension())]... | [
"def",
"CheckHeaderFileIncluded",
"(",
"filename",
",",
"include_state",
",",
"error",
")",
":",
"# Do not check test files",
"fileinfo",
"=",
"FileInfo",
"(",
"filename",
")",
"if",
"Search",
"(",
"_TEST_FILE_SUFFIX",
",",
"fileinfo",
".",
"BaseName",
"(",
")",
... | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L1983-L2005 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/distutils/archive_util.py | python | make_tarball | (base_name, base_dir, compress="gzip", verbose=0, dry_run=0,
owner=None, group=None) | return archive_name | Create a (possibly compressed) tar file from all the files under
'base_dir'.
'compress' must be "gzip" (the default), "compress", "bzip2", or None.
(compress will be deprecated in Python 3.2)
'owner' and 'group' can be used to define an owner and a group for the
archive that is being built. If not... | Create a (possibly compressed) tar file from all the files under
'base_dir'. | [
"Create",
"a",
"(",
"possibly",
"compressed",
")",
"tar",
"file",
"from",
"all",
"the",
"files",
"under",
"base_dir",
"."
] | def make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0,
owner=None, group=None):
"""Create a (possibly compressed) tar file from all the files under
'base_dir'.
'compress' must be "gzip" (the default), "compress", "bzip2", or None.
(compress will be deprecated in P... | [
"def",
"make_tarball",
"(",
"base_name",
",",
"base_dir",
",",
"compress",
"=",
"\"gzip\"",
",",
"verbose",
"=",
"0",
",",
"dry_run",
"=",
"0",
",",
"owner",
"=",
"None",
",",
"group",
"=",
"None",
")",
":",
"tar_compression",
"=",
"{",
"'gzip'",
":",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/distutils/archive_util.py#L51-L119 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Optimizer/vai_p_pytorch/cifar10_ofa_pruning/mynet_ofa_pruning.py | python | adjust_learning_rate | (optimizer, epoch, lr) | Sets the learning rate to the initial LR decayed by every 2 epochs | Sets the learning rate to the initial LR decayed by every 2 epochs | [
"Sets",
"the",
"learning",
"rate",
"to",
"the",
"initial",
"LR",
"decayed",
"by",
"every",
"2",
"epochs"
] | def adjust_learning_rate(optimizer, epoch, lr):
"""Sets the learning rate to the initial LR decayed by every 2 epochs"""
lr = lr * (0.1**(epoch // 2))
for param_group in optimizer.param_groups:
param_group['lr'] = lr | [
"def",
"adjust_learning_rate",
"(",
"optimizer",
",",
"epoch",
",",
"lr",
")",
":",
"lr",
"=",
"lr",
"*",
"(",
"0.1",
"**",
"(",
"epoch",
"//",
"2",
")",
")",
"for",
"param_group",
"in",
"optimizer",
".",
"param_groups",
":",
"param_group",
"[",
"'lr'"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Optimizer/vai_p_pytorch/cifar10_ofa_pruning/mynet_ofa_pruning.py#L158-L163 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/socket.py | python | getaddrinfo | (host, port, family=0, type=0, proto=0, flags=0) | return addrlist | Resolve host and port into list of address info entries.
Translate the host/port argument into a sequence of 5-tuples that contain
all the necessary arguments for creating a socket connected to that service.
host is a domain name, a string representation of an IPv4/v6 address or
None. port is a string ... | Resolve host and port into list of address info entries. | [
"Resolve",
"host",
"and",
"port",
"into",
"list",
"of",
"address",
"info",
"entries",
"."
] | def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
"""Resolve host and port into list of address info entries.
Translate the host/port argument into a sequence of 5-tuples that contain
all the necessary arguments for creating a socket connected to that service.
host is a domain name, a st... | [
"def",
"getaddrinfo",
"(",
"host",
",",
"port",
",",
"family",
"=",
"0",
",",
"type",
"=",
"0",
",",
"proto",
"=",
"0",
",",
"flags",
"=",
"0",
")",
":",
"# We override this function since we want to translate the numeric family",
"# and socket type values to enum c... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/socket.py#L735-L757 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/dataview.py | python | DataViewListCtrl.Create | (*args, **kwargs) | return _dataview.DataViewListCtrl_Create(*args, **kwargs) | Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=DV_ROW_LINES,
Validator validator=DefaultValidator) -> bool
Do the 2nd phase and create the GUI control. | Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=DV_ROW_LINES,
Validator validator=DefaultValidator) -> bool | [
"Create",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"DV_ROW_LINES",
"Validator",
"validator",
"=",
"DefaultValidator",
")",
"-",
">",
"bool"
... | def Create(*args, **kwargs):
"""
Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=DV_ROW_LINES,
Validator validator=DefaultValidator) -> bool
Do the 2nd phase and create the GUI control.
"""
return _dat... | [
"def",
"Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewListCtrl_Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/dataview.py#L2079-L2087 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/grid.py | python | Grid.SetDefaultRenderer | (*args, **kwargs) | return _grid.Grid_SetDefaultRenderer(*args, **kwargs) | SetDefaultRenderer(self, GridCellRenderer renderer) | SetDefaultRenderer(self, GridCellRenderer renderer) | [
"SetDefaultRenderer",
"(",
"self",
"GridCellRenderer",
"renderer",
")"
] | def SetDefaultRenderer(*args, **kwargs):
"""SetDefaultRenderer(self, GridCellRenderer renderer)"""
return _grid.Grid_SetDefaultRenderer(*args, **kwargs) | [
"def",
"SetDefaultRenderer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"Grid_SetDefaultRenderer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/grid.py#L1978-L1980 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/widgets/fitpropertybrowser/fitpropertybrowser.py | python | FitPropertyBrowser.clear_fit_result_lines | (self) | Delete the fit curves. | Delete the fit curves. | [
"Delete",
"the",
"fit",
"curves",
"."
] | def clear_fit_result_lines(self):
"""
Delete the fit curves.
"""
for line in self.get_lines():
if line.get_label() == self.sequential_fit_line:
line.remove()
if self.fit_result_ws_name:
ws = AnalysisDataService.retrieve(self.fit_result_ws_... | [
"def",
"clear_fit_result_lines",
"(",
"self",
")",
":",
"for",
"line",
"in",
"self",
".",
"get_lines",
"(",
")",
":",
"if",
"line",
".",
"get_label",
"(",
")",
"==",
"self",
".",
"sequential_fit_line",
":",
"line",
".",
"remove",
"(",
")",
"if",
"self"... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/fitpropertybrowser/fitpropertybrowser.py#L303-L315 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | PrintDialogData.SetMaxPage | (*args, **kwargs) | return _windows_.PrintDialogData_SetMaxPage(*args, **kwargs) | SetMaxPage(self, int v) | SetMaxPage(self, int v) | [
"SetMaxPage",
"(",
"self",
"int",
"v",
")"
] | def SetMaxPage(*args, **kwargs):
"""SetMaxPage(self, int v)"""
return _windows_.PrintDialogData_SetMaxPage(*args, **kwargs) | [
"def",
"SetMaxPage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PrintDialogData_SetMaxPage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L5090-L5092 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/math/so2.py | python | from_ndarray | (R : "ndarray") | return from_matrix(R) | Returns the rotation angle of a rotation matrix. | Returns the rotation angle of a rotation matrix. | [
"Returns",
"the",
"rotation",
"angle",
"of",
"a",
"rotation",
"matrix",
"."
] | def from_ndarray(R : "ndarray") -> float:
"""Returns the rotation angle of a rotation matrix."""
return from_matrix(R) | [
"def",
"from_ndarray",
"(",
"R",
":",
"\"ndarray\"",
")",
"->",
"float",
":",
"return",
"from_matrix",
"(",
"R",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/math/so2.py#L67-L69 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | FileCtrl.GetPaths | (*args, **kwargs) | return _controls_.FileCtrl_GetPaths(*args, **kwargs) | GetPaths(self) -> wxArrayString | GetPaths(self) -> wxArrayString | [
"GetPaths",
"(",
"self",
")",
"-",
">",
"wxArrayString"
] | def GetPaths(*args, **kwargs):
"""GetPaths(self) -> wxArrayString"""
return _controls_.FileCtrl_GetPaths(*args, **kwargs) | [
"def",
"GetPaths",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"FileCtrl_GetPaths",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L7695-L7697 | |
HyeonwooNoh/caffe | d9e8494a2832d67b25dee37194c7bcb9d52d0e42 | python/caffe/pycaffe.py | python | _Net_forward | (self, blobs=None, start=None, end=None, **kwargs) | return {out: self.blobs[out].data for out in outputs} | Forward pass: prepare inputs and run the net forward.
Take
blobs: list of blobs to return in addition to output blobs.
kwargs: Keys are input blob names and values are blob ndarrays.
For formatting inputs for Caffe, see Net.preprocess().
If None, input is taken from data layers.
... | Forward pass: prepare inputs and run the net forward. | [
"Forward",
"pass",
":",
"prepare",
"inputs",
"and",
"run",
"the",
"net",
"forward",
"."
] | def _Net_forward(self, blobs=None, start=None, end=None, **kwargs):
"""
Forward pass: prepare inputs and run the net forward.
Take
blobs: list of blobs to return in addition to output blobs.
kwargs: Keys are input blob names and values are blob ndarrays.
For formatting inputs for Caffe,... | [
"def",
"_Net_forward",
"(",
"self",
",",
"blobs",
"=",
"None",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"blobs",
"is",
"None",
":",
"blobs",
"=",
"[",
"]",
"if",
"start",
"is",
"not",
"None",
... | https://github.com/HyeonwooNoh/caffe/blob/d9e8494a2832d67b25dee37194c7bcb9d52d0e42/python/caffe/pycaffe.py#L38-L81 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/polynomial/legendre.py | python | legval | (x, c, tensor=True) | return c0 + c1*x | Evaluate a Legendre series at points x.
If `c` is of length `n + 1`, this function returns the value:
.. math:: p(x) = c_0 * L_0(x) + c_1 * L_1(x) + ... + c_n * L_n(x)
The parameter `x` is converted to an array only if it is a tuple or a
list, otherwise it is treated as a scalar. In either case, eith... | Evaluate a Legendre series at points x. | [
"Evaluate",
"a",
"Legendre",
"series",
"at",
"points",
"x",
"."
] | def legval(x, c, tensor=True):
"""
Evaluate a Legendre series at points x.
If `c` is of length `n + 1`, this function returns the value:
.. math:: p(x) = c_0 * L_0(x) + c_1 * L_1(x) + ... + c_n * L_n(x)
The parameter `x` is converted to an array only if it is a tuple or a
list, otherwise it i... | [
"def",
"legval",
"(",
"x",
",",
"c",
",",
"tensor",
"=",
"True",
")",
":",
"c",
"=",
"np",
".",
"array",
"(",
"c",
",",
"ndmin",
"=",
"1",
",",
"copy",
"=",
"0",
")",
"if",
"c",
".",
"dtype",
".",
"char",
"in",
"'?bBhHiIlLqQpP'",
":",
"c",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/polynomial/legendre.py#L907-L992 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/dataset/vision/py_transforms_util.py | python | is_pil | (img) | return isinstance(img, Image.Image) | Check if the input image is PIL format.
Args:
img: Image to be checked.
Returns:
Bool, True if input is PIL image. | Check if the input image is PIL format. | [
"Check",
"if",
"the",
"input",
"image",
"is",
"PIL",
"format",
"."
] | def is_pil(img):
"""
Check if the input image is PIL format.
Args:
img: Image to be checked.
Returns:
Bool, True if input is PIL image.
"""
return isinstance(img, Image.Image) | [
"def",
"is_pil",
"(",
"img",
")",
":",
"return",
"isinstance",
"(",
"img",
",",
"Image",
".",
"Image",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/vision/py_transforms_util.py#L31-L41 | |
vslavik/poedit | f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a | deps/boost/libs/metaparse/tools/benchmark/benchmark.py | python | join_images | (img_files, out_file) | Join the list of images into the out file | Join the list of images into the out file | [
"Join",
"the",
"list",
"of",
"images",
"into",
"the",
"out",
"file"
] | def join_images(img_files, out_file):
"""Join the list of images into the out file"""
images = [PIL.Image.open(f) for f in img_files]
joined = PIL.Image.new(
'RGB',
(sum(i.size[0] for i in images), max(i.size[1] for i in images))
)
left = 0
for img in images:
joined.paste... | [
"def",
"join_images",
"(",
"img_files",
",",
"out_file",
")",
":",
"images",
"=",
"[",
"PIL",
".",
"Image",
".",
"open",
"(",
"f",
")",
"for",
"f",
"in",
"img_files",
"]",
"joined",
"=",
"PIL",
".",
"Image",
".",
"new",
"(",
"'RGB'",
",",
"(",
"s... | https://github.com/vslavik/poedit/blob/f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a/deps/boost/libs/metaparse/tools/benchmark/benchmark.py#L215-L226 | ||
openthread/openthread | 9fcdbed9c526c70f1556d1ed84099c1535c7cd32 | third_party/mbedtls/repo/scripts/assemble_changelog.py | python | ChangeLog.write | (self, filename) | Write the changelog to the specified file. | Write the changelog to the specified file. | [
"Write",
"the",
"changelog",
"to",
"the",
"specified",
"file",
"."
] | def write(self, filename):
"""Write the changelog to the specified file.
"""
with open(filename, 'wb') as out:
out.write(self.header)
out.write(self.top_version_title)
for title, body in self.categories.items():
if not body:
... | [
"def",
"write",
"(",
"self",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'wb'",
")",
"as",
"out",
":",
"out",
".",
"write",
"(",
"self",
".",
"header",
")",
"out",
".",
"write",
"(",
"self",
".",
"top_version_title",
")",
"for... | https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/third_party/mbedtls/repo/scripts/assemble_changelog.py#L244-L254 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/nanops.py | python | na_accum_func | (values: ArrayLike, accum_func, *, skipna: bool) | return result | Cumulative function with skipna support.
Parameters
----------
values : np.ndarray or ExtensionArray
accum_func : {np.cumprod, np.maximum.accumulate, np.cumsum, np.minimum.accumulate}
skipna : bool
Returns
-------
np.ndarray or ExtensionArray | Cumulative function with skipna support. | [
"Cumulative",
"function",
"with",
"skipna",
"support",
"."
] | def na_accum_func(values: ArrayLike, accum_func, *, skipna: bool) -> ArrayLike:
"""
Cumulative function with skipna support.
Parameters
----------
values : np.ndarray or ExtensionArray
accum_func : {np.cumprod, np.maximum.accumulate, np.cumsum, np.minimum.accumulate}
skipna : bool
Retu... | [
"def",
"na_accum_func",
"(",
"values",
":",
"ArrayLike",
",",
"accum_func",
",",
"*",
",",
"skipna",
":",
"bool",
")",
"->",
"ArrayLike",
":",
"mask_a",
",",
"mask_b",
"=",
"{",
"np",
".",
"cumprod",
":",
"(",
"1.0",
",",
"np",
".",
"nan",
")",
","... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/nanops.py#L1729-L1805 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/parsers.py | python | PythonParser._get_index_name | (self, columns) | return index_name, orig_names, columns | Try several cases to get lines:
0) There are headers on row 0 and row 1 and their
total summed lengths equals the length of the next line.
Treat row 0 as columns and row 1 as indices
1) Look for implicit index: there are more columns
on row 1 than row 0. If this is true, assume ... | Try several cases to get lines: | [
"Try",
"several",
"cases",
"to",
"get",
"lines",
":"
] | def _get_index_name(self, columns):
"""
Try several cases to get lines:
0) There are headers on row 0 and row 1 and their
total summed lengths equals the length of the next line.
Treat row 0 as columns and row 1 as indices
1) Look for implicit index: there are more colum... | [
"def",
"_get_index_name",
"(",
"self",
",",
"columns",
")",
":",
"orig_names",
"=",
"list",
"(",
"columns",
")",
"columns",
"=",
"list",
"(",
"columns",
")",
"try",
":",
"line",
"=",
"self",
".",
"_next_line",
"(",
")",
"except",
"StopIteration",
":",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/parsers.py#L2999-L3061 | |
facebookresearch/habitat-sim | 63b6c71d9ca8adaefb140b198196f5d0ca1f1e34 | src_python/habitat_sim/robots/mobile_manipulator.py | python | MobileManipulator.arm_joint_pos | (self, ctrl: List[float]) | Kinematically sets the arm joints and sets the motors to target. | Kinematically sets the arm joints and sets the motors to target. | [
"Kinematically",
"sets",
"the",
"arm",
"joints",
"and",
"sets",
"the",
"motors",
"to",
"target",
"."
] | def arm_joint_pos(self, ctrl: List[float]):
"""Kinematically sets the arm joints and sets the motors to target."""
self._validate_arm_ctrl_input(ctrl)
joint_positions = self.sim_obj.joint_positions
for i, jidx in enumerate(self.params.arm_joints):
self._set_motor_pos(jidx, ... | [
"def",
"arm_joint_pos",
"(",
"self",
",",
"ctrl",
":",
"List",
"[",
"float",
"]",
")",
":",
"self",
".",
"_validate_arm_ctrl_input",
"(",
"ctrl",
")",
"joint_positions",
"=",
"self",
".",
"sim_obj",
".",
"joint_positions",
"for",
"i",
",",
"jidx",
"in",
... | https://github.com/facebookresearch/habitat-sim/blob/63b6c71d9ca8adaefb140b198196f5d0ca1f1e34/src_python/habitat_sim/robots/mobile_manipulator.py#L377-L386 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/utils.py | python | parse_list_header | (value) | return result | Parse lists as described by RFC 2068 Section 2.
In particular, parse comma-separated lists where the elements of
the list may include quoted-strings. A quoted-string could
contain a comma. A non-quoted string could have quotes in the
middle. Quotes are removed automatically after parsing.
It ba... | Parse lists as described by RFC 2068 Section 2. | [
"Parse",
"lists",
"as",
"described",
"by",
"RFC",
"2068",
"Section",
"2",
"."
] | def parse_list_header(value):
"""Parse lists as described by RFC 2068 Section 2.
In particular, parse comma-separated lists where the elements of
the list may include quoted-strings. A quoted-string could
contain a comma. A non-quoted string could have quotes in the
middle. Quotes are removed au... | [
"def",
"parse_list_header",
"(",
"value",
")",
":",
"result",
"=",
"[",
"]",
"for",
"item",
"in",
"_parse_list_header",
"(",
"value",
")",
":",
"if",
"item",
"[",
":",
"1",
"]",
"==",
"item",
"[",
"-",
"1",
":",
"]",
"==",
"'\"'",
":",
"item",
"=... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/utils.py#L323-L351 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.