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/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py | python | FormulaProcessor.processcontents | (self, bit) | Process the contents of a formula bit. | Process the contents of a formula bit. | [
"Process",
"the",
"contents",
"of",
"a",
"formula",
"bit",
"."
] | def processcontents(self, bit):
"Process the contents of a formula bit."
if not isinstance(bit, FormulaBit):
return
bit.process()
for element in bit.contents:
self.processcontents(element) | [
"def",
"processcontents",
"(",
"self",
",",
"bit",
")",
":",
"if",
"not",
"isinstance",
"(",
"bit",
",",
"FormulaBit",
")",
":",
"return",
"bit",
".",
"process",
"(",
")",
"for",
"element",
"in",
"bit",
".",
"contents",
":",
"self",
".",
"processconten... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py#L2860-L2866 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/training/supervisor.py | python | Supervisor._init_local_init_op | (self, local_init_op=USE_DEFAULT) | Initializes local_init_op.
Args:
local_init_op: `Operation` run for every new supervisor instance. If set
to USE_DEFAULT, use the first op from the GraphKeys.LOCAL_INIT_OP
collection. If the collection is empty, create an op that initializes
all local variables and all tables. | Initializes local_init_op. | [
"Initializes",
"local_init_op",
"."
] | def _init_local_init_op(self, local_init_op=USE_DEFAULT):
"""Initializes local_init_op.
Args:
local_init_op: `Operation` run for every new supervisor instance. If set
to USE_DEFAULT, use the first op from the GraphKeys.LOCAL_INIT_OP
collection. If the collection is empty, create an op that initializes
all local variables and all tables.
"""
if local_init_op is Supervisor.USE_DEFAULT:
local_init_op = self._get_first_op_from_collection(
ops.GraphKeys.LOCAL_INIT_OP)
if local_init_op is None:
op_list = [variables.initialize_local_variables(),
data_flow_ops.initialize_all_tables()]
if op_list:
local_init_op = control_flow_ops.group(*op_list)
ops.add_to_collection(ops.GraphKeys.LOCAL_INIT_OP, local_init_op)
self._local_init_op = local_init_op | [
"def",
"_init_local_init_op",
"(",
"self",
",",
"local_init_op",
"=",
"USE_DEFAULT",
")",
":",
"if",
"local_init_op",
"is",
"Supervisor",
".",
"USE_DEFAULT",
":",
"local_init_op",
"=",
"self",
".",
"_get_first_op_from_collection",
"(",
"ops",
".",
"GraphKeys",
"."... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/training/supervisor.py#L392-L410 | ||
sailing-pmls/bosen | 06cb58902d011fbea5f9428f10ce30e621492204 | style_script/cpplint.py | python | _FunctionState.Count | (self) | Count line in current function body. | Count line in current function body. | [
"Count",
"line",
"in",
"current",
"function",
"body",
"."
] | def Count(self):
"""Count line in current function body."""
if self.in_a_function:
self.lines_in_function += 1 | [
"def",
"Count",
"(",
"self",
")",
":",
"if",
"self",
".",
"in_a_function",
":",
"self",
".",
"lines_in_function",
"+=",
"1"
] | https://github.com/sailing-pmls/bosen/blob/06cb58902d011fbea5f9428f10ce30e621492204/style_script/cpplint.py#L934-L937 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/odr/odrpack.py | python | Model.__getattr__ | (self, attr) | Dispatch attribute access to the metadata. | Dispatch attribute access to the metadata. | [
"Dispatch",
"attribute",
"access",
"to",
"the",
"metadata",
"."
] | def __getattr__(self, attr):
""" Dispatch attribute access to the metadata.
"""
if attr in self.meta:
return self.meta[attr]
else:
raise AttributeError("'%s' not in metadata" % attr) | [
"def",
"__getattr__",
"(",
"self",
",",
"attr",
")",
":",
"if",
"attr",
"in",
"self",
".",
"meta",
":",
"return",
"self",
".",
"meta",
"[",
"attr",
"]",
"else",
":",
"raise",
"AttributeError",
"(",
"\"'%s' not in metadata\"",
"%",
"attr",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/odr/odrpack.py#L535-L542 | ||
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | RecoVertex/BeamSpotProducer/scripts/CommonMethods.py | python | unpackLumiid | (i) | return {'run':j[0],'lumisection':j[1]} | unpack 64bit lumiid to dictionary {'run','lumisection'} | unpack 64bit lumiid to dictionary {'run','lumisection'} | [
"unpack",
"64bit",
"lumiid",
"to",
"dictionary",
"{",
"run",
"lumisection",
"}"
] | def unpackLumiid(i):
"""unpack 64bit lumiid to dictionary {'run','lumisection'}
"""
j=unpack(i)
return {'run':j[0],'lumisection':j[1]} | [
"def",
"unpackLumiid",
"(",
"i",
")",
":",
"j",
"=",
"unpack",
"(",
"i",
")",
"return",
"{",
"'run'",
":",
"j",
"[",
"0",
"]",
",",
"'lumisection'",
":",
"j",
"[",
"1",
"]",
"}"
] | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/RecoVertex/BeamSpotProducer/scripts/CommonMethods.py#L245-L249 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | ppapi/generators/idl_thunk.py | python | _GetShortName | (interface, filter_suffixes) | return ''.join(parts) | Return a shorter interface name that matches Is* and Create* functions. | Return a shorter interface name that matches Is* and Create* functions. | [
"Return",
"a",
"shorter",
"interface",
"name",
"that",
"matches",
"Is",
"*",
"and",
"Create",
"*",
"functions",
"."
] | def _GetShortName(interface, filter_suffixes):
"""Return a shorter interface name that matches Is* and Create* functions."""
parts = interface.GetName().split('_')[1:]
tail = parts[len(parts) - 1]
if tail in filter_suffixes:
parts = parts[:-1]
return ''.join(parts) | [
"def",
"_GetShortName",
"(",
"interface",
",",
"filter_suffixes",
")",
":",
"parts",
"=",
"interface",
".",
"GetName",
"(",
")",
".",
"split",
"(",
"'_'",
")",
"[",
"1",
":",
"]",
"tail",
"=",
"parts",
"[",
"len",
"(",
"parts",
")",
"-",
"1",
"]",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/ppapi/generators/idl_thunk.py#L153-L159 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/subprocess.py | python | list2cmdline | (seq) | return ''.join(result) | Translate a sequence of arguments into a command line
string, using the same rules as the MS C runtime:
1) Arguments are delimited by white space, which is either a
space or a tab.
2) A string surrounded by double quotation marks is
interpreted as a single argument, regardless of white space
contained within. A quoted string can be embedded in an
argument.
3) A double quotation mark preceded by a backslash is
interpreted as a literal double quotation mark.
4) Backslashes are interpreted literally, unless they
immediately precede a double quotation mark.
5) If backslashes immediately precede a double quotation mark,
every pair of backslashes is interpreted as a literal
backslash. If the number of backslashes is odd, the last
backslash escapes the next double quotation mark as
described in rule 3. | Translate a sequence of arguments into a command line
string, using the same rules as the MS C runtime: | [
"Translate",
"a",
"sequence",
"of",
"arguments",
"into",
"a",
"command",
"line",
"string",
"using",
"the",
"same",
"rules",
"as",
"the",
"MS",
"C",
"runtime",
":"
] | def list2cmdline(seq):
"""
Translate a sequence of arguments into a command line
string, using the same rules as the MS C runtime:
1) Arguments are delimited by white space, which is either a
space or a tab.
2) A string surrounded by double quotation marks is
interpreted as a single argument, regardless of white space
contained within. A quoted string can be embedded in an
argument.
3) A double quotation mark preceded by a backslash is
interpreted as a literal double quotation mark.
4) Backslashes are interpreted literally, unless they
immediately precede a double quotation mark.
5) If backslashes immediately precede a double quotation mark,
every pair of backslashes is interpreted as a literal
backslash. If the number of backslashes is odd, the last
backslash escapes the next double quotation mark as
described in rule 3.
"""
# See
# http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
# or search http://msdn.microsoft.com for
# "Parsing C++ Command-Line Arguments"
result = []
needquote = False
for arg in seq:
bs_buf = []
# Add a space to separate this argument from the others
if result:
result.append(' ')
needquote = (" " in arg) or ("\t" in arg) or not arg
if needquote:
result.append('"')
for c in arg:
if c == '\\':
# Don't know if we need to double yet.
bs_buf.append(c)
elif c == '"':
# Double backslashes.
result.append('\\' * len(bs_buf)*2)
bs_buf = []
result.append('\\"')
else:
# Normal char
if bs_buf:
result.extend(bs_buf)
bs_buf = []
result.append(c)
# Add remaining backslashes, if any.
if bs_buf:
result.extend(bs_buf)
if needquote:
result.extend(bs_buf)
result.append('"')
return ''.join(result) | [
"def",
"list2cmdline",
"(",
"seq",
")",
":",
"# See",
"# http://msdn.microsoft.com/en-us/library/17w5ykft.aspx",
"# or search http://msdn.microsoft.com for",
"# \"Parsing C++ Command-Line Arguments\"",
"result",
"=",
"[",
"]",
"needquote",
"=",
"False",
"for",
"arg",
"in",
"s... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/subprocess.py#L516-L583 | |
BSVino/DoubleAction | c550b168a3e919926c198c30240f506538b92e75 | mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/decoder.py | python | BytesDecoder | (field_number, is_repeated, is_packed, key, new_default) | Returns a decoder for a bytes field. | Returns a decoder for a bytes field. | [
"Returns",
"a",
"decoder",
"for",
"a",
"bytes",
"field",
"."
] | def BytesDecoder(field_number, is_repeated, is_packed, key, new_default):
"""Returns a decoder for a bytes field."""
local_DecodeVarint = _DecodeVarint
assert not is_packed
if is_repeated:
tag_bytes = encoder.TagBytes(field_number,
wire_format.WIRETYPE_LENGTH_DELIMITED)
tag_len = len(tag_bytes)
def DecodeRepeatedField(buffer, pos, end, message, field_dict):
value = field_dict.get(key)
if value is None:
value = field_dict.setdefault(key, new_default(message))
while 1:
(size, pos) = local_DecodeVarint(buffer, pos)
new_pos = pos + size
if new_pos > end:
raise _DecodeError('Truncated string.')
value.append(buffer[pos:new_pos])
# Predict that the next tag is another copy of the same repeated field.
pos = new_pos + tag_len
if buffer[new_pos:pos] != tag_bytes or new_pos == end:
# Prediction failed. Return.
return new_pos
return DecodeRepeatedField
else:
def DecodeField(buffer, pos, end, message, field_dict):
(size, pos) = local_DecodeVarint(buffer, pos)
new_pos = pos + size
if new_pos > end:
raise _DecodeError('Truncated string.')
field_dict[key] = buffer[pos:new_pos]
return new_pos
return DecodeField | [
"def",
"BytesDecoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
",",
"key",
",",
"new_default",
")",
":",
"local_DecodeVarint",
"=",
"_DecodeVarint",
"assert",
"not",
"is_packed",
"if",
"is_repeated",
":",
"tag_bytes",
"=",
"encoder",
".",
"Tag... | https://github.com/BSVino/DoubleAction/blob/c550b168a3e919926c198c30240f506538b92e75/mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/decoder.py#L342-L376 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/tools/gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.ComputeExportEnvString | (self, env) | return ' '.join(export_str) | Given an environment, returns a string looking like
'export FOO=foo; export BAR="${FOO} bar;'
that exports |env| to the shell. | Given an environment, returns a string looking like
'export FOO=foo; export BAR="${FOO} bar;'
that exports |env| to the shell. | [
"Given",
"an",
"environment",
"returns",
"a",
"string",
"looking",
"like",
"export",
"FOO",
"=",
"foo",
";",
"export",
"BAR",
"=",
"$",
"{",
"FOO",
"}",
"bar",
";",
"that",
"exports",
"|env|",
"to",
"the",
"shell",
"."
] | def ComputeExportEnvString(self, env):
"""Given an environment, returns a string looking like
'export FOO=foo; export BAR="${FOO} bar;'
that exports |env| to the shell."""
export_str = []
for k, v in env:
export_str.append('export %s=%s;' %
(k, ninja_syntax.escape(gyp.common.EncodePOSIXShellArgument(v))))
return ' '.join(export_str) | [
"def",
"ComputeExportEnvString",
"(",
"self",
",",
"env",
")",
":",
"export_str",
"=",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"env",
":",
"export_str",
".",
"append",
"(",
"'export %s=%s;'",
"%",
"(",
"k",
",",
"ninja_syntax",
".",
"escape",
"(",
"gyp",... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/tools/gyp/pylib/gyp/generator/ninja.py#L1467-L1475 | |
mysql/mysql-workbench | 2f35f9034f015cbcd22139a60e1baa2e3e8e795c | modules/db.sybase/db_sybase_re_grt.py | python | join_multiline_content | (name_column, split_column, cursor, callback=lambda _:None) | Generator to join definition columns that are split across several rows
In Sybase, object definitions in syscomments can be split into several rows. For example,
a stored procedure can have several row entries in syscomments each having the same object
name and containing the chunks of the procedure's code in the "text" column. The order of
the rows is determined by the "colid" value (a sequence of integers: 1, 2, 3, etc.).
Arguments: name_column -- string with the name of the column that has the object name
split_column -- string with the name of the column that has the fragments
cursor -- the resultset to iterate through
callback -- an optional callable that will be called with the row corresponding
to the first row of each distinct object
Returns: idx, name, definition where idx tracks the count of different objects as they are
found, name is the name of the current object and definition is the joint definition for the
object.
Note: This functions assumes that the rows are ordered properly, i.e. sorted by name, colid. | Generator to join definition columns that are split across several rows | [
"Generator",
"to",
"join",
"definition",
"columns",
"that",
"are",
"split",
"across",
"several",
"rows"
] | def join_multiline_content(name_column, split_column, cursor, callback=lambda _:None):
"""Generator to join definition columns that are split across several rows
In Sybase, object definitions in syscomments can be split into several rows. For example,
a stored procedure can have several row entries in syscomments each having the same object
name and containing the chunks of the procedure's code in the "text" column. The order of
the rows is determined by the "colid" value (a sequence of integers: 1, 2, 3, etc.).
Arguments: name_column -- string with the name of the column that has the object name
split_column -- string with the name of the column that has the fragments
cursor -- the resultset to iterate through
callback -- an optional callable that will be called with the row corresponding
to the first row of each distinct object
Returns: idx, name, definition where idx tracks the count of different objects as they are
found, name is the name of the current object and definition is the joint definition for the
object.
Note: This functions assumes that the rows are ordered properly, i.e. sorted by name, colid.
"""
idx = 0
current_object = None
current_object_chunks = []
column_index = dict( (col_description[0], pos) for pos, col_description in enumerate(cursor.description) )
for row in cursor:
object_name, object_definition = row[column_index[name_column]], row[column_index[split_column]]
if not current_object or object_name != current_object:
callback(row)
if current_object:
yield idx, current_object, ''.join(current_object_chunks)
current_object = object_name
current_object_chunks = [object_definition]
idx += 1
continue
current_object_chunks.append(object_definition)
# Add the code of the last object:
if current_object:
yield idx, current_object, ''.join(current_object_chunks) | [
"def",
"join_multiline_content",
"(",
"name_column",
",",
"split_column",
",",
"cursor",
",",
"callback",
"=",
"lambda",
"_",
":",
"None",
")",
":",
"idx",
"=",
"0",
"current_object",
"=",
"None",
"current_object_chunks",
"=",
"[",
"]",
"column_index",
"=",
... | https://github.com/mysql/mysql-workbench/blob/2f35f9034f015cbcd22139a60e1baa2e3e8e795c/modules/db.sybase/db_sybase_re_grt.py#L111-L148 | ||
facebookresearch/TensorComprehensions | fd014435ab384847e7400eac15bf87b3dcccddf0 | tensor_comprehensions/__init__.py | python | assert_almost_equal | (actual : torch.Tensor,
expected : torch.Tensor,
*inputs : torch.Tensor,
operations: Optional[int] = 1,
precision: Optional[float] = 1e-7) | r"""Asserts numerical precision requirements.
:param actual: the PyTorch Tensor to check.
:param expected: the expected PyTorch Tensor.
:param inputs: PyTorch Tensors passed as inputs to the TC that produced the
actual Tensor.
:param operations: maximum number of iterated operations per produced value.
This is used to compute the required absolute precision.
:param precision: relative precision at which to check. | r"""Asserts numerical precision requirements. | [
"r",
"Asserts",
"numerical",
"precision",
"requirements",
"."
] | def assert_almost_equal(actual : torch.Tensor,
expected : torch.Tensor,
*inputs : torch.Tensor,
operations: Optional[int] = 1,
precision: Optional[float] = 1e-7):
r"""Asserts numerical precision requirements.
:param actual: the PyTorch Tensor to check.
:param expected: the expected PyTorch Tensor.
:param inputs: PyTorch Tensors passed as inputs to the TC that produced the
actual Tensor.
:param operations: maximum number of iterated operations per produced value.
This is used to compute the required absolute precision.
:param precision: relative precision at which to check.
"""
diff = actual - expected
max_value = 0.0
for inp in inputs:
max_value = max(float(inp.abs().max()), max_value)
max_diff = float(diff.abs().max())
assert max_diff <= operations * precision * max_value, (
("error at relative precision: {}, #operations: {}, " +
"max_value: {}, max_diff: {}").format(
precision, operations, max_value, max_diff)
) | [
"def",
"assert_almost_equal",
"(",
"actual",
":",
"torch",
".",
"Tensor",
",",
"expected",
":",
"torch",
".",
"Tensor",
",",
"*",
"inputs",
":",
"torch",
".",
"Tensor",
",",
"operations",
":",
"Optional",
"[",
"int",
"]",
"=",
"1",
",",
"precision",
":... | https://github.com/facebookresearch/TensorComprehensions/blob/fd014435ab384847e7400eac15bf87b3dcccddf0/tensor_comprehensions/__init__.py#L47-L71 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/idl_parser/idl_ppapi_parser.py | python | IDLPPAPIParser.p_EnumValueList | (self, p) | EnumValueList : EnumValue EnumValues | EnumValueList : EnumValue EnumValues | [
"EnumValueList",
":",
"EnumValue",
"EnumValues"
] | def p_EnumValueList(self, p):
"""EnumValueList : EnumValue EnumValues"""
p[0] = ListFromConcat(p[1], p[2]) | [
"def",
"p_EnumValueList",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"ListFromConcat",
"(",
"p",
"[",
"1",
"]",
",",
"p",
"[",
"2",
"]",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/idl_parser/idl_ppapi_parser.py#L157-L159 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/propgrid.py | python | PropertyGrid.GenerateEditorTextCtrl | (*args, **kwargs) | return _propgrid.PropertyGrid_GenerateEditorTextCtrl(*args, **kwargs) | GenerateEditorTextCtrl(self, Point pos, Size sz, String value, Window secondary,
int extraStyle=0, int maxLen=0, int forColumn=1) -> Window | GenerateEditorTextCtrl(self, Point pos, Size sz, String value, Window secondary,
int extraStyle=0, int maxLen=0, int forColumn=1) -> Window | [
"GenerateEditorTextCtrl",
"(",
"self",
"Point",
"pos",
"Size",
"sz",
"String",
"value",
"Window",
"secondary",
"int",
"extraStyle",
"=",
"0",
"int",
"maxLen",
"=",
"0",
"int",
"forColumn",
"=",
"1",
")",
"-",
">",
"Window"
] | def GenerateEditorTextCtrl(*args, **kwargs):
"""
GenerateEditorTextCtrl(self, Point pos, Size sz, String value, Window secondary,
int extraStyle=0, int maxLen=0, int forColumn=1) -> Window
"""
return _propgrid.PropertyGrid_GenerateEditorTextCtrl(*args, **kwargs) | [
"def",
"GenerateEditorTextCtrl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGrid_GenerateEditorTextCtrl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L2347-L2352 | |
raymondlu/super-animation-samples | 04234269112ff0dc32447f27a761dbbb00b8ba17 | samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py | python | Cursor.hash | (self) | return self._hash | Returns a hash of the cursor as an int. | Returns a hash of the cursor as an int. | [
"Returns",
"a",
"hash",
"of",
"the",
"cursor",
"as",
"an",
"int",
"."
] | def hash(self):
"""Returns a hash of the cursor as an int."""
if not hasattr(self, '_hash'):
self._hash = conf.lib.clang_hashCursor(self)
return self._hash | [
"def",
"hash",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_hash'",
")",
":",
"self",
".",
"_hash",
"=",
"conf",
".",
"lib",
".",
"clang_hashCursor",
"(",
"self",
")",
"return",
"self",
".",
"_hash"
] | https://github.com/raymondlu/super-animation-samples/blob/04234269112ff0dc32447f27a761dbbb00b8ba17/samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py#L1244-L1249 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/aui.py | python | AuiManager.InsertPane | (*args, **kwargs) | return _aui.AuiManager_InsertPane(*args, **kwargs) | InsertPane(self, Window window, AuiPaneInfo insertLocation, int insertLevel=AUI_INSERT_PANE) -> bool | InsertPane(self, Window window, AuiPaneInfo insertLocation, int insertLevel=AUI_INSERT_PANE) -> bool | [
"InsertPane",
"(",
"self",
"Window",
"window",
"AuiPaneInfo",
"insertLocation",
"int",
"insertLevel",
"=",
"AUI_INSERT_PANE",
")",
"-",
">",
"bool"
] | def InsertPane(*args, **kwargs):
"""InsertPane(self, Window window, AuiPaneInfo insertLocation, int insertLevel=AUI_INSERT_PANE) -> bool"""
return _aui.AuiManager_InsertPane(*args, **kwargs) | [
"def",
"InsertPane",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiManager_InsertPane",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/aui.py#L651-L653 | |
tensorflow/deepmath | b5b721f54de1d5d6a02d78f5da5995237f9995f9 | deepmath/deephol/theorem_fingerprint.py | python | Fingerprint | (theorem) | return result | Compute a unique, stable fingerprint for theorem objects.
Args:
theorem: proof_assistant_pb2.Theorem object
Returns:
62 bit non-negative integer fingerprint. Note that we truncate to 62 bits
for OCaml compatibility. OCaml uses 63 bit signed integers. | Compute a unique, stable fingerprint for theorem objects. | [
"Compute",
"a",
"unique",
"stable",
"fingerprint",
"for",
"theorem",
"objects",
"."
] | def Fingerprint(theorem):
"""Compute a unique, stable fingerprint for theorem objects.
Args:
theorem: proof_assistant_pb2.Theorem object
Returns:
62 bit non-negative integer fingerprint. Note that we truncate to 62 bits
for OCaml compatibility. OCaml uses 63 bit signed integers.
"""
if not theorem.HasField('conclusion') and theorem.HasField('fingerprint'):
return theorem.fingerprint
fp = farmhash.fingerprint64(theorem.conclusion)
for hypothesis in theorem.hypotheses:
tmp = farmhash.fingerprint64(hypothesis)
fp = _PairFingerprint(fp, tmp)
result = fp & MASK62
assert (not theorem.HasField('fingerprint') or
theorem.fingerprint == result), (
'Inconsistent fingerprints %d != %d in Theorem protobuf.' %
(result, theorem.fingerprint))
return result | [
"def",
"Fingerprint",
"(",
"theorem",
")",
":",
"if",
"not",
"theorem",
".",
"HasField",
"(",
"'conclusion'",
")",
"and",
"theorem",
".",
"HasField",
"(",
"'fingerprint'",
")",
":",
"return",
"theorem",
".",
"fingerprint",
"fp",
"=",
"farmhash",
".",
"fing... | https://github.com/tensorflow/deepmath/blob/b5b721f54de1d5d6a02d78f5da5995237f9995f9/deepmath/deephol/theorem_fingerprint.py#L37-L58 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | MemoryFSHandler.__init__ | (self, *args, **kwargs) | __init__(self) -> MemoryFSHandler | __init__(self) -> MemoryFSHandler | [
"__init__",
"(",
"self",
")",
"-",
">",
"MemoryFSHandler"
] | def __init__(self, *args, **kwargs):
"""__init__(self) -> MemoryFSHandler"""
_core_.MemoryFSHandler_swiginit(self,_core_.new_MemoryFSHandler(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_core_",
".",
"MemoryFSHandler_swiginit",
"(",
"self",
",",
"_core_",
".",
"new_MemoryFSHandler",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L2560-L2562 | ||
SIPp/sipp | f44d0cf5dec0013eff8fd7b4da885d455aa82e0e | cpplint.py | python | ProcessLine | (filename, file_extension, clean_lines, line,
include_state, function_state, nesting_state, error,
extra_check_functions=[]) | Processes a single line in the file.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
clean_lines: An array of strings, each representing a line of the file,
with comments stripped.
line: Number of line being processed.
include_state: An _IncludeState instance in which the headers are inserted.
function_state: A _FunctionState instance which counts function lines, etc.
nesting_state: A _NestingState instance which maintains information about
the current stack of nested blocks being parsed.
error: A callable to which errors are reported, which takes 4 arguments:
filename, line number, error level, and message
extra_check_functions: An array of additional check functions that will be
run on each source line. Each function takes 4
arguments: filename, clean_lines, line, error | Processes a single line in the file. | [
"Processes",
"a",
"single",
"line",
"in",
"the",
"file",
"."
] | def ProcessLine(filename, file_extension, clean_lines, line,
include_state, function_state, nesting_state, error,
extra_check_functions=[]):
"""Processes a single line in the file.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
clean_lines: An array of strings, each representing a line of the file,
with comments stripped.
line: Number of line being processed.
include_state: An _IncludeState instance in which the headers are inserted.
function_state: A _FunctionState instance which counts function lines, etc.
nesting_state: A _NestingState instance which maintains information about
the current stack of nested blocks being parsed.
error: A callable to which errors are reported, which takes 4 arguments:
filename, line number, error level, and message
extra_check_functions: An array of additional check functions that will be
run on each source line. Each function takes 4
arguments: filename, clean_lines, line, error
"""
raw_lines = clean_lines.raw_lines
ParseNolintSuppressions(filename, raw_lines[line], line, error)
nesting_state.Update(filename, clean_lines, line, error)
if nesting_state.stack and nesting_state.stack[-1].inline_asm != _NO_ASM:
return
CheckForFunctionLengths(filename, clean_lines, line, function_state, error)
CheckForMultilineCommentsAndStrings(filename, clean_lines, line, error)
CheckStyle(filename, clean_lines, line, file_extension, nesting_state, error)
CheckLanguage(filename, clean_lines, line, file_extension, include_state,
error)
CheckForNonStandardConstructs(filename, clean_lines, line,
nesting_state, error)
CheckPosixThreading(filename, clean_lines, line, error)
CheckInvalidIncrement(filename, clean_lines, line, error)
CheckMakePairUsesDeduction(filename, clean_lines, line, error)
for check_fn in extra_check_functions:
check_fn(filename, clean_lines, line, error) | [
"def",
"ProcessLine",
"(",
"filename",
",",
"file_extension",
",",
"clean_lines",
",",
"line",
",",
"include_state",
",",
"function_state",
",",
"nesting_state",
",",
"error",
",",
"extra_check_functions",
"=",
"[",
"]",
")",
":",
"raw_lines",
"=",
"clean_lines"... | https://github.com/SIPp/sipp/blob/f44d0cf5dec0013eff8fd7b4da885d455aa82e0e/cpplint.py#L3775-L3812 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | ScreenDC.__init__ | (self, *args, **kwargs) | __init__(self) -> ScreenDC
A wxScreenDC can be used to paint anywhere on the screen. This should
normally be constructed as a temporary stack object; don't store a
wxScreenDC object. | __init__(self) -> ScreenDC | [
"__init__",
"(",
"self",
")",
"-",
">",
"ScreenDC"
] | def __init__(self, *args, **kwargs):
"""
__init__(self) -> ScreenDC
A wxScreenDC can be used to paint anywhere on the screen. This should
normally be constructed as a temporary stack object; don't store a
wxScreenDC object.
"""
_gdi_.ScreenDC_swiginit(self,_gdi_.new_ScreenDC(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_gdi_",
".",
"ScreenDC_swiginit",
"(",
"self",
",",
"_gdi_",
".",
"new_ScreenDC",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L5003-L5012 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/robotsim.py | python | threejs_get_transforms | (arg1: "WorldModel") | return _robotsim.threejs_get_transforms(arg1) | r"""
threejs_get_transforms(WorldModel arg1) -> std::string
Exports the WorldModel to a JSON string ready for use in Three.js. | r"""
threejs_get_transforms(WorldModel arg1) -> std::string | [
"r",
"threejs_get_transforms",
"(",
"WorldModel",
"arg1",
")",
"-",
">",
"std",
"::",
"string"
] | def threejs_get_transforms(arg1: "WorldModel") -> "std::string":
r"""
threejs_get_transforms(WorldModel arg1) -> std::string
Exports the WorldModel to a JSON string ready for use in Three.js.
"""
return _robotsim.threejs_get_transforms(arg1) | [
"def",
"threejs_get_transforms",
"(",
"arg1",
":",
"\"WorldModel\"",
")",
"->",
"\"std::string\"",
":",
"return",
"_robotsim",
".",
"threejs_get_transforms",
"(",
"arg1",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/robotsim.py#L8723-L8731 | |
PrincetonUniversity/athena-public-version | 9c266692b9423743d8e23509b3ab266a232a92d2 | tst/regression/scripts/utils/log_pipe.py | python | LogPipe.fileno | (self) | return self.fdWrite | Return the write file descriptor of the pipe | Return the write file descriptor of the pipe | [
"Return",
"the",
"write",
"file",
"descriptor",
"of",
"the",
"pipe"
] | def fileno(self):
"""Return the write file descriptor of the pipe"""
return self.fdWrite | [
"def",
"fileno",
"(",
"self",
")",
":",
"return",
"self",
".",
"fdWrite"
] | https://github.com/PrincetonUniversity/athena-public-version/blob/9c266692b9423743d8e23509b3ab266a232a92d2/tst/regression/scripts/utils/log_pipe.py#L20-L22 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/setuptools/msvc.py | python | RegistryInfo.vs | (self) | return join(self.sxs, 'VS7') | Microsoft Visual Studio VS7 registry key.
Return
------
str
Registry key | Microsoft Visual Studio VS7 registry key. | [
"Microsoft",
"Visual",
"Studio",
"VS7",
"registry",
"key",
"."
] | def vs(self):
"""
Microsoft Visual Studio VS7 registry key.
Return
------
str
Registry key
"""
return join(self.sxs, 'VS7') | [
"def",
"vs",
"(",
"self",
")",
":",
"return",
"join",
"(",
"self",
".",
"sxs",
",",
"'VS7'",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/msvc.py#L541-L550 | |
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | src/api/python/z3/z3.py | python | FiniteDomainRef.sort | (self) | return FiniteDomainSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx) | Return the sort of the finite-domain expression `self`. | Return the sort of the finite-domain expression `self`. | [
"Return",
"the",
"sort",
"of",
"the",
"finite",
"-",
"domain",
"expression",
"self",
"."
] | def sort(self):
"""Return the sort of the finite-domain expression `self`."""
return FiniteDomainSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx) | [
"def",
"sort",
"(",
"self",
")",
":",
"return",
"FiniteDomainSortRef",
"(",
"Z3_get_sort",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as_ast",
"(",
")",
")",
",",
"self",
".",
"ctx",
")"
] | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L7652-L7654 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/tensor_forest/data/data_ops.py | python | Load | () | return _data_ops | Load the data ops library and return the loaded module. | Load the data ops library and return the loaded module. | [
"Load",
"the",
"data",
"ops",
"library",
"and",
"return",
"the",
"loaded",
"module",
"."
] | def Load():
"""Load the data ops library and return the loaded module."""
with _ops_lock:
global _data_ops
if not _data_ops:
ops_path = resource_loader.get_path_to_datafile(DATA_OPS_FILE)
logging.info('data path: %s', ops_path)
_data_ops = load_library.load_op_library(ops_path)
assert _data_ops, 'Could not load _data_ops.so'
return _data_ops | [
"def",
"Load",
"(",
")",
":",
"with",
"_ops_lock",
":",
"global",
"_data_ops",
"if",
"not",
"_data_ops",
":",
"ops_path",
"=",
"resource_loader",
".",
"get_path_to_datafile",
"(",
"DATA_OPS_FILE",
")",
"logging",
".",
"info",
"(",
"'data path: %s'",
",",
"ops_... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/tensor_forest/data/data_ops.py#L60-L70 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | ListItem.SetId | (*args, **kwargs) | return _controls_.ListItem_SetId(*args, **kwargs) | SetId(self, long id) | SetId(self, long id) | [
"SetId",
"(",
"self",
"long",
"id",
")"
] | def SetId(*args, **kwargs):
"""SetId(self, long id)"""
return _controls_.ListItem_SetId(*args, **kwargs) | [
"def",
"SetId",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ListItem_SetId",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L4164-L4166 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/tracking/data_structures.py | python | List.__init__ | (self, *args, **kwargs) | Construct a new sequence. Arguments are passed to `list()`. | Construct a new sequence. Arguments are passed to `list()`. | [
"Construct",
"a",
"new",
"sequence",
".",
"Arguments",
"are",
"passed",
"to",
"list",
"()",
"."
] | def __init__(self, *args, **kwargs):
"""Construct a new sequence. Arguments are passed to `list()`."""
super(List, self).__init__()
self._storage = self._make_storage(*args, **kwargs)
for index, element in enumerate(self._storage):
self._storage[index] = self._track_value(
element, name=self._name_element(index)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"List",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_storage",
"=",
"self",
".",
"_make_storage",
"(",
"*",
"args",
",",
"*",
"*",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/tracking/data_structures.py#L288-L294 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBCommandInterpreter.HasAliasOptions | (self) | return _lldb.SBCommandInterpreter_HasAliasOptions(self) | HasAliasOptions(SBCommandInterpreter self) -> bool | HasAliasOptions(SBCommandInterpreter self) -> bool | [
"HasAliasOptions",
"(",
"SBCommandInterpreter",
"self",
")",
"-",
">",
"bool"
] | def HasAliasOptions(self):
"""HasAliasOptions(SBCommandInterpreter self) -> bool"""
return _lldb.SBCommandInterpreter_HasAliasOptions(self) | [
"def",
"HasAliasOptions",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBCommandInterpreter_HasAliasOptions",
"(",
"self",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L2743-L2745 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/actor/Actor.py | python | Actor.bindAnim | (self, animName, partName = None, lodName = None,
allowAsyncBind = False) | Binds the named animation to the named part and/or lod. If
allowAsyncBind is False, this guarantees that the animation is
bound immediately--the animation is never bound in a
sub-thread; it will be loaded and bound in the main thread, so
it will be available by the time this method returns.
The parameters are the same as that for getAnimControls(). In
fact, this method is a thin wrapper around that other method.
Use this method if you need to ensure that an animation is
available before you start to play it, and you don't mind
holding up the render for a frame or two until the animation
is available. | Binds the named animation to the named part and/or lod. If
allowAsyncBind is False, this guarantees that the animation is
bound immediately--the animation is never bound in a
sub-thread; it will be loaded and bound in the main thread, so
it will be available by the time this method returns. | [
"Binds",
"the",
"named",
"animation",
"to",
"the",
"named",
"part",
"and",
"/",
"or",
"lod",
".",
"If",
"allowAsyncBind",
"is",
"False",
"this",
"guarantees",
"that",
"the",
"animation",
"is",
"bound",
"immediately",
"--",
"the",
"animation",
"is",
"never",
... | def bindAnim(self, animName, partName = None, lodName = None,
allowAsyncBind = False):
"""
Binds the named animation to the named part and/or lod. If
allowAsyncBind is False, this guarantees that the animation is
bound immediately--the animation is never bound in a
sub-thread; it will be loaded and bound in the main thread, so
it will be available by the time this method returns.
The parameters are the same as that for getAnimControls(). In
fact, this method is a thin wrapper around that other method.
Use this method if you need to ensure that an animation is
available before you start to play it, and you don't mind
holding up the render for a frame or two until the animation
is available.
"""
self.getAnimControls(animName = animName, partName = partName,
lodName = lodName,
allowAsyncBind = allowAsyncBind) | [
"def",
"bindAnim",
"(",
"self",
",",
"animName",
",",
"partName",
"=",
"None",
",",
"lodName",
"=",
"None",
",",
"allowAsyncBind",
"=",
"False",
")",
":",
"self",
".",
"getAnimControls",
"(",
"animName",
"=",
"animName",
",",
"partName",
"=",
"partName",
... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/actor/Actor.py#L2292-L2311 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | tools/clang_format.py | python | Repo.get_branch_name | (self) | return branch | Get the current branch name, short form
This returns "main", not "refs/head/main"
Will not work if the current branch is detached | Get the current branch name, short form
This returns "main", not "refs/head/main"
Will not work if the current branch is detached | [
"Get",
"the",
"current",
"branch",
"name",
"short",
"form",
"This",
"returns",
"main",
"not",
"refs",
"/",
"head",
"/",
"main",
"Will",
"not",
"work",
"if",
"the",
"current",
"branch",
"is",
"detached"
] | def get_branch_name(self):
"""Get the current branch name, short form
This returns "main", not "refs/head/main"
Will not work if the current branch is detached
"""
branch = self.rev_parse(["--abbrev-ref", "HEAD"])
if branch == "HEAD":
raise ValueError("Branch is currently detached")
return branch | [
"def",
"get_branch_name",
"(",
"self",
")",
":",
"branch",
"=",
"self",
".",
"rev_parse",
"(",
"[",
"\"--abbrev-ref\"",
",",
"\"HEAD\"",
"]",
")",
"if",
"branch",
"==",
"\"HEAD\"",
":",
"raise",
"ValueError",
"(",
"\"Branch is currently detached\"",
")",
"retu... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/tools/clang_format.py#L444-L453 | |
nodejs/nan | 8db8c8f544f2b6ce1b0859ef6ecdd0a3873a9e62 | cpplint.py | python | RemoveMultiLineComments | (filename, lines, error) | Removes multiline (c-style) comments from lines. | Removes multiline (c-style) comments from lines. | [
"Removes",
"multiline",
"(",
"c",
"-",
"style",
")",
"comments",
"from",
"lines",
"."
] | def RemoveMultiLineComments(filename, lines, error):
"""Removes multiline (c-style) comments from lines."""
lineix = 0
while lineix < len(lines):
lineix_begin = FindNextMultiLineCommentStart(lines, lineix)
if lineix_begin >= len(lines):
return
lineix_end = FindNextMultiLineCommentEnd(lines, lineix_begin)
if lineix_end >= len(lines):
error(filename, lineix_begin + 1, 'readability/multiline_comment', 5,
'Could not find end of multi-line comment')
return
RemoveMultiLineCommentsFromRange(lines, lineix_begin, lineix_end + 1)
lineix = lineix_end + 1 | [
"def",
"RemoveMultiLineComments",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"lineix",
"=",
"0",
"while",
"lineix",
"<",
"len",
"(",
"lines",
")",
":",
"lineix_begin",
"=",
"FindNextMultiLineCommentStart",
"(",
"lines",
",",
"lineix",
")",
"if",
... | https://github.com/nodejs/nan/blob/8db8c8f544f2b6ce1b0859ef6ecdd0a3873a9e62/cpplint.py#L1617-L1630 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/pyparsing.py | python | ParseResults.asList | (self) | return [res.asList() if isinstance(res, ParseResults) else res for res in self.__toklist] | Returns the parse results as a nested list of matching tokens, all converted to strings.
Example::
patt = OneOrMore(Word(alphas))
result = patt.parseString("sldkj lsdkj sldkj")
# even though the result prints in string-like form, it is actually a pyparsing ParseResults
print(type(result), result) # -> <class 'pyparsing.ParseResults'> ['sldkj', 'lsdkj', 'sldkj']
# Use asList() to create an actual list
result_list = result.asList()
print(type(result_list), result_list) # -> <class 'list'> ['sldkj', 'lsdkj', 'sldkj'] | [] | def asList(self):
"""
Returns the parse results as a nested list of matching tokens, all converted to strings.
Example::
patt = OneOrMore(Word(alphas))
result = patt.parseString("sldkj lsdkj sldkj")
# even though the result prints in string-like form, it is actually a pyparsing ParseResults
print(type(result), result) # -> <class 'pyparsing.ParseResults'> ['sldkj', 'lsdkj', 'sldkj']
# Use asList() to create an actual list
result_list = result.asList()
print(type(result_list), result_list) # -> <class 'list'> ['sldkj', 'lsdkj', 'sldkj']
"""
return [res.asList() if isinstance(res, ParseResults) else res for res in self.__toklist] | [
"def",
"asList",
"(",
"self",
")",
":",
"return",
"[",
"res",
".",
"asList",
"(",
")",
"if",
"isinstance",
"(",
"res",
",",
"ParseResults",
")",
"else",
"res",
"for",
"res",
"in",
"self",
".",
"__toklist",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/pyparsing.py#L1785-L1815 | ||
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/tools/grit/grit/node/base.py | python | Node.IsResourceMapSource | (self) | return False | Whether this node is a resource map source. | Whether this node is a resource map source. | [
"Whether",
"this",
"node",
"is",
"a",
"resource",
"map",
"source",
"."
] | def IsResourceMapSource(self):
'''Whether this node is a resource map source.'''
return False | [
"def",
"IsResourceMapSource",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/tools/grit/grit/node/base.py#L623-L625 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py | python | MaskedArray.count | (self, axis = None) | Count of the non-masked elements in a, or along a certain axis. | Count of the non-masked elements in a, or along a certain axis. | [
"Count",
"of",
"the",
"non",
"-",
"masked",
"elements",
"in",
"a",
"or",
"along",
"a",
"certain",
"axis",
"."
] | def count (self, axis = None):
"Count of the non-masked elements in a, or along a certain axis."
m = self._mask
s = self._data.shape
ls = len(s)
if m is nomask:
if ls == 0:
return 1
if ls == 1:
return s[0]
if axis is None:
return reduce(lambda x, y:x*y, s)
else:
n = s[axis]
t = list(s)
del t[axis]
return ones(t) * n
if axis is None:
w = fromnumeric.ravel(m).astype(int)
n1 = size(w)
if n1 == 1:
n2 = w[0]
else:
n2 = umath.add.reduce(w)
return n1 - n2
else:
n1 = size(m, axis)
n2 = sum(m.astype(int), axis)
return n1 - n2 | [
"def",
"count",
"(",
"self",
",",
"axis",
"=",
"None",
")",
":",
"m",
"=",
"self",
".",
"_mask",
"s",
"=",
"self",
".",
"_data",
".",
"shape",
"ls",
"=",
"len",
"(",
"s",
")",
"if",
"m",
"is",
"nomask",
":",
"if",
"ls",
"==",
"0",
":",
"ret... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py#L1198-L1226 | ||
CGRU/cgru | 1881a4128530e3d31ac6c25314c18314fc50c2c7 | afanasy/python/parsers/awscli.py | python | awscli.do | (self, i_args) | Missing DocString | Missing DocString | [
"Missing",
"DocString"
] | def do(self, i_args):
"""Missing DocString
"""
data = i_args['data']
data = re.findall(r'\d+ of \d+ part', data)
if len(data) == 0:
return
data = re.findall(r'(\d+) of (\d+) part', data[-1])
if len(data) == 0:
return
self.percentframe = int(float(data[0][0]) / float(data[0][1]) * 100)
# print('percent = ' + data)
self.calculate() | [
"def",
"do",
"(",
"self",
",",
"i_args",
")",
":",
"data",
"=",
"i_args",
"[",
"'data'",
"]",
"data",
"=",
"re",
".",
"findall",
"(",
"r'\\d+ of \\d+ part'",
",",
"data",
")",
"if",
"len",
"(",
"data",
")",
"==",
"0",
":",
"return",
"data",
"=",
... | https://github.com/CGRU/cgru/blob/1881a4128530e3d31ac6c25314c18314fc50c2c7/afanasy/python/parsers/awscli.py#L17-L34 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/linalg/_interpolative_backend.py | python | idz_reconint | (idx, proj) | return _id.idz_reconint(idx, proj) | Reconstruct interpolation matrix from complex ID.
:param idx:
Column index array.
:type idx: :class:`numpy.ndarray`
:param proj:
Interpolation coefficients.
:type proj: :class:`numpy.ndarray`
:return:
Interpolation matrix.
:rtype: :class:`numpy.ndarray` | Reconstruct interpolation matrix from complex ID. | [
"Reconstruct",
"interpolation",
"matrix",
"from",
"complex",
"ID",
"."
] | def idz_reconint(idx, proj):
"""
Reconstruct interpolation matrix from complex ID.
:param idx:
Column index array.
:type idx: :class:`numpy.ndarray`
:param proj:
Interpolation coefficients.
:type proj: :class:`numpy.ndarray`
:return:
Interpolation matrix.
:rtype: :class:`numpy.ndarray`
"""
return _id.idz_reconint(idx, proj) | [
"def",
"idz_reconint",
"(",
"idx",
",",
"proj",
")",
":",
"return",
"_id",
".",
"idz_reconint",
"(",
"idx",
",",
"proj",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/linalg/_interpolative_backend.py#L1057-L1072 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/layers/merge.py | python | average | (inputs, **kwargs) | return Average(**kwargs)(inputs) | Functional interface to the `tf.keras.layers.Average` layer.
Example:
>>> x1 = np.ones((2, 2))
>>> x2 = np.zeros((2, 2))
>>> y = tf.keras.layers.Average()([x1, x2])
>>> y.numpy().tolist()
[[0.5, 0.5], [0.5, 0.5]]
Usage in a functional model:
>>> input1 = tf.keras.layers.Input(shape=(16,))
>>> x1 = tf.keras.layers.Dense(8, activation='relu')(input1)
>>> input2 = tf.keras.layers.Input(shape=(32,))
>>> x2 = tf.keras.layers.Dense(8, activation='relu')(input2)
>>> avg = tf.keras.layers.Average()([x1, x2])
>>> out = tf.keras.layers.Dense(4)(avg)
>>> model = tf.keras.models.Model(inputs=[input1, input2], outputs=out)
Args:
inputs: A list of input tensors (at least 2).
**kwargs: Standard layer keyword arguments.
Returns:
A tensor, the average of the inputs.
Raises:
ValueError: If there is a shape mismatch between the inputs and the shapes
cannot be broadcasted to match. | Functional interface to the `tf.keras.layers.Average` layer. | [
"Functional",
"interface",
"to",
"the",
"tf",
".",
"keras",
".",
"layers",
".",
"Average",
"layer",
"."
] | def average(inputs, **kwargs):
"""Functional interface to the `tf.keras.layers.Average` layer.
Example:
>>> x1 = np.ones((2, 2))
>>> x2 = np.zeros((2, 2))
>>> y = tf.keras.layers.Average()([x1, x2])
>>> y.numpy().tolist()
[[0.5, 0.5], [0.5, 0.5]]
Usage in a functional model:
>>> input1 = tf.keras.layers.Input(shape=(16,))
>>> x1 = tf.keras.layers.Dense(8, activation='relu')(input1)
>>> input2 = tf.keras.layers.Input(shape=(32,))
>>> x2 = tf.keras.layers.Dense(8, activation='relu')(input2)
>>> avg = tf.keras.layers.Average()([x1, x2])
>>> out = tf.keras.layers.Dense(4)(avg)
>>> model = tf.keras.models.Model(inputs=[input1, input2], outputs=out)
Args:
inputs: A list of input tensors (at least 2).
**kwargs: Standard layer keyword arguments.
Returns:
A tensor, the average of the inputs.
Raises:
ValueError: If there is a shape mismatch between the inputs and the shapes
cannot be broadcasted to match.
"""
return Average(**kwargs)(inputs) | [
"def",
"average",
"(",
"inputs",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"Average",
"(",
"*",
"*",
"kwargs",
")",
"(",
"inputs",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/layers/merge.py#L832-L864 | |
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | third_party/WebIDL.py | python | Parser.p_PrimitiveOrStringTypeFloat | (self, p) | PrimitiveOrStringType : FLOAT | PrimitiveOrStringType : FLOAT | [
"PrimitiveOrStringType",
":",
"FLOAT"
] | def p_PrimitiveOrStringTypeFloat(self, p):
"""
PrimitiveOrStringType : FLOAT
"""
p[0] = IDLBuiltinType.Types.float | [
"def",
"p_PrimitiveOrStringTypeFloat",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"IDLBuiltinType",
".",
"Types",
".",
"float"
] | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/third_party/WebIDL.py#L4713-L4717 | ||
synfig/synfig | a5ec91db5b751dc12e4400ccfb5c063fd6d2d928 | synfig-studio/plugins/lottie-exporter/properties/shapePropKeyframe/advanced_outline.py | python | bline_to_bezier | (bline_pos, origin, bezier_size) | return bline_pos | Synfig function: https://github.com/synfig/synfig/blob/15607089680af560ad031465d31878425af927eb/synfig-core/src/modules/mod_geometry/advanced_outline.cpp#L1289
Args:
bline_pos (Float):
origin (Float):
bezier_size (Float):
Returns:
(Float) | Synfig function: https://github.com/synfig/synfig/blob/15607089680af560ad031465d31878425af927eb/synfig-core/src/modules/mod_geometry/advanced_outline.cpp#L1289 | [
"Synfig",
"function",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"synfig",
"/",
"synfig",
"/",
"blob",
"/",
"15607089680af560ad031465d31878425af927eb",
"/",
"synfig",
"-",
"core",
"/",
"src",
"/",
"modules",
"/",
"mod_geometry",
"/",
"advanced_outline... | def bline_to_bezier(bline_pos, origin, bezier_size):
"""
Synfig function: https://github.com/synfig/synfig/blob/15607089680af560ad031465d31878425af927eb/synfig-core/src/modules/mod_geometry/advanced_outline.cpp#L1289
Args:
bline_pos (Float):
origin (Float):
bezier_size (Float):
Returns:
(Float)
"""
if bezier_size != 0:
return (bline_pos - origin)/bezier_size
return bline_pos | [
"def",
"bline_to_bezier",
"(",
"bline_pos",
",",
"origin",
",",
"bezier_size",
")",
":",
"if",
"bezier_size",
"!=",
"0",
":",
"return",
"(",
"bline_pos",
"-",
"origin",
")",
"/",
"bezier_size",
"return",
"bline_pos"
] | https://github.com/synfig/synfig/blob/a5ec91db5b751dc12e4400ccfb5c063fd6d2d928/synfig-studio/plugins/lottie-exporter/properties/shapePropKeyframe/advanced_outline.py#L1063-L1077 | |
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/twitter.py | python | User.GetUrl | (self) | return self._url | Get the homepage url of this user.
Returns:
The homepage url of this user | Get the homepage url of this user. | [
"Get",
"the",
"homepage",
"url",
"of",
"this",
"user",
"."
] | def GetUrl(self):
'''Get the homepage url of this user.
Returns:
The homepage url of this user
'''
return self._url | [
"def",
"GetUrl",
"(",
"self",
")",
":",
"return",
"self",
".",
"_url"
] | https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/twitter.py#L415-L421 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/PyChop/ISISDisk.py | python | ISISDisk.getFlux | (self, Ei_in=None, frequency=None) | return flux | Returns the instrument flux at a given Ei by interpolating from a table of measured flux. | Returns the instrument flux at a given Ei by interpolating from a table of measured flux. | [
"Returns",
"the",
"instrument",
"flux",
"at",
"a",
"given",
"Ei",
"by",
"interpolating",
"from",
"a",
"table",
"of",
"measured",
"flux",
"."
] | def getFlux(self, Ei_in=None, frequency=None):
"""
Returns the instrument flux at a given Ei by interpolating from a table of measured flux.
"""
Ei = self.Ei if Ei_in is None else Ei_in
if Ei is None:
raise ValueError('Incident energy has not been specified')
if frequency:
oldfreq = self.freq
self.setFrequency(frequency)
if 'LET' in self.instname:
_, _, _, percent, ie_list, _, _ = self.__LETgetResolution(True, 0., Ei)
flux = MulpyRep.calcFlux(Ei, self.freq[-1], [percent[ie_list[0]]], self.slot_width[-1])[0]
elif any([iname in self.instname for iname in ['MERLIN', 'MAPS', 'MARI']]):
chopper_inst = ISISFermi(self.instname, self.variant, self.freq[-1])
flux = chopper_inst.getFlux(Ei)
else:
raise RuntimeError('Instrument name has not been set')
if frequency:
self.setFrequency(oldfreq)
return flux | [
"def",
"getFlux",
"(",
"self",
",",
"Ei_in",
"=",
"None",
",",
"frequency",
"=",
"None",
")",
":",
"Ei",
"=",
"self",
".",
"Ei",
"if",
"Ei_in",
"is",
"None",
"else",
"Ei_in",
"if",
"Ei",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Incident energ... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/PyChop/ISISDisk.py#L350-L370 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/locators.py | python | Locator.__init__ | (self, scheme='default') | Initialise an instance.
:param scheme: Because locators look for most recent versions, they
need to know the version scheme to use. This specifies
the current PEP-recommended scheme - use ``'legacy'``
if you need to support existing distributions on PyPI. | [] | def __init__(self, scheme='default'):
"""
Initialise an instance.
:param scheme: Because locators look for most recent versions, they
need to know the version scheme to use. This specifies
the current PEP-recommended scheme - use ``'legacy'``
if you need to support existing distributions on PyPI.
"""
self._cache = {}
self.scheme = scheme
# Because of bugs in some of the handlers on some of the platforms,
# we use our own opener rather than just using urlopen.
self.opener = build_opener(RedirectHandler())
# If get_project() is called from locate(), the matcher instance
# is set from the requirement passed to locate(). See issue #18 for
# why this can be useful to know.
self.matcher = None
self.errors = queue.Queue() | [
"def",
"__init__",
"(",
"self",
",",
"scheme",
"=",
"'default'",
")",
":",
"self",
".",
"_cache",
"=",
"{",
"}",
"self",
".",
"scheme",
"=",
"scheme",
"# Because of bugs in some of the handlers on some of the platforms,",
"# we use our own opener rather than just using ur... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/locators.py#L203-L237 | |||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/linalg/special_matrices.py | python | kron | (a, b) | return np.concatenate(np.concatenate(o, axis=1), axis=1) | Kronecker product.
The result is the block matrix::
a[0,0]*b a[0,1]*b ... a[0,-1]*b
a[1,0]*b a[1,1]*b ... a[1,-1]*b
...
a[-1,0]*b a[-1,1]*b ... a[-1,-1]*b
Parameters
----------
a : (M, N) ndarray
Input array
b : (P, Q) ndarray
Input array
Returns
-------
A : (M*P, N*Q) ndarray
Kronecker product of `a` and `b`.
Examples
--------
>>> from numpy import array
>>> from scipy.linalg import kron
>>> kron(array([[1,2],[3,4]]), array([[1,1,1]]))
array([[1, 1, 1, 2, 2, 2],
[3, 3, 3, 4, 4, 4]]) | Kronecker product. | [
"Kronecker",
"product",
"."
] | def kron(a, b):
"""
Kronecker product.
The result is the block matrix::
a[0,0]*b a[0,1]*b ... a[0,-1]*b
a[1,0]*b a[1,1]*b ... a[1,-1]*b
...
a[-1,0]*b a[-1,1]*b ... a[-1,-1]*b
Parameters
----------
a : (M, N) ndarray
Input array
b : (P, Q) ndarray
Input array
Returns
-------
A : (M*P, N*Q) ndarray
Kronecker product of `a` and `b`.
Examples
--------
>>> from numpy import array
>>> from scipy.linalg import kron
>>> kron(array([[1,2],[3,4]]), array([[1,1,1]]))
array([[1, 1, 1, 2, 2, 2],
[3, 3, 3, 4, 4, 4]])
"""
if not a.flags['CONTIGUOUS']:
a = np.reshape(a, a.shape)
if not b.flags['CONTIGUOUS']:
b = np.reshape(b, b.shape)
o = np.outer(a, b)
o = o.reshape(a.shape + b.shape)
return np.concatenate(np.concatenate(o, axis=1), axis=1) | [
"def",
"kron",
"(",
"a",
",",
"b",
")",
":",
"if",
"not",
"a",
".",
"flags",
"[",
"'CONTIGUOUS'",
"]",
":",
"a",
"=",
"np",
".",
"reshape",
"(",
"a",
",",
"a",
".",
"shape",
")",
"if",
"not",
"b",
".",
"flags",
"[",
"'CONTIGUOUS'",
"]",
":",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/linalg/special_matrices.py#L432-L470 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/Queue.py | python | Queue.empty | (self) | return n | Return True if the queue is empty, False otherwise (not reliable!). | Return True if the queue is empty, False otherwise (not reliable!). | [
"Return",
"True",
"if",
"the",
"queue",
"is",
"empty",
"False",
"otherwise",
"(",
"not",
"reliable!",
")",
"."
] | def empty(self):
"""Return True if the queue is empty, False otherwise (not reliable!)."""
self.mutex.acquire()
n = not self._qsize()
self.mutex.release()
return n | [
"def",
"empty",
"(",
"self",
")",
":",
"self",
".",
"mutex",
".",
"acquire",
"(",
")",
"n",
"=",
"not",
"self",
".",
"_qsize",
"(",
")",
"self",
".",
"mutex",
".",
"release",
"(",
")",
"return",
"n"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/Queue.py#L93-L98 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py | python | Writer.AddConfig | (self, name, attrs=None, tools=None) | Adds a configuration to the project.
Args:
name: Configuration name.
attrs: Dict of configuration attributes; may be None.
tools: List of tools (strings or Tool objects); may be None. | Adds a configuration to the project. | [
"Adds",
"a",
"configuration",
"to",
"the",
"project",
"."
] | def AddConfig(self, name, attrs=None, tools=None):
"""Adds a configuration to the project.
Args:
name: Configuration name.
attrs: Dict of configuration attributes; may be None.
tools: List of tools (strings or Tool objects); may be None.
"""
spec = self._GetSpecForConfiguration("Configuration", name, attrs, tools)
self.configurations_section.append(spec) | [
"def",
"AddConfig",
"(",
"self",
",",
"name",
",",
"attrs",
"=",
"None",
",",
"tools",
"=",
"None",
")",
":",
"spec",
"=",
"self",
".",
"_GetSpecForConfiguration",
"(",
"\"Configuration\"",
",",
"name",
",",
"attrs",
",",
"tools",
")",
"self",
".",
"co... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py#L122-L131 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/propgrid.py | python | FloatProperty.__init__ | (self, *args, **kwargs) | __init__(self, String label=(*wxPGProperty::sm_wxPG_LABEL), String name=(*wxPGProperty::sm_wxPG_LABEL),
double value=0.0) -> FloatProperty | __init__(self, String label=(*wxPGProperty::sm_wxPG_LABEL), String name=(*wxPGProperty::sm_wxPG_LABEL),
double value=0.0) -> FloatProperty | [
"__init__",
"(",
"self",
"String",
"label",
"=",
"(",
"*",
"wxPGProperty",
"::",
"sm_wxPG_LABEL",
")",
"String",
"name",
"=",
"(",
"*",
"wxPGProperty",
"::",
"sm_wxPG_LABEL",
")",
"double",
"value",
"=",
"0",
".",
"0",
")",
"-",
">",
"FloatProperty"
] | def __init__(self, *args, **kwargs):
"""
__init__(self, String label=(*wxPGProperty::sm_wxPG_LABEL), String name=(*wxPGProperty::sm_wxPG_LABEL),
double value=0.0) -> FloatProperty
"""
_propgrid.FloatProperty_swiginit(self,_propgrid.new_FloatProperty(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_propgrid",
".",
"FloatProperty_swiginit",
"(",
"self",
",",
"_propgrid",
".",
"new_FloatProperty",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L2952-L2957 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/plotting/_matplotlib/converter.py | python | TimeSeries_DateLocator._get_default_locs | (self, vmin, vmax) | return np.compress(locator["maj"], locator["val"]) | Returns the default locations of ticks. | Returns the default locations of ticks. | [
"Returns",
"the",
"default",
"locations",
"of",
"ticks",
"."
] | def _get_default_locs(self, vmin, vmax):
"""Returns the default locations of ticks."""
if self.plot_obj.date_axis_info is None:
self.plot_obj.date_axis_info = self.finder(vmin, vmax, self.freq)
locator = self.plot_obj.date_axis_info
if self.isminor:
return np.compress(locator["min"], locator["val"])
return np.compress(locator["maj"], locator["val"]) | [
"def",
"_get_default_locs",
"(",
"self",
",",
"vmin",
",",
"vmax",
")",
":",
"if",
"self",
".",
"plot_obj",
".",
"date_axis_info",
"is",
"None",
":",
"self",
".",
"plot_obj",
".",
"date_axis_info",
"=",
"self",
".",
"finder",
"(",
"vmin",
",",
"vmax",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/plotting/_matplotlib/converter.py#L949-L958 | |
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/Chem/Pharm2D/Utils.py | python | GetTriangles | (nPts) | return res | returns a tuple with the distance indices for
triangles composing an nPts-pharmacophore | returns a tuple with the distance indices for
triangles composing an nPts-pharmacophore | [
"returns",
"a",
"tuple",
"with",
"the",
"distance",
"indices",
"for",
"triangles",
"composing",
"an",
"nPts",
"-",
"pharmacophore"
] | def GetTriangles(nPts):
""" returns a tuple with the distance indices for
triangles composing an nPts-pharmacophore
"""
global _trianglesInPharmacophore
if nPts < 3:
return []
res = _trianglesInPharmacophore.get(nPts, [])
if not res:
idx1, idx2, idx3 = (0, 1, nPts - 1)
while idx1 < nPts - 2:
res.append((idx1, idx2, idx3))
idx1 += 1
idx2 += 1
idx3 += 1
res = tuple(res)
_trianglesInPharmacophore[nPts] = res
return res | [
"def",
"GetTriangles",
"(",
"nPts",
")",
":",
"global",
"_trianglesInPharmacophore",
"if",
"nPts",
"<",
"3",
":",
"return",
"[",
"]",
"res",
"=",
"_trianglesInPharmacophore",
".",
"get",
"(",
"nPts",
",",
"[",
"]",
")",
"if",
"not",
"res",
":",
"idx1",
... | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/Chem/Pharm2D/Utils.py#L111-L129 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/rpc.py | python | SocketIO.handle_EOF | (self) | action taken upon link being closed by peer | action taken upon link being closed by peer | [
"action",
"taken",
"upon",
"link",
"being",
"closed",
"by",
"peer"
] | def handle_EOF(self):
"action taken upon link being closed by peer"
self.EOFhook()
self.debug("handle_EOF")
for key in self.cvars:
cv = self.cvars[key]
cv.acquire()
self.responses[key] = ('EOF', None)
cv.notify()
cv.release()
# call our (possibly overridden) exit function
self.exithook() | [
"def",
"handle_EOF",
"(",
"self",
")",
":",
"self",
".",
"EOFhook",
"(",
")",
"self",
".",
"debug",
"(",
"\"handle_EOF\"",
")",
"for",
"key",
"in",
"self",
".",
"cvars",
":",
"cv",
"=",
"self",
".",
"cvars",
"[",
"key",
"]",
"cv",
".",
"acquire",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/rpc.py#L471-L482 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | DateTime.ParseTime | (*args, **kwargs) | return _misc_.DateTime_ParseTime(*args, **kwargs) | ParseTime(self, String time) -> int | ParseTime(self, String time) -> int | [
"ParseTime",
"(",
"self",
"String",
"time",
")",
"-",
">",
"int"
] | def ParseTime(*args, **kwargs):
"""ParseTime(self, String time) -> int"""
return _misc_.DateTime_ParseTime(*args, **kwargs) | [
"def",
"ParseTime",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DateTime_ParseTime",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L4158-L4160 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/variables.py | python | Variable.device | (self) | return self._variable.device | The device of this variable. | The device of this variable. | [
"The",
"device",
"of",
"this",
"variable",
"."
] | def device(self):
"""The device of this variable."""
return self._variable.device | [
"def",
"device",
"(",
"self",
")",
":",
"return",
"self",
".",
"_variable",
".",
"device"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/variables.py#L817-L819 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/grit/grit/tool/android2grd.py | python | Android2Grd.ShortDescription | (self) | return 'Converts Android string.xml files into Chrome grd files.' | Returns a short description of the Android2Grd tool.
Overridden from grit.interface.Tool
Returns:
A string containing a short description of the android2grd tool. | Returns a short description of the Android2Grd tool. | [
"Returns",
"a",
"short",
"description",
"of",
"the",
"Android2Grd",
"tool",
"."
] | def ShortDescription(self):
"""Returns a short description of the Android2Grd tool.
Overridden from grit.interface.Tool
Returns:
A string containing a short description of the android2grd tool.
"""
return 'Converts Android string.xml files into Chrome grd files.' | [
"def",
"ShortDescription",
"(",
"self",
")",
":",
"return",
"'Converts Android string.xml files into Chrome grd files.'"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/grit/grit/tool/android2grd.py#L108-L116 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/client/timeline.py | python | _ChromeTraceFormatter.emit_counter | (self, category, name, pid, timestamp, counter, value) | Emits a record for a single counter.
Args:
category: The event category as a string.
name: The event name as a string.
pid: Identifier of the process generating this event as an integer.
timestamp: The timestamp of this event as a long integer.
counter: Name of the counter as a string.
value: Value of the counter as an integer. | Emits a record for a single counter. | [
"Emits",
"a",
"record",
"for",
"a",
"single",
"counter",
"."
] | def emit_counter(self, category, name, pid, timestamp, counter, value):
"""Emits a record for a single counter.
Args:
category: The event category as a string.
name: The event name as a string.
pid: Identifier of the process generating this event as an integer.
timestamp: The timestamp of this event as a long integer.
counter: Name of the counter as a string.
value: Value of the counter as an integer.
"""
event = self._create_event('C', category, name, pid, 0, timestamp)
event['args'] = {counter: value}
self._events.append(event) | [
"def",
"emit_counter",
"(",
"self",
",",
"category",
",",
"name",
",",
"pid",
",",
"timestamp",
",",
"counter",
",",
"value",
")",
":",
"event",
"=",
"self",
".",
"_create_event",
"(",
"'C'",
",",
"category",
",",
"name",
",",
"pid",
",",
"0",
",",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/client/timeline.py#L216-L229 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/gcs-oauth2-boto-plugin/gcs_oauth2_boto_plugin/oauth2_client.py | python | OAuth2Client.GetAccessToken | (self) | Obtains an access token for this client.
This client's access token cache is first checked for an existing,
not-yet-expired access token. If none is found, the client obtains a fresh
access token from the OAuth2 provider's token endpoint.
Returns:
The cached or freshly obtained AccessToken.
Raises:
AccessTokenRefreshError if an error occurs. | Obtains an access token for this client. | [
"Obtains",
"an",
"access",
"token",
"for",
"this",
"client",
"."
] | def GetAccessToken(self):
"""Obtains an access token for this client.
This client's access token cache is first checked for an existing,
not-yet-expired access token. If none is found, the client obtains a fresh
access token from the OAuth2 provider's token endpoint.
Returns:
The cached or freshly obtained AccessToken.
Raises:
AccessTokenRefreshError if an error occurs.
"""
# Ensure only one thread at a time attempts to get (and possibly refresh)
# the access token. This doesn't prevent concurrent refresh attempts across
# multiple gsutil instances, but at least protects against multiple threads
# simultaneously attempting to refresh when gsutil -m is used.
token_exchange_lock.acquire()
try:
cache_key = self.CacheKey()
LOG.debug('GetAccessToken: checking cache for key %s', cache_key)
access_token = self.access_token_cache.GetToken(cache_key)
LOG.debug('GetAccessToken: token from cache: %s', access_token)
if access_token is None or access_token.ShouldRefresh():
LOG.debug('GetAccessToken: fetching fresh access token...')
access_token = self.FetchAccessToken()
LOG.debug('GetAccessToken: fresh access token: %s', access_token)
self.access_token_cache.PutToken(cache_key, access_token)
return access_token
finally:
token_exchange_lock.release() | [
"def",
"GetAccessToken",
"(",
"self",
")",
":",
"# Ensure only one thread at a time attempts to get (and possibly refresh)",
"# the access token. This doesn't prevent concurrent refresh attempts across",
"# multiple gsutil instances, but at least protects against multiple threads",
"# simultaneous... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/gcs-oauth2-boto-plugin/gcs_oauth2_boto_plugin/oauth2_client.py#L292-L321 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/hooks.py | python | editor | (self, filename, linenum=None, wait=True) | Open the default editor at the given filename and linenumber.
This is IPython's default editor hook, you can use it as an example to
write your own modified one. To set your own editor function as the
new editor hook, call ip.set_hook('editor',yourfunc). | Open the default editor at the given filename and linenumber. | [
"Open",
"the",
"default",
"editor",
"at",
"the",
"given",
"filename",
"and",
"linenumber",
"."
] | def editor(self, filename, linenum=None, wait=True):
"""Open the default editor at the given filename and linenumber.
This is IPython's default editor hook, you can use it as an example to
write your own modified one. To set your own editor function as the
new editor hook, call ip.set_hook('editor',yourfunc)."""
# IPython configures a default editor at startup by reading $EDITOR from
# the environment, and falling back on vi (unix) or notepad (win32).
editor = self.editor
# marker for at which line to open the file (for existing objects)
if linenum is None or editor=='notepad':
linemark = ''
else:
linemark = '+%d' % int(linenum)
# Enclose in quotes if necessary and legal
if ' ' in editor and os.path.isfile(editor) and editor[0] != '"':
editor = '"%s"' % editor
# Call the actual editor
proc = subprocess.Popen('%s %s %s' % (editor, linemark, filename),
shell=True)
if wait and proc.wait() != 0:
raise TryNext() | [
"def",
"editor",
"(",
"self",
",",
"filename",
",",
"linenum",
"=",
"None",
",",
"wait",
"=",
"True",
")",
":",
"# IPython configures a default editor at startup by reading $EDITOR from",
"# the environment, and falling back on vi (unix) or notepad (win32).",
"editor",
"=",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/hooks.py#L57-L82 | ||
gromacs/gromacs | 7dec3a3f99993cf5687a122de3e12de31c21c399 | docs/doxygen/gmxtree.py | python | File.get_declared_defines | (self) | return self._declared_defines | Return set of defines declared in this file.
The information is only populated for selected files. | Return set of defines declared in this file. | [
"Return",
"set",
"of",
"defines",
"declared",
"in",
"this",
"file",
"."
] | def get_declared_defines(self):
"""Return set of defines declared in this file.
The information is only populated for selected files."""
return self._declared_defines | [
"def",
"get_declared_defines",
"(",
"self",
")",
":",
"return",
"self",
".",
"_declared_defines"
] | https://github.com/gromacs/gromacs/blob/7dec3a3f99993cf5687a122de3e12de31c21c399/docs/doxygen/gmxtree.py#L347-L351 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | RichTextCtrl.WriteBitmap | (*args, **kwargs) | return _richtext.RichTextCtrl_WriteBitmap(*args, **kwargs) | WriteBitmap(self, Bitmap bitmap, int bitmapType=BITMAP_TYPE_PNG) -> bool
Write a bitmap at the current insertion point. Supply optional type to
use for internal and file storage of the raw data. | WriteBitmap(self, Bitmap bitmap, int bitmapType=BITMAP_TYPE_PNG) -> bool | [
"WriteBitmap",
"(",
"self",
"Bitmap",
"bitmap",
"int",
"bitmapType",
"=",
"BITMAP_TYPE_PNG",
")",
"-",
">",
"bool"
] | def WriteBitmap(*args, **kwargs):
"""
WriteBitmap(self, Bitmap bitmap, int bitmapType=BITMAP_TYPE_PNG) -> bool
Write a bitmap at the current insertion point. Supply optional type to
use for internal and file storage of the raw data.
"""
return _richtext.RichTextCtrl_WriteBitmap(*args, **kwargs) | [
"def",
"WriteBitmap",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_WriteBitmap",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L3258-L3265 | |
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/android/gyp/compile_resources.py | python | _ToAndroidLocales | (locale_allowlist) | return ret | Converts the list of Chrome locales to Android config locale qualifiers.
Args:
locale_allowlist: A list of Chromium locale names.
Returns:
A set of matching Android config locale qualifier names. | Converts the list of Chrome locales to Android config locale qualifiers. | [
"Converts",
"the",
"list",
"of",
"Chrome",
"locales",
"to",
"Android",
"config",
"locale",
"qualifiers",
"."
] | def _ToAndroidLocales(locale_allowlist):
"""Converts the list of Chrome locales to Android config locale qualifiers.
Args:
locale_allowlist: A list of Chromium locale names.
Returns:
A set of matching Android config locale qualifier names.
"""
ret = set()
for locale in locale_allowlist:
locale = resource_utils.ToAndroidLocaleName(locale)
if locale is None or ('-' in locale and '-r' not in locale):
raise Exception('Unsupported Chromium locale name: %s' % locale)
ret.add(locale)
# Always keep non-regional fall-backs.
language = locale.split('-')[0]
ret.add(language)
return ret | [
"def",
"_ToAndroidLocales",
"(",
"locale_allowlist",
")",
":",
"ret",
"=",
"set",
"(",
")",
"for",
"locale",
"in",
"locale_allowlist",
":",
"locale",
"=",
"resource_utils",
".",
"ToAndroidLocaleName",
"(",
"locale",
")",
"if",
"locale",
"is",
"None",
"or",
"... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/android/gyp/compile_resources.py#L318-L336 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/modulegraph/modulegraph/find_modules.py | python | find_modules | (scripts=(), includes=(), packages=(), excludes=(), path=None, debug=0) | return mf | High-level interface, takes iterables for:
scripts, includes, packages, excludes
And returns a :class:`modulegraph.modulegraph.ModuleGraph` instance,
python_files, and extensions
python_files is a list of pure python dependencies as modulegraph.Module objects,
extensions is a list of platform-specific C extension dependencies as modulegraph.Module objects | High-level interface, takes iterables for:
scripts, includes, packages, excludes | [
"High",
"-",
"level",
"interface",
"takes",
"iterables",
"for",
":",
"scripts",
"includes",
"packages",
"excludes"
] | def find_modules(scripts=(), includes=(), packages=(), excludes=(), path=None, debug=0):
"""
High-level interface, takes iterables for:
scripts, includes, packages, excludes
And returns a :class:`modulegraph.modulegraph.ModuleGraph` instance,
python_files, and extensions
python_files is a list of pure python dependencies as modulegraph.Module objects,
extensions is a list of platform-specific C extension dependencies as modulegraph.Module objects
"""
scripts = set(scripts)
includes = set(includes)
packages = set(packages)
excludes = set(excludes)
plat_prepare(includes, packages, excludes)
mf = modulegraph.ModuleGraph(
path=path,
excludes=(excludes - includes),
implies=get_implies(),
debug=debug,
)
find_needed_modules(mf, scripts, includes, packages)
return mf | [
"def",
"find_modules",
"(",
"scripts",
"=",
"(",
")",
",",
"includes",
"=",
"(",
")",
",",
"packages",
"=",
"(",
")",
",",
"excludes",
"=",
"(",
")",
",",
"path",
"=",
"None",
",",
"debug",
"=",
"0",
")",
":",
"scripts",
"=",
"set",
"(",
"scrip... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/modulegraph/modulegraph/find_modules.py#L319-L342 | |
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/esptool/serial/serialwin32.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._break_state:
win32.SetCommBreak(self._port_handle)
else:
win32.ClearCommBreak(self._port_handle) | [
"def",
"_update_break_state",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_open",
":",
"raise",
"portNotOpenError",
"if",
"self",
".",
"_break_state",
":",
"win32",
".",
"SetCommBreak",
"(",
"self",
".",
"_port_handle",
")",
"else",
":",
"win32",
"... | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/esptool/serial/serialwin32.py#L364-L371 | ||
Manu343726/siplasplas | 9fae7559f87087cf8ef34f04bd1e774b84b2ea9c | reference/cindex.py | python | Cursor.get_usr | (self) | return conf.lib.clang_getCursorUSR(self) | Return the Unified Symbol Resultion (USR) for the entity referenced
by the given cursor (or None).
A Unified Symbol Resolution (USR) is a string that identifies a
particular entity (function, class, variable, etc.) within a
program. USRs can be compared across translation units to determine,
e.g., when references in one translation refer to an entity defined in
another translation unit. | Return the Unified Symbol Resultion (USR) for the entity referenced
by the given cursor (or None). | [
"Return",
"the",
"Unified",
"Symbol",
"Resultion",
"(",
"USR",
")",
"for",
"the",
"entity",
"referenced",
"by",
"the",
"given",
"cursor",
"(",
"or",
"None",
")",
"."
] | def get_usr(self):
"""Return the Unified Symbol Resultion (USR) for the entity referenced
by the given cursor (or None).
A Unified Symbol Resolution (USR) is a string that identifies a
particular entity (function, class, variable, etc.) within a
program. USRs can be compared across translation units to determine,
e.g., when references in one translation refer to an entity defined in
another translation unit."""
return conf.lib.clang_getCursorUSR(self) | [
"def",
"get_usr",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getCursorUSR",
"(",
"self",
")"
] | https://github.com/Manu343726/siplasplas/blob/9fae7559f87087cf8ef34f04bd1e774b84b2ea9c/reference/cindex.py#L1237-L1246 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/docview.py | python | DocChildFrame.ProcessUpdateUIEvent | (self, event) | Processes a UI event, searching event tables and calling zero or more
suitable event handler function(s). Note that the ProcessEvent
method is called from the wxPython docview framework directly since
wxPython does not have a virtual ProcessEvent function. | Processes a UI event, searching event tables and calling zero or more
suitable event handler function(s). Note that the ProcessEvent
method is called from the wxPython docview framework directly since
wxPython does not have a virtual ProcessEvent function. | [
"Processes",
"a",
"UI",
"event",
"searching",
"event",
"tables",
"and",
"calling",
"zero",
"or",
"more",
"suitable",
"event",
"handler",
"function",
"(",
"s",
")",
".",
"Note",
"that",
"the",
"ProcessEvent",
"method",
"is",
"called",
"from",
"the",
"wxPython... | def ProcessUpdateUIEvent(self, event):
"""
Processes a UI event, searching event tables and calling zero or more
suitable event handler function(s). Note that the ProcessEvent
method is called from the wxPython docview framework directly since
wxPython does not have a virtual ProcessEvent function.
"""
if self.GetParent():
self.GetParent().ProcessUpdateUIEvent(event)
else:
return False | [
"def",
"ProcessUpdateUIEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"GetParent",
"(",
")",
":",
"self",
".",
"GetParent",
"(",
")",
".",
"ProcessUpdateUIEvent",
"(",
"event",
")",
"else",
":",
"return",
"False"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/docview.py#L2535-L2545 | ||
ome/openmicroscopy | 17d0a38493571540815074bfbf06932526fc3349 | examples/ScriptingService/adminWorkflow.py | python | listScripts | (scriptService) | Prints out the available Official Scripts returned by getScripts()
and User Scripts returned by getUserScripts() | Prints out the available Official Scripts returned by getScripts()
and User Scripts returned by getUserScripts() | [
"Prints",
"out",
"the",
"available",
"Official",
"Scripts",
"returned",
"by",
"getScripts",
"()",
"and",
"User",
"Scripts",
"returned",
"by",
"getUserScripts",
"()"
] | def listScripts(scriptService):
"""
Prints out the available Official Scripts returned by getScripts()
and User Scripts returned by getUserScripts()
"""
print("--OFFICIAL SCRIPTS--")
scripts = scriptService.getScripts()
for s in scripts:
print(s.id.val, s.path.val + s.name.val)
print("--USER SCRIPTS--")
userGroups = [] # gives me available scripts for default group
scripts = scriptService.getUserScripts(userGroups)
for s in scripts:
print(s.id.val, s.path.val + s.name.val) | [
"def",
"listScripts",
"(",
"scriptService",
")",
":",
"print",
"(",
"\"--OFFICIAL SCRIPTS--\"",
")",
"scripts",
"=",
"scriptService",
".",
"getScripts",
"(",
")",
"for",
"s",
"in",
"scripts",
":",
"print",
"(",
"s",
".",
"id",
".",
"val",
",",
"s",
".",
... | https://github.com/ome/openmicroscopy/blob/17d0a38493571540815074bfbf06932526fc3349/examples/ScriptingService/adminWorkflow.py#L95-L110 | ||
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/core/column/lists.py | python | ListMethods.len | (self) | return self._return_or_inplace(count_elements(self._column)) | Computes the length of each element in the Series/Index.
Returns
-------
Series or Index
Examples
--------
>>> s = cudf.Series([[1, 2, 3], None, [4, 5]])
>>> s
0 [1, 2, 3]
1 None
2 [4, 5]
dtype: list
>>> s.list.len()
0 3
1 <NA>
2 2
dtype: int32 | Computes the length of each element in the Series/Index. | [
"Computes",
"the",
"length",
"of",
"each",
"element",
"in",
"the",
"Series",
"/",
"Index",
"."
] | def len(self) -> ParentType:
"""
Computes the length of each element in the Series/Index.
Returns
-------
Series or Index
Examples
--------
>>> s = cudf.Series([[1, 2, 3], None, [4, 5]])
>>> s
0 [1, 2, 3]
1 None
2 [4, 5]
dtype: list
>>> s.list.len()
0 3
1 <NA>
2 2
dtype: int32
"""
return self._return_or_inplace(count_elements(self._column)) | [
"def",
"len",
"(",
"self",
")",
"->",
"ParentType",
":",
"return",
"self",
".",
"_return_or_inplace",
"(",
"count_elements",
"(",
"self",
".",
"_column",
")",
")"
] | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/column/lists.py#L459-L481 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib2to3/pgen2/conv.py | python | Converter.run | (self, graminit_h, graminit_c) | Load the grammar tables from the text files written by pgen. | Load the grammar tables from the text files written by pgen. | [
"Load",
"the",
"grammar",
"tables",
"from",
"the",
"text",
"files",
"written",
"by",
"pgen",
"."
] | def run(self, graminit_h, graminit_c):
"""Load the grammar tables from the text files written by pgen."""
self.parse_graminit_h(graminit_h)
self.parse_graminit_c(graminit_c)
self.finish_off() | [
"def",
"run",
"(",
"self",
",",
"graminit_h",
",",
"graminit_c",
")",
":",
"self",
".",
"parse_graminit_h",
"(",
"graminit_h",
")",
"self",
".",
"parse_graminit_c",
"(",
"graminit_c",
")",
"self",
".",
"finish_off",
"(",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib2to3/pgen2/conv.py#L47-L51 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/categorical.py | python | Categorical.as_ordered | (self, inplace=False) | return self.set_ordered(True, inplace=inplace) | Set the Categorical to be ordered.
Parameters
----------
inplace : bool, default False
Whether or not to set the ordered attribute in-place or return
a copy of this categorical with ordered set to True.
Returns
-------
Categorical
Ordered Categorical. | Set the Categorical to be ordered. | [
"Set",
"the",
"Categorical",
"to",
"be",
"ordered",
"."
] | def as_ordered(self, inplace=False):
"""
Set the Categorical to be ordered.
Parameters
----------
inplace : bool, default False
Whether or not to set the ordered attribute in-place or return
a copy of this categorical with ordered set to True.
Returns
-------
Categorical
Ordered Categorical.
"""
inplace = validate_bool_kwarg(inplace, "inplace")
return self.set_ordered(True, inplace=inplace) | [
"def",
"as_ordered",
"(",
"self",
",",
"inplace",
"=",
"False",
")",
":",
"inplace",
"=",
"validate_bool_kwarg",
"(",
"inplace",
",",
"\"inplace\"",
")",
"return",
"self",
".",
"set_ordered",
"(",
"True",
",",
"inplace",
"=",
"inplace",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/categorical.py#L756-L772 | |
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/gdal.py | python | Rmdir | (*args) | return _gdal.Rmdir(*args) | r"""Rmdir(char const * utf8_path) -> VSI_RETVAL | r"""Rmdir(char const * utf8_path) -> VSI_RETVAL | [
"r",
"Rmdir",
"(",
"char",
"const",
"*",
"utf8_path",
")",
"-",
">",
"VSI_RETVAL"
] | def Rmdir(*args):
r"""Rmdir(char const * utf8_path) -> VSI_RETVAL"""
return _gdal.Rmdir(*args) | [
"def",
"Rmdir",
"(",
"*",
"args",
")",
":",
"return",
"_gdal",
".",
"Rmdir",
"(",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/gdal.py#L1684-L1686 | |
SmartisanTech/Wrench | 27f3c17692910997bba3a3c9fd88c8717497aac6 | extra-cmake-modules/usr/share/ECM/find-modules/sip_generator.py | python | SipGenerator._read_source | (self, extent) | return "".join(extract).replace("\n", " ") | Read the given range from the unpre-processed source.
:param extent: The range of text required. | Read the given range from the unpre-processed source. | [
"Read",
"the",
"given",
"range",
"from",
"the",
"unpre",
"-",
"processed",
"source",
"."
] | def _read_source(self, extent):
"""
Read the given range from the unpre-processed source.
:param extent: The range of text required.
"""
extract = self.unpreprocessed_source[extent.start.line - 1:extent.end.line]
if extent.start.line == extent.end.line:
extract[0] = extract[0][extent.start.column - 1:extent.end.column - 1]
else:
extract[0] = extract[0][extent.start.column - 1:]
extract[-1] = extract[-1][:extent.end.column - 1]
#
# Return a single line of text.
#
return "".join(extract).replace("\n", " ") | [
"def",
"_read_source",
"(",
"self",
",",
"extent",
")",
":",
"extract",
"=",
"self",
".",
"unpreprocessed_source",
"[",
"extent",
".",
"start",
".",
"line",
"-",
"1",
":",
"extent",
".",
"end",
".",
"line",
"]",
"if",
"extent",
".",
"start",
".",
"li... | https://github.com/SmartisanTech/Wrench/blob/27f3c17692910997bba3a3c9fd88c8717497aac6/extra-cmake-modules/usr/share/ECM/find-modules/sip_generator.py#L626-L641 | |
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/tools/grit/grit/gather/interface.py | python | GathererBase.SetGrdNode | (self, node) | Sets the grd node on which this gatherer is running. | Sets the grd node on which this gatherer is running. | [
"Sets",
"the",
"grd",
"node",
"on",
"which",
"this",
"gatherer",
"is",
"running",
"."
] | def SetGrdNode(self, node):
'''Sets the grd node on which this gatherer is running.
'''
self.grd_node = node | [
"def",
"SetGrdNode",
"(",
"self",
",",
"node",
")",
":",
"self",
".",
"grd_node",
"=",
"node"
] | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/tools/grit/grit/gather/interface.py#L70-L73 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/pytables.py | python | HDFStore.select_column | (
self,
key: str,
column: str,
start: Optional[int] = None,
stop: Optional[int] = None,
) | return tbl.read_column(column=column, start=start, stop=stop) | return a single column from the table. This is generally only useful to
select an indexable
Parameters
----------
key : str
column : str
The column of interest.
start : int or None, default None
stop : int or None, default None
Raises
------
raises KeyError if the column is not found (or key is not a valid
store)
raises ValueError if the column can not be extracted individually (it
is part of a data block) | return a single column from the table. This is generally only useful to
select an indexable | [
"return",
"a",
"single",
"column",
"from",
"the",
"table",
".",
"This",
"is",
"generally",
"only",
"useful",
"to",
"select",
"an",
"indexable"
] | def select_column(
self,
key: str,
column: str,
start: Optional[int] = None,
stop: Optional[int] = None,
):
"""
return a single column from the table. This is generally only useful to
select an indexable
Parameters
----------
key : str
column : str
The column of interest.
start : int or None, default None
stop : int or None, default None
Raises
------
raises KeyError if the column is not found (or key is not a valid
store)
raises ValueError if the column can not be extracted individually (it
is part of a data block)
"""
tbl = self.get_storer(key)
if not isinstance(tbl, Table):
raise TypeError("can only read_column with a table")
return tbl.read_column(column=column, start=start, stop=stop) | [
"def",
"select_column",
"(",
"self",
",",
"key",
":",
"str",
",",
"column",
":",
"str",
",",
"start",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
"stop",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
")",
":",
"tbl",
"=",
"self",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/pytables.py#L839-L869 | |
Caffe-MPI/Caffe-MPI.github.io | df5992af571a2a19981b69635115c393f18d1c76 | tools/extra/parse_log.py | python | write_csv | (output_filename, dict_list, delimiter, verbose=False) | Write a CSV file | Write a CSV file | [
"Write",
"a",
"CSV",
"file"
] | def write_csv(output_filename, dict_list, delimiter, verbose=False):
"""Write a CSV file
"""
if not dict_list:
if verbose:
print('Not writing %s; no lines to write' % output_filename)
return
dialect = csv.excel
dialect.delimiter = delimiter
with open(output_filename, 'w') as f:
dict_writer = csv.DictWriter(f, fieldnames=dict_list[0].keys(),
dialect=dialect)
dict_writer.writeheader()
dict_writer.writerows(dict_list)
if verbose:
print 'Wrote %s' % output_filename | [
"def",
"write_csv",
"(",
"output_filename",
",",
"dict_list",
",",
"delimiter",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"not",
"dict_list",
":",
"if",
"verbose",
":",
"print",
"(",
"'Not writing %s; no lines to write'",
"%",
"output_filename",
")",
"return... | https://github.com/Caffe-MPI/Caffe-MPI.github.io/blob/df5992af571a2a19981b69635115c393f18d1c76/tools/extra/parse_log.py#L148-L166 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/numbers.py | python | Complex.__truediv__ | (self, other) | self / other with __future__ division.
Should promote to float when necessary. | self / other with __future__ division. | [
"self",
"/",
"other",
"with",
"__future__",
"division",
"."
] | def __truediv__(self, other):
"""self / other with __future__ division.
Should promote to float when necessary.
"""
raise NotImplementedError | [
"def",
"__truediv__",
"(",
"self",
",",
"other",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/numbers.py#L124-L129 | ||
apache/qpid-proton | 6bcdfebb55ea3554bc29b1901422532db331a591 | python/proton/_handlers.py | python | EndpointStateHandler.is_local_uninitialised | (cls, endpoint: Endpoint) | return bool(endpoint.state & Endpoint.LOCAL_UNINIT) | Test if local ``endpoint`` is uninitialised (ie has state
:const:`proton.Endpoint.LOCAL_UNINIT`).
:param endpoint: The local endpoint to be tested.
:return: ``True`` if local endpoint is in state
:const:`proton.Endpoint.LOCAL_UNINIT`, ``False`` otherwise. | Test if local ``endpoint`` is uninitialised (ie has state
:const:`proton.Endpoint.LOCAL_UNINIT`). | [
"Test",
"if",
"local",
"endpoint",
"is",
"uninitialised",
"(",
"ie",
"has",
"state",
":",
"const",
":",
"proton",
".",
"Endpoint",
".",
"LOCAL_UNINIT",
")",
"."
] | def is_local_uninitialised(cls, endpoint: Endpoint) -> bool:
"""
Test if local ``endpoint`` is uninitialised (ie has state
:const:`proton.Endpoint.LOCAL_UNINIT`).
:param endpoint: The local endpoint to be tested.
:return: ``True`` if local endpoint is in state
:const:`proton.Endpoint.LOCAL_UNINIT`, ``False`` otherwise.
"""
return bool(endpoint.state & Endpoint.LOCAL_UNINIT) | [
"def",
"is_local_uninitialised",
"(",
"cls",
",",
"endpoint",
":",
"Endpoint",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"endpoint",
".",
"state",
"&",
"Endpoint",
".",
"LOCAL_UNINIT",
")"
] | https://github.com/apache/qpid-proton/blob/6bcdfebb55ea3554bc29b1901422532db331a591/python/proton/_handlers.py#L337-L346 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Window.GetCursor | (*args, **kwargs) | return _core_.Window_GetCursor(*args, **kwargs) | GetCursor(self) -> Cursor
Return the cursor associated with this window. | GetCursor(self) -> Cursor | [
"GetCursor",
"(",
"self",
")",
"-",
">",
"Cursor"
] | def GetCursor(*args, **kwargs):
"""
GetCursor(self) -> Cursor
Return the cursor associated with this window.
"""
return _core_.Window_GetCursor(*args, **kwargs) | [
"def",
"GetCursor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_GetCursor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L10970-L10976 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/stc.py | python | StyledTextCtrl.LinesSplit | (*args, **kwargs) | return _stc.StyledTextCtrl_LinesSplit(*args, **kwargs) | LinesSplit(self, int pixelWidth)
Split the lines in the target into lines that are less wide than pixelWidth
where possible. | LinesSplit(self, int pixelWidth) | [
"LinesSplit",
"(",
"self",
"int",
"pixelWidth",
")"
] | def LinesSplit(*args, **kwargs):
"""
LinesSplit(self, int pixelWidth)
Split the lines in the target into lines that are less wide than pixelWidth
where possible.
"""
return _stc.StyledTextCtrl_LinesSplit(*args, **kwargs) | [
"def",
"LinesSplit",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_LinesSplit",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/stc.py#L4305-L4312 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | RectS | (*args, **kwargs) | return val | RectS(Size size) -> Rect
Create a new Rect from a size only. | RectS(Size size) -> Rect | [
"RectS",
"(",
"Size",
"size",
")",
"-",
">",
"Rect"
] | def RectS(*args, **kwargs):
"""
RectS(Size size) -> Rect
Create a new Rect from a size only.
"""
val = _core_.new_RectS(*args, **kwargs)
return val | [
"def",
"RectS",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"_core_",
".",
"new_RectS",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"val"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L1621-L1628 | |
rootm0s/Protectors | 5b3f4d11687a5955caf9c3af30666c4bfc2c19ab | OWASP-ZSC/module/readline_windows/pyreadline/modes/emacs.py | python | EmacsMode.re_read_init_file | (self, e) | Read in the contents of the inputrc file, and incorporate any
bindings or variable assignments found there. | Read in the contents of the inputrc file, and incorporate any
bindings or variable assignments found there. | [
"Read",
"in",
"the",
"contents",
"of",
"the",
"inputrc",
"file",
"and",
"incorporate",
"any",
"bindings",
"or",
"variable",
"assignments",
"found",
"there",
"."
] | def re_read_init_file(self, e): # (C-x C-r)
'''Read in the contents of the inputrc file, and incorporate any
bindings or variable assignments found there.'''
self.finalize() | [
"def",
"re_read_init_file",
"(",
"self",
",",
"e",
")",
":",
"# (C-x C-r)",
"self",
".",
"finalize",
"(",
")"
] | https://github.com/rootm0s/Protectors/blob/5b3f4d11687a5955caf9c3af30666c4bfc2c19ab/OWASP-ZSC/module/readline_windows/pyreadline/modes/emacs.py#L525-L528 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/closure_compiler/compile2.py | python | Checker._run_jar | (self, jar, args) | return process.returncode, stderr | Runs a .jar from the command line with arguments.
Args:
jar: A file path to a .jar file
args: A list of command line arguments to be passed when running the .jar.
Return:
(exit_code, stderr) The exit code of the command (e.g. 0 for success) and
the stderr collected while running |jar| (as a string). | Runs a .jar from the command line with arguments. | [
"Runs",
"a",
".",
"jar",
"from",
"the",
"command",
"line",
"with",
"arguments",
"."
] | def _run_jar(self, jar, args):
"""Runs a .jar from the command line with arguments.
Args:
jar: A file path to a .jar file
args: A list of command line arguments to be passed when running the .jar.
Return:
(exit_code, stderr) The exit code of the command (e.g. 0 for success) and
the stderr collected while running |jar| (as a string).
"""
shell_command = " ".join(self._JAR_COMMAND + [jar] + args)
self._log_debug("Running jar: %s" % shell_command)
devnull = open(os.devnull, "w")
kwargs = {"stdout": devnull, "stderr": subprocess.PIPE, "shell": True}
process = subprocess.Popen(shell_command, **kwargs)
_, stderr = process.communicate()
return process.returncode, stderr | [
"def",
"_run_jar",
"(",
"self",
",",
"jar",
",",
"args",
")",
":",
"shell_command",
"=",
"\" \"",
".",
"join",
"(",
"self",
".",
"_JAR_COMMAND",
"+",
"[",
"jar",
"]",
"+",
"args",
")",
"self",
".",
"_log_debug",
"(",
"\"Running jar: %s\"",
"%",
"shell_... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/closure_compiler/compile2.py#L79-L97 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/email/_parseaddr.py | python | AddrlistClass.getdomainliteral | (self) | return '[%s]' % self.getdelimited('[', ']\r', False) | Parse an RFC 2822 domain-literal. | Parse an RFC 2822 domain-literal. | [
"Parse",
"an",
"RFC",
"2822",
"domain",
"-",
"literal",
"."
] | def getdomainliteral(self):
"""Parse an RFC 2822 domain-literal."""
return '[%s]' % self.getdelimited('[', ']\r', False) | [
"def",
"getdomainliteral",
"(",
"self",
")",
":",
"return",
"'[%s]'",
"%",
"self",
".",
"getdelimited",
"(",
"'['",
",",
"']\\r'",
",",
"False",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/email/_parseaddr.py#L457-L459 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/pyserial/serial/serialutil.py | python | SerialBase.getXonXoff | (self) | return self._xonxoff | Get the current XON/XOFF setting. | Get the current XON/XOFF setting. | [
"Get",
"the",
"current",
"XON",
"/",
"XOFF",
"setting",
"."
] | def getXonXoff(self):
"""Get the current XON/XOFF setting."""
return self._xonxoff | [
"def",
"getXonXoff",
"(",
"self",
")",
":",
"return",
"self",
".",
"_xonxoff"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/pyserial/serial/serialutil.py#L435-L437 | |
vadimcn/vscode-lldb | 0ece78ec15eda432be7c9e4392aaec9404c29942 | adapter/codelldb.py | python | debug_info | (debugger, command, result, internal_dict) | Display compilation units found in each module's debug info.\nUsage: debug_info [module name] | Display compilation units found in each module's debug info.\nUsage: debug_info [module name] | [
"Display",
"compilation",
"units",
"found",
"in",
"each",
"module",
"s",
"debug",
"info",
".",
"\\",
"nUsage",
":",
"debug_info",
"[",
"module",
"name",
"]"
] | def debug_info(debugger, command, result, internal_dict):
'''Display compilation units found in each module's debug info.\nUsage: debug_info [module name]'''
import shlex
args = shlex.split(command)
if len(args) > 0:
import re
regex = re.compile(args[0])
filter = lambda mod: regex.search(mod.platform_file.fullpath)
else:
filter = lambda mod: True
target = debugger.GetSelectedTarget()
for module in target.modules:
if filter(module):
result.write('Module {}\n'.format(module.platform_file.fullpath))
if len(module.compile_units) == 0:
result.write(' No compile units found.\n')
else:
for cu in module.compile_units:
result.write(' {}\n'.format(cu.file.fullpath))
result.write('\n')
result.flush() | [
"def",
"debug_info",
"(",
"debugger",
",",
"command",
",",
"result",
",",
"internal_dict",
")",
":",
"import",
"shlex",
"args",
"=",
"shlex",
".",
"split",
"(",
"command",
")",
"if",
"len",
"(",
"args",
")",
">",
"0",
":",
"import",
"re",
"regex",
"=... | https://github.com/vadimcn/vscode-lldb/blob/0ece78ec15eda432be7c9e4392aaec9404c29942/adapter/codelldb.py#L294-L315 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/debugger.py | python | Pdb.do_psource | (self, arg) | Print (or run through pager) the source code for an object. | Print (or run through pager) the source code for an object. | [
"Print",
"(",
"or",
"run",
"through",
"pager",
")",
"the",
"source",
"code",
"for",
"an",
"object",
"."
] | def do_psource(self, arg):
"""Print (or run through pager) the source code for an object."""
namespaces = [
("Locals", self.curframe_locals),
("Globals", self.curframe.f_globals),
]
self.shell.find_line_magic("psource")(arg, namespaces=namespaces) | [
"def",
"do_psource",
"(",
"self",
",",
"arg",
")",
":",
"namespaces",
"=",
"[",
"(",
"\"Locals\"",
",",
"self",
".",
"curframe_locals",
")",
",",
"(",
"\"Globals\"",
",",
"self",
".",
"curframe",
".",
"f_globals",
")",
",",
"]",
"self",
".",
"shell",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/debugger.py#L864-L870 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/reduction_gui/reduction/sans/eqsans_sample_script.py | python | SampleData.to_xml | (self) | return BaseScriptElement.addElementToSection(xml_str, "Transmission", "combine_transmission_frames",
str(self.combine_transmission_frames)) | Create XML from the current data. | Create XML from the current data. | [
"Create",
"XML",
"from",
"the",
"current",
"data",
"."
] | def to_xml(self):
"""
Create XML from the current data.
"""
xml_str = super(SampleData, self).to_xml()
return BaseScriptElement.addElementToSection(xml_str, "Transmission", "combine_transmission_frames",
str(self.combine_transmission_frames)) | [
"def",
"to_xml",
"(",
"self",
")",
":",
"xml_str",
"=",
"super",
"(",
"SampleData",
",",
"self",
")",
".",
"to_xml",
"(",
")",
"return",
"BaseScriptElement",
".",
"addElementToSection",
"(",
"xml_str",
",",
"\"Transmission\"",
",",
"\"combine_transmission_frames... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/reduction_gui/reduction/sans/eqsans_sample_script.py#L47-L53 | |
pristineio/webrtc-mirror | 7a5bcdffaab90a05bc1146b2b1ea71c004e54d71 | tools_webrtc/vim/webrtc.ycm_extra_conf.py | python | FlagsForFile | (filename) | return {
'flags': final_flags,
'do_cache': should_cache_flags_for_file
} | This is the main entry point for YCM. Its interface is fixed.
Args:
filename: (String) Path to source file being edited.
Returns:
(Dictionary)
'flags': (List of Strings) Command line flags.
'do_cache': (Boolean) True if the result should be cached. | This is the main entry point for YCM. Its interface is fixed. | [
"This",
"is",
"the",
"main",
"entry",
"point",
"for",
"YCM",
".",
"Its",
"interface",
"is",
"fixed",
"."
] | def FlagsForFile(filename):
"""This is the main entry point for YCM. Its interface is fixed.
Args:
filename: (String) Path to source file being edited.
Returns:
(Dictionary)
'flags': (List of Strings) Command line flags.
'do_cache': (Boolean) True if the result should be cached.
"""
abs_filename = os.path.abspath(filename)
webrtc_root = FindWebrtcSrcFromFilename(abs_filename)
clang_flags = GetClangOptionsFromNinjaForFilename(webrtc_root, abs_filename)
# If clang_flags could not be determined, then assume that was due to a
# transient failure. Preventing YCM from caching the flags allows us to try to
# determine the flags again.
should_cache_flags_for_file = bool(clang_flags)
final_flags = _DEFAULT_FLAGS + clang_flags
return {
'flags': final_flags,
'do_cache': should_cache_flags_for_file
} | [
"def",
"FlagsForFile",
"(",
"filename",
")",
":",
"abs_filename",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"filename",
")",
"webrtc_root",
"=",
"FindWebrtcSrcFromFilename",
"(",
"abs_filename",
")",
"clang_flags",
"=",
"GetClangOptionsFromNinjaForFilename",
"(",... | https://github.com/pristineio/webrtc-mirror/blob/7a5bcdffaab90a05bc1146b2b1ea71c004e54d71/tools_webrtc/vim/webrtc.ycm_extra_conf.py#L332-L357 | |
apache/arrow | af33dd1157eb8d7d9bfac25ebf61445b793b7943 | dev/archery/archery/crossbow/cli.py | python | report | (obj, job_name, sender_name, sender_email, recipient_email,
smtp_user, smtp_password, smtp_server, smtp_port, poll,
poll_max_minutes, poll_interval_minutes, send, fetch) | Send an e-mail report showing success/failure of tasks in a Crossbow run | Send an e-mail report showing success/failure of tasks in a Crossbow run | [
"Send",
"an",
"e",
"-",
"mail",
"report",
"showing",
"success",
"/",
"failure",
"of",
"tasks",
"in",
"a",
"Crossbow",
"run"
] | def report(obj, job_name, sender_name, sender_email, recipient_email,
smtp_user, smtp_password, smtp_server, smtp_port, poll,
poll_max_minutes, poll_interval_minutes, send, fetch):
"""
Send an e-mail report showing success/failure of tasks in a Crossbow run
"""
output = obj['output']
queue = obj['queue']
if fetch:
queue.fetch()
job = queue.get(job_name)
report = EmailReport(
job=job,
sender_name=sender_name,
sender_email=sender_email,
recipient_email=recipient_email
)
if poll:
job.wait_until_finished(
poll_max_minutes=poll_max_minutes,
poll_interval_minutes=poll_interval_minutes
)
if send:
report.send(
smtp_user=smtp_user,
smtp_password=smtp_password,
smtp_server=smtp_server,
smtp_port=smtp_port
)
else:
report.show(output) | [
"def",
"report",
"(",
"obj",
",",
"job_name",
",",
"sender_name",
",",
"sender_email",
",",
"recipient_email",
",",
"smtp_user",
",",
"smtp_password",
",",
"smtp_server",
",",
"smtp_port",
",",
"poll",
",",
"poll_max_minutes",
",",
"poll_interval_minutes",
",",
... | https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/dev/archery/archery/crossbow/cli.py#L268-L301 | ||
alexgkendall/caffe-segnet | 344c113bf1832886f1cbe9f33ffe28a3beeaf412 | scripts/cpp_lint.py | python | CheckEmptyBlockBody | (filename, clean_lines, linenum, error) | Look for empty loop/conditional body with only a single semicolon.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Look for empty loop/conditional body with only a single semicolon. | [
"Look",
"for",
"empty",
"loop",
"/",
"conditional",
"body",
"with",
"only",
"a",
"single",
"semicolon",
"."
] | def CheckEmptyBlockBody(filename, clean_lines, linenum, error):
"""Look for empty loop/conditional body with only a single semicolon.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found.
"""
# Search for loop keywords at the beginning of the line. Because only
# whitespaces are allowed before the keywords, this will also ignore most
# do-while-loops, since those lines should start with closing brace.
#
# We also check "if" blocks here, since an empty conditional block
# is likely an error.
line = clean_lines.elided[linenum]
matched = Match(r'\s*(for|while|if)\s*\(', line)
if matched:
# Find the end of the conditional expression
(end_line, end_linenum, end_pos) = CloseExpression(
clean_lines, linenum, line.find('('))
# Output warning if what follows the condition expression is a semicolon.
# No warning for all other cases, including whitespace or newline, since we
# have a separate check for semicolons preceded by whitespace.
if end_pos >= 0 and Match(r';', end_line[end_pos:]):
if matched.group(1) == 'if':
error(filename, end_linenum, 'whitespace/empty_conditional_body', 5,
'Empty conditional bodies should use {}')
else:
error(filename, end_linenum, 'whitespace/empty_loop_body', 5,
'Empty loop bodies should use {} or continue') | [
"def",
"CheckEmptyBlockBody",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"# Search for loop keywords at the beginning of the line. Because only",
"# whitespaces are allowed before the keywords, this will also ignore most",
"# do-while-loops, since those... | https://github.com/alexgkendall/caffe-segnet/blob/344c113bf1832886f1cbe9f33ffe28a3beeaf412/scripts/cpp_lint.py#L3243-L3275 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/framework/graph_io.py | python | write_graph | (graph_or_graph_def, logdir, name, as_text=True) | return path | Writes a graph proto to a file.
The graph is written as a text proto unless `as_text` is `False`.
```python
v = tf.Variable(0, name='my_variable')
sess = tf.Session()
tf.train.write_graph(sess.graph_def, '/tmp/my-model', 'train.pbtxt')
```
or
```python
v = tf.Variable(0, name='my_variable')
sess = tf.Session()
tf.train.write_graph(sess.graph, '/tmp/my-model', 'train.pbtxt')
```
Args:
graph_or_graph_def: A `Graph` or a `GraphDef` protocol buffer.
logdir: Directory where to write the graph. This can refer to remote
filesystems, such as Google Cloud Storage (GCS).
name: Filename for the graph.
as_text: If `True`, writes the graph as an ASCII proto.
Returns:
The path of the output proto file. | Writes a graph proto to a file. | [
"Writes",
"a",
"graph",
"proto",
"to",
"a",
"file",
"."
] | def write_graph(graph_or_graph_def, logdir, name, as_text=True):
"""Writes a graph proto to a file.
The graph is written as a text proto unless `as_text` is `False`.
```python
v = tf.Variable(0, name='my_variable')
sess = tf.Session()
tf.train.write_graph(sess.graph_def, '/tmp/my-model', 'train.pbtxt')
```
or
```python
v = tf.Variable(0, name='my_variable')
sess = tf.Session()
tf.train.write_graph(sess.graph, '/tmp/my-model', 'train.pbtxt')
```
Args:
graph_or_graph_def: A `Graph` or a `GraphDef` protocol buffer.
logdir: Directory where to write the graph. This can refer to remote
filesystems, such as Google Cloud Storage (GCS).
name: Filename for the graph.
as_text: If `True`, writes the graph as an ASCII proto.
Returns:
The path of the output proto file.
"""
if isinstance(graph_or_graph_def, ops.Graph):
graph_def = graph_or_graph_def.as_graph_def()
else:
graph_def = graph_or_graph_def
# gcs does not have the concept of directory at the moment.
if not file_io.file_exists(logdir) and not logdir.startswith('gs:'):
file_io.recursive_create_dir(logdir)
path = os.path.join(logdir, name)
if as_text:
file_io.atomic_write_string_to_file(path,
text_format.MessageToString(graph_def))
else:
file_io.atomic_write_string_to_file(path, graph_def.SerializeToString())
return path | [
"def",
"write_graph",
"(",
"graph_or_graph_def",
",",
"logdir",
",",
"name",
",",
"as_text",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"graph_or_graph_def",
",",
"ops",
".",
"Graph",
")",
":",
"graph_def",
"=",
"graph_or_graph_def",
".",
"as_graph_def",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/framework/graph_io.py#L29-L72 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/jit/_trace.py | python | trace_module | (
mod,
inputs,
optimize=None,
check_trace=True,
check_inputs=None,
check_tolerance=1e-5,
strict=True,
_force_outplace=False,
_module_class=None,
_compilation_unit=_python_cu,
) | return module | Trace a module and return an executable :class:`ScriptModule` that will be optimized
using just-in-time compilation. When a module is passed to :func:`torch.jit.trace <torch.jit.trace>`, only
the ``forward`` method is run and traced. With ``trace_module``, you can specify a dictionary of
method names to example inputs to trace (see the ``inputs``) argument below.
See :func:`torch.jit.trace <torch.jit.trace>` for more information on tracing.
Args:
mod (torch.nn.Module): A ``torch.nn.Module`` containing methods whose names are
specified in ``inputs``. The given methods will be compiled
as a part of a single `ScriptModule`.
inputs (dict): A dict containing sample inputs indexed by method names in ``mod``.
The inputs will be passed to methods whose names correspond to inputs'
keys while tracing.
``{ 'forward' : example_forward_input, 'method2': example_method2_input}``
Keyword arguments:
check_trace (``bool``, optional): Check if the same inputs run through
traced code produce the same outputs. Default: ``True``. You might want
to disable this if, for example, your network contains non-
deterministic ops or if you are sure that the network is correct despite
a checker failure.
check_inputs (list of dicts, optional): A list of dicts of input arguments that should be used
to check the trace against what is expected. Each tuple
is equivalent to a set of input arguments that would
be specified in ``inputs``. For best results, pass in a
set of checking inputs representative of the space of
shapes and types of inputs you expect the network to see.
If not specified, the original ``inputs`` are used for checking
check_tolerance (float, optional): Floating-point comparison tolerance to use in the checker procedure.
This can be used to relax the checker strictness in the event that
results diverge numerically for a known reason, such as operator fusion.
Returns:
A :class:`ScriptModule` object with a single ``forward`` method containing the traced code.
When ``func`` is a ``torch.nn.Module``, the returned :class:`ScriptModule` will have the same set of
sub-modules and parameters as ``func``.
Example (tracing a module with multiple methods)::
import torch
import torch.nn as nn
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv = nn.Conv2d(1, 1, 3)
def forward(self, x):
return self.conv(x)
def weighted_kernel_sum(self, weight):
return weight * self.conv.weight
n = Net()
example_weight = torch.rand(1, 1, 3, 3)
example_forward_input = torch.rand(1, 1, 3, 3)
# Trace a specific method and construct `ScriptModule` with
# a single `forward` method
module = torch.jit.trace(n.forward, example_forward_input)
# Trace a module (implicitly traces `forward`) and construct a
# `ScriptModule` with a single `forward` method
module = torch.jit.trace(n, example_forward_input)
# Trace specific methods on a module (specified in `inputs`), constructs
# a `ScriptModule` with `forward` and `weighted_kernel_sum` methods
inputs = {'forward' : example_forward_input, 'weighted_kernel_sum' : example_weight}
module = torch.jit.trace_module(n, inputs) | Trace a module and return an executable :class:`ScriptModule` that will be optimized
using just-in-time compilation. When a module is passed to :func:`torch.jit.trace <torch.jit.trace>`, only
the ``forward`` method is run and traced. With ``trace_module``, you can specify a dictionary of
method names to example inputs to trace (see the ``inputs``) argument below. | [
"Trace",
"a",
"module",
"and",
"return",
"an",
"executable",
":",
"class",
":",
"ScriptModule",
"that",
"will",
"be",
"optimized",
"using",
"just",
"-",
"in",
"-",
"time",
"compilation",
".",
"When",
"a",
"module",
"is",
"passed",
"to",
":",
"func",
":",... | def trace_module(
mod,
inputs,
optimize=None,
check_trace=True,
check_inputs=None,
check_tolerance=1e-5,
strict=True,
_force_outplace=False,
_module_class=None,
_compilation_unit=_python_cu,
):
"""
Trace a module and return an executable :class:`ScriptModule` that will be optimized
using just-in-time compilation. When a module is passed to :func:`torch.jit.trace <torch.jit.trace>`, only
the ``forward`` method is run and traced. With ``trace_module``, you can specify a dictionary of
method names to example inputs to trace (see the ``inputs``) argument below.
See :func:`torch.jit.trace <torch.jit.trace>` for more information on tracing.
Args:
mod (torch.nn.Module): A ``torch.nn.Module`` containing methods whose names are
specified in ``inputs``. The given methods will be compiled
as a part of a single `ScriptModule`.
inputs (dict): A dict containing sample inputs indexed by method names in ``mod``.
The inputs will be passed to methods whose names correspond to inputs'
keys while tracing.
``{ 'forward' : example_forward_input, 'method2': example_method2_input}``
Keyword arguments:
check_trace (``bool``, optional): Check if the same inputs run through
traced code produce the same outputs. Default: ``True``. You might want
to disable this if, for example, your network contains non-
deterministic ops or if you are sure that the network is correct despite
a checker failure.
check_inputs (list of dicts, optional): A list of dicts of input arguments that should be used
to check the trace against what is expected. Each tuple
is equivalent to a set of input arguments that would
be specified in ``inputs``. For best results, pass in a
set of checking inputs representative of the space of
shapes and types of inputs you expect the network to see.
If not specified, the original ``inputs`` are used for checking
check_tolerance (float, optional): Floating-point comparison tolerance to use in the checker procedure.
This can be used to relax the checker strictness in the event that
results diverge numerically for a known reason, such as operator fusion.
Returns:
A :class:`ScriptModule` object with a single ``forward`` method containing the traced code.
When ``func`` is a ``torch.nn.Module``, the returned :class:`ScriptModule` will have the same set of
sub-modules and parameters as ``func``.
Example (tracing a module with multiple methods)::
import torch
import torch.nn as nn
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv = nn.Conv2d(1, 1, 3)
def forward(self, x):
return self.conv(x)
def weighted_kernel_sum(self, weight):
return weight * self.conv.weight
n = Net()
example_weight = torch.rand(1, 1, 3, 3)
example_forward_input = torch.rand(1, 1, 3, 3)
# Trace a specific method and construct `ScriptModule` with
# a single `forward` method
module = torch.jit.trace(n.forward, example_forward_input)
# Trace a module (implicitly traces `forward`) and construct a
# `ScriptModule` with a single `forward` method
module = torch.jit.trace(n, example_forward_input)
# Trace specific methods on a module (specified in `inputs`), constructs
# a `ScriptModule` with `forward` and `weighted_kernel_sum` methods
inputs = {'forward' : example_forward_input, 'weighted_kernel_sum' : example_weight}
module = torch.jit.trace_module(n, inputs)
"""
if not _enabled:
return mod
if optimize is not None:
warnings.warn(
"`optimize` is deprecated and has no effect. Use `with torch.jit.optimized_execution() instead"
)
var_lookup_fn = _create_interpreter_name_lookup_fn(0)
if not isinstance(mod, torch.nn.Module):
raise AttributeError("expected torch.nn.Module as the first argument")
if not isinstance(inputs, dict):
raise AttributeError("expected a dictionary of (method_name, input) pairs")
old_module_map = torch.jit._trace._trace_module_map
try:
trace_module_map: Dict[Any, Any] = {}
def register_submods(mod, prefix):
for name, child in mod.named_children():
submod_qualname = prefix + "." + name
trace_module_map[child] = submod_qualname
register_submods(child, submod_qualname)
trace_module_map["__module"] = mod
torch.jit._trace._trace_module_map = trace_module_map
register_submods(mod, "__module")
module = make_module(mod, _module_class, _compilation_unit)
for method_name, example_inputs in inputs.items():
if method_name == "forward":
# "forward" is a special case because we need to trace
# `Module.__call__`, which sets up some extra tracing, but uses
# argument names of the real `Module.forward` method.
func = mod
forward_method = getattr(mod, method_name)
argument_names = get_callable_argument_names(forward_method)
else:
func = getattr(mod, method_name)
argument_names = get_callable_argument_names(func)
example_inputs = make_tuple(example_inputs)
module._c._create_method_from_trace(
method_name,
func,
example_inputs,
var_lookup_fn,
strict,
_force_outplace,
argument_names,
)
check_trace_method = module._c._get_method(method_name)
# Check the trace against new traces created from user-specified inputs
if check_trace:
if check_inputs is not None:
_check_trace(
check_inputs,
func,
check_trace_method,
check_tolerance,
strict,
_force_outplace,
True,
_module_class,
)
else:
_check_trace(
[inputs],
func,
check_trace_method,
check_tolerance,
strict,
_force_outplace,
True,
_module_class,
)
finally:
torch.jit._trace._trace_module_map = old_module_map
return module | [
"def",
"trace_module",
"(",
"mod",
",",
"inputs",
",",
"optimize",
"=",
"None",
",",
"check_trace",
"=",
"True",
",",
"check_inputs",
"=",
"None",
",",
"check_tolerance",
"=",
"1e-5",
",",
"strict",
"=",
"True",
",",
"_force_outplace",
"=",
"False",
",",
... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/jit/_trace.py#L827-L996 | |
lmb-freiburg/ogn | 974f72ef4bf840d6f6693d22d1843a79223e77ce | scripts/cpp_lint.py | python | CheckForHeaderGuard | (filename, lines, error) | Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used.
Args:
filename: The name of the C++ header file.
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found. | Checks that the file contains a header guard. | [
"Checks",
"that",
"the",
"file",
"contains",
"a",
"header",
"guard",
"."
] | def CheckForHeaderGuard(filename, lines, error):
"""Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used.
Args:
filename: The name of the C++ header file.
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found.
"""
cppvar = GetHeaderGuardCPPVariable(filename)
ifndef = None
ifndef_linenum = 0
define = None
endif = None
endif_linenum = 0
for linenum, line in enumerate(lines):
linesplit = line.split()
if len(linesplit) >= 2:
# find the first occurrence of #ifndef and #define, save arg
if not ifndef and linesplit[0] == '#ifndef':
# set ifndef to the header guard presented on the #ifndef line.
ifndef = linesplit[1]
ifndef_linenum = linenum
if not define and linesplit[0] == '#define':
define = linesplit[1]
# find the last occurrence of #endif, save entire line
if line.startswith('#endif'):
endif = line
endif_linenum = linenum
if not ifndef:
error(filename, 0, 'build/header_guard', 5,
'No #ifndef header guard found, suggested CPP variable is: %s' %
cppvar)
return
if not define:
error(filename, 0, 'build/header_guard', 5,
'No #define header guard found, suggested CPP variable is: %s' %
cppvar)
return
# The guard should be PATH_FILE_H_, but we also allow PATH_FILE_H__
# for backward compatibility.
if ifndef != cppvar:
error_level = 0
if ifndef != cppvar + '_':
error_level = 5
ParseNolintSuppressions(filename, lines[ifndef_linenum], ifndef_linenum,
error)
error(filename, ifndef_linenum, 'build/header_guard', error_level,
'#ifndef header guard has wrong style, please use: %s' % cppvar)
if define != ifndef:
error(filename, 0, 'build/header_guard', 5,
'#ifndef and #define don\'t match, suggested CPP variable is: %s' %
cppvar)
return
if endif != ('#endif // %s' % cppvar):
error_level = 0
if endif != ('#endif // %s' % (cppvar + '_')):
error_level = 5
ParseNolintSuppressions(filename, lines[endif_linenum], endif_linenum,
error)
error(filename, endif_linenum, 'build/header_guard', error_level,
'#endif line should be "#endif // %s"' % cppvar) | [
"def",
"CheckForHeaderGuard",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"cppvar",
"=",
"GetHeaderGuardCPPVariable",
"(",
"filename",
")",
"ifndef",
"=",
"None",
"ifndef_linenum",
"=",
"0",
"define",
"=",
"None",
"endif",
"=",
"None",
"endif_linenu... | https://github.com/lmb-freiburg/ogn/blob/974f72ef4bf840d6f6693d22d1843a79223e77ce/scripts/cpp_lint.py#L1408-L1480 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/ttk.py | python | Treeview.set | (self, item, column=None, value=None) | Query or set the value of given item.
With one argument, return a dictionary of column/value pairs
for the specified item. With two arguments, return the current
value of the specified column. With three arguments, set the
value of given column in given item to the specified value. | Query or set the value of given item. | [
"Query",
"or",
"set",
"the",
"value",
"of",
"given",
"item",
"."
] | def set(self, item, column=None, value=None):
"""Query or set the value of given item.
With one argument, return a dictionary of column/value pairs
for the specified item. With two arguments, return the current
value of the specified column. With three arguments, set the
value of given column in given item to the specified value."""
res = self.tk.call(self._w, "set", item, column, value)
if column is None and value is None:
return _splitdict(self.tk, res,
cut_minus=False, conv=_tclobj_to_py)
else:
return res | [
"def",
"set",
"(",
"self",
",",
"item",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
")",
":",
"res",
"=",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"\"set\"",
",",
"item",
",",
"column",
",",
"value",
")",
"if",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/ttk.py#L1476-L1488 | ||
alexgkendall/caffe-posenet | 62aafbd7c45df91acdba14f5d1406d8295c2bc6f | python/caffe/pycaffe.py | python | _Net_backward | (self, diffs=None, start=None, end=None, **kwargs) | return {out: self.blobs[out].diff for out in outputs} | Backward pass: prepare diffs and run the net backward.
Parameters
----------
diffs : list of diffs to return in addition to bottom diffs.
kwargs : Keys are output blob names and values are diff ndarrays.
If None, top diffs are taken from forward loss.
start : optional name of layer at which to begin the backward pass
end : optional name of layer at which to finish the backward pass
(inclusive)
Returns
-------
outs: {blob name: diff ndarray} dict. | Backward pass: prepare diffs and run the net backward. | [
"Backward",
"pass",
":",
"prepare",
"diffs",
"and",
"run",
"the",
"net",
"backward",
"."
] | def _Net_backward(self, diffs=None, start=None, end=None, **kwargs):
"""
Backward pass: prepare diffs and run the net backward.
Parameters
----------
diffs : list of diffs to return in addition to bottom diffs.
kwargs : Keys are output blob names and values are diff ndarrays.
If None, top diffs are taken from forward loss.
start : optional name of layer at which to begin the backward pass
end : optional name of layer at which to finish the backward pass
(inclusive)
Returns
-------
outs: {blob name: diff ndarray} dict.
"""
if diffs is None:
diffs = []
if start is not None:
start_ind = list(self._layer_names).index(start)
else:
start_ind = len(self.layers) - 1
if end is not None:
end_ind = list(self._layer_names).index(end)
outputs = set([end] + diffs)
else:
end_ind = 0
outputs = set(self.inputs + diffs)
if kwargs:
if set(kwargs.keys()) != set(self.outputs):
raise Exception('Top diff arguments do not match net outputs.')
# Set top diffs according to defined shapes and make arrays single and
# C-contiguous as Caffe expects.
for top, diff in kwargs.iteritems():
if diff.shape[0] != self.blobs[top].num:
raise Exception('Diff is not batch sized')
self.blobs[top].diff[...] = diff
self._backward(start_ind, end_ind)
# Unpack diffs to extract
return {out: self.blobs[out].diff for out in outputs} | [
"def",
"_Net_backward",
"(",
"self",
",",
"diffs",
"=",
"None",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"diffs",
"is",
"None",
":",
"diffs",
"=",
"[",
"]",
"if",
"start",
"is",
"not",
"None",
... | https://github.com/alexgkendall/caffe-posenet/blob/62aafbd7c45df91acdba14f5d1406d8295c2bc6f/python/caffe/pycaffe.py#L111-L156 | |
CalcProgrammer1/OpenRGB | 8156b0167a7590dd8ba561dfde524bfcacf46b5e | dependencies/mbedtls-2.24.0/scripts/config.py | python | Config.__getitem__ | (self, name) | return self.settings[name].value | Get the value of name, i.e. what the preprocessor symbol expands to.
If name is not known, raise KeyError. name does not need to be active. | Get the value of name, i.e. what the preprocessor symbol expands to. | [
"Get",
"the",
"value",
"of",
"name",
"i",
".",
"e",
".",
"what",
"the",
"preprocessor",
"symbol",
"expands",
"to",
"."
] | def __getitem__(self, name):
"""Get the value of name, i.e. what the preprocessor symbol expands to.
If name is not known, raise KeyError. name does not need to be active.
"""
return self.settings[name].value | [
"def",
"__getitem__",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"settings",
"[",
"name",
"]",
".",
"value"
] | https://github.com/CalcProgrammer1/OpenRGB/blob/8156b0167a7590dd8ba561dfde524bfcacf46b5e/dependencies/mbedtls-2.24.0/scripts/config.py#L86-L91 | |
papyrussolution/OpenPapyrus | bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91 | Src/OSF/protobuf-3.19.1/python/google/protobuf/internal/well_known_types.py | python | Timestamp.FromMilliseconds | (self, millis) | Converts milliseconds since epoch to Timestamp. | Converts milliseconds since epoch to Timestamp. | [
"Converts",
"milliseconds",
"since",
"epoch",
"to",
"Timestamp",
"."
] | def FromMilliseconds(self, millis):
"""Converts milliseconds since epoch to Timestamp."""
self.seconds = millis // _MILLIS_PER_SECOND
self.nanos = (millis % _MILLIS_PER_SECOND) * _NANOS_PER_MILLISECOND | [
"def",
"FromMilliseconds",
"(",
"self",
",",
"millis",
")",
":",
"self",
".",
"seconds",
"=",
"millis",
"//",
"_MILLIS_PER_SECOND",
"self",
".",
"nanos",
"=",
"(",
"millis",
"%",
"_MILLIS_PER_SECOND",
")",
"*",
"_NANOS_PER_MILLISECOND"
] | https://github.com/papyrussolution/OpenPapyrus/blob/bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91/Src/OSF/protobuf-3.19.1/python/google/protobuf/internal/well_known_types.py#L224-L227 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/gyp/pylib/gyp/mac_tool.py | python | MacTool.ExecCodeSignBundle | (self, key, entitlements, provisioning, path, preserve) | Code sign a bundle.
This function tries to code sign an iOS bundle, following the same
algorithm as Xcode:
1. pick the provisioning profile that best match the bundle identifier,
and copy it into the bundle as embedded.mobileprovision,
2. copy Entitlements.plist from user or SDK next to the bundle,
3. code sign the bundle. | Code sign a bundle. | [
"Code",
"sign",
"a",
"bundle",
"."
] | def ExecCodeSignBundle(self, key, entitlements, provisioning, path, preserve):
"""Code sign a bundle.
This function tries to code sign an iOS bundle, following the same
algorithm as Xcode:
1. pick the provisioning profile that best match the bundle identifier,
and copy it into the bundle as embedded.mobileprovision,
2. copy Entitlements.plist from user or SDK next to the bundle,
3. code sign the bundle.
"""
substitutions, overrides = self._InstallProvisioningProfile(
provisioning, self._GetCFBundleIdentifier())
entitlements_path = self._InstallEntitlements(
entitlements, substitutions, overrides)
args = ['codesign', '--force', '--sign', key]
if preserve == 'True':
args.extend(['--deep', '--preserve-metadata=identifier,entitlements'])
else:
args.extend(['--entitlements', entitlements_path])
args.extend(['--timestamp=none', path])
subprocess.check_call(args) | [
"def",
"ExecCodeSignBundle",
"(",
"self",
",",
"key",
",",
"entitlements",
",",
"provisioning",
",",
"path",
",",
"preserve",
")",
":",
"substitutions",
",",
"overrides",
"=",
"self",
".",
"_InstallProvisioningProfile",
"(",
"provisioning",
",",
"self",
".",
"... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/gyp/pylib/gyp/mac_tool.py#L411-L432 | ||
NVIDIA/TensorRT | 42805f078052daad1a98bc5965974fcffaad0960 | demo/HuggingFace/NNDF/models.py | python | NNModelFile.__init__ | (
self,
default_converter: ModelFileConverter = None,
network_metadata: NetworkMetadata = None,
) | Since torch functions often allow for models to either be from disk as fpath or from a loaded object,
we provide a similar option here. Arguments can either be a path on disk or from model itself.
Args:
model (Union[str, torch.Model]): Location of the model as fpath OR loaded torch.Model object. | Since torch functions often allow for models to either be from disk as fpath or from a loaded object,
we provide a similar option here. Arguments can either be a path on disk or from model itself. | [
"Since",
"torch",
"functions",
"often",
"allow",
"for",
"models",
"to",
"either",
"be",
"from",
"disk",
"as",
"fpath",
"or",
"from",
"a",
"loaded",
"object",
"we",
"provide",
"a",
"similar",
"option",
"here",
".",
"Arguments",
"can",
"either",
"be",
"a",
... | def __init__(
self,
default_converter: ModelFileConverter = None,
network_metadata: NetworkMetadata = None,
):
"""
Since torch functions often allow for models to either be from disk as fpath or from a loaded object,
we provide a similar option here. Arguments can either be a path on disk or from model itself.
Args:
model (Union[str, torch.Model]): Location of the model as fpath OR loaded torch.Model object.
"""
if default_converter is not None:
self.default_converter = default_converter()
else:
self.default_converter = NullConverter()
self.network_metadata = network_metadata | [
"def",
"__init__",
"(",
"self",
",",
"default_converter",
":",
"ModelFileConverter",
"=",
"None",
",",
"network_metadata",
":",
"NetworkMetadata",
"=",
"None",
",",
")",
":",
"if",
"default_converter",
"is",
"not",
"None",
":",
"self",
".",
"default_converter",
... | https://github.com/NVIDIA/TensorRT/blob/42805f078052daad1a98bc5965974fcffaad0960/demo/HuggingFace/NNDF/models.py#L137-L154 | ||
apache/madlib | be297fe6beada0640f93317e8948834032718e32 | src/madpack/upgrade_util.py | python | ChangeHandler.drop_changed_udo | (self) | @brief Drop all operators (UDO) that were removed/updated in new version | [] | def drop_changed_udo(self):
"""
@brief Drop all operators (UDO) that were removed/updated in new version
"""
for op in self._udo:
for value in self._udo[op]:
leftarg = value['leftarg'].replace('schema_madlib', self._schema)
rightarg = value['rightarg'].replace('schema_madlib', self._schema)
_write_to_file(self.output_filehandle, """
DROP OPERATOR IF EXISTS {schema}.{op} ({leftarg}, {rightarg});
""".format(schema=self._schema, **locals())) | [
"def",
"drop_changed_udo",
"(",
"self",
")",
":",
"for",
"op",
"in",
"self",
".",
"_udo",
":",
"for",
"value",
"in",
"self",
".",
"_udo",
"[",
"op",
"]",
":",
"leftarg",
"=",
"value",
"[",
"'leftarg'",
"]",
".",
"replace",
"(",
"'schema_madlib'",
","... | https://github.com/apache/madlib/blob/be297fe6beada0640f93317e8948834032718e32/src/madpack/upgrade_util.py#L452-L462 | |||
cornell-zhang/heterocl | 6d9e4b4acc2ee2707b2d25b27298c0335bccedfd | python/heterocl/tvm/_ffi/node.py | python | NodeBase.same_as | (self, other) | return self.__hash__() == other.__hash__() | check object identity equality | check object identity equality | [
"check",
"object",
"identity",
"equality"
] | def same_as(self, other):
"""check object identity equality"""
if not isinstance(other, NodeBase):
return False
return self.__hash__() == other.__hash__() | [
"def",
"same_as",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"NodeBase",
")",
":",
"return",
"False",
"return",
"self",
".",
"__hash__",
"(",
")",
"==",
"other",
".",
"__hash__",
"(",
")"
] | https://github.com/cornell-zhang/heterocl/blob/6d9e4b4acc2ee2707b2d25b27298c0335bccedfd/python/heterocl/tvm/_ffi/node.py#L68-L72 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/dynamodb/layer1.py | python | Layer1.list_tables | (self, limit=None, start_table=None) | return self.make_request('ListTables', json_input) | Returns a dictionary of results. The dictionary contains
a **TableNames** key whose value is a list of the table names.
The dictionary could also contain a **LastEvaluatedTableName**
key whose value would be the last table name returned if
the complete list of table names was not returned. This
value would then be passed as the ``start_table`` parameter on
a subsequent call to this method.
:type limit: int
:param limit: The maximum number of tables to return.
:type start_table: str
:param start_table: The name of the table that starts the
list. If you ran a previous list_tables and not
all results were returned, the response dict would
include a LastEvaluatedTableName attribute. Use
that value here to continue the listing. | Returns a dictionary of results. The dictionary contains
a **TableNames** key whose value is a list of the table names.
The dictionary could also contain a **LastEvaluatedTableName**
key whose value would be the last table name returned if
the complete list of table names was not returned. This
value would then be passed as the ``start_table`` parameter on
a subsequent call to this method. | [
"Returns",
"a",
"dictionary",
"of",
"results",
".",
"The",
"dictionary",
"contains",
"a",
"**",
"TableNames",
"**",
"key",
"whose",
"value",
"is",
"a",
"list",
"of",
"the",
"table",
"names",
".",
"The",
"dictionary",
"could",
"also",
"contain",
"a",
"**",
... | def list_tables(self, limit=None, start_table=None):
"""
Returns a dictionary of results. The dictionary contains
a **TableNames** key whose value is a list of the table names.
The dictionary could also contain a **LastEvaluatedTableName**
key whose value would be the last table name returned if
the complete list of table names was not returned. This
value would then be passed as the ``start_table`` parameter on
a subsequent call to this method.
:type limit: int
:param limit: The maximum number of tables to return.
:type start_table: str
:param start_table: The name of the table that starts the
list. If you ran a previous list_tables and not
all results were returned, the response dict would
include a LastEvaluatedTableName attribute. Use
that value here to continue the listing.
"""
data = {}
if limit:
data['Limit'] = limit
if start_table:
data['ExclusiveStartTableName'] = start_table
json_input = json.dumps(data)
return self.make_request('ListTables', json_input) | [
"def",
"list_tables",
"(",
"self",
",",
"limit",
"=",
"None",
",",
"start_table",
"=",
"None",
")",
":",
"data",
"=",
"{",
"}",
"if",
"limit",
":",
"data",
"[",
"'Limit'",
"]",
"=",
"limit",
"if",
"start_table",
":",
"data",
"[",
"'ExclusiveStartTableN... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/dynamodb/layer1.py#L180-L206 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/distributions/python/ops/student_t.py | python | StudentT.mu | (self) | return self._mu | Locations of these Student's t distribution(s). | Locations of these Student's t distribution(s). | [
"Locations",
"of",
"these",
"Student",
"s",
"t",
"distribution",
"(",
"s",
")",
"."
] | def mu(self):
"""Locations of these Student's t distribution(s)."""
return self._mu | [
"def",
"mu",
"(",
"self",
")",
":",
"return",
"self",
".",
"_mu"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/distributions/python/ops/student_t.py#L154-L156 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/lib/npyio.py | python | NpzFile.keys | (self) | return self.files | Return files in the archive with a ".npy" extension. | Return files in the archive with a ".npy" extension. | [
"Return",
"files",
"in",
"the",
"archive",
"with",
"a",
".",
"npy",
"extension",
"."
] | def keys(self):
"""Return files in the archive with a ".npy" extension."""
return self.files | [
"def",
"keys",
"(",
"self",
")",
":",
"return",
"self",
".",
"files"
] | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/lib/npyio.py#L253-L255 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/base.py | python | data_dir_default | () | :return: default data directory depending on the platform and environment variables | [] | def data_dir_default():
"""
:return: default data directory depending on the platform and environment variables
"""
system = platform.system()
if system == 'Windows':
return os.path.join(os.environ.get('APPDATA'), 'mxnet')
else:
return os.path.join(os.path.expanduser("~"), '.mxnet') | [
"def",
"data_dir_default",
"(",
")",
":",
"system",
"=",
"platform",
".",
"system",
"(",
")",
"if",
"system",
"==",
"'Windows'",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"environ",
".",
"get",
"(",
"'APPDATA'",
")",
",",
"'mxnet... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/base.py#L59-L68 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.