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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/PartDesign/WizardShaft/SegmentFunction.py | python | SegmentFunctionSegment.hasStart | (self, xval) | return abs(self.start - xval) < 1E-9 | Return true if the start of this segment is xval | Return true if the start of this segment is xval | [
"Return",
"true",
"if",
"the",
"start",
"of",
"this",
"segment",
"is",
"xval"
] | def hasStart(self, xval):
"Return true if the start of this segment is xval"
#FIXME: 1E-9 is arbitrary here. But since units are in meters, 1E-9 is a nanometer...
return abs(self.start - xval) < 1E-9 | [
"def",
"hasStart",
"(",
"self",
",",
"xval",
")",
":",
"#FIXME: 1E-9 is arbitrary here. But since units are in meters, 1E-9 is a nanometer...",
"return",
"abs",
"(",
"self",
".",
"start",
"-",
"xval",
")",
"<",
"1E-9"
] | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/PartDesign/WizardShaft/SegmentFunction.py#L36-L39 | |
intel/caffe | 3f494b442ee3f9d17a07b09ecbd5fa2bbda00836 | examples/faster-rcnn/lib/rpn/generate.py | python | _get_image_blob | (im) | return blob, im_info | Converts an image into a network input.
Arguments:
im (ndarray): a color image in BGR order
Returns:
blob (ndarray): a data blob holding an image pyramid
im_scale_factors (list): list of image scales (relative to im) used
in the image pyramid | Converts an image into a network input. | [
"Converts",
"an",
"image",
"into",
"a",
"network",
"input",
"."
] | def _get_image_blob(im):
"""Converts an image into a network input.
Arguments:
im (ndarray): a color image in BGR order
Returns:
blob (ndarray): a data blob holding an image pyramid
im_scale_factors (list): list of image scales (relative to im) used
in the image pyramid... | [
"def",
"_get_image_blob",
"(",
"im",
")",
":",
"im_orig",
"=",
"im",
".",
"astype",
"(",
"np",
".",
"float32",
",",
"copy",
"=",
"True",
")",
"im_orig",
"-=",
"cfg",
".",
"PIXEL_MEANS",
"im_shape",
"=",
"im_orig",
".",
"shape",
"im_size_min",
"=",
"np"... | https://github.com/intel/caffe/blob/3f494b442ee3f9d17a07b09ecbd5fa2bbda00836/examples/faster-rcnn/lib/rpn/generate.py#L47-L82 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/nn/init.py | python | sparse_ | (tensor, sparsity, std=0.01) | return tensor | r"""Fills the 2D input `Tensor` as a sparse matrix, where the
non-zero elements will be drawn from the normal distribution
:math:`\mathcal{N}(0, 0.01)`, as described in `Deep learning via
Hessian-free optimization` - Martens, J. (2010).
Args:
tensor: an n-dimensional `torch.Tensor`
spar... | r"""Fills the 2D input `Tensor` as a sparse matrix, where the
non-zero elements will be drawn from the normal distribution
:math:`\mathcal{N}(0, 0.01)`, as described in `Deep learning via
Hessian-free optimization` - Martens, J. (2010). | [
"r",
"Fills",
"the",
"2D",
"input",
"Tensor",
"as",
"a",
"sparse",
"matrix",
"where",
"the",
"non",
"-",
"zero",
"elements",
"will",
"be",
"drawn",
"from",
"the",
"normal",
"distribution",
":",
"math",
":",
"\\",
"mathcal",
"{",
"N",
"}",
"(",
"0",
"... | def sparse_(tensor, sparsity, std=0.01):
r"""Fills the 2D input `Tensor` as a sparse matrix, where the
non-zero elements will be drawn from the normal distribution
:math:`\mathcal{N}(0, 0.01)`, as described in `Deep learning via
Hessian-free optimization` - Martens, J. (2010).
Args:
tensor:... | [
"def",
"sparse_",
"(",
"tensor",
",",
"sparsity",
",",
"std",
"=",
"0.01",
")",
":",
"if",
"tensor",
".",
"ndimension",
"(",
")",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"\"Only tensors with 2 dimensions are supported\"",
")",
"rows",
",",
"cols",
"=",
... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/nn/init.py#L488-L516 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/flatmenu.py | python | FlatMenuBar.OnLeaveWindow | (self, event) | Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`FlatMenuBar`.
:param `event`: a :class:`MouseEvent` event to be processed.
:note: This method is for GTK only. | Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`FlatMenuBar`. | [
"Handles",
"the",
"wx",
".",
"EVT_LEAVE_WINDOW",
"event",
"for",
":",
"class",
":",
"FlatMenuBar",
"."
] | def OnLeaveWindow(self, event):
"""
Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`FlatMenuBar`.
:param `event`: a :class:`MouseEvent` event to be processed.
:note: This method is for GTK only.
"""
self._curretHiliteItem = -1
self._dropDownButtonState = ... | [
"def",
"OnLeaveWindow",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"_curretHiliteItem",
"=",
"-",
"1",
"self",
".",
"_dropDownButtonState",
"=",
"ControlNormal",
"# Reset items state",
"for",
"item",
"in",
"self",
".",
"_items",
":",
"item",
".",
"Set... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/flatmenu.py#L3134-L3153 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/pytables.py | python | GenericTable.get_attrs | (self) | retrieve our attributes | retrieve our attributes | [
"retrieve",
"our",
"attributes"
] | def get_attrs(self):
""" retrieve our attributes """
self.non_index_axes = []
self.nan_rep = None
self.levels = []
self.index_axes = [a for a in self.indexables if a.is_an_indexable]
self.values_axes = [a for a in self.indexables if not a.is_an_indexable]
self.da... | [
"def",
"get_attrs",
"(",
"self",
")",
":",
"self",
".",
"non_index_axes",
"=",
"[",
"]",
"self",
".",
"nan_rep",
"=",
"None",
"self",
".",
"levels",
"=",
"[",
"]",
"self",
".",
"index_axes",
"=",
"[",
"a",
"for",
"a",
"in",
"self",
".",
"indexables... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/pytables.py#L4525-L4533 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py | python | StateSpaceModel._exogenous_noise_increasing | (self, current_times, exogenous_values, state) | return (start_mean + mean_addition,
start_covariance + covariance_addition,
previous_times) | Update state with exogenous regressors, increasing uncertainty.
Adds to the state mean a linear transformation of `exogenous_values`, and
increases uncertainty by constructing a covariance matrix based on
`exogenous_values` and adding it to the state covariance.
This update is useful for modeling chan... | Update state with exogenous regressors, increasing uncertainty. | [
"Update",
"state",
"with",
"exogenous",
"regressors",
"increasing",
"uncertainty",
"."
] | def _exogenous_noise_increasing(self, current_times, exogenous_values, state):
"""Update state with exogenous regressors, increasing uncertainty.
Adds to the state mean a linear transformation of `exogenous_values`, and
increases uncertainty by constructing a covariance matrix based on
`exogenous_value... | [
"def",
"_exogenous_noise_increasing",
"(",
"self",
",",
"current_times",
",",
"exogenous_values",
",",
"state",
")",
":",
"start_mean",
",",
"start_covariance",
",",
"previous_times",
"=",
"state",
"with",
"variable_scope",
".",
"variable_scope",
"(",
"\"exogenous_noi... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py#L547-L585 | |
Cisco-Talos/moflow | ed71dfb0540d9e0d7a4c72f0881b58958d573728 | BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/google/protobuf/internal/wire_format.py | python | _VarUInt64ByteSizeNoTag | (uint64) | return 10 | Returns the number of bytes required to serialize a single varint
using boundary value comparisons. (unrolled loop optimization -WPierce)
uint64 must be unsigned. | Returns the number of bytes required to serialize a single varint
using boundary value comparisons. (unrolled loop optimization -WPierce)
uint64 must be unsigned. | [
"Returns",
"the",
"number",
"of",
"bytes",
"required",
"to",
"serialize",
"a",
"single",
"varint",
"using",
"boundary",
"value",
"comparisons",
".",
"(",
"unrolled",
"loop",
"optimization",
"-",
"WPierce",
")",
"uint64",
"must",
"be",
"unsigned",
"."
] | def _VarUInt64ByteSizeNoTag(uint64):
"""Returns the number of bytes required to serialize a single varint
using boundary value comparisons. (unrolled loop optimization -WPierce)
uint64 must be unsigned.
"""
if uint64 <= 0x7f: return 1
if uint64 <= 0x3fff: return 2
if uint64 <= 0x1fffff: return 3
if uint... | [
"def",
"_VarUInt64ByteSizeNoTag",
"(",
"uint64",
")",
":",
"if",
"uint64",
"<=",
"0x7f",
":",
"return",
"1",
"if",
"uint64",
"<=",
"0x3fff",
":",
"return",
"2",
"if",
"uint64",
"<=",
"0x1fffff",
":",
"return",
"3",
"if",
"uint64",
"<=",
"0xfffffff",
":",... | https://github.com/Cisco-Talos/moflow/blob/ed71dfb0540d9e0d7a4c72f0881b58958d573728/BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/google/protobuf/internal/wire_format.py#L232-L248 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/smtplib.py | python | SMTP.connect | (self, host='localhost', port=0) | return (code, msg) | Connect to a host on a given port.
If the hostname ends with a colon (`:') followed by a number, and
there is no port specified, that suffix will be stripped off and the
number interpreted as the port number to use.
Note: This method is automatically invoked by __init__, if a host is
... | Connect to a host on a given port. | [
"Connect",
"to",
"a",
"host",
"on",
"a",
"given",
"port",
"."
] | def connect(self, host='localhost', port=0):
"""Connect to a host on a given port.
If the hostname ends with a colon (`:') followed by a number, and
there is no port specified, that suffix will be stripped off and the
number interpreted as the port number to use.
Note: This met... | [
"def",
"connect",
"(",
"self",
",",
"host",
"=",
"'localhost'",
",",
"port",
"=",
"0",
")",
":",
"if",
"not",
"port",
"and",
"(",
"host",
".",
"find",
"(",
"':'",
")",
"==",
"host",
".",
"rfind",
"(",
"':'",
")",
")",
":",
"i",
"=",
"host",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/smtplib.py#L294-L321 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | chrome/common/extensions/docs/server2/compiled_file_system.py | python | CompiledFileSystem._RecursiveList | (self, path) | return Future(delegate=Gettable(resolve)) | Returns a Future containing the recursive directory listing of |path| as
a flat list of paths. | Returns a Future containing the recursive directory listing of |path| as
a flat list of paths. | [
"Returns",
"a",
"Future",
"containing",
"the",
"recursive",
"directory",
"listing",
"of",
"|path|",
"as",
"a",
"flat",
"list",
"of",
"paths",
"."
] | def _RecursiveList(self, path):
'''Returns a Future containing the recursive directory listing of |path| as
a flat list of paths.
'''
def split_dirs_from_files(paths):
'''Returns a tuple (dirs, files) where |dirs| contains the directory
names in |paths| and |files| contains the files.
... | [
"def",
"_RecursiveList",
"(",
"self",
",",
"path",
")",
":",
"def",
"split_dirs_from_files",
"(",
"paths",
")",
":",
"'''Returns a tuple (dirs, files) where |dirs| contains the directory\n names in |paths| and |files| contains the files.\n '''",
"result",
"=",
"[",
"]",... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/chrome/common/extensions/docs/server2/compiled_file_system.py#L148-L201 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/pyyaml/lib/yaml/__init__.py | python | YAMLObject.to_yaml | (cls, dumper, data) | return dumper.represent_yaml_object(cls.yaml_tag, data, cls,
flow_style=cls.yaml_flow_style) | Convert a Python object to a representation node. | Convert a Python object to a representation node. | [
"Convert",
"a",
"Python",
"object",
"to",
"a",
"representation",
"node",
"."
] | def to_yaml(cls, dumper, data):
"""
Convert a Python object to a representation node.
"""
return dumper.represent_yaml_object(cls.yaml_tag, data, cls,
flow_style=cls.yaml_flow_style) | [
"def",
"to_yaml",
"(",
"cls",
",",
"dumper",
",",
"data",
")",
":",
"return",
"dumper",
".",
"represent_yaml_object",
"(",
"cls",
".",
"yaml_tag",
",",
"data",
",",
"cls",
",",
"flow_style",
"=",
"cls",
".",
"yaml_flow_style",
")"
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/pyyaml/lib/yaml/__init__.py#L308-L313 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/propgrid.py | python | PropertyGridManager.SetPageSplitterLeft | (*args, **kwargs) | return _propgrid.PropertyGridManager_SetPageSplitterLeft(*args, **kwargs) | SetPageSplitterLeft(self, int page, bool subProps=False) | SetPageSplitterLeft(self, int page, bool subProps=False) | [
"SetPageSplitterLeft",
"(",
"self",
"int",
"page",
"bool",
"subProps",
"=",
"False",
")"
] | def SetPageSplitterLeft(*args, **kwargs):
"""SetPageSplitterLeft(self, int page, bool subProps=False)"""
return _propgrid.PropertyGridManager_SetPageSplitterLeft(*args, **kwargs) | [
"def",
"SetPageSplitterLeft",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridManager_SetPageSplitterLeft",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L3586-L3588 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/dqn.py | python | DQN.__init__ | (self,
session,
player_id,
state_representation_size,
num_actions,
hidden_layers_sizes=128,
replay_buffer_capacity=10000,
batch_size=128,
replay_buffer_class=ReplayBuffer,
learning_rate... | Initialize the DQN agent. | Initialize the DQN agent. | [
"Initialize",
"the",
"DQN",
"agent",
"."
] | def __init__(self,
session,
player_id,
state_representation_size,
num_actions,
hidden_layers_sizes=128,
replay_buffer_capacity=10000,
batch_size=128,
replay_buffer_class=ReplayBuffer,
l... | [
"def",
"__init__",
"(",
"self",
",",
"session",
",",
"player_id",
",",
"state_representation_size",
",",
"num_actions",
",",
"hidden_layers_sizes",
"=",
"128",
",",
"replay_buffer_capacity",
"=",
"10000",
",",
"batch_size",
"=",
"128",
",",
"replay_buffer_class",
... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/dqn.py#L47-L174 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/integrate/_ode.py | python | _transform_banded_jac | (bjac) | return newjac | Convert a real matrix of the form (for example)
[0 0 A B] [0 0 0 B]
[0 0 C D] [0 0 A D]
[E F G H] to [0 F C H]
[I J K L] [E J G L]
[I 0 K 0]
That is, every other column is shifted up one. | Convert a real matrix of the form (for example) | [
"Convert",
"a",
"real",
"matrix",
"of",
"the",
"form",
"(",
"for",
"example",
")"
] | def _transform_banded_jac(bjac):
"""
Convert a real matrix of the form (for example)
[0 0 A B] [0 0 0 B]
[0 0 C D] [0 0 A D]
[E F G H] to [0 F C H]
[I J K L] [E J G L]
[I 0 K 0]
That is, every other column is shifted up one.... | [
"def",
"_transform_banded_jac",
"(",
"bjac",
")",
":",
"# Shift every other column.",
"newjac",
"=",
"zeros",
"(",
"(",
"bjac",
".",
"shape",
"[",
"0",
"]",
"+",
"1",
",",
"bjac",
".",
"shape",
"[",
"1",
"]",
")",
")",
"newjac",
"[",
"1",
":",
",",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/integrate/_ode.py#L571-L587 | |
bristolcrypto/SPDZ-2 | 721abfae849625a02ea49aabc534f9cf41ca643f | Compiler/program.py | python | Program.curr_tape | (self) | return self._curr_tape | The tape that is currently running. | The tape that is currently running. | [
"The",
"tape",
"that",
"is",
"currently",
"running",
"."
] | def curr_tape(self):
""" The tape that is currently running."""
if self._curr_tape is None:
# Create a new main thread if necessary
self.restart_main_thread()
return self._curr_tape | [
"def",
"curr_tape",
"(",
"self",
")",
":",
"if",
"self",
".",
"_curr_tape",
"is",
"None",
":",
"# Create a new main thread if necessary",
"self",
".",
"restart_main_thread",
"(",
")",
"return",
"self",
".",
"_curr_tape"
] | https://github.com/bristolcrypto/SPDZ-2/blob/721abfae849625a02ea49aabc534f9cf41ca643f/Compiler/program.py#L315-L320 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/protobuf/python/google/protobuf/descriptor_pool.py | python | DescriptorPool._ConvertEnumDescriptor | (self, enum_proto, package=None, file_desc=None,
containing_type=None, scope=None) | return desc | Make a protobuf EnumDescriptor given an EnumDescriptorProto protobuf.
Args:
enum_proto: The descriptor_pb2.EnumDescriptorProto protobuf message.
package: Optional package name for the new message EnumDescriptor.
file_desc: The file containing the enum descriptor.
containing_type: The type c... | Make a protobuf EnumDescriptor given an EnumDescriptorProto protobuf. | [
"Make",
"a",
"protobuf",
"EnumDescriptor",
"given",
"an",
"EnumDescriptorProto",
"protobuf",
"."
] | def _ConvertEnumDescriptor(self, enum_proto, package=None, file_desc=None,
containing_type=None, scope=None):
"""Make a protobuf EnumDescriptor given an EnumDescriptorProto protobuf.
Args:
enum_proto: The descriptor_pb2.EnumDescriptorProto protobuf message.
package: Opt... | [
"def",
"_ConvertEnumDescriptor",
"(",
"self",
",",
"enum_proto",
",",
"package",
"=",
"None",
",",
"file_desc",
"=",
"None",
",",
"containing_type",
"=",
"None",
",",
"scope",
"=",
"None",
")",
":",
"if",
"package",
":",
"enum_name",
"=",
"'.'",
".",
"jo... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/protobuf/python/google/protobuf/descriptor_pool.py#L482-L518 | |
wyrover/book-code | 7f4883d9030d553bc6bcfa3da685e34789839900 | 3rdparty/protobuf/python/mox.py | python | MockMethod.GetPossibleGroup | (self) | return group | Returns a possible group from the end of the call queue or None if no
other methods are on the stack. | Returns a possible group from the end of the call queue or None if no
other methods are on the stack. | [
"Returns",
"a",
"possible",
"group",
"from",
"the",
"end",
"of",
"the",
"call",
"queue",
"or",
"None",
"if",
"no",
"other",
"methods",
"are",
"on",
"the",
"stack",
"."
] | def GetPossibleGroup(self):
"""Returns a possible group from the end of the call queue or None if no
other methods are on the stack.
"""
# Remove this method from the tail of the queue so we can add it to a group.
this_method = self._call_queue.pop()
assert this_method == self
# Determine ... | [
"def",
"GetPossibleGroup",
"(",
"self",
")",
":",
"# Remove this method from the tail of the queue so we can add it to a group.",
"this_method",
"=",
"self",
".",
"_call_queue",
".",
"pop",
"(",
")",
"assert",
"this_method",
"==",
"self",
"# Determine if the tail of the queue... | https://github.com/wyrover/book-code/blob/7f4883d9030d553bc6bcfa3da685e34789839900/3rdparty/protobuf/python/mox.py#L645-L662 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/ndarray/ndarray.py | python | maximum | (lhs, rhs) | return _ufunc_helper(
lhs,
rhs,
op.broadcast_maximum,
lambda x, y: x if x > y else y,
_internal._maximum_scalar,
None) | Returns element-wise maximum of the input arrays with broadcasting.
Equivalent to ``mx.nd.broadcast_maximum(lhs, rhs)``.
.. note::
If the corresponding dimensions of two arrays have the same size or one of them has size 1,
then the arrays are broadcastable to a common shape.
Parameters
... | Returns element-wise maximum of the input arrays with broadcasting. | [
"Returns",
"element",
"-",
"wise",
"maximum",
"of",
"the",
"input",
"arrays",
"with",
"broadcasting",
"."
] | def maximum(lhs, rhs):
"""Returns element-wise maximum of the input arrays with broadcasting.
Equivalent to ``mx.nd.broadcast_maximum(lhs, rhs)``.
.. note::
If the corresponding dimensions of two arrays have the same size or one of them has size 1,
then the arrays are broadcastable to a com... | [
"def",
"maximum",
"(",
"lhs",
",",
"rhs",
")",
":",
"# pylint: disable= no-member, protected-access",
"return",
"_ufunc_helper",
"(",
"lhs",
",",
"rhs",
",",
"op",
".",
"broadcast_maximum",
",",
"lambda",
"x",
",",
"y",
":",
"x",
"if",
"x",
">",
"y",
"else... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/ndarray/ndarray.py#L3095-L3148 | |
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/core/dataframe.py | python | DataFrame._prepare_for_rowwise_op | (self, method, skipna) | return coerced, mask, common_dtype | Prepare a DataFrame for CuPy-based row-wise operations. | Prepare a DataFrame for CuPy-based row-wise operations. | [
"Prepare",
"a",
"DataFrame",
"for",
"CuPy",
"-",
"based",
"row",
"-",
"wise",
"operations",
"."
] | def _prepare_for_rowwise_op(self, method, skipna):
"""Prepare a DataFrame for CuPy-based row-wise operations."""
if method not in _cupy_nan_methods_map and any(
col.nullable for col in self._columns
):
msg = (
f"Row-wise operations to calculate '{method}'... | [
"def",
"_prepare_for_rowwise_op",
"(",
"self",
",",
"method",
",",
"skipna",
")",
":",
"if",
"method",
"not",
"in",
"_cupy_nan_methods_map",
"and",
"any",
"(",
"col",
".",
"nullable",
"for",
"col",
"in",
"self",
".",
"_columns",
")",
":",
"msg",
"=",
"("... | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/dataframe.py#L5130-L5177 | |
0ad/0ad | f58db82e0e925016d83f4e3fa7ca599e3866e2af | source/tools/i18n/generateDebugTranslation.py | python | generate_long_strings | (root_path, input_file_name, output_file_name, languages=None) | Generate the 'long strings' debug catalog.
This catalog contains the longest singular and plural string,
found amongst all translated languages or a filtered subset.
It can be used to check if GUI elements are large enough.
The catalog is long.*.po | Generate the 'long strings' debug catalog.
This catalog contains the longest singular and plural string,
found amongst all translated languages or a filtered subset.
It can be used to check if GUI elements are large enough.
The catalog is long.*.po | [
"Generate",
"the",
"long",
"strings",
"debug",
"catalog",
".",
"This",
"catalog",
"contains",
"the",
"longest",
"singular",
"and",
"plural",
"string",
"found",
"amongst",
"all",
"translated",
"languages",
"or",
"a",
"filtered",
"subset",
".",
"It",
"can",
"be"... | def generate_long_strings(root_path, input_file_name, output_file_name, languages=None):
"""
Generate the 'long strings' debug catalog.
This catalog contains the longest singular and plural string,
found amongst all translated languages or a filtered subset.
It can be used to check i... | [
"def",
"generate_long_strings",
"(",
"root_path",
",",
"input_file_name",
",",
"output_file_name",
",",
"languages",
"=",
"None",
")",
":",
"print",
"(",
"\"Generating\"",
",",
"output_file_name",
")",
"input_file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",... | https://github.com/0ad/0ad/blob/f58db82e0e925016d83f4e3fa7ca599e3866e2af/source/tools/i18n/generateDebugTranslation.py#L32-L92 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/learn/python/learn/estimators/logistic_regressor.py | python | LogisticRegressor.get_default_metrics | (cls, thresholds=None) | return metrics | Returns a dictionary of basic metrics for logistic regression.
Args:
thresholds: List of floating point thresholds to use for accuracy,
precision, and recall metrics. If None, defaults to [0.5].
Returns:
Dictionary mapping metrics string names to metrics functions. | Returns a dictionary of basic metrics for logistic regression. | [
"Returns",
"a",
"dictionary",
"of",
"basic",
"metrics",
"for",
"logistic",
"regression",
"."
] | def get_default_metrics(cls, thresholds=None):
"""Returns a dictionary of basic metrics for logistic regression.
Args:
thresholds: List of floating point thresholds to use for accuracy,
precision, and recall metrics. If None, defaults to [0.5].
Returns:
Dictionary mapping metrics strin... | [
"def",
"get_default_metrics",
"(",
"cls",
",",
"thresholds",
"=",
"None",
")",
":",
"if",
"thresholds",
"is",
"None",
":",
"thresholds",
"=",
"[",
"0.5",
"]",
"metrics",
"=",
"{",
"}",
"metrics",
"[",
"cls",
".",
"PREDICTION_MEAN",
"]",
"=",
"_prediction... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/learn/python/learn/estimators/logistic_regressor.py#L84-L116 | |
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | buildscripts/cpplint.py | python | _BlockInfo.CheckEnd | (self, filename, clean_lines, linenum, error) | Run checks that applies to text after the closing brace.
This is mostly used for checking end of namespace comments.
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... | Run checks that applies to text after the closing brace. | [
"Run",
"checks",
"that",
"applies",
"to",
"text",
"after",
"the",
"closing",
"brace",
"."
] | def CheckEnd(self, filename, clean_lines, linenum, error):
"""Run checks that applies to text after the closing brace.
This is mostly used for checking end of namespace comments.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
line... | [
"def",
"CheckEnd",
"(",
"self",
",",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"pass"
] | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/buildscripts/cpplint.py#L2027-L2038 | ||
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/nyan/nyan_structs.py | python | NyanObject._prepare_inheritance_content | (self, import_tree=None) | return output_str | Returns a string containing the nyan object's inheritance set
in the header.
Subroutine of dump(). | Returns a string containing the nyan object's inheritance set
in the header. | [
"Returns",
"a",
"string",
"containing",
"the",
"nyan",
"object",
"s",
"inheritance",
"set",
"in",
"the",
"header",
"."
] | def _prepare_inheritance_content(self, import_tree=None):
"""
Returns a string containing the nyan object's inheritance set
in the header.
Subroutine of dump().
"""
output_str = "("
if len(self._parents) > 0:
for parent in self._parents:
... | [
"def",
"_prepare_inheritance_content",
"(",
"self",
",",
"import_tree",
"=",
"None",
")",
":",
"output_str",
"=",
"\"(\"",
"if",
"len",
"(",
"self",
".",
"_parents",
")",
">",
"0",
":",
"for",
"parent",
"in",
"self",
".",
"_parents",
":",
"if",
"import_t... | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/nyan/nyan_structs.py#L390-L416 | |
amrayn/easyloggingpp | 8489989bb26c6371df103f6cbced3fbee1bc3c2f | tools/cpplint.py | python | _VerboseLevel | () | return _cpplint_state.verbose_level | Returns the module's verbosity setting. | Returns the module's verbosity setting. | [
"Returns",
"the",
"module",
"s",
"verbosity",
"setting",
"."
] | def _VerboseLevel():
"""Returns the module's verbosity setting."""
return _cpplint_state.verbose_level | [
"def",
"_VerboseLevel",
"(",
")",
":",
"return",
"_cpplint_state",
".",
"verbose_level"
] | https://github.com/amrayn/easyloggingpp/blob/8489989bb26c6371df103f6cbced3fbee1bc3c2f/tools/cpplint.py#L754-L756 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/distutils/archive_util.py | python | make_zipfile | (base_name, base_dir, verbose=0, dry_run=0) | return zip_filename | Create a zip file from all the files under 'base_dir'.
The output zip file will be named 'base_name' + ".zip". Uses either the
"zipfile" Python module (if available) or the InfoZIP "zip" utility
(if installed and found on the default search path). If neither tool is
available, raises DistutilsExecErr... | Create a zip file from all the files under 'base_dir'. | [
"Create",
"a",
"zip",
"file",
"from",
"all",
"the",
"files",
"under",
"base_dir",
"."
] | def make_zipfile(base_name, base_dir, verbose=0, dry_run=0):
"""Create a zip file from all the files under 'base_dir'.
The output zip file will be named 'base_name' + ".zip". Uses either the
"zipfile" Python module (if available) or the InfoZIP "zip" utility
(if installed and found on the default sear... | [
"def",
"make_zipfile",
"(",
"base_name",
",",
"base_dir",
",",
"verbose",
"=",
"0",
",",
"dry_run",
"=",
"0",
")",
":",
"try",
":",
"import",
"zipfile",
"except",
"ImportError",
":",
"zipfile",
"=",
"None",
"zip_filename",
"=",
"base_name",
"+",
"\".zip\""... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/distutils/archive_util.py#L121-L181 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/storage_uri.py | python | BucketStorageUri.is_cloud_uri | (self) | return True | Returns True if this URI names a bucket or object. | Returns True if this URI names a bucket or object. | [
"Returns",
"True",
"if",
"this",
"URI",
"names",
"a",
"bucket",
"or",
"object",
"."
] | def is_cloud_uri(self):
"""Returns True if this URI names a bucket or object."""
return True | [
"def",
"is_cloud_uri",
"(",
"self",
")",
":",
"return",
"True"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/storage_uri.py#L512-L514 | |
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | imperative/python/megengine/dtr/dtr.py | python | enable_sqrt_sampling | (mod) | return _enable_sqrt_sampling | r"""Get or set whether sqrt sampling is allowed. Sqrt sampling means that given
the size of the candidate set is N, only enumerate sqrt(N) tensors. When
the number of tensors is very high, enabling this optimization will speed
up the training.
Examples:
.. code-block::
impor... | r"""Get or set whether sqrt sampling is allowed. Sqrt sampling means that given
the size of the candidate set is N, only enumerate sqrt(N) tensors. When
the number of tensors is very high, enabling this optimization will speed
up the training.
Examples:
.. code-block:: | [
"r",
"Get",
"or",
"set",
"whether",
"sqrt",
"sampling",
"is",
"allowed",
".",
"Sqrt",
"sampling",
"means",
"that",
"given",
"the",
"size",
"of",
"the",
"candidate",
"set",
"is",
"N",
"only",
"enumerate",
"sqrt",
"(",
"N",
")",
"tensors",
".",
"When",
"... | def enable_sqrt_sampling(mod):
r"""Get or set whether sqrt sampling is allowed. Sqrt sampling means that given
the size of the candidate set is N, only enumerate sqrt(N) tensors. When
the number of tensors is very high, enabling this optimization will speed
up the training.
Examples:
... | [
"def",
"enable_sqrt_sampling",
"(",
"mod",
")",
":",
"return",
"_enable_sqrt_sampling"
] | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/dtr/dtr.py#L97-L109 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/misc/doccer.py | python | inherit_docstring_from | (cls) | return _doc | This decorator modifies the decorated function's docstring by
replacing occurrences of '%(super)s' with the docstring of the
method of the same name from the class `cls`.
If the decorated method has no docstring, it is simply given the
docstring of `cls`s method.
Parameters
----------
cls ... | This decorator modifies the decorated function's docstring by
replacing occurrences of '%(super)s' with the docstring of the
method of the same name from the class `cls`. | [
"This",
"decorator",
"modifies",
"the",
"decorated",
"function",
"s",
"docstring",
"by",
"replacing",
"occurrences",
"of",
"%",
"(",
"super",
")",
"s",
"with",
"the",
"docstring",
"of",
"the",
"method",
"of",
"the",
"same",
"name",
"from",
"the",
"class",
... | def inherit_docstring_from(cls):
"""
This decorator modifies the decorated function's docstring by
replacing occurrences of '%(super)s' with the docstring of the
method of the same name from the class `cls`.
If the decorated method has no docstring, it is simply given the
docstring of `cls`s me... | [
"def",
"inherit_docstring_from",
"(",
"cls",
")",
":",
"def",
"_doc",
"(",
"func",
")",
":",
"cls_docstring",
"=",
"getattr",
"(",
"cls",
",",
"func",
".",
"__name__",
")",
".",
"__doc__",
"func_docstring",
"=",
"func",
".",
"__doc__",
"if",
"func_docstrin... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/misc/doccer.py#L71-L125 | |
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_parser.py | python | p_loc | (p) | loc : | loc : | [
"loc",
":"
] | def p_loc(p):
'loc : '
p[0] = None | [
"def",
"p_loc",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"None"
] | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_parser.py#L2005-L2007 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/ma/core.py | python | put | (a, indices, values, mode='raise') | Set storage-indexed locations to corresponding values.
This function is equivalent to `MaskedArray.put`, see that method
for details.
See Also
--------
MaskedArray.put | Set storage-indexed locations to corresponding values. | [
"Set",
"storage",
"-",
"indexed",
"locations",
"to",
"corresponding",
"values",
"."
] | def put(a, indices, values, mode='raise'):
"""
Set storage-indexed locations to corresponding values.
This function is equivalent to `MaskedArray.put`, see that method
for details.
See Also
--------
MaskedArray.put
"""
# We can't use 'frommethod', the order of arguments is differe... | [
"def",
"put",
"(",
"a",
",",
"indices",
",",
"values",
",",
"mode",
"=",
"'raise'",
")",
":",
"# We can't use 'frommethod', the order of arguments is different",
"try",
":",
"return",
"a",
".",
"put",
"(",
"indices",
",",
"values",
",",
"mode",
"=",
"mode",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/ma/core.py#L7046-L7062 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | RichTextBuffer_SetBulletRightMargin | (*args, **kwargs) | return _richtext.RichTextBuffer_SetBulletRightMargin(*args, **kwargs) | RichTextBuffer_SetBulletRightMargin(int margin) | RichTextBuffer_SetBulletRightMargin(int margin) | [
"RichTextBuffer_SetBulletRightMargin",
"(",
"int",
"margin",
")"
] | def RichTextBuffer_SetBulletRightMargin(*args, **kwargs):
"""RichTextBuffer_SetBulletRightMargin(int margin)"""
return _richtext.RichTextBuffer_SetBulletRightMargin(*args, **kwargs) | [
"def",
"RichTextBuffer_SetBulletRightMargin",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextBuffer_SetBulletRightMargin",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L2717-L2719 | |
ArduPilot/ardupilot | 6e684b3496122b8158ac412b609d00004b7ac306 | Tools/scripts/build_binaries.py | python | build_binaries.read_string_from_filepath | (self, filepath) | return content | returns content of filepath as a string | returns content of filepath as a string | [
"returns",
"content",
"of",
"filepath",
"as",
"a",
"string"
] | def read_string_from_filepath(self, filepath):
'''returns content of filepath as a string'''
with open(filepath, 'rb') as fh:
content = fh.read()
return content | [
"def",
"read_string_from_filepath",
"(",
"self",
",",
"filepath",
")",
":",
"with",
"open",
"(",
"filepath",
",",
"'rb'",
")",
"as",
"fh",
":",
"content",
"=",
"fh",
".",
"read",
"(",
")",
"return",
"content"
] | https://github.com/ArduPilot/ardupilot/blob/6e684b3496122b8158ac412b609d00004b7ac306/Tools/scripts/build_binaries.py#L347-L351 | |
Cantera/cantera | 0119484b261967ccb55a0066c020599cacc312e4 | interfaces/cython/cantera/ctml2yaml.py | python | main | () | Parse command line arguments and pass them to `convert`. | Parse command line arguments and pass them to `convert`. | [
"Parse",
"command",
"line",
"arguments",
"and",
"pass",
"them",
"to",
"convert",
"."
] | def main():
"""Parse command line arguments and pass them to `convert`."""
parser = argparse.ArgumentParser(
description="Convert legacy CTML input files to YAML format",
epilog=(
"The 'output' argument is optional. If it is not given, an output "
"file with the same name... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"Convert legacy CTML input files to YAML format\"",
",",
"epilog",
"=",
"(",
"\"The 'output' argument is optional. If it is not given, an output \"",
"\"file with the same... | https://github.com/Cantera/cantera/blob/0119484b261967ccb55a0066c020599cacc312e4/interfaces/cython/cantera/ctml2yaml.py#L2659-L2687 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py | python | Wm.wm_overrideredirect | (self, boolean=None) | return self._getboolean(self.tk.call(
'wm', 'overrideredirect', self._w, boolean)) | Instruct the window manager to ignore this widget
if BOOLEAN is given with 1. Return the current value if None
is given. | Instruct the window manager to ignore this widget
if BOOLEAN is given with 1. Return the current value if None
is given. | [
"Instruct",
"the",
"window",
"manager",
"to",
"ignore",
"this",
"widget",
"if",
"BOOLEAN",
"is",
"given",
"with",
"1",
".",
"Return",
"the",
"current",
"value",
"if",
"None",
"is",
"given",
"."
] | def wm_overrideredirect(self, boolean=None):
"""Instruct the window manager to ignore this widget
if BOOLEAN is given with 1. Return the current value if None
is given."""
return self._getboolean(self.tk.call(
'wm', 'overrideredirect', self._w, boolean)) | [
"def",
"wm_overrideredirect",
"(",
"self",
",",
"boolean",
"=",
"None",
")",
":",
"return",
"self",
".",
"_getboolean",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"'wm'",
",",
"'overrideredirect'",
",",
"self",
".",
"_w",
",",
"boolean",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py#L1943-L1948 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/slim/python/slim/data/data_provider.py | python | DataProvider.__init__ | (self, items_to_tensors, num_samples) | Constructs the Data Provider.
Args:
items_to_tensors: a dictionary of names to tensors.
num_samples: the number of samples in the dataset being provided. | Constructs the Data Provider. | [
"Constructs",
"the",
"Data",
"Provider",
"."
] | def __init__(self, items_to_tensors, num_samples):
"""Constructs the Data Provider.
Args:
items_to_tensors: a dictionary of names to tensors.
num_samples: the number of samples in the dataset being provided.
"""
self._items_to_tensors = items_to_tensors
self._num_samples = num_samples | [
"def",
"__init__",
"(",
"self",
",",
"items_to_tensors",
",",
"num_samples",
")",
":",
"self",
".",
"_items_to_tensors",
"=",
"items_to_tensors",
"self",
".",
"_num_samples",
"=",
"num_samples"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/slim/python/slim/data/data_provider.py#L52-L60 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | EventLoopBase.WakeUpIdle | (*args, **kwargs) | return _core_.EventLoopBase_WakeUpIdle(*args, **kwargs) | WakeUpIdle(self) | WakeUpIdle(self) | [
"WakeUpIdle",
"(",
"self",
")"
] | def WakeUpIdle(*args, **kwargs):
"""WakeUpIdle(self)"""
return _core_.EventLoopBase_WakeUpIdle(*args, **kwargs) | [
"def",
"WakeUpIdle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"EventLoopBase_WakeUpIdle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L8808-L8810 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | _CppLintState.PrintErrorCounts | (self) | Print a summary of errors by category, and the total. | Print a summary of errors by category, and the total. | [
"Print",
"a",
"summary",
"of",
"errors",
"by",
"category",
"and",
"the",
"total",
"."
] | def PrintErrorCounts(self):
"""Print a summary of errors by category, and the total."""
for category, count in self.errors_by_category.iteritems():
sys.stderr.write('Category \'%s\' errors found: %d\n' %
(category, count))
sys.stderr.write('Total errors found: %d\n' % self.error... | [
"def",
"PrintErrorCounts",
"(",
"self",
")",
":",
"for",
"category",
",",
"count",
"in",
"self",
".",
"errors_by_category",
".",
"iteritems",
"(",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"'Category \\'%s\\' errors found: %d\\n'",
"%",
"(",
"category... | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L621-L626 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/imaplib.py | python | IMAP4.xatom | (self, name, *args) | return self._simple_command(name, *args) | Allow simple extension commands
notified by server in CAPABILITY response.
Assumes command is legal in current state.
(typ, [data]) = <instance>.xatom(name, arg, ...)
Returns response appropriate to extension command `name'. | Allow simple extension commands
notified by server in CAPABILITY response. | [
"Allow",
"simple",
"extension",
"commands",
"notified",
"by",
"server",
"in",
"CAPABILITY",
"response",
"."
] | def xatom(self, name, *args):
"""Allow simple extension commands
notified by server in CAPABILITY response.
Assumes command is legal in current state.
(typ, [data]) = <instance>.xatom(name, arg, ...)
Returns response appropriate to extension command `name'.
"""... | [
"def",
"xatom",
"(",
"self",
",",
"name",
",",
"*",
"args",
")",
":",
"name",
"=",
"name",
".",
"upper",
"(",
")",
"#if not name in self.capabilities: # Let the server decide!",
"# raise self.error('unknown extension command: %s' % name)",
"if",
"not",
"name",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/imaplib.py#L895-L910 | |
tensorflow/deepmath | b5b721f54de1d5d6a02d78f5da5995237f9995f9 | deepmath/deephol/utilities/stats.py | python | merge_aggregate_stat | (target: deephol_stat_pb2.ProofAggregateStat,
source: deephol_stat_pb2.ProofAggregateStat) | Merge two aggregated statistics.
Args:
target: Aggregeated statistics to be updated.
source: Statistics to be merged in. | Merge two aggregated statistics. | [
"Merge",
"two",
"aggregated",
"statistics",
"."
] | def merge_aggregate_stat(target: deephol_stat_pb2.ProofAggregateStat,
source: deephol_stat_pb2.ProofAggregateStat):
"""Merge two aggregated statistics.
Args:
target: Aggregeated statistics to be updated.
source: Statistics to be merged in.
"""
target.num_theorems_attempted += s... | [
"def",
"merge_aggregate_stat",
"(",
"target",
":",
"deephol_stat_pb2",
".",
"ProofAggregateStat",
",",
"source",
":",
"deephol_stat_pb2",
".",
"ProofAggregateStat",
")",
":",
"target",
".",
"num_theorems_attempted",
"+=",
"source",
".",
"num_theorems_attempted",
"target... | https://github.com/tensorflow/deepmath/blob/b5b721f54de1d5d6a02d78f5da5995237f9995f9/deepmath/deephol/utilities/stats.py#L238-L267 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/D7AbsoluteCrossSections.py | python | D7AbsoluteCrossSections._read_experiment_properties | (self, ws) | Reads the user-provided dictionary that contains sample geometry (type, dimensions) and experimental conditions,
such as the beam size and calculates derived parameters. | Reads the user-provided dictionary that contains sample geometry (type, dimensions) and experimental conditions,
such as the beam size and calculates derived parameters. | [
"Reads",
"the",
"user",
"-",
"provided",
"dictionary",
"that",
"contains",
"sample",
"geometry",
"(",
"type",
"dimensions",
")",
"and",
"experimental",
"conditions",
"such",
"as",
"the",
"beam",
"size",
"and",
"calculates",
"derived",
"parameters",
"."
] | def _read_experiment_properties(self, ws):
"""Reads the user-provided dictionary that contains sample geometry (type, dimensions) and experimental conditions,
such as the beam size and calculates derived parameters."""
self._sampleAndEnvironmentProperties = self.getProperty('SampleAndEnvironmen... | [
"def",
"_read_experiment_properties",
"(",
"self",
",",
"ws",
")",
":",
"self",
".",
"_sampleAndEnvironmentProperties",
"=",
"self",
".",
"getProperty",
"(",
"'SampleAndEnvironmentProperties'",
")",
".",
"value",
"if",
"'InitialEnergy'",
"not",
"in",
"self",
".",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/D7AbsoluteCrossSections.py#L296-L311 | ||
Komnomnomnom/swigibpy | cfd307fdbfaffabc69a2dc037538d7e34a8b8daf | swigibpy.py | python | ComboLegList.size | (self) | return _swigibpy.ComboLegList_size(self) | size(ComboLegList self) -> std::vector< shared_ptr< ComboLeg > >::size_type | size(ComboLegList self) -> std::vector< shared_ptr< ComboLeg > >::size_type | [
"size",
"(",
"ComboLegList",
"self",
")",
"-",
">",
"std",
"::",
"vector<",
"shared_ptr<",
"ComboLeg",
">",
">",
"::",
"size_type"
] | def size(self):
"""size(ComboLegList self) -> std::vector< shared_ptr< ComboLeg > >::size_type"""
return _swigibpy.ComboLegList_size(self) | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"_swigibpy",
".",
"ComboLegList_size",
"(",
"self",
")"
] | https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L321-L323 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | cmake/developer_package/cpplint/cpplint.py | python | FileInfo.Split | (self) | return (project,) + os.path.splitext(rest) | Splits the file into the directory, basename, and extension.
For 'chrome/browser/browser.cc', Split() would
return ('chrome/browser', 'browser', '.cc')
Returns:
A tuple of (directory, basename, extension). | Splits the file into the directory, basename, and extension. | [
"Splits",
"the",
"file",
"into",
"the",
"directory",
"basename",
"and",
"extension",
"."
] | def Split(self):
"""Splits the file into the directory, basename, and extension.
For 'chrome/browser/browser.cc', Split() would
return ('chrome/browser', 'browser', '.cc')
Returns:
A tuple of (directory, basename, extension).
"""
googlename = self.RepositoryName()
projec... | [
"def",
"Split",
"(",
"self",
")",
":",
"googlename",
"=",
"self",
".",
"RepositoryName",
"(",
")",
"project",
",",
"rest",
"=",
"os",
".",
"path",
".",
"split",
"(",
"googlename",
")",
"return",
"(",
"project",
",",
")",
"+",
"os",
".",
"path",
"."... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/cmake/developer_package/cpplint/cpplint.py#L1379-L1391 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/urllib3/_collections.py | python | HTTPHeaderDict.itermerged | (self) | Iterate over all headers, merging duplicate ones together. | Iterate over all headers, merging duplicate ones together. | [
"Iterate",
"over",
"all",
"headers",
"merging",
"duplicate",
"ones",
"together",
"."
] | def itermerged(self):
"""Iterate over all headers, merging duplicate ones together."""
for key in self:
val = self._container[key.lower()]
yield val[0], ', '.join(val[1:]) | [
"def",
"itermerged",
"(",
"self",
")",
":",
"for",
"key",
"in",
"self",
":",
"val",
"=",
"self",
".",
"_container",
"[",
"key",
".",
"lower",
"(",
")",
"]",
"yield",
"val",
"[",
"0",
"]",
",",
"', '",
".",
"join",
"(",
"val",
"[",
"1",
":",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/urllib3/_collections.py#L293-L297 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBTypeNameSpecifier.__eq__ | (self, *args) | return _lldb.SBTypeNameSpecifier___eq__(self, *args) | __eq__(self, SBTypeNameSpecifier rhs) -> bool | __eq__(self, SBTypeNameSpecifier rhs) -> bool | [
"__eq__",
"(",
"self",
"SBTypeNameSpecifier",
"rhs",
")",
"-",
">",
"bool"
] | def __eq__(self, *args):
"""__eq__(self, SBTypeNameSpecifier rhs) -> bool"""
return _lldb.SBTypeNameSpecifier___eq__(self, *args) | [
"def",
"__eq__",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_lldb",
".",
"SBTypeNameSpecifier___eq__",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L11309-L11311 | |
openthread/openthread | 9fcdbed9c526c70f1556d1ed84099c1535c7cd32 | tools/otci/otci/otci.py | python | OTCI.srp_client_get_host_state | (self) | return self.__parse_str(self.execute_command('srp client host state')) | Get SRP client host state. | Get SRP client host state. | [
"Get",
"SRP",
"client",
"host",
"state",
"."
] | def srp_client_get_host_state(self):
"""Get SRP client host state."""
return self.__parse_str(self.execute_command('srp client host state')) | [
"def",
"srp_client_get_host_state",
"(",
"self",
")",
":",
"return",
"self",
".",
"__parse_str",
"(",
"self",
".",
"execute_command",
"(",
"'srp client host state'",
")",
")"
] | https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/tools/otci/otci/otci.py#L1089-L1091 | |
google/clif | cab24d6a105609a65c95a36a1712ae3c20c7b5df | clif/pyclif.py | python | _GetHeaders | (ast) | return wrap_header | Scan AST for header files. | Scan AST for header files. | [
"Scan",
"AST",
"for",
"header",
"files",
"."
] | def _GetHeaders(ast):
"""Scan AST for header files."""
# It's not moved to astutils yet because of asserts.
included = set(d.cpp_file for d in ast.decls if d.cpp_file)
if not included:
return None
if len(included) != 1:
raise argparse.ArgumentError(
'input_filename',
'must have exactly... | [
"def",
"_GetHeaders",
"(",
"ast",
")",
":",
"# It's not moved to astutils yet because of asserts.",
"included",
"=",
"set",
"(",
"d",
".",
"cpp_file",
"for",
"d",
"in",
"ast",
".",
"decls",
"if",
"d",
".",
"cpp_file",
")",
"if",
"not",
"included",
":",
"retu... | https://github.com/google/clif/blob/cab24d6a105609a65c95a36a1712ae3c20c7b5df/clif/pyclif.py#L122-L133 | |
CaoWGG/TensorRT-CenterNet | f949252e37b51e60f873808f46d3683f15735e79 | onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py | python | Type.get_size | (self) | return conf.lib.clang_Type_getSizeOf(self) | Retrieve the size of the record. | Retrieve the size of the record. | [
"Retrieve",
"the",
"size",
"of",
"the",
"record",
"."
] | def get_size(self):
"""
Retrieve the size of the record.
"""
return conf.lib.clang_Type_getSizeOf(self) | [
"def",
"get_size",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_Type_getSizeOf",
"(",
"self",
")"
] | https://github.com/CaoWGG/TensorRT-CenterNet/blob/f949252e37b51e60f873808f46d3683f15735e79/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py#L2089-L2093 | |
pybind/pybind11 | 6493f496e30c80f004772c906370c8f4db94b6ec | pybind11/setup_helpers.py | python | tmp_chdir | () | Prepare and enter a temporary directory, cleanup when done | Prepare and enter a temporary directory, cleanup when done | [
"Prepare",
"and",
"enter",
"a",
"temporary",
"directory",
"cleanup",
"when",
"done"
] | def tmp_chdir() -> Iterator[str]:
"Prepare and enter a temporary directory, cleanup when done"
# Threadsafe
with tmp_chdir_lock:
olddir = os.getcwd()
try:
tmpdir = tempfile.mkdtemp()
os.chdir(tmpdir)
yield tmpdir
finally:
os.chdir(oldd... | [
"def",
"tmp_chdir",
"(",
")",
"->",
"Iterator",
"[",
"str",
"]",
":",
"# Threadsafe",
"with",
"tmp_chdir_lock",
":",
"olddir",
"=",
"os",
".",
"getcwd",
"(",
")",
"try",
":",
"tmpdir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"os",
".",
"chdir",
"(... | https://github.com/pybind/pybind11/blob/6493f496e30c80f004772c906370c8f4db94b6ec/pybind11/setup_helpers.py#L216-L228 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | StatusBar.SetFields | (self, items) | Set the values of the statusbar fields from a list of strings. | Set the values of the statusbar fields from a list of strings. | [
"Set",
"the",
"values",
"of",
"the",
"statusbar",
"fields",
"from",
"a",
"list",
"of",
"strings",
"."
] | def SetFields(self, items):
"""Set the values of the statusbar fields from a list of strings. """
self.SetFieldsCount(len(items))
for i in range(len(items)):
self.SetStatusText(items[i], i) | [
"def",
"SetFields",
"(",
"self",
",",
"items",
")",
":",
"self",
".",
"SetFieldsCount",
"(",
"len",
"(",
"items",
")",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"items",
")",
")",
":",
"self",
".",
"SetStatusText",
"(",
"items",
"[",
"i",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L1325-L1329 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2.py | python | xmlDoc.htmlDocContentDumpOutput | (self, buf, encoding) | Dump an HTML document. Formating return/spaces are added. | Dump an HTML document. Formating return/spaces are added. | [
"Dump",
"an",
"HTML",
"document",
".",
"Formating",
"return",
"/",
"spaces",
"are",
"added",
"."
] | def htmlDocContentDumpOutput(self, buf, encoding):
"""Dump an HTML document. Formating return/spaces are added. """
if buf is None: buf__o = None
else: buf__o = buf._o
libxml2mod.htmlDocContentDumpOutput(buf__o, self._o, encoding) | [
"def",
"htmlDocContentDumpOutput",
"(",
"self",
",",
"buf",
",",
"encoding",
")",
":",
"if",
"buf",
"is",
"None",
":",
"buf__o",
"=",
"None",
"else",
":",
"buf__o",
"=",
"buf",
".",
"_o",
"libxml2mod",
".",
"htmlDocContentDumpOutput",
"(",
"buf__o",
",",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L3997-L4001 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PropertyGridInterface.SetPropertyValidator | (*args, **kwargs) | return _propgrid.PropertyGridInterface_SetPropertyValidator(*args, **kwargs) | SetPropertyValidator(self, PGPropArg id, Validator validator) | SetPropertyValidator(self, PGPropArg id, Validator validator) | [
"SetPropertyValidator",
"(",
"self",
"PGPropArg",
"id",
"Validator",
"validator",
")"
] | def SetPropertyValidator(*args, **kwargs):
"""SetPropertyValidator(self, PGPropArg id, Validator validator)"""
return _propgrid.PropertyGridInterface_SetPropertyValidator(*args, **kwargs) | [
"def",
"SetPropertyValidator",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridInterface_SetPropertyValidator",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L1446-L1448 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/core/numeric.py | python | normalize_axis_tuple | (axis, ndim, argname=None, allow_duplicate=False) | return axis | Normalizes an axis argument into a tuple of non-negative integer axes.
This handles shorthands such as ``1`` and converts them to ``(1,)``,
as well as performing the handling of negative indices covered by
`normalize_axis_index`.
By default, this forbids axes from being specified multiple times.
... | Normalizes an axis argument into a tuple of non-negative integer axes. | [
"Normalizes",
"an",
"axis",
"argument",
"into",
"a",
"tuple",
"of",
"non",
"-",
"negative",
"integer",
"axes",
"."
] | def normalize_axis_tuple(axis, ndim, argname=None, allow_duplicate=False):
"""
Normalizes an axis argument into a tuple of non-negative integer axes.
This handles shorthands such as ``1`` and converts them to ``(1,)``,
as well as performing the handling of negative indices covered by
`normalize_axi... | [
"def",
"normalize_axis_tuple",
"(",
"axis",
",",
"ndim",
",",
"argname",
"=",
"None",
",",
"allow_duplicate",
"=",
"False",
")",
":",
"# Optimization to speed-up the most common cases.",
"if",
"type",
"(",
"axis",
")",
"not",
"in",
"(",
"tuple",
",",
"list",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/core/numeric.py#L1277-L1333 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/Input/BlockEditor.py | python | BlockEditor._applyAndClose | (self) | Apply any changes the user has made then close the window | Apply any changes the user has made then close the window | [
"Apply",
"any",
"changes",
"the",
"user",
"has",
"made",
"then",
"close",
"the",
"window"
] | def _applyAndClose(self):
"""
Apply any changes the user has made then close the window
"""
if self.apply_button.isEnabled():
self.applyChanges()
self.appliedAndClosed.emit(self.block)
self.close() | [
"def",
"_applyAndClose",
"(",
"self",
")",
":",
"if",
"self",
".",
"apply_button",
".",
"isEnabled",
"(",
")",
":",
"self",
".",
"applyChanges",
"(",
")",
"self",
".",
"appliedAndClosed",
".",
"emit",
"(",
"self",
".",
"block",
")",
"self",
".",
"close... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/Input/BlockEditor.py#L187-L194 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | PageSetupDialogData.GetDefaultMinMargins | (*args, **kwargs) | return _windows_.PageSetupDialogData_GetDefaultMinMargins(*args, **kwargs) | GetDefaultMinMargins(self) -> bool | GetDefaultMinMargins(self) -> bool | [
"GetDefaultMinMargins",
"(",
"self",
")",
"-",
">",
"bool"
] | def GetDefaultMinMargins(*args, **kwargs):
"""GetDefaultMinMargins(self) -> bool"""
return _windows_.PageSetupDialogData_GetDefaultMinMargins(*args, **kwargs) | [
"def",
"GetDefaultMinMargins",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PageSetupDialogData_GetDefaultMinMargins",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L4886-L4888 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/distutils/misc_util.py | python | Configuration.set_options | (self, **options) | Configure Configuration instance.
The following options are available:
- ignore_setup_xxx_py
- assume_default_configuration
- delegate_options_to_subpackages
- quiet | Configure Configuration instance. | [
"Configure",
"Configuration",
"instance",
"."
] | def set_options(self, **options):
"""
Configure Configuration instance.
The following options are available:
- ignore_setup_xxx_py
- assume_default_configuration
- delegate_options_to_subpackages
- quiet
"""
for key, value in options.items():... | [
"def",
"set_options",
"(",
"self",
",",
"*",
"*",
"options",
")",
":",
"for",
"key",
",",
"value",
"in",
"options",
".",
"items",
"(",
")",
":",
"if",
"key",
"in",
"self",
".",
"options",
":",
"self",
".",
"options",
"[",
"key",
"]",
"=",
"value"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/distutils/misc_util.py#L864-L879 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/html5lib/treebuilders/base.py | python | Node.insertBefore | (self, node, refNode) | Insert node as a child of the current node, before refNode in the
list of child nodes. Raises ValueError if refNode is not a child of
the current node
:arg node: the node to insert
:arg refNode: the child node to insert the node before | Insert node as a child of the current node, before refNode in the | [
"Insert",
"node",
"as",
"a",
"child",
"of",
"the",
"current",
"node",
"before",
"refNode",
"in",
"the"
] | def insertBefore(self, node, refNode):
"""Insert node as a child of the current node, before refNode in the
list of child nodes. Raises ValueError if refNode is not a child of
the current node
:arg node: the node to insert
:arg refNode: the child node to insert the node ... | [
"def",
"insertBefore",
"(",
"self",
",",
"node",
",",
"refNode",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/html5lib/treebuilders/base.py#L153-L173 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/memory_stats/python/ops/memory_stats_ops.py | python | BytesLimit | () | return gen_memory_stats_ops.bytes_limit() | Generates an op that measures the total memory (in bytes) of a device. | Generates an op that measures the total memory (in bytes) of a device. | [
"Generates",
"an",
"op",
"that",
"measures",
"the",
"total",
"memory",
"(",
"in",
"bytes",
")",
"of",
"a",
"device",
"."
] | def BytesLimit():
"""Generates an op that measures the total memory (in bytes) of a device."""
return gen_memory_stats_ops.bytes_limit() | [
"def",
"BytesLimit",
"(",
")",
":",
"return",
"gen_memory_stats_ops",
".",
"bytes_limit",
"(",
")"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/memory_stats/python/ops/memory_stats_ops.py#L34-L36 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/aui_utilities.py | python | IndentPressedBitmap | (rect, button_state) | return rect | Indents the input rectangle `rect` based on the value of `button_state`.
:param Rect `rect`: the button bitmap rectangle;
:param integer `button_state`: the button state. | Indents the input rectangle `rect` based on the value of `button_state`. | [
"Indents",
"the",
"input",
"rectangle",
"rect",
"based",
"on",
"the",
"value",
"of",
"button_state",
"."
] | def IndentPressedBitmap(rect, button_state):
"""
Indents the input rectangle `rect` based on the value of `button_state`.
:param Rect `rect`: the button bitmap rectangle;
:param integer `button_state`: the button state.
"""
if button_state == AUI_BUTTON_STATE_PRESSED:
rect.x += 1
... | [
"def",
"IndentPressedBitmap",
"(",
"rect",
",",
"button_state",
")",
":",
"if",
"button_state",
"==",
"AUI_BUTTON_STATE_PRESSED",
":",
"rect",
".",
"x",
"+=",
"1",
"rect",
".",
"y",
"+=",
"1",
"return",
"rect"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/aui_utilities.py#L147-L159 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/metrics/pairwise.py | python | pairwise_distances | (X, Y=None, metric="euclidean", n_jobs=None,
force_all_finite=True, **kwds) | return _parallel_pairwise(X, Y, func, n_jobs, **kwds) | Compute the distance matrix from a vector array X and optional Y.
This method takes either a vector array or a distance matrix, and returns
a distance matrix. If the input is a vector array, the distances are
computed. If the input is a distances matrix, it is returned instead.
This method provides a ... | Compute the distance matrix from a vector array X and optional Y. | [
"Compute",
"the",
"distance",
"matrix",
"from",
"a",
"vector",
"array",
"X",
"and",
"optional",
"Y",
"."
] | def pairwise_distances(X, Y=None, metric="euclidean", n_jobs=None,
force_all_finite=True, **kwds):
""" Compute the distance matrix from a vector array X and optional Y.
This method takes either a vector array or a distance matrix, and returns
a distance matrix. If the input is a vect... | [
"def",
"pairwise_distances",
"(",
"X",
",",
"Y",
"=",
"None",
",",
"metric",
"=",
"\"euclidean\"",
",",
"n_jobs",
"=",
"None",
",",
"force_all_finite",
"=",
"True",
",",
"*",
"*",
"kwds",
")",
":",
"if",
"(",
"metric",
"not",
"in",
"_VALID_METRICS",
"a... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/metrics/pairwise.py#L1609-L1752 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/learn/python/learn/estimators/head.py | python | loss_only_head | (loss_fn, head_name=None) | return _LossOnlyHead(loss_fn, head_name=head_name) | Creates a Head that contains only loss terms.
Loss only head holds additional loss terms to be added to other heads and
usually represents additional regularization terms in the objective function.
Args:
loss_fn: a function that takes no argument and returns a list of
scalar tensors.
head_name: ... | Creates a Head that contains only loss terms. | [
"Creates",
"a",
"Head",
"that",
"contains",
"only",
"loss",
"terms",
"."
] | def loss_only_head(loss_fn, head_name=None):
"""Creates a Head that contains only loss terms.
Loss only head holds additional loss terms to be added to other heads and
usually represents additional regularization terms in the objective function.
Args:
loss_fn: a function that takes no argument and returns... | [
"def",
"loss_only_head",
"(",
"loss_fn",
",",
"head_name",
"=",
"None",
")",
":",
"return",
"_LossOnlyHead",
"(",
"loss_fn",
",",
"head_name",
"=",
"head_name",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/learn/python/learn/estimators/head.py#L430-L444 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/timeseries/python/timeseries/model.py | python | SequentialTimeSeriesModel._window_initializer | (self, times, state) | Prepare for training or prediction on a window of data.
Args:
times: A [batch size x window size] Tensor with times for each
observation.
state: Model-dependent state, each with size [batch size x ...]. The
number and type will typically be fixed by the model (for example a
... | Prepare for training or prediction on a window of data. | [
"Prepare",
"for",
"training",
"or",
"prediction",
"on",
"a",
"window",
"of",
"data",
"."
] | def _window_initializer(self, times, state):
"""Prepare for training or prediction on a window of data.
Args:
times: A [batch size x window size] Tensor with times for each
observation.
state: Model-dependent state, each with size [batch size x ...]. The
number and type will typ... | [
"def",
"_window_initializer",
"(",
"self",
",",
"times",
",",
"state",
")",
":",
"pass"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/timeseries/python/timeseries/model.py#L436-L448 | ||
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/distributed/ClockDelta.py | python | ClockDelta.networkToLocalTime | (self, networkTime, now = None, bits = 16,
ticksPerSec=NetworkTimePrecision) | return now + float(diff) / ticksPerSec | networkToLocalTime(self, int networkTime)
Converts the indicated networkTime to the corresponding
localTime value. The time is assumed to be within +/- 5
minutes of the current local time given in now, or
getRealTime() if now is not specified. | networkToLocalTime(self, int networkTime) | [
"networkToLocalTime",
"(",
"self",
"int",
"networkTime",
")"
] | def networkToLocalTime(self, networkTime, now = None, bits = 16,
ticksPerSec=NetworkTimePrecision):
"""networkToLocalTime(self, int networkTime)
Converts the indicated networkTime to the corresponding
localTime value. The time is assumed to be within +/- 5
mi... | [
"def",
"networkToLocalTime",
"(",
"self",
",",
"networkTime",
",",
"now",
"=",
"None",
",",
"bits",
"=",
"16",
",",
"ticksPerSec",
"=",
"NetworkTimePrecision",
")",
":",
"if",
"now",
"is",
"None",
":",
"now",
"=",
"self",
".",
"globalClock",
".",
"getRea... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/distributed/ClockDelta.py#L235-L268 | |
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | bindings/pyroot/pythonizations/python/ROOT/_pythonization/_roofit/_roojsonfactorywstool.py | python | RooJSONFactoryWSTool.gendoc | (cls) | return hs3 | Generate the importer and exporter documentation. | Generate the importer and exporter documentation. | [
"Generate",
"the",
"importer",
"and",
"exporter",
"documentation",
"."
] | def gendoc(cls):
"""Generate the importer and exporter documentation."""
hs3 = {}
for key, importer in cls.importers():
if not key in hs3.keys():
hs3[key] = {}
if not "import" in hs3[key]:
hs3[key]["import"] = []
hs3[key]["impo... | [
"def",
"gendoc",
"(",
"cls",
")",
":",
"hs3",
"=",
"{",
"}",
"for",
"key",
",",
"importer",
"in",
"cls",
".",
"importers",
"(",
")",
":",
"if",
"not",
"key",
"in",
"hs3",
".",
"keys",
"(",
")",
":",
"hs3",
"[",
"key",
"]",
"=",
"{",
"}",
"i... | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_roofit/_roojsonfactorywstool.py#L16-L72 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/contrib/slim/quantization/quantization_pass.py | python | _get_input_name_index | (op, input_var_name) | return res | Get the input name and index of the var_name in the op | Get the input name and index of the var_name in the op | [
"Get",
"the",
"input",
"name",
"and",
"index",
"of",
"the",
"var_name",
"in",
"the",
"op"
] | def _get_input_name_index(op, input_var_name):
"""Get the input name and index of the var_name in the op"""
assert isinstance(op, (IrNode, Operator)), \
"The input op should be IrNode or Operator."
op_name = op.name() if isinstance(op, IrNode) \
else op.type
if op_name not in _op_real_in... | [
"def",
"_get_input_name_index",
"(",
"op",
",",
"input_var_name",
")",
":",
"assert",
"isinstance",
"(",
"op",
",",
"(",
"IrNode",
",",
"Operator",
")",
")",
",",
"\"The input op should be IrNode or Operator.\"",
"op_name",
"=",
"op",
".",
"name",
"(",
")",
"i... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py#L175-L190 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/gyp/pylib/gyp/__init__.py | python | NameValueListToDict | (name_value_list) | return result | Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary
of the pairs. If a string is simply NAME, then the value in the dictionary
is set to True. If VALUE can be converted to an integer, it is. | Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary
of the pairs. If a string is simply NAME, then the value in the dictionary
is set to True. If VALUE can be converted to an integer, it is. | [
"Takes",
"an",
"array",
"of",
"strings",
"of",
"the",
"form",
"NAME",
"=",
"VALUE",
"and",
"creates",
"a",
"dictionary",
"of",
"the",
"pairs",
".",
"If",
"a",
"string",
"is",
"simply",
"NAME",
"then",
"the",
"value",
"in",
"the",
"dictionary",
"is",
"s... | def NameValueListToDict(name_value_list):
"""
Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary
of the pairs. If a string is simply NAME, then the value in the dictionary
is set to True. If VALUE can be converted to an integer, it is.
"""
result = {}
for item in name_valu... | [
"def",
"NameValueListToDict",
"(",
"name_value_list",
")",
":",
"result",
"=",
"{",
"}",
"for",
"item",
"in",
"name_value_list",
":",
"tokens",
"=",
"item",
".",
"split",
"(",
"\"=\"",
",",
"1",
")",
"if",
"len",
"(",
"tokens",
")",
"==",
"2",
":",
"... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/__init__.py#L156-L176 | |
facebookincubator/BOLT | 88c70afe9d388ad430cc150cc158641701397f70 | lldb/examples/python/file_extract.py | python | FileExtract.get_n_sint32 | (self, n, fail_value=0) | Extract "n" int32_t integers from the binary file at the current file position, returns a list of integers | Extract "n" int32_t integers from the binary file at the current file position, returns a list of integers | [
"Extract",
"n",
"int32_t",
"integers",
"from",
"the",
"binary",
"file",
"at",
"the",
"current",
"file",
"position",
"returns",
"a",
"list",
"of",
"integers"
] | def get_n_sint32(self, n, fail_value=0):
'''Extract "n" int32_t integers from the binary file at the current file position, returns a list of integers'''
s = self.read_size(4 * n)
if s:
return struct.unpack(self.byte_order + ("%u" % n) + 'i', s)
else:
return (fail... | [
"def",
"get_n_sint32",
"(",
"self",
",",
"n",
",",
"fail_value",
"=",
"0",
")",
":",
"s",
"=",
"self",
".",
"read_size",
"(",
"4",
"*",
"n",
")",
"if",
"s",
":",
"return",
"struct",
".",
"unpack",
"(",
"self",
".",
"byte_order",
"+",
"(",
"\"%u\"... | https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/lldb/examples/python/file_extract.py#L196-L202 | ||
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | util/gerrit-bot/gerrit.py | python | GerritRestAPI.list_reviewers | (self, change_id) | return self._get(f"/changes/{change_id}/reviewers") | list reviewers of a change | list reviewers of a change | [
"list",
"reviewers",
"of",
"a",
"change"
] | def list_reviewers(self, change_id):
""" list reviewers of a change """
return self._get(f"/changes/{change_id}/reviewers") | [
"def",
"list_reviewers",
"(",
"self",
",",
"change_id",
")",
":",
"return",
"self",
".",
"_get",
"(",
"f\"/changes/{change_id}/reviewers\"",
")"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/util/gerrit-bot/gerrit.py#L112-L114 | |
luliyucoordinate/Leetcode | 96afcdc54807d1d184e881a075d1dbf3371e31fb | src/0957-Prison-Cells-After-N-Days/0957.py | python | Solution.prisonAfterNDays | (self, cells, N) | return cells | :type cells: List[int]
:type N: int
:rtype: List[int] | :type cells: List[int]
:type N: int
:rtype: List[int] | [
":",
"type",
"cells",
":",
"List",
"[",
"int",
"]",
":",
"type",
"N",
":",
"int",
":",
"rtype",
":",
"List",
"[",
"int",
"]"
] | def prisonAfterNDays(self, cells, N):
"""
:type cells: List[int]
:type N: int
:rtype: List[int]
"""
N = N % 14
if not N:
N = 14
for _ in range(N):
for i in range(1, len(cells) - 1):
if cells[i-1] & 1 ==... | [
"def",
"prisonAfterNDays",
"(",
"self",
",",
"cells",
",",
"N",
")",
":",
"N",
"=",
"N",
"%",
"14",
"if",
"not",
"N",
":",
"N",
"=",
"14",
"for",
"_",
"in",
"range",
"(",
"N",
")",
":",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"len",
"(",
... | https://github.com/luliyucoordinate/Leetcode/blob/96afcdc54807d1d184e881a075d1dbf3371e31fb/src/0957-Prison-Cells-After-N-Days/0957.py#L2-L20 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Rect.Intersects | (*args, **kwargs) | return _core_.Rect_Intersects(*args, **kwargs) | Intersects(self, Rect rect) -> bool
Returns True if the rectangles have a non empty intersection. | Intersects(self, Rect rect) -> bool | [
"Intersects",
"(",
"self",
"Rect",
"rect",
")",
"-",
">",
"bool"
] | def Intersects(*args, **kwargs):
"""
Intersects(self, Rect rect) -> bool
Returns True if the rectangles have a non empty intersection.
"""
return _core_.Rect_Intersects(*args, **kwargs) | [
"def",
"Intersects",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Rect_Intersects",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L1533-L1539 | |
echronos/echronos | c996f1d2c8af6c6536205eb319c1bf1d4d84569c | prj/app/lib/util/crc16.py | python | Crc16Ccitt.add | (self, byte) | Add a new byte to the CRC engine. 'byte'
should be a python character. E.g: c.add('x') | Add a new byte to the CRC engine. 'byte'
should be a python character. E.g: c.add('x') | [
"Add",
"a",
"new",
"byte",
"to",
"the",
"CRC",
"engine",
".",
"byte",
"should",
"be",
"a",
"python",
"character",
".",
"E",
".",
"g",
":",
"c",
".",
"add",
"(",
"x",
")"
] | def add(self, byte):
"""Add a new byte to the CRC engine. 'byte'
should be a python character. E.g: c.add('x')
"""
# CRC-16 polynomial
poly_s = byte ^ (self.state >> 8)
poly_t = poly_s ^ (poly_s >> 4)
result = s16l(self.state, 8) ^ poly_t ^ s16l(poly_t, 5) ^ s16l... | [
"def",
"add",
"(",
"self",
",",
"byte",
")",
":",
"# CRC-16 polynomial",
"poly_s",
"=",
"byte",
"^",
"(",
"self",
".",
"state",
">>",
"8",
")",
"poly_t",
"=",
"poly_s",
"^",
"(",
"poly_s",
">>",
"4",
")",
"result",
"=",
"s16l",
"(",
"self",
".",
... | https://github.com/echronos/echronos/blob/c996f1d2c8af6c6536205eb319c1bf1d4d84569c/prj/app/lib/util/crc16.py#L43-L52 | ||
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/ptable.py | python | PTable.flatten | (self, **option) | return transforms.flatten(self, **option) | 对于每个Key和Value中的每个元素(value 1, value 2, ... value m),构造(Key, value 1), (Key, value 2), ... (Key, value m),结果使用PCollection表示
Returns:
PCollection: 表示结果的PCollection | 对于每个Key和Value中的每个元素(value 1, value 2, ... value m),构造(Key, value 1), (Key, value 2), ... (Key, value m),结果使用PCollection表示 | [
"对于每个Key和Value中的每个元素",
"(",
"value",
"1",
"value",
"2",
"...",
"value",
"m",
")",
",构造",
"(",
"Key",
"value",
"1",
")",
"(",
"Key",
"value",
"2",
")",
"...",
"(",
"Key",
"value",
"m",
")",
",结果使用PCollection表示"
] | def flatten(self, **option):
"""
对于每个Key和Value中的每个元素(value 1, value 2, ... value m),构造(Key, value 1), (Key, value 2), ... (Key, value m),结果使用PCollection表示
Returns:
PCollection: 表示结果的PCollection
"""
return transforms.flatten(self, **option) | [
"def",
"flatten",
"(",
"self",
",",
"*",
"*",
"option",
")",
":",
"return",
"transforms",
".",
"flatten",
"(",
"self",
",",
"*",
"*",
"option",
")"
] | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/ptable.py#L254-L261 | |
google-ar/WebARonTango | e86965d2cbc652156b480e0fcf77c716745578cd | chromium/src/gpu/command_buffer/build_gles2_cmd_buffer.py | python | GETnHandler.WriteServiceImplementation | (self, func, f) | Overrriden from TypeHandler. | Overrriden from TypeHandler. | [
"Overrriden",
"from",
"TypeHandler",
"."
] | def WriteServiceImplementation(self, func, f):
"""Overrriden from TypeHandler."""
self.WriteServiceHandlerFunctionHeader(func, f)
last_arg = func.GetLastOriginalArg()
# All except shm_id and shm_offset.
all_but_last_args = func.GetCmdArgs()[:-2]
for arg in all_but_last_args:
arg.WriteGetCo... | [
"def",
"WriteServiceImplementation",
"(",
"self",
",",
"func",
",",
"f",
")",
":",
"self",
".",
"WriteServiceHandlerFunctionHeader",
"(",
"func",
",",
"f",
")",
"last_arg",
"=",
"func",
".",
"GetLastOriginalArg",
"(",
")",
"# All except shm_id and shm_offset.",
"a... | https://github.com/google-ar/WebARonTango/blob/e86965d2cbc652156b480e0fcf77c716745578cd/chromium/src/gpu/command_buffer/build_gles2_cmd_buffer.py#L6649-L6699 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/mapreduce/mapreduce/api/map_job/abstract_datastore_input_reader.py | python | AbstractDatastoreInputReader._get_query_spec | (cls, params) | return model.QuerySpec(
entity_kind=cls._get_raw_entity_kind(entity_kind),
keys_only=bool(params.get(cls.KEYS_ONLY_PARAM, False)),
filters=filters,
batch_size=int(params.get(cls.BATCH_SIZE_PARAM, cls._BATCH_SIZE)),
model_class_path=entity_kind,
app=app,
ns=ns) | Construct a model.QuerySpec from model.MapperSpec. | Construct a model.QuerySpec from model.MapperSpec. | [
"Construct",
"a",
"model",
".",
"QuerySpec",
"from",
"model",
".",
"MapperSpec",
"."
] | def _get_query_spec(cls, params):
"""Construct a model.QuerySpec from model.MapperSpec."""
entity_kind = params[cls.ENTITY_KIND_PARAM]
filters = params.get(cls.FILTERS_PARAM)
app = params.get(cls._APP_PARAM)
ns = params.get(cls.NAMESPACE_PARAM)
return model.QuerySpec(
entity_kind=cls._g... | [
"def",
"_get_query_spec",
"(",
"cls",
",",
"params",
")",
":",
"entity_kind",
"=",
"params",
"[",
"cls",
".",
"ENTITY_KIND_PARAM",
"]",
"filters",
"=",
"params",
".",
"get",
"(",
"cls",
".",
"FILTERS_PARAM",
")",
"app",
"=",
"params",
".",
"get",
"(",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/mapreduce/mapreduce/api/map_job/abstract_datastore_input_reader.py#L73-L87 | |
nasa/astrobee | 9241e67e6692810d6e275abb3165b6d02f4ca5ef | localization/sparse_mapping/tools/build_theia_map.py | python | which | (program) | return None | Find if a program is in the PATH | Find if a program is in the PATH | [
"Find",
"if",
"a",
"program",
"is",
"in",
"the",
"PATH"
] | def which(program):
"""Find if a program is in the PATH"""
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
for path in os.environ["PATH"].split... | [
"def",
"which",
"(",
"program",
")",
":",
"def",
"is_exe",
"(",
"fpath",
")",
":",
"return",
"os",
".",
"path",
".",
"isfile",
"(",
"fpath",
")",
"and",
"os",
".",
"access",
"(",
"fpath",
",",
"os",
".",
"X_OK",
")",
"fpath",
",",
"fname",
"=",
... | https://github.com/nasa/astrobee/blob/9241e67e6692810d6e275abb3165b6d02f4ca5ef/localization/sparse_mapping/tools/build_theia_map.py#L35-L52 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/cpplint.py | python | ReverseCloseExpression | (clean_lines, linenum, pos) | return (line, 0, -1) | If input points to ) or } or ] or >, finds the position that opens it.
If lines[linenum][pos] points to a ')' or '}' or ']' or '>', finds the
linenum/pos that correspond to the opening of the expression.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to ... | If input points to ) or } or ] or >, finds the position that opens it. | [
"If",
"input",
"points",
"to",
")",
"or",
"}",
"or",
"]",
"or",
">",
"finds",
"the",
"position",
"that",
"opens",
"it",
"."
] | def ReverseCloseExpression(clean_lines, linenum, pos):
"""If input points to ) or } or ] or >, finds the position that opens it.
If lines[linenum][pos] points to a ')' or '}' or ']' or '>', finds the
linenum/pos that correspond to the opening of the expression.
Args:
clean_lines: A CleansedLines instance ... | [
"def",
"ReverseCloseExpression",
"(",
"clean_lines",
",",
"linenum",
",",
"pos",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"if",
"line",
"[",
"pos",
"]",
"not",
"in",
"')}]>'",
":",
"return",
"(",
"line",
",",
"0",
",",
... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/cpplint.py#L2208-L2243 | |
tangzhenyu/Scene-Text-Understanding | 0f7ffc7aea5971a50cdc03d33d0a41075285948b | ctpn_crnn_ocr/CTPN/caffe/scripts/cpp_lint.py | python | CheckForHeaderGuard | (filename, lines, error) | Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used.
Args:
filename: The name of the C++ header file.
lines: An array of strings, each representing a line of the file.
error: The function to call... | Checks that the file contains a header guard. | [
"Checks",
"that",
"the",
"file",
"contains",
"a",
"header",
"guard",
"."
] | def CheckForHeaderGuard(filename, lines, error):
"""Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used.
Args:
filename: The name of the C++ header file.
lines: An array of strings, each representi... | [
"def",
"CheckForHeaderGuard",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"cppvar",
"=",
"GetHeaderGuardCPPVariable",
"(",
"filename",
")",
"ifndef",
"=",
"None",
"ifndef_linenum",
"=",
"0",
"define",
"=",
"None",
"endif",
"=",
"None",
"endif_linenu... | https://github.com/tangzhenyu/Scene-Text-Understanding/blob/0f7ffc7aea5971a50cdc03d33d0a41075285948b/ctpn_crnn_ocr/CTPN/caffe/scripts/cpp_lint.py#L1408-L1480 | ||
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py | python | PtyProcess.readline | (self) | return s | Read one line from the pseudoterminal, and return it as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed. | Read one line from the pseudoterminal, and return it as unicode. | [
"Read",
"one",
"line",
"from",
"the",
"pseudoterminal",
"and",
"return",
"it",
"as",
"unicode",
"."
] | def readline(self):
"""Read one line from the pseudoterminal, and return it as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
"""
try:
s = self.fileobj.readline()
except (OSError, IOError) as err:
... | [
"def",
"readline",
"(",
"self",
")",
":",
"try",
":",
"s",
"=",
"self",
".",
"fileobj",
".",
"readline",
"(",
")",
"except",
"(",
"OSError",
",",
"IOError",
")",
"as",
"err",
":",
"if",
"err",
".",
"args",
"[",
"0",
"]",
"==",
"errno",
".",
"EI... | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py#L530-L549 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/eager/tape.py | python | record_operation | (op_type, output_tensors, input_tensors, backward_function) | Records the operation on all tapes in the stack. | Records the operation on all tapes in the stack. | [
"Records",
"the",
"operation",
"on",
"all",
"tapes",
"in",
"the",
"stack",
"."
] | def record_operation(op_type, output_tensors, input_tensors, backward_function):
"""Records the operation on all tapes in the stack."""
for t in _tape_stack.stack:
t.record_operation(op_type, output_tensors,
input_tensors,
backward_function) | [
"def",
"record_operation",
"(",
"op_type",
",",
"output_tensors",
",",
"input_tensors",
",",
"backward_function",
")",
":",
"for",
"t",
"in",
"_tape_stack",
".",
"stack",
":",
"t",
".",
"record_operation",
"(",
"op_type",
",",
"output_tensors",
",",
"input_tenso... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/eager/tape.py#L177-L182 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/VBox/ValidationKit/common/utils.py | python | formatIntervalHours | (cHours) | return sRet[:-1] | Format a hours interval into a nice 1w 2d 1h string. | Format a hours interval into a nice 1w 2d 1h string. | [
"Format",
"a",
"hours",
"interval",
"into",
"a",
"nice",
"1w",
"2d",
"1h",
"string",
"."
] | def formatIntervalHours(cHours):
""" Format a hours interval into a nice 1w 2d 1h string. """
# Simple special cases.
if cHours < 24:
return '%sh' % (cHours,);
# Generic and a bit slower.
cWeeks = cHours / (7 * 24);
cHours %= 7 * 24;
cDays = cHours / 24;
cHours %= 24;... | [
"def",
"formatIntervalHours",
"(",
"cHours",
")",
":",
"# Simple special cases.",
"if",
"cHours",
"<",
"24",
":",
"return",
"'%sh'",
"%",
"(",
"cHours",
",",
")",
"# Generic and a bit slower.",
"cWeeks",
"=",
"cHours",
"/",
"(",
"7",
"*",
"24",
")",
"cHours"... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/VBox/ValidationKit/common/utils.py#L1452-L1471 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/minimum-increment-to-make-array-unique.py | python | Solution.minIncrementForUnique | (self, A) | return result | :type A: List[int]
:rtype: int | :type A: List[int]
:rtype: int | [
":",
"type",
"A",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def minIncrementForUnique(self, A):
"""
:type A: List[int]
:rtype: int
"""
A.sort()
A.append(float("inf"))
result, duplicate = 0, 0
for i in xrange(1, len(A)):
if A[i-1] == A[i]:
duplicate += 1
result -= A[i]
... | [
"def",
"minIncrementForUnique",
"(",
"self",
",",
"A",
")",
":",
"A",
".",
"sort",
"(",
")",
"A",
".",
"append",
"(",
"float",
"(",
"\"inf\"",
")",
")",
"result",
",",
"duplicate",
"=",
"0",
",",
"0",
"for",
"i",
"in",
"xrange",
"(",
"1",
",",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/minimum-increment-to-make-array-unique.py#L5-L21 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | syzygy/scripts/benchmark/chrome_control.py | python | GetPreload | () | Reads Chrome.dll preload settings from the registry.
Returns:
The percentage of chrome.dll that will be preloaded. | Reads Chrome.dll preload settings from the registry. | [
"Reads",
"Chrome",
".",
"dll",
"preload",
"settings",
"from",
"the",
"registry",
"."
] | def GetPreload():
"""Reads Chrome.dll preload settings from the registry.
Returns:
The percentage of chrome.dll that will be preloaded.
"""
try:
with _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, _CHROME_FRAME_KEY) as key:
percentage = _GetDWORDValue(key, _PREREAD_PERCENTAGE_VALUE)
if percenta... | [
"def",
"GetPreload",
"(",
")",
":",
"try",
":",
"with",
"_winreg",
".",
"OpenKey",
"(",
"_winreg",
".",
"HKEY_CURRENT_USER",
",",
"_CHROME_FRAME_KEY",
")",
"as",
"key",
":",
"percentage",
"=",
"_GetDWORDValue",
"(",
"key",
",",
"_PREREAD_PERCENTAGE_VALUE",
")"... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/syzygy/scripts/benchmark/chrome_control.py#L169-L186 | ||
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/pyserial/examples/port_publisher.py | python | Forwarder.close | (self) | Close all resources and unpublish service | Close all resources and unpublish service | [
"Close",
"all",
"resources",
"and",
"unpublish",
"service"
] | def close(self):
"""Close all resources and unpublish service"""
if self.log is not None:
self.log.info("{}: closing...".format(self.device))
self.alive = False
self.unpublish()
if self.server_socket:
self.server_socket.close()
if self.socket:
... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"log",
"is",
"not",
"None",
":",
"self",
".",
"log",
".",
"info",
"(",
"\"{}: closing...\"",
".",
"format",
"(",
"self",
".",
"device",
")",
")",
"self",
".",
"alive",
"=",
"False",
"self",
... | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/pyserial/examples/port_publisher.py#L165-L180 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | ConfigBase_Create | (*args) | return _misc_.ConfigBase_Create(*args) | ConfigBase_Create() -> ConfigBase
Create and return a new global config object. This function will
create the "best" implementation of wx.Config available for the
current platform. | ConfigBase_Create() -> ConfigBase | [
"ConfigBase_Create",
"()",
"-",
">",
"ConfigBase"
] | def ConfigBase_Create(*args):
"""
ConfigBase_Create() -> ConfigBase
Create and return a new global config object. This function will
create the "best" implementation of wx.Config available for the
current platform.
"""
return _misc_.ConfigBase_Create(*args) | [
"def",
"ConfigBase_Create",
"(",
"*",
"args",
")",
":",
"return",
"_misc_",
".",
"ConfigBase_Create",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L3467-L3475 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/auibar.py | python | AuiToolBarItem.SetSizerItem | (self, s) | Associates a sizer item to this toolbar item.
:param `s`: an instance of :class:`SizerItem`. | Associates a sizer item to this toolbar item. | [
"Associates",
"a",
"sizer",
"item",
"to",
"this",
"toolbar",
"item",
"."
] | def SetSizerItem(self, s):
"""
Associates a sizer item to this toolbar item.
:param `s`: an instance of :class:`SizerItem`.
"""
self.sizer_item = s | [
"def",
"SetSizerItem",
"(",
"self",
",",
"s",
")",
":",
"self",
".",
"sizer_item",
"=",
"s"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/auibar.py#L434-L441 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListCtrl.GetClassDefaultAttributes | (self, variant) | return attr | Returns the default font and colours which are used by the control. This is
useful if you want to use the same font or colour in your own control as in
a standard control -- which is a much better idea than hard coding specific
colours or fonts which might look completely out of place on the use... | Returns the default font and colours which are used by the control. This is
useful if you want to use the same font or colour in your own control as in
a standard control -- which is a much better idea than hard coding specific
colours or fonts which might look completely out of place on the use... | [
"Returns",
"the",
"default",
"font",
"and",
"colours",
"which",
"are",
"used",
"by",
"the",
"control",
".",
"This",
"is",
"useful",
"if",
"you",
"want",
"to",
"use",
"the",
"same",
"font",
"or",
"colour",
"in",
"your",
"own",
"control",
"as",
"in",
"a"... | def GetClassDefaultAttributes(self, variant):
"""
Returns the default font and colours which are used by the control. This is
useful if you want to use the same font or colour in your own control as in
a standard control -- which is a much better idea than hard coding specific
co... | [
"def",
"GetClassDefaultAttributes",
"(",
"self",
",",
"variant",
")",
":",
"attr",
"=",
"wx",
".",
"VisualAttributes",
"(",
")",
"attr",
".",
"colFg",
"=",
"wx",
".",
"SystemSettings",
".",
"GetColour",
"(",
"wx",
".",
"SYS_COLOUR_LISTBOXTEXT",
")",
"attr",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ultimatelistctrl.py#L12419-L12445 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/protobuf/python/stubout.py | python | StubOutForTesting.Set | (self, parent, child_name, new_child) | Replace child_name's old definition with new_child, in the context
of the given parent. The parent could be a module when the child is a
function at module scope. Or the parent could be a class when a class'
method is being replaced. The named child is set to new_child, while
the prior definition is ... | Replace child_name's old definition with new_child, in the context
of the given parent. The parent could be a module when the child is a
function at module scope. Or the parent could be a class when a class'
method is being replaced. The named child is set to new_child, while
the prior definition is ... | [
"Replace",
"child_name",
"s",
"old",
"definition",
"with",
"new_child",
"in",
"the",
"context",
"of",
"the",
"given",
"parent",
".",
"The",
"parent",
"could",
"be",
"a",
"module",
"when",
"the",
"child",
"is",
"a",
"function",
"at",
"module",
"scope",
".",... | def Set(self, parent, child_name, new_child):
"""Replace child_name's old definition with new_child, in the context
of the given parent. The parent could be a module when the child is a
function at module scope. Or the parent could be a class when a class'
method is being replaced. The named child is... | [
"def",
"Set",
"(",
"self",
",",
"parent",
",",
"child_name",
",",
"new_child",
")",
":",
"old_child",
"=",
"getattr",
"(",
"parent",
",",
"child_name",
")",
"old_attribute",
"=",
"parent",
".",
"__dict__",
".",
"get",
"(",
"child_name",
")",
"if",
"old_a... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/protobuf/python/stubout.py#L109-L126 | ||
eldar/deepcut-cnn | 928bf2f224fce132f6e4404b4c95fb017297a5e0 | python/caffe/pycaffe.py | python | _Net_forward_all | (self, blobs=None, **kwargs) | return all_outs | Run net forward in batches.
Parameters
----------
blobs : list of blobs to extract as in forward()
kwargs : Keys are input blob names and values are blob ndarrays.
Refer to forward().
Returns
-------
all_outs : {blob name: list of blobs} dict. | Run net forward in batches. | [
"Run",
"net",
"forward",
"in",
"batches",
"."
] | def _Net_forward_all(self, blobs=None, **kwargs):
"""
Run net forward in batches.
Parameters
----------
blobs : list of blobs to extract as in forward()
kwargs : Keys are input blob names and values are blob ndarrays.
Refer to forward().
Returns
-------
all_outs : {blo... | [
"def",
"_Net_forward_all",
"(",
"self",
",",
"blobs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Collect outputs from batches",
"all_outs",
"=",
"{",
"out",
":",
"[",
"]",
"for",
"out",
"in",
"set",
"(",
"self",
".",
"outputs",
"+",
"(",
"blobs... | https://github.com/eldar/deepcut-cnn/blob/928bf2f224fce132f6e4404b4c95fb017297a5e0/python/caffe/pycaffe.py#L159-L187 | |
wy1iu/LargeMargin_Softmax_Loss | c3e9f20e4f16e2b4daf7d358a614366b9b39a6ec | python/caffe/pycaffe.py | python | _Net_backward | (self, diffs=None, start=None, end=None, **kwargs) | return {out: self.blobs[out].diff for out in outputs} | Backward pass: prepare diffs and run the net backward.
Parameters
----------
diffs : list of diffs to return in addition to bottom diffs.
kwargs : Keys are output blob names and values are diff ndarrays.
If None, top diffs are taken from forward loss.
start : optional name of layer at w... | Backward pass: prepare diffs and run the net backward. | [
"Backward",
"pass",
":",
"prepare",
"diffs",
"and",
"run",
"the",
"net",
"backward",
"."
] | def _Net_backward(self, diffs=None, start=None, end=None, **kwargs):
"""
Backward pass: prepare diffs and run the net backward.
Parameters
----------
diffs : list of diffs to return in addition to bottom diffs.
kwargs : Keys are output blob names and values are diff ndarrays.
If Non... | [
"def",
"_Net_backward",
"(",
"self",
",",
"diffs",
"=",
"None",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"diffs",
"is",
"None",
":",
"diffs",
"=",
"[",
"]",
"if",
"start",
"is",
"not",
"None",
... | https://github.com/wy1iu/LargeMargin_Softmax_Loss/blob/c3e9f20e4f16e2b4daf7d358a614366b9b39a6ec/python/caffe/pycaffe.py#L127-L172 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/boto3/resources/collection.py | python | ResourceCollection.all | (self) | return self._clone() | Get all items from the collection, optionally with a custom
page size and item count limit.
This method returns an iterable generator which yields
individual resource instances. Example use::
# Iterate through items
>>> for queue in sqs.queues.all():
... ... | Get all items from the collection, optionally with a custom
page size and item count limit. | [
"Get",
"all",
"items",
"from",
"the",
"collection",
"optionally",
"with",
"a",
"custom",
"page",
"size",
"and",
"item",
"count",
"limit",
"."
] | def all(self):
"""
Get all items from the collection, optionally with a custom
page size and item count limit.
This method returns an iterable generator which yields
individual resource instances. Example use::
# Iterate through items
>>> for queue in sq... | [
"def",
"all",
"(",
"self",
")",
":",
"return",
"self",
".",
"_clone",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/boto3/resources/collection.py#L183-L202 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/logging/__init__.py | python | Handler.flush | (self) | Ensure all logging output has been flushed.
This version does nothing and is intended to be implemented by
subclasses. | Ensure all logging output has been flushed. | [
"Ensure",
"all",
"logging",
"output",
"has",
"been",
"flushed",
"."
] | def flush(self):
"""
Ensure all logging output has been flushed.
This version does nothing and is intended to be implemented by
subclasses.
"""
pass | [
"def",
"flush",
"(",
"self",
")",
":",
"pass"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/logging/__init__.py#L760-L767 | ||
shogun-toolbox/shogun | 9b8d856971af5a295dd6ad70623ae45647a6334c | examples/meta/generator/parse.py | python | FastParser.p_elementAccess | (self, p) | elementAccess : identifier LSQUARE indexList RSQUARE | elementAccess : identifier LSQUARE indexList RSQUARE | [
"elementAccess",
":",
"identifier",
"LSQUARE",
"indexList",
"RSQUARE"
] | def p_elementAccess(self, p):
"elementAccess : identifier LSQUARE indexList RSQUARE"
p[0] = {"ElementAccess": [p[1],
{"IndexList": p[3]}]} | [
"def",
"p_elementAccess",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"{",
"\"ElementAccess\"",
":",
"[",
"p",
"[",
"1",
"]",
",",
"{",
"\"IndexList\"",
":",
"p",
"[",
"3",
"]",
"}",
"]",
"}"
] | https://github.com/shogun-toolbox/shogun/blob/9b8d856971af5a295dd6ad70623ae45647a6334c/examples/meta/generator/parse.py#L245-L248 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/pexpect/pexpect.py | python | spawn.isatty | (self) | return os.isatty(self.child_fd) | This returns True if the file descriptor is open and connected to a
tty(-like) device, else False. | This returns True if the file descriptor is open and connected to a
tty(-like) device, else False. | [
"This",
"returns",
"True",
"if",
"the",
"file",
"descriptor",
"is",
"open",
"and",
"connected",
"to",
"a",
"tty",
"(",
"-",
"like",
")",
"device",
"else",
"False",
"."
] | def isatty(self):
"""This returns True if the file descriptor is open and connected to a
tty(-like) device, else False. """
return os.isatty(self.child_fd) | [
"def",
"isatty",
"(",
"self",
")",
":",
"return",
"os",
".",
"isatty",
"(",
"self",
".",
"child_fd",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/pexpect/pexpect.py#L722-L727 | |
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/qcdb/molecule.py | python | Molecule.__init__ | (self,
molinit=None,
dtype=None,
geom=None,
elea=None,
elez=None,
elem=None,
mass=None,
real=None,
elbl=None,
name=None,
units='Angst... | Initialize Molecule object from LibmintsMolecule | Initialize Molecule object from LibmintsMolecule | [
"Initialize",
"Molecule",
"object",
"from",
"LibmintsMolecule"
] | def __init__(self,
molinit=None,
dtype=None,
geom=None,
elea=None,
elez=None,
elem=None,
mass=None,
real=None,
elbl=None,
name=None,
... | [
"def",
"__init__",
"(",
"self",
",",
"molinit",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"geom",
"=",
"None",
",",
"elea",
"=",
"None",
",",
"elez",
"=",
"None",
",",
"elem",
"=",
"None",
",",
"mass",
"=",
"None",
",",
"real",
"=",
"None",
... | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/qcdb/molecule.py#L57-L149 | ||
apache/arrow | af33dd1157eb8d7d9bfac25ebf61445b793b7943 | python/pyarrow/filesystem.py | python | FileSystem.read_parquet | (self, path, columns=None, metadata=None, schema=None,
use_threads=True, use_pandas_metadata=False) | return dataset.read(columns=columns, use_threads=use_threads,
use_pandas_metadata=use_pandas_metadata) | Read Parquet data from path in file system. Can read from a single file
or a directory of files.
Parameters
----------
path : str
Single file path or directory
columns : List[str], optional
Subset of columns to read.
metadata : pyarrow.parquet.Fil... | Read Parquet data from path in file system. Can read from a single file
or a directory of files. | [
"Read",
"Parquet",
"data",
"from",
"path",
"in",
"file",
"system",
".",
"Can",
"read",
"from",
"a",
"single",
"file",
"or",
"a",
"directory",
"of",
"files",
"."
] | def read_parquet(self, path, columns=None, metadata=None, schema=None,
use_threads=True, use_pandas_metadata=False):
"""
Read Parquet data from path in file system. Can read from a single file
or a directory of files.
Parameters
----------
path : str... | [
"def",
"read_parquet",
"(",
"self",
",",
"path",
",",
"columns",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"schema",
"=",
"None",
",",
"use_threads",
"=",
"True",
",",
"use_pandas_metadata",
"=",
"False",
")",
":",
"from",
"pyarrow",
".",
"parquet"... | https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/python/pyarrow/filesystem.py#L198-L229 | |
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_parser.py | python | p_action_call_callatom | (p) | action : CALL callatom | action : CALL callatom | [
"action",
":",
"CALL",
"callatom"
] | def p_action_call_callatom(p):
'action : CALL callatom'
p[0] = CallAction(p[2])
p[0].lineno = get_lineno(p,1) | [
"def",
"p_action_call_callatom",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"CallAction",
"(",
"p",
"[",
"2",
"]",
")",
"p",
"[",
"0",
"]",
".",
"lineno",
"=",
"get_lineno",
"(",
"p",
",",
"1",
")"
] | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_parser.py#L2329-L2332 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/v8/third_party/jinja2/lexer.py | python | get_lexer | (environment) | return lexer | Return a lexer which is probably cached. | Return a lexer which is probably cached. | [
"Return",
"a",
"lexer",
"which",
"is",
"probably",
"cached",
"."
] | def get_lexer(environment):
"""Return a lexer which is probably cached."""
key = (environment.block_start_string,
environment.block_end_string,
environment.variable_start_string,
environment.variable_end_string,
environment.comment_start_string,
environment... | [
"def",
"get_lexer",
"(",
"environment",
")",
":",
"key",
"=",
"(",
"environment",
".",
"block_start_string",
",",
"environment",
".",
"block_end_string",
",",
"environment",
".",
"variable_start_string",
",",
"environment",
".",
"variable_end_string",
",",
"environm... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/v8/third_party/jinja2/lexer.py#L391-L409 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/FortranCommon.py | python | DialectAddToEnv | (env, dialect, suffixes, ppsuffixes, support_module = 0) | Add dialect specific construction variables. | Add dialect specific construction variables. | [
"Add",
"dialect",
"specific",
"construction",
"variables",
"."
] | def DialectAddToEnv(env, dialect, suffixes, ppsuffixes, support_module = 0):
"""Add dialect specific construction variables."""
ComputeFortranSuffixes(suffixes, ppsuffixes)
fscan = SCons.Scanner.Fortran.FortranScan("%sPATH" % dialect)
for suffix in suffixes + ppsuffixes:
SCons.Tool.SourceFileS... | [
"def",
"DialectAddToEnv",
"(",
"env",
",",
"dialect",
",",
"suffixes",
",",
"ppsuffixes",
",",
"support_module",
"=",
"0",
")",
":",
"ComputeFortranSuffixes",
"(",
"suffixes",
",",
"ppsuffixes",
")",
"fscan",
"=",
"SCons",
".",
"Scanner",
".",
"Fortran",
"."... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/FortranCommon.py#L109-L161 | ||
svn2github/webrtc | 0e4615a75ed555ec866cd5543bfea586f3385ceb | webrtc/tools/barcode_tools/barcode_decoder.py | python | _read_barcode_from_text_file | (barcode_file_name) | return barcode | Reads the decoded barcode for a .txt file.
Args:
barcode_file_name(string): The name of the .txt file.
Return:
(string): The decoded barcode. | Reads the decoded barcode for a .txt file. | [
"Reads",
"the",
"decoded",
"barcode",
"for",
"a",
".",
"txt",
"file",
"."
] | def _read_barcode_from_text_file(barcode_file_name):
"""Reads the decoded barcode for a .txt file.
Args:
barcode_file_name(string): The name of the .txt file.
Return:
(string): The decoded barcode.
"""
barcode_file = open(barcode_file_name, 'r')
barcode = barcode_file.read()
barcode_file.close()
... | [
"def",
"_read_barcode_from_text_file",
"(",
"barcode_file_name",
")",
":",
"barcode_file",
"=",
"open",
"(",
"barcode_file_name",
",",
"'r'",
")",
"barcode",
"=",
"barcode_file",
".",
"read",
"(",
")",
"barcode_file",
".",
"close",
"(",
")",
"return",
"barcode"
... | https://github.com/svn2github/webrtc/blob/0e4615a75ed555ec866cd5543bfea586f3385ceb/webrtc/tools/barcode_tools/barcode_decoder.py#L155-L166 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/print-immutable-linked-list-in-reverse.py | python | Solution3.printLinkedListInReverse | (self, head) | :type head: ImmutableListNode
:rtype: None | :type head: ImmutableListNode
:rtype: None | [
":",
"type",
"head",
":",
"ImmutableListNode",
":",
"rtype",
":",
"None"
] | def printLinkedListInReverse(self, head):
"""
:type head: ImmutableListNode
:rtype: None
"""
tail = None
while head != tail:
curr = head
while curr.getNext() != tail:
curr = curr.getNext()
curr.printValue()
t... | [
"def",
"printLinkedListInReverse",
"(",
"self",
",",
"head",
")",
":",
"tail",
"=",
"None",
"while",
"head",
"!=",
"tail",
":",
"curr",
"=",
"head",
"while",
"curr",
".",
"getNext",
"(",
")",
"!=",
"tail",
":",
"curr",
"=",
"curr",
".",
"getNext",
"(... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/print-immutable-linked-list-in-reverse.py#L59-L70 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/pkg_resources/__init__.py | python | _initialize | (g=globals()) | Set up global resource manager (deliberately not state-saved) | Set up global resource manager (deliberately not state-saved) | [
"Set",
"up",
"global",
"resource",
"manager",
"(",
"deliberately",
"not",
"state",
"-",
"saved",
")"
] | def _initialize(g=globals()):
"Set up global resource manager (deliberately not state-saved)"
manager = ResourceManager()
g['_manager'] = manager
g.update(
(name, getattr(manager, name))
for name in dir(manager)
if not name.startswith('_')
) | [
"def",
"_initialize",
"(",
"g",
"=",
"globals",
"(",
")",
")",
":",
"manager",
"=",
"ResourceManager",
"(",
")",
"g",
"[",
"'_manager'",
"]",
"=",
"manager",
"g",
".",
"update",
"(",
"(",
"name",
",",
"getattr",
"(",
"manager",
",",
"name",
")",
")... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/pkg_resources/__init__.py#L3330-L3338 | ||
chromiumembedded/cef | 80caf947f3fe2210e5344713c5281d8af9bdc295 | tools/cef_parser.py | python | obj_function.get_capi_parts | (self, defined_structs=[], prefix=None) | return {'retval': retval, 'name': name, 'args': args} | Return the parts of the C API function definition. | Return the parts of the C API function definition. | [
"Return",
"the",
"parts",
"of",
"the",
"C",
"API",
"function",
"definition",
"."
] | def get_capi_parts(self, defined_structs=[], prefix=None):
""" Return the parts of the C API function definition. """
retval = ''
dict = self.retval.get_type().get_capi(defined_structs)
if dict['format'] == 'single':
retval = dict['value']
name = self.get_capi_name(prefix)
args = []
... | [
"def",
"get_capi_parts",
"(",
"self",
",",
"defined_structs",
"=",
"[",
"]",
",",
"prefix",
"=",
"None",
")",
":",
"retval",
"=",
"''",
"dict",
"=",
"self",
".",
"retval",
".",
"get_type",
"(",
")",
".",
"get_capi",
"(",
"defined_structs",
")",
"if",
... | https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/cef_parser.py#L1208-L1243 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.