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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/io/parsers/base_parser.py | python | ParserBase._open_handles | (self, src: FilePathOrBuffer, kwds: dict[str, Any]) | Let the readers open IOHandles after they are done with their potential raises. | Let the readers open IOHandles after they are done with their potential raises. | [
"Let",
"the",
"readers",
"open",
"IOHandles",
"after",
"they",
"are",
"done",
"with",
"their",
"potential",
"raises",
"."
] | def _open_handles(self, src: FilePathOrBuffer, kwds: dict[str, Any]) -> None:
"""
Let the readers open IOHandles after they are done with their potential raises.
"""
self.handles = get_handle(
src,
"r",
encoding=kwds.get("encoding", None),
... | [
"def",
"_open_handles",
"(",
"self",
",",
"src",
":",
"FilePathOrBuffer",
",",
"kwds",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"None",
":",
"self",
".",
"handles",
"=",
"get_handle",
"(",
"src",
",",
"\"r\"",
",",
"encoding",
"=",
"kwds"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/parsers/base_parser.py#L218-L230 | ||
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/fusion/portableglobe/servers/portable_server.py | python | InfoHandler.get | (self) | Handle GET request for unknown path. | Handle GET request for unknown path. | [
"Handle",
"GET",
"request",
"for",
"unknown",
"path",
"."
] | def get(self):
"""Handle GET request for unknown path."""
self.set_header("Content-Type", "text/plain")
tornado.web.local_server_.LocalInfoHandler(self)
self.finish() | [
"def",
"get",
"(",
"self",
")",
":",
"self",
".",
"set_header",
"(",
"\"Content-Type\"",
",",
"\"text/plain\"",
")",
"tornado",
".",
"web",
".",
"local_server_",
".",
"LocalInfoHandler",
"(",
"self",
")",
"self",
".",
"finish",
"(",
")"
] | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/fusion/portableglobe/servers/portable_server.py#L376-L380 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/attr/_funcs.py | python | has | (cls) | return getattr(cls, "__attrs_attrs__", None) is not None | Check whether *cls* is a class with ``attrs`` attributes.
:param type cls: Class to introspect.
:raise TypeError: If *cls* is not a class.
:rtype: bool | Check whether *cls* is a class with ``attrs`` attributes. | [
"Check",
"whether",
"*",
"cls",
"*",
"is",
"a",
"class",
"with",
"attrs",
"attributes",
"."
] | def has(cls):
"""
Check whether *cls* is a class with ``attrs`` attributes.
:param type cls: Class to introspect.
:raise TypeError: If *cls* is not a class.
:rtype: bool
"""
return getattr(cls, "__attrs_attrs__", None) is not None | [
"def",
"has",
"(",
"cls",
")",
":",
"return",
"getattr",
"(",
"cls",
",",
"\"__attrs_attrs__\"",
",",
"None",
")",
"is",
"not",
"None"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/attr/_funcs.py#L215-L224 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/ntpath.py | python | splitunc | (p) | return '', p | Split a pathname into UNC mount point and relative path specifiers.
Return a 2-tuple (unc, rest); either part may be empty.
If unc is not empty, it has the form '//host/mount' (or similar
using backslashes). unc+rest is always the input path.
Paths containing drive letters never have an UNC part. | Split a pathname into UNC mount point and relative path specifiers. | [
"Split",
"a",
"pathname",
"into",
"UNC",
"mount",
"point",
"and",
"relative",
"path",
"specifiers",
"."
] | def splitunc(p):
"""Split a pathname into UNC mount point and relative path specifiers.
Return a 2-tuple (unc, rest); either part may be empty.
If unc is not empty, it has the form '//host/mount' (or similar
using backslashes). unc+rest is always the input path.
Paths containing drive letters neve... | [
"def",
"splitunc",
"(",
"p",
")",
":",
"if",
"p",
"[",
"1",
":",
"2",
"]",
"==",
"':'",
":",
"return",
"''",
",",
"p",
"# Drive letter present",
"firstTwo",
"=",
"p",
"[",
"0",
":",
"2",
"]",
"if",
"firstTwo",
"==",
"'//'",
"or",
"firstTwo",
"=="... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/ntpath.py#L131-L156 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/search.py | python | accept_search | () | Accept current search query. Focus original `BufferControl` again. | Accept current search query. Focus original `BufferControl` again. | [
"Accept",
"current",
"search",
"query",
".",
"Focus",
"original",
"BufferControl",
"again",
"."
] | def accept_search() -> None:
"""
Accept current search query. Focus original `BufferControl` again.
"""
layout = get_app().layout
search_control = layout.current_control
target_buffer_control = layout.search_target_buffer_control
from prompt_toolkit.layout.controls import BufferControl
... | [
"def",
"accept_search",
"(",
")",
"->",
"None",
":",
"layout",
"=",
"get_app",
"(",
")",
".",
"layout",
"search_control",
"=",
"layout",
".",
"current_control",
"target_buffer_control",
"=",
"layout",
".",
"search_target_buffer_control",
"from",
"prompt_toolkit",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/search.py#L186-L217 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/distributions/python/ops/onehot_categorical.py | python | OneHotCategorical.event_size | (self) | return self._event_size | Scalar `int32` tensor: the number of classes. | Scalar `int32` tensor: the number of classes. | [
"Scalar",
"int32",
"tensor",
":",
"the",
"number",
"of",
"classes",
"."
] | def event_size(self):
"""Scalar `int32` tensor: the number of classes."""
return self._event_size | [
"def",
"event_size",
"(",
"self",
")",
":",
"return",
"self",
".",
"_event_size"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/distributions/python/ops/onehot_categorical.py#L148-L150 | |
freesurfer/freesurfer | 6dbe527d43ffa611acb2cd112e9469f9bfec8e36 | python/freesurfer/subfields/core.py | python | MeshModel.get_gaussian_hyps | (self, sameGaussianParameters, mesh) | This function should return a tuple of (meanHyps, nHyps) for Gaussian parameter estimation. | This function should return a tuple of (meanHyps, nHyps) for Gaussian parameter estimation. | [
"This",
"function",
"should",
"return",
"a",
"tuple",
"of",
"(",
"meanHyps",
"nHyps",
")",
"for",
"Gaussian",
"parameter",
"estimation",
"."
] | def get_gaussian_hyps(self, sameGaussianParameters, mesh):
"""
This function should return a tuple of (meanHyps, nHyps) for Gaussian parameter estimation.
"""
raise NotImplementedError('A MeshModel subclass must implement the get_gaussian_hyps() function!') | [
"def",
"get_gaussian_hyps",
"(",
"self",
",",
"sameGaussianParameters",
",",
"mesh",
")",
":",
"raise",
"NotImplementedError",
"(",
"'A MeshModel subclass must implement the get_gaussian_hyps() function!'",
")"
] | https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/python/freesurfer/subfields/core.py#L774-L778 | ||
tomahawk-player/tomahawk-resolvers | 7f827bbe410ccfdb0446f7d6a91acc2199c9cc8d | archive/spotify/breakpad/third_party/protobuf/protobuf/python/google/protobuf/service_reflection.py | python | _ServiceStubBuilder.__init__ | (self, service_descriptor) | Initializes an instance of the service stub class builder.
Args:
service_descriptor: ServiceDescriptor to use when constructing the
stub class. | Initializes an instance of the service stub class builder. | [
"Initializes",
"an",
"instance",
"of",
"the",
"service",
"stub",
"class",
"builder",
"."
] | def __init__(self, service_descriptor):
"""Initializes an instance of the service stub class builder.
Args:
service_descriptor: ServiceDescriptor to use when constructing the
stub class.
"""
self.descriptor = service_descriptor | [
"def",
"__init__",
"(",
"self",
",",
"service_descriptor",
")",
":",
"self",
".",
"descriptor",
"=",
"service_descriptor"
] | https://github.com/tomahawk-player/tomahawk-resolvers/blob/7f827bbe410ccfdb0446f7d6a91acc2199c9cc8d/archive/spotify/breakpad/third_party/protobuf/protobuf/python/google/protobuf/service_reflection.py#L242-L249 | ||
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/mongo/gotools/vendor/src/github.com/smartystreets/assertions/internal/go-render/PRESUBMIT.py | python | source_file_filter | (input_api) | return lambda x: input_api.FilterSourceFile(x, white_list=wl, black_list=bl) | Returns filter that selects source code files only. | Returns filter that selects source code files only. | [
"Returns",
"filter",
"that",
"selects",
"source",
"code",
"files",
"only",
"."
] | def source_file_filter(input_api):
"""Returns filter that selects source code files only."""
bl = list(input_api.DEFAULT_BLACK_LIST) + [
r'.+\.pb\.go$',
r'.+_string\.go$',
]
wl = list(input_api.DEFAULT_WHITE_LIST) + [
r'.+\.go$',
]
return lambda x: input_api.FilterSourceFile(x, white_list=wl, bl... | [
"def",
"source_file_filter",
"(",
"input_api",
")",
":",
"bl",
"=",
"list",
"(",
"input_api",
".",
"DEFAULT_BLACK_LIST",
")",
"+",
"[",
"r'.+\\.pb\\.go$'",
",",
"r'.+_string\\.go$'",
",",
"]",
"wl",
"=",
"list",
"(",
"input_api",
".",
"DEFAULT_WHITE_LIST",
")"... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/mongo/gotools/vendor/src/github.com/smartystreets/assertions/internal/go-render/PRESUBMIT.py#L68-L77 | |
alibaba/weex_js_engine | 2bdf4b6f020c1fc99c63f649718f6faf7e27fdde | jni/v8core/v8/tools/stats-viewer.py | python | UiCounter.Set | (self, value) | Updates the ui for this counter.
Args:
value: The value to display
Returns:
True if the value had changed, otherwise False. The first call
always returns True. | Updates the ui for this counter. | [
"Updates",
"the",
"ui",
"for",
"this",
"counter",
"."
] | def Set(self, value):
"""Updates the ui for this counter.
Args:
value: The value to display
Returns:
True if the value had changed, otherwise False. The first call
always returns True.
"""
if value == self.last_value:
return False
else:
self.last_value = value
... | [
"def",
"Set",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"==",
"self",
".",
"last_value",
":",
"return",
"False",
"else",
":",
"self",
".",
"last_value",
"=",
"value",
"self",
".",
"var",
".",
"set",
"(",
"self",
".",
"format",
"%",
"value... | https://github.com/alibaba/weex_js_engine/blob/2bdf4b6f020c1fc99c63f649718f6faf7e27fdde/jni/v8core/v8/tools/stats-viewer.py#L282-L297 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/setuptools/_vendor/packaging/_manylinux.py | python | _glibc_version_string_confstr | () | return version | Primary implementation of glibc_version_string using os.confstr. | Primary implementation of glibc_version_string using os.confstr. | [
"Primary",
"implementation",
"of",
"glibc_version_string",
"using",
"os",
".",
"confstr",
"."
] | def _glibc_version_string_confstr() -> Optional[str]:
"""
Primary implementation of glibc_version_string using os.confstr.
"""
# os.confstr is quite a bit faster than ctypes.DLL. It's also less likely
# to be broken or missing. This strategy is used in the standard library
# platform module.
... | [
"def",
"_glibc_version_string_confstr",
"(",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"# os.confstr is quite a bit faster than ctypes.DLL. It's also less likely",
"# to be broken or missing. This strategy is used in the standard library",
"# platform module.",
"# https://github.com/pyt... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/_vendor/packaging/_manylinux.py#L135-L151 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py | python | WorkingSet._build_from_requirements | (cls, req_spec) | return ws | Build a working set from a requirement spec. Rewrites sys.path. | Build a working set from a requirement spec. Rewrites sys.path. | [
"Build",
"a",
"working",
"set",
"from",
"a",
"requirement",
"spec",
".",
"Rewrites",
"sys",
".",
"path",
"."
] | def _build_from_requirements(cls, req_spec):
"""
Build a working set from a requirement spec. Rewrites sys.path.
"""
# try it without defaults already on sys.path
# by starting with an empty path
ws = cls([])
reqs = parse_requirements(req_spec)
dists = ws.... | [
"def",
"_build_from_requirements",
"(",
"cls",
",",
"req_spec",
")",
":",
"# try it without defaults already on sys.path",
"# by starting with an empty path",
"ws",
"=",
"cls",
"(",
"[",
"]",
")",
"reqs",
"=",
"parse_requirements",
"(",
"req_spec",
")",
"dists",
"=",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py#L590-L609 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/setuptools/_vendor/pyparsing.py | python | removeQuotes | (s,l,t) | return t[0][1:-1] | Helper parse action for removing quotation marks from parsed quoted strings.
Example::
# by default, quotation marks are included in parsed results
quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["'Now is the Winter of our Discontent'"]
# use removeQuotes to strip q... | Helper parse action for removing quotation marks from parsed quoted strings. | [
"Helper",
"parse",
"action",
"for",
"removing",
"quotation",
"marks",
"from",
"parsed",
"quoted",
"strings",
"."
] | def removeQuotes(s,l,t):
"""
Helper parse action for removing quotation marks from parsed quoted strings.
Example::
# by default, quotation marks are included in parsed results
quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["'Now is the Winter of our Discontent'"]
... | [
"def",
"removeQuotes",
"(",
"s",
",",
"l",
",",
"t",
")",
":",
"return",
"t",
"[",
"0",
"]",
"[",
"1",
":",
"-",
"1",
"]"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/_vendor/pyparsing.py#L4811-L4823 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/math/autodiff/ad.py | python | var | (x) | return ADTerminal(x) | Creates a new variable symbol with name x. | Creates a new variable symbol with name x. | [
"Creates",
"a",
"new",
"variable",
"symbol",
"with",
"name",
"x",
"."
] | def var(x):
"""Creates a new variable symbol with name x."""
return ADTerminal(x) | [
"def",
"var",
"(",
"x",
")",
":",
"return",
"ADTerminal",
"(",
"x",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/math/autodiff/ad.py#L973-L975 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/symbol/symbol.py | python | Symbol.shape_array | (self, *args, **kwargs) | return op.shape_array(self, *args, **kwargs) | Convenience fluent method for :py:func:`shape_array`.
The arguments are the same as for :py:func:`shape_op`, with
this array as data. | Convenience fluent method for :py:func:`shape_array`. | [
"Convenience",
"fluent",
"method",
"for",
":",
"py",
":",
"func",
":",
"shape_array",
"."
] | def shape_array(self, *args, **kwargs):
"""Convenience fluent method for :py:func:`shape_array`.
The arguments are the same as for :py:func:`shape_op`, with
this array as data.
"""
return op.shape_array(self, *args, **kwargs) | [
"def",
"shape_array",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"op",
".",
"shape_array",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/symbol.py#L2165-L2171 | |
nileshkulkarni/csm | 0e6e0e7d4f725fd36f2414c0be4b9d83197aa1fc | csm/benchmark/cub/csp_kp_tfs.py | python | CSPTester.map_kp_img1_to_img2_cyc | (self, vis_inds, kps1, kps2, xy_map1, xy_map2, mask1, mask2) | return transfer_kps, torch.stack([kp_transfer_error, kp_mask], dim=1) | xy_map1 --> xy_map1 256 x 256 x 2 | xy_map1 --> xy_map1 256 x 256 x 2 | [
"xy_map1",
"--",
">",
"xy_map1",
"256",
"x",
"256",
"x",
"2"
] | def map_kp_img1_to_img2_cyc(self, vis_inds, kps1, kps2, xy_map1, xy_map2, mask1, mask2):
img_size = self.opts.img_size
kp_mask = torch.zeros([len(kps1)]).cuda()
kp_mask[vis_inds] = 1
'''
xy_map1 --> xy_map1 256 x 256 x 2
'''
xy_map1 = xy_map1.permute(1,2,0)
... | [
"def",
"map_kp_img1_to_img2_cyc",
"(",
"self",
",",
"vis_inds",
",",
"kps1",
",",
"kps2",
",",
"xy_map1",
",",
"xy_map2",
",",
"mask1",
",",
"mask2",
")",
":",
"img_size",
"=",
"self",
".",
"opts",
".",
"img_size",
"kp_mask",
"=",
"torch",
".",
"zeros",
... | https://github.com/nileshkulkarni/csm/blob/0e6e0e7d4f725fd36f2414c0be4b9d83197aa1fc/csm/benchmark/cub/csp_kp_tfs.py#L213-L239 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py | python | StateSpaceModel._loss_additions | (self, times, values, mode) | Add regularization during training. | Add regularization during training. | [
"Add",
"regularization",
"during",
"training",
"."
] | def _loss_additions(self, times, values, mode):
"""Add regularization during training."""
if mode == estimator_lib.ModeKeys.TRAIN:
if (self._input_statistics is not None
and self._configuration.bayesian_prior_weighting):
normalization = 1. / math_ops.cast(
self._input_statist... | [
"def",
"_loss_additions",
"(",
"self",
",",
"times",
",",
"values",
",",
"mode",
")",
":",
"if",
"mode",
"==",
"estimator_lib",
".",
"ModeKeys",
".",
"TRAIN",
":",
"if",
"(",
"self",
".",
"_input_statistics",
"is",
"not",
"None",
"and",
"self",
".",
"_... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py#L613-L641 | ||
glotzerlab/hoomd-blue | f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a | hoomd/mpcd/collide.py | python | srd.set_params | (self, angle=None, shift=None, kT=None) | Set parameters for the SRD collision method
Args:
angle (float): SRD rotation angle (degrees)
shift (bool): If True, perform a random shift of the underlying cell list
kT (:py:mod:`hoomd.variant` or :py:obj:`float` or bool): Temperature
set point for the ther... | Set parameters for the SRD collision method | [
"Set",
"parameters",
"for",
"the",
"SRD",
"collision",
"method"
] | def set_params(self, angle=None, shift=None, kT=None):
""" Set parameters for the SRD collision method
Args:
angle (float): SRD rotation angle (degrees)
shift (bool): If True, perform a random shift of the underlying cell list
kT (:py:mod:`hoomd.variant` or :py:obj:`... | [
"def",
"set_params",
"(",
"self",
",",
"angle",
"=",
"None",
",",
"shift",
"=",
"None",
",",
"kT",
"=",
"None",
")",
":",
"if",
"angle",
"is",
"not",
"None",
":",
"self",
".",
"angle",
"=",
"angle",
"self",
".",
"_cpp",
".",
"setRotationAngle",
"("... | https://github.com/glotzerlab/hoomd-blue/blob/f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a/hoomd/mpcd/collide.py#L335-L367 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/common/dump.py | python | set_dump | (target, enabled=True) | Enable or disable dump for the target and its contents.
Target should be an instance of Cell or Primitive. The default enabled
status for a cell or primitive is False. Please note that this API takes
effect only when the dump_mode field in dump config file is 2. See the
`dump document <https://mindspor... | Enable or disable dump for the target and its contents. | [
"Enable",
"or",
"disable",
"dump",
"for",
"the",
"target",
"and",
"its",
"contents",
"."
] | def set_dump(target, enabled=True):
"""
Enable or disable dump for the target and its contents.
Target should be an instance of Cell or Primitive. The default enabled
status for a cell or primitive is False. Please note that this API takes
effect only when the dump_mode field in dump config file is... | [
"def",
"set_dump",
"(",
"target",
",",
"enabled",
"=",
"True",
")",
":",
"if",
"security",
".",
"enable_security",
"(",
")",
":",
"raise",
"ValueError",
"(",
"'The set_dump API is not supported, please recompile '",
"'source without \"-s on\".'",
")",
"import",
"minds... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/common/dump.py#L22-L143 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/util.py | python | get_installed_distributions | (local_only=True,
skip=('setuptools', 'pip', 'python'),
include_editables=True,
editables_only=False) | return [d for d in pkg_resources.working_set
if local_test(d)
and d.key not in skip
and editable_test(d)
and editables_only_test(d)
] | Return a list of installed Distribution objects.
If ``local_only`` is True (default), only return installations
local to the current virtualenv, if in a virtualenv.
``skip`` argument is an iterable of lower-case project names to
ignore; defaults to ('setuptools', 'pip', 'python'). [FIXME also
skip... | Return a list of installed Distribution objects. | [
"Return",
"a",
"list",
"of",
"installed",
"Distribution",
"objects",
"."
] | def get_installed_distributions(local_only=True,
skip=('setuptools', 'pip', 'python'),
include_editables=True,
editables_only=False):
"""
Return a list of installed Distribution objects.
If ``local_only`` is Tru... | [
"def",
"get_installed_distributions",
"(",
"local_only",
"=",
"True",
",",
"skip",
"=",
"(",
"'setuptools'",
",",
"'pip'",
",",
"'python'",
")",
",",
"include_editables",
"=",
"True",
",",
"editables_only",
"=",
"False",
")",
":",
"if",
"local_only",
":",
"l... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/util.py#L350-L389 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TIntH.LoadXml | (self, *args) | return _snap.TIntH_LoadXml(self, *args) | LoadXml(TIntH self, PXmlTok const & XmlTok, TStr Nm="")
Parameters:
XmlTok: PXmlTok const &
Nm: TStr const &
LoadXml(TIntH self, PXmlTok const & XmlTok)
Parameters:
XmlTok: PXmlTok const & | LoadXml(TIntH self, PXmlTok const & XmlTok, TStr Nm="") | [
"LoadXml",
"(",
"TIntH",
"self",
"PXmlTok",
"const",
"&",
"XmlTok",
"TStr",
"Nm",
"=",
")"
] | def LoadXml(self, *args):
"""
LoadXml(TIntH self, PXmlTok const & XmlTok, TStr Nm="")
Parameters:
XmlTok: PXmlTok const &
Nm: TStr const &
LoadXml(TIntH self, PXmlTok const & XmlTok)
Parameters:
XmlTok: PXmlTok const &
"""
r... | [
"def",
"LoadXml",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TIntH_LoadXml",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L18329-L18343 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/cpplint.py | python | _CppLintState.IncrementErrorCount | (self, category) | Bumps the module's error statistic. | Bumps the module's error statistic. | [
"Bumps",
"the",
"module",
"s",
"error",
"statistic",
"."
] | def IncrementErrorCount(self, category):
"""Bumps the module's error statistic."""
self.error_count += 1
if self.counting in ('toplevel', 'detailed'):
if self.counting != 'detailed':
category = category.split('/')[0]
if category not in self.errors_by_category:
self.errors_by_cate... | [
"def",
"IncrementErrorCount",
"(",
"self",
",",
"category",
")",
":",
"self",
".",
"error_count",
"+=",
"1",
"if",
"self",
".",
"counting",
"in",
"(",
"'toplevel'",
",",
"'detailed'",
")",
":",
"if",
"self",
".",
"counting",
"!=",
"'detailed'",
":",
"cat... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/cpplint.py#L1348-L1356 | ||
intel/linux-sgx | 2ee53db4e8fd25437a817612d3bcb94b66a28373 | sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py | python | enclave_info.get_peak_heap_used | (self) | return peak_heap_used | Get the peak value of the heap used | Get the peak value of the heap used | [
"Get",
"the",
"peak",
"value",
"of",
"the",
"heap",
"used"
] | def get_peak_heap_used(self):
"""Get the peak value of the heap used"""
if self.heap_addr == 0:
return -2
# read the peak_heap_used value
string = read_from_memory(self.heap_addr, SIZE)
if string == None:
return -1
if SIZE == 4:
fmt = '... | [
"def",
"get_peak_heap_used",
"(",
"self",
")",
":",
"if",
"self",
".",
"heap_addr",
"==",
"0",
":",
"return",
"-",
"2",
"# read the peak_heap_used value",
"string",
"=",
"read_from_memory",
"(",
"self",
".",
"heap_addr",
",",
"SIZE",
")",
"if",
"string",
"==... | https://github.com/intel/linux-sgx/blob/2ee53db4e8fd25437a817612d3bcb94b66a28373/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py#L178-L191 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/_lib/_version.py | python | NumpyVersion._compare_pre_release | (self, other) | return vercmp | Compare alpha/beta/rc/final. | Compare alpha/beta/rc/final. | [
"Compare",
"alpha",
"/",
"beta",
"/",
"rc",
"/",
"final",
"."
] | def _compare_pre_release(self, other):
"""Compare alpha/beta/rc/final."""
if self.pre_release == other.pre_release:
vercmp = 0
elif self.pre_release == 'final':
vercmp = 1
elif other.pre_release == 'final':
vercmp = -1
elif self.pre_release > o... | [
"def",
"_compare_pre_release",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
".",
"pre_release",
"==",
"other",
".",
"pre_release",
":",
"vercmp",
"=",
"0",
"elif",
"self",
".",
"pre_release",
"==",
"'final'",
":",
"vercmp",
"=",
"1",
"elif",
"other... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/_lib/_version.py#L99-L112 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py | python | Decimal.__ceil__ | (self) | return int(self._rescale(0, ROUND_CEILING)) | Return the ceiling of self, as an integer.
For a finite Decimal instance self, return the least integer n
such that n >= self. If self is infinite or a NaN then a
Python exception is raised. | Return the ceiling of self, as an integer. | [
"Return",
"the",
"ceiling",
"of",
"self",
"as",
"an",
"integer",
"."
] | def __ceil__(self):
"""Return the ceiling of self, as an integer.
For a finite Decimal instance self, return the least integer n
such that n >= self. If self is infinite or a NaN then a
Python exception is raised.
"""
if self._is_special:
if self.is_nan():
... | [
"def",
"__ceil__",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_special",
":",
"if",
"self",
".",
"is_nan",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"cannot round a NaN\"",
")",
"else",
":",
"raise",
"OverflowError",
"(",
"\"cannot round an infinity\"",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py#L1907-L1920 | |
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/pyserial/serial/serialposix.py | python | Serial.out_waiting | (self) | return struct.unpack('I', s)[0] | Return the number of bytes currently in the output buffer. | Return the number of bytes currently in the output buffer. | [
"Return",
"the",
"number",
"of",
"bytes",
"currently",
"in",
"the",
"output",
"buffer",
"."
] | def out_waiting(self):
"""Return the number of bytes currently in the output buffer."""
#~ s = fcntl.ioctl(self.fd, termios.FIONREAD, TIOCM_zero_str)
s = fcntl.ioctl(self.fd, TIOCOUTQ, TIOCM_zero_str)
return struct.unpack('I', s)[0] | [
"def",
"out_waiting",
"(",
"self",
")",
":",
"#~ s = fcntl.ioctl(self.fd, termios.FIONREAD, TIOCM_zero_str)",
"s",
"=",
"fcntl",
".",
"ioctl",
"(",
"self",
".",
"fd",
",",
"TIOCOUTQ",
",",
"TIOCM_zero_str",
")",
"return",
"struct",
".",
"unpack",
"(",
"'I'",
","... | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/pyserial/serial/serialposix.py#L673-L677 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/__init__.py | python | VersionConflict.with_context | (self, required_by) | return ContextualVersionConflict(*args) | If required_by is non-empty, return a version of self that is a
ContextualVersionConflict. | If required_by is non-empty, return a version of self that is a
ContextualVersionConflict. | [
"If",
"required_by",
"is",
"non",
"-",
"empty",
"return",
"a",
"version",
"of",
"self",
"that",
"is",
"a",
"ContextualVersionConflict",
"."
] | def with_context(self, required_by):
"""
If required_by is non-empty, return a version of self that is a
ContextualVersionConflict.
"""
if not required_by:
return self
args = self.args + (required_by,)
return ContextualVersionConflict(*args) | [
"def",
"with_context",
"(",
"self",
",",
"required_by",
")",
":",
"if",
"not",
"required_by",
":",
"return",
"self",
"args",
"=",
"self",
".",
"args",
"+",
"(",
"required_by",
",",
")",
"return",
"ContextualVersionConflict",
"(",
"*",
"args",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/__init__.py#L280-L288 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/devil/devil/android/sdk/shared_prefs.py | python | SharedPrefs.Commit | (self) | Save the current set of preferences to the device.
Only actually saves if some preferences have been modified. | Save the current set of preferences to the device. | [
"Save",
"the",
"current",
"set",
"of",
"preferences",
"to",
"the",
"device",
"."
] | def Commit(self):
"""Save the current set of preferences to the device.
Only actually saves if some preferences have been modified.
"""
if not self.changed:
return
self._device.RunShellCommand(
['mkdir', '-p', posixpath.dirname(self.path)],
as_root=True, check_return=True)
... | [
"def",
"Commit",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"changed",
":",
"return",
"self",
".",
"_device",
".",
"RunShellCommand",
"(",
"[",
"'mkdir'",
",",
"'-p'",
",",
"posixpath",
".",
"dirname",
"(",
"self",
".",
"path",
")",
"]",
",",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/devil/devil/android/sdk/shared_prefs.py#L260-L272 | ||
google/ml-metadata | b60196492d2ea2bcd8e4ddff0f3757e5fd710e4d | ml_metadata/metadata_store/metadata_store.py | python | MetadataStore.get_context_types | (self) | return result | Gets all context types.
Returns:
A list of all known ContextTypes.
Raises:
errors.InternalError: if query execution fails. | Gets all context types. | [
"Gets",
"all",
"context",
"types",
"."
] | def get_context_types(self) -> List[proto.ContextType]:
"""Gets all context types.
Returns:
A list of all known ContextTypes.
Raises:
errors.InternalError: if query execution fails.
"""
request = metadata_store_service_pb2.GetContextTypesRequest()
response = metadata_store_service_... | [
"def",
"get_context_types",
"(",
"self",
")",
"->",
"List",
"[",
"proto",
".",
"ContextType",
"]",
":",
"request",
"=",
"metadata_store_service_pb2",
".",
"GetContextTypesRequest",
"(",
")",
"response",
"=",
"metadata_store_service_pb2",
".",
"GetContextTypesResponse"... | https://github.com/google/ml-metadata/blob/b60196492d2ea2bcd8e4ddff0f3757e5fd710e4d/ml_metadata/metadata_store/metadata_store.py#L809-L825 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/training/sync_replicas_optimizer.py | python | SyncReplicasOptimizer.__init__ | (self,
opt,
replicas_to_aggregate,
variable_averages=None,
variables_to_average=None,
replica_id=None,
total_num_replicas=0,
use_locking=False,
name="sync_replicas") | Construct a sync_replicas optimizer.
Args:
opt: The actual optimizer that will be used to compute and apply the
gradients. Must be one of the Optimizer classes.
replicas_to_aggregate: number of replicas to aggregate for each variable
update.
variable_averages: Optional `Exponentia... | Construct a sync_replicas optimizer. | [
"Construct",
"a",
"sync_replicas",
"optimizer",
"."
] | def __init__(self,
opt,
replicas_to_aggregate,
variable_averages=None,
variables_to_average=None,
replica_id=None,
total_num_replicas=0,
use_locking=False,
name="sync_replicas"):
"""Construct a sy... | [
"def",
"__init__",
"(",
"self",
",",
"opt",
",",
"replicas_to_aggregate",
",",
"variable_averages",
"=",
"None",
",",
"variables_to_average",
"=",
"None",
",",
"replica_id",
"=",
"None",
",",
"total_num_replicas",
"=",
"0",
",",
"use_locking",
"=",
"False",
",... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/training/sync_replicas_optimizer.py#L136-L211 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | xpcom/idl-parser/xpidl.py | python | IDLParser.p_productions_include | (self, p) | productions : INCLUDE productions | productions : INCLUDE productions | [
"productions",
":",
"INCLUDE",
"productions"
] | def p_productions_include(self, p):
"""productions : INCLUDE productions"""
p[0] = list(p[2])
p[0].insert(0, Include(p[1], self.getLocation(p, 1))) | [
"def",
"p_productions_include",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"list",
"(",
"p",
"[",
"2",
"]",
")",
"p",
"[",
"0",
"]",
".",
"insert",
"(",
"0",
",",
"Include",
"(",
"p",
"[",
"1",
"]",
",",
"self",
".",
"getLoca... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/xpcom/idl-parser/xpidl.py#L1104-L1107 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_pytorch/nndct_shared/compile/xop_creator.py | python | _pack | (xgraph: XGraph, node: Node, pack_name: str, packed_item: List[Any],
quant_config: NndctQuantInfo) | return sub_op_pack, pack_list | pack items into stack op | pack items into stack op | [
"pack",
"items",
"into",
"stack",
"op"
] | def _pack(xgraph: XGraph, node: Node, pack_name: str, packed_item: List[Any],
quant_config: NndctQuantInfo) -> Tuple[Op, List[Op]]:
"""
pack items into stack op
"""
pack_list = []
pack_input_ops: Dict[str, List[Op]] = {}
for i, item in enumerate(packed_item):
if isinstance(item, Tensor):
... | [
"def",
"_pack",
"(",
"xgraph",
":",
"XGraph",
",",
"node",
":",
"Node",
",",
"pack_name",
":",
"str",
",",
"packed_item",
":",
"List",
"[",
"Any",
"]",
",",
"quant_config",
":",
"NndctQuantInfo",
")",
"->",
"Tuple",
"[",
"Op",
",",
"List",
"[",
"Op",... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_pytorch/nndct_shared/compile/xop_creator.py#L92-L120 | |
NVIDIA/MDL-SDK | aa9642b2546ad7b6236b5627385d882c2ed83c5d | src/mdl/jit/generator_jit/gen_libbsdf_runtime_header.py | python | eat_until | (token_set, tokens) | return eaten_tokens, [None] | eat tokens until token_kind is found and return them, handle parenthesis | eat tokens until token_kind is found and return them, handle parenthesis | [
"eat",
"tokens",
"until",
"token_kind",
"is",
"found",
"and",
"return",
"them",
"handle",
"parenthesis"
] | def eat_until(token_set, tokens):
"""eat tokens until token_kind is found and return them, handle parenthesis"""
r = 0
e = 0
g = 0
a = 0
l = len(tokens)
eaten_tokens = []
while l > 0:
tok = tokens[0]
if r == 0 and e == 0 and g == 0 and a == 0 and tok in token_set:
return eaten_tokens, tokens
if tok == ... | [
"def",
"eat_until",
"(",
"token_set",
",",
"tokens",
")",
":",
"r",
"=",
"0",
"e",
"=",
"0",
"g",
"=",
"0",
"a",
"=",
"0",
"l",
"=",
"len",
"(",
"tokens",
")",
"eaten_tokens",
"=",
"[",
"]",
"while",
"l",
">",
"0",
":",
"tok",
"=",
"tokens",
... | https://github.com/NVIDIA/MDL-SDK/blob/aa9642b2546ad7b6236b5627385d882c2ed83c5d/src/mdl/jit/generator_jit/gen_libbsdf_runtime_header.py#L60-L93 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | media/webrtc/trunk/tools/gyp/pylib/gyp/generator/make.py | python | MakefileWriter.WriteActions | (self, actions, extra_sources, extra_outputs,
extra_mac_bundle_resources, part_of_all) | Write Makefile code for any 'actions' from the gyp input.
extra_sources: a list that will be filled in with newly generated source
files, if any
extra_outputs: a list that will be filled in with any outputs of these
actions (used to make other pieces dependent on these
... | Write Makefile code for any 'actions' from the gyp input. | [
"Write",
"Makefile",
"code",
"for",
"any",
"actions",
"from",
"the",
"gyp",
"input",
"."
] | def WriteActions(self, actions, extra_sources, extra_outputs,
extra_mac_bundle_resources, part_of_all):
"""Write Makefile code for any 'actions' from the gyp input.
extra_sources: a list that will be filled in with newly generated source
files, if any
extra_outputs: a ... | [
"def",
"WriteActions",
"(",
"self",
",",
"actions",
",",
"extra_sources",
",",
"extra_outputs",
",",
"extra_mac_bundle_resources",
",",
"part_of_all",
")",
":",
"env",
"=",
"self",
".",
"GetSortedXcodeEnv",
"(",
")",
"for",
"action",
"in",
"actions",
":",
"nam... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/make.py#L835-L932 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/Inelastic/Direct/ISISDirecInelasticConfig.py | python | MantidConfigDirectInelastic.get_data_folder_name | (self, instr, cycle_ID) | return folder | Method to generate a data folder from instrument name and the cycle start date
(cycle ID)
The agreement on the naming as currently in ISIS:
e.g: /archive/NDXMERLIN/Instrument/data/cycle_08_1
Note: will fail if cycle numbers ever become a 2-digit numbers e.g. cycle_22_10 | Method to generate a data folder from instrument name and the cycle start date
(cycle ID)
The agreement on the naming as currently in ISIS:
e.g: /archive/NDXMERLIN/Instrument/data/cycle_08_1 | [
"Method",
"to",
"generate",
"a",
"data",
"folder",
"from",
"instrument",
"name",
"and",
"the",
"cycle",
"start",
"date",
"(",
"cycle",
"ID",
")",
"The",
"agreement",
"on",
"the",
"naming",
"as",
"currently",
"in",
"ISIS",
":",
"e",
".",
"g",
":",
"/",
... | def get_data_folder_name(self, instr, cycle_ID):
"""Method to generate a data folder from instrument name and the cycle start date
(cycle ID)
The agreement on the naming as currently in ISIS:
e.g: /archive/NDXMERLIN/Instrument/data/cycle_08_1
Note: will fail if cycl... | [
"def",
"get_data_folder_name",
"(",
"self",
",",
"instr",
",",
"cycle_ID",
")",
":",
"# cycle folder have short form without leading numbers",
"cycle_fold_n",
"=",
"int",
"(",
"cycle_ID",
"[",
"0",
"]",
")",
"-",
"2000",
"folder",
"=",
"os",
".",
"path",
".",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Inelastic/Direct/ISISDirecInelasticConfig.py#L695-L707 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/ceph-volume/ceph_volume/util/lsmdisk.py | python | LSMDisk.led_ident_state | (self) | return "Unsupported" | Query a disks IDENT LED state to discover when it is On, Off or Unknown (str) | Query a disks IDENT LED state to discover when it is On, Off or Unknown (str) | [
"Query",
"a",
"disks",
"IDENT",
"LED",
"state",
"to",
"discover",
"when",
"it",
"is",
"On",
"Off",
"or",
"Unknown",
"(",
"str",
")"
] | def led_ident_state(self):
"""Query a disks IDENT LED state to discover when it is On, Off or Unknown (str)"""
if self.led_status == 1:
return "Unsupported"
if self.led_status & lsm_Disk.LED_STATUS_IDENT_ON == lsm_Disk.LED_STATUS_IDENT_ON:
return "On"
elif self.le... | [
"def",
"led_ident_state",
"(",
"self",
")",
":",
"if",
"self",
".",
"led_status",
"==",
"1",
":",
"return",
"\"Unsupported\"",
"if",
"self",
".",
"led_status",
"&",
"lsm_Disk",
".",
"LED_STATUS_IDENT_ON",
"==",
"lsm_Disk",
".",
"LED_STATUS_IDENT_ON",
":",
"ret... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/ceph-volume/ceph_volume/util/lsmdisk.py#L91-L102 | |
xhzdeng/crpn | a5aef0f80dbe486103123f740c634fb01e6cc9a1 | caffe-fast-rcnn/scripts/cpp_lint.py | python | Search | (pattern, s) | return _regexp_compile_cache[pattern].search(s) | Searches the string for the pattern, caching the compiled regexp. | Searches the string for the pattern, caching the compiled regexp. | [
"Searches",
"the",
"string",
"for",
"the",
"pattern",
"caching",
"the",
"compiled",
"regexp",
"."
] | def Search(pattern, s):
"""Searches the string for the pattern, caching the compiled regexp."""
if pattern not in _regexp_compile_cache:
_regexp_compile_cache[pattern] = sre_compile.compile(pattern)
return _regexp_compile_cache[pattern].search(s) | [
"def",
"Search",
"(",
"pattern",
",",
"s",
")",
":",
"if",
"pattern",
"not",
"in",
"_regexp_compile_cache",
":",
"_regexp_compile_cache",
"[",
"pattern",
"]",
"=",
"sre_compile",
".",
"compile",
"(",
"pattern",
")",
"return",
"_regexp_compile_cache",
"[",
"pat... | https://github.com/xhzdeng/crpn/blob/a5aef0f80dbe486103123f740c634fb01e6cc9a1/caffe-fast-rcnn/scripts/cpp_lint.py#L547-L551 | |
infinit/elle | a8154593c42743f45b9df09daf62b44630c24a02 | drake/src/drake/__init__.py | python | Path.__init | (self, path, absolute, virtual, volume) | Build a path.
path -- The path, as a string or an other Path. | Build a path. | [
"Build",
"a",
"path",
"."
] | def __init(self, path, absolute, virtual, volume):
"""Build a path.
path -- The path, as a string or an other Path.
"""
self.__absolute = absolute
self.__canonized = None
self.__path = path
self.__str = None
self.__virtual = virtual
self.__volume = volume
self.__saved_cwd = [] | [
"def",
"__init",
"(",
"self",
",",
"path",
",",
"absolute",
",",
"virtual",
",",
"volume",
")",
":",
"self",
".",
"__absolute",
"=",
"absolute",
"self",
".",
"__canonized",
"=",
"None",
"self",
".",
"__path",
"=",
"path",
"self",
".",
"__str",
"=",
"... | https://github.com/infinit/elle/blob/a8154593c42743f45b9df09daf62b44630c24a02/drake/src/drake/__init__.py#L589-L600 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/more-itertools/py3/more_itertools/more.py | python | sample | (iterable, k, weights=None) | Return a *k*-length list of elements chosen (without replacement)
from the *iterable*. Like :func:`random.sample`, but works on iterables
of unknown length.
>>> iterable = range(100)
>>> sample(iterable, 5) # doctest: +SKIP
[81, 60, 96, 16, 4]
An iterable with *weights* may also be given:
... | Return a *k*-length list of elements chosen (without replacement)
from the *iterable*. Like :func:`random.sample`, but works on iterables
of unknown length. | [
"Return",
"a",
"*",
"k",
"*",
"-",
"length",
"list",
"of",
"elements",
"chosen",
"(",
"without",
"replacement",
")",
"from",
"the",
"*",
"iterable",
"*",
".",
"Like",
":",
"func",
":",
"random",
".",
"sample",
"but",
"works",
"on",
"iterables",
"of",
... | def sample(iterable, k, weights=None):
"""Return a *k*-length list of elements chosen (without replacement)
from the *iterable*. Like :func:`random.sample`, but works on iterables
of unknown length.
>>> iterable = range(100)
>>> sample(iterable, 5) # doctest: +SKIP
[81, 60, 96, 16, 4]
An ... | [
"def",
"sample",
"(",
"iterable",
",",
"k",
",",
"weights",
"=",
"None",
")",
":",
"if",
"k",
"==",
"0",
":",
"return",
"[",
"]",
"iterable",
"=",
"iter",
"(",
"iterable",
")",
"if",
"weights",
"is",
"None",
":",
"return",
"_sample_unweighted",
"(",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/more-itertools/py3/more_itertools/more.py#L3535-L3568 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/_vendor/six.py | python | with_metaclass | (meta, *bases) | return type.__new__(metaclass, 'temporary_class', (), {}) | Create a base class with a metaclass. | Create a base class with a metaclass. | [
"Create",
"a",
"base",
"class",
"with",
"a",
"metaclass",
"."
] | def with_metaclass(meta, *bases):
"""Create a base class with a metaclass."""
# This requires a bit of explanation: the basic idea is to make a dummy
# metaclass for one level of class instantiation that replaces itself with
# the actual metaclass.
class metaclass(meta):
def __new__(cls, na... | [
"def",
"with_metaclass",
"(",
"meta",
",",
"*",
"bases",
")",
":",
"# This requires a bit of explanation: the basic idea is to make a dummy",
"# metaclass for one level of class instantiation that replaces itself with",
"# the actual metaclass.",
"class",
"metaclass",
"(",
"meta",
")... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/_vendor/six.py#L800-L809 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/command/easy_install.py | python | easy_install.create_home_path | (self) | Create directories under ~. | Create directories under ~. | [
"Create",
"directories",
"under",
"~",
"."
] | def create_home_path(self):
"""Create directories under ~."""
if not self.user:
return
home = convert_path(os.path.expanduser("~"))
for name, path in six.iteritems(self.config_vars):
if path.startswith(home) and not os.path.isdir(path):
self.debug_... | [
"def",
"create_home_path",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"user",
":",
"return",
"home",
"=",
"convert_path",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"\"~\"",
")",
")",
"for",
"name",
",",
"path",
"in",
"six",
".",
"iteritem... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/command/easy_install.py#L1352-L1360 | ||
apache/kudu | 90895ce76590f10730ad7aac3613b69d89ff5422 | build-support/dep_extract.py | python | DependencyExtractor.expand_symlinks | (self, deps) | return expanded | ldd will often point to symlinks. Return a list including any symlink in
the specified dependency list as well as whatever it's pointing to,
recursively. | ldd will often point to symlinks. Return a list including any symlink in
the specified dependency list as well as whatever it's pointing to,
recursively. | [
"ldd",
"will",
"often",
"point",
"to",
"symlinks",
".",
"Return",
"a",
"list",
"including",
"any",
"symlink",
"in",
"the",
"specified",
"dependency",
"list",
"as",
"well",
"as",
"whatever",
"it",
"s",
"pointing",
"to",
"recursively",
"."
] | def expand_symlinks(self, deps):
"""
ldd will often point to symlinks. Return a list including any symlink in
the specified dependency list as well as whatever it's pointing to,
recursively.
"""
expanded = []
for path in deps:
expanded.append(path)
while os.path.islink(path):
... | [
"def",
"expand_symlinks",
"(",
"self",
",",
"deps",
")",
":",
"expanded",
"=",
"[",
"]",
"for",
"path",
"in",
"deps",
":",
"expanded",
".",
"append",
"(",
"path",
")",
"while",
"os",
".",
"path",
".",
"islink",
"(",
"path",
")",
":",
"# TODO(mpercy):... | https://github.com/apache/kudu/blob/90895ce76590f10730ad7aac3613b69d89ff5422/build-support/dep_extract.py#L63-L77 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/internals/ops.py | python | _get_same_shape_values | (
lblk: Block, rblk: Block, left_ea: bool, right_ea: bool
) | return lvals, rvals | Slice lblk.values to align with rblk. Squeeze if we have EAs. | Slice lblk.values to align with rblk. Squeeze if we have EAs. | [
"Slice",
"lblk",
".",
"values",
"to",
"align",
"with",
"rblk",
".",
"Squeeze",
"if",
"we",
"have",
"EAs",
"."
] | def _get_same_shape_values(
lblk: Block, rblk: Block, left_ea: bool, right_ea: bool
) -> tuple[ArrayLike, ArrayLike]:
"""
Slice lblk.values to align with rblk. Squeeze if we have EAs.
"""
lvals = lblk.values
rvals = rblk.values
# Require that the indexing into lvals be slice-like
asser... | [
"def",
"_get_same_shape_values",
"(",
"lblk",
":",
"Block",
",",
"rblk",
":",
"Block",
",",
"left_ea",
":",
"bool",
",",
"right_ea",
":",
"bool",
")",
"->",
"tuple",
"[",
"ArrayLike",
",",
"ArrayLike",
"]",
":",
"lvals",
"=",
"lblk",
".",
"values",
"rv... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/internals/ops.py#L95-L132 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/distribute/distributed_training_utils.py | python | validate_per_replica_inputs | (distribution_strategy, x) | return x_values_list | Validates PerReplica dataset input list.
Args:
distribution_strategy: The current DistributionStrategy used to call
`fit`, `evaluate` and `predict`.
x: A list of PerReplica objects that represent the input or
target values.
Returns:
List containing the first element of each of the PerRepli... | Validates PerReplica dataset input list. | [
"Validates",
"PerReplica",
"dataset",
"input",
"list",
"."
] | def validate_per_replica_inputs(distribution_strategy, x):
"""Validates PerReplica dataset input list.
Args:
distribution_strategy: The current DistributionStrategy used to call
`fit`, `evaluate` and `predict`.
x: A list of PerReplica objects that represent the input or
target values.
Return... | [
"def",
"validate_per_replica_inputs",
"(",
"distribution_strategy",
",",
"x",
")",
":",
"# Convert the inputs and targets into a list of PerReplica objects.",
"per_replica_list",
"=",
"nest",
".",
"flatten",
"(",
"x",
",",
"expand_composites",
"=",
"True",
")",
"x_values_li... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/distribute/distributed_training_utils.py#L325-L360 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/training/optimizer.py | python | Optimizer.__init__ | (self, use_locking, name) | Create a new Optimizer.
This must be called by the constructors of subclasses.
Args:
use_locking: Bool. If True apply use locks to prevent concurrent updates
to variables.
name: A non-empty string. The name to use for accumulators created
for the optimizer.
Raises:
Valu... | Create a new Optimizer. | [
"Create",
"a",
"new",
"Optimizer",
"."
] | def __init__(self, use_locking, name):
"""Create a new Optimizer.
This must be called by the constructors of subclasses.
Args:
use_locking: Bool. If True apply use locks to prevent concurrent updates
to variables.
name: A non-empty string. The name to use for accumulators created
... | [
"def",
"__init__",
"(",
"self",
",",
"use_locking",
",",
"name",
")",
":",
"if",
"not",
"name",
":",
"raise",
"ValueError",
"(",
"\"Must specify the optimizer name\"",
")",
"self",
".",
"_use_locking",
"=",
"use_locking",
"self",
".",
"_name",
"=",
"name",
"... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/training/optimizer.py#L133-L153 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | CollapsiblePaneEvent.SetCollapsed | (*args, **kwargs) | return _controls_.CollapsiblePaneEvent_SetCollapsed(*args, **kwargs) | SetCollapsed(self, bool c) | SetCollapsed(self, bool c) | [
"SetCollapsed",
"(",
"self",
"bool",
"c",
")"
] | def SetCollapsed(*args, **kwargs):
"""SetCollapsed(self, bool c)"""
return _controls_.CollapsiblePaneEvent_SetCollapsed(*args, **kwargs) | [
"def",
"SetCollapsed",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"CollapsiblePaneEvent_SetCollapsed",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L7410-L7412 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | VListBox.GetFirstSelected | (*args, **kwargs) | return _windows_.VListBox_GetFirstSelected(*args, **kwargs) | GetFirstSelected(self) -> PyObject | GetFirstSelected(self) -> PyObject | [
"GetFirstSelected",
"(",
"self",
")",
"-",
">",
"PyObject"
] | def GetFirstSelected(*args, **kwargs):
"""GetFirstSelected(self) -> PyObject"""
return _windows_.VListBox_GetFirstSelected(*args, **kwargs) | [
"def",
"GetFirstSelected",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"VListBox_GetFirstSelected",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L2628-L2630 | |
indutny/candor | 48e7260618f5091c80a3416828e2808cad3ea22e | tools/gyp/pylib/gyp/MSVSSettings.py | python | ConvertVCMacrosToMSBuild | (s) | return s | Convert the the MSVS macros found in the string to the MSBuild equivalent.
This list is probably not exhaustive. Add as needed. | Convert the the MSVS macros found in the string to the MSBuild equivalent. | [
"Convert",
"the",
"the",
"MSVS",
"macros",
"found",
"in",
"the",
"string",
"to",
"the",
"MSBuild",
"equivalent",
"."
] | def ConvertVCMacrosToMSBuild(s):
"""Convert the the MSVS macros found in the string to the MSBuild equivalent.
This list is probably not exhaustive. Add as needed.
"""
if '$' in s:
replace_map = {
'$(ConfigurationName)': '$(Configuration)',
'$(InputDir)': '%(RootDir)%(Directory)',
... | [
"def",
"ConvertVCMacrosToMSBuild",
"(",
"s",
")",
":",
"if",
"'$'",
"in",
"s",
":",
"replace_map",
"=",
"{",
"'$(ConfigurationName)'",
":",
"'$(Configuration)'",
",",
"'$(InputDir)'",
":",
"'%(RootDir)%(Directory)'",
",",
"'$(InputExt)'",
":",
"'%(Extension)'",
",",... | https://github.com/indutny/candor/blob/48e7260618f5091c80a3416828e2808cad3ea22e/tools/gyp/pylib/gyp/MSVSSettings.py#L383-L403 | |
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | third_party/ply/example/BASIC/basiclex.py | python | t_ID | (t) | return t | r'[A-Z][A-Z0-9]* | r'[A-Z][A-Z0-9]* | [
"r",
"[",
"A",
"-",
"Z",
"]",
"[",
"A",
"-",
"Z0",
"-",
"9",
"]",
"*"
] | def t_ID(t):
r'[A-Z][A-Z0-9]*'
if t.value in keywords:
t.type = t.value
return t | [
"def",
"t_ID",
"(",
"t",
")",
":",
"if",
"t",
".",
"value",
"in",
"keywords",
":",
"t",
".",
"type",
"=",
"t",
".",
"value",
"return",
"t"
] | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/third_party/ply/example/BASIC/basiclex.py#L23-L27 | |
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | Tools/uorb_graph/create.py | python | Graph._generate_print_lists | (self, use_topic_pubsub_union, merge_depends) | generate the set of scopes (modules + libraries) and topics to print to output | generate the set of scopes (modules + libraries) and topics to print to output | [
"generate",
"the",
"set",
"of",
"scopes",
"(",
"modules",
"+",
"libraries",
")",
"and",
"topics",
"to",
"print",
"to",
"output"
] | def _generate_print_lists(self, use_topic_pubsub_union, merge_depends):
""" generate the set of scopes (modules + libraries) and topics to print to output """
subscribed_topics = set()
published_topics = set()
ambiguous_topics = set()
# gather all found scopes:
all_scop... | [
"def",
"_generate_print_lists",
"(",
"self",
",",
"use_topic_pubsub_union",
",",
"merge_depends",
")",
":",
"subscribed_topics",
"=",
"set",
"(",
")",
"published_topics",
"=",
"set",
"(",
")",
"ambiguous_topics",
"=",
"set",
"(",
")",
"# gather all found scopes:",
... | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/Tools/uorb_graph/create.py#L331-L394 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | native_client_sdk/src/build_tools/buildbot_common.py | python | MakeDir | (dst) | Create the path including all parent directories as needed. | Create the path including all parent directories as needed. | [
"Create",
"the",
"path",
"including",
"all",
"parent",
"directories",
"as",
"needed",
"."
] | def MakeDir(dst):
"""Create the path including all parent directories as needed."""
print 'mkdir -p ' + dst
oshelpers.Mkdir(['-p', dst]) | [
"def",
"MakeDir",
"(",
"dst",
")",
":",
"print",
"'mkdir -p '",
"+",
"dst",
"oshelpers",
".",
"Mkdir",
"(",
"[",
"'-p'",
",",
"dst",
"]",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/native_client_sdk/src/build_tools/buildbot_common.py#L161-L164 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | xmlReg.regexpExec | (self, content) | return ret | Check if the regular expression generates the value | Check if the regular expression generates the value | [
"Check",
"if",
"the",
"regular",
"expression",
"generates",
"the",
"value"
] | def regexpExec(self, content):
"""Check if the regular expression generates the value """
ret = libxml2mod.xmlRegexpExec(self._o, content)
return ret | [
"def",
"regexpExec",
"(",
"self",
",",
"content",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlRegexpExec",
"(",
"self",
".",
"_o",
",",
"content",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L6200-L6203 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mailbox.py | python | Mailbox.keys | (self) | return list(self.iterkeys()) | Return a list of keys. | Return a list of keys. | [
"Return",
"a",
"list",
"of",
"keys",
"."
] | def keys(self):
"""Return a list of keys."""
return list(self.iterkeys()) | [
"def",
"keys",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
".",
"iterkeys",
"(",
")",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mailbox.py#L102-L104 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/linalg/matfuncs.py | python | expm | (A) | return scipy.sparse.linalg.expm(A) | Compute the matrix exponential using Pade approximation.
Parameters
----------
A : (N, N) array_like or sparse matrix
Matrix to be exponentiated.
Returns
-------
expm : (N, N) ndarray
Matrix exponential of `A`.
References
----------
.. [1] Awad H. Al-Mohy and Nicho... | Compute the matrix exponential using Pade approximation. | [
"Compute",
"the",
"matrix",
"exponential",
"using",
"Pade",
"approximation",
"."
] | def expm(A):
"""
Compute the matrix exponential using Pade approximation.
Parameters
----------
A : (N, N) array_like or sparse matrix
Matrix to be exponentiated.
Returns
-------
expm : (N, N) ndarray
Matrix exponential of `A`.
References
----------
.. [1] ... | [
"def",
"expm",
"(",
"A",
")",
":",
"# Input checking and conversion is provided by sparse.linalg.expm().",
"import",
"scipy",
".",
"sparse",
".",
"linalg",
"return",
"scipy",
".",
"sparse",
".",
"linalg",
".",
"expm",
"(",
"A",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/linalg/matfuncs.py#L211-L256 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/statemachine.py | python | StateMachine.is_next_line_blank | (self) | Return 1 if the next line is blank or non-existant. | Return 1 if the next line is blank or non-existant. | [
"Return",
"1",
"if",
"the",
"next",
"line",
"is",
"blank",
"or",
"non",
"-",
"existant",
"."
] | def is_next_line_blank(self):
"""Return 1 if the next line is blank or non-existant."""
try:
return not self.input_lines[self.line_offset + 1].strip()
except IndexError:
return 1 | [
"def",
"is_next_line_blank",
"(",
"self",
")",
":",
"try",
":",
"return",
"not",
"self",
".",
"input_lines",
"[",
"self",
".",
"line_offset",
"+",
"1",
"]",
".",
"strip",
"(",
")",
"except",
"IndexError",
":",
"return",
"1"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/statemachine.py#L315-L320 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/framemanager.py | python | AuiManager.SetAGWFlags | (self, agwFlags) | This method is used to specify :class:`AuiManager` 's settings flags.
:param integer `agwFlags`: specifies options which allow the frame management behavior
to be modified. `agwFlags` can be one of the following style bits:
==================================== ===============================... | This method is used to specify :class:`AuiManager` 's settings flags. | [
"This",
"method",
"is",
"used",
"to",
"specify",
":",
"class",
":",
"AuiManager",
"s",
"settings",
"flags",
"."
] | def SetAGWFlags(self, agwFlags):
"""
This method is used to specify :class:`AuiManager` 's settings flags.
:param integer `agwFlags`: specifies options which allow the frame management behavior
to be modified. `agwFlags` can be one of the following style bits:
===============... | [
"def",
"SetAGWFlags",
"(",
"self",
",",
"agwFlags",
")",
":",
"self",
".",
"_agwFlags",
"=",
"agwFlags",
"if",
"len",
"(",
"self",
".",
"_guides",
")",
">",
"0",
":",
"self",
".",
"CreateGuideWindows",
"(",
")",
"if",
"self",
".",
"_hint_window",
"and"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/framemanager.py#L4392-L4435 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/requests/sessions.py | python | session | () | return Session() | Returns a :class:`Session` for context-management.
.. deprecated:: 1.0.0
This method has been deprecated since version 1.0.0 and is only kept for
backwards compatibility. New code should use :class:`~requests.sessions.Session`
to create a session. This may be removed at a future date.
... | Returns a :class:`Session` for context-management. | [
"Returns",
"a",
":",
"class",
":",
"Session",
"for",
"context",
"-",
"management",
"."
] | def session():
"""
Returns a :class:`Session` for context-management.
.. deprecated:: 1.0.0
This method has been deprecated since version 1.0.0 and is only kept for
backwards compatibility. New code should use :class:`~requests.sessions.Session`
to create a session. This may be rem... | [
"def",
"session",
"(",
")",
":",
"return",
"Session",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/requests/sessions.py#L755-L767 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/Tools/msvc.py | python | print_all_msvc_detected | (conf) | Print the contents of *conf.env.MSVC_INSTALLED_VERSIONS* | Print the contents of *conf.env.MSVC_INSTALLED_VERSIONS* | [
"Print",
"the",
"contents",
"of",
"*",
"conf",
".",
"env",
".",
"MSVC_INSTALLED_VERSIONS",
"*"
] | def print_all_msvc_detected(conf):
"""
Print the contents of *conf.env.MSVC_INSTALLED_VERSIONS*
"""
for version,targets in conf.env['MSVC_INSTALLED_VERSIONS']:
Logs.info(version)
for target,l in targets:
Logs.info("\t"+target) | [
"def",
"print_all_msvc_detected",
"(",
"conf",
")",
":",
"for",
"version",
",",
"targets",
"in",
"conf",
".",
"env",
"[",
"'MSVC_INSTALLED_VERSIONS'",
"]",
":",
"Logs",
".",
"info",
"(",
"version",
")",
"for",
"target",
",",
"l",
"in",
"targets",
":",
"L... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Tools/msvc.py#L530-L537 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Node/FS.py | python | EntryProxy.__get_rsrcdir | (self) | return EntryProxy(self.get().srcnode().rfile().dir) | Returns the directory containing the source node linked to this
node via VariantDir(), or the directory of this node if not linked. | Returns the directory containing the source node linked to this
node via VariantDir(), or the directory of this node if not linked. | [
"Returns",
"the",
"directory",
"containing",
"the",
"source",
"node",
"linked",
"to",
"this",
"node",
"via",
"VariantDir",
"()",
"or",
"the",
"directory",
"of",
"this",
"node",
"if",
"not",
"linked",
"."
] | def __get_rsrcdir(self):
"""Returns the directory containing the source node linked to this
node via VariantDir(), or the directory of this node if not linked."""
return EntryProxy(self.get().srcnode().rfile().dir) | [
"def",
"__get_rsrcdir",
"(",
"self",
")",
":",
"return",
"EntryProxy",
"(",
"self",
".",
"get",
"(",
")",
".",
"srcnode",
"(",
")",
".",
"rfile",
"(",
")",
".",
"dir",
")"
] | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Node/FS.py#L502-L505 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/core/numeric.py | python | isscalar | (element) | return (isinstance(element, generic)
or type(element) in ScalarType
or isinstance(element, numbers.Number)) | Returns True if the type of `element` is a scalar type.
Parameters
----------
element : any
Input argument, can be of any type and shape.
Returns
-------
val : bool
True if `element` is a scalar type, False if it is not.
See Also
--------
ndim : Get the number of d... | Returns True if the type of `element` is a scalar type. | [
"Returns",
"True",
"if",
"the",
"type",
"of",
"element",
"is",
"a",
"scalar",
"type",
"."
] | def isscalar(element):
"""
Returns True if the type of `element` is a scalar type.
Parameters
----------
element : any
Input argument, can be of any type and shape.
Returns
-------
val : bool
True if `element` is a scalar type, False if it is not.
See Also
----... | [
"def",
"isscalar",
"(",
"element",
")",
":",
"return",
"(",
"isinstance",
"(",
"element",
",",
"generic",
")",
"or",
"type",
"(",
"element",
")",
"in",
"ScalarType",
"or",
"isinstance",
"(",
"element",
",",
"numbers",
".",
"Number",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/core/numeric.py#L1787-L1864 | |
facebookincubator/BOLT | 88c70afe9d388ad430cc150cc158641701397f70 | llvm/examples/Kaleidoscope/MCJIT/lazy/genk-timing.py | python | KScriptGenerator.updateFunctionCallMap | (self, caller, callee) | Maintains a map of functions that are called from other functions | Maintains a map of functions that are called from other functions | [
"Maintains",
"a",
"map",
"of",
"functions",
"that",
"are",
"called",
"from",
"other",
"functions"
] | def updateFunctionCallMap(self, caller, callee):
"""Maintains a map of functions that are called from other functions"""
if not caller in self.calledFunctionTable:
self.calledFunctionTable[caller] = []
if not callee in self.calledFunctionTable[caller]:
self.calledFunction... | [
"def",
"updateFunctionCallMap",
"(",
"self",
",",
"caller",
",",
"callee",
")",
":",
"if",
"not",
"caller",
"in",
"self",
".",
"calledFunctionTable",
":",
"self",
".",
"calledFunctionTable",
"[",
"caller",
"]",
"=",
"[",
"]",
"if",
"not",
"callee",
"in",
... | https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/llvm/examples/Kaleidoscope/MCJIT/lazy/genk-timing.py#L58-L66 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/propgrid.py | python | PropertyGridPopulator.ParseChoices | (*args, **kwargs) | return _propgrid.PropertyGridPopulator_ParseChoices(*args, **kwargs) | ParseChoices(self, String choicesString, String idString) -> PGChoices | ParseChoices(self, String choicesString, String idString) -> PGChoices | [
"ParseChoices",
"(",
"self",
"String",
"choicesString",
"String",
"idString",
")",
"-",
">",
"PGChoices"
] | def ParseChoices(*args, **kwargs):
"""ParseChoices(self, String choicesString, String idString) -> PGChoices"""
return _propgrid.PropertyGridPopulator_ParseChoices(*args, **kwargs) | [
"def",
"ParseChoices",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridPopulator_ParseChoices",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L2620-L2622 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py | python | VisualStudioVersion.Path | (self) | return self.path | Returns the path to Visual Studio installation. | Returns the path to Visual Studio installation. | [
"Returns",
"the",
"path",
"to",
"Visual",
"Studio",
"installation",
"."
] | def Path(self):
"""Returns the path to Visual Studio installation."""
return self.path | [
"def",
"Path",
"(",
"self",
")",
":",
"return",
"self",
".",
"path"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py#L60-L62 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/checkperms/checkperms.py | python | is_ignored | (rel_path) | return (
os.path.basename(rel_path) in IGNORED_FILENAMES or
rel_path.lower().startswith(IGNORED_PATHS)) | Returns True if rel_path is in our whitelist of files to ignore. | Returns True if rel_path is in our whitelist of files to ignore. | [
"Returns",
"True",
"if",
"rel_path",
"is",
"in",
"our",
"whitelist",
"of",
"files",
"to",
"ignore",
"."
] | def is_ignored(rel_path):
"""Returns True if rel_path is in our whitelist of files to ignore."""
rel_path = rel_path.lower()
return (
os.path.basename(rel_path) in IGNORED_FILENAMES or
rel_path.lower().startswith(IGNORED_PATHS)) | [
"def",
"is_ignored",
"(",
"rel_path",
")",
":",
"rel_path",
"=",
"rel_path",
".",
"lower",
"(",
")",
"return",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"rel_path",
")",
"in",
"IGNORED_FILENAMES",
"or",
"rel_path",
".",
"lower",
"(",
")",
".",
"sta... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/checkperms/checkperms.py#L261-L266 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | tools/linter/mypy_wrapper.py | python | make_plan | (
*,
configs: Dict[str, Set[str]],
files: List[str]
) | return plan | Return a dict from config names to the files to run them with.
The keys of the returned dict are a subset of the keys of `configs`.
The list of files in each value of returned dict should contain a
nonempty subset of the given `files`, in the same order as `files`. | Return a dict from config names to the files to run them with. | [
"Return",
"a",
"dict",
"from",
"config",
"names",
"to",
"the",
"files",
"to",
"run",
"them",
"with",
"."
] | def make_plan(
*,
configs: Dict[str, Set[str]],
files: List[str]
) -> Dict[str, List[str]]:
"""
Return a dict from config names to the files to run them with.
The keys of the returned dict are a subset of the keys of `configs`.
The list of files in each value of returned dict should contain... | [
"def",
"make_plan",
"(",
"*",
",",
"configs",
":",
"Dict",
"[",
"str",
",",
"Set",
"[",
"str",
"]",
"]",
",",
"files",
":",
"List",
"[",
"str",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"List",
"[",
"str",
"]",
"]",
":",
"trie",
"=",
"make_tri... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/tools/linter/mypy_wrapper.py#L109-L126 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py2/google/protobuf/internal/encoder.py | python | _VarintEncoder | () | return EncodeVarint | Return an encoder for a basic varint value (does not include tag). | Return an encoder for a basic varint value (does not include tag). | [
"Return",
"an",
"encoder",
"for",
"a",
"basic",
"varint",
"value",
"(",
"does",
"not",
"include",
"tag",
")",
"."
] | def _VarintEncoder():
"""Return an encoder for a basic varint value (does not include tag)."""
local_int2byte = six.int2byte
def EncodeVarint(write, value, unused_deterministic=None):
bits = value & 0x7f
value >>= 7
while value:
write(local_int2byte(0x80|bits))
bits = value & 0x7f
v... | [
"def",
"_VarintEncoder",
"(",
")",
":",
"local_int2byte",
"=",
"six",
".",
"int2byte",
"def",
"EncodeVarint",
"(",
"write",
",",
"value",
",",
"unused_deterministic",
"=",
"None",
")",
":",
"bits",
"=",
"value",
"&",
"0x7f",
"value",
">>=",
"7",
"while",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py2/google/protobuf/internal/encoder.py#L372-L385 | |
blackberry/Boost | fc90c3fde129c62565c023f091eddc4a7ed9902b | tools/build/v2/build/project.py | python | ProjectAttributes.dump | (self) | Prints the project attributes. | Prints the project attributes. | [
"Prints",
"the",
"project",
"attributes",
"."
] | def dump(self):
"""Prints the project attributes."""
id = self.get("id")
if not id:
id = "(none)"
else:
id = id[0]
parent = self.get("parent")
if not parent:
parent = "(none)"
else:
parent = parent[0]
print... | [
"def",
"dump",
"(",
"self",
")",
":",
"id",
"=",
"self",
".",
"get",
"(",
"\"id\"",
")",
"if",
"not",
"id",
":",
"id",
"=",
"\"(none)\"",
"else",
":",
"id",
"=",
"id",
"[",
"0",
"]",
"parent",
"=",
"self",
".",
"get",
"(",
"\"parent\"",
")",
... | https://github.com/blackberry/Boost/blob/fc90c3fde129c62565c023f091eddc4a7ed9902b/tools/build/v2/build/project.py#L818-L837 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/core/fromnumeric.py | python | prod | (a, axis=None, dtype=None, out=None, keepdims=False) | Return the product of array elements over a given axis.
Parameters
----------
a : array_like
Input data.
axis : None or int or tuple of ints, optional
Axis or axes along which a product is performed.
The default (`axis` = `None`) is perform a product over all
the dimensi... | Return the product of array elements over a given axis. | [
"Return",
"the",
"product",
"of",
"array",
"elements",
"over",
"a",
"given",
"axis",
"."
] | def prod(a, axis=None, dtype=None, out=None, keepdims=False):
"""
Return the product of array elements over a given axis.
Parameters
----------
a : array_like
Input data.
axis : None or int or tuple of ints, optional
Axis or axes along which a product is performed.
The d... | [
"def",
"prod",
"(",
"a",
",",
"axis",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"out",
"=",
"None",
",",
"keepdims",
"=",
"False",
")",
":",
"if",
"type",
"(",
"a",
")",
"is",
"not",
"mu",
".",
"ndarray",
":",
"try",
":",
"prod",
"=",
"a",... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/core/fromnumeric.py#L2249-L2343 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/control_flow_ops.py | python | _SwitchRefOrTensor | (data, pred, name="Switch") | Forwards `data` to an output determined by `pred`.
If `pred` is false, the `data` input is forwarded to the first output.
Otherwise, the data goes to the second output.
This op handles `Tensor`s and `IndexedSlices`.
Args:
data: The tensor to be forwarded to the appropriate output.
pred: A scalar that... | Forwards `data` to an output determined by `pred`. | [
"Forwards",
"data",
"to",
"an",
"output",
"determined",
"by",
"pred",
"."
] | def _SwitchRefOrTensor(data, pred, name="Switch"):
"""Forwards `data` to an output determined by `pred`.
If `pred` is false, the `data` input is forwarded to the first output.
Otherwise, the data goes to the second output.
This op handles `Tensor`s and `IndexedSlices`.
Args:
data: The tensor to be forw... | [
"def",
"_SwitchRefOrTensor",
"(",
"data",
",",
"pred",
",",
"name",
"=",
"\"Switch\"",
")",
":",
"data",
"=",
"ops",
".",
"convert_to_tensor_or_indexed_slices",
"(",
"data",
",",
"name",
"=",
"\"data\"",
")",
"# NOTE(vrv): ops.colocate_with(data, ignore_existing=True)... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/control_flow_ops.py#L326-L367 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/logging/__init__.py | python | Logger.getChild | (self, suffix) | return self.manager.getLogger(suffix) | Get a logger which is a descendant to this one.
This is a convenience method, such that
logging.getLogger('abc').getChild('def.ghi')
is the same as
logging.getLogger('abc.def.ghi')
It's useful, for example, when the parent logger is named using
__name__ rather than a... | Get a logger which is a descendant to this one. | [
"Get",
"a",
"logger",
"which",
"is",
"a",
"descendant",
"to",
"this",
"one",
"."
] | def getChild(self, suffix):
"""
Get a logger which is a descendant to this one.
This is a convenience method, such that
logging.getLogger('abc').getChild('def.ghi')
is the same as
logging.getLogger('abc.def.ghi')
It's useful, for example, when the parent logg... | [
"def",
"getChild",
"(",
"self",
",",
"suffix",
")",
":",
"if",
"self",
".",
"root",
"is",
"not",
"self",
":",
"suffix",
"=",
"'.'",
".",
"join",
"(",
"(",
"self",
".",
"name",
",",
"suffix",
")",
")",
"return",
"self",
".",
"manager",
".",
"getLo... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/logging/__init__.py#L1350-L1367 | |
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | interpreter/llvm/src/utils/benchmark/mingw.py | python | find_7zip | (log = EmptyLogger()) | return path[0] | Attempts to find 7zip for unpacking the mingw-build archives | Attempts to find 7zip for unpacking the mingw-build archives | [
"Attempts",
"to",
"find",
"7zip",
"for",
"unpacking",
"the",
"mingw",
"-",
"build",
"archives"
] | def find_7zip(log = EmptyLogger()):
'''
Attempts to find 7zip for unpacking the mingw-build archives
'''
log.info('finding 7zip')
path = find_in_path('7z')
if not path:
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\7-Zip')
path, _ = winreg.QueryValueEx(key, 'Path')
... | [
"def",
"find_7zip",
"(",
"log",
"=",
"EmptyLogger",
"(",
")",
")",
":",
"log",
".",
"info",
"(",
"'finding 7zip'",
")",
"path",
"=",
"find_in_path",
"(",
"'7z'",
")",
"if",
"not",
"path",
":",
"key",
"=",
"winreg",
".",
"OpenKey",
"(",
"winreg",
".",... | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/interpreter/llvm/src/utils/benchmark/mingw.py#L99-L110 | |
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/android/gyp/util/protoresources.py | python | _ProcessZip | (zip_path, process_func) | Filters a .zip file via: new_bytes = process_func(filename, data). | Filters a .zip file via: new_bytes = process_func(filename, data). | [
"Filters",
"a",
".",
"zip",
"file",
"via",
":",
"new_bytes",
"=",
"process_func",
"(",
"filename",
"data",
")",
"."
] | def _ProcessZip(zip_path, process_func):
"""Filters a .zip file via: new_bytes = process_func(filename, data)."""
has_changes = False
zip_entries = []
with zipfile.ZipFile(zip_path) as src_zip:
for info in src_zip.infolist():
data = src_zip.read(info)
new_data = process_func(info.filename, data)... | [
"def",
"_ProcessZip",
"(",
"zip_path",
",",
"process_func",
")",
":",
"has_changes",
"=",
"False",
"zip_entries",
"=",
"[",
"]",
"with",
"zipfile",
".",
"ZipFile",
"(",
"zip_path",
")",
"as",
"src_zip",
":",
"for",
"info",
"in",
"src_zip",
".",
"infolist",... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/android/gyp/util/protoresources.py#L39-L56 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/rnn/python/ops/rnn_cell.py | python | UGRNNCell.__init__ | (self, num_units, initializer=None, forget_bias=1.0,
activation=math_ops.tanh, reuse=None) | Initialize the parameters for an UGRNN cell.
Args:
num_units: int, The number of units in the UGRNN cell
initializer: (optional) The initializer to use for the weight matrices.
forget_bias: (optional) float, default 1.0, The initial bias of the
forget gate, used to reduce the scale of for... | Initialize the parameters for an UGRNN cell. | [
"Initialize",
"the",
"parameters",
"for",
"an",
"UGRNN",
"cell",
"."
] | def __init__(self, num_units, initializer=None, forget_bias=1.0,
activation=math_ops.tanh, reuse=None):
"""Initialize the parameters for an UGRNN cell.
Args:
num_units: int, The number of units in the UGRNN cell
initializer: (optional) The initializer to use for the weight matrices.
... | [
"def",
"__init__",
"(",
"self",
",",
"num_units",
",",
"initializer",
"=",
"None",
",",
"forget_bias",
"=",
"1.0",
",",
"activation",
"=",
"math_ops",
".",
"tanh",
",",
"reuse",
"=",
"None",
")",
":",
"super",
"(",
"UGRNNCell",
",",
"self",
")",
".",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/rnn/python/ops/rnn_cell.py#L1517-L1538 | ||
learnforpractice/pyeos | 4f04eb982c86c1fdb413084af77c713a6fda3070 | libraries/vm/vm_cpython_ss/lib/abc.py | python | abstractmethod | (funcobj) | return funcobj | A decorator indicating abstract methods.
Requires that the metaclass is ABCMeta or derived from it. A
class that has a metaclass derived from ABCMeta cannot be
instantiated unless all of its abstract methods are overridden.
The abstract methods can be called using any of the normal
'super' call me... | A decorator indicating abstract methods. | [
"A",
"decorator",
"indicating",
"abstract",
"methods",
"."
] | def abstractmethod(funcobj):
"""A decorator indicating abstract methods.
Requires that the metaclass is ABCMeta or derived from it. A
class that has a metaclass derived from ABCMeta cannot be
instantiated unless all of its abstract methods are overridden.
The abstract methods can be called using a... | [
"def",
"abstractmethod",
"(",
"funcobj",
")",
":",
"funcobj",
".",
"__isabstractmethod__",
"=",
"True",
"return",
"funcobj"
] | https://github.com/learnforpractice/pyeos/blob/4f04eb982c86c1fdb413084af77c713a6fda3070/libraries/vm/vm_cpython_ss/lib/abc.py#L9-L26 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/commands.py | python | Build.finalize_options | (self) | Finalize options | Finalize options | [
"Finalize",
"options"
] | def finalize_options(self):
""" Finalize options """
_build.build.finalize_options(self)
if 'build' in _option_inherits:
for parent, opt_name in _option_inherits['build']:
self.set_undefined_options(parent, (opt_name, opt_name))
if 'build' in _option_finalizer... | [
"def",
"finalize_options",
"(",
"self",
")",
":",
"_build",
".",
"build",
".",
"finalize_options",
"(",
"self",
")",
"if",
"'build'",
"in",
"_option_inherits",
":",
"for",
"parent",
",",
"opt_name",
"in",
"_option_inherits",
"[",
"'build'",
"]",
":",
"self",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/commands.py#L258-L266 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/api.py | python | patch | (url, data=None, **kwargs) | return request('patch', url, data=data, **kwargs) | r"""Sends a PATCH request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`Request`.
:param \*\*k... | r"""Sends a PATCH request. | [
"r",
"Sends",
"a",
"PATCH",
"request",
"."
] | def patch(url, data=None, **kwargs):
r"""Sends a PATCH request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body ... | [
"def",
"patch",
"(",
"url",
",",
"data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"request",
"(",
"'patch'",
",",
"url",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/api.py#L137-L149 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/elb/loadbalancer.py | python | LoadBalancer.__init__ | (self, connection=None, name=None, endpoints=None) | :ivar boto.ec2.elb.ELBConnection connection: The connection this load
balancer was instance was instantiated from.
:ivar list listeners: A list of tuples in the form of
``(<Inbound port>, <Outbound port>, <Protocol>)``
:ivar boto.ec2.elb.healthcheck.HealthCheck health_check: The ... | :ivar boto.ec2.elb.ELBConnection connection: The connection this load
balancer was instance was instantiated from.
:ivar list listeners: A list of tuples in the form of
``(<Inbound port>, <Outbound port>, <Protocol>)``
:ivar boto.ec2.elb.healthcheck.HealthCheck health_check: The ... | [
":",
"ivar",
"boto",
".",
"ec2",
".",
"elb",
".",
"ELBConnection",
"connection",
":",
"The",
"connection",
"this",
"load",
"balancer",
"was",
"instance",
"was",
"instantiated",
"from",
".",
":",
"ivar",
"list",
"listeners",
":",
"A",
"list",
"of",
"tuples"... | def __init__(self, connection=None, name=None, endpoints=None):
"""
:ivar boto.ec2.elb.ELBConnection connection: The connection this load
balancer was instance was instantiated from.
:ivar list listeners: A list of tuples in the form of
``(<Inbound port>, <Outbound port>,... | [
"def",
"__init__",
"(",
"self",
",",
"connection",
"=",
"None",
",",
"name",
"=",
"None",
",",
"endpoints",
"=",
"None",
")",
":",
"self",
".",
"connection",
"=",
"connection",
"self",
".",
"name",
"=",
"name",
"self",
".",
"listeners",
"=",
"None",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/elb/loadbalancer.py#L77-L128 | ||
syoyo/tinygltf | e7f1ff5c59d3ca2489923beb239bdf93d863498f | deps/cpplint.py | python | GetPreviousNonBlankLine | (clean_lines, linenum) | return ('', -1) | Return the most recent non-blank line and its line number.
Args:
clean_lines: A CleansedLines instance containing the file contents.
linenum: The number of the line to check.
Returns:
A tuple with two elements. The first element is the contents of the last
non-blank line before the current line, ... | Return the most recent non-blank line and its line number. | [
"Return",
"the",
"most",
"recent",
"non",
"-",
"blank",
"line",
"and",
"its",
"line",
"number",
"."
] | def GetPreviousNonBlankLine(clean_lines, linenum):
"""Return the most recent non-blank line and its line number.
Args:
clean_lines: A CleansedLines instance containing the file contents.
linenum: The number of the line to check.
Returns:
A tuple with two elements. The first element is the contents ... | [
"def",
"GetPreviousNonBlankLine",
"(",
"clean_lines",
",",
"linenum",
")",
":",
"prevlinenum",
"=",
"linenum",
"-",
"1",
"while",
"prevlinenum",
">=",
"0",
":",
"prevline",
"=",
"clean_lines",
".",
"elided",
"[",
"prevlinenum",
"]",
"if",
"not",
"IsBlankLine",... | https://github.com/syoyo/tinygltf/blob/e7f1ff5c59d3ca2489923beb239bdf93d863498f/deps/cpplint.py#L3867-L3887 | |
Slicer/SlicerGitSVNArchive | 65e92bb16c2b32ea47a1a66bee71f238891ee1ca | Modules/Scripted/EditorLib/PaintEffect.py | python | PaintEffectTool.paintPixel | (self, x, y) | paint with a single pixel (in label space) | paint with a single pixel (in label space) | [
"paint",
"with",
"a",
"single",
"pixel",
"(",
"in",
"label",
"space",
")"
] | def paintPixel(self, x, y):
"""
paint with a single pixel (in label space)
"""
sliceLogic = self.sliceWidget.sliceLogic()
labelLogic = sliceLogic.GetLabelLayer()
labelNode = labelLogic.GetVolumeNode()
labelImage = labelNode.GetImageData()
if not labelNode:
# if there's no label, w... | [
"def",
"paintPixel",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"sliceLogic",
"=",
"self",
".",
"sliceWidget",
".",
"sliceLogic",
"(",
")",
"labelLogic",
"=",
"sliceLogic",
".",
"GetLabelLayer",
"(",
")",
"labelNode",
"=",
"labelLogic",
".",
"GetVolumeNode... | https://github.com/Slicer/SlicerGitSVNArchive/blob/65e92bb16c2b32ea47a1a66bee71f238891ee1ca/Modules/Scripted/EditorLib/PaintEffect.py#L530-L560 | ||
p4lang/behavioral-model | 81ce0163f0770c6b9d6056a28ce2e0cc035bb6e9 | tools/cpplint.py | python | CheckRedundantOverrideOrFinal | (filename, clean_lines, linenum, error) | Check if line contains a redundant "override" or "final" virt-specifier.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Check if line contains a redundant "override" or "final" virt-specifier. | [
"Check",
"if",
"line",
"contains",
"a",
"redundant",
"override",
"or",
"final",
"virt",
"-",
"specifier",
"."
] | def CheckRedundantOverrideOrFinal(filename, clean_lines, linenum, error):
"""Check if line contains a redundant "override" or "final" virt-specifier.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
er... | [
"def",
"CheckRedundantOverrideOrFinal",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"# Look for closing parenthesis nearby. We need one to confirm where",
"# the declarator ends and where the virt-specifier starts to avoid",
"# false positives.",
"line... | https://github.com/p4lang/behavioral-model/blob/81ce0163f0770c6b9d6056a28ce2e0cc035bb6e9/tools/cpplint.py#L6242-L6268 | ||
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | lldb/examples/python/symbolication.py | python | Image.create_target | (self) | return None | Create a target using the information in this Image object. | Create a target using the information in this Image object. | [
"Create",
"a",
"target",
"using",
"the",
"information",
"in",
"this",
"Image",
"object",
"."
] | def create_target(self):
'''Create a target using the information in this Image object.'''
if self.unavailable:
return None
if self.locate_module_and_debug_symbols():
resolved_path = self.get_resolved_path()
path_spec = lldb.SBFileSpec(resolved_path)
... | [
"def",
"create_target",
"(",
"self",
")",
":",
"if",
"self",
".",
"unavailable",
":",
"return",
"None",
"if",
"self",
".",
"locate_module_and_debug_symbols",
"(",
")",
":",
"resolved_path",
"=",
"self",
".",
"get_resolved_path",
"(",
")",
"path_spec",
"=",
"... | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/lldb/examples/python/symbolication.py#L414-L437 | |
s5z/zsim | fb4d6e0475a25cffd23f0687ede2d43d96b4a99f | misc/cpplint.py | python | CheckLanguage | (filename, clean_lines, linenum, file_extension, include_state,
error) | Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum:... | Checks rules from the 'C++ language rules' section of cppguide.html. | [
"Checks",
"rules",
"from",
"the",
"C",
"++",
"language",
"rules",
"section",
"of",
"cppguide",
".",
"html",
"."
] | def CheckLanguage(filename, clean_lines, linenum, file_extension, include_state,
error):
"""Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.
Args:
fil... | [
"def",
"CheckLanguage",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"file_extension",
",",
"include_state",
",",
"error",
")",
":",
"# If the line is empty or consists of entirely a comment, no need to",
"# check it.",
"line",
"=",
"clean_lines",
".",
"elide... | https://github.com/s5z/zsim/blob/fb4d6e0475a25cffd23f0687ede2d43d96b4a99f/misc/cpplint.py#L3142-L3443 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | PyControl.DoGetVirtualSize | (*args, **kwargs) | return _controls_.PyControl_DoGetVirtualSize(*args, **kwargs) | DoGetVirtualSize(self) -> Size | DoGetVirtualSize(self) -> Size | [
"DoGetVirtualSize",
"(",
"self",
")",
"-",
">",
"Size"
] | def DoGetVirtualSize(*args, **kwargs):
"""DoGetVirtualSize(self) -> Size"""
return _controls_.PyControl_DoGetVirtualSize(*args, **kwargs) | [
"def",
"DoGetVirtualSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"PyControl_DoGetVirtualSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L5870-L5872 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/control/robotinterface.py | python | RobotInterfaceBase.beginStep | (self) | This is called before the commands sent at each time step | This is called before the commands sent at each time step | [
"This",
"is",
"called",
"before",
"the",
"commands",
"sent",
"at",
"each",
"time",
"step"
] | def beginStep(self) -> None:
"""This is called before the commands sent at each time step"""
pass | [
"def",
"beginStep",
"(",
"self",
")",
"->",
"None",
":",
"pass"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/control/robotinterface.py#L288-L290 | ||
ablab/quast | 5f6709528129a6ad266a6b24ef3f40b88f0fe04b | quast_libs/site_packages/jsontemplate/jsontemplate.py | python | _ScopedContext.__init__ | (self, context, undefined_str) | Args:
context: The root context
undefined_str: See Template() constructor. | Args:
context: The root context
undefined_str: See Template() constructor. | [
"Args",
":",
"context",
":",
"The",
"root",
"context",
"undefined_str",
":",
"See",
"Template",
"()",
"constructor",
"."
] | def __init__(self, context, undefined_str):
"""
Args:
context: The root context
undefined_str: See Template() constructor.
"""
self.stack = [_Frame(context)]
self.undefined_str = undefined_str | [
"def",
"__init__",
"(",
"self",
",",
"context",
",",
"undefined_str",
")",
":",
"self",
".",
"stack",
"=",
"[",
"_Frame",
"(",
"context",
")",
"]",
"self",
".",
"undefined_str",
"=",
"undefined_str"
] | https://github.com/ablab/quast/blob/5f6709528129a6ad266a6b24ef3f40b88f0fe04b/quast_libs/site_packages/jsontemplate/jsontemplate.py#L445-L452 | ||
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/sfm/OpenSfM/opensfm/reconstruction.py | python | paint_reconstruction | (data, graph, reconstruction) | Set the color of the points from the color of the tracks. | Set the color of the points from the color of the tracks. | [
"Set",
"the",
"color",
"of",
"the",
"points",
"from",
"the",
"color",
"of",
"the",
"tracks",
"."
] | def paint_reconstruction(data, graph, reconstruction):
"""Set the color of the points from the color of the tracks."""
for k, point in iteritems(reconstruction.points):
point.color = six.next(six.itervalues(graph[k]))['feature_color'] | [
"def",
"paint_reconstruction",
"(",
"data",
",",
"graph",
",",
"reconstruction",
")",
":",
"for",
"k",
",",
"point",
"in",
"iteritems",
"(",
"reconstruction",
".",
"points",
")",
":",
"point",
".",
"color",
"=",
"six",
".",
"next",
"(",
"six",
".",
"it... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/sfm/OpenSfM/opensfm/reconstruction.py#L1014-L1017 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/tableparser.py | python | GridTableParser.scan_left | (self, top, left, bottom, right) | return None | Noting column boundaries, look for the bottom-left corner of the cell.
It must line up with the starting point. | Noting column boundaries, look for the bottom-left corner of the cell.
It must line up with the starting point. | [
"Noting",
"column",
"boundaries",
"look",
"for",
"the",
"bottom",
"-",
"left",
"corner",
"of",
"the",
"cell",
".",
"It",
"must",
"line",
"up",
"with",
"the",
"starting",
"point",
"."
] | def scan_left(self, top, left, bottom, right):
"""
Noting column boundaries, look for the bottom-left corner of the cell.
It must line up with the starting point.
"""
colseps = {}
line = self.block[bottom]
for i in range(right - 1, left, -1):
if line[i... | [
"def",
"scan_left",
"(",
"self",
",",
"top",
",",
"left",
",",
"bottom",
",",
"right",
")",
":",
"colseps",
"=",
"{",
"}",
"line",
"=",
"self",
".",
"block",
"[",
"bottom",
"]",
"for",
"i",
"in",
"range",
"(",
"right",
"-",
"1",
",",
"left",
",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/tableparser.py#L252-L270 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | __wxMemoryFSHandler_AddFile_Data | (*args, **kwargs) | return _core_.__wxMemoryFSHandler_AddFile_Data(*args, **kwargs) | __wxMemoryFSHandler_AddFile_Data(String filename, buffer data) | __wxMemoryFSHandler_AddFile_Data(String filename, buffer data) | [
"__wxMemoryFSHandler_AddFile_Data",
"(",
"String",
"filename",
"buffer",
"data",
")"
] | def __wxMemoryFSHandler_AddFile_Data(*args, **kwargs):
"""__wxMemoryFSHandler_AddFile_Data(String filename, buffer data)"""
return _core_.__wxMemoryFSHandler_AddFile_Data(*args, **kwargs) | [
"def",
"__wxMemoryFSHandler_AddFile_Data",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"__wxMemoryFSHandler_AddFile_Data",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L2535-L2537 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/wsgiref/simple_server.py | python | make_server | (
host, port, app, server_class=WSGIServer, handler_class=WSGIRequestHandler
) | return server | Create a new WSGI server listening on `host` and `port` for `app` | Create a new WSGI server listening on `host` and `port` for `app` | [
"Create",
"a",
"new",
"WSGI",
"server",
"listening",
"on",
"host",
"and",
"port",
"for",
"app"
] | def make_server(
host, port, app, server_class=WSGIServer, handler_class=WSGIRequestHandler
):
"""Create a new WSGI server listening on `host` and `port` for `app`"""
server = server_class((host, port), handler_class)
server.set_app(app)
return server | [
"def",
"make_server",
"(",
"host",
",",
"port",
",",
"app",
",",
"server_class",
"=",
"WSGIServer",
",",
"handler_class",
"=",
"WSGIRequestHandler",
")",
":",
"server",
"=",
"server_class",
"(",
"(",
"host",
",",
"port",
")",
",",
"handler_class",
")",
"se... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/wsgiref/simple_server.py#L150-L156 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/http/server.py | python | HTTPServer.server_bind | (self) | Override server_bind to store the server name. | Override server_bind to store the server name. | [
"Override",
"server_bind",
"to",
"store",
"the",
"server",
"name",
"."
] | def server_bind(self):
"""Override server_bind to store the server name."""
socketserver.TCPServer.server_bind(self)
host, port = self.server_address[:2]
self.server_name = socket.getfqdn(host)
self.server_port = port | [
"def",
"server_bind",
"(",
"self",
")",
":",
"socketserver",
".",
"TCPServer",
".",
"server_bind",
"(",
"self",
")",
"host",
",",
"port",
"=",
"self",
".",
"server_address",
"[",
":",
"2",
"]",
"self",
".",
"server_name",
"=",
"socket",
".",
"getfqdn",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/http/server.py#L135-L140 | ||
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | python/mxnet/model.py | python | _train_multi_device | (symbol, ctx, arg_names, param_names, aux_names,
arg_params, aux_params,
begin_epoch, end_epoch, epoch_size, optimizer,
kvstore, update_on_kvstore,
train_data, eval_data=None, eval_metric=None,
epoch_... | return | Internal training function on multiple devices.
This function will also work for single device as well.
Parameters
----------
symbol : Symbol
The network configuration.
ctx : list of Context
The training devices.
arg_names: list of str
Name of all arguments of the networ... | Internal training function on multiple devices.
This function will also work for single device as well. | [
"Internal",
"training",
"function",
"on",
"multiple",
"devices",
".",
"This",
"function",
"will",
"also",
"work",
"for",
"single",
"device",
"as",
"well",
"."
] | def _train_multi_device(symbol, ctx, arg_names, param_names, aux_names,
arg_params, aux_params,
begin_epoch, end_epoch, epoch_size, optimizer,
kvstore, update_on_kvstore,
train_data, eval_data=None, eval_metric=None,
... | [
"def",
"_train_multi_device",
"(",
"symbol",
",",
"ctx",
",",
"arg_names",
",",
"param_names",
",",
"aux_names",
",",
"arg_params",
",",
"aux_params",
",",
"begin_epoch",
",",
"end_epoch",
",",
"epoch_size",
",",
"optimizer",
",",
"kvstore",
",",
"update_on_kvst... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/model.py#L173-L363 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/configure.d/nodedownload.py | python | checkHash | (targetfile, hashAlgo) | return digest.hexdigest() | Check a file using hashAlgo. Return the hex digest. | Check a file using hashAlgo. Return the hex digest. | [
"Check",
"a",
"file",
"using",
"hashAlgo",
".",
"Return",
"the",
"hex",
"digest",
"."
] | def checkHash(targetfile, hashAlgo):
"""Check a file using hashAlgo. Return the hex digest."""
digest = hashlib.new(hashAlgo)
with open(targetfile, 'rb') as f:
chunk = f.read(1024)
while len(chunk) > 0:
digest.update(chunk)
chunk = f.read(1024)
return digest.hexdigest() | [
"def",
"checkHash",
"(",
"targetfile",
",",
"hashAlgo",
")",
":",
"digest",
"=",
"hashlib",
".",
"new",
"(",
"hashAlgo",
")",
"with",
"open",
"(",
"targetfile",
",",
"'rb'",
")",
"as",
"f",
":",
"chunk",
"=",
"f",
".",
"read",
"(",
"1024",
")",
"wh... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/configure.d/nodedownload.py#L61-L69 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/mixture/gmm.py | python | _GMMBase.score_samples | (self, X) | return logprob, responsibilities | Return the per-sample likelihood of the data under the model.
Compute the log probability of X under the model and
return the posterior distribution (responsibilities) of each
mixture component for each element of X.
Parameters
----------
X: array_like, shape (n_samples... | Return the per-sample likelihood of the data under the model. | [
"Return",
"the",
"per",
"-",
"sample",
"likelihood",
"of",
"the",
"data",
"under",
"the",
"model",
"."
] | def score_samples(self, X):
"""Return the per-sample likelihood of the data under the model.
Compute the log probability of X under the model and
return the posterior distribution (responsibilities) of each
mixture component for each element of X.
Parameters
----------
... | [
"def",
"score_samples",
"(",
"self",
",",
"X",
")",
":",
"check_is_fitted",
"(",
"self",
",",
"'means_'",
")",
"X",
"=",
"check_array",
"(",
"X",
")",
"if",
"X",
".",
"ndim",
"==",
"1",
":",
"X",
"=",
"X",
"[",
":",
",",
"np",
".",
"newaxis",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/mixture/gmm.py#L302-L339 | |
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/pyedbglib/primitive/gen4controller.py | python | Gen4ControllerCommand.set_data_source | (self, source_id) | Sets the data source buffer
:param source_id: data source buffer ID | Sets the data source buffer | [
"Sets",
"the",
"data",
"source",
"buffer"
] | def set_data_source(self, source_id):
"""
Sets the data source buffer
:param source_id: data source buffer ID
"""
self.data_source = source_id | [
"def",
"set_data_source",
"(",
"self",
",",
"source_id",
")",
":",
"self",
".",
"data_source",
"=",
"source_id"
] | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/pyedbglib/primitive/gen4controller.py#L56-L62 | ||
etotheipi/BitcoinArmory | 2a6fc5355bb0c6fe26e387ccba30a5baafe8cd98 | urllib3/packages/six.py | python | remove_move | (name) | Remove item from six.moves. | Remove item from six.moves. | [
"Remove",
"item",
"from",
"six",
".",
"moves",
"."
] | def remove_move(name):
"""Remove item from six.moves."""
try:
delattr(_MovedItems, name)
except AttributeError:
try:
del moves.__dict__[name]
except KeyError:
raise AttributeError("no such move, %r" % (name,)) | [
"def",
"remove_move",
"(",
"name",
")",
":",
"try",
":",
"delattr",
"(",
"_MovedItems",
",",
"name",
")",
"except",
"AttributeError",
":",
"try",
":",
"del",
"moves",
".",
"__dict__",
"[",
"name",
"]",
"except",
"KeyError",
":",
"raise",
"AttributeError",
... | https://github.com/etotheipi/BitcoinArmory/blob/2a6fc5355bb0c6fe26e387ccba30a5baafe8cd98/urllib3/packages/six.py#L194-L202 | ||
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/v7.9.317/third_party/jinja2/compiler.py | python | CodeGenerator.visit_Extends | (self, node, frame) | Calls the extender. | Calls the extender. | [
"Calls",
"the",
"extender",
"."
] | def visit_Extends(self, node, frame):
"""Calls the extender."""
if not frame.toplevel:
self.fail('cannot use extend from a non top-level scope',
node.lineno)
# if the number of extends statements in general is zero so
# far, we don't have to add a check... | [
"def",
"visit_Extends",
"(",
"self",
",",
"node",
",",
"frame",
")",
":",
"if",
"not",
"frame",
".",
"toplevel",
":",
"self",
".",
"fail",
"(",
"'cannot use extend from a non top-level scope'",
",",
"node",
".",
"lineno",
")",
"# if the number of extends statement... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/v7.9.317/third_party/jinja2/compiler.py#L843-L888 | ||
blakesmith/embedded | 61d02c8feed34eff75fe64f29cc8997f1c480867 | nome/hardware/KiBoM/KiBOM/netlist_reader.py | python | netlist.getVersion | (self) | return sheet.get("rev") | Return the verison of the sheet info | Return the verison of the sheet info | [
"Return",
"the",
"verison",
"of",
"the",
"sheet",
"info"
] | def getVersion(self):
"""Return the verison of the sheet info"""
sheet = self.getSheet()
if sheet == None: return ""
return sheet.get("rev") | [
"def",
"getVersion",
"(",
"self",
")",
":",
"sheet",
"=",
"self",
".",
"getSheet",
"(",
")",
"if",
"sheet",
"==",
"None",
":",
"return",
"\"\"",
"return",
"sheet",
".",
"get",
"(",
"\"rev\"",
")"
] | https://github.com/blakesmith/embedded/blob/61d02c8feed34eff75fe64f29cc8997f1c480867/nome/hardware/KiBoM/KiBOM/netlist_reader.py#L381-L385 | |
rsummers11/CADLab | 976ed959a0b5208bb4173127a7ef732ac73a9b6f | panreas_hnn/hed-globalweight/scripts/cpp_lint.py | python | FileInfo.FullName | (self) | return os.path.abspath(self._filename).replace('\\', '/') | Make Windows paths like Unix. | Make Windows paths like Unix. | [
"Make",
"Windows",
"paths",
"like",
"Unix",
"."
] | def FullName(self):
"""Make Windows paths like Unix."""
return os.path.abspath(self._filename).replace('\\', '/') | [
"def",
"FullName",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"abspath",
"(",
"self",
".",
"_filename",
")",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")"
] | https://github.com/rsummers11/CADLab/blob/976ed959a0b5208bb4173127a7ef732ac73a9b6f/panreas_hnn/hed-globalweight/scripts/cpp_lint.py#L881-L883 | |
zju3dv/clean-pvnet | 5870c509e3cc205e1bb28910a7b1a9a3c8add9a8 | lib/utils/pysixd/transform.py | python | decompose_matrix | (matrix) | return scale, shear, angles, translate, perspective | Return sequence of transformations from transformation matrix.
matrix : array_like
Non-degenerative homogeneous transformation matrix
Return tuple of:
scale : vector of 3 scaling factors
shear : list of shear factors for x-y, x-z, y-z axes
angles : list of Euler angles about st... | Return sequence of transformations from transformation matrix. | [
"Return",
"sequence",
"of",
"transformations",
"from",
"transformation",
"matrix",
"."
] | def decompose_matrix(matrix):
"""Return sequence of transformations from transformation matrix.
matrix : array_like
Non-degenerative homogeneous transformation matrix
Return tuple of:
scale : vector of 3 scaling factors
shear : list of shear factors for x-y, x-z, y-z axes
a... | [
"def",
"decompose_matrix",
"(",
"matrix",
")",
":",
"M",
"=",
"numpy",
".",
"array",
"(",
"matrix",
",",
"dtype",
"=",
"numpy",
".",
"float64",
",",
"copy",
"=",
"True",
")",
".",
"T",
"if",
"abs",
"(",
"M",
"[",
"3",
",",
"3",
"]",
")",
"<",
... | https://github.com/zju3dv/clean-pvnet/blob/5870c509e3cc205e1bb28910a7b1a9a3c8add9a8/lib/utils/pysixd/transform.py#L724-L806 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/idl/idl_check_compatibility.py | python | check_param_or_command_type | (ctxt: IDLCompatibilityContext, field_pair: FieldCompatibilityPair,
is_command_parameter: bool) | Check compatibility between old and new command parameter type or command type. | Check compatibility between old and new command parameter type or command type. | [
"Check",
"compatibility",
"between",
"old",
"and",
"new",
"command",
"parameter",
"type",
"or",
"command",
"type",
"."
] | def check_param_or_command_type(ctxt: IDLCompatibilityContext, field_pair: FieldCompatibilityPair,
is_command_parameter: bool):
"""Check compatibility between old and new command parameter type or command type."""
# pylint: disable=too-many-branches
old_field = field_pair.old... | [
"def",
"check_param_or_command_type",
"(",
"ctxt",
":",
"IDLCompatibilityContext",
",",
"field_pair",
":",
"FieldCompatibilityPair",
",",
"is_command_parameter",
":",
"bool",
")",
":",
"# pylint: disable=too-many-branches",
"old_field",
"=",
"field_pair",
".",
"old",
"new... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/idl/idl_check_compatibility.py#L718-L773 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.