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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2.py | python | catalog.add | (self, type, orig, replace) | return ret | Add an entry in the catalog, it may overwrite existing but
different entries. | Add an entry in the catalog, it may overwrite existing but
different entries. | [
"Add",
"an",
"entry",
"in",
"the",
"catalog",
"it",
"may",
"overwrite",
"existing",
"but",
"different",
"entries",
"."
] | def add(self, type, orig, replace):
"""Add an entry in the catalog, it may overwrite existing but
different entries. """
ret = libxml2mod.xmlACatalogAdd(self._o, type, orig, replace)
return ret | [
"def",
"add",
"(",
"self",
",",
"type",
",",
"orig",
",",
"replace",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlACatalogAdd",
"(",
"self",
".",
"_o",
",",
"type",
",",
"orig",
",",
"replace",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L5661-L5665 | |
NREL/EnergyPlus | fadc5973b85c70e8cc923efb69c144e808a26078 | src/EnergyPlus/api/datatransfer.py | python | DataExchange.set_global_value | (self, state: c_void_p, handle: int, value: float) | Set the current value of a plugin global variable in a running simulation. This is only used for Python Plugin
applications!
Global variables are used as a way to share data between running Python Plugins. First a global variable must
be declared in the input file using the PythonPlugin:Globa... | Set the current value of a plugin global variable in a running simulation. This is only used for Python Plugin
applications! | [
"Set",
"the",
"current",
"value",
"of",
"a",
"plugin",
"global",
"variable",
"in",
"a",
"running",
"simulation",
".",
"This",
"is",
"only",
"used",
"for",
"Python",
"Plugin",
"applications!"
] | def set_global_value(self, state: c_void_p, handle: int, value: float) -> None:
"""
Set the current value of a plugin global variable in a running simulation. This is only used for Python Plugin
applications!
Global variables are used as a way to share data between running Python Plugi... | [
"def",
"set_global_value",
"(",
"self",
",",
"state",
":",
"c_void_p",
",",
"handle",
":",
"int",
",",
"value",
":",
"float",
")",
"->",
"None",
":",
"if",
"not",
"self",
".",
"running_as_python_plugin",
":",
"raise",
"EnergyPlusException",
"(",
"\"set_globa... | https://github.com/NREL/EnergyPlus/blob/fadc5973b85c70e8cc923efb69c144e808a26078/src/EnergyPlus/api/datatransfer.py#L681-L706 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_windows.py | python | StatusBar.SetStatusStyles | (*args, **kwargs) | return _windows_.StatusBar_SetStatusStyles(*args, **kwargs) | SetStatusStyles(self, int styles) | SetStatusStyles(self, int styles) | [
"SetStatusStyles",
"(",
"self",
"int",
"styles",
")"
] | def SetStatusStyles(*args, **kwargs):
"""SetStatusStyles(self, int styles)"""
return _windows_.StatusBar_SetStatusStyles(*args, **kwargs) | [
"def",
"SetStatusStyles",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"StatusBar_SetStatusStyles",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_windows.py#L1271-L1273 | |
facebook/wangle | 2e7e3fbb3a15c4986d6fe0e36c31daeeba614ce3 | build/fbcode_builder/getdeps/cargo.py | python | CargoBuilder._resolve_config | (self) | return "\n".join(config) | Returns a configuration to be put inside root Cargo.toml file which
patches the dependencies git code with local getdeps versions.
See https://doc.rust-lang.org/cargo/reference/manifest.html#the-patch-section | Returns a configuration to be put inside root Cargo.toml file which
patches the dependencies git code with local getdeps versions.
See https://doc.rust-lang.org/cargo/reference/manifest.html#the-patch-section | [
"Returns",
"a",
"configuration",
"to",
"be",
"put",
"inside",
"root",
"Cargo",
".",
"toml",
"file",
"which",
"patches",
"the",
"dependencies",
"git",
"code",
"with",
"local",
"getdeps",
"versions",
".",
"See",
"https",
":",
"//",
"doc",
".",
"rust",
"-",
... | def _resolve_config(self):
"""
Returns a configuration to be put inside root Cargo.toml file which
patches the dependencies git code with local getdeps versions.
See https://doc.rust-lang.org/cargo/reference/manifest.html#the-patch-section
"""
dep_to_git = self._resolve_d... | [
"def",
"_resolve_config",
"(",
"self",
")",
":",
"dep_to_git",
"=",
"self",
".",
"_resolve_dep_to_git",
"(",
")",
"dep_to_crates",
"=",
"CargoBuilder",
".",
"_resolve_dep_to_crates",
"(",
"self",
".",
"build_source_dir",
"(",
")",
",",
"dep_to_git",
")",
"config... | https://github.com/facebook/wangle/blob/2e7e3fbb3a15c4986d6fe0e36c31daeeba614ce3/build/fbcode_builder/getdeps/cargo.py#L187-L218 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/configure.d/nodedownload.py | python | unpack | (packedfile, parent_path) | Unpacks packedfile into parent_path. Assumes .zip. Returns parent_path | Unpacks packedfile into parent_path. Assumes .zip. Returns parent_path | [
"Unpacks",
"packedfile",
"into",
"parent_path",
".",
"Assumes",
".",
"zip",
".",
"Returns",
"parent_path"
] | def unpack(packedfile, parent_path):
"""Unpacks packedfile into parent_path. Assumes .zip. Returns parent_path"""
if zipfile.is_zipfile(packedfile):
with contextlib.closing(zipfile.ZipFile(packedfile, 'r')) as icuzip:
print(' Extracting zipfile: %s' % packedfile)
icuzip.extractal... | [
"def",
"unpack",
"(",
"packedfile",
",",
"parent_path",
")",
":",
"if",
"zipfile",
".",
"is_zipfile",
"(",
"packedfile",
")",
":",
"with",
"contextlib",
".",
"closing",
"(",
"zipfile",
".",
"ZipFile",
"(",
"packedfile",
",",
"'r'",
")",
")",
"as",
"icuzi... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/configure.d/nodedownload.py#L71-L85 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/retdec-3.2/scripts/type_extractor/type_extractor/json_types.py | python | get_array_dimensions | (dimensions) | return [int(d) if d.isdigit() else d for d in dimensions] | Returns list of all dimensions. | Returns list of all dimensions. | [
"Returns",
"list",
"of",
"all",
"dimensions",
"."
] | def get_array_dimensions(dimensions):
"""Returns list of all dimensions."""
dimensions = re.sub(r'^\[|\]$', '', dimensions).split('][')
return [int(d) if d.isdigit() else d for d in dimensions] | [
"def",
"get_array_dimensions",
"(",
"dimensions",
")",
":",
"dimensions",
"=",
"re",
".",
"sub",
"(",
"r'^\\[|\\]$'",
",",
"''",
",",
"dimensions",
")",
".",
"split",
"(",
"']['",
")",
"return",
"[",
"int",
"(",
"d",
")",
"if",
"d",
".",
"isdigit",
"... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/retdec-3.2/scripts/type_extractor/type_extractor/json_types.py#L489-L492 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/sets.py | python | BaseSet.__or__ | (self, other) | return self.union(other) | Return the union of two sets as a new set.
(I.e. all elements that are in either set.) | Return the union of two sets as a new set. | [
"Return",
"the",
"union",
"of",
"two",
"sets",
"as",
"a",
"new",
"set",
"."
] | def __or__(self, other):
"""Return the union of two sets as a new set.
(I.e. all elements that are in either set.)
"""
if not isinstance(other, BaseSet):
return NotImplemented
return self.union(other) | [
"def",
"__or__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"BaseSet",
")",
":",
"return",
"NotImplemented",
"return",
"self",
".",
"union",
"(",
"other",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/sets.py#L178-L185 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/aui.py | python | AuiPaneInfo.Floatable | (*args, **kwargs) | return _aui.AuiPaneInfo_Floatable(*args, **kwargs) | Floatable(self, bool b=True) -> AuiPaneInfo | Floatable(self, bool b=True) -> AuiPaneInfo | [
"Floatable",
"(",
"self",
"bool",
"b",
"=",
"True",
")",
"-",
">",
"AuiPaneInfo"
] | def Floatable(*args, **kwargs):
"""Floatable(self, bool b=True) -> AuiPaneInfo"""
return _aui.AuiPaneInfo_Floatable(*args, **kwargs) | [
"def",
"Floatable",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiPaneInfo_Floatable",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/aui.py#L493-L495 | |
coinapi/coinapi-sdk | 854f21e7f69ea8599ae35c5403565cf299d8b795 | oeml-sdk/python/openapi_client/model/order_execution_reports.py | python | OrderExecutionReports.__init__ | (self, *args, **kwargs) | OrderExecutionReports - a model defined in OpenAPI
Note that value can be passed either in args or in kwargs, but not in both.
Args:
args[0] ([OrderExecutionReport]): Collection of order execution reports for currently opened orders.. # noqa: E501
Keyword Args:
value ... | OrderExecutionReports - a model defined in OpenAPI | [
"OrderExecutionReports",
"-",
"a",
"model",
"defined",
"in",
"OpenAPI"
] | def __init__(self, *args, **kwargs):
"""OrderExecutionReports - a model defined in OpenAPI
Note that value can be passed either in args or in kwargs, but not in both.
Args:
args[0] ([OrderExecutionReport]): Collection of order execution reports for currently opened orders.. # noqa... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# required up here when default value is not given",
"_path_to_item",
"=",
"kwargs",
".",
"pop",
"(",
"'_path_to_item'",
",",
"(",
")",
")",
"if",
"'value'",
"in",
"kwargs",
... | https://github.com/coinapi/coinapi-sdk/blob/854f21e7f69ea8599ae35c5403565cf299d8b795/oeml-sdk/python/openapi_client/model/order_execution_reports.py#L104-L190 | ||
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | CheckSectionSpacing | (filename, clean_lines, class_info, linenum, error) | Checks for additional blank line issues related to sections.
Currently the only thing checked here is blank line before protected/private.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
class_info: A _ClassInfo objects.
linenum: The number ... | Checks for additional blank line issues related to sections. | [
"Checks",
"for",
"additional",
"blank",
"line",
"issues",
"related",
"to",
"sections",
"."
] | def CheckSectionSpacing(filename, clean_lines, class_info, linenum, error):
"""Checks for additional blank line issues related to sections.
Currently the only thing checked here is blank line before protected/private.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance co... | [
"def",
"CheckSectionSpacing",
"(",
"filename",
",",
"clean_lines",
",",
"class_info",
",",
"linenum",
",",
"error",
")",
":",
"# Skip checks if the class is small, where small means 25 lines or less.",
"# 25 lines seems like a good cutoff since that's the usual height of",
"# termina... | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L3658-L3710 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | MimeTypesManager.EnumAllFileTypes | (*args, **kwargs) | return _misc_.MimeTypesManager_EnumAllFileTypes(*args, **kwargs) | EnumAllFileTypes(self) -> PyObject | EnumAllFileTypes(self) -> PyObject | [
"EnumAllFileTypes",
"(",
"self",
")",
"-",
">",
"PyObject"
] | def EnumAllFileTypes(*args, **kwargs):
"""EnumAllFileTypes(self) -> PyObject"""
return _misc_.MimeTypesManager_EnumAllFileTypes(*args, **kwargs) | [
"def",
"EnumAllFileTypes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"MimeTypesManager_EnumAllFileTypes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L2677-L2679 | |
anestisb/oatdump_plus | ba858c1596598f0d9ae79c14d08c708cecc50af3 | tools/common/common.py | python | GetJackClassPath | () | return libdir + '/core-libart-hostdex_intermediates/classes.jack:' \
+ libdir + '/core-oj-hostdex_intermediates/classes.jack' | Returns Jack's classpath. | Returns Jack's classpath. | [
"Returns",
"Jack",
"s",
"classpath",
"."
] | def GetJackClassPath():
"""Returns Jack's classpath."""
top = GetEnvVariableOrError('ANDROID_BUILD_TOP')
libdir = top + '/out/host/common/obj/JAVA_LIBRARIES'
return libdir + '/core-libart-hostdex_intermediates/classes.jack:' \
+ libdir + '/core-oj-hostdex_intermediates/classes.jack' | [
"def",
"GetJackClassPath",
"(",
")",
":",
"top",
"=",
"GetEnvVariableOrError",
"(",
"'ANDROID_BUILD_TOP'",
")",
"libdir",
"=",
"top",
"+",
"'/out/host/common/obj/JAVA_LIBRARIES'",
"return",
"libdir",
"+",
"'/core-libart-hostdex_intermediates/classes.jack:'",
"+",
"libdir",
... | https://github.com/anestisb/oatdump_plus/blob/ba858c1596598f0d9ae79c14d08c708cecc50af3/tools/common/common.py#L119-L124 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/model/trajectory.py | python | HermiteTrajectory.stackDofs | (self,trajs,strict=True) | Stacks the degrees of freedom of multiple trajectories together.
The result is contained in self.
All evaluations are assumed to take place with the 'halt' endBehavior.
Args:
trajs (list or tuple of HermiteTrajectory): the trajectories to
stack
strict (... | Stacks the degrees of freedom of multiple trajectories together.
The result is contained in self. | [
"Stacks",
"the",
"degrees",
"of",
"freedom",
"of",
"multiple",
"trajectories",
"together",
".",
"The",
"result",
"is",
"contained",
"in",
"self",
"."
] | def stackDofs(self,trajs,strict=True):
"""Stacks the degrees of freedom of multiple trajectories together.
The result is contained in self.
All evaluations are assumed to take place with the 'halt' endBehavior.
Args:
trajs (list or tuple of HermiteTrajectory): the trajector... | [
"def",
"stackDofs",
"(",
"self",
",",
"trajs",
",",
"strict",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"trajs",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"raise",
"ValueError",
"(",
"\"HermiteTrajectory.stackDofs takes in a list of trajector... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/model/trajectory.py#L1036-L1072 | ||
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/google/protobuf/text_format.py | python | PrintFieldValue | (field, value, out, indent=0,
as_utf8=False, as_one_line=False) | Print a single field value (not including name). For repeated fields,
the value should be a single element. | Print a single field value (not including name). For repeated fields,
the value should be a single element. | [
"Print",
"a",
"single",
"field",
"value",
"(",
"not",
"including",
"name",
")",
".",
"For",
"repeated",
"fields",
"the",
"value",
"should",
"be",
"a",
"single",
"element",
"."
] | def PrintFieldValue(field, value, out, indent=0,
as_utf8=False, as_one_line=False):
"""Print a single field value (not including name). For repeated fields,
the value should be a single element."""
if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
if as_one_line:
out... | [
"def",
"PrintFieldValue",
"(",
"field",
",",
"value",
",",
"out",
",",
"indent",
"=",
"0",
",",
"as_utf8",
"=",
"False",
",",
"as_one_line",
"=",
"False",
")",
":",
"if",
"field",
".",
"cpp_type",
"==",
"descriptor",
".",
"FieldDescriptor",
".",
"CPPTYPE... | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/google/protobuf/text_format.py#L110-L143 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/pipeline.py | python | Pipeline.predict | (self, X) | return self.steps[-1][-1].predict(Xt) | Apply transforms to the data, and predict with the final estimator
Parameters
----------
X : iterable
Data to predict on. Must fulfill input requirements of first step
of the pipeline.
Returns
-------
y_pred : array-like | Apply transforms to the data, and predict with the final estimator | [
"Apply",
"transforms",
"to",
"the",
"data",
"and",
"predict",
"with",
"the",
"final",
"estimator"
] | def predict(self, X):
"""Apply transforms to the data, and predict with the final estimator
Parameters
----------
X : iterable
Data to predict on. Must fulfill input requirements of first step
of the pipeline.
Returns
-------
y_pred : arr... | [
"def",
"predict",
"(",
"self",
",",
"X",
")",
":",
"Xt",
"=",
"X",
"for",
"name",
",",
"transform",
"in",
"self",
".",
"steps",
"[",
":",
"-",
"1",
"]",
":",
"if",
"transform",
"is",
"not",
"None",
":",
"Xt",
"=",
"transform",
".",
"transform",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/pipeline.py#L310-L327 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/vitis/common/vitis_quantize_registry.py | python | VitisQuantizeRegistry.get_input_quantize_config | (self) | return config | Get input quantize config. | Get input quantize config. | [
"Get",
"input",
"quantize",
"config",
"."
] | def get_input_quantize_config(self):
"""Get input quantize config."""
config = self._configs['input_quantize_config']
input_bit = self.get_input_bit()
if input_bit:
config['input_quantizer']['quantizer_params']['bit_width'] = input_bit
logger.debug('Override default bit_width: input -> {}'.f... | [
"def",
"get_input_quantize_config",
"(",
"self",
")",
":",
"config",
"=",
"self",
".",
"_configs",
"[",
"'input_quantize_config'",
"]",
"input_bit",
"=",
"self",
".",
"get_input_bit",
"(",
")",
"if",
"input_bit",
":",
"config",
"[",
"'input_quantizer'",
"]",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/vitis/common/vitis_quantize_registry.py#L160-L171 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListHeaderData.GetText | (self) | return self._text | Returns the header/footer item text. | Returns the header/footer item text. | [
"Returns",
"the",
"header",
"/",
"footer",
"item",
"text",
"."
] | def GetText(self):
""" Returns the header/footer item text. """
return self._text | [
"def",
"GetText",
"(",
"self",
")",
":",
"return",
"self",
".",
"_text"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ultimatelistctrl.py#L3221-L3224 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/linux/rewrite_dirs.py | python | RewritePath | (path, opts) | Rewrites a path by stripping the prefix and prepending the sysroot. | Rewrites a path by stripping the prefix and prepending the sysroot. | [
"Rewrites",
"a",
"path",
"by",
"stripping",
"the",
"prefix",
"and",
"prepending",
"the",
"sysroot",
"."
] | def RewritePath(path, opts):
"""Rewrites a path by stripping the prefix and prepending the sysroot."""
sysroot = opts.sysroot
prefix = opts.strip_prefix
if os.path.isabs(path) and not path.startswith(sysroot):
if path.startswith(prefix):
path = path[len(prefix):]
path = path.lstrip('/')
return... | [
"def",
"RewritePath",
"(",
"path",
",",
"opts",
")",
":",
"sysroot",
"=",
"opts",
".",
"sysroot",
"prefix",
"=",
"opts",
".",
"strip_prefix",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
"and",
"not",
"path",
".",
"startswith",
"(",
"sysr... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/linux/rewrite_dirs.py#L22-L32 | ||
potassco/clingo | e0c91d8f95cc28de1c480a871f9c97c30de83d40 | libpyclingo/clingo/ast.py | python | Pool | (location: Location, arguments: Sequence[AST]) | return AST(p_ast[0]) | Construct an AST node of type `ASTType.Pool`. | Construct an AST node of type `ASTType.Pool`. | [
"Construct",
"an",
"AST",
"node",
"of",
"type",
"ASTType",
".",
"Pool",
"."
] | def Pool(location: Location, arguments: Sequence[AST]) -> AST:
'''
Construct an AST node of type `ASTType.Pool`.
'''
p_ast = _ffi.new('clingo_ast_t**')
c_location = _c_location(location)
_handle_error(_lib.clingo_ast_build(
_lib.clingo_ast_type_pool, p_ast,
c_location[0],
... | [
"def",
"Pool",
"(",
"location",
":",
"Location",
",",
"arguments",
":",
"Sequence",
"[",
"AST",
"]",
")",
"->",
"AST",
":",
"p_ast",
"=",
"_ffi",
".",
"new",
"(",
"'clingo_ast_t**'",
")",
"c_location",
"=",
"_c_location",
"(",
"location",
")",
"_handle_e... | https://github.com/potassco/clingo/blob/e0c91d8f95cc28de1c480a871f9c97c30de83d40/libpyclingo/clingo/ast.py#L1287-L1298 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | .ci/openvino-onnx/watchdog/src/git_wrapper.py | python | GitWrapper.get_git_time | (self) | return datetime_object | Retrieve time from GitHub.
Used to reliably determine time during Watchdog run.
:return: Datetime object describing current time
:rtype: datetime | Retrieve time from GitHub. | [
"Retrieve",
"time",
"from",
"GitHub",
"."
] | def get_git_time(self):
"""Retrieve time from GitHub.
Used to reliably determine time during Watchdog run.
:return: Datetime object describing current time
:rtype: datetime
"""
try:
datetime_object = self._get_git_time(... | [
"def",
"get_git_time",
"(",
"self",
")",
":",
"try",
":",
"datetime_object",
"=",
"self",
".",
"_get_git_time",
"(",
")",
"except",
"ValueError",
"as",
"e",
":",
"raise",
"GitWrapperError",
"(",
"str",
"(",
"e",
")",
")",
"except",
"GithubException",
"as",... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/.ci/openvino-onnx/watchdog/src/git_wrapper.py#L44-L62 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/fileinput.py | python | close | () | Close the sequence. | Close the sequence. | [
"Close",
"the",
"sequence",
"."
] | def close():
"""Close the sequence."""
global _state
state = _state
_state = None
if state:
state.close() | [
"def",
"close",
"(",
")",
":",
"global",
"_state",
"state",
"=",
"_state",
"_state",
"=",
"None",
"if",
"state",
":",
"state",
".",
"close",
"(",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/fileinput.py#L106-L112 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/requests/requests/sessions.py | python | Session.get | (self, url, **kwargs) | return self.request('GET', url, **kwargs) | Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes. | Sends a GET request. Returns :class:`Response` object. | [
"Sends",
"a",
"GET",
"request",
".",
"Returns",
":",
"class",
":",
"Response",
"object",
"."
] | def get(self, url, **kwargs):
"""Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
"""
kwargs.setdefault('allow_redirects', True)
return self.request(... | [
"def",
"get",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'allow_redirects'",
",",
"True",
")",
"return",
"self",
".",
"request",
"(",
"'GET'",
",",
"url",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/requests/requests/sessions.py#L465-L473 | |
ivansafrin/Polycode | 37a40fefe194ec7f6e9d1257f3bb3517b0a168bc | Bindings/Scripts/create_lua_library/zipfile.py | python | ZipFile.write | (self, filename, arcname=None, compress_type=None) | Put the bytes from filename into the archive under the name
arcname. | Put the bytes from filename into the archive under the name
arcname. | [
"Put",
"the",
"bytes",
"from",
"filename",
"into",
"the",
"archive",
"under",
"the",
"name",
"arcname",
"."
] | def write(self, filename, arcname=None, compress_type=None):
"""Put the bytes from filename into the archive under the name
arcname."""
if not self.fp:
raise RuntimeError(
"Attempt to write to ZIP archive that was already closed")
st = os.stat(filename)
... | [
"def",
"write",
"(",
"self",
",",
"filename",
",",
"arcname",
"=",
"None",
",",
"compress_type",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"fp",
":",
"raise",
"RuntimeError",
"(",
"\"Attempt to write to ZIP archive that was already closed\"",
")",
"st",
... | https://github.com/ivansafrin/Polycode/blob/37a40fefe194ec7f6e9d1257f3bb3517b0a168bc/Bindings/Scripts/create_lua_library/zipfile.py#L1042-L1121 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | examples/python/globals.py | python | globals | (command_args) | Extract all globals from any arguments which must be paths to object files. | Extract all globals from any arguments which must be paths to object files. | [
"Extract",
"all",
"globals",
"from",
"any",
"arguments",
"which",
"must",
"be",
"paths",
"to",
"object",
"files",
"."
] | def globals(command_args):
'''Extract all globals from any arguments which must be paths to object files.'''
usage = "usage: %prog [options] <PATH> [PATH ...]"
description = '''This command will find all globals in the specified object file and return an list() of lldb.SBValue objects (which might be empty)... | [
"def",
"globals",
"(",
"command_args",
")",
":",
"usage",
"=",
"\"usage: %prog [options] <PATH> [PATH ...]\"",
"description",
"=",
"'''This command will find all globals in the specified object file and return an list() of lldb.SBValue objects (which might be empty).'''",
"parser",
"=",
... | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/examples/python/globals.py#L67-L102 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/nn_impl.py | python | l2_normalize_v2 | (x, axis=None, epsilon=1e-12, name=None) | Normalizes along dimension `axis` using an L2 norm.
For a 1-D tensor with `axis = 0`, computes
output = x / sqrt(max(sum(x**2), epsilon))
For `x` with more dimensions, independently normalizes each 1-D slice along
dimension `axis`.
Args:
x: A `Tensor`.
axis: Dimension along which to normalize.... | Normalizes along dimension `axis` using an L2 norm. | [
"Normalizes",
"along",
"dimension",
"axis",
"using",
"an",
"L2",
"norm",
"."
] | def l2_normalize_v2(x, axis=None, epsilon=1e-12, name=None):
"""Normalizes along dimension `axis` using an L2 norm.
For a 1-D tensor with `axis = 0`, computes
output = x / sqrt(max(sum(x**2), epsilon))
For `x` with more dimensions, independently normalizes each 1-D slice along
dimension `axis`.
Args... | [
"def",
"l2_normalize_v2",
"(",
"x",
",",
"axis",
"=",
"None",
",",
"epsilon",
"=",
"1e-12",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"\"l2_normalize\"",
",",
"[",
"x",
"]",
")",
"as",
"name",
":",
"x",... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/nn_impl.py#L620-L645 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/more.py | python | split_when | (iterable, pred, maxsplit=-1) | Split *iterable* into pieces based on the output of *pred*.
*pred* should be a function that takes successive pairs of items and
returns ``True`` if the iterable should be split in between them.
For example, to find runs of increasing numbers, split the iterable when
element ``i`` is larger than elemen... | Split *iterable* into pieces based on the output of *pred*.
*pred* should be a function that takes successive pairs of items and
returns ``True`` if the iterable should be split in between them. | [
"Split",
"*",
"iterable",
"*",
"into",
"pieces",
"based",
"on",
"the",
"output",
"of",
"*",
"pred",
"*",
".",
"*",
"pred",
"*",
"should",
"be",
"a",
"function",
"that",
"takes",
"successive",
"pairs",
"of",
"items",
"and",
"returns",
"True",
"if",
"the... | def split_when(iterable, pred, maxsplit=-1):
"""Split *iterable* into pieces based on the output of *pred*.
*pred* should be a function that takes successive pairs of items and
returns ``True`` if the iterable should be split in between them.
For example, to find runs of increasing numbers, split the i... | [
"def",
"split_when",
"(",
"iterable",
",",
"pred",
",",
"maxsplit",
"=",
"-",
"1",
")",
":",
"if",
"maxsplit",
"==",
"0",
":",
"yield",
"list",
"(",
"iterable",
")",
"return",
"it",
"=",
"iter",
"(",
"iterable",
")",
"try",
":",
"cur_item",
"=",
"n... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/more.py#L1278-L1320 | ||
tiann/android-native-debug | 198903ed9346dc4a74327a63cb98d449b97d8047 | app/source/art/tools/cpplint.py | python | _CppLintState.PrintErrorCounts | (self) | Print a summary of errors by category, and the total. | Print a summary of errors by category, and the total. | [
"Print",
"a",
"summary",
"of",
"errors",
"by",
"category",
"and",
"the",
"total",
"."
] | def PrintErrorCounts(self):
"""Print a summary of errors by category, and the total."""
for category, count in self.errors_by_category.iteritems():
sys.stderr.write('Category \'%s\' errors found: %d\n' %
(category, count))
sys.stderr.write('Total errors found: %d\n' % self.error... | [
"def",
"PrintErrorCounts",
"(",
"self",
")",
":",
"for",
"category",
",",
"count",
"in",
"self",
".",
"errors_by_category",
".",
"iteritems",
"(",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"'Category \\'%s\\' errors found: %d\\n'",
"%",
"(",
"category... | https://github.com/tiann/android-native-debug/blob/198903ed9346dc4a74327a63cb98d449b97d8047/app/source/art/tools/cpplint.py#L621-L626 | ||
bitsai/book-exercises | 3a52330c6066090662bc2123d03aac270ef3ed10 | Learn Python the Hard Way/ex25.py | python | sort_words | (words) | return sorted(words) | Sorts the words. | Sorts the words. | [
"Sorts",
"the",
"words",
"."
] | def sort_words(words):
"""Sorts the words."""
return sorted(words) | [
"def",
"sort_words",
"(",
"words",
")",
":",
"return",
"sorted",
"(",
"words",
")"
] | https://github.com/bitsai/book-exercises/blob/3a52330c6066090662bc2123d03aac270ef3ed10/Learn Python the Hard Way/ex25.py#L6-L8 | |
echronos/echronos | c996f1d2c8af6c6536205eb319c1bf1d4d84569c | external_tools/ply_info/example/BASIC/basparse.py | python | p_command_for | (p) | command : FOR ID EQUALS expr TO expr optstep | command : FOR ID EQUALS expr TO expr optstep | [
"command",
":",
"FOR",
"ID",
"EQUALS",
"expr",
"TO",
"expr",
"optstep"
] | def p_command_for(p):
'''command : FOR ID EQUALS expr TO expr optstep'''
p[0] = ('FOR',p[2],p[4],p[6],p[7]) | [
"def",
"p_command_for",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"(",
"'FOR'",
",",
"p",
"[",
"2",
"]",
",",
"p",
"[",
"4",
"]",
",",
"p",
"[",
"6",
"]",
",",
"p",
"[",
"7",
"]",
")"
] | https://github.com/echronos/echronos/blob/c996f1d2c8af6c6536205eb319c1bf1d4d84569c/external_tools/ply_info/example/BASIC/basparse.py#L164-L166 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/signal/ltisys.py | python | impulse2 | (system, X0=None, T=None, N=None, **kwargs) | return Tr, Yr | Impulse response of a single-input, continuous-time linear system.
Parameters
----------
system : an instance of the LTI class or a tuple of array_like
describing the system.
The following gives the number of elements in the tuple and
the interpretation:
* 1 (instance o... | Impulse response of a single-input, continuous-time linear system. | [
"Impulse",
"response",
"of",
"a",
"single",
"-",
"input",
"continuous",
"-",
"time",
"linear",
"system",
"."
] | def impulse2(system, X0=None, T=None, N=None, **kwargs):
"""
Impulse response of a single-input, continuous-time linear system.
Parameters
----------
system : an instance of the LTI class or a tuple of array_like
describing the system.
The following gives the number of elements in t... | [
"def",
"impulse2",
"(",
"system",
",",
"X0",
"=",
"None",
",",
"T",
"=",
"None",
",",
"N",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"system",
",",
"lti",
")",
":",
"sys",
"=",
"system",
".",
"_as_ss",
"(",
")",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/signal/ltisys.py#L2126-L2212 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | Slider.GetThumbLength | (*args, **kwargs) | return _controls_.Slider_GetThumbLength(*args, **kwargs) | GetThumbLength(self) -> int | GetThumbLength(self) -> int | [
"GetThumbLength",
"(",
"self",
")",
"-",
">",
"int"
] | def GetThumbLength(*args, **kwargs):
"""GetThumbLength(self) -> int"""
return _controls_.Slider_GetThumbLength(*args, **kwargs) | [
"def",
"GetThumbLength",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"Slider_GetThumbLength",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L2891-L2893 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | tools/valgrind/gdb_helper.py | python | AddressTable.Add | (self, binary, address) | Register a lookup request. | Register a lookup request. | [
"Register",
"a",
"lookup",
"request",
"."
] | def Add(self, binary, address):
''' Register a lookup request. '''
if binary == '':
logging.warn('adding address %s in empty binary?' % address)
if binary in self._binaries:
self._binaries[binary].append(address)
else:
self._binaries[binary] = [address]
self._all_resolved = False | [
"def",
"Add",
"(",
"self",
",",
"binary",
",",
"address",
")",
":",
"if",
"binary",
"==",
"''",
":",
"logging",
".",
"warn",
"(",
"'adding address %s in empty binary?'",
"%",
"address",
")",
"if",
"binary",
"in",
"self",
".",
"_binaries",
":",
"self",
".... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/tools/valgrind/gdb_helper.py#L58-L66 | ||
SmileiPIC/Smilei | 07dcb51200029e10f626e1546558c1ae7599c8b1 | happi/_SmileiSimulation.py | python | SmileiSimulation.fieldInfo | (self, diag) | return dict( diagNumber=diagNumber, diagName=diagName, fields=fields ) | Information on a specific Field diagnostic
Parameters:
-----------
diag: the number or name of a Field diagnostic
Returns:
--------
A dictionnary containing:
* "diagNumber": the diagnostic number
* "diagName": the diagnostic name
* "fields": list of the available fields in this diagnostic. In th... | Information on a specific Field diagnostic
Parameters:
-----------
diag: the number or name of a Field diagnostic
Returns:
--------
A dictionnary containing:
* "diagNumber": the diagnostic number
* "diagName": the diagnostic name
* "fields": list of the available fields in this diagnostic. In th... | [
"Information",
"on",
"a",
"specific",
"Field",
"diagnostic",
"Parameters",
":",
"-----------",
"diag",
":",
"the",
"number",
"or",
"name",
"of",
"a",
"Field",
"diagnostic",
"Returns",
":",
"--------",
"A",
"dictionnary",
"containing",
":",
"*",
"diagNumber",
"... | def fieldInfo(self, diag):
""" Information on a specific Field diagnostic
Parameters:
-----------
diag: the number or name of a Field diagnostic
Returns:
--------
A dictionnary containing:
* "diagNumber": the diagnostic number
* "diagName": the diagnostic name
* "fields": list of the available... | [
"def",
"fieldInfo",
"(",
"self",
",",
"diag",
")",
":",
"diag_numbers",
",",
"diag_names",
"=",
"self",
".",
"getDiags",
"(",
"\"Fields\"",
")",
"if",
"type",
"(",
"diag",
")",
"is",
"str",
":",
"if",
"diag",
"not",
"in",
"diag_names",
":",
"raise",
... | https://github.com/SmileiPIC/Smilei/blob/07dcb51200029e10f626e1546558c1ae7599c8b1/happi/_SmileiSimulation.py#L227-L281 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/oauthlib/oauth2/rfc6749/request_validator.py | python | RequestValidator.get_default_redirect_uri | (self, client_id, request, *args, **kwargs) | Get the default redirect URI for the client.
:param client_id: Unicode client identifier
:param request: The HTTP Request (oauthlib.common.Request)
:rtype: The default redirect URI for the client
Method is used by:
- Authorization Code Grant
- Implicit Grant | Get the default redirect URI for the client. | [
"Get",
"the",
"default",
"redirect",
"URI",
"for",
"the",
"client",
"."
] | def get_default_redirect_uri(self, client_id, request, *args, **kwargs):
"""Get the default redirect URI for the client.
:param client_id: Unicode client identifier
:param request: The HTTP Request (oauthlib.common.Request)
:rtype: The default redirect URI for the client
Method... | [
"def",
"get_default_redirect_uri",
"(",
"self",
",",
"client_id",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
"'Subclasses must implement this method.'",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/oauthlib/oauth2/rfc6749/request_validator.py#L108-L119 | ||
microsoft/DirectXShaderCompiler | 8348ff8d9e0287610ba05d3a828e10af981a1c05 | utils/llvm-build/llvmbuild/main.py | python | add_magic_target_components | (parser, project, opts) | add_magic_target_components(project, opts) -> None
Add the "magic" target based components to the project, which can only be
determined based on the target configuration options.
This currently is responsible for populating the required_libraries list of
the "all-targets", "Native", "NativeCodeGen", a... | add_magic_target_components(project, opts) -> None | [
"add_magic_target_components",
"(",
"project",
"opts",
")",
"-",
">",
"None"
] | def add_magic_target_components(parser, project, opts):
"""add_magic_target_components(project, opts) -> None
Add the "magic" target based components to the project, which can only be
determined based on the target configuration options.
This currently is responsible for populating the required_librar... | [
"def",
"add_magic_target_components",
"(",
"parser",
",",
"project",
",",
"opts",
")",
":",
"# Determine the available targets.",
"available_targets",
"=",
"dict",
"(",
"(",
"ci",
".",
"name",
",",
"ci",
")",
"for",
"ci",
"in",
"project",
".",
"component_infos",... | https://github.com/microsoft/DirectXShaderCompiler/blob/8348ff8d9e0287610ba05d3a828e10af981a1c05/utils/llvm-build/llvmbuild/main.py#L708-L815 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/plugins/codebrowser/codebrowser/tagload.py | python | _TagLoader.GetGenerator | (self, lang_id) | return None | Get the tag generator method for the given language id
@param lang_id: Editra language identifier id
@return: Generator Method or None | Get the tag generator method for the given language id
@param lang_id: Editra language identifier id
@return: Generator Method or None | [
"Get",
"the",
"tag",
"generator",
"method",
"for",
"the",
"given",
"language",
"id",
"@param",
"lang_id",
":",
"Editra",
"language",
"identifier",
"id",
"@return",
":",
"Generator",
"Method",
"or",
"None"
] | def GetGenerator(self, lang_id):
"""Get the tag generator method for the given language id
@param lang_id: Editra language identifier id
@return: Generator Method or None
"""
if lang_id in LOAD_MAP:
modname = LOAD_MAP[lang_id]
self.LoadModule(modname)
... | [
"def",
"GetGenerator",
"(",
"self",
",",
"lang_id",
")",
":",
"if",
"lang_id",
"in",
"LOAD_MAP",
":",
"modname",
"=",
"LOAD_MAP",
"[",
"lang_id",
"]",
"self",
".",
"LoadModule",
"(",
"modname",
")",
"if",
"modname",
"in",
"_TagLoader",
".",
"_loaded",
":... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/plugins/codebrowser/codebrowser/tagload.py#L84-L95 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/balancer/module.py | python | Module.plan_rm | (self, plan: str) | return (0, '', '') | Discard an optimization plan | Discard an optimization plan | [
"Discard",
"an",
"optimization",
"plan"
] | def plan_rm(self, plan: str) -> Tuple[int, str, str]:
"""
Discard an optimization plan
"""
if plan in self.plans:
del self.plans[plan]
return (0, '', '') | [
"def",
"plan_rm",
"(",
"self",
",",
"plan",
":",
"str",
")",
"->",
"Tuple",
"[",
"int",
",",
"str",
",",
"str",
"]",
":",
"if",
"plan",
"in",
"self",
".",
"plans",
":",
"del",
"self",
".",
"plans",
"[",
"plan",
"]",
"return",
"(",
"0",
",",
"... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/balancer/module.py#L561-L567 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/nn/utils/spectral_norm.py | python | remove_spectral_norm | (module: T_module, name: str = 'weight') | return module | r"""Removes the spectral normalization reparameterization from a module.
Args:
module (Module): containing module
name (str, optional): name of weight parameter
Example:
>>> m = spectral_norm(nn.Linear(40, 10))
>>> remove_spectral_norm(m) | r"""Removes the spectral normalization reparameterization from a module. | [
"r",
"Removes",
"the",
"spectral",
"normalization",
"reparameterization",
"from",
"a",
"module",
"."
] | def remove_spectral_norm(module: T_module, name: str = 'weight') -> T_module:
r"""Removes the spectral normalization reparameterization from a module.
Args:
module (Module): containing module
name (str, optional): name of weight parameter
Example:
>>> m = spectral_norm(nn.Linear(40... | [
"def",
"remove_spectral_norm",
"(",
"module",
":",
"T_module",
",",
"name",
":",
"str",
"=",
"'weight'",
")",
"->",
"T_module",
":",
"for",
"k",
",",
"hook",
"in",
"module",
".",
"_forward_pre_hooks",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/nn/utils/spectral_norm.py#L284-L314 | |
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | build/unix/makepchinput.py | python | getParams | () | return rootSrcDir, modules, legacyPyROOT == 'ON', clingetpchList | Extract parameters from the commandline, which looks like
makePCHInput.py WWW XXX YYY ZZZ -- CXXFLAGS | Extract parameters from the commandline, which looks like
makePCHInput.py WWW XXX YYY ZZZ -- CXXFLAGS | [
"Extract",
"parameters",
"from",
"the",
"commandline",
"which",
"looks",
"like",
"makePCHInput",
".",
"py",
"WWW",
"XXX",
"YYY",
"ZZZ",
"--",
"CXXFLAGS"
] | def getParams():
"""
Extract parameters from the commandline, which looks like
makePCHInput.py WWW XXX YYY ZZZ -- CXXFLAGS
"""
argv = sys.argv
rootSrcDir, modules, legacyPyROOT = argv[1:4]
clingetpchList = argv[4:]
return rootSrcDir, modules, legacyPyROOT == 'ON', clingetpchList | [
"def",
"getParams",
"(",
")",
":",
"argv",
"=",
"sys",
".",
"argv",
"rootSrcDir",
",",
"modules",
",",
"legacyPyROOT",
"=",
"argv",
"[",
"1",
":",
"4",
"]",
"clingetpchList",
"=",
"argv",
"[",
"4",
":",
"]",
"return",
"rootSrcDir",
",",
"modules",
",... | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/build/unix/makepchinput.py#L36-L45 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/apitools/apitools/gen/extended_descriptor.py | python | _ProtoRpcPrinter.__PrintAdditionalImports | (self, imports) | Print additional imports needed for protorpc. | Print additional imports needed for protorpc. | [
"Print",
"additional",
"imports",
"needed",
"for",
"protorpc",
"."
] | def __PrintAdditionalImports(self, imports):
"""Print additional imports needed for protorpc."""
google_imports = [x for x in imports if 'google' in x]
other_imports = [x for x in imports if 'google' not in x]
if other_imports:
for import_ in sorted(other_imports):
... | [
"def",
"__PrintAdditionalImports",
"(",
"self",
",",
"imports",
")",
":",
"google_imports",
"=",
"[",
"x",
"for",
"x",
"in",
"imports",
"if",
"'google'",
"in",
"x",
"]",
"other_imports",
"=",
"[",
"x",
"for",
"x",
"in",
"imports",
"if",
"'google'",
"not"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/apitools/apitools/gen/extended_descriptor.py#L382-L395 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/mailcap.py | python | getcaps | () | return caps | Return a dictionary containing the mailcap database.
The dictionary maps a MIME type (in all lowercase, e.g. 'text/plain')
to a list of dictionaries corresponding to mailcap entries. The list
collects all the entries for that MIME type from all available mailcap
files. Each dictionary contains key-va... | Return a dictionary containing the mailcap database. | [
"Return",
"a",
"dictionary",
"containing",
"the",
"mailcap",
"database",
"."
] | def getcaps():
"""Return a dictionary containing the mailcap database.
The dictionary maps a MIME type (in all lowercase, e.g. 'text/plain')
to a list of dictionaries corresponding to mailcap entries. The list
collects all the entries for that MIME type from all available mailcap
files. Each dict... | [
"def",
"getcaps",
"(",
")",
":",
"caps",
"=",
"{",
"}",
"for",
"mailcap",
"in",
"listmailcapfiles",
"(",
")",
":",
"try",
":",
"fp",
"=",
"open",
"(",
"mailcap",
",",
"'r'",
")",
"except",
"IOError",
":",
"continue",
"with",
"fp",
":",
"morecaps",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/mailcap.py#L9-L32 | |
lighttransport/nanort | 74063967336311f54ede5dffdfa242123825033b | deps/cpplint.py | python | IsErrorSuppressedByNolint | (category, linenum) | return (linenum in _error_suppressions.get(category, set()) or
linenum in _error_suppressions.get(None, set())) | Returns true if the specified error category is suppressed on this line.
Consults the global error_suppressions map populated by
ParseNolintSuppressions/ResetNolintSuppressions.
Args:
category: str, the category of the error.
linenum: int, the current line number.
Returns:
bool, True iff the error... | Returns true if the specified error category is suppressed on this line. | [
"Returns",
"true",
"if",
"the",
"specified",
"error",
"category",
"is",
"suppressed",
"on",
"this",
"line",
"."
] | def IsErrorSuppressedByNolint(category, linenum):
"""Returns true if the specified error category is suppressed on this line.
Consults the global error_suppressions map populated by
ParseNolintSuppressions/ResetNolintSuppressions.
Args:
category: str, the category of the error.
linenum: int, the curre... | [
"def",
"IsErrorSuppressedByNolint",
"(",
"category",
",",
"linenum",
")",
":",
"return",
"(",
"linenum",
"in",
"_error_suppressions",
".",
"get",
"(",
"category",
",",
"set",
"(",
")",
")",
"or",
"linenum",
"in",
"_error_suppressions",
".",
"get",
"(",
"None... | https://github.com/lighttransport/nanort/blob/74063967336311f54ede5dffdfa242123825033b/deps/cpplint.py#L541-L554 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/closure_linter/closure_linter/ecmalintrules.py | python | EcmaScriptLintRules._HandleStartBracket | (self, token, last_non_space_token) | Handles a token that is an open bracket.
Args:
token: The token to handle.
last_non_space_token: The last token that was not a space. | Handles a token that is an open bracket. | [
"Handles",
"a",
"token",
"that",
"is",
"an",
"open",
"bracket",
"."
] | def _HandleStartBracket(self, token, last_non_space_token):
"""Handles a token that is an open bracket.
Args:
token: The token to handle.
last_non_space_token: The last token that was not a space.
"""
if (not token.IsFirstInLine() and token.previous.type == Type.WHITESPACE and
last_... | [
"def",
"_HandleStartBracket",
"(",
"self",
",",
"token",
",",
"last_non_space_token",
")",
":",
"if",
"(",
"not",
"token",
".",
"IsFirstInLine",
"(",
")",
"and",
"token",
".",
"previous",
".",
"type",
"==",
"Type",
".",
"WHITESPACE",
"and",
"last_non_space_t... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/closure_linter/closure_linter/ecmalintrules.py#L774-L806 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/pyfakefs/pyfakefs/fake_filesystem_shutil.py | python | FakeShutilModule.rmtree | (self, path, ignore_errors=False, onerror=None) | Remove a directory and all its contents.
Args:
path: (str) Directory tree to remove.
ignore_errors: (bool) unimplemented
onerror: (func) unimplemented | Remove a directory and all its contents. | [
"Remove",
"a",
"directory",
"and",
"all",
"its",
"contents",
"."
] | def rmtree(self, path, ignore_errors=False, onerror=None):
"""Remove a directory and all its contents.
Args:
path: (str) Directory tree to remove.
ignore_errors: (bool) unimplemented
onerror: (func) unimplemented
"""
self.filesystem.RemoveObject(path) | [
"def",
"rmtree",
"(",
"self",
",",
"path",
",",
"ignore_errors",
"=",
"False",
",",
"onerror",
"=",
"None",
")",
":",
"self",
".",
"filesystem",
".",
"RemoveObject",
"(",
"path",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/pyfakefs/pyfakefs/fake_filesystem_shutil.py#L67-L75 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/npdatetime.py | python | is_not_nat | (builder, val) | return builder.icmp(lc.ICMP_NE, val, NAT) | Return a predicate which is true if *val* is not NaT. | Return a predicate which is true if *val* is not NaT. | [
"Return",
"a",
"predicate",
"which",
"is",
"true",
"if",
"*",
"val",
"*",
"is",
"not",
"NaT",
"."
] | def is_not_nat(builder, val):
"""
Return a predicate which is true if *val* is not NaT.
"""
return builder.icmp(lc.ICMP_NE, val, NAT) | [
"def",
"is_not_nat",
"(",
"builder",
",",
"val",
")",
":",
"return",
"builder",
".",
"icmp",
"(",
"lc",
".",
"ICMP_NE",
",",
"val",
",",
"NAT",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/npdatetime.py#L92-L96 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/graphviz/py2/graphviz/files.py | python | File._view | (self, filepath, format, quiet) | Start the right viewer based on file format and platform. | Start the right viewer based on file format and platform. | [
"Start",
"the",
"right",
"viewer",
"based",
"on",
"file",
"format",
"and",
"platform",
"."
] | def _view(self, filepath, format, quiet):
"""Start the right viewer based on file format and platform."""
methodnames = [
'_view_%s_%s' % (format, backend.PLATFORM),
'_view_%s' % backend.PLATFORM,
]
for name in methodnames:
view_method = getattr(self, ... | [
"def",
"_view",
"(",
"self",
",",
"filepath",
",",
"format",
",",
"quiet",
")",
":",
"methodnames",
"=",
"[",
"'_view_%s_%s'",
"%",
"(",
"format",
",",
"backend",
".",
"PLATFORM",
")",
",",
"'_view_%s'",
"%",
"backend",
".",
"PLATFORM",
",",
"]",
"for"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/graphviz/py2/graphviz/files.py#L286-L300 | ||
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | v8_5_1/tools/stats-viewer.py | python | ChromeCounter.__init__ | (self, data, name_offset, value_offset) | Create a new instance.
Args:
data: the shared data access object containing the counter
name_offset: the byte offset of the start of this counter's name
value_offset: the byte offset of the start of this counter's value | Create a new instance. | [
"Create",
"a",
"new",
"instance",
"."
] | def __init__(self, data, name_offset, value_offset):
"""Create a new instance.
Args:
data: the shared data access object containing the counter
name_offset: the byte offset of the start of this counter's name
value_offset: the byte offset of the start of this counter's value
"""
self.... | [
"def",
"__init__",
"(",
"self",
",",
"data",
",",
"name_offset",
",",
"value_offset",
")",
":",
"self",
".",
"data",
"=",
"data",
"self",
".",
"name_offset",
"=",
"name_offset",
"self",
".",
"value_offset",
"=",
"value_offset"
] | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/v8_5_1/tools/stats-viewer.py#L386-L396 | ||
Komnomnomnom/swigibpy | cfd307fdbfaffabc69a2dc037538d7e34a8b8daf | swigibpy.py | python | ContractDetails.__init__ | (self) | __init__(ContractDetails self) -> ContractDetails | __init__(ContractDetails self) -> ContractDetails | [
"__init__",
"(",
"ContractDetails",
"self",
")",
"-",
">",
"ContractDetails"
] | def __init__(self):
"""__init__(ContractDetails self) -> ContractDetails"""
_swigibpy.ContractDetails_swiginit(self, _swigibpy.new_ContractDetails()) | [
"def",
"__init__",
"(",
"self",
")",
":",
"_swigibpy",
".",
"ContractDetails_swiginit",
"(",
"self",
",",
"_swigibpy",
".",
"new_ContractDetails",
"(",
")",
")"
] | https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L1046-L1048 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | _Stream.seek | (self, pos=0) | return self.pos | Set the stream's file pointer to pos. Negative seeking
is forbidden. | Set the stream's file pointer to pos. Negative seeking
is forbidden. | [
"Set",
"the",
"stream",
"s",
"file",
"pointer",
"to",
"pos",
".",
"Negative",
"seeking",
"is",
"forbidden",
"."
] | def seek(self, pos=0):
"""Set the stream's file pointer to pos. Negative seeking
is forbidden.
"""
if pos - self.pos >= 0:
blocks, remainder = divmod(pos - self.pos, self.bufsize)
for i in range(blocks):
self.read(self.bufsize)
self.... | [
"def",
"seek",
"(",
"self",
",",
"pos",
"=",
"0",
")",
":",
"if",
"pos",
"-",
"self",
".",
"pos",
">=",
"0",
":",
"blocks",
",",
"remainder",
"=",
"divmod",
"(",
"pos",
"-",
"self",
".",
"pos",
",",
"self",
".",
"bufsize",
")",
"for",
"i",
"i... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L552-L563 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/scripts/patchcheck.py | python | n_files_str | (count) | return "{} file{}".format(count, "s" if count != 1 else "") | Return 'N file(s)' with the proper plurality on 'file'. | Return 'N file(s)' with the proper plurality on 'file'. | [
"Return",
"N",
"file",
"(",
"s",
")",
"with",
"the",
"proper",
"plurality",
"on",
"file",
"."
] | def n_files_str(count):
"""Return 'N file(s)' with the proper plurality on 'file'."""
return "{} file{}".format(count, "s" if count != 1 else "") | [
"def",
"n_files_str",
"(",
"count",
")",
":",
"return",
"\"{} file{}\"",
".",
"format",
"(",
"count",
",",
"\"s\"",
"if",
"count",
"!=",
"1",
"else",
"\"\"",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/scripts/patchcheck.py#L24-L26 | |
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | llvm/examples/Kaleidoscope/MCJIT/cached/genk-timing.py | python | KScriptGenerator.updateCalledFunctionList | (self, callee) | Maintains a list of functions that will actually be called | Maintains a list of functions that will actually be called | [
"Maintains",
"a",
"list",
"of",
"functions",
"that",
"will",
"actually",
"be",
"called"
] | def updateCalledFunctionList(self, callee):
"""Maintains a list of functions that will actually be called"""
# Update the total call count
self.updateTotalCallCount(callee)
# If this function is already in the list, don't do anything else
if callee in self.calledFunctions:
... | [
"def",
"updateCalledFunctionList",
"(",
"self",
",",
"callee",
")",
":",
"# Update the total call count",
"self",
".",
"updateTotalCallCount",
"(",
"callee",
")",
"# If this function is already in the list, don't do anything else",
"if",
"callee",
"in",
"self",
".",
"called... | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/llvm/examples/Kaleidoscope/MCJIT/cached/genk-timing.py#L68-L80 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/dataview.py | python | PyDataViewModel._setCallbackInfo | (*args, **kwargs) | return _dataview.PyDataViewModel__setCallbackInfo(*args, **kwargs) | _setCallbackInfo(self, PyObject self, PyObject _class) | _setCallbackInfo(self, PyObject self, PyObject _class) | [
"_setCallbackInfo",
"(",
"self",
"PyObject",
"self",
"PyObject",
"_class",
")"
] | def _setCallbackInfo(*args, **kwargs):
"""_setCallbackInfo(self, PyObject self, PyObject _class)"""
return _dataview.PyDataViewModel__setCallbackInfo(*args, **kwargs) | [
"def",
"_setCallbackInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"PyDataViewModel__setCallbackInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/dataview.py#L776-L778 | |
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/utils.py | python | chop | (s, n=1, d=None) | return spl | Chops initial words from a string and returns a list of them and the rest of the string.
@param s: String to chop from.
@type s: str or unicode
@param n: Number of words to chop.
@type n: int
@param d: Optional delimeter. Any white-char by default.
@type d: str or unicode
@return: A list of... | Chops initial words from a string and returns a list of them and the rest of the string. | [
"Chops",
"initial",
"words",
"from",
"a",
"string",
"and",
"returns",
"a",
"list",
"of",
"them",
"and",
"the",
"rest",
"of",
"the",
"string",
"."
] | def chop(s, n=1, d=None):
'''Chops initial words from a string and returns a list of them and the rest of the string.
@param s: String to chop from.
@type s: str or unicode
@param n: Number of words to chop.
@type n: int
@param d: Optional delimeter. Any white-char by default.
@type d: str ... | [
"def",
"chop",
"(",
"s",
",",
"n",
"=",
"1",
",",
"d",
"=",
"None",
")",
":",
"spl",
"=",
"s",
".",
"split",
"(",
"d",
",",
"n",
")",
"if",
"len",
"(",
"spl",
")",
"==",
"n",
":",
"spl",
".",
"append",
"(",
"s",
"[",
":",
"0",
"]",
")... | https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/utils.py#L10-L29 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/best_response.py | python | CPPBestResponsePolicy.decision_nodes | (self, parent_state) | Yields a (state, cf_prob) pair for each descendant decision node. | Yields a (state, cf_prob) pair for each descendant decision node. | [
"Yields",
"a",
"(",
"state",
"cf_prob",
")",
"pair",
"for",
"each",
"descendant",
"decision",
"node",
"."
] | def decision_nodes(self, parent_state):
"""Yields a (state, cf_prob) pair for each descendant decision node."""
if not parent_state.is_terminal():
if parent_state.current_player() == self.best_responder_id:
yield (parent_state, 1.0)
for action, p_action in self.transitions(parent_state):
... | [
"def",
"decision_nodes",
"(",
"self",
",",
"parent_state",
")",
":",
"if",
"not",
"parent_state",
".",
"is_terminal",
"(",
")",
":",
"if",
"parent_state",
".",
"current_player",
"(",
")",
"==",
"self",
".",
"best_responder_id",
":",
"yield",
"(",
"parent_sta... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/best_response.py#L290-L297 | ||
acbull/Unbiased_LambdaMart | 7c39abe5caa18ca07df2d23c2db392916d92956c | evaluation/scripts/click_models.py | python | ClickModel.setClickProb | (self, neg_click_prob, pos_click_prob, relevance_grading_num) | Generate noisy click probability based on the relevance grading
number.
Inspired by ERR.
Parameters
----------
neg_click_prob : [type]
[description]
pos_click_prob : [type]
[description]
relevance_grading_num : [type]
[descript... | Generate noisy click probability based on the relevance grading
number.
Inspired by ERR. | [
"Generate",
"noisy",
"click",
"probability",
"based",
"on",
"the",
"relevance",
"grading",
"number",
".",
"Inspired",
"by",
"ERR",
"."
] | def setClickProb(self, neg_click_prob, pos_click_prob, relevance_grading_num):
"""Generate noisy click probability based on the relevance grading
number.
Inspired by ERR.
Parameters
----------
neg_click_prob : [type]
[description]
pos_click_prob : [ty... | [
"def",
"setClickProb",
"(",
"self",
",",
"neg_click_prob",
",",
"pos_click_prob",
",",
"relevance_grading_num",
")",
":",
"b",
"=",
"(",
"pos_click_prob",
"-",
"neg_click_prob",
")",
"/",
"(",
"pow",
"(",
"2",
",",
"relevance_grading_num",
")",
"-",
"1",
")"... | https://github.com/acbull/Unbiased_LambdaMart/blob/7c39abe5caa18ca07df2d23c2db392916d92956c/evaluation/scripts/click_models.py#L78-L96 | ||
cocos-creator/engine-native | 984c4c9f5838253313b44ccd429bd8fac4ec8a6a | tools/bindings-generator/generator.py | python | Generator.sorted_classes | (self) | return no_dupes | sorted classes in order of inheritance | sorted classes in order of inheritance | [
"sorted",
"classes",
"in",
"order",
"of",
"inheritance"
] | def sorted_classes(self):
'''
sorted classes in order of inheritance
'''
sorted_list = []
for class_name in iter(self.generated_classes.keys()):
nclass = self.generated_classes[class_name]
sorted_list += self._sorted_parents(nclass)
# remove dupes ... | [
"def",
"sorted_classes",
"(",
"self",
")",
":",
"sorted_list",
"=",
"[",
"]",
"for",
"class_name",
"in",
"iter",
"(",
"self",
".",
"generated_classes",
".",
"keys",
"(",
")",
")",
":",
"nclass",
"=",
"self",
".",
"generated_classes",
"[",
"class_name",
"... | https://github.com/cocos-creator/engine-native/blob/984c4c9f5838253313b44ccd429bd8fac4ec8a6a/tools/bindings-generator/generator.py#L1672-L1683 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/probability/distribution/_utils/utils.py | python | cast_type_for_device | (dtype) | return dtype | use the alternative dtype supported by the device.
Args:
dtype (mindspore.dtype): input dtype.
Returns:
mindspore.dtype. | use the alternative dtype supported by the device.
Args:
dtype (mindspore.dtype): input dtype.
Returns:
mindspore.dtype. | [
"use",
"the",
"alternative",
"dtype",
"supported",
"by",
"the",
"device",
".",
"Args",
":",
"dtype",
"(",
"mindspore",
".",
"dtype",
")",
":",
"input",
"dtype",
".",
"Returns",
":",
"mindspore",
".",
"dtype",
"."
] | def cast_type_for_device(dtype):
"""
use the alternative dtype supported by the device.
Args:
dtype (mindspore.dtype): input dtype.
Returns:
mindspore.dtype.
"""
if context.get_context("device_target") == "GPU":
if dtype in mstype.uint_type or dtype == mstype.int8:
... | [
"def",
"cast_type_for_device",
"(",
"dtype",
")",
":",
"if",
"context",
".",
"get_context",
"(",
"\"device_target\"",
")",
"==",
"\"GPU\"",
":",
"if",
"dtype",
"in",
"mstype",
".",
"uint_type",
"or",
"dtype",
"==",
"mstype",
".",
"int8",
":",
"return",
"ms... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/probability/distribution/_utils/utils.py#L56-L71 | |
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/ogr.py | python | FieldDefn.SetDomainName | (self, *args) | return _ogr.FieldDefn_SetDomainName(self, *args) | r"""
SetDomainName(FieldDefn self, char const * name)
void
OGR_Fld_SetDomainName(OGRFieldDefnH hDefn, const char *pszFieldName)
Set the name of the field domain for this field.
Field domains ( OGRFieldDomain) are attached at the GDALDataset level.
This method is the sa... | r"""
SetDomainName(FieldDefn self, char const * name)
void
OGR_Fld_SetDomainName(OGRFieldDefnH hDefn, const char *pszFieldName) | [
"r",
"SetDomainName",
"(",
"FieldDefn",
"self",
"char",
"const",
"*",
"name",
")",
"void",
"OGR_Fld_SetDomainName",
"(",
"OGRFieldDefnH",
"hDefn",
"const",
"char",
"*",
"pszFieldName",
")"
] | def SetDomainName(self, *args):
r"""
SetDomainName(FieldDefn self, char const * name)
void
OGR_Fld_SetDomainName(OGRFieldDefnH hDefn, const char *pszFieldName)
Set the name of the field domain for this field.
Field domains ( OGRFieldDomain) are attached at the GDALDatas... | [
"def",
"SetDomainName",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_ogr",
".",
"FieldDefn_SetDomainName",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/ogr.py#L5546-L5568 | |
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/xcode_emulation.py | python | XcodeSettings.GetCflagsObjC | (self, configname) | return cflags_objc | Returns flags that need to be added to .m compilations. | Returns flags that need to be added to .m compilations. | [
"Returns",
"flags",
"that",
"need",
"to",
"be",
"added",
"to",
".",
"m",
"compilations",
"."
] | def GetCflagsObjC(self, configname):
"""Returns flags that need to be added to .m compilations."""
self.configname = configname
cflags_objc = []
self._AddObjectiveCGarbageCollectionFlags(cflags_objc)
self._AddObjectiveCARCFlags(cflags_objc)
self._AddObjectiveCMissingPropertySynthesisFlags(cflags... | [
"def",
"GetCflagsObjC",
"(",
"self",
",",
"configname",
")",
":",
"self",
".",
"configname",
"=",
"configname",
"cflags_objc",
"=",
"[",
"]",
"self",
".",
"_AddObjectiveCGarbageCollectionFlags",
"(",
"cflags_objc",
")",
"self",
".",
"_AddObjectiveCARCFlags",
"(",
... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/xcode_emulation.py#L652-L660 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBUnixSignals.IsValid | (self) | return _lldb.SBUnixSignals_IsValid(self) | IsValid(self) -> bool | IsValid(self) -> bool | [
"IsValid",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsValid(self):
"""IsValid(self) -> bool"""
return _lldb.SBUnixSignals_IsValid(self) | [
"def",
"IsValid",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBUnixSignals_IsValid",
"(",
"self",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L12717-L12719 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py2/prompt_toolkit/contrib/telnet/protocol.py | python | TelnetProtocolParser.wont_received | (self, data) | Received telnet WONT command. | Received telnet WONT command. | [
"Received",
"telnet",
"WONT",
"command",
"."
] | def wont_received(self, data):
""" Received telnet WONT command. """
logger.info('WONT %r', data) | [
"def",
"wont_received",
"(",
"self",
",",
"data",
")",
":",
"logger",
".",
"info",
"(",
"'WONT %r'",
",",
"data",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py2/prompt_toolkit/contrib/telnet/protocol.py#L82-L84 | ||
zju3dv/clean-pvnet | 5870c509e3cc205e1bb28910a7b1a9a3c8add9a8 | lib/csrc/ransac_voting/ransac_voting_gpu.py | python | ransac_voting_layer_v3 | (mask, vertex, round_hyp_num, inlier_thresh=0.999, confidence=0.99, max_iter=20,
min_num=5, max_num=30000) | return batch_win_pts | :param mask: [b,h,w]
:param vertex: [b,h,w,vn,2]
:param round_hyp_num:
:param inlier_thresh:
:return: [b,vn,2] | :param mask: [b,h,w]
:param vertex: [b,h,w,vn,2]
:param round_hyp_num:
:param inlier_thresh:
:return: [b,vn,2] | [
":",
"param",
"mask",
":",
"[",
"b",
"h",
"w",
"]",
":",
"param",
"vertex",
":",
"[",
"b",
"h",
"w",
"vn",
"2",
"]",
":",
"param",
"round_hyp_num",
":",
":",
"param",
"inlier_thresh",
":",
":",
"return",
":",
"[",
"b",
"vn",
"2",
"]"
] | def ransac_voting_layer_v3(mask, vertex, round_hyp_num, inlier_thresh=0.999, confidence=0.99, max_iter=20,
min_num=5, max_num=30000):
'''
:param mask: [b,h,w]
:param vertex: [b,h,w,vn,2]
:param round_hyp_num:
:param inlier_thresh:
:return: [b,vn,2]
'''
... | [
"def",
"ransac_voting_layer_v3",
"(",
"mask",
",",
"vertex",
",",
"round_hyp_num",
",",
"inlier_thresh",
"=",
"0.999",
",",
"confidence",
"=",
"0.99",
",",
"max_iter",
"=",
"20",
",",
"min_num",
"=",
"5",
",",
"max_num",
"=",
"30000",
")",
":",
"b",
",",... | https://github.com/zju3dv/clean-pvnet/blob/5870c509e3cc205e1bb28910a7b1a9a3c8add9a8/lib/csrc/ransac_voting/ransac_voting_gpu.py#L112-L199 | |
yuxng/PoseCNN | 9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04 | lib/datasets/ycb_single.py | python | ycb_single.image_path_at | (self, i) | return self.image_path_from_index(self.image_index[i]) | Return the absolute path to image i in the image sequence. | Return the absolute path to image i in the image sequence. | [
"Return",
"the",
"absolute",
"path",
"to",
"image",
"i",
"in",
"the",
"image",
"sequence",
"."
] | def image_path_at(self, i):
"""
Return the absolute path to image i in the image sequence.
"""
return self.image_path_from_index(self.image_index[i]) | [
"def",
"image_path_at",
"(",
"self",
",",
"i",
")",
":",
"return",
"self",
".",
"image_path_from_index",
"(",
"self",
".",
"image_index",
"[",
"i",
"]",
")"
] | https://github.com/yuxng/PoseCNN/blob/9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04/lib/datasets/ycb_single.py#L73-L77 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/sparse/frame.py | python | SparseDataFrame.applymap | (self, func) | return self.apply(lambda x: lmap(func, x)) | Apply a function to a DataFrame that is intended to operate
elementwise, i.e. like doing map(func, series) for each series in the
DataFrame
Parameters
----------
func : function
Python function, returns a single value from a single value
Returns
----... | Apply a function to a DataFrame that is intended to operate
elementwise, i.e. like doing map(func, series) for each series in the
DataFrame | [
"Apply",
"a",
"function",
"to",
"a",
"DataFrame",
"that",
"is",
"intended",
"to",
"operate",
"elementwise",
"i",
".",
"e",
".",
"like",
"doing",
"map",
"(",
"func",
"series",
")",
"for",
"each",
"series",
"in",
"the",
"DataFrame"
] | def applymap(self, func):
"""
Apply a function to a DataFrame that is intended to operate
elementwise, i.e. like doing map(func, series) for each series in the
DataFrame
Parameters
----------
func : function
Python function, returns a single value fro... | [
"def",
"applymap",
"(",
"self",
",",
"func",
")",
":",
"return",
"self",
".",
"apply",
"(",
"lambda",
"x",
":",
"lmap",
"(",
"func",
",",
"x",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/sparse/frame.py#L932-L947 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/scripts/doxypy.py | python | Doxypy.parseFile | (self, filename) | Parses a python file given as input string and returns the doxygen-
compatible representation.
@param input the python code to parse
@returns the modified python code | Parses a python file given as input string and returns the doxygen-
compatible representation. | [
"Parses",
"a",
"python",
"file",
"given",
"as",
"input",
"string",
"and",
"returns",
"the",
"doxygen",
"-",
"compatible",
"representation",
"."
] | def parseFile(self, filename):
"""Parses a python file given as input string and returns the doxygen-
compatible representation.
@param input the python code to parse
@returns the modified python code
"""
f = open(filename, 'r')
for line i... | [
"def",
"parseFile",
"(",
"self",
",",
"filename",
")",
":",
"f",
"=",
"open",
"(",
"filename",
",",
"'r'",
")",
"for",
"line",
"in",
"f",
":",
"self",
".",
"parseLine",
"(",
"line",
".",
"rstrip",
"(",
"'\\r\\n'",
")",
")",
"if",
"self",
".",
"fs... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/scripts/doxypy.py#L387-L401 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/mailcap.py | python | findmatch | (caps, MIMEtype, key='view', filename="/dev/null", plist=[]) | return None, None | Find a match for a mailcap entry.
Return a tuple containing the command line, and the mailcap entry
used; (None, None) if no match is found. This may invoke the
'test' command of several matching entries before deciding which
entry to use. | Find a match for a mailcap entry. | [
"Find",
"a",
"match",
"for",
"a",
"mailcap",
"entry",
"."
] | def findmatch(caps, MIMEtype, key='view', filename="/dev/null", plist=[]):
"""Find a match for a mailcap entry.
Return a tuple containing the command line, and the mailcap entry
used; (None, None) if no match is found. This may invoke the
'test' command of several matching entries before deciding whic... | [
"def",
"findmatch",
"(",
"caps",
",",
"MIMEtype",
",",
"key",
"=",
"'view'",
",",
"filename",
"=",
"\"/dev/null\"",
",",
"plist",
"=",
"[",
"]",
")",
":",
"entries",
"=",
"lookup",
"(",
"caps",
",",
"MIMEtype",
",",
"key",
")",
"# XXX This code should so... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/mailcap.py#L138-L156 | |
cyberbotics/webots | af7fa7d68dcf7b4550f1f2e132092b41e83698fc | resources/osm_importer/webots_objects/road.py | python | Road.add_to_list | (osmid, tags, refs) | Add a new road to the list of roads. | Add a new road to the list of roads. | [
"Add",
"a",
"new",
"road",
"to",
"the",
"list",
"of",
"roads",
"."
] | def add_to_list(osmid, tags, refs):
"""Add a new road to the list of roads."""
settingsSection = Settings.get_section('road', tags['highway'])
if settingsSection is None:
return
road = Road()
road.osmid = osmid
road.id = str(osmid)
road.refs = refs
... | [
"def",
"add_to_list",
"(",
"osmid",
",",
"tags",
",",
"refs",
")",
":",
"settingsSection",
"=",
"Settings",
".",
"get_section",
"(",
"'road'",
",",
"tags",
"[",
"'highway'",
"]",
")",
"if",
"settingsSection",
"is",
"None",
":",
"return",
"road",
"=",
"Ro... | https://github.com/cyberbotics/webots/blob/af7fa7d68dcf7b4550f1f2e132092b41e83698fc/resources/osm_importer/webots_objects/road.py#L322-L338 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/cmd.py | python | Cmd.parseline | (self, line) | return cmd, arg, line | Parse the line into a command name and a string containing
the arguments. Returns a tuple containing (command, args, line).
'command' and 'args' may be None if the line couldn't be parsed. | Parse the line into a command name and a string containing
the arguments. Returns a tuple containing (command, args, line).
'command' and 'args' may be None if the line couldn't be parsed. | [
"Parse",
"the",
"line",
"into",
"a",
"command",
"name",
"and",
"a",
"string",
"containing",
"the",
"arguments",
".",
"Returns",
"a",
"tuple",
"containing",
"(",
"command",
"args",
"line",
")",
".",
"command",
"and",
"args",
"may",
"be",
"None",
"if",
"th... | def parseline(self, line):
"""Parse the line into a command name and a string containing
the arguments. Returns a tuple containing (command, args, line).
'command' and 'args' may be None if the line couldn't be parsed.
"""
line = line.strip()
if not line:
ret... | [
"def",
"parseline",
"(",
"self",
",",
"line",
")",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"if",
"not",
"line",
":",
"return",
"None",
",",
"None",
",",
"line",
"elif",
"line",
"[",
"0",
"]",
"==",
"'?'",
":",
"line",
"=",
"'help '",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/cmd.py#L176-L194 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/utils/metrics_utils.py | python | ragged_assert_compatible_and_get_flat_values | (values, mask=None) | return values, mask | If ragged, it checks the compatibility and then returns the flat_values.
Note: If two tensors are dense, it does not check their compatibility.
Note: Although two ragged tensors with different ragged ranks could have
identical overall rank and dimension sizes and hence be compatible,
we... | If ragged, it checks the compatibility and then returns the flat_values. | [
"If",
"ragged",
"it",
"checks",
"the",
"compatibility",
"and",
"then",
"returns",
"the",
"flat_values",
"."
] | def ragged_assert_compatible_and_get_flat_values(values, mask=None):
"""If ragged, it checks the compatibility and then returns the flat_values.
Note: If two tensors are dense, it does not check their compatibility.
Note: Although two ragged tensors with different ragged ranks could have
identic... | [
"def",
"ragged_assert_compatible_and_get_flat_values",
"(",
"values",
",",
"mask",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"values",
",",
"list",
")",
":",
"is_all_ragged",
"=",
"all",
"(",
"isinstance",
"(",
"rt",
",",
"ragged_tensor",
".",
"RaggedTen... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/utils/metrics_utils.py#L772-L831 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/data/experimental/ops/resampling.py | python | rejection_resample | (class_func, target_dist, initial_dist=None, seed=None) | return _apply_fn | A transformation that resamples a dataset to achieve a target distribution.
**NOTE** Resampling is performed via rejection sampling; some fraction
of the input values will be dropped.
Args:
class_func: A function mapping an element of the input dataset to a scalar
`tf.int32` tensor. Values should be i... | A transformation that resamples a dataset to achieve a target distribution. | [
"A",
"transformation",
"that",
"resamples",
"a",
"dataset",
"to",
"achieve",
"a",
"target",
"distribution",
"."
] | def rejection_resample(class_func, target_dist, initial_dist=None, seed=None):
"""A transformation that resamples a dataset to achieve a target distribution.
**NOTE** Resampling is performed via rejection sampling; some fraction
of the input values will be dropped.
Args:
class_func: A function mapping an ... | [
"def",
"rejection_resample",
"(",
"class_func",
",",
"target_dist",
",",
"initial_dist",
"=",
"None",
",",
"seed",
"=",
"None",
")",
":",
"def",
"_apply_fn",
"(",
"dataset",
")",
":",
"\"\"\"Function from `Dataset` to `Dataset` that applies the transformation.\"\"\"",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/data/experimental/ops/resampling.py#L38-L101 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TStr_IsAbsFPath | (*args) | return _snap.TStr_IsAbsFPath(*args) | TStr_IsAbsFPath(TStr FPath) -> bool
Parameters:
FPath: TStr const & | TStr_IsAbsFPath(TStr FPath) -> bool | [
"TStr_IsAbsFPath",
"(",
"TStr",
"FPath",
")",
"-",
">",
"bool"
] | def TStr_IsAbsFPath(*args):
"""
TStr_IsAbsFPath(TStr FPath) -> bool
Parameters:
FPath: TStr const &
"""
return _snap.TStr_IsAbsFPath(*args) | [
"def",
"TStr_IsAbsFPath",
"(",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TStr_IsAbsFPath",
"(",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L11203-L11211 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/internal/platform/posix_platform_backend.py | python | PosixPlatformBackend._GetTopOutput | (self, pid, columns) | return self.RunCommand(args).splitlines() | Returns output of the 'top' command as a list of lines.
Args:
pid: pid of process to examine.
columns: A list of require columns, e.g., ['idlew', 'vsize']. | Returns output of the 'top' command as a list of lines. | [
"Returns",
"output",
"of",
"the",
"top",
"command",
"as",
"a",
"list",
"of",
"lines",
"."
] | def _GetTopOutput(self, pid, columns):
"""Returns output of the 'top' command as a list of lines.
Args:
pid: pid of process to examine.
columns: A list of require columns, e.g., ['idlew', 'vsize'].
"""
args = ['top']
args.extend(['-pid', str(pid), '-l', '1', '-s', '0', '-stats',
... | [
"def",
"_GetTopOutput",
"(",
"self",
",",
"pid",
",",
"columns",
")",
":",
"args",
"=",
"[",
"'top'",
"]",
"args",
".",
"extend",
"(",
"[",
"'-pid'",
",",
"str",
"(",
"pid",
")",
",",
"'-l'",
",",
"'1'",
",",
"'-s'",
",",
"'0'",
",",
"'-stats'",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/internal/platform/posix_platform_backend.py#L61-L71 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/android/loading/dependency_graph.py | python | RequestDependencyGraph.Cost | (self, from_first_request=True, path_list=None, costs_out=None) | Returns the cost of the graph, that is the costliest path.
Args:
from_first_request: (boolean) If True, only considers paths that originate
from the first request node.
path_list: (list) See graph.Cost().
costs_out: (list) See graph.Cost(). | Returns the cost of the graph, that is the costliest path. | [
"Returns",
"the",
"cost",
"of",
"the",
"graph",
"that",
"is",
"the",
"costliest",
"path",
"."
] | def Cost(self, from_first_request=True, path_list=None, costs_out=None):
"""Returns the cost of the graph, that is the costliest path.
Args:
from_first_request: (boolean) If True, only considers paths that originate
from the first request node.
path_list: (list) See graph.... | [
"def",
"Cost",
"(",
"self",
",",
"from_first_request",
"=",
"True",
",",
"path_list",
"=",
"None",
",",
"costs_out",
"=",
"None",
")",
":",
"if",
"from_first_request",
":",
"return",
"self",
".",
"_deps_graph",
".",
"Cost",
"(",
"[",
"self",
".",
"_first... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/android/loading/dependency_graph.py#L117-L130 | ||
facebookresearch/faiss | eb8781557f556505ca93f6f21fff932e17f0d9e0 | benchs/bench_gpu_1bn.py | python | compute_populated_index | (preproc) | return gpu_index, indexall | Add elements to a sharded index. Return the index and if available
a sharded gpu_index that contains the same data. | Add elements to a sharded index. Return the index and if available
a sharded gpu_index that contains the same data. | [
"Add",
"elements",
"to",
"a",
"sharded",
"index",
".",
"Return",
"the",
"index",
"and",
"if",
"available",
"a",
"sharded",
"gpu_index",
"that",
"contains",
"the",
"same",
"data",
"."
] | def compute_populated_index(preproc):
"""Add elements to a sharded index. Return the index and if available
a sharded gpu_index that contains the same data. """
indexall = prepare_trained_index(preproc)
co = faiss.GpuMultipleClonerOptions()
co.useFloat16 = use_float16
co.useFloat16CoarseQuanti... | [
"def",
"compute_populated_index",
"(",
"preproc",
")",
":",
"indexall",
"=",
"prepare_trained_index",
"(",
"preproc",
")",
"co",
"=",
"faiss",
".",
"GpuMultipleClonerOptions",
"(",
")",
"co",
".",
"useFloat16",
"=",
"use_float16",
"co",
".",
"useFloat16CoarseQuant... | https://github.com/facebookresearch/faiss/blob/eb8781557f556505ca93f6f21fff932e17f0d9e0/benchs/bench_gpu_1bn.py#L501-L562 | |
Tokutek/mongo | 0653eabe2c5b9d12b4814617cb7fb2d799937a0f | buildscripts/cpplint.py | python | _SetFilters | (filters) | Sets the module's error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "whitespace/indent").
Each filter should start with + or -; else we die. | Sets the module's error-message filters. | [
"Sets",
"the",
"module",
"s",
"error",
"-",
"message",
"filters",
"."
] | def _SetFilters(filters):
"""Sets the module's error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "whitespace/indent").
Each filter should start with + or -; else we die.
"""
_cpplint... | [
"def",
"_SetFilters",
"(",
"filters",
")",
":",
"_cpplint_state",
".",
"SetFilters",
"(",
"filters",
")"
] | https://github.com/Tokutek/mongo/blob/0653eabe2c5b9d12b4814617cb7fb2d799937a0f/buildscripts/cpplint.py#L601-L611 | ||
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Variables/__init__.py | python | Variables.Update | (self, env, args=None) | Update an environment with the option variables.
env - the environment to update. | Update an environment with the option variables. | [
"Update",
"an",
"environment",
"with",
"the",
"option",
"variables",
"."
] | def Update(self, env, args=None):
"""
Update an environment with the option variables.
env - the environment to update.
"""
values = {}
# first set the defaults:
for option in self.options:
if option.default is not None:
values[optio... | [
"def",
"Update",
"(",
"self",
",",
"env",
",",
"args",
"=",
"None",
")",
":",
"values",
"=",
"{",
"}",
"# first set the defaults:",
"for",
"option",
"in",
"self",
".",
"options",
":",
"if",
"option",
".",
"default",
"is",
"not",
"None",
":",
"values",
... | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Variables/__init__.py#L158-L225 | ||
qgis/QGIS | 15a77662d4bb712184f6aa60d0bd663010a76a75 | python/plugins/processing/gui/HistoryDialog.py | python | TreeLogEntryItem.as_qgis_process_command | (self) | return self.entry.entry.get('process_command') | Returns the entry as a qgis_process command, if possible | Returns the entry as a qgis_process command, if possible | [
"Returns",
"the",
"entry",
"as",
"a",
"qgis_process",
"command",
"if",
"possible"
] | def as_qgis_process_command(self) -> Optional[str]:
"""
Returns the entry as a qgis_process command, if possible
"""
return self.entry.entry.get('process_command') | [
"def",
"as_qgis_process_command",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"entry",
".",
"entry",
".",
"get",
"(",
"'process_command'",
")"
] | https://github.com/qgis/QGIS/blob/15a77662d4bb712184f6aa60d0bd663010a76a75/python/plugins/processing/gui/HistoryDialog.py#L290-L294 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/timeseries/python/timeseries/state_management.py | python | ChainingStateManager._update_cached_states | (self, model, features, mode) | return loss_op, end_state, batch_predictions | Read, process, and write chunks to the cache. | Read, process, and write chunks to the cache. | [
"Read",
"process",
"and",
"write",
"chunks",
"to",
"the",
"cache",
"."
] | def _update_cached_states(self, model, features, mode):
"""Read, process, and write chunks to the cache."""
times = features[feature_keys.TrainEvalFeatures.TIMES]
looked_up_state = self._get_cached_states(times[:, 0])
(model_loss, intermediate_states,
batch_predictions) = model.per_step_batch_loss(... | [
"def",
"_update_cached_states",
"(",
"self",
",",
"model",
",",
"features",
",",
"mode",
")",
":",
"times",
"=",
"features",
"[",
"feature_keys",
".",
"TrainEvalFeatures",
".",
"TIMES",
"]",
"looked_up_state",
"=",
"self",
".",
"_get_cached_states",
"(",
"time... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/timeseries/python/timeseries/state_management.py#L230-L265 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | IconLocation.GetIndex | (*args, **kwargs) | return _gdi_.IconLocation_GetIndex(*args, **kwargs) | GetIndex(self) -> int | GetIndex(self) -> int | [
"GetIndex",
"(",
"self",
")",
"-",
">",
"int"
] | def GetIndex(*args, **kwargs):
"""GetIndex(self) -> int"""
return _gdi_.IconLocation_GetIndex(*args, **kwargs) | [
"def",
"GetIndex",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"IconLocation_GetIndex",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L1368-L1370 | |
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/pkg_resources/__init__.py | python | non_empty_lines | (path) | Yield non-empty lines from file at path | Yield non-empty lines from file at path | [
"Yield",
"non",
"-",
"empty",
"lines",
"from",
"file",
"at",
"path"
] | def non_empty_lines(path):
"""
Yield non-empty lines from file at path
"""
with open(path) as f:
for line in f:
line = line.strip()
if line:
yield line | [
"def",
"non_empty_lines",
"(",
"path",
")",
":",
"with",
"open",
"(",
"path",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"if",
"line",
":",
"yield",
"line"
] | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/pkg_resources/__init__.py#L2042-L2050 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBTypeFilter.__ne__ | (self, rhs) | return _lldb.SBTypeFilter___ne__(self, rhs) | __ne__(SBTypeFilter self, SBTypeFilter rhs) -> bool | __ne__(SBTypeFilter self, SBTypeFilter rhs) -> bool | [
"__ne__",
"(",
"SBTypeFilter",
"self",
"SBTypeFilter",
"rhs",
")",
"-",
">",
"bool"
] | def __ne__(self, rhs):
"""__ne__(SBTypeFilter self, SBTypeFilter rhs) -> bool"""
return _lldb.SBTypeFilter___ne__(self, rhs) | [
"def",
"__ne__",
"(",
"self",
",",
"rhs",
")",
":",
"return",
"_lldb",
".",
"SBTypeFilter___ne__",
"(",
"self",
",",
"rhs",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L13508-L13510 | |
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/sping/WX/pidWxDc.py | python | PiddleWxDc.fontAscent | (self, font=None) | return self.dc.GetCharHeight() - self.fontDescent(font) | Find the ascent (height above base) of the given font. | Find the ascent (height above base) of the given font. | [
"Find",
"the",
"ascent",
"(",
"height",
"above",
"base",
")",
"of",
"the",
"given",
"font",
"."
] | def fontAscent(self, font=None):
'''Find the ascent (height above base) of the given font.'''
wx_font = self._setWXfont(font)
return self.dc.GetCharHeight() - self.fontDescent(font) | [
"def",
"fontAscent",
"(",
"self",
",",
"font",
"=",
"None",
")",
":",
"wx_font",
"=",
"self",
".",
"_setWXfont",
"(",
"font",
")",
"return",
"self",
".",
"dc",
".",
"GetCharHeight",
"(",
")",
"-",
"self",
".",
"fontDescent",
"(",
"font",
")"
] | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/sping/WX/pidWxDc.py#L142-L145 | |
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/pymcuprog/nvmspi.py | python | NvmAccessProviderCmsisDapSpi.stop | (self) | Stop programming session | Stop programming session | [
"Stop",
"programming",
"session"
] | def stop(self):
"""
Stop programming session
"""
self.isp.leave_progmode() | [
"def",
"stop",
"(",
"self",
")",
":",
"self",
".",
"isp",
".",
"leave_progmode",
"(",
")"
] | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/pymcuprog/nvmspi.py#L30-L34 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/model_selection/_validation.py | python | permutation_test_score | (estimator, X, y, groups=None, cv=None,
n_permutations=100, n_jobs=1, random_state=0,
verbose=0, scoring=None) | return score, permutation_scores, pvalue | Evaluate the significance of a cross-validated score with permutations
Read more in the :ref:`User Guide <cross_validation>`.
Parameters
----------
estimator : estimator object implementing 'fit'
The object to use to fit the data.
X : array-like of shape at least 2D
The data to fi... | Evaluate the significance of a cross-validated score with permutations | [
"Evaluate",
"the",
"significance",
"of",
"a",
"cross",
"-",
"validated",
"score",
"with",
"permutations"
] | def permutation_test_score(estimator, X, y, groups=None, cv=None,
n_permutations=100, n_jobs=1, random_state=0,
verbose=0, scoring=None):
"""Evaluate the significance of a cross-validated score with permutations
Read more in the :ref:`User Guide <cross_vali... | [
"def",
"permutation_test_score",
"(",
"estimator",
",",
"X",
",",
"y",
",",
"groups",
"=",
"None",
",",
"cv",
"=",
"None",
",",
"n_permutations",
"=",
"100",
",",
"n_jobs",
"=",
"1",
",",
"random_state",
"=",
"0",
",",
"verbose",
"=",
"0",
",",
"scor... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/model_selection/_validation.py#L514-L617 | |
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py | python | xmlDoc.xincludeProcessFlags | (self, flags) | return ret | Implement the XInclude substitution on the XML document @doc | Implement the XInclude substitution on the XML document | [
"Implement",
"the",
"XInclude",
"substitution",
"on",
"the",
"XML",
"document"
] | def xincludeProcessFlags(self, flags):
"""Implement the XInclude substitution on the XML document @doc """
ret = libxml2mod.xmlXIncludeProcessFlags(self._o, flags)
return ret | [
"def",
"xincludeProcessFlags",
"(",
"self",
",",
"flags",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlXIncludeProcessFlags",
"(",
"self",
".",
"_o",
",",
"flags",
")",
"return",
"ret"
] | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py#L4766-L4769 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/eager/python/examples/revnet/main_estimator.py | python | get_input_fn | (config, data_dir, split) | return input_fn | Get the input function that is required by the `tf.estimator` API.
Args:
config: Customized hyperparameters
data_dir: Directory where the data is stored
split: One of `train`, `validation`, `train_all`, and `test`
Returns:
Input function required by the `tf.estimator` API | Get the input function that is required by the `tf.estimator` API. | [
"Get",
"the",
"input",
"function",
"that",
"is",
"required",
"by",
"the",
"tf",
".",
"estimator",
"API",
"."
] | def get_input_fn(config, data_dir, split):
"""Get the input function that is required by the `tf.estimator` API.
Args:
config: Customized hyperparameters
data_dir: Directory where the data is stored
split: One of `train`, `validation`, `train_all`, and `test`
Returns:
Input function required by ... | [
"def",
"get_input_fn",
"(",
"config",
",",
"data_dir",
",",
"split",
")",
":",
"data_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"config",
".",
"dataset",
")",
"# Fix split-dependent hyperparameters",
"if",
"split",
"==",
"\"train_all\"",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/eager/python/examples/revnet/main_estimator.py#L92-L131 | |
bilibili/biliobs | 573613dc3b2b63fe7c1506cc94717609a2c52c0c | third_party/freetype/src/tools/docmaker/content.py | python | ContentProcessor.set_section | ( self, section_name ) | Set current section during parsing. | Set current section during parsing. | [
"Set",
"current",
"section",
"during",
"parsing",
"."
] | def set_section( self, section_name ):
"""Set current section during parsing."""
if not section_name in self.sections:
section = DocSection( section_name )
self.sections[section_name] = section
self.section = section
else:
self.sect... | [
"def",
"set_section",
"(",
"self",
",",
"section_name",
")",
":",
"if",
"not",
"section_name",
"in",
"self",
".",
"sections",
":",
"section",
"=",
"DocSection",
"(",
"section_name",
")",
"self",
".",
"sections",
"[",
"section_name",
"]",
"=",
"section",
"s... | https://github.com/bilibili/biliobs/blob/573613dc3b2b63fe7c1506cc94717609a2c52c0c/third_party/freetype/src/tools/docmaker/content.py#L414-L421 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2.py | python | xmlDoc.saveFormatFileEnc | (self, filename, encoding, format) | return ret | Dump an XML document to a file or an URL. | Dump an XML document to a file or an URL. | [
"Dump",
"an",
"XML",
"document",
"to",
"a",
"file",
"or",
"an",
"URL",
"."
] | def saveFormatFileEnc(self, filename, encoding, format):
"""Dump an XML document to a file or an URL. """
ret = libxml2mod.xmlSaveFormatFileEnc(filename, self._o, encoding, format)
return ret | [
"def",
"saveFormatFileEnc",
"(",
"self",
",",
"filename",
",",
"encoding",
",",
"format",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlSaveFormatFileEnc",
"(",
"filename",
",",
"self",
".",
"_o",
",",
"encoding",
",",
"format",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L4505-L4508 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/lib/function_base.py | python | gradient | (f, *varargs) | Return the gradient of an N-dimensional array.
The gradient is computed using central differences in the interior
and first differences at the boundaries. The returned gradient hence has
the same shape as the input array.
Parameters
----------
f : array_like
An N-dimensional array contai... | Return the gradient of an N-dimensional array. | [
"Return",
"the",
"gradient",
"of",
"an",
"N",
"-",
"dimensional",
"array",
"."
] | def gradient(f, *varargs):
"""
Return the gradient of an N-dimensional array.
The gradient is computed using central differences in the interior
and first differences at the boundaries. The returned gradient hence has
the same shape as the input array.
Parameters
----------
f : array_l... | [
"def",
"gradient",
"(",
"f",
",",
"*",
"varargs",
")",
":",
"N",
"=",
"len",
"(",
"f",
".",
"shape",
")",
"# number of dimensions",
"n",
"=",
"len",
"(",
"varargs",
")",
"if",
"n",
"==",
"0",
":",
"dx",
"=",
"[",
"1.0",
"]",
"*",
"N",
"elif",
... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/lib/function_base.py#L822-L915 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/robot-return-to-origin.py | python | Solution.judgeCircle | (self, moves) | return v == 0 and h == 0 | :type moves: str
:rtype: bool | :type moves: str
:rtype: bool | [
":",
"type",
"moves",
":",
"str",
":",
"rtype",
":",
"bool"
] | def judgeCircle(self, moves):
"""
:type moves: str
:rtype: bool
"""
v, h = 0, 0
for move in moves:
if move == 'U':
v += 1
elif move == 'D':
v -= 1
elif move == 'R':
h += 1
elif... | [
"def",
"judgeCircle",
"(",
"self",
",",
"moves",
")",
":",
"v",
",",
"h",
"=",
"0",
",",
"0",
"for",
"move",
"in",
"moves",
":",
"if",
"move",
"==",
"'U'",
":",
"v",
"+=",
"1",
"elif",
"move",
"==",
"'D'",
":",
"v",
"-=",
"1",
"elif",
"move",... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/robot-return-to-origin.py#L20-L35 | |
CGRU/cgru | 1881a4128530e3d31ac6c25314c18314fc50c2c7 | plugins/maya/afanasy/__init__.py | python | UI.set_field_value | (self, control, value, *args, **kwargs) | sets the given field value
:param control: the UI control
:param value: the value, can be a callable
:return: | sets the given field value | [
"sets",
"the",
"given",
"field",
"value"
] | def set_field_value(self, control, value, *args, **kwargs):
"""sets the given field value
:param control: the UI control
:param value: the value, can be a callable
:return:
"""
try:
v = value()
except TypeError:
v = value
control.s... | [
"def",
"set_field_value",
"(",
"self",
",",
"control",
",",
"value",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"v",
"=",
"value",
"(",
")",
"except",
"TypeError",
":",
"v",
"=",
"value",
"control",
".",
"setValue",
"(",
"v",
... | https://github.com/CGRU/cgru/blob/1881a4128530e3d31ac6c25314c18314fc50c2c7/plugins/maya/afanasy/__init__.py#L341-L352 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/internal/platform/tracing_agent/__init__.py | python | TracingAgent.StartAgentTracing | (self, config, timeout) | Override to add tracing agent's custom logic to start tracing.
Depending on trace_options and category_filter, the tracing agent may choose
to start or not start tracing.
Args:
config: tracing_config instance that contains trace_option and
category_filter
trace_options: an instance o... | Override to add tracing agent's custom logic to start tracing. | [
"Override",
"to",
"add",
"tracing",
"agent",
"s",
"custom",
"logic",
"to",
"start",
"tracing",
"."
] | def StartAgentTracing(self, config, timeout):
""" Override to add tracing agent's custom logic to start tracing.
Depending on trace_options and category_filter, the tracing agent may choose
to start or not start tracing.
Args:
config: tracing_config instance that contains trace_option and
... | [
"def",
"StartAgentTracing",
"(",
"self",
",",
"config",
",",
"timeout",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/internal/platform/tracing_agent/__init__.py#L27-L46 | ||
eric612/Caffe-YOLOv3-Windows | 6736ca6e16781789b828cc64218ff77cc3454e5d | scripts/cpp_lint.py | python | _NestingState.SeenOpenBrace | (self) | return (not self.stack) or self.stack[-1].seen_open_brace | Check if we have seen the opening brace for the innermost block.
Returns:
True if we have seen the opening brace, False if the innermost
block is still expecting an opening brace. | Check if we have seen the opening brace for the innermost block. | [
"Check",
"if",
"we",
"have",
"seen",
"the",
"opening",
"brace",
"for",
"the",
"innermost",
"block",
"."
] | def SeenOpenBrace(self):
"""Check if we have seen the opening brace for the innermost block.
Returns:
True if we have seen the opening brace, False if the innermost
block is still expecting an opening brace.
"""
return (not self.stack) or self.stack[-1].seen_open_brace | [
"def",
"SeenOpenBrace",
"(",
"self",
")",
":",
"return",
"(",
"not",
"self",
".",
"stack",
")",
"or",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
".",
"seen_open_brace"
] | https://github.com/eric612/Caffe-YOLOv3-Windows/blob/6736ca6e16781789b828cc64218ff77cc3454e5d/scripts/cpp_lint.py#L1935-L1942 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextBuffer.LoadStream | (*args, **kwargs) | return _richtext.RichTextBuffer_LoadStream(*args, **kwargs) | LoadStream(self, InputStream stream, int type=RICHTEXT_TYPE_ANY) -> bool | LoadStream(self, InputStream stream, int type=RICHTEXT_TYPE_ANY) -> bool | [
"LoadStream",
"(",
"self",
"InputStream",
"stream",
"int",
"type",
"=",
"RICHTEXT_TYPE_ANY",
")",
"-",
">",
"bool"
] | def LoadStream(*args, **kwargs):
"""LoadStream(self, InputStream stream, int type=RICHTEXT_TYPE_ANY) -> bool"""
return _richtext.RichTextBuffer_LoadStream(*args, **kwargs) | [
"def",
"LoadStream",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextBuffer_LoadStream",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L2253-L2255 | |
intel/caffe | 3f494b442ee3f9d17a07b09ecbd5fa2bbda00836 | examples/rfcn/lib/pycocotools/cocoeval.py | python | COCOeval._prepare | (self) | Prepare ._gts and ._dts for evaluation based on params
:return: None | Prepare ._gts and ._dts for evaluation based on params
:return: None | [
"Prepare",
".",
"_gts",
"and",
".",
"_dts",
"for",
"evaluation",
"based",
"on",
"params",
":",
"return",
":",
"None"
] | def _prepare(self):
'''
Prepare ._gts and ._dts for evaluation based on params
:return: None
'''
#
def _toMask(objs, coco):
# modify segmentation by reference
for obj in objs:
t = coco.imgs[obj['image_id']]
if type(o... | [
"def",
"_prepare",
"(",
"self",
")",
":",
"#",
"def",
"_toMask",
"(",
"objs",
",",
"coco",
")",
":",
"# modify segmentation by reference",
"for",
"obj",
"in",
"objs",
":",
"t",
"=",
"coco",
".",
"imgs",
"[",
"obj",
"[",
"'image_id'",
"]",
"]",
"if",
... | https://github.com/intel/caffe/blob/3f494b442ee3f9d17a07b09ecbd5fa2bbda00836/examples/rfcn/lib/pycocotools/cocoeval.py#L82-L127 | ||
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/easy_xml.py | python | XmlToString | (content, encoding='utf-8', pretty=False) | return ''.join(xml_parts) | Writes the XML content to disk, touching the file only if it has changed.
Visual Studio files have a lot of pre-defined structures. This function makes
it easy to represent these structures as Python data structures, instead of
having to create a lot of function calls.
Each XML element of the content is repr... | Writes the XML content to disk, touching the file only if it has changed. | [
"Writes",
"the",
"XML",
"content",
"to",
"disk",
"touching",
"the",
"file",
"only",
"if",
"it",
"has",
"changed",
"."
] | def XmlToString(content, encoding='utf-8', pretty=False):
""" Writes the XML content to disk, touching the file only if it has changed.
Visual Studio files have a lot of pre-defined structures. This function makes
it easy to represent these structures as Python data structures, instead of
having to create a l... | [
"def",
"XmlToString",
"(",
"content",
",",
"encoding",
"=",
"'utf-8'",
",",
"pretty",
"=",
"False",
")",
":",
"# We create a huge list of all the elements of the file.",
"xml_parts",
"=",
"[",
"'<?xml version=\"1.0\" encoding=\"%s\"?>'",
"%",
"encoding",
"]",
"if",
"pre... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/easy_xml.py#L12-L57 | |
HyeonwooNoh/caffe | d9e8494a2832d67b25dee37194c7bcb9d52d0e42 | scripts/cpp_lint.py | python | _CppLintState.PrintErrorCounts | (self) | Print a summary of errors by category, and the total. | Print a summary of errors by category, and the total. | [
"Print",
"a",
"summary",
"of",
"errors",
"by",
"category",
"and",
"the",
"total",
"."
] | def PrintErrorCounts(self):
"""Print a summary of errors by category, and the total."""
for category, count in self.errors_by_category.iteritems():
sys.stderr.write('Category \'%s\' errors found: %d\n' %
(category, count))
sys.stderr.write('Total errors found: %d\n' % self.error... | [
"def",
"PrintErrorCounts",
"(",
"self",
")",
":",
"for",
"category",
",",
"count",
"in",
"self",
".",
"errors_by_category",
".",
"iteritems",
"(",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"'Category \\'%s\\' errors found: %d\\n'",
"%",
"(",
"category... | https://github.com/HyeonwooNoh/caffe/blob/d9e8494a2832d67b25dee37194c7bcb9d52d0e42/scripts/cpp_lint.py#L757-L762 | ||
microsoft/ELL | a1d6bacc37a14879cc025d9be2ba40b1a0632315 | tools/importers/common/converters.py | python | ConvertInput.convert_node | (self, conversion_parameters: typing.Mapping[str, typing.Any]) | Derived classes override to return the appropriate ELL node | Derived classes override to return the appropriate ELL node | [
"Derived",
"classes",
"override",
"to",
"return",
"the",
"appropriate",
"ELL",
"node"
] | def convert_node(self, conversion_parameters: typing.Mapping[str, typing.Any]):
"""
Derived classes override to return the appropriate ELL node
"""
model = conversion_parameters["model"]
builder = conversion_parameters["builder"]
lookup_table = conversion_parameters["look... | [
"def",
"convert_node",
"(",
"self",
",",
"conversion_parameters",
":",
"typing",
".",
"Mapping",
"[",
"str",
",",
"typing",
".",
"Any",
"]",
")",
":",
"model",
"=",
"conversion_parameters",
"[",
"\"model\"",
"]",
"builder",
"=",
"conversion_parameters",
"[",
... | https://github.com/microsoft/ELL/blob/a1d6bacc37a14879cc025d9be2ba40b1a0632315/tools/importers/common/converters.py#L1008-L1068 | ||
Atarity/Lightpack | 4dee73a443cba4c4073291febe450e6c1941f3af | Software/apiexamples/liOSC/OSC.py | python | OSCMessage.__delitem__ | (self, i) | Removes the indicated argument (or slice) | Removes the indicated argument (or slice) | [
"Removes",
"the",
"indicated",
"argument",
"(",
"or",
"slice",
")"
] | def __delitem__(self, i):
"""Removes the indicated argument (or slice)
"""
items = self.items()
del items[i]
self._reencode(items) | [
"def",
"__delitem__",
"(",
"self",
",",
"i",
")",
":",
"items",
"=",
"self",
".",
"items",
"(",
")",
"del",
"items",
"[",
"i",
"]",
"self",
".",
"_reencode",
"(",
"items",
")"
] | https://github.com/Atarity/Lightpack/blob/4dee73a443cba4c4073291febe450e6c1941f3af/Software/apiexamples/liOSC/OSC.py#L367-L373 | ||
SpaceNetChallenge/BuildingDetectors | 3def3c44b5847c744cd2f3356182892d92496579 | qinhaifang/src/caffe-mnc/python/caffe/pycaffe.py | python | _Net_forward_backward_all | (self, blobs=None, diffs=None, **kwargs) | return all_outs, all_diffs | Run net forward + backward in batches.
Parameters
----------
blobs: list of blobs to extract as in forward()
diffs: list of diffs to extract as in backward()
kwargs: Keys are input (for forward) and output (for backward) blob names
and values are ndarrays. Refer to forward() and backwar... | Run net forward + backward in batches. | [
"Run",
"net",
"forward",
"+",
"backward",
"in",
"batches",
"."
] | def _Net_forward_backward_all(self, blobs=None, diffs=None, **kwargs):
"""
Run net forward + backward in batches.
Parameters
----------
blobs: list of blobs to extract as in forward()
diffs: list of diffs to extract as in backward()
kwargs: Keys are input (for forward) and output (for backw... | [
"def",
"_Net_forward_backward_all",
"(",
"self",
",",
"blobs",
"=",
"None",
",",
"diffs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Batch blobs and diffs.",
"all_outs",
"=",
"{",
"out",
":",
"[",
"]",
"for",
"out",
"in",
"set",
"(",
"self",
".... | https://github.com/SpaceNetChallenge/BuildingDetectors/blob/3def3c44b5847c744cd2f3356182892d92496579/qinhaifang/src/caffe-mnc/python/caffe/pycaffe.py#L190-L232 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.