nwo stringlengths 5 86 | sha stringlengths 40 40 | path stringlengths 4 189 | language stringclasses 1
value | identifier stringlengths 1 94 | parameters stringlengths 2 4.03k | argument_list stringclasses 1
value | return_statement stringlengths 0 11.5k | docstring stringlengths 1 33.2k | docstring_summary stringlengths 0 5.15k | docstring_tokens list | function stringlengths 34 151k | function_tokens list | url stringlengths 90 278 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/mailbox.py | python | _ProxyFile.__init__ | (self, f, pos=None) | Initialize a _ProxyFile. | Initialize a _ProxyFile. | [
"Initialize",
"a",
"_ProxyFile",
"."
] | def __init__(self, f, pos=None):
"""Initialize a _ProxyFile."""
self._file = f
if pos is None:
self._pos = f.tell()
else:
self._pos = pos | [
"def",
"__init__",
"(",
"self",
",",
"f",
",",
"pos",
"=",
"None",
")",
":",
"self",
".",
"_file",
"=",
"f",
"if",
"pos",
"is",
"None",
":",
"self",
".",
"_pos",
"=",
"f",
".",
"tell",
"(",
")",
"else",
":",
"self",
".",
"_pos",
"=",
"pos"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/mailbox.py#L1923-L1929 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | caffe2/python/onnx/backend.py | python | Caffe2Backend._create_tensor_filling_op | (cls, onnx_tensor, name=None) | return c2_op | Given an Onnx TensorProto, translate it into a Caffe2 operator
which produces the given tensor filling op. | Given an Onnx TensorProto, translate it into a Caffe2 operator
which produces the given tensor filling op. | [
"Given",
"an",
"Onnx",
"TensorProto",
"translate",
"it",
"into",
"a",
"Caffe2",
"operator",
"which",
"produces",
"the",
"given",
"tensor",
"filling",
"op",
"."
] | def _create_tensor_filling_op(cls, onnx_tensor, name=None):
"""
Given an Onnx TensorProto, translate it into a Caffe2 operator
which produces the given tensor filling op.
"""
assert name or onnx_tensor.name
name = name or onnx_tensor.name
c2_op = caffe2_pb2.Opera... | [
"def",
"_create_tensor_filling_op",
"(",
"cls",
",",
"onnx_tensor",
",",
"name",
"=",
"None",
")",
":",
"assert",
"name",
"or",
"onnx_tensor",
".",
"name",
"name",
"=",
"name",
"or",
"onnx_tensor",
".",
"name",
"c2_op",
"=",
"caffe2_pb2",
".",
"OperatorDef",... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/python/onnx/backend.py#L244-L294 | |
ducha-aiki/LSUVinit | a42ecdc0d44c217a29b65e98748d80b90d5c6279 | python/caffe/pycaffe.py | python | _Net_forward_all | (self, blobs=None, **kwargs) | return all_outs | Run net forward in batches.
Parameters
----------
blobs : list of blobs to extract as in forward()
kwargs : Keys are input blob names and values are blob ndarrays.
Refer to forward().
Returns
-------
all_outs : {blob name: list of blobs} dict. | Run net forward in batches. | [
"Run",
"net",
"forward",
"in",
"batches",
"."
] | def _Net_forward_all(self, blobs=None, **kwargs):
"""
Run net forward in batches.
Parameters
----------
blobs : list of blobs to extract as in forward()
kwargs : Keys are input blob names and values are blob ndarrays.
Refer to forward().
Returns
-------
all_outs : {blo... | [
"def",
"_Net_forward_all",
"(",
"self",
",",
"blobs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Collect outputs from batches",
"all_outs",
"=",
"{",
"out",
":",
"[",
"]",
"for",
"out",
"in",
"set",
"(",
"self",
".",
"outputs",
"+",
"(",
"blobs... | https://github.com/ducha-aiki/LSUVinit/blob/a42ecdc0d44c217a29b65e98748d80b90d5c6279/python/caffe/pycaffe.py#L159-L187 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/Pygments/py3/pygments/lexers/markup.py | python | TiddlyWiki5Lexer._handle_cssblock | (self, match) | match args: 1:style tag 2:newline, 3:code, 4:closing style tag | match args: 1:style tag 2:newline, 3:code, 4:closing style tag | [
"match",
"args",
":",
"1",
":",
"style",
"tag",
"2",
":",
"newline",
"3",
":",
"code",
"4",
":",
"closing",
"style",
"tag"
] | def _handle_cssblock(self, match):
"""
match args: 1:style tag 2:newline, 3:code, 4:closing style tag
"""
from pygments.lexers import get_lexer_by_name
# section header
yield match.start(1), String, match.group(1)
yield match.start(2), String, match.group(2)
... | [
"def",
"_handle_cssblock",
"(",
"self",
",",
"match",
")",
":",
"from",
"pygments",
".",
"lexers",
"import",
"get_lexer_by_name",
"# section header",
"yield",
"match",
".",
"start",
"(",
"1",
")",
",",
"String",
",",
"match",
".",
"group",
"(",
"1",
")",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Pygments/py3/pygments/lexers/markup.py#L648-L673 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/eager/function.py | python | ConcreteFunction._call_with_structured_signature | (self, args, kwargs, cancellation_manager) | return self._call_flat(
filtered_flat_args,
captured_inputs=self.captured_inputs,
cancellation_manager=cancellation_manager) | Executes the wrapped function with the structured signature.
Args:
args: Positional arguments to the concrete function.
kwargs: Keyword arguments to the concrete function.
cancellation_manager: A `CancellationManager` that can be used to cancel
function invocation.
Returns:
The... | Executes the wrapped function with the structured signature. | [
"Executes",
"the",
"wrapped",
"function",
"with",
"the",
"structured",
"signature",
"."
] | def _call_with_structured_signature(self, args, kwargs, cancellation_manager):
"""Executes the wrapped function with the structured signature.
Args:
args: Positional arguments to the concrete function.
kwargs: Keyword arguments to the concrete function.
cancellation_manager: A `CancellationMa... | [
"def",
"_call_with_structured_signature",
"(",
"self",
",",
"args",
",",
"kwargs",
",",
"cancellation_manager",
")",
":",
"args",
",",
"kwargs",
",",
"filtered_flat_args",
"=",
"(",
"self",
".",
"_function_spec",
".",
"canonicalize_function_inputs",
"(",
"*",
"arg... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/eager/function.py#L1672-L1696 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/signal/ltisys.py | python | dlti.freqresp | (self, w=None, n=10000, whole=False) | return dfreqresp(self, w=w, n=n, whole=whole) | Calculate the frequency response of a discrete-time system.
Returns a 2-tuple containing arrays of frequencies [rad/s] and
complex magnitude.
See `dfreqresp` for details. | Calculate the frequency response of a discrete-time system. | [
"Calculate",
"the",
"frequency",
"response",
"of",
"a",
"discrete",
"-",
"time",
"system",
"."
] | def freqresp(self, w=None, n=10000, whole=False):
"""
Calculate the frequency response of a discrete-time system.
Returns a 2-tuple containing arrays of frequencies [rad/s] and
complex magnitude.
See `dfreqresp` for details.
"""
return dfreqresp(self, w=w, n=n, ... | [
"def",
"freqresp",
"(",
"self",
",",
"w",
"=",
"None",
",",
"n",
"=",
"10000",
",",
"whole",
"=",
"False",
")",
":",
"return",
"dfreqresp",
"(",
"self",
",",
"w",
"=",
"w",
",",
"n",
"=",
"n",
",",
"whole",
"=",
"whole",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/signal/ltisys.py#L470-L479 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/propgrid.py | python | PropertyGridPopulator.ProcessError | (*args, **kwargs) | return _propgrid.PropertyGridPopulator_ProcessError(*args, **kwargs) | ProcessError(self, String msg) | ProcessError(self, String msg) | [
"ProcessError",
"(",
"self",
"String",
"msg",
")"
] | def ProcessError(*args, **kwargs):
"""ProcessError(self, String msg)"""
return _propgrid.PropertyGridPopulator_ProcessError(*args, **kwargs) | [
"def",
"ProcessError",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridPopulator_ProcessError",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L2625-L2627 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | contrib/gizmos/gtk/gizmos.py | python | DynamicSashWindow.Create | (*args, **kwargs) | return _gizmos.DynamicSashWindow_Create(*args, **kwargs) | Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=wxCLIP_CHILDREN|wxDS_MANAGE_SCROLLBARS|wxDS_DRAG_CORNER,
String name=DynamicSashNameStr) -> bool | Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=wxCLIP_CHILDREN|wxDS_MANAGE_SCROLLBARS|wxDS_DRAG_CORNER,
String name=DynamicSashNameStr) -> bool | [
"Create",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"wxCLIP_CHILDREN|wxDS_MANAGE_SCROLLBARS|wxDS_DRAG_CORNER",
"String",
"name",
"=",
"DynamicSashNam... | def Create(*args, **kwargs):
"""
Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=wxCLIP_CHILDREN|wxDS_MANAGE_SCROLLBARS|wxDS_DRAG_CORNER,
String name=DynamicSashNameStr) -> bool
"""
return _gizmos.DynamicSashWi... | [
"def",
"Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gizmos",
".",
"DynamicSashWindow_Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/contrib/gizmos/gtk/gizmos.py#L103-L109 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | clang/tools/scan-build-py/lib/libscanbuild/report.py | python | crash_report | (output_dir, prefix) | return name | Creates a fragment from the compiler crashes. | Creates a fragment from the compiler crashes. | [
"Creates",
"a",
"fragment",
"from",
"the",
"compiler",
"crashes",
"."
] | def crash_report(output_dir, prefix):
""" Creates a fragment from the compiler crashes. """
pretty = prettify_crash(prefix, output_dir)
crashes = (pretty(crash) for crash in read_crashes(output_dir))
name = os.path.join(output_dir, 'crashes.html.fragment')
with open(name, 'w') as handle:
i... | [
"def",
"crash_report",
"(",
"output_dir",
",",
"prefix",
")",
":",
"pretty",
"=",
"prettify_crash",
"(",
"prefix",
",",
"output_dir",
")",
"crashes",
"=",
"(",
"pretty",
"(",
"crash",
")",
"for",
"crash",
"in",
"read_crashes",
"(",
"output_dir",
")",
")",
... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/clang/tools/scan-build-py/lib/libscanbuild/report.py#L215-L250 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/mixture/_bayesian_mixture.py | python | BayesianGaussianMixture._estimate_wishart_diag | (self, nk, xk, sk) | Estimate the diag Wishart distribution parameters.
Parameters
----------
X : array-like, shape (n_samples, n_features)
nk : array-like, shape (n_components,)
xk : array-like, shape (n_components, n_features)
sk : array-like, shape (n_components, n_features) | Estimate the diag Wishart distribution parameters. | [
"Estimate",
"the",
"diag",
"Wishart",
"distribution",
"parameters",
"."
] | def _estimate_wishart_diag(self, nk, xk, sk):
"""Estimate the diag Wishart distribution parameters.
Parameters
----------
X : array-like, shape (n_samples, n_features)
nk : array-like, shape (n_components,)
xk : array-like, shape (n_components, n_features)
sk ... | [
"def",
"_estimate_wishart_diag",
"(",
"self",
",",
"nk",
",",
"xk",
",",
"sk",
")",
":",
"_",
",",
"n_features",
"=",
"xk",
".",
"shape",
"# Warning : in some Bishop book, there is a typo on the formula 10.63",
"# `degrees_of_freedom_k = degrees_of_freedom_0 + Nk`",
"# is t... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/mixture/_bayesian_mixture.py#L592-L619 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/mplgraphicsview.py | python | MplGraphicsView.set_title | (self, title, color='black') | return | set title to canvas
:param title:
:param color:
:return: | set title to canvas
:param title:
:param color:
:return: | [
"set",
"title",
"to",
"canvas",
":",
"param",
"title",
":",
":",
"param",
"color",
":",
":",
"return",
":"
] | def set_title(self, title, color='black'):
"""
set title to canvas
:param title:
:param color:
:return:
"""
self._myCanvas.set_title(title, color)
return | [
"def",
"set_title",
"(",
"self",
",",
"title",
",",
"color",
"=",
"'black'",
")",
":",
"self",
".",
"_myCanvas",
".",
"set_title",
"(",
"title",
",",
"color",
")",
"return"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/mplgraphicsview.py#L994-L1003 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PropertyGridIteratorBase.Prev | (*args, **kwargs) | return _propgrid.PropertyGridIteratorBase_Prev(*args, **kwargs) | Prev(self) | Prev(self) | [
"Prev",
"(",
"self",
")"
] | def Prev(*args, **kwargs):
"""Prev(self)"""
return _propgrid.PropertyGridIteratorBase_Prev(*args, **kwargs) | [
"def",
"Prev",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridIteratorBase_Prev",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L955-L957 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PGProperty.GetMaxLength | (*args, **kwargs) | return _propgrid.PGProperty_GetMaxLength(*args, **kwargs) | GetMaxLength(self) -> int | GetMaxLength(self) -> int | [
"GetMaxLength",
"(",
"self",
")",
"-",
">",
"int"
] | def GetMaxLength(*args, **kwargs):
"""GetMaxLength(self) -> int"""
return _propgrid.PGProperty_GetMaxLength(*args, **kwargs) | [
"def",
"GetMaxLength",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGProperty_GetMaxLength",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L604-L606 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/cloud/python/ops/bigquery_reader_ops.py | python | BigQueryReader.partitions | (self, name=None) | return gen_bigquery_reader_ops.generate_big_query_reader_partitions(
name=name,
project_id=self._project_id,
dataset_id=self._dataset_id,
table_id=self._table_id,
timestamp_millis=self._timestamp_millis,
num_partitions=self._num_partitions,
test_end_point=self._te... | Returns serialized BigQueryTablePartition messages.
These messages represent a non-overlapping division of a table for a
bulk read.
Args:
name: a name for the operation (optional).
Returns:
`1-D` string `Tensor` of serialized `BigQueryTablePartition` messages. | Returns serialized BigQueryTablePartition messages. | [
"Returns",
"serialized",
"BigQueryTablePartition",
"messages",
"."
] | def partitions(self, name=None):
"""Returns serialized BigQueryTablePartition messages.
These messages represent a non-overlapping division of a table for a
bulk read.
Args:
name: a name for the operation (optional).
Returns:
`1-D` string `Tensor` of serialized `BigQueryTablePartition... | [
"def",
"partitions",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"return",
"gen_bigquery_reader_ops",
".",
"generate_big_query_reader_partitions",
"(",
"name",
"=",
"name",
",",
"project_id",
"=",
"self",
".",
"_project_id",
",",
"dataset_id",
"=",
"self",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/cloud/python/ops/bigquery_reader_ops.py#L127-L147 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/_stc_utf8_methods.py | python | AppendTextUTF8 | (self, text) | Append a UTF8 string to the end of the document without changing
the selection. Works 'natively' in a unicode build of wxPython,
and will also work in an ansi build if the UTF8 text is compatible
with the current encoding. | Append a UTF8 string to the end of the document without changing
the selection. Works 'natively' in a unicode build of wxPython,
and will also work in an ansi build if the UTF8 text is compatible
with the current encoding. | [
"Append",
"a",
"UTF8",
"string",
"to",
"the",
"end",
"of",
"the",
"document",
"without",
"changing",
"the",
"selection",
".",
"Works",
"natively",
"in",
"a",
"unicode",
"build",
"of",
"wxPython",
"and",
"will",
"also",
"work",
"in",
"an",
"ansi",
"build",
... | def AppendTextUTF8(self, text):
"""
Append a UTF8 string to the end of the document without changing
the selection. Works 'natively' in a unicode build of wxPython,
and will also work in an ansi build if the UTF8 text is compatible
with the current encoding.
"""
if not wx.USE_UNICODE:
... | [
"def",
"AppendTextUTF8",
"(",
"self",
",",
"text",
")",
":",
"if",
"not",
"wx",
".",
"USE_UNICODE",
":",
"u",
"=",
"text",
".",
"decode",
"(",
"'utf-8'",
")",
"text",
"=",
"u",
".",
"encode",
"(",
"wx",
".",
"GetDefaultPyEncoding",
"(",
")",
")",
"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/_stc_utf8_methods.py#L106-L116 | ||
epiqc/ScaffCC | 66a79944ee4cd116b27bc1a69137276885461db8 | clang/tools/scan-build-py/libear/__init__.py | python | build_libear | (compiler, dst_dir) | Returns the full path to the 'libear' library. | Returns the full path to the 'libear' library. | [
"Returns",
"the",
"full",
"path",
"to",
"the",
"libear",
"library",
"."
] | def build_libear(compiler, dst_dir):
""" Returns the full path to the 'libear' library. """
try:
src_dir = os.path.dirname(os.path.realpath(__file__))
toolset = make_toolset(src_dir)
toolset.set_compiler(compiler)
toolset.set_language_standard('c99')
toolset.add_definiti... | [
"def",
"build_libear",
"(",
"compiler",
",",
"dst_dir",
")",
":",
"try",
":",
"src_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"realpath",
"(",
"__file__",
")",
")",
"toolset",
"=",
"make_toolset",
"(",
"src_dir",
")",
... | https://github.com/epiqc/ScaffCC/blob/66a79944ee4cd116b27bc1a69137276885461db8/clang/tools/scan-build-py/libear/__init__.py#L19-L58 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/xml/sax/saxutils.py | python | unescape | (data, entities={}) | return data.replace("&", "&") | Unescape &, <, and > in a string of data.
You can unescape other strings of data by passing a dictionary as
the optional entities parameter. The keys and values must all be
strings; each key will be replaced with its corresponding value. | Unescape &, <, and > in a string of data. | [
"Unescape",
"&",
";",
"<",
";",
"and",
">",
";",
"in",
"a",
"string",
"of",
"data",
"."
] | def unescape(data, entities={}):
"""Unescape &, <, and > in a string of data.
You can unescape other strings of data by passing a dictionary as
the optional entities parameter. The keys and values must all be
strings; each key will be replaced with its corresponding value.
"""
data =... | [
"def",
"unescape",
"(",
"data",
",",
"entities",
"=",
"{",
"}",
")",
":",
"data",
"=",
"data",
".",
"replace",
"(",
"\"<\"",
",",
"\"<\"",
")",
"data",
"=",
"data",
".",
"replace",
"(",
"\">\"",
",",
"\">\"",
")",
"if",
"entities",
":",
"data... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/xml/sax/saxutils.py#L39-L51 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/requests/requests/sessions.py | python | Session.post | (self, url, data=None, json=None, **kwargs) | return self.request('POST', url, data=data, json=json, **kwargs) | Sends a POST request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:param json: (optional) json to send in the body of the :class:`Request`.
... | Sends a POST request. Returns :class:`Response` object. | [
"Sends",
"a",
"POST",
"request",
".",
"Returns",
":",
"class",
":",
"Response",
"object",
"."
] | def post(self, url, data=None, json=None, **kwargs):
"""Sends a POST request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:param json: (... | [
"def",
"post",
"(",
"self",
",",
"url",
",",
"data",
"=",
"None",
",",
"json",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"request",
"(",
"'POST'",
",",
"url",
",",
"data",
"=",
"data",
",",
"json",
"=",
"json",
",",... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/requests/requests/sessions.py#L495-L504 | |
pskun/finance_news_analysis | 6ac13e32deede37a4cf57bba8b2897941ae3d80d | crawler/crawler/pipelines.py | python | CrawlPipeline.process_item | (self, item, spider) | if item_id in self.bloom_filter:
return None
self.bloom_filter.add(item_id) | if item_id in self.bloom_filter:
return None
self.bloom_filter.add(item_id) | [
"if",
"item_id",
"in",
"self",
".",
"bloom_filter",
":",
"return",
"None",
"self",
".",
"bloom_filter",
".",
"add",
"(",
"item_id",
")"
] | def process_item(self, item, spider):
'''
if item_id in self.bloom_filter:
return None
self.bloom_filter.add(item_id)
'''
if spider.name == 'HexunResearchPaperSpider':
return self.process_hexun_yanbao_item(item, spider)
elif spider.name == 'EastMon... | [
"def",
"process_item",
"(",
"self",
",",
"item",
",",
"spider",
")",
":",
"if",
"spider",
".",
"name",
"==",
"'HexunResearchPaperSpider'",
":",
"return",
"self",
".",
"process_hexun_yanbao_item",
"(",
"item",
",",
"spider",
")",
"elif",
"spider",
".",
"name"... | https://github.com/pskun/finance_news_analysis/blob/6ac13e32deede37a4cf57bba8b2897941ae3d80d/crawler/crawler/pipelines.py#L103-L121 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/losses/python/metric_learning/metric_loss_ops.py | python | compute_augmented_facility_locations | (pairwise_distances, labels, all_ids,
margin_multiplier, margin_type) | return chosen_ids | Computes the centroid locations.
Args:
pairwise_distances: 2-D Tensor of pairwise distances.
labels: 1-D Tensor of ground truth cluster assignment.
all_ids: 1-D Tensor of all data indices.
margin_multiplier: multiplication constant.
margin_type: Type of structured margin to use. Default is nmi.
... | Computes the centroid locations. | [
"Computes",
"the",
"centroid",
"locations",
"."
] | def compute_augmented_facility_locations(pairwise_distances, labels, all_ids,
margin_multiplier, margin_type):
"""Computes the centroid locations.
Args:
pairwise_distances: 2-D Tensor of pairwise distances.
labels: 1-D Tensor of ground truth cluster assignment.
... | [
"def",
"compute_augmented_facility_locations",
"(",
"pairwise_distances",
",",
"labels",
",",
"all_ids",
",",
"margin_multiplier",
",",
"margin_type",
")",
":",
"def",
"func_cond_augmented",
"(",
"iteration",
",",
"chosen_ids",
")",
":",
"del",
"chosen_ids",
"# Unused... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/losses/python/metric_learning/metric_loss_ops.py#L723-L765 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/response_graph_ucb.py | python | ResponseGraphUCB.delta | (self, k, s) | Returns the confidence parameter for a given player and profile. | Returns the confidence parameter for a given player and profile. | [
"Returns",
"the",
"confidence",
"parameter",
"for",
"a",
"given",
"player",
"and",
"profile",
"."
] | def delta(self, k, s):
"""Returns the confidence parameter for a given player and profile."""
if not self.time_dependent_delta:
return self._delta
else:
return self._delta * (6 / (np.pi**2 * self.count[k][s] **2)) | [
"def",
"delta",
"(",
"self",
",",
"k",
",",
"s",
")",
":",
"if",
"not",
"self",
".",
"time_dependent_delta",
":",
"return",
"self",
".",
"_delta",
"else",
":",
"return",
"self",
".",
"_delta",
"*",
"(",
"6",
"/",
"(",
"np",
".",
"pi",
"**",
"2",
... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/response_graph_ucb.py#L94-L99 | ||
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/imports.py | python | BasketHandler.handle_entityref | (self, name) | Found Entity Reference like &name; | Found Entity Reference like &name; | [
"Found",
"Entity",
"Reference",
"like",
"&name",
";"
] | def handle_entityref(self, name):
"""Found Entity Reference like &name;"""
if self.curr_state == 0: return
if name in htmlentitydefs.name2codepoint:
unicode_char = unichr(htmlentitydefs.name2codepoint[name])
self.rich_text_serialize(unicode_char)
self.chars_co... | [
"def",
"handle_entityref",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"curr_state",
"==",
"0",
":",
"return",
"if",
"name",
"in",
"htmlentitydefs",
".",
"name2codepoint",
":",
"unicode_char",
"=",
"unichr",
"(",
"htmlentitydefs",
".",
"name2codep... | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/imports.py#L1585-L1591 | ||
taichi-dev/taichi | 973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6 | python/taichi/ui/scene.py | python | Scene.particles | (self,
centers,
radius,
color=(0.5, 0.5, 0.5),
per_vertex_color=None) | Declare a set of particles within the scene.
Args:
centers: a taichi 3D Vector field, where each element indicate the 3D location of the center of a triangle.
color: a global color for the particles as 3 floats representing RGB values. If `per_vertex_color` is provided, this is ignored.... | Declare a set of particles within the scene. | [
"Declare",
"a",
"set",
"of",
"particles",
"within",
"the",
"scene",
"."
] | def particles(self,
centers,
radius,
color=(0.5, 0.5, 0.5),
per_vertex_color=None):
"""Declare a set of particles within the scene.
Args:
centers: a taichi 3D Vector field, where each element indicate the 3D location of... | [
"def",
"particles",
"(",
"self",
",",
"centers",
",",
"radius",
",",
"color",
"=",
"(",
"0.5",
",",
"0.5",
",",
"0.5",
")",
",",
"per_vertex_color",
"=",
"None",
")",
":",
"vbo",
"=",
"get_vbo_field",
"(",
"centers",
")",
"copy_vertices_to_vbo",
"(",
"... | https://github.com/taichi-dev/taichi/blob/973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6/python/taichi/ui/scene.py#L112-L131 | ||
google/omaha | 61e8c2833fd69c9a13978400108e5b9ebff24a09 | omaha/site_scons/site_tools/omaha_builders.py | python | CloneAndMake64Bit | (env) | return env64 | Clones the supplied environment and calls ConfigureEnvFor64Bit()
on the clone.
Args:
env: The environment to clone.
Returns:
The cloned and modified environment. | Clones the supplied environment and calls ConfigureEnvFor64Bit()
on the clone. | [
"Clones",
"the",
"supplied",
"environment",
"and",
"calls",
"ConfigureEnvFor64Bit",
"()",
"on",
"the",
"clone",
"."
] | def CloneAndMake64Bit(env):
"""Clones the supplied environment and calls ConfigureEnvFor64Bit()
on the clone.
Args:
env: The environment to clone.
Returns:
The cloned and modified environment.
"""
env64 = env.Clone()
ConfigureEnvFor64Bit(env64)
return env64 | [
"def",
"CloneAndMake64Bit",
"(",
"env",
")",
":",
"env64",
"=",
"env",
".",
"Clone",
"(",
")",
"ConfigureEnvFor64Bit",
"(",
"env64",
")",
"return",
"env64"
] | https://github.com/google/omaha/blob/61e8c2833fd69c9a13978400108e5b9ebff24a09/omaha/site_scons/site_tools/omaha_builders.py#L440-L452 | |
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/models/ModelParser.py | python | ModelParser._getPortArgsNamespacePrefix | (self, comp_namespace, port_namespace, arg_type) | Return the arg_type prefixed by <namespace>::arg_type using namespace rules. | Return the arg_type prefixed by <namespace>::arg_type using namespace rules. | [
"Return",
"the",
"arg_type",
"prefixed",
"by",
"<namespace",
">",
"::",
"arg_type",
"using",
"namespace",
"rules",
"."
] | def _getPortArgsNamespacePrefix(self, comp_namespace, port_namespace, arg_type):
"""
Return the arg_type prefixed by <namespace>::arg_type using namespace rules.
"""
if comp_namespace == port_namespace:
return arg_type
# U8 * or char * pointer types
# e... | [
"def",
"_getPortArgsNamespacePrefix",
"(",
"self",
",",
"comp_namespace",
",",
"port_namespace",
",",
"arg_type",
")",
":",
"if",
"comp_namespace",
"==",
"port_namespace",
":",
"return",
"arg_type",
"# U8 * or char * pointer types",
"# elif arg_type.split(\" \")[0] in ... | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/models/ModelParser.py#L132-L151 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/inspector_protocol/jinja2/compiler.py | python | CodeGenerator.temporary_identifier | (self) | return 't_%d' % self._last_identifier | Get a new unique identifier. | Get a new unique identifier. | [
"Get",
"a",
"new",
"unique",
"identifier",
"."
] | def temporary_identifier(self):
"""Get a new unique identifier."""
self._last_identifier += 1
return 't_%d' % self._last_identifier | [
"def",
"temporary_identifier",
"(",
"self",
")",
":",
"self",
".",
"_last_identifier",
"+=",
"1",
"return",
"'t_%d'",
"%",
"self",
".",
"_last_identifier"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/inspector_protocol/jinja2/compiler.py#L317-L320 | |
microsoft/AirSim | 8057725712c0cd46979135396381784075ffc0f3 | PythonClient/airsim/client.py | python | MultirotorClient.moveByVelocityBodyFrameAsync | (self, vx, vy, vz, duration, drivetrain = DrivetrainType.MaxDegreeOfFreedom, yaw_mode = YawMode(), vehicle_name = '') | return self.client.call_async('moveByVelocityBodyFrame', vx, vy, vz, duration, drivetrain, yaw_mode, vehicle_name) | Args:
vx (float): desired velocity in the X axis of the vehicle's local NED frame.
vy (float): desired velocity in the Y axis of the vehicle's local NED frame.
vz (float): desired velocity in the Z axis of the vehicle's local NED frame.
duration (float): Desired amount of... | Args:
vx (float): desired velocity in the X axis of the vehicle's local NED frame.
vy (float): desired velocity in the Y axis of the vehicle's local NED frame.
vz (float): desired velocity in the Z axis of the vehicle's local NED frame.
duration (float): Desired amount of... | [
"Args",
":",
"vx",
"(",
"float",
")",
":",
"desired",
"velocity",
"in",
"the",
"X",
"axis",
"of",
"the",
"vehicle",
"s",
"local",
"NED",
"frame",
".",
"vy",
"(",
"float",
")",
":",
"desired",
"velocity",
"in",
"the",
"Y",
"axis",
"of",
"the",
"vehi... | def moveByVelocityBodyFrameAsync(self, vx, vy, vz, duration, drivetrain = DrivetrainType.MaxDegreeOfFreedom, yaw_mode = YawMode(), vehicle_name = ''):
"""
Args:
vx (float): desired velocity in the X axis of the vehicle's local NED frame.
vy (float): desired velocity in the Y axis... | [
"def",
"moveByVelocityBodyFrameAsync",
"(",
"self",
",",
"vx",
",",
"vy",
",",
"vz",
",",
"duration",
",",
"drivetrain",
"=",
"DrivetrainType",
".",
"MaxDegreeOfFreedom",
",",
"yaw_mode",
"=",
"YawMode",
"(",
")",
",",
"vehicle_name",
"=",
"''",
")",
":",
... | https://github.com/microsoft/AirSim/blob/8057725712c0cd46979135396381784075ffc0f3/PythonClient/airsim/client.py#L1159-L1173 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | _BlockInfo.CheckBegin | (self, filename, clean_lines, linenum, error) | Run checks that applies to text up to the opening brace.
This is mostly for checking the text after the class identifier
and the "{", usually where the base class is specified. For other
blocks, there isn't much to check, so we always pass.
Args:
filename: The name of the current file.
cl... | Run checks that applies to text up to the opening brace. | [
"Run",
"checks",
"that",
"applies",
"to",
"text",
"up",
"to",
"the",
"opening",
"brace",
"."
] | def CheckBegin(self, filename, clean_lines, linenum, error):
"""Run checks that applies to text up to the opening brace.
This is mostly for checking the text after the class identifier
and the "{", usually where the base class is specified. For other
blocks, there isn't much to check, so we always pas... | [
"def",
"CheckBegin",
"(",
"self",
",",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"pass"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L1365-L1378 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | gr-digital/python/digital/qam_constellations.py | python | sd_qam_16_0x1_1_0_2_3 | (x, Es=1) | return [b3, b2, b1, b0] | | Soft bit LUT generator for constellation:
|
| 0000 0100 | 1100 1000
|
| 0010 0110 | 1110 1010
| -----------------------
| 0011 0111 | 1111 1011
|
| 0001 0101 | 1101 1001 | | Soft bit LUT generator for constellation:
|
| 0000 0100 | 1100 1000
|
| 0010 0110 | 1110 1010
| -----------------------
| 0011 0111 | 1111 1011
|
| 0001 0101 | 1101 1001 | [
"|",
"Soft",
"bit",
"LUT",
"generator",
"for",
"constellation",
":",
"|",
"|",
"0000",
"0100",
"|",
"1100",
"1000",
"|",
"|",
"0010",
"0110",
"|",
"1110",
"1010",
"|",
"-----------------------",
"|",
"0011",
"0111",
"|",
"1111",
"1011",
"|",
"|",
"0001... | def sd_qam_16_0x1_1_0_2_3(x, Es=1):
'''
| Soft bit LUT generator for constellation:
|
| 0000 0100 | 1100 1000
|
| 0010 0110 | 1110 1010
| -----------------------
| 0011 0111 | 1111 1011
|
| 0001 0101 | 1101 1001
'''
x_re = 3 * x.real
x_im = 3 * x.imag
if ... | [
"def",
"sd_qam_16_0x1_1_0_2_3",
"(",
"x",
",",
"Es",
"=",
"1",
")",
":",
"x_re",
"=",
"3",
"*",
"x",
".",
"real",
"x_im",
"=",
"3",
"*",
"x",
".",
"imag",
"if",
"x_re",
"<",
"-",
"2",
":",
"b3",
"=",
"2",
"*",
"(",
"x_re",
"+",
"1",
")",
... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/gr-digital/python/digital/qam_constellations.py#L444-L476 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/vis/backends/glutbackend.py | python | GLUTWindow.refresh | (self) | Call this to redraw the screen on the next event loop. Called by frontend. | Call this to redraw the screen on the next event loop. Called by frontend. | [
"Call",
"this",
"to",
"redraw",
"the",
"screen",
"on",
"the",
"next",
"event",
"loop",
".",
"Called",
"by",
"frontend",
"."
] | def refresh(self):
"""Call this to redraw the screen on the next event loop. Called by frontend."""
glutPostRedisplay() | [
"def",
"refresh",
"(",
"self",
")",
":",
"glutPostRedisplay",
"(",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/vis/backends/glutbackend.py#L119-L121 | ||
chukong/SampleGame-EarthWarrior3D | ddbda78b3c211f1b0363339a90044caf49fff1d1 | proj.android/build_native.py | python | check_environment_variables_sdk | () | return SDK_ROOT | Checking the environment ANDROID_SDK_ROOT, which will be used for building | Checking the environment ANDROID_SDK_ROOT, which will be used for building | [
"Checking",
"the",
"environment",
"ANDROID_SDK_ROOT",
"which",
"will",
"be",
"used",
"for",
"building"
] | def check_environment_variables_sdk():
''' Checking the environment ANDROID_SDK_ROOT, which will be used for building
'''
try:
SDK_ROOT = os.environ['ANDROID_SDK_ROOT']
except Exception:
print "ANDROID_SDK_ROOT not defined. Please define ANDROID_SDK_ROOT in your environment"
sys... | [
"def",
"check_environment_variables_sdk",
"(",
")",
":",
"try",
":",
"SDK_ROOT",
"=",
"os",
".",
"environ",
"[",
"'ANDROID_SDK_ROOT'",
"]",
"except",
"Exception",
":",
"print",
"\"ANDROID_SDK_ROOT not defined. Please define ANDROID_SDK_ROOT in your environment\"",
"sys",
".... | https://github.com/chukong/SampleGame-EarthWarrior3D/blob/ddbda78b3c211f1b0363339a90044caf49fff1d1/proj.android/build_native.py#L28-L38 | |
naver/sling | 5671cd445a2caae0b4dd0332299e4cfede05062c | webkit/Tools/Scripts/webkitpy/port/base.py | python | Port.test_key | (self, test_name) | return (self._natural_sort_key(dirname + self.TEST_PATH_SEPARATOR), self._natural_sort_key(basename)) | Turns a test name into a list with two sublists, the natural key of the
dirname, and the natural key of the basename.
This can be used when sorting paths so that files in a directory.
directory are kept together rather than being mixed in with files in
subdirectories. | Turns a test name into a list with two sublists, the natural key of the
dirname, and the natural key of the basename. | [
"Turns",
"a",
"test",
"name",
"into",
"a",
"list",
"with",
"two",
"sublists",
"the",
"natural",
"key",
"of",
"the",
"dirname",
"and",
"the",
"natural",
"key",
"of",
"the",
"basename",
"."
] | def test_key(self, test_name):
"""Turns a test name into a list with two sublists, the natural key of the
dirname, and the natural key of the basename.
This can be used when sorting paths so that files in a directory.
directory are kept together rather than being mixed in with files in
... | [
"def",
"test_key",
"(",
"self",
",",
"test_name",
")",
":",
"dirname",
",",
"basename",
"=",
"self",
".",
"split_test",
"(",
"test_name",
")",
"return",
"(",
"self",
".",
"_natural_sort_key",
"(",
"dirname",
"+",
"self",
".",
"TEST_PATH_SEPARATOR",
")",
",... | https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/port/base.py#L594-L602 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/build/pymake/pymake/data.py | python | findmodifiers | (command) | return realcommand, '@' in modset, '+' in modset, '-' in modset, '%' in modset | Find any of +-@% prefixed on the command.
@returns (command, isHidden, isRecursive, ignoreErrors, isNative) | Find any of +- | [
"Find",
"any",
"of",
"+",
"-"
] | def findmodifiers(command):
"""
Find any of +-@% prefixed on the command.
@returns (command, isHidden, isRecursive, ignoreErrors, isNative)
"""
isHidden = False
isRecursive = False
ignoreErrors = False
isNative = False
realcommand = command.lstrip(' \t\n@+-%')
modset = set(comm... | [
"def",
"findmodifiers",
"(",
"command",
")",
":",
"isHidden",
"=",
"False",
"isRecursive",
"=",
"False",
"ignoreErrors",
"=",
"False",
"isNative",
"=",
"False",
"realcommand",
"=",
"command",
".",
"lstrip",
"(",
"' \\t\\n@+-%'",
")",
"modset",
"=",
"set",
"(... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/build/pymake/pymake/data.py#L1375-L1388 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/pkg_resources/_vendor/pyparsing.py | python | ParserElement.__radd__ | (self, other ) | return other + self | Implementation of + operator when left operand is not a C{L{ParserElement}} | Implementation of + operator when left operand is not a C{L{ParserElement}} | [
"Implementation",
"of",
"+",
"operator",
"when",
"left",
"operand",
"is",
"not",
"a",
"C",
"{",
"L",
"{",
"ParserElement",
"}}"
] | def __radd__(self, other ):
"""
Implementation of + operator when left operand is not a C{L{ParserElement}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn(... | [
"def",
"__radd__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElemen... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/pkg_resources/_vendor/pyparsing.py#L1841-L1851 | |
echronos/echronos | c996f1d2c8af6c6536205eb319c1bf1d4d84569c | prj/app/lib/util/util.py | python | check_unique | (lst) | Raise exception if the items in the list are not unique. | Raise exception if the items in the list are not unique. | [
"Raise",
"exception",
"if",
"the",
"items",
"in",
"the",
"list",
"are",
"not",
"unique",
"."
] | def check_unique(lst):
"""Raise exception if the items in the list are not unique."""
uniq = list(set(lst))
if len(uniq) != len(lst):
dups = list((u, lst.count(u)) for u in uniq if lst.count(u) > 1)
raise ValueError("Duplicates found in list: {}".format(dups)) | [
"def",
"check_unique",
"(",
"lst",
")",
":",
"uniq",
"=",
"list",
"(",
"set",
"(",
"lst",
")",
")",
"if",
"len",
"(",
"uniq",
")",
"!=",
"len",
"(",
"lst",
")",
":",
"dups",
"=",
"list",
"(",
"(",
"u",
",",
"lst",
".",
"count",
"(",
"u",
")... | https://github.com/echronos/echronos/blob/c996f1d2c8af6c6536205eb319c1bf1d4d84569c/prj/app/lib/util/util.py#L77-L82 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | DateTime.IsWestEuropeanCountry | (*args, **kwargs) | return _misc_.DateTime_IsWestEuropeanCountry(*args, **kwargs) | IsWestEuropeanCountry(int country=Country_Default) -> bool | IsWestEuropeanCountry(int country=Country_Default) -> bool | [
"IsWestEuropeanCountry",
"(",
"int",
"country",
"=",
"Country_Default",
")",
"-",
">",
"bool"
] | def IsWestEuropeanCountry(*args, **kwargs):
"""IsWestEuropeanCountry(int country=Country_Default) -> bool"""
return _misc_.DateTime_IsWestEuropeanCountry(*args, **kwargs) | [
"def",
"IsWestEuropeanCountry",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DateTime_IsWestEuropeanCountry",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L3682-L3684 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/_common.py | python | isfile_strict | (path) | Same as os.path.isfile() but does not swallow EACCES / EPERM
exceptions, see:
http://mail.python.org/pipermail/python-dev/2012-June/120787.html | Same as os.path.isfile() but does not swallow EACCES / EPERM
exceptions, see:
http://mail.python.org/pipermail/python-dev/2012-June/120787.html | [
"Same",
"as",
"os",
".",
"path",
".",
"isfile",
"()",
"but",
"does",
"not",
"swallow",
"EACCES",
"/",
"EPERM",
"exceptions",
"see",
":",
"http",
":",
"//",
"mail",
".",
"python",
".",
"org",
"/",
"pipermail",
"/",
"python",
"-",
"dev",
"/",
"2012",
... | def isfile_strict(path):
"""Same as os.path.isfile() but does not swallow EACCES / EPERM
exceptions, see:
http://mail.python.org/pipermail/python-dev/2012-June/120787.html
"""
try:
st = os.stat(path)
except OSError:
err = sys.exc_info()[1]
if err.errno in (errno.EPERM, er... | [
"def",
"isfile_strict",
"(",
"path",
")",
":",
"try",
":",
"st",
"=",
"os",
".",
"stat",
"(",
"path",
")",
"except",
"OSError",
":",
"err",
"=",
"sys",
".",
"exc_info",
"(",
")",
"[",
"1",
"]",
"if",
"err",
".",
"errno",
"in",
"(",
"errno",
"."... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/_common.py#L149-L162 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/generic.py | python | NDFrame.add_prefix | (self: FrameOrSeries, prefix: str) | return self.rename(**mapper) | Prefix labels with string `prefix`.
For Series, the row labels are prefixed.
For DataFrame, the column labels are prefixed.
Parameters
----------
prefix : str
The string to add before each label.
Returns
-------
Series or DataFrame
... | Prefix labels with string `prefix`. | [
"Prefix",
"labels",
"with",
"string",
"prefix",
"."
] | def add_prefix(self: FrameOrSeries, prefix: str) -> FrameOrSeries:
"""
Prefix labels with string `prefix`.
For Series, the row labels are prefixed.
For DataFrame, the column labels are prefixed.
Parameters
----------
prefix : str
The string to add be... | [
"def",
"add_prefix",
"(",
"self",
":",
"FrameOrSeries",
",",
"prefix",
":",
"str",
")",
"->",
"FrameOrSeries",
":",
"f",
"=",
"functools",
".",
"partial",
"(",
"\"{prefix}{}\"",
".",
"format",
",",
"prefix",
"=",
"prefix",
")",
"mapper",
"=",
"{",
"self"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/generic.py#L4015-L4072 | |
etternagame/etterna | 8775f74ac9c353320128609d4b4150672e9a6d04 | extern/crashpad/buildtools/checkdeps/rules.py | python | Rule.ChildOrMatch | (self, other) | return self._dir == other or other.startswith(self._dir + '/') | Returns true if the input string would be covered by this rule. For
example, the input "foo/bar" would match the rule "foo". | Returns true if the input string would be covered by this rule. For
example, the input "foo/bar" would match the rule "foo". | [
"Returns",
"true",
"if",
"the",
"input",
"string",
"would",
"be",
"covered",
"by",
"this",
"rule",
".",
"For",
"example",
"the",
"input",
"foo",
"/",
"bar",
"would",
"match",
"the",
"rule",
"foo",
"."
] | def ChildOrMatch(self, other):
"""Returns true if the input string would be covered by this rule. For
example, the input "foo/bar" would match the rule "foo"."""
return self._dir == other or other.startswith(self._dir + '/') | [
"def",
"ChildOrMatch",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"_dir",
"==",
"other",
"or",
"other",
".",
"startswith",
"(",
"self",
".",
"_dir",
"+",
"'/'",
")"
] | https://github.com/etternagame/etterna/blob/8775f74ac9c353320128609d4b4150672e9a6d04/extern/crashpad/buildtools/checkdeps/rules.py#L45-L48 | |
freesurfer/freesurfer | 6dbe527d43ffa611acb2cd112e9469f9bfec8e36 | python/freesurfer/utils/logging.py | python | Logger.close | (self) | Closes the log file. | Closes the log file. | [
"Closes",
"the",
"log",
"file",
"."
] | def close(self):
'''Closes the log file.'''
self.file.close() | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"file",
".",
"close",
"(",
")"
] | https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/python/freesurfer/utils/logging.py#L82-L84 | ||
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/transforms.py | python | idl_to_str | (pcollection, **options) | return pcollection.map(deserialize, serde=serde.StrSerde()) \
.filter(lambda x: x is not None) | 对于给定的PCollection,对每条数据执行idl解包。并过滤掉idl packet类型为Heartbeat和EOF的数据。
Args:
pcollection (PCollection): 输入
**options: 可配置选项
log_type: idl数据类型,目前支持log_text和log_bin,默认为log_text
Returns:
PCollection: 处理后的PCollection | 对于给定的PCollection,对每条数据执行idl解包。并过滤掉idl packet类型为Heartbeat和EOF的数据。 | [
"对于给定的PCollection,对每条数据执行idl解包。并过滤掉idl",
"packet类型为Heartbeat和EOF的数据。"
] | def idl_to_str(pcollection, **options):
"""
对于给定的PCollection,对每条数据执行idl解包。并过滤掉idl packet类型为Heartbeat和EOF的数据。
Args:
pcollection (PCollection): 输入
**options: 可配置选项
log_type: idl数据类型,目前支持log_text和log_bin,默认为log_text
Returns:
PCollection: 处理后的PCollection
"""
from bigflo... | [
"def",
"idl_to_str",
"(",
"pcollection",
",",
"*",
"*",
"options",
")",
":",
"from",
"bigflow",
"import",
"serde",
"from",
"bigflow",
".",
"core",
"import",
"entity",
"log_type",
"=",
"options",
".",
"get",
"(",
"\"log_type\"",
",",
"\"log_text\"",
")",
"i... | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/transforms.py#L1340-L1359 | |
apache/trafodion | 8455c839ad6b6d7b6e04edda5715053095b78046 | core/sqf/src/seatrans/hbase-trx/src/main/python/thrift1/gen-py/hbase/Hbase.py | python | Client.getRowWithColumns | (self, tableName, row, columns, attributes) | return self.recv_getRowWithColumns() | Get the specified columns for the specified table and row at the latest
timestamp. Returns an empty list if the row does not exist.
@return TRowResult containing the row and map of columns to TCells
Parameters:
- tableName: name of table
- row: row key
- columns: List of columns to return, ... | Get the specified columns for the specified table and row at the latest
timestamp. Returns an empty list if the row does not exist. | [
"Get",
"the",
"specified",
"columns",
"for",
"the",
"specified",
"table",
"and",
"row",
"at",
"the",
"latest",
"timestamp",
".",
"Returns",
"an",
"empty",
"list",
"if",
"the",
"row",
"does",
"not",
"exist",
"."
] | def getRowWithColumns(self, tableName, row, columns, attributes):
"""
Get the specified columns for the specified table and row at the latest
timestamp. Returns an empty list if the row does not exist.
@return TRowResult containing the row and map of columns to TCells
Parameters:
- tableName:... | [
"def",
"getRowWithColumns",
"(",
"self",
",",
"tableName",
",",
"row",
",",
"columns",
",",
"attributes",
")",
":",
"self",
".",
"send_getRowWithColumns",
"(",
"tableName",
",",
"row",
",",
"columns",
",",
"attributes",
")",
"return",
"self",
".",
"recv_getR... | https://github.com/apache/trafodion/blob/8455c839ad6b6d7b6e04edda5715053095b78046/core/sqf/src/seatrans/hbase-trx/src/main/python/thrift1/gen-py/hbase/Hbase.py#L1142-L1156 | |
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/bindings/python/MythTV/database.py | python | DBDataRef.commit | (self) | Push all local changes to database. | Push all local changes to database. | [
"Push",
"all",
"local",
"changes",
"to",
"database",
"."
] | def commit(self):
"""Push all local changes to database."""
if not self._populated:
return
# push changes to database
diff = self^self._origdata
if len(diff) == 0:
return
fields = list(self._ref)+list(self._datfields)
with self._db as curs... | [
"def",
"commit",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_populated",
":",
"return",
"# push changes to database",
"diff",
"=",
"self",
"^",
"self",
".",
"_origdata",
"if",
"len",
"(",
"diff",
")",
"==",
"0",
":",
"return",
"fields",
"=",
"li... | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/bindings/python/MythTV/database.py#L593-L626 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/android/loading/xvfb_helper.py | python | GetChromeEnvironment | () | return {'DISPLAY': 'localhost:99'} | Returns the environment for Chrome to run in headless mode with Xvfb. | Returns the environment for Chrome to run in headless mode with Xvfb. | [
"Returns",
"the",
"environment",
"for",
"Chrome",
"to",
"run",
"in",
"headless",
"mode",
"with",
"Xvfb",
"."
] | def GetChromeEnvironment():
"""Returns the environment for Chrome to run in headless mode with Xvfb."""
return {'DISPLAY': 'localhost:99'} | [
"def",
"GetChromeEnvironment",
"(",
")",
":",
"return",
"{",
"'DISPLAY'",
":",
"'localhost:99'",
"}"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/android/loading/xvfb_helper.py#L17-L19 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/majority-element.py | python | Solution.majorityElement3 | (self, nums) | return collections.Counter(nums).most_common(1)[0][0] | :type nums: List[int]
:rtype: int | :type nums: List[int]
:rtype: int | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def majorityElement3(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
return collections.Counter(nums).most_common(1)[0][0] | [
"def",
"majorityElement3",
"(",
"self",
",",
"nums",
")",
":",
"return",
"collections",
".",
"Counter",
"(",
"nums",
")",
".",
"most_common",
"(",
"1",
")",
"[",
"0",
"]",
"[",
"0",
"]"
] | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/majority-element.py#L33-L38 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/cgi.py | python | FieldStorage.skip_lines | (self) | Internal: skip lines until outer boundary if defined. | Internal: skip lines until outer boundary if defined. | [
"Internal",
":",
"skip",
"lines",
"until",
"outer",
"boundary",
"if",
"defined",
"."
] | def skip_lines(self):
"""Internal: skip lines until outer boundary if defined."""
if not self.outerboundary or self.done:
return
next = "--" + self.outerboundary
last = next + "--"
last_line_lfend = True
while 1:
line = self.fp.readline(1<<16)
... | [
"def",
"skip_lines",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"outerboundary",
"or",
"self",
".",
"done",
":",
"return",
"next",
"=",
"\"--\"",
"+",
"self",
".",
"outerboundary",
"last",
"=",
"next",
"+",
"\"--\"",
"last_line_lfend",
"=",
"True",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/cgi.py#L721-L740 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/tornado/tornado-6/tornado/httputil.py | python | encode_username_password | (
username: Union[str, bytes], password: Union[str, bytes]
) | return utf8(username) + b":" + utf8(password) | Encodes a username/password pair in the format used by HTTP auth.
The return value is a byte string in the form ``username:password``.
.. versionadded:: 5.1 | Encodes a username/password pair in the format used by HTTP auth. | [
"Encodes",
"a",
"username",
"/",
"password",
"pair",
"in",
"the",
"format",
"used",
"by",
"HTTP",
"auth",
"."
] | def encode_username_password(
username: Union[str, bytes], password: Union[str, bytes]
) -> bytes:
"""Encodes a username/password pair in the format used by HTTP auth.
The return value is a byte string in the form ``username:password``.
.. versionadded:: 5.1
"""
if isinstance(username, unicode... | [
"def",
"encode_username_password",
"(",
"username",
":",
"Union",
"[",
"str",
",",
"bytes",
"]",
",",
"password",
":",
"Union",
"[",
"str",
",",
"bytes",
"]",
")",
"->",
"bytes",
":",
"if",
"isinstance",
"(",
"username",
",",
"unicode_type",
")",
":",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/httputil.py#L1002-L1015 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/aui_utilities.py | python | GetDockingImage | (direction, useAero, center) | return bmp_unfocus, bmp_focus | Returns the correct name of the docking bitmap depending on the input parameters.
:param bool `useAero`: whether :class:`~lib.agw.aui.framemanager.AuiManager` is using
Aero-style or Whidbey-style docking images or not;
:param bool `center`: whether we are looking for the center diamond-shaped bitmap or no... | Returns the correct name of the docking bitmap depending on the input parameters. | [
"Returns",
"the",
"correct",
"name",
"of",
"the",
"docking",
"bitmap",
"depending",
"on",
"the",
"input",
"parameters",
"."
] | def GetDockingImage(direction, useAero, center):
"""
Returns the correct name of the docking bitmap depending on the input parameters.
:param bool `useAero`: whether :class:`~lib.agw.aui.framemanager.AuiManager` is using
Aero-style or Whidbey-style docking images or not;
:param bool `center`: whet... | [
"def",
"GetDockingImage",
"(",
"direction",
",",
"useAero",
",",
"center",
")",
":",
"suffix",
"=",
"(",
"center",
"and",
"[",
"\"\"",
"]",
"or",
"[",
"\"_single\"",
"]",
")",
"[",
"0",
"]",
"prefix",
"=",
"\"\"",
"if",
"useAero",
"==",
"2",
":",
"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/aui_utilities.py#L506-L540 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/pathlib.py | python | Path.is_dir | (self) | Whether this path is a directory. | Whether this path is a directory. | [
"Whether",
"this",
"path",
"is",
"a",
"directory",
"."
] | def is_dir(self):
"""
Whether this path is a directory.
"""
try:
return S_ISDIR(self.stat().st_mode)
except OSError as e:
if not _ignore_error(e):
raise
# Path doesn't exist or is a broken symlink
# (see https://bitb... | [
"def",
"is_dir",
"(",
"self",
")",
":",
"try",
":",
"return",
"S_ISDIR",
"(",
"self",
".",
"stat",
"(",
")",
".",
"st_mode",
")",
"except",
"OSError",
"as",
"e",
":",
"if",
"not",
"_ignore_error",
"(",
"e",
")",
":",
"raise",
"# Path doesn't exist or i... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/pathlib.py#L1368-L1379 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/Pygments/py2/pygments/lexer.py | python | RegexLexerMeta._process_token | (cls, token) | return token | Preprocess the token component of a token definition. | Preprocess the token component of a token definition. | [
"Preprocess",
"the",
"token",
"component",
"of",
"a",
"token",
"definition",
"."
] | def _process_token(cls, token):
"""Preprocess the token component of a token definition."""
assert type(token) is _TokenType or callable(token), \
'token type must be simple type or callable, not %r' % (token,)
return token | [
"def",
"_process_token",
"(",
"cls",
",",
"token",
")",
":",
"assert",
"type",
"(",
"token",
")",
"is",
"_TokenType",
"or",
"callable",
"(",
"token",
")",
",",
"'token type must be simple type or callable, not %r'",
"%",
"(",
"token",
",",
")",
"return",
"toke... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Pygments/py2/pygments/lexer.py#L429-L433 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Spinbox.scan_dragto | (self, x) | return self.scan("dragto", x) | Compute the difference between the given x argument
and the x argument to the last scan mark command
It then adjusts the view left or right by 10 times the
difference in x-coordinates. This command is typically
associated with mouse motion events in the widget, to
produce the ef... | Compute the difference between the given x argument
and the x argument to the last scan mark command | [
"Compute",
"the",
"difference",
"between",
"the",
"given",
"x",
"argument",
"and",
"the",
"x",
"argument",
"to",
"the",
"last",
"scan",
"mark",
"command"
] | def scan_dragto(self, x):
"""Compute the difference between the given x argument
and the x argument to the last scan mark command
It then adjusts the view left or right by 10 times the
difference in x-coordinates. This command is typically
associated with mouse motion events in ... | [
"def",
"scan_dragto",
"(",
"self",
",",
"x",
")",
":",
"return",
"self",
".",
"scan",
"(",
"\"dragto\"",
",",
"x",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L3480-L3490 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/core/defchararray.py | python | chararray.__mod__ | (self, i) | return asarray(mod(self, i)) | Return (self % i), that is pre-Python 2.6 string formatting
(iterpolation), element-wise for a pair of array_likes of `string_`
or `unicode_`.
See also
--------
mod | Return (self % i), that is pre-Python 2.6 string formatting
(iterpolation), element-wise for a pair of array_likes of `string_`
or `unicode_`. | [
"Return",
"(",
"self",
"%",
"i",
")",
"that",
"is",
"pre",
"-",
"Python",
"2",
".",
"6",
"string",
"formatting",
"(",
"iterpolation",
")",
"element",
"-",
"wise",
"for",
"a",
"pair",
"of",
"array_likes",
"of",
"string_",
"or",
"unicode_",
"."
] | def __mod__(self, i):
"""
Return (self % i), that is pre-Python 2.6 string formatting
(iterpolation), element-wise for a pair of array_likes of `string_`
or `unicode_`.
See also
--------
mod
"""
return asarray(mod(self, i)) | [
"def",
"__mod__",
"(",
"self",
",",
"i",
")",
":",
"return",
"asarray",
"(",
"mod",
"(",
"self",
",",
"i",
")",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/core/defchararray.py#L1969-L1979 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/ops/seq2seq.py | python | one2many_rnn_seq2seq | (encoder_inputs, decoder_inputs_dict, cell,
num_encoder_symbols, num_decoder_symbols_dict,
embedding_size, feed_previous=False,
dtype=dtypes.float32, scope=None) | return outputs_dict, state_dict | One-to-many RNN sequence-to-sequence model (multi-task).
This is a multi-task sequence-to-sequence model with one encoder and multiple
decoders. Reference to multi-task sequence-to-sequence learning can be found
here: http://arxiv.org/abs/1511.06114
Args:
encoder_inputs: A list of 1D int32 Tensors of shap... | One-to-many RNN sequence-to-sequence model (multi-task). | [
"One",
"-",
"to",
"-",
"many",
"RNN",
"sequence",
"-",
"to",
"-",
"sequence",
"model",
"(",
"multi",
"-",
"task",
")",
"."
] | def one2many_rnn_seq2seq(encoder_inputs, decoder_inputs_dict, cell,
num_encoder_symbols, num_decoder_symbols_dict,
embedding_size, feed_previous=False,
dtype=dtypes.float32, scope=None):
"""One-to-many RNN sequence-to-sequence model (multi-tas... | [
"def",
"one2many_rnn_seq2seq",
"(",
"encoder_inputs",
",",
"decoder_inputs_dict",
",",
"cell",
",",
"num_encoder_symbols",
",",
"num_decoder_symbols_dict",
",",
"embedding_size",
",",
"feed_previous",
"=",
"False",
",",
"dtype",
"=",
"dtypes",
".",
"float32",
",",
"... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/seq2seq.py#L799-L894 | |
alibaba/weex_js_engine | 2bdf4b6f020c1fc99c63f649718f6faf7e27fdde | jni/v8core/v8/build/gyp/pylib/gyp/xcodeproj_file.py | python | XCConfigurationList.ConfigurationNamed | (self, name) | Convenience accessor to obtain an XCBuildConfiguration by name. | Convenience accessor to obtain an XCBuildConfiguration by name. | [
"Convenience",
"accessor",
"to",
"obtain",
"an",
"XCBuildConfiguration",
"by",
"name",
"."
] | def ConfigurationNamed(self, name):
"""Convenience accessor to obtain an XCBuildConfiguration by name."""
for configuration in self._properties['buildConfigurations']:
if configuration._properties['name'] == name:
return configuration
raise KeyError, name | [
"def",
"ConfigurationNamed",
"(",
"self",
",",
"name",
")",
":",
"for",
"configuration",
"in",
"self",
".",
"_properties",
"[",
"'buildConfigurations'",
"]",
":",
"if",
"configuration",
".",
"_properties",
"[",
"'name'",
"]",
"==",
"name",
":",
"return",
"co... | https://github.com/alibaba/weex_js_engine/blob/2bdf4b6f020c1fc99c63f649718f6faf7e27fdde/jni/v8core/v8/build/gyp/pylib/gyp/xcodeproj_file.py#L1589-L1595 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TForestFire.BurnExpFire | (self) | return _snap.TForestFire_BurnExpFire(self) | BurnExpFire(TForestFire self)
Parameters:
self: TForestFire * | BurnExpFire(TForestFire self) | [
"BurnExpFire",
"(",
"TForestFire",
"self",
")"
] | def BurnExpFire(self):
"""
BurnExpFire(TForestFire self)
Parameters:
self: TForestFire *
"""
return _snap.TForestFire_BurnExpFire(self) | [
"def",
"BurnExpFire",
"(",
"self",
")",
":",
"return",
"_snap",
".",
"TForestFire_BurnExpFire",
"(",
"self",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L1274-L1282 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/array_analysis.py | python | ShapeEquivSet.is_equiv | (self, *objs) | return True | Overload EquivSet.is_equiv to handle Numba IR variables and
constants. | Overload EquivSet.is_equiv to handle Numba IR variables and
constants. | [
"Overload",
"EquivSet",
".",
"is_equiv",
"to",
"handle",
"Numba",
"IR",
"variables",
"and",
"constants",
"."
] | def is_equiv(self, *objs):
"""Overload EquivSet.is_equiv to handle Numba IR variables and
constants.
"""
assert(len(objs) > 1)
obj_names = [self._get_names(x) for x in objs]
obj_names = [x for x in obj_names if x != ()] # rule out 0d shape
if len(obj_names) <= 1:
... | [
"def",
"is_equiv",
"(",
"self",
",",
"*",
"objs",
")",
":",
"assert",
"(",
"len",
"(",
"objs",
")",
">",
"1",
")",
"obj_names",
"=",
"[",
"self",
".",
"_get_names",
"(",
"x",
")",
"for",
"x",
"in",
"objs",
"]",
"obj_names",
"=",
"[",
"x",
"for"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/array_analysis.py#L395-L414 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/model/coordinates.py | python | Point.localCoordinates | (self) | return self._localCoordinates[:] | Returns the coordinates of this point in its parent Frame | Returns the coordinates of this point in its parent Frame | [
"Returns",
"the",
"coordinates",
"of",
"this",
"point",
"in",
"its",
"parent",
"Frame"
] | def localCoordinates(self):
"""Returns the coordinates of this point in its parent Frame"""
return self._localCoordinates[:] | [
"def",
"localCoordinates",
"(",
"self",
")",
":",
"return",
"self",
".",
"_localCoordinates",
"[",
":",
"]"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/model/coordinates.py#L137-L139 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/longest-happy-string.py | python | Solution.longestDiverseString | (self, a, b, c) | return "".join(result) | :type a: int
:type b: int
:type c: int
:rtype: str | :type a: int
:type b: int
:type c: int
:rtype: str | [
":",
"type",
"a",
":",
"int",
":",
"type",
"b",
":",
"int",
":",
"type",
"c",
":",
"int",
":",
"rtype",
":",
"str"
] | def longestDiverseString(self, a, b, c):
"""
:type a: int
:type b: int
:type c: int
:rtype: str
"""
max_heap = []
if a:
heapq.heappush(max_heap, (-a, 'a'))
if b:
heapq.heappush(max_heap, (-b, 'b'))
if c:
... | [
"def",
"longestDiverseString",
"(",
"self",
",",
"a",
",",
"b",
",",
"c",
")",
":",
"max_heap",
"=",
"[",
"]",
"if",
"a",
":",
"heapq",
".",
"heappush",
"(",
"max_heap",
",",
"(",
"-",
"a",
",",
"'a'",
")",
")",
"if",
"b",
":",
"heapq",
".",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/longest-happy-string.py#L8-L39 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/cookielib.py | python | DefaultCookiePolicy.blocked_domains | (self) | return self._blocked_domains | Return the sequence of blocked domains (as a tuple). | Return the sequence of blocked domains (as a tuple). | [
"Return",
"the",
"sequence",
"of",
"blocked",
"domains",
"(",
"as",
"a",
"tuple",
")",
"."
] | def blocked_domains(self):
"""Return the sequence of blocked domains (as a tuple)."""
return self._blocked_domains | [
"def",
"blocked_domains",
"(",
"self",
")",
":",
"return",
"self",
".",
"_blocked_domains"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/cookielib.py#L881-L883 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | DateTime.ParseISOCombined | (*args, **kwargs) | return _misc_.DateTime_ParseISOCombined(*args, **kwargs) | ParseISOCombined(self, String datetime, char sep='T') -> bool | ParseISOCombined(self, String datetime, char sep='T') -> bool | [
"ParseISOCombined",
"(",
"self",
"String",
"datetime",
"char",
"sep",
"=",
"T",
")",
"-",
">",
"bool"
] | def ParseISOCombined(*args, **kwargs):
"""ParseISOCombined(self, String datetime, char sep='T') -> bool"""
return _misc_.DateTime_ParseISOCombined(*args, **kwargs) | [
"def",
"ParseISOCombined",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DateTime_ParseISOCombined",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L4146-L4148 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/webapp2/webapp2_extras/i18n.py | python | get_store | (factory=I18nStore, key=_store_registry_key, app=None) | return store | Returns an instance of :class:`I18nStore` from the app registry.
It'll try to get it from the current app registry, and if it is not
registered it'll be instantiated and registered. A second call to this
function will return the same instance.
:param factory:
The callable used to build and reg... | Returns an instance of :class:`I18nStore` from the app registry. | [
"Returns",
"an",
"instance",
"of",
":",
"class",
":",
"I18nStore",
"from",
"the",
"app",
"registry",
"."
] | def get_store(factory=I18nStore, key=_store_registry_key, app=None):
"""Returns an instance of :class:`I18nStore` from the app registry.
It'll try to get it from the current app registry, and if it is not
registered it'll be instantiated and registered. A second call to this
function will return the sa... | [
"def",
"get_store",
"(",
"factory",
"=",
"I18nStore",
",",
"key",
"=",
"_store_registry_key",
",",
"app",
"=",
"None",
")",
":",
"app",
"=",
"app",
"or",
"webapp2",
".",
"get_app",
"(",
")",
"store",
"=",
"app",
".",
"registry",
".",
"get",
"(",
"key... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/webapp2/webapp2_extras/i18n.py#L836-L858 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/polynomial/legendre.py | python | poly2leg | (pol) | return res | Convert a polynomial to a Legendre series.
Convert an array representing the coefficients of a polynomial (relative
to the "standard" basis) ordered from lowest degree to highest, to an
array of the coefficients of the equivalent Legendre series, ordered
from lowest to highest degree.
Parameters
... | Convert a polynomial to a Legendre series. | [
"Convert",
"a",
"polynomial",
"to",
"a",
"Legendre",
"series",
"."
] | def poly2leg(pol):
"""
Convert a polynomial to a Legendre series.
Convert an array representing the coefficients of a polynomial (relative
to the "standard" basis) ordered from lowest degree to highest, to an
array of the coefficients of the equivalent Legendre series, ordered
from lowest to hi... | [
"def",
"poly2leg",
"(",
"pol",
")",
":",
"[",
"pol",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"pol",
"]",
")",
"deg",
"=",
"len",
"(",
"pol",
")",
"-",
"1",
"res",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"deg",
",",
"-",
"1",
",",
"-... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/polynomial/legendre.py#L105-L150 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/ndarray/numpy/_op.py | python | max | (a, axis=None, out=None, keepdims=False) | return _api_internal.max(a, axis, keepdims, out) | Return the maximum of an array or maximum along an axis.
Parameters
----------
a : ndarray
Input data.
axis : int, optional
Axis along which to operate. By default, flattened input is used.
out : ndarray, optional
Alternative output array in which to place the result. Must... | Return the maximum of an array or maximum along an axis. | [
"Return",
"the",
"maximum",
"of",
"an",
"array",
"or",
"maximum",
"along",
"an",
"axis",
"."
] | def max(a, axis=None, out=None, keepdims=False):
"""
Return the maximum of an array or maximum along an axis.
Parameters
----------
a : ndarray
Input data.
axis : int, optional
Axis along which to operate. By default, flattened input is used.
out : ndarray, optional
... | [
"def",
"max",
"(",
"a",
",",
"axis",
"=",
"None",
",",
"out",
"=",
"None",
",",
"keepdims",
"=",
"False",
")",
":",
"return",
"_api_internal",
".",
"max",
"(",
"a",
",",
"axis",
",",
"keepdims",
",",
"out",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/ndarray/numpy/_op.py#L5037-L5098 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/eclipse.py | python | GetCompilerPath | (target_list, target_dicts, data) | return 'gcc' | Determine a command that can be used to invoke the compiler.
Returns:
If this is a gyp project that has explicit make settings, try to determine
the compiler from that. Otherwise, see if a compiler was specified via the
CC_target environment variable. | Determine a command that can be used to invoke the compiler. | [
"Determine",
"a",
"command",
"that",
"can",
"be",
"used",
"to",
"invoke",
"the",
"compiler",
"."
] | def GetCompilerPath(target_list, target_dicts, data):
"""Determine a command that can be used to invoke the compiler.
Returns:
If this is a gyp project that has explicit make settings, try to determine
the compiler from that. Otherwise, see if a compiler was specified via the
CC_target environment var... | [
"def",
"GetCompilerPath",
"(",
"target_list",
",",
"target_dicts",
",",
"data",
")",
":",
"# First, see if the compiler is configured in make's settings.",
"build_file",
",",
"_",
",",
"_",
"=",
"gyp",
".",
"common",
".",
"ParseQualifiedTarget",
"(",
"target_list",
"[... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/eclipse.py#L123-L145 | |
yushroom/FishEngine | a4b9fb9b0a6dc202f7990e75f4b7d8d5163209d9 | Script/reflect/clang/cindex.py | python | Diagnostic.option | (self) | return conf.lib.clang_getDiagnosticOption(self, None) | The command-line option that enables this diagnostic. | The command-line option that enables this diagnostic. | [
"The",
"command",
"-",
"line",
"option",
"that",
"enables",
"this",
"diagnostic",
"."
] | def option(self):
"""The command-line option that enables this diagnostic."""
return conf.lib.clang_getDiagnosticOption(self, None) | [
"def",
"option",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getDiagnosticOption",
"(",
"self",
",",
"None",
")"
] | https://github.com/yushroom/FishEngine/blob/a4b9fb9b0a6dc202f7990e75f4b7d8d5163209d9/Script/reflect/clang/cindex.py#L398-L400 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/util/_cloudpickle/_cloudpickle_py27.py | python | CloudPickler.save_attrgetter | (self, obj) | return self.save_reduce(operator.attrgetter, tuple(attrs)) | attrgetter serializer | attrgetter serializer | [
"attrgetter",
"serializer"
] | def save_attrgetter(self, obj):
"""attrgetter serializer"""
class Dummy(object):
def __init__(self, attrs, index=None):
self.attrs = attrs
self.index = index
def __getattribute__(self, item):
attrs = object.__getattribute__(self, ... | [
"def",
"save_attrgetter",
"(",
"self",
",",
"obj",
")",
":",
"class",
"Dummy",
"(",
"object",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"attrs",
",",
"index",
"=",
"None",
")",
":",
"self",
".",
"attrs",
"=",
"attrs",
"self",
".",
"index",
"="... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/util/_cloudpickle/_cloudpickle_py27.py#L809-L829 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/traitlets/py3/traitlets/config/loader.py | python | DeferredConfigString.get_value | (self, trait) | Get the value stored in this string | Get the value stored in this string | [
"Get",
"the",
"value",
"stored",
"in",
"this",
"string"
] | def get_value(self, trait):
"""Get the value stored in this string"""
s = str(self)
try:
return trait.from_string(s)
except Exception:
# exception casting from string,
# let the original string lie.
# this will raise a more informative erro... | [
"def",
"get_value",
"(",
"self",
",",
"trait",
")",
":",
"s",
"=",
"str",
"(",
"self",
")",
"try",
":",
"return",
"trait",
".",
"from_string",
"(",
"s",
")",
"except",
"Exception",
":",
"# exception casting from string,",
"# let the original string lie.",
"# t... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/traitlets/py3/traitlets/config/loader.py#L404-L413 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/numbers.py | python | Integral.__pow__ | (self, exponent, modulus=None) | self ** exponent % modulus, but maybe faster.
Accept the modulus argument if you want to support the
3-argument version of pow(). Raise a TypeError if exponent < 0
or any argument isn't Integral. Otherwise, just implement the
2-argument version described in Complex. | self ** exponent % modulus, but maybe faster. | [
"self",
"**",
"exponent",
"%",
"modulus",
"but",
"maybe",
"faster",
"."
] | def __pow__(self, exponent, modulus=None):
"""self ** exponent % modulus, but maybe faster.
Accept the modulus argument if you want to support the
3-argument version of pow(). Raise a TypeError if exponent < 0
or any argument isn't Integral. Otherwise, just implement the
2-argum... | [
"def",
"__pow__",
"(",
"self",
",",
"exponent",
",",
"modulus",
"=",
"None",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/numbers.py#L309-L317 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | createDocParserCtxt | (cur) | return parserCtxt(_obj=ret) | Creates a parser context for an XML in-memory document. | Creates a parser context for an XML in-memory document. | [
"Creates",
"a",
"parser",
"context",
"for",
"an",
"XML",
"in",
"-",
"memory",
"document",
"."
] | def createDocParserCtxt(cur):
"""Creates a parser context for an XML in-memory document. """
ret = libxml2mod.xmlCreateDocParserCtxt(cur)
if ret is None:raise parserError('xmlCreateDocParserCtxt() failed')
return parserCtxt(_obj=ret) | [
"def",
"createDocParserCtxt",
"(",
"cur",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlCreateDocParserCtxt",
"(",
"cur",
")",
"if",
"ret",
"is",
"None",
":",
"raise",
"parserError",
"(",
"'xmlCreateDocParserCtxt() failed'",
")",
"return",
"parserCtxt",
"(",
"_ob... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L483-L487 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Util.py | python | AddPathIfNotExists | (env_dict, key, path, sep=os.pathsep) | This function will take 'key' out of the dictionary
'env_dict', then add the path 'path' to that key if it is not
already there. This treats the value of env_dict[key] as if it
has a similar format to the PATH variable...a list of paths
separated by tokens. The 'path' will get added to the list if it
... | This function will take 'key' out of the dictionary
'env_dict', then add the path 'path' to that key if it is not
already there. This treats the value of env_dict[key] as if it
has a similar format to the PATH variable...a list of paths
separated by tokens. The 'path' will get added to the list if it
... | [
"This",
"function",
"will",
"take",
"key",
"out",
"of",
"the",
"dictionary",
"env_dict",
"then",
"add",
"the",
"path",
"path",
"to",
"that",
"key",
"if",
"it",
"is",
"not",
"already",
"there",
".",
"This",
"treats",
"the",
"value",
"of",
"env_dict",
"[",... | def AddPathIfNotExists(env_dict, key, path, sep=os.pathsep):
"""This function will take 'key' out of the dictionary
'env_dict', then add the path 'path' to that key if it is not
already there. This treats the value of env_dict[key] as if it
has a similar format to the PATH variable...a list of paths
... | [
"def",
"AddPathIfNotExists",
"(",
"env_dict",
",",
"key",
",",
"path",
",",
"sep",
"=",
"os",
".",
"pathsep",
")",
":",
"try",
":",
"is_list",
"=",
"1",
"paths",
"=",
"env_dict",
"[",
"key",
"]",
"if",
"not",
"is_List",
"(",
"env_dict",
"[",
"key",
... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Util.py#L899-L919 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/setuptools/package_index.py | python | unique_values | (func) | return wrapper | Wrap a function returning an iterable such that the resulting iterable
only ever yields unique items. | Wrap a function returning an iterable such that the resulting iterable
only ever yields unique items. | [
"Wrap",
"a",
"function",
"returning",
"an",
"iterable",
"such",
"that",
"the",
"resulting",
"iterable",
"only",
"ever",
"yields",
"unique",
"items",
"."
] | def unique_values(func):
"""
Wrap a function returning an iterable such that the resulting iterable
only ever yields unique items.
"""
@wraps(func)
def wrapper(*args, **kwargs):
return unique_everseen(func(*args, **kwargs))
return wrapper | [
"def",
"unique_values",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"unique_everseen",
"(",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/setuptools/package_index.py#L169-L177 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | snapx/snapx/classes/graph.py | python | Graph.add_node | (self, node_for_adding, **attr) | PORTED FROM NETWORKX
Add a single node `node_for_adding` and update node attributes.
Parameters
----------
node_for_adding : node
A node can be any hashable Python object except None.
attr : keyword arguments, optional
Set or change node attributes using k... | PORTED FROM NETWORKX
Add a single node `node_for_adding` and update node attributes.
Parameters
----------
node_for_adding : node
A node can be any hashable Python object except None.
attr : keyword arguments, optional
Set or change node attributes using k... | [
"PORTED",
"FROM",
"NETWORKX",
"Add",
"a",
"single",
"node",
"node_for_adding",
"and",
"update",
"node",
"attributes",
".",
"Parameters",
"----------",
"node_for_adding",
":",
"node",
"A",
"node",
"can",
"be",
"any",
"hashable",
"Python",
"object",
"except",
"Non... | def add_node(self, node_for_adding, **attr):
"""PORTED FROM NETWORKX
Add a single node `node_for_adding` and update node attributes.
Parameters
----------
node_for_adding : node
A node can be any hashable Python object except None.
attr : keyword arguments, op... | [
"def",
"add_node",
"(",
"self",
",",
"node_for_adding",
",",
"*",
"*",
"attr",
")",
":",
"try",
":",
"if",
"node_for_adding",
"not",
"in",
"self",
":",
"self",
".",
"_graph",
".",
"AddNode",
"(",
"node_for_adding",
")",
"self",
".",
"nodes",
"[",
"node... | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/snapx/snapx/classes/graph.py#L232-L270 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/dataview.py | python | DataViewTreeCtrl.GetItemIcon | (*args, **kwargs) | return _dataview.DataViewTreeCtrl_GetItemIcon(*args, **kwargs) | GetItemIcon(self, DataViewItem item) -> Icon | GetItemIcon(self, DataViewItem item) -> Icon | [
"GetItemIcon",
"(",
"self",
"DataViewItem",
"item",
")",
"-",
">",
"Icon"
] | def GetItemIcon(*args, **kwargs):
"""GetItemIcon(self, DataViewItem item) -> Icon"""
return _dataview.DataViewTreeCtrl_GetItemIcon(*args, **kwargs) | [
"def",
"GetItemIcon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewTreeCtrl_GetItemIcon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/dataview.py#L2544-L2546 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/tpu_sharding.py | python | ShardingPolicy.set_number_of_shards | (self, number_of_shards) | Sets the number of shards for the current policy.
If the policy has been frozen then number_of_shards must match the
existing setting.
Args:
number_of_shards: The number of shards to use in the policy.
Raises:
ValueError: If the policy has been frozen and number_of_shards
differs ... | Sets the number of shards for the current policy. | [
"Sets",
"the",
"number",
"of",
"shards",
"for",
"the",
"current",
"policy",
"."
] | def set_number_of_shards(self, number_of_shards):
"""Sets the number of shards for the current policy.
If the policy has been frozen then number_of_shards must match the
existing setting.
Args:
number_of_shards: The number of shards to use in the policy.
Raises:
ValueError: If the pol... | [
"def",
"set_number_of_shards",
"(",
"self",
",",
"number_of_shards",
")",
":",
"if",
"self",
".",
"_frozen",
":",
"if",
"self",
".",
"_number_of_shards",
"!=",
"number_of_shards",
":",
"raise",
"ValueError",
"(",
"\"Can't set sharding policy to use %d shards since it ha... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/tpu_sharding.py#L69-L93 | ||
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | Wrapping/Python/paraview/servermanager.py | python | ArrayInformation.__getattr__ | (self, name) | return getattr(array, name) | Forward unknown methods to vtkPVArrayInformation | Forward unknown methods to vtkPVArrayInformation | [
"Forward",
"unknown",
"methods",
"to",
"vtkPVArrayInformation"
] | def __getattr__(self, name):
"""Forward unknown methods to vtkPVArrayInformation"""
array = self.FieldData.GetFieldData().GetArrayInformation(self.Name)
if not array: return None
return getattr(array, name) | [
"def",
"__getattr__",
"(",
"self",
",",
"name",
")",
":",
"array",
"=",
"self",
".",
"FieldData",
".",
"GetFieldData",
"(",
")",
".",
"GetArrayInformation",
"(",
"self",
".",
"Name",
")",
"if",
"not",
"array",
":",
"return",
"None",
"return",
"getattr",
... | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Wrapping/Python/paraview/servermanager.py#L1555-L1559 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/urllib3/connection.py | python | HTTPConnection._new_conn | (self) | return conn | Establish a socket connection and set nodelay settings on it.
:return: New socket connection. | Establish a socket connection and set nodelay settings on it. | [
"Establish",
"a",
"socket",
"connection",
"and",
"set",
"nodelay",
"settings",
"on",
"it",
"."
] | def _new_conn(self):
""" Establish a socket connection and set nodelay settings on it.
:return: New socket connection.
"""
extra_kw = {}
if self.source_address:
extra_kw["source_address"] = self.source_address
if self.socket_options:
extra_kw["so... | [
"def",
"_new_conn",
"(",
"self",
")",
":",
"extra_kw",
"=",
"{",
"}",
"if",
"self",
".",
"source_address",
":",
"extra_kw",
"[",
"\"source_address\"",
"]",
"=",
"self",
".",
"source_address",
"if",
"self",
".",
"socket_options",
":",
"extra_kw",
"[",
"\"so... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/urllib3/connection.py#L143-L172 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/google/protobuf-py/google/protobuf/text_format.py | python | _Tokenizer.ParseErrorPreviousToken | (self, message) | return ParseError('%d:%d : %s' % (
self._previous_line + 1, self._previous_column + 1, message)) | Creates and *returns* a ParseError for the previously read token.
Args:
message: A message to set for the exception.
Returns:
A ParseError instance. | Creates and *returns* a ParseError for the previously read token. | [
"Creates",
"and",
"*",
"returns",
"*",
"a",
"ParseError",
"for",
"the",
"previously",
"read",
"token",
"."
] | def ParseErrorPreviousToken(self, message):
"""Creates and *returns* a ParseError for the previously read token.
Args:
message: A message to set for the exception.
Returns:
A ParseError instance.
"""
return ParseError('%d:%d : %s' % (
self._previous_line + 1, self._previous_col... | [
"def",
"ParseErrorPreviousToken",
"(",
"self",
",",
"message",
")",
":",
"return",
"ParseError",
"(",
"'%d:%d : %s'",
"%",
"(",
"self",
".",
"_previous_line",
"+",
"1",
",",
"self",
".",
"_previous_column",
"+",
"1",
",",
"message",
")",
")"
] | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/google/protobuf-py/google/protobuf/text_format.py#L613-L623 | |
vslavik/poedit | f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a | deps/boost/tools/build/src/build/targets.py | python | BasicTarget.construct | (self, name, source_targets, properties) | Constructs the virtual targets for this abstract targets and
the dependency graph. Returns a tuple consisting of the properties and the list of virtual targets.
Should be overridden in derived classes. | Constructs the virtual targets for this abstract targets and
the dependency graph. Returns a tuple consisting of the properties and the list of virtual targets.
Should be overridden in derived classes. | [
"Constructs",
"the",
"virtual",
"targets",
"for",
"this",
"abstract",
"targets",
"and",
"the",
"dependency",
"graph",
".",
"Returns",
"a",
"tuple",
"consisting",
"of",
"the",
"properties",
"and",
"the",
"list",
"of",
"virtual",
"targets",
".",
"Should",
"be",
... | def construct (self, name, source_targets, properties):
""" Constructs the virtual targets for this abstract targets and
the dependency graph. Returns a tuple consisting of the properties and the list of virtual targets.
Should be overridden in derived classes.
"""
raise ... | [
"def",
"construct",
"(",
"self",
",",
"name",
",",
"source_targets",
",",
"properties",
")",
":",
"raise",
"BaseException",
"(",
"\"method should be defined in derived classes\"",
")"
] | https://github.com/vslavik/poedit/blob/f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a/deps/boost/tools/build/src/build/targets.py#L1372-L1377 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/graph_editor/select.py | python | _get_input_ts | (ops) | return ts | Compute the list of unique input tensors of all the op in ops.
Args:
ops: an object convertible to a list of tf.Operation.
Returns:
The list of unique input tensors of all the op in ops.
Raises:
TypeError: if ops cannot be converted to a list of tf.Operation. | Compute the list of unique input tensors of all the op in ops. | [
"Compute",
"the",
"list",
"of",
"unique",
"input",
"tensors",
"of",
"all",
"the",
"op",
"in",
"ops",
"."
] | def _get_input_ts(ops):
"""Compute the list of unique input tensors of all the op in ops.
Args:
ops: an object convertible to a list of tf.Operation.
Returns:
The list of unique input tensors of all the op in ops.
Raises:
TypeError: if ops cannot be converted to a list of tf.Operation.
"""
ops ... | [
"def",
"_get_input_ts",
"(",
"ops",
")",
":",
"ops",
"=",
"util",
".",
"make_list_of_op",
"(",
"ops",
")",
"ts",
"=",
"[",
"]",
"for",
"op",
"in",
"ops",
":",
"for",
"t",
"in",
"op",
".",
"inputs",
":",
"if",
"t",
"not",
"in",
"ts",
":",
"ts",
... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/graph_editor/select.py#L59-L75 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/os2emxpath.py | python | normcase | (s) | return s.replace('\\', '/').lower() | Normalize case of pathname.
Makes all characters lowercase and all altseps into seps. | Normalize case of pathname. | [
"Normalize",
"case",
"of",
"pathname",
"."
] | def normcase(s):
"""Normalize case of pathname.
Makes all characters lowercase and all altseps into seps."""
return s.replace('\\', '/').lower() | [
"def",
"normcase",
"(",
"s",
")",
":",
"return",
"s",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")",
".",
"lower",
"(",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/os2emxpath.py#L35-L39 | |
bairdzhang/smallhardface | 76fa1d87a9602d9b13d7a7fe693fc7aec91cab80 | lib/prototxt/manipulate.py | python | _simple_conv_layer | (name,
bottom,
top,
num_output,
kernel_size,
pad,
dilation=1,
std=0.01,
bias=0.0,
param_type=0) | return conv_layer | param_type:
0 -> do nothing
1 -> (lr 1, decay 0; lr 2, decay 0)
2 -> (lr 1, decay 1; lr 2, decay 0)
3 -> (lr 10, decay 1; lr 20, decay 0)
4 -> (lr 1, decay 1; lr 1, decay 1) | param_type:
0 -> do nothing
1 -> (lr 1, decay 0; lr 2, decay 0)
2 -> (lr 1, decay 1; lr 2, decay 0)
3 -> (lr 10, decay 1; lr 20, decay 0)
4 -> (lr 1, decay 1; lr 1, decay 1) | [
"param_type",
":",
"0",
"-",
">",
"do",
"nothing",
"1",
"-",
">",
"(",
"lr",
"1",
"decay",
"0",
";",
"lr",
"2",
"decay",
"0",
")",
"2",
"-",
">",
"(",
"lr",
"1",
"decay",
"1",
";",
"lr",
"2",
"decay",
"0",
")",
"3",
"-",
">",
"(",
"lr",
... | def _simple_conv_layer(name,
bottom,
top,
num_output,
kernel_size,
pad,
dilation=1,
std=0.01,
bias=0.0,
param_typ... | [
"def",
"_simple_conv_layer",
"(",
"name",
",",
"bottom",
",",
"top",
",",
"num_output",
",",
"kernel_size",
",",
"pad",
",",
"dilation",
"=",
"1",
",",
"std",
"=",
"0.01",
",",
"bias",
"=",
"0.0",
",",
"param_type",
"=",
"0",
")",
":",
"conv_layer",
... | https://github.com/bairdzhang/smallhardface/blob/76fa1d87a9602d9b13d7a7fe693fc7aec91cab80/lib/prototxt/manipulate.py#L89-L142 | |
Slicer/SlicerGitSVNArchive | 65e92bb16c2b32ea47a1a66bee71f238891ee1ca | Modules/Scripted/EditorLib/EditUtil.py | python | UndoRedo.addRedoObserver | (self, observer) | observer is a callable to be invoked when an redo operation
is selected | observer is a callable to be invoked when an redo operation
is selected | [
"observer",
"is",
"a",
"callable",
"to",
"be",
"invoked",
"when",
"an",
"redo",
"operation",
"is",
"selected"
] | def addRedoObserver(self, observer):
"""observer is a callable to be invoked when an redo operation
is selected"""
self.redoObservers.append(observer) | [
"def",
"addRedoObserver",
"(",
"self",
",",
"observer",
")",
":",
"self",
".",
"redoObservers",
".",
"append",
"(",
"observer",
")"
] | https://github.com/Slicer/SlicerGitSVNArchive/blob/65e92bb16c2b32ea47a1a66bee71f238891ee1ca/Modules/Scripted/EditorLib/EditUtil.py#L419-L422 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py | python | JSONEncoder.__init__ | (self, *, skipkeys=False, ensure_ascii=True,
check_circular=True, allow_nan=True, sort_keys=False,
indent=None, separators=None, default=None) | Constructor for JSONEncoder, with sensible defaults.
If skipkeys is false, then it is a TypeError to attempt
encoding of keys that are not str, int, float or None. If
skipkeys is True, such items are simply skipped.
If ensure_ascii is true, the output is guaranteed to be str
o... | Constructor for JSONEncoder, with sensible defaults. | [
"Constructor",
"for",
"JSONEncoder",
"with",
"sensible",
"defaults",
"."
] | def __init__(self, *, skipkeys=False, ensure_ascii=True,
check_circular=True, allow_nan=True, sort_keys=False,
indent=None, separators=None, default=None):
"""Constructor for JSONEncoder, with sensible defaults.
If skipkeys is false, then it is a TypeError to attempt
enc... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"skipkeys",
"=",
"False",
",",
"ensure_ascii",
"=",
"True",
",",
"check_circular",
"=",
"True",
",",
"allow_nan",
"=",
"True",
",",
"sort_keys",
"=",
"False",
",",
"indent",
"=",
"None",
",",
"separators",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py#L104-L158 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/optimize/_linprog_simplex.py | python | _linprog_simplex | (c, c0, A, b, maxiter=1000, disp=False, callback=None,
tol=1.0E-12, bland=False, _T_o=None, **unknown_options) | return x, status, messages[status], int(nit2) | Minimize a linear objective function subject to linear equality and
non-negativity constraints using the two phase simplex method.
Linear programming is intended to solve problems of the following form:
Minimize::
c @ x
Subject to::
A @ x == b
x >= 0
Parameters
-... | Minimize a linear objective function subject to linear equality and
non-negativity constraints using the two phase simplex method.
Linear programming is intended to solve problems of the following form: | [
"Minimize",
"a",
"linear",
"objective",
"function",
"subject",
"to",
"linear",
"equality",
"and",
"non",
"-",
"negativity",
"constraints",
"using",
"the",
"two",
"phase",
"simplex",
"method",
".",
"Linear",
"programming",
"is",
"intended",
"to",
"solve",
"proble... | def _linprog_simplex(c, c0, A, b, maxiter=1000, disp=False, callback=None,
tol=1.0E-12, bland=False, _T_o=None, **unknown_options):
"""
Minimize a linear objective function subject to linear equality and
non-negativity constraints using the two phase simplex method.
Linear programmi... | [
"def",
"_linprog_simplex",
"(",
"c",
",",
"c0",
",",
"A",
",",
"b",
",",
"maxiter",
"=",
"1000",
",",
"disp",
"=",
"False",
",",
"callback",
"=",
"None",
",",
"tol",
"=",
"1.0E-12",
",",
"bland",
"=",
"False",
",",
"_T_o",
"=",
"None",
",",
"*",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/_linprog_simplex.py#L405-L616 | |
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/instrument.py | python | Instrument.last_price_protected | (self) | return self._last_price_protected | Gets the last_price_protected of this Instrument. # noqa: E501
:return: The last_price_protected of this Instrument. # noqa: E501
:rtype: float | Gets the last_price_protected of this Instrument. # noqa: E501 | [
"Gets",
"the",
"last_price_protected",
"of",
"this",
"Instrument",
".",
"#",
"noqa",
":",
"E501"
] | def last_price_protected(self):
"""Gets the last_price_protected of this Instrument. # noqa: E501
:return: The last_price_protected of this Instrument. # noqa: E501
:rtype: float
"""
return self._last_price_protected | [
"def",
"last_price_protected",
"(",
"self",
")",
":",
"return",
"self",
".",
"_last_price_protected"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/instrument.py#L2242-L2249 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/xml/sax/xmlreader.py | python | InputSource.setPublicId | (self, public_id) | Sets the public identifier of this InputSource. | Sets the public identifier of this InputSource. | [
"Sets",
"the",
"public",
"identifier",
"of",
"this",
"InputSource",
"."
] | def setPublicId(self, public_id):
"Sets the public identifier of this InputSource."
self.__public_id = public_id | [
"def",
"setPublicId",
"(",
"self",
",",
"public_id",
")",
":",
"self",
".",
"__public_id",
"=",
"public_id"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/xml/sax/xmlreader.py#L210-L212 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/grid.py | python | GridTableBase.GetNumberRows | (*args, **kwargs) | return _grid.GridTableBase_GetNumberRows(*args, **kwargs) | GetNumberRows(self) -> int | GetNumberRows(self) -> int | [
"GetNumberRows",
"(",
"self",
")",
"-",
">",
"int"
] | def GetNumberRows(*args, **kwargs):
"""GetNumberRows(self) -> int"""
return _grid.GridTableBase_GetNumberRows(*args, **kwargs) | [
"def",
"GetNumberRows",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"GridTableBase_GetNumberRows",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/grid.py#L802-L804 | |
yrnkrn/zapcc | c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50 | bindings/python/llvm/disassembler.py | python | Disassembler.get_instruction | (self, source, pc=0) | return (result, out_str.value) | Obtain the next instruction from an input source.
The input source should be a str or bytearray or something that
represents a sequence of bytes.
This function will start reading bytes from the beginning of the
source.
The pc argument specifies the address that the first byte ... | Obtain the next instruction from an input source. | [
"Obtain",
"the",
"next",
"instruction",
"from",
"an",
"input",
"source",
"."
] | def get_instruction(self, source, pc=0):
"""Obtain the next instruction from an input source.
The input source should be a str or bytearray or something that
represents a sequence of bytes.
This function will start reading bytes from the beginning of the
source.
The pc... | [
"def",
"get_instruction",
"(",
"self",
",",
"source",
",",
"pc",
"=",
"0",
")",
":",
"buf",
"=",
"cast",
"(",
"c_char_p",
"(",
"source",
")",
",",
"POINTER",
"(",
"c_ubyte",
")",
")",
"out_str",
"=",
"cast",
"(",
"(",
"c_byte",
"*",
"255",
")",
"... | https://github.com/yrnkrn/zapcc/blob/c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50/bindings/python/llvm/disassembler.py#L84-L107 | |
SoarGroup/Soar | a1c5e249499137a27da60533c72969eef3b8ab6b | scons/scons-local-4.1.0/SCons/Builder.py | python | DictCmdGenerator.add_action | (self, suffix, action) | Add a suffix-action pair to the mapping. | Add a suffix-action pair to the mapping. | [
"Add",
"a",
"suffix",
"-",
"action",
"pair",
"to",
"the",
"mapping",
"."
] | def add_action(self, suffix, action):
"""Add a suffix-action pair to the mapping.
"""
self[suffix] = action | [
"def",
"add_action",
"(",
"self",
",",
"suffix",
",",
"action",
")",
":",
"self",
"[",
"suffix",
"]",
"=",
"action"
] | https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/Builder.py#L140-L143 | ||
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/contributed/sumopy/coremodules/demand/turnflows.py | python | Flows.count_left | (self, counter) | Counts the number of vehicles leaving the edge.
The counter is an array where the index equals the edge ID
and the value represens the number of entered vehicles per edge. | Counts the number of vehicles leaving the edge.
The counter is an array where the index equals the edge ID
and the value represens the number of entered vehicles per edge. | [
"Counts",
"the",
"number",
"of",
"vehicles",
"leaving",
"the",
"edge",
".",
"The",
"counter",
"is",
"an",
"array",
"where",
"the",
"index",
"equals",
"the",
"edge",
"ID",
"and",
"the",
"value",
"represens",
"the",
"number",
"of",
"entered",
"vehicles",
"pe... | def count_left(self, counter):
"""
Counts the number of vehicles leaving the edge.
The counter is an array where the index equals the edge ID
and the value represens the number of entered vehicles per edge.
"""
ids_flow = self.get_ids()
counter[self.ids_edge[ids_f... | [
"def",
"count_left",
"(",
"self",
",",
"counter",
")",
":",
"ids_flow",
"=",
"self",
".",
"get_ids",
"(",
")",
"counter",
"[",
"self",
".",
"ids_edge",
"[",
"ids_flow",
"]",
"]",
"+=",
"self",
".",
"flows",
"[",
"ids_flow",
"]"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/coremodules/demand/turnflows.py#L116-L123 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/msvc.py | python | SystemInfo._find_latest_available_vs_ver | (self) | return sorted(vc_vers)[-1] | Find the latest VC version
Return
------
float
version | Find the latest VC version | [
"Find",
"the",
"latest",
"VC",
"version"
] | def _find_latest_available_vs_ver(self):
"""
Find the latest VC version
Return
------
float
version
"""
reg_vc_vers = self.find_reg_vs_vers()
if not (reg_vc_vers or self.known_vs_paths):
raise distutils.errors.DistutilsPlatformErr... | [
"def",
"_find_latest_available_vs_ver",
"(",
"self",
")",
":",
"reg_vc_vers",
"=",
"self",
".",
"find_reg_vs_vers",
"(",
")",
"if",
"not",
"(",
"reg_vc_vers",
"or",
"self",
".",
"known_vs_paths",
")",
":",
"raise",
"distutils",
".",
"errors",
".",
"DistutilsPl... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/msvc.py#L692-L709 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | media/webrtc/trunk/tools/gyp/pylib/gyp/generator/android.py | python | WriteAutoRegenerationRule | (params, root_makefile, makefile_name,
build_files) | Write the target to regenerate the Makefile. | Write the target to regenerate the Makefile. | [
"Write",
"the",
"target",
"to",
"regenerate",
"the",
"Makefile",
"."
] | def WriteAutoRegenerationRule(params, root_makefile, makefile_name,
build_files):
"""Write the target to regenerate the Makefile."""
options = params['options']
# Sort to avoid non-functional changes to makefile.
build_files = sorted([os.path.join('$(LOCAL_PATH)', f) for f in build... | [
"def",
"WriteAutoRegenerationRule",
"(",
"params",
",",
"root_makefile",
",",
"makefile_name",
",",
"build_files",
")",
":",
"options",
"=",
"params",
"[",
"'options'",
"]",
"# Sort to avoid non-functional changes to makefile.",
"build_files",
"=",
"sorted",
"(",
"[",
... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/android.py#L943-L966 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/jedi/jedi/evaluate/compiled/subprocess/functions.py | python | _get_init_path | (directory_path) | return None | The __init__ file can be searched in a directory. If found return it, else
None. | The __init__ file can be searched in a directory. If found return it, else
None. | [
"The",
"__init__",
"file",
"can",
"be",
"searched",
"in",
"a",
"directory",
".",
"If",
"found",
"return",
"it",
"else",
"None",
"."
] | def _get_init_path(directory_path):
"""
The __init__ file can be searched in a directory. If found return it, else
None.
"""
for suffix in all_suffixes():
path = os.path.join(directory_path, '__init__' + suffix)
if os.path.exists(path):
return path
return None | [
"def",
"_get_init_path",
"(",
"directory_path",
")",
":",
"for",
"suffix",
"in",
"all_suffixes",
"(",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"directory_path",
",",
"'__init__'",
"+",
"suffix",
")",
"if",
"os",
".",
"path",
".",
"ex... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/jedi/jedi/evaluate/compiled/subprocess/functions.py#L100-L109 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/composite/base.py | python | HyperMap.__init__ | (self, ops=None, reverse=False) | Initialize HyperMap. | Initialize HyperMap. | [
"Initialize",
"HyperMap",
"."
] | def __init__(self, ops=None, reverse=False):
"""Initialize HyperMap."""
self.ops = ops
if ops:
HyperMap_.__init__(self, reverse, ops)
else:
HyperMap_.__init__(self, reverse) | [
"def",
"__init__",
"(",
"self",
",",
"ops",
"=",
"None",
",",
"reverse",
"=",
"False",
")",
":",
"self",
".",
"ops",
"=",
"ops",
"if",
"ops",
":",
"HyperMap_",
".",
"__init__",
"(",
"self",
",",
"reverse",
",",
"ops",
")",
"else",
":",
"HyperMap_",... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/composite/base.py#L653-L659 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/_csr_ops.py | python | CSRReduceSum.__init__ | (self) | Initialize CSRReduceSum | Initialize CSRReduceSum | [
"Initialize",
"CSRReduceSum"
] | def __init__(self):
"""Initialize CSRReduceSum"""
self.init_prim_io_names(inputs=['indptr', 'indices', 'values', 'dense_shape', 'axis'],
outputs=['output']) | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"init_prim_io_names",
"(",
"inputs",
"=",
"[",
"'indptr'",
",",
"'indices'",
",",
"'values'",
",",
"'dense_shape'",
",",
"'axis'",
"]",
",",
"outputs",
"=",
"[",
"'output'",
"]",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/_csr_ops.py#L57-L60 | ||
kristjankorjus/Replicating-DeepMind | 68539394e792b34a4d6b430a2eb73b8b8f91d8db | Hybrid/src/memory/memoryd.py | python | MemoryD.get_state | (self, index) | return state | Extract one state (4 images) given last image position
@param index: global location of the 4th image in the memory | Extract one state (4 images) given last image position | [
"Extract",
"one",
"state",
"(",
"4",
"images",
")",
"given",
"last",
"image",
"position"
] | def get_state(self, index):
"""
Extract one state (4 images) given last image position
@param index: global location of the 4th image in the memory
"""
#: We always need 4 images to compose one state. In the beginning of the
# game (at time moments 0, 1, 2) we do not ha... | [
"def",
"get_state",
"(",
"self",
",",
"index",
")",
":",
"#: We always need 4 images to compose one state. In the beginning of the",
"# game (at time moments 0, 1, 2) we do not have enough images in the memory",
"# for this particular game. So we came up with an ugly hack: duplicate the",
"#... | https://github.com/kristjankorjus/Replicating-DeepMind/blob/68539394e792b34a4d6b430a2eb73b8b8f91d8db/Hybrid/src/memory/memoryd.py#L99-L133 | |
wujixiu/helmet-detection | 8eff5c59ddfba5a29e0b76aeb48babcb49246178 | hardhat-wearing-detection/SSD-RPA/python/caffe/io.py | python | oversample | (images, crop_dims) | return crops | Crop images into the four corners, center, and their mirrored versions.
Parameters
----------
image : iterable of (H x W x K) ndarrays
crop_dims : (height, width) tuple for the crops.
Returns
-------
crops : (10*N x H x W x K) ndarray of crops for number of inputs N. | Crop images into the four corners, center, and their mirrored versions. | [
"Crop",
"images",
"into",
"the",
"four",
"corners",
"center",
"and",
"their",
"mirrored",
"versions",
"."
] | def oversample(images, crop_dims):
"""
Crop images into the four corners, center, and their mirrored versions.
Parameters
----------
image : iterable of (H x W x K) ndarrays
crop_dims : (height, width) tuple for the crops.
Returns
-------
crops : (10*N x H x W x K) ndarray of crops... | [
"def",
"oversample",
"(",
"images",
",",
"crop_dims",
")",
":",
"# Dimensions and center.",
"im_shape",
"=",
"np",
".",
"array",
"(",
"images",
"[",
"0",
"]",
".",
"shape",
")",
"crop_dims",
"=",
"np",
".",
"array",
"(",
"crop_dims",
")",
"im_center",
"=... | https://github.com/wujixiu/helmet-detection/blob/8eff5c59ddfba5a29e0b76aeb48babcb49246178/hardhat-wearing-detection/SSD-RPA/python/caffe/io.py#L341-L383 | |
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/conversion.py | python | IConversion.ChatMessageTypeToText | (self, Type) | return self._ToText('cme', Type) | Returns message type as text.
@param Type: Chat message type.
@type Type: L{Chat message type<enums.cmeUnknown>}
@return: Text describing the chat message type.
@rtype: unicode | Returns message type as text. | [
"Returns",
"message",
"type",
"as",
"text",
"."
] | def ChatMessageTypeToText(self, Type):
'''Returns message type as text.
@param Type: Chat message type.
@type Type: L{Chat message type<enums.cmeUnknown>}
@return: Text describing the chat message type.
@rtype: unicode
'''
return self._ToText('cme', Type) | [
"def",
"ChatMessageTypeToText",
"(",
"self",
",",
"Type",
")",
":",
"return",
"self",
".",
"_ToText",
"(",
"'cme'",
",",
"Type",
")"
] | https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/conversion.py#L138-L146 | |
indutny/candor | 48e7260618f5091c80a3416828e2808cad3ea22e | tools/gyp/pylib/gyp/generator/android.py | python | AndroidMkWriter.WriteSources | (self, spec, configs, extra_sources) | Write Makefile code for any 'sources' from the gyp input.
These are source files necessary to build the current target.
We need to handle shared_intermediate directory source files as
a special case by copying them to the intermediate directory and
treating them as a genereated sources. Otherwise the An... | Write Makefile code for any 'sources' from the gyp input.
These are source files necessary to build the current target.
We need to handle shared_intermediate directory source files as
a special case by copying them to the intermediate directory and
treating them as a genereated sources. Otherwise the An... | [
"Write",
"Makefile",
"code",
"for",
"any",
"sources",
"from",
"the",
"gyp",
"input",
".",
"These",
"are",
"source",
"files",
"necessary",
"to",
"build",
"the",
"current",
"target",
".",
"We",
"need",
"to",
"handle",
"shared_intermediate",
"directory",
"source"... | def WriteSources(self, spec, configs, extra_sources):
"""Write Makefile code for any 'sources' from the gyp input.
These are source files necessary to build the current target.
We need to handle shared_intermediate directory source files as
a special case by copying them to the intermediate directory an... | [
"def",
"WriteSources",
"(",
"self",
",",
"spec",
",",
"configs",
",",
"extra_sources",
")",
":",
"sources",
"=",
"filter",
"(",
"make",
".",
"Compilable",
",",
"spec",
".",
"get",
"(",
"'sources'",
",",
"[",
"]",
")",
")",
"generated_not_sources",
"=",
... | https://github.com/indutny/candor/blob/48e7260618f5091c80a3416828e2808cad3ea22e/tools/gyp/pylib/gyp/generator/android.py#L485-L568 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/fractions.py | python | Fraction.from_float | (cls, f) | return cls(*f.as_integer_ratio()) | Converts a finite float to a rational number, exactly.
Beware that Fraction.from_float(0.3) != Fraction(3, 10). | Converts a finite float to a rational number, exactly. | [
"Converts",
"a",
"finite",
"float",
"to",
"a",
"rational",
"number",
"exactly",
"."
] | def from_float(cls, f):
"""Converts a finite float to a rational number, exactly.
Beware that Fraction.from_float(0.3) != Fraction(3, 10).
"""
if isinstance(f, numbers.Integral):
return cls(f)
elif not isinstance(f, float):
raise TypeError("%s.from_float... | [
"def",
"from_float",
"(",
"cls",
",",
"f",
")",
":",
"if",
"isinstance",
"(",
"f",
",",
"numbers",
".",
"Integral",
")",
":",
"return",
"cls",
"(",
"f",
")",
"elif",
"not",
"isinstance",
"(",
"f",
",",
"float",
")",
":",
"raise",
"TypeError",
"(",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/fractions.py#L194-L205 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.