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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
google/mozc | 7329757e1ad30e327c1ae823a8302c79482d6b9c | src/base/gen_config_file_stream_data.py | python | GenerateFileData | (path) | return ''.join(result) | r"""Generate FileData entry from given file path.
The generated FileData entry looks as follows:
{ "something_original_file_path", "\xAA\xBB\xCC", 3 }
Args:
path: a filepath to be converted into FileData.
Returns:
Generated code of a FileData entry. | r"""Generate FileData entry from given file path. | [
"r",
"Generate",
"FileData",
"entry",
"from",
"given",
"file",
"path",
"."
] | def GenerateFileData(path):
r"""Generate FileData entry from given file path.
The generated FileData entry looks as follows:
{ "something_original_file_path", "\xAA\xBB\xCC", 3 }
Args:
path: a filepath to be converted into FileData.
Returns:
Generated code of a FileData entry.
"""
result = []
... | [
"def",
"GenerateFileData",
"(",
"path",
")",
":",
"result",
"=",
"[",
"]",
"result",
".",
"append",
"(",
"' { \"%s\", \"'",
"%",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")",
")",
"with",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"stream"... | https://github.com/google/mozc/blob/7329757e1ad30e327c1ae823a8302c79482d6b9c/src/base/gen_config_file_stream_data.py#L48-L66 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/geographic_msgs/msg/_GeoPose.py | python | GeoPose.__init__ | (self, *args, **kwds) | Constructor. Any message fields that are implicitly/explicitly
set to None will be assigned a default value. The recommend
use is keyword arguments as this is more robust to future message
changes. You cannot mix in-order arguments and keyword arguments.
The available fields are:
position,orien... | Constructor. Any message fields that are implicitly/explicitly
set to None will be assigned a default value. The recommend
use is keyword arguments as this is more robust to future message
changes. You cannot mix in-order arguments and keyword arguments. | [
"Constructor",
".",
"Any",
"message",
"fields",
"that",
"are",
"implicitly",
"/",
"explicitly",
"set",
"to",
"None",
"will",
"be",
"assigned",
"a",
"default",
"value",
".",
"The",
"recommend",
"use",
"is",
"keyword",
"arguments",
"as",
"this",
"is",
"more",
... | def __init__(self, *args, **kwds):
"""
Constructor. Any message fields that are implicitly/explicitly
set to None will be assigned a default value. The recommend
use is keyword arguments as this is more robust to future message
changes. You cannot mix in-order arguments and keyword arguments.
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"if",
"args",
"or",
"kwds",
":",
"super",
"(",
"GeoPose",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
"#message fields cannot be... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/geographic_msgs/msg/_GeoPose.py#L52-L75 | ||
wujixiu/helmet-detection | 8eff5c59ddfba5a29e0b76aeb48babcb49246178 | hardhat-wearing-detection/SSD-RPA/scripts/cpp_lint.py | python | CheckForFunctionLengths | (filename, clean_lines, linenum,
function_state, error) | Reports for long function bodies.
For an overview why this is done, see:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions
Uses a simplistic algorithm assuming other style guidelines
(especially spacing) are followed.
Only checks unindented functions, so class members are ... | Reports for long function bodies. | [
"Reports",
"for",
"long",
"function",
"bodies",
"."
] | def CheckForFunctionLengths(filename, clean_lines, linenum,
function_state, error):
"""Reports for long function bodies.
For an overview why this is done, see:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions
Uses a simplistic algorithm assuming ... | [
"def",
"CheckForFunctionLengths",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"function_state",
",",
"error",
")",
":",
"lines",
"=",
"clean_lines",
".",
"lines",
"line",
"=",
"lines",
"[",
"linenum",
"]",
"raw",
"=",
"clean_lines",
".",
"raw_l... | https://github.com/wujixiu/helmet-detection/blob/8eff5c59ddfba5a29e0b76aeb48babcb49246178/hardhat-wearing-detection/SSD-RPA/scripts/cpp_lint.py#L2388-L2455 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/controlflow.py | python | CFGraph.exit_points | (self) | return self._exit_points | Return the computed set of exit nodes (may be empty). | Return the computed set of exit nodes (may be empty). | [
"Return",
"the",
"computed",
"set",
"of",
"exit",
"nodes",
"(",
"may",
"be",
"empty",
")",
"."
] | def exit_points(self):
"""
Return the computed set of exit nodes (may be empty).
"""
return self._exit_points | [
"def",
"exit_points",
"(",
"self",
")",
":",
"return",
"self",
".",
"_exit_points"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/controlflow.py#L197-L201 | |
gabyx/ApproxMVBB | 838f3ff7690a938f1e4199a5f41b6feefc32a603 | example/kdTreeFiltering/python/Tools/Transformations/Transformations.py | python | random_vector | (size) | return numpy.random.random(size) | Return array of random doubles in the half-open interval [0.0, 1.0).
>>> v = random_vector(10000)
>>> numpy.all(v >= 0) and numpy.all(v < 1)
True
>>> v0 = random_vector(10)
>>> v1 = random_vector(10)
>>> numpy.any(v0 == v1)
False | Return array of random doubles in the half-open interval [0.0, 1.0). | [
"Return",
"array",
"of",
"random",
"doubles",
"in",
"the",
"half",
"-",
"open",
"interval",
"[",
"0",
".",
"0",
"1",
".",
"0",
")",
"."
] | def random_vector(size):
"""Return array of random doubles in the half-open interval [0.0, 1.0).
>>> v = random_vector(10000)
>>> numpy.all(v >= 0) and numpy.all(v < 1)
True
>>> v0 = random_vector(10)
>>> v1 = random_vector(10)
>>> numpy.any(v0 == v1)
False
"""
return numpy.ran... | [
"def",
"random_vector",
"(",
"size",
")",
":",
"return",
"numpy",
".",
"random",
".",
"random",
"(",
"size",
")"
] | https://github.com/gabyx/ApproxMVBB/blob/838f3ff7690a938f1e4199a5f41b6feefc32a603/example/kdTreeFiltering/python/Tools/Transformations/Transformations.py#L1757-L1769 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/engine/training_v1.py | python | Model._in_multi_worker_mode | (self) | return strategy and strategy.extended._in_multi_worker_mode() | Method to infer if this `Model` is working in multi-worker settings.
Multi-worker training refers to the setup where the training is
distributed across multiple workers, as opposed to the case where
only a local process performs the training. This function is
used to infer for example whether or not a ... | Method to infer if this `Model` is working in multi-worker settings. | [
"Method",
"to",
"infer",
"if",
"this",
"Model",
"is",
"working",
"in",
"multi",
"-",
"worker",
"settings",
"."
] | def _in_multi_worker_mode(self):
"""Method to infer if this `Model` is working in multi-worker settings.
Multi-worker training refers to the setup where the training is
distributed across multiple workers, as opposed to the case where
only a local process performs the training. This function is
use... | [
"def",
"_in_multi_worker_mode",
"(",
"self",
")",
":",
"strategy",
"=",
"self",
".",
"_distribution_strategy",
"# Otherwise, use the strategy whose scope this is in.",
"if",
"not",
"strategy",
"and",
"distribution_strategy_context",
".",
"has_strategy",
"(",
")",
":",
"st... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/engine/training_v1.py#L2800-L2821 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/pubsub/core/topicdefnprovider.py | python | ITopicDefnProvider.topicNames | (self) | Return an iterator over topic names available from this provider.
Note that the topic names should be in tuple rather than dotted-string
format so as to be compatible with getDefn(). | Return an iterator over topic names available from this provider.
Note that the topic names should be in tuple rather than dotted-string
format so as to be compatible with getDefn(). | [
"Return",
"an",
"iterator",
"over",
"topic",
"names",
"available",
"from",
"this",
"provider",
".",
"Note",
"that",
"the",
"topic",
"names",
"should",
"be",
"in",
"tuple",
"rather",
"than",
"dotted",
"-",
"string",
"format",
"so",
"as",
"to",
"be",
"compat... | def topicNames(self):
"""Return an iterator over topic names available from this provider.
Note that the topic names should be in tuple rather than dotted-string
format so as to be compatible with getDefn()."""
msg = 'Must return a list of topic names available from this provider'
... | [
"def",
"topicNames",
"(",
"self",
")",
":",
"msg",
"=",
"'Must return a list of topic names available from this provider'",
"raise",
"NotImplementedError",
"(",
"msg",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/pubsub/core/topicdefnprovider.py#L37-L42 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/webapp2/webapp2_extras/routes.py | python | NamePrefixRoute.__init__ | (self, prefix, routes) | Initializes a URL route.
:param prefix:
The prefix to be prepended.
:param routes:
A list of :class:`webapp2.Route` instances. | Initializes a URL route. | [
"Initializes",
"a",
"URL",
"route",
"."
] | def __init__(self, prefix, routes):
"""Initializes a URL route.
:param prefix:
The prefix to be prepended.
:param routes:
A list of :class:`webapp2.Route` instances.
"""
super(NamePrefixRoute, self).__init__(routes)
self.prefix = prefix
# ... | [
"def",
"__init__",
"(",
"self",
",",
"prefix",
",",
"routes",
")",
":",
"super",
"(",
"NamePrefixRoute",
",",
"self",
")",
".",
"__init__",
"(",
"routes",
")",
"self",
".",
"prefix",
"=",
"prefix",
"# Prepend a prefix to a route attribute.",
"for",
"route",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/webapp2/webapp2_extras/routes.py#L145-L157 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | PseudoDC.DrawRotatedText | (*args, **kwargs) | return _gdi_.PseudoDC_DrawRotatedText(*args, **kwargs) | DrawRotatedText(self, String text, int x, int y, double angle)
Draws the text rotated by *angle* degrees, if supported by the platform.
**NOTE**: Under Win9x only TrueType fonts can be drawn by this
function. In particular, a font different from ``wx.NORMAL_FONT``
should be used as the... | DrawRotatedText(self, String text, int x, int y, double angle) | [
"DrawRotatedText",
"(",
"self",
"String",
"text",
"int",
"x",
"int",
"y",
"double",
"angle",
")"
] | def DrawRotatedText(*args, **kwargs):
"""
DrawRotatedText(self, String text, int x, int y, double angle)
Draws the text rotated by *angle* degrees, if supported by the platform.
**NOTE**: Under Win9x only TrueType fonts can be drawn by this
function. In particular, a font diffe... | [
"def",
"DrawRotatedText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"PseudoDC_DrawRotatedText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L8286-L8297 | |
KhronosGroup/Vulkan-Headers | b32da5329b50e3cb96229aaecba9ded032fe29cc | registry/generator.py | python | regSortFeatureVersionKey | (feature) | return float(feature.versionNumber) | Sort key for regSortFeatures - key is the feature version.
`<extension>` elements all have version number 0. | Sort key for regSortFeatures - key is the feature version.
`<extension>` elements all have version number 0. | [
"Sort",
"key",
"for",
"regSortFeatures",
"-",
"key",
"is",
"the",
"feature",
"version",
".",
"<extension",
">",
"elements",
"all",
"have",
"version",
"number",
"0",
"."
] | def regSortFeatureVersionKey(feature):
"""Sort key for regSortFeatures - key is the feature version.
`<extension>` elements all have version number 0."""
return float(feature.versionNumber) | [
"def",
"regSortFeatureVersionKey",
"(",
"feature",
")",
":",
"return",
"float",
"(",
"feature",
".",
"versionNumber",
")"
] | https://github.com/KhronosGroup/Vulkan-Headers/blob/b32da5329b50e3cb96229aaecba9ded032fe29cc/registry/generator.py#L81-L85 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py | python | IsValidTargetForWrapper | (target_extras, executable_target_pattern, spec) | return False | Limit targets for Xcode wrapper.
Xcode sometimes performs poorly with too many targets, so only include
proper executable targets, with filters to customize.
Arguments:
target_extras: Regular expression to always add, matching any target.
executable_target_pattern: Regular expression limiting executable ... | Limit targets for Xcode wrapper. | [
"Limit",
"targets",
"for",
"Xcode",
"wrapper",
"."
] | def IsValidTargetForWrapper(target_extras, executable_target_pattern, spec):
"""Limit targets for Xcode wrapper.
Xcode sometimes performs poorly with too many targets, so only include
proper executable targets, with filters to customize.
Arguments:
target_extras: Regular expression to always add, matchin... | [
"def",
"IsValidTargetForWrapper",
"(",
"target_extras",
",",
"executable_target_pattern",
",",
"spec",
")",
":",
"target_name",
"=",
"spec",
".",
"get",
"(",
"\"target_name\"",
")",
"# Always include targets matching target_extras.",
"if",
"target_extras",
"is",
"not",
... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py#L137-L163 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/ctypes/_aix.py | python | get_ld_headers | (file) | return ldr_headers | Parse the header of the loader section of executable and archives
This function calls /usr/bin/dump -H as a subprocess
and returns a list of (ld_header, ld_header_info) tuples. | Parse the header of the loader section of executable and archives
This function calls /usr/bin/dump -H as a subprocess
and returns a list of (ld_header, ld_header_info) tuples. | [
"Parse",
"the",
"header",
"of",
"the",
"loader",
"section",
"of",
"executable",
"and",
"archives",
"This",
"function",
"calls",
"/",
"usr",
"/",
"bin",
"/",
"dump",
"-",
"H",
"as",
"a",
"subprocess",
"and",
"returns",
"a",
"list",
"of",
"(",
"ld_header",... | def get_ld_headers(file):
"""
Parse the header of the loader section of executable and archives
This function calls /usr/bin/dump -H as a subprocess
and returns a list of (ld_header, ld_header_info) tuples.
"""
# get_ld_headers parsing:
# 1. Find a line that starts with /, ./, or ../ - set a... | [
"def",
"get_ld_headers",
"(",
"file",
")",
":",
"# get_ld_headers parsing:",
"# 1. Find a line that starts with /, ./, or ../ - set as ld_header",
"# 2. If \"INDEX\" in occurs in a following line - return ld_header",
"# 3. get info (lines starting with [0-9])",
"ldr_headers",
"=",
"[",
"]"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/ctypes/_aix.py#L97-L119 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib-tk/turtle.py | python | RawTurtle.shape | (self, name=None) | Set turtle shape to shape with given name / return current shapename.
Optional argument:
name -- a string, which is a valid shapename
Set turtle shape to shape with given name or, if name is not given,
return name of current shape.
Shape with name must exist in the TurtleScreen... | Set turtle shape to shape with given name / return current shapename. | [
"Set",
"turtle",
"shape",
"to",
"shape",
"with",
"given",
"name",
"/",
"return",
"current",
"shapename",
"."
] | def shape(self, name=None):
"""Set turtle shape to shape with given name / return current shapename.
Optional argument:
name -- a string, which is a valid shapename
Set turtle shape to shape with given name or, if name is not given,
return name of current shape.
Shape w... | [
"def",
"shape",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"return",
"self",
".",
"turtle",
".",
"shapeIndex",
"if",
"not",
"name",
"in",
"self",
".",
"screen",
".",
"getshapes",
"(",
")",
":",
"raise",
"Turtl... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib-tk/turtle.py#L2658-L2683 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/protobuf/python/google/protobuf/internal/containers.py | python | RepeatedScalarFieldContainer.MergeFrom | (self, other) | Appends the contents of another repeated field of the same type to this
one. We do not check the types of the individual fields. | Appends the contents of another repeated field of the same type to this
one. We do not check the types of the individual fields. | [
"Appends",
"the",
"contents",
"of",
"another",
"repeated",
"field",
"of",
"the",
"same",
"type",
"to",
"this",
"one",
".",
"We",
"do",
"not",
"check",
"the",
"types",
"of",
"the",
"individual",
"fields",
"."
] | def MergeFrom(self, other):
"""Appends the contents of another repeated field of the same type to this
one. We do not check the types of the individual fields.
"""
self._values.extend(other._values)
self._message_listener.Modified() | [
"def",
"MergeFrom",
"(",
"self",
",",
"other",
")",
":",
"self",
".",
"_values",
".",
"extend",
"(",
"other",
".",
"_values",
")",
"self",
".",
"_message_listener",
".",
"Modified",
"(",
")"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/protobuf/python/google/protobuf/internal/containers.py#L130-L135 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/py_compile.py | python | main | (args=None) | return rv | Compile several source files.
The files named in 'args' (or on the command line, if 'args' is
not specified) are compiled and the resulting bytecode is cached
in the normal manner. This function does not search a directory
structure to locate source files; it only compiles files named
explicitly. ... | Compile several source files. | [
"Compile",
"several",
"source",
"files",
"."
] | def main(args=None):
"""Compile several source files.
The files named in 'args' (or on the command line, if 'args' is
not specified) are compiled and the resulting bytecode is cached
in the normal manner. This function does not search a directory
structure to locate source files; it only compiles ... | [
"def",
"main",
"(",
"args",
"=",
"None",
")",
":",
"if",
"args",
"is",
"None",
":",
"args",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"rv",
"=",
"0",
"if",
"args",
"==",
"[",
"'-'",
"]",
":",
"while",
"True",
":",
"filename",
"=",
"sys",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/py_compile.py#L131-L167 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/input_lib.py | python | _SingleWorkerDatasetIteratorBase.get_next | (self, device, name=None) | Get next element for the given device. | Get next element for the given device. | [
"Get",
"next",
"element",
"for",
"the",
"given",
"device",
"."
] | def get_next(self, device, name=None):
"""Get next element for the given device."""
del name
with ops.device(self._worker):
if _should_use_multi_device_iterator(self._options):
return self._iterator.get_next(device)
else:
return self._iterator.get_next() | [
"def",
"get_next",
"(",
"self",
",",
"device",
",",
"name",
"=",
"None",
")",
":",
"del",
"name",
"with",
"ops",
".",
"device",
"(",
"self",
".",
"_worker",
")",
":",
"if",
"_should_use_multi_device_iterator",
"(",
"self",
".",
"_options",
")",
":",
"r... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/input_lib.py#L1570-L1577 | ||
DLR-SC/tigl | d1c5901e948e33d10b1f9659ff3e22c4717b455f | thirdparty/nsiqcppstyle/nsiqcppstyle_rulemanager.py | python | RuleManager.RunPreprocessRule | (self, lexer, contextStack) | Run rules which runs in the preprecessor blocks | Run rules which runs in the preprecessor blocks | [
"Run",
"rules",
"which",
"runs",
"in",
"the",
"preprecessor",
"blocks"
] | def RunPreprocessRule(self, lexer, contextStack):
""" Run rules which runs in the preprecessor blocks """
for preprocessRule in self.preprocessRules :
data = lexer.Backup()
preprocessRule(lexer, contextStack)
lexer.Restore(data) | [
"def",
"RunPreprocessRule",
"(",
"self",
",",
"lexer",
",",
"contextStack",
")",
":",
"for",
"preprocessRule",
"in",
"self",
".",
"preprocessRules",
":",
"data",
"=",
"lexer",
".",
"Backup",
"(",
")",
"preprocessRule",
"(",
"lexer",
",",
"contextStack",
")",... | https://github.com/DLR-SC/tigl/blob/d1c5901e948e33d10b1f9659ff3e22c4717b455f/thirdparty/nsiqcppstyle/nsiqcppstyle_rulemanager.py#L94-L99 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/docview.py | python | DocTemplate.CreateDocument | (self, path, flags) | Creates a new instance of the associated document class. If you have
not supplied a class to the template constructor, you will need to
override this function to return an appropriate document instance. | Creates a new instance of the associated document class. If you have
not supplied a class to the template constructor, you will need to
override this function to return an appropriate document instance. | [
"Creates",
"a",
"new",
"instance",
"of",
"the",
"associated",
"document",
"class",
".",
"If",
"you",
"have",
"not",
"supplied",
"a",
"class",
"to",
"the",
"template",
"constructor",
"you",
"will",
"need",
"to",
"override",
"this",
"function",
"to",
"return",... | def CreateDocument(self, path, flags):
"""
Creates a new instance of the associated document class. If you have
not supplied a class to the template constructor, you will need to
override this function to return an appropriate document instance.
"""
doc = self._docType()
... | [
"def",
"CreateDocument",
"(",
"self",
",",
"path",
",",
"flags",
")",
":",
"doc",
"=",
"self",
".",
"_docType",
"(",
")",
"doc",
".",
"SetFilename",
"(",
"path",
")",
"doc",
".",
"SetDocumentTemplate",
"(",
"self",
")",
"self",
".",
"GetDocumentManager",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/docview.py#L1245-L1261 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/VesuvioPeakPrediction.py | python | VesuvioPeakPrediction.displacement | (self, temp, debye_temp, atomic_mass) | return disp | temp: temperature in K
debye_temp: debye temperature in K
atomic_mass: atomic mass in AMU | temp: temperature in K
debye_temp: debye temperature in K
atomic_mass: atomic mass in AMU | [
"temp",
":",
"temperature",
"in",
"K",
"debye_temp",
":",
"debye",
"temperature",
"in",
"K",
"atomic_mass",
":",
"atomic",
"mass",
"in",
"AMU"
] | def displacement(self, temp, debye_temp, atomic_mass):
"""
temp: temperature in K
debye_temp: debye temperature in K
atomic_mass: atomic mass in AMU
"""
n = 1000
y = np.empty(n + 1, float)
debye_energy = debye_temp / K_IN_MEV
temp /= K_IN_MEV
... | [
"def",
"displacement",
"(",
"self",
",",
"temp",
",",
"debye_temp",
",",
"atomic_mass",
")",
":",
"n",
"=",
"1000",
"y",
"=",
"np",
".",
"empty",
"(",
"n",
"+",
"1",
",",
"float",
")",
"debye_energy",
"=",
"debye_temp",
"/",
"K_IN_MEV",
"temp",
"/=",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/VesuvioPeakPrediction.py#L146-L165 | |
seqan/seqan | f5f658343c366c9c3d44ba358ffc9317e78a09ed | util/py_lib/seqan/dddoc/main.py | python | DDDocRunner.__init__ | (self, index_only=False, doc_dirs=[], out_dir='html',
demos_dir='.', cache_only=False, include_dirs=[]) | Initialize, arguments correspond to attributes. | Initialize, arguments correspond to attributes. | [
"Initialize",
"arguments",
"correspond",
"to",
"attributes",
"."
] | def __init__(self, index_only=False, doc_dirs=[], out_dir='html',
demos_dir='.', cache_only=False, include_dirs=[]):
"""Initialize, arguments correspond to attributes."""
self.index_only = index_only
self.doc_dirs = doc_dirs
self.out_dir = out_dir
self.demos_dir ... | [
"def",
"__init__",
"(",
"self",
",",
"index_only",
"=",
"False",
",",
"doc_dirs",
"=",
"[",
"]",
",",
"out_dir",
"=",
"'html'",
",",
"demos_dir",
"=",
"'.'",
",",
"cache_only",
"=",
"False",
",",
"include_dirs",
"=",
"[",
"]",
")",
":",
"self",
".",
... | https://github.com/seqan/seqan/blob/f5f658343c366c9c3d44ba358ffc9317e78a09ed/util/py_lib/seqan/dddoc/main.py#L35-L43 | ||
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/distlib/_backport/tarfile.py | python | TarInfo._proc_member | (self, tarfile) | Choose the right processing method depending on
the type and call it. | Choose the right processing method depending on
the type and call it. | [
"Choose",
"the",
"right",
"processing",
"method",
"depending",
"on",
"the",
"type",
"and",
"call",
"it",
"."
] | def _proc_member(self, tarfile):
"""Choose the right processing method depending on
the type and call it.
"""
if self.type in (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK):
return self._proc_gnulong(tarfile)
elif self.type == GNUTYPE_SPARSE:
return self._proc_sp... | [
"def",
"_proc_member",
"(",
"self",
",",
"tarfile",
")",
":",
"if",
"self",
".",
"type",
"in",
"(",
"GNUTYPE_LONGNAME",
",",
"GNUTYPE_LONGLINK",
")",
":",
"return",
"self",
".",
"_proc_gnulong",
"(",
"tarfile",
")",
"elif",
"self",
".",
"type",
"==",
"GN... | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/distlib/_backport/tarfile.py#L1303-L1314 | ||
CaoWGG/TensorRT-CenterNet | f949252e37b51e60f873808f46d3683f15735e79 | onnx-tensorrt/third_party/onnx/third_party/benchmark/mingw.py | python | download | (url, location, log = EmptyLogger()) | return possible | Downloads and unpacks a mingw-builds archive | Downloads and unpacks a mingw-builds archive | [
"Downloads",
"and",
"unpacks",
"a",
"mingw",
"-",
"builds",
"archive"
] | def download(url, location, log = EmptyLogger()):
'''
Downloads and unpacks a mingw-builds archive
'''
log.info('downloading MinGW')
log.debug(' - url: %s', url)
log.debug(' - location: %s', location)
re_content = re.compile(r'attachment;[ \t]*filename=(")?([^"]*)(")?[\r\n]*')
stream =... | [
"def",
"download",
"(",
"url",
",",
"location",
",",
"log",
"=",
"EmptyLogger",
"(",
")",
")",
":",
"log",
".",
"info",
"(",
"'downloading MinGW'",
")",
"log",
".",
"debug",
"(",
"' - url: %s'",
",",
"url",
")",
"log",
".",
"debug",
"(",
"' - location:... | https://github.com/CaoWGG/TensorRT-CenterNet/blob/f949252e37b51e60f873808f46d3683f15735e79/onnx-tensorrt/third_party/onnx/third_party/benchmark/mingw.py#L125-L170 | |
fatih/subvim | 241b6d170597857105da219c9b7d36059e9f11fb | vim/base/YouCompleteMe/third_party/jedi/jedi/evaluate_representation.py | python | Execution.get_params | (self) | return result | This returns the params for an Execution/Instance and is injected as a
'hack' into the pr.Function class.
This needs to be here, because Instance can have __init__ functions,
which act the same way as normal functions. | This returns the params for an Execution/Instance and is injected as a
'hack' into the pr.Function class.
This needs to be here, because Instance can have __init__ functions,
which act the same way as normal functions. | [
"This",
"returns",
"the",
"params",
"for",
"an",
"Execution",
"/",
"Instance",
"and",
"is",
"injected",
"as",
"a",
"hack",
"into",
"the",
"pr",
".",
"Function",
"class",
".",
"This",
"needs",
"to",
"be",
"here",
"because",
"Instance",
"can",
"have",
"__i... | def get_params(self):
"""
This returns the params for an Execution/Instance and is injected as a
'hack' into the pr.Function class.
This needs to be here, because Instance can have __init__ functions,
which act the same way as normal functions.
"""
def gen_param_n... | [
"def",
"get_params",
"(",
"self",
")",
":",
"def",
"gen_param_name_copy",
"(",
"param",
",",
"keys",
"=",
"(",
")",
",",
"values",
"=",
"(",
")",
",",
"array_type",
"=",
"None",
")",
":",
"\"\"\"\n Create a param with the original scope (of varargs) as ... | https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/jedi/jedi/evaluate_representation.py#L515-L642 | |
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/support.py | python | apply_tag_try_node_name | (dad, iter_start, iter_end) | return False | Apply Link to Node Tag if the text is a node name | Apply Link to Node Tag if the text is a node name | [
"Apply",
"Link",
"to",
"Node",
"Tag",
"if",
"the",
"text",
"is",
"a",
"node",
"name"
] | def apply_tag_try_node_name(dad, iter_start, iter_end):
"""Apply Link to Node Tag if the text is a node name"""
node_name = dad.curr_buffer.get_text(iter_start, iter_end)
node_dest = dad.get_tree_iter_from_node_name(node_name)
if node_dest:
dad.curr_buffer.select_range(iter_start, iter_end)
... | [
"def",
"apply_tag_try_node_name",
"(",
"dad",
",",
"iter_start",
",",
"iter_end",
")",
":",
"node_name",
"=",
"dad",
".",
"curr_buffer",
".",
"get_text",
"(",
"iter_start",
",",
"iter_end",
")",
"node_dest",
"=",
"dad",
".",
"get_tree_iter_from_node_name",
"(",
... | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/support.py#L94-L103 | |
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPMS_ID_OBJECT.toTpm | (self, buf) | TpmMarshaller method | TpmMarshaller method | [
"TpmMarshaller",
"method"
] | def toTpm(self, buf):
""" TpmMarshaller method """
buf.writeSizedByteBuf(self.integrityHMAC)
buf.writeByteBuf(self.encIdentity) | [
"def",
"toTpm",
"(",
"self",
",",
"buf",
")",
":",
"buf",
".",
"writeSizedByteBuf",
"(",
"self",
".",
"integrityHMAC",
")",
"buf",
".",
"writeByteBuf",
"(",
"self",
".",
"encIdentity",
")"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L8537-L8540 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/sysconfig.py | python | _parse_makefile | (filename, vars=None) | return vars | Parse a Makefile-style file.
A dictionary containing name/value pairs is returned. If an
optional dictionary is passed in as the second argument, it is
used instead of a new dictionary. | Parse a Makefile-style file. | [
"Parse",
"a",
"Makefile",
"-",
"style",
"file",
"."
] | def _parse_makefile(filename, vars=None):
"""Parse a Makefile-style file.
A dictionary containing name/value pairs is returned. If an
optional dictionary is passed in as the second argument, it is
used instead of a new dictionary.
"""
import re
# Regexes needed for parsing Makefile (and si... | [
"def",
"_parse_makefile",
"(",
"filename",
",",
"vars",
"=",
"None",
")",
":",
"import",
"re",
"# Regexes needed for parsing Makefile (and similar syntaxes,",
"# like old-style Setup files).",
"_variable_rx",
"=",
"re",
".",
"compile",
"(",
"\"([a-zA-Z][a-zA-Z0-9_]+)\\s*=\\s*... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/sysconfig.py#L195-L278 | |
syoyo/tinygltf | e7f1ff5c59d3ca2489923beb239bdf93d863498f | deps/cpplint.py | python | _DropCommonSuffixes | (filename) | return os.path.splitext(filename)[0] | Drops common suffixes like _test.cc or -inl.h from filename.
For example:
>>> _DropCommonSuffixes('foo/foo-inl.h')
'foo/foo'
>>> _DropCommonSuffixes('foo/bar/foo.cc')
'foo/bar/foo'
>>> _DropCommonSuffixes('foo/foo_internal.h')
'foo/foo'
>>> _DropCommonSuffixes('foo/foo_unusualinternal.h')... | Drops common suffixes like _test.cc or -inl.h from filename. | [
"Drops",
"common",
"suffixes",
"like",
"_test",
".",
"cc",
"or",
"-",
"inl",
".",
"h",
"from",
"filename",
"."
] | def _DropCommonSuffixes(filename):
"""Drops common suffixes like _test.cc or -inl.h from filename.
For example:
>>> _DropCommonSuffixes('foo/foo-inl.h')
'foo/foo'
>>> _DropCommonSuffixes('foo/bar/foo.cc')
'foo/bar/foo'
>>> _DropCommonSuffixes('foo/foo_internal.h')
'foo/foo'
>>> _DropCom... | [
"def",
"_DropCommonSuffixes",
"(",
"filename",
")",
":",
"for",
"suffix",
"in",
"(",
"'test.cc'",
",",
"'regtest.cc'",
",",
"'unittest.cc'",
",",
"'inl.h'",
",",
"'impl.h'",
",",
"'internal.h'",
")",
":",
"if",
"(",
"filename",
".",
"endswith",
"(",
"suffix"... | https://github.com/syoyo/tinygltf/blob/e7f1ff5c59d3ca2489923beb239bdf93d863498f/deps/cpplint.py#L4501-L4525 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/ctc_ops.py | python | _scan | (fn, elems, initial, reverse=False, inclusive=False, final_only=False) | return pack(out) | Repeatedly applies callable `fn` to a sequence of elements.
Implemented by functional_ops.While, tpu friendly, no gradient.
This is similar to functional_ops.scan but significantly faster on tpu/gpu
for the forward backward use case.
Examples:
scan(lambda a, e: a + e, [1.0, 2.0, 3.0], 1.0) => [2.0, 4.0, ... | Repeatedly applies callable `fn` to a sequence of elements. | [
"Repeatedly",
"applies",
"callable",
"fn",
"to",
"a",
"sequence",
"of",
"elements",
"."
] | def _scan(fn, elems, initial, reverse=False, inclusive=False, final_only=False):
"""Repeatedly applies callable `fn` to a sequence of elements.
Implemented by functional_ops.While, tpu friendly, no gradient.
This is similar to functional_ops.scan but significantly faster on tpu/gpu
for the forward backward us... | [
"def",
"_scan",
"(",
"fn",
",",
"elems",
",",
"initial",
",",
"reverse",
"=",
"False",
",",
"inclusive",
"=",
"False",
",",
"final_only",
"=",
"False",
")",
":",
"flat_elems",
"=",
"[",
"ops",
".",
"convert_to_tensor",
"(",
"x",
")",
"for",
"x",
"in"... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/ctc_ops.py#L1369-L1479 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/bitstring/bitstring.py | python | Bits._readsie | (self, pos) | Return interpretation of next bits as a signed interleaved exponential-Golomb code.
Advances position to after the read code.
Raises ReadError if the end of the bitstring is encountered while
reading the code. | Return interpretation of next bits as a signed interleaved exponential-Golomb code. | [
"Return",
"interpretation",
"of",
"next",
"bits",
"as",
"a",
"signed",
"interleaved",
"exponential",
"-",
"Golomb",
"code",
"."
] | def _readsie(self, pos):
"""Return interpretation of next bits as a signed interleaved exponential-Golomb code.
Advances position to after the read code.
Raises ReadError if the end of the bitstring is encountered while
reading the code.
"""
codenum, pos = self._readui... | [
"def",
"_readsie",
"(",
"self",
",",
"pos",
")",
":",
"codenum",
",",
"pos",
"=",
"self",
".",
"_readuie",
"(",
"pos",
")",
"if",
"not",
"codenum",
":",
"return",
"0",
",",
"pos",
"try",
":",
"if",
"self",
"[",
"pos",
"]",
":",
"return",
"-",
"... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/bitstring/bitstring.py#L1780-L1798 | ||
tfwu/FaceDetection-ConvNet-3D | f9251c48eb40c5aec8fba7455115c355466555be | python/mxnet/executor.py | python | Executor.set_monitor_callback | (self, callback) | Install callback.
Parameters
----------
callback : function
Takes a string and an NDArrayHandle. | Install callback. | [
"Install",
"callback",
"."
] | def set_monitor_callback(self, callback):
"""Install callback.
Parameters
----------
callback : function
Takes a string and an NDArrayHandle.
"""
cb_type = ctypes.CFUNCTYPE(None, ctypes.c_char_p, NDArrayHandle, ctypes.c_void_p)
self._monitor_callback ... | [
"def",
"set_monitor_callback",
"(",
"self",
",",
"callback",
")",
":",
"cb_type",
"=",
"ctypes",
".",
"CFUNCTYPE",
"(",
"None",
",",
"ctypes",
".",
"c_char_p",
",",
"NDArrayHandle",
",",
"ctypes",
".",
"c_void_p",
")",
"self",
".",
"_monitor_callback",
"=",
... | https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/python/mxnet/executor.py#L139-L152 | ||
liuheng92/tensorflow_PSENet | e2cd908f301b762150aa36893677c1c51c98ff9e | nets/resnet/resnet_utils.py | python | stack_blocks_dense | (net, blocks, output_stride=None,
outputs_collections=None) | return net | Stacks ResNet `Blocks` and controls output feature density.
First, this function creates scopes for the ResNet in the form of
'block_name/unit_1', 'block_name/unit_2', etc.
Second, this function allows the user to explicitly control the ResNet
output_stride, which is the ratio of the input to output s... | Stacks ResNet `Blocks` and controls output feature density. | [
"Stacks",
"ResNet",
"Blocks",
"and",
"controls",
"output",
"feature",
"density",
"."
] | def stack_blocks_dense(net, blocks, output_stride=None,
outputs_collections=None):
"""Stacks ResNet `Blocks` and controls output feature density.
First, this function creates scopes for the ResNet in the form of
'block_name/unit_1', 'block_name/unit_2', etc.
Second, this functio... | [
"def",
"stack_blocks_dense",
"(",
"net",
",",
"blocks",
",",
"output_stride",
"=",
"None",
",",
"outputs_collections",
"=",
"None",
")",
":",
"# The current_stride variable keeps track of the effective stride of the",
"# activations. This allows us to invoke atrous convolution when... | https://github.com/liuheng92/tensorflow_PSENet/blob/e2cd908f301b762150aa36893677c1c51c98ff9e/nets/resnet/resnet_utils.py#L126-L206 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/model/multipath.py | python | _prettify | (elem,indent_level=0) | return res | Return a pretty-printed XML string for the Element. | Return a pretty-printed XML string for the Element. | [
"Return",
"a",
"pretty",
"-",
"printed",
"XML",
"string",
"for",
"the",
"Element",
"."
] | def _prettify(elem,indent_level=0):
"""Return a pretty-printed XML string for the Element.
"""
indent = " "
res = indent_level*indent + '<'+elem.tag.encode('utf-8')
for k in elem.iterkeys():
res += " "+k.encode('utf-8')+'="'+_escape_nl(elem.get(k)).encode('utf-8')+'"'
children = elem.g... | [
"def",
"_prettify",
"(",
"elem",
",",
"indent_level",
"=",
"0",
")",
":",
"indent",
"=",
"\" \"",
"res",
"=",
"indent_level",
"*",
"indent",
"+",
"'<'",
"+",
"elem",
".",
"tag",
".",
"encode",
"(",
"'utf-8'",
")",
"for",
"k",
"in",
"elem",
".",
"i... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/model/multipath.py#L467-L487 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/catkin_pkg/package.py | python | Package.__init__ | (self, filename=None, **kwargs) | :param filename: location of package.xml. Necessary if
converting ``${prefix}`` in ``<export>`` values, ``str``. | :param filename: location of package.xml. Necessary if
converting ``${prefix}`` in ``<export>`` values, ``str``. | [
":",
"param",
"filename",
":",
"location",
"of",
"package",
".",
"xml",
".",
"Necessary",
"if",
"converting",
"$",
"{",
"prefix",
"}",
"in",
"<export",
">",
"values",
"str",
"."
] | def __init__(self, filename=None, **kwargs):
"""
:param filename: location of package.xml. Necessary if
converting ``${prefix}`` in ``<export>`` values, ``str``.
"""
# initialize all slots ending with "s" with lists, all other with plain values
for attr in self.__slots... | [
"def",
"__init__",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# initialize all slots ending with \"s\" with lists, all other with plain values",
"for",
"attr",
"in",
"self",
".",
"__slots__",
":",
"if",
"attr",
".",
"endswith",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/catkin_pkg/package.py#L76-L105 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/combotreebox.py | python | BaseComboTreeBox.NotifyItemSelected | (self, text) | Simulate selection of an item by the user. This is meant to
be called by the PopupFrame when the user selects an item. | Simulate selection of an item by the user. This is meant to
be called by the PopupFrame when the user selects an item. | [
"Simulate",
"selection",
"of",
"an",
"item",
"by",
"the",
"user",
".",
"This",
"is",
"meant",
"to",
"be",
"called",
"by",
"the",
"PopupFrame",
"when",
"the",
"user",
"selects",
"an",
"item",
"."
] | def NotifyItemSelected(self, text):
"""
Simulate selection of an item by the user. This is meant to
be called by the PopupFrame when the user selects an item.
"""
self._text.SetValue(text)
self._postComboBoxSelectedEvent(text)
self.SetFocus() | [
"def",
"NotifyItemSelected",
"(",
"self",
",",
"text",
")",
":",
"self",
".",
"_text",
".",
"SetValue",
"(",
"text",
")",
"self",
".",
"_postComboBoxSelectedEvent",
"(",
"text",
")",
"self",
".",
"SetFocus",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/combotreebox.py#L418-L425 | ||
microsoft/DirectXShaderCompiler | 8348ff8d9e0287610ba05d3a828e10af981a1c05 | utils/hct/hctdb.py | python | db_dxil.build_indices | (self) | Build a name_idx dictionary with instructions and an enum_idx dictionary with enumeration types | Build a name_idx dictionary with instructions and an enum_idx dictionary with enumeration types | [
"Build",
"a",
"name_idx",
"dictionary",
"with",
"instructions",
"and",
"an",
"enum_idx",
"dictionary",
"with",
"enumeration",
"types"
] | def build_indices(self):
"Build a name_idx dictionary with instructions and an enum_idx dictionary with enumeration types"
self.name_idx = {}
for i in self.instr:
self.name_idx[i.name] = i
self.enum_idx = {}
for i in self.enums:
self.enum_idx[i.name] = i | [
"def",
"build_indices",
"(",
"self",
")",
":",
"self",
".",
"name_idx",
"=",
"{",
"}",
"for",
"i",
"in",
"self",
".",
"instr",
":",
"self",
".",
"name_idx",
"[",
"i",
".",
"name",
"]",
"=",
"i",
"self",
".",
"enum_idx",
"=",
"{",
"}",
"for",
"i... | https://github.com/microsoft/DirectXShaderCompiler/blob/8348ff8d9e0287610ba05d3a828e10af981a1c05/utils/hct/hctdb.py#L203-L210 | ||
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/viewer/mpl/modelview.py | python | draw1dmodelLU | (x, xL, xU, thk=None, **kwargs) | Draw 1d model with lower and upper bounds. | Draw 1d model with lower and upper bounds. | [
"Draw",
"1d",
"model",
"with",
"lower",
"and",
"upper",
"bounds",
"."
] | def draw1dmodelLU(x, xL, xU, thk=None, **kwargs):
"""Draw 1d model with lower and upper bounds."""
raise BaseException("IMPLEMENTME") | [
"def",
"draw1dmodelLU",
"(",
"x",
",",
"xL",
",",
"xU",
",",
"thk",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"BaseException",
"(",
"\"IMPLEMENTME\"",
")"
] | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/viewer/mpl/modelview.py#L213-L215 | ||
chromiumembedded/cef | 80caf947f3fe2210e5344713c5281d8af9bdc295 | tools/gn_args.py | python | GetChromiumDefaultArgs | () | return defaults | Return default GN args. These must match the Chromium defaults.
Only args that may be retrieved via GetArgValue() need to be specified here. | Return default GN args. These must match the Chromium defaults.
Only args that may be retrieved via GetArgValue() need to be specified here. | [
"Return",
"default",
"GN",
"args",
".",
"These",
"must",
"match",
"the",
"Chromium",
"defaults",
".",
"Only",
"args",
"that",
"may",
"be",
"retrieved",
"via",
"GetArgValue",
"()",
"need",
"to",
"be",
"specified",
"here",
"."
] | def GetChromiumDefaultArgs():
"""
Return default GN args. These must match the Chromium defaults.
Only args that may be retrieved via GetArgValue() need to be specified here.
"""
# Search for these values in declare_args() sections of *.gni files to find
# the defaults.
defaults = {
'dcheck_always_... | [
"def",
"GetChromiumDefaultArgs",
"(",
")",
":",
"# Search for these values in declare_args() sections of *.gni files to find",
"# the defaults.",
"defaults",
"=",
"{",
"'dcheck_always_on'",
":",
"False",
",",
"'is_asan'",
":",
"False",
",",
"'is_debug'",
":",
"True",
",",
... | https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/gn_args.py#L161-L187 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/keras/_impl/keras/initializers.py | python | glorot_uniform | (seed=None) | return VarianceScaling(
scale=1., mode='fan_avg', distribution='uniform', seed=seed) | Glorot uniform initializer, also called Xavier uniform initializer.
It draws samples from a uniform distribution within [-limit, limit]
where `limit` is `sqrt(6 / (fan_in + fan_out))`
where `fan_in` is the number of input units in the weight tensor
and `fan_out` is the number of output units in the weight tens... | Glorot uniform initializer, also called Xavier uniform initializer. | [
"Glorot",
"uniform",
"initializer",
"also",
"called",
"Xavier",
"uniform",
"initializer",
"."
] | def glorot_uniform(seed=None):
"""Glorot uniform initializer, also called Xavier uniform initializer.
It draws samples from a uniform distribution within [-limit, limit]
where `limit` is `sqrt(6 / (fan_in + fan_out))`
where `fan_in` is the number of input units in the weight tensor
and `fan_out` is the numbe... | [
"def",
"glorot_uniform",
"(",
"seed",
"=",
"None",
")",
":",
"return",
"VarianceScaling",
"(",
"scale",
"=",
"1.",
",",
"mode",
"=",
"'fan_avg'",
",",
"distribution",
"=",
"'uniform'",
",",
"seed",
"=",
"seed",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/keras/_impl/keras/initializers.py#L102-L121 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/compiler/transformer.py | python | Transformer.parseexpr | (self, text) | return self.transform(parser.expr(text)) | Return a modified parse tree for the given expression text. | Return a modified parse tree for the given expression text. | [
"Return",
"a",
"modified",
"parse",
"tree",
"for",
"the",
"given",
"expression",
"text",
"."
] | def parseexpr(self, text):
"""Return a modified parse tree for the given expression text."""
return self.transform(parser.expr(text)) | [
"def",
"parseexpr",
"(",
"self",
",",
"text",
")",
":",
"return",
"self",
".",
"transform",
"(",
"parser",
".",
"expr",
"(",
"text",
")",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/compiler/transformer.py#L130-L132 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/pdfviewer/viewer.py | python | pypdfProcessor.InsertXObject | (self, name) | return dlist | XObject can be an image or a 'form' (an arbitrary PDF sequence) | XObject can be an image or a 'form' (an arbitrary PDF sequence) | [
"XObject",
"can",
"be",
"an",
"image",
"or",
"a",
"form",
"(",
"an",
"arbitrary",
"PDF",
"sequence",
")"
] | def InsertXObject(self, name):
" XObject can be an image or a 'form' (an arbitrary PDF sequence) "
dlist = []
xobject = self.page["/Resources"].getObject()['/XObject']
stream = xobject[name]
if stream.get('/Subtype') == '/Form':
# insert contents into current page dra... | [
"def",
"InsertXObject",
"(",
"self",
",",
"name",
")",
":",
"dlist",
"=",
"[",
"]",
"xobject",
"=",
"self",
".",
"page",
"[",
"\"/Resources\"",
"]",
".",
"getObject",
"(",
")",
"[",
"'/XObject'",
"]",
"stream",
"=",
"xobject",
"[",
"name",
"]",
"if",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/pdfviewer/viewer.py#L861-L886 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/cpplint.py | python | PathSplitToList | (path) | return lst | Returns the path split into a list by the separator.
Args:
path: An absolute or relative path (e.g. '/a/b/c/' or '../a')
Returns:
A list of path components (e.g. ['a', 'b', 'c]). | Returns the path split into a list by the separator. | [
"Returns",
"the",
"path",
"split",
"into",
"a",
"list",
"by",
"the",
"separator",
"."
] | def PathSplitToList(path):
"""Returns the path split into a list by the separator.
Args:
path: An absolute or relative path (e.g. '/a/b/c/' or '../a')
Returns:
A list of path components (e.g. ['a', 'b', 'c]).
"""
lst = []
while True:
(head, tail) = os.path.split(path)
if head == path: # a... | [
"def",
"PathSplitToList",
"(",
"path",
")",
":",
"lst",
"=",
"[",
"]",
"while",
"True",
":",
"(",
"head",
",",
"tail",
")",
"=",
"os",
".",
"path",
".",
"split",
"(",
"path",
")",
"if",
"head",
"==",
"path",
":",
"# absolute paths end",
"lst",
".",... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/cpplint.py#L2274-L2297 | |
15172658790/Blog | 46e5036f5fbcad535af2255dc0e095cebcd8d710 | 数学类/计算方法/code/numerical_integration/numerical_integration.py | python | trapezoidal | (a,b,h,fs) | return ret | 梯形积分公式 | 梯形积分公式 | [
"梯形积分公式"
] | def trapezoidal(a,b,h,fs):
'''梯形积分公式'''
xs = [i for i in np.arange(a,b+h,h)]
print('x'.ljust(10),end='')
mypprint(xs)
print('fx'.ljust(10),end='')
mypprint(fs)
ret = h*(sum(fs)-fs[0]/2 - fs[-1]/2)
print(ret)
return ret | [
"def",
"trapezoidal",
"(",
"a",
",",
"b",
",",
"h",
",",
"fs",
")",
":",
"xs",
"=",
"[",
"i",
"for",
"i",
"in",
"np",
".",
"arange",
"(",
"a",
",",
"b",
"+",
"h",
",",
"h",
")",
"]",
"print",
"(",
"'x'",
".",
"ljust",
"(",
"10",
")",
",... | https://github.com/15172658790/Blog/blob/46e5036f5fbcad535af2255dc0e095cebcd8d710/数学类/计算方法/code/numerical_integration/numerical_integration.py#L23-L32 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Source/ThirdParty/CEF3/pristine/cef_source/tools/cef_parser.py | python | obj_header.get_capi_translations | (self) | return map | Return a dictionary that maps C++ terminology to C API terminology. | Return a dictionary that maps C++ terminology to C API terminology. | [
"Return",
"a",
"dictionary",
"that",
"maps",
"C",
"++",
"terminology",
"to",
"C",
"API",
"terminology",
"."
] | def get_capi_translations(self):
""" Return a dictionary that maps C++ terminology to C API terminology.
"""
# strings that will be changed in C++ comments
map = {
'class' : 'structure',
'Class' : 'Structure',
'interface' : 'structure',
'In... | [
"def",
"get_capi_translations",
"(",
"self",
")",
":",
"# strings that will be changed in C++ comments",
"map",
"=",
"{",
"'class'",
":",
"'structure'",
",",
"'Class'",
":",
"'Structure'",
",",
"'interface'",
":",
"'structure'",
",",
"'Interface'",
":",
"'Structure'",... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Source/ThirdParty/CEF3/pristine/cef_source/tools/cef_parser.py#L720-L752 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/win32com/util.py | python | IIDToInterfaceName | (iid) | Converts an IID to a string interface name.
Used primarily for debugging purposes, this allows a cryptic IID to
be converted to a useful string name. This will firstly look for interfaces
known (ie, registered) by pythoncom. If not known, it will look in the
registry for a registered interface.
iid -- An II... | Converts an IID to a string interface name.
Used primarily for debugging purposes, this allows a cryptic IID to
be converted to a useful string name. This will firstly look for interfaces
known (ie, registered) by pythoncom. If not known, it will look in the
registry for a registered interface. | [
"Converts",
"an",
"IID",
"to",
"a",
"string",
"interface",
"name",
".",
"Used",
"primarily",
"for",
"debugging",
"purposes",
"this",
"allows",
"a",
"cryptic",
"IID",
"to",
"be",
"converted",
"to",
"a",
"useful",
"string",
"name",
".",
"This",
"will",
"firs... | def IIDToInterfaceName(iid):
"""Converts an IID to a string interface name.
Used primarily for debugging purposes, this allows a cryptic IID to
be converted to a useful string name. This will firstly look for interfaces
known (ie, registered) by pythoncom. If not known, it will look in the
registry for a reg... | [
"def",
"IIDToInterfaceName",
"(",
"iid",
")",
":",
"try",
":",
"return",
"pythoncom",
".",
"ServerInterfaces",
"[",
"iid",
"]",
"except",
"KeyError",
":",
"try",
":",
"try",
":",
"return",
"win32api",
".",
"RegQueryValue",
"(",
"win32con",
".",
"HKEY_CLASSES... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/win32com/util.py#L8-L30 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/printimpl.py | python | print_item_impl | (context, builder, sig, args) | return impl_ret_untracked(context, builder, sig.return_type, res) | Print a single constant value. | Print a single constant value. | [
"Print",
"a",
"single",
"constant",
"value",
"."
] | def print_item_impl(context, builder, sig, args):
"""
Print a single constant value.
"""
ty, = sig.args
val = ty.literal_value
pyapi = context.get_python_api(builder)
strobj = pyapi.unserialize(pyapi.serialize_object(val))
pyapi.print_object(strobj)
pyapi.decref(strobj)
res = ... | [
"def",
"print_item_impl",
"(",
"context",
",",
"builder",
",",
"sig",
",",
"args",
")",
":",
"ty",
",",
"=",
"sig",
".",
"args",
"val",
"=",
"ty",
".",
"literal_value",
"pyapi",
"=",
"context",
".",
"get_python_api",
"(",
"builder",
")",
"strobj",
"=",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/printimpl.py#L18-L32 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/mox3/mox3/mox.py | python | MockObject.__contains__ | (self, key) | return self._CreateMockMethod('__contains__')(key) | Provide custom logic for mocking classes that contain items.
Args:
key: Key to look in container for.
Returns:
Expected return value in replay mode. A MockMethod object for the
__contains__ method that has already been called if not in replay
mode.
... | Provide custom logic for mocking classes that contain items. | [
"Provide",
"custom",
"logic",
"for",
"mocking",
"classes",
"that",
"contain",
"items",
"."
] | def __contains__(self, key):
"""Provide custom logic for mocking classes that contain items.
Args:
key: Key to look in container for.
Returns:
Expected return value in replay mode. A MockMethod object for the
__contains__ method that has already been called ... | [
"def",
"__contains__",
"(",
"self",
",",
"key",
")",
":",
"contains",
"=",
"self",
".",
"_class_to_mock",
".",
"__dict__",
".",
"get",
"(",
"'__contains__'",
",",
"None",
")",
"if",
"contains",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"'unsubscriptabl... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/mox3/mox3/mox.py#L766-L792 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/exploitability.py | python | exploitability | (game, policy) | return nash_conv_value / game.num_players() | Returns the exploitability of the policy in the game.
This is implemented only for 2 players constant-sum games, and is equivalent
to NashConv / num_players in that case. Prefer using `nash_conv`.
Args:
game: An open_spiel game, e.g. kuhn_poker
policy: A `policy.Policy` object. This policy should depend... | Returns the exploitability of the policy in the game. | [
"Returns",
"the",
"exploitability",
"of",
"the",
"policy",
"in",
"the",
"game",
"."
] | def exploitability(game, policy):
"""Returns the exploitability of the policy in the game.
This is implemented only for 2 players constant-sum games, and is equivalent
to NashConv / num_players in that case. Prefer using `nash_conv`.
Args:
game: An open_spiel game, e.g. kuhn_poker
policy: A `policy.Po... | [
"def",
"exploitability",
"(",
"game",
",",
"policy",
")",
":",
"if",
"game",
".",
"num_players",
"(",
")",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"\"Game must be a 2-player game\"",
")",
"game_info",
"=",
"game",
".",
"get_type",
"(",
")",
"if",
"game... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/exploitability.py#L114-L151 | |
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/pipeline/pipeline_base.py | python | PipelineBase.add_egg_file | (self, file_path) | 向Pipeline添加一个egg文件,使得该文件会在运行期自动被添加到PYTHONPATH中
Args:
file_path (str): egg文件路径 | 向Pipeline添加一个egg文件,使得该文件会在运行期自动被添加到PYTHONPATH中 | [
"向Pipeline添加一个egg文件,使得该文件会在运行期自动被添加到PYTHONPATH中"
] | def add_egg_file(self, file_path):
"""
向Pipeline添加一个egg文件,使得该文件会在运行期自动被添加到PYTHONPATH中
Args:
file_path (str): egg文件路径
"""
self._resource.add_egg_file(file_path) | [
"def",
"add_egg_file",
"(",
"self",
",",
"file_path",
")",
":",
"self",
".",
"_resource",
".",
"add_egg_file",
"(",
"file_path",
")"
] | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/pipeline/pipeline_base.py#L137-L144 | ||
scummvm/scummvm | 9c039d027e7ffb9d83ae2e274147e2daf8d57ce2 | devtools/themeparser.py | python | STXBinaryFile.__parseDrawStepToBin | (self, stepDict) | return stepBin | /BBBBiiiiiBBB4s4s4s4s4sB/ ==
function (byte)
fill (byte)
stroke (byte)
gradient_factor (byte)
width (int32)
height (int32)
xpos (int32)
ypos (int32)
radius (int32)
bevel (byte)
shadow (byte)
orientation (byte)
file (byte)
fg_color (4 byte)
bg_color ... | /BBBBiiiiiBBB4s4s4s4s4sB/ ==
function (byte)
fill (byte)
stroke (byte)
gradient_factor (byte)
width (int32)
height (int32)
xpos (int32)
ypos (int32)
radius (int32)
bevel (byte)
shadow (byte)
orientation (byte)
file (byte)
fg_color (4 byte)
bg_color ... | [
"/",
"BBBBiiiiiBBB4s4s4s4s4sB",
"/",
"==",
"function",
"(",
"byte",
")",
"fill",
"(",
"byte",
")",
"stroke",
"(",
"byte",
")",
"gradient_factor",
"(",
"byte",
")",
"width",
"(",
"int32",
")",
"height",
"(",
"int32",
")",
"xpos",
"(",
"int32",
")",
"ypo... | def __parseDrawStepToBin(self, stepDict):
"""
/BBBBiiiiiBBB4s4s4s4s4sB/ ==
function (byte)
fill (byte)
stroke (byte)
gradient_factor (byte)
width (int32)
height (int32)
xpos (int32)
ypos (int32)
radius (int32)
bevel (byte)
shadow (byte)
orientation (byte)
... | [
"def",
"__parseDrawStepToBin",
"(",
"self",
",",
"stepDict",
")",
":",
"packLayout",
"=",
"\"\"",
"packData",
"=",
"[",
"]",
"for",
"ds",
"in",
"self",
".",
"DS_list",
":",
"layout",
"=",
"self",
".",
"DS_data",
"[",
"ds",
"]",
".",
"packFormat",
"data... | https://github.com/scummvm/scummvm/blob/9c039d027e7ffb9d83ae2e274147e2daf8d57ce2/devtools/themeparser.py#L216-L258 | |
cathywu/Sentiment-Analysis | eb501fd1375c0c3f3ab430f963255f1bb858e659 | PyML-0.7.9/PyML/utils/myio.py | python | csvreadArray | (fileName, type = 'float') | return dlmreadArray(fileName, ',', type) | read an array from a file in csv format into a numpy array | read an array from a file in csv format into a numpy array | [
"read",
"an",
"array",
"from",
"a",
"file",
"in",
"csv",
"format",
"into",
"a",
"numpy",
"array"
] | def csvreadArray(fileName, type = 'float') :
'''read an array from a file in csv format into a numpy array'''
return dlmreadArray(fileName, ',', type) | [
"def",
"csvreadArray",
"(",
"fileName",
",",
"type",
"=",
"'float'",
")",
":",
"return",
"dlmreadArray",
"(",
"fileName",
",",
"','",
",",
"type",
")"
] | https://github.com/cathywu/Sentiment-Analysis/blob/eb501fd1375c0c3f3ab430f963255f1bb858e659/PyML-0.7.9/PyML/utils/myio.py#L104-L107 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/multicall.py | python | expand_substates | (states) | return statelist | For each item of states return a list containing all combinations of
that item with individual bits reset, sorted by the number of set bits. | For each item of states return a list containing all combinations of
that item with individual bits reset, sorted by the number of set bits. | [
"For",
"each",
"item",
"of",
"states",
"return",
"a",
"list",
"containing",
"all",
"combinations",
"of",
"that",
"item",
"with",
"individual",
"bits",
"reset",
"sorted",
"by",
"the",
"number",
"of",
"set",
"bits",
"."
] | def expand_substates(states):
'''For each item of states return a list containing all combinations of
that item with individual bits reset, sorted by the number of set bits.
'''
def nbits(n):
"number of bits set in n base 2"
nb = 0
while n:
n, rem = divmod(n, 2)
... | [
"def",
"expand_substates",
"(",
"states",
")",
":",
"def",
"nbits",
"(",
"n",
")",
":",
"\"number of bits set in n base 2\"",
"nb",
"=",
"0",
"while",
"n",
":",
"n",
",",
"rem",
"=",
"divmod",
"(",
"n",
",",
"2",
")",
"nb",
"+=",
"rem",
"return",
"nb... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/multicall.py#L124-L140 | |
freeorion/freeorion | c266a40eccd3a99a17de8fe57c36ef6ba3771665 | default/python/AI/ShipDesignAI.py | python | ShipDesigner._combinatorial_filling | (self, available_parts) | return rating, partlist | Fill the design using a combinatorial approach.
This generic filling algorithm considers the problem of filling the slots as combinatorial problem.
We are interested in the best combination of parts without considering order.
In general, this yields (n+k-1) choose k possibilities in total per s... | Fill the design using a combinatorial approach. | [
"Fill",
"the",
"design",
"using",
"a",
"combinatorial",
"approach",
"."
] | def _combinatorial_filling(self, available_parts):
"""Fill the design using a combinatorial approach.
This generic filling algorithm considers the problem of filling the slots as combinatorial problem.
We are interested in the best combination of parts without considering order.
In gene... | [
"def",
"_combinatorial_filling",
"(",
"self",
",",
"available_parts",
")",
":",
"number_of_slots_by_slottype",
"=",
"Counter",
"(",
")",
"for",
"slot",
"in",
"self",
".",
"hull",
".",
"slots",
":",
"number_of_slots_by_slottype",
"[",
"slot",
"]",
"+=",
"1",
"p... | https://github.com/freeorion/freeorion/blob/c266a40eccd3a99a17de8fe57c36ef6ba3771665/default/python/AI/ShipDesignAI.py#L1204-L1309 | |
lammps/lammps | b75c3065430a75b1b5543a10e10f46d9b4c91913 | tools/i-pi/ipi/engine/normalmodes.py | python | NormalModes.get_kin | (self) | return self.kins.sum() | Gets the total MD kinetic energy.
Note that this does not correspond to the quantum kinetic energy estimate
for the system.
Returns:
The sum of the kinetic energy of each NM in the path. | Gets the total MD kinetic energy. | [
"Gets",
"the",
"total",
"MD",
"kinetic",
"energy",
"."
] | def get_kin(self):
"""Gets the total MD kinetic energy.
Note that this does not correspond to the quantum kinetic energy estimate
for the system.
Returns:
The sum of the kinetic energy of each NM in the path.
"""
return self.kins.sum() | [
"def",
"get_kin",
"(",
"self",
")",
":",
"return",
"self",
".",
"kins",
".",
"sum",
"(",
")"
] | https://github.com/lammps/lammps/blob/b75c3065430a75b1b5543a10e10f46d9b4c91913/tools/i-pi/ipi/engine/normalmodes.py#L363-L373 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/nn_ops.py | python | AdaptiveAvgPool2D.__init__ | (self, output_size) | Initialize AdaptiveAvgPool2D. | Initialize AdaptiveAvgPool2D. | [
"Initialize",
"AdaptiveAvgPool2D",
"."
] | def __init__(self, output_size):
"""Initialize AdaptiveAvgPool2D."""
validator.check_value_type("output_size", output_size, [int, tuple], self.name)
if isinstance(output_size, tuple):
validator.check_int(len(output_size), 2, Rel.EQ, 'length of output_size', self.name)
self.ou... | [
"def",
"__init__",
"(",
"self",
",",
"output_size",
")",
":",
"validator",
".",
"check_value_type",
"(",
"\"output_size\"",
",",
"output_size",
",",
"[",
"int",
",",
"tuple",
"]",
",",
"self",
".",
"name",
")",
"if",
"isinstance",
"(",
"output_size",
",",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/nn_ops.py#L266-L271 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/externals/joblib/memory.py | python | MemorizedFunc.call | (self, *args, **kwargs) | return output, metadata | Force the execution of the function with the given arguments and
persist the output values. | Force the execution of the function with the given arguments and
persist the output values. | [
"Force",
"the",
"execution",
"of",
"the",
"function",
"with",
"the",
"given",
"arguments",
"and",
"persist",
"the",
"output",
"values",
"."
] | def call(self, *args, **kwargs):
""" Force the execution of the function with the given arguments and
persist the output values.
"""
start_time = time.time()
output_dir, _ = self._get_output_dir(*args, **kwargs)
if self._verbose > 0:
print(format_call(self... | [
"def",
"call",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"output_dir",
",",
"_",
"=",
"self",
".",
"_get_output_dir",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"if",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/externals/joblib/memory.py#L667-L684 | |
scanner-research/scanner | 04a0c4b4196341995985acd729c0788aab823e1c | python/scannerpy/streams.py | python | StreamsGenerator.RepeatNull | (self,
input: scannerpy.op.OpColumn,
spacings) | return self._sc.ops.Space(
col=input,
extra={'type': 'RepeatNull',
'arg_builder': arg_builder,
'job_args': spacings}) | r"""Expands a sequence by inserting nulls.
Parameters
----------
input
The stream to expand.
spacing
Returns
-------
scannerpy.op.OpColumn
The sampled stream. | r"""Expands a sequence by inserting nulls. | [
"r",
"Expands",
"a",
"sequence",
"by",
"inserting",
"nulls",
"."
] | def RepeatNull(self,
input: scannerpy.op.OpColumn,
spacings) -> scannerpy.op.OpColumn:
r"""Expands a sequence by inserting nulls.
Parameters
----------
input
The stream to expand.
spacing
Returns
-------
s... | [
"def",
"RepeatNull",
"(",
"self",
",",
"input",
":",
"scannerpy",
".",
"op",
".",
"OpColumn",
",",
"spacings",
")",
"->",
"scannerpy",
".",
"op",
".",
"OpColumn",
":",
"def",
"arg_builder",
"(",
"spacing",
")",
":",
"args",
"=",
"protobufs",
".",
"Spac... | https://github.com/scanner-research/scanner/blob/04a0c4b4196341995985acd729c0788aab823e1c/python/scannerpy/streams.py#L320-L349 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TStrUtil_SplitSentences | (*args) | return _snap.TStrUtil_SplitSentences(*args) | TStrUtil_SplitSentences(TChA ChA, TVec< char * > & SentenceV) -> int
Parameters:
ChA: TChA &
SentenceV: TVec< char * > & | TStrUtil_SplitSentences(TChA ChA, TVec< char * > & SentenceV) -> int | [
"TStrUtil_SplitSentences",
"(",
"TChA",
"ChA",
"TVec<",
"char",
"*",
">",
"&",
"SentenceV",
")",
"-",
">",
"int"
] | def TStrUtil_SplitSentences(*args):
"""
TStrUtil_SplitSentences(TChA ChA, TVec< char * > & SentenceV) -> int
Parameters:
ChA: TChA &
SentenceV: TVec< char * > &
"""
return _snap.TStrUtil_SplitSentences(*args) | [
"def",
"TStrUtil_SplitSentences",
"(",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TStrUtil_SplitSentences",
"(",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L7434-L7443 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/coordinator/values.py | python | PerWorkerDatasetFromDatasetFunction.element_spec | (self) | return self._dataset_fn.structured_outputs.element_spec | The type specification of an element of this dataset.
This property is subject to change without notice. | The type specification of an element of this dataset. | [
"The",
"type",
"specification",
"of",
"an",
"element",
"of",
"this",
"dataset",
"."
] | def element_spec(self):
"""The type specification of an element of this dataset.
This property is subject to change without notice.
"""
if not isinstance(self._dataset_fn, tf_function.ConcreteFunction):
raise NotImplementedError(
"`element_spec` is not supported when the `dataset_fn` is... | [
"def",
"element_spec",
"(",
"self",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"_dataset_fn",
",",
"tf_function",
".",
"ConcreteFunction",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"`element_spec` is not supported when the `dataset_fn` is not \"",
"\"... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/coordinator/values.py#L371-L380 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/data/ops/dataset_ops.py | python | ParallelMapDataset.__init__ | (self,
input_dataset,
map_func,
num_parallel_calls,
use_inter_op_parallelism=True,
preserve_cardinality=False,
use_legacy_function=False) | See `Dataset.map()` for details. | See `Dataset.map()` for details. | [
"See",
"Dataset",
".",
"map",
"()",
"for",
"details",
"."
] | def __init__(self,
input_dataset,
map_func,
num_parallel_calls,
use_inter_op_parallelism=True,
preserve_cardinality=False,
use_legacy_function=False):
"""See `Dataset.map()` for details."""
self._input_dataset = input_data... | [
"def",
"__init__",
"(",
"self",
",",
"input_dataset",
",",
"map_func",
",",
"num_parallel_calls",
",",
"use_inter_op_parallelism",
"=",
"True",
",",
"preserve_cardinality",
"=",
"False",
",",
"use_legacy_function",
"=",
"False",
")",
":",
"self",
".",
"_input_data... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/data/ops/dataset_ops.py#L3458-L3484 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/kfac/python/ops/fisher_blocks.py | python | NaiveDiagonalFB.__init__ | (self, layer_collection, params, batch_size) | Creates a NaiveDiagonalFB block.
Args:
layer_collection: The collection of all layers in the K-FAC approximate
Fisher information matrix to which this FisherBlock belongs.
params: The parameters of this layer (Tensor or tuple of Tensors).
batch_size: The batch size, used in the covarian... | Creates a NaiveDiagonalFB block. | [
"Creates",
"a",
"NaiveDiagonalFB",
"block",
"."
] | def __init__(self, layer_collection, params, batch_size):
"""Creates a NaiveDiagonalFB block.
Args:
layer_collection: The collection of all layers in the K-FAC approximate
Fisher information matrix to which this FisherBlock belongs.
params: The parameters of this layer (Tensor or tuple of... | [
"def",
"__init__",
"(",
"self",
",",
"layer_collection",
",",
"params",
",",
"batch_size",
")",
":",
"self",
".",
"_params",
"=",
"params",
"self",
".",
"_batch_size",
"=",
"batch_size",
"super",
"(",
"NaiveDiagonalFB",
",",
"self",
")",
".",
"__init__",
"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/kfac/python/ops/fisher_blocks.py#L189-L201 | ||
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPMS_PCR_SELECTION.__init__ | (self, hash = TPM_ALG_ID.NULL, pcrSelect = None) | Table 94 Definition of TPMS_PCR_SELECTION Structure
Attributes:
hash (TPM_ALG_ID): The hash algorithm associated with the selection
pcrSelect (bytes): The bit map of selected PCR | Table 94 Definition of TPMS_PCR_SELECTION Structure | [
"Table",
"94",
"Definition",
"of",
"TPMS_PCR_SELECTION",
"Structure"
] | def __init__(self, hash = TPM_ALG_ID.NULL, pcrSelect = None):
""" Table 94 Definition of TPMS_PCR_SELECTION Structure
Attributes:
hash (TPM_ALG_ID): The hash algorithm associated with the selection
pcrSelect (bytes): The bit map of selected PCR
"""
self.hash = ha... | [
"def",
"__init__",
"(",
"self",
",",
"hash",
"=",
"TPM_ALG_ID",
".",
"NULL",
",",
"pcrSelect",
"=",
"None",
")",
":",
"self",
".",
"hash",
"=",
"hash",
"self",
".",
"pcrSelect",
"=",
"pcrSelect"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L4052-L4060 | ||
p4lang/PI | 38d87e81253feff9fff0660d662c885be78fb719 | tools/cpplint.py | python | _CppLintState.RestoreFilters | (self) | Restores filters previously backed up. | Restores filters previously backed up. | [
"Restores",
"filters",
"previously",
"backed",
"up",
"."
] | def RestoreFilters(self):
""" Restores filters previously backed up."""
self.filters = self._filters_backup[:] | [
"def",
"RestoreFilters",
"(",
"self",
")",
":",
"self",
".",
"filters",
"=",
"self",
".",
"_filters_backup",
"[",
":",
"]"
] | https://github.com/p4lang/PI/blob/38d87e81253feff9fff0660d662c885be78fb719/tools/cpplint.py#L1326-L1328 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/quant_ops.py | python | MovingAvgQuantize | (inputs,
min_var,
max_var,
per_channel=False,
ema_decay=0.999,
name_prefix='MovingAvgQuantize',
is_training=True,
num_bits=8,
narrow_range=False... | Adds a layer that collects quantization ranges as EMAs of input ranges.
MovingAvgQuantize creates variables called 'min' and 'max', representing the
interval used for quantization and clamping.
Args:
inputs: a tensor containing values to be quantized.
per_channel: (default False) a boolean specifying wh... | Adds a layer that collects quantization ranges as EMAs of input ranges. | [
"Adds",
"a",
"layer",
"that",
"collects",
"quantization",
"ranges",
"as",
"EMAs",
"of",
"input",
"ranges",
"."
] | def MovingAvgQuantize(inputs,
min_var,
max_var,
per_channel=False,
ema_decay=0.999,
name_prefix='MovingAvgQuantize',
is_training=True,
num_bits=8,
... | [
"def",
"MovingAvgQuantize",
"(",
"inputs",
",",
"min_var",
",",
"max_var",
",",
"per_channel",
"=",
"False",
",",
"ema_decay",
"=",
"0.999",
",",
"name_prefix",
"=",
"'MovingAvgQuantize'",
",",
"is_training",
"=",
"True",
",",
"num_bits",
"=",
"8",
",",
"nar... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/quant_ops.py#L212-L308 | ||
timi-liuliang/echo | 40a5a24d430eee4118314459ab7e03afcb3b8719 | thirdparty/protobuf/python/google/protobuf/descriptor_pool.py | python | DescriptorPool.SetFieldType | (self, field_proto, field_desc, package, scope) | Sets the field's type, cpp_type, message_type and enum_type.
Args:
field_proto: Data about the field in proto format.
field_desc: The descriptor to modiy.
package: The package the field's container is in.
scope: Enclosing scope of available types. | Sets the field's type, cpp_type, message_type and enum_type. | [
"Sets",
"the",
"field",
"s",
"type",
"cpp_type",
"message_type",
"and",
"enum_type",
"."
] | def SetFieldType(self, field_proto, field_desc, package, scope):
"""Sets the field's type, cpp_type, message_type and enum_type.
Args:
field_proto: Data about the field in proto format.
field_desc: The descriptor to modiy.
package: The package the field's container is in.
scope: Enclosi... | [
"def",
"SetFieldType",
"(",
"self",
",",
"field_proto",
",",
"field_desc",
",",
"package",
",",
"scope",
")",
":",
"if",
"field_proto",
".",
"type_name",
":",
"desc",
"=",
"self",
".",
"_GetTypeFromScope",
"(",
"package",
",",
"field_proto",
".",
"type_name"... | https://github.com/timi-liuliang/echo/blob/40a5a24d430eee4118314459ab7e03afcb3b8719/thirdparty/protobuf/python/google/protobuf/descriptor_pool.py#L513-L567 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/rnn/python/ops/lstm_ops.py | python | _FusedLSTMGradShape | (op) | return [x_shape] * max_len + [cs_prev_shape, h_prev_shape, w_shape, wci_shape,
wco_shape, wcf_shape, b_shape] | Shape for FusedLSTM. | Shape for FusedLSTM. | [
"Shape",
"for",
"FusedLSTM",
"."
] | def _FusedLSTMGradShape(op):
"""Shape for FusedLSTM."""
max_len = op.get_attr("max_len")
x = op.inputs[1]
cs_prev = op.inputs[1 + max_len]
h_prev = op.inputs[2 + max_len]
w = op.inputs[3 + max_len]
wci = op.inputs[4 + max_len]
wco = op.inputs[5 + max_len]
wcf = op.inputs[6 + max_len]
b = op.inputs[... | [
"def",
"_FusedLSTMGradShape",
"(",
"op",
")",
":",
"max_len",
"=",
"op",
".",
"get_attr",
"(",
"\"max_len\"",
")",
"x",
"=",
"op",
".",
"inputs",
"[",
"1",
"]",
"cs_prev",
"=",
"op",
".",
"inputs",
"[",
"1",
"+",
"max_len",
"]",
"h_prev",
"=",
"op"... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/rnn/python/ops/lstm_ops.py#L369-L392 | |
leosac/leosac | 932a2a90bd2e75483d46b24fdbc8f02e0809d731 | python/leosacpy/wsclient.py | python | LowLevelWSClient.connect | (self, target, timeout=45, autoread=True) | Connect to target.
:param target: URL to connect to ('ws://blah:1234')
:param timeout: Timeout before aborting connection attempt
:param autoread: Should the client automatically read message. See below
If ``autoread`` is true, the client will setup a coroutine that will
... | Connect to target.
:param target: URL to connect to ('ws://blah:1234')
:param timeout: Timeout before aborting connection attempt
:param autoread: Should the client automatically read message. See below
If ``autoread`` is true, the client will setup a coroutine that will
... | [
"Connect",
"to",
"target",
".",
":",
"param",
"target",
":",
"URL",
"to",
"connect",
"to",
"(",
"ws",
":",
"//",
"blah",
":",
"1234",
")",
":",
"param",
"timeout",
":",
"Timeout",
"before",
"aborting",
"connection",
"attempt",
":",
"param",
"autoread",
... | async def connect(self, target, timeout=45, autoread=True):
"""
Connect to target.
:param target: URL to connect to ('ws://blah:1234')
:param timeout: Timeout before aborting connection attempt
:param autoread: Should the client automatically read message. See below
... | [
"async",
"def",
"connect",
"(",
"self",
",",
"target",
",",
"timeout",
"=",
"45",
",",
"autoread",
"=",
"True",
")",
":",
"last_ex",
"=",
"None",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"while",
"time",
".",
"time",
"(",
")",
"<",
"start_... | https://github.com/leosac/leosac/blob/932a2a90bd2e75483d46b24fdbc8f02e0809d731/python/leosacpy/wsclient.py#L69-L100 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/dataview.py | python | DataViewTreeStore.DeleteChildren | (*args, **kwargs) | return _dataview.DataViewTreeStore_DeleteChildren(*args, **kwargs) | DeleteChildren(self, DataViewItem item) | DeleteChildren(self, DataViewItem item) | [
"DeleteChildren",
"(",
"self",
"DataViewItem",
"item",
")"
] | def DeleteChildren(*args, **kwargs):
"""DeleteChildren(self, DataViewItem item)"""
return _dataview.DataViewTreeStore_DeleteChildren(*args, **kwargs) | [
"def",
"DeleteChildren",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewTreeStore_DeleteChildren",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/dataview.py#L2448-L2450 | |
msftguy/ssh-rd | a5f3a79daeac5844edebf01916c9613563f1c390 | _3rd/boost_1_48_0/tools/build/v2/build/feature.py | python | set_default | (feature, value) | Sets the default value of the given feature, overriding any previous default.
feature: the name of the feature
value: the default value to assign | Sets the default value of the given feature, overriding any previous default.
feature: the name of the feature
value: the default value to assign | [
"Sets",
"the",
"default",
"value",
"of",
"the",
"given",
"feature",
"overriding",
"any",
"previous",
"default",
".",
"feature",
":",
"the",
"name",
"of",
"the",
"feature",
"value",
":",
"the",
"default",
"value",
"to",
"assign"
] | def set_default (feature, value):
""" Sets the default value of the given feature, overriding any previous default.
feature: the name of the feature
value: the default value to assign
"""
f = __all_features[feature]
attributes = f.attributes()
bad_attribute = None
if attributes ... | [
"def",
"set_default",
"(",
"feature",
",",
"value",
")",
":",
"f",
"=",
"__all_features",
"[",
"feature",
"]",
"attributes",
"=",
"f",
".",
"attributes",
"(",
")",
"bad_attribute",
"=",
"None",
"if",
"attributes",
"&",
"Feature",
".",
"FREE",
":",
"bad_a... | https://github.com/msftguy/ssh-rd/blob/a5f3a79daeac5844edebf01916c9613563f1c390/_3rd/boost_1_48_0/tools/build/v2/build/feature.py#L186-L206 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8_inspector/third_party/jinja2/jinja2/optimizer.py | python | optimize | (node, environment) | return optimizer.visit(node) | The context hint can be used to perform an static optimization
based on the context given. | The context hint can be used to perform an static optimization
based on the context given. | [
"The",
"context",
"hint",
"can",
"be",
"used",
"to",
"perform",
"an",
"static",
"optimization",
"based",
"on",
"the",
"context",
"given",
"."
] | def optimize(node, environment):
"""The context hint can be used to perform an static optimization
based on the context given."""
optimizer = Optimizer(environment)
return optimizer.visit(node) | [
"def",
"optimize",
"(",
"node",
",",
"environment",
")",
":",
"optimizer",
"=",
"Optimizer",
"(",
"environment",
")",
"return",
"optimizer",
".",
"visit",
"(",
"node",
")"
] | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8_inspector/third_party/jinja2/jinja2/optimizer.py#L23-L27 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/rcfr.py | python | ReservoirRcfrSolver.evaluate_and_update_policy | (self, train_fn) | Performs a single step of policy evaluation and policy improvement.
Args:
train_fn: A (model, `tf.data.Dataset`) function that trains the given
regression model to accurately reproduce the x to y mapping given x-y
data. | Performs a single step of policy evaluation and policy improvement. | [
"Performs",
"a",
"single",
"step",
"of",
"policy",
"evaluation",
"and",
"policy",
"improvement",
"."
] | def evaluate_and_update_policy(self, train_fn):
"""Performs a single step of policy evaluation and policy improvement.
Args:
train_fn: A (model, `tf.data.Dataset`) function that trains the given
regression model to accurately reproduce the x to y mapping given x-y
data.
"""
sequen... | [
"def",
"evaluate_and_update_policy",
"(",
"self",
",",
"train_fn",
")",
":",
"sequence_weights",
"=",
"self",
".",
"_sequence_weights",
"(",
")",
"player_seq_features",
"=",
"self",
".",
"_root_wrapper",
".",
"sequence_features",
"for",
"regret_player",
"in",
"range... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/rcfr.py#L844-L878 | ||
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | Wrapping/Python/paraview/coprocessing.py | python | CoProcessor.SetUpdateFrequencies | (self, frequencies) | Set the frequencies at which the pipeline needs to be updated.
Typically, this is called by the subclass once it has determined what
timesteps co-processing will be needed to be done.
frequencies is a map, with key->string name of for the simulation
input, and value is a list... | Set the frequencies at which the pipeline needs to be updated.
Typically, this is called by the subclass once it has determined what
timesteps co-processing will be needed to be done.
frequencies is a map, with key->string name of for the simulation
input, and value is a list... | [
"Set",
"the",
"frequencies",
"at",
"which",
"the",
"pipeline",
"needs",
"to",
"be",
"updated",
".",
"Typically",
"this",
"is",
"called",
"by",
"the",
"subclass",
"once",
"it",
"has",
"determined",
"what",
"timesteps",
"co",
"-",
"processing",
"will",
"be",
... | def SetUpdateFrequencies(self, frequencies):
"""Set the frequencies at which the pipeline needs to be updated.
Typically, this is called by the subclass once it has determined what
timesteps co-processing will be needed to be done.
frequencies is a map, with key->string name of ... | [
"def",
"SetUpdateFrequencies",
"(",
"self",
",",
"frequencies",
")",
":",
"if",
"type",
"(",
"frequencies",
")",
"!=",
"dict",
":",
"raise",
"RuntimeError",
"(",
"\"Incorrect argument type: %s, must be a dict\"",
"%",
"type",
"(",
"frequencies",
")",
")",
"self",
... | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Wrapping/Python/paraview/coprocessing.py#L80-L90 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/eager/python/network.py | python | _network_name_scope_naming | (current_variable_scope) | return current_variable_scope.name + "/" | Name scope naming to match operation names to variable names.
Used in Networks and also applied to non-Network Layers which are added to
Networks before being built.
Args:
current_variable_scope: A VariableScope object.
Returns:
A name scope name. | Name scope naming to match operation names to variable names. | [
"Name",
"scope",
"naming",
"to",
"match",
"operation",
"names",
"to",
"variable",
"names",
"."
] | def _network_name_scope_naming(current_variable_scope):
"""Name scope naming to match operation names to variable names.
Used in Networks and also applied to non-Network Layers which are added to
Networks before being built.
Args:
current_variable_scope: A VariableScope object.
Returns:
A name scop... | [
"def",
"_network_name_scope_naming",
"(",
"current_variable_scope",
")",
":",
"return",
"current_variable_scope",
".",
"name",
"+",
"\"/\""
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/eager/python/network.py#L43-L55 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/ops/variable_scope.py | python | VariableScope._get_partitioned_variable | (self,
var_store,
name,
shape=None,
dtype=None,
initializer=None,
regularizer=None,
trainable=Tr... | Gets an existing variable with this name or create a new one. | Gets an existing variable with this name or create a new one. | [
"Gets",
"an",
"existing",
"variable",
"with",
"this",
"name",
"or",
"create",
"a",
"new",
"one",
"."
] | def _get_partitioned_variable(self,
var_store,
name,
shape=None,
dtype=None,
initializer=None,
regularizer=None,
... | [
"def",
"_get_partitioned_variable",
"(",
"self",
",",
"var_store",
",",
"name",
",",
"shape",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"initializer",
"=",
"None",
",",
"regularizer",
"=",
"None",
",",
"trainable",
"=",
"True",
",",
"collections",
"=",
... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/variable_scope.py#L702-L755 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/plan/motionplanning.py | python | CSpaceInterface.setVisibility | (self, pyVisible: object) | return _motionplanning.CSpaceInterface_setVisibility(self, pyVisible) | r"""
Args:
pyVisible (:obj:`object`) | r"""
Args:
pyVisible (:obj:`object`) | [
"r",
"Args",
":",
"pyVisible",
"(",
":",
"obj",
":",
"object",
")"
] | def setVisibility(self, pyVisible: object) ->None:
r"""
Args:
pyVisible (:obj:`object`)
"""
return _motionplanning.CSpaceInterface_setVisibility(self, pyVisible) | [
"def",
"setVisibility",
"(",
"self",
",",
"pyVisible",
":",
"object",
")",
"->",
"None",
":",
"return",
"_motionplanning",
".",
"CSpaceInterface_setVisibility",
"(",
"self",
",",
"pyVisible",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/plan/motionplanning.py#L516-L521 | |
freeorion/freeorion | c266a40eccd3a99a17de8fe57c36ef6ba3771665 | default/python/AI/FleetUtilsAI.py | python | get_empire_fleet_ids_by_role | (fleet_role) | return fleet_ids_with_role | Returns a list with fleet_ids that have the specified role. | Returns a list with fleet_ids that have the specified role. | [
"Returns",
"a",
"list",
"with",
"fleet_ids",
"that",
"have",
"the",
"specified",
"role",
"."
] | def get_empire_fleet_ids_by_role(fleet_role):
"""Returns a list with fleet_ids that have the specified role."""
fleet_ids = get_empire_fleet_ids()
fleet_ids_with_role = []
aistate = get_aistate()
for fleet_id in fleet_ids:
if aistate.get_fleet_role(fleet_id) != fleet_role:
contin... | [
"def",
"get_empire_fleet_ids_by_role",
"(",
"fleet_role",
")",
":",
"fleet_ids",
"=",
"get_empire_fleet_ids",
"(",
")",
"fleet_ids_with_role",
"=",
"[",
"]",
"aistate",
"=",
"get_aistate",
"(",
")",
"for",
"fleet_id",
"in",
"fleet_ids",
":",
"if",
"aistate",
"."... | https://github.com/freeorion/freeorion/blob/c266a40eccd3a99a17de8fe57c36ef6ba3771665/default/python/AI/FleetUtilsAI.py#L357-L366 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/summary/writer/event_file_writer.py | python | EventFileWriter.flush | (self) | Flushes the event file to disk.
Call this method to make sure that all pending events have been written to
disk. | Flushes the event file to disk. | [
"Flushes",
"the",
"event",
"file",
"to",
"disk",
"."
] | def flush(self):
"""Flushes the event file to disk.
Call this method to make sure that all pending events have been written to
disk.
"""
if not self._closed:
# Request a flush operation by enqueing a sentinel and then waiting for
# the writer thread to mark the flush as complete.
... | [
"def",
"flush",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_closed",
":",
"# Request a flush operation by enqueing a sentinel and then waiting for",
"# the writer thread to mark the flush as complete.",
"self",
".",
"_flush_complete",
".",
"clear",
"(",
")",
"self",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/summary/writer/event_file_writer.py#L134-L148 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/diagnose-me.py | python | Check | (name) | return wrap | Decorator that defines a diagnostic check. | Decorator that defines a diagnostic check. | [
"Decorator",
"that",
"defines",
"a",
"diagnostic",
"check",
"."
] | def Check(name):
"""Decorator that defines a diagnostic check."""
def wrap(func):
all_checks.append((name, func))
return func
return wrap | [
"def",
"Check",
"(",
"name",
")",
":",
"def",
"wrap",
"(",
"func",
")",
":",
"all_checks",
".",
"append",
"(",
"(",
"name",
",",
"func",
")",
")",
"return",
"func",
"return",
"wrap"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/diagnose-me.py#L15-L20 | |
Samsung/veles | 95ed733c2e49bc011ad98ccf2416ecec23fbf352 | veles/external/freetype/__init__.py | python | Outline.__init__ | (self, outline) | Create a new Outline object.
:param charmap: a FT_Outline | Create a new Outline object. | [
"Create",
"a",
"new",
"Outline",
"object",
"."
] | def __init__(self, outline):
'''
Create a new Outline object.
:param charmap: a FT_Outline
'''
self._FT_Outline = outline | [
"def",
"__init__",
"(",
"self",
",",
"outline",
")",
":",
"self",
".",
"_FT_Outline",
"=",
"outline"
] | https://github.com/Samsung/veles/blob/95ed733c2e49bc011ad98ccf2416ecec23fbf352/veles/external/freetype/__init__.py#L653-L659 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TInt.Load | (self, *args) | return _snap.TInt_Load(self, *args) | Load(TInt self, TSIn SIn)
Parameters:
SIn: TSIn & | Load(TInt self, TSIn SIn) | [
"Load",
"(",
"TInt",
"self",
"TSIn",
"SIn",
")"
] | def Load(self, *args):
"""
Load(TInt self, TSIn SIn)
Parameters:
SIn: TSIn &
"""
return _snap.TInt_Load(self, *args) | [
"def",
"Load",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TInt_Load",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L12944-L12952 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/framework/ops.py | python | Operation.name | (self) | return self._node_def.name | The full name of this operation. | The full name of this operation. | [
"The",
"full",
"name",
"of",
"this",
"operation",
"."
] | def name(self):
"""The full name of this operation."""
return self._node_def.name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_node_def",
".",
"name"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/framework/ops.py#L1351-L1353 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/probability/distribution/uniform.py | python | Uniform._cdf | (self, value, low=None, high=None) | return self.select(comp_hi, less_than_low, ones) | r"""
The cumulative distribution function of Uniform distribution.
Args:
value (Tensor): The value to be evaluated.
low (Tensor): The lower bound of the distribution. Default: self.low.
high (Tensor): The upper bound of the distribution. Default: self.high.
... | r"""
The cumulative distribution function of Uniform distribution. | [
"r",
"The",
"cumulative",
"distribution",
"function",
"of",
"Uniform",
"distribution",
"."
] | def _cdf(self, value, low=None, high=None):
r"""
The cumulative distribution function of Uniform distribution.
Args:
value (Tensor): The value to be evaluated.
low (Tensor): The lower bound of the distribution. Default: self.low.
high (Tensor): The upper boun... | [
"def",
"_cdf",
"(",
"self",
",",
"value",
",",
"low",
"=",
"None",
",",
"high",
"=",
"None",
")",
":",
"value",
"=",
"self",
".",
"_check_value",
"(",
"value",
",",
"'value'",
")",
"value",
"=",
"self",
".",
"cast",
"(",
"value",
",",
"self",
"."... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/probability/distribution/uniform.py#L335-L359 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/internals/managers.py | python | SingleBlockManager.idelete | (self, indexer) | return self | Delete single location from SingleBlockManager.
Ensures that self.blocks doesn't become empty. | Delete single location from SingleBlockManager. | [
"Delete",
"single",
"location",
"from",
"SingleBlockManager",
"."
] | def idelete(self, indexer) -> SingleBlockManager:
"""
Delete single location from SingleBlockManager.
Ensures that self.blocks doesn't become empty.
"""
self._block.delete(indexer)
self.axes[0] = self.axes[0].delete(indexer)
return self | [
"def",
"idelete",
"(",
"self",
",",
"indexer",
")",
"->",
"SingleBlockManager",
":",
"self",
".",
"_block",
".",
"delete",
"(",
"indexer",
")",
"self",
".",
"axes",
"[",
"0",
"]",
"=",
"self",
".",
"axes",
"[",
"0",
"]",
".",
"delete",
"(",
"indexe... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/internals/managers.py#L1695-L1703 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/propgrid.py | python | PyChoiceEditor._SetSelf | (*args, **kwargs) | return _propgrid.PyChoiceEditor__SetSelf(*args, **kwargs) | _SetSelf(self, PyObject self) | _SetSelf(self, PyObject self) | [
"_SetSelf",
"(",
"self",
"PyObject",
"self",
")"
] | def _SetSelf(*args, **kwargs):
"""_SetSelf(self, PyObject self)"""
return _propgrid.PyChoiceEditor__SetSelf(*args, **kwargs) | [
"def",
"_SetSelf",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PyChoiceEditor__SetSelf",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L4470-L4472 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Alignment/MuonAlignment/python/svgfig.py | python | load_stream | (stream) | return ch.output | Loads an SVG image from a stream (can be a string or a file object). | Loads an SVG image from a stream (can be a string or a file object). | [
"Loads",
"an",
"SVG",
"image",
"from",
"a",
"stream",
"(",
"can",
"be",
"a",
"string",
"or",
"a",
"file",
"object",
")",
"."
] | def load_stream(stream):
"""Loads an SVG image from a stream (can be a string or a file object)."""
from xml.sax import handler, make_parser
from xml.sax.handler import feature_namespaces, feature_external_ges, feature_external_pes
class ContentHandler(handler.ContentHandler):
def __init__(self):
se... | [
"def",
"load_stream",
"(",
"stream",
")",
":",
"from",
"xml",
".",
"sax",
"import",
"handler",
",",
"make_parser",
"from",
"xml",
".",
"sax",
".",
"handler",
"import",
"feature_namespaces",
",",
"feature_external_ges",
",",
"feature_external_pes",
"class",
"Cont... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Alignment/MuonAlignment/python/svgfig.py#L551-L594 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/fractions.py | python | Fraction.__repr__ | (self) | return ('Fraction(%s, %s)' % (self._numerator, self._denominator)) | repr(self) | repr(self) | [
"repr",
"(",
"self",
")"
] | def __repr__(self):
"""repr(self)"""
return ('Fraction(%s, %s)' % (self._numerator, self._denominator)) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"(",
"'Fraction(%s, %s)'",
"%",
"(",
"self",
".",
"_numerator",
",",
"self",
".",
"_denominator",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/fractions.py#L269-L271 | |
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | algorithms/src/LocalizationAndMapping/icp_lidar_localization/fast_gicp/thirdparty/Sophus/py/sophus/se3.py | python | Se3.vee | (Omega) | return upsilon_omega | R^4x4 => R^6 | R^4x4 => R^6 | [
"R^4x4",
"=",
">",
"R^6"
] | def vee(Omega):
""" R^4x4 => R^6 """
""" returns 6-vector representation of Lie algebra """
""" This is the inverse of the hat-operator """
head = sophus.Vector3(Omega[0,3], Omega[1,3], Omega[2,3])
tail = sophus.So3.vee(Omega[0:3,0:3])
upsilon_omega = \
... | [
"def",
"vee",
"(",
"Omega",
")",
":",
"\"\"\" returns 6-vector representation of Lie algebra \"\"\"",
"\"\"\" This is the inverse of the hat-operator \"\"\"",
"head",
"=",
"sophus",
".",
"Vector3",
"(",
"Omega",
"[",
"0",
",",
"3",
"]",
",",
"Omega",
"[",
"1",
",",
... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/algorithms/src/LocalizationAndMapping/icp_lidar_localization/fast_gicp/thirdparty/Sophus/py/sophus/se3.py#L67-L76 | |
google/mysql-protobuf | 467cda676afaa49e762c5c9164a43f6ad31a1fbf | storage/ndb/mcc/util.py | python | try_connect | (url_host, port, success=True, retdict={}) | Test connectability of url_host and port. Return success if connection attempt
was successful. If the connection attempt throws a socket.error and its errno is
a key in retdict, the corresponding retdict value is returned. Any other exception
propagated. | Test connectability of url_host and port. Return success if connection attempt
was successful. If the connection attempt throws a socket.error and its errno is
a key in retdict, the corresponding retdict value is returned. Any other exception
propagated. | [
"Test",
"connectability",
"of",
"url_host",
"and",
"port",
".",
"Return",
"success",
"if",
"connection",
"attempt",
"was",
"successful",
".",
"If",
"the",
"connection",
"attempt",
"throws",
"a",
"socket",
".",
"error",
"and",
"its",
"errno",
"is",
"a",
"key"... | def try_connect(url_host, port, success=True, retdict={}):
"""Test connectability of url_host and port. Return success if connection attempt
was successful. If the connection attempt throws a socket.error and its errno is
a key in retdict, the corresponding retdict value is returned. Any other exception
... | [
"def",
"try_connect",
"(",
"url_host",
",",
"port",
",",
"success",
"=",
"True",
",",
"retdict",
"=",
"{",
"}",
")",
":",
"s",
"=",
"None",
"try",
":",
"s",
"=",
"socket",
".",
"create_connection",
"(",
"(",
"url_host",
",",
"port",
")",
")",
"exce... | https://github.com/google/mysql-protobuf/blob/467cda676afaa49e762c5c9164a43f6ad31a1fbf/storage/ndb/mcc/util.py#L55-L74 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/specifiers.py | python | BaseSpecifier.__hash__ | (self) | Returns a hash value for this Specifier like object. | Returns a hash value for this Specifier like object. | [
"Returns",
"a",
"hash",
"value",
"for",
"this",
"Specifier",
"like",
"object",
"."
] | def __hash__(self):
"""
Returns a hash value for this Specifier like object.
""" | [
"def",
"__hash__",
"(",
"self",
")",
":"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/specifiers.py#L31-L34 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/variables.py | python | Variable.assign_add | (self, delta, use_locking=False) | return state_ops.assign_add(self._variable, delta, use_locking=use_locking) | Adds a value to this variable.
This is essentially a shortcut for `assign_add(self, delta)`.
Args:
delta: A `Tensor`. The value to add to this variable.
use_locking: If `True`, use locking during the operation.
Returns:
A `Tensor` that will hold the new value of this variable after
... | Adds a value to this variable. | [
"Adds",
"a",
"value",
"to",
"this",
"variable",
"."
] | def assign_add(self, delta, use_locking=False):
"""Adds a value to this variable.
This is essentially a shortcut for `assign_add(self, delta)`.
Args:
delta: A `Tensor`. The value to add to this variable.
use_locking: If `True`, use locking during the operation.
Returns:
A `Tensor` ... | [
"def",
"assign_add",
"(",
"self",
",",
"delta",
",",
"use_locking",
"=",
"False",
")",
":",
"return",
"state_ops",
".",
"assign_add",
"(",
"self",
".",
"_variable",
",",
"delta",
",",
"use_locking",
"=",
"use_locking",
")"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/variables.py#L529-L542 | |
astra-toolbox/astra-toolbox | 1e7ec8af702e595b76654f2e500f4c00344b273f | python/astra/data2d.py | python | store | (i, data) | return d.store(i, data) | Fill existing 2D object with data.
:param i: ID of object to fill.
:type i: :class:`int`
:param data: Data to fill the object with, either a scalar or array.
:type data: :class:`float` or :class:`numpy.ndarray` | Fill existing 2D object with data.
:param i: ID of object to fill.
:type i: :class:`int`
:param data: Data to fill the object with, either a scalar or array.
:type data: :class:`float` or :class:`numpy.ndarray` | [
"Fill",
"existing",
"2D",
"object",
"with",
"data",
".",
":",
"param",
"i",
":",
"ID",
"of",
"object",
"to",
"fill",
".",
":",
"type",
"i",
":",
":",
"class",
":",
"int",
":",
"param",
"data",
":",
"Data",
"to",
"fill",
"the",
"object",
"with",
"... | def store(i, data):
"""Fill existing 2D object with data.
:param i: ID of object to fill.
:type i: :class:`int`
:param data: Data to fill the object with, either a scalar or array.
:type data: :class:`float` or :class:`numpy.ndarray`
"""
return d.store(i, data) | [
"def",
"store",
"(",
"i",
",",
"data",
")",
":",
"return",
"d",
".",
"store",
"(",
"i",
",",
"data",
")"
] | https://github.com/astra-toolbox/astra-toolbox/blob/1e7ec8af702e595b76654f2e500f4c00344b273f/python/astra/data2d.py#L73-L82 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/toolkits/_internal_utils.py | python | _toolkit_summary_to_json | (model, sections, section_titles) | return _toolkit_summary_dict_to_json(
_toolkit_serialize_summary_struct(model, sections, section_titles)
) | Serialize model summary to JSON string. JSON is an object with ordered arrays of
section_titles and sections
Parameters
----------
model : Model object
sections : Ordered list of lists (sections) of tuples (field,value)
[
[(field1, value1), (field2, value2)],
[(field3, value3... | Serialize model summary to JSON string. JSON is an object with ordered arrays of
section_titles and sections | [
"Serialize",
"model",
"summary",
"to",
"JSON",
"string",
".",
"JSON",
"is",
"an",
"object",
"with",
"ordered",
"arrays",
"of",
"section_titles",
"and",
"sections"
] | def _toolkit_summary_to_json(model, sections, section_titles):
"""
Serialize model summary to JSON string. JSON is an object with ordered arrays of
section_titles and sections
Parameters
----------
model : Model object
sections : Ordered list of lists (sections) of tuples (field,value)
... | [
"def",
"_toolkit_summary_to_json",
"(",
"model",
",",
"sections",
",",
"section_titles",
")",
":",
"return",
"_toolkit_summary_dict_to_json",
"(",
"_toolkit_serialize_summary_struct",
"(",
"model",
",",
"sections",
",",
"section_titles",
")",
")"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/_internal_utils.py#L374-L393 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/stats/kde.py | python | gaussian_kde.logpdf | (self, x) | return np.log(self.evaluate(x)) | Evaluate the log of the estimated pdf on a provided set of points.
Notes
-----
See `gaussian_kde.evaluate` for more details; this method simply
returns ``np.log(gaussian_kde.evaluate(x))``. | Evaluate the log of the estimated pdf on a provided set of points. | [
"Evaluate",
"the",
"log",
"of",
"the",
"estimated",
"pdf",
"on",
"a",
"provided",
"set",
"of",
"points",
"."
] | def logpdf(self, x):
"""
Evaluate the log of the estimated pdf on a provided set of points.
Notes
-----
See `gaussian_kde.evaluate` for more details; this method simply
returns ``np.log(gaussian_kde.evaluate(x))``.
"""
return np.log(self.evaluate(x)) | [
"def",
"logpdf",
"(",
"self",
",",
"x",
")",
":",
"return",
"np",
".",
"log",
"(",
"self",
".",
"evaluate",
"(",
"x",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/stats/kde.py#L526-L536 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/io/pytables.py | python | _maybe_adjust_name | (name: str, version: Sequence[int]) | return name | Prior to 0.10.1, we named values blocks like: values_block_0 an the
name values_0, adjust the given name if necessary.
Parameters
----------
name : str
version : Tuple[int, int, int]
Returns
-------
str | Prior to 0.10.1, we named values blocks like: values_block_0 an the
name values_0, adjust the given name if necessary. | [
"Prior",
"to",
"0",
".",
"10",
".",
"1",
"we",
"named",
"values",
"blocks",
"like",
":",
"values_block_0",
"an",
"the",
"name",
"values_0",
"adjust",
"the",
"given",
"name",
"if",
"necessary",
"."
] | def _maybe_adjust_name(name: str, version: Sequence[int]) -> str:
"""
Prior to 0.10.1, we named values blocks like: values_block_0 an the
name values_0, adjust the given name if necessary.
Parameters
----------
name : str
version : Tuple[int, int, int]
Returns
-------
str
"... | [
"def",
"_maybe_adjust_name",
"(",
"name",
":",
"str",
",",
"version",
":",
"Sequence",
"[",
"int",
"]",
")",
"->",
"str",
":",
"if",
"isinstance",
"(",
"version",
",",
"str",
")",
"or",
"len",
"(",
"version",
")",
"<",
"3",
":",
"raise",
"ValueError"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/pytables.py#L5105-L5127 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/mvn.py | python | MultivariateNormalOperatorPD.event_shape | (self, name="event_shape") | Shape of a sample from a single distribution as a 1-D int32 `Tensor`. | Shape of a sample from a single distribution as a 1-D int32 `Tensor`. | [
"Shape",
"of",
"a",
"sample",
"from",
"a",
"single",
"distribution",
"as",
"a",
"1",
"-",
"D",
"int32",
"Tensor",
"."
] | def event_shape(self, name="event_shape"):
"""Shape of a sample from a single distribution as a 1-D int32 `Tensor`."""
# Recall _check_mu ensures mu and self._cov have same batch shape.
with ops.name_scope(self.name):
with ops.op_scope(self._cov.inputs, name):
return array_ops.pack([self._cov.... | [
"def",
"event_shape",
"(",
"self",
",",
"name",
"=",
"\"event_shape\"",
")",
":",
"# Recall _check_mu ensures mu and self._cov have same batch shape.",
"with",
"ops",
".",
"name_scope",
"(",
"self",
".",
"name",
")",
":",
"with",
"ops",
".",
"op_scope",
"(",
"self... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/mvn.py#L192-L197 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | ListItem.HasAttributes | (*args, **kwargs) | return _controls_.ListItem_HasAttributes(*args, **kwargs) | HasAttributes(self) -> bool | HasAttributes(self) -> bool | [
"HasAttributes",
"(",
"self",
")",
"-",
">",
"bool"
] | def HasAttributes(*args, **kwargs):
"""HasAttributes(self) -> bool"""
return _controls_.ListItem_HasAttributes(*args, **kwargs) | [
"def",
"HasAttributes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ListItem_HasAttributes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L4252-L4254 | |
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/v8/third_party/jinja2/utils.py | python | urlize | (text, trim_url_limit=None, nofollow=False, target=None) | return u''.join(words) | Converts any URLs in text into clickable links. Works on http://,
https:// and www. links. Links can have trailing punctuation (periods,
commas, close-parens) and leading punctuation (opening parens) and
it'll still do the right thing.
If trim_url_limit is not None, the URLs in link text will be limite... | Converts any URLs in text into clickable links. Works on http://,
https:// and www. links. Links can have trailing punctuation (periods,
commas, close-parens) and leading punctuation (opening parens) and
it'll still do the right thing. | [
"Converts",
"any",
"URLs",
"in",
"text",
"into",
"clickable",
"links",
".",
"Works",
"on",
"http",
":",
"//",
"https",
":",
"//",
"and",
"www",
".",
"links",
".",
"Links",
"can",
"have",
"trailing",
"punctuation",
"(",
"periods",
"commas",
"close",
"-",
... | def urlize(text, trim_url_limit=None, nofollow=False, target=None):
"""Converts any URLs in text into clickable links. Works on http://,
https:// and www. links. Links can have trailing punctuation (periods,
commas, close-parens) and leading punctuation (opening parens) and
it'll still do the right thin... | [
"def",
"urlize",
"(",
"text",
",",
"trim_url_limit",
"=",
"None",
",",
"nofollow",
"=",
"False",
",",
"target",
"=",
"None",
")",
":",
"trim_url",
"=",
"lambda",
"x",
",",
"limit",
"=",
"trim_url_limit",
":",
"limit",
"is",
"not",
"None",
"and",
"(",
... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/v8/third_party/jinja2/utils.py#L186-L234 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/training/tensorboard_logging.py | python | _clear_summary_writer | () | Makes all subsequent log invocations error.
This is only used for testing. If you want to disable TensorBoard logging,
call `set_summary_writer(None)` instead. | Makes all subsequent log invocations error. | [
"Makes",
"all",
"subsequent",
"log",
"invocations",
"error",
"."
] | def _clear_summary_writer():
"""Makes all subsequent log invocations error.
This is only used for testing. If you want to disable TensorBoard logging,
call `set_summary_writer(None)` instead.
"""
global _summary_writer
_summary_writer = _sentinel_summary_writer | [
"def",
"_clear_summary_writer",
"(",
")",
":",
"global",
"_summary_writer",
"_summary_writer",
"=",
"_sentinel_summary_writer"
] | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/training/tensorboard_logging.py#L107-L114 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py | python | _AddAccumulatedActionsToMSVS | (p, spec, actions_dict) | Add actions accumulated into an actions_dict, merging as needed.
Arguments:
p: the target project
spec: the target project dict
actions_dict: dictionary keyed on input name, which maps to a list of
dicts describing the actions attached to that input file. | Add actions accumulated into an actions_dict, merging as needed. | [
"Add",
"actions",
"accumulated",
"into",
"an",
"actions_dict",
"merging",
"as",
"needed",
"."
] | def _AddAccumulatedActionsToMSVS(p, spec, actions_dict):
"""Add actions accumulated into an actions_dict, merging as needed.
Arguments:
p: the target project
spec: the target project dict
actions_dict: dictionary keyed on input name, which maps to a list of
dicts describing the actions attached... | [
"def",
"_AddAccumulatedActionsToMSVS",
"(",
"p",
",",
"spec",
",",
"actions_dict",
")",
":",
"for",
"primary_input",
"in",
"actions_dict",
":",
"inputs",
"=",
"OrderedSet",
"(",
")",
"outputs",
"=",
"OrderedSet",
"(",
")",
"descriptions",
"=",
"[",
"]",
"com... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py#L466-L493 | ||
flexflow/FlexFlow | 581fad8ba8d10a16a3102ee2b406b0319586df24 | python/flexflow/keras/utils/generic_utils.py | python | Progbar.update | (self, current, values=None) | Updates the progress bar.
# Arguments
current: Index of current step.
values: List of tuples:
`(name, value_for_last_step)`.
If `name` is in `stateful_metrics`,
`value_for_last_step` will be displayed as-is.
Else, an averag... | Updates the progress bar. | [
"Updates",
"the",
"progress",
"bar",
"."
] | def update(self, current, values=None):
"""Updates the progress bar.
# Arguments
current: Index of current step.
values: List of tuples:
`(name, value_for_last_step)`.
If `name` is in `stateful_metrics`,
`value_for_last_step` will ... | [
"def",
"update",
"(",
"self",
",",
"current",
",",
"values",
"=",
"None",
")",
":",
"values",
"=",
"values",
"or",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"values",
":",
"if",
"k",
"not",
"in",
"self",
".",
"stateful_metrics",
":",
"if",
"k",
"not"... | https://github.com/flexflow/FlexFlow/blob/581fad8ba8d10a16a3102ee2b406b0319586df24/python/flexflow/keras/utils/generic_utils.py#L349-L470 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/docs/shape.py | python | ShapeDocumenter.traverse_and_document_shape | (self, section, shape, history,
include=None, exclude=None, name=None,
is_required=False) | Traverses and documents a shape
Will take a self class and call its appropriate methods as a shape
is traversed.
:param section: The section to document.
:param history: A list of the names of the shapes that have been
traversed.
:type include: Dictionary where ke... | Traverses and documents a shape | [
"Traverses",
"and",
"documents",
"a",
"shape"
] | def traverse_and_document_shape(self, section, shape, history,
include=None, exclude=None, name=None,
is_required=False):
"""Traverses and documents a shape
Will take a self class and call its appropriate methods as a shape
... | [
"def",
"traverse_and_document_shape",
"(",
"self",
",",
"section",
",",
"shape",
",",
"history",
",",
"include",
"=",
"None",
",",
"exclude",
"=",
"None",
",",
"name",
"=",
"None",
",",
"is_required",
"=",
"False",
")",
":",
"param_type",
"=",
"shape",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/docs/shape.py#L36-L89 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.