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
sequence | function
stringlengths 34
151k
| function_tokens
sequence | url
stringlengths 90
278
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/_config/config.py | python | _build_option_description | (k) | return s | Builds a formatted description of a registered option and prints it | Builds a formatted description of a registered option and prints it | [
"Builds",
"a",
"formatted",
"description",
"of",
"a",
"registered",
"option",
"and",
"prints",
"it"
] | def _build_option_description(k):
""" Builds a formatted description of a registered option and prints it """
o = _get_registered_option(k)
d = _get_deprecated_option(k)
s = f"{k} "
if o.doc:
s += "\n".join(o.doc.strip().split("\n"))
else:
s += "No description available."
if o:
s += f"\n [default: {o.defval}] [currently: {_get_option(k, True)}]"
if d:
rkey = d.rkey if d.rkey else ""
s += "\n (Deprecated"
s += f", use `{rkey}` instead."
s += ")"
return s | [
"def",
"_build_option_description",
"(",
"k",
")",
":",
"o",
"=",
"_get_registered_option",
"(",
"k",
")",
"d",
"=",
"_get_deprecated_option",
"(",
"k",
")",
"s",
"=",
"f\"{k} \"",
"if",
"o",
".",
"doc",
":",
"s",
"+=",
"\"\\n\"",
".",
"join",
"(",
"o",
".",
"doc",
".",
"strip",
"(",
")",
".",
"split",
"(",
"\"\\n\"",
")",
")",
"else",
":",
"s",
"+=",
"\"No description available.\"",
"if",
"o",
":",
"s",
"+=",
"f\"\\n [default: {o.defval}] [currently: {_get_option(k, True)}]\"",
"if",
"d",
":",
"rkey",
"=",
"d",
".",
"rkey",
"if",
"d",
".",
"rkey",
"else",
"\"\"",
"s",
"+=",
"\"\\n (Deprecated\"",
"s",
"+=",
"f\", use `{rkey}` instead.\"",
"s",
"+=",
"\")\"",
"return",
"s"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/_config/config.py#L635-L657 |
|
Illumina/strelka | d7377443b62319f7c7bd70c241c4b2df3459e29a | src/python/lib/checkChromSet.py | python | getTabixChromSet | (tabixBin, tabixFile) | return chromSet | Return the set of chromosomes from any tabix-indexed file | Return the set of chromosomes from any tabix-indexed file | [
"Return",
"the",
"set",
"of",
"chromosomes",
"from",
"any",
"tabix",
"-",
"indexed",
"file"
] | def getTabixChromSet(tabixBin, tabixFile) :
"""
Return the set of chromosomes from any tabix-indexed file
"""
import subprocess
chromSet = set()
tabixCmd = [tabixBin, "-l", tabixFile]
proc=subprocess.Popen(tabixCmd, stdout=subprocess.PIPE)
for line in proc.stdout :
chrom = line.strip()
chromSet.add(chrom)
proc.stdout.close()
proc.wait()
return chromSet | [
"def",
"getTabixChromSet",
"(",
"tabixBin",
",",
"tabixFile",
")",
":",
"import",
"subprocess",
"chromSet",
"=",
"set",
"(",
")",
"tabixCmd",
"=",
"[",
"tabixBin",
",",
"\"-l\"",
",",
"tabixFile",
"]",
"proc",
"=",
"subprocess",
".",
"Popen",
"(",
"tabixCmd",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
")",
"for",
"line",
"in",
"proc",
".",
"stdout",
":",
"chrom",
"=",
"line",
".",
"strip",
"(",
")",
"chromSet",
".",
"add",
"(",
"chrom",
")",
"proc",
".",
"stdout",
".",
"close",
"(",
")",
"proc",
".",
"wait",
"(",
")",
"return",
"chromSet"
] | https://github.com/Illumina/strelka/blob/d7377443b62319f7c7bd70c241c4b2df3459e29a/src/python/lib/checkChromSet.py#L103-L119 |
|
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/__init__.py | python | _assert_pid_not_reused | (fun) | return wrapper | Decorator which raises NoSuchProcess in case a process is no
longer running or its PID has been reused. | Decorator which raises NoSuchProcess in case a process is no
longer running or its PID has been reused. | [
"Decorator",
"which",
"raises",
"NoSuchProcess",
"in",
"case",
"a",
"process",
"is",
"no",
"longer",
"running",
"or",
"its",
"PID",
"has",
"been",
"reused",
"."
] | def _assert_pid_not_reused(fun):
"""Decorator which raises NoSuchProcess in case a process is no
longer running or its PID has been reused.
"""
@_wraps(fun)
def wrapper(self, *args, **kwargs):
if not self.is_running():
raise NoSuchProcess(self.pid, self._name)
return fun(self, *args, **kwargs)
return wrapper | [
"def",
"_assert_pid_not_reused",
"(",
"fun",
")",
":",
"@",
"_wraps",
"(",
"fun",
")",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"is_running",
"(",
")",
":",
"raise",
"NoSuchProcess",
"(",
"self",
".",
"pid",
",",
"self",
".",
"_name",
")",
"return",
"fun",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"wrapper"
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/__init__.py#L250-L259 |
|
omnisci/omniscidb | b9c95f1bd602b4ffc8b0edf18bfad61031e08d86 | Benchmarks/synthetic_benchmark/create_table.py | python | Column.createColumnDetailsString | (self) | return result | Returns the ColumnDetails as expected by pymapd's API | Returns the ColumnDetails as expected by pymapd's API | [
"Returns",
"the",
"ColumnDetails",
"as",
"expected",
"by",
"pymapd",
"s",
"API"
] | def createColumnDetailsString(self):
"""
Returns the ColumnDetails as expected by pymapd's API
"""
result = "ColumnDetails(name='"
result += self.column_name
result += "', type='"
result += self.sql_type.upper()
result += "', nullable=True, precision=0, scale=0, comp_param=0, encoding='NONE', is_array=False)"
return result | [
"def",
"createColumnDetailsString",
"(",
"self",
")",
":",
"result",
"=",
"\"ColumnDetails(name='\"",
"result",
"+=",
"self",
".",
"column_name",
"result",
"+=",
"\"', type='\"",
"result",
"+=",
"self",
".",
"sql_type",
".",
"upper",
"(",
")",
"result",
"+=",
"\"', nullable=True, precision=0, scale=0, comp_param=0, encoding='NONE', is_array=False)\"",
"return",
"result"
] | https://github.com/omnisci/omniscidb/blob/b9c95f1bd602b4ffc8b0edf18bfad61031e08d86/Benchmarks/synthetic_benchmark/create_table.py#L35-L44 |
|
nyuwireless-unipd/ns3-mmwave | 4ff9e87e8079764e04cbeccd8e85bff15ae16fb3 | utils/grid.py | python | TimelineEvent.get_bounds | (self) | ! Get Bounds
@param self this object
@return the bounds | ! Get Bounds | [
"!",
"Get",
"Bounds"
] | def get_bounds(self):
"""! Get Bounds
@param self this object
@return the bounds
"""
if len(self.events) > 0:
lo = self.events[0].at
hi = self.events[-1].at
return(lo, hi)
else:
return(0, 0) | [
"def",
"get_bounds",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"events",
")",
">",
"0",
":",
"lo",
"=",
"self",
".",
"events",
"[",
"0",
"]",
".",
"at",
"hi",
"=",
"self",
".",
"events",
"[",
"-",
"1",
"]",
".",
"at",
"return",
"(",
"lo",
",",
"hi",
")",
"else",
":",
"return",
"(",
"0",
",",
"0",
")"
] | https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/utils/grid.py#L252-L262 |
||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py | python | load_cdll | (name, macos10_16_path) | Loads a CDLL by name, falling back to known path on 10.16+ | Loads a CDLL by name, falling back to known path on 10.16+ | [
"Loads",
"a",
"CDLL",
"by",
"name",
"falling",
"back",
"to",
"known",
"path",
"on",
"10",
".",
"16",
"+"
] | def load_cdll(name, macos10_16_path):
"""Loads a CDLL by name, falling back to known path on 10.16+"""
try:
# Big Sur is technically 11 but we use 10.16 due to the Big Sur
# beta being labeled as 10.16.
if version_info >= (10, 16):
path = macos10_16_path
else:
path = find_library(name)
if not path:
raise OSError # Caught and reraised as 'ImportError'
return CDLL(path, use_errno=True)
except OSError:
raise_from(ImportError("The library %s failed to load" % name), None) | [
"def",
"load_cdll",
"(",
"name",
",",
"macos10_16_path",
")",
":",
"try",
":",
"# Big Sur is technically 11 but we use 10.16 due to the Big Sur",
"# beta being labeled as 10.16.",
"if",
"version_info",
">=",
"(",
"10",
",",
"16",
")",
":",
"path",
"=",
"macos10_16_path",
"else",
":",
"path",
"=",
"find_library",
"(",
"name",
")",
"if",
"not",
"path",
":",
"raise",
"OSError",
"# Caught and reraised as 'ImportError'",
"return",
"CDLL",
"(",
"path",
",",
"use_errno",
"=",
"True",
")",
"except",
"OSError",
":",
"raise_from",
"(",
"ImportError",
"(",
"\"The library %s failed to load\"",
"%",
"name",
")",
",",
"None",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py#L65-L78 |
||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | SashWindow.SashHitTest | (*args, **kwargs) | return _windows_.SashWindow_SashHitTest(*args, **kwargs) | SashHitTest(self, int x, int y, int tolerance=2) -> int | SashHitTest(self, int x, int y, int tolerance=2) -> int | [
"SashHitTest",
"(",
"self",
"int",
"x",
"int",
"y",
"int",
"tolerance",
"=",
"2",
")",
"-",
">",
"int"
] | def SashHitTest(*args, **kwargs):
"""SashHitTest(self, int x, int y, int tolerance=2) -> int"""
return _windows_.SashWindow_SashHitTest(*args, **kwargs) | [
"def",
"SashHitTest",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"SashWindow_SashHitTest",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L1870-L1872 |
|
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/math_ops.py | python | reduce_min | (input_tensor, axis=None, keepdims=False, name=None) | return _may_reduce_to_scalar(
keepdims, axis,
gen_math_ops._min(
input_tensor, _ReductionDims(input_tensor, axis), keepdims,
name=name)) | Computes the `tf.math.minimum` of elements across dimensions of a tensor.
This is the reduction operation for the elementwise `tf.math.minimum` op.
Reduces `input_tensor` along the dimensions given in `axis`.
Unless `keepdims` is true, the rank of the tensor is reduced by 1 for each
of the entries in `axis`, which must be unique. If `keepdims` is true, the
reduced dimensions are retained with length 1.
If `axis` is None, all dimensions are reduced, and a
tensor with a single element is returned.
For example:
>>> a = tf.constant([
... [[1, 2], [3, 4]],
... [[1, 2], [3, 4]]
... ])
>>> tf.reduce_min(a)
<tf.Tensor: shape=(), dtype=int32, numpy=1>
Choosing a specific axis returns minimum element in the given axis:
>>> b = tf.constant([[1, 2, 3], [4, 5, 6]])
>>> tf.reduce_min(b, axis=0)
<tf.Tensor: shape=(3,), dtype=int32, numpy=array([1, 2, 3], dtype=int32)>
>>> tf.reduce_min(b, axis=1)
<tf.Tensor: shape=(2,), dtype=int32, numpy=array([1, 4], dtype=int32)>
Setting `keepdims` to `True` retains the dimension of `input_tensor`:
>>> tf.reduce_min(a, keepdims=True)
<tf.Tensor: shape=(1, 1, 1), dtype=int32, numpy=array([[[1]]], dtype=int32)>
>>> tf.math.reduce_min(a, axis=0, keepdims=True)
<tf.Tensor: shape=(1, 2, 2), dtype=int32, numpy=
array([[[1, 2],
[3, 4]]], dtype=int32)>
Args:
input_tensor: The tensor to reduce. Should have real numeric type.
axis: The dimensions to reduce. If `None` (the default), reduces all
dimensions. Must be in the range `[-rank(input_tensor),
rank(input_tensor))`.
keepdims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
Returns:
The reduced tensor.
@compatibility(numpy)
Equivalent to np.min
@end_compatibility | Computes the `tf.math.minimum` of elements across dimensions of a tensor. | [
"Computes",
"the",
"tf",
".",
"math",
".",
"minimum",
"of",
"elements",
"across",
"dimensions",
"of",
"a",
"tensor",
"."
] | def reduce_min(input_tensor, axis=None, keepdims=False, name=None):
"""Computes the `tf.math.minimum` of elements across dimensions of a tensor.
This is the reduction operation for the elementwise `tf.math.minimum` op.
Reduces `input_tensor` along the dimensions given in `axis`.
Unless `keepdims` is true, the rank of the tensor is reduced by 1 for each
of the entries in `axis`, which must be unique. If `keepdims` is true, the
reduced dimensions are retained with length 1.
If `axis` is None, all dimensions are reduced, and a
tensor with a single element is returned.
For example:
>>> a = tf.constant([
... [[1, 2], [3, 4]],
... [[1, 2], [3, 4]]
... ])
>>> tf.reduce_min(a)
<tf.Tensor: shape=(), dtype=int32, numpy=1>
Choosing a specific axis returns minimum element in the given axis:
>>> b = tf.constant([[1, 2, 3], [4, 5, 6]])
>>> tf.reduce_min(b, axis=0)
<tf.Tensor: shape=(3,), dtype=int32, numpy=array([1, 2, 3], dtype=int32)>
>>> tf.reduce_min(b, axis=1)
<tf.Tensor: shape=(2,), dtype=int32, numpy=array([1, 4], dtype=int32)>
Setting `keepdims` to `True` retains the dimension of `input_tensor`:
>>> tf.reduce_min(a, keepdims=True)
<tf.Tensor: shape=(1, 1, 1), dtype=int32, numpy=array([[[1]]], dtype=int32)>
>>> tf.math.reduce_min(a, axis=0, keepdims=True)
<tf.Tensor: shape=(1, 2, 2), dtype=int32, numpy=
array([[[1, 2],
[3, 4]]], dtype=int32)>
Args:
input_tensor: The tensor to reduce. Should have real numeric type.
axis: The dimensions to reduce. If `None` (the default), reduces all
dimensions. Must be in the range `[-rank(input_tensor),
rank(input_tensor))`.
keepdims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
Returns:
The reduced tensor.
@compatibility(numpy)
Equivalent to np.min
@end_compatibility
"""
keepdims = False if keepdims is None else bool(keepdims)
return _may_reduce_to_scalar(
keepdims, axis,
gen_math_ops._min(
input_tensor, _ReductionDims(input_tensor, axis), keepdims,
name=name)) | [
"def",
"reduce_min",
"(",
"input_tensor",
",",
"axis",
"=",
"None",
",",
"keepdims",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"keepdims",
"=",
"False",
"if",
"keepdims",
"is",
"None",
"else",
"bool",
"(",
"keepdims",
")",
"return",
"_may_reduce_to_scalar",
"(",
"keepdims",
",",
"axis",
",",
"gen_math_ops",
".",
"_min",
"(",
"input_tensor",
",",
"_ReductionDims",
"(",
"input_tensor",
",",
"axis",
")",
",",
"keepdims",
",",
"name",
"=",
"name",
")",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/math_ops.py#L2932-L2991 |
|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/operator.py | python | ipow | (a, b) | return a | Same as a **= b. | Same as a **= b. | [
"Same",
"as",
"a",
"**",
"=",
"b",
"."
] | def ipow(a, b):
"Same as a **= b."
a **=b
return a | [
"def",
"ipow",
"(",
"a",
",",
"b",
")",
":",
"a",
"**=",
"b",
"return",
"a"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/operator.py#L385-L388 |
|
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/model_fitting/model_fitting_model.py | python | ModelFittingModel.y_parameters | (self) | return list(self.fitting_context.y_parameters.keys()) | Returns the Y parameters that are stored by the fitting context. | Returns the Y parameters that are stored by the fitting context. | [
"Returns",
"the",
"Y",
"parameters",
"that",
"are",
"stored",
"by",
"the",
"fitting",
"context",
"."
] | def y_parameters(self) -> list:
"""Returns the Y parameters that are stored by the fitting context."""
return list(self.fitting_context.y_parameters.keys()) | [
"def",
"y_parameters",
"(",
"self",
")",
"->",
"list",
":",
"return",
"list",
"(",
"self",
".",
"fitting_context",
".",
"y_parameters",
".",
"keys",
"(",
")",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/model_fitting/model_fitting_model.py#L63-L65 |
|
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | PyPickerBase.SetTextCtrl | (*args, **kwargs) | return _controls_.PyPickerBase_SetTextCtrl(*args, **kwargs) | SetTextCtrl(self, TextCtrl text) | SetTextCtrl(self, TextCtrl text) | [
"SetTextCtrl",
"(",
"self",
"TextCtrl",
"text",
")"
] | def SetTextCtrl(*args, **kwargs):
"""SetTextCtrl(self, TextCtrl text)"""
return _controls_.PyPickerBase_SetTextCtrl(*args, **kwargs) | [
"def",
"SetTextCtrl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"PyPickerBase_SetTextCtrl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L6880-L6882 |
|
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/dask_cudf/dask_cudf/io/parquet.py | python | read_parquet | (
path,
columns=None,
split_row_groups=None,
row_groups_per_part=None,
**kwargs,
) | return dd.read_parquet(
path,
columns=columns,
split_row_groups=split_row_groups,
engine=CudfEngine,
**kwargs,
) | Read parquet files into a Dask DataFrame
Calls ``dask.dataframe.read_parquet`` to cordinate the execution of
``cudf.read_parquet``, and ultimately read multiple partitions into
a single Dask dataframe. The Dask version must supply an
``ArrowDatasetEngine`` class to support full functionality.
See ``cudf.read_parquet`` and Dask documentation for further details.
Examples
--------
>>> import dask_cudf
>>> df = dask_cudf.read_parquet("/path/to/dataset/") # doctest: +SKIP
See Also
--------
cudf.read_parquet | Read parquet files into a Dask DataFrame | [
"Read",
"parquet",
"files",
"into",
"a",
"Dask",
"DataFrame"
] | def read_parquet(
path,
columns=None,
split_row_groups=None,
row_groups_per_part=None,
**kwargs,
):
"""Read parquet files into a Dask DataFrame
Calls ``dask.dataframe.read_parquet`` to cordinate the execution of
``cudf.read_parquet``, and ultimately read multiple partitions into
a single Dask dataframe. The Dask version must supply an
``ArrowDatasetEngine`` class to support full functionality.
See ``cudf.read_parquet`` and Dask documentation for further details.
Examples
--------
>>> import dask_cudf
>>> df = dask_cudf.read_parquet("/path/to/dataset/") # doctest: +SKIP
See Also
--------
cudf.read_parquet
"""
if isinstance(columns, str):
columns = [columns]
if row_groups_per_part:
warnings.warn(
"row_groups_per_part is deprecated. "
"Pass an integer value to split_row_groups instead.",
FutureWarning,
)
if split_row_groups is None:
split_row_groups = row_groups_per_part
return dd.read_parquet(
path,
columns=columns,
split_row_groups=split_row_groups,
engine=CudfEngine,
**kwargs,
) | [
"def",
"read_parquet",
"(",
"path",
",",
"columns",
"=",
"None",
",",
"split_row_groups",
"=",
"None",
",",
"row_groups_per_part",
"=",
"None",
",",
"*",
"*",
"kwargs",
",",
")",
":",
"if",
"isinstance",
"(",
"columns",
",",
"str",
")",
":",
"columns",
"=",
"[",
"columns",
"]",
"if",
"row_groups_per_part",
":",
"warnings",
".",
"warn",
"(",
"\"row_groups_per_part is deprecated. \"",
"\"Pass an integer value to split_row_groups instead.\"",
",",
"FutureWarning",
",",
")",
"if",
"split_row_groups",
"is",
"None",
":",
"split_row_groups",
"=",
"row_groups_per_part",
"return",
"dd",
".",
"read_parquet",
"(",
"path",
",",
"columns",
"=",
"columns",
",",
"split_row_groups",
"=",
"split_row_groups",
",",
"engine",
"=",
"CudfEngine",
",",
"*",
"*",
"kwargs",
",",
")"
] | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/dask_cudf/dask_cudf/io/parquet.py#L351-L393 |
|
dfm/celerite | 62c8ce6f5816c655ad2a2d1b3eaaaf9fc7ca7908 | celerite/modeling.py | python | Model.log_prior | (self) | return 0.0 | Compute the log prior probability of the current parameters | Compute the log prior probability of the current parameters | [
"Compute",
"the",
"log",
"prior",
"probability",
"of",
"the",
"current",
"parameters"
] | def log_prior(self):
"""Compute the log prior probability of the current parameters"""
for p, b in zip(self.parameter_vector, self.parameter_bounds):
if b[0] is not None and p < b[0]:
return -np.inf
if b[1] is not None and p > b[1]:
return -np.inf
return 0.0 | [
"def",
"log_prior",
"(",
"self",
")",
":",
"for",
"p",
",",
"b",
"in",
"zip",
"(",
"self",
".",
"parameter_vector",
",",
"self",
".",
"parameter_bounds",
")",
":",
"if",
"b",
"[",
"0",
"]",
"is",
"not",
"None",
"and",
"p",
"<",
"b",
"[",
"0",
"]",
":",
"return",
"-",
"np",
".",
"inf",
"if",
"b",
"[",
"1",
"]",
"is",
"not",
"None",
"and",
"p",
">",
"b",
"[",
"1",
"]",
":",
"return",
"-",
"np",
".",
"inf",
"return",
"0.0"
] | https://github.com/dfm/celerite/blob/62c8ce6f5816c655ad2a2d1b3eaaaf9fc7ca7908/celerite/modeling.py#L299-L306 |
|
microsoft/ELL | a1d6bacc37a14879cc025d9be2ba40b1a0632315 | tools/utilities/pythonlibs/audio/view_audio.py | python | AudioDemo.init_ui | (self) | setup the GUI for the app | setup the GUI for the app | [
"setup",
"the",
"GUI",
"for",
"the",
"app"
] | def init_ui(self):
""" setup the GUI for the app """
self.master.title("Test")
self.pack(fill=BOTH, expand=True)
# Input section
input_frame = LabelFrame(self, text="Input")
input_frame.bind("-", self.on_minus_key)
input_frame.bind("+", self.on_plus_key)
input_frame.pack(fill=X)
self.play_button = Button(input_frame, text="Play", command=self.on_play_button_click)
self.play_button.pack(side=RIGHT, padx=4)
self.rgb_canvas = tk.Canvas(input_frame, width=20, height=20, bd=0)
self.rgb_oval = self.rgb_canvas.create_oval(2, 2, 20, 20, fill='#FF0000', width=0)
self.rgb_canvas.pack(side=RIGHT, padx=4)
self.rec_button = Button(input_frame, text="Rec", command=self.on_rec_button_click)
self.rec_button.pack(side=RIGHT, padx=4)
self.wav_filename_entry = Entry(input_frame, width=24)
self.wav_filename_entry.pack(fill=X)
self.wav_filename_entry.delete(0, END)
if self.wav_filename:
self.wav_filename_entry.insert(0, self.wav_filename)
# Feature section
features_frame = LabelFrame(self, text="Features")
features_frame.pack(fill=X)
features_control_frame = Frame(features_frame)
features_control_frame.pack(fill=X)
load_features_button = Button(features_control_frame, text="Load", command=self.on_load_featurizer_model)
load_features_button.pack(side=RIGHT)
self.features_entry = Entry(features_control_frame, width=8)
self.features_entry.pack(fill=X)
self.features_entry.delete(0, END)
if self.featurizer_model:
self.features_entry.insert(0, self.featurizer_model)
self.spectrogram_widget = SpectrogramImage(features_frame)
self.spectrogram_widget.pack(fill=X)
# Classifier section
classifier_frame = LabelFrame(self, text="Classifier")
classifier_frame.pack(fill=X)
load_classifier_button = Button(classifier_frame, text="Load", command=self.on_load_classifier)
load_classifier_button.pack(side=RIGHT)
self.classifier_entry = Entry(classifier_frame, width=8)
self.classifier_entry.pack(fill=X)
self.classifier_entry.delete(0, END)
if self.classifier_model:
self.classifier_entry.insert(0, self.classifier_model)
# Output section
output_frame = LabelFrame(self, text="Output")
output_frame.pack(fill=BOTH, expand=True)
self.output_text = Text(output_frame)
self.output_text.pack(fill=BOTH, padx=4, expand=True) | [
"def",
"init_ui",
"(",
"self",
")",
":",
"self",
".",
"master",
".",
"title",
"(",
"\"Test\"",
")",
"self",
".",
"pack",
"(",
"fill",
"=",
"BOTH",
",",
"expand",
"=",
"True",
")",
"# Input section",
"input_frame",
"=",
"LabelFrame",
"(",
"self",
",",
"text",
"=",
"\"Input\"",
")",
"input_frame",
".",
"bind",
"(",
"\"-\"",
",",
"self",
".",
"on_minus_key",
")",
"input_frame",
".",
"bind",
"(",
"\"+\"",
",",
"self",
".",
"on_plus_key",
")",
"input_frame",
".",
"pack",
"(",
"fill",
"=",
"X",
")",
"self",
".",
"play_button",
"=",
"Button",
"(",
"input_frame",
",",
"text",
"=",
"\"Play\"",
",",
"command",
"=",
"self",
".",
"on_play_button_click",
")",
"self",
".",
"play_button",
".",
"pack",
"(",
"side",
"=",
"RIGHT",
",",
"padx",
"=",
"4",
")",
"self",
".",
"rgb_canvas",
"=",
"tk",
".",
"Canvas",
"(",
"input_frame",
",",
"width",
"=",
"20",
",",
"height",
"=",
"20",
",",
"bd",
"=",
"0",
")",
"self",
".",
"rgb_oval",
"=",
"self",
".",
"rgb_canvas",
".",
"create_oval",
"(",
"2",
",",
"2",
",",
"20",
",",
"20",
",",
"fill",
"=",
"'#FF0000'",
",",
"width",
"=",
"0",
")",
"self",
".",
"rgb_canvas",
".",
"pack",
"(",
"side",
"=",
"RIGHT",
",",
"padx",
"=",
"4",
")",
"self",
".",
"rec_button",
"=",
"Button",
"(",
"input_frame",
",",
"text",
"=",
"\"Rec\"",
",",
"command",
"=",
"self",
".",
"on_rec_button_click",
")",
"self",
".",
"rec_button",
".",
"pack",
"(",
"side",
"=",
"RIGHT",
",",
"padx",
"=",
"4",
")",
"self",
".",
"wav_filename_entry",
"=",
"Entry",
"(",
"input_frame",
",",
"width",
"=",
"24",
")",
"self",
".",
"wav_filename_entry",
".",
"pack",
"(",
"fill",
"=",
"X",
")",
"self",
".",
"wav_filename_entry",
".",
"delete",
"(",
"0",
",",
"END",
")",
"if",
"self",
".",
"wav_filename",
":",
"self",
".",
"wav_filename_entry",
".",
"insert",
"(",
"0",
",",
"self",
".",
"wav_filename",
")",
"# Feature section",
"features_frame",
"=",
"LabelFrame",
"(",
"self",
",",
"text",
"=",
"\"Features\"",
")",
"features_frame",
".",
"pack",
"(",
"fill",
"=",
"X",
")",
"features_control_frame",
"=",
"Frame",
"(",
"features_frame",
")",
"features_control_frame",
".",
"pack",
"(",
"fill",
"=",
"X",
")",
"load_features_button",
"=",
"Button",
"(",
"features_control_frame",
",",
"text",
"=",
"\"Load\"",
",",
"command",
"=",
"self",
".",
"on_load_featurizer_model",
")",
"load_features_button",
".",
"pack",
"(",
"side",
"=",
"RIGHT",
")",
"self",
".",
"features_entry",
"=",
"Entry",
"(",
"features_control_frame",
",",
"width",
"=",
"8",
")",
"self",
".",
"features_entry",
".",
"pack",
"(",
"fill",
"=",
"X",
")",
"self",
".",
"features_entry",
".",
"delete",
"(",
"0",
",",
"END",
")",
"if",
"self",
".",
"featurizer_model",
":",
"self",
".",
"features_entry",
".",
"insert",
"(",
"0",
",",
"self",
".",
"featurizer_model",
")",
"self",
".",
"spectrogram_widget",
"=",
"SpectrogramImage",
"(",
"features_frame",
")",
"self",
".",
"spectrogram_widget",
".",
"pack",
"(",
"fill",
"=",
"X",
")",
"# Classifier section",
"classifier_frame",
"=",
"LabelFrame",
"(",
"self",
",",
"text",
"=",
"\"Classifier\"",
")",
"classifier_frame",
".",
"pack",
"(",
"fill",
"=",
"X",
")",
"load_classifier_button",
"=",
"Button",
"(",
"classifier_frame",
",",
"text",
"=",
"\"Load\"",
",",
"command",
"=",
"self",
".",
"on_load_classifier",
")",
"load_classifier_button",
".",
"pack",
"(",
"side",
"=",
"RIGHT",
")",
"self",
".",
"classifier_entry",
"=",
"Entry",
"(",
"classifier_frame",
",",
"width",
"=",
"8",
")",
"self",
".",
"classifier_entry",
".",
"pack",
"(",
"fill",
"=",
"X",
")",
"self",
".",
"classifier_entry",
".",
"delete",
"(",
"0",
",",
"END",
")",
"if",
"self",
".",
"classifier_model",
":",
"self",
".",
"classifier_entry",
".",
"insert",
"(",
"0",
",",
"self",
".",
"classifier_model",
")",
"# Output section",
"output_frame",
"=",
"LabelFrame",
"(",
"self",
",",
"text",
"=",
"\"Output\"",
")",
"output_frame",
".",
"pack",
"(",
"fill",
"=",
"BOTH",
",",
"expand",
"=",
"True",
")",
"self",
".",
"output_text",
"=",
"Text",
"(",
"output_frame",
")",
"self",
".",
"output_text",
".",
"pack",
"(",
"fill",
"=",
"BOTH",
",",
"padx",
"=",
"4",
",",
"expand",
"=",
"True",
")"
] | https://github.com/microsoft/ELL/blob/a1d6bacc37a14879cc025d9be2ba40b1a0632315/tools/utilities/pythonlibs/audio/view_audio.py#L602-L661 |
||
telefonicaid/fiware-orion | 27c3202b9ddcfb9e3635a0af8d373f76e89b1d24 | scripts/utils/check_entity_existence_by_list.py | python | check_entities | (filename) | Check entities in filename
:param filename:
:return: | Check entities in filename
:param filename:
:return: | [
"Check",
"entities",
"in",
"filename",
":",
"param",
"filename",
":",
":",
"return",
":"
] | def check_entities(filename):
"""
Check entities in filename
:param filename:
:return:
"""
with open(filename, 'r') as file:
for line in file:
id = line.strip()
check_entity(id) | [
"def",
"check_entities",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"file",
":",
"for",
"line",
"in",
"file",
":",
"id",
"=",
"line",
".",
"strip",
"(",
")",
"check_entity",
"(",
"id",
")"
] | https://github.com/telefonicaid/fiware-orion/blob/27c3202b9ddcfb9e3635a0af8d373f76e89b1d24/scripts/utils/check_entity_existence_by_list.py#L77-L87 |
||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_pydecimal.py | python | Context.divide_int | (self, a, b) | Divides two numbers and returns the integer part of the result.
>>> ExtendedContext.divide_int(Decimal('2'), Decimal('3'))
Decimal('0')
>>> ExtendedContext.divide_int(Decimal('10'), Decimal('3'))
Decimal('3')
>>> ExtendedContext.divide_int(Decimal('1'), Decimal('0.3'))
Decimal('3')
>>> ExtendedContext.divide_int(10, 3)
Decimal('3')
>>> ExtendedContext.divide_int(Decimal(10), 3)
Decimal('3')
>>> ExtendedContext.divide_int(10, Decimal(3))
Decimal('3') | Divides two numbers and returns the integer part of the result. | [
"Divides",
"two",
"numbers",
"and",
"returns",
"the",
"integer",
"part",
"of",
"the",
"result",
"."
] | def divide_int(self, a, b):
"""Divides two numbers and returns the integer part of the result.
>>> ExtendedContext.divide_int(Decimal('2'), Decimal('3'))
Decimal('0')
>>> ExtendedContext.divide_int(Decimal('10'), Decimal('3'))
Decimal('3')
>>> ExtendedContext.divide_int(Decimal('1'), Decimal('0.3'))
Decimal('3')
>>> ExtendedContext.divide_int(10, 3)
Decimal('3')
>>> ExtendedContext.divide_int(Decimal(10), 3)
Decimal('3')
>>> ExtendedContext.divide_int(10, Decimal(3))
Decimal('3')
"""
a = _convert_other(a, raiseit=True)
r = a.__floordiv__(b, context=self)
if r is NotImplemented:
raise TypeError("Unable to convert %s to Decimal" % b)
else:
return r | [
"def",
"divide_int",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"r",
"=",
"a",
".",
"__floordiv__",
"(",
"b",
",",
"context",
"=",
"self",
")",
"if",
"r",
"is",
"NotImplemented",
":",
"raise",
"TypeError",
"(",
"\"Unable to convert %s to Decimal\"",
"%",
"b",
")",
"else",
":",
"return",
"r"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_pydecimal.py#L4395-L4416 |
||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | RegionIterator.__nonzero__ | (*args, **kwargs) | return _gdi_.RegionIterator___nonzero__(*args, **kwargs) | __nonzero__(self) -> bool | __nonzero__(self) -> bool | [
"__nonzero__",
"(",
"self",
")",
"-",
">",
"bool"
] | def __nonzero__(*args, **kwargs):
"""__nonzero__(self) -> bool"""
return _gdi_.RegionIterator___nonzero__(*args, **kwargs) | [
"def",
"__nonzero__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"RegionIterator___nonzero__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L1710-L1712 |
|
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | clang/utils/check_cfc/check_cfc.py | python | path_without_wrapper | () | return remove_dir_from_path(path, scriptdir) | Returns the PATH variable modified to remove the path to this program. | Returns the PATH variable modified to remove the path to this program. | [
"Returns",
"the",
"PATH",
"variable",
"modified",
"to",
"remove",
"the",
"path",
"to",
"this",
"program",
"."
] | def path_without_wrapper():
"""Returns the PATH variable modified to remove the path to this program."""
scriptdir = get_main_dir()
path = os.environ['PATH']
return remove_dir_from_path(path, scriptdir) | [
"def",
"path_without_wrapper",
"(",
")",
":",
"scriptdir",
"=",
"get_main_dir",
"(",
")",
"path",
"=",
"os",
".",
"environ",
"[",
"'PATH'",
"]",
"return",
"remove_dir_from_path",
"(",
"path",
",",
"scriptdir",
")"
] | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/clang/utils/check_cfc/check_cfc.py#L105-L109 |
|
carla-simulator/carla | 8854804f4d7748e14d937ec763a2912823a7e5f5 | Co-Simulation/PTV-Vissim/run_synchronization.py | python | SimulationSynchronization.close | (self) | Cleans synchronization. | Cleans synchronization. | [
"Cleans",
"synchronization",
"."
] | def close(self):
"""
Cleans synchronization.
"""
# Configuring carla simulation in async mode.
settings = self.carla.world.get_settings()
settings.synchronous_mode = False
settings.fixed_delta_seconds = None
self.carla.world.apply_settings(settings)
# Destroying synchronized actors.
for carla_actor_id in self.vissim2carla_ids.values():
self.carla.destroy_actor(carla_actor_id)
# Closing PTV-Vissim connection.
self.vissim.close() | [
"def",
"close",
"(",
"self",
")",
":",
"# Configuring carla simulation in async mode.",
"settings",
"=",
"self",
".",
"carla",
".",
"world",
".",
"get_settings",
"(",
")",
"settings",
".",
"synchronous_mode",
"=",
"False",
"settings",
".",
"fixed_delta_seconds",
"=",
"None",
"self",
".",
"carla",
".",
"world",
".",
"apply_settings",
"(",
"settings",
")",
"# Destroying synchronized actors.",
"for",
"carla_actor_id",
"in",
"self",
".",
"vissim2carla_ids",
".",
"values",
"(",
")",
":",
"self",
".",
"carla",
".",
"destroy_actor",
"(",
"carla_actor_id",
")",
"# Closing PTV-Vissim connection.",
"self",
".",
"vissim",
".",
"close",
"(",
")"
] | https://github.com/carla-simulator/carla/blob/8854804f4d7748e14d937ec763a2912823a7e5f5/Co-Simulation/PTV-Vissim/run_synchronization.py#L152-L167 |
||
sailing-pmls/bosen | 06cb58902d011fbea5f9428f10ce30e621492204 | style_script/cpplint.py | python | _AddFilters | (filters) | Adds more filter overrides.
Unlike _SetFilters, this function does not reset the current list of filters
available.
Args:
filters: A string of comma-separated filters (eg "whitespace/indent").
Each filter should start with + or -; else we die. | Adds more filter overrides. | [
"Adds",
"more",
"filter",
"overrides",
"."
] | def _AddFilters(filters):
"""Adds more filter overrides.
Unlike _SetFilters, this function does not reset the current list of filters
available.
Args:
filters: A string of comma-separated filters (eg "whitespace/indent").
Each filter should start with + or -; else we die.
"""
_cpplint_state.AddFilters(filters) | [
"def",
"_AddFilters",
"(",
"filters",
")",
":",
"_cpplint_state",
".",
"AddFilters",
"(",
"filters",
")"
] | https://github.com/sailing-pmls/bosen/blob/06cb58902d011fbea5f9428f10ce30e621492204/style_script/cpplint.py#L893-L903 |
||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBTarget.FindGlobalVariables | (self, *args) | return _lldb.SBTarget_FindGlobalVariables(self, *args) | FindGlobalVariables(self, str name, uint32_t max_matches) -> SBValueList
FindGlobalVariables(self, str name, uint32_t max_matches, MatchType matchtype) -> SBValueList
Find global and static variables by name.
@param[in] name
The name of the global or static variable we are looking
for.
@param[in] max_matches
Allow the number of matches to be limited to max_matches.
@return
A list of matched variables in an SBValueList. | FindGlobalVariables(self, str name, uint32_t max_matches) -> SBValueList
FindGlobalVariables(self, str name, uint32_t max_matches, MatchType matchtype) -> SBValueList | [
"FindGlobalVariables",
"(",
"self",
"str",
"name",
"uint32_t",
"max_matches",
")",
"-",
">",
"SBValueList",
"FindGlobalVariables",
"(",
"self",
"str",
"name",
"uint32_t",
"max_matches",
"MatchType",
"matchtype",
")",
"-",
">",
"SBValueList"
] | def FindGlobalVariables(self, *args):
"""
FindGlobalVariables(self, str name, uint32_t max_matches) -> SBValueList
FindGlobalVariables(self, str name, uint32_t max_matches, MatchType matchtype) -> SBValueList
Find global and static variables by name.
@param[in] name
The name of the global or static variable we are looking
for.
@param[in] max_matches
Allow the number of matches to be limited to max_matches.
@return
A list of matched variables in an SBValueList.
"""
return _lldb.SBTarget_FindGlobalVariables(self, *args) | [
"def",
"FindGlobalVariables",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_lldb",
".",
"SBTarget_FindGlobalVariables",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L8984-L9001 |
|
SOUI2/soui | 774e5566b2d3254a94f4b3efd55b982e7c665434 | third-part/jsoncpp/doxybuild.py | python | cd | (newdir) | http://stackoverflow.com/questions/431684/how-do-i-cd-in-python | http://stackoverflow.com/questions/431684/how-do-i-cd-in-python | [
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"431684",
"/",
"how",
"-",
"do",
"-",
"i",
"-",
"cd",
"-",
"in",
"-",
"python"
] | def cd(newdir):
"""
http://stackoverflow.com/questions/431684/how-do-i-cd-in-python
"""
prevdir = os.getcwd()
os.chdir(newdir)
try:
yield
finally:
os.chdir(prevdir) | [
"def",
"cd",
"(",
"newdir",
")",
":",
"prevdir",
"=",
"os",
".",
"getcwd",
"(",
")",
"os",
".",
"chdir",
"(",
"newdir",
")",
"try",
":",
"yield",
"finally",
":",
"os",
".",
"chdir",
"(",
"prevdir",
")"
] | https://github.com/SOUI2/soui/blob/774e5566b2d3254a94f4b3efd55b982e7c665434/third-part/jsoncpp/doxybuild.py#L15-L24 |
||
musescore/MuseScore | a817fea23e3c2be30847b7fde5b01746222c252e | thirdparty/freetype/src/tools/docmaker/sources.py | python | SourceProcessor.process_normal_line | ( self, line ) | Process a normal line and check whether it is the start of a new
block. | Process a normal line and check whether it is the start of a new
block. | [
"Process",
"a",
"normal",
"line",
"and",
"check",
"whether",
"it",
"is",
"the",
"start",
"of",
"a",
"new",
"block",
"."
] | def process_normal_line( self, line ):
"""Process a normal line and check whether it is the start of a new
block."""
for f in re_source_block_formats:
if f.start.match( line ):
self.add_block_lines()
self.format = f
self.lineno = fileinput.filelineno()
self.lines.append( line ) | [
"def",
"process_normal_line",
"(",
"self",
",",
"line",
")",
":",
"for",
"f",
"in",
"re_source_block_formats",
":",
"if",
"f",
".",
"start",
".",
"match",
"(",
"line",
")",
":",
"self",
".",
"add_block_lines",
"(",
")",
"self",
".",
"format",
"=",
"f",
"self",
".",
"lineno",
"=",
"fileinput",
".",
"filelineno",
"(",
")",
"self",
".",
"lines",
".",
"append",
"(",
"line",
")"
] | https://github.com/musescore/MuseScore/blob/a817fea23e3c2be30847b7fde5b01746222c252e/thirdparty/freetype/src/tools/docmaker/sources.py#L369-L378 |
||
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/parsers/XmlTopologyParser.py | python | XmlTopologyParser.get_instances | (self) | return self.__instances | Returns a topology object. | Returns a topology object. | [
"Returns",
"a",
"topology",
"object",
"."
] | def get_instances(self):
"""
Returns a topology object.
"""
return self.__instances | [
"def",
"get_instances",
"(",
"self",
")",
":",
"return",
"self",
".",
"__instances"
] | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/parsers/XmlTopologyParser.py#L340-L344 |
|
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/code_coverage/croc.py | python | Coverage.UpdateTreeStats | (self) | Recalculates the tree stats from the currently covered files.
Also calculates coverage summary for files. | Recalculates the tree stats from the currently covered files. | [
"Recalculates",
"the",
"tree",
"stats",
"from",
"the",
"currently",
"covered",
"files",
"."
] | def UpdateTreeStats(self):
"""Recalculates the tree stats from the currently covered files.
Also calculates coverage summary for files.
"""
self.tree = CoveredDir('')
for cov_file in self.files.itervalues():
# Add the file to the tree
fdirs = cov_file.filename.split('/')
parent = self.tree
ancestors = [parent]
for d in fdirs[:-1]:
if d not in parent.subdirs:
if parent.dirpath:
parent.subdirs[d] = CoveredDir(parent.dirpath + '/' + d)
else:
parent.subdirs[d] = CoveredDir(d)
parent = parent.subdirs[d]
ancestors.append(parent)
# Final subdir actually contains the file
parent.files[fdirs[-1]] = cov_file
# Now add file's contribution to coverage by dir
for a in ancestors:
# Add to 'all' group
a.stats_by_group['all'].Add(cov_file.stats)
# Add to group file belongs to
group = cov_file.attrs.get('group')
if group not in a.stats_by_group:
a.stats_by_group[group] = CoverageStats()
cbyg = a.stats_by_group[group]
cbyg.Add(cov_file.stats) | [
"def",
"UpdateTreeStats",
"(",
"self",
")",
":",
"self",
".",
"tree",
"=",
"CoveredDir",
"(",
"''",
")",
"for",
"cov_file",
"in",
"self",
".",
"files",
".",
"itervalues",
"(",
")",
":",
"# Add the file to the tree",
"fdirs",
"=",
"cov_file",
".",
"filename",
".",
"split",
"(",
"'/'",
")",
"parent",
"=",
"self",
".",
"tree",
"ancestors",
"=",
"[",
"parent",
"]",
"for",
"d",
"in",
"fdirs",
"[",
":",
"-",
"1",
"]",
":",
"if",
"d",
"not",
"in",
"parent",
".",
"subdirs",
":",
"if",
"parent",
".",
"dirpath",
":",
"parent",
".",
"subdirs",
"[",
"d",
"]",
"=",
"CoveredDir",
"(",
"parent",
".",
"dirpath",
"+",
"'/'",
"+",
"d",
")",
"else",
":",
"parent",
".",
"subdirs",
"[",
"d",
"]",
"=",
"CoveredDir",
"(",
"d",
")",
"parent",
"=",
"parent",
".",
"subdirs",
"[",
"d",
"]",
"ancestors",
".",
"append",
"(",
"parent",
")",
"# Final subdir actually contains the file",
"parent",
".",
"files",
"[",
"fdirs",
"[",
"-",
"1",
"]",
"]",
"=",
"cov_file",
"# Now add file's contribution to coverage by dir",
"for",
"a",
"in",
"ancestors",
":",
"# Add to 'all' group",
"a",
".",
"stats_by_group",
"[",
"'all'",
"]",
".",
"Add",
"(",
"cov_file",
".",
"stats",
")",
"# Add to group file belongs to",
"group",
"=",
"cov_file",
".",
"attrs",
".",
"get",
"(",
"'group'",
")",
"if",
"group",
"not",
"in",
"a",
".",
"stats_by_group",
":",
"a",
".",
"stats_by_group",
"[",
"group",
"]",
"=",
"CoverageStats",
"(",
")",
"cbyg",
"=",
"a",
".",
"stats_by_group",
"[",
"group",
"]",
"cbyg",
".",
"Add",
"(",
"cov_file",
".",
"stats",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/code_coverage/croc.py#L570-L602 |
||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/yaml/__init__.py | python | compose | (stream, Loader=Loader) | Parse the first YAML document in a stream
and produce the corresponding representation tree. | Parse the first YAML document in a stream
and produce the corresponding representation tree. | [
"Parse",
"the",
"first",
"YAML",
"document",
"in",
"a",
"stream",
"and",
"produce",
"the",
"corresponding",
"representation",
"tree",
"."
] | def compose(stream, Loader=Loader):
"""
Parse the first YAML document in a stream
and produce the corresponding representation tree.
"""
loader = Loader(stream)
try:
return loader.get_single_node()
finally:
loader.dispose() | [
"def",
"compose",
"(",
"stream",
",",
"Loader",
"=",
"Loader",
")",
":",
"loader",
"=",
"Loader",
"(",
"stream",
")",
"try",
":",
"return",
"loader",
".",
"get_single_node",
"(",
")",
"finally",
":",
"loader",
".",
"dispose",
"(",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/yaml/__init__.py#L41-L50 |
||
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/expressions/expression.py | python | Expression.is_pwl | (self) | return self.is_constant() | Is the expression piecewise linear? | Is the expression piecewise linear? | [
"Is",
"the",
"expression",
"piecewise",
"linear?"
] | def is_pwl(self) -> bool:
"""Is the expression piecewise linear?
"""
# Defaults to constant.
return self.is_constant() | [
"def",
"is_pwl",
"(",
"self",
")",
"->",
"bool",
":",
"# Defaults to constant.",
"return",
"self",
".",
"is_constant",
"(",
")"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/expressions/expression.py#L320-L324 |
|
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/inspector_protocol/jinja2/filters.py | python | do_first | (environment, seq) | Return the first item of a sequence. | Return the first item of a sequence. | [
"Return",
"the",
"first",
"item",
"of",
"a",
"sequence",
"."
] | def do_first(environment, seq):
"""Return the first item of a sequence."""
try:
return next(iter(seq))
except StopIteration:
return environment.undefined('No first item, sequence was empty.') | [
"def",
"do_first",
"(",
"environment",
",",
"seq",
")",
":",
"try",
":",
"return",
"next",
"(",
"iter",
"(",
"seq",
")",
")",
"except",
"StopIteration",
":",
"return",
"environment",
".",
"undefined",
"(",
"'No first item, sequence was empty.'",
")"
] | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/inspector_protocol/jinja2/filters.py#L433-L438 |
||
llvm-mirror/libcxx | 78d6a7767ed57b50122a161b91f59f19c9bd0d19 | utils/gdb/libcxx/printers.py | python | AbstractRBTreePrinter._get_key_value | (self, node) | Subclasses should override to return a list of values to yield. | Subclasses should override to return a list of values to yield. | [
"Subclasses",
"should",
"override",
"to",
"return",
"a",
"list",
"of",
"values",
"to",
"yield",
"."
] | def _get_key_value(self, node):
"""Subclasses should override to return a list of values to yield."""
raise NotImplementedError | [
"def",
"_get_key_value",
"(",
"self",
",",
"node",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/llvm-mirror/libcxx/blob/78d6a7767ed57b50122a161b91f59f19c9bd0d19/utils/gdb/libcxx/printers.py#L628-L630 |
||
nsnam/ns-3-dev-git | efdb2e21f45c0a87a60b47c547b68fa140a7b686 | src/visualizer/visualizer/core.py | python | SimulationThread.set_nodes_of_interest | (self, nodes) | !
Set nodes of interest function.
@param self: class object.
@param nodes: class object.
@return | !
Set nodes of interest function. | [
"!",
"Set",
"nodes",
"of",
"interest",
"function",
"."
] | def set_nodes_of_interest(self, nodes):
"""!
Set nodes of interest function.
@param self: class object.
@param nodes: class object.
@return
"""
self.lock.acquire()
try:
self.sim_helper.SetNodesOfInterest(nodes)
finally:
self.lock.release() | [
"def",
"set_nodes_of_interest",
"(",
"self",
",",
"nodes",
")",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"sim_helper",
".",
"SetNodesOfInterest",
"(",
"nodes",
")",
"finally",
":",
"self",
".",
"lock",
".",
"release",
"(",
")"
] | https://github.com/nsnam/ns-3-dev-git/blob/efdb2e21f45c0a87a60b47c547b68fa140a7b686/src/visualizer/visualizer/core.py#L635-L647 |
||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.ComputeMacBundleBinaryOutput | (self) | return os.path.join(path, self.xcode_settings.GetExecutablePath()) | Return the 'output' (full output path) to the binary in a bundle. | Return the 'output' (full output path) to the binary in a bundle. | [
"Return",
"the",
"output",
"(",
"full",
"output",
"path",
")",
"to",
"the",
"binary",
"in",
"a",
"bundle",
"."
] | def ComputeMacBundleBinaryOutput(self):
"""Return the 'output' (full output path) to the binary in a bundle."""
assert self.is_mac_bundle
path = self.ExpandSpecial(generator_default_variables['PRODUCT_DIR'])
return os.path.join(path, self.xcode_settings.GetExecutablePath()) | [
"def",
"ComputeMacBundleBinaryOutput",
"(",
"self",
")",
":",
"assert",
"self",
".",
"is_mac_bundle",
"path",
"=",
"self",
".",
"ExpandSpecial",
"(",
"generator_default_variables",
"[",
"'PRODUCT_DIR'",
"]",
")",
"return",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"self",
".",
"xcode_settings",
".",
"GetExecutablePath",
"(",
")",
")"
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/ninja.py#L1062-L1066 |
|
google/swiftshader | 8ccc63f045d5975fb67f9dfd3d2b8235b0526990 | third_party/llvm-10.0/scripts/update.py | python | copy_common_generated_files | (dst_base) | Copy platform-independent generated files. | Copy platform-independent generated files. | [
"Copy",
"platform",
"-",
"independent",
"generated",
"files",
"."
] | def copy_common_generated_files(dst_base):
"""Copy platform-independent generated files."""
log("Copying platform-independent generated files", 1)
suffixes = {'.inc', '.h', '.def'}
subdirs = [
path.join('include', 'llvm', 'IR'),
path.join('include', 'llvm', 'Support'),
path.join('lib', 'IR'),
path.join('lib', 'Transforms', 'InstCombine'),
] + [path.join('lib', 'Target', arch) for arch, defs in LLVM_TARGETS]
for subdir in subdirs:
for src, dst in list_files(LLVM_OBJS, subdir, dst_base, suffixes):
log('{} -> {}'.format(src, dst), 2)
os.makedirs(path.dirname(dst), exist_ok=True)
shutil.copyfile(src, dst) | [
"def",
"copy_common_generated_files",
"(",
"dst_base",
")",
":",
"log",
"(",
"\"Copying platform-independent generated files\"",
",",
"1",
")",
"suffixes",
"=",
"{",
"'.inc'",
",",
"'.h'",
",",
"'.def'",
"}",
"subdirs",
"=",
"[",
"path",
".",
"join",
"(",
"'include'",
",",
"'llvm'",
",",
"'IR'",
")",
",",
"path",
".",
"join",
"(",
"'include'",
",",
"'llvm'",
",",
"'Support'",
")",
",",
"path",
".",
"join",
"(",
"'lib'",
",",
"'IR'",
")",
",",
"path",
".",
"join",
"(",
"'lib'",
",",
"'Transforms'",
",",
"'InstCombine'",
")",
",",
"]",
"+",
"[",
"path",
".",
"join",
"(",
"'lib'",
",",
"'Target'",
",",
"arch",
")",
"for",
"arch",
",",
"defs",
"in",
"LLVM_TARGETS",
"]",
"for",
"subdir",
"in",
"subdirs",
":",
"for",
"src",
",",
"dst",
"in",
"list_files",
"(",
"LLVM_OBJS",
",",
"subdir",
",",
"dst_base",
",",
"suffixes",
")",
":",
"log",
"(",
"'{} -> {}'",
".",
"format",
"(",
"src",
",",
"dst",
")",
",",
"2",
")",
"os",
".",
"makedirs",
"(",
"path",
".",
"dirname",
"(",
"dst",
")",
",",
"exist_ok",
"=",
"True",
")",
"shutil",
".",
"copyfile",
"(",
"src",
",",
"dst",
")"
] | https://github.com/google/swiftshader/blob/8ccc63f045d5975fb67f9dfd3d2b8235b0526990/third_party/llvm-10.0/scripts/update.py#L238-L252 |
||
wuye9036/SalviaRenderer | a3931dec1b1e5375ef497a9d4d064f0521ba6f37 | blibs/cpuinfo.py | python | get_cpu_info | () | return output | Returns the CPU info by using the best sources of information for your OS.
Returns the result in a dict | Returns the CPU info by using the best sources of information for your OS.
Returns the result in a dict | [
"Returns",
"the",
"CPU",
"info",
"by",
"using",
"the",
"best",
"sources",
"of",
"information",
"for",
"your",
"OS",
".",
"Returns",
"the",
"result",
"in",
"a",
"dict"
] | def get_cpu_info():
'''
Returns the CPU info by using the best sources of information for your OS.
Returns the result in a dict
'''
import json
output = get_cpu_info_json()
# Convert JSON to Python with non unicode strings
output = json.loads(output, object_hook = _utf_to_str)
return output | [
"def",
"get_cpu_info",
"(",
")",
":",
"import",
"json",
"output",
"=",
"get_cpu_info_json",
"(",
")",
"# Convert JSON to Python with non unicode strings",
"output",
"=",
"json",
".",
"loads",
"(",
"output",
",",
"object_hook",
"=",
"_utf_to_str",
")",
"return",
"output"
] | https://github.com/wuye9036/SalviaRenderer/blob/a3931dec1b1e5375ef497a9d4d064f0521ba6f37/blibs/cpuinfo.py#L2185-L2198 |
|
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/diagnostic_updater/_publisher.py | python | HeaderlessTopicDiagnostic.tick | (self) | Signals that a publication has occurred. | Signals that a publication has occurred. | [
"Signals",
"that",
"a",
"publication",
"has",
"occurred",
"."
] | def tick(self):
"""Signals that a publication has occurred."""
self.freq.tick() | [
"def",
"tick",
"(",
"self",
")",
":",
"self",
".",
"freq",
".",
"tick",
"(",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/diagnostic_updater/_publisher.py#L72-L74 |
||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/external/qt_loaders.py | python | can_import | (api) | Safely query whether an API is importable, without importing it | Safely query whether an API is importable, without importing it | [
"Safely",
"query",
"whether",
"an",
"API",
"is",
"importable",
"without",
"importing",
"it"
] | def can_import(api):
"""Safely query whether an API is importable, without importing it"""
if not has_binding(api):
return False
current = loaded_api()
if api == QT_API_PYQT_DEFAULT:
return current in [QT_API_PYQT6, None]
else:
return current in [api, None] | [
"def",
"can_import",
"(",
"api",
")",
":",
"if",
"not",
"has_binding",
"(",
"api",
")",
":",
"return",
"False",
"current",
"=",
"loaded_api",
"(",
")",
"if",
"api",
"==",
"QT_API_PYQT_DEFAULT",
":",
"return",
"current",
"in",
"[",
"QT_API_PYQT6",
",",
"None",
"]",
"else",
":",
"return",
"current",
"in",
"[",
"api",
",",
"None",
"]"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/external/qt_loaders.py#L179-L188 |
||
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | lldb/utils/lui/lldbutil.py | python | continue_to_breakpoint | (process, bkpt) | Continues the process, if it stops, returns the threads stopped at bkpt; otherwise, returns None | Continues the process, if it stops, returns the threads stopped at bkpt; otherwise, returns None | [
"Continues",
"the",
"process",
"if",
"it",
"stops",
"returns",
"the",
"threads",
"stopped",
"at",
"bkpt",
";",
"otherwise",
"returns",
"None"
] | def continue_to_breakpoint(process, bkpt):
""" Continues the process, if it stops, returns the threads stopped at bkpt; otherwise, returns None"""
process.Continue()
if process.GetState() != lldb.eStateStopped:
return None
else:
return get_threads_stopped_at_breakpoint(process, bkpt) | [
"def",
"continue_to_breakpoint",
"(",
"process",
",",
"bkpt",
")",
":",
"process",
".",
"Continue",
"(",
")",
"if",
"process",
".",
"GetState",
"(",
")",
"!=",
"lldb",
".",
"eStateStopped",
":",
"return",
"None",
"else",
":",
"return",
"get_threads_stopped_at_breakpoint",
"(",
"process",
",",
"bkpt",
")"
] | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/lldb/utils/lui/lldbutil.py#L681-L687 |
||
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py | python | PtyProcess.flush | (self) | This does nothing. It is here to support the interface for a
File-like object. | This does nothing. It is here to support the interface for a
File-like object. | [
"This",
"does",
"nothing",
".",
"It",
"is",
"here",
"to",
"support",
"the",
"interface",
"for",
"a",
"File",
"-",
"like",
"object",
"."
] | def flush(self):
'''This does nothing. It is here to support the interface for a
File-like object. '''
pass | [
"def",
"flush",
"(",
"self",
")",
":",
"pass"
] | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py#L405-L409 |
||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/nfs/module.py | python | Module._cmd_nfs_export_apply | (self, cluster_id: str, inbuf: str) | return self.export_mgr.apply_export(cluster_id, export_config=inbuf) | Create or update an export by `-i <json_or_ganesha_export_file>` | Create or update an export by `-i <json_or_ganesha_export_file>` | [
"Create",
"or",
"update",
"an",
"export",
"by",
"-",
"i",
"<json_or_ganesha_export_file",
">"
] | def _cmd_nfs_export_apply(self, cluster_id: str, inbuf: str) -> Tuple[int, str, str]:
"""Create or update an export by `-i <json_or_ganesha_export_file>`"""
return self.export_mgr.apply_export(cluster_id, export_config=inbuf) | [
"def",
"_cmd_nfs_export_apply",
"(",
"self",
",",
"cluster_id",
":",
"str",
",",
"inbuf",
":",
"str",
")",
"->",
"Tuple",
"[",
"int",
",",
"str",
",",
"str",
"]",
":",
"return",
"self",
".",
"export_mgr",
".",
"apply_export",
"(",
"cluster_id",
",",
"export_config",
"=",
"inbuf",
")"
] | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/nfs/module.py#L89-L91 |
|
networkit/networkit | 695b7a786a894a303fa8587597d5ef916e797729 | networkit/profiling/plot.py | python | PlotJob.save | (self, id, fig, extention) | return (id, result) | generate plot output | generate plot output | [
"generate",
"plot",
"output"
] | def save(self, id, fig, extention):
""" generate plot output """
if not have_mpl:
raise MissingDependencyError("matplotlib")
result = ""
fig.tight_layout()
if self.__plottype == "SVG":
imgdata = io.StringIO()
fig.savefig(imgdata, format='svg')
plaintext = imgdata.getvalue()
plaintext = " ".join(plaintext[plaintext.find("<svg "):].split())
result = quote(plaintext, safe='')
elif self.__plottype == "PDF":
filename = self.__options[1] + extention
with PdfPages(self.__options[0] + "/" + filename + ".pdf") as pdf:
pdf.savefig(fig)
result = filename
else:
pass
plt.close(fig)
return (id, result) | [
"def",
"save",
"(",
"self",
",",
"id",
",",
"fig",
",",
"extention",
")",
":",
"if",
"not",
"have_mpl",
":",
"raise",
"MissingDependencyError",
"(",
"\"matplotlib\"",
")",
"result",
"=",
"\"\"",
"fig",
".",
"tight_layout",
"(",
")",
"if",
"self",
".",
"__plottype",
"==",
"\"SVG\"",
":",
"imgdata",
"=",
"io",
".",
"StringIO",
"(",
")",
"fig",
".",
"savefig",
"(",
"imgdata",
",",
"format",
"=",
"'svg'",
")",
"plaintext",
"=",
"imgdata",
".",
"getvalue",
"(",
")",
"plaintext",
"=",
"\" \"",
".",
"join",
"(",
"plaintext",
"[",
"plaintext",
".",
"find",
"(",
"\"<svg \"",
")",
":",
"]",
".",
"split",
"(",
")",
")",
"result",
"=",
"quote",
"(",
"plaintext",
",",
"safe",
"=",
"''",
")",
"elif",
"self",
".",
"__plottype",
"==",
"\"PDF\"",
":",
"filename",
"=",
"self",
".",
"__options",
"[",
"1",
"]",
"+",
"extention",
"with",
"PdfPages",
"(",
"self",
".",
"__options",
"[",
"0",
"]",
"+",
"\"/\"",
"+",
"filename",
"+",
"\".pdf\"",
")",
"as",
"pdf",
":",
"pdf",
".",
"savefig",
"(",
"fig",
")",
"result",
"=",
"filename",
"else",
":",
"pass",
"plt",
".",
"close",
"(",
"fig",
")",
"return",
"(",
"id",
",",
"result",
")"
] | https://github.com/networkit/networkit/blob/695b7a786a894a303fa8587597d5ef916e797729/networkit/profiling/plot.py#L182-L208 |
|
envoyproxy/envoy | 65541accdafe255e72310b4298d646e091da2d80 | tools/api_proto_breaking_change_detector/detector.py | python | ProtoBreakingChangeDetector.is_breaking | (self) | Return True if breaking changes were detected in the given protos | Return True if breaking changes were detected in the given protos | [
"Return",
"True",
"if",
"breaking",
"changes",
"were",
"detected",
"in",
"the",
"given",
"protos"
] | def is_breaking(self) -> bool:
"""Return True if breaking changes were detected in the given protos"""
pass | [
"def",
"is_breaking",
"(",
"self",
")",
"->",
"bool",
":",
"pass"
] | https://github.com/envoyproxy/envoy/blob/65541accdafe255e72310b4298d646e091da2d80/tools/api_proto_breaking_change_detector/detector.py#L35-L37 |
||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/backend.py | python | _get_available_gpus | () | return [x.name for x in _LOCAL_DEVICES if x.device_type == 'GPU'] | Get a list of available gpu devices (formatted as strings).
Returns:
A list of available GPU devices. | Get a list of available gpu devices (formatted as strings). | [
"Get",
"a",
"list",
"of",
"available",
"gpu",
"devices",
"(",
"formatted",
"as",
"strings",
")",
"."
] | def _get_available_gpus():
"""Get a list of available gpu devices (formatted as strings).
Returns:
A list of available GPU devices.
"""
if ops.executing_eagerly_outside_functions():
# Returns names of devices directly.
return [name for name in context.list_devices() if 'GPU' in name]
global _LOCAL_DEVICES
if _LOCAL_DEVICES is None:
_LOCAL_DEVICES = get_session().list_devices()
return [x.name for x in _LOCAL_DEVICES if x.device_type == 'GPU'] | [
"def",
"_get_available_gpus",
"(",
")",
":",
"if",
"ops",
".",
"executing_eagerly_outside_functions",
"(",
")",
":",
"# Returns names of devices directly.",
"return",
"[",
"name",
"for",
"name",
"in",
"context",
".",
"list_devices",
"(",
")",
"if",
"'GPU'",
"in",
"name",
"]",
"global",
"_LOCAL_DEVICES",
"if",
"_LOCAL_DEVICES",
"is",
"None",
":",
"_LOCAL_DEVICES",
"=",
"get_session",
"(",
")",
".",
"list_devices",
"(",
")",
"return",
"[",
"x",
".",
"name",
"for",
"x",
"in",
"_LOCAL_DEVICES",
"if",
"x",
".",
"device_type",
"==",
"'GPU'",
"]"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/backend.py#L619-L632 |
|
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/cookielib.py | python | DefaultCookiePolicy.set_blocked_domains | (self, blocked_domains) | Set the sequence of blocked domains. | Set the sequence of blocked domains. | [
"Set",
"the",
"sequence",
"of",
"blocked",
"domains",
"."
] | def set_blocked_domains(self, blocked_domains):
"""Set the sequence of blocked domains."""
self._blocked_domains = tuple(blocked_domains) | [
"def",
"set_blocked_domains",
"(",
"self",
",",
"blocked_domains",
")",
":",
"self",
".",
"_blocked_domains",
"=",
"tuple",
"(",
"blocked_domains",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/cookielib.py#L884-L886 |
||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/summary_ops_v2.py | python | create_file_writer | (logdir,
max_queue=None,
flush_millis=None,
filename_suffix=None,
name=None) | Creates a summary file writer in the current context under the given name.
Args:
logdir: a string, or None. If a string, creates a summary file writer
which writes to the directory named by the string. If None, returns
a mock object which acts like a summary writer but does nothing,
useful to use as a context manager.
max_queue: the largest number of summaries to keep in a queue; will
flush once the queue gets bigger than this. Defaults to 10.
flush_millis: the largest interval between flushes. Defaults to 120,000.
filename_suffix: optional suffix for the event file name. Defaults to `.v2`.
name: Shared name for this SummaryWriter resource stored to default
Graph. Defaults to the provided logdir prefixed with `logdir:`. Note: if a
summary writer resource with this shared name already exists, the returned
SummaryWriter wraps that resource and the other arguments have no effect.
Returns:
Either a summary writer or an empty object which can be used as a
summary writer. | Creates a summary file writer in the current context under the given name. | [
"Creates",
"a",
"summary",
"file",
"writer",
"in",
"the",
"current",
"context",
"under",
"the",
"given",
"name",
"."
] | def create_file_writer(logdir,
max_queue=None,
flush_millis=None,
filename_suffix=None,
name=None):
"""Creates a summary file writer in the current context under the given name.
Args:
logdir: a string, or None. If a string, creates a summary file writer
which writes to the directory named by the string. If None, returns
a mock object which acts like a summary writer but does nothing,
useful to use as a context manager.
max_queue: the largest number of summaries to keep in a queue; will
flush once the queue gets bigger than this. Defaults to 10.
flush_millis: the largest interval between flushes. Defaults to 120,000.
filename_suffix: optional suffix for the event file name. Defaults to `.v2`.
name: Shared name for this SummaryWriter resource stored to default
Graph. Defaults to the provided logdir prefixed with `logdir:`. Note: if a
summary writer resource with this shared name already exists, the returned
SummaryWriter wraps that resource and the other arguments have no effect.
Returns:
Either a summary writer or an empty object which can be used as a
summary writer.
"""
if logdir is None:
return _NoopSummaryWriter()
logdir = str(logdir)
with ops.device("cpu:0"):
if max_queue is None:
max_queue = constant_op.constant(10)
if flush_millis is None:
flush_millis = constant_op.constant(2 * 60 * 1000)
if filename_suffix is None:
filename_suffix = constant_op.constant(".v2")
if name is None:
name = "logdir:" + logdir
resource = gen_summary_ops.summary_writer(shared_name=name)
return _LegacyResourceSummaryWriter(
resource=resource,
init_op_fn=functools.partial(
gen_summary_ops.create_summary_file_writer,
logdir=logdir,
max_queue=max_queue,
flush_millis=flush_millis,
filename_suffix=filename_suffix)) | [
"def",
"create_file_writer",
"(",
"logdir",
",",
"max_queue",
"=",
"None",
",",
"flush_millis",
"=",
"None",
",",
"filename_suffix",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"logdir",
"is",
"None",
":",
"return",
"_NoopSummaryWriter",
"(",
")",
"logdir",
"=",
"str",
"(",
"logdir",
")",
"with",
"ops",
".",
"device",
"(",
"\"cpu:0\"",
")",
":",
"if",
"max_queue",
"is",
"None",
":",
"max_queue",
"=",
"constant_op",
".",
"constant",
"(",
"10",
")",
"if",
"flush_millis",
"is",
"None",
":",
"flush_millis",
"=",
"constant_op",
".",
"constant",
"(",
"2",
"*",
"60",
"*",
"1000",
")",
"if",
"filename_suffix",
"is",
"None",
":",
"filename_suffix",
"=",
"constant_op",
".",
"constant",
"(",
"\".v2\"",
")",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"\"logdir:\"",
"+",
"logdir",
"resource",
"=",
"gen_summary_ops",
".",
"summary_writer",
"(",
"shared_name",
"=",
"name",
")",
"return",
"_LegacyResourceSummaryWriter",
"(",
"resource",
"=",
"resource",
",",
"init_op_fn",
"=",
"functools",
".",
"partial",
"(",
"gen_summary_ops",
".",
"create_summary_file_writer",
",",
"logdir",
"=",
"logdir",
",",
"max_queue",
"=",
"max_queue",
",",
"flush_millis",
"=",
"flush_millis",
",",
"filename_suffix",
"=",
"filename_suffix",
")",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/summary_ops_v2.py#L563-L608 |
||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | BookCtrlBase.ChangeSelection | (*args, **kwargs) | return _core_.BookCtrlBase_ChangeSelection(*args, **kwargs) | ChangeSelection(self, size_t n) -> int | ChangeSelection(self, size_t n) -> int | [
"ChangeSelection",
"(",
"self",
"size_t",
"n",
")",
"-",
">",
"int"
] | def ChangeSelection(*args, **kwargs):
"""ChangeSelection(self, size_t n) -> int"""
return _core_.BookCtrlBase_ChangeSelection(*args, **kwargs) | [
"def",
"ChangeSelection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"BookCtrlBase_ChangeSelection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L13637-L13639 |
|
echronos/echronos | c996f1d2c8af6c6536205eb319c1bf1d4d84569c | prj/app/prj.py | python | System.generate | (self, *, copy_all_files) | Generate the source for the system.
Raise an appropriate exception if there is an error.
No return value from this method. | Generate the source for the system. | [
"Generate",
"the",
"source",
"for",
"the",
"system",
"."
] | def generate(self, *, copy_all_files):
"""Generate the source for the system.
Raise an appropriate exception if there is an error.
No return value from this method.
"""
os.makedirs(self.output, exist_ok=True)
for i in self._instances:
i.prepare(copy_all_files=copy_all_files)
for i in self._instances:
i.post_prepare() | [
"def",
"generate",
"(",
"self",
",",
"*",
",",
"copy_all_files",
")",
":",
"os",
".",
"makedirs",
"(",
"self",
".",
"output",
",",
"exist_ok",
"=",
"True",
")",
"for",
"i",
"in",
"self",
".",
"_instances",
":",
"i",
".",
"prepare",
"(",
"copy_all_files",
"=",
"copy_all_files",
")",
"for",
"i",
"in",
"self",
".",
"_instances",
":",
"i",
".",
"post_prepare",
"(",
")"
] | https://github.com/echronos/echronos/blob/c996f1d2c8af6c6536205eb319c1bf1d4d84569c/prj/app/prj.py#L791-L804 |
||
borglab/gtsam | a5bee157efce6a0563704bce6a5d188c29817f39 | wrap/gtwrap/template_instantiator/namespace.py | python | instantiate_namespace | (namespace) | return namespace | Instantiate the classes and other elements in the `namespace` content and
assign it back to the namespace content attribute.
@param[in/out] namespace The namespace whose content will be replaced with
the instantiated content. | Instantiate the classes and other elements in the `namespace` content and
assign it back to the namespace content attribute. | [
"Instantiate",
"the",
"classes",
"and",
"other",
"elements",
"in",
"the",
"namespace",
"content",
"and",
"assign",
"it",
"back",
"to",
"the",
"namespace",
"content",
"attribute",
"."
] | def instantiate_namespace(namespace):
"""
Instantiate the classes and other elements in the `namespace` content and
assign it back to the namespace content attribute.
@param[in/out] namespace The namespace whose content will be replaced with
the instantiated content.
"""
instantiated_content = []
typedef_content = []
for element in namespace.content:
if isinstance(element, parser.Class):
original_class = element
if not original_class.template:
instantiated_content.append(
InstantiatedClass(original_class, []))
else:
# This case is for when the templates have enumerated instantiations.
# Use itertools to get all possible combinations of instantiations
# Works even if one template does not have an instantiation list
for instantiations in itertools.product(
*original_class.template.instantiations):
instantiated_content.append(
InstantiatedClass(original_class,
list(instantiations)))
elif isinstance(element, parser.GlobalFunction):
original_func = element
if not original_func.template:
instantiated_content.append(
InstantiatedGlobalFunction(original_func, []))
else:
# Use itertools to get all possible combinations of instantiations
# Works even if one template does not have an instantiation list
for instantiations in itertools.product(
*original_func.template.instantiations):
instantiated_content.append(
InstantiatedGlobalFunction(original_func,
list(instantiations)))
elif isinstance(element, parser.TypedefTemplateInstantiation):
# This is for the case where `typedef` statements are used
# to specify the template parameters.
typedef_inst = element
top_level = namespace.top_level()
original_element = top_level.find_class_or_function(
typedef_inst.typename)
# Check if element is a typedef'd class, function or
# forward declaration from another project.
if isinstance(original_element, parser.Class):
typedef_content.append(
InstantiatedClass(original_element,
typedef_inst.typename.instantiations,
typedef_inst.new_name))
elif isinstance(original_element, parser.GlobalFunction):
typedef_content.append(
InstantiatedGlobalFunction(
original_element, typedef_inst.typename.instantiations,
typedef_inst.new_name))
elif isinstance(original_element, parser.ForwardDeclaration):
typedef_content.append(
InstantiatedDeclaration(
original_element, typedef_inst.typename.instantiations,
typedef_inst.new_name))
elif isinstance(element, parser.Namespace):
element = instantiate_namespace(element)
instantiated_content.append(element)
else:
instantiated_content.append(element)
instantiated_content.extend(typedef_content)
namespace.content = instantiated_content
return namespace | [
"def",
"instantiate_namespace",
"(",
"namespace",
")",
":",
"instantiated_content",
"=",
"[",
"]",
"typedef_content",
"=",
"[",
"]",
"for",
"element",
"in",
"namespace",
".",
"content",
":",
"if",
"isinstance",
"(",
"element",
",",
"parser",
".",
"Class",
")",
":",
"original_class",
"=",
"element",
"if",
"not",
"original_class",
".",
"template",
":",
"instantiated_content",
".",
"append",
"(",
"InstantiatedClass",
"(",
"original_class",
",",
"[",
"]",
")",
")",
"else",
":",
"# This case is for when the templates have enumerated instantiations.",
"# Use itertools to get all possible combinations of instantiations",
"# Works even if one template does not have an instantiation list",
"for",
"instantiations",
"in",
"itertools",
".",
"product",
"(",
"*",
"original_class",
".",
"template",
".",
"instantiations",
")",
":",
"instantiated_content",
".",
"append",
"(",
"InstantiatedClass",
"(",
"original_class",
",",
"list",
"(",
"instantiations",
")",
")",
")",
"elif",
"isinstance",
"(",
"element",
",",
"parser",
".",
"GlobalFunction",
")",
":",
"original_func",
"=",
"element",
"if",
"not",
"original_func",
".",
"template",
":",
"instantiated_content",
".",
"append",
"(",
"InstantiatedGlobalFunction",
"(",
"original_func",
",",
"[",
"]",
")",
")",
"else",
":",
"# Use itertools to get all possible combinations of instantiations",
"# Works even if one template does not have an instantiation list",
"for",
"instantiations",
"in",
"itertools",
".",
"product",
"(",
"*",
"original_func",
".",
"template",
".",
"instantiations",
")",
":",
"instantiated_content",
".",
"append",
"(",
"InstantiatedGlobalFunction",
"(",
"original_func",
",",
"list",
"(",
"instantiations",
")",
")",
")",
"elif",
"isinstance",
"(",
"element",
",",
"parser",
".",
"TypedefTemplateInstantiation",
")",
":",
"# This is for the case where `typedef` statements are used",
"# to specify the template parameters.",
"typedef_inst",
"=",
"element",
"top_level",
"=",
"namespace",
".",
"top_level",
"(",
")",
"original_element",
"=",
"top_level",
".",
"find_class_or_function",
"(",
"typedef_inst",
".",
"typename",
")",
"# Check if element is a typedef'd class, function or",
"# forward declaration from another project.",
"if",
"isinstance",
"(",
"original_element",
",",
"parser",
".",
"Class",
")",
":",
"typedef_content",
".",
"append",
"(",
"InstantiatedClass",
"(",
"original_element",
",",
"typedef_inst",
".",
"typename",
".",
"instantiations",
",",
"typedef_inst",
".",
"new_name",
")",
")",
"elif",
"isinstance",
"(",
"original_element",
",",
"parser",
".",
"GlobalFunction",
")",
":",
"typedef_content",
".",
"append",
"(",
"InstantiatedGlobalFunction",
"(",
"original_element",
",",
"typedef_inst",
".",
"typename",
".",
"instantiations",
",",
"typedef_inst",
".",
"new_name",
")",
")",
"elif",
"isinstance",
"(",
"original_element",
",",
"parser",
".",
"ForwardDeclaration",
")",
":",
"typedef_content",
".",
"append",
"(",
"InstantiatedDeclaration",
"(",
"original_element",
",",
"typedef_inst",
".",
"typename",
".",
"instantiations",
",",
"typedef_inst",
".",
"new_name",
")",
")",
"elif",
"isinstance",
"(",
"element",
",",
"parser",
".",
"Namespace",
")",
":",
"element",
"=",
"instantiate_namespace",
"(",
"element",
")",
"instantiated_content",
".",
"append",
"(",
"element",
")",
"else",
":",
"instantiated_content",
".",
"append",
"(",
"element",
")",
"instantiated_content",
".",
"extend",
"(",
"typedef_content",
")",
"namespace",
".",
"content",
"=",
"instantiated_content",
"return",
"namespace"
] | https://github.com/borglab/gtsam/blob/a5bee157efce6a0563704bce6a5d188c29817f39/wrap/gtwrap/template_instantiator/namespace.py#L11-L88 |
|
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/pyserial/serial/serialcli.py | python | IronSerial.inWaiting | (self) | return self._port_handle.BytesToRead | Return the number of characters currently in the input buffer. | Return the number of characters currently in the input buffer. | [
"Return",
"the",
"number",
"of",
"characters",
"currently",
"in",
"the",
"input",
"buffer",
"."
] | def inWaiting(self):
"""Return the number of characters currently in the input buffer."""
if not self._port_handle: raise portNotOpenError
return self._port_handle.BytesToRead | [
"def",
"inWaiting",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_port_handle",
":",
"raise",
"portNotOpenError",
"return",
"self",
".",
"_port_handle",
".",
"BytesToRead"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/pyserial/serial/serialcli.py#L147-L150 |
|
google/nucleus | 68d3947fafba1337f294c0668a6e1c7f3f1273e3 | nucleus/io/genomics_reader.py | python | GenomicsReader.__exit__ | (self, unused_type, unused_value, unused_traceback) | Exit a `with` block. Typically, this will close the file. | Exit a `with` block. Typically, this will close the file. | [
"Exit",
"a",
"with",
"block",
".",
"Typically",
"this",
"will",
"close",
"the",
"file",
"."
] | def __exit__(self, unused_type, unused_value, unused_traceback):
"""Exit a `with` block. Typically, this will close the file.""" | [
"def",
"__exit__",
"(",
"self",
",",
"unused_type",
",",
"unused_value",
",",
"unused_traceback",
")",
":"
] | https://github.com/google/nucleus/blob/68d3947fafba1337f294c0668a6e1c7f3f1273e3/nucleus/io/genomics_reader.py#L99-L100 |
||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/math/rootfind.py | python | setXTolerance | (tolx: float) | return _rootfind.setXTolerance(tolx) | r"""
Sets the termination threshold for the change in x.
Args:
tolx (float) | r"""
Sets the termination threshold for the change in x. | [
"r",
"Sets",
"the",
"termination",
"threshold",
"for",
"the",
"change",
"in",
"x",
"."
] | def setXTolerance(tolx: float) ->None:
r"""
Sets the termination threshold for the change in x.
Args:
tolx (float)
"""
return _rootfind.setXTolerance(tolx) | [
"def",
"setXTolerance",
"(",
"tolx",
":",
"float",
")",
"->",
"None",
":",
"return",
"_rootfind",
".",
"setXTolerance",
"(",
"tolx",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/math/rootfind.py#L80-L87 |
|
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/masked/numctrl.py | python | NumCtrl.SetLimited | (self, limited) | If called with a value of True, this function will cause the control
to limit the value to fall within the bounds currently specified.
If the control's value currently exceeds the bounds, it will then
be limited accordingly.
If called with a value of False, this function will disable value
limiting, but coloring of out-of-bounds values will still take
place if bounds have been set for the control. | If called with a value of True, this function will cause the control
to limit the value to fall within the bounds currently specified.
If the control's value currently exceeds the bounds, it will then
be limited accordingly. | [
"If",
"called",
"with",
"a",
"value",
"of",
"True",
"this",
"function",
"will",
"cause",
"the",
"control",
"to",
"limit",
"the",
"value",
"to",
"fall",
"within",
"the",
"bounds",
"currently",
"specified",
".",
"If",
"the",
"control",
"s",
"value",
"currently",
"exceeds",
"the",
"bounds",
"it",
"will",
"then",
"be",
"limited",
"accordingly",
"."
] | def SetLimited(self, limited):
"""
If called with a value of True, this function will cause the control
to limit the value to fall within the bounds currently specified.
If the control's value currently exceeds the bounds, it will then
be limited accordingly.
If called with a value of False, this function will disable value
limiting, but coloring of out-of-bounds values will still take
place if bounds have been set for the control.
"""
self.SetParameters(limited = limited) | [
"def",
"SetLimited",
"(",
"self",
",",
"limited",
")",
":",
"self",
".",
"SetParameters",
"(",
"limited",
"=",
"limited",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/masked/numctrl.py#L1409-L1420 |
||
eclipse/omr | 056e7c9ce9d503649190bc5bd9931fac30b4e4bc | jitbuilder/apigen/cppgen.py | python | CppGenerator.grab_impl | (self, v, t) | return self.to_impl_cast(t.as_class(), "{v} != NULL ? {v}->_impl : NULL".format(v=v)) if t.is_class() else v | Constructs an expression that grabs the implementation object
from a client API object `v` and with type name `t`. | Constructs an expression that grabs the implementation object
from a client API object `v` and with type name `t`. | [
"Constructs",
"an",
"expression",
"that",
"grabs",
"the",
"implementation",
"object",
"from",
"a",
"client",
"API",
"object",
"v",
"and",
"with",
"type",
"name",
"t",
"."
] | def grab_impl(self, v, t):
"""
Constructs an expression that grabs the implementation object
from a client API object `v` and with type name `t`.
"""
return self.to_impl_cast(t.as_class(), "{v} != NULL ? {v}->_impl : NULL".format(v=v)) if t.is_class() else v | [
"def",
"grab_impl",
"(",
"self",
",",
"v",
",",
"t",
")",
":",
"return",
"self",
".",
"to_impl_cast",
"(",
"t",
".",
"as_class",
"(",
")",
",",
"\"{v} != NULL ? {v}->_impl : NULL\"",
".",
"format",
"(",
"v",
"=",
"v",
")",
")",
"if",
"t",
".",
"is_class",
"(",
")",
"else",
"v"
] | https://github.com/eclipse/omr/blob/056e7c9ce9d503649190bc5bd9931fac30b4e4bc/jitbuilder/apigen/cppgen.py#L190-L195 |
|
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBLanguageRuntime_GetNameForLanguageType | (*args) | return _lldb.SBLanguageRuntime_GetNameForLanguageType(*args) | SBLanguageRuntime_GetNameForLanguageType(LanguageType language) -> str | SBLanguageRuntime_GetNameForLanguageType(LanguageType language) -> str | [
"SBLanguageRuntime_GetNameForLanguageType",
"(",
"LanguageType",
"language",
")",
"-",
">",
"str"
] | def SBLanguageRuntime_GetNameForLanguageType(*args):
"""SBLanguageRuntime_GetNameForLanguageType(LanguageType language) -> str"""
return _lldb.SBLanguageRuntime_GetNameForLanguageType(*args) | [
"def",
"SBLanguageRuntime_GetNameForLanguageType",
"(",
"*",
"args",
")",
":",
"return",
"_lldb",
".",
"SBLanguageRuntime_GetNameForLanguageType",
"(",
"*",
"args",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L5405-L5407 |
|
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | Pen.SetDashes | (*args, **kwargs) | return _gdi_.Pen_SetDashes(*args, **kwargs) | SetDashes(self, int dashes) | SetDashes(self, int dashes) | [
"SetDashes",
"(",
"self",
"int",
"dashes",
")"
] | def SetDashes(*args, **kwargs):
"""SetDashes(self, int dashes)"""
return _gdi_.Pen_SetDashes(*args, **kwargs) | [
"def",
"SetDashes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Pen_SetDashes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L445-L447 |
|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_pydecimal.py | python | Context.logical_or | (self, a, b) | return a.logical_or(b, context=self) | Applies the logical operation 'or' between each operand's digits.
The operands must be both logical numbers.
>>> ExtendedContext.logical_or(Decimal('0'), Decimal('0'))
Decimal('0')
>>> ExtendedContext.logical_or(Decimal('0'), Decimal('1'))
Decimal('1')
>>> ExtendedContext.logical_or(Decimal('1'), Decimal('0'))
Decimal('1')
>>> ExtendedContext.logical_or(Decimal('1'), Decimal('1'))
Decimal('1')
>>> ExtendedContext.logical_or(Decimal('1100'), Decimal('1010'))
Decimal('1110')
>>> ExtendedContext.logical_or(Decimal('1110'), Decimal('10'))
Decimal('1110')
>>> ExtendedContext.logical_or(110, 1101)
Decimal('1111')
>>> ExtendedContext.logical_or(Decimal(110), 1101)
Decimal('1111')
>>> ExtendedContext.logical_or(110, Decimal(1101))
Decimal('1111') | Applies the logical operation 'or' between each operand's digits. | [
"Applies",
"the",
"logical",
"operation",
"or",
"between",
"each",
"operand",
"s",
"digits",
"."
] | def logical_or(self, a, b):
"""Applies the logical operation 'or' between each operand's digits.
The operands must be both logical numbers.
>>> ExtendedContext.logical_or(Decimal('0'), Decimal('0'))
Decimal('0')
>>> ExtendedContext.logical_or(Decimal('0'), Decimal('1'))
Decimal('1')
>>> ExtendedContext.logical_or(Decimal('1'), Decimal('0'))
Decimal('1')
>>> ExtendedContext.logical_or(Decimal('1'), Decimal('1'))
Decimal('1')
>>> ExtendedContext.logical_or(Decimal('1100'), Decimal('1010'))
Decimal('1110')
>>> ExtendedContext.logical_or(Decimal('1110'), Decimal('10'))
Decimal('1110')
>>> ExtendedContext.logical_or(110, 1101)
Decimal('1111')
>>> ExtendedContext.logical_or(Decimal(110), 1101)
Decimal('1111')
>>> ExtendedContext.logical_or(110, Decimal(1101))
Decimal('1111')
"""
a = _convert_other(a, raiseit=True)
return a.logical_or(b, context=self) | [
"def",
"logical_or",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"logical_or",
"(",
"b",
",",
"context",
"=",
"self",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_pydecimal.py#L4784-L4809 |
|
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBCompileUnit.__str__ | (self) | return _lldb.SBCompileUnit___str__(self) | __str__(SBCompileUnit self) -> PyObject * | __str__(SBCompileUnit self) -> PyObject * | [
"__str__",
"(",
"SBCompileUnit",
"self",
")",
"-",
">",
"PyObject",
"*"
] | def __str__(self):
"""__str__(SBCompileUnit self) -> PyObject *"""
return _lldb.SBCompileUnit___str__(self) | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBCompileUnit___str__",
"(",
"self",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L3259-L3261 |
|
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/boost/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | python | benchmark_file | (
filename, compiler, include_dirs, (progress_from, progress_to),
iter_count, extra_flags = '') | return {
"time": time_sum / iter_count,
"memory": mem_sum / (iter_count * 1024)
} | Benchmark one file | Benchmark one file | [
"Benchmark",
"one",
"file"
] | def benchmark_file(
filename, compiler, include_dirs, (progress_from, progress_to),
iter_count, extra_flags = ''):
"""Benchmark one file"""
time_sum = 0
mem_sum = 0
for nth_run in xrange(0, iter_count):
(time_spent, mem_used) = benchmark_command(
'{0} -std=c++11 {1} -c {2} {3}'.format(
compiler,
' '.join('-I{0}'.format(i) for i in include_dirs),
filename,
extra_flags
),
(
progress_to * nth_run + progress_from * (iter_count - nth_run)
) / iter_count
)
os.remove(os.path.splitext(os.path.basename(filename))[0] + '.o')
time_sum = time_sum + time_spent
mem_sum = mem_sum + mem_used
return {
"time": time_sum / iter_count,
"memory": mem_sum / (iter_count * 1024)
} | [
"def",
"benchmark_file",
"(",
"filename",
",",
"compiler",
",",
"include_dirs",
",",
"(",
"progress_from",
",",
"progress_to",
")",
",",
"iter_count",
",",
"extra_flags",
"=",
"''",
")",
":",
"time_sum",
"=",
"0",
"mem_sum",
"=",
"0",
"for",
"nth_run",
"in",
"xrange",
"(",
"0",
",",
"iter_count",
")",
":",
"(",
"time_spent",
",",
"mem_used",
")",
"=",
"benchmark_command",
"(",
"'{0} -std=c++11 {1} -c {2} {3}'",
".",
"format",
"(",
"compiler",
",",
"' '",
".",
"join",
"(",
"'-I{0}'",
".",
"format",
"(",
"i",
")",
"for",
"i",
"in",
"include_dirs",
")",
",",
"filename",
",",
"extra_flags",
")",
",",
"(",
"progress_to",
"*",
"nth_run",
"+",
"progress_from",
"*",
"(",
"iter_count",
"-",
"nth_run",
")",
")",
"/",
"iter_count",
")",
"os",
".",
"remove",
"(",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
")",
"[",
"0",
"]",
"+",
"'.o'",
")",
"time_sum",
"=",
"time_sum",
"+",
"time_spent",
"mem_sum",
"=",
"mem_sum",
"+",
"mem_used",
"return",
"{",
"\"time\"",
":",
"time_sum",
"/",
"iter_count",
",",
"\"memory\"",
":",
"mem_sum",
"/",
"(",
"iter_count",
"*",
"1024",
")",
"}"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/boost/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L48-L73 |
|
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libevent-2.0.18-stable/event_rpcgen.py | python | EntryInt.CodeArrayAdd | (self, varname, value) | return [ '%(varname)s = %(value)s;' % { 'varname' : varname,
'value' : value } ] | Returns a new entry of this type. | Returns a new entry of this type. | [
"Returns",
"a",
"new",
"entry",
"of",
"this",
"type",
"."
] | def CodeArrayAdd(self, varname, value):
"""Returns a new entry of this type."""
return [ '%(varname)s = %(value)s;' % { 'varname' : varname,
'value' : value } ] | [
"def",
"CodeArrayAdd",
"(",
"self",
",",
"varname",
",",
"value",
")",
":",
"return",
"[",
"'%(varname)s = %(value)s;'",
"%",
"{",
"'varname'",
":",
"varname",
",",
"'value'",
":",
"value",
"}",
"]"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libevent-2.0.18-stable/event_rpcgen.py#L621-L624 |
|
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/grid.py | python | GridSizeEvent.CmdDown | (*args, **kwargs) | return _grid.GridSizeEvent_CmdDown(*args, **kwargs) | CmdDown(self) -> bool | CmdDown(self) -> bool | [
"CmdDown",
"(",
"self",
")",
"-",
">",
"bool"
] | def CmdDown(*args, **kwargs):
"""CmdDown(self) -> bool"""
return _grid.GridSizeEvent_CmdDown(*args, **kwargs) | [
"def",
"CmdDown",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"GridSizeEvent_CmdDown",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/grid.py#L2381-L2383 |
|
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/renderer.py | python | print_formatted_text | (
output: Output,
formatted_text: AnyFormattedText,
style: BaseStyle,
style_transformation: Optional[StyleTransformation] = None,
color_depth: Optional[ColorDepth] = None,
) | Print a list of (style_str, text) tuples in the given style to the output. | Print a list of (style_str, text) tuples in the given style to the output. | [
"Print",
"a",
"list",
"of",
"(",
"style_str",
"text",
")",
"tuples",
"in",
"the",
"given",
"style",
"to",
"the",
"output",
"."
] | def print_formatted_text(
output: Output,
formatted_text: AnyFormattedText,
style: BaseStyle,
style_transformation: Optional[StyleTransformation] = None,
color_depth: Optional[ColorDepth] = None,
) -> None:
"""
Print a list of (style_str, text) tuples in the given style to the output.
"""
fragments = to_formatted_text(formatted_text)
style_transformation = style_transformation or DummyStyleTransformation()
color_depth = color_depth or output.get_default_color_depth()
# Reset first.
output.reset_attributes()
output.enable_autowrap()
last_attrs: Optional[Attrs] = None
# Print all (style_str, text) tuples.
attrs_for_style_string = _StyleStringToAttrsCache(
style.get_attrs_for_style_str, style_transformation
)
for style_str, text, *_ in fragments:
attrs = attrs_for_style_string[style_str]
# Set style attributes if something changed.
if attrs != last_attrs:
if attrs:
output.set_attributes(attrs, color_depth)
else:
output.reset_attributes()
last_attrs = attrs
# Eliminate carriage returns
text = text.replace("\r", "")
# Assume that the output is raw, and insert a carriage return before
# every newline. (Also important when the front-end is a telnet client.)
output.write(text.replace("\n", "\r\n"))
# Reset again.
output.reset_attributes()
output.flush() | [
"def",
"print_formatted_text",
"(",
"output",
":",
"Output",
",",
"formatted_text",
":",
"AnyFormattedText",
",",
"style",
":",
"BaseStyle",
",",
"style_transformation",
":",
"Optional",
"[",
"StyleTransformation",
"]",
"=",
"None",
",",
"color_depth",
":",
"Optional",
"[",
"ColorDepth",
"]",
"=",
"None",
",",
")",
"->",
"None",
":",
"fragments",
"=",
"to_formatted_text",
"(",
"formatted_text",
")",
"style_transformation",
"=",
"style_transformation",
"or",
"DummyStyleTransformation",
"(",
")",
"color_depth",
"=",
"color_depth",
"or",
"output",
".",
"get_default_color_depth",
"(",
")",
"# Reset first.",
"output",
".",
"reset_attributes",
"(",
")",
"output",
".",
"enable_autowrap",
"(",
")",
"last_attrs",
":",
"Optional",
"[",
"Attrs",
"]",
"=",
"None",
"# Print all (style_str, text) tuples.",
"attrs_for_style_string",
"=",
"_StyleStringToAttrsCache",
"(",
"style",
".",
"get_attrs_for_style_str",
",",
"style_transformation",
")",
"for",
"style_str",
",",
"text",
",",
"",
"*",
"_",
"in",
"fragments",
":",
"attrs",
"=",
"attrs_for_style_string",
"[",
"style_str",
"]",
"# Set style attributes if something changed.",
"if",
"attrs",
"!=",
"last_attrs",
":",
"if",
"attrs",
":",
"output",
".",
"set_attributes",
"(",
"attrs",
",",
"color_depth",
")",
"else",
":",
"output",
".",
"reset_attributes",
"(",
")",
"last_attrs",
"=",
"attrs",
"# Eliminate carriage returns",
"text",
"=",
"text",
".",
"replace",
"(",
"\"\\r\"",
",",
"\"\"",
")",
"# Assume that the output is raw, and insert a carriage return before",
"# every newline. (Also important when the front-end is a telnet client.)",
"output",
".",
"write",
"(",
"text",
".",
"replace",
"(",
"\"\\n\"",
",",
"\"\\r\\n\"",
")",
")",
"# Reset again.",
"output",
".",
"reset_attributes",
"(",
")",
"output",
".",
"flush",
"(",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/renderer.py#L766-L810 |
||
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/v8/tools/grokdump.py | python | InspectionShell.do_dp | (self, address) | return self.do_display_page(address) | see display_page | see display_page | [
"see",
"display_page"
] | def do_dp(self, address):
""" see display_page """
return self.do_display_page(address) | [
"def",
"do_dp",
"(",
"self",
",",
"address",
")",
":",
"return",
"self",
".",
"do_display_page",
"(",
"address",
")"
] | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/v8/tools/grokdump.py#L3460-L3462 |
|
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/saved_model/signature_def_utils_impl.py | python | regression_signature_def | (examples, predictions) | return signature_def | Creates regression signature from given examples and predictions.
This function produces signatures intended for use with the TensorFlow Serving
Regress API (tensorflow_serving/apis/prediction_service.proto), and so
constrains the input and output types to those allowed by TensorFlow Serving.
Args:
examples: A string `Tensor`, expected to accept serialized tf.Examples.
predictions: A float `Tensor`.
Returns:
A regression-flavored signature_def.
Raises:
ValueError: If examples is `None`. | Creates regression signature from given examples and predictions. | [
"Creates",
"regression",
"signature",
"from",
"given",
"examples",
"and",
"predictions",
"."
] | def regression_signature_def(examples, predictions):
"""Creates regression signature from given examples and predictions.
This function produces signatures intended for use with the TensorFlow Serving
Regress API (tensorflow_serving/apis/prediction_service.proto), and so
constrains the input and output types to those allowed by TensorFlow Serving.
Args:
examples: A string `Tensor`, expected to accept serialized tf.Examples.
predictions: A float `Tensor`.
Returns:
A regression-flavored signature_def.
Raises:
ValueError: If examples is `None`.
"""
if examples is None:
raise ValueError('Regression `examples` cannot be None.')
if not isinstance(examples, ops.Tensor):
raise ValueError('Expected regression `examples` to be of type Tensor. '
f'Found `examples` of type {type(examples)}.')
if predictions is None:
raise ValueError('Regression `predictions` cannot be None.')
input_tensor_info = utils.build_tensor_info(examples)
if input_tensor_info.dtype != types_pb2.DT_STRING:
raise ValueError('Regression input tensors must be of type string. '
f'Found tensors with type {input_tensor_info.dtype}.')
signature_inputs = {signature_constants.REGRESS_INPUTS: input_tensor_info}
output_tensor_info = utils.build_tensor_info(predictions)
if output_tensor_info.dtype != types_pb2.DT_FLOAT:
raise ValueError('Regression output tensors must be of type float. '
f'Found tensors with type {output_tensor_info.dtype}.')
signature_outputs = {signature_constants.REGRESS_OUTPUTS: output_tensor_info}
signature_def = build_signature_def(
signature_inputs, signature_outputs,
signature_constants.REGRESS_METHOD_NAME)
return signature_def | [
"def",
"regression_signature_def",
"(",
"examples",
",",
"predictions",
")",
":",
"if",
"examples",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Regression `examples` cannot be None.'",
")",
"if",
"not",
"isinstance",
"(",
"examples",
",",
"ops",
".",
"Tensor",
")",
":",
"raise",
"ValueError",
"(",
"'Expected regression `examples` to be of type Tensor. '",
"f'Found `examples` of type {type(examples)}.'",
")",
"if",
"predictions",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Regression `predictions` cannot be None.'",
")",
"input_tensor_info",
"=",
"utils",
".",
"build_tensor_info",
"(",
"examples",
")",
"if",
"input_tensor_info",
".",
"dtype",
"!=",
"types_pb2",
".",
"DT_STRING",
":",
"raise",
"ValueError",
"(",
"'Regression input tensors must be of type string. '",
"f'Found tensors with type {input_tensor_info.dtype}.'",
")",
"signature_inputs",
"=",
"{",
"signature_constants",
".",
"REGRESS_INPUTS",
":",
"input_tensor_info",
"}",
"output_tensor_info",
"=",
"utils",
".",
"build_tensor_info",
"(",
"predictions",
")",
"if",
"output_tensor_info",
".",
"dtype",
"!=",
"types_pb2",
".",
"DT_FLOAT",
":",
"raise",
"ValueError",
"(",
"'Regression output tensors must be of type float. '",
"f'Found tensors with type {output_tensor_info.dtype}.'",
")",
"signature_outputs",
"=",
"{",
"signature_constants",
".",
"REGRESS_OUTPUTS",
":",
"output_tensor_info",
"}",
"signature_def",
"=",
"build_signature_def",
"(",
"signature_inputs",
",",
"signature_outputs",
",",
"signature_constants",
".",
"REGRESS_METHOD_NAME",
")",
"return",
"signature_def"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/saved_model/signature_def_utils_impl.py#L67-L108 |
|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/distutils/fcompiler/__init__.py | python | show_fcompilers | (dist=None) | Print list of available compilers (used by the "--help-fcompiler"
option to "config_fc"). | Print list of available compilers (used by the "--help-fcompiler"
option to "config_fc"). | [
"Print",
"list",
"of",
"available",
"compilers",
"(",
"used",
"by",
"the",
"--",
"help",
"-",
"fcompiler",
"option",
"to",
"config_fc",
")",
"."
] | def show_fcompilers(dist=None):
"""Print list of available compilers (used by the "--help-fcompiler"
option to "config_fc").
"""
if dist is None:
from distutils.dist import Distribution
from numpy.distutils.command.config_compiler import config_fc
dist = Distribution()
dist.script_name = os.path.basename(sys.argv[0])
dist.script_args = ['config_fc'] + sys.argv[1:]
try:
dist.script_args.remove('--help-fcompiler')
except ValueError:
pass
dist.cmdclass['config_fc'] = config_fc
dist.parse_config_files()
dist.parse_command_line()
compilers = []
compilers_na = []
compilers_ni = []
if not fcompiler_class:
load_all_fcompiler_classes()
platform_compilers = available_fcompilers_for_platform()
for compiler in platform_compilers:
v = None
log.set_verbosity(-2)
try:
c = new_fcompiler(compiler=compiler, verbose=dist.verbose)
c.customize(dist)
v = c.get_version()
except (DistutilsModuleError, CompilerNotFound):
e = get_exception()
log.debug("show_fcompilers: %s not found" % (compiler,))
log.debug(repr(e))
if v is None:
compilers_na.append(("fcompiler="+compiler, None,
fcompiler_class[compiler][2]))
else:
c.dump_properties()
compilers.append(("fcompiler="+compiler, None,
fcompiler_class[compiler][2] + ' (%s)' % v))
compilers_ni = list(set(fcompiler_class.keys()) - set(platform_compilers))
compilers_ni = [("fcompiler="+fc, None, fcompiler_class[fc][2])
for fc in compilers_ni]
compilers.sort()
compilers_na.sort()
compilers_ni.sort()
pretty_printer = FancyGetopt(compilers)
pretty_printer.print_help("Fortran compilers found:")
pretty_printer = FancyGetopt(compilers_na)
pretty_printer.print_help("Compilers available for this "
"platform, but not found:")
if compilers_ni:
pretty_printer = FancyGetopt(compilers_ni)
pretty_printer.print_help("Compilers not available on this platform:")
print("For compiler details, run 'config_fc --verbose' setup command.") | [
"def",
"show_fcompilers",
"(",
"dist",
"=",
"None",
")",
":",
"if",
"dist",
"is",
"None",
":",
"from",
"distutils",
".",
"dist",
"import",
"Distribution",
"from",
"numpy",
".",
"distutils",
".",
"command",
".",
"config_compiler",
"import",
"config_fc",
"dist",
"=",
"Distribution",
"(",
")",
"dist",
".",
"script_name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"sys",
".",
"argv",
"[",
"0",
"]",
")",
"dist",
".",
"script_args",
"=",
"[",
"'config_fc'",
"]",
"+",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"try",
":",
"dist",
".",
"script_args",
".",
"remove",
"(",
"'--help-fcompiler'",
")",
"except",
"ValueError",
":",
"pass",
"dist",
".",
"cmdclass",
"[",
"'config_fc'",
"]",
"=",
"config_fc",
"dist",
".",
"parse_config_files",
"(",
")",
"dist",
".",
"parse_command_line",
"(",
")",
"compilers",
"=",
"[",
"]",
"compilers_na",
"=",
"[",
"]",
"compilers_ni",
"=",
"[",
"]",
"if",
"not",
"fcompiler_class",
":",
"load_all_fcompiler_classes",
"(",
")",
"platform_compilers",
"=",
"available_fcompilers_for_platform",
"(",
")",
"for",
"compiler",
"in",
"platform_compilers",
":",
"v",
"=",
"None",
"log",
".",
"set_verbosity",
"(",
"-",
"2",
")",
"try",
":",
"c",
"=",
"new_fcompiler",
"(",
"compiler",
"=",
"compiler",
",",
"verbose",
"=",
"dist",
".",
"verbose",
")",
"c",
".",
"customize",
"(",
"dist",
")",
"v",
"=",
"c",
".",
"get_version",
"(",
")",
"except",
"(",
"DistutilsModuleError",
",",
"CompilerNotFound",
")",
":",
"e",
"=",
"get_exception",
"(",
")",
"log",
".",
"debug",
"(",
"\"show_fcompilers: %s not found\"",
"%",
"(",
"compiler",
",",
")",
")",
"log",
".",
"debug",
"(",
"repr",
"(",
"e",
")",
")",
"if",
"v",
"is",
"None",
":",
"compilers_na",
".",
"append",
"(",
"(",
"\"fcompiler=\"",
"+",
"compiler",
",",
"None",
",",
"fcompiler_class",
"[",
"compiler",
"]",
"[",
"2",
"]",
")",
")",
"else",
":",
"c",
".",
"dump_properties",
"(",
")",
"compilers",
".",
"append",
"(",
"(",
"\"fcompiler=\"",
"+",
"compiler",
",",
"None",
",",
"fcompiler_class",
"[",
"compiler",
"]",
"[",
"2",
"]",
"+",
"' (%s)'",
"%",
"v",
")",
")",
"compilers_ni",
"=",
"list",
"(",
"set",
"(",
"fcompiler_class",
".",
"keys",
"(",
")",
")",
"-",
"set",
"(",
"platform_compilers",
")",
")",
"compilers_ni",
"=",
"[",
"(",
"\"fcompiler=\"",
"+",
"fc",
",",
"None",
",",
"fcompiler_class",
"[",
"fc",
"]",
"[",
"2",
"]",
")",
"for",
"fc",
"in",
"compilers_ni",
"]",
"compilers",
".",
"sort",
"(",
")",
"compilers_na",
".",
"sort",
"(",
")",
"compilers_ni",
".",
"sort",
"(",
")",
"pretty_printer",
"=",
"FancyGetopt",
"(",
"compilers",
")",
"pretty_printer",
".",
"print_help",
"(",
"\"Fortran compilers found:\"",
")",
"pretty_printer",
"=",
"FancyGetopt",
"(",
"compilers_na",
")",
"pretty_printer",
".",
"print_help",
"(",
"\"Compilers available for this \"",
"\"platform, but not found:\"",
")",
"if",
"compilers_ni",
":",
"pretty_printer",
"=",
"FancyGetopt",
"(",
"compilers_ni",
")",
"pretty_printer",
".",
"print_help",
"(",
"\"Compilers not available on this platform:\"",
")",
"print",
"(",
"\"For compiler details, run 'config_fc --verbose' setup command.\"",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/distutils/fcompiler/__init__.py#L904-L962 |
||
continental/ecal | 204dab80a24fe01abca62541133b311bf0c09608 | lang/python/core/ecal/core/core.py | python | client_rem_method_callback | (client_handle) | return _ecal.client_rem_response_callback(client_handle) | remove response callback from client
:param client_handle: the client handle | remove response callback from client | [
"remove",
"response",
"callback",
"from",
"client"
] | def client_rem_method_callback(client_handle):
""" remove response callback from client
:param client_handle: the client handle
"""
return _ecal.client_rem_response_callback(client_handle) | [
"def",
"client_rem_method_callback",
"(",
"client_handle",
")",
":",
"return",
"_ecal",
".",
"client_rem_response_callback",
"(",
"client_handle",
")"
] | https://github.com/continental/ecal/blob/204dab80a24fe01abca62541133b311bf0c09608/lang/python/core/ecal/core/core.py#L456-L462 |
|
INK-USC/USC-DS-RelationExtraction | eebcfa7fd2eda5bba92f3ef8158797cdf91e6981 | code/Classifier/HierarchySVM.py | python | HierarchySVM.fit_em | (self, train_x, train_y) | row = [0]*len(x)
data = [1]*len(x)
train_x = list of list
train_y = list of list
:param x:
:param y:
:return: | row = [0]*len(x)
data = [1]*len(x)
train_x = list of list
train_y = list of list
:param x:
:param y:
:return: | [
"row",
"=",
"[",
"0",
"]",
"*",
"len",
"(",
"x",
")",
"data",
"=",
"[",
"1",
"]",
"*",
"len",
"(",
"x",
")",
"train_x",
"=",
"list",
"of",
"list",
"train_y",
"=",
"list",
"of",
"list",
":",
"param",
"x",
":",
":",
"param",
"y",
":",
":",
"return",
":"
] | def fit_em(self, train_x, train_y):
"""
row = [0]*len(x)
data = [1]*len(x)
train_x = list of list
train_y = list of list
:param x:
:param y:
:return:
"""
new_train_x = []
new_train_y = []
for i in xrange(len(train_y)):
x = train_x[i]
y = train_y[i]
flag = True
for l in y:
if l in self._typemapping:
flag = False
new_train_x.append(x)
new_train_y.append(self._typemapping[l])
if flag:
new_train_x.append(x)
new_train_y.append(0)
if len(new_train_y)>0:
self._svm.fit(new_train_x, new_train_y)
# train children svm
for child in self._children:
new_train_x = []
new_train_y = []
for i in xrange(len(train_y)):
x = train_x[i]
y = train_y[i]
if child in y:
new_train_x.append(x)
new_train_y.append(y)
print "Train child svm for label %d, example:#%d" % (child, len(new_train_y))
self._children[child].fit_em(new_train_x, new_train_y) | [
"def",
"fit_em",
"(",
"self",
",",
"train_x",
",",
"train_y",
")",
":",
"new_train_x",
"=",
"[",
"]",
"new_train_y",
"=",
"[",
"]",
"for",
"i",
"in",
"xrange",
"(",
"len",
"(",
"train_y",
")",
")",
":",
"x",
"=",
"train_x",
"[",
"i",
"]",
"y",
"=",
"train_y",
"[",
"i",
"]",
"flag",
"=",
"True",
"for",
"l",
"in",
"y",
":",
"if",
"l",
"in",
"self",
".",
"_typemapping",
":",
"flag",
"=",
"False",
"new_train_x",
".",
"append",
"(",
"x",
")",
"new_train_y",
".",
"append",
"(",
"self",
".",
"_typemapping",
"[",
"l",
"]",
")",
"if",
"flag",
":",
"new_train_x",
".",
"append",
"(",
"x",
")",
"new_train_y",
".",
"append",
"(",
"0",
")",
"if",
"len",
"(",
"new_train_y",
")",
">",
"0",
":",
"self",
".",
"_svm",
".",
"fit",
"(",
"new_train_x",
",",
"new_train_y",
")",
"# train children svm",
"for",
"child",
"in",
"self",
".",
"_children",
":",
"new_train_x",
"=",
"[",
"]",
"new_train_y",
"=",
"[",
"]",
"for",
"i",
"in",
"xrange",
"(",
"len",
"(",
"train_y",
")",
")",
":",
"x",
"=",
"train_x",
"[",
"i",
"]",
"y",
"=",
"train_y",
"[",
"i",
"]",
"if",
"child",
"in",
"y",
":",
"new_train_x",
".",
"append",
"(",
"x",
")",
"new_train_y",
".",
"append",
"(",
"y",
")",
"print",
"\"Train child svm for label %d, example:#%d\"",
"%",
"(",
"child",
",",
"len",
"(",
"new_train_y",
")",
")",
"self",
".",
"_children",
"[",
"child",
"]",
".",
"fit_em",
"(",
"new_train_x",
",",
"new_train_y",
")"
] | https://github.com/INK-USC/USC-DS-RelationExtraction/blob/eebcfa7fd2eda5bba92f3ef8158797cdf91e6981/code/Classifier/HierarchySVM.py#L32-L70 |
||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/idlelib/TreeWidget.py | python | TreeItem.SetText | (self, text) | Change the item's text (if it is editable). | Change the item's text (if it is editable). | [
"Change",
"the",
"item",
"s",
"text",
"(",
"if",
"it",
"is",
"editable",
")",
"."
] | def SetText(self, text):
"""Change the item's text (if it is editable).""" | [
"def",
"SetText",
"(",
"self",
",",
"text",
")",
":"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/idlelib/TreeWidget.py#L346-L347 |
||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/gencpp/src/gencpp/__init__.py | python | default_value | (type) | return "" | Returns the value to initialize a message member with. 0 for integer types, 0.0 for floating point, false for bool,
empty string for everything else
@param type: The type
@type type: str | Returns the value to initialize a message member with. 0 for integer types, 0.0 for floating point, false for bool,
empty string for everything else | [
"Returns",
"the",
"value",
"to",
"initialize",
"a",
"message",
"member",
"with",
".",
"0",
"for",
"integer",
"types",
"0",
".",
"0",
"for",
"floating",
"point",
"false",
"for",
"bool",
"empty",
"string",
"for",
"everything",
"else"
] | def default_value(type):
"""
Returns the value to initialize a message member with. 0 for integer types, 0.0 for floating point, false for bool,
empty string for everything else
@param type: The type
@type type: str
"""
if type in ['byte', 'int8', 'int16', 'int32', 'int64',
'char', 'uint8', 'uint16', 'uint32', 'uint64']:
return '0'
elif type in ['float32', 'float64']:
return '0.0'
elif type == 'bool':
return 'false'
return "" | [
"def",
"default_value",
"(",
"type",
")",
":",
"if",
"type",
"in",
"[",
"'byte'",
",",
"'int8'",
",",
"'int16'",
",",
"'int32'",
",",
"'int64'",
",",
"'char'",
",",
"'uint8'",
",",
"'uint16'",
",",
"'uint32'",
",",
"'uint64'",
"]",
":",
"return",
"'0'",
"elif",
"type",
"in",
"[",
"'float32'",
",",
"'float64'",
"]",
":",
"return",
"'0.0'",
"elif",
"type",
"==",
"'bool'",
":",
"return",
"'false'",
"return",
"\"\""
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/gencpp/src/gencpp/__init__.py#L159-L175 |
|
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_windows.py | python | PyWindow.DoSetVirtualSize | (*args, **kwargs) | return _windows_.PyWindow_DoSetVirtualSize(*args, **kwargs) | DoSetVirtualSize(self, int x, int y) | DoSetVirtualSize(self, int x, int y) | [
"DoSetVirtualSize",
"(",
"self",
"int",
"x",
"int",
"y",
")"
] | def DoSetVirtualSize(*args, **kwargs):
"""DoSetVirtualSize(self, int x, int y)"""
return _windows_.PyWindow_DoSetVirtualSize(*args, **kwargs) | [
"def",
"DoSetVirtualSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PyWindow_DoSetVirtualSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_windows.py#L4158-L4160 |
|
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/zipfile.py | python | ZipFile.close | (self) | Close the file, and for mode "w" and "a" write the ending
records. | Close the file, and for mode "w" and "a" write the ending
records. | [
"Close",
"the",
"file",
"and",
"for",
"mode",
"w",
"and",
"a",
"write",
"the",
"ending",
"records",
"."
] | def close(self):
"""Close the file, and for mode "w" and "a" write the ending
records."""
if self.fp is None:
return
try:
if self.mode in ("w", "a") and self._didModify: # write ending records
count = 0
pos1 = self.fp.tell()
for zinfo in self.filelist: # write central directory
count = count + 1
dt = zinfo.date_time
dosdate = (dt[0] - 1980) << 9 | dt[1] << 5 | dt[2]
dostime = dt[3] << 11 | dt[4] << 5 | (dt[5] // 2)
extra = []
if zinfo.file_size > ZIP64_LIMIT \
or zinfo.compress_size > ZIP64_LIMIT:
extra.append(zinfo.file_size)
extra.append(zinfo.compress_size)
file_size = 0xffffffff
compress_size = 0xffffffff
else:
file_size = zinfo.file_size
compress_size = zinfo.compress_size
if zinfo.header_offset > ZIP64_LIMIT:
extra.append(zinfo.header_offset)
header_offset = 0xffffffffL
else:
header_offset = zinfo.header_offset
extra_data = zinfo.extra
if extra:
# Append a ZIP64 field to the extra's
extra_data = struct.pack(
'<HH' + 'Q'*len(extra),
1, 8*len(extra), *extra) + extra_data
extract_version = max(45, zinfo.extract_version)
create_version = max(45, zinfo.create_version)
else:
extract_version = zinfo.extract_version
create_version = zinfo.create_version
try:
filename, flag_bits = zinfo._encodeFilenameFlags()
centdir = struct.pack(structCentralDir,
stringCentralDir, create_version,
zinfo.create_system, extract_version, zinfo.reserved,
flag_bits, zinfo.compress_type, dostime, dosdate,
zinfo.CRC, compress_size, file_size,
len(filename), len(extra_data), len(zinfo.comment),
0, zinfo.internal_attr, zinfo.external_attr,
header_offset)
except DeprecationWarning:
print >>sys.stderr, (structCentralDir,
stringCentralDir, create_version,
zinfo.create_system, extract_version, zinfo.reserved,
zinfo.flag_bits, zinfo.compress_type, dostime, dosdate,
zinfo.CRC, compress_size, file_size,
len(zinfo.filename), len(extra_data), len(zinfo.comment),
0, zinfo.internal_attr, zinfo.external_attr,
header_offset)
raise
self.fp.write(centdir)
self.fp.write(filename)
self.fp.write(extra_data)
self.fp.write(zinfo.comment)
pos2 = self.fp.tell()
# Write end-of-zip-archive record
centDirCount = count
centDirSize = pos2 - pos1
centDirOffset = pos1
if (centDirCount >= ZIP_FILECOUNT_LIMIT or
centDirOffset > ZIP64_LIMIT or
centDirSize > ZIP64_LIMIT):
# Need to write the ZIP64 end-of-archive records
zip64endrec = struct.pack(
structEndArchive64, stringEndArchive64,
44, 45, 45, 0, 0, centDirCount, centDirCount,
centDirSize, centDirOffset)
self.fp.write(zip64endrec)
zip64locrec = struct.pack(
structEndArchive64Locator,
stringEndArchive64Locator, 0, pos2, 1)
self.fp.write(zip64locrec)
centDirCount = min(centDirCount, 0xFFFF)
centDirSize = min(centDirSize, 0xFFFFFFFF)
centDirOffset = min(centDirOffset, 0xFFFFFFFF)
endrec = struct.pack(structEndArchive, stringEndArchive,
0, 0, centDirCount, centDirCount,
centDirSize, centDirOffset, len(self._comment))
self.fp.write(endrec)
self.fp.write(self._comment)
self.fp.flush()
finally:
fp = self.fp
self.fp = None
if not self._filePassed:
fp.close() | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"fp",
"is",
"None",
":",
"return",
"try",
":",
"if",
"self",
".",
"mode",
"in",
"(",
"\"w\"",
",",
"\"a\"",
")",
"and",
"self",
".",
"_didModify",
":",
"# write ending records",
"count",
"=",
"0",
"pos1",
"=",
"self",
".",
"fp",
".",
"tell",
"(",
")",
"for",
"zinfo",
"in",
"self",
".",
"filelist",
":",
"# write central directory",
"count",
"=",
"count",
"+",
"1",
"dt",
"=",
"zinfo",
".",
"date_time",
"dosdate",
"=",
"(",
"dt",
"[",
"0",
"]",
"-",
"1980",
")",
"<<",
"9",
"|",
"dt",
"[",
"1",
"]",
"<<",
"5",
"|",
"dt",
"[",
"2",
"]",
"dostime",
"=",
"dt",
"[",
"3",
"]",
"<<",
"11",
"|",
"dt",
"[",
"4",
"]",
"<<",
"5",
"|",
"(",
"dt",
"[",
"5",
"]",
"//",
"2",
")",
"extra",
"=",
"[",
"]",
"if",
"zinfo",
".",
"file_size",
">",
"ZIP64_LIMIT",
"or",
"zinfo",
".",
"compress_size",
">",
"ZIP64_LIMIT",
":",
"extra",
".",
"append",
"(",
"zinfo",
".",
"file_size",
")",
"extra",
".",
"append",
"(",
"zinfo",
".",
"compress_size",
")",
"file_size",
"=",
"0xffffffff",
"compress_size",
"=",
"0xffffffff",
"else",
":",
"file_size",
"=",
"zinfo",
".",
"file_size",
"compress_size",
"=",
"zinfo",
".",
"compress_size",
"if",
"zinfo",
".",
"header_offset",
">",
"ZIP64_LIMIT",
":",
"extra",
".",
"append",
"(",
"zinfo",
".",
"header_offset",
")",
"header_offset",
"=",
"0xffffffffL",
"else",
":",
"header_offset",
"=",
"zinfo",
".",
"header_offset",
"extra_data",
"=",
"zinfo",
".",
"extra",
"if",
"extra",
":",
"# Append a ZIP64 field to the extra's",
"extra_data",
"=",
"struct",
".",
"pack",
"(",
"'<HH'",
"+",
"'Q'",
"*",
"len",
"(",
"extra",
")",
",",
"1",
",",
"8",
"*",
"len",
"(",
"extra",
")",
",",
"*",
"extra",
")",
"+",
"extra_data",
"extract_version",
"=",
"max",
"(",
"45",
",",
"zinfo",
".",
"extract_version",
")",
"create_version",
"=",
"max",
"(",
"45",
",",
"zinfo",
".",
"create_version",
")",
"else",
":",
"extract_version",
"=",
"zinfo",
".",
"extract_version",
"create_version",
"=",
"zinfo",
".",
"create_version",
"try",
":",
"filename",
",",
"flag_bits",
"=",
"zinfo",
".",
"_encodeFilenameFlags",
"(",
")",
"centdir",
"=",
"struct",
".",
"pack",
"(",
"structCentralDir",
",",
"stringCentralDir",
",",
"create_version",
",",
"zinfo",
".",
"create_system",
",",
"extract_version",
",",
"zinfo",
".",
"reserved",
",",
"flag_bits",
",",
"zinfo",
".",
"compress_type",
",",
"dostime",
",",
"dosdate",
",",
"zinfo",
".",
"CRC",
",",
"compress_size",
",",
"file_size",
",",
"len",
"(",
"filename",
")",
",",
"len",
"(",
"extra_data",
")",
",",
"len",
"(",
"zinfo",
".",
"comment",
")",
",",
"0",
",",
"zinfo",
".",
"internal_attr",
",",
"zinfo",
".",
"external_attr",
",",
"header_offset",
")",
"except",
"DeprecationWarning",
":",
"print",
">>",
"sys",
".",
"stderr",
",",
"(",
"structCentralDir",
",",
"stringCentralDir",
",",
"create_version",
",",
"zinfo",
".",
"create_system",
",",
"extract_version",
",",
"zinfo",
".",
"reserved",
",",
"zinfo",
".",
"flag_bits",
",",
"zinfo",
".",
"compress_type",
",",
"dostime",
",",
"dosdate",
",",
"zinfo",
".",
"CRC",
",",
"compress_size",
",",
"file_size",
",",
"len",
"(",
"zinfo",
".",
"filename",
")",
",",
"len",
"(",
"extra_data",
")",
",",
"len",
"(",
"zinfo",
".",
"comment",
")",
",",
"0",
",",
"zinfo",
".",
"internal_attr",
",",
"zinfo",
".",
"external_attr",
",",
"header_offset",
")",
"raise",
"self",
".",
"fp",
".",
"write",
"(",
"centdir",
")",
"self",
".",
"fp",
".",
"write",
"(",
"filename",
")",
"self",
".",
"fp",
".",
"write",
"(",
"extra_data",
")",
"self",
".",
"fp",
".",
"write",
"(",
"zinfo",
".",
"comment",
")",
"pos2",
"=",
"self",
".",
"fp",
".",
"tell",
"(",
")",
"# Write end-of-zip-archive record",
"centDirCount",
"=",
"count",
"centDirSize",
"=",
"pos2",
"-",
"pos1",
"centDirOffset",
"=",
"pos1",
"if",
"(",
"centDirCount",
">=",
"ZIP_FILECOUNT_LIMIT",
"or",
"centDirOffset",
">",
"ZIP64_LIMIT",
"or",
"centDirSize",
">",
"ZIP64_LIMIT",
")",
":",
"# Need to write the ZIP64 end-of-archive records",
"zip64endrec",
"=",
"struct",
".",
"pack",
"(",
"structEndArchive64",
",",
"stringEndArchive64",
",",
"44",
",",
"45",
",",
"45",
",",
"0",
",",
"0",
",",
"centDirCount",
",",
"centDirCount",
",",
"centDirSize",
",",
"centDirOffset",
")",
"self",
".",
"fp",
".",
"write",
"(",
"zip64endrec",
")",
"zip64locrec",
"=",
"struct",
".",
"pack",
"(",
"structEndArchive64Locator",
",",
"stringEndArchive64Locator",
",",
"0",
",",
"pos2",
",",
"1",
")",
"self",
".",
"fp",
".",
"write",
"(",
"zip64locrec",
")",
"centDirCount",
"=",
"min",
"(",
"centDirCount",
",",
"0xFFFF",
")",
"centDirSize",
"=",
"min",
"(",
"centDirSize",
",",
"0xFFFFFFFF",
")",
"centDirOffset",
"=",
"min",
"(",
"centDirOffset",
",",
"0xFFFFFFFF",
")",
"endrec",
"=",
"struct",
".",
"pack",
"(",
"structEndArchive",
",",
"stringEndArchive",
",",
"0",
",",
"0",
",",
"centDirCount",
",",
"centDirCount",
",",
"centDirSize",
",",
"centDirOffset",
",",
"len",
"(",
"self",
".",
"_comment",
")",
")",
"self",
".",
"fp",
".",
"write",
"(",
"endrec",
")",
"self",
".",
"fp",
".",
"write",
"(",
"self",
".",
"_comment",
")",
"self",
".",
"fp",
".",
"flush",
"(",
")",
"finally",
":",
"fp",
"=",
"self",
".",
"fp",
"self",
".",
"fp",
"=",
"None",
"if",
"not",
"self",
".",
"_filePassed",
":",
"fp",
".",
"close",
"(",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/zipfile.py#L1247-L1350 |
||
OGRECave/ogre-next | 287307980e6de8910f04f3cc0994451b075071fd | Tools/Wings3DExporter/mesh.py | python | Mesh.dump | (self) | show data | show data | [
"show",
"data"
] | def dump(self):
"show data"
print "Mesh '%s':" % self.name
print "%d vertices:" % len(self.glverts)
for vert in self.glverts: print " ", vert
ntris = sum(map(lambda submesh: len(submesh.gltris), self.subs))
print "%d submeshes, %d tris total:" % (len(self.subs), ntris)
for sub in self.subs:
print " material %d (%s), %d tris" % (sub.material, sub.mat_data.name, len(sub.gltris))
for tri in sub.gltris:
A, B, C = tri
print " ", A, B, C | [
"def",
"dump",
"(",
"self",
")",
":",
"print",
"\"Mesh '%s':\"",
"%",
"self",
".",
"name",
"print",
"\"%d vertices:\"",
"%",
"len",
"(",
"self",
".",
"glverts",
")",
"for",
"vert",
"in",
"self",
".",
"glverts",
":",
"print",
"\" \"",
",",
"vert",
"ntris",
"=",
"sum",
"(",
"map",
"(",
"lambda",
"submesh",
":",
"len",
"(",
"submesh",
".",
"gltris",
")",
",",
"self",
".",
"subs",
")",
")",
"print",
"\"%d submeshes, %d tris total:\"",
"%",
"(",
"len",
"(",
"self",
".",
"subs",
")",
",",
"ntris",
")",
"for",
"sub",
"in",
"self",
".",
"subs",
":",
"print",
"\" material %d (%s), %d tris\"",
"%",
"(",
"sub",
".",
"material",
",",
"sub",
".",
"mat_data",
".",
"name",
",",
"len",
"(",
"sub",
".",
"gltris",
")",
")",
"for",
"tri",
"in",
"sub",
".",
"gltris",
":",
"A",
",",
"B",
",",
"C",
"=",
"tri",
"print",
"\" \"",
",",
"A",
",",
"B",
",",
"C"
] | https://github.com/OGRECave/ogre-next/blob/287307980e6de8910f04f3cc0994451b075071fd/Tools/Wings3DExporter/mesh.py#L394-L408 |
||
InsightSoftwareConsortium/ITK | 87acfce9a93d928311c38bc371b666b515b9f19d | Modules/ThirdParty/pygccxml/src/pygccxml/declarations/type_traits.py | python | is_same | (type1, type2) | return nake_type1 == nake_type2 | returns True, if type1 and type2 are same types | returns True, if type1 and type2 are same types | [
"returns",
"True",
"if",
"type1",
"and",
"type2",
"are",
"same",
"types"
] | def is_same(type1, type2):
"""returns True, if type1 and type2 are same types"""
nake_type1 = remove_declarated(type1)
nake_type2 = remove_declarated(type2)
return nake_type1 == nake_type2 | [
"def",
"is_same",
"(",
"type1",
",",
"type2",
")",
":",
"nake_type1",
"=",
"remove_declarated",
"(",
"type1",
")",
"nake_type2",
"=",
"remove_declarated",
"(",
"type2",
")",
"return",
"nake_type1",
"==",
"nake_type2"
] | https://github.com/InsightSoftwareConsortium/ITK/blob/87acfce9a93d928311c38bc371b666b515b9f19d/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/type_traits.py#L383-L387 |
|
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/grid.py | python | GridCellWorker._setOORInfo | (*args, **kwargs) | return _grid.GridCellWorker__setOORInfo(*args, **kwargs) | _setOORInfo(self, PyObject _self) | _setOORInfo(self, PyObject _self) | [
"_setOORInfo",
"(",
"self",
"PyObject",
"_self",
")"
] | def _setOORInfo(*args, **kwargs):
"""_setOORInfo(self, PyObject _self)"""
return _grid.GridCellWorker__setOORInfo(*args, **kwargs) | [
"def",
"_setOORInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"GridCellWorker__setOORInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/grid.py#L89-L91 |
|
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | FWCore/ParameterSet/python/Config.py | python | Process.services_ | (self) | return DictTypes.FixedKeysDict(self.__services) | returns a dict of the services that have been added to the Process | returns a dict of the services that have been added to the Process | [
"returns",
"a",
"dict",
"of",
"the",
"services",
"that",
"have",
"been",
"added",
"to",
"the",
"Process"
] | def services_(self):
"""returns a dict of the services that have been added to the Process"""
return DictTypes.FixedKeysDict(self.__services) | [
"def",
"services_",
"(",
"self",
")",
":",
"return",
"DictTypes",
".",
"FixedKeysDict",
"(",
"self",
".",
"__services",
")"
] | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/FWCore/ParameterSet/python/Config.py#L324-L326 |
|
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/setuptools/_distutils/command/bdist_msi.py | python | PyDialog.xbutton | (self, name, title, next, xpos) | return self.pushbutton(name, int(self.w*xpos - 28), self.h-27, 56, 17, 3, title, next) | Add a button with a given title, the tab-next button,
its name in the Control table, giving its x position; the
y-position is aligned with the other buttons.
Return the button, so that events can be associated | Add a button with a given title, the tab-next button,
its name in the Control table, giving its x position; the
y-position is aligned with the other buttons. | [
"Add",
"a",
"button",
"with",
"a",
"given",
"title",
"the",
"tab",
"-",
"next",
"button",
"its",
"name",
"in",
"the",
"Control",
"table",
"giving",
"its",
"x",
"position",
";",
"the",
"y",
"-",
"position",
"is",
"aligned",
"with",
"the",
"other",
"buttons",
"."
] | def xbutton(self, name, title, next, xpos):
"""Add a button with a given title, the tab-next button,
its name in the Control table, giving its x position; the
y-position is aligned with the other buttons.
Return the button, so that events can be associated"""
return self.pushbutton(name, int(self.w*xpos - 28), self.h-27, 56, 17, 3, title, next) | [
"def",
"xbutton",
"(",
"self",
",",
"name",
",",
"title",
",",
"next",
",",
"xpos",
")",
":",
"return",
"self",
".",
"pushbutton",
"(",
"name",
",",
"int",
"(",
"self",
".",
"w",
"*",
"xpos",
"-",
"28",
")",
",",
"self",
".",
"h",
"-",
"27",
",",
"56",
",",
"17",
",",
"3",
",",
"title",
",",
"next",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/_distutils/command/bdist_msi.py#L77-L83 |
|
chanyn/3Dpose_ssl | 585696676279683a279b1ecca136c0e0d02aef2a | caffe-3dssl/scripts/cpp_lint.py | python | FindEndOfExpressionInLine | (line, startpos, depth, startchar, endchar) | return (-1, depth) | Find the position just after the matching endchar.
Args:
line: a CleansedLines line.
startpos: start searching at this position.
depth: nesting level at startpos.
startchar: expression opening character.
endchar: expression closing character.
Returns:
On finding matching endchar: (index just after matching endchar, 0)
Otherwise: (-1, new depth at end of this line) | Find the position just after the matching endchar. | [
"Find",
"the",
"position",
"just",
"after",
"the",
"matching",
"endchar",
"."
] | def FindEndOfExpressionInLine(line, startpos, depth, startchar, endchar):
"""Find the position just after the matching endchar.
Args:
line: a CleansedLines line.
startpos: start searching at this position.
depth: nesting level at startpos.
startchar: expression opening character.
endchar: expression closing character.
Returns:
On finding matching endchar: (index just after matching endchar, 0)
Otherwise: (-1, new depth at end of this line)
"""
for i in xrange(startpos, len(line)):
if line[i] == startchar:
depth += 1
elif line[i] == endchar:
depth -= 1
if depth == 0:
return (i + 1, 0)
return (-1, depth) | [
"def",
"FindEndOfExpressionInLine",
"(",
"line",
",",
"startpos",
",",
"depth",
",",
"startchar",
",",
"endchar",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"startpos",
",",
"len",
"(",
"line",
")",
")",
":",
"if",
"line",
"[",
"i",
"]",
"==",
"startchar",
":",
"depth",
"+=",
"1",
"elif",
"line",
"[",
"i",
"]",
"==",
"endchar",
":",
"depth",
"-=",
"1",
"if",
"depth",
"==",
"0",
":",
"return",
"(",
"i",
"+",
"1",
",",
"0",
")",
"return",
"(",
"-",
"1",
",",
"depth",
")"
] | https://github.com/chanyn/3Dpose_ssl/blob/585696676279683a279b1ecca136c0e0d02aef2a/caffe-3dssl/scripts/cpp_lint.py#L1230-L1251 |
|
cryfs/cryfs | 5f908c641cd5854b8a347f842b996bfe76a64577 | src/gitversion/_version.py | python | run_command | (commands, args, cwd=None, verbose=False, hide_stderr=False) | return stdout | Call the given command(s). | Call the given command(s). | [
"Call",
"the",
"given",
"command",
"(",
"s",
")",
"."
] | def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False):
"""Call the given command(s)."""
assert isinstance(commands, list)
p = None
for c in commands:
try:
dispcmd = str([c] + args)
# remember shell=False, so use git.cmd on windows, not just git
p = subprocess.Popen([c] + args, cwd=cwd, stdout=subprocess.PIPE,
stderr=(subprocess.PIPE if hide_stderr
else None))
break
except EnvironmentError:
e = sys.exc_info()[1]
if e.errno == errno.ENOENT:
continue
if verbose:
print("unable to run %s" % dispcmd)
print(e)
return None
else:
if verbose:
print("unable to find command, tried %s" % (commands,))
return None
stdout = p.communicate()[0].strip()
if sys.version_info[0] >= 3:
stdout = stdout.decode()
if p.returncode != 0:
if verbose:
print("unable to run %s (error)" % dispcmd)
return None
return stdout | [
"def",
"run_command",
"(",
"commands",
",",
"args",
",",
"cwd",
"=",
"None",
",",
"verbose",
"=",
"False",
",",
"hide_stderr",
"=",
"False",
")",
":",
"assert",
"isinstance",
"(",
"commands",
",",
"list",
")",
"p",
"=",
"None",
"for",
"c",
"in",
"commands",
":",
"try",
":",
"dispcmd",
"=",
"str",
"(",
"[",
"c",
"]",
"+",
"args",
")",
"# remember shell=False, so use git.cmd on windows, not just git",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"c",
"]",
"+",
"args",
",",
"cwd",
"=",
"cwd",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"(",
"subprocess",
".",
"PIPE",
"if",
"hide_stderr",
"else",
"None",
")",
")",
"break",
"except",
"EnvironmentError",
":",
"e",
"=",
"sys",
".",
"exc_info",
"(",
")",
"[",
"1",
"]",
"if",
"e",
".",
"errno",
"==",
"errno",
".",
"ENOENT",
":",
"continue",
"if",
"verbose",
":",
"print",
"(",
"\"unable to run %s\"",
"%",
"dispcmd",
")",
"print",
"(",
"e",
")",
"return",
"None",
"else",
":",
"if",
"verbose",
":",
"print",
"(",
"\"unable to find command, tried %s\"",
"%",
"(",
"commands",
",",
")",
")",
"return",
"None",
"stdout",
"=",
"p",
".",
"communicate",
"(",
")",
"[",
"0",
"]",
".",
"strip",
"(",
")",
"if",
"sys",
".",
"version_info",
"[",
"0",
"]",
">=",
"3",
":",
"stdout",
"=",
"stdout",
".",
"decode",
"(",
")",
"if",
"p",
".",
"returncode",
"!=",
"0",
":",
"if",
"verbose",
":",
"print",
"(",
"\"unable to run %s (error)\"",
"%",
"dispcmd",
")",
"return",
"None",
"return",
"stdout"
] | https://github.com/cryfs/cryfs/blob/5f908c641cd5854b8a347f842b996bfe76a64577/src/gitversion/_version.py#L71-L102 |
|
mapsme/omim | 1892903b63f2c85b16ed4966d21fe76aba06b9ba | tools/python/stylesheet/drules_merge.py | python | zooms_string | (z1, z2) | Prints 'zoom N' or 'zooms N-M'. | Prints 'zoom N' or 'zooms N-M'. | [
"Prints",
"zoom",
"N",
"or",
"zooms",
"N",
"-",
"M",
"."
] | def zooms_string(z1, z2):
"""Prints 'zoom N' or 'zooms N-M'."""
if z2 != z1:
return "zooms {}-{}".format(min(z1, z2), max(z1, z2))
else:
return "zoom {}".format(z1) | [
"def",
"zooms_string",
"(",
"z1",
",",
"z2",
")",
":",
"if",
"z2",
"!=",
"z1",
":",
"return",
"\"zooms {}-{}\"",
".",
"format",
"(",
"min",
"(",
"z1",
",",
"z2",
")",
",",
"max",
"(",
"z1",
",",
"z2",
")",
")",
"else",
":",
"return",
"\"zoom {}\"",
".",
"format",
"(",
"z1",
")"
] | https://github.com/mapsme/omim/blob/1892903b63f2c85b16ed4966d21fe76aba06b9ba/tools/python/stylesheet/drules_merge.py#L32-L37 |
||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ma/core.py | python | MaskedArray.tofile | (self, fid, sep="", format="%s") | Save a masked array to a file in binary format.
.. warning::
This function is not implemented yet.
Raises
------
NotImplementedError
When `tofile` is called. | Save a masked array to a file in binary format. | [
"Save",
"a",
"masked",
"array",
"to",
"a",
"file",
"in",
"binary",
"format",
"."
] | def tofile(self, fid, sep="", format="%s"):
"""
Save a masked array to a file in binary format.
.. warning::
This function is not implemented yet.
Raises
------
NotImplementedError
When `tofile` is called.
"""
raise NotImplementedError("MaskedArray.tofile() not implemented yet.") | [
"def",
"tofile",
"(",
"self",
",",
"fid",
",",
"sep",
"=",
"\"\"",
",",
"format",
"=",
"\"%s\"",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"MaskedArray.tofile() not implemented yet.\"",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ma/core.py#L6021-L6034 |
||
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/inputparser.py | python | process_cfour_command | (matchobj) | return "%score.set_global_option(\"%s\", \"\"\"%s\n\"\"\")\n" % \
(spaces, 'LITERAL_CFOUR', 'literals_psi4_yo-' + literalkey) | Function to process match of ``cfour name? { ... }``. | Function to process match of ``cfour name? { ... }``. | [
"Function",
"to",
"process",
"match",
"of",
"cfour",
"name?",
"{",
"...",
"}",
"."
] | def process_cfour_command(matchobj):
"""Function to process match of ``cfour name? { ... }``."""
spaces = matchobj.group(1)
name = matchobj.group(2)
cfourblock = matchobj.group(3)
literalkey = str(uuid.uuid4())[:8]
literals[literalkey] = cfourblock
return "%score.set_global_option(\"%s\", \"\"\"%s\n\"\"\")\n" % \
(spaces, 'LITERAL_CFOUR', 'literals_psi4_yo-' + literalkey) | [
"def",
"process_cfour_command",
"(",
"matchobj",
")",
":",
"spaces",
"=",
"matchobj",
".",
"group",
"(",
"1",
")",
"name",
"=",
"matchobj",
".",
"group",
"(",
"2",
")",
"cfourblock",
"=",
"matchobj",
".",
"group",
"(",
"3",
")",
"literalkey",
"=",
"str",
"(",
"uuid",
".",
"uuid4",
"(",
")",
")",
"[",
":",
"8",
"]",
"literals",
"[",
"literalkey",
"]",
"=",
"cfourblock",
"return",
"\"%score.set_global_option(\\\"%s\\\", \\\"\\\"\\\"%s\\n\\\"\\\"\\\")\\n\"",
"%",
"(",
"spaces",
",",
"'LITERAL_CFOUR'",
",",
"'literals_psi4_yo-'",
"+",
"literalkey",
")"
] | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/inputparser.py#L217-L226 |
|
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/configobj/configobj.py | python | ConfigObj._handle_error | (self, text, ErrorClass, infile, cur_index) | Handle an error according to the error settings.
Either raise the error or store it.
The error will have occured at ``cur_index`` | Handle an error according to the error settings.
Either raise the error or store it.
The error will have occured at ``cur_index`` | [
"Handle",
"an",
"error",
"according",
"to",
"the",
"error",
"settings",
".",
"Either",
"raise",
"the",
"error",
"or",
"store",
"it",
".",
"The",
"error",
"will",
"have",
"occured",
"at",
"cur_index"
] | def _handle_error(self, text, ErrorClass, infile, cur_index):
"""
Handle an error according to the error settings.
Either raise the error or store it.
The error will have occured at ``cur_index``
"""
line = infile[cur_index]
cur_index += 1
message = text % cur_index
error = ErrorClass(message, cur_index, line)
if self.raise_errors:
# raise the error - parsing stops here
raise error
# store the error
# reraise when parsing has finished
self._errors.append(error) | [
"def",
"_handle_error",
"(",
"self",
",",
"text",
",",
"ErrorClass",
",",
"infile",
",",
"cur_index",
")",
":",
"line",
"=",
"infile",
"[",
"cur_index",
"]",
"cur_index",
"+=",
"1",
"message",
"=",
"text",
"%",
"cur_index",
"error",
"=",
"ErrorClass",
"(",
"message",
",",
"cur_index",
",",
"line",
")",
"if",
"self",
".",
"raise_errors",
":",
"# raise the error - parsing stops here",
"raise",
"error",
"# store the error",
"# reraise when parsing has finished",
"self",
".",
"_errors",
".",
"append",
"(",
"error",
")"
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/configobj/configobj.py#L1720-L1736 |
||
apache/thrift | 0b29261a4f3c6882ef3b09aae47914f0012b0472 | lib/py/src/server/TNonblockingServer.py | python | socket_exception | (func) | return read | Decorator close object on socket.error. | Decorator close object on socket.error. | [
"Decorator",
"close",
"object",
"on",
"socket",
".",
"error",
"."
] | def socket_exception(func):
"""Decorator close object on socket.error."""
def read(self, *args, **kwargs):
try:
return func(self, *args, **kwargs)
except socket.error:
logger.debug('ignoring socket exception', exc_info=True)
self.close()
return read | [
"def",
"socket_exception",
"(",
"func",
")",
":",
"def",
"read",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"func",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"except",
"socket",
".",
"error",
":",
"logger",
".",
"debug",
"(",
"'ignoring socket exception'",
",",
"exc_info",
"=",
"True",
")",
"self",
".",
"close",
"(",
")",
"return",
"read"
] | https://github.com/apache/thrift/blob/0b29261a4f3c6882ef3b09aae47914f0012b0472/lib/py/src/server/TNonblockingServer.py#L84-L92 |
|
Yijunmaverick/GenerativeFaceCompletion | f72dea0fa27c779fef7b65d2f01e82bcc23a0eb2 | scripts/cpp_lint.py | python | CleanseRawStrings | (raw_lines) | return lines_without_raw_strings | Removes C++11 raw strings from lines.
Before:
static const char kData[] = R"(
multi-line string
)";
After:
static const char kData[] = ""
(replaced by blank line)
"";
Args:
raw_lines: list of raw lines.
Returns:
list of lines with C++11 raw strings replaced by empty strings. | Removes C++11 raw strings from lines. | [
"Removes",
"C",
"++",
"11",
"raw",
"strings",
"from",
"lines",
"."
] | def CleanseRawStrings(raw_lines):
"""Removes C++11 raw strings from lines.
Before:
static const char kData[] = R"(
multi-line string
)";
After:
static const char kData[] = ""
(replaced by blank line)
"";
Args:
raw_lines: list of raw lines.
Returns:
list of lines with C++11 raw strings replaced by empty strings.
"""
delimiter = None
lines_without_raw_strings = []
for line in raw_lines:
if delimiter:
# Inside a raw string, look for the end
end = line.find(delimiter)
if end >= 0:
# Found the end of the string, match leading space for this
# line and resume copying the original lines, and also insert
# a "" on the last line.
leading_space = Match(r'^(\s*)\S', line)
line = leading_space.group(1) + '""' + line[end + len(delimiter):]
delimiter = None
else:
# Haven't found the end yet, append a blank line.
line = ''
else:
# Look for beginning of a raw string.
# See 2.14.15 [lex.string] for syntax.
matched = Match(r'^(.*)\b(?:R|u8R|uR|UR|LR)"([^\s\\()]*)\((.*)$', line)
if matched:
delimiter = ')' + matched.group(2) + '"'
end = matched.group(3).find(delimiter)
if end >= 0:
# Raw string ended on same line
line = (matched.group(1) + '""' +
matched.group(3)[end + len(delimiter):])
delimiter = None
else:
# Start of a multi-line raw string
line = matched.group(1) + '""'
lines_without_raw_strings.append(line)
# TODO(unknown): if delimiter is not None here, we might want to
# emit a warning for unterminated string.
return lines_without_raw_strings | [
"def",
"CleanseRawStrings",
"(",
"raw_lines",
")",
":",
"delimiter",
"=",
"None",
"lines_without_raw_strings",
"=",
"[",
"]",
"for",
"line",
"in",
"raw_lines",
":",
"if",
"delimiter",
":",
"# Inside a raw string, look for the end",
"end",
"=",
"line",
".",
"find",
"(",
"delimiter",
")",
"if",
"end",
">=",
"0",
":",
"# Found the end of the string, match leading space for this",
"# line and resume copying the original lines, and also insert",
"# a \"\" on the last line.",
"leading_space",
"=",
"Match",
"(",
"r'^(\\s*)\\S'",
",",
"line",
")",
"line",
"=",
"leading_space",
".",
"group",
"(",
"1",
")",
"+",
"'\"\"'",
"+",
"line",
"[",
"end",
"+",
"len",
"(",
"delimiter",
")",
":",
"]",
"delimiter",
"=",
"None",
"else",
":",
"# Haven't found the end yet, append a blank line.",
"line",
"=",
"''",
"else",
":",
"# Look for beginning of a raw string.",
"# See 2.14.15 [lex.string] for syntax.",
"matched",
"=",
"Match",
"(",
"r'^(.*)\\b(?:R|u8R|uR|UR|LR)\"([^\\s\\\\()]*)\\((.*)$'",
",",
"line",
")",
"if",
"matched",
":",
"delimiter",
"=",
"')'",
"+",
"matched",
".",
"group",
"(",
"2",
")",
"+",
"'\"'",
"end",
"=",
"matched",
".",
"group",
"(",
"3",
")",
".",
"find",
"(",
"delimiter",
")",
"if",
"end",
">=",
"0",
":",
"# Raw string ended on same line",
"line",
"=",
"(",
"matched",
".",
"group",
"(",
"1",
")",
"+",
"'\"\"'",
"+",
"matched",
".",
"group",
"(",
"3",
")",
"[",
"end",
"+",
"len",
"(",
"delimiter",
")",
":",
"]",
")",
"delimiter",
"=",
"None",
"else",
":",
"# Start of a multi-line raw string",
"line",
"=",
"matched",
".",
"group",
"(",
"1",
")",
"+",
"'\"\"'",
"lines_without_raw_strings",
".",
"append",
"(",
"line",
")",
"# TODO(unknown): if delimiter is not None here, we might want to",
"# emit a warning for unterminated string.",
"return",
"lines_without_raw_strings"
] | https://github.com/Yijunmaverick/GenerativeFaceCompletion/blob/f72dea0fa27c779fef7b65d2f01e82bcc23a0eb2/scripts/cpp_lint.py#L1062-L1120 |
|
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/lib/format.py | python | _filter_header | (s) | return tokenize.untokenize(tokens)[:-1] | Clean up 'L' in npz header ints.
Cleans up the 'L' in strings representing integers. Needed to allow npz
headers produced in Python2 to be read in Python3.
Parameters
----------
s : byte string
Npy file header.
Returns
-------
header : str
Cleaned up header. | Clean up 'L' in npz header ints. | [
"Clean",
"up",
"L",
"in",
"npz",
"header",
"ints",
"."
] | def _filter_header(s):
"""Clean up 'L' in npz header ints.
Cleans up the 'L' in strings representing integers. Needed to allow npz
headers produced in Python2 to be read in Python3.
Parameters
----------
s : byte string
Npy file header.
Returns
-------
header : str
Cleaned up header.
"""
import tokenize
if sys.version_info[0] >= 3:
from io import StringIO
else:
from StringIO import StringIO
tokens = []
last_token_was_number = False
# adding newline as python 2.7.5 workaround
string = asstr(s) + "\n"
for token in tokenize.generate_tokens(StringIO(string).readline):
token_type = token[0]
token_string = token[1]
if (last_token_was_number and
token_type == tokenize.NAME and
token_string == "L"):
continue
else:
tokens.append(token)
last_token_was_number = (token_type == tokenize.NUMBER)
# removing newline (see above) as python 2.7.5 workaround
return tokenize.untokenize(tokens)[:-1] | [
"def",
"_filter_header",
"(",
"s",
")",
":",
"import",
"tokenize",
"if",
"sys",
".",
"version_info",
"[",
"0",
"]",
">=",
"3",
":",
"from",
"io",
"import",
"StringIO",
"else",
":",
"from",
"StringIO",
"import",
"StringIO",
"tokens",
"=",
"[",
"]",
"last_token_was_number",
"=",
"False",
"# adding newline as python 2.7.5 workaround",
"string",
"=",
"asstr",
"(",
"s",
")",
"+",
"\"\\n\"",
"for",
"token",
"in",
"tokenize",
".",
"generate_tokens",
"(",
"StringIO",
"(",
"string",
")",
".",
"readline",
")",
":",
"token_type",
"=",
"token",
"[",
"0",
"]",
"token_string",
"=",
"token",
"[",
"1",
"]",
"if",
"(",
"last_token_was_number",
"and",
"token_type",
"==",
"tokenize",
".",
"NAME",
"and",
"token_string",
"==",
"\"L\"",
")",
":",
"continue",
"else",
":",
"tokens",
".",
"append",
"(",
"token",
")",
"last_token_was_number",
"=",
"(",
"token_type",
"==",
"tokenize",
".",
"NUMBER",
")",
"# removing newline (see above) as python 2.7.5 workaround",
"return",
"tokenize",
".",
"untokenize",
"(",
"tokens",
")",
"[",
":",
"-",
"1",
"]"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/lib/format.py#L479-L517 |
|
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/tempfile.py | python | mktemp | (suffix="", prefix=template, dir=None) | User-callable function to return a unique temporary file name. The
file is not created.
Arguments are as for mkstemp, except that the 'text' argument is
not accepted.
This function is unsafe and should not be used. The file name
refers to a file that did not exist at some point, but by the time
you get around to creating it, someone else may have beaten you to
the punch. | User-callable function to return a unique temporary file name. The
file is not created. | [
"User",
"-",
"callable",
"function",
"to",
"return",
"a",
"unique",
"temporary",
"file",
"name",
".",
"The",
"file",
"is",
"not",
"created",
"."
] | def mktemp(suffix="", prefix=template, dir=None):
"""User-callable function to return a unique temporary file name. The
file is not created.
Arguments are as for mkstemp, except that the 'text' argument is
not accepted.
This function is unsafe and should not be used. The file name
refers to a file that did not exist at some point, but by the time
you get around to creating it, someone else may have beaten you to
the punch.
"""
## from warnings import warn as _warn
## _warn("mktemp is a potential security risk to your program",
## RuntimeWarning, stacklevel=2)
if dir is None:
dir = gettempdir()
names = _get_candidate_names()
for seq in xrange(TMP_MAX):
name = names.next()
file = _os.path.join(dir, prefix + name + suffix)
if not _exists(file):
return file
raise IOError, (_errno.EEXIST, "No usable temporary filename found") | [
"def",
"mktemp",
"(",
"suffix",
"=",
"\"\"",
",",
"prefix",
"=",
"template",
",",
"dir",
"=",
"None",
")",
":",
"## from warnings import warn as _warn",
"## _warn(\"mktemp is a potential security risk to your program\",",
"## RuntimeWarning, stacklevel=2)",
"if",
"dir",
"is",
"None",
":",
"dir",
"=",
"gettempdir",
"(",
")",
"names",
"=",
"_get_candidate_names",
"(",
")",
"for",
"seq",
"in",
"xrange",
"(",
"TMP_MAX",
")",
":",
"name",
"=",
"names",
".",
"next",
"(",
")",
"file",
"=",
"_os",
".",
"path",
".",
"join",
"(",
"dir",
",",
"prefix",
"+",
"name",
"+",
"suffix",
")",
"if",
"not",
"_exists",
"(",
"file",
")",
":",
"return",
"file",
"raise",
"IOError",
",",
"(",
"_errno",
".",
"EEXIST",
",",
"\"No usable temporary filename found\"",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/tempfile.py#L338-L365 |
||
nvdla/sw | 79538ba1b52b040a4a4645f630e457fa01839e90 | umd/external/protobuf-2.6/python/mox.py | python | UnknownMethodCallError.__init__ | (self, unknown_method_name) | Init exception.
Args:
# unknown_method_name: Method call that is not part of the mocked class's
# public interface.
unknown_method_name: str | Init exception. | [
"Init",
"exception",
"."
] | def __init__(self, unknown_method_name):
"""Init exception.
Args:
# unknown_method_name: Method call that is not part of the mocked class's
# public interface.
unknown_method_name: str
"""
Error.__init__(self)
self._unknown_method_name = unknown_method_name | [
"def",
"__init__",
"(",
"self",
",",
"unknown_method_name",
")",
":",
"Error",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"_unknown_method_name",
"=",
"unknown_method_name"
] | https://github.com/nvdla/sw/blob/79538ba1b52b040a4a4645f630e457fa01839e90/umd/external/protobuf-2.6/python/mox.py#L133-L143 |
||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/while_v2_indexed_slices_rewriter.py | python | rewrite_grad_indexed_slices | (grads, body_grad_graph, loop_vars,
forward_inputs) | return loop_vars | Handles special case of IndexedSlices returned from while gradient.
Some gradient functions return IndexedSlices instead of a Tensor (e.g. the
gradient of Gather ops). When this happens in the gradient of a while body,
the resulting gradient body function will have mismatched inputs and outputs,
since the input is a single Tensor, but the IndexedSlices gets unnested into
three output Tensors.
This function fixes this by rewriting the gradient body to have three inputs
to match the three outputs, i.e., it effectively converts the input Tensor
into an input IndexedSlices. It also returns new `loop_vars` to reflect the
new inputs.
Args:
grads: the input gradient Tensors to the while gradient computation.
body_grad_graph: _WhileBodyGradFuncGraph.
loop_vars: list of Tensors. The inputs to body_grad_graph.
forward_inputs: list of Tensors. The (flat) inputs to the forward-pass While
op.
Returns:
The new loop_vars to pass to body_grad_graph. | Handles special case of IndexedSlices returned from while gradient. | [
"Handles",
"special",
"case",
"of",
"IndexedSlices",
"returned",
"from",
"while",
"gradient",
"."
] | def rewrite_grad_indexed_slices(grads, body_grad_graph, loop_vars,
forward_inputs):
"""Handles special case of IndexedSlices returned from while gradient.
Some gradient functions return IndexedSlices instead of a Tensor (e.g. the
gradient of Gather ops). When this happens in the gradient of a while body,
the resulting gradient body function will have mismatched inputs and outputs,
since the input is a single Tensor, but the IndexedSlices gets unnested into
three output Tensors.
This function fixes this by rewriting the gradient body to have three inputs
to match the three outputs, i.e., it effectively converts the input Tensor
into an input IndexedSlices. It also returns new `loop_vars` to reflect the
new inputs.
Args:
grads: the input gradient Tensors to the while gradient computation.
body_grad_graph: _WhileBodyGradFuncGraph.
loop_vars: list of Tensors. The inputs to body_grad_graph.
forward_inputs: list of Tensors. The (flat) inputs to the forward-pass While
op.
Returns:
The new loop_vars to pass to body_grad_graph.
"""
# Match up body_grad_graph.structured_outputs with the corresponding
# forward_inputs.
#
# Note that we don't expect a gradient computation to have structured output
# (e.g. no nested lists), so no need to flatten
# body_grad_graph.structured_outputs. However, structured_outputs may still
# contain composite tensors such as IndexedSlices, unlike
# body_grad_graph.outputs, which contains flattened composite tensors.
inputs_with_grads = [
t for g, t in zip(grads, forward_inputs) if g is not None
]
# Skip loop counter, maximum_iterations and total number of loop iterations.
structured_outputs = body_grad_graph.structured_outputs[3:]
for forward_input, output in zip(inputs_with_grads, structured_outputs):
if not isinstance(output, indexed_slices.IndexedSlices):
continue
if forward_input.dtype == dtypes.resource:
# TODO(skyewm): In theory we should use this for all captured inputs, not
# just resource handles (which can only be captured). We can do this by
# checking that forward_input is passed straight through to its output.
loop_vars = _rewrite_input_as_indexed_slices(body_grad_graph, output,
forward_input, loop_vars)
else:
_rewrite_output_as_tensor(body_grad_graph, output)
return loop_vars | [
"def",
"rewrite_grad_indexed_slices",
"(",
"grads",
",",
"body_grad_graph",
",",
"loop_vars",
",",
"forward_inputs",
")",
":",
"# Match up body_grad_graph.structured_outputs with the corresponding",
"# forward_inputs.",
"#",
"# Note that we don't expect a gradient computation to have structured output",
"# (e.g. no nested lists), so no need to flatten",
"# body_grad_graph.structured_outputs. However, structured_outputs may still",
"# contain composite tensors such as IndexedSlices, unlike",
"# body_grad_graph.outputs, which contains flattened composite tensors.",
"inputs_with_grads",
"=",
"[",
"t",
"for",
"g",
",",
"t",
"in",
"zip",
"(",
"grads",
",",
"forward_inputs",
")",
"if",
"g",
"is",
"not",
"None",
"]",
"# Skip loop counter, maximum_iterations and total number of loop iterations.",
"structured_outputs",
"=",
"body_grad_graph",
".",
"structured_outputs",
"[",
"3",
":",
"]",
"for",
"forward_input",
",",
"output",
"in",
"zip",
"(",
"inputs_with_grads",
",",
"structured_outputs",
")",
":",
"if",
"not",
"isinstance",
"(",
"output",
",",
"indexed_slices",
".",
"IndexedSlices",
")",
":",
"continue",
"if",
"forward_input",
".",
"dtype",
"==",
"dtypes",
".",
"resource",
":",
"# TODO(skyewm): In theory we should use this for all captured inputs, not",
"# just resource handles (which can only be captured). We can do this by",
"# checking that forward_input is passed straight through to its output.",
"loop_vars",
"=",
"_rewrite_input_as_indexed_slices",
"(",
"body_grad_graph",
",",
"output",
",",
"forward_input",
",",
"loop_vars",
")",
"else",
":",
"_rewrite_output_as_tensor",
"(",
"body_grad_graph",
",",
"output",
")",
"return",
"loop_vars"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/while_v2_indexed_slices_rewriter.py#L28-L80 |
|
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | Sizer._setOORInfo | (*args, **kwargs) | return _core_.Sizer__setOORInfo(*args, **kwargs) | _setOORInfo(self, PyObject _self) | _setOORInfo(self, PyObject _self) | [
"_setOORInfo",
"(",
"self",
"PyObject",
"_self",
")"
] | def _setOORInfo(*args, **kwargs):
"""_setOORInfo(self, PyObject _self)"""
return _core_.Sizer__setOORInfo(*args, **kwargs) | [
"def",
"_setOORInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Sizer__setOORInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L14446-L14448 |
|
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/dependency_manager/dependency_manager/base_config.py | python | BaseConfig.GetVersion | (self, dependency, platform) | return self._GetPlatformData(
dependency, platform, data_type='version_in_cs') | Return the Version information for the given dependency. | Return the Version information for the given dependency. | [
"Return",
"the",
"Version",
"information",
"for",
"the",
"given",
"dependency",
"."
] | def GetVersion(self, dependency, platform):
"""Return the Version information for the given dependency."""
return self._GetPlatformData(
dependency, platform, data_type='version_in_cs') | [
"def",
"GetVersion",
"(",
"self",
",",
"dependency",
",",
"platform",
")",
":",
"return",
"self",
".",
"_GetPlatformData",
"(",
"dependency",
",",
"platform",
",",
"data_type",
"=",
"'version_in_cs'",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/dependency_manager/dependency_manager/base_config.py#L286-L289 |
|
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/signal/filter_design.py | python | _align_nums | (nums) | Aligns the shapes of multiple numerators.
Given an array of numerator coefficient arrays [[a_1, a_2,...,
a_n],..., [b_1, b_2,..., b_m]], this function pads shorter numerator
arrays with zero's so that all numerators have the same length. Such
alignment is necessary for functions like 'tf2ss', which needs the
alignment when dealing with SIMO transfer functions.
Parameters
----------
nums: array_like
Numerator or list of numerators. Not necessarily with same length.
Returns
-------
nums: array
The numerator. If `nums` input was a list of numerators then a 2d
array with padded zeros for shorter numerators is returned. Otherwise
returns ``np.asarray(nums)``. | Aligns the shapes of multiple numerators. | [
"Aligns",
"the",
"shapes",
"of",
"multiple",
"numerators",
"."
] | def _align_nums(nums):
"""Aligns the shapes of multiple numerators.
Given an array of numerator coefficient arrays [[a_1, a_2,...,
a_n],..., [b_1, b_2,..., b_m]], this function pads shorter numerator
arrays with zero's so that all numerators have the same length. Such
alignment is necessary for functions like 'tf2ss', which needs the
alignment when dealing with SIMO transfer functions.
Parameters
----------
nums: array_like
Numerator or list of numerators. Not necessarily with same length.
Returns
-------
nums: array
The numerator. If `nums` input was a list of numerators then a 2d
array with padded zeros for shorter numerators is returned. Otherwise
returns ``np.asarray(nums)``.
"""
try:
# The statement can throw a ValueError if one
# of the numerators is a single digit and another
# is array-like e.g. if nums = [5, [1, 2, 3]]
nums = asarray(nums)
if not np.issubdtype(nums.dtype, np.number):
raise ValueError("dtype of numerator is non-numeric")
return nums
except ValueError:
nums = [np.atleast_1d(num) for num in nums]
max_width = max(num.size for num in nums)
# pre-allocate
aligned_nums = np.zeros((len(nums), max_width))
# Create numerators with padded zeros
for index, num in enumerate(nums):
aligned_nums[index, -num.size:] = num
return aligned_nums | [
"def",
"_align_nums",
"(",
"nums",
")",
":",
"try",
":",
"# The statement can throw a ValueError if one",
"# of the numerators is a single digit and another",
"# is array-like e.g. if nums = [5, [1, 2, 3]]",
"nums",
"=",
"asarray",
"(",
"nums",
")",
"if",
"not",
"np",
".",
"issubdtype",
"(",
"nums",
".",
"dtype",
",",
"np",
".",
"number",
")",
":",
"raise",
"ValueError",
"(",
"\"dtype of numerator is non-numeric\"",
")",
"return",
"nums",
"except",
"ValueError",
":",
"nums",
"=",
"[",
"np",
".",
"atleast_1d",
"(",
"num",
")",
"for",
"num",
"in",
"nums",
"]",
"max_width",
"=",
"max",
"(",
"num",
".",
"size",
"for",
"num",
"in",
"nums",
")",
"# pre-allocate",
"aligned_nums",
"=",
"np",
".",
"zeros",
"(",
"(",
"len",
"(",
"nums",
")",
",",
"max_width",
")",
")",
"# Create numerators with padded zeros",
"for",
"index",
",",
"num",
"in",
"enumerate",
"(",
"nums",
")",
":",
"aligned_nums",
"[",
"index",
",",
"-",
"num",
".",
"size",
":",
"]",
"=",
"num",
"return",
"aligned_nums"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/signal/filter_design.py#L1165-L1208 |
||
bigtreetech/BIGTREETECH-SKR-mini-E3 | 221247c12502ff92d071c701ea63cf3aa9bb3b29 | firmware/V2.0/Marlin-2.0.8.2.x-SKR-mini-E3-V2.0/buildroot/share/scripts/createTemperatureLookupMarlin.py | python | main | (argv) | Default values | Default values | [
"Default",
"values"
] | def main(argv):
"Default values"
t1 = 25 # low temperature in Kelvin (25 degC)
r1 = 100000 # resistance at low temperature (10 kOhm)
t2 = 150 # middle temperature in Kelvin (150 degC)
r2 = 1641.9 # resistance at middle temperature (1.6 KOhm)
t3 = 250 # high temperature in Kelvin (250 degC)
r3 = 226.15 # resistance at high temperature (226.15 Ohm)
rp = 4700; # pull-up resistor (4.7 kOhm)
num_temps = 36; # number of entries for look-up table
try:
opts, args = getopt.getopt(argv, "h", ["help", "rp=", "t1=", "t2=", "t3=", "num-temps="])
except getopt.GetoptError as err:
print(str(err))
usage()
sys.exit(2)
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
sys.exit()
elif opt == "--rp":
rp = int(arg)
elif opt == "--t1":
arg = arg.split(':')
t1 = float(arg[0])
r1 = float(arg[1])
elif opt == "--t2":
arg = arg.split(':')
t2 = float(arg[0])
r2 = float(arg[1])
elif opt == "--t3":
arg = arg.split(':')
t3 = float(arg[0])
r3 = float(arg[1])
elif opt == "--num-temps":
num_temps = int(arg)
t = Thermistor(rp, t1, r1, t2, r2, t3, r3)
increment = int((ARES-1)/(num_temps-1));
step = (TMIN-TMAX) / (num_temps-1)
low_bound = t.temp(ARES-1);
up_bound = t.temp(1);
min_temp = int(TMIN if TMIN > low_bound else low_bound)
max_temp = int(TMAX if TMAX < up_bound else up_bound)
temps = list(range(max_temp, TMIN+step, step));
print("// Thermistor lookup table for Marlin")
print("// ./createTemperatureLookupMarlin.py --rp=%s --t1=%s:%s --t2=%s:%s --t3=%s:%s --num-temps=%s" % (rp, t1, r1, t2, r2, t3, r3, num_temps))
print("// Steinhart-Hart Coefficients: a=%.15g, b=%.15g, c=%.15g " % (t.c1, t.c2, t.c3))
print("// Theoretical limits of thermistor: %.2f to %.2f degC" % (low_bound, up_bound))
print()
print("const short temptable[][2] PROGMEM = {")
for temp in temps:
adc = t.adc(temp)
print(" { OV(%7.2f), %4s }%s // v=%.3f\tr=%.3f\tres=%.3f degC/count" % (adc , temp, \
',' if temp != temps[-1] else ' ', \
t.voltage(adc), \
t.resist( adc), \
t.resol( adc) \
))
print("};") | [
"def",
"main",
"(",
"argv",
")",
":",
"t1",
"=",
"25",
"# low temperature in Kelvin (25 degC)",
"r1",
"=",
"100000",
"# resistance at low temperature (10 kOhm)",
"t2",
"=",
"150",
"# middle temperature in Kelvin (150 degC)",
"r2",
"=",
"1641.9",
"# resistance at middle temperature (1.6 KOhm)",
"t3",
"=",
"250",
"# high temperature in Kelvin (250 degC)",
"r3",
"=",
"226.15",
"# resistance at high temperature (226.15 Ohm)",
"rp",
"=",
"4700",
"# pull-up resistor (4.7 kOhm)",
"num_temps",
"=",
"36",
"# number of entries for look-up table",
"try",
":",
"opts",
",",
"args",
"=",
"getopt",
".",
"getopt",
"(",
"argv",
",",
"\"h\"",
",",
"[",
"\"help\"",
",",
"\"rp=\"",
",",
"\"t1=\"",
",",
"\"t2=\"",
",",
"\"t3=\"",
",",
"\"num-temps=\"",
"]",
")",
"except",
"getopt",
".",
"GetoptError",
"as",
"err",
":",
"print",
"(",
"str",
"(",
"err",
")",
")",
"usage",
"(",
")",
"sys",
".",
"exit",
"(",
"2",
")",
"for",
"opt",
",",
"arg",
"in",
"opts",
":",
"if",
"opt",
"in",
"(",
"\"-h\"",
",",
"\"--help\"",
")",
":",
"usage",
"(",
")",
"sys",
".",
"exit",
"(",
")",
"elif",
"opt",
"==",
"\"--rp\"",
":",
"rp",
"=",
"int",
"(",
"arg",
")",
"elif",
"opt",
"==",
"\"--t1\"",
":",
"arg",
"=",
"arg",
".",
"split",
"(",
"':'",
")",
"t1",
"=",
"float",
"(",
"arg",
"[",
"0",
"]",
")",
"r1",
"=",
"float",
"(",
"arg",
"[",
"1",
"]",
")",
"elif",
"opt",
"==",
"\"--t2\"",
":",
"arg",
"=",
"arg",
".",
"split",
"(",
"':'",
")",
"t2",
"=",
"float",
"(",
"arg",
"[",
"0",
"]",
")",
"r2",
"=",
"float",
"(",
"arg",
"[",
"1",
"]",
")",
"elif",
"opt",
"==",
"\"--t3\"",
":",
"arg",
"=",
"arg",
".",
"split",
"(",
"':'",
")",
"t3",
"=",
"float",
"(",
"arg",
"[",
"0",
"]",
")",
"r3",
"=",
"float",
"(",
"arg",
"[",
"1",
"]",
")",
"elif",
"opt",
"==",
"\"--num-temps\"",
":",
"num_temps",
"=",
"int",
"(",
"arg",
")",
"t",
"=",
"Thermistor",
"(",
"rp",
",",
"t1",
",",
"r1",
",",
"t2",
",",
"r2",
",",
"t3",
",",
"r3",
")",
"increment",
"=",
"int",
"(",
"(",
"ARES",
"-",
"1",
")",
"/",
"(",
"num_temps",
"-",
"1",
")",
")",
"step",
"=",
"(",
"TMIN",
"-",
"TMAX",
")",
"/",
"(",
"num_temps",
"-",
"1",
")",
"low_bound",
"=",
"t",
".",
"temp",
"(",
"ARES",
"-",
"1",
")",
"up_bound",
"=",
"t",
".",
"temp",
"(",
"1",
")",
"min_temp",
"=",
"int",
"(",
"TMIN",
"if",
"TMIN",
">",
"low_bound",
"else",
"low_bound",
")",
"max_temp",
"=",
"int",
"(",
"TMAX",
"if",
"TMAX",
"<",
"up_bound",
"else",
"up_bound",
")",
"temps",
"=",
"list",
"(",
"range",
"(",
"max_temp",
",",
"TMIN",
"+",
"step",
",",
"step",
")",
")",
"print",
"(",
"\"// Thermistor lookup table for Marlin\"",
")",
"print",
"(",
"\"// ./createTemperatureLookupMarlin.py --rp=%s --t1=%s:%s --t2=%s:%s --t3=%s:%s --num-temps=%s\"",
"%",
"(",
"rp",
",",
"t1",
",",
"r1",
",",
"t2",
",",
"r2",
",",
"t3",
",",
"r3",
",",
"num_temps",
")",
")",
"print",
"(",
"\"// Steinhart-Hart Coefficients: a=%.15g, b=%.15g, c=%.15g \"",
"%",
"(",
"t",
".",
"c1",
",",
"t",
".",
"c2",
",",
"t",
".",
"c3",
")",
")",
"print",
"(",
"\"// Theoretical limits of thermistor: %.2f to %.2f degC\"",
"%",
"(",
"low_bound",
",",
"up_bound",
")",
")",
"print",
"(",
")",
"print",
"(",
"\"const short temptable[][2] PROGMEM = {\"",
")",
"for",
"temp",
"in",
"temps",
":",
"adc",
"=",
"t",
".",
"adc",
"(",
"temp",
")",
"print",
"(",
"\" { OV(%7.2f), %4s }%s // v=%.3f\\tr=%.3f\\tres=%.3f degC/count\"",
"%",
"(",
"adc",
",",
"temp",
",",
"','",
"if",
"temp",
"!=",
"temps",
"[",
"-",
"1",
"]",
"else",
"' '",
",",
"t",
".",
"voltage",
"(",
"adc",
")",
",",
"t",
".",
"resist",
"(",
"adc",
")",
",",
"t",
".",
"resol",
"(",
"adc",
")",
")",
")",
"print",
"(",
"\"};\"",
")"
] | https://github.com/bigtreetech/BIGTREETECH-SKR-mini-E3/blob/221247c12502ff92d071c701ea63cf3aa9bb3b29/firmware/V2.0/Marlin-2.0.8.2.x-SKR-mini-E3-V2.0/buildroot/share/scripts/createTemperatureLookupMarlin.py#L88-L151 |
||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py3/google/protobuf/descriptor.py | python | _OptionsOrNone | (descriptor_proto) | Returns the value of the field `options`, or None if it is not set. | Returns the value of the field `options`, or None if it is not set. | [
"Returns",
"the",
"value",
"of",
"the",
"field",
"options",
"or",
"None",
"if",
"it",
"is",
"not",
"set",
"."
] | def _OptionsOrNone(descriptor_proto):
"""Returns the value of the field `options`, or None if it is not set."""
if descriptor_proto.HasField('options'):
return descriptor_proto.options
else:
return None | [
"def",
"_OptionsOrNone",
"(",
"descriptor_proto",
")",
":",
"if",
"descriptor_proto",
".",
"HasField",
"(",
"'options'",
")",
":",
"return",
"descriptor_proto",
".",
"options",
"else",
":",
"return",
"None"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py3/google/protobuf/descriptor.py#L1054-L1059 |
||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/valgrind/suppressions.py | python | ReadDrMemorySuppressions | (lines, supp_descriptor) | return suppressions | Given a list of lines, returns a list of DrMemory suppressions.
Args:
lines: a list of lines containing suppressions.
supp_descriptor: should typically be a filename.
Used only when parsing errors happen. | Given a list of lines, returns a list of DrMemory suppressions. | [
"Given",
"a",
"list",
"of",
"lines",
"returns",
"a",
"list",
"of",
"DrMemory",
"suppressions",
"."
] | def ReadDrMemorySuppressions(lines, supp_descriptor):
"""Given a list of lines, returns a list of DrMemory suppressions.
Args:
lines: a list of lines containing suppressions.
supp_descriptor: should typically be a filename.
Used only when parsing errors happen.
"""
lines = StripAndSkipCommentsIterator(lines)
suppressions = []
for (line_no, line) in lines:
if not line:
continue
if line not in DRMEMORY_ERROR_TYPES:
raise SuppressionError('Expected a DrMemory error type, '
'found %r instead\n Valid error types: %s' %
(line, ' '.join(DRMEMORY_ERROR_TYPES)),
"%s:%d" % (supp_descriptor, line_no))
# Suppression starts here.
report_type = line
name = ''
instr = None
stack = []
defined_at = "%s:%d" % (supp_descriptor, line_no)
found_stack = False
for (line_no, line) in lines:
if not found_stack and line.startswith('name='):
name = line.replace('name=', '')
elif not found_stack and line.startswith('instruction='):
instr = line.replace('instruction=', '')
else:
# Unrecognized prefix indicates start of stack trace.
found_stack = True
if not line:
# Blank line means end of suppression.
break
if not any([regex.match(line) for regex in DRMEMORY_FRAME_PATTERNS]):
raise SuppressionError(
('Unexpected stack frame pattern at line %d\n' +
'Frames should be one of the following:\n' +
' module!function\n' +
' module!...\n' +
' <module+0xhexoffset>\n' +
' <not in a module>\n' +
' system call Name\n' +
' *\n' +
' ...\n') % line_no, defined_at)
stack.append(line)
if len(stack) == 0: # In case we hit EOF or blank without any stack frames.
raise SuppressionError('Suppression "%s" has no stack frames, ends at %d'
% (name, line_no), defined_at)
if stack[-1] == ELLIPSIS:
raise SuppressionError('Suppression "%s" ends in an ellipsis on line %d' %
(name, line_no), defined_at)
suppressions.append(
DrMemorySuppression(name, report_type, instr, stack, defined_at))
return suppressions | [
"def",
"ReadDrMemorySuppressions",
"(",
"lines",
",",
"supp_descriptor",
")",
":",
"lines",
"=",
"StripAndSkipCommentsIterator",
"(",
"lines",
")",
"suppressions",
"=",
"[",
"]",
"for",
"(",
"line_no",
",",
"line",
")",
"in",
"lines",
":",
"if",
"not",
"line",
":",
"continue",
"if",
"line",
"not",
"in",
"DRMEMORY_ERROR_TYPES",
":",
"raise",
"SuppressionError",
"(",
"'Expected a DrMemory error type, '",
"'found %r instead\\n Valid error types: %s'",
"%",
"(",
"line",
",",
"' '",
".",
"join",
"(",
"DRMEMORY_ERROR_TYPES",
")",
")",
",",
"\"%s:%d\"",
"%",
"(",
"supp_descriptor",
",",
"line_no",
")",
")",
"# Suppression starts here.",
"report_type",
"=",
"line",
"name",
"=",
"''",
"instr",
"=",
"None",
"stack",
"=",
"[",
"]",
"defined_at",
"=",
"\"%s:%d\"",
"%",
"(",
"supp_descriptor",
",",
"line_no",
")",
"found_stack",
"=",
"False",
"for",
"(",
"line_no",
",",
"line",
")",
"in",
"lines",
":",
"if",
"not",
"found_stack",
"and",
"line",
".",
"startswith",
"(",
"'name='",
")",
":",
"name",
"=",
"line",
".",
"replace",
"(",
"'name='",
",",
"''",
")",
"elif",
"not",
"found_stack",
"and",
"line",
".",
"startswith",
"(",
"'instruction='",
")",
":",
"instr",
"=",
"line",
".",
"replace",
"(",
"'instruction='",
",",
"''",
")",
"else",
":",
"# Unrecognized prefix indicates start of stack trace.",
"found_stack",
"=",
"True",
"if",
"not",
"line",
":",
"# Blank line means end of suppression.",
"break",
"if",
"not",
"any",
"(",
"[",
"regex",
".",
"match",
"(",
"line",
")",
"for",
"regex",
"in",
"DRMEMORY_FRAME_PATTERNS",
"]",
")",
":",
"raise",
"SuppressionError",
"(",
"(",
"'Unexpected stack frame pattern at line %d\\n'",
"+",
"'Frames should be one of the following:\\n'",
"+",
"' module!function\\n'",
"+",
"' module!...\\n'",
"+",
"' <module+0xhexoffset>\\n'",
"+",
"' <not in a module>\\n'",
"+",
"' system call Name\\n'",
"+",
"' *\\n'",
"+",
"' ...\\n'",
")",
"%",
"line_no",
",",
"defined_at",
")",
"stack",
".",
"append",
"(",
"line",
")",
"if",
"len",
"(",
"stack",
")",
"==",
"0",
":",
"# In case we hit EOF or blank without any stack frames.",
"raise",
"SuppressionError",
"(",
"'Suppression \"%s\" has no stack frames, ends at %d'",
"%",
"(",
"name",
",",
"line_no",
")",
",",
"defined_at",
")",
"if",
"stack",
"[",
"-",
"1",
"]",
"==",
"ELLIPSIS",
":",
"raise",
"SuppressionError",
"(",
"'Suppression \"%s\" ends in an ellipsis on line %d'",
"%",
"(",
"name",
",",
"line_no",
")",
",",
"defined_at",
")",
"suppressions",
".",
"append",
"(",
"DrMemorySuppression",
"(",
"name",
",",
"report_type",
",",
"instr",
",",
"stack",
",",
"defined_at",
")",
")",
"return",
"suppressions"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/valgrind/suppressions.py#L446-L506 |
|
mangosArchives/serverZero_Rel19 | 395039dd19cca769ec42186e76f0477089cc2490 | dep/ACE_wrappers/bin/make_release.py | python | get_and_update_versions | () | Gets current version information for each component,
updates the version files, creates changelog entries,
and commit the changes into the repository. | Gets current version information for each component,
updates the version files, creates changelog entries,
and commit the changes into the repository. | [
"Gets",
"current",
"version",
"information",
"for",
"each",
"component",
"updates",
"the",
"version",
"files",
"creates",
"changelog",
"entries",
"and",
"commit",
"the",
"changes",
"into",
"the",
"repository",
"."
] | def get_and_update_versions ():
""" Gets current version information for each component,
updates the version files, creates changelog entries,
and commit the changes into the repository."""
try:
get_comp_versions ("ACE")
get_comp_versions ("TAO")
get_comp_versions ("CIAO")
get_comp_versions ("DAnCE")
files = list ()
files += update_version_files ("ACE")
files += update_version_files ("TAO")
files += update_version_files ("CIAO")
files += update_version_files ("DAnCE")
files += create_changelog ("ACE")
files += create_changelog ("TAO")
files += create_changelog ("CIAO")
files += create_changelog ("DAnCE")
files += update_debianbuild ()
print "Committing " + str(files)
commit (files)
except:
print "Fatal error in get_and_update_versions."
raise | [
"def",
"get_and_update_versions",
"(",
")",
":",
"try",
":",
"get_comp_versions",
"(",
"\"ACE\"",
")",
"get_comp_versions",
"(",
"\"TAO\"",
")",
"get_comp_versions",
"(",
"\"CIAO\"",
")",
"get_comp_versions",
"(",
"\"DAnCE\"",
")",
"files",
"=",
"list",
"(",
")",
"files",
"+=",
"update_version_files",
"(",
"\"ACE\"",
")",
"files",
"+=",
"update_version_files",
"(",
"\"TAO\"",
")",
"files",
"+=",
"update_version_files",
"(",
"\"CIAO\"",
")",
"files",
"+=",
"update_version_files",
"(",
"\"DAnCE\"",
")",
"files",
"+=",
"create_changelog",
"(",
"\"ACE\"",
")",
"files",
"+=",
"create_changelog",
"(",
"\"TAO\"",
")",
"files",
"+=",
"create_changelog",
"(",
"\"CIAO\"",
")",
"files",
"+=",
"create_changelog",
"(",
"\"DAnCE\"",
")",
"files",
"+=",
"update_debianbuild",
"(",
")",
"print",
"\"Committing \"",
"+",
"str",
"(",
"files",
")",
"commit",
"(",
"files",
")",
"except",
":",
"print",
"\"Fatal error in get_and_update_versions.\"",
"raise"
] | https://github.com/mangosArchives/serverZero_Rel19/blob/395039dd19cca769ec42186e76f0477089cc2490/dep/ACE_wrappers/bin/make_release.py#L420-L447 |
||
lballabio/quantlib-old | 136336947ed4fea9ecc1da6edad188700e821739 | gensrc/gensrc/types/datatype.py | python | DataType.value | (self) | return self.value_ | Return the data type. | Return the data type. | [
"Return",
"the",
"data",
"type",
"."
] | def value(self):
"""Return the data type."""
return self.value_ | [
"def",
"value",
"(",
"self",
")",
":",
"return",
"self",
".",
"value_"
] | https://github.com/lballabio/quantlib-old/blob/136336947ed4fea9ecc1da6edad188700e821739/gensrc/gensrc/types/datatype.py#L39-L41 |
|
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TNEANet.AttrValueNI | (self, *args) | return _snap.TNEANet_AttrValueNI(self, *args) | AttrValueNI(TNEANet self, TInt NId, TStrV Values)
Parameters:
NId: TInt const &
Values: TStrV &
AttrValueNI(TNEANet self, TInt NId, TStrIntPrH::TIter NodeHI, TStrV Values)
Parameters:
NId: TInt const &
NodeHI: TStrIntPrH::TIter
Values: TStrV & | AttrValueNI(TNEANet self, TInt NId, TStrV Values) | [
"AttrValueNI",
"(",
"TNEANet",
"self",
"TInt",
"NId",
"TStrV",
"Values",
")"
] | def AttrValueNI(self, *args):
"""
AttrValueNI(TNEANet self, TInt NId, TStrV Values)
Parameters:
NId: TInt const &
Values: TStrV &
AttrValueNI(TNEANet self, TInt NId, TStrIntPrH::TIter NodeHI, TStrV Values)
Parameters:
NId: TInt const &
NodeHI: TStrIntPrH::TIter
Values: TStrV &
"""
return _snap.TNEANet_AttrValueNI(self, *args) | [
"def",
"AttrValueNI",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TNEANet_AttrValueNI",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L21455-L21471 |
|
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/factorization/python/ops/gmm_ops.py | python | GmmAlgorithm.is_initialized | (self) | return self._cluster_centers_initialized | Returns a boolean operation for initialized variables. | Returns a boolean operation for initialized variables. | [
"Returns",
"a",
"boolean",
"operation",
"for",
"initialized",
"variables",
"."
] | def is_initialized(self):
"""Returns a boolean operation for initialized variables."""
return self._cluster_centers_initialized | [
"def",
"is_initialized",
"(",
"self",
")",
":",
"return",
"self",
".",
"_cluster_centers_initialized"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/factorization/python/ops/gmm_ops.py#L233-L235 |
|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/ttk.py | python | Panedwindow.__init__ | (self, master=None, **kw) | Construct a Ttk Panedwindow with parent master.
STANDARD OPTIONS
class, cursor, style, takefocus
WIDGET-SPECIFIC OPTIONS
orient, width, height
PANE OPTIONS
weight | Construct a Ttk Panedwindow with parent master. | [
"Construct",
"a",
"Ttk",
"Panedwindow",
"with",
"parent",
"master",
"."
] | def __init__(self, master=None, **kw):
"""Construct a Ttk Panedwindow with parent master.
STANDARD OPTIONS
class, cursor, style, takefocus
WIDGET-SPECIFIC OPTIONS
orient, width, height
PANE OPTIONS
weight
"""
Widget.__init__(self, master, "ttk::panedwindow", kw) | [
"def",
"__init__",
"(",
"self",
",",
"master",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"Widget",
".",
"__init__",
"(",
"self",
",",
"master",
",",
"\"ttk::panedwindow\"",
",",
"kw",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/ttk.py#L941-L956 |
||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/ImageFile.py | python | PyDecoder.init | (self, args) | Override to perform decoder specific initialization
:param args: Array of args items from the tile entry
:returns: None | Override to perform decoder specific initialization | [
"Override",
"to",
"perform",
"decoder",
"specific",
"initialization"
] | def init(self, args):
"""
Override to perform decoder specific initialization
:param args: Array of args items from the tile entry
:returns: None
"""
self.args = args | [
"def",
"init",
"(",
"self",
",",
"args",
")",
":",
"self",
".",
"args",
"=",
"args"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/ImageFile.py#L588-L595 |
||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | ListView.Select | (*args, **kwargs) | return _controls_.ListView_Select(*args, **kwargs) | Select(self, long n, bool on=True) | Select(self, long n, bool on=True) | [
"Select",
"(",
"self",
"long",
"n",
"bool",
"on",
"=",
"True",
")"
] | def Select(*args, **kwargs):
"""Select(self, long n, bool on=True)"""
return _controls_.ListView_Select(*args, **kwargs) | [
"def",
"Select",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ListView_Select",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L4915-L4917 |
|
epam/Indigo | 30e40b4b1eb9bae0207435a26cfcb81ddcc42be1 | api/python/indigo/__init__.py | python | IndigoObject.isotope | (self) | return self.dispatcher._checkResult(Indigo._lib.indigoIsotope(self.id)) | Atom method returns the isotope number
Returns:
int: isotope number | Atom method returns the isotope number | [
"Atom",
"method",
"returns",
"the",
"isotope",
"number"
] | def isotope(self):
"""Atom method returns the isotope number
Returns:
int: isotope number
"""
self.dispatcher._setSessionId()
return self.dispatcher._checkResult(Indigo._lib.indigoIsotope(self.id)) | [
"def",
"isotope",
"(",
"self",
")",
":",
"self",
".",
"dispatcher",
".",
"_setSessionId",
"(",
")",
"return",
"self",
".",
"dispatcher",
".",
"_checkResult",
"(",
"Indigo",
".",
"_lib",
".",
"indigoIsotope",
"(",
"self",
".",
"id",
")",
")"
] | https://github.com/epam/Indigo/blob/30e40b4b1eb9bae0207435a26cfcb81ddcc42be1/api/python/indigo/__init__.py#L1163-L1170 |
|
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/macurl2path.py | python | url2pathname | (pathname) | return urllib.unquote(rv) | OS-specific conversion from a relative URL of the 'file' scheme
to a file system path; not recommended for general use. | OS-specific conversion from a relative URL of the 'file' scheme
to a file system path; not recommended for general use. | [
"OS",
"-",
"specific",
"conversion",
"from",
"a",
"relative",
"URL",
"of",
"the",
"file",
"scheme",
"to",
"a",
"file",
"system",
"path",
";",
"not",
"recommended",
"for",
"general",
"use",
"."
] | def url2pathname(pathname):
"""OS-specific conversion from a relative URL of the 'file' scheme
to a file system path; not recommended for general use."""
#
# XXXX The .. handling should be fixed...
#
tp = urllib.splittype(pathname)[0]
if tp and tp != 'file':
raise RuntimeError, 'Cannot convert non-local URL to pathname'
# Turn starting /// into /, an empty hostname means current host
if pathname[:3] == '///':
pathname = pathname[2:]
elif pathname[:2] == '//':
raise RuntimeError, 'Cannot convert non-local URL to pathname'
components = pathname.split('/')
# Remove . and embedded ..
i = 0
while i < len(components):
if components[i] == '.':
del components[i]
elif components[i] == '..' and i > 0 and \
components[i-1] not in ('', '..'):
del components[i-1:i+1]
i = i-1
elif components[i] == '' and i > 0 and components[i-1] != '':
del components[i]
else:
i = i+1
if not components[0]:
# Absolute unix path, don't start with colon
rv = ':'.join(components[1:])
else:
# relative unix path, start with colon. First replace
# leading .. by empty strings (giving ::file)
i = 0
while i < len(components) and components[i] == '..':
components[i] = ''
i = i + 1
rv = ':' + ':'.join(components)
# and finally unquote slashes and other funny characters
return urllib.unquote(rv) | [
"def",
"url2pathname",
"(",
"pathname",
")",
":",
"#",
"# XXXX The .. handling should be fixed...",
"#",
"tp",
"=",
"urllib",
".",
"splittype",
"(",
"pathname",
")",
"[",
"0",
"]",
"if",
"tp",
"and",
"tp",
"!=",
"'file'",
":",
"raise",
"RuntimeError",
",",
"'Cannot convert non-local URL to pathname'",
"# Turn starting /// into /, an empty hostname means current host",
"if",
"pathname",
"[",
":",
"3",
"]",
"==",
"'///'",
":",
"pathname",
"=",
"pathname",
"[",
"2",
":",
"]",
"elif",
"pathname",
"[",
":",
"2",
"]",
"==",
"'//'",
":",
"raise",
"RuntimeError",
",",
"'Cannot convert non-local URL to pathname'",
"components",
"=",
"pathname",
".",
"split",
"(",
"'/'",
")",
"# Remove . and embedded ..",
"i",
"=",
"0",
"while",
"i",
"<",
"len",
"(",
"components",
")",
":",
"if",
"components",
"[",
"i",
"]",
"==",
"'.'",
":",
"del",
"components",
"[",
"i",
"]",
"elif",
"components",
"[",
"i",
"]",
"==",
"'..'",
"and",
"i",
">",
"0",
"and",
"components",
"[",
"i",
"-",
"1",
"]",
"not",
"in",
"(",
"''",
",",
"'..'",
")",
":",
"del",
"components",
"[",
"i",
"-",
"1",
":",
"i",
"+",
"1",
"]",
"i",
"=",
"i",
"-",
"1",
"elif",
"components",
"[",
"i",
"]",
"==",
"''",
"and",
"i",
">",
"0",
"and",
"components",
"[",
"i",
"-",
"1",
"]",
"!=",
"''",
":",
"del",
"components",
"[",
"i",
"]",
"else",
":",
"i",
"=",
"i",
"+",
"1",
"if",
"not",
"components",
"[",
"0",
"]",
":",
"# Absolute unix path, don't start with colon",
"rv",
"=",
"':'",
".",
"join",
"(",
"components",
"[",
"1",
":",
"]",
")",
"else",
":",
"# relative unix path, start with colon. First replace",
"# leading .. by empty strings (giving ::file)",
"i",
"=",
"0",
"while",
"i",
"<",
"len",
"(",
"components",
")",
"and",
"components",
"[",
"i",
"]",
"==",
"'..'",
":",
"components",
"[",
"i",
"]",
"=",
"''",
"i",
"=",
"i",
"+",
"1",
"rv",
"=",
"':'",
"+",
"':'",
".",
"join",
"(",
"components",
")",
"# and finally unquote slashes and other funny characters",
"return",
"urllib",
".",
"unquote",
"(",
"rv",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/macurl2path.py#L10-L50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.