nwo stringlengths 5 86 | sha stringlengths 40 40 | path stringlengths 4 189 | language stringclasses 1
value | identifier stringlengths 1 94 | parameters stringlengths 2 4.03k | argument_list stringclasses 1
value | return_statement stringlengths 0 11.5k | docstring stringlengths 1 33.2k | docstring_summary stringlengths 0 5.15k | docstring_tokens list | function stringlengths 34 151k | function_tokens list | url stringlengths 90 278 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/computation/ops.py | python | BinOp.convert_values | (self) | Convert datetimes to a comparable value in an expression. | Convert datetimes to a comparable value in an expression. | [
"Convert",
"datetimes",
"to",
"a",
"comparable",
"value",
"in",
"an",
"expression",
"."
] | def convert_values(self):
"""Convert datetimes to a comparable value in an expression.
"""
def stringify(value):
if self.encoding is not None:
encoder = partial(pprint_thing_encoded, encoding=self.encoding)
else:
encoder = pprint_thing
... | [
"def",
"convert_values",
"(",
"self",
")",
":",
"def",
"stringify",
"(",
"value",
")",
":",
"if",
"self",
".",
"encoding",
"is",
"not",
"None",
":",
"encoder",
"=",
"partial",
"(",
"pprint_thing_encoded",
",",
"encoding",
"=",
"self",
".",
"encoding",
")... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/computation/ops.py#L445-L474 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/ops/io_ops.py | python | _RestoreSliceShape | (op) | return [tensor_shape.unknown_shape()] | Shape function for RestoreSlice op. | Shape function for RestoreSlice op. | [
"Shape",
"function",
"for",
"RestoreSlice",
"op",
"."
] | def _RestoreSliceShape(op):
"""Shape function for RestoreSlice op."""
# Validate input shapes.
unused_file_pattern = op.inputs[0].get_shape().merge_with(
tensor_shape.scalar())
unused_tensor_name = op.inputs[1].get_shape().merge_with(
tensor_shape.scalar())
unused_shape_and_slice_shape = op.inputs... | [
"def",
"_RestoreSliceShape",
"(",
"op",
")",
":",
"# Validate input shapes.",
"unused_file_pattern",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
".",
"get_shape",
"(",
")",
".",
"merge_with",
"(",
"tensor_shape",
".",
"scalar",
"(",
")",
")",
"unused_tensor_name"... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/io_ops.py#L218-L229 | |
google/mysql-protobuf | 467cda676afaa49e762c5c9164a43f6ad31a1fbf | protobuf/python/google/protobuf/descriptor_pool.py | python | DescriptorPool._ExtractSymbols | (self, descriptors) | Pulls out all the symbols from descriptor protos.
Args:
descriptors: The messages to extract descriptors from.
Yields:
A two element tuple of the type name and descriptor object. | Pulls out all the symbols from descriptor protos. | [
"Pulls",
"out",
"all",
"the",
"symbols",
"from",
"descriptor",
"protos",
"."
] | def _ExtractSymbols(self, descriptors):
"""Pulls out all the symbols from descriptor protos.
Args:
descriptors: The messages to extract descriptors from.
Yields:
A two element tuple of the type name and descriptor object.
"""
for desc in descriptors:
yield (_PrefixWithDot(desc.fu... | [
"def",
"_ExtractSymbols",
"(",
"self",
",",
"descriptors",
")",
":",
"for",
"desc",
"in",
"descriptors",
":",
"yield",
"(",
"_PrefixWithDot",
"(",
"desc",
".",
"full_name",
")",
",",
"desc",
")",
"for",
"symbol",
"in",
"self",
".",
"_ExtractSymbols",
"(",
... | https://github.com/google/mysql-protobuf/blob/467cda676afaa49e762c5c9164a43f6ad31a1fbf/protobuf/python/google/protobuf/descriptor_pool.py#L630-L644 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/optimize/_lsq/lsq_linear.py | python | lsq_linear | (A, b, bounds=(-np.inf, np.inf), method='trf', tol=1e-10,
lsq_solver=None, lsmr_tol=None, max_iter=None, verbose=0) | return res | r"""Solve a linear least-squares problem with bounds on the variables.
Given a m-by-n design matrix A and a target vector b with m elements,
`lsq_linear` solves the following optimization problem::
minimize 0.5 * ||A x - b||**2
subject to lb <= x <= ub
This optimization problem is convex,... | r"""Solve a linear least-squares problem with bounds on the variables. | [
"r",
"Solve",
"a",
"linear",
"least",
"-",
"squares",
"problem",
"with",
"bounds",
"on",
"the",
"variables",
"."
] | def lsq_linear(A, b, bounds=(-np.inf, np.inf), method='trf', tol=1e-10,
lsq_solver=None, lsmr_tol=None, max_iter=None, verbose=0):
r"""Solve a linear least-squares problem with bounds on the variables.
Given a m-by-n design matrix A and a target vector b with m elements,
`lsq_linear` solves ... | [
"def",
"lsq_linear",
"(",
"A",
",",
"b",
",",
"bounds",
"=",
"(",
"-",
"np",
".",
"inf",
",",
"np",
".",
"inf",
")",
",",
"method",
"=",
"'trf'",
",",
"tol",
"=",
"1e-10",
",",
"lsq_solver",
"=",
"None",
",",
"lsmr_tol",
"=",
"None",
",",
"max_... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/optimize/_lsq/lsq_linear.py#L36-L317 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/model/DrillAlgorithmObserver.py | python | DrillAlgorithmObserver.progressHandle | (self, p, msg, estimatedTime, progressPrecision) | Called when the observed algo reports its progress.
Args:
p (float): progress value between 0.0 and 1.0
msp (str): an associated message | Called when the observed algo reports its progress. | [
"Called",
"when",
"the",
"observed",
"algo",
"reports",
"its",
"progress",
"."
] | def progressHandle(self, p, msg, estimatedTime, progressPrecision):
"""
Called when the observed algo reports its progress.
Args:
p (float): progress value between 0.0 and 1.0
msp (str): an associated message
"""
self.signals.progress.emit(p) | [
"def",
"progressHandle",
"(",
"self",
",",
"p",
",",
"msg",
",",
"estimatedTime",
",",
"progressPrecision",
")",
":",
"self",
".",
"signals",
".",
"progress",
".",
"emit",
"(",
"p",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/model/DrillAlgorithmObserver.py#L48-L56 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/tracking/graph_view.py | python | ObjectGraphView.__init__ | (self, root, saveables_cache=None) | Configure the graph view.
Args:
root: A `Trackable` object whose variables (including the variables
of dependencies, recursively) should be saved. May be a weak reference.
saveables_cache: A dictionary mapping `Trackable` objects ->
attribute names -> SaveableObjects, used to avoid re-c... | Configure the graph view. | [
"Configure",
"the",
"graph",
"view",
"."
] | def __init__(self, root, saveables_cache=None):
"""Configure the graph view.
Args:
root: A `Trackable` object whose variables (including the variables
of dependencies, recursively) should be saved. May be a weak reference.
saveables_cache: A dictionary mapping `Trackable` objects ->
... | [
"def",
"__init__",
"(",
"self",
",",
"root",
",",
"saveables_cache",
"=",
"None",
")",
":",
"self",
".",
"_root_ref",
"=",
"root",
"self",
".",
"_saveables_cache",
"=",
"saveables_cache"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/tracking/graph_view.py#L143-L154 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextCtrl.MarkerEnableHighlight | (*args, **kwargs) | return _stc.StyledTextCtrl_MarkerEnableHighlight(*args, **kwargs) | MarkerEnableHighlight(self, bool enabled) | MarkerEnableHighlight(self, bool enabled) | [
"MarkerEnableHighlight",
"(",
"self",
"bool",
"enabled",
")"
] | def MarkerEnableHighlight(*args, **kwargs):
"""MarkerEnableHighlight(self, bool enabled)"""
return _stc.StyledTextCtrl_MarkerEnableHighlight(*args, **kwargs) | [
"def",
"MarkerEnableHighlight",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_MarkerEnableHighlight",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L2358-L2360 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/eager/python/examples/gan/mnist.py | python | train_one_epoch | (generator, discriminator, generator_optimizer,
discriminator_optimizer, dataset, step_counter,
log_interval, noise_dim) | Trains `generator` and `discriminator` models on `dataset`.
Args:
generator: Generator model.
discriminator: Discriminator model.
generator_optimizer: Optimizer to use for generator.
discriminator_optimizer: Optimizer to use for discriminator.
dataset: Dataset of images to train on.
step_coun... | Trains `generator` and `discriminator` models on `dataset`. | [
"Trains",
"generator",
"and",
"discriminator",
"models",
"on",
"dataset",
"."
] | def train_one_epoch(generator, discriminator, generator_optimizer,
discriminator_optimizer, dataset, step_counter,
log_interval, noise_dim):
"""Trains `generator` and `discriminator` models on `dataset`.
Args:
generator: Generator model.
discriminator: Discriminator ... | [
"def",
"train_one_epoch",
"(",
"generator",
",",
"discriminator",
",",
"generator_optimizer",
",",
"discriminator_optimizer",
",",
"dataset",
",",
"step_counter",
",",
"log_interval",
",",
"noise_dim",
")",
":",
"total_generator_loss",
"=",
"0.0",
"total_discriminator_l... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/eager/python/examples/gan/mnist.py#L197-L262 | ||
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/bindings/python/MythTV/methodheap.py | python | MythBE.getCheckfile | (self,program) | Returns location of recording in file system | Returns location of recording in file system | [
"Returns",
"location",
"of",
"recording",
"in",
"file",
"system"
] | def getCheckfile(self,program):
"""
Returns location of recording in file system
"""
res = self.backendCommand(BACKEND_SEP.join(\
['QUERY_CHECKFILE','1',program.toString()]\
)).split(BACKEND_SEP)
if res[0] == 0:
return None
... | [
"def",
"getCheckfile",
"(",
"self",
",",
"program",
")",
":",
"res",
"=",
"self",
".",
"backendCommand",
"(",
"BACKEND_SEP",
".",
"join",
"(",
"[",
"'QUERY_CHECKFILE'",
",",
"'1'",
",",
"program",
".",
"toString",
"(",
")",
"]",
")",
")",
".",
"split",... | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/bindings/python/MythTV/methodheap.py#L272-L282 | ||
mumble-voip/mumble | dc47fe2ccc1a837567591b78abea77b44f6dccc7 | macx/scripts/osxdist.py | python | FolderObject.copy | (self, src, dst='/') | Copy a file or directory into the folder. | Copy a file or directory into the folder. | [
"Copy",
"a",
"file",
"or",
"directory",
"into",
"the",
"folder",
"."
] | def copy(self, src, dst='/'):
'''
Copy a file or directory into the folder.
'''
asrc = os.path.abspath(src)
if dst[0] != '/':
raise self.Exception
# Determine destination
if dst[-1] == '/':
adst = os.path.abspath(self.tmp + '/' + dst + os.path.basename(src))
else:
adst = os.path.abspath(self... | [
"def",
"copy",
"(",
"self",
",",
"src",
",",
"dst",
"=",
"'/'",
")",
":",
"asrc",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"src",
")",
"if",
"dst",
"[",
"0",
"]",
"!=",
"'/'",
":",
"raise",
"self",
".",
"Exception",
"# Determine destination",
... | https://github.com/mumble-voip/mumble/blob/dc47fe2ccc1a837567591b78abea77b44f6dccc7/macx/scripts/osxdist.py#L198-L218 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/geographic_msgs/msg/_GeoPose.py | python | GeoPose.deserialize | (self, str) | unpack serialized message in str into this message instance
:param str: byte array of serialized message, ``str`` | unpack serialized message in str into this message instance
:param str: byte array of serialized message, ``str`` | [
"unpack",
"serialized",
"message",
"in",
"str",
"into",
"this",
"message",
"instance",
":",
"param",
"str",
":",
"byte",
"array",
"of",
"serialized",
"message",
"str"
] | def deserialize(self, str):
"""
unpack serialized message in str into this message instance
:param str: byte array of serialized message, ``str``
"""
try:
if self.position is None:
self.position = geographic_msgs.msg.GeoPoint()
if self.orientation is None:
self.orientatio... | [
"def",
"deserialize",
"(",
"self",
",",
"str",
")",
":",
"try",
":",
"if",
"self",
".",
"position",
"is",
"None",
":",
"self",
".",
"position",
"=",
"geographic_msgs",
".",
"msg",
".",
"GeoPoint",
"(",
")",
"if",
"self",
".",
"orientation",
"is",
"No... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/geographic_msgs/msg/_GeoPose.py#L94-L111 | ||
yrnkrn/zapcc | c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50 | tools/clang/bindings/python/clang/cindex.py | python | TranslationUnit.diagnostics | (self) | return DiagIterator(self) | Return an iterable (and indexable) object containing the diagnostics. | Return an iterable (and indexable) object containing the diagnostics. | [
"Return",
"an",
"iterable",
"(",
"and",
"indexable",
")",
"object",
"containing",
"the",
"diagnostics",
"."
] | def diagnostics(self):
"""
Return an iterable (and indexable) object containing the diagnostics.
"""
class DiagIterator:
def __init__(self, tu):
self.tu = tu
def __len__(self):
return int(conf.lib.clang_getNumDiagnostics(self.tu))
... | [
"def",
"diagnostics",
"(",
"self",
")",
":",
"class",
"DiagIterator",
":",
"def",
"__init__",
"(",
"self",
",",
"tu",
")",
":",
"self",
".",
"tu",
"=",
"tu",
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"int",
"(",
"conf",
".",
"lib",
".",
... | https://github.com/yrnkrn/zapcc/blob/c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50/tools/clang/bindings/python/clang/cindex.py#L2932-L2949 | |
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Tool/mwcc.py | python | find_versions | () | return versions | Return a list of MWVersion objects representing installed versions | Return a list of MWVersion objects representing installed versions | [
"Return",
"a",
"list",
"of",
"MWVersion",
"objects",
"representing",
"installed",
"versions"
] | def find_versions():
"""Return a list of MWVersion objects representing installed versions"""
versions = []
### This function finds CodeWarrior by reading from the registry on
### Windows. Some other method needs to be implemented for other
### platforms, maybe something that calls env.WhereIs('mwc... | [
"def",
"find_versions",
"(",
")",
":",
"versions",
"=",
"[",
"]",
"### This function finds CodeWarrior by reading from the registry on",
"### Windows. Some other method needs to be implemented for other",
"### platforms, maybe something that calls env.WhereIs('mwcc')",
"if",
"SCons",
"."... | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Tool/mwcc.py#L87-L119 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/ceph-volume/ceph_volume/terminal.py | python | colorize.make | (cls, string) | return obj | A helper method to return itself and workaround the fact that
the str object doesn't allow extra arguments passed in to the
constructor | A helper method to return itself and workaround the fact that
the str object doesn't allow extra arguments passed in to the
constructor | [
"A",
"helper",
"method",
"to",
"return",
"itself",
"and",
"workaround",
"the",
"fact",
"that",
"the",
"str",
"object",
"doesn",
"t",
"allow",
"extra",
"arguments",
"passed",
"in",
"to",
"the",
"constructor"
] | def make(cls, string):
"""
A helper method to return itself and workaround the fact that
the str object doesn't allow extra arguments passed in to the
constructor
"""
obj = cls(string)
obj._set_attributes()
return obj | [
"def",
"make",
"(",
"cls",
",",
"string",
")",
":",
"obj",
"=",
"cls",
"(",
"string",
")",
"obj",
".",
"_set_attributes",
"(",
")",
"return",
"obj"
] | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/ceph-volume/ceph_volume/terminal.py#L58-L66 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/sets.py | python | BaseSet.issubset | (self, other) | return True | Report whether another set contains this set. | Report whether another set contains this set. | [
"Report",
"whether",
"another",
"set",
"contains",
"this",
"set",
"."
] | def issubset(self, other):
"""Report whether another set contains this set."""
self._binary_sanity_check(other)
if len(self) > len(other): # Fast check for obvious cases
return False
for elt in ifilterfalse(other._data.__contains__, self):
return False
re... | [
"def",
"issubset",
"(",
"self",
",",
"other",
")",
":",
"self",
".",
"_binary_sanity_check",
"(",
"other",
")",
"if",
"len",
"(",
"self",
")",
">",
"len",
"(",
"other",
")",
":",
"# Fast check for obvious cases",
"return",
"False",
"for",
"elt",
"in",
"i... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/sets.py#L289-L296 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_gdi.py | python | Brush.IsTransparent | (*args, **kwargs) | return _gdi_.Brush_IsTransparent(*args, **kwargs) | IsTransparent(self) -> bool | IsTransparent(self) -> bool | [
"IsTransparent",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsTransparent(*args, **kwargs):
"""IsTransparent(self) -> bool"""
return _gdi_.Brush_IsTransparent(*args, **kwargs) | [
"def",
"IsTransparent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Brush_IsTransparent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L580-L582 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/decimal.py | python | Context.power | (self, a, b, modulo=None) | return a.__pow__(b, modulo, context=self) | Raises a to the power of b, to modulo if given.
With two arguments, compute a**b. If a is negative then b
must be integral. The result will be inexact unless b is
integral and the result is finite and can be expressed exactly
in 'precision' digits.
With three arguments, compu... | Raises a to the power of b, to modulo if given. | [
"Raises",
"a",
"to",
"the",
"power",
"of",
"b",
"to",
"modulo",
"if",
"given",
"."
] | def power(self, a, b, modulo=None):
"""Raises a to the power of b, to modulo if given.
With two arguments, compute a**b. If a is negative then b
must be integral. The result will be inexact unless b is
integral and the result is finite and can be expressed exactly
in 'precisio... | [
"def",
"power",
"(",
"self",
",",
"a",
",",
"b",
",",
"modulo",
"=",
"None",
")",
":",
"return",
"a",
".",
"__pow__",
"(",
"b",
",",
"modulo",
",",
"context",
"=",
"self",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/decimal.py#L4554-L4621 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/graph_editor/select.py | python | compute_boundary_ts | (ops) | return outside_input_ts, outside_output_ts, inside_ts | Compute the tensors at the boundary of a set of ops.
This function looks at all the tensors connected to the given ops (in/out)
and classify them into three categories:
1) input tensors: tensors whose generating operation is not in ops.
2) output tensors: tensors whose consumer operations are not in ops
3) i... | Compute the tensors at the boundary of a set of ops. | [
"Compute",
"the",
"tensors",
"at",
"the",
"boundary",
"of",
"a",
"set",
"of",
"ops",
"."
] | def compute_boundary_ts(ops):
"""Compute the tensors at the boundary of a set of ops.
This function looks at all the tensors connected to the given ops (in/out)
and classify them into three categories:
1) input tensors: tensors whose generating operation is not in ops.
2) output tensors: tensors whose consum... | [
"def",
"compute_boundary_ts",
"(",
"ops",
")",
":",
"ops",
"=",
"util",
".",
"make_list_of_op",
"(",
"ops",
")",
"input_ts",
"=",
"_get_input_ts",
"(",
"ops",
")",
"output_ts",
"=",
"_get_output_ts",
"(",
"ops",
")",
"output_ts_set",
"=",
"frozenset",
"(",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/graph_editor/select.py#L280-L329 | |
bumptop/BumpTop | 466d23597a07ae738f4265262fa01087fc6e257c | trunk/win/Source/bin/jinja2/runtime.py | python | LoopContext.cycle | (self, *args) | return args[self.index0 % len(args)] | Cycles among the arguments with the current loop index. | Cycles among the arguments with the current loop index. | [
"Cycles",
"among",
"the",
"arguments",
"with",
"the",
"current",
"loop",
"index",
"."
] | def cycle(self, *args):
"""Cycles among the arguments with the current loop index."""
if not args:
raise TypeError('no items for cycling given')
return args[self.index0 % len(args)] | [
"def",
"cycle",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"not",
"args",
":",
"raise",
"TypeError",
"(",
"'no items for cycling given'",
")",
"return",
"args",
"[",
"self",
".",
"index0",
"%",
"len",
"(",
"args",
")",
"]"
] | https://github.com/bumptop/BumpTop/blob/466d23597a07ae738f4265262fa01087fc6e257c/trunk/win/Source/bin/jinja2/runtime.py#L277-L281 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/psutil/_pswindows.py | python | py2_strencode | (s) | Encode a unicode string to a byte string by using the default fs
encoding + "replace" error handler. | Encode a unicode string to a byte string by using the default fs
encoding + "replace" error handler. | [
"Encode",
"a",
"unicode",
"string",
"to",
"a",
"byte",
"string",
"by",
"using",
"the",
"default",
"fs",
"encoding",
"+",
"replace",
"error",
"handler",
"."
] | def py2_strencode(s):
"""Encode a unicode string to a byte string by using the default fs
encoding + "replace" error handler.
"""
if PY3:
return s
else:
if isinstance(s, str):
return s
else:
return s.encode(ENCODING, ENCODING_ERRS) | [
"def",
"py2_strencode",
"(",
"s",
")",
":",
"if",
"PY3",
":",
"return",
"s",
"else",
":",
"if",
"isinstance",
"(",
"s",
",",
"str",
")",
":",
"return",
"s",
"else",
":",
"return",
"s",
".",
"encode",
"(",
"ENCODING",
",",
"ENCODING_ERRS",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/psutil/_pswindows.py#L205-L215 | ||
kungfu-origin/kungfu | 90c84b2b590855654cb9a6395ed050e0f7763512 | core/deps/SQLiteCpp-2.3.0/cpplint.py | python | UpdateIncludeState | (filename, include_state, io=codecs) | return True | Fill up the include_state with new includes found from the file.
Args:
filename: the name of the header to read.
include_state: an _IncludeState instance in which the headers are inserted.
io: The io factory to use to read the file. Provided for testability.
Returns:
True if a header was succesful... | Fill up the include_state with new includes found from the file. | [
"Fill",
"up",
"the",
"include_state",
"with",
"new",
"includes",
"found",
"from",
"the",
"file",
"."
] | def UpdateIncludeState(filename, include_state, io=codecs):
"""Fill up the include_state with new includes found from the file.
Args:
filename: the name of the header to read.
include_state: an _IncludeState instance in which the headers are inserted.
io: The io factory to use to read the file. Provide... | [
"def",
"UpdateIncludeState",
"(",
"filename",
",",
"include_state",
",",
"io",
"=",
"codecs",
")",
":",
"headerfile",
"=",
"None",
"try",
":",
"headerfile",
"=",
"io",
".",
"open",
"(",
"filename",
",",
"'r'",
",",
"'utf8'",
",",
"'replace'",
")",
"excep... | https://github.com/kungfu-origin/kungfu/blob/90c84b2b590855654cb9a6395ed050e0f7763512/core/deps/SQLiteCpp-2.3.0/cpplint.py#L4393-L4419 | |
tzutalin/dlib-android | 989627cb7fe81cd1d41d73434b0e91ce1dd2683f | tools/lint/cpplint.py | python | _BlockInfo.IsBlockInfo | (self) | return self.__class__ == _BlockInfo | Returns true if this block is a _BlockInfo.
This is convenient for verifying that an object is an instance of
a _BlockInfo, but not an instance of any of the derived classes.
Returns:
True for this class, False for derived classes. | Returns true if this block is a _BlockInfo.
This is convenient for verifying that an object is an instance of
a _BlockInfo, but not an instance of any of the derived classes.
Returns:
True for this class, False for derived classes. | [
"Returns",
"true",
"if",
"this",
"block",
"is",
"a",
"_BlockInfo",
".",
"This",
"is",
"convenient",
"for",
"verifying",
"that",
"an",
"object",
"is",
"an",
"instance",
"of",
"a",
"_BlockInfo",
"but",
"not",
"an",
"instance",
"of",
"any",
"of",
"the",
"de... | def IsBlockInfo(self):
"""Returns true if this block is a _BlockInfo.
This is convenient for verifying that an object is an instance of
a _BlockInfo, but not an instance of any of the derived classes.
Returns:
True for this class, False for derived classes.
"""
return self.__class__ == _Bl... | [
"def",
"IsBlockInfo",
"(",
"self",
")",
":",
"return",
"self",
".",
"__class__",
"==",
"_BlockInfo"
] | https://github.com/tzutalin/dlib-android/blob/989627cb7fe81cd1d41d73434b0e91ce1dd2683f/tools/lint/cpplint.py#L2027-L2034 | |
physercoe/starquant | c00cad64d1de2da05081b3dc320ef264c6295e08 | cppsrc/log4cplus-2.0.4/catch/scripts/updateDocumentToC.py | python | dashifyHeadline | (line) | return [stripped_wspace, dashified, level] | Takes a header line from a Markdown document and
returns a tuple of the
'#'-stripped version of the head line,
a string version for <a id=''></a> anchor tags,
and the level of the headline as integer.
E.g.,
>>> dashifyHeadline('### some header lvl3')
('Some header lvl3', 'some-he... | Takes a header line from a Markdown document and
returns a tuple of the
'#'-stripped version of the head line,
a string version for <a id=''></a> anchor tags,
and the level of the headline as integer.
E.g.,
>>> dashifyHeadline('### some header lvl3')
('Some header lvl3', 'some-he... | [
"Takes",
"a",
"header",
"line",
"from",
"a",
"Markdown",
"document",
"and",
"returns",
"a",
"tuple",
"of",
"the",
"#",
"-",
"stripped",
"version",
"of",
"the",
"head",
"line",
"a",
"string",
"version",
"for",
"<a",
"id",
"=",
">",
"<",
"/",
"a",
">",... | def dashifyHeadline(line):
"""
Takes a header line from a Markdown document and
returns a tuple of the
'#'-stripped version of the head line,
a string version for <a id=''></a> anchor tags,
and the level of the headline as integer.
E.g.,
>>> dashifyHeadline('### some header l... | [
"def",
"dashifyHeadline",
"(",
"line",
")",
":",
"stripped_right",
"=",
"line",
".",
"rstrip",
"(",
"'#'",
")",
"stripped_both",
"=",
"stripped_right",
".",
"lstrip",
"(",
"'#'",
")",
"level",
"=",
"len",
"(",
"stripped_right",
")",
"-",
"len",
"(",
"str... | https://github.com/physercoe/starquant/blob/c00cad64d1de2da05081b3dc320ef264c6295e08/cppsrc/log4cplus-2.0.4/catch/scripts/updateDocumentToC.py#L77-L109 | |
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/tools/gyp/pylib/gyp/ordered_dict.py | python | OrderedDict.__delitem__ | (self, key, dict_delitem=dict.__delitem__) | od.__delitem__(y) <==> del od[y] | od.__delitem__(y) <==> del od[y] | [
"od",
".",
"__delitem__",
"(",
"y",
")",
"<",
"==",
">",
"del",
"od",
"[",
"y",
"]"
] | def __delitem__(self, key, dict_delitem=dict.__delitem__):
'od.__delitem__(y) <==> del od[y]'
# Deleting an existing item uses self.__map to find the link which is
# then removed by updating the links in the predecessor and successor nodes.
dict_delitem(self, key)
link_prev, link... | [
"def",
"__delitem__",
"(",
"self",
",",
"key",
",",
"dict_delitem",
"=",
"dict",
".",
"__delitem__",
")",
":",
"# Deleting an existing item uses self.__map to find the link which is",
"# then removed by updating the links in the predecessor and successor nodes.",
"dict_delitem",
"(... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/ordered_dict.py#L81-L88 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/numpy_ops/np_utils.py | python | less_equal | (a, b) | return _maybe_static(a) <= _maybe_static(b) | A version of tf.less_equal that eagerly evaluates if possible. | A version of tf.less_equal that eagerly evaluates if possible. | [
"A",
"version",
"of",
"tf",
".",
"less_equal",
"that",
"eagerly",
"evaluates",
"if",
"possible",
"."
] | def less_equal(a, b):
"""A version of tf.less_equal that eagerly evaluates if possible."""
return _maybe_static(a) <= _maybe_static(b) | [
"def",
"less_equal",
"(",
"a",
",",
"b",
")",
":",
"return",
"_maybe_static",
"(",
"a",
")",
"<=",
"_maybe_static",
"(",
"b",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/numpy_ops/np_utils.py#L627-L629 | |
p4lang/behavioral-model | 81ce0163f0770c6b9d6056a28ce2e0cc035bb6e9 | tools/cpplint.py | python | _RestoreFilters | () | Restores filters previously backed up. | Restores filters previously backed up. | [
"Restores",
"filters",
"previously",
"backed",
"up",
"."
] | def _RestoreFilters():
""" Restores filters previously backed up."""
_cpplint_state.RestoreFilters() | [
"def",
"_RestoreFilters",
"(",
")",
":",
"_cpplint_state",
".",
"RestoreFilters",
"(",
")"
] | https://github.com/p4lang/behavioral-model/blob/81ce0163f0770c6b9d6056a28ce2e0cc035bb6e9/tools/cpplint.py#L1482-L1484 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/keras/_impl/keras/layers/merge.py | python | _Merge._compute_elemwise_op_output_shape | (self, shape1, shape2) | return tuple(output_shape) | Computes the shape of the resultant of an elementwise operation.
Arguments:
shape1: tuple or None. Shape of the first tensor
shape2: tuple or None. Shape of the second tensor
Returns:
expected output shape when an element-wise operation is
carried out on 2 tensors with shapes s... | Computes the shape of the resultant of an elementwise operation. | [
"Computes",
"the",
"shape",
"of",
"the",
"resultant",
"of",
"an",
"elementwise",
"operation",
"."
] | def _compute_elemwise_op_output_shape(self, shape1, shape2):
"""Computes the shape of the resultant of an elementwise operation.
Arguments:
shape1: tuple or None. Shape of the first tensor
shape2: tuple or None. Shape of the second tensor
Returns:
expected output shape when an elem... | [
"def",
"_compute_elemwise_op_output_shape",
"(",
"self",
",",
"shape1",
",",
"shape2",
")",
":",
"if",
"None",
"in",
"[",
"shape1",
",",
"shape2",
"]",
":",
"return",
"None",
"elif",
"len",
"(",
"shape1",
")",
"<",
"len",
"(",
"shape2",
")",
":",
"retu... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/keras/_impl/keras/layers/merge.py#L44-L80 | |
TimoSaemann/caffe-segnet-cudnn5 | abcf30dca449245e101bf4ced519f716177f0885 | scripts/cpp_lint.py | python | IsCppString | (line) | return ((line.count('"') - line.count(r'\"') - line.count("'\"'")) & 1) == 1 | Does line terminate so, that the next symbol is in string constant.
This function does not consider single-line nor multi-line comments.
Args:
line: is a partial line of code starting from the 0..n.
Returns:
True, if next character appended to 'line' is inside a
string constant. | Does line terminate so, that the next symbol is in string constant. | [
"Does",
"line",
"terminate",
"so",
"that",
"the",
"next",
"symbol",
"is",
"in",
"string",
"constant",
"."
] | def IsCppString(line):
"""Does line terminate so, that the next symbol is in string constant.
This function does not consider single-line nor multi-line comments.
Args:
line: is a partial line of code starting from the 0..n.
Returns:
True, if next character appended to 'line' is inside a
string c... | [
"def",
"IsCppString",
"(",
"line",
")",
":",
"line",
"=",
"line",
".",
"replace",
"(",
"r'\\\\'",
",",
"'XX'",
")",
"# after this, \\\\\" does not match to \\\"",
"return",
"(",
"(",
"line",
".",
"count",
"(",
"'\"'",
")",
"-",
"line",
".",
"count",
"(",
... | https://github.com/TimoSaemann/caffe-segnet-cudnn5/blob/abcf30dca449245e101bf4ced519f716177f0885/scripts/cpp_lint.py#L1045-L1059 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TGUtil.__init__ | (self) | __init__(TGUtil self) -> TGUtil | __init__(TGUtil self) -> TGUtil | [
"__init__",
"(",
"TGUtil",
"self",
")",
"-",
">",
"TGUtil"
] | def __init__(self):
"""__init__(TGUtil self) -> TGUtil"""
_snap.TGUtil_swiginit(self,_snap.new_TGUtil()) | [
"def",
"__init__",
"(",
"self",
")",
":",
"_snap",
".",
"TGUtil_swiginit",
"(",
"self",
",",
"_snap",
".",
"new_TGUtil",
"(",
")",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L6721-L6723 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/dataview.py | python | DataViewCtrl.PrependDateColumn | (*args, **kwargs) | return _dataview.DataViewCtrl_PrependDateColumn(*args, **kwargs) | PrependDateColumn(self, PyObject label_or_bitmap, unsigned int model_column,
int mode=DATAVIEW_CELL_ACTIVATABLE, int width=-1,
int align=ALIGN_NOT, int flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn | PrependDateColumn(self, PyObject label_or_bitmap, unsigned int model_column,
int mode=DATAVIEW_CELL_ACTIVATABLE, int width=-1,
int align=ALIGN_NOT, int flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn | [
"PrependDateColumn",
"(",
"self",
"PyObject",
"label_or_bitmap",
"unsigned",
"int",
"model_column",
"int",
"mode",
"=",
"DATAVIEW_CELL_ACTIVATABLE",
"int",
"width",
"=",
"-",
"1",
"int",
"align",
"=",
"ALIGN_NOT",
"int",
"flags",
"=",
"DATAVIEW_COL_RESIZABLE",
")",
... | def PrependDateColumn(*args, **kwargs):
"""
PrependDateColumn(self, PyObject label_or_bitmap, unsigned int model_column,
int mode=DATAVIEW_CELL_ACTIVATABLE, int width=-1,
int align=ALIGN_NOT, int flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
"""
return _datavi... | [
"def",
"PrependDateColumn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewCtrl_PrependDateColumn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/dataview.py#L1622-L1628 | |
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Utils/topologyTool.py | python | diff_files | (xml_list) | Finds the difference between topology XML files, ignoring ordering and names in "connection" tags
Iterate through root tag elements
Create a dictionary with file_dict[tag] = [list of tag objects] | Finds the difference between topology XML files, ignoring ordering and names in "connection" tags | [
"Finds",
"the",
"difference",
"between",
"topology",
"XML",
"files",
"ignoring",
"ordering",
"and",
"names",
"in",
"connection",
"tags"
] | def diff_files(xml_list):
"""
Finds the difference between topology XML files, ignoring ordering and names in "connection" tags
Iterate through root tag elements
Create a dictionary with file_dict[tag] = [list of tag objects]
"""
if len(xml_list) < 2:
print("Less than two XML files wer... | [
"def",
"diff_files",
"(",
"xml_list",
")",
":",
"if",
"len",
"(",
"xml_list",
")",
"<",
"2",
":",
"print",
"(",
"\"Less than two XML files were specified. Exiting.\"",
")",
"return",
"master_tag_dict",
"=",
"{",
"}",
"for",
"xml_path",
"in",
"xml_list",
":",
"... | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Utils/topologyTool.py#L96-L146 | ||
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | algorithms/src/LocalizationAndMapping/icp_lidar_localization/fast_gicp/thirdparty/Sophus/py/sophus/complex.py | python | Complex.__truediv__ | (self, scalar) | return Complex(self.real / scalar, self.imag / scalar) | scalar division | scalar division | [
"scalar",
"division"
] | def __truediv__(self, scalar):
""" scalar division """
return Complex(self.real / scalar, self.imag / scalar) | [
"def",
"__truediv__",
"(",
"self",
",",
"scalar",
")",
":",
"return",
"Complex",
"(",
"self",
".",
"real",
"/",
"scalar",
",",
"self",
".",
"imag",
"/",
"scalar",
")"
] | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/algorithms/src/LocalizationAndMapping/icp_lidar_localization/fast_gicp/thirdparty/Sophus/py/sophus/complex.py#L25-L27 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/polynomial/polynomial.py | python | polyder | (c, m=1, scl=1, axis=0) | return c | Differentiate a polynomial.
Returns the polynomial coefficients `c` differentiated `m` times along
`axis`. At each iteration the result is multiplied by `scl` (the
scaling factor is for use in a linear change of variable). The
argument `c` is an array of coefficients from low to high degree along
... | Differentiate a polynomial. | [
"Differentiate",
"a",
"polynomial",
"."
] | def polyder(c, m=1, scl=1, axis=0):
"""
Differentiate a polynomial.
Returns the polynomial coefficients `c` differentiated `m` times along
`axis`. At each iteration the result is multiplied by `scl` (the
scaling factor is for use in a linear change of variable). The
argument `c` is an array o... | [
"def",
"polyder",
"(",
"c",
",",
"m",
"=",
"1",
",",
"scl",
"=",
"1",
",",
"axis",
"=",
"0",
")",
":",
"c",
"=",
"np",
".",
"array",
"(",
"c",
",",
"ndmin",
"=",
"1",
",",
"copy",
"=",
"True",
")",
"if",
"c",
".",
"dtype",
".",
"char",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/polynomial/polynomial.py#L463-L542 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/general_fitting/general_fitting_options_view.py | python | GeneralFittingOptionsView.enable_simultaneous_fit_options | (self) | Enables the simultaneous fit options. | Enables the simultaneous fit options. | [
"Enables",
"the",
"simultaneous",
"fit",
"options",
"."
] | def enable_simultaneous_fit_options(self) -> None:
"""Enables the simultaneous fit options."""
self.simul_fit_by_combo.setEnabled(True)
self.simul_fit_by_specifier.setEnabled(True) | [
"def",
"enable_simultaneous_fit_options",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"simul_fit_by_combo",
".",
"setEnabled",
"(",
"True",
")",
"self",
".",
"simul_fit_by_specifier",
".",
"setEnabled",
"(",
"True",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/general_fitting/general_fitting_options_view.py#L71-L74 | ||
modm-io/modm | 845840ec08566a3aa9c04167b1a18a56255afa4f | tools/xpcc_generator/xmlparser/type.py | python | Struct.iter | (self) | Iterate over all sub-elements of the enum | Iterate over all sub-elements of the enum | [
"Iterate",
"over",
"all",
"sub",
"-",
"elements",
"of",
"the",
"enum"
] | def iter(self):
""" Iterate over all sub-elements of the enum """
for element in self.elements:
yield element | [
"def",
"iter",
"(",
"self",
")",
":",
"for",
"element",
"in",
"self",
".",
"elements",
":",
"yield",
"element"
] | https://github.com/modm-io/modm/blob/845840ec08566a3aa9c04167b1a18a56255afa4f/tools/xpcc_generator/xmlparser/type.py#L353-L356 | ||
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/core/column/string.py | python | StringMethods.url_encode | (self) | return self._return_or_inplace(libstrings.url_encode(self._column)) | Returns a URL-encoded format of each string.
No format checking is performed.
All characters are encoded except for ASCII letters,
digits, and these characters: ``‘.’,’_’,’-‘,’~’``.
Encoding converts to hex using UTF-8 encoded bytes.
Returns
-------
Series or Ind... | Returns a URL-encoded format of each string.
No format checking is performed.
All characters are encoded except for ASCII letters,
digits, and these characters: ``‘.’,’_’,’-‘,’~’``.
Encoding converts to hex using UTF-8 encoded bytes. | [
"Returns",
"a",
"URL",
"-",
"encoded",
"format",
"of",
"each",
"string",
".",
"No",
"format",
"checking",
"is",
"performed",
".",
"All",
"characters",
"are",
"encoded",
"except",
"for",
"ASCII",
"letters",
"digits",
"and",
"these",
"characters",
":",
"‘",
... | def url_encode(self) -> SeriesOrIndex:
"""
Returns a URL-encoded format of each string.
No format checking is performed.
All characters are encoded except for ASCII letters,
digits, and these characters: ``‘.’,’_’,’-‘,’~’``.
Encoding converts to hex using UTF-8 encoded by... | [
"def",
"url_encode",
"(",
"self",
")",
"->",
"SeriesOrIndex",
":",
"return",
"self",
".",
"_return_or_inplace",
"(",
"libstrings",
".",
"url_encode",
"(",
"self",
".",
"_column",
")",
")"
] | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/column/string.py#L4018-L4047 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/gluon/data/batchify.py | python | _append_arrs | (arrs, use_shared_mem=False, expand=False, batch_axis=0) | return out | Internal impl for returning appened arrays as list. | Internal impl for returning appened arrays as list. | [
"Internal",
"impl",
"for",
"returning",
"appened",
"arrays",
"as",
"list",
"."
] | def _append_arrs(arrs, use_shared_mem=False, expand=False, batch_axis=0):
"""Internal impl for returning appened arrays as list."""
_arr = _np if is_np_array() else nd
if isinstance(arrs[0], _arr.NDArray):
if use_shared_mem:
out = [x.as_in_context(Device('cpu_shared', 0)) for x in arrs]
... | [
"def",
"_append_arrs",
"(",
"arrs",
",",
"use_shared_mem",
"=",
"False",
",",
"expand",
"=",
"False",
",",
"batch_axis",
"=",
"0",
")",
":",
"_arr",
"=",
"_np",
"if",
"is_np_array",
"(",
")",
"else",
"nd",
"if",
"isinstance",
"(",
"arrs",
"[",
"0",
"... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/gluon/data/batchify.py#L259-L276 | |
pioneerspacesim/pioneer | 800a23e864f5c5f0f0c47a766dfb1fd6f10046e1 | scripts/wiki_ship_stat_parser.py | python | make_chart | (ship_folder) | Make wiki table from ships/*.json path | Make wiki table from ships/*.json path | [
"Make",
"wiki",
"table",
"from",
"ships",
"/",
"*",
".",
"json",
"path"
] | def make_chart(ship_folder):
"Make wiki table from ships/*.json path"
ships = {}
# Read in all ship json-files, into simple "flat" dictionaries
for filename in os.listdir(ship_folder):
flying_thing = flatten(json.load(open(ship_folder + "/" + filename)))
if 'ship_class' in flying_thing ... | [
"def",
"make_chart",
"(",
"ship_folder",
")",
":",
"ships",
"=",
"{",
"}",
"# Read in all ship json-files, into simple \"flat\" dictionaries",
"for",
"filename",
"in",
"os",
".",
"listdir",
"(",
"ship_folder",
")",
":",
"flying_thing",
"=",
"flatten",
"(",
"json",
... | https://github.com/pioneerspacesim/pioneer/blob/800a23e864f5c5f0f0c47a766dfb1fd6f10046e1/scripts/wiki_ship_stat_parser.py#L322-L375 | ||
lilypond/lilypond | 2a14759372979f5b796ee802b0ee3bc15d28b06b | python/book_snippets.py | python | LilypondSnippet.all_output_files | (self, output_dir) | return (result, missing) | Return all files generated in lily_output_dir, a set.
output_dir_files is the list of files in the output directory. | Return all files generated in lily_output_dir, a set. | [
"Return",
"all",
"files",
"generated",
"in",
"lily_output_dir",
"a",
"set",
"."
] | def all_output_files(self, output_dir):
"""Return all files generated in lily_output_dir, a set.
output_dir_files is the list of files in the output directory.
"""
result = set()
missing = set()
base = self.basename()
full = os.path.join(output_dir, base)
... | [
"def",
"all_output_files",
"(",
"self",
",",
"output_dir",
")",
":",
"result",
"=",
"set",
"(",
")",
"missing",
"=",
"set",
"(",
")",
"base",
"=",
"self",
".",
"basename",
"(",
")",
"full",
"=",
"os",
".",
"path",
".",
"join",
"(",
"output_dir",
",... | https://github.com/lilypond/lilypond/blob/2a14759372979f5b796ee802b0ee3bc15d28b06b/python/book_snippets.py#L749-L818 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/stats/_multivariate.py | python | invwishart_gen._rvs | (self, n, shape, dim, df, C, random_state) | return A | Parameters
----------
n : integer
Number of variates to generate
shape : iterable
Shape of the variates to generate
dim : int
Dimension of the scale matrix
df : int
Degrees of freedom
C : ndarray
Cholesky factori... | Parameters
----------
n : integer
Number of variates to generate
shape : iterable
Shape of the variates to generate
dim : int
Dimension of the scale matrix
df : int
Degrees of freedom
C : ndarray
Cholesky factori... | [
"Parameters",
"----------",
"n",
":",
"integer",
"Number",
"of",
"variates",
"to",
"generate",
"shape",
":",
"iterable",
"Shape",
"of",
"the",
"variates",
"to",
"generate",
"dim",
":",
"int",
"Dimension",
"of",
"the",
"scale",
"matrix",
"df",
":",
"int",
"... | def _rvs(self, n, shape, dim, df, C, random_state):
"""
Parameters
----------
n : integer
Number of variates to generate
shape : iterable
Shape of the variates to generate
dim : int
Dimension of the scale matrix
df : int
... | [
"def",
"_rvs",
"(",
"self",
",",
"n",
",",
"shape",
",",
"dim",
",",
"df",
",",
"C",
",",
"random_state",
")",
":",
"random_state",
"=",
"self",
".",
"_get_random_state",
"(",
"random_state",
")",
"# Get random draws A such that A ~ W(df, I)",
"A",
"=",
"sup... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/stats/_multivariate.py#L2686-L2733 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/urllib/parse.py | python | splitport | (host) | return host, None | splitport('host:port') --> 'host', 'port'. | splitport('host:port') --> 'host', 'port'. | [
"splitport",
"(",
"host",
":",
"port",
")",
"--",
">",
"host",
"port",
"."
] | def splitport(host):
"""splitport('host:port') --> 'host', 'port'."""
global _portprog
if _portprog is None:
_portprog = re.compile('(.*):([0-9]*)', re.DOTALL)
match = _portprog.fullmatch(host)
if match:
host, port = match.groups()
if port:
return host, port
... | [
"def",
"splitport",
"(",
"host",
")",
":",
"global",
"_portprog",
"if",
"_portprog",
"is",
"None",
":",
"_portprog",
"=",
"re",
".",
"compile",
"(",
"'(.*):([0-9]*)'",
",",
"re",
".",
"DOTALL",
")",
"match",
"=",
"_portprog",
".",
"fullmatch",
"(",
"host... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/urllib/parse.py#L1025-L1036 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBCommandInterpreterRunOptions.__init__ | (self) | __init__(self) -> SBCommandInterpreterRunOptions | __init__(self) -> SBCommandInterpreterRunOptions | [
"__init__",
"(",
"self",
")",
"-",
">",
"SBCommandInterpreterRunOptions"
] | def __init__(self):
"""__init__(self) -> SBCommandInterpreterRunOptions"""
this = _lldb.new_SBCommandInterpreterRunOptions()
try: self.this.append(this)
except: self.this = this | [
"def",
"__init__",
"(",
"self",
")",
":",
"this",
"=",
"_lldb",
".",
"new_SBCommandInterpreterRunOptions",
"(",
")",
"try",
":",
"self",
".",
"this",
".",
"append",
"(",
"this",
")",
"except",
":",
"self",
".",
"this",
"=",
"this"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L2019-L2023 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/examples/skflow/text_classification_character_rnn.py | python | char_rnn_model | (x, y) | return {'class': tf.argmax(prediction, 1), 'prob': prediction}, loss, train_op | Character level recurrent neural network model to predict classes. | Character level recurrent neural network model to predict classes. | [
"Character",
"level",
"recurrent",
"neural",
"network",
"model",
"to",
"predict",
"classes",
"."
] | def char_rnn_model(x, y):
"""Character level recurrent neural network model to predict classes."""
y = tf.one_hot(y, 15, 1, 0)
byte_list = learn.ops.one_hot_matrix(x, 256)
byte_list = tf.unpack(byte_list, axis=1)
cell = tf.nn.rnn_cell.GRUCell(HIDDEN_SIZE)
_, encoding = tf.nn.rnn(cell, byte_list, dtype=tf.f... | [
"def",
"char_rnn_model",
"(",
"x",
",",
"y",
")",
":",
"y",
"=",
"tf",
".",
"one_hot",
"(",
"y",
",",
"15",
",",
"1",
",",
"0",
")",
"byte_list",
"=",
"learn",
".",
"ops",
".",
"one_hot_matrix",
"(",
"x",
",",
"256",
")",
"byte_list",
"=",
"tf"... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/examples/skflow/text_classification_character_rnn.py#L46-L61 | |
zhaoweicai/mscnn | 534bcac5710a579d60827f192035f7eef6d8c585 | scripts/cpp_lint.py | python | CheckEmptyBlockBody | (filename, clean_lines, linenum, error) | Look for empty loop/conditional body with only a single semicolon.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Look for empty loop/conditional body with only a single semicolon. | [
"Look",
"for",
"empty",
"loop",
"/",
"conditional",
"body",
"with",
"only",
"a",
"single",
"semicolon",
"."
] | def CheckEmptyBlockBody(filename, clean_lines, linenum, error):
"""Look for empty loop/conditional body with only a single semicolon.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The functio... | [
"def",
"CheckEmptyBlockBody",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"# Search for loop keywords at the beginning of the line. Because only",
"# whitespaces are allowed before the keywords, this will also ignore most",
"# do-while-loops, since those... | https://github.com/zhaoweicai/mscnn/blob/534bcac5710a579d60827f192035f7eef6d8c585/scripts/cpp_lint.py#L3243-L3275 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Menu.add | (self, itemType, cnf={}, **kw) | Internal function. | Internal function. | [
"Internal",
"function",
"."
] | def add(self, itemType, cnf={}, **kw):
"""Internal function."""
self.tk.call((self._w, 'add', itemType) +
self._options(cnf, kw)) | [
"def",
"add",
"(",
"self",
",",
"itemType",
",",
"cnf",
"=",
"{",
"}",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"(",
"self",
".",
"_w",
",",
"'add'",
",",
"itemType",
")",
"+",
"self",
".",
"_options",
"(",
"cnf",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py#L2671-L2674 | ||
google/iree | 1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76 | integrations/tensorflow/python_projects/iree_tf/iree/tf/support/module_utils.py | python | TfCompiledModule.create_from_signature_def_saved_model | (
cls,
saved_model_dir: str,
saved_model_tags: Set[str],
module_name: str,
backend_info: "BackendInfo",
exported_name: str,
input_names: Sequence[str],
output_names: Sequence[str],
artifacts_dir: Optional[str] = None) | return cls(module_name, backend_info, constructor, [exported_name]) | Compile a SignatureDef SavedModel to the target backend in backend_info.
Args:
saved_model_dir: Directory of the saved model.
saved_model_tags: Optional set of tags to use when loading the model.
module_name: A name for this compiled module.
backend_info: BackendInfo with the details for co... | Compile a SignatureDef SavedModel to the target backend in backend_info. | [
"Compile",
"a",
"SignatureDef",
"SavedModel",
"to",
"the",
"target",
"backend",
"in",
"backend_info",
"."
] | def create_from_signature_def_saved_model(
cls,
saved_model_dir: str,
saved_model_tags: Set[str],
module_name: str,
backend_info: "BackendInfo",
exported_name: str,
input_names: Sequence[str],
output_names: Sequence[str],
artifacts_dir: Optional[str] = None):
""... | [
"def",
"create_from_signature_def_saved_model",
"(",
"cls",
",",
"saved_model_dir",
":",
"str",
",",
"saved_model_tags",
":",
"Set",
"[",
"str",
"]",
",",
"module_name",
":",
"str",
",",
"backend_info",
":",
"\"BackendInfo\"",
",",
"exported_name",
":",
"str",
"... | https://github.com/google/iree/blob/1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76/integrations/tensorflow/python_projects/iree_tf/iree/tf/support/module_utils.py#L535-L562 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/graph_editor/reroute.py | python | _reroute_ts | (ts0, ts1, mode, can_modify=None, cannot_modify=None) | return nb_update_inputs | Reroute the end of the tensors in each pair (t0,t1) in ts0 x ts1.
This function is the back-bone of the Graph-Editor. It is essentially a thin
wrapper on top of the tf.Operation._update_input.
Given a pair of tensor t0, t1 in ts0 x ts1, this function re-route the end
of t0 and t1 in three possible ways:
1) ... | Reroute the end of the tensors in each pair (t0,t1) in ts0 x ts1. | [
"Reroute",
"the",
"end",
"of",
"the",
"tensors",
"in",
"each",
"pair",
"(",
"t0",
"t1",
")",
"in",
"ts0",
"x",
"ts1",
"."
] | def _reroute_ts(ts0, ts1, mode, can_modify=None, cannot_modify=None):
"""Reroute the end of the tensors in each pair (t0,t1) in ts0 x ts1.
This function is the back-bone of the Graph-Editor. It is essentially a thin
wrapper on top of the tf.Operation._update_input.
Given a pair of tensor t0, t1 in ts0 x ts1, ... | [
"def",
"_reroute_ts",
"(",
"ts0",
",",
"ts1",
",",
"mode",
",",
"can_modify",
"=",
"None",
",",
"cannot_modify",
"=",
"None",
")",
":",
"a2b",
",",
"b2a",
"=",
"_RerouteMode",
".",
"check",
"(",
"mode",
")",
"ts0",
"=",
"util",
".",
"make_list_of_t",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/graph_editor/reroute.py#L120-L185 | |
plumonito/dtslam | 5994bb9cf7a11981b830370db206bceb654c085d | 3rdparty/opencv-git/3rdparty/jinja2/filters.py | python | do_filesizeformat | (value, binary=False) | Format the value like a 'human-readable' file size (i.e. 13 kB,
4.1 MB, 102 Bytes, etc). Per default decimal prefixes are used (Mega,
Giga, etc.), if the second parameter is set to `True` the binary
prefixes are used (Mebi, Gibi). | Format the value like a 'human-readable' file size (i.e. 13 kB,
4.1 MB, 102 Bytes, etc). Per default decimal prefixes are used (Mega,
Giga, etc.), if the second parameter is set to `True` the binary
prefixes are used (Mebi, Gibi). | [
"Format",
"the",
"value",
"like",
"a",
"human",
"-",
"readable",
"file",
"size",
"(",
"i",
".",
"e",
".",
"13",
"kB",
"4",
".",
"1",
"MB",
"102",
"Bytes",
"etc",
")",
".",
"Per",
"default",
"decimal",
"prefixes",
"are",
"used",
"(",
"Mega",
"Giga",... | def do_filesizeformat(value, binary=False):
"""Format the value like a 'human-readable' file size (i.e. 13 kB,
4.1 MB, 102 Bytes, etc). Per default decimal prefixes are used (Mega,
Giga, etc.), if the second parameter is set to `True` the binary
prefixes are used (Mebi, Gibi).
"""
bytes = float... | [
"def",
"do_filesizeformat",
"(",
"value",
",",
"binary",
"=",
"False",
")",
":",
"bytes",
"=",
"float",
"(",
"value",
")",
"base",
"=",
"binary",
"and",
"1024",
"or",
"1000",
"prefixes",
"=",
"[",
"(",
"binary",
"and",
"'KiB'",
"or",
"'kB'",
")",
","... | https://github.com/plumonito/dtslam/blob/5994bb9cf7a11981b830370db206bceb654c085d/3rdparty/opencv-git/3rdparty/jinja2/filters.py#L372-L399 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/telemetry/third_party/png/png.py | python | Reader.validate_signature | (self) | If signature (header) has not been read then read and
validate it; otherwise do nothing. | If signature (header) has not been read then read and
validate it; otherwise do nothing. | [
"If",
"signature",
"(",
"header",
")",
"has",
"not",
"been",
"read",
"then",
"read",
"and",
"validate",
"it",
";",
"otherwise",
"do",
"nothing",
"."
] | def validate_signature(self):
"""If signature (header) has not been read then read and
validate it; otherwise do nothing.
"""
if self.signature:
return
self.signature = self.file.read(8)
if self.signature != _signature:
raise FormatError("PNG file... | [
"def",
"validate_signature",
"(",
"self",
")",
":",
"if",
"self",
".",
"signature",
":",
"return",
"self",
".",
"signature",
"=",
"self",
".",
"file",
".",
"read",
"(",
"8",
")",
"if",
"self",
".",
"signature",
"!=",
"_signature",
":",
"raise",
"Format... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/telemetry/third_party/png/png.py#L1689-L1698 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/plan/motionplanning.py | python | CSpaceInterface.setSampler | (self, pySamp) | return _motionplanning.CSpaceInterface_setSampler(self, pySamp) | Args:
pySamp (:obj:`object`) | Args:
pySamp (:obj:`object`) | [
"Args",
":",
"pySamp",
"(",
":",
"obj",
":",
"object",
")"
] | def setSampler(self, pySamp):
"""
Args:
pySamp (:obj:`object`)
"""
return _motionplanning.CSpaceInterface_setSampler(self, pySamp) | [
"def",
"setSampler",
"(",
"self",
",",
"pySamp",
")",
":",
"return",
"_motionplanning",
".",
"CSpaceInterface_setSampler",
"(",
"self",
",",
"pySamp",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/plan/motionplanning.py#L367-L372 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/src/robotsim.py | python | Simulator.contactForce | (self, aid, bid) | return _robotsim.Simulator_contactForce(self, aid, bid) | contactForce(Simulator self, int aid, int bid)
Returns the contact force on object a at the last time step. You can set bid to
-1 to get the overall contact force on object a. | contactForce(Simulator self, int aid, int bid) | [
"contactForce",
"(",
"Simulator",
"self",
"int",
"aid",
"int",
"bid",
")"
] | def contactForce(self, aid, bid):
"""
contactForce(Simulator self, int aid, int bid)
Returns the contact force on object a at the last time step. You can set bid to
-1 to get the overall contact force on object a.
"""
return _robotsim.Simulator_contactForce(self, ai... | [
"def",
"contactForce",
"(",
"self",
",",
"aid",
",",
"bid",
")",
":",
"return",
"_robotsim",
".",
"Simulator_contactForce",
"(",
"self",
",",
"aid",
",",
"bid",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/src/robotsim.py#L8421-L8431 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/style_editor.py | python | StyleEditorBox.DoChangeStyleSheet | (self, sheet_name) | Change the StyleEditor for the given style sheet | Change the StyleEditor for the given style sheet | [
"Change",
"the",
"StyleEditor",
"for",
"the",
"given",
"style",
"sheet"
] | def DoChangeStyleSheet(self, sheet_name):
"""Change the StyleEditor for the given style sheet"""
if not self.SheetExistOnDisk(sheet_name):
# Changing to a fully transient style sheet that has
# not yet been written to disk.
self.SetDisplayForTransientSheet(sheet_name)... | [
"def",
"DoChangeStyleSheet",
"(",
"self",
",",
"sheet_name",
")",
":",
"if",
"not",
"self",
".",
"SheetExistOnDisk",
"(",
"sheet_name",
")",
":",
"# Changing to a fully transient style sheet that has",
"# not yet been written to disk.",
"self",
".",
"SetDisplayForTransientS... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/style_editor.py#L243-L251 | ||
nsnam/ns-3-dev-git | efdb2e21f45c0a87a60b47c547b68fa140a7b686 | src/flow-monitor/examples/flowmon-parse-results.py | python | FiveTuple.__init__ | (self, el) | ! The initializer.
@param self The object pointer.
@param el The element. | ! The initializer. | [
"!",
"The",
"initializer",
"."
] | def __init__(self, el):
'''! The initializer.
@param self The object pointer.
@param el The element.
'''
self.sourceAddress = el.get('sourceAddress')
self.destinationAddress = el.get('destinationAddress')
self.sourcePort = int(el.get('sourcePort'))
self.de... | [
"def",
"__init__",
"(",
"self",
",",
"el",
")",
":",
"self",
".",
"sourceAddress",
"=",
"el",
".",
"get",
"(",
"'sourceAddress'",
")",
"self",
".",
"destinationAddress",
"=",
"el",
".",
"get",
"(",
"'destinationAddress'",
")",
"self",
".",
"sourcePort",
... | https://github.com/nsnam/ns-3-dev-git/blob/efdb2e21f45c0a87a60b47c547b68fa140a7b686/src/flow-monitor/examples/flowmon-parse-results.py#L32-L41 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/pyasn1/pyasn1/type/univ.py | python | ObjectIdentifier.prettyIn | (self, value) | return value | Dotted -> tuple of numerics OID converter | Dotted -> tuple of numerics OID converter | [
"Dotted",
"-",
">",
"tuple",
"of",
"numerics",
"OID",
"converter"
] | def prettyIn(self, value):
"""Dotted -> tuple of numerics OID converter"""
if isinstance(value, tuple):
pass
elif isinstance(value, ObjectIdentifier):
return tuple(value)
elif isinstance(value, str):
r = []
for element in [ x for x ... | [
"def",
"prettyIn",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"tuple",
")",
":",
"pass",
"elif",
"isinstance",
"(",
"value",
",",
"ObjectIdentifier",
")",
":",
"return",
"tuple",
"(",
"value",
")",
"elif",
"isinstance",
... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/pyasn1/pyasn1/type/univ.py#L470-L502 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/zipfile.py | python | ZipFile.close | (self) | Close the file, and for mode 'w', 'x' and 'a' write the ending
records. | Close the file, and for mode 'w', 'x' and 'a' write the ending
records. | [
"Close",
"the",
"file",
"and",
"for",
"mode",
"w",
"x",
"and",
"a",
"write",
"the",
"ending",
"records",
"."
] | def close(self):
"""Close the file, and for mode 'w', 'x' and 'a' write the ending
records."""
if self.fp is None:
return
if self._writing:
raise ValueError("Can't close the ZIP file while there is "
"an open writing handle on it. "
... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"fp",
"is",
"None",
":",
"return",
"if",
"self",
".",
"_writing",
":",
"raise",
"ValueError",
"(",
"\"Can't close the ZIP file while there is \"",
"\"an open writing handle on it. \"",
"\"Close the writing hand... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/zipfile.py#L1811-L1831 | ||
rsummers11/CADLab | 976ed959a0b5208bb4173127a7ef732ac73a9b6f | panreas_hnn/hed-globalweight/scripts/cpp_lint.py | python | ReplaceAll | (pattern, rep, s) | return _regexp_compile_cache[pattern].sub(rep, s) | Replaces instances of pattern in a string with a replacement.
The compiled regex is kept in a cache shared by Match and Search.
Args:
pattern: regex pattern
rep: replacement text
s: search string
Returns:
string with replacements made (or original string if no replacements) | Replaces instances of pattern in a string with a replacement. | [
"Replaces",
"instances",
"of",
"pattern",
"in",
"a",
"string",
"with",
"a",
"replacement",
"."
] | def ReplaceAll(pattern, rep, s):
"""Replaces instances of pattern in a string with a replacement.
The compiled regex is kept in a cache shared by Match and Search.
Args:
pattern: regex pattern
rep: replacement text
s: search string
Returns:
string with replacements made (or original string if... | [
"def",
"ReplaceAll",
"(",
"pattern",
",",
"rep",
",",
"s",
")",
":",
"if",
"pattern",
"not",
"in",
"_regexp_compile_cache",
":",
"_regexp_compile_cache",
"[",
"pattern",
"]",
"=",
"sre_compile",
".",
"compile",
"(",
"pattern",
")",
"return",
"_regexp_compile_c... | https://github.com/rsummers11/CADLab/blob/976ed959a0b5208bb4173127a7ef732ac73a9b6f/panreas_hnn/hed-globalweight/scripts/cpp_lint.py#L525-L540 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/webbrowser.py | python | _synthesize | (browser, *, preferred=False) | return [None, None] | Attempt to synthesize a controller based on existing controllers.
This is useful to create a controller when a user specifies a path to
an entry in the BROWSER environment variable -- we can copy a general
controller to operate using a specific installation of the desired
browser in this way.
If w... | Attempt to synthesize a controller based on existing controllers. | [
"Attempt",
"to",
"synthesize",
"a",
"controller",
"based",
"on",
"existing",
"controllers",
"."
] | def _synthesize(browser, *, preferred=False):
"""Attempt to synthesize a controller based on existing controllers.
This is useful to create a controller when a user specifies a path to
an entry in the BROWSER environment variable -- we can copy a general
controller to operate using a specific installat... | [
"def",
"_synthesize",
"(",
"browser",
",",
"*",
",",
"preferred",
"=",
"False",
")",
":",
"cmd",
"=",
"browser",
".",
"split",
"(",
")",
"[",
"0",
"]",
"if",
"not",
"shutil",
".",
"which",
"(",
"cmd",
")",
":",
"return",
"[",
"None",
",",
"None",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/webbrowser.py#L105-L134 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/v8/third_party/jinja2/environment.py | python | Environment.make_globals | (self, d) | return dict(self.globals, **d) | Return a dict for the globals. | Return a dict for the globals. | [
"Return",
"a",
"dict",
"for",
"the",
"globals",
"."
] | def make_globals(self, d):
"""Return a dict for the globals."""
if not d:
return self.globals
return dict(self.globals, **d) | [
"def",
"make_globals",
"(",
"self",
",",
"d",
")",
":",
"if",
"not",
"d",
":",
"return",
"self",
".",
"globals",
"return",
"dict",
"(",
"self",
".",
"globals",
",",
"*",
"*",
"d",
")"
] | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/v8/third_party/jinja2/environment.py#L882-L886 | |
commaai/openpilot | 4416c21b1e738ab7d04147c5ae52b5135e0cdb40 | tools/lib/kbhit.py | python | KBHit.set_kbhit_terminal | (self) | Save old terminal settings for closure, remove ICANON & ECHO flags. | Save old terminal settings for closure, remove ICANON & ECHO flags. | [
"Save",
"old",
"terminal",
"settings",
"for",
"closure",
"remove",
"ICANON",
"&",
"ECHO",
"flags",
"."
] | def set_kbhit_terminal(self) -> None:
''' Save old terminal settings for closure, remove ICANON & ECHO flags.
'''
# Save the terminal settings
self.old_term = termios.tcgetattr(STDIN_FD)
self.new_term = self.old_term.copy()
# New terminal setting unbuffered
self.new_term[3] &= ~(termios.IC... | [
"def",
"set_kbhit_terminal",
"(",
"self",
")",
"->",
"None",
":",
"# Save the terminal settings",
"self",
".",
"old_term",
"=",
"termios",
".",
"tcgetattr",
"(",
"STDIN_FD",
")",
"self",
".",
"new_term",
"=",
"self",
".",
"old_term",
".",
"copy",
"(",
")",
... | https://github.com/commaai/openpilot/blob/4416c21b1e738ab7d04147c5ae52b5135e0cdb40/tools/lib/kbhit.py#L16-L29 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextParagraphLayoutBox.GetLineForVisibleLineNumber | (*args, **kwargs) | return _richtext.RichTextParagraphLayoutBox_GetLineForVisibleLineNumber(*args, **kwargs) | GetLineForVisibleLineNumber(self, long lineNumber) -> RichTextLine | GetLineForVisibleLineNumber(self, long lineNumber) -> RichTextLine | [
"GetLineForVisibleLineNumber",
"(",
"self",
"long",
"lineNumber",
")",
"-",
">",
"RichTextLine"
] | def GetLineForVisibleLineNumber(*args, **kwargs):
"""GetLineForVisibleLineNumber(self, long lineNumber) -> RichTextLine"""
return _richtext.RichTextParagraphLayoutBox_GetLineForVisibleLineNumber(*args, **kwargs) | [
"def",
"GetLineForVisibleLineNumber",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextParagraphLayoutBox_GetLineForVisibleLineNumber",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L1688-L1690 | |
HyeonwooNoh/caffe | d9e8494a2832d67b25dee37194c7bcb9d52d0e42 | python/caffe/pycaffe.py | python | _Net_set_input_arrays | (self, data, labels) | return self._set_input_arrays(data, labels) | Set input arrays of the in-memory MemoryDataLayer.
(Note: this is only for networks declared with the memory data layer.) | Set input arrays of the in-memory MemoryDataLayer.
(Note: this is only for networks declared with the memory data layer.) | [
"Set",
"input",
"arrays",
"of",
"the",
"in",
"-",
"memory",
"MemoryDataLayer",
".",
"(",
"Note",
":",
"this",
"is",
"only",
"for",
"networks",
"declared",
"with",
"the",
"memory",
"data",
"layer",
".",
")"
] | def _Net_set_input_arrays(self, data, labels):
"""
Set input arrays of the in-memory MemoryDataLayer.
(Note: this is only for networks declared with the memory data layer.)
"""
if labels.ndim == 1:
labels = np.ascontiguousarray(labels[:, np.newaxis, np.newaxis,
... | [
"def",
"_Net_set_input_arrays",
"(",
"self",
",",
"data",
",",
"labels",
")",
":",
"if",
"labels",
".",
"ndim",
"==",
"1",
":",
"labels",
"=",
"np",
".",
"ascontiguousarray",
"(",
"labels",
"[",
":",
",",
"np",
".",
"newaxis",
",",
"np",
".",
"newaxi... | https://github.com/HyeonwooNoh/caffe/blob/d9e8494a2832d67b25dee37194c7bcb9d52d0e42/python/caffe/pycaffe.py#L333-L341 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/rospkg/rospack.py | python | ManifestManager.__init__ | (self, manifest_name, ros_paths=None) | ctor. subclasses are expected to use *manifest_name*
to customize behavior of ManifestManager.
:param manifest_name: MANIFEST_FILE or STACK_FILE
:param ros_paths: Ordered list of paths to search for
resources. If `None` (default), use environment ROS path. | ctor. subclasses are expected to use *manifest_name*
to customize behavior of ManifestManager.
:param manifest_name: MANIFEST_FILE or STACK_FILE
:param ros_paths: Ordered list of paths to search for
resources. If `None` (default), use environment ROS path. | [
"ctor",
".",
"subclasses",
"are",
"expected",
"to",
"use",
"*",
"manifest_name",
"*",
"to",
"customize",
"behavior",
"of",
"ManifestManager",
".",
":",
"param",
"manifest_name",
":",
"MANIFEST_FILE",
"or",
"STACK_FILE",
":",
"param",
"ros_paths",
":",
"Ordered",... | def __init__(self, manifest_name, ros_paths=None):
"""
ctor. subclasses are expected to use *manifest_name*
to customize behavior of ManifestManager.
:param manifest_name: MANIFEST_FILE or STACK_FILE
:param ros_paths: Ordered list of paths to search for
resour... | [
"def",
"__init__",
"(",
"self",
",",
"manifest_name",
",",
"ros_paths",
"=",
"None",
")",
":",
"self",
".",
"_manifest_name",
"=",
"manifest_name",
"if",
"ros_paths",
"is",
"None",
":",
"self",
".",
"_ros_paths",
"=",
"get_ros_paths",
"(",
")",
"else",
":"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/rospkg/rospack.py#L108-L128 | ||
unsynchronized/gr-amps | 709d48272e7b605f34cfe89a517cc423923245e3 | python/build_utils.py | python | expand_template | (d, template_filename, extra = "") | Given a dictionary D and a TEMPLATE_FILENAME, expand template into output file | Given a dictionary D and a TEMPLATE_FILENAME, expand template into output file | [
"Given",
"a",
"dictionary",
"D",
"and",
"a",
"TEMPLATE_FILENAME",
"expand",
"template",
"into",
"output",
"file"
] | def expand_template (d, template_filename, extra = ""):
'''Given a dictionary D and a TEMPLATE_FILENAME, expand template into output file
'''
global do_sources
output_extension = extract_extension (template_filename)
template = open_src (template_filename, 'r')
output_name = d['NAME'] + extra + ... | [
"def",
"expand_template",
"(",
"d",
",",
"template_filename",
",",
"extra",
"=",
"\"\"",
")",
":",
"global",
"do_sources",
"output_extension",
"=",
"extract_extension",
"(",
"template_filename",
")",
"template",
"=",
"open_src",
"(",
"template_filename",
",",
"'r'... | https://github.com/unsynchronized/gr-amps/blob/709d48272e7b605f34cfe89a517cc423923245e3/python/build_utils.py#L72-L84 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | ScrollHelper.CalcScrollInc | (*args, **kwargs) | return _windows_.ScrollHelper_CalcScrollInc(*args, **kwargs) | CalcScrollInc(self, ScrollWinEvent event) -> int | CalcScrollInc(self, ScrollWinEvent event) -> int | [
"CalcScrollInc",
"(",
"self",
"ScrollWinEvent",
"event",
")",
"-",
">",
"int"
] | def CalcScrollInc(*args, **kwargs):
"""CalcScrollInc(self, ScrollWinEvent event) -> int"""
return _windows_.ScrollHelper_CalcScrollInc(*args, **kwargs) | [
"def",
"CalcScrollInc",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"ScrollHelper_CalcScrollInc",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L237-L239 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pkg_resources/_vendor/six.py | python | _import_module | (name) | return sys.modules[name] | Import module, returning the module after the last dot. | Import module, returning the module after the last dot. | [
"Import",
"module",
"returning",
"the",
"module",
"after",
"the",
"last",
"dot",
"."
] | def _import_module(name):
"""Import module, returning the module after the last dot."""
__import__(name)
return sys.modules[name] | [
"def",
"_import_module",
"(",
"name",
")",
":",
"__import__",
"(",
"name",
")",
"return",
"sys",
".",
"modules",
"[",
"name",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pkg_resources/_vendor/six.py#L80-L83 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/aui.py | python | AuiToolBar.SetToolLabel | (*args, **kwargs) | return _aui.AuiToolBar_SetToolLabel(*args, **kwargs) | SetToolLabel(self, int toolId, String label) | SetToolLabel(self, int toolId, String label) | [
"SetToolLabel",
"(",
"self",
"int",
"toolId",
"String",
"label",
")"
] | def SetToolLabel(*args, **kwargs):
"""SetToolLabel(self, int toolId, String label)"""
return _aui.AuiToolBar_SetToolLabel(*args, **kwargs) | [
"def",
"SetToolLabel",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiToolBar_SetToolLabel",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/aui.py#L2222-L2224 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/urllib3/filepost.py | python | encode_multipart_formdata | (fields, boundary=None) | return body.getvalue(), content_type | Encode a dictionary of ``fields`` using the multipart/form-data MIME format.
:param fields:
Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`).
:param boundary:
If not specified, then a random boundary will be generated using
:func:`urllib3.filepost.choose_bou... | Encode a dictionary of ``fields`` using the multipart/form-data MIME format. | [
"Encode",
"a",
"dictionary",
"of",
"fields",
"using",
"the",
"multipart",
"/",
"form",
"-",
"data",
"MIME",
"format",
"."
] | def encode_multipart_formdata(fields, boundary=None):
"""
Encode a dictionary of ``fields`` using the multipart/form-data MIME format.
:param fields:
Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`).
:param boundary:
If not specified, then a random boundary ... | [
"def",
"encode_multipart_formdata",
"(",
"fields",
",",
"boundary",
"=",
"None",
")",
":",
"body",
"=",
"BytesIO",
"(",
")",
"if",
"boundary",
"is",
"None",
":",
"boundary",
"=",
"choose_boundary",
"(",
")",
"for",
"field",
"in",
"iter_field_objects",
"(",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/urllib3/filepost.py#L63-L98 | |
DBAIWangGroup/nns_benchmark | 761b7d746d66e3c9c9e513d5546d775d37b9f722 | algorithms/flann/code/src/python/pyflann/index.py | python | FLANN.hierarchical_kmeans | (self, pts, branch_size, num_branches,
max_iterations = None,
dtype = None, **kwargs) | Clusters the data by using multiple runs of kmeans to
recursively partition the dataset. The number of resulting
clusters is given by (branch_size-1)*num_branches+1.
This method can be significantly faster when the number of
desired clusters is quite large (e.g. a hundred or mo... | Clusters the data by using multiple runs of kmeans to
recursively partition the dataset. The number of resulting
clusters is given by (branch_size-1)*num_branches+1.
This method can be significantly faster when the number of
desired clusters is quite large (e.g. a hundred or mo... | [
"Clusters",
"the",
"data",
"by",
"using",
"multiple",
"runs",
"of",
"kmeans",
"to",
"recursively",
"partition",
"the",
"dataset",
".",
"The",
"number",
"of",
"resulting",
"clusters",
"is",
"given",
"by",
"(",
"branch_size",
"-",
"1",
")",
"*",
"num_branches"... | def hierarchical_kmeans(self, pts, branch_size, num_branches,
max_iterations = None,
dtype = None, **kwargs):
"""
Clusters the data by using multiple runs of kmeans to
recursively partition the dataset. The number of resulting
clu... | [
"def",
"hierarchical_kmeans",
"(",
"self",
",",
"pts",
",",
"branch_size",
",",
"num_branches",
",",
"max_iterations",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# First verify the paremeters are sensible.",
"if",
"not",
"pts",
... | https://github.com/DBAIWangGroup/nns_benchmark/blob/761b7d746d66e3c9c9e513d5546d775d37b9f722/algorithms/flann/code/src/python/pyflann/index.py#L323-L391 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/extension.py | python | read_setup_file | (filename) | return extensions | Reads a Setup file and returns Extension instances. | Reads a Setup file and returns Extension instances. | [
"Reads",
"a",
"Setup",
"file",
"and",
"returns",
"Extension",
"instances",
"."
] | def read_setup_file(filename):
"""Reads a Setup file and returns Extension instances."""
from distutils.sysconfig import (parse_makefile, expand_makefile_vars,
_variable_rx)
from distutils.text_file import TextFile
from distutils.util import split_quoted
# Firs... | [
"def",
"read_setup_file",
"(",
"filename",
")",
":",
"from",
"distutils",
".",
"sysconfig",
"import",
"(",
"parse_makefile",
",",
"expand_makefile_vars",
",",
"_variable_rx",
")",
"from",
"distutils",
".",
"text_file",
"import",
"TextFile",
"from",
"distutils",
".... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/extension.py#L141-L240 | |
simsong/bulk_extractor | 738911df22b7066ca9e1662f4131fb44090a4196 | python/dfxml.py | python | extentdb.add_sectors | (self,sectors) | Adds the sectors in the list to the database. | Adds the sectors in the list to the database. | [
"Adds",
"the",
"sectors",
"in",
"the",
"list",
"to",
"the",
"database",
"."
] | def add_sectors(self,sectors):
"""Adds the sectors in the list to the database."""
self.add_runs(self.runs_for_sectors(sectors)) | [
"def",
"add_sectors",
"(",
"self",
",",
"sectors",
")",
":",
"self",
".",
"add_runs",
"(",
"self",
".",
"runs_for_sectors",
"(",
"sectors",
")",
")"
] | https://github.com/simsong/bulk_extractor/blob/738911df22b7066ca9e1662f4131fb44090a4196/python/dfxml.py#L1469-L1471 | ||
google/or-tools | 2cb85b4eead4c38e1c54b48044f92087cf165bce | examples/contrib/bacp.py | python | ReadData | (filename) | return (credits, nb_periods, prereq) | Read data from <filename>. | Read data from <filename>. | [
"Read",
"data",
"from",
"<filename",
">",
"."
] | def ReadData(filename):
"""Read data from <filename>."""
f = open(filename)
nb_courses, nb_periods, min_credit, max_credit, nb_prereqs =\
[int(nb) for nb in f.readline().split()]
credits = [int(nb) for nb in f.readline().split()]
prereq = [int(nb) for nb in f.readline().split()]
prereq = [(prereq[i * ... | [
"def",
"ReadData",
"(",
"filename",
")",
":",
"f",
"=",
"open",
"(",
"filename",
")",
"nb_courses",
",",
"nb_periods",
",",
"min_credit",
",",
"max_credit",
",",
"nb_prereqs",
"=",
"[",
"int",
"(",
"nb",
")",
"for",
"nb",
"in",
"f",
".",
"readline",
... | https://github.com/google/or-tools/blob/2cb85b4eead4c38e1c54b48044f92087cf165bce/examples/contrib/bacp.py#L40-L48 | |
nnrg/opennero | 43e12a1bcba6e228639db3886fec1dc47ddc24cb | mods/common/module.py | python | addSkyBox | (prefix, extension = None) | add a skybox starting with the prefix and ending with the extension | add a skybox starting with the prefix and ending with the extension | [
"add",
"a",
"skybox",
"starting",
"with",
"the",
"prefix",
"and",
"ending",
"with",
"the",
"extension"
] | def addSkyBox(prefix, extension = None):
""" add a skybox starting with the prefix and ending with the extension """
if extension:
OpenNero.getSimContext().addSkyBox(prefix, extension)
else:
OpenNero.getSimContext().addSkyBox(prefix) | [
"def",
"addSkyBox",
"(",
"prefix",
",",
"extension",
"=",
"None",
")",
":",
"if",
"extension",
":",
"OpenNero",
".",
"getSimContext",
"(",
")",
".",
"addSkyBox",
"(",
"prefix",
",",
"extension",
")",
"else",
":",
"OpenNero",
".",
"getSimContext",
"(",
")... | https://github.com/nnrg/opennero/blob/43e12a1bcba6e228639db3886fec1dc47ddc24cb/mods/common/module.py#L23-L28 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_windows.py | python | PrintData.SetQuality | (*args, **kwargs) | return _windows_.PrintData_SetQuality(*args, **kwargs) | SetQuality(self, int quality) | SetQuality(self, int quality) | [
"SetQuality",
"(",
"self",
"int",
"quality",
")"
] | def SetQuality(*args, **kwargs):
"""SetQuality(self, int quality)"""
return _windows_.PrintData_SetQuality(*args, **kwargs) | [
"def",
"SetQuality",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PrintData_SetQuality",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_windows.py#L4803-L4805 | |
RegrowthStudios/SoACode-Public | c3ddd69355b534d5e70e2e6d0c489b4e93ab1ffe | utils/git-hooks/cpplint/cpplint.py | python | _IncludeState.CheckNextIncludeOrder | (self, header_type) | return '' | Returns a non-empty error message if the next header is out of order.
This function also updates the internal state to be ready to check
the next include.
Args:
header_type: One of the _XXX_HEADER constants defined above.
Returns:
The empty string if the header is in the right order, or a... | Returns a non-empty error message if the next header is out of order. | [
"Returns",
"a",
"non",
"-",
"empty",
"error",
"message",
"if",
"the",
"next",
"header",
"is",
"out",
"of",
"order",
"."
] | def CheckNextIncludeOrder(self, header_type):
"""Returns a non-empty error message if the next header is out of order.
This function also updates the internal state to be ready to check
the next include.
Args:
header_type: One of the _XXX_HEADER constants defined above.
Returns:
The e... | [
"def",
"CheckNextIncludeOrder",
"(",
"self",
",",
"header_type",
")",
":",
"error_message",
"=",
"(",
"'Found %s after %s'",
"%",
"(",
"self",
".",
"_TYPE_NAMES",
"[",
"header_type",
"]",
",",
"self",
".",
"_SECTION_NAMES",
"[",
"self",
".",
"_section",
"]",
... | https://github.com/RegrowthStudios/SoACode-Public/blob/c3ddd69355b534d5e70e2e6d0c489b4e93ab1ffe/utils/git-hooks/cpplint/cpplint.py#L456-L507 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/eager/function.py | python | ConcreteFunction._experimental_with_cancellation_manager | (self, cancellation_manager) | return cancellable_call | Returns a callable that invokes a cancellable version of this function.
Args:
cancellation_manager: A `CancellationManager` object that can be used to
cancel function invocation.
Returns:
A callable with the same signature as this concrete function. | Returns a callable that invokes a cancellable version of this function. | [
"Returns",
"a",
"callable",
"that",
"invokes",
"a",
"cancellable",
"version",
"of",
"this",
"function",
"."
] | def _experimental_with_cancellation_manager(self, cancellation_manager):
"""Returns a callable that invokes a cancellable version of this function.
Args:
cancellation_manager: A `CancellationManager` object that can be used to
cancel function invocation.
Returns:
A callable with the sa... | [
"def",
"_experimental_with_cancellation_manager",
"(",
"self",
",",
"cancellation_manager",
")",
":",
"def",
"cancellable_call",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_call_impl",
"(",
"args",
",",
"kwargs",
",",
"cancell... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/eager/function.py#L1879-L1894 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/framework/ops.py | python | get_collection | (key, scope=None) | return get_default_graph().get_collection(key, scope) | Wrapper for `Graph.get_collection()` using the default graph.
See [`Graph.get_collection()`](../../api_docs/python/framework.md#Graph.get_collection)
for more details.
Args:
key: The key for the collection. For example, the `GraphKeys` class
contains many standard names for collections.
scope: (Op... | Wrapper for `Graph.get_collection()` using the default graph. | [
"Wrapper",
"for",
"Graph",
".",
"get_collection",
"()",
"using",
"the",
"default",
"graph",
"."
] | def get_collection(key, scope=None):
"""Wrapper for `Graph.get_collection()` using the default graph.
See [`Graph.get_collection()`](../../api_docs/python/framework.md#Graph.get_collection)
for more details.
Args:
key: The key for the collection. For example, the `GraphKeys` class
contains many stan... | [
"def",
"get_collection",
"(",
"key",
",",
"scope",
"=",
"None",
")",
":",
"return",
"get_default_graph",
"(",
")",
".",
"get_collection",
"(",
"key",
",",
"scope",
")"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/framework/ops.py#L3962-L3983 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/math_grad.py | python | _RealDivGrad | (op, grad) | return (array_ops.reshape(
math_ops.reduce_sum(math_ops.realdiv(grad, y), rx),
sx), array_ops.reshape(
math_ops.reduce_sum(grad * math_ops.realdiv(math_ops.realdiv(-x, y), y),
ry), sy)) | RealDiv op gradient. | RealDiv op gradient. | [
"RealDiv",
"op",
"gradient",
"."
] | def _RealDivGrad(op, grad):
"""RealDiv op gradient."""
x = op.inputs[0]
y = op.inputs[1]
sx = array_ops.shape(x)
sy = array_ops.shape(y)
# pylint: disable=protected-access
rx, ry = gen_array_ops._broadcast_gradient_args(sx, sy)
# pylint: enable=protected-access
x = math_ops.conj(x)
y = math_ops.conj... | [
"def",
"_RealDivGrad",
"(",
"op",
",",
"grad",
")",
":",
"x",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
"y",
"=",
"op",
".",
"inputs",
"[",
"1",
"]",
"sx",
"=",
"array_ops",
".",
"shape",
"(",
"x",
")",
"sy",
"=",
"array_ops",
".",
"shape",
"(... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/math_grad.py#L750-L765 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/urllib/request.py | python | URLopener.open_file | (self, url) | Use local file or FTP depending on form of URL. | Use local file or FTP depending on form of URL. | [
"Use",
"local",
"file",
"or",
"FTP",
"depending",
"on",
"form",
"of",
"URL",
"."
] | def open_file(self, url):
"""Use local file or FTP depending on form of URL."""
if not isinstance(url, str):
raise URLError('file error: proxy support for file protocol currently not implemented')
if url[:2] == '//' and url[2:3] != '/' and url[2:12].lower() != 'localhost/':
... | [
"def",
"open_file",
"(",
"self",
",",
"url",
")",
":",
"if",
"not",
"isinstance",
"(",
"url",
",",
"str",
")",
":",
"raise",
"URLError",
"(",
"'file error: proxy support for file protocol currently not implemented'",
")",
"if",
"url",
"[",
":",
"2",
"]",
"==",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/urllib/request.py#L2000-L2007 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/email/message.py | python | Message.__len__ | (self) | return len(self._headers) | Return the total number of headers, including duplicates. | Return the total number of headers, including duplicates. | [
"Return",
"the",
"total",
"number",
"of",
"headers",
"including",
"duplicates",
"."
] | def __len__(self):
"""Return the total number of headers, including duplicates."""
return len(self._headers) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"_headers",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/email/message.py#L378-L380 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/array_ops.py | python | boolean_mask_v2 | (tensor, mask, axis=None, name="boolean_mask") | return boolean_mask(tensor, mask, name, axis) | Apply boolean mask to tensor.
Numpy equivalent is `tensor[mask]`.
```python
# 1-D example
tensor = [0, 1, 2, 3]
mask = np.array([True, False, True, False])
boolean_mask(tensor, mask) # [0, 2]
```
In general, `0 < dim(mask) = K <= dim(tensor)`, and `mask`'s shape must match
the first K dimensions o... | Apply boolean mask to tensor. | [
"Apply",
"boolean",
"mask",
"to",
"tensor",
"."
] | def boolean_mask_v2(tensor, mask, axis=None, name="boolean_mask"):
"""Apply boolean mask to tensor.
Numpy equivalent is `tensor[mask]`.
```python
# 1-D example
tensor = [0, 1, 2, 3]
mask = np.array([True, False, True, False])
boolean_mask(tensor, mask) # [0, 2]
```
In general, `0 < dim(mask) = K <... | [
"def",
"boolean_mask_v2",
"(",
"tensor",
",",
"mask",
",",
"axis",
"=",
"None",
",",
"name",
"=",
"\"boolean_mask\"",
")",
":",
"return",
"boolean_mask",
"(",
"tensor",
",",
"mask",
",",
"name",
",",
"axis",
")"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/array_ops.py#L1512-L1560 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/models/rnn/translate/data_utils.py | python | prepare_wmt_data | (data_dir, en_vocabulary_size, fr_vocabulary_size, tokenizer=None) | return (en_train_ids_path, fr_train_ids_path,
en_dev_ids_path, fr_dev_ids_path,
en_vocab_path, fr_vocab_path) | Get WMT data into data_dir, create vocabularies and tokenize data.
Args:
data_dir: directory in which the data sets will be stored.
en_vocabulary_size: size of the English vocabulary to create and use.
fr_vocabulary_size: size of the French vocabulary to create and use.
tokenizer: a function to use t... | Get WMT data into data_dir, create vocabularies and tokenize data. | [
"Get",
"WMT",
"data",
"into",
"data_dir",
"create",
"vocabularies",
"and",
"tokenize",
"data",
"."
] | def prepare_wmt_data(data_dir, en_vocabulary_size, fr_vocabulary_size, tokenizer=None):
"""Get WMT data into data_dir, create vocabularies and tokenize data.
Args:
data_dir: directory in which the data sets will be stored.
en_vocabulary_size: size of the English vocabulary to create and use.
fr_vocabul... | [
"def",
"prepare_wmt_data",
"(",
"data_dir",
",",
"en_vocabulary_size",
",",
"fr_vocabulary_size",
",",
"tokenizer",
"=",
"None",
")",
":",
"# Get wmt data to the specified directory.",
"train_path",
"=",
"get_wmt_enfr_train_set",
"(",
"data_dir",
")",
"dev_path",
"=",
"... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/models/rnn/translate/data_utils.py#L245-L288 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/signal/ltisys.py | python | dlti.step | (self, x0=None, t=None, n=None) | return dstep(self, x0=x0, t=t, n=n) | Return the step response of the discrete-time `dlti` system.
See `dstep` for details. | Return the step response of the discrete-time `dlti` system.
See `dstep` for details. | [
"Return",
"the",
"step",
"response",
"of",
"the",
"discrete",
"-",
"time",
"dlti",
"system",
".",
"See",
"dstep",
"for",
"details",
"."
] | def step(self, x0=None, t=None, n=None):
"""
Return the step response of the discrete-time `dlti` system.
See `dstep` for details.
"""
return dstep(self, x0=x0, t=t, n=n) | [
"def",
"step",
"(",
"self",
",",
"x0",
"=",
"None",
",",
"t",
"=",
"None",
",",
"n",
"=",
"None",
")",
":",
"return",
"dstep",
"(",
"self",
",",
"x0",
"=",
"x0",
",",
"t",
"=",
"t",
",",
"n",
"=",
"n",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/signal/ltisys.py#L427-L432 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/utils/vim-lldb/python-vim-lldb/vim_ui.py | python | is_same_file | (a, b) | return a in b or b in a | returns true if paths a and b are the same file | returns true if paths a and b are the same file | [
"returns",
"true",
"if",
"paths",
"a",
"and",
"b",
"are",
"the",
"same",
"file"
] | def is_same_file(a, b):
""" returns true if paths a and b are the same file """
a = os.path.realpath(a)
b = os.path.realpath(b)
return a in b or b in a | [
"def",
"is_same_file",
"(",
"a",
",",
"b",
")",
":",
"a",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"a",
")",
"b",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"b",
")",
"return",
"a",
"in",
"b",
"or",
"b",
"in",
"a"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/utils/vim-lldb/python-vim-lldb/vim_ui.py#L13-L17 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | MultiChoiceDialog.__init__ | (self, *args, **kwargs) | __init__(self, Window parent, String message, String caption,
List choices=EmptyList, long style=CHOICEDLG_STYLE,
Point pos=DefaultPosition) -> MultiChoiceDialog
Constructor. Use the `ShowModal` method to show the dialog.
:param parent: The parent window.
:para... | __init__(self, Window parent, String message, String caption,
List choices=EmptyList, long style=CHOICEDLG_STYLE,
Point pos=DefaultPosition) -> MultiChoiceDialog | [
"__init__",
"(",
"self",
"Window",
"parent",
"String",
"message",
"String",
"caption",
"List",
"choices",
"=",
"EmptyList",
"long",
"style",
"=",
"CHOICEDLG_STYLE",
"Point",
"pos",
"=",
"DefaultPosition",
")",
"-",
">",
"MultiChoiceDialog"
] | def __init__(self, *args, **kwargs):
"""
__init__(self, Window parent, String message, String caption,
List choices=EmptyList, long style=CHOICEDLG_STYLE,
Point pos=DefaultPosition) -> MultiChoiceDialog
Constructor. Use the `ShowModal` method to show the dialog.
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_windows_",
".",
"MultiChoiceDialog_swiginit",
"(",
"self",
",",
"_windows_",
".",
"new_MultiChoiceDialog",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"self",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L3281-L3301 | ||
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/execution.py | python | Execution.simple_leaves_qty | (self) | return self._simple_leaves_qty | Gets the simple_leaves_qty of this Execution. # noqa: E501
:return: The simple_leaves_qty of this Execution. # noqa: E501
:rtype: float | Gets the simple_leaves_qty of this Execution. # noqa: E501 | [
"Gets",
"the",
"simple_leaves_qty",
"of",
"this",
"Execution",
".",
"#",
"noqa",
":",
"E501"
] | def simple_leaves_qty(self):
"""Gets the simple_leaves_qty of this Execution. # noqa: E501
:return: The simple_leaves_qty of this Execution. # noqa: E501
:rtype: float
"""
return self._simple_leaves_qty | [
"def",
"simple_leaves_qty",
"(",
"self",
")",
":",
"return",
"self",
".",
"_simple_leaves_qty"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/execution.py#L933-L940 | |
CaoWGG/TensorRT-YOLOv4 | 4d7c2edce99e8794a4cb4ea3540d51ce91158a36 | onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py | python | Type.get_array_element_type | (self) | return conf.lib.clang_getArrayElementType(self) | Retrieve the type of the elements of the array type. | Retrieve the type of the elements of the array type. | [
"Retrieve",
"the",
"type",
"of",
"the",
"elements",
"of",
"the",
"array",
"type",
"."
] | def get_array_element_type(self):
"""
Retrieve the type of the elements of the array type.
"""
return conf.lib.clang_getArrayElementType(self) | [
"def",
"get_array_element_type",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getArrayElementType",
"(",
"self",
")"
] | https://github.com/CaoWGG/TensorRT-YOLOv4/blob/4d7c2edce99e8794a4cb4ea3540d51ce91158a36/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py#L2060-L2064 | |
wjakob/tbb | 9e219e24fe223b299783200f217e9d27790a87b0 | python/tbb/pool.py | python | Pool.close | (self) | Prevents any more tasks from being submitted to the
pool. Once all the tasks have been completed the worker
processes will exit. | Prevents any more tasks from being submitted to the
pool. Once all the tasks have been completed the worker
processes will exit. | [
"Prevents",
"any",
"more",
"tasks",
"from",
"being",
"submitted",
"to",
"the",
"pool",
".",
"Once",
"all",
"the",
"tasks",
"have",
"been",
"completed",
"the",
"worker",
"processes",
"will",
"exit",
"."
] | def close(self):
"""Prevents any more tasks from being submitted to the
pool. Once all the tasks have been completed the worker
processes will exit."""
# No lock here. We assume it's sufficiently atomic...
self._closed = True | [
"def",
"close",
"(",
"self",
")",
":",
"# No lock here. We assume it's sufficiently atomic...",
"self",
".",
"_closed",
"=",
"True"
] | https://github.com/wjakob/tbb/blob/9e219e24fe223b299783200f217e9d27790a87b0/python/tbb/pool.py#L206-L211 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py3/google/protobuf/internal/decoder.py | python | _EndGroup | (buffer, pos, end) | return -1 | Skipping an END_GROUP tag returns -1 to tell the parent loop to break. | Skipping an END_GROUP tag returns -1 to tell the parent loop to break. | [
"Skipping",
"an",
"END_GROUP",
"tag",
"returns",
"-",
"1",
"to",
"tell",
"the",
"parent",
"loop",
"to",
"break",
"."
] | def _EndGroup(buffer, pos, end):
"""Skipping an END_GROUP tag returns -1 to tell the parent loop to break."""
return -1 | [
"def",
"_EndGroup",
"(",
"buffer",
",",
"pos",
",",
"end",
")",
":",
"return",
"-",
"1"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py3/google/protobuf/internal/decoder.py#L998-L1001 | |
google/shaka-packager | e1b0c7c45431327fd3ce193514a5407d07b39b22 | packager/third_party/protobuf/python/google/protobuf/internal/python_message.py | python | _AddEnumValues | (descriptor, cls) | Sets class-level attributes for all enum fields defined in this message.
Also exporting a class-level object that can name enum values.
Args:
descriptor: Descriptor object for this message type.
cls: Class we're constructing for this message type. | Sets class-level attributes for all enum fields defined in this message. | [
"Sets",
"class",
"-",
"level",
"attributes",
"for",
"all",
"enum",
"fields",
"defined",
"in",
"this",
"message",
"."
] | def _AddEnumValues(descriptor, cls):
"""Sets class-level attributes for all enum fields defined in this message.
Also exporting a class-level object that can name enum values.
Args:
descriptor: Descriptor object for this message type.
cls: Class we're constructing for this message type.
"""
for enum... | [
"def",
"_AddEnumValues",
"(",
"descriptor",
",",
"cls",
")",
":",
"for",
"enum_type",
"in",
"descriptor",
".",
"enum_types",
":",
"setattr",
"(",
"cls",
",",
"enum_type",
".",
"name",
",",
"enum_type_wrapper",
".",
"EnumTypeWrapper",
"(",
"enum_type",
")",
"... | https://github.com/google/shaka-packager/blob/e1b0c7c45431327fd3ce193514a5407d07b39b22/packager/third_party/protobuf/python/google/protobuf/internal/python_message.py#L347-L359 | ||
xiexiexx/Planet | 90cfdcbabdb8e6b45c4213a1debf468d9220a390 | merge/merge.py | python | merge_sort_dust | (lst, left, right) | 使用下表方式
效率没有提升 | 使用下表方式
效率没有提升 | [
"使用下表方式",
"效率没有提升"
] | def merge_sort_dust(lst, left, right):
"""
使用下表方式
效率没有提升
"""
if left < right:
mid = (left + right) / 2
merge_sort_dust(lst, left, mid)
merge_sort_dust(lst, mid + 1, right)
merge_dust(lst, left, mid, right) | [
"def",
"merge_sort_dust",
"(",
"lst",
",",
"left",
",",
"right",
")",
":",
"if",
"left",
"<",
"right",
":",
"mid",
"=",
"(",
"left",
"+",
"right",
")",
"/",
"2",
"merge_sort_dust",
"(",
"lst",
",",
"left",
",",
"mid",
")",
"merge_sort_dust",
"(",
"... | https://github.com/xiexiexx/Planet/blob/90cfdcbabdb8e6b45c4213a1debf468d9220a390/merge/merge.py#L76-L86 | ||
protocolbuffers/protobuf | b5ab0b7a18b7336c60130f4ddb2d97c51792f896 | python/google/protobuf/internal/containers.py | python | RepeatedScalarFieldContainer.__delslice__ | (self, start, stop) | Deletes the subset of items from between the specified indices. | Deletes the subset of items from between the specified indices. | [
"Deletes",
"the",
"subset",
"of",
"items",
"from",
"between",
"the",
"specified",
"indices",
"."
] | def __delslice__(self, start, stop):
"""Deletes the subset of items from between the specified indices."""
del self._values[start:stop]
self._message_listener.Modified() | [
"def",
"__delslice__",
"(",
"self",
",",
"start",
",",
"stop",
")",
":",
"del",
"self",
".",
"_values",
"[",
"start",
":",
"stop",
"]",
"self",
".",
"_message_listener",
".",
"Modified",
"(",
")"
] | https://github.com/protocolbuffers/protobuf/blob/b5ab0b7a18b7336c60130f4ddb2d97c51792f896/python/google/protobuf/internal/containers.py#L193-L196 | ||
deepmind/streetlearn | ccf1d60b9c45154894d45a897748aee85d7eb69b | streetlearn/python/ui/human_agent.py | python | loop | (env, screen, x_max, y_max, subsampling=None, font=None) | Main loop of the human agent. | Main loop of the human agent. | [
"Main",
"loop",
"of",
"the",
"human",
"agent",
"."
] | def loop(env, screen, x_max, y_max, subsampling=None, font=None):
"""Main loop of the human agent."""
screen_buffer = np.zeros((x_max, y_max, 3), np.uint8)
action = np.array([0, 0, 0, 0])
action_spec = env.action_spec()
sum_rewards = 0
sum_rewards_at_goal = 0
previous_goal_id = None
while True:
# T... | [
"def",
"loop",
"(",
"env",
",",
"screen",
",",
"x_max",
",",
"y_max",
",",
"subsampling",
"=",
"None",
",",
"font",
"=",
"None",
")",
":",
"screen_buffer",
"=",
"np",
".",
"zeros",
"(",
"(",
"x_max",
",",
"y_max",
",",
"3",
")",
",",
"np",
".",
... | https://github.com/deepmind/streetlearn/blob/ccf1d60b9c45154894d45a897748aee85d7eb69b/streetlearn/python/ui/human_agent.py#L91-L192 | ||
abforce/xposed_art_n | ec3fbe417d74d4664cec053d91dd4e3881176374 | tools/checker/checker.py | python | FindCheckerFiles | (path) | Returns a list of files to scan for check annotations in the given path.
Path to a file is returned as a single-element list, directories are
recursively traversed and all '.java' and '.smali' files returned. | Returns a list of files to scan for check annotations in the given path.
Path to a file is returned as a single-element list, directories are
recursively traversed and all '.java' and '.smali' files returned. | [
"Returns",
"a",
"list",
"of",
"files",
"to",
"scan",
"for",
"check",
"annotations",
"in",
"the",
"given",
"path",
".",
"Path",
"to",
"a",
"file",
"is",
"returned",
"as",
"a",
"single",
"-",
"element",
"list",
"directories",
"are",
"recursively",
"traversed... | def FindCheckerFiles(path):
""" Returns a list of files to scan for check annotations in the given path.
Path to a file is returned as a single-element list, directories are
recursively traversed and all '.java' and '.smali' files returned.
"""
if not path:
Logger.fail("No source path provided")
... | [
"def",
"FindCheckerFiles",
"(",
"path",
")",
":",
"if",
"not",
"path",
":",
"Logger",
".",
"fail",
"(",
"\"No source path provided\"",
")",
"elif",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
":",
"return",
"[",
"path",
"]",
"elif",
"os",
".",
... | https://github.com/abforce/xposed_art_n/blob/ec3fbe417d74d4664cec053d91dd4e3881176374/tools/checker/checker.py#L67-L85 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/pytables.py | python | Fixed.__repr__ | (self) | return self.pandas_type | return a pretty representation of myself | return a pretty representation of myself | [
"return",
"a",
"pretty",
"representation",
"of",
"myself"
] | def __repr__(self) -> str:
""" return a pretty representation of myself """
self.infer_axes()
s = self.shape
if s is not None:
if isinstance(s, (list, tuple)):
jshape = ",".join(pprint_thing(x) for x in s)
s = f"[{jshape}]"
return f... | [
"def",
"__repr__",
"(",
"self",
")",
"->",
"str",
":",
"self",
".",
"infer_axes",
"(",
")",
"s",
"=",
"self",
".",
"shape",
"if",
"s",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"s",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"jshap... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/pytables.py#L2521-L2530 | |
DGtal-team/DGtal | b403217bae9a55638a0a8baac69cc7e8d6362af5 | wrap/deploy/dgtalVersion.py | python | get_versions | () | return versions | Returns versions for the DGtal Python package.
from dgtalVersion import get_versions
# Returns the DGtal repository version
get_versions()['version']
# Returns the package version. Since GitHub Releases do not support the '+'
# character in file names, this does not contain the local version
... | Returns versions for the DGtal Python package. | [
"Returns",
"versions",
"for",
"the",
"DGtal",
"Python",
"package",
"."
] | def get_versions():
"""Returns versions for the DGtal Python package.
from dgtalVersion import get_versions
# Returns the DGtal repository version
get_versions()['version']
# Returns the package version. Since GitHub Releases do not support the '+'
# character in file names, this does not con... | [
"def",
"get_versions",
"(",
")",
":",
"versions",
"=",
"{",
"}",
"versions",
"[",
"'version'",
"]",
"=",
"VERSION",
"versions",
"[",
"'package-version'",
"]",
"=",
"VERSION",
".",
"split",
"(",
"'+'",
")",
"[",
"0",
"]",
"return",
"versions"
] | https://github.com/DGtal-team/DGtal/blob/b403217bae9a55638a0a8baac69cc7e8d6362af5/wrap/deploy/dgtalVersion.py#L3-L25 | |
Samsung/veles | 95ed733c2e49bc011ad98ccf2416ecec23fbf352 | veles/external/progressbar/widgets.py | python | Bar.__init__ | (self, marker='#', left='|', right='|', fill=' ',
fill_left=True) | Creates a customizable progress bar.
marker - string or updatable object to use as a marker
left - string or updatable object to use as a left border
right - string or updatable object to use as a right border
fill - character to use for the empty part of the progress bar
fill_l... | Creates a customizable progress bar. | [
"Creates",
"a",
"customizable",
"progress",
"bar",
"."
] | def __init__(self, marker='#', left='|', right='|', fill=' ',
fill_left=True):
"""Creates a customizable progress bar.
marker - string or updatable object to use as a marker
left - string or updatable object to use as a left border
right - string or updatable object to ... | [
"def",
"__init__",
"(",
"self",
",",
"marker",
"=",
"'#'",
",",
"left",
"=",
"'|'",
",",
"right",
"=",
"'|'",
",",
"fill",
"=",
"' '",
",",
"fill_left",
"=",
"True",
")",
":",
"self",
".",
"marker",
"=",
"marker",
"self",
".",
"left",
"=",
"left"... | https://github.com/Samsung/veles/blob/95ed733c2e49bc011ad98ccf2416ecec23fbf352/veles/external/progressbar/widgets.py#L284-L298 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/profiler/tfprof_logger.py | python | write_op_log | (graph, log_dir, op_log=None, run_meta=None, add_trace=True) | Log provided 'op_log', and add additional model information below.
The API also assigns ops in tf.compat.v1.trainable_variables() an op type
called '_trainable_variables'.
The API also logs 'flops' statistics for ops with op.RegisterStatistics()
defined. flops calculation depends on Tensor shapes defin... | Log provided 'op_log', and add additional model information below. | [
"Log",
"provided",
"op_log",
"and",
"add",
"additional",
"model",
"information",
"below",
"."
] | def write_op_log(graph, log_dir, op_log=None, run_meta=None, add_trace=True):
"""Log provided 'op_log', and add additional model information below.
The API also assigns ops in tf.compat.v1.trainable_variables() an op type
called '_trainable_variables'.
The API also logs 'flops' statistics for ops with op... | [
"def",
"write_op_log",
"(",
"graph",
",",
"log_dir",
",",
"op_log",
"=",
"None",
",",
"run_meta",
"=",
"None",
",",
"add_trace",
"=",
"True",
")",
":",
"if",
"not",
"graph",
"and",
"not",
"context",
".",
"executing_eagerly",
"(",
")",
":",
"graph",
"="... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/profiler/tfprof_logger.py#L192-L218 | ||
epam/Indigo | 30e40b4b1eb9bae0207435a26cfcb81ddcc42be1 | api/python/indigo/__init__.py | python | IndigoObject.iterateDecompositions | (self) | return self.dispatcher.IndigoObject(
self.dispatcher,
self.dispatcher._checkResult(
Indigo._lib.indigoIterateDecompositions(self.id)
),
) | Deconvolution element method returns decompositions iterator
Returns:
IndigoObject: decompositions iterator | Deconvolution element method returns decompositions iterator | [
"Deconvolution",
"element",
"method",
"returns",
"decompositions",
"iterator"
] | def iterateDecompositions(self):
"""Deconvolution element method returns decompositions iterator
Returns:
IndigoObject: decompositions iterator
"""
self.dispatcher._setSessionId()
return self.dispatcher.IndigoObject(
self.dispatcher,
self.disp... | [
"def",
"iterateDecompositions",
"(",
"self",
")",
":",
"self",
".",
"dispatcher",
".",
"_setSessionId",
"(",
")",
"return",
"self",
".",
"dispatcher",
".",
"IndigoObject",
"(",
"self",
".",
"dispatcher",
",",
"self",
".",
"dispatcher",
".",
"_checkResult",
"... | https://github.com/epam/Indigo/blob/30e40b4b1eb9bae0207435a26cfcb81ddcc42be1/api/python/indigo/__init__.py#L4068-L4080 | |
metashell/metashell | f4177e4854ea00c8dbc722cadab26ef413d798ea | 3rd/templight/clang/docs/tools/dump_ast_matchers.py | python | strip_doxygen | (comment) | return comment | Returns the given comment without \-escaped words. | Returns the given comment without \-escaped words. | [
"Returns",
"the",
"given",
"comment",
"without",
"\\",
"-",
"escaped",
"words",
"."
] | def strip_doxygen(comment):
"""Returns the given comment without \-escaped words."""
# If there is only a doxygen keyword in the line, delete the whole line.
comment = re.sub(r'^\\[^\s]+\n', r'', comment, flags=re.M)
# If there is a doxygen \see command, change the \see prefix into "See also:".
# FIXME: it... | [
"def",
"strip_doxygen",
"(",
"comment",
")",
":",
"# If there is only a doxygen keyword in the line, delete the whole line.",
"comment",
"=",
"re",
".",
"sub",
"(",
"r'^\\\\[^\\s]+\\n'",
",",
"r''",
",",
"comment",
",",
"flags",
"=",
"re",
".",
"M",
")",
"# If there... | https://github.com/metashell/metashell/blob/f4177e4854ea00c8dbc722cadab26ef413d798ea/3rd/templight/clang/docs/tools/dump_ast_matchers.py#L85-L96 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py | python | _Log10Memoize.getdigits | (self, p) | return int(self.digits[:p+1]) | Given an integer p >= 0, return floor(10**p)*log(10).
For example, self.getdigits(3) returns 2302. | Given an integer p >= 0, return floor(10**p)*log(10). | [
"Given",
"an",
"integer",
"p",
">",
"=",
"0",
"return",
"floor",
"(",
"10",
"**",
"p",
")",
"*",
"log",
"(",
"10",
")",
"."
] | def getdigits(self, p):
"""Given an integer p >= 0, return floor(10**p)*log(10).
For example, self.getdigits(3) returns 2302.
"""
# digits are stored as a string, for quick conversion to
# integer in the case that we've already computed enough
# digits; the stored digits... | [
"def",
"getdigits",
"(",
"self",
",",
"p",
")",
":",
"# digits are stored as a string, for quick conversion to",
"# integer in the case that we've already computed enough",
"# digits; the stored digits should always be correct",
"# (truncated, not rounded to nearest).",
"if",
"p",
"<",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py#L5859-L5885 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.