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/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pyparsing.py | python | unicode_set.alphanums | (cls) | return cls.alphas + cls.nums | all alphanumeric characters in this range | all alphanumeric characters in this range | [
"all",
"alphanumeric",
"characters",
"in",
"this",
"range"
] | def alphanums(cls):
"all alphanumeric characters in this range"
return cls.alphas + cls.nums | [
"def",
"alphanums",
"(",
"cls",
")",
":",
"return",
"cls",
".",
"alphas",
"+",
"cls",
".",
"nums"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pyparsing.py#L6758-L6760 | |
makefile/frcnn | 8d9b9ebf8be8315ba2f374d460121b0adf1df29c | scripts/cpp_lint.py | python | CheckCaffeRandom | (filename, clean_lines, linenum, error) | Checks for calls to C random functions (rand, rand_r, random, ...).
Caffe code should (almost) always use the caffe_rng_* functions rather
than these, as the internal state of these C functions is independent of the
native Caffe RNG system which should produce deterministic results for a
fixed Caffe seed set u... | Checks for calls to C random functions (rand, rand_r, random, ...). | [
"Checks",
"for",
"calls",
"to",
"C",
"random",
"functions",
"(",
"rand",
"rand_r",
"random",
"...",
")",
"."
] | def CheckCaffeRandom(filename, clean_lines, linenum, error):
"""Checks for calls to C random functions (rand, rand_r, random, ...).
Caffe code should (almost) always use the caffe_rng_* functions rather
than these, as the internal state of these C functions is independent of the
native Caffe RNG system which s... | [
"def",
"CheckCaffeRandom",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"for",
"function",
"in",
"c_random_function_list",
":",
"ix",
"=",
"line",
".",
"find",
... | https://github.com/makefile/frcnn/blob/8d9b9ebf8be8315ba2f374d460121b0adf1df29c/scripts/cpp_lint.py#L1640-L1663 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/dataview.py | python | DataViewModel.GetParent | (*args, **kwargs) | return _dataview.DataViewModel_GetParent(*args, **kwargs) | GetParent(self, DataViewItem item) -> DataViewItem
Override this to indicate which item is the parent of the given item.
If the item is a child of the (hidden) root, then simply return an
invalid item, (one constructed with no ID.) | GetParent(self, DataViewItem item) -> DataViewItem | [
"GetParent",
"(",
"self",
"DataViewItem",
"item",
")",
"-",
">",
"DataViewItem"
] | def GetParent(*args, **kwargs):
"""
GetParent(self, DataViewItem item) -> DataViewItem
Override this to indicate which item is the parent of the given item.
If the item is a child of the (hidden) root, then simply return an
invalid item, (one constructed with no ID.)
"""... | [
"def",
"GetParent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewModel_GetParent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/dataview.py#L514-L522 | |
lightvector/KataGo | 20d34784703c5b4000643d3ccc43bb37d418f3b5 | python/sgfmill/sgf_grammar.py | python | tokenise | (bb, start_position=0) | return result, i | Tokenise a string containing SGF data.
bb -- bytes-like object
start_position -- index into 'bb'
Skips leading junk.
Returns a list of pairs of strings (token type, contents), and also the
index in 'bb' of the start of the unprocessed 'tail'.
token types and contents:
I -- ... | Tokenise a string containing SGF data. | [
"Tokenise",
"a",
"string",
"containing",
"SGF",
"data",
"."
] | def tokenise(bb, start_position=0):
"""Tokenise a string containing SGF data.
bb -- bytes-like object
start_position -- index into 'bb'
Skips leading junk.
Returns a list of pairs of strings (token type, contents), and also the
index in 'bb' of the start of the unprocessed 'tail'.... | [
"def",
"tokenise",
"(",
"bb",
",",
"start_position",
"=",
"0",
")",
":",
"result",
"=",
"[",
"]",
"m",
"=",
"_find_start_re",
".",
"search",
"(",
"bb",
",",
"start_position",
")",
"if",
"not",
"m",
":",
"return",
"[",
"]",
",",
"0",
"i",
"=",
"m"... | https://github.com/lightvector/KataGo/blob/20d34784703c5b4000643d3ccc43bb37d418f3b5/python/sgfmill/sgf_grammar.py#L69-L113 | |
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/esptool/serial/rfc2217.py | python | Serial._update_break_state | (self) | \
Set break: Controls TXD. When active, to transmitting is
possible. | \
Set break: Controls TXD. When active, to transmitting is
possible. | [
"\\",
"Set",
"break",
":",
"Controls",
"TXD",
".",
"When",
"active",
"to",
"transmitting",
"is",
"possible",
"."
] | def _update_break_state(self):
"""\
Set break: Controls TXD. When active, to transmitting is
possible.
"""
if not self.is_open:
raise portNotOpenError
if self.logger:
self.logger.info('set BREAK to {}'.format('active' if self._break_state else 'ina... | [
"def",
"_update_break_state",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_open",
":",
"raise",
"portNotOpenError",
"if",
"self",
".",
"logger",
":",
"self",
".",
"logger",
".",
"info",
"(",
"'set BREAK to {}'",
".",
"format",
"(",
"'active'",
"if"... | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/esptool/serial/rfc2217.py#L656-L668 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/gettext.py | python | c2py | (plural) | Gets a C expression as used in PO files for plural forms and returns a
Python function that implements an equivalent expression. | Gets a C expression as used in PO files for plural forms and returns a
Python function that implements an equivalent expression. | [
"Gets",
"a",
"C",
"expression",
"as",
"used",
"in",
"PO",
"files",
"for",
"plural",
"forms",
"and",
"returns",
"a",
"Python",
"function",
"that",
"implements",
"an",
"equivalent",
"expression",
"."
] | def c2py(plural):
"""Gets a C expression as used in PO files for plural forms and returns a
Python function that implements an equivalent expression.
"""
if len(plural) > 1000:
raise ValueError('plural form expression is too long')
try:
result, nexttok = _parse(_tokenize(plural))
... | [
"def",
"c2py",
"(",
"plural",
")",
":",
"if",
"len",
"(",
"plural",
")",
">",
"1000",
":",
"raise",
"ValueError",
"(",
"'plural form expression is too long'",
")",
"try",
":",
"result",
",",
"nexttok",
"=",
"_parse",
"(",
"_tokenize",
"(",
"plural",
")",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/gettext.py#L175-L208 | ||
Xilinx/Vitis_Libraries | 4bd100518d93a8842d1678046ad7457f94eb355c | hpc/L3/src/sw/mlp/python_api/xfhpc_L3.py | python | XFHPCManager.destroy | (self, numKernel, idxDevice) | return self._lib.xfhpcDestroy(numKernel, idxDevice) | release handle used by the XFHPC library
Parameters
numKernel
number of CUs in the xclbin
idxDeivce
index of local device to be used | release handle used by the XFHPC library | [
"release",
"handle",
"used",
"by",
"the",
"XFHPC",
"library"
] | def destroy(self, numKernel, idxDevice):
'''
release handle used by the XFHPC library
Parameters
numKernel
number of CUs in the xclbin
idxDeivce
index of local device to be used
'''
return self._lib.xfhpcDestroy(numKernel,... | [
"def",
"destroy",
"(",
"self",
",",
"numKernel",
",",
"idxDevice",
")",
":",
"return",
"self",
".",
"_lib",
".",
"xfhpcDestroy",
"(",
"numKernel",
",",
"idxDevice",
")"
] | https://github.com/Xilinx/Vitis_Libraries/blob/4bd100518d93a8842d1678046ad7457f94eb355c/hpc/L3/src/sw/mlp/python_api/xfhpc_L3.py#L156-L167 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/grid.py | python | Grid.SetCellTextColour | (*args, **kwargs) | return _grid.Grid_SetCellTextColour(*args, **kwargs) | SetCellTextColour(self, int row, int col, Colour ?) | SetCellTextColour(self, int row, int col, Colour ?) | [
"SetCellTextColour",
"(",
"self",
"int",
"row",
"int",
"col",
"Colour",
"?",
")"
] | def SetCellTextColour(*args, **kwargs):
"""SetCellTextColour(self, int row, int col, Colour ?)"""
return _grid.Grid_SetCellTextColour(*args, **kwargs) | [
"def",
"SetCellTextColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"Grid_SetCellTextColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/grid.py#L1946-L1948 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/learn/python/learn/estimators/estimator.py | python | _make_metrics_ops | (metrics, features, labels, predictions) | return result | Add metrics based on `features`, `labels`, and `predictions`.
`metrics` contains a specification for how to run metrics. It is a dict
mapping friendly names to either `MetricSpec` objects, or directly to a metric
function (assuming that `predictions` and `labels` are single tensors), or to
`(pred_name, metric)... | Add metrics based on `features`, `labels`, and `predictions`. | [
"Add",
"metrics",
"based",
"on",
"features",
"labels",
"and",
"predictions",
"."
] | def _make_metrics_ops(metrics, features, labels, predictions):
"""Add metrics based on `features`, `labels`, and `predictions`.
`metrics` contains a specification for how to run metrics. It is a dict
mapping friendly names to either `MetricSpec` objects, or directly to a metric
function (assuming that `predict... | [
"def",
"_make_metrics_ops",
"(",
"metrics",
",",
"features",
",",
"labels",
",",
"predictions",
")",
":",
"metrics",
"=",
"metrics",
"or",
"{",
"}",
"# If labels is a dict with a single key, unpack into a single tensor.",
"labels_tensor_or_dict",
"=",
"labels",
"if",
"i... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/learn/python/learn/estimators/estimator.py#L230-L304 | |
MicBosi/VisualizationLibrary | d2a0e321288152008957e29a0bc270ad192f75be | src/external/freetype/src/tools/docmaker/utils.py | python | file_exists | ( pathname ) | return result | checks that a given file exists | checks that a given file exists | [
"checks",
"that",
"a",
"given",
"file",
"exists"
] | def file_exists( pathname ):
"""checks that a given file exists"""
result = 1
try:
file = open( pathname, "r" )
file.close()
except:
result = None
sys.stderr.write( pathname + " couldn't be accessed\n" )
return result | [
"def",
"file_exists",
"(",
"pathname",
")",
":",
"result",
"=",
"1",
"try",
":",
"file",
"=",
"open",
"(",
"pathname",
",",
"\"r\"",
")",
"file",
".",
"close",
"(",
")",
"except",
":",
"result",
"=",
"None",
"sys",
".",
"stderr",
".",
"write",
"(",... | https://github.com/MicBosi/VisualizationLibrary/blob/d2a0e321288152008957e29a0bc270ad192f75be/src/external/freetype/src/tools/docmaker/utils.py#L93-L103 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/internal/util/binary_manager.py | python | LocalPath | (binary_name, arch, os_name, os_version=None) | return _binary_manager.LocalPath(binary_name, os_name, arch, os_version) | Return a local path to the given binary name, or None if an executable
cannot be found. Will not download the executable. | Return a local path to the given binary name, or None if an executable
cannot be found. Will not download the executable. | [
"Return",
"a",
"local",
"path",
"to",
"the",
"given",
"binary",
"name",
"or",
"None",
"if",
"an",
"executable",
"cannot",
"be",
"found",
".",
"Will",
"not",
"download",
"the",
"executable",
"."
] | def LocalPath(binary_name, arch, os_name, os_version=None):
""" Return a local path to the given binary name, or None if an executable
cannot be found. Will not download the executable.
"""
if _binary_manager is None:
raise exceptions.InitializationError(
'Called LocalPath with uninitialized... | [
"def",
"LocalPath",
"(",
"binary_name",
",",
"arch",
",",
"os_name",
",",
"os_version",
"=",
"None",
")",
":",
"if",
"_binary_manager",
"is",
"None",
":",
"raise",
"exceptions",
".",
"InitializationError",
"(",
"'Called LocalPath with uninitialized binary manager.'",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/internal/util/binary_manager.py#L66-L73 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/server/wsgi/serve/publish/publish_manager_helper.py | python | PublishManagerHelper._QueryTargetIdByPath | (self, target_path) | return target_id | Queries target point ID by its path.
Note: query is case-sensitive since we keep target path in database as user
have entered it.
Args:
target_path: target point path.
Raises:
psycopg2.Error/Warning.
Returns:
ID of target point in case of it exists otherwise -1. | Queries target point ID by its path. | [
"Queries",
"target",
"point",
"ID",
"by",
"its",
"path",
"."
] | def _QueryTargetIdByPath(self, target_path):
"""Queries target point ID by its path.
Note: query is case-sensitive since we keep target path in database as user
have entered it.
Args:
target_path: target point path.
Raises:
psycopg2.Error/Warning.
Returns:
ID of target point ... | [
"def",
"_QueryTargetIdByPath",
"(",
"self",
",",
"target_path",
")",
":",
"query_string",
"=",
"\"SELECT target_id FROM target_table WHERE target_path = %s\"",
"result",
"=",
"self",
".",
"DbQuery",
"(",
"query_string",
",",
"(",
"target_path",
",",
")",
")",
"target_... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/server/wsgi/serve/publish/publish_manager_helper.py#L995-L1014 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/signal/filter_design.py | python | iirdesign | (wp, ws, gpass, gstop, analog=False, ftype='ellip', output='ba') | return iirfilter(N, Wn, rp=gpass, rs=gstop, analog=analog, btype=btype,
ftype=ftype, output=output) | Complete IIR digital and analog filter design.
Given passband and stopband frequencies and gains, construct an analog or
digital IIR filter of minimum order for a given basic type. Return the
output in numerator, denominator ('ba'), pole-zero ('zpk') or second order
sections ('sos') form.
Paramet... | Complete IIR digital and analog filter design. | [
"Complete",
"IIR",
"digital",
"and",
"analog",
"filter",
"design",
"."
] | def iirdesign(wp, ws, gpass, gstop, analog=False, ftype='ellip', output='ba'):
"""Complete IIR digital and analog filter design.
Given passband and stopband frequencies and gains, construct an analog or
digital IIR filter of minimum order for a given basic type. Return the
output in numerator, denomin... | [
"def",
"iirdesign",
"(",
"wp",
",",
"ws",
",",
"gpass",
",",
"gstop",
",",
"analog",
"=",
"False",
",",
"ftype",
"=",
"'ellip'",
",",
"output",
"=",
"'ba'",
")",
":",
"try",
":",
"ordfunc",
"=",
"filter_dict",
"[",
"ftype",
"]",
"[",
"1",
"]",
"e... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/signal/filter_design.py#L1454-L1541 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/pydoc.py | python | classname | (object, modname) | return name | Get a class name and qualify it with a module name if necessary. | Get a class name and qualify it with a module name if necessary. | [
"Get",
"a",
"class",
"name",
"and",
"qualify",
"it",
"with",
"a",
"module",
"name",
"if",
"necessary",
"."
] | def classname(object, modname):
"""Get a class name and qualify it with a module name if necessary."""
name = object.__name__
if object.__module__ != modname:
name = object.__module__ + '.' + name
return name | [
"def",
"classname",
"(",
"object",
",",
"modname",
")",
":",
"name",
"=",
"object",
".",
"__name__",
"if",
"object",
".",
"__module__",
"!=",
"modname",
":",
"name",
"=",
"object",
".",
"__module__",
"+",
"'.'",
"+",
"name",
"return",
"name"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/pydoc.py#L95-L100 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/device_setter.py | python | replica_device_setter | (ps_tasks=0,
ps_device="/job:ps",
worker_device="/job:worker",
merge_devices=True,
cluster=None,
ps_ops=None,
ps_strategy=None) | return chooser.device_function | Return a `device function` to use when building a Graph for replicas.
Device Functions are used in `with tf.device(device_function):` statement to
automatically assign devices to `Operation` objects as they are constructed,
Device constraints are added from the inner-most context first, working
outwards. The m... | Return a `device function` to use when building a Graph for replicas. | [
"Return",
"a",
"device",
"function",
"to",
"use",
"when",
"building",
"a",
"Graph",
"for",
"replicas",
"."
] | def replica_device_setter(ps_tasks=0,
ps_device="/job:ps",
worker_device="/job:worker",
merge_devices=True,
cluster=None,
ps_ops=None,
ps_strategy=None):
"""Retur... | [
"def",
"replica_device_setter",
"(",
"ps_tasks",
"=",
"0",
",",
"ps_device",
"=",
"\"/job:ps\"",
",",
"worker_device",
"=",
"\"/job:worker\"",
",",
"merge_devices",
"=",
"True",
",",
"cluster",
"=",
"None",
",",
"ps_ops",
"=",
"None",
",",
"ps_strategy",
"=",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/device_setter.py#L136-L230 | |
mingchen/protobuf-ios | 0958df34558cd54cb7b6e6ca5c8855bf3d475046 | compiler/python/mox.py | python | MoxMetaTestBase.CleanUpTest | (cls, func) | return new_method | Adds Mox cleanup code to any MoxTestBase method.
Always unsets stubs after a test. Will verify all mocks for tests that
otherwise pass.
Args:
cls: MoxTestBase or subclass; the class whose test method we are altering.
func: method; the method of the MoxTestBase test class we wish to alter.
... | Adds Mox cleanup code to any MoxTestBase method. | [
"Adds",
"Mox",
"cleanup",
"code",
"to",
"any",
"MoxTestBase",
"method",
"."
] | def CleanUpTest(cls, func):
"""Adds Mox cleanup code to any MoxTestBase method.
Always unsets stubs after a test. Will verify all mocks for tests that
otherwise pass.
Args:
cls: MoxTestBase or subclass; the class whose test method we are altering.
func: method; the method of the MoxTestBas... | [
"def",
"CleanUpTest",
"(",
"cls",
",",
"func",
")",
":",
"def",
"new_method",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"mox_obj",
"=",
"getattr",
"(",
"self",
",",
"'mox'",
",",
"None",
")",
"cleanup_mox",
"=",
"False",
"if... | https://github.com/mingchen/protobuf-ios/blob/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/python/mox.py#L1358-L1386 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/io/sql.py | python | _engine_builder | (con) | return con | Returns a SQLAlchemy engine from a URI (if con is a string)
else it just return con without modifying it. | Returns a SQLAlchemy engine from a URI (if con is a string)
else it just return con without modifying it. | [
"Returns",
"a",
"SQLAlchemy",
"engine",
"from",
"a",
"URI",
"(",
"if",
"con",
"is",
"a",
"string",
")",
"else",
"it",
"just",
"return",
"con",
"without",
"modifying",
"it",
"."
] | def _engine_builder(con):
"""
Returns a SQLAlchemy engine from a URI (if con is a string)
else it just return con without modifying it.
"""
global _SQLALCHEMY_INSTALLED
if isinstance(con, string_types):
try:
import sqlalchemy
except ImportError:
_SQLALCHEM... | [
"def",
"_engine_builder",
"(",
"con",
")",
":",
"global",
"_SQLALCHEMY_INSTALLED",
"if",
"isinstance",
"(",
"con",
",",
"string_types",
")",
":",
"try",
":",
"import",
"sqlalchemy",
"except",
"ImportError",
":",
"_SQLALCHEMY_INSTALLED",
"=",
"False",
"else",
":"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/io/sql.py#L490-L505 | |
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | bindings/python/cntk/internal/sanitize.py | python | sanitize_range | (x) | Convert ``x`` to a tuple such as the first element is less than or equal to the
second element.
Args:
x: a scalar number or a tuple of length 2 that contains the range values.
Returns:
A tuple of length two where the first element is less than or equal to the
second element. | Convert ``x`` to a tuple such as the first element is less than or equal to the
second element. | [
"Convert",
"x",
"to",
"a",
"tuple",
"such",
"as",
"the",
"first",
"element",
"is",
"less",
"than",
"or",
"equal",
"to",
"the",
"second",
"element",
"."
] | def sanitize_range(x):
'''
Convert ``x`` to a tuple such as the first element is less than or equal to the
second element.
Args:
x: a scalar number or a tuple of length 2 that contains the range values.
Returns:
A tuple of length two where the first element is less than or equal to... | [
"def",
"sanitize_range",
"(",
"x",
")",
":",
"x",
"=",
"sanitize_2d_number",
"(",
"x",
")",
"if",
"x",
"[",
"0",
"]",
"<=",
"x",
"[",
"1",
"]",
":",
"return",
"x",
"raise",
"ValueError",
"(",
"'Input argument must be a number or a tuple of two numbers such as ... | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/internal/sanitize.py#L148-L164 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py | python | OrderedDict.keys | (self) | return list(self) | od.keys() -> list of keys in od | od.keys() -> list of keys in od | [
"od",
".",
"keys",
"()",
"-",
">",
"list",
"of",
"keys",
"in",
"od"
] | def keys(self):
'od.keys() -> list of keys in od'
return list(self) | [
"def",
"keys",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
")"
] | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py#L143-L145 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/contributed/sumopy/coremodules/misc/shapefile.py | python | Reader.shapes | (self) | return shapes | Returns all shapes in a shapefile. | Returns all shapes in a shapefile. | [
"Returns",
"all",
"shapes",
"in",
"a",
"shapefile",
"."
] | def shapes(self):
"""Returns all shapes in a shapefile."""
shp = self.__getFileObj(self.shp)
shp.seek(100)
shapes = []
while shp.tell() < self.shpLength:
shapes.append(self.__shape())
return shapes | [
"def",
"shapes",
"(",
"self",
")",
":",
"shp",
"=",
"self",
".",
"__getFileObj",
"(",
"self",
".",
"shp",
")",
"shp",
".",
"seek",
"(",
"100",
")",
"shapes",
"=",
"[",
"]",
"while",
"shp",
".",
"tell",
"(",
")",
"<",
"self",
".",
"shpLength",
"... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/coremodules/misc/shapefile.py#L335-L342 | |
xenia-project/xenia | 9b1fdac98665ac091b9660a5d0fbb259ed79e578 | third_party/google-styleguide/cpplint/cpplint.py | python | _SetFilters | (filters) | Sets the module's error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "whitespace/indent").
Each filter should start with + or -; else we die. | Sets the module's error-message filters. | [
"Sets",
"the",
"module",
"s",
"error",
"-",
"message",
"filters",
"."
] | def _SetFilters(filters):
"""Sets the module's error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "whitespace/indent").
Each filter should start with + or -; else we die.
"""
_cpplint... | [
"def",
"_SetFilters",
"(",
"filters",
")",
":",
"_cpplint_state",
".",
"SetFilters",
"(",
"filters",
")"
] | https://github.com/xenia-project/xenia/blob/9b1fdac98665ac091b9660a5d0fbb259ed79e578/third_party/google-styleguide/cpplint/cpplint.py#L787-L797 | ||
PaddlePaddle/PaddleOCR | b756bf5f8c90142e0d89d3db0163965c686b6ffe | ppocr/data/imaug/pg_process.py | python | PGProcessTrain.gen_min_area_quad_from_poly | (self, poly) | return min_area_quad, center_point | Generate min area quad from poly. | Generate min area quad from poly. | [
"Generate",
"min",
"area",
"quad",
"from",
"poly",
"."
] | def gen_min_area_quad_from_poly(self, poly):
"""
Generate min area quad from poly.
"""
point_num = poly.shape[0]
min_area_quad = np.zeros((4, 2), dtype=np.float32)
if point_num == 4:
min_area_quad = poly
center_point = np.sum(poly, axis=0) / 4
... | [
"def",
"gen_min_area_quad_from_poly",
"(",
"self",
",",
"poly",
")",
":",
"point_num",
"=",
"poly",
".",
"shape",
"[",
"0",
"]",
"min_area_quad",
"=",
"np",
".",
"zeros",
"(",
"(",
"4",
",",
"2",
")",
",",
"dtype",
"=",
"np",
".",
"float32",
")",
"... | https://github.com/PaddlePaddle/PaddleOCR/blob/b756bf5f8c90142e0d89d3db0163965c686b6ffe/ppocr/data/imaug/pg_process.py#L486-L515 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | build/android/valgrind_tools.py | python | TSanTool.GetFilesForTool | (self) | return ['tools/valgrind/android/vg-chrome-wrapper-tsan.sh',
'tools/valgrind/tsan/suppressions.txt',
'tools/valgrind/tsan/suppressions_android.txt',
'tools/valgrind/tsan/ignores.txt'] | Returns a list of file names for the tool. | Returns a list of file names for the tool. | [
"Returns",
"a",
"list",
"of",
"file",
"names",
"for",
"the",
"tool",
"."
] | def GetFilesForTool(self):
"""Returns a list of file names for the tool."""
return ['tools/valgrind/android/vg-chrome-wrapper-tsan.sh',
'tools/valgrind/tsan/suppressions.txt',
'tools/valgrind/tsan/suppressions_android.txt',
'tools/valgrind/tsan/ignores.txt'] | [
"def",
"GetFilesForTool",
"(",
"self",
")",
":",
"return",
"[",
"'tools/valgrind/android/vg-chrome-wrapper-tsan.sh'",
",",
"'tools/valgrind/tsan/suppressions.txt'",
",",
"'tools/valgrind/tsan/suppressions_android.txt'",
",",
"'tools/valgrind/tsan/ignores.txt'",
"]"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/build/android/valgrind_tools.py#L145-L150 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBProcess.GetDescription | (self, *args) | return _lldb.SBProcess_GetDescription(self, *args) | GetDescription(self, SBStream description) -> bool | GetDescription(self, SBStream description) -> bool | [
"GetDescription",
"(",
"self",
"SBStream",
"description",
")",
"-",
">",
"bool"
] | def GetDescription(self, *args):
"""GetDescription(self, SBStream description) -> bool"""
return _lldb.SBProcess_GetDescription(self, *args) | [
"def",
"GetDescription",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_lldb",
".",
"SBProcess_GetDescription",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L7304-L7306 | |
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/physics/SIP/models.py | python | ColeColeComplexSigma.response | (self, par) | return pg.cat(np.real(spec), np.imag(spec)) | phase angle of the model | phase angle of the model | [
"phase",
"angle",
"of",
"the",
"model"
] | def response(self, par):
"""phase angle of the model"""
spec = modelColeColeSigma(self.f_, *par)
return pg.cat(np.real(spec), np.imag(spec)) | [
"def",
"response",
"(",
"self",
",",
"par",
")",
":",
"spec",
"=",
"modelColeColeSigma",
"(",
"self",
".",
"f_",
",",
"*",
"par",
")",
"return",
"pg",
".",
"cat",
"(",
"np",
".",
"real",
"(",
"spec",
")",
",",
"np",
".",
"imag",
"(",
"spec",
")... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/physics/SIP/models.py#L288-L291 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ma/mrecords.py | python | MaskedRecords.__setattr__ | (self, attr, val) | return obj | Sets the attribute attr to the value val. | Sets the attribute attr to the value val. | [
"Sets",
"the",
"attribute",
"attr",
"to",
"the",
"value",
"val",
"."
] | def __setattr__(self, attr, val):
"""
Sets the attribute attr to the value val.
"""
# Should we call __setmask__ first ?
if attr in ['mask', 'fieldmask']:
self.__setmask__(val)
return
# Create a shortcut (so that we don't have to call getattr all ... | [
"def",
"__setattr__",
"(",
"self",
",",
"attr",
",",
"val",
")",
":",
"# Should we call __setmask__ first ?",
"if",
"attr",
"in",
"[",
"'mask'",
",",
"'fieldmask'",
"]",
":",
"self",
".",
"__setmask__",
"(",
"val",
")",
"return",
"# Create a shortcut (so that we... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ma/mrecords.py#L242-L295 | |
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/core/_base_index.py | python | BaseIndex.dropna | (self, how="any") | return self._from_columns_like_self(
drop_nulls(data_columns, how=how, keys=range(len(data_columns)),),
self._column_names,
) | Drop null rows from Index.
how : {"any", "all"}, default "any"
Specifies how to decide whether to drop a row.
"any" (default) drops rows containing at least
one null value. "all" drops only rows containing
*all* null values. | Drop null rows from Index. | [
"Drop",
"null",
"rows",
"from",
"Index",
"."
] | def dropna(self, how="any"):
"""
Drop null rows from Index.
how : {"any", "all"}, default "any"
Specifies how to decide whether to drop a row.
"any" (default) drops rows containing at least
one null value. "all" drops only rows containing
*all* nu... | [
"def",
"dropna",
"(",
"self",
",",
"how",
"=",
"\"any\"",
")",
":",
"# This is to be consistent with IndexedFrame.dropna to handle nans",
"# as nulls by default",
"data_columns",
"=",
"[",
"col",
".",
"nans_to_nulls",
"(",
")",
"if",
"isinstance",
"(",
"col",
",",
"... | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/_base_index.py#L1420-L1443 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/numpy/multiarray.py | python | fmod | (x1, x2, out=None, **kwargs) | return _mx_nd_np.fmod(x1, x2, out=out) | Return element-wise remainder of division.
Parameters
----------
x1 : ndarray or scalar
Dividend array.
x2 : ndarray or scalar
Divisor array.
out : ndarray
A location into which the result is stored. If provided, it must have a shape
that the inputs broadcast to. I... | Return element-wise remainder of division. | [
"Return",
"element",
"-",
"wise",
"remainder",
"of",
"division",
"."
] | def fmod(x1, x2, out=None, **kwargs):
"""
Return element-wise remainder of division.
Parameters
----------
x1 : ndarray or scalar
Dividend array.
x2 : ndarray or scalar
Divisor array.
out : ndarray
A location into which the result is stored. If provided, it must ha... | [
"def",
"fmod",
"(",
"x1",
",",
"x2",
",",
"out",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_mx_nd_np",
".",
"fmod",
"(",
"x1",
",",
"x2",
",",
"out",
"=",
"out",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/numpy/multiarray.py#L3687-L3714 | |
physercoe/starquant | c00cad64d1de2da05081b3dc320ef264c6295e08 | cppsrc/fmt-5.3.0/support/docopt.py | python | parse_atom | (tokens, options) | atom ::= '(' expr ')' | '[' expr ']' | 'options'
| long | shorts | argument | command ; | atom ::= '(' expr ')' | '[' expr ']' | 'options'
| long | shorts | argument | command ; | [
"atom",
"::",
"=",
"(",
"expr",
")",
"|",
"[",
"expr",
"]",
"|",
"options",
"|",
"long",
"|",
"shorts",
"|",
"argument",
"|",
"command",
";"
] | def parse_atom(tokens, options):
"""atom ::= '(' expr ')' | '[' expr ']' | 'options'
| long | shorts | argument | command ;
"""
token = tokens.current()
result = []
if token in '([':
tokens.move()
matching, pattern = {'(': [')', Required], '[': [']', Optional]}[token]
... | [
"def",
"parse_atom",
"(",
"tokens",
",",
"options",
")",
":",
"token",
"=",
"tokens",
".",
"current",
"(",
")",
"result",
"=",
"[",
"]",
"if",
"token",
"in",
"'(['",
":",
"tokens",
".",
"move",
"(",
")",
"matching",
",",
"pattern",
"=",
"{",
"'('",... | https://github.com/physercoe/starquant/blob/c00cad64d1de2da05081b3dc320ef264c6295e08/cppsrc/fmt-5.3.0/support/docopt.py#L402-L425 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/requests/requests/packages/urllib3/util/timeout.py | python | current_time | () | return time.time() | Retrieve the current time. This function is mocked out in unit testing. | Retrieve the current time. This function is mocked out in unit testing. | [
"Retrieve",
"the",
"current",
"time",
".",
"This",
"function",
"is",
"mocked",
"out",
"in",
"unit",
"testing",
"."
] | def current_time():
"""
Retrieve the current time. This function is mocked out in unit testing.
"""
return time.time() | [
"def",
"current_time",
"(",
")",
":",
"return",
"time",
".",
"time",
"(",
")"
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/requests/requests/packages/urllib3/util/timeout.py#L12-L16 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/PartDesign/InvoluteGearFeature.py | python | _InvoluteGearTaskPanel.update | (self) | fills the widgets | fills the widgets | [
"fills",
"the",
"widgets"
] | def update(self):
'fills the widgets'
self.transferFrom() | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"transferFrom",
"(",
")"
] | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/PartDesign/InvoluteGearFeature.py#L238-L240 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | tools/linter/mypy_wrapper.py | python | config_files | () | return {str(ini): read_config(ini) for ini in Path().glob('mypy*.ini')} | Return a dict from all our `mypy` ini filenames to their `files`. | Return a dict from all our `mypy` ini filenames to their `files`. | [
"Return",
"a",
"dict",
"from",
"all",
"our",
"mypy",
"ini",
"filenames",
"to",
"their",
"files",
"."
] | def config_files() -> Dict[str, Set[str]]:
"""
Return a dict from all our `mypy` ini filenames to their `files`.
"""
return {str(ini): read_config(ini) for ini in Path().glob('mypy*.ini')} | [
"def",
"config_files",
"(",
")",
"->",
"Dict",
"[",
"str",
",",
"Set",
"[",
"str",
"]",
"]",
":",
"return",
"{",
"str",
"(",
"ini",
")",
":",
"read_config",
"(",
"ini",
")",
"for",
"ini",
"in",
"Path",
"(",
")",
".",
"glob",
"(",
"'mypy*.ini'",
... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/tools/linter/mypy_wrapper.py#L49-L53 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/array_ops.py | python | Split.__init__ | (self, axis=0, output_num=1) | Initialize Split | Initialize Split | [
"Initialize",
"Split"
] | def __init__(self, axis=0, output_num=1):
"""Initialize Split"""
validator.check_value_type("axis", axis, [int], self.name)
validator.check_value_type("output_num", output_num, [int], self.name)
validator.check_positive_int(output_num, "output_num", self.name)
self.axis = axis
... | [
"def",
"__init__",
"(",
"self",
",",
"axis",
"=",
"0",
",",
"output_num",
"=",
"1",
")",
":",
"validator",
".",
"check_value_type",
"(",
"\"axis\"",
",",
"axis",
",",
"[",
"int",
"]",
",",
"self",
".",
"name",
")",
"validator",
".",
"check_value_type",... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/array_ops.py#L1117-L1123 | ||
google/filament | d21f092645b8e1e312307cbf89f1484891347c63 | third_party/spirv-tools/utils/generate_grammar_tables.py | python | generate_extension_enum | (extensions) | return ',\n'.join(['k' + extension for extension in extensions]) | Returns enumeration containing extensions declared in the grammar. | Returns enumeration containing extensions declared in the grammar. | [
"Returns",
"enumeration",
"containing",
"extensions",
"declared",
"in",
"the",
"grammar",
"."
] | def generate_extension_enum(extensions):
"""Returns enumeration containing extensions declared in the grammar."""
return ',\n'.join(['k' + extension for extension in extensions]) | [
"def",
"generate_extension_enum",
"(",
"extensions",
")",
":",
"return",
"',\\n'",
".",
"join",
"(",
"[",
"'k'",
"+",
"extension",
"for",
"extension",
"in",
"extensions",
"]",
")"
] | https://github.com/google/filament/blob/d21f092645b8e1e312307cbf89f1484891347c63/third_party/spirv-tools/utils/generate_grammar_tables.py#L591-L593 | |
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/sfm/OpenSfM/opensfm/io.py | python | reconstructions_from_json | (obj) | return [reconstruction_from_json(i) for i in obj] | Read all reconstructions from a json object | Read all reconstructions from a json object | [
"Read",
"all",
"reconstructions",
"from",
"a",
"json",
"object"
] | def reconstructions_from_json(obj):
"""
Read all reconstructions from a json object
"""
return [reconstruction_from_json(i) for i in obj] | [
"def",
"reconstructions_from_json",
"(",
"obj",
")",
":",
"return",
"[",
"reconstruction_from_json",
"(",
"i",
")",
"for",
"i",
"in",
"obj",
"]"
] | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/sfm/OpenSfM/opensfm/io.py#L182-L186 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/fileinput.py | python | nextfile | () | return _state.nextfile() | Close the current file so that the next iteration will read the first
line from the next file (if any); lines not read from the file will
not count towards the cumulative line count. The filename is not
changed until after the first line of the next file has been read.
Before the first line has been rea... | Close the current file so that the next iteration will read the first
line from the next file (if any); lines not read from the file will
not count towards the cumulative line count. The filename is not
changed until after the first line of the next file has been read.
Before the first line has been rea... | [
"Close",
"the",
"current",
"file",
"so",
"that",
"the",
"next",
"iteration",
"will",
"read",
"the",
"first",
"line",
"from",
"the",
"next",
"file",
"(",
"if",
"any",
")",
";",
"lines",
"not",
"read",
"from",
"the",
"file",
"will",
"not",
"count",
"towa... | def nextfile():
"""
Close the current file so that the next iteration will read the first
line from the next file (if any); lines not read from the file will
not count towards the cumulative line count. The filename is not
changed until after the first line of the next file has been read.
Before... | [
"def",
"nextfile",
"(",
")",
":",
"if",
"not",
"_state",
":",
"raise",
"RuntimeError",
",",
"\"no active input()\"",
"return",
"_state",
".",
"nextfile",
"(",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/fileinput.py#L114-L126 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/lmbrwaflib/lumberyard.py | python | get_enabled_capabilities | (ctx) | return parsed_capabilities | Get the capabilities that were set through setup assistant
:param ctx: Context
:return: List of capabilities that were set by the setup assistant | Get the capabilities that were set through setup assistant
:param ctx: Context
:return: List of capabilities that were set by the setup assistant | [
"Get",
"the",
"capabilities",
"that",
"were",
"set",
"through",
"setup",
"assistant",
":",
"param",
"ctx",
":",
"Context",
":",
"return",
":",
"List",
"of",
"capabilities",
"that",
"were",
"set",
"by",
"the",
"setup",
"assistant"
] | def get_enabled_capabilities(ctx):
"""
Get the capabilities that were set through setup assistant
:param ctx: Context
:return: List of capabilities that were set by the setup assistant
"""
try:
return ctx.parsed_capabilities
except AttributeError:
pass
raw_capability_st... | [
"def",
"get_enabled_capabilities",
"(",
"ctx",
")",
":",
"try",
":",
"return",
"ctx",
".",
"parsed_capabilities",
"except",
"AttributeError",
":",
"pass",
"raw_capability_string",
"=",
"getattr",
"(",
"ctx",
".",
"options",
",",
"'bootstrap_tool_param'",
",",
"Non... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/lmbrwaflib/lumberyard.py#L618-L693 | |
Genius-x/genius-x | 9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0 | cocos2d/tools/bindings-generator/clang/cindex.py | python | Token.kind | (self) | return TokenKind.from_value(conf.lib.clang_getTokenKind(self)) | Obtain the TokenKind of the current token. | Obtain the TokenKind of the current token. | [
"Obtain",
"the",
"TokenKind",
"of",
"the",
"current",
"token",
"."
] | def kind(self):
"""Obtain the TokenKind of the current token."""
return TokenKind.from_value(conf.lib.clang_getTokenKind(self)) | [
"def",
"kind",
"(",
"self",
")",
":",
"return",
"TokenKind",
".",
"from_value",
"(",
"conf",
".",
"lib",
".",
"clang_getTokenKind",
"(",
"self",
")",
")"
] | https://github.com/Genius-x/genius-x/blob/9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0/cocos2d/tools/bindings-generator/clang/cindex.py#L2672-L2674 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/build/upload.py | python | GetRemotePath | (path, local_file, base_path) | return path + dir | Given a remote path to upload to, a full path to a local file, and an
optional full path that is a base path of the local file, construct the
full remote path to place the file in. If base_path is not None, include
the relative path from base_path to file. | Given a remote path to upload to, a full path to a local file, and an
optional full path that is a base path of the local file, construct the
full remote path to place the file in. If base_path is not None, include
the relative path from base_path to file. | [
"Given",
"a",
"remote",
"path",
"to",
"upload",
"to",
"a",
"full",
"path",
"to",
"a",
"local",
"file",
"and",
"an",
"optional",
"full",
"path",
"that",
"is",
"a",
"base",
"path",
"of",
"the",
"local",
"file",
"construct",
"the",
"full",
"remote",
"path... | def GetRemotePath(path, local_file, base_path):
"""Given a remote path to upload to, a full path to a local file, and an
optional full path that is a base path of the local file, construct the
full remote path to place the file in. If base_path is not None, include
the relative path from base_path to fi... | [
"def",
"GetRemotePath",
"(",
"path",
",",
"local_file",
",",
"base_path",
")",
":",
"if",
"base_path",
"is",
"None",
"or",
"not",
"local_file",
".",
"startswith",
"(",
"base_path",
")",
":",
"return",
"path",
"dir",
"=",
"os",
".",
"path",
".",
"dirname"... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/build/upload.py#L106-L116 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/lib/function_base.py | python | cov | (m, y=None, rowvar=True, bias=False, ddof=None, fweights=None,
aweights=None) | return c.squeeze() | Estimate a covariance matrix, given data and weights.
Covariance indicates the level to which two variables vary together.
If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`,
then the covariance matrix element :math:`C_{ij}` is the covariance of
:math:`x_i` and :math:`x_j`. The elem... | Estimate a covariance matrix, given data and weights. | [
"Estimate",
"a",
"covariance",
"matrix",
"given",
"data",
"and",
"weights",
"."
] | def cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None,
aweights=None):
"""
Estimate a covariance matrix, given data and weights.
Covariance indicates the level to which two variables vary together.
If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`,
then t... | [
"def",
"cov",
"(",
"m",
",",
"y",
"=",
"None",
",",
"rowvar",
"=",
"True",
",",
"bias",
"=",
"False",
",",
"ddof",
"=",
"None",
",",
"fweights",
"=",
"None",
",",
"aweights",
"=",
"None",
")",
":",
"# Check inputs",
"if",
"ddof",
"is",
"not",
"No... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/lib/function_base.py#L2246-L2456 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/arrays/categorical.py | python | Categorical.remove_categories | (self, removals, inplace=False) | return self.set_categories(
new_categories, ordered=self.ordered, rename=False, inplace=inplace
) | Remove the specified categories.
`removals` must be included in the old categories. Values which were in
the removed categories will be set to NaN
Parameters
----------
removals : category or list of categories
The categories which should be removed.
inplace ... | Remove the specified categories. | [
"Remove",
"the",
"specified",
"categories",
"."
] | def remove_categories(self, removals, inplace=False):
"""
Remove the specified categories.
`removals` must be included in the old categories. Values which were in
the removed categories will be set to NaN
Parameters
----------
removals : category or list of cate... | [
"def",
"remove_categories",
"(",
"self",
",",
"removals",
",",
"inplace",
"=",
"False",
")",
":",
"inplace",
"=",
"validate_bool_kwarg",
"(",
"inplace",
",",
"\"inplace\"",
")",
"if",
"not",
"is_list_like",
"(",
"removals",
")",
":",
"removals",
"=",
"[",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/arrays/categorical.py#L1039-L1089 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/egt/dynamics.py | python | time_average | (traj) | return sum_traj * norm[:, np.newaxis] | Time-averaged population state trajectory.
Args:
traj: Trajectory as `numpy.ndarray`. Time is along the first dimension,
types/strategies along the second.
Returns:
Time-averaged trajectory. | Time-averaged population state trajectory. | [
"Time",
"-",
"averaged",
"population",
"state",
"trajectory",
"."
] | def time_average(traj):
"""Time-averaged population state trajectory.
Args:
traj: Trajectory as `numpy.ndarray`. Time is along the first dimension,
types/strategies along the second.
Returns:
Time-averaged trajectory.
"""
n = traj.shape[0]
sum_traj = np.cumsum(traj, axis=0)
norm = 1. / np.... | [
"def",
"time_average",
"(",
"traj",
")",
":",
"n",
"=",
"traj",
".",
"shape",
"[",
"0",
"]",
"sum_traj",
"=",
"np",
".",
"cumsum",
"(",
"traj",
",",
"axis",
"=",
"0",
")",
"norm",
"=",
"1.",
"/",
"np",
".",
"arange",
"(",
"1",
",",
"n",
"+",
... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/egt/dynamics.py#L177-L190 | |
apache/singa | 93fd9da72694e68bfe3fb29d0183a65263d238a1 | python/singa/autograd.py | python | batchnorm_2d | (handle, x, scale, bias, running_mean, running_var) | return _BatchNorm2d(handle, running_mean, running_var)(x, scale, bias)[0] | Carries out batch normalization as described in the paper
https://arxiv.org/abs/1502.03167.
Args:
handle (object): BatchNormHandle for cpu and CudnnBatchNormHandle
for gpu
x (Tensor): the input tensor
scale (Tensor): the bias tensor
bias (Tensor): the bias tensor
... | Carries out batch normalization as described in the paper
https://arxiv.org/abs/1502.03167.
Args:
handle (object): BatchNormHandle for cpu and CudnnBatchNormHandle
for gpu
x (Tensor): the input tensor
scale (Tensor): the bias tensor
bias (Tensor): the bias tensor
... | [
"Carries",
"out",
"batch",
"normalization",
"as",
"described",
"in",
"the",
"paper",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1502",
".",
"03167",
".",
"Args",
":",
"handle",
"(",
"object",
")",
":",
"BatchNormHandle",
"for",
"cpu",
"... | def batchnorm_2d(handle, x, scale, bias, running_mean, running_var):
"""
Carries out batch normalization as described in the paper
https://arxiv.org/abs/1502.03167.
Args:
handle (object): BatchNormHandle for cpu and CudnnBatchNormHandle
for gpu
x (Tensor): the input tensor
... | [
"def",
"batchnorm_2d",
"(",
"handle",
",",
"x",
",",
"scale",
",",
"bias",
",",
"running_mean",
",",
"running_var",
")",
":",
"return",
"_BatchNorm2d",
"(",
"handle",
",",
"running_mean",
",",
"running_var",
")",
"(",
"x",
",",
"scale",
",",
"bias",
")",... | https://github.com/apache/singa/blob/93fd9da72694e68bfe3fb29d0183a65263d238a1/python/singa/autograd.py#L1829-L1844 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/statemachine.py | python | StringList.pad_double_width | (self, pad_char) | Pad all double-width characters in self by appending `pad_char` to each.
For East Asian language support. | Pad all double-width characters in self by appending `pad_char` to each.
For East Asian language support. | [
"Pad",
"all",
"double",
"-",
"width",
"characters",
"in",
"self",
"by",
"appending",
"pad_char",
"to",
"each",
".",
"For",
"East",
"Asian",
"language",
"support",
"."
] | def pad_double_width(self, pad_char):
"""
Pad all double-width characters in self by appending `pad_char` to each.
For East Asian language support.
"""
if hasattr(unicodedata, 'east_asian_width'):
east_asian_width = unicodedata.east_asian_width
else:
... | [
"def",
"pad_double_width",
"(",
"self",
",",
"pad_char",
")",
":",
"if",
"hasattr",
"(",
"unicodedata",
",",
"'east_asian_width'",
")",
":",
"east_asian_width",
"=",
"unicodedata",
".",
"east_asian_width",
"else",
":",
"return",
"# new in Python 2.4",
"for",
"i",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/statemachine.py#L1450-L1467 | ||
eric612/Caffe-YOLOv3-Windows | 6736ca6e16781789b828cc64218ff77cc3454e5d | examples/pycaffe/tools.py | python | CaffeSolver.write | (self, filepath) | Export solver parameters to INPUT "filepath". Sorted alphabetically. | Export solver parameters to INPUT "filepath". Sorted alphabetically. | [
"Export",
"solver",
"parameters",
"to",
"INPUT",
"filepath",
".",
"Sorted",
"alphabetically",
"."
] | def write(self, filepath):
"""
Export solver parameters to INPUT "filepath". Sorted alphabetically.
"""
f = open(filepath, 'w')
for key, value in sorted(self.sp.items()):
if not(type(value) is str):
raise TypeError('All solver parameters must be string... | [
"def",
"write",
"(",
"self",
",",
"filepath",
")",
":",
"f",
"=",
"open",
"(",
"filepath",
",",
"'w'",
")",
"for",
"key",
",",
"value",
"in",
"sorted",
"(",
"self",
".",
"sp",
".",
"items",
"(",
")",
")",
":",
"if",
"not",
"(",
"type",
"(",
"... | https://github.com/eric612/Caffe-YOLOv3-Windows/blob/6736ca6e16781789b828cc64218ff77cc3454e5d/examples/pycaffe/tools.py#L113-L121 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/common.py | python | GetFlavor | (params) | return 'linux' | Returns |params.flavor| if it's set, the system's default flavor else. | Returns |params.flavor| if it's set, the system's default flavor else. | [
"Returns",
"|params",
".",
"flavor|",
"if",
"it",
"s",
"set",
"the",
"system",
"s",
"default",
"flavor",
"else",
"."
] | def GetFlavor(params):
"""Returns |params.flavor| if it's set, the system's default flavor else."""
flavors = {
'cygwin': 'win',
'win32': 'win',
'darwin': 'mac',
}
if 'flavor' in params:
return params['flavor']
if sys.platform in flavors:
return flavors[sys.platform]
if sys.platform.sta... | [
"def",
"GetFlavor",
"(",
"params",
")",
":",
"flavors",
"=",
"{",
"'cygwin'",
":",
"'win'",
",",
"'win32'",
":",
"'win'",
",",
"'darwin'",
":",
"'mac'",
",",
"}",
"if",
"'flavor'",
"in",
"params",
":",
"return",
"params",
"[",
"'flavor'",
"]",
"if",
... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/common.py#L365-L382 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/grid.py | python | Grid.MoveCursorDownBlock | (*args, **kwargs) | return _grid.Grid_MoveCursorDownBlock(*args, **kwargs) | MoveCursorDownBlock(self, bool expandSelection) -> bool | MoveCursorDownBlock(self, bool expandSelection) -> bool | [
"MoveCursorDownBlock",
"(",
"self",
"bool",
"expandSelection",
")",
"-",
">",
"bool"
] | def MoveCursorDownBlock(*args, **kwargs):
"""MoveCursorDownBlock(self, bool expandSelection) -> bool"""
return _grid.Grid_MoveCursorDownBlock(*args, **kwargs) | [
"def",
"MoveCursorDownBlock",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"Grid_MoveCursorDownBlock",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/grid.py#L1458-L1460 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/tools/docs/gen_cc_md.py | python | element_text | (member_elt, elt_name) | return '\n\n'.join(text) | Extract all `para` text from (`elt_name` in) `member_elt`. | Extract all `para` text from (`elt_name` in) `member_elt`. | [
"Extract",
"all",
"para",
"text",
"from",
"(",
"elt_name",
"in",
")",
"member_elt",
"."
] | def element_text(member_elt, elt_name):
"""Extract all `para` text from (`elt_name` in) `member_elt`."""
text = []
if elt_name:
elt = member_elt.find(elt_name)
else:
elt = member_elt
if elt:
paras = elt.findAll('para')
for p in paras:
text.append(p.getText(separator=u' ').strip())
ret... | [
"def",
"element_text",
"(",
"member_elt",
",",
"elt_name",
")",
":",
"text",
"=",
"[",
"]",
"if",
"elt_name",
":",
"elt",
"=",
"member_elt",
".",
"find",
"(",
"elt_name",
")",
"else",
":",
"elt",
"=",
"member_elt",
"if",
"elt",
":",
"paras",
"=",
"el... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/tools/docs/gen_cc_md.py#L128-L140 | |
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/scripts/exomerge3.py | python | ExodusModel._order_nodes | (self) | Redefine node ordering in a consistent manner.
This was introduced because running exodiff on two different
models with the same information but differing node numbering will
fail. By running this routine before export_model, the numbering
will be consistent and will avoid this problem... | Redefine node ordering in a consistent manner. | [
"Redefine",
"node",
"ordering",
"in",
"a",
"consistent",
"manner",
"."
] | def _order_nodes(self):
"""
Redefine node ordering in a consistent manner.
This was introduced because running exodiff on two different
models with the same information but differing node numbering will
fail. By running this routine before export_model, the numbering
wi... | [
"def",
"_order_nodes",
"(",
"self",
")",
":",
"# Define new node numbering by the order in which nodes are encountered",
"# in element blocks by ascending element block id. For nodes not used",
"# in any element blocks, they are sorted by x coordinate, then y",
"# coordinate, then z coordinate.",... | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exomerge3.py#L6704-L6736 | ||
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | Examples/ReinforcementLearning/FlappingBirdWithKeras/game/wrapped_flappy_bird.py | python | pixelCollision | (rect1, rect2, hitmask1, hitmask2) | return False | Checks if two objects collide and not just their rects | Checks if two objects collide and not just their rects | [
"Checks",
"if",
"two",
"objects",
"collide",
"and",
"not",
"just",
"their",
"rects"
] | def pixelCollision(rect1, rect2, hitmask1, hitmask2):
"""Checks if two objects collide and not just their rects"""
rect = rect1.clip(rect2)
if rect.width == 0 or rect.height == 0:
return False
x1, y1 = rect.x - rect1.x, rect.y - rect1.y
x2, y2 = rect.x - rect2.x, rect.y - rect2.y
for ... | [
"def",
"pixelCollision",
"(",
"rect1",
",",
"rect2",
",",
"hitmask1",
",",
"hitmask2",
")",
":",
"rect",
"=",
"rect1",
".",
"clip",
"(",
"rect2",
")",
"if",
"rect",
".",
"width",
"==",
"0",
"or",
"rect",
".",
"height",
"==",
"0",
":",
"return",
"Fa... | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/Examples/ReinforcementLearning/FlappingBirdWithKeras/game/wrapped_flappy_bird.py#L213-L227 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/probability/distribution/bernoulli.py | python | Bernoulli._cdf | (self, value, probs1=None) | return self.select(comp_one, less_than_zero, ones) | r"""
Cumulative distribution function (cdf) of Bernoulli distributions.
Args:
value (Tensor): The value to be evaluated.
probs (Tensor): The probability of that the outcome is 1. Default: self.probs.
.. math::
cdf(k) = 0 if k < 0;
cdf(k) = probs0... | r"""
Cumulative distribution function (cdf) of Bernoulli distributions. | [
"r",
"Cumulative",
"distribution",
"function",
"(",
"cdf",
")",
"of",
"Bernoulli",
"distributions",
"."
] | def _cdf(self, value, probs1=None):
r"""
Cumulative distribution function (cdf) of Bernoulli distributions.
Args:
value (Tensor): The value to be evaluated.
probs (Tensor): The probability of that the outcome is 1. Default: self.probs.
.. math::
cdf(... | [
"def",
"_cdf",
"(",
"self",
",",
"value",
",",
"probs1",
"=",
"None",
")",
":",
"value",
"=",
"self",
".",
"_check_value",
"(",
"value",
",",
"'value'",
")",
"value",
"=",
"self",
".",
"cast",
"(",
"value",
",",
"self",
".",
"parameter_type",
")",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/probability/distribution/bernoulli.py#L272-L299 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/SaveGSSCW.py | python | SaveGSSCW._write_gsas_fxye | (self, workspace) | return gsas_content | Write GSAS file from a workspace to FXYE format
Example:
BANK 1 2438 488 CONST 1000.000 5.000 0 0 ESD
287.51 16.96 281.38 13.52 279.80 11.83 282.77 11.89 279.73 13.43
270.69 16.45 270.27 13.23 271.90 11.66 275.57 11.74 286.05 13.66
303.35 ... | Write GSAS file from a workspace to FXYE format | [
"Write",
"GSAS",
"file",
"from",
"a",
"workspace",
"to",
"FXYE",
"format"
] | def _write_gsas_fxye(self, workspace):
"""
Write GSAS file from a workspace to FXYE format
Example:
BANK 1 2438 488 CONST 1000.000 5.000 0 0 ESD
287.51 16.96 281.38 13.52 279.80 11.83 282.77 11.89 279.73 13.43
270.69 16.45 270.27 13.23 271.90 ... | [
"def",
"_write_gsas_fxye",
"(",
"self",
",",
"workspace",
")",
":",
"# generate header",
"header",
"=",
"self",
".",
"_create_gsas_header",
"(",
"workspace",
")",
"# generate body",
"body",
"=",
"self",
".",
"_create_gsas_body",
"(",
"workspace",
")",
"# construct... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/SaveGSSCW.py#L96-L125 | |
SpaceNetChallenge/BuildingDetectors | 3def3c44b5847c744cd2f3356182892d92496579 | qinhaifang/src/caffe-mnc/python/caffe/io.py | python | blobproto_to_array | (blob, return_diff=False) | Convert a blob proto to an array. In default, we will just return the data,
unless return_diff is True, in which case we will return the diff. | Convert a blob proto to an array. In default, we will just return the data,
unless return_diff is True, in which case we will return the diff. | [
"Convert",
"a",
"blob",
"proto",
"to",
"an",
"array",
".",
"In",
"default",
"we",
"will",
"just",
"return",
"the",
"data",
"unless",
"return_diff",
"is",
"True",
"in",
"which",
"case",
"we",
"will",
"return",
"the",
"diff",
"."
] | def blobproto_to_array(blob, return_diff=False):
"""
Convert a blob proto to an array. In default, we will just return the data,
unless return_diff is True, in which case we will return the diff.
"""
# Read the data into an array
if return_diff:
data = np.array(blob.diff)
else:
... | [
"def",
"blobproto_to_array",
"(",
"blob",
",",
"return_diff",
"=",
"False",
")",
":",
"# Read the data into an array",
"if",
"return_diff",
":",
"data",
"=",
"np",
".",
"array",
"(",
"blob",
".",
"diff",
")",
"else",
":",
"data",
"=",
"np",
".",
"array",
... | https://github.com/SpaceNetChallenge/BuildingDetectors/blob/3def3c44b5847c744cd2f3356182892d92496579/qinhaifang/src/caffe-mnc/python/caffe/io.py#L18-L34 | ||
RamadhanAmizudin/malware | 2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1 | Mazar/MazAr_Admin/apps/smsg_r/smsapp/remote_api.py | python | intercept_status_change | (rec, data) | Signals that the phone has changed its intercept status in reply to #intercept_sms_start & #intercept_sms_stop
data."rent status" contains either "started" or "stopped"
@param rec: Phone data record
@type rec: models.PhoneData
@param data: Phone data
@type data: dict
@rtype: None | Signals that the phone has changed its intercept status in reply to #intercept_sms_start & #intercept_sms_stop
data."rent status" contains either "started" or "stopped" | [
"Signals",
"that",
"the",
"phone",
"has",
"changed",
"its",
"intercept",
"status",
"in",
"reply",
"to",
"#intercept_sms_start",
"&",
"#intercept_sms_stop",
"data",
".",
"rent",
"status",
"contains",
"either",
"started",
"or",
"stopped"
] | def intercept_status_change(rec, data):
"""
Signals that the phone has changed its intercept status in reply to #intercept_sms_start & #intercept_sms_stop
data."rent status" contains either "started" or "stopped"
@param rec: Phone data record
@type rec: models.PhoneData
@param data: Phone data
... | [
"def",
"intercept_status_change",
"(",
"rec",
",",
"data",
")",
":",
"if",
"rec",
".",
"owner_id",
"is",
"None",
":",
"logger",
".",
"error",
"(",
"u\"No owner for phone {0} currently\"",
".",
"format",
"(",
"rec",
")",
")",
"return",
"new_status",
"=",
"dat... | https://github.com/RamadhanAmizudin/malware/blob/2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1/Mazar/MazAr_Admin/apps/smsg_r/smsapp/remote_api.py#L246-L274 | ||
rrwick/Unicycler | 96ffea71e3a78d63ade19d6124946773e65cf129 | unicycler/assembly_graph.py | python | AssemblyGraph.gfa_link_line | (self, start, end) | return l_line | Returns an entire L line for GFA output, including the newline. | Returns an entire L line for GFA output, including the newline. | [
"Returns",
"an",
"entire",
"L",
"line",
"for",
"GFA",
"output",
"including",
"the",
"newline",
"."
] | def gfa_link_line(self, start, end):
"""
Returns an entire L line for GFA output, including the newline.
"""
l_line = 'L\t'
l_line += str(abs(start)) + '\t'
l_line += get_sign_string(start) + '\t'
l_line += str(abs(end)) + '\t'
l_line += get_sign_string(en... | [
"def",
"gfa_link_line",
"(",
"self",
",",
"start",
",",
"end",
")",
":",
"l_line",
"=",
"'L\\t'",
"l_line",
"+=",
"str",
"(",
"abs",
"(",
"start",
")",
")",
"+",
"'\\t'",
"l_line",
"+=",
"get_sign_string",
"(",
"start",
")",
"+",
"'\\t'",
"l_line",
"... | https://github.com/rrwick/Unicycler/blob/96ffea71e3a78d63ade19d6124946773e65cf129/unicycler/assembly_graph.py#L739-L749 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | samples/pySketch/pySketch.py | python | DrawingFrame.doDelete | (self, event) | Respond to the "Delete" menu command. | Respond to the "Delete" menu command. | [
"Respond",
"to",
"the",
"Delete",
"menu",
"command",
"."
] | def doDelete(self, event):
""" Respond to the "Delete" menu command.
"""
self.saveUndoInfo()
for obj in self.selection:
self.contents.remove(obj)
del obj
self.deselectAll() | [
"def",
"doDelete",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"saveUndoInfo",
"(",
")",
"for",
"obj",
"in",
"self",
".",
"selection",
":",
"self",
".",
"contents",
".",
"remove",
"(",
"obj",
")",
"del",
"obj",
"self",
".",
"deselectAll",
"(",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/samples/pySketch/pySketch.py#L885-L893 | ||
msracver/Deep-Image-Analogy | 632b9287b42552e32dad64922967c8c9ec7fc4d3 | scripts/cpp_lint.py | python | _NamespaceInfo.CheckEnd | (self, filename, clean_lines, linenum, error) | Check end of namespace comments. | Check end of namespace comments. | [
"Check",
"end",
"of",
"namespace",
"comments",
"."
] | def CheckEnd(self, filename, clean_lines, linenum, error):
"""Check end of namespace comments."""
line = clean_lines.raw_lines[linenum]
# Check how many lines is enclosed in this namespace. Don't issue
# warning for missing namespace comments if there aren't enough
# lines. However, do apply chec... | [
"def",
"CheckEnd",
"(",
"self",
",",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"raw_lines",
"[",
"linenum",
"]",
"# Check how many lines is enclosed in this namespace. Don't issue",
"# warning for missing n... | https://github.com/msracver/Deep-Image-Analogy/blob/632b9287b42552e32dad64922967c8c9ec7fc4d3/scripts/cpp_lint.py#L1856-L1899 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/inspect.py | python | Signature.replace | (self, *, parameters=_void, return_annotation=_void) | return type(self)(parameters,
return_annotation=return_annotation) | Creates a customized copy of the Signature.
Pass 'parameters' and/or 'return_annotation' arguments
to override them in the new copy. | Creates a customized copy of the Signature.
Pass 'parameters' and/or 'return_annotation' arguments
to override them in the new copy. | [
"Creates",
"a",
"customized",
"copy",
"of",
"the",
"Signature",
".",
"Pass",
"parameters",
"and",
"/",
"or",
"return_annotation",
"arguments",
"to",
"override",
"them",
"in",
"the",
"new",
"copy",
"."
] | def replace(self, *, parameters=_void, return_annotation=_void):
"""Creates a customized copy of the Signature.
Pass 'parameters' and/or 'return_annotation' arguments
to override them in the new copy.
"""
if parameters is _void:
parameters = self.parameters.values()
... | [
"def",
"replace",
"(",
"self",
",",
"*",
",",
"parameters",
"=",
"_void",
",",
"return_annotation",
"=",
"_void",
")",
":",
"if",
"parameters",
"is",
"_void",
":",
"parameters",
"=",
"self",
".",
"parameters",
".",
"values",
"(",
")",
"if",
"return_annot... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/inspect.py#L2843-L2856 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | xmlNode.setContent | (self, content) | Replace the content of a node. NOTE: @content is supposed
to be a piece of XML CDATA, so it allows entity references,
but XML special chars need to be escaped first by using
xmlEncodeEntitiesReentrant() resp. xmlEncodeSpecialChars(). | Replace the content of a node. NOTE: | [
"Replace",
"the",
"content",
"of",
"a",
"node",
".",
"NOTE",
":"
] | def setContent(self, content):
"""Replace the content of a node. NOTE: @content is supposed
to be a piece of XML CDATA, so it allows entity references,
but XML special chars need to be escaped first by using
xmlEncodeEntitiesReentrant() resp. xmlEncodeSpecialChars(). """
l... | [
"def",
"setContent",
"(",
"self",
",",
"content",
")",
":",
"libxml2mod",
".",
"xmlNodeSetContent",
"(",
"self",
".",
"_o",
",",
"content",
")"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L3537-L3542 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/contexts/fitting_contexts/general_fitting_context.py | python | GeneralFittingContext.global_parameters | (self, global_parameters: list) | Sets the global parameters stored in the model. | Sets the global parameters stored in the model. | [
"Sets",
"the",
"global",
"parameters",
"stored",
"in",
"the",
"model",
"."
] | def global_parameters(self, global_parameters: list) -> None:
"""Sets the global parameters stored in the model."""
self._global_parameters = global_parameters | [
"def",
"global_parameters",
"(",
"self",
",",
"global_parameters",
":",
"list",
")",
"->",
"None",
":",
"self",
".",
"_global_parameters",
"=",
"global_parameters"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/contexts/fitting_contexts/general_fitting_context.py#L99-L101 | ||
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_internal/wheel.py | python | WheelBuilder.build | (
self,
requirements, # type: Iterable[InstallRequirement]
session, # type: PipSession
autobuilding=False # type: bool
) | return build_failure | Build wheels.
:param unpack: If True, replace the sdist we built from with the
newly built wheel, in preparation for installation.
:return: True if all the wheels built correctly. | Build wheels. | [
"Build",
"wheels",
"."
] | def build(
self,
requirements, # type: Iterable[InstallRequirement]
session, # type: PipSession
autobuilding=False # type: bool
):
# type: (...) -> List[InstallRequirement]
"""Build wheels.
:param unpack: If True, replace the sdist we built from with the
... | [
"def",
"build",
"(",
"self",
",",
"requirements",
",",
"# type: Iterable[InstallRequirement]",
"session",
",",
"# type: PipSession",
"autobuilding",
"=",
"False",
"# type: bool",
")",
":",
"# type: (...) -> List[InstallRequirement]",
"buildset",
"=",
"[",
"]",
"format_con... | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_internal/wheel.py#L983-L1095 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/gslib/storage_url.py | python | StorageUrlFromString | (url_str) | return _CloudUrl(url_str) | Static factory function for creating a StorageUrl from a string. | Static factory function for creating a StorageUrl from a string. | [
"Static",
"factory",
"function",
"for",
"creating",
"a",
"StorageUrl",
"from",
"a",
"string",
"."
] | def StorageUrlFromString(url_str):
"""Static factory function for creating a StorageUrl from a string."""
scheme = _GetSchemeFromUrlString(url_str)
if scheme not in ('file', 's3', 'gs'):
raise InvalidUrlError('Unrecognized scheme "%s"' % scheme)
if scheme == 'file':
path = _GetPathFromUrlString(url_st... | [
"def",
"StorageUrlFromString",
"(",
"url_str",
")",
":",
"scheme",
"=",
"_GetSchemeFromUrlString",
"(",
"url_str",
")",
"if",
"scheme",
"not",
"in",
"(",
"'file'",
",",
"'s3'",
",",
"'gs'",
")",
":",
"raise",
"InvalidUrlError",
"(",
"'Unrecognized scheme \"%s\"'... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/gslib/storage_url.py#L295-L306 | |
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/PhactoriDriver.py | python | PhactoriPipeAndViewsState.ExportOperationsData | (self, datadescription) | go through all the operation blocks and call the ExportOperationData()\n method on each to allow each operation to export non-image data if\n they need to do so | go through all the operation blocks and call the ExportOperationData()\n method on each to allow each operation to export non-image data if\n they need to do so | [
"go",
"through",
"all",
"the",
"operation",
"blocks",
"and",
"call",
"the",
"ExportOperationData",
"()",
"\\",
"n",
"method",
"on",
"each",
"to",
"allow",
"each",
"operation",
"to",
"export",
"non",
"-",
"image",
"data",
"if",
"\\",
"n",
"they",
"need",
... | def ExportOperationsData(self, datadescription):
"go through all the operation blocks and call the ExportOperationData()\n method on each to allow each operation to export non-image data if\n they need to do so"
for operationName, operationInstance in self.mOperationBlocks.items():
operationIn... | [
"def",
"ExportOperationsData",
"(",
"self",
",",
"datadescription",
")",
":",
"for",
"operationName",
",",
"operationInstance",
"in",
"self",
".",
"mOperationBlocks",
".",
"items",
"(",
")",
":",
"operationInstance",
".",
"ExportOperationData",
"(",
"datadescription... | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/PhactoriDriver.py#L19616-L19619 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/command/easy_install.py | python | samefile | (p1, p2) | return norm_p1 == norm_p2 | Determine if two paths reference the same file.
Augments os.path.samefile to work on Windows and
suppresses errors if the path doesn't exist. | Determine if two paths reference the same file. | [
"Determine",
"if",
"two",
"paths",
"reference",
"the",
"same",
"file",
"."
] | def samefile(p1, p2):
"""
Determine if two paths reference the same file.
Augments os.path.samefile to work on Windows and
suppresses errors if the path doesn't exist.
"""
both_exist = os.path.exists(p1) and os.path.exists(p2)
use_samefile = hasattr(os.path, 'samefile') and both_exist
i... | [
"def",
"samefile",
"(",
"p1",
",",
"p2",
")",
":",
"both_exist",
"=",
"os",
".",
"path",
".",
"exists",
"(",
"p1",
")",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"p2",
")",
"use_samefile",
"=",
"hasattr",
"(",
"os",
".",
"path",
",",
"'samefi... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/command/easy_install.py#L83-L96 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | TreeCtrl.SetItemTextColour | (*args, **kwargs) | return _controls_.TreeCtrl_SetItemTextColour(*args, **kwargs) | SetItemTextColour(self, TreeItemId item, Colour col) | SetItemTextColour(self, TreeItemId item, Colour col) | [
"SetItemTextColour",
"(",
"self",
"TreeItemId",
"item",
"Colour",
"col",
")"
] | def SetItemTextColour(*args, **kwargs):
"""SetItemTextColour(self, TreeItemId item, Colour col)"""
return _controls_.TreeCtrl_SetItemTextColour(*args, **kwargs) | [
"def",
"SetItemTextColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TreeCtrl_SetItemTextColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L5315-L5317 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/keras/_impl/keras/layers/merge.py | python | average | (inputs, **kwargs) | return Average(**kwargs)(inputs) | Functional interface to the `Average` layer.
Arguments:
inputs: A list of input tensors (at least 2).
**kwargs: Standard layer keyword arguments.
Returns:
A tensor, the average of the inputs. | Functional interface to the `Average` layer. | [
"Functional",
"interface",
"to",
"the",
"Average",
"layer",
"."
] | def average(inputs, **kwargs):
"""Functional interface to the `Average` layer.
Arguments:
inputs: A list of input tensors (at least 2).
**kwargs: Standard layer keyword arguments.
Returns:
A tensor, the average of the inputs.
"""
return Average(**kwargs)(inputs) | [
"def",
"average",
"(",
"inputs",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"Average",
"(",
"*",
"*",
"kwargs",
")",
"(",
"inputs",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/keras/_impl/keras/layers/merge.py#L561-L571 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | CallWrapper.__call__ | (self, *args) | Apply first function SUBST to arguments, than FUNC. | Apply first function SUBST to arguments, than FUNC. | [
"Apply",
"first",
"function",
"SUBST",
"to",
"arguments",
"than",
"FUNC",
"."
] | def __call__(self, *args):
"""Apply first function SUBST to arguments, than FUNC."""
try:
if self.subst:
args = self.subst(*args)
return self.func(*args)
except SystemExit, msg:
raise SystemExit, msg
except:
self.widget._rep... | [
"def",
"__call__",
"(",
"self",
",",
"*",
"args",
")",
":",
"try",
":",
"if",
"self",
".",
"subst",
":",
"args",
"=",
"self",
".",
"subst",
"(",
"*",
"args",
")",
"return",
"self",
".",
"func",
"(",
"*",
"args",
")",
"except",
"SystemExit",
",",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py#L1465-L1474 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/distutils/dist.py | python | Distribution.print_command_list | (self, commands, header, max_length) | Print a subset of the list of all commands -- used by
'print_commands()'. | Print a subset of the list of all commands -- used by
'print_commands()'. | [
"Print",
"a",
"subset",
"of",
"the",
"list",
"of",
"all",
"commands",
"--",
"used",
"by",
"print_commands",
"()",
"."
] | def print_command_list(self, commands, header, max_length):
"""Print a subset of the list of all commands -- used by
'print_commands()'.
"""
print(header + ":")
for cmd in commands:
klass = self.cmdclass.get(cmd)
if not klass:
klass = self... | [
"def",
"print_command_list",
"(",
"self",
",",
"commands",
",",
"header",
",",
"max_length",
")",
":",
"print",
"(",
"header",
"+",
"\":\"",
")",
"for",
"cmd",
"in",
"commands",
":",
"klass",
"=",
"self",
".",
"cmdclass",
".",
"get",
"(",
"cmd",
")",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/distutils/dist.py#L697-L712 | ||
qgis/QGIS | 15a77662d4bb712184f6aa60d0bd663010a76a75 | python/plugins/db_manager/db_plugins/postgis/connector.py | python | PostGisDBConnector.deleteTableTrigger | (self, trigger, table) | Deletes trigger on table | Deletes trigger on table | [
"Deletes",
"trigger",
"on",
"table"
] | def deleteTableTrigger(self, trigger, table):
"""Deletes trigger on table """
sql = u"DROP TRIGGER %s ON %s" % (self.quoteId(trigger), self.quoteId(table))
self._execute_and_commit(sql) | [
"def",
"deleteTableTrigger",
"(",
"self",
",",
"trigger",
",",
"table",
")",
":",
"sql",
"=",
"u\"DROP TRIGGER %s ON %s\"",
"%",
"(",
"self",
".",
"quoteId",
"(",
"trigger",
")",
",",
"self",
".",
"quoteId",
"(",
"table",
")",
")",
"self",
".",
"_execute... | https://github.com/qgis/QGIS/blob/15a77662d4bb712184f6aa60d0bd663010a76a75/python/plugins/db_manager/db_plugins/postgis/connector.py#L744-L747 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/requests/utils.py | python | parse_dict_header | (value) | return result | Parse lists of key, value pairs as described by RFC 2068 Section 2 and
convert them into a python dict:
>>> d = parse_dict_header('foo="is a fish", bar="as well"')
>>> type(d) is dict
True
>>> sorted(d.items())
[('bar', 'as well'), ('foo', 'is a fish')]
If there is no value for a key it wi... | Parse lists of key, value pairs as described by RFC 2068 Section 2 and
convert them into a python dict: | [
"Parse",
"lists",
"of",
"key",
"value",
"pairs",
"as",
"described",
"by",
"RFC",
"2068",
"Section",
"2",
"and",
"convert",
"them",
"into",
"a",
"python",
"dict",
":"
] | def parse_dict_header(value):
"""Parse lists of key, value pairs as described by RFC 2068 Section 2 and
convert them into a python dict:
>>> d = parse_dict_header('foo="is a fish", bar="as well"')
>>> type(d) is dict
True
>>> sorted(d.items())
[('bar', 'as well'), ('foo', 'is a fish')]
... | [
"def",
"parse_dict_header",
"(",
"value",
")",
":",
"result",
"=",
"{",
"}",
"for",
"item",
"in",
"_parse_list_header",
"(",
"value",
")",
":",
"if",
"'='",
"not",
"in",
"item",
":",
"result",
"[",
"item",
"]",
"=",
"None",
"continue",
"name",
",",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/requests/utils.py#L349-L380 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/distributed/fleet/meta_parallel/sharding/sharding_stage2.py | python | ShardingStage2.__sync_buffers | (self) | Sync all the param buffers from all ranks (exp: batch norm statistics). | Sync all the param buffers from all ranks (exp: batch norm statistics). | [
"Sync",
"all",
"the",
"param",
"buffers",
"from",
"all",
"ranks",
"(",
"exp",
":",
"batch",
"norm",
"statistics",
")",
"."
] | def __sync_buffers(self):
"""
Sync all the param buffers from all ranks (exp: batch norm statistics).
"""
for buffer in self._layer.buffers(include_sublayers=True):
dist.broadcast(
buffer,
self._global_root_rank,
self._group,
... | [
"def",
"__sync_buffers",
"(",
"self",
")",
":",
"for",
"buffer",
"in",
"self",
".",
"_layer",
".",
"buffers",
"(",
"include_sublayers",
"=",
"True",
")",
":",
"dist",
".",
"broadcast",
"(",
"buffer",
",",
"self",
".",
"_global_root_rank",
",",
"self",
".... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/fleet/meta_parallel/sharding/sharding_stage2.py#L268-L280 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | Log.RemoveTraceMask | (*args, **kwargs) | return _misc_.Log_RemoveTraceMask(*args, **kwargs) | RemoveTraceMask(String str) | RemoveTraceMask(String str) | [
"RemoveTraceMask",
"(",
"String",
"str",
")"
] | def RemoveTraceMask(*args, **kwargs):
"""RemoveTraceMask(String str)"""
return _misc_.Log_RemoveTraceMask(*args, **kwargs) | [
"def",
"RemoveTraceMask",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Log_RemoveTraceMask",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L1565-L1567 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/specifiers.py | python | BaseSpecifier.__ne__ | (self, other) | Returns a boolean representing whether or not the two Specifier like
objects are not equal. | Returns a boolean representing whether or not the two Specifier like
objects are not equal. | [
"Returns",
"a",
"boolean",
"representing",
"whether",
"or",
"not",
"the",
"two",
"Specifier",
"like",
"objects",
"are",
"not",
"equal",
"."
] | def __ne__(self, other):
"""
Returns a boolean representing whether or not the two Specifier like
objects are not equal.
""" | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/specifiers.py#L44-L48 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/floatspin.py | python | FixedPoint.get_precision | (self) | return self.p | Return the precision of this :class:`FixedPoint`.
:note: The precision is the number of decimal digits carried after
the decimal point, and is an int >= 0. | Return the precision of this :class:`FixedPoint`. | [
"Return",
"the",
"precision",
"of",
"this",
":",
"class",
":",
"FixedPoint",
"."
] | def get_precision(self):
"""
Return the precision of this :class:`FixedPoint`.
:note: The precision is the number of decimal digits carried after
the decimal point, and is an int >= 0.
"""
return self.p | [
"def",
"get_precision",
"(",
"self",
")",
":",
"return",
"self",
".",
"p"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/floatspin.py#L1406-L1414 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/logging/__init__.py | python | Filterer.addFilter | (self, filter) | Add the specified filter to this handler. | Add the specified filter to this handler. | [
"Add",
"the",
"specified",
"filter",
"to",
"this",
"handler",
"."
] | def addFilter(self, filter):
"""
Add the specified filter to this handler.
"""
if not (filter in self.filters):
self.filters.append(filter) | [
"def",
"addFilter",
"(",
"self",
",",
"filter",
")",
":",
"if",
"not",
"(",
"filter",
"in",
"self",
".",
"filters",
")",
":",
"self",
".",
"filters",
".",
"append",
"(",
"filter",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/logging/__init__.py#L584-L589 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ReflectometryILLAutoProcess.py | python | ReflectometryILLAutoProcess.summary | (self) | return "Performs reduction of ILL reflectometry data, instruments D17 and FIGARO." | Return a summary of the algorithm. | Return a summary of the algorithm. | [
"Return",
"a",
"summary",
"of",
"the",
"algorithm",
"."
] | def summary(self):
"""Return a summary of the algorithm."""
return "Performs reduction of ILL reflectometry data, instruments D17 and FIGARO." | [
"def",
"summary",
"(",
"self",
")",
":",
"return",
"\"Performs reduction of ILL reflectometry data, instruments D17 and FIGARO.\""
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ReflectometryILLAutoProcess.py#L121-L123 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | utils/vim-lldb/python-vim-lldb/lldb_controller.py | python | LLDBController.getCommandOutput | (self, command, command_args="") | return (result.Succeeded(), result.GetOutput()
if result.Succeeded() else result.GetError()) | runs cmd in the command interpreter andreturns (status, result) | runs cmd in the command interpreter andreturns (status, result) | [
"runs",
"cmd",
"in",
"the",
"command",
"interpreter",
"andreturns",
"(",
"status",
"result",
")"
] | def getCommandOutput(self, command, command_args=""):
""" runs cmd in the command interpreter andreturns (status, result) """
result = lldb.SBCommandReturnObject()
cmd = "%s %s" % (command, command_args)
self.commandInterpreter.HandleCommand(cmd, result)
return (result.Succeeded(... | [
"def",
"getCommandOutput",
"(",
"self",
",",
"command",
",",
"command_args",
"=",
"\"\"",
")",
":",
"result",
"=",
"lldb",
".",
"SBCommandReturnObject",
"(",
")",
"cmd",
"=",
"\"%s %s\"",
"%",
"(",
"command",
",",
"command_args",
")",
"self",
".",
"command... | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/utils/vim-lldb/python-vim-lldb/lldb_controller.py#L332-L338 | |
openweave/openweave-core | 11ceb6b7efd39fe05de7f79229247a5774d56766 | src/device-manager/python/weave-device-mgr.py | python | DeviceMgrCmd.do_testnetwork | (self, line) | test-network <network-id>
Perform a network connectivity test for a particular provisioned network. | test-network <network-id> | [
"test",
"-",
"network",
"<network",
"-",
"id",
">"
] | def do_testnetwork(self, line):
"""
test-network <network-id>
Perform a network connectivity test for a particular provisioned network.
"""
args = shlex.split(line)
if (len(args) == 0):
print("Usage:")
self.do_help('test-network')
... | [
"def",
"do_testnetwork",
"(",
"self",
",",
"line",
")",
":",
"args",
"=",
"shlex",
".",
"split",
"(",
"line",
")",
"if",
"(",
"len",
"(",
"args",
")",
"==",
"0",
")",
":",
"print",
"(",
"\"Usage:\"",
")",
"self",
".",
"do_help",
"(",
"'test-network... | https://github.com/openweave/openweave-core/blob/11ceb6b7efd39fe05de7f79229247a5774d56766/src/device-manager/python/weave-device-mgr.py#L1628-L1662 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | grc/core/generator/top_block.py | python | TopBlockGenerator._build_python_code_from_template | (self) | return output | Convert the flow graph to python code.
Returns:
a string of python code | Convert the flow graph to python code. | [
"Convert",
"the",
"flow",
"graph",
"to",
"python",
"code",
"."
] | def _build_python_code_from_template(self):
"""
Convert the flow graph to python code.
Returns:
a string of python code
"""
output = []
fg = self._flow_graph
platform = fg.parent
title = fg.get_option('title') or fg.get_option(
'i... | [
"def",
"_build_python_code_from_template",
"(",
"self",
")",
":",
"output",
"=",
"[",
"]",
"fg",
"=",
"self",
".",
"_flow_graph",
"platform",
"=",
"fg",
".",
"parent",
"title",
"=",
"fg",
".",
"get_option",
"(",
"'title'",
")",
"or",
"fg",
".",
"get_opti... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/grc/core/generator/top_block.py#L92-L143 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/robotsim.py | python | RobotModelLink.getPointAcceleration | (self, plocal: Point, ddq: Vector) | return _robotsim.RobotModelLink_getPointAcceleration(self, plocal, ddq) | r"""
Computes the acceleration of the point given the robot's current joint
configuration and velocities, and the joint accelerations ddq.
Args:
plocal (:obj:`list of 3 floats`)
ddq (:obj:`list of floats`)
Returns:
list of 3 floats: the accelera... | r"""
Computes the acceleration of the point given the robot's current joint
configuration and velocities, and the joint accelerations ddq. | [
"r",
"Computes",
"the",
"acceleration",
"of",
"the",
"point",
"given",
"the",
"robot",
"s",
"current",
"joint",
"configuration",
"and",
"velocities",
"and",
"the",
"joint",
"accelerations",
"ddq",
"."
] | def getPointAcceleration(self, plocal: Point, ddq: Vector) ->None:
r"""
Computes the acceleration of the point given the robot's current joint
configuration and velocities, and the joint accelerations ddq.
Args:
plocal (:obj:`list of 3 floats`)
ddq (:obj:`list ... | [
"def",
"getPointAcceleration",
"(",
"self",
",",
"plocal",
":",
"Point",
",",
"ddq",
":",
"Vector",
")",
"->",
"None",
":",
"return",
"_robotsim",
".",
"RobotModelLink_getPointAcceleration",
"(",
"self",
",",
"plocal",
",",
"ddq",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/robotsim.py#L4283-L4298 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/results_tab_widget/results_tab_view.py | python | _create_empty_list_selector | (parent, col_zero_width) | return presenter | Create a ListSelector around the given parent
and return the presenter
:param parent: The parent widget for the selector
:param col_zero_width: The width of the first column
:return: A new presenter that controls the widget | Create a ListSelector around the given parent
and return the presenter | [
"Create",
"a",
"ListSelector",
"around",
"the",
"given",
"parent",
"and",
"return",
"the",
"presenter"
] | def _create_empty_list_selector(parent, col_zero_width):
"""
Create a ListSelector around the given parent
and return the presenter
:param parent: The parent widget for the selector
:param col_zero_width: The width of the first column
:return: A new presenter that controls the widget
"""
... | [
"def",
"_create_empty_list_selector",
"(",
"parent",
",",
"col_zero_width",
")",
":",
"presenter",
"=",
"ListSelectorPresenter",
"(",
"ListSelectorView",
"(",
"parent",
")",
",",
"{",
"}",
")",
"return",
"presenter"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/results_tab_widget/results_tab_view.py#L163-L173 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | RichTextFileHandler.LoadStream | (*args, **kwargs) | return _richtext.RichTextFileHandler_LoadStream(*args, **kwargs) | LoadStream(self, RichTextBuffer buffer, InputStream stream) -> bool | LoadStream(self, RichTextBuffer buffer, InputStream stream) -> bool | [
"LoadStream",
"(",
"self",
"RichTextBuffer",
"buffer",
"InputStream",
"stream",
")",
"-",
">",
"bool"
] | def LoadStream(*args, **kwargs):
"""LoadStream(self, RichTextBuffer buffer, InputStream stream) -> bool"""
return _richtext.RichTextFileHandler_LoadStream(*args, **kwargs) | [
"def",
"LoadStream",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextFileHandler_LoadStream",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L2752-L2754 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/_vendor/pyparsing.py | python | ParseExpression.leaveWhitespace | ( self ) | return self | Extends C{leaveWhitespace} defined in base class, and also invokes C{leaveWhitespace} on
all contained expressions. | Extends C{leaveWhitespace} defined in base class, and also invokes C{leaveWhitespace} on
all contained expressions. | [
"Extends",
"C",
"{",
"leaveWhitespace",
"}",
"defined",
"in",
"base",
"class",
"and",
"also",
"invokes",
"C",
"{",
"leaveWhitespace",
"}",
"on",
"all",
"contained",
"expressions",
"."
] | def leaveWhitespace( self ):
"""Extends C{leaveWhitespace} defined in base class, and also invokes C{leaveWhitespace} on
all contained expressions."""
self.skipWhitespace = False
self.exprs = [ e.copy() for e in self.exprs ]
for e in self.exprs:
e.leaveWhitespace()... | [
"def",
"leaveWhitespace",
"(",
"self",
")",
":",
"self",
".",
"skipWhitespace",
"=",
"False",
"self",
".",
"exprs",
"=",
"[",
"e",
".",
"copy",
"(",
")",
"for",
"e",
"in",
"self",
".",
"exprs",
"]",
"for",
"e",
"in",
"self",
".",
"exprs",
":",
"e... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/_vendor/pyparsing.py#L3288-L3295 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/arrays/period.py | python | PeriodArray._add_timedeltalike_scalar | (self, other) | return super()._add_timedeltalike_scalar(other) | Parameters
----------
other : timedelta, Tick, np.timedelta64
Returns
-------
PeriodArray | Parameters
----------
other : timedelta, Tick, np.timedelta64 | [
"Parameters",
"----------",
"other",
":",
"timedelta",
"Tick",
"np",
".",
"timedelta64"
] | def _add_timedeltalike_scalar(self, other):
"""
Parameters
----------
other : timedelta, Tick, np.timedelta64
Returns
-------
PeriodArray
"""
if not isinstance(self.freq, Tick):
# We cannot add timedelta-like to non-tick PeriodArray
... | [
"def",
"_add_timedeltalike_scalar",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"freq",
",",
"Tick",
")",
":",
"# We cannot add timedelta-like to non-tick PeriodArray",
"raise",
"raise_on_incompatible",
"(",
"self",
",",
"other"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/arrays/period.py#L744-L766 | |
berndpfrommer/tagslam | 406562abfb27ec0f409d7bd27dd6c45dabd9965d | src/align_trajectories.py | python | align_umeyama | (model, data) | return s, R, t | Implementation of the paper: S. Umeyama, Least-Squares Estimation
of Transformation Parameters Between Two Point Patterns,
IEEE Trans. Pattern Anal. Mach. Intell., vol. 13, no. 4, 1991.
model = s * R * data + t
Input:
model -- first trajectory (nx3), numpy array type
data -- second trajectory (n... | Implementation of the paper: S. Umeyama, Least-Squares Estimation
of Transformation Parameters Between Two Point Patterns,
IEEE Trans. Pattern Anal. Mach. Intell., vol. 13, no. 4, 1991.
model = s * R * data + t
Input:
model -- first trajectory (nx3), numpy array type
data -- second trajectory (n... | [
"Implementation",
"of",
"the",
"paper",
":",
"S",
".",
"Umeyama",
"Least",
"-",
"Squares",
"Estimation",
"of",
"Transformation",
"Parameters",
"Between",
"Two",
"Point",
"Patterns",
"IEEE",
"Trans",
".",
"Pattern",
"Anal",
".",
"Mach",
".",
"Intell",
".",
"v... | def align_umeyama(model, data):
"""Implementation of the paper: S. Umeyama, Least-Squares Estimation
of Transformation Parameters Between Two Point Patterns,
IEEE Trans. Pattern Anal. Mach. Intell., vol. 13, no. 4, 1991.
model = s * R * data + t
Input:
model -- first trajectory (nx3), numpy arra... | [
"def",
"align_umeyama",
"(",
"model",
",",
"data",
")",
":",
"# originally from https://github.com/uzh-rpg/rpg_trajectory_evaluation/",
"# substract mean",
"mu_M",
"=",
"model",
".",
"mean",
"(",
"0",
")",
"mu_D",
"=",
"data",
".",
"mean",
"(",
"0",
")",
"model_ze... | https://github.com/berndpfrommer/tagslam/blob/406562abfb27ec0f409d7bd27dd6c45dabd9965d/src/align_trajectories.py#L22-L59 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/google_appengine_cloudstorage/cloudstorage/cloudstorage_api.py | python | _Bucket._should_get_another_batch | (self, content) | return True | Whether to issue another GET bucket call.
Args:
content: response XML.
Returns:
True if should, also update self._options for the next request.
False otherwise. | Whether to issue another GET bucket call. | [
"Whether",
"to",
"issue",
"another",
"GET",
"bucket",
"call",
"."
] | def _should_get_another_batch(self, content):
"""Whether to issue another GET bucket call.
Args:
content: response XML.
Returns:
True if should, also update self._options for the next request.
False otherwise.
"""
if ('max-keys' in self._options and
self._options['max-key... | [
"def",
"_should_get_another_batch",
"(",
"self",
",",
"content",
")",
":",
"if",
"(",
"'max-keys'",
"in",
"self",
".",
"_options",
"and",
"self",
".",
"_options",
"[",
"'max-keys'",
"]",
"<=",
"common",
".",
"_MAX_GET_BUCKET_RESULT",
")",
":",
"return",
"Fal... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/google_appengine_cloudstorage/cloudstorage/cloudstorage_api.py#L399-L424 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | tools/Pylint/run_pylint.py | python | Results.update | (self, other) | Update this object with results from another | Update this object with results from another | [
"Update",
"this",
"object",
"with",
"results",
"from",
"another"
] | def update(self, other):
"""
Update this object with results from another
"""
self.totalchecks += other.totalchecks
self.failures.extend(other.failures) | [
"def",
"update",
"(",
"self",
",",
"other",
")",
":",
"self",
".",
"totalchecks",
"+=",
"other",
".",
"totalchecks",
"self",
".",
"failures",
".",
"extend",
"(",
"other",
".",
"failures",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/tools/Pylint/run_pylint.py#L103-L108 | ||
microsoft/EdgeML | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | tf/edgeml_tf/trainer/protoNNTrainer.py | python | ProtoNNTrainer.train | (self, batchSize, totalEpochs, sess,
x_train, x_val, y_train, y_val, noInit=False,
redirFile=None, printStep=10, valStep=3) | Performs dense training of ProtoNN followed by iterative hard
thresholding to enforce sparsity constraints.
batchSize: Batch size per update
totalEpochs: The number of epochs to run training for. One epoch is
defined as one pass over the entire training data.
sess: The Tenso... | Performs dense training of ProtoNN followed by iterative hard
thresholding to enforce sparsity constraints. | [
"Performs",
"dense",
"training",
"of",
"ProtoNN",
"followed",
"by",
"iterative",
"hard",
"thresholding",
"to",
"enforce",
"sparsity",
"constraints",
"."
] | def train(self, batchSize, totalEpochs, sess,
x_train, x_val, y_train, y_val, noInit=False,
redirFile=None, printStep=10, valStep=3):
'''
Performs dense training of ProtoNN followed by iterative hard
thresholding to enforce sparsity constraints.
batchSize: Ba... | [
"def",
"train",
"(",
"self",
",",
"batchSize",
",",
"totalEpochs",
",",
"sess",
",",
"x_train",
",",
"x_val",
",",
"y_train",
",",
"y_val",
",",
"noInit",
"=",
"False",
",",
"redirFile",
"=",
"None",
",",
"printStep",
"=",
"10",
",",
"valStep",
"=",
... | https://github.com/microsoft/EdgeML/blob/ef9f8a77f096acbdeb941014791f8eda1c1bc35b/tf/edgeml_tf/trainer/protoNNTrainer.py#L129-L218 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/Execute/ExecuteOptionsPlugin.py | python | ExecuteOptionsPlugin._workingDirChanged | (self) | Slot called when working directory changed. | Slot called when working directory changed. | [
"Slot",
"called",
"when",
"working",
"directory",
"changed",
"."
] | def _workingDirChanged(self):
"""
Slot called when working directory changed.
"""
working = str(self.working_line.text())
self.setWorkingDir(working) | [
"def",
"_workingDirChanged",
"(",
"self",
")",
":",
"working",
"=",
"str",
"(",
"self",
".",
"working_line",
".",
"text",
"(",
")",
")",
"self",
".",
"setWorkingDir",
"(",
"working",
")"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/Execute/ExecuteOptionsPlugin.py#L210-L215 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | xpathParserContext.xpathCeilingFunction | (self, nargs) | Implement the ceiling() XPath function number
ceiling(number) The ceiling function returns the smallest
(closest to negative infinity) number that is not less than
the argument and that is an integer. | Implement the ceiling() XPath function number
ceiling(number) The ceiling function returns the smallest
(closest to negative infinity) number that is not less than
the argument and that is an integer. | [
"Implement",
"the",
"ceiling",
"()",
"XPath",
"function",
"number",
"ceiling",
"(",
"number",
")",
"The",
"ceiling",
"function",
"returns",
"the",
"smallest",
"(",
"closest",
"to",
"negative",
"infinity",
")",
"number",
"that",
"is",
"not",
"less",
"than",
"... | def xpathCeilingFunction(self, nargs):
"""Implement the ceiling() XPath function number
ceiling(number) The ceiling function returns the smallest
(closest to negative infinity) number that is not less than
the argument and that is an integer. """
libxml2mod.xmlXPathCeiling... | [
"def",
"xpathCeilingFunction",
"(",
"self",
",",
"nargs",
")",
":",
"libxml2mod",
".",
"xmlXPathCeilingFunction",
"(",
"self",
".",
"_o",
",",
"nargs",
")"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L7451-L7456 | ||
kevinlin311tw/Caffe-DeepBinaryCode | 9eaa7662be47d49f475ecbeea2bd51be105270d2 | scripts/cpp_lint.py | python | CheckSpacing | (filename, clean_lines, linenum, nesting_state, error) | Checks for the correctness of various spacing issues in the code.
Things we check for: spaces around operators, spaces after
if/for/while/switch, no spaces around parens in function calls, two
spaces between code and comment, don't start a block with a blank
line, don't end a function with a blank line, don't ... | Checks for the correctness of various spacing issues in the code. | [
"Checks",
"for",
"the",
"correctness",
"of",
"various",
"spacing",
"issues",
"in",
"the",
"code",
"."
] | def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
"""Checks for the correctness of various spacing issues in the code.
Things we check for: spaces around operators, spaces after
if/for/while/switch, no spaces around parens in function calls, two
spaces between code and comment, don't star... | [
"def",
"CheckSpacing",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"# Don't use \"elided\" lines here, otherwise we can't check commented lines.",
"# Don't want to use \"raw\" either, because we don't want to check inside C++11",
... | https://github.com/kevinlin311tw/Caffe-DeepBinaryCode/blob/9eaa7662be47d49f475ecbeea2bd51be105270d2/scripts/cpp_lint.py#L2643-L2988 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/logging/handlers.py | python | QueueListener.prepare | (self, record) | return record | Prepare a record for handling.
This method just returns the passed-in record. You may want to
override this method if you need to do any custom marshalling or
manipulation of the record before passing it to the handlers. | Prepare a record for handling. | [
"Prepare",
"a",
"record",
"for",
"handling",
"."
] | def prepare(self, record):
"""
Prepare a record for handling.
This method just returns the passed-in record. You may want to
override this method if you need to do any custom marshalling or
manipulation of the record before passing it to the handlers.
"""
return ... | [
"def",
"prepare",
"(",
"self",
",",
"record",
")",
":",
"return",
"record"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/logging/handlers.py#L1499-L1507 | |
SoarGroup/Soar | a1c5e249499137a27da60533c72969eef3b8ab6b | scons/scons-local-4.1.0/SCons/Node/FS.py | python | FS.PyPackageDir | (self, modulename) | return self._lookup(dirpath, None, Dir, True) | r"""Locate the directory of a given python module name
For example scons might resolve to
Windows: C:\Python27\Lib\site-packages\scons-2.5.1
Linux: /usr/lib/scons
This can be useful when we want to determine a toolpath based on a python module name | r"""Locate the directory of a given python module name | [
"r",
"Locate",
"the",
"directory",
"of",
"a",
"given",
"python",
"module",
"name"
] | def PyPackageDir(self, modulename):
r"""Locate the directory of a given python module name
For example scons might resolve to
Windows: C:\Python27\Lib\site-packages\scons-2.5.1
Linux: /usr/lib/scons
This can be useful when we want to determine a toolpath based on a python modul... | [
"def",
"PyPackageDir",
"(",
"self",
",",
"modulename",
")",
":",
"dirpath",
"=",
"''",
"# Python3 Code",
"modspec",
"=",
"importlib",
".",
"util",
".",
"find_spec",
"(",
"modulename",
")",
"dirpath",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"modspec",
... | https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/Node/FS.py#L1436-L1450 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/multi.py | python | MultiIndex._get_loc_single_level_index | (self, level_index: Index, key: Hashable) | If key is NA value, location of index unify as -1.
Parameters
----------
level_index: Index
key : label
Returns
-------
loc : int
If key is NA value, loc is -1
Else, location of key in index.
See Also
--------
Ind... | If key is NA value, location of index unify as -1. | [
"If",
"key",
"is",
"NA",
"value",
"location",
"of",
"index",
"unify",
"as",
"-",
"1",
"."
] | def _get_loc_single_level_index(self, level_index: Index, key: Hashable) -> int:
"""
If key is NA value, location of index unify as -1.
Parameters
----------
level_index: Index
key : label
Returns
-------
loc : int
If key is NA value,... | [
"def",
"_get_loc_single_level_index",
"(",
"self",
",",
"level_index",
":",
"Index",
",",
"key",
":",
"Hashable",
")",
"->",
"int",
":",
"if",
"is_scalar",
"(",
"key",
")",
"and",
"isna",
"(",
"key",
")",
":",
"return",
"-",
"1",
"else",
":",
"return",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/multi.py#L2575-L2598 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/backend.py | python | _get_current_tf_device | () | Return explicit device of current context, otherwise returns `None`.
Returns:
If the current device scope is explicitly set, it returns a string with
the device (`CPU` or `GPU`). If the scope is not explicitly set, it will
return `None`. | Return explicit device of current context, otherwise returns `None`. | [
"Return",
"explicit",
"device",
"of",
"current",
"context",
"otherwise",
"returns",
"None",
"."
] | def _get_current_tf_device():
"""Return explicit device of current context, otherwise returns `None`.
Returns:
If the current device scope is explicitly set, it returns a string with
the device (`CPU` or `GPU`). If the scope is not explicitly set, it will
return `None`.
"""
graph = get_graph(... | [
"def",
"_get_current_tf_device",
"(",
")",
":",
"graph",
"=",
"get_graph",
"(",
")",
"op",
"=",
"_TfDeviceCaptureOp",
"(",
")",
"graph",
".",
"_apply_device_functions",
"(",
"op",
")",
"if",
"tf2",
".",
"enabled",
"(",
")",
":",
"return",
"device_spec",
".... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/backend.py#L856-L870 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/ndlstm/python/lstm2d.py | python | reduce_to_final | (images, num_filters_out, nhidden=None, scope=None) | Reduce an image to a final state by running two LSTMs.
Args:
images: (num_images, height, width, depth) tensor
num_filters_out: output layer depth
nhidden: hidden layer depth (defaults to num_filters_out)
scope: optional scope name
Returns:
A (num_images, num_filters_out) batch. | Reduce an image to a final state by running two LSTMs. | [
"Reduce",
"an",
"image",
"to",
"a",
"final",
"state",
"by",
"running",
"two",
"LSTMs",
"."
] | def reduce_to_final(images, num_filters_out, nhidden=None, scope=None):
"""Reduce an image to a final state by running two LSTMs.
Args:
images: (num_images, height, width, depth) tensor
num_filters_out: output layer depth
nhidden: hidden layer depth (defaults to num_filters_out)
scope: optional sco... | [
"def",
"reduce_to_final",
"(",
"images",
",",
"num_filters_out",
",",
"nhidden",
"=",
"None",
",",
"scope",
"=",
"None",
")",
":",
"with",
"variable_scope",
".",
"variable_scope",
"(",
"scope",
",",
"\"ReduceToFinal\"",
",",
"[",
"images",
"]",
")",
":",
"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/ndlstm/python/lstm2d.py#L188-L213 | ||
lighttransport/nanort | 74063967336311f54ede5dffdfa242123825033b | deps/cpplint.py | python | NestingState.InnermostClass | (self) | return None | Get class info on the top of the stack.
Returns:
A _ClassInfo object if we are inside a class, or None otherwise. | Get class info on the top of the stack. | [
"Get",
"class",
"info",
"on",
"the",
"top",
"of",
"the",
"stack",
"."
] | def InnermostClass(self):
"""Get class info on the top of the stack.
Returns:
A _ClassInfo object if we are inside a class, or None otherwise.
"""
for i in range(len(self.stack), 0, -1):
classinfo = self.stack[i - 1]
if isinstance(classinfo, _ClassInfo):
return classinfo
r... | [
"def",
"InnermostClass",
"(",
"self",
")",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"stack",
")",
",",
"0",
",",
"-",
"1",
")",
":",
"classinfo",
"=",
"self",
".",
"stack",
"[",
"i",
"-",
"1",
"]",
"if",
"isinstance",
"(",
... | https://github.com/lighttransport/nanort/blob/74063967336311f54ede5dffdfa242123825033b/deps/cpplint.py#L2539-L2549 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/thumbnailctrl.py | python | ScrolledThumbnail.GetItemIndex | (self, x, y) | return index | Returns the thumbnail index at position (x, y).
:param `x`: the mouse `x` position;
:param `y`: the mouse `y` position. | Returns the thumbnail index at position (x, y). | [
"Returns",
"the",
"thumbnail",
"index",
"at",
"position",
"(",
"x",
"y",
")",
"."
] | def GetItemIndex(self, x, y):
"""
Returns the thumbnail index at position (x, y).
:param `x`: the mouse `x` position;
:param `y`: the mouse `y` position.
"""
col = (x - self._tBorder)/(self._tWidth + self._tBorder)
if col >= self._cols:
col ... | [
"def",
"GetItemIndex",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"col",
"=",
"(",
"x",
"-",
"self",
".",
"_tBorder",
")",
"/",
"(",
"self",
".",
"_tWidth",
"+",
"self",
".",
"_tBorder",
")",
"if",
"col",
">=",
"self",
".",
"_cols",
":",
"col",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/thumbnailctrl.py#L1793-L1822 | |
AutoRally/autorally | 48bae14fe4b2d56e5ca11fd2fec3d7dfac7a0e75 | autorally_gazebo/nodes/autorally_controller.py | python | AutoRallyCtrlr.__init__ | (self, namespace='controller_manager') | Initialize this _AutoRallyCtrlr. | Initialize this _AutoRallyCtrlr. | [
"Initialize",
"this",
"_AutoRallyCtrlr",
"."
] | def __init__(self, namespace='controller_manager'):
"""Initialize this _AutoRallyCtrlr."""
rospy.init_node("autorally_controller")
# Parameters
# Wheels
(left_steer_link_name, left_steer_ctrlr_name,
left_front_axle_ctrlr_name, self._left_front_inv_circ) = \
self._get_front... | [
"def",
"__init__",
"(",
"self",
",",
"namespace",
"=",
"'controller_manager'",
")",
":",
"rospy",
".",
"init_node",
"(",
"\"autorally_controller\"",
")",
"# Parameters",
"# Wheels",
"(",
"left_steer_link_name",
",",
"left_steer_ctrlr_name",
",",
"left_front_axle_ctrlr_n... | https://github.com/AutoRally/autorally/blob/48bae14fe4b2d56e5ca11fd2fec3d7dfac7a0e75/autorally_gazebo/nodes/autorally_controller.py#L141-L312 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | EventLoopBase.YieldFor | (*args, **kwargs) | return _core_.EventLoopBase_YieldFor(*args, **kwargs) | YieldFor(self, long eventsToProcess) -> bool | YieldFor(self, long eventsToProcess) -> bool | [
"YieldFor",
"(",
"self",
"long",
"eventsToProcess",
")",
"-",
">",
"bool"
] | def YieldFor(*args, **kwargs):
"""YieldFor(self, long eventsToProcess) -> bool"""
return _core_.EventLoopBase_YieldFor(*args, **kwargs) | [
"def",
"YieldFor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"EventLoopBase_YieldFor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L8820-L8822 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.