nwo stringlengths 5 86 | sha stringlengths 40 40 | path stringlengths 4 189 | language stringclasses 1
value | identifier stringlengths 1 94 | parameters stringlengths 2 4.03k | argument_list stringclasses 1
value | return_statement stringlengths 0 11.5k | docstring stringlengths 1 33.2k | docstring_summary stringlengths 0 5.15k | docstring_tokens list | function stringlengths 34 151k | function_tokens list | url stringlengths 90 278 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/urllib3/connectionpool.py | python | HTTPConnectionPool._put_conn | (self, conn) | Put a connection back into the pool.
:param conn:
Connection object for the current host and port as returned by
:meth:`._new_conn` or :meth:`._get_conn`.
If the pool is already full, the connection is closed and discarded
because we exceeded maxsize. If connections are... | Put a connection back into the pool. | [
"Put",
"a",
"connection",
"back",
"into",
"the",
"pool",
"."
] | def _put_conn(self, conn):
"""
Put a connection back into the pool.
:param conn:
Connection object for the current host and port as returned by
:meth:`._new_conn` or :meth:`._get_conn`.
If the pool is already full, the connection is closed and discarded
... | [
"def",
"_put_conn",
"(",
"self",
",",
"conn",
")",
":",
"try",
":",
"self",
".",
"pool",
".",
"put",
"(",
"conn",
",",
"block",
"=",
"False",
")",
"return",
"# Everything is dandy, done.",
"except",
"AttributeError",
":",
"# self.pool is None.",
"pass",
"exc... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/urllib3/connectionpool.py#L276-L302 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | amalgamation/python/mxnet_predict.py | python | Predictor.forward | (self, **kwargs) | Perform forward to get the output.
Parameters
----------
**kwargs
Keyword arguments of input variable name to data.
Examples
--------
>>> predictor.forward(data=mydata)
>>> out = predictor.get_output(0) | Perform forward to get the output. | [
"Perform",
"forward",
"to",
"get",
"the",
"output",
"."
] | def forward(self, **kwargs):
"""Perform forward to get the output.
Parameters
----------
**kwargs
Keyword arguments of input variable name to data.
Examples
--------
>>> predictor.forward(data=mydata)
>>> out = predictor.get_output(0)
... | [
"def",
"forward",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"not",
"isinstance",
"(",
"v",
",",
"np",
".",
"ndarray",
")",
":",
"raise",
"ValueError",
"(",
"\"Expect n... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/amalgamation/python/mxnet_predict.py#L150-L171 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | IdleEvent.__init__ | (self, *args, **kwargs) | __init__(self) -> IdleEvent
Constructor | __init__(self) -> IdleEvent | [
"__init__",
"(",
"self",
")",
"-",
">",
"IdleEvent"
] | def __init__(self, *args, **kwargs):
"""
__init__(self) -> IdleEvent
Constructor
"""
_core_.IdleEvent_swiginit(self,_core_.new_IdleEvent(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_core_",
".",
"IdleEvent_swiginit",
"(",
"self",
",",
"_core_",
".",
"new_IdleEvent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L7449-L7455 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/gslib/util.py | python | LookUpGsutilVersion | (gsutil_api, url_str) | Looks up the gsutil version of the specified gsutil tarball URL.
Version is specified in the metadata field set on that object.
Args:
gsutil_api: gsutil Cloud API to use when retrieving gsutil tarball.
url_str: tarball URL to retrieve (such as 'gs://pub/gsutil.tar.gz').
Returns:
Version string if U... | Looks up the gsutil version of the specified gsutil tarball URL. | [
"Looks",
"up",
"the",
"gsutil",
"version",
"of",
"the",
"specified",
"gsutil",
"tarball",
"URL",
"."
] | def LookUpGsutilVersion(gsutil_api, url_str):
"""Looks up the gsutil version of the specified gsutil tarball URL.
Version is specified in the metadata field set on that object.
Args:
gsutil_api: gsutil Cloud API to use when retrieving gsutil tarball.
url_str: tarball URL to retrieve (such as 'gs://pub/g... | [
"def",
"LookUpGsutilVersion",
"(",
"gsutil_api",
",",
"url_str",
")",
":",
"url",
"=",
"StorageUrlFromString",
"(",
"url_str",
")",
"if",
"url",
".",
"IsCloudUrl",
"(",
")",
":",
"obj",
"=",
"gsutil_api",
".",
"GetObjectMetadata",
"(",
"url",
".",
"bucket_na... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/gslib/util.py#L639-L660 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/telemetry/third_party/pyserial/serial/serialposix.py | python | PosixSerial.open | (self) | Open port with current settings. This may throw a SerialException
if the port cannot be opened. | Open port with current settings. This may throw a SerialException
if the port cannot be opened. | [
"Open",
"port",
"with",
"current",
"settings",
".",
"This",
"may",
"throw",
"a",
"SerialException",
"if",
"the",
"port",
"cannot",
"be",
"opened",
"."
] | def open(self):
"""Open port with current settings. This may throw a SerialException
if the port cannot be opened."""
if self._port is None:
raise SerialException("Port must be configured before it can be used.")
if self._isOpen:
raise SerialException("Port is ... | [
"def",
"open",
"(",
"self",
")",
":",
"if",
"self",
".",
"_port",
"is",
"None",
":",
"raise",
"SerialException",
"(",
"\"Port must be configured before it can be used.\"",
")",
"if",
"self",
".",
"_isOpen",
":",
"raise",
"SerialException",
"(",
"\"Port is already ... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/telemetry/third_party/pyserial/serial/serialposix.py#L279-L308 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/layer/basic.py | python | Flatten.__init__ | (self) | Initialize Flatten. | Initialize Flatten. | [
"Initialize",
"Flatten",
"."
] | def __init__(self):
"""Initialize Flatten."""
super(Flatten, self).__init__() | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"Flatten",
",",
"self",
")",
".",
"__init__",
"(",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/layer/basic.py#L210-L212 | ||
google/shaka-packager | e1b0c7c45431327fd3ce193514a5407d07b39b22 | packager/third_party/protobuf/python/google/protobuf/service.py | python | RpcController.Reset | (self) | Resets the RpcController to its initial state.
After the RpcController has been reset, it may be reused in
a new call. Must not be called while an RPC is in progress. | Resets the RpcController to its initial state. | [
"Resets",
"the",
"RpcController",
"to",
"its",
"initial",
"state",
"."
] | def Reset(self):
"""Resets the RpcController to its initial state.
After the RpcController has been reset, it may be reused in
a new call. Must not be called while an RPC is in progress.
"""
raise NotImplementedError | [
"def",
"Reset",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/google/shaka-packager/blob/e1b0c7c45431327fd3ce193514a5407d07b39b22/packager/third_party/protobuf/python/google/protobuf/service.py#L132-L138 | ||
RegrowthStudios/SoACode-Public | c3ddd69355b534d5e70e2e6d0c489b4e93ab1ffe | utils/git-hooks/cpplint/cpplint.py | python | CheckCStyleCast | (filename, linenum, line, raw_line, cast_type, pattern,
error) | return True | Checks for a C-style cast by looking for the pattern.
This also handles sizeof(type) warnings, due to similarity of content.
Args:
filename: The name of the current file.
linenum: The number of the line to check.
line: The line of code to check.
raw_line: The raw line of code to check, with commen... | Checks for a C-style cast by looking for the pattern. | [
"Checks",
"for",
"a",
"C",
"-",
"style",
"cast",
"by",
"looking",
"for",
"the",
"pattern",
"."
] | def CheckCStyleCast(filename, linenum, line, raw_line, cast_type, pattern,
error):
"""Checks for a C-style cast by looking for the pattern.
This also handles sizeof(type) warnings, due to similarity of content.
Args:
filename: The name of the current file.
linenum: The number of the ... | [
"def",
"CheckCStyleCast",
"(",
"filename",
",",
"linenum",
",",
"line",
",",
"raw_line",
",",
"cast_type",
",",
"pattern",
",",
"error",
")",
":",
"match",
"=",
"Search",
"(",
"pattern",
",",
"line",
")",
"if",
"not",
"match",
":",
"return",
"False",
"... | https://github.com/RegrowthStudios/SoACode-Public/blob/c3ddd69355b534d5e70e2e6d0c489b4e93ab1ffe/utils/git-hooks/cpplint/cpplint.py#L2817-L2877 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/reduce4circleGUI.py | python | MainWindow.menu_sort_by_pt_number | (self) | sort survey table by pt number (with the maximum counts in the scan)
:return: | sort survey table by pt number (with the maximum counts in the scan)
:return: | [
"sort",
"survey",
"table",
"by",
"pt",
"number",
"(",
"with",
"the",
"maximum",
"counts",
"in",
"the",
"scan",
")",
":",
"return",
":"
] | def menu_sort_by_pt_number(self):
"""
sort survey table by pt number (with the maximum counts in the scan)
:return:
"""
self.ui.tableWidget_surveyTable.filter_and_sort(start_scan=0, end_scan=100000,
min_counts=0., max_counts... | [
"def",
"menu_sort_by_pt_number",
"(",
"self",
")",
":",
"self",
".",
"ui",
".",
"tableWidget_surveyTable",
".",
"filter_and_sort",
"(",
"start_scan",
"=",
"0",
",",
"end_scan",
"=",
"100000",
",",
"min_counts",
"=",
"0.",
",",
"max_counts",
"=",
"10000000000."... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/reduce4circleGUI.py#L3715-L3722 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/cookielib.py | python | is_third_party | (request) | RFC 2965, section 3.3.6:
An unverifiable transaction is to a third-party host if its request-
host U does not domain-match the reach R of the request-host O in the
origin transaction. | [] | def is_third_party(request):
"""
RFC 2965, section 3.3.6:
An unverifiable transaction is to a third-party host if its request-
host U does not domain-match the reach R of the request-host O in the
origin transaction.
"""
req_host = request_host(request)
if not domain_match... | [
"def",
"is_third_party",
"(",
"request",
")",
":",
"req_host",
"=",
"request_host",
"(",
"request",
")",
"if",
"not",
"domain_match",
"(",
"req_host",
",",
"reach",
"(",
"request",
".",
"get_origin_req_host",
"(",
")",
")",
")",
":",
"return",
"True",
"els... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/cookielib.py#L690-L704 | |||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/contextlib.py | python | AbstractContextManager.__enter__ | (self) | return self | Return `self` upon entering the runtime context. | Return `self` upon entering the runtime context. | [
"Return",
"self",
"upon",
"entering",
"the",
"runtime",
"context",
"."
] | def __enter__(self):
"""Return `self` upon entering the runtime context."""
return self | [
"def",
"__enter__",
"(",
"self",
")",
":",
"return",
"self"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/contextlib.py#L21-L23 | |
ucsb-seclab/difuze | bb59a12ff87ad5ae45d9c60e349891bf80d72877 | helper_scripts/components/bear_parse_headers.py | python | BearParseHeaders.setup | (self) | return None | Perform setup.
:return: Error msg or none | Perform setup.
:return: Error msg or none | [
"Perform",
"setup",
".",
":",
"return",
":",
"Error",
"msg",
"or",
"none"
] | def setup(self):
"""
Perform setup.
:return: Error msg or none
"""
if not os.path.exists(self.c2xml_path):
return "Provided c2xml path:" + str(self.c2xml_path) + " does not exist."
if not os.path.isdir(self.kernel_src_dir) or not os.path.isdir(os.path.join... | [
"def",
"setup",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"c2xml_path",
")",
":",
"return",
"\"Provided c2xml path:\"",
"+",
"str",
"(",
"self",
".",
"c2xml_path",
")",
"+",
"\" does not exist.\"",
"if",
"not... | https://github.com/ucsb-seclab/difuze/blob/bb59a12ff87ad5ae45d9c60e349891bf80d72877/helper_scripts/components/bear_parse_headers.py#L37-L50 | |
protocolbuffers/protobuf | b5ab0b7a18b7336c60130f4ddb2d97c51792f896 | python/google/protobuf/descriptor_pool.py | python | DescriptorPool.FindExtensionByName | (self, full_name) | return scope.extensions_by_name[extension_name] | Loads the named extension descriptor from the pool.
Args:
full_name (str): The full name of the extension descriptor to load.
Returns:
FieldDescriptor: The field descriptor for the named extension.
Raises:
KeyError: if the extension cannot be found in the pool. | Loads the named extension descriptor from the pool. | [
"Loads",
"the",
"named",
"extension",
"descriptor",
"from",
"the",
"pool",
"."
] | def FindExtensionByName(self, full_name):
"""Loads the named extension descriptor from the pool.
Args:
full_name (str): The full name of the extension descriptor to load.
Returns:
FieldDescriptor: The field descriptor for the named extension.
Raises:
KeyError: if the extension canno... | [
"def",
"FindExtensionByName",
"(",
"self",
",",
"full_name",
")",
":",
"full_name",
"=",
"_NormalizeFullyQualifiedName",
"(",
"full_name",
")",
"try",
":",
"# The proto compiler does not give any link between the FileDescriptor",
"# and top-level extensions unless the FileDescripto... | https://github.com/protocolbuffers/protobuf/blob/b5ab0b7a18b7336c60130f4ddb2d97c51792f896/python/google/protobuf/descriptor_pool.py#L571-L599 | |
gnina/gnina | b9ae032f52fc7a8153987bde09c0efa3620d8bb6 | caffe/python/caffe/pycaffe.py | python | _Net_set_input_arrays | (self, data, labels) | return self._set_input_arrays(data, labels) | Set input arrays of the in-memory MemoryDataLayer.
(Note: this is only for networks declared with the memory data layer.) | Set input arrays of the in-memory MemoryDataLayer.
(Note: this is only for networks declared with the memory data layer.) | [
"Set",
"input",
"arrays",
"of",
"the",
"in",
"-",
"memory",
"MemoryDataLayer",
".",
"(",
"Note",
":",
"this",
"is",
"only",
"for",
"networks",
"declared",
"with",
"the",
"memory",
"data",
"layer",
".",
")"
] | def _Net_set_input_arrays(self, data, labels):
"""
Set input arrays of the in-memory MemoryDataLayer.
(Note: this is only for networks declared with the memory data layer.)
"""
if labels.ndim == 1:
labels = np.ascontiguousarray(labels[:, np.newaxis, np.newaxis,
... | [
"def",
"_Net_set_input_arrays",
"(",
"self",
",",
"data",
",",
"labels",
")",
":",
"if",
"labels",
".",
"ndim",
"==",
"1",
":",
"labels",
"=",
"np",
".",
"ascontiguousarray",
"(",
"labels",
"[",
":",
",",
"np",
".",
"newaxis",
",",
"np",
".",
"newaxi... | https://github.com/gnina/gnina/blob/b9ae032f52fc7a8153987bde09c0efa3620d8bb6/caffe/python/caffe/pycaffe.py#L261-L269 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/lmbrwaflib/msvs.py | python | msvs_generator.get_compatible_platform_to_toolset_maps | (self, msvs_version, restricted_platforms) | return compatible_platforms_map, ms_toolset_to_platform_map | :param msvs_version:
:param platform_toolset:
:return: | [] | def get_compatible_platform_to_toolset_maps(self, msvs_version, restricted_platforms):
"""
:param msvs_version:
:param platform_toolset:
:return:
"""
# Go through the list of enabled platforms and track which ones 'compatible' toolsets apply to the current toolset
... | [
"def",
"get_compatible_platform_to_toolset_maps",
"(",
"self",
",",
"msvs_version",
",",
"restricted_platforms",
")",
":",
"# Go through the list of enabled platforms and track which ones 'compatible' toolsets apply to the current toolset",
"compatible_platforms_map",
"=",
"{",
"}",
"m... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/lmbrwaflib/msvs.py#L1735-L1775 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_txt.py | python | FileLoadEvent.GetProgress | (self) | return self._prog | Get the current progress of the load | Get the current progress of the load | [
"Get",
"the",
"current",
"progress",
"of",
"the",
"load"
] | def GetProgress(self):
"""Get the current progress of the load"""
return self._prog | [
"def",
"GetProgress",
"(",
"self",
")",
":",
"return",
"self",
".",
"_prog"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_txt.py#L634-L636 | |
BVLC/caffe | 9b891540183ddc834a02b2bd81b31afae71b2153 | scripts/cpp_lint.py | python | _ClassifyInclude | (fileinfo, include, is_system) | return _OTHER_HEADER | Figures out what kind of header 'include' is.
Args:
fileinfo: The current file cpplint is running over. A FileInfo instance.
include: The path to a #included file.
is_system: True if the #include used <> rather than "".
Returns:
One of the _XXX_HEADER constants.
For example:
>>> _ClassifyIn... | Figures out what kind of header 'include' is. | [
"Figures",
"out",
"what",
"kind",
"of",
"header",
"include",
"is",
"."
] | def _ClassifyInclude(fileinfo, include, is_system):
"""Figures out what kind of header 'include' is.
Args:
fileinfo: The current file cpplint is running over. A FileInfo instance.
include: The path to a #included file.
is_system: True if the #include used <> rather than "".
Returns:
One of the _... | [
"def",
"_ClassifyInclude",
"(",
"fileinfo",
",",
"include",
",",
"is_system",
")",
":",
"# This is a list of all standard c++ header files, except",
"# those already checked for above.",
"is_cpp_h",
"=",
"include",
"in",
"_CPP_HEADERS",
"if",
"is_system",
":",
"if",
"is_cpp... | https://github.com/BVLC/caffe/blob/9b891540183ddc834a02b2bd81b31afae71b2153/scripts/cpp_lint.py#L3624-L3680 | |
KhronosGroup/SPIRV-LLVM | 1eb85593f3fe2c39379b9a9b088d51eda4f42b8b | utils/llvm-build/llvmbuild/main.py | python | LLVMProjectInfo.write_cmake_fragment | (self, output_path, enabled_optional_components) | write_cmake_fragment(output_path) -> None
Generate a CMake fragment which includes all of the collated LLVMBuild
information in a format that is easily digestible by a CMake. The exact
contents of this are closely tied to how the CMake configuration
integrates LLVMBuild, see CMakeLists.... | write_cmake_fragment(output_path) -> None | [
"write_cmake_fragment",
"(",
"output_path",
")",
"-",
">",
"None"
] | def write_cmake_fragment(self, output_path, enabled_optional_components):
"""
write_cmake_fragment(output_path) -> None
Generate a CMake fragment which includes all of the collated LLVMBuild
information in a format that is easily digestible by a CMake. The exact
contents of this... | [
"def",
"write_cmake_fragment",
"(",
"self",
",",
"output_path",
",",
"enabled_optional_components",
")",
":",
"dependencies",
"=",
"list",
"(",
"self",
".",
"get_fragment_dependencies",
"(",
")",
")",
"# Write out the CMake fragment.",
"make_install_dir",
"(",
"os",
"... | https://github.com/KhronosGroup/SPIRV-LLVM/blob/1eb85593f3fe2c39379b9a9b088d51eda4f42b8b/utils/llvm-build/llvmbuild/main.py#L504-L588 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/_pyio.py | python | IOBase.truncate | (self, pos=None) | Truncate file to size bytes.
Size defaults to the current IO position as reported by tell(). Return
the new size. | Truncate file to size bytes. | [
"Truncate",
"file",
"to",
"size",
"bytes",
"."
] | def truncate(self, pos=None):
"""Truncate file to size bytes.
Size defaults to the current IO position as reported by tell(). Return
the new size.
"""
self._unsupported("truncate") | [
"def",
"truncate",
"(",
"self",
",",
"pos",
"=",
"None",
")",
":",
"self",
".",
"_unsupported",
"(",
"\"truncate\"",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/_pyio.py#L317-L323 | ||
vnpy/vnpy | f50f2535ed39dd33272e0985ed40c7078e4c19f6 | vnpy/event/engine.py | python | EventEngine.put | (self, event: Event) | Put an event object into event queue. | Put an event object into event queue. | [
"Put",
"an",
"event",
"object",
"into",
"event",
"queue",
"."
] | def put(self, event: Event) -> None:
"""
Put an event object into event queue.
"""
self._queue.put(event) | [
"def",
"put",
"(",
"self",
",",
"event",
":",
"Event",
")",
"->",
"None",
":",
"self",
".",
"_queue",
".",
"put",
"(",
"event",
")"
] | https://github.com/vnpy/vnpy/blob/f50f2535ed39dd33272e0985ed40c7078e4c19f6/vnpy/event/engine.py#L103-L107 | ||
stitchEm/stitchEm | 0f399501d41ab77933677f2907f41f80ceb704d7 | lib/bindings/samples/server/output/output.py | python | WriterOutput._load_preset | (self, preset=None, preserve=False) | Creates configuration object based on the default preset and the given one if present
Args:
preset: | Creates configuration object based on the default preset and the given one if present | [
"Creates",
"configuration",
"object",
"based",
"on",
"the",
"default",
"preset",
"and",
"the",
"given",
"one",
"if",
"present"
] | def _load_preset(self, preset=None, preserve=False):
"""Creates configuration object based on the default preset and the given one if present
Args:
preset:
"""
if SETTINGS.ptv is not None:
preset_ptv = PTV.from_file(SETTINGS.ptv)
self.ptv = PTV(preset... | [
"def",
"_load_preset",
"(",
"self",
",",
"preset",
"=",
"None",
",",
"preserve",
"=",
"False",
")",
":",
"if",
"SETTINGS",
".",
"ptv",
"is",
"not",
"None",
":",
"preset_ptv",
"=",
"PTV",
".",
"from_file",
"(",
"SETTINGS",
".",
"ptv",
")",
"self",
"."... | https://github.com/stitchEm/stitchEm/blob/0f399501d41ab77933677f2907f41f80ceb704d7/lib/bindings/samples/server/output/output.py#L153-L187 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/boost/boost_1_68_0/tools/build/src/build/targets.py | python | TargetRegistry.main_target_sources | (self, sources, main_target_name, no_renaming=0) | return result | Return the list of sources to use, if main target rule is invoked
with 'sources'. If there are any objects in 'sources', they are treated
as main target instances, and the name of such targets are adjusted to
be '<name_of_this_target>__<name_of_source_target>'. Such renaming
is disabled ... | Return the list of sources to use, if main target rule is invoked
with 'sources'. If there are any objects in 'sources', they are treated
as main target instances, and the name of such targets are adjusted to
be '<name_of_this_target>__<name_of_source_target>'. Such renaming
is disabled ... | [
"Return",
"the",
"list",
"of",
"sources",
"to",
"use",
"if",
"main",
"target",
"rule",
"is",
"invoked",
"with",
"sources",
".",
"If",
"there",
"are",
"any",
"objects",
"in",
"sources",
"they",
"are",
"treated",
"as",
"main",
"target",
"instances",
"and",
... | def main_target_sources (self, sources, main_target_name, no_renaming=0):
"""Return the list of sources to use, if main target rule is invoked
with 'sources'. If there are any objects in 'sources', they are treated
as main target instances, and the name of such targets are adjusted to
be... | [
"def",
"main_target_sources",
"(",
"self",
",",
"sources",
",",
"main_target_name",
",",
"no_renaming",
"=",
"0",
")",
":",
"assert",
"is_iterable_typed",
"(",
"sources",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"main_target_name",
",",
"basestring",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/boost/boost_1_68_0/tools/build/src/build/targets.py#L115-L145 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/dataview.py | python | DataViewTreeStore.AppendItem | (*args, **kwargs) | return _dataview.DataViewTreeStore_AppendItem(*args, **kwargs) | AppendItem(self, DataViewItem parent, String text, Icon icon=wxNullIcon,
wxClientData data=None) -> DataViewItem | AppendItem(self, DataViewItem parent, String text, Icon icon=wxNullIcon,
wxClientData data=None) -> DataViewItem | [
"AppendItem",
"(",
"self",
"DataViewItem",
"parent",
"String",
"text",
"Icon",
"icon",
"=",
"wxNullIcon",
"wxClientData",
"data",
"=",
"None",
")",
"-",
">",
"DataViewItem"
] | def AppendItem(*args, **kwargs):
"""
AppendItem(self, DataViewItem parent, String text, Icon icon=wxNullIcon,
wxClientData data=None) -> DataViewItem
"""
return _dataview.DataViewTreeStore_AppendItem(*args, **kwargs) | [
"def",
"AppendItem",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewTreeStore_AppendItem",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/dataview.py#L2361-L2366 | |
Ardour/ardour | a63a18a3387b90c0920d9b1668d2a50bd6302b83 | tools/misc.py | python | copy_attrs | (orig, dest, names, only_if_set=False) | copy class attributes from an object to another | copy class attributes from an object to another | [
"copy",
"class",
"attributes",
"from",
"an",
"object",
"to",
"another"
] | def copy_attrs(orig, dest, names, only_if_set=False):
"""
copy class attributes from an object to another
"""
for a in Utils.to_list(names):
u = getattr(orig, a, ())
if u or not only_if_set:
setattr(dest, a, u) | [
"def",
"copy_attrs",
"(",
"orig",
",",
"dest",
",",
"names",
",",
"only_if_set",
"=",
"False",
")",
":",
"for",
"a",
"in",
"Utils",
".",
"to_list",
"(",
"names",
")",
":",
"u",
"=",
"getattr",
"(",
"orig",
",",
"a",
",",
"(",
")",
")",
"if",
"u... | https://github.com/Ardour/ardour/blob/a63a18a3387b90c0920d9b1668d2a50bd6302b83/tools/misc.py#L19-L26 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/indexes/multi.py | python | MultiIndex._to_safe_for_reshape | (self) | return self.set_levels([i._to_safe_for_reshape() for i in self.levels]) | convert to object if we are a categorical | convert to object if we are a categorical | [
"convert",
"to",
"object",
"if",
"we",
"are",
"a",
"categorical"
] | def _to_safe_for_reshape(self):
""" convert to object if we are a categorical """
return self.set_levels([i._to_safe_for_reshape() for i in self.levels]) | [
"def",
"_to_safe_for_reshape",
"(",
"self",
")",
":",
"return",
"self",
".",
"set_levels",
"(",
"[",
"i",
".",
"_to_safe_for_reshape",
"(",
")",
"for",
"i",
"in",
"self",
".",
"levels",
"]",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/indexes/multi.py#L1425-L1427 | |
raspberrypi/tools | 13474ee775d0c5ec8a7da4fb0a9fa84187abfc87 | arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/share/gdb/python/gdb/printing.py | python | register_pretty_printer | (obj, printer, replace=False) | Register pretty-printer PRINTER with OBJ.
The printer is added to the front of the search list, thus one can override
an existing printer if one needs to. Use a different name when overriding
an existing printer, otherwise an exception will be raised; multiple
printers with the same name are disallowe... | Register pretty-printer PRINTER with OBJ. | [
"Register",
"pretty",
"-",
"printer",
"PRINTER",
"with",
"OBJ",
"."
] | def register_pretty_printer(obj, printer, replace=False):
"""Register pretty-printer PRINTER with OBJ.
The printer is added to the front of the search list, thus one can override
an existing printer if one needs to. Use a different name when overriding
an existing printer, otherwise an exception will ... | [
"def",
"register_pretty_printer",
"(",
"obj",
",",
"printer",
",",
"replace",
"=",
"False",
")",
":",
"# Watch for both __name__ and name.",
"# Functions get the former for free, but we don't want to use an",
"# attribute named __foo__ for pretty-printers-as-objects.",
"# If printer ha... | https://github.com/raspberrypi/tools/blob/13474ee775d0c5ec8a7da4fb0a9fa84187abfc87/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/share/gdb/python/gdb/printing.py#L76-L149 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Arch/importIFClegacy.py | python | IfcWriter.addExtrudedEllipse | (self,data,extrusion,placement=None,color=None) | return exp | addExtrudedEllipse(data,extrusion,[placement,color]): makes an extruded ellipse
from the given data (center,radiusx,radiusy) and the given extrusion vector | addExtrudedEllipse(data,extrusion,[placement,color]): makes an extruded ellipse
from the given data (center,radiusx,radiusy) and the given extrusion vector | [
"addExtrudedEllipse",
"(",
"data",
"extrusion",
"[",
"placement",
"color",
"]",
")",
":",
"makes",
"an",
"extruded",
"ellipse",
"from",
"the",
"given",
"data",
"(",
"center",
"radiusx",
"radiusy",
")",
"and",
"the",
"given",
"extrusion",
"vector"
] | def addExtrudedEllipse(self,data,extrusion,placement=None,color=None):
"""addExtrudedEllipse(data,extrusion,[placement,color]): makes an extruded ellipse
from the given data (center,radiusx,radiusy) and the given extrusion vector"""
cir = self.addProfile("IfcEllipseProfileDef",[data[1],data[2]])... | [
"def",
"addExtrudedEllipse",
"(",
"self",
",",
"data",
",",
"extrusion",
",",
"placement",
"=",
"None",
",",
"color",
"=",
"None",
")",
":",
"cir",
"=",
"self",
".",
"addProfile",
"(",
"\"IfcEllipseProfileDef\"",
",",
"[",
"data",
"[",
"1",
"]",
",",
"... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Arch/importIFClegacy.py#L2297-L2306 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozbuild/makeutil.py | python | Rule.add_dependencies | (self, deps) | return self | Add dependencies to the rule. | Add dependencies to the rule. | [
"Add",
"dependencies",
"to",
"the",
"rule",
"."
] | def add_dependencies(self, deps):
'''Add dependencies to the rule.'''
assert isinstance(deps, Iterable) and not isinstance(deps, StringTypes)
self._dependencies.update(deps)
return self | [
"def",
"add_dependencies",
"(",
"self",
",",
"deps",
")",
":",
"assert",
"isinstance",
"(",
"deps",
",",
"Iterable",
")",
"and",
"not",
"isinstance",
"(",
"deps",
",",
"StringTypes",
")",
"self",
".",
"_dependencies",
".",
"update",
"(",
"deps",
")",
"re... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozbuild/makeutil.py#L108-L112 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/grit/grit/format/policy_templates/writers/admx_writer.py | python | ADMXWriter._AddListPolicy | (self, parent, key, name) | Generates ADMX XML elements for a List-Policy and adds them to the
passed parent element. | Generates ADMX XML elements for a List-Policy and adds them to the
passed parent element. | [
"Generates",
"ADMX",
"XML",
"elements",
"for",
"a",
"List",
"-",
"Policy",
"and",
"adds",
"them",
"to",
"the",
"passed",
"parent",
"element",
"."
] | def _AddListPolicy(self, parent, key, name):
'''Generates ADMX XML elements for a List-Policy and adds them to the
passed parent element.
'''
attributes = {
# The ID must be in sync with ID of the corresponding element in the ADML
# file.
'id': name + 'Desc',
'valuePrefix': '',
... | [
"def",
"_AddListPolicy",
"(",
"self",
",",
"parent",
",",
"key",
",",
"name",
")",
":",
"attributes",
"=",
"{",
"# The ID must be in sync with ID of the corresponding element in the ADML",
"# file.",
"'id'",
":",
"name",
"+",
"'Desc'",
",",
"'valuePrefix'",
":",
"''... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/grit/grit/format/policy_templates/writers/admx_writer.py#L207-L218 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/cython/Cython/Compiler/Nodes.py | python | ParallelStatNode.analyse_sharing_attributes | (self, env) | Analyse the privates for this block and set them in self.privates.
This should be called in a post-order fashion during the
analyse_expressions phase | Analyse the privates for this block and set them in self.privates.
This should be called in a post-order fashion during the
analyse_expressions phase | [
"Analyse",
"the",
"privates",
"for",
"this",
"block",
"and",
"set",
"them",
"in",
"self",
".",
"privates",
".",
"This",
"should",
"be",
"called",
"in",
"a",
"post",
"-",
"order",
"fashion",
"during",
"the",
"analyse_expressions",
"phase"
] | def analyse_sharing_attributes(self, env):
"""
Analyse the privates for this block and set them in self.privates.
This should be called in a post-order fashion during the
analyse_expressions phase
"""
for entry, (pos, op) in self.assignments.items():
if self.... | [
"def",
"analyse_sharing_attributes",
"(",
"self",
",",
"env",
")",
":",
"for",
"entry",
",",
"(",
"pos",
",",
"op",
")",
"in",
"self",
".",
"assignments",
".",
"items",
"(",
")",
":",
"if",
"self",
".",
"is_prange",
"and",
"not",
"self",
".",
"is_par... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/cython/Cython/Compiler/Nodes.py#L8293-L8317 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | ConfigBase.IsRecordingDefaults | (*args, **kwargs) | return _misc_.ConfigBase_IsRecordingDefaults(*args, **kwargs) | IsRecordingDefaults(self) -> bool
Are we currently recording default values? | IsRecordingDefaults(self) -> bool | [
"IsRecordingDefaults",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsRecordingDefaults(*args, **kwargs):
"""
IsRecordingDefaults(self) -> bool
Are we currently recording default values?
"""
return _misc_.ConfigBase_IsRecordingDefaults(*args, **kwargs) | [
"def",
"IsRecordingDefaults",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"ConfigBase_IsRecordingDefaults",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L3397-L3403 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | DC.GetSizeTuple | (*args, **kwargs) | return _gdi_.DC_GetSizeTuple(*args, **kwargs) | GetSizeTuple() -> (width, height)
This gets the horizontal and vertical resolution in device units. It
can be used to scale graphics to fit the page. For example, if *maxX*
and *maxY* represent the maximum horizontal and vertical 'pixel' values
used in your application, the following co... | GetSizeTuple() -> (width, height) | [
"GetSizeTuple",
"()",
"-",
">",
"(",
"width",
"height",
")"
] | def GetSizeTuple(*args, **kwargs):
"""
GetSizeTuple() -> (width, height)
This gets the horizontal and vertical resolution in device units. It
can be used to scale graphics to fit the page. For example, if *maxX*
and *maxY* represent the maximum horizontal and vertical 'pixel' va... | [
"def",
"GetSizeTuple",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"DC_GetSizeTuple",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L4270-L4286 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/datetime.py | python | _is_leap | (year) | return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) | year -> 1 if leap year, else 0. | year -> 1 if leap year, else 0. | [
"year",
"-",
">",
"1",
"if",
"leap",
"year",
"else",
"0",
"."
] | def _is_leap(year):
"year -> 1 if leap year, else 0."
return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) | [
"def",
"_is_leap",
"(",
"year",
")",
":",
"return",
"year",
"%",
"4",
"==",
"0",
"and",
"(",
"year",
"%",
"100",
"!=",
"0",
"or",
"year",
"%",
"400",
"==",
"0",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/datetime.py#L37-L39 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Window.Create | (*args, **kwargs) | return _core_.Window_Create(*args, **kwargs) | Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=0, String name=PanelNameStr) -> bool
Create the GUI part of the Window for 2-phase creation mode. | Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=0, String name=PanelNameStr) -> bool | [
"Create",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"0",
"String",
"name",
"=",
"PanelNameStr",
")",
"-",
">",
"bool"
] | def Create(*args, **kwargs):
"""
Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=0, String name=PanelNameStr) -> bool
Create the GUI part of the Window for 2-phase creation mode.
"""
return _core_.Window_Create(*ar... | [
"def",
"Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L9148-L9155 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/utils/qt/qappthreadcall.py | python | QAppThreadCall._ensure_self_on_qapp_thread | (self) | Assuming the QApplication instance exists, ensure this object is on
that thread | Assuming the QApplication instance exists, ensure this object is on
that thread | [
"Assuming",
"the",
"QApplication",
"instance",
"exists",
"ensure",
"this",
"object",
"is",
"on",
"that",
"thread"
] | def _ensure_self_on_qapp_thread(self):
"""Assuming the QApplication instance exists, ensure this object is on
that thread"""
if self._moved_to_app:
return
self.moveToThread(QApplication.instance().thread())
self._moved_to_app = True | [
"def",
"_ensure_self_on_qapp_thread",
"(",
"self",
")",
":",
"if",
"self",
".",
"_moved_to_app",
":",
"return",
"self",
".",
"moveToThread",
"(",
"QApplication",
".",
"instance",
"(",
")",
".",
"thread",
"(",
")",
")",
"self",
".",
"_moved_to_app",
"=",
"T... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/utils/qt/qappthreadcall.py#L69-L76 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | DC.GetPixelPoint | (*args, **kwargs) | return _gdi_.DC_GetPixelPoint(*args, **kwargs) | GetPixelPoint(self, Point pt) -> Colour | GetPixelPoint(self, Point pt) -> Colour | [
"GetPixelPoint",
"(",
"self",
"Point",
"pt",
")",
"-",
">",
"Colour"
] | def GetPixelPoint(*args, **kwargs):
"""GetPixelPoint(self, Point pt) -> Colour"""
return _gdi_.DC_GetPixelPoint(*args, **kwargs) | [
"def",
"GetPixelPoint",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"DC_GetPixelPoint",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L3402-L3404 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/model_fitting/model_fitting_view.py | python | ModelFittingView.set_selected_y_parameter | (self, y_parameter: str) | Sets the selected Y parameter. | Sets the selected Y parameter. | [
"Sets",
"the",
"selected",
"Y",
"parameter",
"."
] | def set_selected_y_parameter(self, y_parameter: str) -> None:
"""Sets the selected Y parameter."""
self.model_fitting_data_selector.set_selected_y_parameter(y_parameter) | [
"def",
"set_selected_y_parameter",
"(",
"self",
",",
"y_parameter",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"model_fitting_data_selector",
".",
"set_selected_y_parameter",
"(",
"y_parameter",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/model_fitting/model_fitting_view.py#L69-L71 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/gluon/contrib/estimator/estimator.py | python | Estimator.fit | (self, train_data,
val_data=None,
epochs=None,
event_handlers=None,
batches=None,
batch_axis=0) | Trains the model with a given :py:class:`DataLoader` for a specified
number of epochs or batches. The batch size is inferred from the
data loader's batch_size.
Parameters
----------
train_data : DataLoader
Training data loader with data and labels.
val_data :... | Trains the model with a given :py:class:`DataLoader` for a specified
number of epochs or batches. The batch size is inferred from the
data loader's batch_size. | [
"Trains",
"the",
"model",
"with",
"a",
"given",
":",
"py",
":",
"class",
":",
"DataLoader",
"for",
"a",
"specified",
"number",
"of",
"epochs",
"or",
"batches",
".",
"The",
"batch",
"size",
"is",
"inferred",
"from",
"the",
"data",
"loader",
"s",
"batch_si... | def fit(self, train_data,
val_data=None,
epochs=None,
event_handlers=None,
batches=None,
batch_axis=0):
"""Trains the model with a given :py:class:`DataLoader` for a specified
number of epochs or batches. The batch size is inferred from the
... | [
"def",
"fit",
"(",
"self",
",",
"train_data",
",",
"val_data",
"=",
"None",
",",
"epochs",
"=",
"None",
",",
"event_handlers",
"=",
"None",
",",
"batches",
"=",
"None",
",",
"batch_axis",
"=",
"0",
")",
":",
"if",
"not",
"isinstance",
"(",
"train_data"... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/gluon/contrib/estimator/estimator.py#L230-L326 | ||
RoboJackets/robocup-software | bce13ce53ddb2ecb9696266d980722c34617dc15 | util/run-cmake-format.py | python | run_format | (args, file_queue, lock, return_codes) | Takes filenames out of queue and runs clang-format on them. | Takes filenames out of queue and runs clang-format on them. | [
"Takes",
"filenames",
"out",
"of",
"queue",
"and",
"runs",
"clang",
"-",
"format",
"on",
"them",
"."
] | def run_format(args, file_queue, lock, return_codes):
"""Takes filenames out of queue and runs clang-format on them."""
while True:
name = file_queue.get()
invocation = get_format_invocation(name, args.cmake_format_binary, args.check)
proc = subprocess.Popen(
invocation, std... | [
"def",
"run_format",
"(",
"args",
",",
"file_queue",
",",
"lock",
",",
"return_codes",
")",
":",
"while",
"True",
":",
"name",
"=",
"file_queue",
".",
"get",
"(",
")",
"invocation",
"=",
"get_format_invocation",
"(",
"name",
",",
"args",
".",
"cmake_format... | https://github.com/RoboJackets/robocup-software/blob/bce13ce53ddb2ecb9696266d980722c34617dc15/util/run-cmake-format.py#L21-L37 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | build/upload.py | python | AppendOptionalArgsToSSHCommandline | (cmdline, port, ssh_key) | Given optional port and ssh key values, append valid OpenSSH
commandline arguments to the list cmdline if the values are not None. | Given optional port and ssh key values, append valid OpenSSH
commandline arguments to the list cmdline if the values are not None. | [
"Given",
"optional",
"port",
"and",
"ssh",
"key",
"values",
"append",
"valid",
"OpenSSH",
"commandline",
"arguments",
"to",
"the",
"list",
"cmdline",
"if",
"the",
"values",
"are",
"not",
"None",
"."
] | def AppendOptionalArgsToSSHCommandline(cmdline, port, ssh_key):
"""Given optional port and ssh key values, append valid OpenSSH
commandline arguments to the list cmdline if the values are not None."""
if port is not None:
cmdline.append("-P%d" % port)
if ssh_key is not None:
# Don't inte... | [
"def",
"AppendOptionalArgsToSSHCommandline",
"(",
"cmdline",
",",
"port",
",",
"ssh_key",
")",
":",
"if",
"port",
"is",
"not",
"None",
":",
"cmdline",
".",
"append",
"(",
"\"-P%d\"",
"%",
"port",
")",
"if",
"ssh_key",
"is",
"not",
"None",
":",
"# Don't int... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/build/upload.py#L68-L77 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/logging_ops.py | python | get_summary_op | () | return summary_op | Returns a single Summary op that would run all summaries.
Either existing one from `SUMMARY_OP` collection or merges all existing
summaries.
Returns:
If no summaries were collected, returns None. Otherwise returns a scalar
`Tensor` of type `string` containing the serialized `Summary` protocol
buffer... | Returns a single Summary op that would run all summaries. | [
"Returns",
"a",
"single",
"Summary",
"op",
"that",
"would",
"run",
"all",
"summaries",
"."
] | def get_summary_op():
"""Returns a single Summary op that would run all summaries.
Either existing one from `SUMMARY_OP` collection or merges all existing
summaries.
Returns:
If no summaries were collected, returns None. Otherwise returns a scalar
`Tensor` of type `string` containing the serialized `S... | [
"def",
"get_summary_op",
"(",
")",
":",
"summary_op",
"=",
"ops",
".",
"get_collection",
"(",
"ops",
".",
"GraphKeys",
".",
"SUMMARY_OP",
")",
"if",
"summary_op",
"is",
"not",
"None",
":",
"if",
"summary_op",
":",
"summary_op",
"=",
"summary_op",
"[",
"0",... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/logging_ops.py#L292-L313 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/util/runcommand.py | python | RunCommand.execute | (self) | return error_code, output | Execute 'cmd' and return err_code and output. | Execute 'cmd' and return err_code and output. | [
"Execute",
"cmd",
"and",
"return",
"err_code",
"and",
"output",
"."
] | def execute(self):
"""Execute 'cmd' and return err_code and output."""
self._process = subprocess.Popen(self._cmd_list(), stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, **self._preexec_kargs)
output, _ = self._process.communicate()
error_code =... | [
"def",
"execute",
"(",
"self",
")",
":",
"self",
".",
"_process",
"=",
"subprocess",
".",
"Popen",
"(",
"self",
".",
"_cmd_list",
"(",
")",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"subprocess",
".",
"STDOUT",
",",
"*",
"*",... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/util/runcommand.py#L52-L58 | |
Caffe-MPI/Caffe-MPI.github.io | df5992af571a2a19981b69635115c393f18d1c76 | scripts/cpp_lint.py | python | CheckForHeaderGuard | (filename, lines, error) | Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used.
Args:
filename: The name of the C++ header file.
lines: An array of strings, each representing a line of the file.
error: The function to call... | Checks that the file contains a header guard. | [
"Checks",
"that",
"the",
"file",
"contains",
"a",
"header",
"guard",
"."
] | def CheckForHeaderGuard(filename, lines, error):
"""Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used.
Args:
filename: The name of the C++ header file.
lines: An array of strings, each representi... | [
"def",
"CheckForHeaderGuard",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"cppvar",
"=",
"GetHeaderGuardCPPVariable",
"(",
"filename",
")",
"ifndef",
"=",
"None",
"ifndef_linenum",
"=",
"0",
"define",
"=",
"None",
"endif",
"=",
"None",
"endif_linenu... | https://github.com/Caffe-MPI/Caffe-MPI.github.io/blob/df5992af571a2a19981b69635115c393f18d1c76/scripts/cpp_lint.py#L1408-L1480 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/build/unix/build-clang/tooltool.py | python | process_command | (options, args) | I know how to take a list of program arguments and
start doing the right thing with them | I know how to take a list of program arguments and
start doing the right thing with them | [
"I",
"know",
"how",
"to",
"take",
"a",
"list",
"of",
"program",
"arguments",
"and",
"start",
"doing",
"the",
"right",
"thing",
"with",
"them"
] | def process_command(options, args):
""" I know how to take a list of program arguments and
start doing the right thing with them"""
cmd = args[0]
cmd_args = args[1:]
log.debug("processing '%s' command with args '%s'" % (cmd, '", "'.join(cmd_args)))
log.debug("using options: %s" % options)
if... | [
"def",
"process_command",
"(",
"options",
",",
"args",
")",
":",
"cmd",
"=",
"args",
"[",
"0",
"]",
"cmd_args",
"=",
"args",
"[",
"1",
":",
"]",
"log",
".",
"debug",
"(",
"\"processing '%s' command with args '%s'\"",
"%",
"(",
"cmd",
",",
"'\", \"'",
"."... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/build/unix/build-clang/tooltool.py#L450-L470 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/mplgraphicsview.py | python | MyNavigationToolbar.release_zoom | (self, event) | return | override zoom released method
Parameters
----------
event
Returns
------- | override zoom released method
Parameters
----------
event | [
"override",
"zoom",
"released",
"method",
"Parameters",
"----------",
"event"
] | def release_zoom(self, event):
"""
override zoom released method
Parameters
----------
event
Returns
-------
"""
self.canvas_zoom_released.emit()
NavigationToolbar2.release_zoom(self, event)
return | [
"def",
"release_zoom",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"canvas_zoom_released",
".",
"emit",
"(",
")",
"NavigationToolbar2",
".",
"release_zoom",
"(",
"self",
",",
"event",
")",
"return"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/mplgraphicsview.py#L1915-L1930 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/train/summary/_writer_pool.py | python | _pack_data | (datadict, wall_time) | return result | Pack data according to which plugin. | Pack data according to which plugin. | [
"Pack",
"data",
"according",
"to",
"which",
"plugin",
"."
] | def _pack_data(datadict, wall_time):
"""Pack data according to which plugin."""
result, summaries, step = [], [], None
for plugin, datalist in datadict.items():
for data in datalist:
if plugin == PluginEnum.GRAPH.value:
result.append([plugin, package_graph_event(data.get(... | [
"def",
"_pack_data",
"(",
"datadict",
",",
"wall_time",
")",
":",
"result",
",",
"summaries",
",",
"step",
"=",
"[",
"]",
",",
"[",
"]",
",",
"None",
"for",
"plugin",
",",
"datalist",
"in",
"datadict",
".",
"items",
"(",
")",
":",
"for",
"data",
"i... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/train/summary/_writer_pool.py#L38-L59 | |
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/service/read/gamedata.py | python | load_gamespec | (fileobj, game_version, cachefile_name=None, load_cache=False) | return gamespec | Helper method that loads the contents of a 'empires.dat' gzipped wrapper
file.
If cachefile_name is given, this file is consulted before performing the
load. | Helper method that loads the contents of a 'empires.dat' gzipped wrapper
file. | [
"Helper",
"method",
"that",
"loads",
"the",
"contents",
"of",
"a",
"empires",
".",
"dat",
"gzipped",
"wrapper",
"file",
"."
] | def load_gamespec(fileobj, game_version, cachefile_name=None, load_cache=False):
"""
Helper method that loads the contents of a 'empires.dat' gzipped wrapper
file.
If cachefile_name is given, this file is consulted before performing the
load.
"""
# try to use the cached result from a previo... | [
"def",
"load_gamespec",
"(",
"fileobj",
",",
"game_version",
",",
"cachefile_name",
"=",
"None",
",",
"load_cache",
"=",
"False",
")",
":",
"# try to use the cached result from a previous run",
"if",
"cachefile_name",
"and",
"load_cache",
":",
"try",
":",
"with",
"o... | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/service/read/gamedata.py#L45-L96 | |
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/physics/sNMR/mrs.py | python | MRS.loadZVector | (self, filename='zkernel.vec') | Load the kernel vertical discretisation (z) vector. | Load the kernel vertical discretisation (z) vector. | [
"Load",
"the",
"kernel",
"vertical",
"discretisation",
"(",
"z",
")",
"vector",
"."
] | def loadZVector(self, filename='zkernel.vec'):
"""Load the kernel vertical discretisation (z) vector."""
self.z = pg.Vector(filename) | [
"def",
"loadZVector",
"(",
"self",
",",
"filename",
"=",
"'zkernel.vec'",
")",
":",
"self",
".",
"z",
"=",
"pg",
".",
"Vector",
"(",
"filename",
")"
] | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/physics/sNMR/mrs.py#L290-L292 | ||
paullouisageneau/libdatachannel | 27569ce021bea0df6cfc3e0b99e71d5c2d180089 | pages/tasks.py | python | regenerate | (c) | Automatically regenerate site upon file modification | Automatically regenerate site upon file modification | [
"Automatically",
"regenerate",
"site",
"upon",
"file",
"modification"
] | def regenerate(c):
"""Automatically regenerate site upon file modification"""
pelican_run('-r -s {settings_base}'.format(**CONFIG)) | [
"def",
"regenerate",
"(",
"c",
")",
":",
"pelican_run",
"(",
"'-r -s {settings_base}'",
".",
"format",
"(",
"*",
"*",
"CONFIG",
")",
")"
] | https://github.com/paullouisageneau/libdatachannel/blob/27569ce021bea0df6cfc3e0b99e71d5c2d180089/pages/tasks.py#L53-L55 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/hmac.py | python | digest | (key, msg, digest) | return outer.digest() | Fast inline implementation of HMAC.
key: bytes or buffer, The key for the keyed hash object.
msg: bytes or buffer, Input message.
digest: A hash name suitable for hashlib.new() for best performance. *OR*
A hashlib constructor returning a new hash object. *OR*
A module supporting PEP... | Fast inline implementation of HMAC. | [
"Fast",
"inline",
"implementation",
"of",
"HMAC",
"."
] | def digest(key, msg, digest):
"""Fast inline implementation of HMAC.
key: bytes or buffer, The key for the keyed hash object.
msg: bytes or buffer, Input message.
digest: A hash name suitable for hashlib.new() for best performance. *OR*
A hashlib constructor returning a new hash object. *OR... | [
"def",
"digest",
"(",
"key",
",",
"msg",
",",
"digest",
")",
":",
"if",
"(",
"_hashopenssl",
"is",
"not",
"None",
"and",
"isinstance",
"(",
"digest",
",",
"str",
")",
"and",
"digest",
"in",
"_openssl_md_meths",
")",
":",
"return",
"_hashopenssl",
".",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/hmac.py#L173-L203 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | v8_5_1/tools/stats-viewer.py | python | StatsViewer.ComputeCounters | (self) | return groups | Group the counters by the suffix of their name.
Since the same code-level counter (for instance "X") can result in
several variables in the binary counters file that differ only by a
two-character prefix (for instance "c:X" and "t:X") counters are
grouped by suffix and then displayed with custom format... | Group the counters by the suffix of their name. | [
"Group",
"the",
"counters",
"by",
"the",
"suffix",
"of",
"their",
"name",
"."
] | def ComputeCounters(self):
"""Group the counters by the suffix of their name.
Since the same code-level counter (for instance "X") can result in
several variables in the binary counters file that differ only by a
two-character prefix (for instance "c:X" and "t:X") counters are
grouped by suffix and... | [
"def",
"ComputeCounters",
"(",
"self",
")",
":",
"names",
"=",
"{",
"}",
"for",
"i",
"in",
"xrange",
"(",
"self",
".",
"data",
".",
"CountersInUse",
"(",
")",
")",
":",
"counter",
"=",
"self",
".",
"data",
".",
"Counter",
"(",
"i",
")",
"name",
"... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/v8_5_1/tools/stats-viewer.py#L177-L212 | |
neoml-lib/neoml | a0d370fba05269a1b2258cef126f77bbd2054a3e | NeoML/Python/neoml/Dnn/Loss.py | python | FocalLoss.force | (self) | return self._internal.get_force() | Gets the focal force multiplier. | Gets the focal force multiplier. | [
"Gets",
"the",
"focal",
"force",
"multiplier",
"."
] | def force(self):
"""Gets the focal force multiplier.
"""
return self._internal.get_force() | [
"def",
"force",
"(",
"self",
")",
":",
"return",
"self",
".",
"_internal",
".",
"get_force",
"(",
")"
] | https://github.com/neoml-lib/neoml/blob/a0d370fba05269a1b2258cef126f77bbd2054a3e/NeoML/Python/neoml/Dnn/Loss.py#L480-L483 | |
microsoft/clang | 86d4513d3e0daa4d5a29b0b1de7c854ca15f9fe5 | tools/scan-build-py/libear/__init__.py | python | Toolset.add_definitions | (self, defines) | part of public interface | part of public interface | [
"part",
"of",
"public",
"interface"
] | def add_definitions(self, defines):
""" part of public interface """
self.c_flags.extend(defines) | [
"def",
"add_definitions",
"(",
"self",
",",
"defines",
")",
":",
"self",
".",
"c_flags",
".",
"extend",
"(",
"defines",
")"
] | https://github.com/microsoft/clang/blob/86d4513d3e0daa4d5a29b0b1de7c854ca15f9fe5/tools/scan-build-py/libear/__init__.py#L95-L97 | ||
NVIDIA/TensorRT | 42805f078052daad1a98bc5965974fcffaad0960 | tools/Polygraphy/polygraphy/backend/trt/calibrator.py | python | Calibrator | (
data_loader, cache=None, BaseClass=None, batch_size=None, quantile=None, regression_cutoff=None, algo=None
) | return CalibratorClass() | Supplies calibration data to TensorRT to calibrate the network for INT8 inference.
Args:
data_loader (Generator -> OrderedDict[str, Union[numpy.ndarray, DeviceView, int]]):
A generator or iterable that yields a dictionary that maps input names to NumPy
arrays, Polygraphy DeviceViews... | Supplies calibration data to TensorRT to calibrate the network for INT8 inference. | [
"Supplies",
"calibration",
"data",
"to",
"TensorRT",
"to",
"calibrate",
"the",
"network",
"for",
"INT8",
"inference",
"."
] | def Calibrator(
data_loader, cache=None, BaseClass=None, batch_size=None, quantile=None, regression_cutoff=None, algo=None
):
"""
Supplies calibration data to TensorRT to calibrate the network for INT8 inference.
Args:
data_loader (Generator -> OrderedDict[str, Union[numpy.ndarray, DeviceView, ... | [
"def",
"Calibrator",
"(",
"data_loader",
",",
"cache",
"=",
"None",
",",
"BaseClass",
"=",
"None",
",",
"batch_size",
"=",
"None",
",",
"quantile",
"=",
"None",
",",
"regression_cutoff",
"=",
"None",
",",
"algo",
"=",
"None",
")",
":",
"BaseClass",
"=",
... | https://github.com/NVIDIA/TensorRT/blob/42805f078052daad1a98bc5965974fcffaad0960/tools/Polygraphy/polygraphy/backend/trt/calibrator.py#L27-L251 | |
carla-simulator/carla | 8854804f4d7748e14d937ec763a2912823a7e5f5 | PythonAPI/examples/no_rendering_mode.py | python | World._show_nearby_vehicles | (self, vehicles) | Shows nearby vehicles of the hero actor | Shows nearby vehicles of the hero actor | [
"Shows",
"nearby",
"vehicles",
"of",
"the",
"hero",
"actor"
] | def _show_nearby_vehicles(self, vehicles):
"""Shows nearby vehicles of the hero actor"""
info_text = []
if self.hero_actor is not None and len(vehicles) > 1:
location = self.hero_transform.location
vehicle_list = [x[0] for x in vehicles if x[0].id != self.hero_actor.id]
... | [
"def",
"_show_nearby_vehicles",
"(",
"self",
",",
"vehicles",
")",
":",
"info_text",
"=",
"[",
"]",
"if",
"self",
".",
"hero_actor",
"is",
"not",
"None",
"and",
"len",
"(",
"vehicles",
")",
">",
"1",
":",
"location",
"=",
"self",
".",
"hero_transform",
... | https://github.com/carla-simulator/carla/blob/8854804f4d7748e14d937ec763a2912823a7e5f5/PythonAPI/examples/no_rendering_mode.py#L1094-L1107 | ||
NVIDIA/TensorRT | 42805f078052daad1a98bc5965974fcffaad0960 | tools/Polygraphy/polygraphy/tools/script.py | python | Script.append_preimport | (self, line) | Append a line to the pre-import prefix of the script.
Args:
line (str): The line to append. | Append a line to the pre-import prefix of the script. | [
"Append",
"a",
"line",
"to",
"the",
"pre",
"-",
"import",
"prefix",
"of",
"the",
"script",
"."
] | def append_preimport(self, line):
"""
Append a line to the pre-import prefix of the script.
Args:
line (str): The line to append.
"""
line = ensure_safe(line).unwrap()
self.preimport.append(line) | [
"def",
"append_preimport",
"(",
"self",
",",
"line",
")",
":",
"line",
"=",
"ensure_safe",
"(",
"line",
")",
".",
"unwrap",
"(",
")",
"self",
".",
"preimport",
".",
"append",
"(",
"line",
")"
] | https://github.com/NVIDIA/TensorRT/blob/42805f078052daad1a98bc5965974fcffaad0960/tools/Polygraphy/polygraphy/tools/script.py#L293-L301 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | FileHistory.UseMenu | (*args, **kwargs) | return _misc_.FileHistory_UseMenu(*args, **kwargs) | UseMenu(self, Menu menu) | UseMenu(self, Menu menu) | [
"UseMenu",
"(",
"self",
"Menu",
"menu",
")"
] | def UseMenu(*args, **kwargs):
"""UseMenu(self, Menu menu)"""
return _misc_.FileHistory_UseMenu(*args, **kwargs) | [
"def",
"UseMenu",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"FileHistory_UseMenu",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L926-L928 | |
bundy-dns/bundy | 3d41934996b82b0cd2fe22dd74d2abc1daba835d | src/lib/python/bundy/xfrin/diff.py | python | Diff.__init__ | (self, ds_client, zone, replace=False, journaling=False,
single_update_mode=False) | Initializes the diff to a ready state. It checks the zone exists
in the datasource and if not, NoSuchZone is raised. This also creates
a transaction in the data source.
The ds_client is the datasource client containing the zone. Zone is
bundy.dns.Name object representing the name of the... | Initializes the diff to a ready state. It checks the zone exists
in the datasource and if not, NoSuchZone is raised. This also creates
a transaction in the data source. | [
"Initializes",
"the",
"diff",
"to",
"a",
"ready",
"state",
".",
"It",
"checks",
"the",
"zone",
"exists",
"in",
"the",
"datasource",
"and",
"if",
"not",
"NoSuchZone",
"is",
"raised",
".",
"This",
"also",
"creates",
"a",
"transaction",
"in",
"the",
"data",
... | def __init__(self, ds_client, zone, replace=False, journaling=False,
single_update_mode=False):
"""
Initializes the diff to a ready state. It checks the zone exists
in the datasource and if not, NoSuchZone is raised. This also creates
a transaction in the data source.
... | [
"def",
"__init__",
"(",
"self",
",",
"ds_client",
",",
"zone",
",",
"replace",
"=",
"False",
",",
"journaling",
"=",
"False",
",",
"single_update_mode",
"=",
"False",
")",
":",
"try",
":",
"self",
".",
"__updater",
"=",
"ds_client",
".",
"get_updater",
"... | https://github.com/bundy-dns/bundy/blob/3d41934996b82b0cd2fe22dd74d2abc1daba835d/src/lib/python/bundy/xfrin/diff.py#L65-L122 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/training/saver.py | python | generate_checkpoint_state_proto | (save_dir,
model_checkpoint_path,
all_model_checkpoint_paths=None) | return coord_checkpoint_proto | Generates a checkpoint state proto.
Args:
save_dir: Directory where the model was saved.
model_checkpoint_path: The checkpoint file.
all_model_checkpoint_paths: List of strings. Paths to all not-yet-deleted
checkpoints, sorted from oldest to newest. If this is a non-empty list,
the last ele... | Generates a checkpoint state proto. | [
"Generates",
"a",
"checkpoint",
"state",
"proto",
"."
] | def generate_checkpoint_state_proto(save_dir,
model_checkpoint_path,
all_model_checkpoint_paths=None):
"""Generates a checkpoint state proto.
Args:
save_dir: Directory where the model was saved.
model_checkpoint_path: The checkpoint fi... | [
"def",
"generate_checkpoint_state_proto",
"(",
"save_dir",
",",
"model_checkpoint_path",
",",
"all_model_checkpoint_paths",
"=",
"None",
")",
":",
"if",
"all_model_checkpoint_paths",
"is",
"None",
":",
"all_model_checkpoint_paths",
"=",
"[",
"]",
"if",
"(",
"not",
"al... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/training/saver.py#L548-L589 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PGProperty.SetWasModified | (*args, **kwargs) | return _propgrid.PGProperty_SetWasModified(*args, **kwargs) | SetWasModified(self, bool set=True) | SetWasModified(self, bool set=True) | [
"SetWasModified",
"(",
"self",
"bool",
"set",
"=",
"True",
")"
] | def SetWasModified(*args, **kwargs):
"""SetWasModified(self, bool set=True)"""
return _propgrid.PGProperty_SetWasModified(*args, **kwargs) | [
"def",
"SetWasModified",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGProperty_SetWasModified",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L783-L785 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/random.py | python | Random.weibullvariate | (self, alpha, beta) | return alpha * (-_log(u)) ** (1.0/beta) | Weibull distribution.
alpha is the scale parameter and beta is the shape parameter. | Weibull distribution. | [
"Weibull",
"distribution",
"."
] | def weibullvariate(self, alpha, beta):
"""Weibull distribution.
alpha is the scale parameter and beta is the shape parameter.
"""
# Jain, pg. 499; bug fix courtesy Bill Arms
u = 1.0 - self.random()
return alpha * (-_log(u)) ** (1.0/beta) | [
"def",
"weibullvariate",
"(",
"self",
",",
"alpha",
",",
"beta",
")",
":",
"# Jain, pg. 499; bug fix courtesy Bill Arms",
"u",
"=",
"1.0",
"-",
"self",
".",
"random",
"(",
")",
"return",
"alpha",
"*",
"(",
"-",
"_log",
"(",
"u",
")",
")",
"**",
"(",
"1... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/random.py#L656-L665 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/pydoc.py | python | writedocs | (dir, pkgpath='', done=None) | return | Write out HTML documentation for all modules in a directory tree. | Write out HTML documentation for all modules in a directory tree. | [
"Write",
"out",
"HTML",
"documentation",
"for",
"all",
"modules",
"in",
"a",
"directory",
"tree",
"."
] | def writedocs(dir, pkgpath='', done=None):
"""Write out HTML documentation for all modules in a directory tree."""
if done is None: done = {}
for importer, modname, ispkg in pkgutil.walk_packages([dir], pkgpath):
writedoc(modname)
return | [
"def",
"writedocs",
"(",
"dir",
",",
"pkgpath",
"=",
"''",
",",
"done",
"=",
"None",
")",
":",
"if",
"done",
"is",
"None",
":",
"done",
"=",
"{",
"}",
"for",
"importer",
",",
"modname",
",",
"ispkg",
"in",
"pkgutil",
".",
"walk_packages",
"(",
"[",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/pydoc.py#L1688-L1693 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/lite/schema/upgrade_schema.py | python | Converter._PerformUpgrade | (self, data) | Manipulate the `data` (parsed JSON) based on changes in format.
This incrementally will upgrade from version to version within data.
Args:
data: Dictionary representing the TensorFlow data. This will be upgraded
in place. | Manipulate the `data` (parsed JSON) based on changes in format. | [
"Manipulate",
"the",
"data",
"(",
"parsed",
"JSON",
")",
"based",
"on",
"changes",
"in",
"format",
"."
] | def _PerformUpgrade(self, data):
"""Manipulate the `data` (parsed JSON) based on changes in format.
This incrementally will upgrade from version to version within data.
Args:
data: Dictionary representing the TensorFlow data. This will be upgraded
in place.
"""
while data["version"] ... | [
"def",
"_PerformUpgrade",
"(",
"self",
",",
"data",
")",
":",
"while",
"data",
"[",
"\"version\"",
"]",
"<",
"self",
".",
"_new_version",
":",
"self",
".",
"_upgrade_dispatch",
"[",
"data",
"[",
"\"version\"",
"]",
"]",
"(",
"data",
")",
"data",
"[",
"... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/lite/schema/upgrade_schema.py#L292-L303 | ||
Cisco-Talos/moflow | ed71dfb0540d9e0d7a4c72f0881b58958d573728 | BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/ez_setup.py | python | use_setuptools | (
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
download_delay=15
) | return do_download() | Automatically find/download setuptools and make it available on sys.path
`version` should be a valid setuptools version number that is available
as an egg for download under the `download_base` URL (which should end with
a '/'). `to_dir` is the directory where setuptools will be downloaded, if
it is n... | Automatically find/download setuptools and make it available on sys.path | [
"Automatically",
"find",
"/",
"download",
"setuptools",
"and",
"make",
"it",
"available",
"on",
"sys",
".",
"path"
] | def use_setuptools(
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
download_delay=15
):
"""Automatically find/download setuptools and make it available on sys.path
`version` should be a valid setuptools version number that is available
as an egg for download under the `downlo... | [
"def",
"use_setuptools",
"(",
"version",
"=",
"DEFAULT_VERSION",
",",
"download_base",
"=",
"DEFAULT_URL",
",",
"to_dir",
"=",
"os",
".",
"curdir",
",",
"download_delay",
"=",
"15",
")",
":",
"was_imported",
"=",
"'pkg_resources'",
"in",
"sys",
".",
"modules",... | https://github.com/Cisco-Talos/moflow/blob/ed71dfb0540d9e0d7a4c72f0881b58958d573728/BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/ez_setup.py#L85-L124 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/metrics_impl.py | python | _sparse_false_negative_at_k | (labels,
predictions_idx,
class_id=None,
weights=None) | Calculates false negatives for recall@k.
If `class_id` is specified, calculate binary true positives for `class_id`
only.
If `class_id` is not specified, calculate metrics for `k` predicted vs
`n` label classes, where `n` is the 2nd dimension of `labels_sparse`.
Args:
labels: `int64` `Tensor` or... | Calculates false negatives for recall@k. | [
"Calculates",
"false",
"negatives",
"for",
"recall@k",
"."
] | def _sparse_false_negative_at_k(labels,
predictions_idx,
class_id=None,
weights=None):
"""Calculates false negatives for recall@k.
If `class_id` is specified, calculate binary true positives for `class_id`
only.
... | [
"def",
"_sparse_false_negative_at_k",
"(",
"labels",
",",
"predictions_idx",
",",
"class_id",
"=",
"None",
",",
"weights",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"None",
",",
"'false_negatives'",
",",
"(",
"predictions_idx",
",",
"labels... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/metrics_impl.py#L2379-L2420 | ||
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/base/android/jni_generator/jni_registration_generator.py | python | _Generate | (java_file_paths,
srcjar_path,
proxy_opts,
header_path=None,
namespace='') | Generates files required to perform JNI registration.
Generates a srcjar containing a single class, GEN_JNI, that contains all
native method declarations.
Optionally generates a header file that provides functions
(RegisterMainDexNatives and RegisterNonMainDexNatives) to perform
JNI registration.
Args:
... | Generates files required to perform JNI registration. | [
"Generates",
"files",
"required",
"to",
"perform",
"JNI",
"registration",
"."
] | def _Generate(java_file_paths,
srcjar_path,
proxy_opts,
header_path=None,
namespace=''):
"""Generates files required to perform JNI registration.
Generates a srcjar containing a single class, GEN_JNI, that contains all
native method declarations.
Optiona... | [
"def",
"_Generate",
"(",
"java_file_paths",
",",
"srcjar_path",
",",
"proxy_opts",
",",
"header_path",
"=",
"None",
",",
"namespace",
"=",
"''",
")",
":",
"# Without multiprocessing, script takes ~13 seconds for chrome_public_apk",
"# on a z620. With multiprocessing, takes ~2 s... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/base/android/jni_generator/jni_registration_generator.py#L38-L104 | ||
RegrowthStudios/SoACode-Public | c3ddd69355b534d5e70e2e6d0c489b4e93ab1ffe | utils/git-hooks/pep8.py | python | whitespace_around_keywords | (logical_line) | r"""
Avoid extraneous whitespace around keywords.
Okay: True and False
E271: True and False
E272: True and False
E273: True and\tFalse
E274: True\tand False | r"""
Avoid extraneous whitespace around keywords. | [
"r",
"Avoid",
"extraneous",
"whitespace",
"around",
"keywords",
"."
] | def whitespace_around_keywords(logical_line):
r"""
Avoid extraneous whitespace around keywords.
Okay: True and False
E271: True and False
E272: True and False
E273: True and\tFalse
E274: True\tand False
"""
for match in KEYWORD_REGEX.finditer(logical_line):
before, after =... | [
"def",
"whitespace_around_keywords",
"(",
"logical_line",
")",
":",
"for",
"match",
"in",
"KEYWORD_REGEX",
".",
"finditer",
"(",
"logical_line",
")",
":",
"before",
",",
"after",
"=",
"match",
".",
"groups",
"(",
")",
"if",
"'\\t'",
"in",
"before",
":",
"y... | https://github.com/RegrowthStudios/SoACode-Public/blob/c3ddd69355b534d5e70e2e6d0c489b4e93ab1ffe/utils/git-hooks/pep8.py#L306-L327 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Path/PathScripts/post/opensbp_pre.py | python | insert | (filename, docname) | called when freecad imports a file
This insert expects parse to return a list of strings
each string will become a separate path | called when freecad imports a file
This insert expects parse to return a list of strings
each string will become a separate path | [
"called",
"when",
"freecad",
"imports",
"a",
"file",
"This",
"insert",
"expects",
"parse",
"to",
"return",
"a",
"list",
"of",
"strings",
"each",
"string",
"will",
"become",
"a",
"separate",
"path"
] | def insert(filename, docname):
'''called when freecad imports a file
This insert expects parse to return a list of strings
each string will become a separate path'''
gfile = pythonopen(filename)
gcode = gfile.read()
gfile.close()
gcode = parse(gcode)
doc = FreeCAD.getDocument(docname)
... | [
"def",
"insert",
"(",
"filename",
",",
"docname",
")",
":",
"gfile",
"=",
"pythonopen",
"(",
"filename",
")",
"gcode",
"=",
"gfile",
".",
"read",
"(",
")",
"gfile",
".",
"close",
"(",
")",
"gcode",
"=",
"parse",
"(",
"gcode",
")",
"doc",
"=",
"Free... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Path/PathScripts/post/opensbp_pre.py#L71-L83 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/distributed/algorithms/join.py | python | Join.__exit__ | (
self,
type: Optional[Type[BaseException]],
value: Optional[BaseException],
traceback: Optional[TracebackType]
) | r"""
Repeatedly runs the main hooks until all processes join; then, runs
the post-hooks.
Raises:
RuntimeError
If ``throw_on_early_termination=True``. | r"""
Repeatedly runs the main hooks until all processes join; then, runs
the post-hooks. | [
"r",
"Repeatedly",
"runs",
"the",
"main",
"hooks",
"until",
"all",
"processes",
"join",
";",
"then",
"runs",
"the",
"post",
"-",
"hooks",
"."
] | def __exit__(
self,
type: Optional[Type[BaseException]],
value: Optional[BaseException],
traceback: Optional[TracebackType]
):
r"""
Repeatedly runs the main hooks until all processes join; then, runs
the post-hooks.
Raises:
RuntimeError
... | [
"def",
"__exit__",
"(",
"self",
",",
"type",
":",
"Optional",
"[",
"Type",
"[",
"BaseException",
"]",
"]",
",",
"value",
":",
"Optional",
"[",
"BaseException",
"]",
",",
"traceback",
":",
"Optional",
"[",
"TracebackType",
"]",
")",
":",
"if",
"not",
"s... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/distributed/algorithms/join.py#L230-L281 | ||
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Alignment/MuonAlignmentAlgorithms/scripts/plotscripts.py | python | set_palette | (name=None, ncontours=999) | Set a color palette from a given RGB list
stops, red, green and blue should all be lists of the same length
see set_decent_colors for an example | Set a color palette from a given RGB list
stops, red, green and blue should all be lists of the same length
see set_decent_colors for an example | [
"Set",
"a",
"color",
"palette",
"from",
"a",
"given",
"RGB",
"list",
"stops",
"red",
"green",
"and",
"blue",
"should",
"all",
"be",
"lists",
"of",
"the",
"same",
"length",
"see",
"set_decent_colors",
"for",
"an",
"example"
] | def set_palette(name=None, ncontours=999):
"""Set a color palette from a given RGB list
stops, red, green and blue should all be lists of the same length
see set_decent_colors for an example"""
if name == "halfgray":
stops = [0.00, 0.34, 0.61, 0.84, 1.00]
red = map(lambda x: 1. - (1.-... | [
"def",
"set_palette",
"(",
"name",
"=",
"None",
",",
"ncontours",
"=",
"999",
")",
":",
"if",
"name",
"==",
"\"halfgray\"",
":",
"stops",
"=",
"[",
"0.00",
",",
"0.34",
",",
"0.61",
",",
"0.84",
",",
"1.00",
"]",
"red",
"=",
"map",
"(",
"lambda",
... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Alignment/MuonAlignmentAlgorithms/scripts/plotscripts.py#L228-L285 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/plistlib.py | python | readPlist | (pathOrFile) | return rootObject | Read a .plist file. 'pathOrFile' may either be a file name or a
(readable) file object. Return the unpacked root object (which
usually is a dictionary). | Read a .plist file. 'pathOrFile' may either be a file name or a
(readable) file object. Return the unpacked root object (which
usually is a dictionary). | [
"Read",
"a",
".",
"plist",
"file",
".",
"pathOrFile",
"may",
"either",
"be",
"a",
"file",
"name",
"or",
"a",
"(",
"readable",
")",
"file",
"object",
".",
"Return",
"the",
"unpacked",
"root",
"object",
"(",
"which",
"usually",
"is",
"a",
"dictionary",
"... | def readPlist(pathOrFile):
"""Read a .plist file. 'pathOrFile' may either be a file name or a
(readable) file object. Return the unpacked root object (which
usually is a dictionary).
"""
didOpen = 0
if isinstance(pathOrFile, (str, unicode)):
pathOrFile = open(pathOrFile)
didOpen ... | [
"def",
"readPlist",
"(",
"pathOrFile",
")",
":",
"didOpen",
"=",
"0",
"if",
"isinstance",
"(",
"pathOrFile",
",",
"(",
"str",
",",
"unicode",
")",
")",
":",
"pathOrFile",
"=",
"open",
"(",
"pathOrFile",
")",
"didOpen",
"=",
"1",
"p",
"=",
"PlistParser"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/plistlib.py#L68-L81 | |
fifengine/fifengine | 4b62c42e85bec19893cef8e63e6855927cff2c47 | engine/python/fife/extensions/pychan/widgets/containers.py | python | Container.addChild | (self, widget) | Adds a child widget to the container.
This makes the childs widgets visible state the same as the containers.
i.e. if the containter is visible the child will be as well and if the
container widget is hidden so will the child. The child however WILL
be shown when you show the container widget. If you want ... | Adds a child widget to the container.
This makes the childs widgets visible state the same as the containers.
i.e. if the containter is visible the child will be as well and if the
container widget is hidden so will the child. The child however WILL
be shown when you show the container widget. If you want ... | [
"Adds",
"a",
"child",
"widget",
"to",
"the",
"container",
".",
"This",
"makes",
"the",
"childs",
"widgets",
"visible",
"state",
"the",
"same",
"as",
"the",
"containers",
".",
"i",
".",
"e",
".",
"if",
"the",
"containter",
"is",
"visible",
"the",
"child",... | def addChild(self, widget):
"""
Adds a child widget to the container.
This makes the childs widgets visible state the same as the containers.
i.e. if the containter is visible the child will be as well and if the
container widget is hidden so will the child. The child however WILL
be shown when you show... | [
"def",
"addChild",
"(",
"self",
",",
"widget",
")",
":",
"widget",
".",
"parent",
"=",
"self",
"if",
"widget",
".",
"max_size",
"[",
"0",
"]",
">",
"self",
".",
"max_size",
"[",
"0",
"]",
"or",
"widget",
".",
"max_size",
"[",
"1",
"]",
">",
"self... | https://github.com/fifengine/fifengine/blob/4b62c42e85bec19893cef8e63e6855927cff2c47/engine/python/fife/extensions/pychan/widgets/containers.py#L189-L213 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/SANS/sans/command_interface/ISISCommandInterface.py | python | set_save | (save_algorithms, save_as_zero_error_free) | Mainly internally used by BatchMode. Provides the save settings.
@param save_algorithms: A list of SaveType enums.
@param save_as_zero_error_free: True if a zero error correction should be performed. | Mainly internally used by BatchMode. Provides the save settings. | [
"Mainly",
"internally",
"used",
"by",
"BatchMode",
".",
"Provides",
"the",
"save",
"settings",
"."
] | def set_save(save_algorithms, save_as_zero_error_free):
"""
Mainly internally used by BatchMode. Provides the save settings.
@param save_algorithms: A list of SaveType enums.
@param save_as_zero_error_free: True if a zero error correction should be performed.
"""
save_command = NParameterComman... | [
"def",
"set_save",
"(",
"save_algorithms",
",",
"save_as_zero_error_free",
")",
":",
"save_command",
"=",
"NParameterCommand",
"(",
"command_id",
"=",
"NParameterCommandId",
".",
"SAVE",
",",
"values",
"=",
"[",
"save_algorithms",
",",
"save_as_zero_error_free",
"]",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/SANS/sans/command_interface/ISISCommandInterface.py#L497-L506 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | InputStream.readlines | (*args, **kwargs) | return _core_.InputStream_readlines(*args, **kwargs) | readlines(self, int sizehint=-1) -> PyObject | readlines(self, int sizehint=-1) -> PyObject | [
"readlines",
"(",
"self",
"int",
"sizehint",
"=",
"-",
"1",
")",
"-",
">",
"PyObject"
] | def readlines(*args, **kwargs):
"""readlines(self, int sizehint=-1) -> PyObject"""
return _core_.InputStream_readlines(*args, **kwargs) | [
"def",
"readlines",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"InputStream_readlines",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L2178-L2180 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | tools/codestyle/docstring_checker.py | python | DocstringChecker.one_line | (self, node) | return True | one_line checks if docstring (len < 40) is on one line.
Args:
node (astroid.node): The node visiting.
Returns:
True if successful otherwise False. | one_line checks if docstring (len < 40) is on one line.
Args:
node (astroid.node): The node visiting.
Returns:
True if successful otherwise False. | [
"one_line",
"checks",
"if",
"docstring",
"(",
"len",
"<",
"40",
")",
"is",
"on",
"one",
"line",
".",
"Args",
":",
"node",
"(",
"astroid",
".",
"node",
")",
":",
"The",
"node",
"visiting",
".",
"Returns",
":",
"True",
"if",
"successful",
"otherwise",
... | def one_line(self, node):
"""one_line checks if docstring (len < 40) is on one line.
Args:
node (astroid.node): The node visiting.
Returns:
True if successful otherwise False.
"""
doc = node.doc
if doc is None:
return True
if ... | [
"def",
"one_line",
"(",
"self",
",",
"node",
")",
":",
"doc",
"=",
"node",
".",
"doc",
"if",
"doc",
"is",
"None",
":",
"return",
"True",
"if",
"len",
"(",
"doc",
")",
">",
"40",
":",
"return",
"True",
"elif",
"sum",
"(",
"doc",
".",
"find",
"("... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/tools/codestyle/docstring_checker.py#L218-L238 | |
freeorion/freeorion | c266a40eccd3a99a17de8fe57c36ef6ba3771665 | default/python/universe_generation/planets.py | python | calc_planet_type | (star_type, orbit, planet_size) | Calculate planet type randomly for a potential new planet.
TODO: take into account star type and orbit number for determining planet type. | Calculate planet type randomly for a potential new planet. | [
"Calculate",
"planet",
"type",
"randomly",
"for",
"a",
"potential",
"new",
"planet",
"."
] | def calc_planet_type(star_type, orbit, planet_size):
"""
Calculate planet type randomly for a potential new planet.
TODO: take into account star type and orbit number for determining planet type.
"""
# check specified planet size to determine if we want a planet at all
if planet_size in planet_... | [
"def",
"calc_planet_type",
"(",
"star_type",
",",
"orbit",
",",
"planet_size",
")",
":",
"# check specified planet size to determine if we want a planet at all",
"if",
"planet_size",
"in",
"planet_sizes",
":",
"# if yes, determine planet type based on planet size...",
"if",
"plan... | https://github.com/freeorion/freeorion/blob/c266a40eccd3a99a17de8fe57c36ef6ba3771665/default/python/universe_generation/planets.py#L125-L141 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | tools/site_compare/command_line.py | python | Command.__init__ | (self, names, helptext, validator=None, impl=None) | Initializes Command from names and helptext, plus optional callables.
Args:
names: command name, or list of synonyms
helptext: brief string description of the command
validator: callable for custom argument validation
Should raise ParseError if it wants
impl: ... | Initializes Command from names and helptext, plus optional callables. | [
"Initializes",
"Command",
"from",
"names",
"and",
"helptext",
"plus",
"optional",
"callables",
"."
] | def __init__(self, names, helptext, validator=None, impl=None):
"""Initializes Command from names and helptext, plus optional callables.
Args:
names: command name, or list of synonyms
helptext: brief string description of the command
validator: callable for custom argument validati... | [
"def",
"__init__",
"(",
"self",
",",
"names",
",",
"helptext",
",",
"validator",
"=",
"None",
",",
"impl",
"=",
"None",
")",
":",
"self",
".",
"names",
"=",
"names",
"self",
".",
"validator",
"=",
"validator",
"self",
".",
"helptext",
"=",
"helptext",
... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/tools/site_compare/command_line.py#L35-L53 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/thumbnailctrl.py | python | ScrolledThumbnail.SetPopupMenu | (self, menu) | Sets the thumbnails popup menu when at least one thumbnail is selected.
:param `menu`: an instance of :class:`Menu`. | Sets the thumbnails popup menu when at least one thumbnail is selected. | [
"Sets",
"the",
"thumbnails",
"popup",
"menu",
"when",
"at",
"least",
"one",
"thumbnail",
"is",
"selected",
"."
] | def SetPopupMenu(self, menu):
"""
Sets the thumbnails popup menu when at least one thumbnail is selected.
:param `menu`: an instance of :class:`Menu`.
"""
self._pmenu = menu | [
"def",
"SetPopupMenu",
"(",
"self",
",",
"menu",
")",
":",
"self",
".",
"_pmenu",
"=",
"menu"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/thumbnailctrl.py#L1343-L1350 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/image_ops.py | python | _ImageDimensions | (images, static_only=True) | Returns the dimensions of an image tensor.
Args:
images: 4-D Tensor of shape `[batch, height, width, channels]`
static_only: Boolean, whether to return only static shape.
Returns:
list of integers `[batch, height, width, channels]`, when static shape is
fully defined or `static_only` is `True`.
... | Returns the dimensions of an image tensor. | [
"Returns",
"the",
"dimensions",
"of",
"an",
"image",
"tensor",
"."
] | def _ImageDimensions(images, static_only=True):
"""Returns the dimensions of an image tensor.
Args:
images: 4-D Tensor of shape `[batch, height, width, channels]`
static_only: Boolean, whether to return only static shape.
Returns:
list of integers `[batch, height, width, channels]`, when static shap... | [
"def",
"_ImageDimensions",
"(",
"images",
",",
"static_only",
"=",
"True",
")",
":",
"# A simple abstraction to provide names for each dimension. This abstraction",
"# should make it simpler to switch dimensions in the future (e.g. if we ever",
"# want to switch height and width.)",
"if",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/image_ops.py#L223-L242 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/fps/connection.py | python | FPSConnection.get_payment_instruction | (self, action, response, **kw) | return self.get_object(action, kw, response) | Gets the payment instruction of a token. | Gets the payment instruction of a token. | [
"Gets",
"the",
"payment",
"instruction",
"of",
"a",
"token",
"."
] | def get_payment_instruction(self, action, response, **kw):
"""
Gets the payment instruction of a token.
"""
return self.get_object(action, kw, response) | [
"def",
"get_payment_instruction",
"(",
"self",
",",
"action",
",",
"response",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"get_object",
"(",
"action",
",",
"kw",
",",
"response",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/fps/connection.py#L391-L395 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/rgw/module.py | python | Module.config_notify | (self) | This method is called whenever one of our config options is changed. | This method is called whenever one of our config options is changed. | [
"This",
"method",
"is",
"called",
"whenever",
"one",
"of",
"our",
"config",
"options",
"is",
"changed",
"."
] | def config_notify(self) -> None:
"""
This method is called whenever one of our config options is changed.
"""
# This is some boilerplate that stores MODULE_OPTIONS in a class
# member, so that, for instance, the 'emphatic' option is always
# available as 'self.emphatic'.
... | [
"def",
"config_notify",
"(",
"self",
")",
"->",
"None",
":",
"# This is some boilerplate that stores MODULE_OPTIONS in a class",
"# member, so that, for instance, the 'emphatic' option is always",
"# available as 'self.emphatic'.",
"for",
"opt",
"in",
"self",
".",
"MODULE_OPTIONS",
... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/rgw/module.py#L68-L86 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vendor/html5lib/inputstream.py | python | EncodingBytes.jumpTo | (self, bytes) | Look for the next sequence of bytes matching a given sequence. If
a match is found advance the position to the last byte of the match | Look for the next sequence of bytes matching a given sequence. If
a match is found advance the position to the last byte of the match | [
"Look",
"for",
"the",
"next",
"sequence",
"of",
"bytes",
"matching",
"a",
"given",
"sequence",
".",
"If",
"a",
"match",
"is",
"found",
"advance",
"the",
"position",
"to",
"the",
"last",
"byte",
"of",
"the",
"match"
] | def jumpTo(self, bytes):
"""Look for the next sequence of bytes matching a given sequence. If
a match is found advance the position to the last byte of the match"""
newPosition = self[self.position:].find(bytes)
if newPosition > -1:
# XXX: This is ugly, but I can't see a nice... | [
"def",
"jumpTo",
"(",
"self",
",",
"bytes",
")",
":",
"newPosition",
"=",
"self",
"[",
"self",
".",
"position",
":",
"]",
".",
"find",
"(",
"bytes",
")",
"if",
"newPosition",
">",
"-",
"1",
":",
"# XXX: This is ugly, but I can't see a nicer way to fix this.",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vendor/html5lib/inputstream.py#L635-L646 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | SplashScreen.GetSplashStyle | (*args, **kwargs) | return _windows_.SplashScreen_GetSplashStyle(*args, **kwargs) | GetSplashStyle(self) -> long | GetSplashStyle(self) -> long | [
"GetSplashStyle",
"(",
"self",
")",
"-",
">",
"long"
] | def GetSplashStyle(*args, **kwargs):
"""GetSplashStyle(self) -> long"""
return _windows_.SplashScreen_GetSplashStyle(*args, **kwargs) | [
"def",
"GetSplashStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"SplashScreen_GetSplashStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L1145-L1147 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/plan/cspace.py | python | MotionPlan.__init__ | (self,space,type=None,**options) | Initializes a plan with a given CSpace and a given type.
Optionally, planner options can be set via keyword arguments.
Valid values for type are:
* 'prm': the Probabilistic Roadmap algorithm
* 'rrt': the Rapidly Exploring Random Trees algorithm
* 'sbl': the ... | Initializes a plan with a given CSpace and a given type.
Optionally, planner options can be set via keyword arguments.
Valid values for type are: | [
"Initializes",
"a",
"plan",
"with",
"a",
"given",
"CSpace",
"and",
"a",
"given",
"type",
".",
"Optionally",
"planner",
"options",
"can",
"be",
"set",
"via",
"keyword",
"arguments",
".",
"Valid",
"values",
"for",
"type",
"are",
":"
] | def __init__(self,space,type=None,**options):
"""Initializes a plan with a given CSpace and a given type.
Optionally, planner options can be set via keyword arguments.
Valid values for type are:
* 'prm': the Probabilistic Roadmap algorithm
* 'rrt': the Rapidly E... | [
"def",
"__init__",
"(",
"self",
",",
"space",
",",
"type",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"if",
"space",
".",
"cspace",
"is",
"None",
":",
"space",
".",
"setup",
"(",
")",
"if",
"type",
"!=",
"None",
":",
"motionplanning",
".",
... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/plan/cspace.py#L235-L265 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/rnn_cell.py | python | EmbeddingWrapper.__init__ | (self, cell, embedding_classes, embedding_size, initializer=None) | Create a cell with an added input embedding.
Args:
cell: an RNNCell, an embedding will be put before its inputs.
embedding_classes: integer, how many symbols will be embedded.
embedding_size: integer, the size of the vectors we embed into.
initializer: an initializer to use when creating th... | Create a cell with an added input embedding. | [
"Create",
"a",
"cell",
"with",
"an",
"added",
"input",
"embedding",
"."
] | def __init__(self, cell, embedding_classes, embedding_size, initializer=None):
"""Create a cell with an added input embedding.
Args:
cell: an RNNCell, an embedding will be put before its inputs.
embedding_classes: integer, how many symbols will be embedded.
embedding_size: integer, the size o... | [
"def",
"__init__",
"(",
"self",
",",
"cell",
",",
"embedding_classes",
",",
"embedding_size",
",",
"initializer",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"cell",
",",
"RNNCell",
")",
":",
"raise",
"TypeError",
"(",
"\"The parameter cell is not R... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/rnn_cell.py#L698-L720 | ||
netket/netket | 0d534e54ecbf25b677ea72af6b85947979420652 | netket/hilbert/qubit.py | python | Qubit.__init__ | (self, N: int = 1, graph: Optional[AbstractGraph] = None) | r"""Initializes a qubit hilbert space.
Args:
N: Number of qubits.
graph: (deprecated) a graph from which to extract the number of sites.
Examples:
Simple spin hilbert space.
>>> from netket.hilbert import Qubit
>>> hi = Qubit(N=100)
... | r"""Initializes a qubit hilbert space. | [
"r",
"Initializes",
"a",
"qubit",
"hilbert",
"space",
"."
] | def __init__(self, N: int = 1, graph: Optional[AbstractGraph] = None):
r"""Initializes a qubit hilbert space.
Args:
N: Number of qubits.
graph: (deprecated) a graph from which to extract the number of sites.
Examples:
Simple spin hilbert space.
... | [
"def",
"__init__",
"(",
"self",
",",
"N",
":",
"int",
"=",
"1",
",",
"graph",
":",
"Optional",
"[",
"AbstractGraph",
"]",
"=",
"None",
")",
":",
"N",
"=",
"graph_to_N_depwarn",
"(",
"N",
"=",
"N",
",",
"graph",
"=",
"graph",
")",
"super",
"(",
")... | https://github.com/netket/netket/blob/0d534e54ecbf25b677ea72af6b85947979420652/netket/hilbert/qubit.py#L26-L43 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/Inelastic/Direct/PropertyManager.py | python | PropertyManager._init_private_properties | (self,prop_dict) | helper method used to define all private dictionaries at once
during __init__ procedure | helper method used to define all private dictionaries at once
during __init__ procedure | [
"helper",
"method",
"used",
"to",
"define",
"all",
"private",
"dictionaries",
"at",
"once",
"during",
"__init__",
"procedure"
] | def _init_private_properties(self,prop_dict):
""" helper method used to define all private dictionaries at once
during __init__ procedure
"""
class_decor = '_'+type(self).__name__+'__'
for key,val in prop_dict.items():
new_key = class_decor+key
objec... | [
"def",
"_init_private_properties",
"(",
"self",
",",
"prop_dict",
")",
":",
"class_decor",
"=",
"'_'",
"+",
"type",
"(",
"self",
")",
".",
"__name__",
"+",
"'__'",
"for",
"key",
",",
"val",
"in",
"prop_dict",
".",
"items",
"(",
")",
":",
"new_key",
"="... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Inelastic/Direct/PropertyManager.py#L135-L144 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/ops.py | python | _get_opstr | (op, cls) | return {operator.add: '+',
radd: '+',
operator.mul: '*',
rmul: '*',
operator.sub: '-',
rsub: '-',
operator.truediv: '/',
rtruediv: '/',
operator.floordiv: '//',
rfloordiv: '//',
operator.mod: None, #... | Find the operation string, if any, to pass to numexpr for this
operation.
Parameters
----------
op : binary operator
cls : class
Returns
-------
op_str : string or None | Find the operation string, if any, to pass to numexpr for this
operation. | [
"Find",
"the",
"operation",
"string",
"if",
"any",
"to",
"pass",
"to",
"numexpr",
"for",
"this",
"operation",
"."
] | def _get_opstr(op, cls):
"""
Find the operation string, if any, to pass to numexpr for this
operation.
Parameters
----------
op : binary operator
cls : class
Returns
-------
op_str : string or None
"""
# numexpr is available for non-sparse classes
subtyp = getattr(c... | [
"def",
"_get_opstr",
"(",
"op",
",",
"cls",
")",
":",
"# numexpr is available for non-sparse classes",
"subtyp",
"=",
"getattr",
"(",
"cls",
",",
"'_subtyp'",
",",
"''",
")",
"use_numexpr",
"=",
"'sparse'",
"not",
"in",
"subtyp",
"if",
"not",
"use_numexpr",
":... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/ops.py#L312-L361 | |
randomascii/blogstuff | 07074af1c2df6e61d30bb4fb7704e4166d0dc9ed | ChromiumBuildAnalysis/analyze_chrome.py | python | ReadTargets | (log, show_all) | return targets_dict.values() | Reads all targets from .ninja_log file |log_file|, sorted by duration.
The result is a list of Target objects. | Reads all targets from .ninja_log file |log_file|, sorted by duration. | [
"Reads",
"all",
"targets",
"from",
".",
"ninja_log",
"file",
"|log_file|",
"sorted",
"by",
"duration",
"."
] | def ReadTargets(log, show_all):
"""Reads all targets from .ninja_log file |log_file|, sorted by duration.
The result is a list of Target objects."""
header = log.readline()
assert header == '# ninja log v5\n', \
'unrecognized ninja log version %r' % header
targets_dict = {}
last_end_... | [
"def",
"ReadTargets",
"(",
"log",
",",
"show_all",
")",
":",
"header",
"=",
"log",
".",
"readline",
"(",
")",
"assert",
"header",
"==",
"'# ninja log v5\\n'",
",",
"'unrecognized ninja log version %r'",
"%",
"header",
"targets_dict",
"=",
"{",
"}",
"last_end_see... | https://github.com/randomascii/blogstuff/blob/07074af1c2df6e61d30bb4fb7704e4166d0dc9ed/ChromiumBuildAnalysis/analyze_chrome.py#L43-L86 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/pygments/lexers/text.py | python | YamlLexer.parse_plain_scalar_indent | (token_class) | return callback | Process indentation spaces in a plain scalar. | Process indentation spaces in a plain scalar. | [
"Process",
"indentation",
"spaces",
"in",
"a",
"plain",
"scalar",
"."
] | def parse_plain_scalar_indent(token_class):
"""Process indentation spaces in a plain scalar."""
def callback(lexer, match, context):
text = match.group()
if len(text) <= context.indent:
context.stack.pop()
context.stack.pop()
return... | [
"def",
"parse_plain_scalar_indent",
"(",
"token_class",
")",
":",
"def",
"callback",
"(",
"lexer",
",",
"match",
",",
"context",
")",
":",
"text",
"=",
"match",
".",
"group",
"(",
")",
"if",
"len",
"(",
"text",
")",
"<=",
"context",
".",
"indent",
":",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/pygments/lexers/text.py#L1191-L1202 | |
naver/sling | 5671cd445a2caae0b4dd0332299e4cfede05062c | webkit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/standalone.py | python | WebSocketRequestHandler.log_error | (self, *args) | Override BaseHTTPServer.log_error. | Override BaseHTTPServer.log_error. | [
"Override",
"BaseHTTPServer",
".",
"log_error",
"."
] | def log_error(self, *args):
"""Override BaseHTTPServer.log_error."""
# Despite the name, this method is for warnings than for errors.
# For example, HTTP status code is logged by this method.
self._logger.warning('%s - %s',
self.address_string(),
... | [
"def",
"log_error",
"(",
"self",
",",
"*",
"args",
")",
":",
"# Despite the name, this method is for warnings than for errors.",
"# For example, HTTP status code is logged by this method.",
"self",
".",
"_logger",
".",
"warning",
"(",
"'%s - %s'",
",",
"self",
".",
"address... | https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/standalone.py#L770-L777 | ||
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | lldb/third_party/Python/module/pexpect-4.6/pexpect/screen.py | python | screen.crlf | (self) | This advances the cursor with CRLF properties.
The cursor will line wrap and the screen may scroll. | This advances the cursor with CRLF properties.
The cursor will line wrap and the screen may scroll. | [
"This",
"advances",
"the",
"cursor",
"with",
"CRLF",
"properties",
".",
"The",
"cursor",
"will",
"line",
"wrap",
"and",
"the",
"screen",
"may",
"scroll",
"."
] | def crlf (self):
'''This advances the cursor with CRLF properties.
The cursor will line wrap and the screen may scroll.
'''
self.cr ()
self.lf () | [
"def",
"crlf",
"(",
"self",
")",
":",
"self",
".",
"cr",
"(",
")",
"self",
".",
"lf",
"(",
")"
] | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/lldb/third_party/Python/module/pexpect-4.6/pexpect/screen.py#L186-L192 | ||
projectchrono/chrono | 92015a8a6f84ef63ac8206a74e54a676251dcc89 | src/demos/python/chrono-tensorflow/PPO/policy.py | python | Policy._restore_model | (self) | restore saved model.
if multiprocessing on gpu enable dynamic memory allocation | restore saved model.
if multiprocessing on gpu enable dynamic memory allocation | [
"restore",
"saved",
"model",
".",
"if",
"multiprocessing",
"on",
"gpu",
"enable",
"dynamic",
"memory",
"allocation"
] | def _restore_model(self):
""" restore saved model.
if multiprocessing on gpu enable dynamic memory allocation """
tf.reset_default_graph()
if self.multiGPU :
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
sel... | [
"def",
"_restore_model",
"(",
"self",
")",
":",
"tf",
".",
"reset_default_graph",
"(",
")",
"if",
"self",
".",
"multiGPU",
":",
"config",
"=",
"tf",
".",
"ConfigProto",
"(",
")",
"config",
".",
"gpu_options",
".",
"allow_growth",
"=",
"True",
"self",
"."... | https://github.com/projectchrono/chrono/blob/92015a8a6f84ef63ac8206a74e54a676251dcc89/src/demos/python/chrono-tensorflow/PPO/policy.py#L197-L232 | ||
pristineio/webrtc-mirror | 7a5bcdffaab90a05bc1146b2b1ea71c004e54d71 | webrtc/rtc_tools/py_event_log_analyzer/rtp_analyzer.py | python | RTPStatistics.ComputeBandwidth | (self) | Computes bandwidth averaged over several consecutive packets.
The number of consecutive packets used in the average is
BANDWIDTH_SMOOTHING_WINDOW_SIZE. Averaging is done with
numpy.correlate. | Computes bandwidth averaged over several consecutive packets. | [
"Computes",
"bandwidth",
"averaged",
"over",
"several",
"consecutive",
"packets",
"."
] | def ComputeBandwidth(self):
"""Computes bandwidth averaged over several consecutive packets.
The number of consecutive packets used in the average is
BANDWIDTH_SMOOTHING_WINDOW_SIZE. Averaging is done with
numpy.correlate.
"""
start_ms = self.data_points[0].real_send_time_ms
stop_ms = self.... | [
"def",
"ComputeBandwidth",
"(",
"self",
")",
":",
"start_ms",
"=",
"self",
".",
"data_points",
"[",
"0",
"]",
".",
"real_send_time_ms",
"stop_ms",
"=",
"self",
".",
"data_points",
"[",
"-",
"1",
"]",
".",
"real_send_time_ms",
"(",
"self",
".",
"bandwidth_k... | https://github.com/pristineio/webrtc-mirror/blob/7a5bcdffaab90a05bc1146b2b1ea71c004e54d71/webrtc/rtc_tools/py_event_log_analyzer/rtp_analyzer.py#L228-L247 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/ao/ns/_numeric_suite.py | python | compare_weights | (
float_dict: Dict[str, Any], quantized_dict: Dict[str, Any]
) | return weight_dict | r"""Compare the weights of the float module with its corresponding quantized
module. Return a dict with key corresponding to module names and each entry being
a dictionary with two keys 'float' and 'quantized', containing the float and
quantized weights. This dict can be used to compare and compute the quan... | r"""Compare the weights of the float module with its corresponding quantized
module. Return a dict with key corresponding to module names and each entry being
a dictionary with two keys 'float' and 'quantized', containing the float and
quantized weights. This dict can be used to compare and compute the quan... | [
"r",
"Compare",
"the",
"weights",
"of",
"the",
"float",
"module",
"with",
"its",
"corresponding",
"quantized",
"module",
".",
"Return",
"a",
"dict",
"with",
"key",
"corresponding",
"to",
"module",
"names",
"and",
"each",
"entry",
"being",
"a",
"dictionary",
... | def compare_weights(
float_dict: Dict[str, Any], quantized_dict: Dict[str, Any]
) -> Dict[str, Dict[str, torch.Tensor]]:
r"""Compare the weights of the float module with its corresponding quantized
module. Return a dict with key corresponding to module names and each entry being
a dictionary with two ke... | [
"def",
"compare_weights",
"(",
"float_dict",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
",",
"quantized_dict",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"Dict",
"[",
"str",
",",
"torch",
".",
"Tensor",
"]",
"]",
... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/ao/ns/_numeric_suite.py#L52-L118 | |
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | clang/utils/check_cfc/check_cfc.py | python | path_without_wrapper | () | return remove_dir_from_path(path, scriptdir) | Returns the PATH variable modified to remove the path to this program. | Returns the PATH variable modified to remove the path to this program. | [
"Returns",
"the",
"PATH",
"variable",
"modified",
"to",
"remove",
"the",
"path",
"to",
"this",
"program",
"."
] | def path_without_wrapper():
"""Returns the PATH variable modified to remove the path to this program."""
scriptdir = get_main_dir()
path = os.environ['PATH']
return remove_dir_from_path(path, scriptdir) | [
"def",
"path_without_wrapper",
"(",
")",
":",
"scriptdir",
"=",
"get_main_dir",
"(",
")",
"path",
"=",
"os",
".",
"environ",
"[",
"'PATH'",
"]",
"return",
"remove_dir_from_path",
"(",
"path",
",",
"scriptdir",
")"
] | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/clang/utils/check_cfc/check_cfc.py#L105-L109 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/propgrid.py | python | PropertyGrid.GetSelectionBackgroundColour | (*args, **kwargs) | return _propgrid.PropertyGrid_GetSelectionBackgroundColour(*args, **kwargs) | GetSelectionBackgroundColour(self) -> Colour | GetSelectionBackgroundColour(self) -> Colour | [
"GetSelectionBackgroundColour",
"(",
"self",
")",
"-",
">",
"Colour"
] | def GetSelectionBackgroundColour(*args, **kwargs):
"""GetSelectionBackgroundColour(self) -> Colour"""
return _propgrid.PropertyGrid_GetSelectionBackgroundColour(*args, **kwargs) | [
"def",
"GetSelectionBackgroundColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGrid_GetSelectionBackgroundColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L2129-L2131 | |
zachriggle/ida-splode | a4aee3be415b318a0e051a523ebd0a8d6d5e0026 | py/idasplode/name.py | python | MakeOffset | (x, sign=True) | return hexstr | Make integer x into an IDA-styled offset string
>>> MakeOffset(0)
0
>>> MakeOffset(0xd0)
0D0h
>>> MakeOffset(0x1234)
1234h | Make integer x into an IDA-styled offset string | [
"Make",
"integer",
"x",
"into",
"an",
"IDA",
"-",
"styled",
"offset",
"string"
] | def MakeOffset(x, sign=True):
"""Make integer x into an IDA-styled offset string
>>> MakeOffset(0)
0
>>> MakeOffset(0xd0)
0D0h
>>> MakeOffset(0x1234)
1234h
"""
if sign and x == 0:
return ""
hexstr = "%X" % x
if hexstr[0] in ('A','B','C','D','E','F'):
hexstr ... | [
"def",
"MakeOffset",
"(",
"x",
",",
"sign",
"=",
"True",
")",
":",
"if",
"sign",
"and",
"x",
"==",
"0",
":",
"return",
"\"\"",
"hexstr",
"=",
"\"%X\"",
"%",
"x",
"if",
"hexstr",
"[",
"0",
"]",
"in",
"(",
"'A'",
",",
"'B'",
",",
"'C'",
",",
"'... | https://github.com/zachriggle/ida-splode/blob/a4aee3be415b318a0e051a523ebd0a8d6d5e0026/py/idasplode/name.py#L105-L126 | |
bareos/bareos | 56a10bb368b0a81e977bb51304033fe49d59efb0 | core/src/plugins/filed/python/pyfiles/BareosFdPluginBaseclass.py | python | BareosFdPluginBaseclass.start_backup_job | (self) | return bRC_OK | Start of Backup Job. Called just before backup job really start.
Overload this to arrange whatever you have to do at this time. | Start of Backup Job. Called just before backup job really start.
Overload this to arrange whatever you have to do at this time. | [
"Start",
"of",
"Backup",
"Job",
".",
"Called",
"just",
"before",
"backup",
"job",
"really",
"start",
".",
"Overload",
"this",
"to",
"arrange",
"whatever",
"you",
"have",
"to",
"do",
"at",
"this",
"time",
"."
] | def start_backup_job(self):
"""
Start of Backup Job. Called just before backup job really start.
Overload this to arrange whatever you have to do at this time.
"""
return bRC_OK | [
"def",
"start_backup_job",
"(",
"self",
")",
":",
"return",
"bRC_OK"
] | https://github.com/bareos/bareos/blob/56a10bb368b0a81e977bb51304033fe49d59efb0/core/src/plugins/filed/python/pyfiles/BareosFdPluginBaseclass.py#L302-L307 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/sgicc.py | python | generate | (env) | Add Builders and construction variables for gcc to an Environment. | Add Builders and construction variables for gcc to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"gcc",
"to",
"an",
"Environment",
"."
] | def generate(env):
"""Add Builders and construction variables for gcc to an Environment."""
cc.generate(env)
env['CXX'] = 'CC'
env['SHOBJSUFFIX'] = '.o'
env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 | [
"def",
"generate",
"(",
"env",
")",
":",
"cc",
".",
"generate",
"(",
"env",
")",
"env",
"[",
"'CXX'",
"]",
"=",
"'CC'",
"env",
"[",
"'SHOBJSUFFIX'",
"]",
"=",
"'.o'",
"env",
"[",
"'STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'",
"]",
"=",
"1"
] | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/sgicc.py#L38-L44 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.