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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/Task.py | python | set_file_constraints | (tasks) | Adds tasks to the task 'run_after' attribute based on the task inputs and outputs
:param tasks: tasks
:type tasks: list of :py:class:`waflib.Task.TaskBase` | Adds tasks to the task 'run_after' attribute based on the task inputs and outputs | [
"Adds",
"tasks",
"to",
"the",
"task",
"run_after",
"attribute",
"based",
"on",
"the",
"task",
"inputs",
"and",
"outputs"
] | def set_file_constraints(tasks):
"""
Adds tasks to the task 'run_after' attribute based on the task inputs and outputs
:param tasks: tasks
:type tasks: list of :py:class:`waflib.Task.TaskBase`
"""
ins = Utils.defaultdict(set)
outs = Utils.defaultdict(set)
for x in tasks:
for a in getattr(x, 'inputs', []) + g... | [
"def",
"set_file_constraints",
"(",
"tasks",
")",
":",
"ins",
"=",
"Utils",
".",
"defaultdict",
"(",
"set",
")",
"outs",
"=",
"Utils",
".",
"defaultdict",
"(",
"set",
")",
"for",
"x",
"in",
"tasks",
":",
"for",
"a",
"in",
"getattr",
"(",
"x",
",",
... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Task.py#L951-L969 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/random.py | python | Random.gammavariate | (self, alpha, beta) | Gamma distribution. Not the gamma function!
Conditions on the parameters are alpha > 0 and beta > 0.
The probability distribution function is:
x ** (alpha - 1) * math.exp(-x / beta)
pdf(x) = --------------------------------------
math.gamma(alpha)... | Gamma distribution. Not the gamma function! | [
"Gamma",
"distribution",
".",
"Not",
"the",
"gamma",
"function!"
] | def gammavariate(self, alpha, beta):
"""Gamma distribution. Not the gamma function!
Conditions on the parameters are alpha > 0 and beta > 0.
The probability distribution function is:
x ** (alpha - 1) * math.exp(-x / beta)
pdf(x) = ------------------------------... | [
"def",
"gammavariate",
"(",
"self",
",",
"alpha",
",",
"beta",
")",
":",
"# alpha > 0, beta > 0, mean is alpha*beta, variance is alpha*beta**2",
"# Warning: a few older sources define the gamma distribution in terms",
"# of alpha > -1.0",
"if",
"alpha",
"<=",
"0.0",
"or",
"beta",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/random.py#L504-L572 | ||
mingchen/protobuf-ios | 0958df34558cd54cb7b6e6ca5c8855bf3d475046 | compiler/python/mox.py | python | MockMethod.AndReturn | (self, return_value) | return return_value | Set the value to return when this method is called.
Args:
# return_value can be anything. | Set the value to return when this method is called. | [
"Set",
"the",
"value",
"to",
"return",
"when",
"this",
"method",
"is",
"called",
"."
] | def AndReturn(self, return_value):
"""Set the value to return when this method is called.
Args:
# return_value can be anything.
"""
self._return_value = return_value
return return_value | [
"def",
"AndReturn",
"(",
"self",
",",
"return_value",
")",
":",
"self",
".",
"_return_value",
"=",
"return_value",
"return",
"return_value"
] | https://github.com/mingchen/protobuf-ios/blob/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/python/mox.py#L718-L726 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/customtreectrl.py | python | CustomTreeCtrl.CheckSameLevel | (self, item, checked=False) | Uncheck radio items which are on the same level of the checked one.
Used internally.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `checked`: ``True`` to check an item, ``False`` to uncheck it.
:note: This method is meaningful only for radiobutton-like items. | Uncheck radio items which are on the same level of the checked one.
Used internally. | [
"Uncheck",
"radio",
"items",
"which",
"are",
"on",
"the",
"same",
"level",
"of",
"the",
"checked",
"one",
".",
"Used",
"internally",
"."
] | def CheckSameLevel(self, item, checked=False):
"""
Uncheck radio items which are on the same level of the checked one.
Used internally.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `checked`: ``True`` to check an item, ``False`` to uncheck it.
:no... | [
"def",
"CheckSameLevel",
"(",
"self",
",",
"item",
",",
"checked",
"=",
"False",
")",
":",
"parent",
"=",
"item",
".",
"GetParent",
"(",
")",
"if",
"not",
"parent",
":",
"return",
"torefresh",
"=",
"False",
"if",
"parent",
".",
"IsExpanded",
"(",
")",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/customtreectrl.py#L3361-L3387 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TBPGraph.GetRndLNId | (self, *args) | return _snap.TBPGraph_GetRndLNId(self, *args) | GetRndLNId(TBPGraph self, TRnd Rnd=Rnd) -> int
Parameters:
Rnd: TRnd &
GetRndLNId(TBPGraph self) -> int
Parameters:
self: TBPGraph * | GetRndLNId(TBPGraph self, TRnd Rnd=Rnd) -> int | [
"GetRndLNId",
"(",
"TBPGraph",
"self",
"TRnd",
"Rnd",
"=",
"Rnd",
")",
"-",
">",
"int"
] | def GetRndLNId(self, *args):
"""
GetRndLNId(TBPGraph self, TRnd Rnd=Rnd) -> int
Parameters:
Rnd: TRnd &
GetRndLNId(TBPGraph self) -> int
Parameters:
self: TBPGraph *
"""
return _snap.TBPGraph_GetRndLNId(self, *args) | [
"def",
"GetRndLNId",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TBPGraph_GetRndLNId",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L5165-L5178 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/connection.py | python | EC2Connection.get_all_instance_status | (self, instance_ids=None,
max_results=None, next_token=None,
filters=None, dry_run=False,
include_all_instances=False) | return self.get_object('DescribeInstanceStatus', params,
InstanceStatusSet, verb='POST') | Retrieve all the instances in your account scheduled for maintenance.
:type instance_ids: list
:param instance_ids: A list of strings of instance IDs
:type max_results: int
:param max_results: The maximum number of paginated instance
items per response.
:type next_... | Retrieve all the instances in your account scheduled for maintenance. | [
"Retrieve",
"all",
"the",
"instances",
"in",
"your",
"account",
"scheduled",
"for",
"maintenance",
"."
] | def get_all_instance_status(self, instance_ids=None,
max_results=None, next_token=None,
filters=None, dry_run=False,
include_all_instances=False):
"""
Retrieve all the instances in your account scheduled for ... | [
"def",
"get_all_instance_status",
"(",
"self",
",",
"instance_ids",
"=",
"None",
",",
"max_results",
"=",
"None",
",",
"next_token",
"=",
"None",
",",
"filters",
"=",
"None",
",",
"dry_run",
"=",
"False",
",",
"include_all_instances",
"=",
"False",
")",
":",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/connection.py#L683-L736 | |
PyMesh/PyMesh | 384ba882b7558ba6e8653ed263c419226c22bddf | python/pymesh/meshutils/generate_box_mesh.py | python | generate_box_mesh | (box_min, box_max,
num_samples=1, keep_symmetry=False, subdiv_order=0, using_simplex=True) | return mesh | Generate axis-aligned box mesh.
Each box is made of a number of cells (a square in 2D and cube in 3D), and
each cell is made of triangles (2D) or tetrahedra (3D).
Args:
box_min (``numpy.ndarray``): min corner of the box.
box_max (``numpy.ndarray``): max corner of the box.
num_sampl... | Generate axis-aligned box mesh. | [
"Generate",
"axis",
"-",
"aligned",
"box",
"mesh",
"."
] | def generate_box_mesh(box_min, box_max,
num_samples=1, keep_symmetry=False, subdiv_order=0, using_simplex=True):
""" Generate axis-aligned box mesh.
Each box is made of a number of cells (a square in 2D and cube in 3D), and
each cell is made of triangles (2D) or tetrahedra (3D).
Args:
... | [
"def",
"generate_box_mesh",
"(",
"box_min",
",",
"box_max",
",",
"num_samples",
"=",
"1",
",",
"keep_symmetry",
"=",
"False",
",",
"subdiv_order",
"=",
"0",
",",
"using_simplex",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"box_min",
",",
"np",
... | https://github.com/PyMesh/PyMesh/blob/384ba882b7558ba6e8653ed263c419226c22bddf/python/pymesh/meshutils/generate_box_mesh.py#L10-L49 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/framework/ops.py | python | RegisterStatistics.__init__ | (self, op_type, statistic_type) | Saves the `op_type` as the `Operation` type. | Saves the `op_type` as the `Operation` type. | [
"Saves",
"the",
"op_type",
"as",
"the",
"Operation",
"type",
"."
] | def __init__(self, op_type, statistic_type):
"""Saves the `op_type` as the `Operation` type."""
if not isinstance(op_type, six.string_types):
raise TypeError("op_type must be a string.")
if "," in op_type:
raise TypeError("op_type must not contain a comma.")
self._op_type = op_type
if no... | [
"def",
"__init__",
"(",
"self",
",",
"op_type",
",",
"statistic_type",
")",
":",
"if",
"not",
"isinstance",
"(",
"op_type",
",",
"six",
".",
"string_types",
")",
":",
"raise",
"TypeError",
"(",
"\"op_type must be a string.\"",
")",
"if",
"\",\"",
"in",
"op_t... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/framework/ops.py#L2026-L2037 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/util/process_statistic_timeline_data.py | python | ProcessStatisticTimelineData.__sub__ | (self, other) | return ret | The results of subtraction is an object holding only the pids contained
in |self|.
The motivation is that some processes may have died between two consecutive
measurements. The desired behavior is to only make calculations based on
the processes that are alive at the end of the second measurement. | The results of subtraction is an object holding only the pids contained
in |self|. | [
"The",
"results",
"of",
"subtraction",
"is",
"an",
"object",
"holding",
"only",
"the",
"pids",
"contained",
"in",
"|self|",
"."
] | def __sub__(self, other):
"""The results of subtraction is an object holding only the pids contained
in |self|.
The motivation is that some processes may have died between two consecutive
measurements. The desired behavior is to only make calculations based on
the processes that are alive at the en... | [
"def",
"__sub__",
"(",
"self",
",",
"other",
")",
":",
"# pylint: disable=protected-access",
"ret",
"=",
"self",
".",
"__class__",
"(",
"0",
",",
"0",
")",
"my_dict",
"=",
"self",
".",
"_value_by_pid",
"ret",
".",
"_value_by_pid",
"=",
"(",
"{",
"k",
":"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/util/process_statistic_timeline_data.py#L17-L31 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/protorpc/demos/quotas/backend/quotas/services.py | python | QuotaState.abort_transaction | (self) | Roll back transaction ignoring quota changes. | Roll back transaction ignoring quota changes. | [
"Roll",
"back",
"transaction",
"ignoring",
"quota",
"changes",
"."
] | def abort_transaction(self):
"""Roll back transaction ignoring quota changes."""
assert self.in_transaction()
self.__transaction.changes = None
self.__lock.release() | [
"def",
"abort_transaction",
"(",
"self",
")",
":",
"assert",
"self",
".",
"in_transaction",
"(",
")",
"self",
".",
"__transaction",
".",
"changes",
"=",
"None",
"self",
".",
"__lock",
".",
"release",
"(",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/protorpc/demos/quotas/backend/quotas/services.py#L264-L268 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | PseudoDC.DrawPolygon | (*args, **kwargs) | return _gdi_.PseudoDC_DrawPolygon(*args, **kwargs) | DrawPolygon(self, List points, int xoffset=0, int yoffset=0,
wxPolygonFillMode fillStyle=ODDEVEN_RULE)
Draws a filled polygon using a sequence of `wx.Point` objects, adding
the optional offset coordinate. The last argument specifies the fill
rule: ``wx.ODDEVEN_RULE`` (the default) ... | DrawPolygon(self, List points, int xoffset=0, int yoffset=0,
wxPolygonFillMode fillStyle=ODDEVEN_RULE) | [
"DrawPolygon",
"(",
"self",
"List",
"points",
"int",
"xoffset",
"=",
"0",
"int",
"yoffset",
"=",
"0",
"wxPolygonFillMode",
"fillStyle",
"=",
"ODDEVEN_RULE",
")"
] | def DrawPolygon(*args, **kwargs):
"""
DrawPolygon(self, List points, int xoffset=0, int yoffset=0,
wxPolygonFillMode fillStyle=ODDEVEN_RULE)
Draws a filled polygon using a sequence of `wx.Point` objects, adding
the optional offset coordinate. The last argument specifies the... | [
"def",
"DrawPolygon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"PseudoDC_DrawPolygon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L8322-L8336 | |
deepmodeling/deepmd-kit | 159e45d248b0429844fb6a8cb3b3a201987c8d79 | deepmd/entrypoints/train.py | python | _do_work | (jdata: Dict[str, Any], run_opt: RunOptions, is_compress: bool = False) | Run serial model training.
Parameters
----------
jdata : Dict[str, Any]
arguments read form json/yaml control file
run_opt : RunOptions
object with run configuration
is_compress : Bool
indicates whether in model compress mode
Raises
------
RuntimeError
I... | Run serial model training. | [
"Run",
"serial",
"model",
"training",
"."
] | def _do_work(jdata: Dict[str, Any], run_opt: RunOptions, is_compress: bool = False):
"""Run serial model training.
Parameters
----------
jdata : Dict[str, Any]
arguments read form json/yaml control file
run_opt : RunOptions
object with run configuration
is_compress : Bool
... | [
"def",
"_do_work",
"(",
"jdata",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
",",
"run_opt",
":",
"RunOptions",
",",
"is_compress",
":",
"bool",
"=",
"False",
")",
":",
"# make necessary checks",
"assert",
"\"training\"",
"in",
"jdata",
"# init the model",
"mo... | https://github.com/deepmodeling/deepmd-kit/blob/159e45d248b0429844fb6a8cb3b3a201987c8d79/deepmd/entrypoints/train.py#L106-L170 | ||
vmware/concord-bft | ec036a384b4c81be0423d4b429bd37900b13b864 | util/pyclient/bft_metrics_client.py | python | MetricsClient._req | (self) | return req | Return a get request to the metrics server | Return a get request to the metrics server | [
"Return",
"a",
"get",
"request",
"to",
"the",
"metrics",
"server"
] | def _req(self):
"""Return a get request to the metrics server"""
self.seq_num += 1
req = struct.pack(HEADER_FMT, REQUEST_TYPE, self.seq_num)
return req | [
"def",
"_req",
"(",
"self",
")",
":",
"self",
".",
"seq_num",
"+=",
"1",
"req",
"=",
"struct",
".",
"pack",
"(",
"HEADER_FMT",
",",
"REQUEST_TYPE",
",",
"self",
".",
"seq_num",
")",
"return",
"req"
] | https://github.com/vmware/concord-bft/blob/ec036a384b4c81be0423d4b429bd37900b13b864/util/pyclient/bft_metrics_client.py#L43-L47 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/ragged/ragged_tensor_shape.py | python | RaggedTensorDynamicShape._broadcast_inner_dimension_to_uniform | (self, axis, length) | return RaggedTensorDynamicShape(partitioned_sizes, inner_sizes) | Broadcasts the inner dimension `axis` to match `lengths`. | Broadcasts the inner dimension `axis` to match `lengths`. | [
"Broadcasts",
"the",
"inner",
"dimension",
"axis",
"to",
"match",
"lengths",
"."
] | def _broadcast_inner_dimension_to_uniform(self, axis, length):
"""Broadcasts the inner dimension `axis` to match `lengths`."""
dim_size = self.dimension_size(axis)
axis_in_inner_dims = axis - self.num_partitioned_dimensions
partitioned_sizes = self._partitioned_dim_sizes
inner_sizes = array_ops.conc... | [
"def",
"_broadcast_inner_dimension_to_uniform",
"(",
"self",
",",
"axis",
",",
"length",
")",
":",
"dim_size",
"=",
"self",
".",
"dimension_size",
"(",
"axis",
")",
"axis_in_inner_dims",
"=",
"axis",
"-",
"self",
".",
"num_partitioned_dimensions",
"partitioned_sizes... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/ragged/ragged_tensor_shape.py#L412-L423 | |
CGRU/cgru | 1881a4128530e3d31ac6c25314c18314fc50c2c7 | afanasy/python/af.py | python | checkRegExp | (pattern) | return result | Missing DocString
:param pattern:
:return: | Missing DocString | [
"Missing",
"DocString"
] | def checkRegExp(pattern):
"""Missing DocString
:param pattern:
:return:
"""
if len(pattern) == 0:
return False
result = True
try:
re.compile(pattern)
except re.error:
print('Error: Invalid regular expression pattern "%s"' % pattern)
print(str(sys.exc_inf... | [
"def",
"checkRegExp",
"(",
"pattern",
")",
":",
"if",
"len",
"(",
"pattern",
")",
"==",
"0",
":",
"return",
"False",
"result",
"=",
"True",
"try",
":",
"re",
".",
"compile",
"(",
"pattern",
")",
"except",
"re",
".",
"error",
":",
"print",
"(",
"'Er... | https://github.com/CGRU/cgru/blob/1881a4128530e3d31ac6c25314c18314fc50c2c7/afanasy/python/af.py#L19-L35 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/series.py | python | Series.axes | (self) | return [self.index] | Return a list of the row axis labels. | Return a list of the row axis labels. | [
"Return",
"a",
"list",
"of",
"the",
"row",
"axis",
"labels",
"."
] | def axes(self):
"""
Return a list of the row axis labels.
"""
return [self.index] | [
"def",
"axes",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"index",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/series.py#L797-L801 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/_pslinux.py | python | boot_time | () | Return the system boot time expressed in seconds since the epoch. | Return the system boot time expressed in seconds since the epoch. | [
"Return",
"the",
"system",
"boot",
"time",
"expressed",
"in",
"seconds",
"since",
"the",
"epoch",
"."
] | def boot_time():
"""Return the system boot time expressed in seconds since the epoch."""
global BOOT_TIME
f = open('/proc/stat', 'rb')
try:
BTIME = b('btime')
for line in f:
if line.startswith(BTIME):
ret = float(line.strip().split()[1])
BOOT_T... | [
"def",
"boot_time",
"(",
")",
":",
"global",
"BOOT_TIME",
"f",
"=",
"open",
"(",
"'/proc/stat'",
",",
"'rb'",
")",
"try",
":",
"BTIME",
"=",
"b",
"(",
"'btime'",
")",
"for",
"line",
"in",
"f",
":",
"if",
"line",
".",
"startswith",
"(",
"BTIME",
")"... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/_pslinux.py#L332-L345 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/data_flow_ops.py | python | BaseStagingArea.dtypes | (self) | return self._dtypes | The list of dtypes for each component of a staging area element. | The list of dtypes for each component of a staging area element. | [
"The",
"list",
"of",
"dtypes",
"for",
"each",
"component",
"of",
"a",
"staging",
"area",
"element",
"."
] | def dtypes(self):
"""The list of dtypes for each component of a staging area element."""
return self._dtypes | [
"def",
"dtypes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_dtypes"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/data_flow_ops.py#L1438-L1440 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py | python | fix_help_options | (options) | return new_options | Convert a 4-tuple 'help_options' list as found in various command
classes to the 3-tuple form required by FancyGetopt. | Convert a 4-tuple 'help_options' list as found in various command
classes to the 3-tuple form required by FancyGetopt. | [
"Convert",
"a",
"4",
"-",
"tuple",
"help_options",
"list",
"as",
"found",
"in",
"various",
"command",
"classes",
"to",
"the",
"3",
"-",
"tuple",
"form",
"required",
"by",
"FancyGetopt",
"."
] | def fix_help_options(options):
"""Convert a 4-tuple 'help_options' list as found in various command
classes to the 3-tuple form required by FancyGetopt.
"""
new_options = []
for help_tuple in options:
new_options.append(help_tuple[0:3])
return new_options | [
"def",
"fix_help_options",
"(",
"options",
")",
":",
"new_options",
"=",
"[",
"]",
"for",
"help_tuple",
"in",
"options",
":",
"new_options",
".",
"append",
"(",
"help_tuple",
"[",
"0",
":",
"3",
"]",
")",
"return",
"new_options"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py#L1249-L1256 | |
weichengkuo/DeepBox | c4f8c065b6a51cf296540cc453a44f0519aaacc9 | src/datasets/coco_imdb.py | python | coco_imdb.proposals_roidb | (self) | return roidb | Return the database of Edge box regions of interest.
Ground-truth ROIs are also included.
This function loads/saves from/to a cache file to speed up future calls. | Return the database of Edge box regions of interest.
Ground-truth ROIs are also included. | [
"Return",
"the",
"database",
"of",
"Edge",
"box",
"regions",
"of",
"interest",
".",
"Ground",
"-",
"truth",
"ROIs",
"are",
"also",
"included",
"."
] | def proposals_roidb(self):
"""
Return the database of Edge box regions of interest.
Ground-truth ROIs are also included.
This function loads/saves from/to a cache file to speed up future calls.
"""
cache_file = os.path.join(self.cache_path,self.name + '_'+self._obj_prop... | [
"def",
"proposals_roidb",
"(",
"self",
")",
":",
"cache_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"cache_path",
",",
"self",
".",
"name",
"+",
"'_'",
"+",
"self",
".",
"_obj_proposer",
"+",
"'_roidb.pkl'",
")",
"if",
"os",
".",
"p... | https://github.com/weichengkuo/DeepBox/blob/c4f8c065b6a51cf296540cc453a44f0519aaacc9/src/datasets/coco_imdb.py#L122-L147 | |
ZhouWeikuan/DouDiZhu | 0d84ff6c0bc54dba6ae37955de9ae9307513dc99 | code/frameworks/cocos2d-x/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py | python | Type.get_result | (self) | return conf.lib.clang_getResultType(self) | Retrieve the result type associated with a function type. | Retrieve the result type associated with a function type. | [
"Retrieve",
"the",
"result",
"type",
"associated",
"with",
"a",
"function",
"type",
"."
] | def get_result(self):
"""
Retrieve the result type associated with a function type.
"""
return conf.lib.clang_getResultType(self) | [
"def",
"get_result",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getResultType",
"(",
"self",
")"
] | https://github.com/ZhouWeikuan/DouDiZhu/blob/0d84ff6c0bc54dba6ae37955de9ae9307513dc99/code/frameworks/cocos2d-x/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py#L1610-L1614 | |
GoSSIP-SJTU/Armariris | ad5d868482956b2194a77b39c8d543c7c2318200 | bindings/python/llvm/object.py | python | Section.size | (self) | return lib.LLVMGetSectionSize(self) | The size of the section, in long bytes. | The size of the section, in long bytes. | [
"The",
"size",
"of",
"the",
"section",
"in",
"long",
"bytes",
"."
] | def size(self):
"""The size of the section, in long bytes."""
if self.expired:
raise Exception('Section instance has expired.')
return lib.LLVMGetSectionSize(self) | [
"def",
"size",
"(",
"self",
")",
":",
"if",
"self",
".",
"expired",
":",
"raise",
"Exception",
"(",
"'Section instance has expired.'",
")",
"return",
"lib",
".",
"LLVMGetSectionSize",
"(",
"self",
")"
] | https://github.com/GoSSIP-SJTU/Armariris/blob/ad5d868482956b2194a77b39c8d543c7c2318200/bindings/python/llvm/object.py#L205-L210 | |
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/v8/third_party/jinja2/filters.py | python | do_upper | (s) | return soft_unicode(s).upper() | Convert a value to uppercase. | Convert a value to uppercase. | [
"Convert",
"a",
"value",
"to",
"uppercase",
"."
] | def do_upper(s):
"""Convert a value to uppercase."""
return soft_unicode(s).upper() | [
"def",
"do_upper",
"(",
"s",
")",
":",
"return",
"soft_unicode",
"(",
"s",
")",
".",
"upper",
"(",
")"
] | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/v8/third_party/jinja2/filters.py#L129-L131 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/utils/cli_parser.py | python | get_tf_cli_parser | (parser: argparse.ArgumentParser = None) | return parser | Specifies cli arguments for Model Optimizer for TF
Returns
-------
ArgumentParser instance | Specifies cli arguments for Model Optimizer for TF | [
"Specifies",
"cli",
"arguments",
"for",
"Model",
"Optimizer",
"for",
"TF"
] | def get_tf_cli_parser(parser: argparse.ArgumentParser = None):
"""
Specifies cli arguments for Model Optimizer for TF
Returns
-------
ArgumentParser instance
"""
if not parser:
parser = argparse.ArgumentParser(usage='%(prog)s [options]')
get_common_cli_parser(parser=pars... | [
"def",
"get_tf_cli_parser",
"(",
"parser",
":",
"argparse",
".",
"ArgumentParser",
"=",
"None",
")",
":",
"if",
"not",
"parser",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"usage",
"=",
"'%(prog)s [options]'",
")",
"get_common_cli_parser",
"(",
... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/utils/cli_parser.py#L604-L659 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/datetime.py | python | date.strftime | (self, fmt) | return _wrap_strftime(self, fmt, self.timetuple()) | Format using strftime(). | Format using strftime(). | [
"Format",
"using",
"strftime",
"()",
"."
] | def strftime(self, fmt):
"Format using strftime()."
return _wrap_strftime(self, fmt, self.timetuple()) | [
"def",
"strftime",
"(",
"self",
",",
"fmt",
")",
":",
"return",
"_wrap_strftime",
"(",
"self",
",",
"fmt",
",",
"self",
".",
"timetuple",
"(",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/datetime.py#L905-L907 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/urllib3/filepost.py | python | choose_boundary | () | return boundary | Our embarrassingly-simple replacement for mimetools.choose_boundary. | Our embarrassingly-simple replacement for mimetools.choose_boundary. | [
"Our",
"embarrassingly",
"-",
"simple",
"replacement",
"for",
"mimetools",
".",
"choose_boundary",
"."
] | def choose_boundary():
"""
Our embarrassingly-simple replacement for mimetools.choose_boundary.
"""
boundary = binascii.hexlify(os.urandom(16))
if not six.PY2:
boundary = boundary.decode("ascii")
return boundary | [
"def",
"choose_boundary",
"(",
")",
":",
"boundary",
"=",
"binascii",
".",
"hexlify",
"(",
"os",
".",
"urandom",
"(",
"16",
")",
")",
"if",
"not",
"six",
".",
"PY2",
":",
"boundary",
"=",
"boundary",
".",
"decode",
"(",
"\"ascii\"",
")",
"return",
"b... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/urllib3/filepost.py#L15-L22 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/cephadm/module.py | python | CephadmOrchestrator.config_notify | (self) | This method is called whenever one of our config options is changed.
TODO: this method should be moved into mgr_module.py | This method is called whenever one of our config options is changed. | [
"This",
"method",
"is",
"called",
"whenever",
"one",
"of",
"our",
"config",
"options",
"is",
"changed",
"."
] | def config_notify(self) -> None:
"""
This method is called whenever one of our config options is changed.
TODO: this method should be moved into mgr_module.py
"""
for opt in self.MODULE_OPTIONS:
setattr(self,
opt['name'], # type: ignore
... | [
"def",
"config_notify",
"(",
"self",
")",
"->",
"None",
":",
"for",
"opt",
"in",
"self",
".",
"MODULE_OPTIONS",
":",
"setattr",
"(",
"self",
",",
"opt",
"[",
"'name'",
"]",
",",
"# type: ignore",
"self",
".",
"get_module_option",
"(",
"opt",
"[",
"'name'... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/cephadm/module.py#L579-L597 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/python_gflags/gflags.py | python | DEFINE_multistring | (name, default, help, flag_values=FLAGS, **args) | Registers a flag whose value can be a list of any strings.
Use the flag on the command line multiple times to place multiple
string values into the list. The 'default' may be a single string
(which will be converted into a single-element list) or a list of
strings. | Registers a flag whose value can be a list of any strings. | [
"Registers",
"a",
"flag",
"whose",
"value",
"can",
"be",
"a",
"list",
"of",
"any",
"strings",
"."
] | def DEFINE_multistring(name, default, help, flag_values=FLAGS, **args):
"""Registers a flag whose value can be a list of any strings.
Use the flag on the command line multiple times to place multiple
string values into the list. The 'default' may be a single string
(which will be converted into a single-eleme... | [
"def",
"DEFINE_multistring",
"(",
"name",
",",
"default",
",",
"help",
",",
"flag_values",
"=",
"FLAGS",
",",
"*",
"*",
"args",
")",
":",
"parser",
"=",
"ArgumentParser",
"(",
")",
"serializer",
"=",
"ArgumentSerializer",
"(",
")",
"DEFINE_multi",
"(",
"pa... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/python_gflags/gflags.py#L2799-L2809 | ||
openmm/openmm | cb293447c4fc8b03976dfe11399f107bab70f3d9 | wrappers/python/openmm/app/topology.py | python | Topology.setPeriodicBoxVectors | (self, vectors) | Set the vectors defining the periodic box. | Set the vectors defining the periodic box. | [
"Set",
"the",
"vectors",
"defining",
"the",
"periodic",
"box",
"."
] | def setPeriodicBoxVectors(self, vectors):
"""Set the vectors defining the periodic box."""
if vectors is not None:
if not is_quantity(vectors[0][0]):
vectors = vectors*nanometers
if vectors[0][1] != 0*nanometers or vectors[0][2] != 0*nanometers:
ra... | [
"def",
"setPeriodicBoxVectors",
"(",
"self",
",",
"vectors",
")",
":",
"if",
"vectors",
"is",
"not",
"None",
":",
"if",
"not",
"is_quantity",
"(",
"vectors",
"[",
"0",
"]",
"[",
"0",
"]",
")",
":",
"vectors",
"=",
"vectors",
"*",
"nanometers",
"if",
... | https://github.com/openmm/openmm/blob/cb293447c4fc8b03976dfe11399f107bab70f3d9/wrappers/python/openmm/app/topology.py#L242-L253 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/tpu/tpu_embedding.py | python | TPUEmbedding.num_cores_per_host | (self) | return self._num_cores_per_host | Number of TPU cores on a CPU host.
Returns:
Number of TPU cores on a CPU host. | Number of TPU cores on a CPU host. | [
"Number",
"of",
"TPU",
"cores",
"on",
"a",
"CPU",
"host",
"."
] | def num_cores_per_host(self):
"""Number of TPU cores on a CPU host.
Returns:
Number of TPU cores on a CPU host.
"""
return self._num_cores_per_host | [
"def",
"num_cores_per_host",
"(",
"self",
")",
":",
"return",
"self",
".",
"_num_cores_per_host"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/tpu/tpu_embedding.py#L1480-L1486 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | DPGAnalysis/HcalTools/scripts/cmt/das_client.py | python | prim_value | (row) | Extract primary key value from DAS record | Extract primary key value from DAS record | [
"Extract",
"primary",
"key",
"value",
"from",
"DAS",
"record"
] | def prim_value(row):
"""Extract primary key value from DAS record"""
prim_key = row['das']['primary_key']
if prim_key == 'summary':
return row.get(prim_key, None)
key, att = prim_key.split('.')
if isinstance(row[key], list):
for item in row[key]:
if att in item:
... | [
"def",
"prim_value",
"(",
"row",
")",
":",
"prim_key",
"=",
"row",
"[",
"'das'",
"]",
"[",
"'primary_key'",
"]",
"if",
"prim_key",
"==",
"'summary'",
":",
"return",
"row",
".",
"get",
"(",
"prim_key",
",",
"None",
")",
"key",
",",
"att",
"=",
"prim_k... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/DPGAnalysis/HcalTools/scripts/cmt/das_client.py#L350-L363 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/ao/quantization/quantize.py | python | _convert | (
module, mapping=None, inplace=False,
convert_custom_config_dict=None) | return module | r"""Converts submodules in input module to a different module according to `mapping`
by calling `from_float` method on the target module class
Args:
module: input module
mapping: a dictionary that maps from source module type to target
module type, can be overwritten to allow s... | r"""Converts submodules in input module to a different module according to `mapping`
by calling `from_float` method on the target module class | [
"r",
"Converts",
"submodules",
"in",
"input",
"module",
"to",
"a",
"different",
"module",
"according",
"to",
"mapping",
"by",
"calling",
"from_float",
"method",
"on",
"the",
"target",
"module",
"class"
] | def _convert(
module, mapping=None, inplace=False,
convert_custom_config_dict=None):
r"""Converts submodules in input module to a different module according to `mapping`
by calling `from_float` method on the target module class
Args:
module: input module
mapping: a dictionar... | [
"def",
"_convert",
"(",
"module",
",",
"mapping",
"=",
"None",
",",
"inplace",
"=",
"False",
",",
"convert_custom_config_dict",
"=",
"None",
")",
":",
"if",
"mapping",
"is",
"None",
":",
"mapping",
"=",
"get_default_static_quant_module_mappings",
"(",
")",
"if... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/ao/quantization/quantize.py#L512-L548 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | ToolBarBase.GetToolByPos | (*args, **kwargs) | return _controls_.ToolBarBase_GetToolByPos(*args, **kwargs) | GetToolByPos(self, int pos) -> ToolBarToolBase | GetToolByPos(self, int pos) -> ToolBarToolBase | [
"GetToolByPos",
"(",
"self",
"int",
"pos",
")",
"-",
">",
"ToolBarToolBase"
] | def GetToolByPos(*args, **kwargs):
"""GetToolByPos(self, int pos) -> ToolBarToolBase"""
return _controls_.ToolBarBase_GetToolByPos(*args, **kwargs) | [
"def",
"GetToolByPos",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ToolBarBase_GetToolByPos",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L3923-L3925 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | tools/code_coverage/coverage_posix.py | python | Coverage.AfterRunOneTest | (self, testname) | Do things right after running each test. | Do things right after running each test. | [
"Do",
"things",
"right",
"after",
"running",
"each",
"test",
"."
] | def AfterRunOneTest(self, testname):
"""Do things right after running each test."""
if not self.IsWindows():
return
# Stop counters
cmdlist = [self.perf, '-shutdown']
self.Run(cmdlist)
full_output = self.vsts_output + '.coverage'
shutil.move(full_output, self.vsts_output)
# generat... | [
"def",
"AfterRunOneTest",
"(",
"self",
",",
"testname",
")",
":",
"if",
"not",
"self",
".",
"IsWindows",
"(",
")",
":",
"return",
"# Stop counters",
"cmdlist",
"=",
"[",
"self",
".",
"perf",
",",
"'-shutdown'",
"]",
"self",
".",
"Run",
"(",
"cmdlist",
... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/tools/code_coverage/coverage_posix.py#L717-L727 | ||
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/pyserial/serial/serialposix.py | python | Serial.write | (self, data) | return length - len(d) | Output the given byte string over the serial port. | Output the given byte string over the serial port. | [
"Output",
"the",
"given",
"byte",
"string",
"over",
"the",
"serial",
"port",
"."
] | def write(self, data):
"""Output the given byte string over the serial port."""
if not self.is_open:
raise portNotOpenError
d = to_bytes(data)
tx_len = length = len(d)
timeout = Timeout(self._write_timeout)
while tx_len > 0:
try:
n ... | [
"def",
"write",
"(",
"self",
",",
"data",
")",
":",
"if",
"not",
"self",
".",
"is_open",
":",
"raise",
"portNotOpenError",
"d",
"=",
"to_bytes",
"(",
"data",
")",
"tx_len",
"=",
"length",
"=",
"len",
"(",
"d",
")",
"timeout",
"=",
"Timeout",
"(",
"... | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/pyserial/serial/serialposix.py#L528-L580 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/gyp/pylib/gyp/msvs_emulation.py | python | GetGlobalVSMacroEnv | (vs_version) | return env | Get a dict of variables mapping internal VS macro names to their gyp
equivalents. Returns all variables that are independent of the target. | Get a dict of variables mapping internal VS macro names to their gyp
equivalents. Returns all variables that are independent of the target. | [
"Get",
"a",
"dict",
"of",
"variables",
"mapping",
"internal",
"VS",
"macro",
"names",
"to",
"their",
"gyp",
"equivalents",
".",
"Returns",
"all",
"variables",
"that",
"are",
"independent",
"of",
"the",
"target",
"."
] | def GetGlobalVSMacroEnv(vs_version):
"""Get a dict of variables mapping internal VS macro names to their gyp
equivalents. Returns all variables that are independent of the target."""
env = {}
# '$(VSInstallDir)' and '$(VCInstallDir)' are available when and only when
# Visual Studio is actually installed.
if... | [
"def",
"GetGlobalVSMacroEnv",
"(",
"vs_version",
")",
":",
"env",
"=",
"{",
"}",
"# '$(VSInstallDir)' and '$(VCInstallDir)' are available when and only when",
"# Visual Studio is actually installed.",
"if",
"vs_version",
".",
"Path",
"(",
")",
":",
"env",
"[",
"'$(VSInstall... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/gyp/pylib/gyp/msvs_emulation.py#L146-L164 | |
nasa/meshNetwork | ff4bd66e0ca6bd424fd8897a97252bb3925d8b3c | python/mesh/generic/cmdDict.py | python | serialize_NodeCmds_CmdResponse | (cmdData, timestamp) | return pack(NodeCmdDict[NodeCmds['CmdResponse']].packFormat, cmdData['cmdId'], cmdData['cmdCounter'], cmdData['cmdResponse']) | Method for serializing NodeCmds['CmdReponse'] command for serial transmission. | Method for serializing NodeCmds['CmdReponse'] command for serial transmission. | [
"Method",
"for",
"serializing",
"NodeCmds",
"[",
"CmdReponse",
"]",
"command",
"for",
"serial",
"transmission",
"."
] | def serialize_NodeCmds_CmdResponse(cmdData, timestamp):
"""Method for serializing NodeCmds['CmdReponse'] command for serial transmission."""
return pack(NodeCmdDict[NodeCmds['CmdResponse']].packFormat, cmdData['cmdId'], cmdData['cmdCounter'], cmdData['cmdResponse']) | [
"def",
"serialize_NodeCmds_CmdResponse",
"(",
"cmdData",
",",
"timestamp",
")",
":",
"return",
"pack",
"(",
"NodeCmdDict",
"[",
"NodeCmds",
"[",
"'CmdResponse'",
"]",
"]",
".",
"packFormat",
",",
"cmdData",
"[",
"'cmdId'",
"]",
",",
"cmdData",
"[",
"'cmdCounte... | https://github.com/nasa/meshNetwork/blob/ff4bd66e0ca6bd424fd8897a97252bb3925d8b3c/python/mesh/generic/cmdDict.py#L10-L12 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2.py | python | uCSIsCatPd | (code) | return ret | Check whether the character is part of Pd UCS Category | Check whether the character is part of Pd UCS Category | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"Pd",
"UCS",
"Category"
] | def uCSIsCatPd(code):
"""Check whether the character is part of Pd UCS Category """
ret = libxml2mod.xmlUCSIsCatPd(code)
return ret | [
"def",
"uCSIsCatPd",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsCatPd",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L2349-L2352 | |
apache/arrow | af33dd1157eb8d7d9bfac25ebf61445b793b7943 | python/benchmarks/common.py | python | BuiltinsGenerator.generate_float_list | (self, n, none_prob=DEFAULT_NONE_PROB,
use_nan=False) | return data | Generate a list of Python floats with *none_prob* probability of
an entry being None (or NaN if *use_nan* is true). | Generate a list of Python floats with *none_prob* probability of
an entry being None (or NaN if *use_nan* is true). | [
"Generate",
"a",
"list",
"of",
"Python",
"floats",
"with",
"*",
"none_prob",
"*",
"probability",
"of",
"an",
"entry",
"being",
"None",
"(",
"or",
"NaN",
"if",
"*",
"use_nan",
"*",
"is",
"true",
")",
"."
] | def generate_float_list(self, n, none_prob=DEFAULT_NONE_PROB,
use_nan=False):
"""
Generate a list of Python floats with *none_prob* probability of
an entry being None (or NaN if *use_nan* is true).
"""
# Make sure we get Python floats, not np.float64
... | [
"def",
"generate_float_list",
"(",
"self",
",",
"n",
",",
"none_prob",
"=",
"DEFAULT_NONE_PROB",
",",
"use_nan",
"=",
"False",
")",
":",
"# Make sure we get Python floats, not np.float64",
"data",
"=",
"list",
"(",
"map",
"(",
"float",
",",
"self",
".",
"rnd",
... | https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/python/benchmarks/common.py#L136-L146 | |
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/pyedbglib/protocols/cmsisdap.py | python | CmsisDapDebugger.read_word | (self, address) | return self.dap_read_reg(self.SWD_AP_DRW | self.DAP_TRANSFER_APnDP) | Reads a word from the device memory bus
:param address: address to read | Reads a word from the device memory bus | [
"Reads",
"a",
"word",
"from",
"the",
"device",
"memory",
"bus"
] | def read_word(self, address):
"""
Reads a word from the device memory bus
:param address: address to read
"""
self.logger.debug("read word at 0x%08X", address)
self.dap_write_reg(self.SWD_AP_TAR | self.DAP_TRANSFER_APnDP, address)
return self.dap_read_reg(self.SW... | [
"def",
"read_word",
"(",
"self",
",",
"address",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"read word at 0x%08X\"",
",",
"address",
")",
"self",
".",
"dap_write_reg",
"(",
"self",
".",
"SWD_AP_TAR",
"|",
"self",
".",
"DAP_TRANSFER_APnDP",
",",
... | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/pyedbglib/protocols/cmsisdap.py#L316-L324 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/_pydecimal.py | python | _sqrt_nearest | (n, a) | return a | Closest integer to the square root of the positive integer n. a is
an initial approximation to the square root. Any positive integer
will do for a, but the closer a is to the square root of n the
faster convergence will be. | Closest integer to the square root of the positive integer n. a is
an initial approximation to the square root. Any positive integer
will do for a, but the closer a is to the square root of n the
faster convergence will be. | [
"Closest",
"integer",
"to",
"the",
"square",
"root",
"of",
"the",
"positive",
"integer",
"n",
".",
"a",
"is",
"an",
"initial",
"approximation",
"to",
"the",
"square",
"root",
".",
"Any",
"positive",
"integer",
"will",
"do",
"for",
"a",
"but",
"the",
"clo... | def _sqrt_nearest(n, a):
"""Closest integer to the square root of the positive integer n. a is
an initial approximation to the square root. Any positive integer
will do for a, but the closer a is to the square root of n the
faster convergence will be.
"""
if n <= 0 or a <= 0:
raise Va... | [
"def",
"_sqrt_nearest",
"(",
"n",
",",
"a",
")",
":",
"if",
"n",
"<=",
"0",
"or",
"a",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"\"Both arguments to _sqrt_nearest should be positive.\"",
")",
"b",
"=",
"0",
"while",
"a",
"!=",
"b",
":",
"b",
",",
"a... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/_pydecimal.py#L5693-L5706 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/perf/profile_creators/profile_safe_url_generator.py | python | GenerateSafeUrls | () | Prints a list of safe urls.
Generates a safe list of urls from a seed list. Each href in the HTML
fetched from the url from the seed list is placed into the safe list. The
safe list contains unsanitized urls. | Prints a list of safe urls. | [
"Prints",
"a",
"list",
"of",
"safe",
"urls",
"."
] | def GenerateSafeUrls():
"""Prints a list of safe urls.
Generates a safe list of urls from a seed list. Each href in the HTML
fetched from the url from the seed list is placed into the safe list. The
safe list contains unsanitized urls.
"""
# A list of websites whose hrefs are unlikely to link to sites that... | [
"def",
"GenerateSafeUrls",
"(",
")",
":",
"# A list of websites whose hrefs are unlikely to link to sites that contain",
"# malware.",
"seed_urls",
"=",
"[",
"\"http://www.cnn.com\"",
",",
"\"https://www.youtube.com\"",
",",
"\"https://www.facebook.com\"",
",",
"\"https://www.twitter... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/perf/profile_creators/profile_safe_url_generator.py#L31-L94 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/io/pytables.py | python | Table.set_attrs | (self) | set our table type & indexables | set our table type & indexables | [
"set",
"our",
"table",
"type",
"&",
"indexables"
] | def set_attrs(self):
"""set our table type & indexables"""
self.attrs.table_type = str(self.table_type)
self.attrs.index_cols = self.index_cols()
self.attrs.values_cols = self.values_cols()
self.attrs.non_index_axes = self.non_index_axes
self.attrs.data_columns = self.dat... | [
"def",
"set_attrs",
"(",
"self",
")",
":",
"self",
".",
"attrs",
".",
"table_type",
"=",
"str",
"(",
"self",
".",
"table_type",
")",
"self",
".",
"attrs",
".",
"index_cols",
"=",
"self",
".",
"index_cols",
"(",
")",
"self",
".",
"attrs",
".",
"values... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/pytables.py#L3493-L3504 | ||
randombit/botan | e068d80953469fc8a3ec1715d0f64756d972daba | src/scripts/ci_build.py | python | main | (args=None) | return 0 | Parse options, do the things | Parse options, do the things | [
"Parse",
"options",
"do",
"the",
"things"
] | def main(args=None):
# pylint: disable=too-many-branches,too-many-statements,too-many-locals,too-many-return-statements,too-many-locals
"""
Parse options, do the things
"""
if os.getenv('COVERITY_SCAN_BRANCH') == '1':
print('Skipping build COVERITY_SCAN_BRANCH set in environment')
r... | [
"def",
"main",
"(",
"args",
"=",
"None",
")",
":",
"# pylint: disable=too-many-branches,too-many-statements,too-many-locals,too-many-return-statements,too-many-locals",
"if",
"os",
".",
"getenv",
"(",
"'COVERITY_SCAN_BRANCH'",
")",
"==",
"'1'",
":",
"print",
"(",
"'Skipping... | https://github.com/randombit/botan/blob/e068d80953469fc8a3ec1715d0f64756d972daba/src/scripts/ci_build.py#L437-L651 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/aui.py | python | AuiToolBarItem.GetDisabledBitmap | (*args, **kwargs) | return _aui.AuiToolBarItem_GetDisabledBitmap(*args, **kwargs) | GetDisabledBitmap(self) -> Bitmap | GetDisabledBitmap(self) -> Bitmap | [
"GetDisabledBitmap",
"(",
"self",
")",
"-",
">",
"Bitmap"
] | def GetDisabledBitmap(*args, **kwargs):
"""GetDisabledBitmap(self) -> Bitmap"""
return _aui.AuiToolBarItem_GetDisabledBitmap(*args, **kwargs) | [
"def",
"GetDisabledBitmap",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiToolBarItem_GetDisabledBitmap",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/aui.py#L1789-L1791 | |
rsummers11/CADLab | 976ed959a0b5208bb4173127a7ef732ac73a9b6f | MULAN_universal_lesion_analysis/maskrcnn/modeling/poolers.py | python | Pooler.__init__ | (self, output_size, scales, sampling_ratio) | Arguments:
output_size (list[tuple[int]] or list[int]): output size for the pooled region
scales (list[float]): scales for each Pooler
sampling_ratio (int): sampling ratio for ROIAlign | Arguments:
output_size (list[tuple[int]] or list[int]): output size for the pooled region
scales (list[float]): scales for each Pooler
sampling_ratio (int): sampling ratio for ROIAlign | [
"Arguments",
":",
"output_size",
"(",
"list",
"[",
"tuple",
"[",
"int",
"]]",
"or",
"list",
"[",
"int",
"]",
")",
":",
"output",
"size",
"for",
"the",
"pooled",
"region",
"scales",
"(",
"list",
"[",
"float",
"]",
")",
":",
"scales",
"for",
"each",
... | def __init__(self, output_size, scales, sampling_ratio):
"""
Arguments:
output_size (list[tuple[int]] or list[int]): output size for the pooled region
scales (list[float]): scales for each Pooler
sampling_ratio (int): sampling ratio for ROIAlign
"""
su... | [
"def",
"__init__",
"(",
"self",
",",
"output_size",
",",
"scales",
",",
"sampling_ratio",
")",
":",
"super",
"(",
"Pooler",
",",
"self",
")",
".",
"__init__",
"(",
")",
"poolers",
"=",
"[",
"]",
"for",
"scale",
"in",
"scales",
":",
"poolers",
".",
"a... | https://github.com/rsummers11/CADLab/blob/976ed959a0b5208bb4173127a7ef732ac73a9b6f/MULAN_universal_lesion_analysis/maskrcnn/modeling/poolers.py#L63-L84 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/training/input.py | python | _deserialize_sparse_tensors | (serialized_list, sparse_info_list) | return tensors if received_sequence else tensors[0] | Deserialize SparseTensors after dequeue in batch, batch_join, etc. | Deserialize SparseTensors after dequeue in batch, batch_join, etc. | [
"Deserialize",
"SparseTensors",
"after",
"dequeue",
"in",
"batch",
"batch_join",
"etc",
"."
] | def _deserialize_sparse_tensors(serialized_list, sparse_info_list):
"""Deserialize SparseTensors after dequeue in batch, batch_join, etc."""
received_sequence = isinstance(serialized_list, collections.Sequence)
if not received_sequence:
serialized_list = (serialized_list,)
tensors = [
sparse_ops.deser... | [
"def",
"_deserialize_sparse_tensors",
"(",
"serialized_list",
",",
"sparse_info_list",
")",
":",
"received_sequence",
"=",
"isinstance",
"(",
"serialized_list",
",",
"collections",
".",
"Sequence",
")",
"if",
"not",
"received_sequence",
":",
"serialized_list",
"=",
"(... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/training/input.py#L399-L409 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/genericmessagedialog.py | python | GenericMessageDialog.GetCustomNoBitmap | (self) | return (self._noBitmap and [self._noBitmap] or [self.GetDefaultNoBitmap()])[0] | If a custom icon has been used for the ``No`` button, this method will return
it as an instance of :class:`Bitmap`. Otherwise, the default one (as defined in
:meth:`~GenericMessageDialog.GetDefaultNoBitmap`) is returned.
.. versionadded:: 0.9.3 | If a custom icon has been used for the ``No`` button, this method will return
it as an instance of :class:`Bitmap`. Otherwise, the default one (as defined in
:meth:`~GenericMessageDialog.GetDefaultNoBitmap`) is returned. | [
"If",
"a",
"custom",
"icon",
"has",
"been",
"used",
"for",
"the",
"No",
"button",
"this",
"method",
"will",
"return",
"it",
"as",
"an",
"instance",
"of",
":",
"class",
":",
"Bitmap",
".",
"Otherwise",
"the",
"default",
"one",
"(",
"as",
"defined",
"in"... | def GetCustomNoBitmap(self):
"""
If a custom icon has been used for the ``No`` button, this method will return
it as an instance of :class:`Bitmap`. Otherwise, the default one (as defined in
:meth:`~GenericMessageDialog.GetDefaultNoBitmap`) is returned.
.. versionadded:: 0.9.3
... | [
"def",
"GetCustomNoBitmap",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"_noBitmap",
"and",
"[",
"self",
".",
"_noBitmap",
"]",
"or",
"[",
"self",
".",
"GetDefaultNoBitmap",
"(",
")",
"]",
")",
"[",
"0",
"]"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/genericmessagedialog.py#L1331-L1340 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_controls.py | python | ToolBarBase.GetToolSeparation | (*args, **kwargs) | return _controls_.ToolBarBase_GetToolSeparation(*args, **kwargs) | GetToolSeparation(self) -> int | GetToolSeparation(self) -> int | [
"GetToolSeparation",
"(",
"self",
")",
"-",
">",
"int"
] | def GetToolSeparation(*args, **kwargs):
"""GetToolSeparation(self) -> int"""
return _controls_.ToolBarBase_GetToolSeparation(*args, **kwargs) | [
"def",
"GetToolSeparation",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ToolBarBase_GetToolSeparation",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L3867-L3869 | |
toggl-open-source/toggldesktop | 91865205885531cc8fd9e8d613dad49d625d56e7 | third_party/cpplint/cpplint.py | python | ReverseCloseExpression | (clean_lines, linenum, pos) | return (line, 0, -1) | If input points to ) or } or ] or >, finds the position that opens it.
If lines[linenum][pos] points to a ')' or '}' or ']' or '>', finds the
linenum/pos that correspond to the opening of the expression.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to ... | If input points to ) or } or ] or >, finds the position that opens it. | [
"If",
"input",
"points",
"to",
")",
"or",
"}",
"or",
"]",
"or",
">",
"finds",
"the",
"position",
"that",
"opens",
"it",
"."
] | def ReverseCloseExpression(clean_lines, linenum, pos):
"""If input points to ) or } or ] or >, finds the position that opens it.
If lines[linenum][pos] points to a ')' or '}' or ']' or '>', finds the
linenum/pos that correspond to the opening of the expression.
Args:
clean_lines: A CleansedLines instance ... | [
"def",
"ReverseCloseExpression",
"(",
"clean_lines",
",",
"linenum",
",",
"pos",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"if",
"line",
"[",
"pos",
"]",
"not",
"in",
"')}]>'",
":",
"return",
"(",
"line",
",",
"0",
",",
... | https://github.com/toggl-open-source/toggldesktop/blob/91865205885531cc8fd9e8d613dad49d625d56e7/third_party/cpplint/cpplint.py#L1584-L1619 | |
apache/singa | 93fd9da72694e68bfe3fb29d0183a65263d238a1 | python/singa/autograd.py | python | clip | (x, min=None, max=None) | return Clip(min, max)(x)[0] | Clip operator limits the given input within an interval. The interval
is specified by the inputs 'min' and 'max'.
Args:
x (Tensor): input tensor
min (float): Minimum value, under which element is replaced by min.
max (float): Maximum value, above which element is replaced by max.
Ret... | Clip operator limits the given input within an interval. The interval
is specified by the inputs 'min' and 'max'.
Args:
x (Tensor): input tensor
min (float): Minimum value, under which element is replaced by min.
max (float): Maximum value, above which element is replaced by max.
Ret... | [
"Clip",
"operator",
"limits",
"the",
"given",
"input",
"within",
"an",
"interval",
".",
"The",
"interval",
"is",
"specified",
"by",
"the",
"inputs",
"min",
"and",
"max",
".",
"Args",
":",
"x",
"(",
"Tensor",
")",
":",
"input",
"tensor",
"min",
"(",
"fl... | def clip(x, min=None, max=None):
"""
Clip operator limits the given input within an interval. The interval
is specified by the inputs 'min' and 'max'.
Args:
x (Tensor): input tensor
min (float): Minimum value, under which element is replaced by min.
max (float): Maximum value, ab... | [
"def",
"clip",
"(",
"x",
",",
"min",
"=",
"None",
",",
"max",
"=",
"None",
")",
":",
"return",
"Clip",
"(",
"min",
",",
"max",
")",
"(",
"x",
")",
"[",
"0",
"]"
] | https://github.com/apache/singa/blob/93fd9da72694e68bfe3fb29d0183a65263d238a1/python/singa/autograd.py#L543-L554 | |
nlohmann/json | eb2182414749825be086c825edb5229e5c28503d | third_party/cpplint/cpplint.py | python | Search | (pattern, s) | return _regexp_compile_cache[pattern].search(s) | Searches the string for the pattern, caching the compiled regexp. | Searches the string for the pattern, caching the compiled regexp. | [
"Searches",
"the",
"string",
"for",
"the",
"pattern",
"caching",
"the",
"compiled",
"regexp",
"."
] | def Search(pattern, s):
"""Searches the string for the pattern, caching the compiled regexp."""
if pattern not in _regexp_compile_cache:
_regexp_compile_cache[pattern] = sre_compile.compile(pattern)
return _regexp_compile_cache[pattern].search(s) | [
"def",
"Search",
"(",
"pattern",
",",
"s",
")",
":",
"if",
"pattern",
"not",
"in",
"_regexp_compile_cache",
":",
"_regexp_compile_cache",
"[",
"pattern",
"]",
"=",
"sre_compile",
".",
"compile",
"(",
"pattern",
")",
"return",
"_regexp_compile_cache",
"[",
"pat... | https://github.com/nlohmann/json/blob/eb2182414749825be086c825edb5229e5c28503d/third_party/cpplint/cpplint.py#L1057-L1061 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/linear_model/stochastic_gradient.py | python | BaseSGD._allocate_parameter_mem | (self, n_classes, n_features, coef_init=None,
intercept_init=None) | Allocate mem for parameters; initialize if provided. | Allocate mem for parameters; initialize if provided. | [
"Allocate",
"mem",
"for",
"parameters",
";",
"initialize",
"if",
"provided",
"."
] | def _allocate_parameter_mem(self, n_classes, n_features, coef_init=None,
intercept_init=None):
"""Allocate mem for parameters; initialize if provided."""
if n_classes > 2:
# allocate coef_ for multi-class
if coef_init is not None:
c... | [
"def",
"_allocate_parameter_mem",
"(",
"self",
",",
"n_classes",
",",
"n_features",
",",
"coef_init",
"=",
"None",
",",
"intercept_init",
"=",
"None",
")",
":",
"if",
"n_classes",
">",
"2",
":",
"# allocate coef_ for multi-class",
"if",
"coef_init",
"is",
"not",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/linear_model/stochastic_gradient.py#L155-L214 | ||
choasup/caffe-yolo9000 | e8a476c4c23d756632f7a26c681a96e3ab672544 | scripts/cpp_lint.py | python | IsBlankLine | (line) | return not line or line.isspace() | Returns true if the given line is blank.
We consider a line to be blank if the line is empty or consists of
only white spaces.
Args:
line: A line of a string.
Returns:
True, if the given line is blank. | Returns true if the given line is blank. | [
"Returns",
"true",
"if",
"the",
"given",
"line",
"is",
"blank",
"."
] | def IsBlankLine(line):
"""Returns true if the given line is blank.
We consider a line to be blank if the line is empty or consists of
only white spaces.
Args:
line: A line of a string.
Returns:
True, if the given line is blank.
"""
return not line or line.isspace() | [
"def",
"IsBlankLine",
"(",
"line",
")",
":",
"return",
"not",
"line",
"or",
"line",
".",
"isspace",
"(",
")"
] | https://github.com/choasup/caffe-yolo9000/blob/e8a476c4c23d756632f7a26c681a96e3ab672544/scripts/cpp_lint.py#L2373-L2385 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/xrc.py | python | XmlResourceHandler.CreateChildren | (*args, **kwargs) | return _xrc.XmlResourceHandler_CreateChildren(*args, **kwargs) | CreateChildren(self, Object parent, bool this_hnd_only=False) | CreateChildren(self, Object parent, bool this_hnd_only=False) | [
"CreateChildren",
"(",
"self",
"Object",
"parent",
"bool",
"this_hnd_only",
"=",
"False",
")"
] | def CreateChildren(*args, **kwargs):
"""CreateChildren(self, Object parent, bool this_hnd_only=False)"""
return _xrc.XmlResourceHandler_CreateChildren(*args, **kwargs) | [
"def",
"CreateChildren",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_xrc",
".",
"XmlResourceHandler_CreateChildren",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/xrc.py#L721-L723 | |
zhuli19901106/leetcode-zhuli | 0f8fc29ccb8c33ea91149ecb2d4e961024c11db7 | explore/fun-with-arrays/3245_duplicate-zeros_1_AC.py | python | Solution.duplicateZeros | (self, arr: List[int]) | Do not return anything, modify arr in-place instead. | Do not return anything, modify arr in-place instead. | [
"Do",
"not",
"return",
"anything",
"modify",
"arr",
"in",
"-",
"place",
"instead",
"."
] | def duplicateZeros(self, arr: List[int]) -> None:
"""
Do not return anything, modify arr in-place instead.
"""
a = arr
n = len(a)
z = 0
for i in range(n):
if a[i] == 0:
z += 1
for i in range(n - 1, -1, -1):
if a[i] =... | [
"def",
"duplicateZeros",
"(",
"self",
",",
"arr",
":",
"List",
"[",
"int",
"]",
")",
"->",
"None",
":",
"a",
"=",
"arr",
"n",
"=",
"len",
"(",
"a",
")",
"z",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"n",
")",
":",
"if",
"a",
"[",
"i",
"]... | https://github.com/zhuli19901106/leetcode-zhuli/blob/0f8fc29ccb8c33ea91149ecb2d4e961024c11db7/explore/fun-with-arrays/3245_duplicate-zeros_1_AC.py#L3-L20 | ||
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/SCons/Scanner/Dir.py | python | scan_on_disk | (node, env, path=()) | return scan_in_memory(node, env, path) | Scans a directory for on-disk files and directories therein.
Looking up the entries will add these to the in-memory Node tree
representation of the file system, so all we have to do is just
that and then call the in-memory scanning function. | Scans a directory for on-disk files and directories therein. | [
"Scans",
"a",
"directory",
"for",
"on",
"-",
"disk",
"files",
"and",
"directories",
"therein",
"."
] | def scan_on_disk(node, env, path=()):
"""
Scans a directory for on-disk files and directories therein.
Looking up the entries will add these to the in-memory Node tree
representation of the file system, so all we have to do is just
that and then call the in-memory scanning function.
"""
try... | [
"def",
"scan_on_disk",
"(",
"node",
",",
"env",
",",
"path",
"=",
"(",
")",
")",
":",
"try",
":",
"flist",
"=",
"node",
".",
"fs",
".",
"listdir",
"(",
"node",
".",
"get_abspath",
"(",
")",
")",
"except",
"(",
"IOError",
",",
"OSError",
")",
":",... | https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Scanner/Dir.py#L71-L88 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/_extends/graph_kernel/model/graph_split.py | python | GraphSplitByPattern.set_area_map | (self, ops, area) | update area_map after op fused to area | update area_map after op fused to area | [
"update",
"area_map",
"after",
"op",
"fused",
"to",
"area"
] | def set_area_map(self, ops, area):
"""update area_map after op fused to area"""
for op in ops:
self.area_map[op] = area | [
"def",
"set_area_map",
"(",
"self",
",",
"ops",
",",
"area",
")",
":",
"for",
"op",
"in",
"ops",
":",
"self",
".",
"area_map",
"[",
"op",
"]",
"=",
"area"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/_extends/graph_kernel/model/graph_split.py#L334-L337 | ||
geemaple/leetcode | 68bc5032e1ee52c22ef2f2e608053484c487af54 | leetcode/173.binary-search-tree-iterator.py | python | BSTIterator.hasNext | (self) | return self.cur is not None or len(self.stack) > 0 | :rtype: bool | :rtype: bool | [
":",
"rtype",
":",
"bool"
] | def hasNext(self):
"""
:rtype: bool
"""
return self.cur is not None or len(self.stack) > 0 | [
"def",
"hasNext",
"(",
"self",
")",
":",
"return",
"self",
".",
"cur",
"is",
"not",
"None",
"or",
"len",
"(",
"self",
".",
"stack",
")",
">",
"0"
] | https://github.com/geemaple/leetcode/blob/68bc5032e1ee52c22ef2f2e608053484c487af54/leetcode/173.binary-search-tree-iterator.py#L17-L21 | |
echronos/echronos | c996f1d2c8af6c6536205eb319c1bf1d4d84569c | external_tools/ply_info/example/ansic/cparse.py | python | p_declaration_1 | (t) | declaration : declaration_specifiers init_declarator_list SEMI | declaration : declaration_specifiers init_declarator_list SEMI | [
"declaration",
":",
"declaration_specifiers",
"init_declarator_list",
"SEMI"
] | def p_declaration_1(t):
'declaration : declaration_specifiers init_declarator_list SEMI'
pass | [
"def",
"p_declaration_1",
"(",
"t",
")",
":",
"pass"
] | https://github.com/echronos/echronos/blob/c996f1d2c8af6c6536205eb319c1bf1d4d84569c/external_tools/ply_info/example/ansic/cparse.py#L54-L56 | ||
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/idl/idl/generator.py | python | _CppFileWriterBase._block | (self, opening, closing) | return writer.IndentedScopedBlock(self._writer, opening, closing) | Generate an indented block if opening is not empty. | Generate an indented block if opening is not empty. | [
"Generate",
"an",
"indented",
"block",
"if",
"opening",
"is",
"not",
"empty",
"."
] | def _block(self, opening, closing):
# type: (unicode, unicode) -> Union[writer.IndentedScopedBlock,writer.EmptyBlock]
"""Generate an indented block if opening is not empty."""
if not opening:
return writer.EmptyBlock()
return writer.IndentedScopedBlock(self._writer, opening,... | [
"def",
"_block",
"(",
"self",
",",
"opening",
",",
"closing",
")",
":",
"# type: (unicode, unicode) -> Union[writer.IndentedScopedBlock,writer.EmptyBlock]",
"if",
"not",
"opening",
":",
"return",
"writer",
".",
"EmptyBlock",
"(",
")",
"return",
"writer",
".",
"Indente... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/idl/idl/generator.py#L323-L329 | |
ApolloAuto/apollo | 463fb82f9e979d02dcb25044e60931293ab2dba0 | modules/tools/sensor_calibration/ins_stat_publisher.py | python | InsStat.shutdown | (self) | shutdown rosnode | shutdown rosnode | [
"shutdown",
"rosnode"
] | def shutdown(self):
"""
shutdown rosnode
"""
self.terminating = True
#self.logger.info("Shutting Down...")
time.sleep(0.2) | [
"def",
"shutdown",
"(",
"self",
")",
":",
"self",
".",
"terminating",
"=",
"True",
"#self.logger.info(\"Shutting Down...\")",
"time",
".",
"sleep",
"(",
"0.2",
")"
] | https://github.com/ApolloAuto/apollo/blob/463fb82f9e979d02dcb25044e60931293ab2dba0/modules/tools/sensor_calibration/ins_stat_publisher.py#L51-L57 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/math/so2.py | python | matrix | (a : float) | return [[c,-s],[s,c]] | Returns the 2x2 rotation matrix representing a rotation about the
angle a. | Returns the 2x2 rotation matrix representing a rotation about the
angle a. | [
"Returns",
"the",
"2x2",
"rotation",
"matrix",
"representing",
"a",
"rotation",
"about",
"the",
"angle",
"a",
"."
] | def matrix(a : float) -> List[List[float]]:
"""Returns the 2x2 rotation matrix representing a rotation about the
angle a."""
c = math.cos(a)
s = math.sin(a)
return [[c,-s],[s,c]] | [
"def",
"matrix",
"(",
"a",
":",
"float",
")",
"->",
"List",
"[",
"List",
"[",
"float",
"]",
"]",
":",
"c",
"=",
"math",
".",
"cos",
"(",
"a",
")",
"s",
"=",
"math",
".",
"sin",
"(",
"a",
")",
"return",
"[",
"[",
"c",
",",
"-",
"s",
"]",
... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/math/so2.py#L50-L55 | |
KhronosGroup/Vulkan-Headers | b32da5329b50e3cb96229aaecba9ded032fe29cc | registry/generator.py | python | OutputGenerator.getMaxCParamTypeLength | (self, info) | return max(lengths) | Return the length of the longest type field for a member/parameter.
- info - TypeInfo or CommandInfo. | Return the length of the longest type field for a member/parameter. | [
"Return",
"the",
"length",
"of",
"the",
"longest",
"type",
"field",
"for",
"a",
"member",
"/",
"parameter",
"."
] | def getMaxCParamTypeLength(self, info):
"""Return the length of the longest type field for a member/parameter.
- info - TypeInfo or CommandInfo.
"""
lengths = (self.getCParamTypeLength(member)
for member in info.getMembers())
return max(lengths) | [
"def",
"getMaxCParamTypeLength",
"(",
"self",
",",
"info",
")",
":",
"lengths",
"=",
"(",
"self",
".",
"getCParamTypeLength",
"(",
"member",
")",
"for",
"member",
"in",
"info",
".",
"getMembers",
"(",
")",
")",
"return",
"max",
"(",
"lengths",
")"
] | https://github.com/KhronosGroup/Vulkan-Headers/blob/b32da5329b50e3cb96229aaecba9ded032fe29cc/registry/generator.py#L1015-L1022 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/layers/python/layers/rev_block_lib.py | python | _rev_layer_forward | (xs, f, g, f_side_input, g_side_input,
gate_outputs=False) | Forward for 1 reversible layer. | Forward for 1 reversible layer. | [
"Forward",
"for",
"1",
"reversible",
"layer",
"."
] | def _rev_layer_forward(xs, f, g, f_side_input, g_side_input,
gate_outputs=False):
"""Forward for 1 reversible layer."""
x1, x2 = xs
y1 = x1 + (f(x2, f_side_input) if f_side_input else f(x2))
y2 = x2 + (g(y1, g_side_input) if g_side_input else g(y1))
if gate_outputs:
return control_f... | [
"def",
"_rev_layer_forward",
"(",
"xs",
",",
"f",
",",
"g",
",",
"f_side_input",
",",
"g_side_input",
",",
"gate_outputs",
"=",
"False",
")",
":",
"x1",
",",
"x2",
"=",
"xs",
"y1",
"=",
"x1",
"+",
"(",
"f",
"(",
"x2",
",",
"f_side_input",
")",
"if"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/layers/python/layers/rev_block_lib.py#L78-L87 | ||
apple/swift-clang | d7403439fc6641751840b723e7165fb02f52db95 | tools/scan-build-py/libscanbuild/report.py | python | read_bugs | (output_dir, html) | Generate a unique sequence of bugs from given output directory.
Duplicates can be in a project if the same module was compiled multiple
times with different compiler options. These would be better to show in
the final report (cover) only once. | Generate a unique sequence of bugs from given output directory. | [
"Generate",
"a",
"unique",
"sequence",
"of",
"bugs",
"from",
"given",
"output",
"directory",
"."
] | def read_bugs(output_dir, html):
# type: (str, bool) -> Generator[Dict[str, Any], None, None]
""" Generate a unique sequence of bugs from given output directory.
Duplicates can be in a project if the same module was compiled multiple
times with different compiler options. These would be better to show ... | [
"def",
"read_bugs",
"(",
"output_dir",
",",
"html",
")",
":",
"# type: (str, bool) -> Generator[Dict[str, Any], None, None]",
"def",
"empty",
"(",
"file_name",
")",
":",
"return",
"os",
".",
"stat",
"(",
"file_name",
")",
".",
"st_size",
"==",
"0",
"duplicate",
... | https://github.com/apple/swift-clang/blob/d7403439fc6641751840b723e7165fb02f52db95/tools/scan-build-py/libscanbuild/report.py#L255-L278 | ||
indutny/candor | 48e7260618f5091c80a3416828e2808cad3ea22e | tools/gyp/pylib/gyp/xcode_emulation.py | python | XcodeSettings.GetLdflags | (self, configname, product_dir, gyp_to_build_path) | return ldflags | Returns flags that need to be passed to the linker.
Args:
configname: The name of the configuration to get ld flags for.
product_dir: The directory where products such static and dynamic
libraries are placed. This is added to the library search path.
gyp_to_build_path: A functio... | Returns flags that need to be passed to the linker. | [
"Returns",
"flags",
"that",
"need",
"to",
"be",
"passed",
"to",
"the",
"linker",
"."
] | def GetLdflags(self, configname, product_dir, gyp_to_build_path):
"""Returns flags that need to be passed to the linker.
Args:
configname: The name of the configuration to get ld flags for.
product_dir: The directory where products such static and dynamic
libraries are placed. This ... | [
"def",
"GetLdflags",
"(",
"self",
",",
"configname",
",",
"product_dir",
",",
"gyp_to_build_path",
")",
":",
"self",
".",
"configname",
"=",
"configname",
"ldflags",
"=",
"[",
"]",
"# The xcode build is relative to a gyp file's directory, and OTHER_LDFLAGS",
"# can contai... | https://github.com/indutny/candor/blob/48e7260618f5091c80a3416828e2808cad3ea22e/tools/gyp/pylib/gyp/xcode_emulation.py#L499-L563 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/preprocessing/_data.py | python | MaxAbsScaler.fit | (self, X, y=None) | return self.partial_fit(X, y) | Compute the maximum absolute value to be used for later scaling.
Parameters
----------
X : {array-like, sparse matrix}, shape [n_samples, n_features]
The data used to compute the per-feature minimum and maximum
used for later scaling along the features axis. | Compute the maximum absolute value to be used for later scaling. | [
"Compute",
"the",
"maximum",
"absolute",
"value",
"to",
"be",
"used",
"for",
"later",
"scaling",
"."
] | def fit(self, X, y=None):
"""Compute the maximum absolute value to be used for later scaling.
Parameters
----------
X : {array-like, sparse matrix}, shape [n_samples, n_features]
The data used to compute the per-feature minimum and maximum
used for later scaling ... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"# Reset internal state before fitting",
"self",
".",
"_reset",
"(",
")",
"return",
"self",
".",
"partial_fit",
"(",
"X",
",",
"y",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/preprocessing/_data.py#L932-L944 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/distutils/filelist.py | python | FileList.debug_print | (self, msg) | Print 'msg' to stdout if the global DEBUG (taken from the
DISTUTILS_DEBUG environment variable) flag is true. | Print 'msg' to stdout if the global DEBUG (taken from the
DISTUTILS_DEBUG environment variable) flag is true. | [
"Print",
"msg",
"to",
"stdout",
"if",
"the",
"global",
"DEBUG",
"(",
"taken",
"from",
"the",
"DISTUTILS_DEBUG",
"environment",
"variable",
")",
"flag",
"is",
"true",
"."
] | def debug_print(self, msg):
"""Print 'msg' to stdout if the global DEBUG (taken from the
DISTUTILS_DEBUG environment variable) flag is true.
"""
from distutils.debug import DEBUG
if DEBUG:
print msg | [
"def",
"debug_print",
"(",
"self",
",",
"msg",
")",
":",
"from",
"distutils",
".",
"debug",
"import",
"DEBUG",
"if",
"DEBUG",
":",
"print",
"msg"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/distutils/filelist.py#L42-L48 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Misc.grid_slaves | (self, row=None, column=None) | return map(self._nametowidget,
self.tk.splitlist(self.tk.call(
('grid', 'slaves', self._w) + args))) | Return a list of all slaves of this widget
in its packing order. | Return a list of all slaves of this widget
in its packing order. | [
"Return",
"a",
"list",
"of",
"all",
"slaves",
"of",
"this",
"widget",
"in",
"its",
"packing",
"order",
"."
] | def grid_slaves(self, row=None, column=None):
"""Return a list of all slaves of this widget
in its packing order."""
args = ()
if row is not None:
args = args + ('-row', row)
if column is not None:
args = args + ('-column', column)
return map(self.... | [
"def",
"grid_slaves",
"(",
"self",
",",
"row",
"=",
"None",
",",
"column",
"=",
"None",
")",
":",
"args",
"=",
"(",
")",
"if",
"row",
"is",
"not",
"None",
":",
"args",
"=",
"args",
"+",
"(",
"'-row'",
",",
"row",
")",
"if",
"column",
"is",
"not... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py#L1404-L1414 | |
line/stellite | 5bd1c1f5f0cdc22a65319068f4f8b2ca7769bfa1 | tools/build.py | python | BuildObject.fetch_toolchain | (self) | return True | fetch build toolchain | fetch build toolchain | [
"fetch",
"build",
"toolchain"
] | def fetch_toolchain(self):
"""fetch build toolchain"""
return True | [
"def",
"fetch_toolchain",
"(",
"self",
")",
":",
"return",
"True"
] | https://github.com/line/stellite/blob/5bd1c1f5f0cdc22a65319068f4f8b2ca7769bfa1/tools/build.py#L762-L764 | |
TGAC/KAT | e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216 | deps/boost/tools/build/src/build/generators.py | python | Generator.target_types | (self) | return self.target_types_ | Returns the list of target types that this generator produces.
It is assumed to be always the same -- i.e. it cannot change depending
list of sources. | Returns the list of target types that this generator produces.
It is assumed to be always the same -- i.e. it cannot change depending
list of sources. | [
"Returns",
"the",
"list",
"of",
"target",
"types",
"that",
"this",
"generator",
"produces",
".",
"It",
"is",
"assumed",
"to",
"be",
"always",
"the",
"same",
"--",
"i",
".",
"e",
".",
"it",
"cannot",
"change",
"depending",
"list",
"of",
"sources",
"."
] | def target_types (self):
""" Returns the list of target types that this generator produces.
It is assumed to be always the same -- i.e. it cannot change depending
list of sources.
"""
return self.target_types_ | [
"def",
"target_types",
"(",
"self",
")",
":",
"return",
"self",
".",
"target_types_"
] | https://github.com/TGAC/KAT/blob/e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216/deps/boost/tools/build/src/build/generators.py#L286-L291 | |
runtimejs/runtime | 0a6e84c30823d35a4548d6634166784260ae7b74 | deps/v8/tools/grokdump.py | python | InspectionShell.do_lm | (self, arg) | List details for all loaded modules in the minidump. An argument can
be passed to limit the output to only those modules that contain the
argument as a substring (case insensitive match). | List details for all loaded modules in the minidump. An argument can
be passed to limit the output to only those modules that contain the
argument as a substring (case insensitive match). | [
"List",
"details",
"for",
"all",
"loaded",
"modules",
"in",
"the",
"minidump",
".",
"An",
"argument",
"can",
"be",
"passed",
"to",
"limit",
"the",
"output",
"to",
"only",
"those",
"modules",
"that",
"contain",
"the",
"argument",
"as",
"a",
"substring",
"("... | def do_lm(self, arg):
"""
List details for all loaded modules in the minidump. An argument can
be passed to limit the output to only those modules that contain the
argument as a substring (case insensitive match).
"""
for module in self.reader.module_list.modules:
if arg:
name =... | [
"def",
"do_lm",
"(",
"self",
",",
"arg",
")",
":",
"for",
"module",
"in",
"self",
".",
"reader",
".",
"module_list",
".",
"modules",
":",
"if",
"arg",
":",
"name",
"=",
"GetModuleName",
"(",
"self",
".",
"reader",
",",
"module",
")",
".",
"lower",
... | https://github.com/runtimejs/runtime/blob/0a6e84c30823d35a4548d6634166784260ae7b74/deps/v8/tools/grokdump.py#L3030-L3043 | ||
perilouswithadollarsign/cstrike15_src | f82112a2388b841d72cb62ca48ab1846dfcc11c8 | thirdparty/protobuf-2.5.0/python/mox.py | python | MockAnything._Reset | (self) | Reset the state of this mock to record mode with an empty queue. | Reset the state of this mock to record mode with an empty queue. | [
"Reset",
"the",
"state",
"of",
"this",
"mock",
"to",
"record",
"mode",
"with",
"an",
"empty",
"queue",
"."
] | def _Reset(self):
"""Reset the state of this mock to record mode with an empty queue."""
# Maintain a list of method calls we are expecting
self._expected_calls_queue = deque()
# Make sure we are in setup mode, not replay mode
self._replay_mode = False | [
"def",
"_Reset",
"(",
"self",
")",
":",
"# Maintain a list of method calls we are expecting",
"self",
".",
"_expected_calls_queue",
"=",
"deque",
"(",
")",
"# Make sure we are in setup mode, not replay mode",
"self",
".",
"_replay_mode",
"=",
"False"
] | https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/thirdparty/protobuf-2.5.0/python/mox.py#L349-L356 | ||
javafxports/openjdk-jfx | 6eabc8c84f698c04548395826a8bb738087666b5 | modules/javafx.web/src/main/native/Source/JavaScriptCore/disassembler/udis86/ud_opcode.py | python | UdOpcodeTables.getMnemonicsList | (self) | return sorted(self._mnemonics.keys()) | Returns a sorted list of mnemonics | Returns a sorted list of mnemonics | [
"Returns",
"a",
"sorted",
"list",
"of",
"mnemonics"
] | def getMnemonicsList(self):
"""Returns a sorted list of mnemonics"""
return sorted(self._mnemonics.keys()) | [
"def",
"getMnemonicsList",
"(",
"self",
")",
":",
"return",
"sorted",
"(",
"self",
".",
"_mnemonics",
".",
"keys",
"(",
")",
")"
] | https://github.com/javafxports/openjdk-jfx/blob/6eabc8c84f698c04548395826a8bb738087666b5/modules/javafx.web/src/main/native/Source/JavaScriptCore/disassembler/udis86/ud_opcode.py#L543-L545 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/debug/cli/analyzer_cli.py | python | DebugAnalyzer.print_source | (self, args, screen_info=None) | return output | Print the content of a source file. | Print the content of a source file. | [
"Print",
"the",
"content",
"of",
"a",
"source",
"file",
"."
] | def print_source(self, args, screen_info=None):
"""Print the content of a source file."""
del screen_info # Unused.
parsed = self._arg_parsers["print_source"].parse_args(args)
source_annotation = source_utils.annotate_source(
self._debug_dump,
parsed.source_file_path,
do_dumpe... | [
"def",
"print_source",
"(",
"self",
",",
"args",
",",
"screen_info",
"=",
"None",
")",
":",
"del",
"screen_info",
"# Unused.",
"parsed",
"=",
"self",
".",
"_arg_parsers",
"[",
"\"print_source\"",
"]",
".",
"parse_args",
"(",
"args",
")",
"source_annotation",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/debug/cli/analyzer_cli.py#L1107-L1164 | |
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | buildscripts/eslint.py | python | get_base_dir | () | Get the base directory for mongo repo.
This script assumes that it is running in buildscripts/, and uses
that to find the base directory. | Get the base directory for mongo repo.
This script assumes that it is running in buildscripts/, and uses
that to find the base directory. | [
"Get",
"the",
"base",
"directory",
"for",
"mongo",
"repo",
".",
"This",
"script",
"assumes",
"that",
"it",
"is",
"running",
"in",
"buildscripts",
"/",
"and",
"uses",
"that",
"to",
"find",
"the",
"base",
"directory",
"."
] | def get_base_dir():
"""Get the base directory for mongo repo.
This script assumes that it is running in buildscripts/, and uses
that to find the base directory.
"""
try:
return subprocess.check_output(['git', 'rev-parse', '--show-toplevel']).rstrip()
except:
# We are not ... | [
"def",
"get_base_dir",
"(",
")",
":",
"try",
":",
"return",
"subprocess",
".",
"check_output",
"(",
"[",
"'git'",
",",
"'rev-parse'",
",",
"'--show-toplevel'",
"]",
")",
".",
"rstrip",
"(",
")",
"except",
":",
"# We are not in a valid git directory. Use the script... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/buildscripts/eslint.py#L313-L322 | ||
ndrplz/self-driving-car | 2bdcc7c822e8f03adc0a7490f1ae29a658720713 | project_5_vehicle_detection/functions_utils.py | python | normalize_image | (img) | return np.uint8(img) | Normalize image between 0 and 255 and cast to uint8
(useful for visualization) | Normalize image between 0 and 255 and cast to uint8
(useful for visualization) | [
"Normalize",
"image",
"between",
"0",
"and",
"255",
"and",
"cast",
"to",
"uint8",
"(",
"useful",
"for",
"visualization",
")"
] | def normalize_image(img):
"""
Normalize image between 0 and 255 and cast to uint8
(useful for visualization)
"""
img = np.float32(img)
img = img / img.max() * 255
return np.uint8(img) | [
"def",
"normalize_image",
"(",
"img",
")",
":",
"img",
"=",
"np",
".",
"float32",
"(",
"img",
")",
"img",
"=",
"img",
"/",
"img",
".",
"max",
"(",
")",
"*",
"255",
"return",
"np",
".",
"uint8",
"(",
"img",
")"
] | https://github.com/ndrplz/self-driving-car/blob/2bdcc7c822e8f03adc0a7490f1ae29a658720713/project_5_vehicle_detection/functions_utils.py#L4-L13 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/v8/tools/grokdump.py | python | InspectionShell.do_do | (self, address) | return self.do_display_object(address) | see display_object | see display_object | [
"see",
"display_object"
] | def do_do(self, address):
""" see display_object """
return self.do_display_object(address) | [
"def",
"do_do",
"(",
"self",
",",
"address",
")",
":",
"return",
"self",
".",
"do_display_object",
"(",
"address",
")"
] | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/v8/tools/grokdump.py#L3543-L3545 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Source/ThirdParty/CEF3/cef_source/tools/cef_parser.py | python | obj_analysis.has_name | (self) | return (not self.name is None) | Returns true if a name value exists. | Returns true if a name value exists. | [
"Returns",
"true",
"if",
"a",
"name",
"value",
"exists",
"."
] | def has_name(self):
""" Returns true if a name value exists. """
return (not self.name is None) | [
"def",
"has_name",
"(",
"self",
")",
":",
"return",
"(",
"not",
"self",
".",
"name",
"is",
"None",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Source/ThirdParty/CEF3/cef_source/tools/cef_parser.py#L1729-L1731 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/robotsim.py | python | RobotModelLink.getPositionJacobian | (self, plocal: "double const [3]") | return _robotsim.RobotModelLink_getPositionJacobian(self, plocal) | r"""
getPositionJacobian(RobotModelLink self, double const [3] plocal)
Computes the position jacobian of a point on this link w.r.t. the robot's
configuration q.
This matrix J gives the point's velocity (in world coordinates) via
np.dot(J,dq), where dq is the robot's joint v... | r"""
getPositionJacobian(RobotModelLink self, double const [3] plocal) | [
"r",
"getPositionJacobian",
"(",
"RobotModelLink",
"self",
"double",
"const",
"[",
"3",
"]",
"plocal",
")"
] | def getPositionJacobian(self, plocal: "double const [3]") -> "void":
r"""
getPositionJacobian(RobotModelLink self, double const [3] plocal)
Computes the position jacobian of a point on this link w.r.t. the robot's
configuration q.
This matrix J gives the point's velocity (in... | [
"def",
"getPositionJacobian",
"(",
"self",
",",
"plocal",
":",
"\"double const [3]\"",
")",
"->",
"\"void\"",
":",
"return",
"_robotsim",
".",
"RobotModelLink_getPositionJacobian",
"(",
"self",
",",
"plocal",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/robotsim.py#L4401-L4418 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/io/parsers/python_parser.py | python | PythonParser._buffered_line | (self) | Return a line from buffer, filling buffer if required. | Return a line from buffer, filling buffer if required. | [
"Return",
"a",
"line",
"from",
"buffer",
"filling",
"buffer",
"if",
"required",
"."
] | def _buffered_line(self):
"""
Return a line from buffer, filling buffer if required.
"""
if len(self.buf) > 0:
return self.buf[0]
else:
return self._next_line() | [
"def",
"_buffered_line",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"buf",
")",
">",
"0",
":",
"return",
"self",
".",
"buf",
"[",
"0",
"]",
"else",
":",
"return",
"self",
".",
"_next_line",
"(",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/parsers/python_parser.py#L577-L584 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/_extends/graph_kernel/model/model_builder.py | python | GraphBuilder.emit | (self, prim, inputs, name=None, attrs=None) | return output | Emit a new operation | Emit a new operation | [
"Emit",
"a",
"new",
"operation"
] | def emit(self, prim, inputs, name=None, attrs=None):
"""Emit a new operation"""
if attrs is None:
attrs = {}
if isinstance(inputs, (Tensor, Value)):
inputs = [inputs]
tensor_inputs = [t for t in inputs if isinstance(t, (Tensor, Value))]
out_shape, out_dtyp... | [
"def",
"emit",
"(",
"self",
",",
"prim",
",",
"inputs",
",",
"name",
"=",
"None",
",",
"attrs",
"=",
"None",
")",
":",
"if",
"attrs",
"is",
"None",
":",
"attrs",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"inputs",
",",
"(",
"Tensor",
",",
"Value",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/_extends/graph_kernel/model/model_builder.py#L98-L108 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PGProperty.RefreshChildren | (*args, **kwargs) | return _propgrid.PGProperty_RefreshChildren(*args, **kwargs) | RefreshChildren(self) | RefreshChildren(self) | [
"RefreshChildren",
"(",
"self",
")"
] | def RefreshChildren(*args, **kwargs):
"""RefreshChildren(self)"""
return _propgrid.PGProperty_RefreshChildren(*args, **kwargs) | [
"def",
"RefreshChildren",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGProperty_RefreshChildren",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L413-L415 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/rulerctrl.py | python | RulerCtrl.AddIndicator | (self, id, value) | Adds an indicator to :class:`RulerCtrl`. You should pass a unique `id` and a starting
`value` for the indicator.
:param `id`: the indicator identifier;
:param `value`: the indicator initial value. | Adds an indicator to :class:`RulerCtrl`. You should pass a unique `id` and a starting
`value` for the indicator. | [
"Adds",
"an",
"indicator",
"to",
":",
"class",
":",
"RulerCtrl",
".",
"You",
"should",
"pass",
"a",
"unique",
"id",
"and",
"a",
"starting",
"value",
"for",
"the",
"indicator",
"."
] | def AddIndicator(self, id, value):
"""
Adds an indicator to :class:`RulerCtrl`. You should pass a unique `id` and a starting
`value` for the indicator.
:param `id`: the indicator identifier;
:param `value`: the indicator initial value.
"""
self._indicators.appen... | [
"def",
"AddIndicator",
"(",
"self",
",",
"id",
",",
"value",
")",
":",
"self",
".",
"_indicators",
".",
"append",
"(",
"Indicator",
"(",
"self",
",",
"id",
",",
"value",
")",
")",
"self",
".",
"Refresh",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/rulerctrl.py#L1183-L1193 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | qa/tasks/cephfs/mount.py | python | CephFSMount.setup_netns | (self) | Setup the netns for the mountpoint. | Setup the netns for the mountpoint. | [
"Setup",
"the",
"netns",
"for",
"the",
"mountpoint",
"."
] | def setup_netns(self):
"""
Setup the netns for the mountpoint.
"""
log.info("Setting the '{0}' netns for '{1}'".format(self._netns_name, self.mountpoint))
self._setup_brx_and_nat()
self._setup_netns() | [
"def",
"setup_netns",
"(",
"self",
")",
":",
"log",
".",
"info",
"(",
"\"Setting the '{0}' netns for '{1}'\"",
".",
"format",
"(",
"self",
".",
"_netns_name",
",",
"self",
".",
"mountpoint",
")",
")",
"self",
".",
"_setup_brx_and_nat",
"(",
")",
"self",
".",... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/qa/tasks/cephfs/mount.py#L394-L400 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/sparse_ops.py | python | sparse_fill_empty_rows | (sp_input, default_value, name=None) | Fills empty rows in the input 2-D `SparseTensor` with a default value.
This op adds entries with the specified `default_value` at index
`[row, 0]` for any row in the input that does not already have a value.
For example, suppose `sp_input` has shape `[5, 6]` and non-empty values:
[0, 1]: a
[0, 3]: ... | Fills empty rows in the input 2-D `SparseTensor` with a default value. | [
"Fills",
"empty",
"rows",
"in",
"the",
"input",
"2",
"-",
"D",
"SparseTensor",
"with",
"a",
"default",
"value",
"."
] | def sparse_fill_empty_rows(sp_input, default_value, name=None):
"""Fills empty rows in the input 2-D `SparseTensor` with a default value.
This op adds entries with the specified `default_value` at index
`[row, 0]` for any row in the input that does not already have a value.
For example, suppose `sp_input` has... | [
"def",
"sparse_fill_empty_rows",
"(",
"sp_input",
",",
"default_value",
",",
"name",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"sp_input",
",",
"ops",
".",
"SparseTensor",
")",
":",
"raise",
"TypeError",
"(",
"\"Input must be a SparseTensor\"",
")",... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/sparse_ops.py#L1014-L1091 | ||
nyuwireless-unipd/ns3-mmwave | 4ff9e87e8079764e04cbeccd8e85bff15ae16fb3 | src/visualizer/visualizer/ipython_view.py | python | IPythonView.raw_input | (self, prompt='') | return self.getCurrentLine() | !
Custom raw_input() replacement. Gets current line from console buffer.
@param prompt: Prompt to print. Here for compatibility as replacement.
@return The current command line text. | !
Custom raw_input() replacement. Gets current line from console buffer. | [
"!",
"Custom",
"raw_input",
"()",
"replacement",
".",
"Gets",
"current",
"line",
"from",
"console",
"buffer",
"."
] | def raw_input(self, prompt=''):
"""!
Custom raw_input() replacement. Gets current line from console buffer.
@param prompt: Prompt to print. Here for compatibility as replacement.
@return The current command line text.
"""
if self.interrupt:
self.interrupt = False
raise KeyboardI... | [
"def",
"raw_input",
"(",
"self",
",",
"prompt",
"=",
"''",
")",
":",
"if",
"self",
".",
"interrupt",
":",
"self",
".",
"interrupt",
"=",
"False",
"raise",
"KeyboardInterrupt",
"return",
"self",
".",
"getCurrentLine",
"(",
")"
] | https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/src/visualizer/visualizer/ipython_view.py#L599-L609 | |
BVLC/caffe | 9b891540183ddc834a02b2bd81b31afae71b2153 | python/caffe/coord_map.py | python | inverse | (coord_map) | return ax, 1 / a, -b / a | Invert a coord map by de-scaling and un-shifting;
this gives the backward mapping for the gradient. | Invert a coord map by de-scaling and un-shifting;
this gives the backward mapping for the gradient. | [
"Invert",
"a",
"coord",
"map",
"by",
"de",
"-",
"scaling",
"and",
"un",
"-",
"shifting",
";",
"this",
"gives",
"the",
"backward",
"mapping",
"for",
"the",
"gradient",
"."
] | def inverse(coord_map):
"""
Invert a coord map by de-scaling and un-shifting;
this gives the backward mapping for the gradient.
"""
ax, a, b = coord_map
return ax, 1 / a, -b / a | [
"def",
"inverse",
"(",
"coord_map",
")",
":",
"ax",
",",
"a",
",",
"b",
"=",
"coord_map",
"return",
"ax",
",",
"1",
"/",
"a",
",",
"-",
"b",
"/",
"a"
] | https://github.com/BVLC/caffe/blob/9b891540183ddc834a02b2bd81b31afae71b2153/python/caffe/coord_map.py#L106-L112 | |
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/pymcuprog/avr8target.py | python | TinyXAvrTarget.activate_physical | (self, use_reset=False, user_interaction_callback=None) | Override function for high-voltage activation for UPDI
:param use_reset: Use external reset line during activation (only used for Mega JTAG interface)
:param user_interaction_callback: Callback to be called when user interaction is required,
for example when doing UPDI high-voltage activati... | Override function for high-voltage activation for UPDI | [
"Override",
"function",
"for",
"high",
"-",
"voltage",
"activation",
"for",
"UPDI"
] | def activate_physical(self, use_reset=False, user_interaction_callback=None):
"""
Override function for high-voltage activation for UPDI
:param use_reset: Use external reset line during activation (only used for Mega JTAG interface)
:param user_interaction_callback: Callback to be calle... | [
"def",
"activate_physical",
"(",
"self",
",",
"use_reset",
"=",
"False",
",",
"user_interaction_callback",
"=",
"None",
")",
":",
"try",
":",
"return",
"self",
".",
"protocol",
".",
"activate_physical",
"(",
"use_reset",
")",
"except",
"Jtagice3ResponseError",
"... | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/pymcuprog/avr8target.py#L347-L374 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | TextEntryBase.GetMargins | (*args, **kwargs) | return _core_.TextEntryBase_GetMargins(*args, **kwargs) | GetMargins(self) -> Point | GetMargins(self) -> Point | [
"GetMargins",
"(",
"self",
")",
"-",
">",
"Point"
] | def GetMargins(*args, **kwargs):
"""GetMargins(self) -> Point"""
return _core_.TextEntryBase_GetMargins(*args, **kwargs) | [
"def",
"GetMargins",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"TextEntryBase_GetMargins",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L13357-L13359 | |
pytorch/ELF | e851e786ced8d26cf470f08a6b9bf7e413fc63f7 | src_py/rlpytorch/utils/fp16_utils.py | python | apply_nonrecursive | (module, fn) | return module | Applies a given function only to parameters and buffers of a module.
Adapted from torch.nn.Module._apply. | Applies a given function only to parameters and buffers of a module. | [
"Applies",
"a",
"given",
"function",
"only",
"to",
"parameters",
"and",
"buffers",
"of",
"a",
"module",
"."
] | def apply_nonrecursive(module, fn):
"""Applies a given function only to parameters and buffers of a module.
Adapted from torch.nn.Module._apply.
"""
for param in module._parameters.values():
if param is not None:
# Tensors stored in modules are graph leaves, and we don't
... | [
"def",
"apply_nonrecursive",
"(",
"module",
",",
"fn",
")",
":",
"for",
"param",
"in",
"module",
".",
"_parameters",
".",
"values",
"(",
")",
":",
"if",
"param",
"is",
"not",
"None",
":",
"# Tensors stored in modules are graph leaves, and we don't",
"# want to cre... | https://github.com/pytorch/ELF/blob/e851e786ced8d26cf470f08a6b9bf7e413fc63f7/src_py/rlpytorch/utils/fp16_utils.py#L11-L28 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/sunf95.py | python | generate | (env) | Add Builders and construction variables for sunf95 to an
Environment. | Add Builders and construction variables for sunf95 to an
Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"sunf95",
"to",
"an",
"Environment",
"."
] | def generate(env):
"""Add Builders and construction variables for sunf95 to an
Environment."""
add_all_to_env(env)
fcomp = env.Detect(compilers) or 'f95'
env['FORTRAN'] = fcomp
env['F95'] = fcomp
env['SHFORTRAN'] = '$FORTRAN'
env['SHF95'] = '$F95'
env['SHFORTRANFLAGS']... | [
"def",
"generate",
"(",
"env",
")",
":",
"add_all_to_env",
"(",
"env",
")",
"fcomp",
"=",
"env",
".",
"Detect",
"(",
"compilers",
")",
"or",
"'f95'",
"env",
"[",
"'FORTRAN'",
"]",
"=",
"fcomp",
"env",
"[",
"'F95'",
"]",
"=",
"fcomp",
"env",
"[",
"'... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/sunf95.py#L42-L55 | ||
modm-io/modm | 845840ec08566a3aa9c04167b1a18a56255afa4f | tools/xpcc_generator/xmlparser/type.py | python | BaseType.create_hierarchy | (self) | Create the type hierarchy
This method calculates the values for self.size and self.level. Must
not be called before all types are fully created. | Create the type hierarchy | [
"Create",
"the",
"type",
"hierarchy"
] | def create_hierarchy(self):
""" Create the type hierarchy
This method calculates the values for self.size and self.level. Must
not be called before all types are fully created.
"""
pass | [
"def",
"create_hierarchy",
"(",
"self",
")",
":",
"pass"
] | https://github.com/modm-io/modm/blob/845840ec08566a3aa9c04167b1a18a56255afa4f/tools/xpcc_generator/xmlparser/type.py#L77-L83 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/Maya_AnimationRiggingTools/MayaTools/General/Scripts/ART_skeletonBuilder_UI.py | python | SkeletonBuilder_UI.publish | (self, project, characterName, handCtrlSpace, *args) | cmds.select("root", hi = True)
joints = cmds.ls(sl = True)
for joint in joints:
cmds.setAttr(joint + ".rx", 0)
cmds.setAttr(joint + ".ry", 0)
cmds.setAttr(joint + ".rz", 0) | cmds.select("root", hi = True)
joints = cmds.ls(sl = True)
for joint in joints:
cmds.setAttr(joint + ".rx", 0)
cmds.setAttr(joint + ".ry", 0)
cmds.setAttr(joint + ".rz", 0) | [
"cmds",
".",
"select",
"(",
"root",
"hi",
"=",
"True",
")",
"joints",
"=",
"cmds",
".",
"ls",
"(",
"sl",
"=",
"True",
")",
"for",
"joint",
"in",
"joints",
":",
"cmds",
".",
"setAttr",
"(",
"joint",
"+",
".",
"rx",
"0",
")",
"cmds",
".",
"setAtt... | def publish(self, project, characterName, handCtrlSpace, *args):
sourceControl = False
#unlock joints
cmds.select("root", hi = True)
joints = cmds.ls(sl = True)
for joint in joints:
cmds.lockNode(joint, lock = False)
#clear any keys on the joints
c... | [
"def",
"publish",
"(",
"self",
",",
"project",
",",
"characterName",
",",
"handCtrlSpace",
",",
"*",
"args",
")",
":",
"sourceControl",
"=",
"False",
"#unlock joints",
"cmds",
".",
"select",
"(",
"\"root\"",
",",
"hi",
"=",
"True",
")",
"joints",
"=",
"c... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/Maya_AnimationRiggingTools/MayaTools/General/Scripts/ART_skeletonBuilder_UI.py#L7358-L7692 | ||
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | External/pymol/modules/pymol/rpc.py | python | rpcIdentify | (what='all', mode=0) | return cmd.identify(what, mode=mode) | returns the results of cmd.identify(what,mode) | returns the results of cmd.identify(what,mode) | [
"returns",
"the",
"results",
"of",
"cmd",
".",
"identify",
"(",
"what",
"mode",
")"
] | def rpcIdentify(what='all', mode=0):
""" returns the results of cmd.identify(what,mode) """
return cmd.identify(what, mode=mode) | [
"def",
"rpcIdentify",
"(",
"what",
"=",
"'all'",
",",
"mode",
"=",
"0",
")",
":",
"return",
"cmd",
".",
"identify",
"(",
"what",
",",
"mode",
"=",
"mode",
")"
] | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/External/pymol/modules/pymol/rpc.py#L519-L521 | |
wujian16/Cornell-MOE | df299d1be882d2af9796d7a68b3f9505cac7a53e | moe/optimal_learning/python/python_version/optimization.py | python | GradientDescentOptimizer.__init__ | (self, domain, optimizable, optimizer_parameters, num_random_samples=None) | Construct a GradientDescentOptimizer.
:param domain: the domain that this optimizer operates over
:type domain: interfaces.domain_interface.DomainInterface subclass
:param optimizable: object representing the objective function being optimized
:type optimizable: interfaces.optimization_... | Construct a GradientDescentOptimizer. | [
"Construct",
"a",
"GradientDescentOptimizer",
"."
] | def __init__(self, domain, optimizable, optimizer_parameters, num_random_samples=None):
"""Construct a GradientDescentOptimizer.
:param domain: the domain that this optimizer operates over
:type domain: interfaces.domain_interface.DomainInterface subclass
:param optimizable: object repr... | [
"def",
"__init__",
"(",
"self",
",",
"domain",
",",
"optimizable",
",",
"optimizer_parameters",
",",
"num_random_samples",
"=",
"None",
")",
":",
"self",
".",
"domain",
"=",
"domain",
"self",
".",
"objective_function",
"=",
"optimizable",
"self",
".",
"optimiz... | https://github.com/wujian16/Cornell-MOE/blob/df299d1be882d2af9796d7a68b3f9505cac7a53e/moe/optimal_learning/python/python_version/optimization.py#L400-L413 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py | python | EncodeRspFileList | (args) | return program + ' ' + ' '.join(QuoteForRspFile(arg) for arg in args[1:]) | Process a list of arguments using QuoteCmdExeArgument. | Process a list of arguments using QuoteCmdExeArgument. | [
"Process",
"a",
"list",
"of",
"arguments",
"using",
"QuoteCmdExeArgument",
"."
] | def EncodeRspFileList(args):
"""Process a list of arguments using QuoteCmdExeArgument."""
# Note that the first argument is assumed to be the command. Don't add
# quotes around it because then built-ins like 'echo', etc. won't work.
# Take care to normpath only the path in the case of 'call ../x.bat' because
... | [
"def",
"EncodeRspFileList",
"(",
"args",
")",
":",
"# Note that the first argument is assumed to be the command. Don't add",
"# quotes around it because then built-ins like 'echo', etc. won't work.",
"# Take care to normpath only the path in the case of 'call ../x.bat' because",
"# otherwise the w... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py#L53-L66 | |
openmm/openmm | cb293447c4fc8b03976dfe11399f107bab70f3d9 | wrappers/python/openmm/app/internal/amber_file_parser.py | python | PrmtopLoader.getUreyBradleys | (self) | return self._ureyBradleyList | Return list of atom pairs, K, and Rmin for each Urey-Bradley term | Return list of atom pairs, K, and Rmin for each Urey-Bradley term | [
"Return",
"list",
"of",
"atom",
"pairs",
"K",
"and",
"Rmin",
"for",
"each",
"Urey",
"-",
"Bradley",
"term"
] | def getUreyBradleys(self):
"""Return list of atom pairs, K, and Rmin for each Urey-Bradley term"""
try:
return self._ureyBradleyList
except AttributeError:
pass
self._ureyBradleyList = []
if 'CHARMM_UREY_BRADLEY' in self._raw_data:
ureyBradleyP... | [
"def",
"getUreyBradleys",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_ureyBradleyList",
"except",
"AttributeError",
":",
"pass",
"self",
".",
"_ureyBradleyList",
"=",
"[",
"]",
"if",
"'CHARMM_UREY_BRADLEY'",
"in",
"self",
".",
"_raw_data",
":",... | https://github.com/openmm/openmm/blob/cb293447c4fc8b03976dfe11399f107bab70f3d9/wrappers/python/openmm/app/internal/amber_file_parser.py#L432-L454 | |
apache/madlib | be297fe6beada0640f93317e8948834032718e32 | src/madpack/madpack.py | python | _db_rename_schema | (from_schema, to_schema) | Rename schema
@param from_schema name of the schema to rename
@param to_schema new name for the schema | Rename schema | [
"Rename",
"schema"
] | def _db_rename_schema(from_schema, to_schema):
"""
Rename schema
@param from_schema name of the schema to rename
@param to_schema new name for the schema
"""
info_(this, "> Renaming schema %s to %s" % (from_schema, to_schema), True)
try:
_internal_run_query("ALTER SCHEMA %s ... | [
"def",
"_db_rename_schema",
"(",
"from_schema",
",",
"to_schema",
")",
":",
"info_",
"(",
"this",
",",
"\"> Renaming schema %s to %s\"",
"%",
"(",
"from_schema",
",",
"to_schema",
")",
",",
"True",
")",
"try",
":",
"_internal_run_query",
"(",
"\"ALTER SCHEMA %s RE... | https://github.com/apache/madlib/blob/be297fe6beada0640f93317e8948834032718e32/src/madpack/madpack.py#L577-L589 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.