nwo stringlengths 5 86 | sha stringlengths 40 40 | path stringlengths 4 189 | language stringclasses 1
value | identifier stringlengths 1 94 | parameters stringlengths 2 4.03k | argument_list stringclasses 1
value | return_statement stringlengths 0 11.5k | docstring stringlengths 1 33.2k | docstring_summary stringlengths 0 5.15k | docstring_tokens list | function stringlengths 34 151k | function_tokens list | url stringlengths 90 278 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/manifest.py | python | Manifest._include_pattern | (self, pattern, anchor=True, prefix=None,
is_regex=False) | return found | Select strings (presumably filenames) from 'self.files' that
match 'pattern', a Unix-style wildcard (glob) pattern.
Patterns are not quite the same as implemented by the 'fnmatch'
module: '*' and '?' match non-special characters, where "special"
is platform-dependent: slash on Uni... | Select strings (presumably filenames) from 'self.files' that | [
"Select",
"strings",
"(",
"presumably",
"filenames",
")",
"from",
"self",
".",
"files",
"that"
] | def _include_pattern(self, pattern, anchor=True, prefix=None,
is_regex=False):
"""Select strings (presumably filenames) from 'self.files' that
match 'pattern', a Unix-style wildcard (glob) pattern.
Patterns are not quite the same as implemented by the 'fnmatch'
... | [
"def",
"_include_pattern",
"(",
"self",
",",
"pattern",
",",
"anchor",
"=",
"True",
",",
"prefix",
"=",
"None",
",",
"is_regex",
"=",
"False",
")",
":",
"# XXX docstring lying about what the special chars are?",
"found",
"=",
"False",
"pattern_re",
"=",
"self",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/manifest.py#L511-L589 | |
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Subst.py | python | ListSubber.next_line | (self) | Arrange for the next word to start a new line. This
is like starting a new word, except that we have to append
another line to the result. | Arrange for the next word to start a new line. This
is like starting a new word, except that we have to append
another line to the result. | [
"Arrange",
"for",
"the",
"next",
"word",
"to",
"start",
"a",
"new",
"line",
".",
"This",
"is",
"like",
"starting",
"a",
"new",
"word",
"except",
"that",
"we",
"have",
"to",
"append",
"another",
"line",
"to",
"the",
"result",
"."
] | def next_line(self):
"""Arrange for the next word to start a new line. This
is like starting a new word, except that we have to append
another line to the result."""
collections.UserList.append(self, [])
self.next_word() | [
"def",
"next_line",
"(",
"self",
")",
":",
"collections",
".",
"UserList",
".",
"append",
"(",
"self",
",",
"[",
"]",
")",
"self",
".",
"next_word",
"(",
")"
] | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Subst.py#L639-L644 | ||
ValveSoftware/source-sdk-2013 | 0d8dceea4310fde5706b3ce1c70609d72a38efdf | sp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/wire_format.py | python | UnpackTag | (tag) | return (tag >> TAG_TYPE_BITS), (tag & TAG_TYPE_MASK) | The inverse of PackTag(). Given an unsigned 32-bit number,
returns a (field_number, wire_type) tuple. | The inverse of PackTag(). Given an unsigned 32-bit number,
returns a (field_number, wire_type) tuple. | [
"The",
"inverse",
"of",
"PackTag",
"()",
".",
"Given",
"an",
"unsigned",
"32",
"-",
"bit",
"number",
"returns",
"a",
"(",
"field_number",
"wire_type",
")",
"tuple",
"."
] | def UnpackTag(tag):
"""The inverse of PackTag(). Given an unsigned 32-bit number,
returns a (field_number, wire_type) tuple.
"""
return (tag >> TAG_TYPE_BITS), (tag & TAG_TYPE_MASK) | [
"def",
"UnpackTag",
"(",
"tag",
")",
":",
"return",
"(",
"tag",
">>",
"TAG_TYPE_BITS",
")",
",",
"(",
"tag",
"&",
"TAG_TYPE_MASK",
")"
] | https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/wire_format.py#L93-L97 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2.py | python | uCSIsArabicPresentationFormsA | (code) | return ret | Check whether the character is part of
ArabicPresentationForms-A UCS Block | Check whether the character is part of
ArabicPresentationForms-A UCS Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"ArabicPresentationForms",
"-",
"A",
"UCS",
"Block"
] | def uCSIsArabicPresentationFormsA(code):
"""Check whether the character is part of
ArabicPresentationForms-A UCS Block """
ret = libxml2mod.xmlUCSIsArabicPresentationFormsA(code)
return ret | [
"def",
"uCSIsArabicPresentationFormsA",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsArabicPresentationFormsA",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L2109-L2113 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pyparsing.py | python | withClass | (classname, namespace='') | return withAttribute(**{classattr: classname}) | Simplified version of :class:`withAttribute` when
matching on a div class - made difficult because ``class`` is
a reserved word in Python.
Example::
html = '''
<div>
Some text
<div class="grid">1 4 0 1 0</div>
<div class="graph">1,3 2,3 1,1</div>
... | Simplified version of :class:`withAttribute` when
matching on a div class - made difficult because ``class`` is
a reserved word in Python. | [
"Simplified",
"version",
"of",
":",
"class",
":",
"withAttribute",
"when",
"matching",
"on",
"a",
"div",
"class",
"-",
"made",
"difficult",
"because",
"class",
"is",
"a",
"reserved",
"word",
"in",
"Python",
"."
] | def withClass(classname, namespace=''):
"""Simplified version of :class:`withAttribute` when
matching on a div class - made difficult because ``class`` is
a reserved word in Python.
Example::
html = '''
<div>
Some text
<div class="grid">1 4 0 1 0</div>
... | [
"def",
"withClass",
"(",
"classname",
",",
"namespace",
"=",
"''",
")",
":",
"classattr",
"=",
"\"%s:class\"",
"%",
"namespace",
"if",
"namespace",
"else",
"\"class\"",
"return",
"withAttribute",
"(",
"*",
"*",
"{",
"classattr",
":",
"classname",
"}",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pyparsing.py#L5946-L5982 | |
msftguy/ssh-rd | a5f3a79daeac5844edebf01916c9613563f1c390 | _3rd/boost_1_48_0/tools/build/v2/util/utility.py | python | to_seq | (value) | If value is a sequence, returns it.
If it is a string, returns a sequence with value as its sole element. | If value is a sequence, returns it.
If it is a string, returns a sequence with value as its sole element. | [
"If",
"value",
"is",
"a",
"sequence",
"returns",
"it",
".",
"If",
"it",
"is",
"a",
"string",
"returns",
"a",
"sequence",
"with",
"value",
"as",
"its",
"sole",
"element",
"."
] | def to_seq (value):
""" If value is a sequence, returns it.
If it is a string, returns a sequence with value as its sole element.
"""
if not value:
return []
if isinstance (value, str):
return [value]
else:
return value | [
"def",
"to_seq",
"(",
"value",
")",
":",
"if",
"not",
"value",
":",
"return",
"[",
"]",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"return",
"[",
"value",
"]",
"else",
":",
"return",
"value"
] | https://github.com/msftguy/ssh-rd/blob/a5f3a79daeac5844edebf01916c9613563f1c390/_3rd/boost_1_48_0/tools/build/v2/util/utility.py#L19-L30 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/xcode_emulation.py | python | XcodeSettings.GetMachOType | (self) | return {
'executable': 'mh_execute',
'static_library': 'staticlib',
'shared_library': 'mh_dylib',
'loadable_module': 'mh_bundle',
}[self.spec['type']] | Returns the MACH_O_TYPE of this target. | Returns the MACH_O_TYPE of this target. | [
"Returns",
"the",
"MACH_O_TYPE",
"of",
"this",
"target",
"."
] | def GetMachOType(self):
"""Returns the MACH_O_TYPE of this target."""
# Weird, but matches Xcode.
if not self._IsBundle() and self.spec['type'] == 'executable':
return ''
return {
'executable': 'mh_execute',
'static_library': 'staticlib',
'shared_library': 'mh_dylib',
'load... | [
"def",
"GetMachOType",
"(",
"self",
")",
":",
"# Weird, but matches Xcode.",
"if",
"not",
"self",
".",
"_IsBundle",
"(",
")",
"and",
"self",
".",
"spec",
"[",
"'type'",
"]",
"==",
"'executable'",
":",
"return",
"''",
"return",
"{",
"'executable'",
":",
"'m... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/xcode_emulation.py#L144-L154 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/cython/Cython/Compiler/FlowControl.py | python | ControlFlow.normalize | (self) | Delete unreachable and orphan blocks. | Delete unreachable and orphan blocks. | [
"Delete",
"unreachable",
"and",
"orphan",
"blocks",
"."
] | def normalize(self):
"""Delete unreachable and orphan blocks."""
queue = set([self.entry_point])
visited = set()
while queue:
root = queue.pop()
visited.add(root)
for child in root.children:
if child not in visited:
... | [
"def",
"normalize",
"(",
"self",
")",
":",
"queue",
"=",
"set",
"(",
"[",
"self",
".",
"entry_point",
"]",
")",
"visited",
"=",
"set",
"(",
")",
"while",
"queue",
":",
"root",
"=",
"queue",
".",
"pop",
"(",
")",
"visited",
".",
"add",
"(",
"root"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/cython/Cython/Compiler/FlowControl.py#L204-L225 | ||
apache/mesos | 97d9a4063332aae3825d78de71611657e05cf5e2 | src/python/interface/src/mesos/interface/__init__.py | python | ExecutorDriver.sendStatusUpdate | (self, status) | Sends a status update to the framework scheduler, retrying as
necessary until an acknowledgement has been received or the executor
is terminated (in which case, a TASK_LOST status update will be sent).
See Scheduler.statusUpdate for more information about status update
acknowledgements. | Sends a status update to the framework scheduler, retrying as
necessary until an acknowledgement has been received or the executor
is terminated (in which case, a TASK_LOST status update will be sent).
See Scheduler.statusUpdate for more information about status update
acknowledgements. | [
"Sends",
"a",
"status",
"update",
"to",
"the",
"framework",
"scheduler",
"retrying",
"as",
"necessary",
"until",
"an",
"acknowledgement",
"has",
"been",
"received",
"or",
"the",
"executor",
"is",
"terminated",
"(",
"in",
"which",
"case",
"a",
"TASK_LOST",
"sta... | def sendStatusUpdate(self, status):
"""
Sends a status update to the framework scheduler, retrying as
necessary until an acknowledgement has been received or the executor
is terminated (in which case, a TASK_LOST status update will be sent).
See Scheduler.statusUpdate for more information ab... | [
"def",
"sendStatusUpdate",
"(",
"self",
",",
"status",
")",
":"
] | https://github.com/apache/mesos/blob/97d9a4063332aae3825d78de71611657e05cf5e2/src/python/interface/src/mesos/interface/__init__.py#L419-L426 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/tornado/tornado-6/tornado/escape.py | python | url_unescape | ( # noqa: F811
value: Union[str, bytes], encoding: Optional[str] = "utf-8", plus: bool = True
) | Decodes the given value from a URL.
The argument may be either a byte or unicode string.
If encoding is None, the result will be a byte string. Otherwise,
the result is a unicode string in the specified encoding.
If ``plus`` is true (the default), plus signs will be interpreted
as spaces (litera... | Decodes the given value from a URL. | [
"Decodes",
"the",
"given",
"value",
"from",
"a",
"URL",
"."
] | def url_unescape( # noqa: F811
value: Union[str, bytes], encoding: Optional[str] = "utf-8", plus: bool = True
) -> Union[str, bytes]:
"""Decodes the given value from a URL.
The argument may be either a byte or unicode string.
If encoding is None, the result will be a byte string. Otherwise,
the ... | [
"def",
"url_unescape",
"(",
"# noqa: F811",
"value",
":",
"Union",
"[",
"str",
",",
"bytes",
"]",
",",
"encoding",
":",
"Optional",
"[",
"str",
"]",
"=",
"\"utf-8\"",
",",
"plus",
":",
"bool",
"=",
"True",
")",
"->",
"Union",
"[",
"str",
",",
"bytes"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/escape.py#L118-L144 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/rfc822.py | python | Message.getdate | (self, name) | return parsedate(data) | Retrieve a date field from a header.
Retrieves a date field from the named header, returning a tuple
compatible with time.mktime(). | Retrieve a date field from a header. | [
"Retrieve",
"a",
"date",
"field",
"from",
"a",
"header",
"."
] | def getdate(self, name):
"""Retrieve a date field from a header.
Retrieves a date field from the named header, returning a tuple
compatible with time.mktime().
"""
try:
data = self[name]
except KeyError:
return None
return parsedate(data) | [
"def",
"getdate",
"(",
"self",
",",
"name",
")",
":",
"try",
":",
"data",
"=",
"self",
"[",
"name",
"]",
"except",
"KeyError",
":",
"return",
"None",
"return",
"parsedate",
"(",
"data",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/rfc822.py#L355-L365 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | lldb/third_party/Python/module/pexpect-4.6/pexpect/replwrap.py | python | python | (command="python") | return REPLWrapper(command, u">>> ", u"import sys; sys.ps1={0!r}; sys.ps2={1!r}") | Start a Python shell and return a :class:`REPLWrapper` object. | Start a Python shell and return a :class:`REPLWrapper` object. | [
"Start",
"a",
"Python",
"shell",
"and",
"return",
"a",
":",
"class",
":",
"REPLWrapper",
"object",
"."
] | def python(command="python"):
"""Start a Python shell and return a :class:`REPLWrapper` object."""
return REPLWrapper(command, u">>> ", u"import sys; sys.ps1={0!r}; sys.ps2={1!r}") | [
"def",
"python",
"(",
"command",
"=",
"\"python\"",
")",
":",
"return",
"REPLWrapper",
"(",
"command",
",",
"u\">>> \"",
",",
"u\"import sys; sys.ps1={0!r}; sys.ps2={1!r}\"",
")"
] | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/lldb/third_party/Python/module/pexpect-4.6/pexpect/replwrap.py#L103-L105 | |
qgis/QGIS | 15a77662d4bb712184f6aa60d0bd663010a76a75 | python/plugins/db_manager/db_plugins/postgis/connector.py | python | PostGisDBConnector.getTableFields | (self, table) | return res | return list of columns in table | return list of columns in table | [
"return",
"list",
"of",
"columns",
"in",
"table"
] | def getTableFields(self, table):
""" return list of columns in table """
schema, tablename = self.getSchemaTableName(table)
schema_where = u" AND nspname=%s " % self.quoteString(schema) if schema is not None else ""
version_number = int(self.getInfo()[0].split(' ')[1].split('.')[0])
... | [
"def",
"getTableFields",
"(",
"self",
",",
"table",
")",
":",
"schema",
",",
"tablename",
"=",
"self",
".",
"getSchemaTableName",
"(",
"table",
")",
"schema_where",
"=",
"u\" AND nspname=%s \"",
"%",
"self",
".",
"quoteString",
"(",
"schema",
")",
"if",
"sch... | https://github.com/qgis/QGIS/blob/15a77662d4bb712184f6aa60d0bd663010a76a75/python/plugins/db_manager/db_plugins/postgis/connector.py#L645-L675 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/keras/_impl/keras/preprocessing/text.py | python | hashing_trick | (text,
n,
hash_function=None,
filters='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~\t\n',
lower=True,
split=' ') | return [(hash_function(w) % (n - 1) + 1) for w in seq] | Converts a text to a sequence of indexes in a fixed-size hashing space.
Arguments:
text: Input text (string).
n: Dimension of the hashing space.
hash_function: if `None` uses python `hash` function, can be 'md5' or
any function that takes in input a string and returns a int.
Not... | Converts a text to a sequence of indexes in a fixed-size hashing space. | [
"Converts",
"a",
"text",
"to",
"a",
"sequence",
"of",
"indexes",
"in",
"a",
"fixed",
"-",
"size",
"hashing",
"space",
"."
] | def hashing_trick(text,
n,
hash_function=None,
filters='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~\t\n',
lower=True,
split=' '):
"""Converts a text to a sequence of indexes in a fixed-size hashing space.
Arguments:
text: Input te... | [
"def",
"hashing_trick",
"(",
"text",
",",
"n",
",",
"hash_function",
"=",
"None",
",",
"filters",
"=",
"'!\"#$%&()*+,-./:;<=>?@[\\\\]^_`{|}~\\t\\n'",
",",
"lower",
"=",
"True",
",",
"split",
"=",
"' '",
")",
":",
"if",
"hash_function",
"is",
"None",
":",
"ha... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/keras/_impl/keras/preprocessing/text.py#L75-L109 | |
freesurfer/freesurfer | 6dbe527d43ffa611acb2cd112e9469f9bfec8e36 | cnn_sphere_register/ext/neuron/neuron/models.py | python | single_ae | (enc_size,
input_shape,
name='single_ae',
prefix=None,
ae_type='dense', # 'dense', or 'conv'
conv_size=None,
input_model=None,
enc_lambda_layers=None,
batch_norm=True,
padding='same',
... | return model | single-layer Autoencoder (i.e. input - encoding - output | single-layer Autoencoder (i.e. input - encoding - output | [
"single",
"-",
"layer",
"Autoencoder",
"(",
"i",
".",
"e",
".",
"input",
"-",
"encoding",
"-",
"output"
] | def single_ae(enc_size,
input_shape,
name='single_ae',
prefix=None,
ae_type='dense', # 'dense', or 'conv'
conv_size=None,
input_model=None,
enc_lambda_layers=None,
batch_norm=True,
padding='same... | [
"def",
"single_ae",
"(",
"enc_size",
",",
"input_shape",
",",
"name",
"=",
"'single_ae'",
",",
"prefix",
"=",
"None",
",",
"ae_type",
"=",
"'dense'",
",",
"# 'dense', or 'conv'",
"conv_size",
"=",
"None",
",",
"input_model",
"=",
"None",
",",
"enc_lambda_layer... | https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/cnn_sphere_register/ext/neuron/neuron/models.py#L597-L794 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/variables.py | python | Variable.dtype | (self) | return self._variable.dtype | The `DType` of this variable. | The `DType` of this variable. | [
"The",
"DType",
"of",
"this",
"variable",
"."
] | def dtype(self):
"""The `DType` of this variable."""
return self._variable.dtype | [
"def",
"dtype",
"(",
"self",
")",
":",
"return",
"self",
".",
"_variable",
".",
"dtype"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/variables.py#L822-L824 | |
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | lldb/utils/lui/lldbutil.py | python | stop_reason_to_str | (enum) | Returns the stopReason string given an enum. | Returns the stopReason string given an enum. | [
"Returns",
"the",
"stopReason",
"string",
"given",
"an",
"enum",
"."
] | def stop_reason_to_str(enum):
"""Returns the stopReason string given an enum."""
if enum == lldb.eStopReasonInvalid:
return "invalid"
elif enum == lldb.eStopReasonNone:
return "none"
elif enum == lldb.eStopReasonTrace:
return "trace"
elif enum == lldb.eStopReasonBreakpoint:
... | [
"def",
"stop_reason_to_str",
"(",
"enum",
")",
":",
"if",
"enum",
"==",
"lldb",
".",
"eStopReasonInvalid",
":",
"return",
"\"invalid\"",
"elif",
"enum",
"==",
"lldb",
".",
"eStopReasonNone",
":",
"return",
"\"none\"",
"elif",
"enum",
"==",
"lldb",
".",
"eSto... | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/lldb/utils/lui/lldbutil.py#L181-L202 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/factorization/examples/mnist.py | python | inference | (inp, num_clusters, hidden1_units, hidden2_units) | return logits, clustering_loss, kmeans_training_op | Build the MNIST model up to where it may be used for inference.
Args:
inp: input data
num_clusters: number of clusters of input features to train.
hidden1_units: Size of the first hidden layer.
hidden2_units: Size of the second hidden layer.
Returns:
logits: Output tensor with the computed log... | Build the MNIST model up to where it may be used for inference. | [
"Build",
"the",
"MNIST",
"model",
"up",
"to",
"where",
"it",
"may",
"be",
"used",
"for",
"inference",
"."
] | def inference(inp, num_clusters, hidden1_units, hidden2_units):
"""Build the MNIST model up to where it may be used for inference.
Args:
inp: input data
num_clusters: number of clusters of input features to train.
hidden1_units: Size of the first hidden layer.
hidden2_units: Size of the second hidd... | [
"def",
"inference",
"(",
"inp",
",",
"num_clusters",
",",
"hidden1_units",
",",
"hidden2_units",
")",
":",
"# Clustering",
"kmeans",
"=",
"clustering_ops",
".",
"KMeans",
"(",
"inp",
",",
"num_clusters",
",",
"distance_metric",
"=",
"clustering_ops",
".",
"COSIN... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/factorization/examples/mnist.py#L131-L189 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/urllib3/util/ssl_.py | python | is_ipaddress | (hostname) | return bool(IPV4_RE.match(hostname) or BRACELESS_IPV6_ADDRZ_RE.match(hostname)) | Detects whether the hostname given is an IPv4 or IPv6 address.
Also detects IPv6 addresses with Zone IDs.
:param str hostname: Hostname to examine.
:return: True if the hostname is an IP address, False otherwise. | Detects whether the hostname given is an IPv4 or IPv6 address.
Also detects IPv6 addresses with Zone IDs. | [
"Detects",
"whether",
"the",
"hostname",
"given",
"is",
"an",
"IPv4",
"or",
"IPv6",
"address",
".",
"Also",
"detects",
"IPv6",
"addresses",
"with",
"Zone",
"IDs",
"."
] | def is_ipaddress(hostname):
"""Detects whether the hostname given is an IPv4 or IPv6 address.
Also detects IPv6 addresses with Zone IDs.
:param str hostname: Hostname to examine.
:return: True if the hostname is an IP address, False otherwise.
"""
if not six.PY2 and isinstance(hostname, bytes):... | [
"def",
"is_ipaddress",
"(",
"hostname",
")",
":",
"if",
"not",
"six",
".",
"PY2",
"and",
"isinstance",
"(",
"hostname",
",",
"bytes",
")",
":",
"# IDN A-label bytes are ASCII compatible.",
"hostname",
"=",
"hostname",
".",
"decode",
"(",
"\"ascii\"",
")",
"ret... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/urllib3/util/ssl_.py#L386-L396 | |
stellar-deprecated/stellard | 67eabb2217bdfa9a6ea317f62338fb6bca458c90 | src/protobuf/python/google/protobuf/internal/containers.py | python | RepeatedScalarFieldContainer.__setslice__ | (self, start, stop, values) | Sets the subset of items from between the specified indices. | Sets the subset of items from between the specified indices. | [
"Sets",
"the",
"subset",
"of",
"items",
"from",
"between",
"the",
"specified",
"indices",
"."
] | def __setslice__(self, start, stop, values):
"""Sets the subset of items from between the specified indices."""
new_values = []
for value in values:
self._type_checker.CheckValue(value)
new_values.append(value)
self._values[start:stop] = new_values
self._message_listener.Modified() | [
"def",
"__setslice__",
"(",
"self",
",",
"start",
",",
"stop",
",",
"values",
")",
":",
"new_values",
"=",
"[",
"]",
"for",
"value",
"in",
"values",
":",
"self",
".",
"_type_checker",
".",
"CheckValue",
"(",
"value",
")",
"new_values",
".",
"append",
"... | https://github.com/stellar-deprecated/stellard/blob/67eabb2217bdfa9a6ea317f62338fb6bca458c90/src/protobuf/python/google/protobuf/internal/containers.py#L157-L164 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/common_shapes.py | python | get_conv_output_size | (input_size, filter_size, strides, padding_type) | return tuple(output_size) | Returns the spatial size of a n-d convolution/pooling output. | Returns the spatial size of a n-d convolution/pooling output. | [
"Returns",
"the",
"spatial",
"size",
"of",
"a",
"n",
"-",
"d",
"convolution",
"/",
"pooling",
"output",
"."
] | def get_conv_output_size(input_size, filter_size, strides, padding_type):
"""Returns the spatial size of a n-d convolution/pooling output."""
input_size = tuple([tensor_shape.as_dimension(x).value for x in input_size])
filter_size = tuple([tensor_shape.as_dimension(x).value for x in filter_size])
strides = [int... | [
"def",
"get_conv_output_size",
"(",
"input_size",
",",
"filter_size",
",",
"strides",
",",
"padding_type",
")",
":",
"input_size",
"=",
"tuple",
"(",
"[",
"tensor_shape",
".",
"as_dimension",
"(",
"x",
")",
".",
"value",
"for",
"x",
"in",
"input_size",
"]",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/common_shapes.py#L118-L157 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/linalg/lapack_lite/make_lite.py | python | FortranLibrary.getRoutine | (self, rname) | return routine | Get a routine from the library. Will add if it's not found. | Get a routine from the library. Will add if it's not found. | [
"Get",
"a",
"routine",
"from",
"the",
"library",
".",
"Will",
"add",
"if",
"it",
"s",
"not",
"found",
"."
] | def getRoutine(self, rname):
"""Get a routine from the library. Will add if it's not found.
"""
unique = []
rname = rname.lower()
routine = self.names_to_routines.get(rname, unique)
if routine is unique:
routine = self._findRoutine(rname)
self.name... | [
"def",
"getRoutine",
"(",
"self",
",",
"rname",
")",
":",
"unique",
"=",
"[",
"]",
"rname",
"=",
"rname",
".",
"lower",
"(",
")",
"routine",
"=",
"self",
".",
"names_to_routines",
".",
"get",
"(",
"rname",
",",
"unique",
")",
"if",
"routine",
"is",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/linalg/lapack_lite/make_lite.py#L128-L137 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/ceph-volume/ceph_volume/api/lvm.py | python | extend_vg | (vg, devices) | return get_single_vg(filters={'vg_name': vg.name}) | Extend a Volume Group. Command looks like::
vgextend --force --yes group_name [device, ...]
Once created the volume group is extended and returned as a ``VolumeGroup`` object
:param vg: A VolumeGroup object
:param devices: A list of devices to extend the VG. Optionally, a single
... | Extend a Volume Group. Command looks like:: | [
"Extend",
"a",
"Volume",
"Group",
".",
"Command",
"looks",
"like",
"::"
] | def extend_vg(vg, devices):
"""
Extend a Volume Group. Command looks like::
vgextend --force --yes group_name [device, ...]
Once created the volume group is extended and returned as a ``VolumeGroup`` object
:param vg: A VolumeGroup object
:param devices: A list of devices to extend the VG... | [
"def",
"extend_vg",
"(",
"vg",
",",
"devices",
")",
":",
"if",
"not",
"isinstance",
"(",
"devices",
",",
"list",
")",
":",
"devices",
"=",
"[",
"devices",
"]",
"process",
".",
"run",
"(",
"[",
"'vgextend'",
",",
"'--force'",
",",
"'--yes'",
",",
"vg"... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/ceph-volume/ceph_volume/api/lvm.py#L669-L691 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | BookCtrlEvent.__init__ | (self, *args, **kwargs) | __init__(self, EventType commandType=wxEVT_NULL, int id=0, int nSel=-1,
int nOldSel=-1) -> BookCtrlEvent | __init__(self, EventType commandType=wxEVT_NULL, int id=0, int nSel=-1,
int nOldSel=-1) -> BookCtrlEvent | [
"__init__",
"(",
"self",
"EventType",
"commandType",
"=",
"wxEVT_NULL",
"int",
"id",
"=",
"0",
"int",
"nSel",
"=",
"-",
"1",
"int",
"nOldSel",
"=",
"-",
"1",
")",
"-",
">",
"BookCtrlEvent"
] | def __init__(self, *args, **kwargs):
"""
__init__(self, EventType commandType=wxEVT_NULL, int id=0, int nSel=-1,
int nOldSel=-1) -> BookCtrlEvent
"""
_core_.BookCtrlEvent_swiginit(self,_core_.new_BookCtrlEvent(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_core_",
".",
"BookCtrlEvent_swiginit",
"(",
"self",
",",
"_core_",
".",
"new_BookCtrlEvent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L13704-L13709 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/lmbrwaflib/branch_spec.py | python | spec_modules | (ctx, spec_name = None, platform=None, configuration=None) | return filtered_module_list | Get all a list of all modules needed for this spec | Get all a list of all modules needed for this spec | [
"Get",
"all",
"a",
"list",
"of",
"all",
"modules",
"needed",
"for",
"this",
"spec"
] | def spec_modules(ctx, spec_name = None, platform=None, configuration=None):
""" Get all a list of all modules needed for this spec """
if not spec_name: # Fall back to command line specified spec if none was given
spec_name = ctx.options.project_spec
cache_key = '{}_{}_{}'.format(spec_name, platfo... | [
"def",
"spec_modules",
"(",
"ctx",
",",
"spec_name",
"=",
"None",
",",
"platform",
"=",
"None",
",",
"configuration",
"=",
"None",
")",
":",
"if",
"not",
"spec_name",
":",
"# Fall back to command line specified spec if none was given",
"spec_name",
"=",
"ctx",
"."... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/lmbrwaflib/branch_spec.py#L355-L386 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/preprocessing/data.py | python | Binarizer.fit | (self, X, y=None) | return self | Do nothing and return the estimator unchanged
This method is just there to implement the usual API and hence
work in pipelines. | Do nothing and return the estimator unchanged | [
"Do",
"nothing",
"and",
"return",
"the",
"estimator",
"unchanged"
] | def fit(self, X, y=None):
"""Do nothing and return the estimator unchanged
This method is just there to implement the usual API and hence
work in pipelines.
"""
check_array(X, accept_sparse='csr')
return self | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"check_array",
"(",
"X",
",",
"accept_sparse",
"=",
"'csr'",
")",
"return",
"self"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/preprocessing/data.py#L1531-L1538 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/timeseries/python/timeseries/input_pipeline.py | python | WholeDatasetInputFn.create_batch | (self) | return ({feature_name: feature_value[None, ...]
for feature_name, feature_value in features.items()},
None) | A suitable `input_fn` for an `Estimator`'s `evaluate()`.
Returns:
A dictionary mapping feature names to `Tensors`, each shape
prefixed by [1, data set size] (i.e. a batch size of 1). | A suitable `input_fn` for an `Estimator`'s `evaluate()`. | [
"A",
"suitable",
"input_fn",
"for",
"an",
"Estimator",
"s",
"evaluate",
"()",
"."
] | def create_batch(self):
"""A suitable `input_fn` for an `Estimator`'s `evaluate()`.
Returns:
A dictionary mapping feature names to `Tensors`, each shape
prefixed by [1, data set size] (i.e. a batch size of 1).
"""
features = self._reader.read_full()
# Add a batch dimension of one to eac... | [
"def",
"create_batch",
"(",
"self",
")",
":",
"features",
"=",
"self",
".",
"_reader",
".",
"read_full",
"(",
")",
"# Add a batch dimension of one to each feature.",
"return",
"(",
"{",
"feature_name",
":",
"feature_value",
"[",
"None",
",",
"...",
"]",
"for",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/timeseries/python/timeseries/input_pipeline.py#L558-L569 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/distutils/misc_util.py | python | Configuration.get_config_cmd | (self) | return cmd | Returns the numpy.distutils config command instance. | Returns the numpy.distutils config command instance. | [
"Returns",
"the",
"numpy",
".",
"distutils",
"config",
"command",
"instance",
"."
] | def get_config_cmd(self):
"""
Returns the numpy.distutils config command instance.
"""
cmd = get_cmd('config')
cmd.ensure_finalized()
cmd.dump_source = 0
cmd.noisy = 0
old_path = os.environ.get('PATH')
if old_path:
path = os.pathsep.joi... | [
"def",
"get_config_cmd",
"(",
"self",
")",
":",
"cmd",
"=",
"get_cmd",
"(",
"'config'",
")",
"cmd",
".",
"ensure_finalized",
"(",
")",
"cmd",
".",
"dump_source",
"=",
"0",
"cmd",
".",
"noisy",
"=",
"0",
"old_path",
"=",
"os",
".",
"environ",
".",
"ge... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/distutils/misc_util.py#L1692-L1704 | |
devsisters/libquic | 8954789a056d8e7d5fcb6452fd1572ca57eb5c4e | src/third_party/protobuf/python/google/protobuf/internal/encoder.py | python | _VarintBytes | (value) | return b"".join(pieces) | Encode the given integer as a varint and return the bytes. This is only
called at startup time so it doesn't need to be fast. | Encode the given integer as a varint and return the bytes. This is only
called at startup time so it doesn't need to be fast. | [
"Encode",
"the",
"given",
"integer",
"as",
"a",
"varint",
"and",
"return",
"the",
"bytes",
".",
"This",
"is",
"only",
"called",
"at",
"startup",
"time",
"so",
"it",
"doesn",
"t",
"need",
"to",
"be",
"fast",
"."
] | def _VarintBytes(value):
"""Encode the given integer as a varint and return the bytes. This is only
called at startup time so it doesn't need to be fast."""
pieces = []
_EncodeVarint(pieces.append, value)
return b"".join(pieces) | [
"def",
"_VarintBytes",
"(",
"value",
")",
":",
"pieces",
"=",
"[",
"]",
"_EncodeVarint",
"(",
"pieces",
".",
"append",
",",
"value",
")",
"return",
"b\"\"",
".",
"join",
"(",
"pieces",
")"
] | https://github.com/devsisters/libquic/blob/8954789a056d8e7d5fcb6452fd1572ca57eb5c4e/src/third_party/protobuf/python/google/protobuf/internal/encoder.py#L406-L412 | |
Slicer/SlicerGitSVNArchive | 65e92bb16c2b32ea47a1a66bee71f238891ee1ca | Modules/Scripted/EditorLib/Effect.py | python | EffectOptions.updateParameterNode | (self, caller, event) | note: this method needs to be implemented exactly as
defined in the leaf classes in EditOptions.py
in each leaf subclass so that "self" in the observer
is of the correct type | note: this method needs to be implemented exactly as
defined in the leaf classes in EditOptions.py
in each leaf subclass so that "self" in the observer
is of the correct type | [
"note",
":",
"this",
"method",
"needs",
"to",
"be",
"implemented",
"exactly",
"as",
"defined",
"in",
"the",
"leaf",
"classes",
"in",
"EditOptions",
".",
"py",
"in",
"each",
"leaf",
"subclass",
"so",
"that",
"self",
"in",
"the",
"observer",
"is",
"of",
"t... | def updateParameterNode(self, caller, event):
"""
note: this method needs to be implemented exactly as
defined in the leaf classes in EditOptions.py
in each leaf subclass so that "self" in the observer
is of the correct type """
pass | [
"def",
"updateParameterNode",
"(",
"self",
",",
"caller",
",",
"event",
")",
":",
"pass"
] | https://github.com/Slicer/SlicerGitSVNArchive/blob/65e92bb16c2b32ea47a1a66bee71f238891ee1ca/Modules/Scripted/EditorLib/Effect.py#L93-L99 | ||
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/phactori.py | python | PhactoriImagesetBlock.HandleShowAxesWithEmptyDataParaViewIssue | (self) | we are having a paraview related issue wherein if an empty dataset
(due to threshold or clip) has a show axes setting of true, VTK
complains. For now, we are turning off the cube axes if the data is
empty and back on if data is nonempty (assuming user has cube axes
set to on | we are having a paraview related issue wherein if an empty dataset
(due to threshold or clip) has a show axes setting of true, VTK
complains. For now, we are turning off the cube axes if the data is
empty and back on if data is nonempty (assuming user has cube axes
set to on | [
"we",
"are",
"having",
"a",
"paraview",
"related",
"issue",
"wherein",
"if",
"an",
"empty",
"dataset",
"(",
"due",
"to",
"threshold",
"or",
"clip",
")",
"has",
"a",
"show",
"axes",
"setting",
"of",
"true",
"VTK",
"complains",
".",
"For",
"now",
"we",
"... | def HandleShowAxesWithEmptyDataParaViewIssue(self):
"""we are having a paraview related issue wherein if an empty dataset
(due to threshold or clip) has a show axes setting of true, VTK
complains. For now, we are turning off the cube axes if the data is
empty and back on if data is nonempty (a... | [
"def",
"HandleShowAxesWithEmptyDataParaViewIssue",
"(",
"self",
")",
":",
"if",
"self",
".",
"mRepresentation",
".",
"mDataCubeAxesFlag",
"==",
"False",
":",
"#nothing to be done--it's off so we just return",
"return",
"#allow this functionality to be eliminated to avoid mpi commun... | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/phactori.py#L9429-L9483 | ||
KDE/krita | 10ea63984e00366865769c193ab298de73a59c5c | plugins/extensions/pykrita/plugin/krita/attic/mikro.py | python | unwrap | (obj) | return obj | if wrapped returns the wrapped object | if wrapped returns the wrapped object | [
"if",
"wrapped",
"returns",
"the",
"wrapped",
"object"
] | def unwrap(obj):
"""
if wrapped returns the wrapped object
"""
if hasattr(obj, "qt"):
obj = obj.qt
return obj | [
"def",
"unwrap",
"(",
"obj",
")",
":",
"if",
"hasattr",
"(",
"obj",
",",
"\"qt\"",
")",
":",
"obj",
"=",
"obj",
".",
"qt",
"return",
"obj"
] | https://github.com/KDE/krita/blob/10ea63984e00366865769c193ab298de73a59c5c/plugins/extensions/pykrita/plugin/krita/attic/mikro.py#L142-L148 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/closure_linter/closure_linter/ecmametadatapass.py | python | EcmaMetaDataPass._PopContextType | (self, *stop_types) | return last | Pops the context stack until a context of the given type is popped.
Args:
stop_types: The types of context to pop to - stops at the first match.
Returns:
The context object of the given type that was popped. | Pops the context stack until a context of the given type is popped. | [
"Pops",
"the",
"context",
"stack",
"until",
"a",
"context",
"of",
"the",
"given",
"type",
"is",
"popped",
"."
] | def _PopContextType(self, *stop_types):
"""Pops the context stack until a context of the given type is popped.
Args:
stop_types: The types of context to pop to - stops at the first match.
Returns:
The context object of the given type that was popped.
"""
last = None
while not last ... | [
"def",
"_PopContextType",
"(",
"self",
",",
"*",
"stop_types",
")",
":",
"last",
"=",
"None",
"while",
"not",
"last",
"or",
"last",
".",
"type",
"not",
"in",
"stop_types",
":",
"last",
"=",
"self",
".",
"_PopContext",
"(",
")",
"return",
"last"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/closure_linter/closure_linter/ecmametadatapass.py#L232-L244 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | qa/tasks/rgw_multisite.py | python | configure_zone_compression | (zone, compression) | Set compression type in the zone's default-placement | Set compression type in the zone's default-placement | [
"Set",
"compression",
"type",
"in",
"the",
"zone",
"s",
"default",
"-",
"placement"
] | def configure_zone_compression(zone, compression):
""" Set compression type in the zone's default-placement """
zone.json_command(zone.cluster, 'placement', ['modify',
'--placement-id', 'default-placement',
'--compression', compression
]) | [
"def",
"configure_zone_compression",
"(",
"zone",
",",
"compression",
")",
":",
"zone",
".",
"json_command",
"(",
"zone",
".",
"cluster",
",",
"'placement'",
",",
"[",
"'modify'",
",",
"'--placement-id'",
",",
"'default-placement'",
",",
"'--compression'",
",",
... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/qa/tasks/rgw_multisite.py#L425-L430 | ||
mhammond/pywin32 | 44afd86ba8485194df93234639243252deeb40d5 | com/win32com/client/selecttlb.py | python | SelectTlb | (title="Select Library", excludeFlags=0) | return items[rc] | Display a list of all the type libraries, and select one. Returns None if cancelled | Display a list of all the type libraries, and select one. Returns None if cancelled | [
"Display",
"a",
"list",
"of",
"all",
"the",
"type",
"libraries",
"and",
"select",
"one",
".",
"Returns",
"None",
"if",
"cancelled"
] | def SelectTlb(title="Select Library", excludeFlags=0):
"""Display a list of all the type libraries, and select one. Returns None if cancelled"""
import pywin.dialogs.list
items = EnumTlbs(excludeFlags)
# fixup versions - we assume hex (see __init__ above)
for i in items:
i.major = int(i.m... | [
"def",
"SelectTlb",
"(",
"title",
"=",
"\"Select Library\"",
",",
"excludeFlags",
"=",
"0",
")",
":",
"import",
"pywin",
".",
"dialogs",
".",
"list",
"items",
"=",
"EnumTlbs",
"(",
"excludeFlags",
")",
"# fixup versions - we assume hex (see __init__ above)",
"for",
... | https://github.com/mhammond/pywin32/blob/44afd86ba8485194df93234639243252deeb40d5/com/win32com/client/selecttlb.py#L163-L176 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/socket.py | python | SocketIO.close | (self) | Close the SocketIO object. This doesn't close the underlying
socket, except if all references to it have disappeared. | Close the SocketIO object. This doesn't close the underlying
socket, except if all references to it have disappeared. | [
"Close",
"the",
"SocketIO",
"object",
".",
"This",
"doesn",
"t",
"close",
"the",
"underlying",
"socket",
"except",
"if",
"all",
"references",
"to",
"it",
"have",
"disappeared",
"."
] | def close(self):
"""Close the SocketIO object. This doesn't close the underlying
socket, except if all references to it have disappeared.
"""
if self.closed:
return
io.RawIOBase.close(self)
self._sock._decref_socketios()
self._sock = None | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"closed",
":",
"return",
"io",
".",
"RawIOBase",
".",
"close",
"(",
"self",
")",
"self",
".",
"_sock",
".",
"_decref_socketios",
"(",
")",
"self",
".",
"_sock",
"=",
"None"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/socket.py#L652-L660 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/multiprocessing/__init__.py | python | get_logger | () | return get_logger() | Return package logger -- if it does not already exist then it is created | Return package logger -- if it does not already exist then it is created | [
"Return",
"package",
"logger",
"--",
"if",
"it",
"does",
"not",
"already",
"exist",
"then",
"it",
"is",
"created"
] | def get_logger():
'''
Return package logger -- if it does not already exist then it is created
'''
from multiprocessing.util import get_logger
return get_logger() | [
"def",
"get_logger",
"(",
")",
":",
"from",
"multiprocessing",
".",
"util",
"import",
"get_logger",
"return",
"get_logger",
"(",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/multiprocessing/__init__.py#L147-L152 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/nn/functional/activation.py | python | silu | (x, name=None) | return out | r"""
silu activation
.. math::
silu(x) = \frac{x}{1 + e^{-x}}
Parameters:
x (Tensor): The input Tensor with data type float32, float64.
name (str, optional): Name for the operation (optional, default is None).
For more information, please refer to :ref:`api_guide_N... | r"""
silu activation | [
"r",
"silu",
"activation"
] | def silu(x, name=None):
r"""
silu activation
.. math::
silu(x) = \frac{x}{1 + e^{-x}}
Parameters:
x (Tensor): The input Tensor with data type float32, float64.
name (str, optional): Name for the operation (optional, default is None).
For more information, pleas... | [
"def",
"silu",
"(",
"x",
",",
"name",
"=",
"None",
")",
":",
"if",
"in_dygraph_mode",
"(",
")",
":",
"return",
"_C_ops",
".",
"silu",
"(",
"x",
")",
"check_variable_and_dtype",
"(",
"x",
",",
"'x'",
",",
"[",
"'float16'",
",",
"'float32'",
",",
"'flo... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/nn/functional/activation.py#L798-L831 | |
SpaceNetChallenge/BuildingDetectors | 3def3c44b5847c744cd2f3356182892d92496579 | qinhaifang/src/caffe-mnc/scripts/cpp_lint.py | python | CheckCaffeRandom | (filename, clean_lines, linenum, error) | Checks for calls to C random functions (rand, rand_r, random, ...).
Caffe code should (almost) always use the caffe_rng_* functions rather
than these, as the internal state of these C functions is independent of the
native Caffe RNG system which should produce deterministic results for a
fixed Caffe seed set u... | Checks for calls to C random functions (rand, rand_r, random, ...). | [
"Checks",
"for",
"calls",
"to",
"C",
"random",
"functions",
"(",
"rand",
"rand_r",
"random",
"...",
")",
"."
] | def CheckCaffeRandom(filename, clean_lines, linenum, error):
"""Checks for calls to C random functions (rand, rand_r, random, ...).
Caffe code should (almost) always use the caffe_rng_* functions rather
than these, as the internal state of these C functions is independent of the
native Caffe RNG system which s... | [
"def",
"CheckCaffeRandom",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"for",
"function",
"in",
"c_random_function_list",
":",
"ix",
"=",
"line",
".",
"find",
... | https://github.com/SpaceNetChallenge/BuildingDetectors/blob/3def3c44b5847c744cd2f3356182892d92496579/qinhaifang/src/caffe-mnc/scripts/cpp_lint.py#L1640-L1663 | ||
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 | CursorKind.is_translation_unit | (self) | return conf.lib.clang_isTranslationUnit(self) | Test if this is a translation unit kind. | Test if this is a translation unit kind. | [
"Test",
"if",
"this",
"is",
"a",
"translation",
"unit",
"kind",
"."
] | def is_translation_unit(self):
"""Test if this is a translation unit kind."""
return conf.lib.clang_isTranslationUnit(self) | [
"def",
"is_translation_unit",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_isTranslationUnit",
"(",
"self",
")"
] | 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#L543-L545 | |
milvus-io/milvus | 3b1030de2b6c39e3512833e97f6044d63eb24237 | internal/core/build-support/cpplint.py | python | _NamespaceInfo.CheckEnd | (self, filename, clean_lines, linenum, error) | Check end of namespace comments. | Check end of namespace comments. | [
"Check",
"end",
"of",
"namespace",
"comments",
"."
] | def CheckEnd(self, filename, clean_lines, linenum, error):
"""Check end of namespace comments."""
line = clean_lines.raw_lines[linenum]
# Check how many lines is enclosed in this namespace. Don't issue
# warning for missing namespace comments if there aren't enough
# lines. However, do apply chec... | [
"def",
"CheckEnd",
"(",
"self",
",",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"raw_lines",
"[",
"linenum",
"]",
"# Check how many lines is enclosed in this namespace. Don't issue",
"# warning for missing n... | https://github.com/milvus-io/milvus/blob/3b1030de2b6c39e3512833e97f6044d63eb24237/internal/core/build-support/cpplint.py#L2830-L2880 | ||
google-ar/WebARonTango | e86965d2cbc652156b480e0fcf77c716745578cd | chromium/src/gpu/command_buffer/build_gles2_cmd_buffer.py | python | DataHandler.WriteImmediateServiceUnitTest | (self, func, f, *extras) | Overrriden from TypeHandler. | Overrriden from TypeHandler. | [
"Overrriden",
"from",
"TypeHandler",
"."
] | def WriteImmediateServiceUnitTest(self, func, f, *extras):
"""Overrriden from TypeHandler."""
pass | [
"def",
"WriteImmediateServiceUnitTest",
"(",
"self",
",",
"func",
",",
"f",
",",
"*",
"extras",
")",
":",
"pass"
] | https://github.com/google-ar/WebARonTango/blob/e86965d2cbc652156b480e0fcf77c716745578cd/chromium/src/gpu/command_buffer/build_gles2_cmd_buffer.py#L5804-L5806 | ||
chanyn/3Dpose_ssl | 585696676279683a279b1ecca136c0e0d02aef2a | caffe-3dssl/scripts/cpp_lint.py | python | GetPreviousNonBlankLine | (clean_lines, linenum) | return ('', -1) | Return the most recent non-blank line and its line number.
Args:
clean_lines: A CleansedLines instance containing the file contents.
linenum: The number of the line to check.
Returns:
A tuple with two elements. The first element is the contents of the last
non-blank line before the current line, ... | Return the most recent non-blank line and its line number. | [
"Return",
"the",
"most",
"recent",
"non",
"-",
"blank",
"line",
"and",
"its",
"line",
"number",
"."
] | def GetPreviousNonBlankLine(clean_lines, linenum):
"""Return the most recent non-blank line and its line number.
Args:
clean_lines: A CleansedLines instance containing the file contents.
linenum: The number of the line to check.
Returns:
A tuple with two elements. The first element is the contents ... | [
"def",
"GetPreviousNonBlankLine",
"(",
"clean_lines",
",",
"linenum",
")",
":",
"prevlinenum",
"=",
"linenum",
"-",
"1",
"while",
"prevlinenum",
">=",
"0",
":",
"prevline",
"=",
"clean_lines",
".",
"elided",
"[",
"prevlinenum",
"]",
"if",
"not",
"IsBlankLine",... | https://github.com/chanyn/3Dpose_ssl/blob/585696676279683a279b1ecca136c0e0d02aef2a/caffe-3dssl/scripts/cpp_lint.py#L3046-L3066 | |
CNugteren/CLBlast | 4500a03440e2cc54998c0edab366babf5e504d67 | scripts/generator/generator/routine.py | python | Routine.options_cast | (self, indent) | return [] | As above, but now casted to CLBlast data-types | As above, but now casted to CLBlast data-types | [
"As",
"above",
"but",
"now",
"casted",
"to",
"CLBlast",
"data",
"-",
"types"
] | def options_cast(self, indent):
"""As above, but now casted to CLBlast data-types"""
if self.options:
options = ["static_cast<clblast::" + convert.option_to_clblast(o) + ">(" + o + ")" for o in self.options]
return [(",\n" + indent).join(options)]
return [] | [
"def",
"options_cast",
"(",
"self",
",",
"indent",
")",
":",
"if",
"self",
".",
"options",
":",
"options",
"=",
"[",
"\"static_cast<clblast::\"",
"+",
"convert",
".",
"option_to_clblast",
"(",
"o",
")",
"+",
"\">(\"",
"+",
"o",
"+",
"\")\"",
"for",
"o",
... | https://github.com/CNugteren/CLBlast/blob/4500a03440e2cc54998c0edab366babf5e504d67/scripts/generator/generator/routine.py#L584-L589 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/framework/ops.py | python | Graph.clear_collection | (self, name) | Clears all values in a collection.
Args:
name: The key for the collection. The `GraphKeys` class contains many
standard names for collections. | Clears all values in a collection. | [
"Clears",
"all",
"values",
"in",
"a",
"collection",
"."
] | def clear_collection(self, name):
"""Clears all values in a collection.
Args:
name: The key for the collection. The `GraphKeys` class contains many
standard names for collections.
"""
self._check_not_finalized()
with self._lock:
if name in self._collections:
del self._co... | [
"def",
"clear_collection",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"_check_not_finalized",
"(",
")",
"with",
"self",
".",
"_lock",
":",
"if",
"name",
"in",
"self",
".",
"_collections",
":",
"del",
"self",
".",
"_collections",
"[",
"name",
"]"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/framework/ops.py#L3038-L3048 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/util/tf_inspect.py | python | currentframe | () | return _inspect.stack()[1][0] | TFDecorator-aware replacement for inspect.currentframe. | TFDecorator-aware replacement for inspect.currentframe. | [
"TFDecorator",
"-",
"aware",
"replacement",
"for",
"inspect",
".",
"currentframe",
"."
] | def currentframe():
"""TFDecorator-aware replacement for inspect.currentframe."""
return _inspect.stack()[1][0] | [
"def",
"currentframe",
"(",
")",
":",
"return",
"_inspect",
".",
"stack",
"(",
")",
"[",
"1",
"]",
"[",
"0",
"]"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/util/tf_inspect.py#L103-L105 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/computation/pytables.py | python | Expr.evaluate | (self) | return self.condition, self.filter | create and return the numexpr condition and filter | create and return the numexpr condition and filter | [
"create",
"and",
"return",
"the",
"numexpr",
"condition",
"and",
"filter"
] | def evaluate(self):
""" create and return the numexpr condition and filter """
try:
self.condition = self.terms.prune(ConditionBinOp)
except AttributeError:
raise ValueError("cannot process expression [{expr}], [{slf}] "
"is not a valid condi... | [
"def",
"evaluate",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"condition",
"=",
"self",
".",
"terms",
".",
"prune",
"(",
"ConditionBinOp",
")",
"except",
"AttributeError",
":",
"raise",
"ValueError",
"(",
"\"cannot process expression [{expr}], [{slf}] \"",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/computation/pytables.py#L555-L571 | |
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/icl.py | python | generate | (*args, **kw) | return SCons.Tool.intelc.generate(*args, **kw) | Add Builders and construction variables for icl to an Environment. | Add Builders and construction variables for icl to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"icl",
"to",
"an",
"Environment",
"."
] | def generate(*args, **kw):
"""Add Builders and construction variables for icl to an Environment."""
return SCons.Tool.intelc.generate(*args, **kw) | [
"def",
"generate",
"(",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"return",
"SCons",
".",
"Tool",
".",
"intelc",
".",
"generate",
"(",
"*",
"args",
",",
"*",
"*",
"kw",
")"
] | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/icl.py#L41-L43 | |
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/esptool/serial/rfc2217.py | python | Serial.reset_output_buffer | (self) | \
Clear output buffer, aborting the current output and
discarding all that is in the buffer. | \
Clear output buffer, aborting the current output and
discarding all that is in the buffer. | [
"\\",
"Clear",
"output",
"buffer",
"aborting",
"the",
"current",
"output",
"and",
"discarding",
"all",
"that",
"is",
"in",
"the",
"buffer",
"."
] | def reset_output_buffer(self):
"""\
Clear output buffer, aborting the current output and
discarding all that is in the buffer.
"""
if not self.is_open:
raise portNotOpenError
self.rfc2217_send_purge(PURGE_TRANSMIT_BUFFER) | [
"def",
"reset_output_buffer",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_open",
":",
"raise",
"portNotOpenError",
"self",
".",
"rfc2217_send_purge",
"(",
"PURGE_TRANSMIT_BUFFER",
")"
] | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/esptool/serial/rfc2217.py#L647-L654 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/urllib.py | python | FancyURLopener.prompt_user_passwd | (self, host, realm) | Override this in a GUI environment! | Override this in a GUI environment! | [
"Override",
"this",
"in",
"a",
"GUI",
"environment!"
] | def prompt_user_passwd(self, host, realm):
"""Override this in a GUI environment!"""
import getpass
try:
user = raw_input("Enter username for %s at %s: " % (realm,
host))
passwd = getpass.getpass("Enter passw... | [
"def",
"prompt_user_passwd",
"(",
"self",
",",
"host",
",",
"realm",
")",
":",
"import",
"getpass",
"try",
":",
"user",
"=",
"raw_input",
"(",
"\"Enter username for %s at %s: \"",
"%",
"(",
"realm",
",",
"host",
")",
")",
"passwd",
"=",
"getpass",
".",
"ge... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/urllib.py#L793-L804 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/states.py | python | Body.parse_extension_options | (self, option_spec, datalines) | Parse `datalines` for a field list containing extension options
matching `option_spec`.
:Parameters:
- `option_spec`: a mapping of option name to conversion
function, which should raise an exception on bad input.
- `datalines`: a list of input strings.
:Re... | Parse `datalines` for a field list containing extension options
matching `option_spec`. | [
"Parse",
"datalines",
"for",
"a",
"field",
"list",
"containing",
"extension",
"options",
"matching",
"option_spec",
"."
] | def parse_extension_options(self, option_spec, datalines):
"""
Parse `datalines` for a field list containing extension options
matching `option_spec`.
:Parameters:
- `option_spec`: a mapping of option name to conversion
function, which should raise an exception... | [
"def",
"parse_extension_options",
"(",
"self",
",",
"option_spec",
",",
"datalines",
")",
":",
"node",
"=",
"nodes",
".",
"field_list",
"(",
")",
"newline_offset",
",",
"blank_finish",
"=",
"self",
".",
"nested_list_parse",
"(",
"datalines",
",",
"0",
",",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/states.py#L2226-L2257 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/ndarray/sparse.py | python | CSRNDArray.indptr | (self) | return self._aux_data(0) | A deep copy NDArray of the indptr array of the CSRNDArray.
This generates a deep copy of the `indptr` of the current `csr` matrix.
Returns
-------
NDArray
This CSRNDArray's indptr array. | A deep copy NDArray of the indptr array of the CSRNDArray.
This generates a deep copy of the `indptr` of the current `csr` matrix. | [
"A",
"deep",
"copy",
"NDArray",
"of",
"the",
"indptr",
"array",
"of",
"the",
"CSRNDArray",
".",
"This",
"generates",
"a",
"deep",
"copy",
"of",
"the",
"indptr",
"of",
"the",
"current",
"csr",
"matrix",
"."
] | def indptr(self):
"""A deep copy NDArray of the indptr array of the CSRNDArray.
This generates a deep copy of the `indptr` of the current `csr` matrix.
Returns
-------
NDArray
This CSRNDArray's indptr array.
"""
return self._aux_data(0) | [
"def",
"indptr",
"(",
"self",
")",
":",
"return",
"self",
".",
"_aux_data",
"(",
"0",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/ndarray/sparse.py#L471-L480 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/gyp/pylib/gyp/msvs_emulation.py | python | GenerateEnvironmentFiles | (
toplevel_build_dir, generator_flags, system_includes, open_out
) | return cl_paths | It's not sufficient to have the absolute path to the compiler, linker,
etc. on Windows, as those tools rely on .dlls being in the PATH. We also
need to support both x86 and x64 compilers within the same build (to support
msvs_target_platform hackery). Different architectures require a different
compiler... | It's not sufficient to have the absolute path to the compiler, linker,
etc. on Windows, as those tools rely on .dlls being in the PATH. We also
need to support both x86 and x64 compilers within the same build (to support
msvs_target_platform hackery). Different architectures require a different
compiler... | [
"It",
"s",
"not",
"sufficient",
"to",
"have",
"the",
"absolute",
"path",
"to",
"the",
"compiler",
"linker",
"etc",
".",
"on",
"Windows",
"as",
"those",
"tools",
"rely",
"on",
".",
"dlls",
"being",
"in",
"the",
"PATH",
".",
"We",
"also",
"need",
"to",
... | def GenerateEnvironmentFiles(
toplevel_build_dir, generator_flags, system_includes, open_out
):
"""It's not sufficient to have the absolute path to the compiler, linker,
etc. on Windows, as those tools rely on .dlls being in the PATH. We also
need to support both x86 and x64 compilers within the same bu... | [
"def",
"GenerateEnvironmentFiles",
"(",
"toplevel_build_dir",
",",
"generator_flags",
",",
"system_includes",
",",
"open_out",
")",
":",
"archs",
"=",
"(",
"\"x86\"",
",",
"\"x64\"",
")",
"if",
"generator_flags",
".",
"get",
"(",
"\"ninja_use_custom_environment_files\... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/msvs_emulation.py#L1176-L1233 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/optparse.py | python | OptionGroup.destroy | (self) | see OptionParser.destroy(). | see OptionParser.destroy(). | [
"see",
"OptionParser",
".",
"destroy",
"()",
"."
] | def destroy(self):
"""see OptionParser.destroy()."""
OptionContainer.destroy(self)
del self.option_list | [
"def",
"destroy",
"(",
"self",
")",
":",
"OptionContainer",
".",
"destroy",
"(",
"self",
")",
"del",
"self",
".",
"option_list"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/optparse.py#L1103-L1106 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/parfor.py | python | ParforPass.run | (self) | return | run parfor conversion pass: replace Numpy calls
with Parfors when possible and optimize the IR. | run parfor conversion pass: replace Numpy calls
with Parfors when possible and optimize the IR. | [
"run",
"parfor",
"conversion",
"pass",
":",
"replace",
"Numpy",
"calls",
"with",
"Parfors",
"when",
"possible",
"and",
"optimize",
"the",
"IR",
"."
] | def run(self):
"""run parfor conversion pass: replace Numpy calls
with Parfors when possible and optimize the IR."""
# run array analysis, a pre-requisite for parfor translation
remove_dels(self.func_ir.blocks)
self.array_analysis.run(self.func_ir.blocks)
# run stencil tr... | [
"def",
"run",
"(",
"self",
")",
":",
"# run array analysis, a pre-requisite for parfor translation",
"remove_dels",
"(",
"self",
".",
"func_ir",
".",
"blocks",
")",
"self",
".",
"array_analysis",
".",
"run",
"(",
"self",
".",
"func_ir",
".",
"blocks",
")",
"# ru... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/parfor.py#L1495-L1617 | |
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | src/api/python/z3/z3.py | python | FiniteDomainSortRef.size | (self) | Return the size of the finite domain sort | Return the size of the finite domain sort | [
"Return",
"the",
"size",
"of",
"the",
"finite",
"domain",
"sort"
] | def size(self):
"""Return the size of the finite domain sort"""
r = (ctypes.c_ulonglong * 1)()
if Z3_get_finite_domain_sort_size(self.ctx_ref(), self.ast, r):
return r[0]
else:
raise Z3Exception("Failed to retrieve finite domain sort size") | [
"def",
"size",
"(",
"self",
")",
":",
"r",
"=",
"(",
"ctypes",
".",
"c_ulonglong",
"*",
"1",
")",
"(",
")",
"if",
"Z3_get_finite_domain_sort_size",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
",",
"r",
")",
":",
"return",
"r",
... | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L7621-L7627 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/lib2to3/pytree.py | python | Node.prefix | (self) | return self.children[0].prefix | The whitespace and comments preceding this node in the input. | The whitespace and comments preceding this node in the input. | [
"The",
"whitespace",
"and",
"comments",
"preceding",
"this",
"node",
"in",
"the",
"input",
"."
] | def prefix(self):
"""
The whitespace and comments preceding this node in the input.
"""
if not self.children:
return ""
return self.children[0].prefix | [
"def",
"prefix",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"children",
":",
"return",
"\"\"",
"return",
"self",
".",
"children",
"[",
"0",
"]",
".",
"prefix"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/lib2to3/pytree.py#L275-L281 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/traci/_vehicle.py | python | VehicleDomain.getShapeClass | (self, vehID) | return self._getUniversal(tc.VAR_SHAPECLASS, vehID) | getShapeClass(string) -> string
Returns the shape class of this vehicle,
see https://sumo.dlr.de/docs/Definition_of_Vehicles,_Vehicle_Types,_and_Routes.html#visualization. | getShapeClass(string) -> string | [
"getShapeClass",
"(",
"string",
")",
"-",
">",
"string"
] | def getShapeClass(self, vehID):
"""getShapeClass(string) -> string
Returns the shape class of this vehicle,
see https://sumo.dlr.de/docs/Definition_of_Vehicles,_Vehicle_Types,_and_Routes.html#visualization.
"""
return self._getUniversal(tc.VAR_SHAPECLASS, vehID) | [
"def",
"getShapeClass",
"(",
"self",
",",
"vehID",
")",
":",
"return",
"self",
".",
"_getUniversal",
"(",
"tc",
".",
"VAR_SHAPECLASS",
",",
"vehID",
")"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/traci/_vehicle.py#L625-L631 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | Window.InformFirstDirection | (*args, **kwargs) | return _core_.Window_InformFirstDirection(*args, **kwargs) | InformFirstDirection(self, int direction, int size, int availableOtherDir) -> bool
wxSizer and friends use this to give a chance to a component to recalc
its min size once one of the final size components is known. Override
this function when that is useful (such as for wxStaticText which can ... | InformFirstDirection(self, int direction, int size, int availableOtherDir) -> bool | [
"InformFirstDirection",
"(",
"self",
"int",
"direction",
"int",
"size",
"int",
"availableOtherDir",
")",
"-",
">",
"bool"
] | def InformFirstDirection(*args, **kwargs):
"""
InformFirstDirection(self, int direction, int size, int availableOtherDir) -> bool
wxSizer and friends use this to give a chance to a component to recalc
its min size once one of the final size components is known. Override
this fu... | [
"def",
"InformFirstDirection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_InformFirstDirection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L9861-L9872 | |
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/Configure.py | python | find_file | (self, filename, path_list=[]) | Find a file in a list of paths
:param filename: name of the file to search for
:param path_list: list of directories to search
:return: the first matching filename; else a configuration exception is raised | Find a file in a list of paths | [
"Find",
"a",
"file",
"in",
"a",
"list",
"of",
"paths"
] | def find_file(self, filename, path_list=[]):
"""
Find a file in a list of paths
:param filename: name of the file to search for
:param path_list: list of directories to search
:return: the first matching filename; else a configuration exception is raised
"""
for n in Utils.to_list(filename):
for d in Utils.to... | [
"def",
"find_file",
"(",
"self",
",",
"filename",
",",
"path_list",
"=",
"[",
"]",
")",
":",
"for",
"n",
"in",
"Utils",
".",
"to_list",
"(",
"filename",
")",
":",
"for",
"d",
"in",
"Utils",
".",
"to_list",
"(",
"path_list",
")",
":",
"p",
"=",
"o... | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/Configure.py#L392-L405 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/name.py | python | Name.to_digestable | (self, origin=None) | return ''.join(dlabels) | Convert name to a format suitable for digesting in hashes.
The name is canonicalized and converted to uncompressed wire format.
@param origin: If the name is relative and origin is not None, then
origin will be appended to it.
@type origin: dns.name.Name object
@raises NeedAbso... | Convert name to a format suitable for digesting in hashes. | [
"Convert",
"name",
"to",
"a",
"format",
"suitable",
"for",
"digesting",
"in",
"hashes",
"."
] | def to_digestable(self, origin=None):
"""Convert name to a format suitable for digesting in hashes.
The name is canonicalized and converted to uncompressed wire format.
@param origin: If the name is relative and origin is not None, then
origin will be appended to it.
@type orig... | [
"def",
"to_digestable",
"(",
"self",
",",
"origin",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"is_absolute",
"(",
")",
":",
"if",
"origin",
"is",
"None",
"or",
"not",
"origin",
".",
"is_absolute",
"(",
")",
":",
"raise",
"NeedAbsoluteNameOrOrigin"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/name.py#L350-L372 | |
schwehr/libais | 1e19605942c8e155cd02fde6d1acde75ecd15d75 | third_party/gmock/scripts/upload.py | python | VersionControlSystem.GenerateDiff | (self, args) | Return the current diff as a string.
Args:
args: Extra arguments to pass to the diff command. | Return the current diff as a string. | [
"Return",
"the",
"current",
"diff",
"as",
"a",
"string",
"."
] | def GenerateDiff(self, args):
"""Return the current diff as a string.
Args:
args: Extra arguments to pass to the diff command.
"""
raise NotImplementedError(
"abstract method -- subclass %s must override" % self.__class__) | [
"def",
"GenerateDiff",
"(",
"self",
",",
"args",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"abstract method -- subclass %s must override\"",
"%",
"self",
".",
"__class__",
")"
] | https://github.com/schwehr/libais/blob/1e19605942c8e155cd02fde6d1acde75ecd15d75/third_party/gmock/scripts/upload.py#L599-L606 | ||
perilouswithadollarsign/cstrike15_src | f82112a2388b841d72cb62ca48ab1846dfcc11c8 | thirdparty/protobuf-2.5.0/python/mox.py | python | Func.equals | (self, rhs) | return self._func(rhs) | Test whether rhs passes the function test.
rhs is passed into func.
Args:
rhs: any python object
Returns:
the result of func(rhs) | Test whether rhs passes the function test. | [
"Test",
"whether",
"rhs",
"passes",
"the",
"function",
"test",
"."
] | def equals(self, rhs):
"""Test whether rhs passes the function test.
rhs is passed into func.
Args:
rhs: any python object
Returns:
the result of func(rhs)
"""
return self._func(rhs) | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"return",
"self",
".",
"_func",
"(",
"rhs",
")"
] | https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/thirdparty/protobuf-2.5.0/python/mox.py#L1138-L1150 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py | python | _GenerateActionsForMSBuild | (spec, actions_to_add) | return actions_spec, sources_handled_by_action | Add actions accumulated into an actions_to_add, merging as needed.
Arguments:
spec: the target project dict
actions_to_add: dictionary keyed on input name, which maps to a list of
dicts describing the actions attached to that input file.
Returns:
A pair of (action specification, the sources ha... | Add actions accumulated into an actions_to_add, merging as needed. | [
"Add",
"actions",
"accumulated",
"into",
"an",
"actions_to_add",
"merging",
"as",
"needed",
"."
] | def _GenerateActionsForMSBuild(spec, actions_to_add):
"""Add actions accumulated into an actions_to_add, merging as needed.
Arguments:
spec: the target project dict
actions_to_add: dictionary keyed on input name, which maps to a list of
dicts describing the actions attached to that input file.
R... | [
"def",
"_GenerateActionsForMSBuild",
"(",
"spec",
",",
"actions_to_add",
")",
":",
"sources_handled_by_action",
"=",
"OrderedSet",
"(",
")",
"actions_spec",
"=",
"[",
"]",
"for",
"primary_input",
",",
"actions",
"in",
"actions_to_add",
".",
"items",
"(",
")",
":... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py#L3452-L3499 | |
cornell-zhang/heterocl | 6d9e4b4acc2ee2707b2d25b27298c0335bccedfd | python/heterocl/tvm/_ffi/ndarray.py | python | free_extension_handle | (handle, type_code) | Free c++ extension type handle
Parameters
----------
handle : ctypes.c_void_p
The handle to the extension type.
type_code : int
The tyoe code | Free c++ extension type handle | [
"Free",
"c",
"++",
"extension",
"type",
"handle"
] | def free_extension_handle(handle, type_code):
"""Free c++ extension type handle
Parameters
----------
handle : ctypes.c_void_p
The handle to the extension type.
type_code : int
The tyoe code
"""
check_call(_LIB.TVMExtTypeFree(handle, ctypes.c_int(type_code))) | [
"def",
"free_extension_handle",
"(",
"handle",
",",
"type_code",
")",
":",
"check_call",
"(",
"_LIB",
".",
"TVMExtTypeFree",
"(",
"handle",
",",
"ctypes",
".",
"c_int",
"(",
"type_code",
")",
")",
")"
] | https://github.com/cornell-zhang/heterocl/blob/6d9e4b4acc2ee2707b2d25b27298c0335bccedfd/python/heterocl/tvm/_ffi/ndarray.py#L287-L298 | ||
tensorflow/minigo | 6d89c202cdceaf449aefc3149ab2110d44f1a6a4 | bigtable_input.py | python | GameQueue.create | (self) | Create the table underlying the queue.
Create the 'metadata' and 'tfexample' column families
and their properties. | Create the table underlying the queue. | [
"Create",
"the",
"table",
"underlying",
"the",
"queue",
"."
] | def create(self):
"""Create the table underlying the queue.
Create the 'metadata' and 'tfexample' column families
and their properties.
"""
if self.bt_table.exists():
utils.dbg('Table already exists')
return
max_versions_rule = bigtable_column_fa... | [
"def",
"create",
"(",
"self",
")",
":",
"if",
"self",
".",
"bt_table",
".",
"exists",
"(",
")",
":",
"utils",
".",
"dbg",
"(",
"'Table already exists'",
")",
"return",
"max_versions_rule",
"=",
"bigtable_column_family",
".",
"MaxVersionsGCRule",
"(",
"1",
")... | https://github.com/tensorflow/minigo/blob/6d89c202cdceaf449aefc3149ab2110d44f1a6a4/bigtable_input.py#L246-L259 | ||
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | lldb/examples/python/gdbremote.py | python | RegisterInfo.name | (self) | return None | Get the name of the register. | Get the name of the register. | [
"Get",
"the",
"name",
"of",
"the",
"register",
"."
] | def name(self):
'''Get the name of the register.'''
if self.info and 'name' in self.info:
return self.info['name']
return None | [
"def",
"name",
"(",
"self",
")",
":",
"if",
"self",
".",
"info",
"and",
"'name'",
"in",
"self",
".",
"info",
":",
"return",
"self",
".",
"info",
"[",
"'name'",
"]",
"return",
"None"
] | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/lldb/examples/python/gdbremote.py#L350-L354 | |
raspberrypi/tools | 13474ee775d0c5ec8a7da4fb0a9fa84187abfc87 | arm-bcm2708/arm-bcm2708-linux-gnueabi/share/gdb/python/gdb/printing.py | python | RegexpCollectionPrettyPrinter.add_printer | (self, name, regexp, gen_printer) | Add a printer to the list.
The printer is added to the end of the list.
Arguments:
name: The name of the subprinter.
regexp: The regular expression, as a string.
gen_printer: A function/method that given a value returns an
object to pretty-p... | Add a printer to the list. | [
"Add",
"a",
"printer",
"to",
"the",
"list",
"."
] | def add_printer(self, name, regexp, gen_printer):
"""Add a printer to the list.
The printer is added to the end of the list.
Arguments:
name: The name of the subprinter.
regexp: The regular expression, as a string.
gen_printer: A function/method that given a... | [
"def",
"add_printer",
"(",
"self",
",",
"name",
",",
"regexp",
",",
"gen_printer",
")",
":",
"# NOTE: A previous version made the name of each printer the regexp.",
"# That makes it awkward to pass to the enable/disable commands (it's",
"# cumbersome to make a regexp of a regexp). So no... | https://github.com/raspberrypi/tools/blob/13474ee775d0c5ec8a7da4fb0a9fa84187abfc87/arm-bcm2708/arm-bcm2708-linux-gnueabi/share/gdb/python/gdb/printing.py#L158-L179 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/distutils/file_util.py | python | write_file | (filename, contents) | Create a file with the specified name and write 'contents' (a
sequence of strings without line terminators) to it. | Create a file with the specified name and write 'contents' (a
sequence of strings without line terminators) to it. | [
"Create",
"a",
"file",
"with",
"the",
"specified",
"name",
"and",
"write",
"contents",
"(",
"a",
"sequence",
"of",
"strings",
"without",
"line",
"terminators",
")",
"to",
"it",
"."
] | def write_file (filename, contents):
"""Create a file with the specified name and write 'contents' (a
sequence of strings without line terminators) to it.
"""
f = open(filename, "w")
for line in contents:
f.write(line + "\n")
f.close() | [
"def",
"write_file",
"(",
"filename",
",",
"contents",
")",
":",
"f",
"=",
"open",
"(",
"filename",
",",
"\"w\"",
")",
"for",
"line",
"in",
"contents",
":",
"f",
".",
"write",
"(",
"line",
"+",
"\"\\n\"",
")",
"f",
".",
"close",
"(",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/distutils/file_util.py#L246-L253 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBThread.GetBroadcasterClassName | () | return _lldb.SBThread_GetBroadcasterClassName() | GetBroadcasterClassName() -> char const * | GetBroadcasterClassName() -> char const * | [
"GetBroadcasterClassName",
"()",
"-",
">",
"char",
"const",
"*"
] | def GetBroadcasterClassName():
"""GetBroadcasterClassName() -> char const *"""
return _lldb.SBThread_GetBroadcasterClassName() | [
"def",
"GetBroadcasterClassName",
"(",
")",
":",
"return",
"_lldb",
".",
"SBThread_GetBroadcasterClassName",
"(",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L11476-L11478 | |
echronos/echronos | c996f1d2c8af6c6536205eb319c1bf1d4d84569c | external_tools/ply_info/example/BASIC/basparse.py | python | p_command_let | (p) | command : LET variable EQUALS expr | command : LET variable EQUALS expr | [
"command",
":",
"LET",
"variable",
"EQUALS",
"expr"
] | def p_command_let(p):
'''command : LET variable EQUALS expr'''
p[0] = ('LET',p[2],p[4]) | [
"def",
"p_command_let",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"(",
"'LET'",
",",
"p",
"[",
"2",
"]",
",",
"p",
"[",
"4",
"]",
")"
] | https://github.com/echronos/echronos/blob/c996f1d2c8af6c6536205eb319c1bf1d4d84569c/external_tools/ply_info/example/BASIC/basparse.py#L83-L85 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/asyncio/sslproto.py | python | _SSLPipe.ssl_object | (self) | return self._sslobj | The internal ssl.SSLObject instance.
Return None if the pipe is not wrapped. | The internal ssl.SSLObject instance. | [
"The",
"internal",
"ssl",
".",
"SSLObject",
"instance",
"."
] | def ssl_object(self):
"""The internal ssl.SSLObject instance.
Return None if the pipe is not wrapped.
"""
return self._sslobj | [
"def",
"ssl_object",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sslobj"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/asyncio/sslproto.py#L83-L88 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/robotsim.py | python | WorldModel.robotLink | (self, *args) | return _robotsim.WorldModel_robotLink(self, *args) | robotLink(WorldModel self, int robot, int index) -> RobotModelLink
robotLink(WorldModel self, char const * robot, char const * name) -> RobotModelLink
Returns a RobotModelLink of some RobotModel in the world by index or name. | robotLink(WorldModel self, int robot, int index) -> RobotModelLink
robotLink(WorldModel self, char const * robot, char const * name) -> RobotModelLink | [
"robotLink",
"(",
"WorldModel",
"self",
"int",
"robot",
"int",
"index",
")",
"-",
">",
"RobotModelLink",
"robotLink",
"(",
"WorldModel",
"self",
"char",
"const",
"*",
"robot",
"char",
"const",
"*",
"name",
")",
"-",
">",
"RobotModelLink"
] | def robotLink(self, *args):
"""
robotLink(WorldModel self, int robot, int index) -> RobotModelLink
robotLink(WorldModel self, char const * robot, char const * name) -> RobotModelLink
Returns a RobotModelLink of some RobotModel in the world by index or name.
"""
retu... | [
"def",
"robotLink",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_robotsim",
".",
"WorldModel_robotLink",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/robotsim.py#L5884-L5894 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/utils.py | python | unquote_header_value | (value, is_filename=False) | return value | r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.
:param value: the header value to unquote.
:rtype: str | r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting. | [
"r",
"Unquotes",
"a",
"header",
"value",
".",
"(",
"Reversal",
"of",
":",
"func",
":",
"quote_header_value",
")",
".",
"This",
"does",
"not",
"use",
"the",
"real",
"unquoting",
"but",
"what",
"browsers",
"are",
"actually",
"using",
"for",
"quoting",
"."
] | def unquote_header_value(value, is_filename=False):
r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.
:param value: the header value to unquote.
:rtype: str
"""
if value and value[0]... | [
"def",
"unquote_header_value",
"(",
"value",
",",
"is_filename",
"=",
"False",
")",
":",
"if",
"value",
"and",
"value",
"[",
"0",
"]",
"==",
"value",
"[",
"-",
"1",
"]",
"==",
"'\"'",
":",
"# this is not the real unquoting, but fixing this so that the",
"# RFC i... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/utils.py#L390-L412 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/propgrid.py | python | PropertyGridPage.GetIndex | (*args, **kwargs) | return _propgrid.PropertyGridPage_GetIndex(*args, **kwargs) | GetIndex(self) -> int | GetIndex(self) -> int | [
"GetIndex",
"(",
"self",
")",
"-",
">",
"int"
] | def GetIndex(*args, **kwargs):
"""GetIndex(self) -> int"""
return _propgrid.PropertyGridPage_GetIndex(*args, **kwargs) | [
"def",
"GetIndex",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridPage_GetIndex",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L3360-L3362 | |
fontello/font-builder | 3974d0d370bd35f5fde203769d9351689b22b517 | bin/font_transform.py | python | apply_rescale | (glyph, origin, scale) | Rescale glyph | Rescale glyph | [
"Rescale",
"glyph"
] | def apply_rescale(glyph, origin, scale):
"""Rescale glyph"""
# move scale origin point to (0, 0)
sx, sy = origin
translate_matrix = psMat.translate(-sx, -sy)
glyph.transform(translate_matrix)
# scale around (0, 0)
scale_matrix = psMat.scale(scale)
glyph.transform(scale_matrix)
# mo... | [
"def",
"apply_rescale",
"(",
"glyph",
",",
"origin",
",",
"scale",
")",
":",
"# move scale origin point to (0, 0)",
"sx",
",",
"sy",
"=",
"origin",
"translate_matrix",
"=",
"psMat",
".",
"translate",
"(",
"-",
"sx",
",",
"-",
"sy",
")",
"glyph",
".",
"tran... | https://github.com/fontello/font-builder/blob/3974d0d370bd35f5fde203769d9351689b22b517/bin/font_transform.py#L11-L24 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/array_grad.py | python | _GatherGrad | (op, grad) | return [ops.IndexedSlices(values, indices, params_shape), None] | Gradient for Gather op. | Gradient for Gather op. | [
"Gradient",
"for",
"Gather",
"op",
"."
] | def _GatherGrad(op, grad):
"""Gradient for Gather op."""
# params can be large, so colocate the shape calculation with it.
#
# params can be very large for sparse model, array_ops.shape raises
# exception on the Windows platform when any dimension is larger than
# int32. params_shape is not used in optimize... | [
"def",
"_GatherGrad",
"(",
"op",
",",
"grad",
")",
":",
"# params can be large, so colocate the shape calculation with it.",
"#",
"# params can be very large for sparse model, array_ops.shape raises",
"# exception on the Windows platform when any dimension is larger than",
"# int32. params_s... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/array_grad.py#L455-L478 | |
shogun-toolbox/shogun | 9b8d856971af5a295dd6ad70623ae45647a6334c | applications/asp/genomic.py | python | write_gff | (f, (source, version), (seqtype, seqname), descrlist, skipheader=False) | writes a gff version 2 file
descrlist is a list of dictionaries, each of which contain these fields:
<seqname> <source> <feature> <start> <end> <score> <strand> <frame> [attributes] [comments] | writes a gff version 2 file
descrlist is a list of dictionaries, each of which contain these fields:
<seqname> <source> <feature> <start> <end> <score> <strand> <frame> [attributes] [comments] | [
"writes",
"a",
"gff",
"version",
"2",
"file",
"descrlist",
"is",
"a",
"list",
"of",
"dictionaries",
"each",
"of",
"which",
"contain",
"these",
"fields",
":",
"<seqname",
">",
"<source",
">",
"<feature",
">",
"<start",
">",
"<end",
">",
"<score",
">",
"<s... | def write_gff(f, (source, version), (seqtype, seqname), descrlist, skipheader=False):
""" writes a gff version 2 file
descrlist is a list of dictionaries, each of which contain these fields:
<seqname> <source> <feature> <start> <end> <score> <strand> <frame> [attributes] [comments]
"""
if not skipheader:
f.wr... | [
"def",
"write_gff",
"(",
"f",
",",
"(",
"source",
",",
"version",
")",
",",
"(",
"seqtype",
",",
"seqname",
")",
",",
"descrlist",
",",
"skipheader",
"=",
"False",
")",
":",
"if",
"not",
"skipheader",
":",
"f",
".",
"write",
"(",
"'##gff-version 2\\n'"... | https://github.com/shogun-toolbox/shogun/blob/9b8d856971af5a295dd6ad70623ae45647a6334c/applications/asp/genomic.py#L154-L177 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Window.GetCharWidth | (*args, **kwargs) | return _core_.Window_GetCharWidth(*args, **kwargs) | GetCharWidth(self) -> int
Get the (average) character size for the current font. | GetCharWidth(self) -> int | [
"GetCharWidth",
"(",
"self",
")",
"-",
">",
"int"
] | def GetCharWidth(*args, **kwargs):
"""
GetCharWidth(self) -> int
Get the (average) character size for the current font.
"""
return _core_.Window_GetCharWidth(*args, **kwargs) | [
"def",
"GetCharWidth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_GetCharWidth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L11022-L11028 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/gs/bucket.py | python | Bucket.get_website_configuration | (self, headers=None) | return self.get_website_configuration_with_xml(headers)[0] | Returns the current status of website configuration on the bucket.
:param dict headers: Additional headers to send with the request.
:rtype: dict
:returns: A dictionary containing the parsed XML response from GCS. The
overall structure is:
* WebsiteConfiguration
... | Returns the current status of website configuration on the bucket. | [
"Returns",
"the",
"current",
"status",
"of",
"website",
"configuration",
"on",
"the",
"bucket",
"."
] | def get_website_configuration(self, headers=None):
"""Returns the current status of website configuration on the bucket.
:param dict headers: Additional headers to send with the request.
:rtype: dict
:returns: A dictionary containing the parsed XML response from GCS. The
ov... | [
"def",
"get_website_configuration",
"(",
"self",
",",
"headers",
"=",
"None",
")",
":",
"return",
"self",
".",
"get_website_configuration_with_xml",
"(",
"headers",
")",
"[",
"0",
"]"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/gs/bucket.py#L859-L875 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/platform/benchmark.py | python | benchmarks_main | (true_main, argv=None) | Run benchmarks as declared in argv.
Args:
true_main: True main function to run if benchmarks are not requested.
argv: the command line arguments (if None, uses sys.argv). | Run benchmarks as declared in argv. | [
"Run",
"benchmarks",
"as",
"declared",
"in",
"argv",
"."
] | def benchmarks_main(true_main, argv=None):
"""Run benchmarks as declared in argv.
Args:
true_main: True main function to run if benchmarks are not requested.
argv: the command line arguments (if None, uses sys.argv).
"""
if argv is None:
argv = sys.argv
found_arg = [arg for arg in argv
... | [
"def",
"benchmarks_main",
"(",
"true_main",
",",
"argv",
"=",
"None",
")",
":",
"if",
"argv",
"is",
"None",
":",
"argv",
"=",
"sys",
".",
"argv",
"found_arg",
"=",
"[",
"arg",
"for",
"arg",
"in",
"argv",
"if",
"arg",
".",
"startswith",
"(",
"\"--benc... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/platform/benchmark.py#L322-L341 | ||
artyom-beilis/cppcms | 463a9a68e0bc15e2d01e8b8d72cc4fcc7f2b3264 | contrib/integration/session/python/cppcms.py | python | Session.get_binary | (self,key) | return res | Get binary value as bytearray | Get binary value as bytearray | [
"Get",
"binary",
"value",
"as",
"bytearray"
] | def get_binary(self,key):
"""Get binary value as bytearray"""
l=Loader.capi.cppcms_capi_session_get_binary_len(self.d,key)
res = bytearray(l)
res_proxy = (c_char * l).from_buffer(res);
Loader.capi.cppcms_capi_session_get_binary(self.d,key,res_proxy,l)
self.check()
... | [
"def",
"get_binary",
"(",
"self",
",",
"key",
")",
":",
"l",
"=",
"Loader",
".",
"capi",
".",
"cppcms_capi_session_get_binary_len",
"(",
"self",
".",
"d",
",",
"key",
")",
"res",
"=",
"bytearray",
"(",
"l",
")",
"res_proxy",
"=",
"(",
"c_char",
"*",
... | https://github.com/artyom-beilis/cppcms/blob/463a9a68e0bc15e2d01e8b8d72cc4fcc7f2b3264/contrib/integration/session/python/cppcms.py#L350-L357 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/utils/extmath.py | python | weighted_mode | (a, w, axis=0) | return mostfrequent, oldcounts | Returns an array of the weighted modal (most common) value in a
If there is more than one such value, only the first is returned.
The bin-count for the modal bins is also returned.
This is an extension of the algorithm in scipy.stats.mode.
Parameters
----------
a : array_like
n-dimens... | Returns an array of the weighted modal (most common) value in a | [
"Returns",
"an",
"array",
"of",
"the",
"weighted",
"modal",
"(",
"most",
"common",
")",
"value",
"in",
"a"
] | def weighted_mode(a, w, axis=0):
"""Returns an array of the weighted modal (most common) value in a
If there is more than one such value, only the first is returned.
The bin-count for the modal bins is also returned.
This is an extension of the algorithm in scipy.stats.mode.
Parameters
------... | [
"def",
"weighted_mode",
"(",
"a",
",",
"w",
",",
"axis",
"=",
"0",
")",
":",
"if",
"axis",
"is",
"None",
":",
"a",
"=",
"np",
".",
"ravel",
"(",
"a",
")",
"w",
"=",
"np",
".",
"ravel",
"(",
"w",
")",
"axis",
"=",
"0",
"else",
":",
"a",
"=... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/utils/extmath.py#L415-L486 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/numbers.py | python | Real.__round__ | (self, ndigits=None) | Rounds self to ndigits decimal places, defaulting to 0.
If ndigits is omitted or None, returns an Integral, otherwise
returns a Real. Rounds half toward even. | Rounds self to ndigits decimal places, defaulting to 0. | [
"Rounds",
"self",
"to",
"ndigits",
"decimal",
"places",
"defaulting",
"to",
"0",
"."
] | def __round__(self, ndigits=None):
"""Rounds self to ndigits decimal places, defaulting to 0.
If ndigits is omitted or None, returns an Integral, otherwise
returns a Real. Rounds half toward even.
"""
raise NotImplementedError | [
"def",
"__round__",
"(",
"self",
",",
"ndigits",
"=",
"None",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/numbers.py#L189-L195 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/tensor_forest/python/tensor_forest.py | python | ForestHParams.fill | (self) | return self | Intelligently sets any non-specific parameters. | Intelligently sets any non-specific parameters. | [
"Intelligently",
"sets",
"any",
"non",
"-",
"specific",
"parameters",
"."
] | def fill(self):
"""Intelligently sets any non-specific parameters."""
# Fail fast if num_classes or num_features isn't set.
_ = getattr(self, 'num_classes')
_ = getattr(self, 'num_features')
self.bagged_num_features = int(self.feature_bagging_fraction *
self.num_f... | [
"def",
"fill",
"(",
"self",
")",
":",
"# Fail fast if num_classes or num_features isn't set.",
"_",
"=",
"getattr",
"(",
"self",
",",
"'num_classes'",
")",
"_",
"=",
"getattr",
"(",
"self",
",",
"'num_features'",
")",
"self",
".",
"bagged_num_features",
"=",
"in... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/tensor_forest/python/tensor_forest.py#L195-L282 | |
yuxng/PoseCNN | 9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04 | lib/datasets/ycb.py | python | ycb.metadata_path_from_index | (self, index) | return metadata_path | Construct an metadata path from the image's "index" identifier. | Construct an metadata path from the image's "index" identifier. | [
"Construct",
"an",
"metadata",
"path",
"from",
"the",
"image",
"s",
"index",
"identifier",
"."
] | def metadata_path_from_index(self, index):
"""
Construct an metadata path from the image's "index" identifier.
"""
metadata_path = os.path.join(self._data_path, index + '-meta.mat')
assert os.path.exists(metadata_path), \
'Path does not exist: {}'.format(metadata_... | [
"def",
"metadata_path_from_index",
"(",
"self",
",",
"index",
")",
":",
"metadata_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_data_path",
",",
"index",
"+",
"'-meta.mat'",
")",
"assert",
"os",
".",
"path",
".",
"exists",
"(",
"metadat... | https://github.com/yuxng/PoseCNN/blob/9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04/lib/datasets/ycb.py#L103-L110 | |
openmm/openmm | cb293447c4fc8b03976dfe11399f107bab70f3d9 | wrappers/python/openmm/app/modeller.py | python | Modeller.deleteWater | (self) | Delete all water molecules from the model. | Delete all water molecules from the model. | [
"Delete",
"all",
"water",
"molecules",
"from",
"the",
"model",
"."
] | def deleteWater(self):
"""Delete all water molecules from the model."""
self.delete(res for res in self.topology.residues() if res.name == "HOH") | [
"def",
"deleteWater",
"(",
"self",
")",
":",
"self",
".",
"delete",
"(",
"res",
"for",
"res",
"in",
"self",
".",
"topology",
".",
"residues",
"(",
")",
"if",
"res",
".",
"name",
"==",
"\"HOH\"",
")"
] | https://github.com/openmm/openmm/blob/cb293447c4fc8b03976dfe11399f107bab70f3d9/wrappers/python/openmm/app/modeller.py#L185-L187 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/telemetry/telemetry/core/tab.py | python | Tab.dom_stats | (self) | return dom_counters | A dictionary populated with measured DOM statistics.
Currently this dictionary contains:
{
'document_count': integer,
'node_count': integer,
'event_listener_count': integer
} | A dictionary populated with measured DOM statistics. | [
"A",
"dictionary",
"populated",
"with",
"measured",
"DOM",
"statistics",
"."
] | def dom_stats(self):
"""A dictionary populated with measured DOM statistics.
Currently this dictionary contains:
{
'document_count': integer,
'node_count': integer,
'event_listener_count': integer
}
"""
dom_counters = self._inspector_backend.GetDOMStats(
timeout=DEFAUL... | [
"def",
"dom_stats",
"(",
"self",
")",
":",
"dom_counters",
"=",
"self",
".",
"_inspector_backend",
".",
"GetDOMStats",
"(",
"timeout",
"=",
"DEFAULT_TAB_TIMEOUT",
")",
"assert",
"(",
"len",
"(",
"dom_counters",
")",
"==",
"3",
"and",
"all",
"(",
"[",
"x",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/telemetry/telemetry/core/tab.py#L40-L55 | |
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/bindings/python/MythTV/methodheap.py | python | MythBE.getFreeInputInfo | (self) | return res_inputinfo | Return a list of 'InputInfo' tuples of free recorders in preferred
live TV order.
Returns an empty list if no recorders are available.
Introduced in protocol 87, changed in protocols 89, 90, 91.
InputInfo is a named tuple containing:
('InputInfo', ('name', 'sourceid', 'inputid',... | Return a list of 'InputInfo' tuples of free recorders in preferred
live TV order.
Returns an empty list if no recorders are available.
Introduced in protocol 87, changed in protocols 89, 90, 91. | [
"Return",
"a",
"list",
"of",
"InputInfo",
"tuples",
"of",
"free",
"recorders",
"in",
"preferred",
"live",
"TV",
"order",
".",
"Returns",
"an",
"empty",
"list",
"if",
"no",
"recorders",
"are",
"available",
".",
"Introduced",
"in",
"protocol",
"87",
"changed",... | def getFreeInputInfo(self):
"""
Return a list of 'InputInfo' tuples of free recorders in preferred
live TV order.
Returns an empty list if no recorders are available.
Introduced in protocol 87, changed in protocols 89, 90, 91.
InputInfo is a named tuple containing:
... | [
"def",
"getFreeInputInfo",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"backendCommand",
"(",
"'GET_FREE_INPUT_INFO 0'",
")",
".",
"split",
"(",
"BACKEND_SEP",
")",
"# this maps the list of variable length ('res') to InputInfo tuples:",
"res_inputinfo",
"=",
"[",
"s... | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/bindings/python/MythTV/methodheap.py#L123-L147 | |
s9xie/hed | 94fb22f10cbfec8d84fbc0642b224022014b6bd6 | scripts/cpp_lint.py | python | CheckAccess | (filename, clean_lines, linenum, nesting_state, error) | Checks for improper use of DISALLOW* macros.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
nesting_state: A _NestingState instance which maintains information about
the current stac... | Checks for improper use of DISALLOW* macros. | [
"Checks",
"for",
"improper",
"use",
"of",
"DISALLOW",
"*",
"macros",
"."
] | def CheckAccess(filename, clean_lines, linenum, nesting_state, error):
"""Checks for improper use of DISALLOW* macros.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
nesting_state: A _NestingState in... | [
"def",
"CheckAccess",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# get rid of comments and strings",
"matched",
"=",
"Match",
"(",
"(",
"r'... | https://github.com/s9xie/hed/blob/94fb22f10cbfec8d84fbc0642b224022014b6bd6/scripts/cpp_lint.py#L2486-L2514 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/share/gdb/python/gdb/command/frame_filters.py | python | _enable_parse_arg | (cmd_name, arg) | return argv | Internal worker function to take an argument from
enable/disable and return a tuple of arguments.
Arguments:
cmd_name: Name of the command invoking this function.
args: The argument as a string.
Returns:
A tuple containing the dictionary, and the argument, or just
the dicti... | Internal worker function to take an argument from
enable/disable and return a tuple of arguments. | [
"Internal",
"worker",
"function",
"to",
"take",
"an",
"argument",
"from",
"enable",
"/",
"disable",
"and",
"return",
"a",
"tuple",
"of",
"arguments",
"."
] | def _enable_parse_arg(cmd_name, arg):
""" Internal worker function to take an argument from
enable/disable and return a tuple of arguments.
Arguments:
cmd_name: Name of the command invoking this function.
args: The argument as a string.
Returns:
A tuple containing the dictionar... | [
"def",
"_enable_parse_arg",
"(",
"cmd_name",
",",
"arg",
")",
":",
"argv",
"=",
"gdb",
".",
"string_to_argv",
"(",
"arg",
")",
"argc",
"=",
"len",
"(",
"argv",
")",
"if",
"argv",
"[",
"0",
"]",
"==",
"\"all\"",
"and",
"argc",
">",
"1",
":",
"raise"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/share/gdb/python/gdb/command/frame_filters.py#L108-L130 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | RichTextBuffer.CanPasteFromClipboard | (*args, **kwargs) | return _richtext.RichTextBuffer_CanPasteFromClipboard(*args, **kwargs) | CanPasteFromClipboard(self) -> bool | CanPasteFromClipboard(self) -> bool | [
"CanPasteFromClipboard",
"(",
"self",
")",
"-",
">",
"bool"
] | def CanPasteFromClipboard(*args, **kwargs):
"""CanPasteFromClipboard(self) -> bool"""
return _richtext.RichTextBuffer_CanPasteFromClipboard(*args, **kwargs) | [
"def",
"CanPasteFromClipboard",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextBuffer_CanPasteFromClipboard",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L2309-L2311 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/reduce4circleGUI.py | python | MainWindow.load_project | (self, project_file_name) | Load a saved project with all the setup loaded to memory
:param project_file_name:
:return: | Load a saved project with all the setup loaded to memory
:param project_file_name:
:return: | [
"Load",
"a",
"saved",
"project",
"with",
"all",
"the",
"setup",
"loaded",
"to",
"memory",
":",
"param",
"project_file_name",
":",
":",
"return",
":"
] | def load_project(self, project_file_name):
"""
Load a saved project with all the setup loaded to memory
:param project_file_name:
:return:
"""
assert isinstance(project_file_name, str), 'Project file name %s must be a string but not %s.' \
... | [
"def",
"load_project",
"(",
"self",
",",
"project_file_name",
")",
":",
"assert",
"isinstance",
"(",
"project_file_name",
",",
"str",
")",
",",
"'Project file name %s must be a string but not %s.'",
"''",
"%",
"(",
"str",
"(",
"project_file_name",
")",
",",
"type",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/reduce4circleGUI.py#L2084-L2143 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator.py | python | _get_rnn_model_fn | (cell_type,
target_column,
problem_type,
optimizer,
num_unroll,
num_units,
num_threads,
queue_capacity,
batch_size,
sequen... | return _rnn_model_fn | Creates a state saving RNN model function for an `Estimator`.
Args:
cell_type: A subclass of `RNNCell` or one of 'basic_rnn,' 'lstm' or 'gru'.
target_column: An initialized `TargetColumn`, used to calculate prediction
and loss.
problem_type: `ProblemType.CLASSIFICATION` or
`ProblemType.LINEAR_R... | Creates a state saving RNN model function for an `Estimator`. | [
"Creates",
"a",
"state",
"saving",
"RNN",
"model",
"function",
"for",
"an",
"Estimator",
"."
] | def _get_rnn_model_fn(cell_type,
target_column,
problem_type,
optimizer,
num_unroll,
num_units,
num_threads,
queue_capacity,
batch_size,
... | [
"def",
"_get_rnn_model_fn",
"(",
"cell_type",
",",
"target_column",
",",
"problem_type",
",",
"optimizer",
",",
"num_unroll",
",",
"num_units",
",",
"num_threads",
",",
"queue_capacity",
",",
"batch_size",
",",
"sequence_feature_columns",
",",
"context_feature_columns",... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator.py#L386-L532 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/configdialog.py | python | HighPage.var_changed_theme_source | (self, *params) | Process toggle between builtin and custom theme.
Update the default toggle value and apply the newly
selected theme type. | Process toggle between builtin and custom theme. | [
"Process",
"toggle",
"between",
"builtin",
"and",
"custom",
"theme",
"."
] | def var_changed_theme_source(self, *params):
"""Process toggle between builtin and custom theme.
Update the default toggle value and apply the newly
selected theme type.
"""
value = self.theme_source.get()
changes.add_option('main', 'Theme', 'default', value)
if ... | [
"def",
"var_changed_theme_source",
"(",
"self",
",",
"*",
"params",
")",
":",
"value",
"=",
"self",
".",
"theme_source",
".",
"get",
"(",
")",
"changes",
".",
"add_option",
"(",
"'main'",
",",
"'Theme'",
",",
"'default'",
",",
"value",
")",
"if",
"value"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/configdialog.py#L1031-L1042 | ||
Tencent/TNN | 7acca99f54c55747b415a4c57677403eebc7b706 | third_party/flatbuffers/python/flatbuffers/builder.py | python | Builder.Output | (self) | return self.Bytes[self.Head():] | Return the portion of the buffer that has been used for writing data.
This is the typical way to access the FlatBuffer data inside the
builder. If you try to access `Builder.Bytes` directly, you would need
to manually index it with `Head()`, since the buffer is constructed
backwards.
... | Return the portion of the buffer that has been used for writing data. | [
"Return",
"the",
"portion",
"of",
"the",
"buffer",
"that",
"has",
"been",
"used",
"for",
"writing",
"data",
"."
] | def Output(self):
"""Return the portion of the buffer that has been used for writing data.
This is the typical way to access the FlatBuffer data inside the
builder. If you try to access `Builder.Bytes` directly, you would need
to manually index it with `Head()`, since the buffer is cons... | [
"def",
"Output",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"finished",
":",
"raise",
"BuilderNotFinishedError",
"(",
")",
"return",
"self",
".",
"Bytes",
"[",
"self",
".",
"Head",
"(",
")",
":",
"]"
] | https://github.com/Tencent/TNN/blob/7acca99f54c55747b415a4c57677403eebc7b706/third_party/flatbuffers/python/flatbuffers/builder.py#L138-L153 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/VBox/Devices/EFI/Firmware/BaseTools/Scripts/UpdateBuildVersions.py | python | UpdateBuildVersionH | (Rev, UserModified, opts) | This routine will update the BuildVersion.h files in the C source tree | This routine will update the BuildVersion.h files in the C source tree | [
"This",
"routine",
"will",
"update",
"the",
"BuildVersion",
".",
"h",
"files",
"in",
"the",
"C",
"source",
"tree"
] | def UpdateBuildVersionH(Rev, UserModified, opts):
""" This routine will update the BuildVersion.h files in the C source tree """
CPath = os.path.join(os.environ['BASE_TOOLS_PATH'], "Source", "C", "Include", "Common")
BuildVersionH = os.path.join(CPath, "BuildVersion.h")
fd_ = open(os.path.normpath(Build... | [
"def",
"UpdateBuildVersionH",
"(",
"Rev",
",",
"UserModified",
",",
"opts",
")",
":",
"CPath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"environ",
"[",
"'BASE_TOOLS_PATH'",
"]",
",",
"\"Source\"",
",",
"\"C\"",
",",
"\"Include\"",
",",
"\"Com... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/VBox/Devices/EFI/Firmware/BaseTools/Scripts/UpdateBuildVersions.py#L171-L200 | ||
yrnkrn/zapcc | c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50 | utils/lit/lit/LitConfig.py | python | LitConfig.load_config | (self, config, path) | return config | load_config(config, path) - Load a config object from an alternate
path. | load_config(config, path) - Load a config object from an alternate
path. | [
"load_config",
"(",
"config",
"path",
")",
"-",
"Load",
"a",
"config",
"object",
"from",
"an",
"alternate",
"path",
"."
] | def load_config(self, config, path):
"""load_config(config, path) - Load a config object from an alternate
path."""
if self.debug:
self.note('load_config from %r' % path)
config.load_from_path(path, self)
return config | [
"def",
"load_config",
"(",
"self",
",",
"config",
",",
"path",
")",
":",
"if",
"self",
".",
"debug",
":",
"self",
".",
"note",
"(",
"'load_config from %r'",
"%",
"path",
")",
"config",
".",
"load_from_path",
"(",
"path",
",",
"self",
")",
"return",
"co... | https://github.com/yrnkrn/zapcc/blob/c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50/utils/lit/lit/LitConfig.py#L101-L107 | |
Jittor/jittor | e9aca0444c2bdc8e2389d99122954cd0903eec46 | python/jittor/nn.py | python | conv2d | (x, weight, bias=None, stride=1, padding=0, dilation=1, groups=1) | Applies a 2D convolution over an input signal composed of several input planes.
:param x: the input image
:type x: jt.Var
:param weight: the convolution kernel
:type weight: jt.Var
:param bias: the bias after convolution
:type bias: jt,Var, optional
:param stride: Stride of the convoluti... | Applies a 2D convolution over an input signal composed of several input planes. | [
"Applies",
"a",
"2D",
"convolution",
"over",
"an",
"input",
"signal",
"composed",
"of",
"several",
"input",
"planes",
"."
] | def conv2d(x, weight, bias=None, stride=1, padding=0, dilation=1, groups=1):
''' Applies a 2D convolution over an input signal composed of several input planes.
:param x: the input image
:type x: jt.Var
:param weight: the convolution kernel
:type weight: jt.Var
:param bias: the bias after con... | [
"def",
"conv2d",
"(",
"x",
",",
"weight",
",",
"bias",
"=",
"None",
",",
"stride",
"=",
"1",
",",
"padding",
"=",
"0",
",",
"dilation",
"=",
"1",
",",
"groups",
"=",
"1",
")",
":",
"padding",
"=",
"_pair",
"(",
"padding",
")",
"stride",
"=",
"_... | https://github.com/Jittor/jittor/blob/e9aca0444c2bdc8e2389d99122954cd0903eec46/python/jittor/nn.py#L1008-L1093 | ||
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/procrouting/sapt/sapt_jk_terms.py | python | build_sapt_jk_cache | (wfn_A, wfn_B, jk, do_print=True) | return cache | Constructs the DCBS cache data required to compute ELST/EXCH/IND | Constructs the DCBS cache data required to compute ELST/EXCH/IND | [
"Constructs",
"the",
"DCBS",
"cache",
"data",
"required",
"to",
"compute",
"ELST",
"/",
"EXCH",
"/",
"IND"
] | def build_sapt_jk_cache(wfn_A, wfn_B, jk, do_print=True):
"""
Constructs the DCBS cache data required to compute ELST/EXCH/IND
"""
core.print_out("\n ==> Preparing SAPT Data Cache <== \n\n")
jk.print_header()
cache = {}
cache["wfn_A"] = wfn_A
cache["wfn_B"] = wfn_B
# First grab t... | [
"def",
"build_sapt_jk_cache",
"(",
"wfn_A",
",",
"wfn_B",
",",
"jk",
",",
"do_print",
"=",
"True",
")",
":",
"core",
".",
"print_out",
"(",
"\"\\n ==> Preparing SAPT Data Cache <== \\n\\n\"",
")",
"jk",
".",
"print_header",
"(",
")",
"cache",
"=",
"{",
"}",
... | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/procrouting/sapt/sapt_jk_terms.py#L39-L118 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.