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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | ext/ply/example/ansic/cparse.py | python | p_declaration_2 | (t) | declaration : declaration_specifiers SEMI | declaration : declaration_specifiers SEMI | [
"declaration",
":",
"declaration_specifiers",
"SEMI"
] | def p_declaration_2(t):
'declaration : declaration_specifiers SEMI'
pass | [
"def",
"p_declaration_2",
"(",
"t",
")",
":",
"pass"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/ext/ply/example/ansic/cparse.py#L58-L60 | ||
apache/arrow | af33dd1157eb8d7d9bfac25ebf61445b793b7943 | python/pyarrow/filesystem.py | python | FileSystem.ls | (self, path) | Return list of file paths.
Parameters
----------
path : str
Directory to list contents from. | Return list of file paths. | [
"Return",
"list",
"of",
"file",
"paths",
"."
] | def ls(self, path):
"""
Return list of file paths.
Parameters
----------
path : str
Directory to list contents from.
"""
raise NotImplementedError | [
"def",
"ls",
"(",
"self",
",",
"path",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/python/pyarrow/filesystem.py#L57-L66 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/math/optimize.py | python | OptimizationProblemBuilder.costSymbolic | (self) | return res | Returns a symbolic.Expression, over variables in self.context, that
evaluates to the cost | Returns a symbolic.Expression, over variables in self.context, that
evaluates to the cost | [
"Returns",
"a",
"symbolic",
".",
"Expression",
"over",
"variables",
"in",
"self",
".",
"context",
"that",
"evaluates",
"to",
"the",
"cost"
] | def costSymbolic(self):
"""Returns a symbolic.Expression, over variables in self.context, that
evaluates to the cost"""
components = []
weights = []
for obj in self.objectives:
if obj.type == 'cost':
components.append(obj.expr)
weights.... | [
"def",
"costSymbolic",
"(",
"self",
")",
":",
"components",
"=",
"[",
"]",
"weights",
"=",
"[",
"]",
"for",
"obj",
"in",
"self",
".",
"objectives",
":",
"if",
"obj",
".",
"type",
"==",
"'cost'",
":",
"components",
".",
"append",
"(",
"obj",
".",
"e... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/math/optimize.py#L1012-L1036 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/reinforcement-learning/dqn/utils.py | python | sample_categorical | (prob, rng) | return ret | Sample from independent categorical distributions
Each batch is an independent categorical distribution.
Parameters
----------
prob : numpy.ndarray
Probability of the categorical distribution. Shape --> (batch_num, category_num)
rng : numpy.random.RandomState
Returns
-------
ret... | Sample from independent categorical distributions | [
"Sample",
"from",
"independent",
"categorical",
"distributions"
] | def sample_categorical(prob, rng):
"""Sample from independent categorical distributions
Each batch is an independent categorical distribution.
Parameters
----------
prob : numpy.ndarray
Probability of the categorical distribution. Shape --> (batch_num, category_num)
rng : numpy.random.Ra... | [
"def",
"sample_categorical",
"(",
"prob",
",",
"rng",
")",
":",
"ret",
"=",
"numpy",
".",
"empty",
"(",
"prob",
".",
"shape",
"[",
"0",
"]",
",",
"dtype",
"=",
"numpy",
".",
"float32",
")",
"for",
"ind",
"in",
"range",
"(",
"prob",
".",
"shape",
... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/reinforcement-learning/dqn/utils.py#L133-L154 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | MimeTypesManager.AddFallback | (*args, **kwargs) | return _misc_.MimeTypesManager_AddFallback(*args, **kwargs) | AddFallback(self, FileTypeInfo ft) | AddFallback(self, FileTypeInfo ft) | [
"AddFallback",
"(",
"self",
"FileTypeInfo",
"ft",
")"
] | def AddFallback(*args, **kwargs):
"""AddFallback(self, FileTypeInfo ft)"""
return _misc_.MimeTypesManager_AddFallback(*args, **kwargs) | [
"def",
"AddFallback",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"MimeTypesManager_AddFallback",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L2681-L2683 | |
google/shaka-packager | e1b0c7c45431327fd3ce193514a5407d07b39b22 | packager/third_party/protobuf/python/google/protobuf/internal/well_known_types.py | python | Any.Is | (self, descriptor) | return self.TypeName() == descriptor.full_name | Checks if this Any represents the given protobuf type. | Checks if this Any represents the given protobuf type. | [
"Checks",
"if",
"this",
"Any",
"represents",
"the",
"given",
"protobuf",
"type",
"."
] | def Is(self, descriptor):
"""Checks if this Any represents the given protobuf type."""
return self.TypeName() == descriptor.full_name | [
"def",
"Is",
"(",
"self",
",",
"descriptor",
")",
":",
"return",
"self",
".",
"TypeName",
"(",
")",
"==",
"descriptor",
".",
"full_name"
] | https://github.com/google/shaka-packager/blob/e1b0c7c45431327fd3ce193514a5407d07b39b22/packager/third_party/protobuf/python/google/protobuf/internal/well_known_types.py#L91-L93 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | ext/ply/example/ansic/cparse.py | python | p_type_qualifier | (t) | type_qualifier : CONST
| VOLATILE | type_qualifier : CONST
| VOLATILE | [
"type_qualifier",
":",
"CONST",
"|",
"VOLATILE"
] | def p_type_qualifier(t):
'''type_qualifier : CONST
| VOLATILE'''
pass | [
"def",
"p_type_qualifier",
"(",
"t",
")",
":",
"pass"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/ext/ply/example/ansic/cparse.py#L125-L128 | ||
citizenfx/fivem | 88276d40cc7baf8285d02754cc5ae42ec7a8563f | vendor/chromium/mojo/public/tools/bindings/generators/mojom_cpp_generator.py | python | Generator._IsHashableKind | (self, kind) | return Check(kind) | Check if the kind can be hashed.
Args:
kind: {Kind} The kind to check.
Returns:
{bool} True if a value of this kind can be hashed. | Check if the kind can be hashed. | [
"Check",
"if",
"the",
"kind",
"can",
"be",
"hashed",
"."
] | def _IsHashableKind(self, kind):
"""Check if the kind can be hashed.
Args:
kind: {Kind} The kind to check.
Returns:
{bool} True if a value of this kind can be hashed.
"""
checked = set()
def Check(kind):
if kind.spec in checked:
return True
checked.add(kind.spec... | [
"def",
"_IsHashableKind",
"(",
"self",
",",
"kind",
")",
":",
"checked",
"=",
"set",
"(",
")",
"def",
"Check",
"(",
"kind",
")",
":",
"if",
"kind",
".",
"spec",
"in",
"checked",
":",
"return",
"True",
"checked",
".",
"add",
"(",
"kind",
".",
"spec"... | https://github.com/citizenfx/fivem/blob/88276d40cc7baf8285d02754cc5ae42ec7a8563f/vendor/chromium/mojo/public/tools/bindings/generators/mojom_cpp_generator.py#L528-L568 | |
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/Chem/MolStandardize/normalize.py | python | Normalizer.normalize | (self, mol) | return outmol | Apply a series of Normalization transforms to correct functional groups and recombine charges.
A series of transforms are applied to the molecule. For each Normalization, the transform is applied repeatedly
until no further changes occur. If any changes occurred, we go back and start from the first Nor... | Apply a series of Normalization transforms to correct functional groups and recombine charges. | [
"Apply",
"a",
"series",
"of",
"Normalization",
"transforms",
"to",
"correct",
"functional",
"groups",
"and",
"recombine",
"charges",
"."
] | def normalize(self, mol):
"""Apply a series of Normalization transforms to correct functional groups and recombine charges.
A series of transforms are applied to the molecule. For each Normalization, the transform is applied repeatedly
until no further changes occur. If any changes occurred, we... | [
"def",
"normalize",
"(",
"self",
",",
"mol",
")",
":",
"log",
".",
"debug",
"(",
"'Running Normalizer'",
")",
"# Normalize each fragment separately to get around quirky RunReactants behaviour",
"fragments",
"=",
"[",
"]",
"for",
"fragment",
"in",
"Chem",
".",
"GetMolF... | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/Chem/MolStandardize/normalize.py#L127-L151 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/polynomial/hermite_e.py | python | hermemul | (c1, c2) | return hermeadd(c0, hermemulx(c1)) | Multiply one Hermite series by another.
Returns the product of two Hermite series `c1` * `c2`. The arguments
are sequences of coefficients, from lowest order "term" to highest,
e.g., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``.
Parameters
----------
c1, c2 : array_like
1-D a... | Multiply one Hermite series by another. | [
"Multiply",
"one",
"Hermite",
"series",
"by",
"another",
"."
] | def hermemul(c1, c2):
"""
Multiply one Hermite series by another.
Returns the product of two Hermite series `c1` * `c2`. The arguments
are sequences of coefficients, from lowest order "term" to highest,
e.g., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``.
Parameters
----------
... | [
"def",
"hermemul",
"(",
"c1",
",",
"c2",
")",
":",
"# s1, s2 are trimmed copies",
"[",
"c1",
",",
"c2",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"c1",
",",
"c2",
"]",
")",
"if",
"len",
"(",
"c1",
")",
">",
"len",
"(",
"c2",
")",
":",
"c",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/polynomial/hermite_e.py#L449-L512 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/filebrowsebutton.py | python | FileBrowseButtonWithHistory.SetHistory | ( self, value=(), selectionIndex = None, control=None ) | Set the current history list | Set the current history list | [
"Set",
"the",
"current",
"history",
"list"
] | def SetHistory( self, value=(), selectionIndex = None, control=None ):
"""Set the current history list"""
if control is None:
control = self.GetHistoryControl()
if self.history == value:
return
self.history = value
# Clear history values not the selected o... | [
"def",
"SetHistory",
"(",
"self",
",",
"value",
"=",
"(",
")",
",",
"selectionIndex",
"=",
"None",
",",
"control",
"=",
"None",
")",
":",
"if",
"control",
"is",
"None",
":",
"control",
"=",
"self",
".",
"GetHistoryControl",
"(",
")",
"if",
"self",
".... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/filebrowsebutton.py#L272-L288 | ||
google/asylo | a3b09ebff6c0e3b10e25d40f14991e16bb75d883 | buildkite/collect_artifacts.py | python | parse_arguments | () | return parser.parse_args() | Parses command line arguments.
Returns:
Parsed arguments as an object. | Parses command line arguments. | [
"Parses",
"command",
"line",
"arguments",
"."
] | def parse_arguments():
"""Parses command line arguments.
Returns:
Parsed arguments as an object.
"""
parser = argparse.ArgumentParser()
required = parser.add_argument_group("required arguments")
required.add_argument("--build-events", "-b", action="store", type=str,
help="Path t... | [
"def",
"parse_arguments",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"required",
"=",
"parser",
".",
"add_argument_group",
"(",
"\"required arguments\"",
")",
"required",
".",
"add_argument",
"(",
"\"--build-events\"",
",",
"\"-b\""... | https://github.com/google/asylo/blob/a3b09ebff6c0e3b10e25d40f14991e16bb75d883/buildkite/collect_artifacts.py#L169-L183 | |
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | emscripten.py | python | create_invoke_wrappers | (invoke_funcs) | return invoke_wrappers | Asm.js-style exception handling: invoke wrapper generation. | Asm.js-style exception handling: invoke wrapper generation. | [
"Asm",
".",
"js",
"-",
"style",
"exception",
"handling",
":",
"invoke",
"wrapper",
"generation",
"."
] | def create_invoke_wrappers(invoke_funcs):
"""Asm.js-style exception handling: invoke wrapper generation."""
invoke_wrappers = ''
for invoke in invoke_funcs:
sig = strip_prefix(invoke, 'invoke_')
invoke_wrappers += '\n' + js_manipulation.make_invoke(sig) + '\n'
return invoke_wrappers | [
"def",
"create_invoke_wrappers",
"(",
"invoke_funcs",
")",
":",
"invoke_wrappers",
"=",
"''",
"for",
"invoke",
"in",
"invoke_funcs",
":",
"sig",
"=",
"strip_prefix",
"(",
"invoke",
",",
"'invoke_'",
")",
"invoke_wrappers",
"+=",
"'\\n'",
"+",
"js_manipulation",
... | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/emscripten.py#L884-L890 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/pydocview.py | python | DocApp.SetUseTabbedMDI | (self, useTabbedMDI) | Set to True if Windows MDI should use folder tabs instead of child windows. | Set to True if Windows MDI should use folder tabs instead of child windows. | [
"Set",
"to",
"True",
"if",
"Windows",
"MDI",
"should",
"use",
"folder",
"tabs",
"instead",
"of",
"child",
"windows",
"."
] | def SetUseTabbedMDI(self, useTabbedMDI):
"""
Set to True if Windows MDI should use folder tabs instead of child windows.
"""
self._useTabbedMDI = useTabbedMDI | [
"def",
"SetUseTabbedMDI",
"(",
"self",
",",
"useTabbedMDI",
")",
":",
"self",
".",
"_useTabbedMDI",
"=",
"useTabbedMDI"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/pydocview.py#L1935-L1939 | ||
apiaryio/drafter | 4634ebd07f6c6f257cc656598ccd535492fdfb55 | tools/gyp/pylib/gyp/generator/msvs.py | python | _GenerateMSVSProject | (project, options, version, generator_flags) | return missing_sources | Generates a .vcproj file. It may create .rules and .user files too.
Arguments:
project: The project object we will generate the file for.
options: Global options passed to the generator.
version: The VisualStudioVersion object.
generator_flags: dict of generator-specific flags. | Generates a .vcproj file. It may create .rules and .user files too. | [
"Generates",
"a",
".",
"vcproj",
"file",
".",
"It",
"may",
"create",
".",
"rules",
"and",
".",
"user",
"files",
"too",
"."
] | def _GenerateMSVSProject(project, options, version, generator_flags):
"""Generates a .vcproj file. It may create .rules and .user files too.
Arguments:
project: The project object we will generate the file for.
options: Global options passed to the generator.
version: The VisualStudioVersion object.
... | [
"def",
"_GenerateMSVSProject",
"(",
"project",
",",
"options",
",",
"version",
",",
"generator_flags",
")",
":",
"spec",
"=",
"project",
".",
"spec",
"gyp",
".",
"common",
".",
"EnsureDirExists",
"(",
"project",
".",
"path",
")",
"platforms",
"=",
"_GetUniqu... | https://github.com/apiaryio/drafter/blob/4634ebd07f6c6f257cc656598ccd535492fdfb55/tools/gyp/pylib/gyp/generator/msvs.py#L967-L1034 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/converters/mil/mil/block.py | python | Block.remove_ops | (self, existing_ops) | Remove `existing_ops` (list[Operation]) that must be pre-existing in
the block. Error if any other op in the block uses output Vars of
`existing_ops` | Remove `existing_ops` (list[Operation]) that must be pre-existing in
the block. Error if any other op in the block uses output Vars of
`existing_ops` | [
"Remove",
"existing_ops",
"(",
"list",
"[",
"Operation",
"]",
")",
"that",
"must",
"be",
"pre",
"-",
"existing",
"in",
"the",
"block",
".",
"Error",
"if",
"any",
"other",
"op",
"in",
"the",
"block",
"uses",
"output",
"Vars",
"of",
"existing_ops"
] | def remove_ops(self, existing_ops):
"""
Remove `existing_ops` (list[Operation]) that must be pre-existing in
the block. Error if any other op in the block uses output Vars of
`existing_ops`
"""
self.validate()
idxs = [-1] * len(existing_ops)
existing_ops_s... | [
"def",
"remove_ops",
"(",
"self",
",",
"existing_ops",
")",
":",
"self",
".",
"validate",
"(",
")",
"idxs",
"=",
"[",
"-",
"1",
"]",
"*",
"len",
"(",
"existing_ops",
")",
"existing_ops_set",
"=",
"set",
"(",
"existing_ops",
")",
"for",
"i",
",",
"op"... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/mil/block.py#L653-L709 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/model/sensing.py | python | camera_to_images | (camera,image_format='numpy',color_format='channels') | return None | Given a SimRobotSensor that is a CameraSensor, returns either the RGB image, the depth image, or both.
Args:
camera (SimRobotSensor): a sensor that is of 'CameraSensor' type
image_format (str): governs the return type. Can be:
* 'numpy' (default): returns numpy arrays. Depending on t... | Given a SimRobotSensor that is a CameraSensor, returns either the RGB image, the depth image, or both. | [
"Given",
"a",
"SimRobotSensor",
"that",
"is",
"a",
"CameraSensor",
"returns",
"either",
"the",
"RGB",
"image",
"the",
"depth",
"image",
"or",
"both",
"."
] | def camera_to_images(camera,image_format='numpy',color_format='channels'):
"""Given a SimRobotSensor that is a CameraSensor, returns either the RGB image, the depth image, or both.
Args:
camera (SimRobotSensor): a sensor that is of 'CameraSensor' type
image_format (str): governs the return type... | [
"def",
"camera_to_images",
"(",
"camera",
",",
"image_format",
"=",
"'numpy'",
",",
"color_format",
"=",
"'channels'",
")",
":",
"assert",
"isinstance",
"(",
"camera",
",",
"SimRobotSensor",
")",
",",
"\"Must provide a SimRobotSensor instance\"",
"assert",
"camera",
... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/model/sensing.py#L100-L191 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py | python | Menu.invoke | (self, index) | return self.tk.call(self._w, 'invoke', index) | Invoke a menu item identified by INDEX and execute
the associated command. | Invoke a menu item identified by INDEX and execute
the associated command. | [
"Invoke",
"a",
"menu",
"item",
"identified",
"by",
"INDEX",
"and",
"execute",
"the",
"associated",
"command",
"."
] | def invoke(self, index):
"""Invoke a menu item identified by INDEX and execute
the associated command."""
return self.tk.call(self._w, 'invoke', index) | [
"def",
"invoke",
"(",
"self",
",",
"index",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'invoke'",
",",
"index",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py#L2736-L2739 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/fractions.py | python | Fraction.__floordiv__ | (a, b) | a // b | a // b | [
"a",
"//",
"b"
] | def __floordiv__(a, b):
"""a // b"""
# Will be math.floor(a / b) in 3.0.
div = a / b
if isinstance(div, Rational):
# trunc(math.floor(div)) doesn't work if the rational is
# more precise than a float because the intermediate
# rounding may cross an int... | [
"def",
"__floordiv__",
"(",
"a",
",",
"b",
")",
":",
"# Will be math.floor(a / b) in 3.0.",
"div",
"=",
"a",
"/",
"b",
"if",
"isinstance",
"(",
"div",
",",
"Rational",
")",
":",
"# trunc(math.floor(div)) doesn't work if the rational is",
"# more precise than a float bec... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/fractions.py#L355-L365 | ||
lballabio/quantlib-old | 136336947ed4fea9ecc1da6edad188700e821739 | gensrc/gensrc/serialization/factory.py | python | Factory.makeObject | (self, className) | Construct an object given its class name. | Construct an object given its class name. | [
"Construct",
"an",
"object",
"given",
"its",
"class",
"name",
"."
] | def makeObject(self, className):
"""Construct an object given its class name."""
if self.creators_.has_key(className):
return self.creators_[className]()
else:
raise exceptions.SerializationCreatorException(className) | [
"def",
"makeObject",
"(",
"self",
",",
"className",
")",
":",
"if",
"self",
".",
"creators_",
".",
"has_key",
"(",
"className",
")",
":",
"return",
"self",
".",
"creators_",
"[",
"className",
"]",
"(",
")",
"else",
":",
"raise",
"exceptions",
".",
"Ser... | https://github.com/lballabio/quantlib-old/blob/136336947ed4fea9ecc1da6edad188700e821739/gensrc/gensrc/serialization/factory.py#L54-L59 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rospy/src/rospy/topics.py | python | _TopicImpl.get_stats_info | (self) | return [(c.id, c.endpoint_id, c.direction, c.transport_type, self.resolved_name, True, c.get_transport_info()) for c in connections] | Get the stats for this topic
@return: stats for topic in getBusInfo() format::
Publisher:
((connection_id, destination_caller_id, direction, transport, topic_name, connected, connection_info_string)*)
Subscriber:
((connection_id, publisher_xmlrpc_uri, direction, transport... | Get the stats for this topic | [
"Get",
"the",
"stats",
"for",
"this",
"topic"
] | def get_stats_info(self): # STATS
"""
Get the stats for this topic
@return: stats for topic in getBusInfo() format::
Publisher:
((connection_id, destination_caller_id, direction, transport, topic_name, connected, connection_info_string)*)
Subscriber:
((con... | [
"def",
"get_stats_info",
"(",
"self",
")",
":",
"# STATS",
"# save referenceto avoid locking",
"connections",
"=",
"self",
".",
"connections",
"return",
"[",
"(",
"c",
".",
"id",
",",
"c",
".",
"endpoint_id",
",",
"c",
".",
"direction",
",",
"c",
".",
"tra... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rospy/src/rospy/topics.py#L485-L497 | |
stack-of-tasks/pinocchio | 593d4d43fded997bb9aa2421f4e55294dbd233c4 | doc/d-practical-exercises/src/prm_display.py | python | display_prm | (robot, graph) | Take a graph object containing a list of configurations q and
a dictionnary of graph relations edge. Display the configurations by the correspond
placement of the robot end effector. Display the graph relation by vertices connecting
the robot end effector positions. | Take a graph object containing a list of configurations q and
a dictionnary of graph relations edge. Display the configurations by the correspond
placement of the robot end effector. Display the graph relation by vertices connecting
the robot end effector positions. | [
"Take",
"a",
"graph",
"object",
"containing",
"a",
"list",
"of",
"configurations",
"q",
"and",
"a",
"dictionnary",
"of",
"graph",
"relations",
"edge",
".",
"Display",
"the",
"configurations",
"by",
"the",
"correspond",
"placement",
"of",
"the",
"robot",
"end",... | def display_prm(robot, graph):
'''Take a graph object containing a list of configurations q and
a dictionnary of graph relations edge. Display the configurations by the correspond
placement of the robot end effector. Display the graph relation by vertices connecting
the robot end effector positions.
... | [
"def",
"display_prm",
"(",
"robot",
",",
"graph",
")",
":",
"gui",
"=",
"robot",
".",
"viewer",
".",
"gui",
"try",
":",
"gui",
".",
"deleteNode",
"(",
"'world/prm'",
",",
"True",
")",
"except",
":",
"pass",
"gui",
".",
"createRoadmap",
"(",
"'world/prm... | https://github.com/stack-of-tasks/pinocchio/blob/593d4d43fded997bb9aa2421f4e55294dbd233c4/doc/d-practical-exercises/src/prm_display.py#L5-L31 | ||
dmlc/xgboost | 2775c2a1abd4b5b759ff517617434c8b9aeb4cc0 | python-package/xgboost/core.py | python | DMatrix.get_float_info | (self, field: str) | return ctypes2numpy(ret, length.value, np.float32) | Get float property from the DMatrix.
Parameters
----------
field: str
The field name of the information
Returns
-------
info : array
a numpy array of float information of the data | Get float property from the DMatrix. | [
"Get",
"float",
"property",
"from",
"the",
"DMatrix",
"."
] | def get_float_info(self, field: str) -> np.ndarray:
"""Get float property from the DMatrix.
Parameters
----------
field: str
The field name of the information
Returns
-------
info : array
a numpy array of float information of the data
... | [
"def",
"get_float_info",
"(",
"self",
",",
"field",
":",
"str",
")",
"->",
"np",
".",
"ndarray",
":",
"length",
"=",
"c_bst_ulong",
"(",
")",
"ret",
"=",
"ctypes",
".",
"POINTER",
"(",
"ctypes",
".",
"c_float",
")",
"(",
")",
"_check_call",
"(",
"_LI... | https://github.com/dmlc/xgboost/blob/2775c2a1abd4b5b759ff517617434c8b9aeb4cc0/python-package/xgboost/core.py#L708-L727 | |
wujixiu/helmet-detection | 8eff5c59ddfba5a29e0b76aeb48babcb49246178 | hardhat-wearing-detection/SSD-RPA/tools/extra/summarize.py | python | print_table | (table, max_width) | Print a simple nicely-aligned table.
table must be a list of (equal-length) lists. Columns are space-separated,
and as narrow as possible, but no wider than max_width. Text may overflow
columns; note that unlike string.format, this will not affect subsequent
columns, if possible. | Print a simple nicely-aligned table. | [
"Print",
"a",
"simple",
"nicely",
"-",
"aligned",
"table",
"."
] | def print_table(table, max_width):
"""Print a simple nicely-aligned table.
table must be a list of (equal-length) lists. Columns are space-separated,
and as narrow as possible, but no wider than max_width. Text may overflow
columns; note that unlike string.format, this will not affect subsequent
co... | [
"def",
"print_table",
"(",
"table",
",",
"max_width",
")",
":",
"max_widths",
"=",
"[",
"max_width",
"]",
"*",
"len",
"(",
"table",
"[",
"0",
"]",
")",
"column_widths",
"=",
"[",
"max",
"(",
"printed_len",
"(",
"row",
"[",
"j",
"]",
")",
"+",
"1",
... | https://github.com/wujixiu/helmet-detection/blob/8eff5c59ddfba5a29e0b76aeb48babcb49246178/hardhat-wearing-detection/SSD-RPA/tools/extra/summarize.py#L41-L61 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py | python | StreamHandler.flush | (self) | Flushes the stream. | Flushes the stream. | [
"Flushes",
"the",
"stream",
"."
] | def flush(self):
"""
Flushes the stream.
"""
self.acquire()
try:
if self.stream and hasattr(self.stream, "flush"):
self.stream.flush()
finally:
self.release() | [
"def",
"flush",
"(",
"self",
")",
":",
"self",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"self",
".",
"stream",
"and",
"hasattr",
"(",
"self",
".",
"stream",
",",
"\"flush\"",
")",
":",
"self",
".",
"stream",
".",
"flush",
"(",
")",
"finally",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py#L1002-L1011 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/__init__.py | python | find_distributions | (path_item, only=False) | return finder(importer, path_item, only) | Yield distributions accessible via `path_item` | Yield distributions accessible via `path_item` | [
"Yield",
"distributions",
"accessible",
"via",
"path_item"
] | def find_distributions(path_item, only=False):
"""Yield distributions accessible via `path_item`"""
importer = get_importer(path_item)
finder = _find_adapter(_distribution_finders, importer)
return finder(importer, path_item, only) | [
"def",
"find_distributions",
"(",
"path_item",
",",
"only",
"=",
"False",
")",
":",
"importer",
"=",
"get_importer",
"(",
"path_item",
")",
"finder",
"=",
"_find_adapter",
"(",
"_distribution_finders",
",",
"importer",
")",
"return",
"finder",
"(",
"importer",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/__init__.py#L1969-L1973 | |
lyxok1/Tiny-DSOD | 94d15450699bea0dd3720e75e2d273e476174fba | examples/web_demo/app.py | python | embed_image_html | (image) | return 'data:image/png;base64,' + data | Creates an image embedded in HTML base64 format. | Creates an image embedded in HTML base64 format. | [
"Creates",
"an",
"image",
"embedded",
"in",
"HTML",
"base64",
"format",
"."
] | def embed_image_html(image):
"""Creates an image embedded in HTML base64 format."""
image_pil = Image.fromarray((255 * image).astype('uint8'))
image_pil = image_pil.resize((256, 256))
string_buf = StringIO.StringIO()
image_pil.save(string_buf, format='png')
data = string_buf.getvalue().encode('b... | [
"def",
"embed_image_html",
"(",
"image",
")",
":",
"image_pil",
"=",
"Image",
".",
"fromarray",
"(",
"(",
"255",
"*",
"image",
")",
".",
"astype",
"(",
"'uint8'",
")",
")",
"image_pil",
"=",
"image_pil",
".",
"resize",
"(",
"(",
"256",
",",
"256",
")... | https://github.com/lyxok1/Tiny-DSOD/blob/94d15450699bea0dd3720e75e2d273e476174fba/examples/web_demo/app.py#L82-L89 | |
openthread/openthread | 9fcdbed9c526c70f1556d1ed84099c1535c7cd32 | tools/otci/otci/otci.py | python | OTCI.get_preferred_partition_id | (self) | return PartitionId(self.__parse_int(self.execute_command(self.__get_partition_preferred_cmd()))) | Get the preferred Thread Leader Partition ID. | Get the preferred Thread Leader Partition ID. | [
"Get",
"the",
"preferred",
"Thread",
"Leader",
"Partition",
"ID",
"."
] | def get_preferred_partition_id(self) -> PartitionId:
"""Get the preferred Thread Leader Partition ID."""
return PartitionId(self.__parse_int(self.execute_command(self.__get_partition_preferred_cmd()))) | [
"def",
"get_preferred_partition_id",
"(",
"self",
")",
"->",
"PartitionId",
":",
"return",
"PartitionId",
"(",
"self",
".",
"__parse_int",
"(",
"self",
".",
"execute_command",
"(",
"self",
".",
"__get_partition_preferred_cmd",
"(",
")",
")",
")",
")"
] | https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/tools/otci/otci/otci.py#L544-L546 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/spatial/distance.py | python | kulsinski | (u, v, w=None) | return (ntf + nft - ntt + n) / (ntf + nft + n) | Compute the Kulsinski dissimilarity between two boolean 1-D arrays.
The Kulsinski dissimilarity between two boolean 1-D arrays `u` and `v`,
is defined as
.. math::
\\frac{c_{TF} + c_{FT} - c_{TT} + n}
{c_{FT} + c_{TF} + n}
where :math:`c_{ij}` is the number of occurrences of
... | Compute the Kulsinski dissimilarity between two boolean 1-D arrays. | [
"Compute",
"the",
"Kulsinski",
"dissimilarity",
"between",
"two",
"boolean",
"1",
"-",
"D",
"arrays",
"."
] | def kulsinski(u, v, w=None):
"""
Compute the Kulsinski dissimilarity between two boolean 1-D arrays.
The Kulsinski dissimilarity between two boolean 1-D arrays `u` and `v`,
is defined as
.. math::
\\frac{c_{TF} + c_{FT} - c_{TT} + n}
{c_{FT} + c_{TF} + n}
where :math:`... | [
"def",
"kulsinski",
"(",
"u",
",",
"v",
",",
"w",
"=",
"None",
")",
":",
"u",
"=",
"_validate_vector",
"(",
"u",
")",
"v",
"=",
"_validate_vector",
"(",
"v",
")",
"if",
"w",
"is",
"None",
":",
"n",
"=",
"float",
"(",
"len",
"(",
"u",
")",
")"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/spatial/distance.py#L879-L932 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/general_fitting/general_fitting_view.py | python | GeneralFittingView.__init__ | (self, parent: QWidget = None) | Initializes the GeneralFittingView, and adds the GeneralFittingOptionsView widget. | Initializes the GeneralFittingView, and adds the GeneralFittingOptionsView widget. | [
"Initializes",
"the",
"GeneralFittingView",
"and",
"adds",
"the",
"GeneralFittingOptionsView",
"widget",
"."
] | def __init__(self, parent: QWidget = None):
"""Initializes the GeneralFittingView, and adds the GeneralFittingOptionsView widget."""
super(GeneralFittingView, self).__init__(parent)
self.general_fitting_options = GeneralFittingOptionsView(self)
self.general_fitting_options_layout.addWid... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
":",
"QWidget",
"=",
"None",
")",
":",
"super",
"(",
"GeneralFittingView",
",",
"self",
")",
".",
"__init__",
"(",
"parent",
")",
"self",
".",
"general_fitting_options",
"=",
"GeneralFittingOptionsView",
"(",
"s... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/general_fitting/general_fitting_view.py#L23-L28 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | build/config/mac/package_framework.py | python | _Relink | (dest, link) | Creates a symlink to |dest| named |link|. If |link| already exists,
it is overwritten. | Creates a symlink to |dest| named |link|. If |link| already exists,
it is overwritten. | [
"Creates",
"a",
"symlink",
"to",
"|dest|",
"named",
"|link|",
".",
"If",
"|link|",
"already",
"exists",
"it",
"is",
"overwritten",
"."
] | def _Relink(dest, link):
"""Creates a symlink to |dest| named |link|. If |link| already exists,
it is overwritten."""
if os.path.lexists(link):
os.remove(link)
os.symlink(dest, link) | [
"def",
"_Relink",
"(",
"dest",
",",
"link",
")",
":",
"if",
"os",
".",
"path",
".",
"lexists",
"(",
"link",
")",
":",
"os",
".",
"remove",
"(",
"link",
")",
"os",
".",
"symlink",
"(",
"dest",
",",
"link",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/build/config/mac/package_framework.py#L56-L61 | ||
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/qcdb/libmintsmolecule.py | python | LibmintsMolecule.full_pg_n | (self) | return self.PYfull_pg_n | Return n in Cnv, etc.; If there is no n (e.g. Td)
it's the highest-order rotation axis. | Return n in Cnv, etc.; If there is no n (e.g. Td)
it's the highest-order rotation axis. | [
"Return",
"n",
"in",
"Cnv",
"etc",
".",
";",
"If",
"there",
"is",
"no",
"n",
"(",
"e",
".",
"g",
".",
"Td",
")",
"it",
"s",
"the",
"highest",
"-",
"order",
"rotation",
"axis",
"."
] | def full_pg_n(self):
"""Return n in Cnv, etc.; If there is no n (e.g. Td)
it's the highest-order rotation axis.
"""
return self.PYfull_pg_n | [
"def",
"full_pg_n",
"(",
"self",
")",
":",
"return",
"self",
".",
"PYfull_pg_n"
] | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/qcdb/libmintsmolecule.py#L3070-L3075 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/matrixlib/defmatrix.py | python | matrix.getI | (self) | return asmatrix(func(self)) | Returns the (multiplicative) inverse of invertible `self`.
Parameters
----------
None
Returns
-------
ret : matrix object
If `self` is non-singular, `ret` is such that ``ret * self`` ==
``self * ret`` == ``np.matrix(np.eye(self[0,:].size)`` all r... | Returns the (multiplicative) inverse of invertible `self`. | [
"Returns",
"the",
"(",
"multiplicative",
")",
"inverse",
"of",
"invertible",
"self",
"."
] | def getI(self):
"""
Returns the (multiplicative) inverse of invertible `self`.
Parameters
----------
None
Returns
-------
ret : matrix object
If `self` is non-singular, `ret` is such that ``ret * self`` ==
``self * ret`` == ``np.m... | [
"def",
"getI",
"(",
"self",
")",
":",
"M",
",",
"N",
"=",
"self",
".",
"shape",
"if",
"M",
"==",
"N",
":",
"from",
"numpy",
".",
"dual",
"import",
"inv",
"as",
"func",
"else",
":",
"from",
"numpy",
".",
"dual",
"import",
"pinv",
"as",
"func",
"... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/matrixlib/defmatrix.py#L808-L850 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TIntIntVH.FNextKeyId | (self, *args) | return _snap.TIntIntVH_FNextKeyId(self, *args) | FNextKeyId(TIntIntVH self, int & KeyId) -> bool
Parameters:
KeyId: int & | FNextKeyId(TIntIntVH self, int & KeyId) -> bool | [
"FNextKeyId",
"(",
"TIntIntVH",
"self",
"int",
"&",
"KeyId",
")",
"-",
">",
"bool"
] | def FNextKeyId(self, *args):
"""
FNextKeyId(TIntIntVH self, int & KeyId) -> bool
Parameters:
KeyId: int &
"""
return _snap.TIntIntVH_FNextKeyId(self, *args) | [
"def",
"FNextKeyId",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TIntIntVH_FNextKeyId",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L18028-L18036 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/functions.py | python | ones | (shape, typecode='l', savespace=0, dtype=None) | return a | ones(shape, dtype=int) returns an array of the given
dimensions which is initialized to all ones. | ones(shape, dtype=int) returns an array of the given
dimensions which is initialized to all ones. | [
"ones",
"(",
"shape",
"dtype",
"=",
"int",
")",
"returns",
"an",
"array",
"of",
"the",
"given",
"dimensions",
"which",
"is",
"initialized",
"to",
"all",
"ones",
"."
] | def ones(shape, typecode='l', savespace=0, dtype=None):
"""ones(shape, dtype=int) returns an array of the given
dimensions which is initialized to all ones.
"""
dtype = convtypecode(typecode, dtype)
a = mu.empty(shape, dtype)
a.fill(1)
return a | [
"def",
"ones",
"(",
"shape",
",",
"typecode",
"=",
"'l'",
",",
"savespace",
"=",
"0",
",",
"dtype",
"=",
"None",
")",
":",
"dtype",
"=",
"convtypecode",
"(",
"typecode",
",",
"dtype",
")",
"a",
"=",
"mu",
".",
"empty",
"(",
"shape",
",",
"dtype",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/functions.py#L54-L61 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/sts/connection.py | python | STSConnection.assume_role_with_web_identity | (self, role_arn, role_session_name,
web_identity_token, provider_id=None,
policy=None, duration_seconds=None) | return self.get_object(
'AssumeRoleWithWebIdentity',
params,
AssumedRole,
verb='POST'
) | Returns a set of temporary security credentials for users who
have been authenticated in a mobile or web application with a
web identity provider, such as Login with Amazon, Facebook, or
Google. `AssumeRoleWithWebIdentity` is an API call that does
not require the use of AWS security cred... | Returns a set of temporary security credentials for users who
have been authenticated in a mobile or web application with a
web identity provider, such as Login with Amazon, Facebook, or
Google. `AssumeRoleWithWebIdentity` is an API call that does
not require the use of AWS security cred... | [
"Returns",
"a",
"set",
"of",
"temporary",
"security",
"credentials",
"for",
"users",
"who",
"have",
"been",
"authenticated",
"in",
"a",
"mobile",
"or",
"web",
"application",
"with",
"a",
"web",
"identity",
"provider",
"such",
"as",
"Login",
"with",
"Amazon",
... | def assume_role_with_web_identity(self, role_arn, role_session_name,
web_identity_token, provider_id=None,
policy=None, duration_seconds=None):
"""
Returns a set of temporary security credentials for users who
have been ... | [
"def",
"assume_role_with_web_identity",
"(",
"self",
",",
"role_arn",
",",
"role_session_name",
",",
"web_identity_token",
",",
"provider_id",
"=",
"None",
",",
"policy",
"=",
"None",
",",
"duration_seconds",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'RoleArn'... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/sts/connection.py#L495-L599 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/_import_tools.py | python | PackageLoader._get_doc_title | (self, info_module) | return '* Not Available *' | Get the title from a package info.py file. | Get the title from a package info.py file. | [
"Get",
"the",
"title",
"from",
"a",
"package",
"info",
".",
"py",
"file",
"."
] | def _get_doc_title(self, info_module):
""" Get the title from a package info.py file.
"""
title = getattr(info_module,'__doc_title__',None)
if title is not None:
return title
title = getattr(info_module,'__doc__',None)
if title is not None:
title =... | [
"def",
"_get_doc_title",
"(",
"self",
",",
"info_module",
")",
":",
"title",
"=",
"getattr",
"(",
"info_module",
",",
"'__doc_title__'",
",",
"None",
")",
"if",
"title",
"is",
"not",
"None",
":",
"return",
"title",
"title",
"=",
"getattr",
"(",
"info_modul... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/_import_tools.py#L271-L281 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/lmbrwaflib/lumberyard.py | python | CreateRootRelativePath | (self, path) | return result_path.abspath() | Generate a path relative from the root | Generate a path relative from the root | [
"Generate",
"a",
"path",
"relative",
"from",
"the",
"root"
] | def CreateRootRelativePath(self, path):
"""
Generate a path relative from the root
"""
result_path = self.engine_node.make_node(path)
return result_path.abspath() | [
"def",
"CreateRootRelativePath",
"(",
"self",
",",
"path",
")",
":",
"result_path",
"=",
"self",
".",
"engine_node",
".",
"make_node",
"(",
"path",
")",
"return",
"result_path",
".",
"abspath",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/lmbrwaflib/lumberyard.py#L698-L703 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TIntV.Swap | (self, *args) | return _snap.TIntV_Swap(self, *args) | Swap(TIntV self, TIntV Vec)
Parameters:
Vec: TVec< TInt,int > &
Swap(TIntV self, int const & ValN1, int const & ValN2)
Parameters:
ValN1: int const &
ValN2: int const & | Swap(TIntV self, TIntV Vec) | [
"Swap",
"(",
"TIntV",
"self",
"TIntV",
"Vec",
")"
] | def Swap(self, *args):
"""
Swap(TIntV self, TIntV Vec)
Parameters:
Vec: TVec< TInt,int > &
Swap(TIntV self, int const & ValN1, int const & ValN2)
Parameters:
ValN1: int const &
ValN2: int const &
"""
return _snap.TIntV_Swap(... | [
"def",
"Swap",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TIntV_Swap",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L15841-L15855 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/signal/spectral.py | python | csd | (x, y, fs=1.0, window='hann', nperseg=None, noverlap=None, nfft=None,
detrend='constant', return_onesided=True, scaling='density',
axis=-1, average='mean') | return freqs, Pxy | r"""
Estimate the cross power spectral density, Pxy, using Welch's
method.
Parameters
----------
x : array_like
Time series of measurement values
y : array_like
Time series of measurement values
fs : float, optional
Sampling frequency of the `x` and `y` time series. ... | r"""
Estimate the cross power spectral density, Pxy, using Welch's
method. | [
"r",
"Estimate",
"the",
"cross",
"power",
"spectral",
"density",
"Pxy",
"using",
"Welch",
"s",
"method",
"."
] | def csd(x, y, fs=1.0, window='hann', nperseg=None, noverlap=None, nfft=None,
detrend='constant', return_onesided=True, scaling='density',
axis=-1, average='mean'):
r"""
Estimate the cross power spectral density, Pxy, using Welch's
method.
Parameters
----------
x : array_like
... | [
"def",
"csd",
"(",
"x",
",",
"y",
",",
"fs",
"=",
"1.0",
",",
"window",
"=",
"'hann'",
",",
"nperseg",
"=",
"None",
",",
"noverlap",
"=",
"None",
",",
"nfft",
"=",
"None",
",",
"detrend",
"=",
"'constant'",
",",
"return_onesided",
"=",
"True",
",",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/signal/spectral.py#L460-L601 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | python | _SignedVarintSize | (value) | return 10 | Compute the size of a signed varint value. | Compute the size of a signed varint value. | [
"Compute",
"the",
"size",
"of",
"a",
"signed",
"varint",
"value",
"."
] | def _SignedVarintSize(value):
"""Compute the size of a signed varint value."""
if value < 0: return 10
if value <= 0x7f: return 1
if value <= 0x3fff: return 2
if value <= 0x1fffff: return 3
if value <= 0xfffffff: return 4
if value <= 0x7ffffffff: return 5
if value <= 0x3ffffffffff: return 6
if value <... | [
"def",
"_SignedVarintSize",
"(",
"value",
")",
":",
"if",
"value",
"<",
"0",
":",
"return",
"10",
"if",
"value",
"<=",
"0x7f",
":",
"return",
"1",
"if",
"value",
"<=",
"0x3fff",
":",
"return",
"2",
"if",
"value",
"<=",
"0x1fffff",
":",
"return",
"3",... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L96-L108 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/input.py | python | GetIncludedBuildFiles | (build_file_path, aux_data, included=None) | return included | Return a list of all build files included into build_file_path.
The returned list will contain build_file_path as well as all other files
that it included, either directly or indirectly. Note that the list may
contain files that were included into a conditional section that evaluated
to false and was not merg... | Return a list of all build files included into build_file_path. | [
"Return",
"a",
"list",
"of",
"all",
"build",
"files",
"included",
"into",
"build_file_path",
"."
] | def GetIncludedBuildFiles(build_file_path, aux_data, included=None):
"""Return a list of all build files included into build_file_path.
The returned list will contain build_file_path as well as all other files
that it included, either directly or indirectly. Note that the list may
contain files that were incl... | [
"def",
"GetIncludedBuildFiles",
"(",
"build_file_path",
",",
"aux_data",
",",
"included",
"=",
"None",
")",
":",
"if",
"included",
"==",
"None",
":",
"included",
"=",
"[",
"]",
"if",
"build_file_path",
"in",
"included",
":",
"return",
"included",
"included",
... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/input.py#L141-L171 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/strings/accessor.py | python | StringMethods.endswith | (self, pat, na=None) | return self._wrap_result(result, returns_string=False) | Test if the end of each string element matches a pattern.
Equivalent to :meth:`str.endswith`.
Parameters
----------
pat : str
Character sequence. Regular expressions are not accepted.
na : object, default NaN
Object shown if element tested is not a strin... | Test if the end of each string element matches a pattern. | [
"Test",
"if",
"the",
"end",
"of",
"each",
"string",
"element",
"matches",
"a",
"pattern",
"."
] | def endswith(self, pat, na=None):
"""
Test if the end of each string element matches a pattern.
Equivalent to :meth:`str.endswith`.
Parameters
----------
pat : str
Character sequence. Regular expressions are not accepted.
na : object, default NaN
... | [
"def",
"endswith",
"(",
"self",
",",
"pat",
",",
"na",
"=",
"None",
")",
":",
"result",
"=",
"self",
".",
"_data",
".",
"array",
".",
"_str_endswith",
"(",
"pat",
",",
"na",
"=",
"na",
")",
"return",
"self",
".",
"_wrap_result",
"(",
"result",
",",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/strings/accessor.py#L2165-L2219 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/lib/histograms.py | python | _unsigned_subtract | (a, b) | Subtract two values where a >= b, and produce an unsigned result
This is needed when finding the difference between the upper and lower
bound of an int16 histogram | Subtract two values where a >= b, and produce an unsigned result | [
"Subtract",
"two",
"values",
"where",
"a",
">",
"=",
"b",
"and",
"produce",
"an",
"unsigned",
"result"
] | def _unsigned_subtract(a, b):
"""
Subtract two values where a >= b, and produce an unsigned result
This is needed when finding the difference between the upper and lower
bound of an int16 histogram
"""
# coerce to a single type
signed_to_unsigned = {
np.byte: np.ubyte,
np.sh... | [
"def",
"_unsigned_subtract",
"(",
"a",
",",
"b",
")",
":",
"# coerce to a single type",
"signed_to_unsigned",
"=",
"{",
"np",
".",
"byte",
":",
"np",
".",
"ubyte",
",",
"np",
".",
"short",
":",
"np",
".",
"ushort",
",",
"np",
".",
"intc",
":",
"np",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/lib/histograms.py#L335-L358 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_session.py | python | EdSessionBar.OnUpdateUI | (self, evt) | Handle UpdateUI events | Handle UpdateUI events | [
"Handle",
"UpdateUI",
"events"
] | def OnUpdateUI(self, evt):
"""Handle UpdateUI events"""
if evt.EventObject is self._delb:
evt.Enable(self._sch.Selection > 0)
else:
evt.Skip() | [
"def",
"OnUpdateUI",
"(",
"self",
",",
"evt",
")",
":",
"if",
"evt",
".",
"EventObject",
"is",
"self",
".",
"_delb",
":",
"evt",
".",
"Enable",
"(",
"self",
".",
"_sch",
".",
"Selection",
">",
"0",
")",
"else",
":",
"evt",
".",
"Skip",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_session.py#L266-L271 | ||
facebook/bistro | db9eff7e92f5cedcc917a440d5c88064c7980e40 | build/fbcode_builder/getdeps/buildopts.py | python | BuildOptions.get_context_generator | (self, host_tuple=None) | return ContextGenerator(
{
"os": host_type.ostype,
"distro": host_type.distro,
"distro_vers": host_type.distrovers,
"fb": "on" if self.facebook_internal else "off",
"fbsource": "on" if self.fbsource_dir else "off",
... | Create a manifest ContextGenerator for the specified target platform. | Create a manifest ContextGenerator for the specified target platform. | [
"Create",
"a",
"manifest",
"ContextGenerator",
"for",
"the",
"specified",
"target",
"platform",
"."
] | def get_context_generator(self, host_tuple=None):
"""Create a manifest ContextGenerator for the specified target platform."""
if host_tuple is None:
host_type = self.host_type
elif isinstance(host_tuple, HostType):
host_type = host_tuple
else:
host_typ... | [
"def",
"get_context_generator",
"(",
"self",
",",
"host_tuple",
"=",
"None",
")",
":",
"if",
"host_tuple",
"is",
"None",
":",
"host_type",
"=",
"self",
".",
"host_type",
"elif",
"isinstance",
"(",
"host_tuple",
",",
"HostType",
")",
":",
"host_type",
"=",
... | https://github.com/facebook/bistro/blob/db9eff7e92f5cedcc917a440d5c88064c7980e40/build/fbcode_builder/getdeps/buildopts.py#L175-L194 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_windows.py | python | PrintPreview.GetPrintout | (*args, **kwargs) | return _windows_.PrintPreview_GetPrintout(*args, **kwargs) | GetPrintout(self) -> Printout | GetPrintout(self) -> Printout | [
"GetPrintout",
"(",
"self",
")",
"-",
">",
"Printout"
] | def GetPrintout(*args, **kwargs):
"""GetPrintout(self) -> Printout"""
return _windows_.PrintPreview_GetPrintout(*args, **kwargs) | [
"def",
"GetPrintout",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PrintPreview_GetPrintout",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_windows.py#L5577-L5579 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/hmac.py | python | HMAC.update | (self, msg) | Update this hashing object with the string msg. | Update this hashing object with the string msg. | [
"Update",
"this",
"hashing",
"object",
"with",
"the",
"string",
"msg",
"."
] | def update(self, msg):
"""Update this hashing object with the string msg.
"""
self.inner.update(msg) | [
"def",
"update",
"(",
"self",
",",
"msg",
")",
":",
"self",
".",
"inner",
".",
"update",
"(",
"msg",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/hmac.py#L80-L83 | ||
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | external/tools/build/v2/build/targets.py | python | MainTarget.__select_alternatives | (self, property_set, debug) | return best | Returns the best viable alternative for this property_set
See the documentation for selection rules.
# TODO: shouldn't this be 'alternative' (singular)? | Returns the best viable alternative for this property_set
See the documentation for selection rules.
# TODO: shouldn't this be 'alternative' (singular)? | [
"Returns",
"the",
"best",
"viable",
"alternative",
"for",
"this",
"property_set",
"See",
"the",
"documentation",
"for",
"selection",
"rules",
".",
"#",
"TODO",
":",
"shouldn",
"t",
"this",
"be",
"alternative",
"(",
"singular",
")",
"?"
] | def __select_alternatives (self, property_set, debug):
""" Returns the best viable alternative for this property_set
See the documentation for selection rules.
# TODO: shouldn't this be 'alternative' (singular)?
"""
# When selecting alternatives we have to consider defaul... | [
"def",
"__select_alternatives",
"(",
"self",
",",
"property_set",
",",
"debug",
")",
":",
"# When selecting alternatives we have to consider defaults,",
"# for example:",
"# lib l : l.cpp : <variant>debug ;",
"# lib l : l_opt.cpp : <variant>release ;",
"# won't work unless we add d... | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/external/tools/build/v2/build/targets.py#L639-L689 | |
GoSSIP-SJTU/TripleDoggy | 03648d6b19c812504b14e8b98c8c7b3f443f4e54 | tools/clang/bindings/python/clang/cindex.py | python | SourceLocation.offset | (self) | return self._get_instantiation()[3] | Get the file offset represented by this source location. | Get the file offset represented by this source location. | [
"Get",
"the",
"file",
"offset",
"represented",
"by",
"this",
"source",
"location",
"."
] | def offset(self):
"""Get the file offset represented by this source location."""
return self._get_instantiation()[3] | [
"def",
"offset",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_instantiation",
"(",
")",
"[",
"3",
"]"
] | https://github.com/GoSSIP-SJTU/TripleDoggy/blob/03648d6b19c812504b14e8b98c8c7b3f443f4e54/tools/clang/bindings/python/clang/cindex.py#L271-L273 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/stc.py | python | StyledTextCtrl.SetWrapStartIndent | (*args, **kwargs) | return _stc.StyledTextCtrl_SetWrapStartIndent(*args, **kwargs) | SetWrapStartIndent(self, int indent)
Set the start indent for wrapped lines. | SetWrapStartIndent(self, int indent) | [
"SetWrapStartIndent",
"(",
"self",
"int",
"indent",
")"
] | def SetWrapStartIndent(*args, **kwargs):
"""
SetWrapStartIndent(self, int indent)
Set the start indent for wrapped lines.
"""
return _stc.StyledTextCtrl_SetWrapStartIndent(*args, **kwargs) | [
"def",
"SetWrapStartIndent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_SetWrapStartIndent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/stc.py#L4119-L4125 | |
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/core/udf/row_function.py | python | _get_frame_row_type | (dtype) | return Record(fields, offset, _is_aligned_struct) | Get the numba `Record` type corresponding to a frame.
Models each column and its mask as a MaskedType and
models the row as a dictionary like data structure
containing these MaskedTypes.
Large parts of this function are copied with comments
from the Numba internals and slightly modified to
acco... | Get the numba `Record` type corresponding to a frame.
Models each column and its mask as a MaskedType and
models the row as a dictionary like data structure
containing these MaskedTypes. | [
"Get",
"the",
"numba",
"Record",
"type",
"corresponding",
"to",
"a",
"frame",
".",
"Models",
"each",
"column",
"and",
"its",
"mask",
"as",
"a",
"MaskedType",
"and",
"models",
"the",
"row",
"as",
"a",
"dictionary",
"like",
"data",
"structure",
"containing",
... | def _get_frame_row_type(dtype):
"""
Get the numba `Record` type corresponding to a frame.
Models each column and its mask as a MaskedType and
models the row as a dictionary like data structure
containing these MaskedTypes.
Large parts of this function are copied with comments
from the Numba... | [
"def",
"_get_frame_row_type",
"(",
"dtype",
")",
":",
"# Create the numpy structured type corresponding to the numpy dtype.",
"fields",
"=",
"[",
"]",
"offset",
"=",
"0",
"sizes",
"=",
"[",
"val",
"[",
"0",
"]",
".",
"itemsize",
"for",
"val",
"in",
"dtype",
".",... | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/udf/row_function.py#L27-L74 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/asyncio/events.py | python | AbstractEventLoop.connect_write_pipe | (self, protocol_factory, pipe) | Register write pipe in event loop.
protocol_factory should instantiate object with BaseProtocol interface.
Pipe is file-like object already switched to nonblocking.
Return pair (transport, protocol), where transport support
WriteTransport interface. | Register write pipe in event loop. | [
"Register",
"write",
"pipe",
"in",
"event",
"loop",
"."
] | async def connect_write_pipe(self, protocol_factory, pipe):
"""Register write pipe in event loop.
protocol_factory should instantiate object with BaseProtocol interface.
Pipe is file-like object already switched to nonblocking.
Return pair (transport, protocol), where transport support
... | [
"async",
"def",
"connect_write_pipe",
"(",
"self",
",",
"protocol_factory",
",",
"pipe",
")",
":",
"# The reason to accept file-like object instead of just file descriptor",
"# is: we need to own pipe and close it at transport finishing",
"# Can got complicated errors if pass f.fileno(),",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/asyncio/events.py#L471-L482 | ||
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPMS_CLOCK_INFO.initFromTpm | (self, buf) | TpmMarshaller method | TpmMarshaller method | [
"TpmMarshaller",
"method"
] | def initFromTpm(self, buf):
""" TpmMarshaller method """
self.clock = buf.readInt64()
self.resetCount = buf.readInt()
self.restartCount = buf.readInt()
self.safe = buf.readByte() | [
"def",
"initFromTpm",
"(",
"self",
",",
"buf",
")",
":",
"self",
".",
"clock",
"=",
"buf",
".",
"readInt64",
"(",
")",
"self",
".",
"resetCount",
"=",
"buf",
".",
"readInt",
"(",
")",
"self",
".",
"restartCount",
"=",
"buf",
".",
"readInt",
"(",
")... | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L5003-L5008 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_strptime.py | python | TimeRE.pattern | (self, format) | return "%s%s" % (processed_format, format) | Return regex pattern for the format string.
Need to make sure that any characters that might be interpreted as
regex syntax are escaped. | Return regex pattern for the format string. | [
"Return",
"regex",
"pattern",
"for",
"the",
"format",
"string",
"."
] | def pattern(self, format):
"""Return regex pattern for the format string.
Need to make sure that any characters that might be interpreted as
regex syntax are escaped.
"""
processed_format = ''
# The sub() call escapes all characters that might be misconstrued
# ... | [
"def",
"pattern",
"(",
"self",
",",
"format",
")",
":",
"processed_format",
"=",
"''",
"# The sub() call escapes all characters that might be misconstrued",
"# as regex syntax. Cannot use re.escape since we have to deal with",
"# format directives (%m, etc.).",
"regex_chars",
"=",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_strptime.py#L247-L268 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/framework/errors.py | python | UnauthenticatedError.__init__ | (self, node_def, op, message) | Creates an `UnauthenticatedError`. | Creates an `UnauthenticatedError`. | [
"Creates",
"an",
"UnauthenticatedError",
"."
] | def __init__(self, node_def, op, message):
"""Creates an `UnauthenticatedError`."""
super(UnauthenticatedError, self).__init__(node_def, op, message,
UNAUTHENTICATED) | [
"def",
"__init__",
"(",
"self",
",",
"node_def",
",",
"op",
",",
"message",
")",
":",
"super",
"(",
"UnauthenticatedError",
",",
"self",
")",
".",
"__init__",
"(",
"node_def",
",",
"op",
",",
"message",
",",
"UNAUTHENTICATED",
")"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/framework/errors.py#L279-L282 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/learn/python/learn/ops/losses_ops.py | python | softmax_classifier | (tensor_in,
labels,
weights,
biases,
class_weight=None,
name=None) | Returns prediction and loss for softmax classifier.
Args:
tensor_in: Input tensor, [batch_size, feature_size], features.
labels: Tensor, [batch_size, n_classes], labels of the output classes.
weights: Tensor, [batch_size, feature_size], linear transformation
matrix.
biases: Tensor, [batch_size]... | Returns prediction and loss for softmax classifier. | [
"Returns",
"prediction",
"and",
"loss",
"for",
"softmax",
"classifier",
"."
] | def softmax_classifier(tensor_in,
labels,
weights,
biases,
class_weight=None,
name=None):
"""Returns prediction and loss for softmax classifier.
Args:
tensor_in: Input tensor, [batch_size, feature... | [
"def",
"softmax_classifier",
"(",
"tensor_in",
",",
"labels",
",",
"weights",
",",
"biases",
",",
"class_weight",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"tensor_in",
",",
"labels",
"]",
",",
"name",
"... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/learn/python/learn/ops/losses_ops.py#L38-L63 | ||
choasup/caffe-yolo9000 | e8a476c4c23d756632f7a26c681a96e3ab672544 | scripts/cpp_lint.py | python | FindEndOfExpressionInLine | (line, startpos, depth, startchar, endchar) | return (-1, depth) | Find the position just after the matching endchar.
Args:
line: a CleansedLines line.
startpos: start searching at this position.
depth: nesting level at startpos.
startchar: expression opening character.
endchar: expression closing character.
Returns:
On finding matching endchar: (index ju... | Find the position just after the matching endchar. | [
"Find",
"the",
"position",
"just",
"after",
"the",
"matching",
"endchar",
"."
] | def FindEndOfExpressionInLine(line, startpos, depth, startchar, endchar):
"""Find the position just after the matching endchar.
Args:
line: a CleansedLines line.
startpos: start searching at this position.
depth: nesting level at startpos.
startchar: expression opening character.
endchar: expre... | [
"def",
"FindEndOfExpressionInLine",
"(",
"line",
",",
"startpos",
",",
"depth",
",",
"startchar",
",",
"endchar",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"startpos",
",",
"len",
"(",
"line",
")",
")",
":",
"if",
"line",
"[",
"i",
"]",
"==",
"start... | https://github.com/choasup/caffe-yolo9000/blob/e8a476c4c23d756632f7a26c681a96e3ab672544/scripts/cpp_lint.py#L1230-L1251 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/sparse_ops.py | python | sparse_reduce_sum | (sp_input, reduction_axes=None, keep_dims=False) | return gen_sparse_ops.sparse_reduce_sum(sp_input.indices,
sp_input.values,
sp_input.shape,
math_ops._ReductionDims(
sp_input, reduction_axes),
... | Computes the sum of elements across dimensions of a SparseTensor.
This Op takes a SparseTensor and is the sparse counterpart to
`tf.reduce_sum()`. In particular, this Op also returns a dense `Tensor`
instead of a sparse one.
Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless
`keep_d... | Computes the sum of elements across dimensions of a SparseTensor. | [
"Computes",
"the",
"sum",
"of",
"elements",
"across",
"dimensions",
"of",
"a",
"SparseTensor",
"."
] | def sparse_reduce_sum(sp_input, reduction_axes=None, keep_dims=False):
"""Computes the sum of elements across dimensions of a SparseTensor.
This Op takes a SparseTensor and is the sparse counterpart to
`tf.reduce_sum()`. In particular, this Op also returns a dense `Tensor`
instead of a sparse one.
Reduces ... | [
"def",
"sparse_reduce_sum",
"(",
"sp_input",
",",
"reduction_axes",
"=",
"None",
",",
"keep_dims",
"=",
"False",
")",
":",
"return",
"gen_sparse_ops",
".",
"sparse_reduce_sum",
"(",
"sp_input",
".",
"indices",
",",
"sp_input",
".",
"values",
",",
"sp_input",
"... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/sparse_ops.py#L612-L655 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/_pyio.py | python | FileIO.seek | (self, pos, whence=SEEK_SET) | return os.lseek(self._fd, pos, whence) | Move to new file position.
Argument offset is a byte count. Optional argument whence defaults to
SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values
are SEEK_CUR or 1 (move relative to current position, positive or negative),
and SEEK_END or 2 (move relative ... | Move to new file position. | [
"Move",
"to",
"new",
"file",
"position",
"."
] | def seek(self, pos, whence=SEEK_SET):
"""Move to new file position.
Argument offset is a byte count. Optional argument whence defaults to
SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values
are SEEK_CUR or 1 (move relative to current position, positive or neg... | [
"def",
"seek",
"(",
"self",
",",
"pos",
",",
"whence",
"=",
"SEEK_SET",
")",
":",
"if",
"isinstance",
"(",
"pos",
",",
"float",
")",
":",
"raise",
"TypeError",
"(",
"'an integer is required'",
")",
"self",
".",
"_checkClosed",
"(",
")",
"return",
"os",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/_pyio.py#L1662-L1676 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py | python | Misc.winfo_vrootx | (self) | return self.tk.getint(
self.tk.call('winfo', 'vrootx', self._w)) | Return the x offset of the virtual root relative to the root
window of the screen of this widget. | Return the x offset of the virtual root relative to the root
window of the screen of this widget. | [
"Return",
"the",
"x",
"offset",
"of",
"the",
"virtual",
"root",
"relative",
"to",
"the",
"root",
"window",
"of",
"the",
"screen",
"of",
"this",
"widget",
"."
] | def winfo_vrootx(self):
"""Return the x offset of the virtual root relative to the root
window of the screen of this widget."""
return self.tk.getint(
self.tk.call('winfo', 'vrootx', self._w)) | [
"def",
"winfo_vrootx",
"(",
"self",
")",
":",
"return",
"self",
".",
"tk",
".",
"getint",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"'winfo'",
",",
"'vrootx'",
",",
"self",
".",
"_w",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py#L1151-L1155 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/symsrc/pefile.py | python | PE.set_dword_at_offset | (self, offset, dword) | return self.set_bytes_at_offset(offset, self.get_data_from_dword(dword)) | Set the double word value at the given file offset. | Set the double word value at the given file offset. | [
"Set",
"the",
"double",
"word",
"value",
"at",
"the",
"given",
"file",
"offset",
"."
] | def set_dword_at_offset(self, offset, dword):
"""Set the double word value at the given file offset."""
return self.set_bytes_at_offset(offset, self.get_data_from_dword(dword)) | [
"def",
"set_dword_at_offset",
"(",
"self",
",",
"offset",
",",
"dword",
")",
":",
"return",
"self",
".",
"set_bytes_at_offset",
"(",
"offset",
",",
"self",
".",
"get_data_from_dword",
"(",
"dword",
")",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/symsrc/pefile.py#L3440-L3442 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/plotting/_matplotlib/core.py | python | MPLPlot._apply_style_colors | (self, colors, kwds, col_num, label) | return style, kwds | Manage style and color based on column number and its label.
Returns tuple of appropriate style and kwds which "color" may be added. | Manage style and color based on column number and its label.
Returns tuple of appropriate style and kwds which "color" may be added. | [
"Manage",
"style",
"and",
"color",
"based",
"on",
"column",
"number",
"and",
"its",
"label",
".",
"Returns",
"tuple",
"of",
"appropriate",
"style",
"and",
"kwds",
"which",
"color",
"may",
"be",
"added",
"."
] | def _apply_style_colors(self, colors, kwds, col_num, label):
"""
Manage style and color based on column number and its label.
Returns tuple of appropriate style and kwds which "color" may be added.
"""
style = None
if self.style is not None:
if isinstance(self... | [
"def",
"_apply_style_colors",
"(",
"self",
",",
"colors",
",",
"kwds",
",",
"col_num",
",",
"label",
")",
":",
"style",
"=",
"None",
"if",
"self",
".",
"style",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"self",
".",
"style",
",",
"list",
")"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/plotting/_matplotlib/core.py#L709-L730 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/examples/learn/multiple_gpu.py | python | my_model | (features, labels, mode) | DNN with three hidden layers, and dropout of 0.1 probability.
Note: If you want to run this example with multiple GPUs, Cuda Toolkit 7.0 and
CUDNN 6.5 V2 from NVIDIA need to be installed beforehand.
Args:
features: Dict of input `Tensor`.
labels: Label `Tensor`.
mode: One of `ModeKeys`.
Returns:
... | DNN with three hidden layers, and dropout of 0.1 probability. | [
"DNN",
"with",
"three",
"hidden",
"layers",
"and",
"dropout",
"of",
"0",
".",
"1",
"probability",
"."
] | def my_model(features, labels, mode):
"""DNN with three hidden layers, and dropout of 0.1 probability.
Note: If you want to run this example with multiple GPUs, Cuda Toolkit 7.0 and
CUDNN 6.5 V2 from NVIDIA need to be installed beforehand.
Args:
features: Dict of input `Tensor`.
labels: Label `Tensor`... | [
"def",
"my_model",
"(",
"features",
",",
"labels",
",",
"mode",
")",
":",
"# Create three fully connected layers respectively of size 10, 20, and 10 with",
"# each layer having a dropout probability of 0.1.",
"net",
"=",
"features",
"[",
"X_FEATURE",
"]",
"with",
"tf",
".",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/examples/learn/multiple_gpu.py#L33-L88 | ||
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/internal/python_message.py | python | _AddEqualsMethod | (message_descriptor, cls) | Helper for _AddMessageMethods(). | Helper for _AddMessageMethods(). | [
"Helper",
"for",
"_AddMessageMethods",
"()",
"."
] | def _AddEqualsMethod(message_descriptor, cls):
"""Helper for _AddMessageMethods()."""
def __eq__(self, other):
if (not isinstance(other, message_mod.Message) or
other.DESCRIPTOR != self.DESCRIPTOR):
return False
if self is other:
return True
if not self.ListFields() == other.ListFi... | [
"def",
"_AddEqualsMethod",
"(",
"message_descriptor",
",",
"cls",
")",
":",
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"other",
",",
"message_mod",
".",
"Message",
")",
"or",
"other",
".",
"DESCRIPTOR",
"!=... | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/internal/python_message.py#L667-L688 | ||
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/minitaur/agents/baseline_controller/leg_controller.py | python | LegController.reset | (self, current_time: float) | Resets the controller's internal state. | Resets the controller's internal state. | [
"Resets",
"the",
"controller",
"s",
"internal",
"state",
"."
] | def reset(self, current_time: float):
"""Resets the controller's internal state."""
pass | [
"def",
"reset",
"(",
"self",
",",
"current_time",
":",
"float",
")",
":",
"pass"
] | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/minitaur/agents/baseline_controller/leg_controller.py#L17-L19 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | GenericDirCtrl.FindChild | (*args, **kwargs) | return _controls_.GenericDirCtrl_FindChild(*args, **kwargs) | FindChild(wxTreeItemId parentId, wxString path) -> (item, done)
Find the child that matches the first part of 'path'. E.g. if a child
path is "/usr" and 'path' is "/usr/include" then the child for
/usr is returned. If the path string has been used (we're at the
leaf), done is set to T... | FindChild(wxTreeItemId parentId, wxString path) -> (item, done) | [
"FindChild",
"(",
"wxTreeItemId",
"parentId",
"wxString",
"path",
")",
"-",
">",
"(",
"item",
"done",
")"
] | def FindChild(*args, **kwargs):
"""
FindChild(wxTreeItemId parentId, wxString path) -> (item, done)
Find the child that matches the first part of 'path'. E.g. if a child
path is "/usr" and 'path' is "/usr/include" then the child for
/usr is returned. If the path string has bee... | [
"def",
"FindChild",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"GenericDirCtrl_FindChild",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L5753-L5763 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | PreRichTextCtrl | (*args, **kwargs) | return val | PreRichTextCtrl() -> RichTextCtrl | PreRichTextCtrl() -> RichTextCtrl | [
"PreRichTextCtrl",
"()",
"-",
">",
"RichTextCtrl"
] | def PreRichTextCtrl(*args, **kwargs):
"""PreRichTextCtrl() -> RichTextCtrl"""
val = _richtext.new_PreRichTextCtrl(*args, **kwargs)
return val | [
"def",
"PreRichTextCtrl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"_richtext",
".",
"new_PreRichTextCtrl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"val"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L4209-L4212 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/vcs/subversion.py | python | Subversion.get_vcs_version | (self) | return vcs_version | Return the version of the currently installed Subversion client.
If the version of the Subversion client has already been queried,
a cached value will be used.
:return: A tuple containing the parts of the version information or
``()`` if the version returned from ``svn`` could not ... | Return the version of the currently installed Subversion client. | [
"Return",
"the",
"version",
"of",
"the",
"currently",
"installed",
"Subversion",
"client",
"."
] | def get_vcs_version(self):
# type: () -> Tuple[int, ...]
"""Return the version of the currently installed Subversion client.
If the version of the Subversion client has already been queried,
a cached value will be used.
:return: A tuple containing the parts of the version infor... | [
"def",
"get_vcs_version",
"(",
"self",
")",
":",
"# type: () -> Tuple[int, ...]",
"if",
"self",
".",
"_vcs_version",
"is",
"not",
"None",
":",
"# Use cached version, if available.",
"# If parsing the version failed previously (empty tuple),",
"# do not attempt to parse it again.",
... | 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/_internal/vcs/subversion.py#L243-L262 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/number-of-strings-that-appear-as-substrings-in-word.py | python | Solution2.numOfStrings | (self, patterns, word) | return sum(kmp(word, pattern) != -1 for pattern in patterns) | :type patterns: List[str]
:type word: str
:rtype: int | :type patterns: List[str]
:type word: str
:rtype: int | [
":",
"type",
"patterns",
":",
"List",
"[",
"str",
"]",
":",
"type",
"word",
":",
"str",
":",
"rtype",
":",
"int"
] | def numOfStrings(self, patterns, word):
"""
:type patterns: List[str]
:type word: str
:rtype: int
"""
def getPrefix(pattern):
prefix = [-1]*len(pattern)
j = -1
for i in xrange(1, len(pattern)):
while j != -1 and pattern[... | [
"def",
"numOfStrings",
"(",
"self",
",",
"patterns",
",",
"word",
")",
":",
"def",
"getPrefix",
"(",
"pattern",
")",
":",
"prefix",
"=",
"[",
"-",
"1",
"]",
"*",
"len",
"(",
"pattern",
")",
"j",
"=",
"-",
"1",
"for",
"i",
"in",
"xrange",
"(",
"... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/number-of-strings-that-appear-as-substrings-in-word.py#L89-L122 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBTypeFilter.GetNumberOfExpressionPaths | (self) | return _lldb.SBTypeFilter_GetNumberOfExpressionPaths(self) | GetNumberOfExpressionPaths(self) -> uint32_t | GetNumberOfExpressionPaths(self) -> uint32_t | [
"GetNumberOfExpressionPaths",
"(",
"self",
")",
"-",
">",
"uint32_t"
] | def GetNumberOfExpressionPaths(self):
"""GetNumberOfExpressionPaths(self) -> uint32_t"""
return _lldb.SBTypeFilter_GetNumberOfExpressionPaths(self) | [
"def",
"GetNumberOfExpressionPaths",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBTypeFilter_GetNumberOfExpressionPaths",
"(",
"self",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L11111-L11113 | |
intel-iot-devkit/how-to-code-samples | b4ea616f36bbfa2e042beb1698f968cfd651d79f | alarm-clock/python/iot_alarm_clock/storage.py | python | store_message | (payload, method="PUT") | Publish message to remote data store. | Publish message to remote data store. | [
"Publish",
"message",
"to",
"remote",
"data",
"store",
"."
] | def store_message(payload, method="PUT"):
"""
Publish message to remote data store.
"""
if not DATA_STORE_CONFIG:
return
server = DATA_STORE_CONFIG.server
auth_token = DATA_STORE_CONFIG.auth_token
headers = {
"X-Auth-Token": auth_token
}
def perform_request():
... | [
"def",
"store_message",
"(",
"payload",
",",
"method",
"=",
"\"PUT\"",
")",
":",
"if",
"not",
"DATA_STORE_CONFIG",
":",
"return",
"server",
"=",
"DATA_STORE_CONFIG",
".",
"server",
"auth_token",
"=",
"DATA_STORE_CONFIG",
".",
"auth_token",
"headers",
"=",
"{",
... | https://github.com/intel-iot-devkit/how-to-code-samples/blob/b4ea616f36bbfa2e042beb1698f968cfd651d79f/alarm-clock/python/iot_alarm_clock/storage.py#L27-L65 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | Dialog.GetReturnCode | (*args, **kwargs) | return _windows_.Dialog_GetReturnCode(*args, **kwargs) | GetReturnCode(self) -> int | GetReturnCode(self) -> int | [
"GetReturnCode",
"(",
"self",
")",
"-",
">",
"int"
] | def GetReturnCode(*args, **kwargs):
"""GetReturnCode(self) -> int"""
return _windows_.Dialog_GetReturnCode(*args, **kwargs) | [
"def",
"GetReturnCode",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"Dialog_GetReturnCode",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L749-L751 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/input/defaults.py | python | create_pipe_input | () | Create an input pipe.
This is mostly useful for unit testing. | Create an input pipe.
This is mostly useful for unit testing. | [
"Create",
"an",
"input",
"pipe",
".",
"This",
"is",
"mostly",
"useful",
"for",
"unit",
"testing",
"."
] | def create_pipe_input() -> PipeInput:
"""
Create an input pipe.
This is mostly useful for unit testing.
"""
if is_windows():
from .win32_pipe import Win32PipeInput
return Win32PipeInput()
else:
from .posix_pipe import PosixPipeInput
return PosixPipeInput() | [
"def",
"create_pipe_input",
"(",
")",
"->",
"PipeInput",
":",
"if",
"is_windows",
"(",
")",
":",
"from",
".",
"win32_pipe",
"import",
"Win32PipeInput",
"return",
"Win32PipeInput",
"(",
")",
"else",
":",
"from",
".",
"posix_pipe",
"import",
"PosixPipeInput",
"r... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/input/defaults.py#L51-L63 | ||
facebook/openr | ed38bdfd6bf290084bfab4821b59f83e7b59315d | openr/py/openr/cli/commands/kvstore.py | python | KvStoreCmdBase.get_node_to_ips | (
self, client: OpenrCtrl.Client, area: Optional[str] = None
) | return node_dict | get the dict of all nodes to their IP in the network | get the dict of all nodes to their IP in the network | [
"get",
"the",
"dict",
"of",
"all",
"nodes",
"to",
"their",
"IP",
"in",
"the",
"network"
] | def get_node_to_ips(
self, client: OpenrCtrl.Client, area: Optional[str] = None
) -> Dict:
"""get the dict of all nodes to their IP in the network"""
node_dict = {}
keyDumpParams = self.buildKvStoreKeyDumpParams(Consts.PREFIX_DB_MARKER)
resp = kvstore_types.Publication()
... | [
"def",
"get_node_to_ips",
"(",
"self",
",",
"client",
":",
"OpenrCtrl",
".",
"Client",
",",
"area",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"Dict",
":",
"node_dict",
"=",
"{",
"}",
"keyDumpParams",
"=",
"self",
".",
"buildKvStoreKeyDump... | https://github.com/facebook/openr/blob/ed38bdfd6bf290084bfab4821b59f83e7b59315d/openr/py/openr/cli/commands/kvstore.py#L120-L140 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/profiler/profiling.py | python | Profiler._get_devid_rankid_and_devtarget | (self) | Get device id and rank id and target of this training. | Get device id and rank id and target of this training. | [
"Get",
"device",
"id",
"and",
"rank",
"id",
"and",
"target",
"of",
"this",
"training",
"."
] | def _get_devid_rankid_and_devtarget(self):
"""Get device id and rank id and target of this training."""
device_target = ""
dev_id = ""
rank_id = ""
try:
dev_id = str(context.get_context("device_id"))
device_target = context.get_context("device_target")
... | [
"def",
"_get_devid_rankid_and_devtarget",
"(",
"self",
")",
":",
"device_target",
"=",
"\"\"",
"dev_id",
"=",
"\"\"",
"rank_id",
"=",
"\"\"",
"try",
":",
"dev_id",
"=",
"str",
"(",
"context",
".",
"get_context",
"(",
"\"device_id\"",
")",
")",
"device_target",... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/profiler/profiling.py#L861-L890 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/pystache/pystache/locator.py | python | Locator.find_file | (self, file_name, search_dirs) | return self._find_path_required(search_dirs, file_name) | Return the path to a template with the given file name.
Arguments:
file_name: the file name of the template.
search_dirs: the list of directories in which to search. | Return the path to a template with the given file name. | [
"Return",
"the",
"path",
"to",
"a",
"template",
"with",
"the",
"given",
"file",
"name",
"."
] | def find_file(self, file_name, search_dirs):
"""
Return the path to a template with the given file name.
Arguments:
file_name: the file name of the template.
search_dirs: the list of directories in which to search.
"""
return self._find_path_required(searc... | [
"def",
"find_file",
"(",
"self",
",",
"file_name",
",",
"search_dirs",
")",
":",
"return",
"self",
".",
"_find_path_required",
"(",
"search_dirs",
",",
"file_name",
")"
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/pystache/pystache/locator.py#L126-L137 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | benchmark/opperf/nd_operations/binary_operators.py | python | run_mx_binary_broadcast_operators_benchmarks | (ctx=mx.cpu(), dtype='float32', warmup=10, runs=50) | return mx_binary_op_results | Runs benchmarks with the given context and precision (dtype)for all the binary
broadcast operators in MXNet.
Parameters
----------
ctx: mx.ctx
Context to run benchmarks
dtype: str, default 'float32'
Precision to use for benchmarks
warmup: int, default 10
Number of times ... | Runs benchmarks with the given context and precision (dtype)for all the binary
broadcast operators in MXNet. | [
"Runs",
"benchmarks",
"with",
"the",
"given",
"context",
"and",
"precision",
"(",
"dtype",
")",
"for",
"all",
"the",
"binary",
"broadcast",
"operators",
"in",
"MXNet",
"."
] | def run_mx_binary_broadcast_operators_benchmarks(ctx=mx.cpu(), dtype='float32', warmup=10, runs=50):
"""Runs benchmarks with the given context and precision (dtype)for all the binary
broadcast operators in MXNet.
Parameters
----------
ctx: mx.ctx
Context to run benchmarks
dtype: str, de... | [
"def",
"run_mx_binary_broadcast_operators_benchmarks",
"(",
"ctx",
"=",
"mx",
".",
"cpu",
"(",
")",
",",
"dtype",
"=",
"'float32'",
",",
"warmup",
"=",
"10",
",",
"runs",
"=",
"50",
")",
":",
"# Fetch all Binary Broadcast Operators",
"mx_binary_broadcast_ops",
"="... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/benchmark/opperf/nd_operations/binary_operators.py#L41-L65 | |
Samsung/veles | 95ed733c2e49bc011ad98ccf2416ecec23fbf352 | veles/distributable.py | python | Pickleable.__setstate__ | (self, state) | Recovers the object after unpickling. | Recovers the object after unpickling. | [
"Recovers",
"the",
"object",
"after",
"unpickling",
"."
] | def __setstate__(self, state):
"""Recovers the object after unpickling.
"""
# recover class attributes
if 'class_attributes__' in state:
# RATS! AttributeError:
# 'mappingproxy' object has no attribute 'update'
# self.__class__.__dict__.update(state['c... | [
"def",
"__setstate__",
"(",
"self",
",",
"state",
")",
":",
"# recover class attributes",
"if",
"'class_attributes__'",
"in",
"state",
":",
"# RATS! AttributeError:",
"# 'mappingproxy' object has no attribute 'update'",
"# self.__class__.__dict__.update(state['class_attributes__'])",... | https://github.com/Samsung/veles/blob/95ed733c2e49bc011ad98ccf2416ecec23fbf352/veles/distributable.py#L105-L119 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/formats/style.py | python | Styler.apply | (self, func, axis=0, subset=None, **kwargs) | return self | Apply a function column-wise, row-wise, or table-wise.
Updates the HTML representation with the result.
Parameters
----------
func : function
``func`` should take a Series or DataFrame (depending
on ``axis``), and return an object with the same shape.
... | Apply a function column-wise, row-wise, or table-wise. | [
"Apply",
"a",
"function",
"column",
"-",
"wise",
"row",
"-",
"wise",
"or",
"table",
"-",
"wise",
"."
] | def apply(self, func, axis=0, subset=None, **kwargs):
"""
Apply a function column-wise, row-wise, or table-wise.
Updates the HTML representation with the result.
Parameters
----------
func : function
``func`` should take a Series or DataFrame (depending
... | [
"def",
"apply",
"(",
"self",
",",
"func",
",",
"axis",
"=",
"0",
",",
"subset",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_todo",
".",
"append",
"(",
"(",
"lambda",
"instance",
":",
"getattr",
"(",
"instance",
",",
"\"_apply\"",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/formats/style.py#L648-L697 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/nn/python/ops/sampling_ops.py | python | _rank_resample | (weights, biases, inputs, sampled_values, num_resampled,
resampling_temperature, partition_strategy) | return resampled, true_expected_count, resampled_expected_count | A helper function for rank_sampled_softmax_loss.
This computes, for each i in `sampled_values`,
log(sum_j exp((w_i * x_j + b_i) / resampling_temperature))
where w_i, b_i are the weight and bias of the i-th class, repsectively,
and j ranges over the rows of `inputs`. For efficiency, we rearrange the
com... | A helper function for rank_sampled_softmax_loss. | [
"A",
"helper",
"function",
"for",
"rank_sampled_softmax_loss",
"."
] | def _rank_resample(weights, biases, inputs, sampled_values, num_resampled,
resampling_temperature, partition_strategy):
"""A helper function for rank_sampled_softmax_loss.
This computes, for each i in `sampled_values`,
log(sum_j exp((w_i * x_j + b_i) / resampling_temperature))
where w_... | [
"def",
"_rank_resample",
"(",
"weights",
",",
"biases",
",",
"inputs",
",",
"sampled_values",
",",
"num_resampled",
",",
"resampling_temperature",
",",
"partition_strategy",
")",
":",
"# This code supports passing a Tensor for num_resampled, but since it is only",
"# called wit... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/nn/python/ops/sampling_ops.py#L29-L105 | |
Constellation/iv | 64c3a9c7c517063f29d90d449180ea8f6f4d946f | tools/cpplint.py | python | Error | (filename, linenum, category, confidence, message) | Logs the fact we've found a lint error.
We log where the error was found, and also our confidence in the error,
that is, how certain we are this is a legitimate style regression, and
not a misidentification or a use that's sometimes justified.
False positives can be suppressed by the use of
"cpplint(categor... | Logs the fact we've found a lint error. | [
"Logs",
"the",
"fact",
"we",
"ve",
"found",
"a",
"lint",
"error",
"."
] | def Error(filename, linenum, category, confidence, message):
"""Logs the fact we've found a lint error.
We log where the error was found, and also our confidence in the error,
that is, how certain we are this is a legitimate style regression, and
not a misidentification or a use that's sometimes justified.
... | [
"def",
"Error",
"(",
"filename",
",",
"linenum",
",",
"category",
",",
"confidence",
",",
"message",
")",
":",
"if",
"_ShouldPrintError",
"(",
"category",
",",
"confidence",
",",
"linenum",
")",
":",
"_cpplint_state",
".",
"IncrementErrorCount",
"(",
"category... | https://github.com/Constellation/iv/blob/64c3a9c7c517063f29d90d449180ea8f6f4d946f/tools/cpplint.py#L976-L1008 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/email/_header_value_parser.py | python | get_dot_atom | (value) | return dot_atom, value | dot-atom = [CFWS] dot-atom-text [CFWS]
Any place we can have a dot atom, we could instead have an rfc2047 encoded
word. | dot-atom = [CFWS] dot-atom-text [CFWS] | [
"dot",
"-",
"atom",
"=",
"[",
"CFWS",
"]",
"dot",
"-",
"atom",
"-",
"text",
"[",
"CFWS",
"]"
] | def get_dot_atom(value):
""" dot-atom = [CFWS] dot-atom-text [CFWS]
Any place we can have a dot atom, we could instead have an rfc2047 encoded
word.
"""
dot_atom = DotAtom()
if value[0] in CFWS_LEADER:
token, value = get_cfws(value)
dot_atom.append(token)
if value.startswith... | [
"def",
"get_dot_atom",
"(",
"value",
")",
":",
"dot_atom",
"=",
"DotAtom",
"(",
")",
"if",
"value",
"[",
"0",
"]",
"in",
"CFWS_LEADER",
":",
"token",
",",
"value",
"=",
"get_cfws",
"(",
"value",
")",
"dot_atom",
".",
"append",
"(",
"token",
")",
"if"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/email/_header_value_parser.py#L1340-L1363 | |
include-what-you-use/include-what-you-use | 208fbfffa5d69364b9f78e427caa443441279283 | fix_includes.py | python | _MayBeHeaderFile | (filename) | return extension not in _SOURCE_EXTENSIONS | Tries to figure out if filename is a C++ header file. Defaults to yes. | Tries to figure out if filename is a C++ header file. Defaults to yes. | [
"Tries",
"to",
"figure",
"out",
"if",
"filename",
"is",
"a",
"C",
"++",
"header",
"file",
".",
"Defaults",
"to",
"yes",
"."
] | def _MayBeHeaderFile(filename):
"""Tries to figure out if filename is a C++ header file. Defaults to yes."""
# Header files have all sorts of extensions: .h, .hpp, .hxx, or no
# extension at all. So we say everything is a header file unless it
# has a known extension that's not.
extension = os.path.splitext... | [
"def",
"_MayBeHeaderFile",
"(",
"filename",
")",
":",
"# Header files have all sorts of extensions: .h, .hpp, .hxx, or no",
"# extension at all. So we say everything is a header file unless it",
"# has a known extension that's not.",
"extension",
"=",
"os",
".",
"path",
".",
"splitext... | https://github.com/include-what-you-use/include-what-you-use/blob/208fbfffa5d69364b9f78e427caa443441279283/fix_includes.py#L201-L207 | |
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/programs/scripts/metadata/Music/musicbrainzngs/musicbrainz.py | python | WebServiceError.__init__ | (self, message=None, cause=None) | Pass ``cause`` if this exception was caused by another
exception. | Pass ``cause`` if this exception was caused by another
exception. | [
"Pass",
"cause",
"if",
"this",
"exception",
"was",
"caused",
"by",
"another",
"exception",
"."
] | def __init__(self, message=None, cause=None):
"""Pass ``cause`` if this exception was caused by another
exception.
"""
self.message = message
self.cause = cause | [
"def",
"__init__",
"(",
"self",
",",
"message",
"=",
"None",
",",
"cause",
"=",
"None",
")",
":",
"self",
".",
"message",
"=",
"message",
"self",
".",
"cause",
"=",
"cause"
] | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/programs/scripts/metadata/Music/musicbrainzngs/musicbrainz.py#L193-L198 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/overrides.py | python | get_default_nowrap_functions | () | return {
Tensor._base.__get__,
Tensor.grad.__get__,
Tensor._grad.__get__,
} | Return public functions that do not wrap in a subclass when invoked by
the default ``Tensor.__torch_function__`` that preserves subclasses. Typically,
these functions represent field accesses (i.e., retrieving a Tensor that
is stored somewhere on the Tensor) as opposed to computation. Users of
these f... | Return public functions that do not wrap in a subclass when invoked by
the default ``Tensor.__torch_function__`` that preserves subclasses. Typically,
these functions represent field accesses (i.e., retrieving a Tensor that
is stored somewhere on the Tensor) as opposed to computation. Users of
these f... | [
"Return",
"public",
"functions",
"that",
"do",
"not",
"wrap",
"in",
"a",
"subclass",
"when",
"invoked",
"by",
"the",
"default",
"Tensor",
".",
"__torch_function__",
"that",
"preserves",
"subclasses",
".",
"Typically",
"these",
"functions",
"represent",
"field",
... | def get_default_nowrap_functions() -> Set[Callable]:
"""
Return public functions that do not wrap in a subclass when invoked by
the default ``Tensor.__torch_function__`` that preserves subclasses. Typically,
these functions represent field accesses (i.e., retrieving a Tensor that
is stored somewher... | [
"def",
"get_default_nowrap_functions",
"(",
")",
"->",
"Set",
"[",
"Callable",
"]",
":",
"Tensor",
"=",
"torch",
".",
"Tensor",
"return",
"{",
"Tensor",
".",
"_base",
".",
"__get__",
",",
"Tensor",
".",
"grad",
".",
"__get__",
",",
"Tensor",
".",
"_grad"... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/overrides.py#L250-L272 | |
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/margin.py | python | Margin.prev_realised_pnl | (self) | return self._prev_realised_pnl | Gets the prev_realised_pnl of this Margin. # noqa: E501
:return: The prev_realised_pnl of this Margin. # noqa: E501
:rtype: float | Gets the prev_realised_pnl of this Margin. # noqa: E501 | [
"Gets",
"the",
"prev_realised_pnl",
"of",
"this",
"Margin",
".",
"#",
"noqa",
":",
"E501"
] | def prev_realised_pnl(self):
"""Gets the prev_realised_pnl of this Margin. # noqa: E501
:return: The prev_realised_pnl of this Margin. # noqa: E501
:rtype: float
"""
return self._prev_realised_pnl | [
"def",
"prev_realised_pnl",
"(",
"self",
")",
":",
"return",
"self",
".",
"_prev_realised_pnl"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/margin.py#L463-L470 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextObject_ConvertTenthsMMToPixels | (*args, **kwargs) | return _richtext.RichTextObject_ConvertTenthsMMToPixels(*args, **kwargs) | RichTextObject_ConvertTenthsMMToPixels(int ppi, int units, double scale=1.0) -> int | RichTextObject_ConvertTenthsMMToPixels(int ppi, int units, double scale=1.0) -> int | [
"RichTextObject_ConvertTenthsMMToPixels",
"(",
"int",
"ppi",
"int",
"units",
"double",
"scale",
"=",
"1",
".",
"0",
")",
"-",
">",
"int"
] | def RichTextObject_ConvertTenthsMMToPixels(*args, **kwargs):
"""RichTextObject_ConvertTenthsMMToPixels(int ppi, int units, double scale=1.0) -> int"""
return _richtext.RichTextObject_ConvertTenthsMMToPixels(*args, **kwargs) | [
"def",
"RichTextObject_ConvertTenthsMMToPixels",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextObject_ConvertTenthsMMToPixels",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L1453-L1455 | |
ApolloAuto/apollo | 463fb82f9e979d02dcb25044e60931293ab2dba0 | modules/tools/prediction/data_pipelines/mlp_train.py | python | setup_model | () | return model | Set up neural network based on keras.Sequential | Set up neural network based on keras.Sequential | [
"Set",
"up",
"neural",
"network",
"based",
"on",
"keras",
".",
"Sequential"
] | def setup_model():
"""
Set up neural network based on keras.Sequential
"""
model = Sequential()
model.add(
Dense(
dim_hidden_1,
input_dim=dim_input,
init='he_normal',
activation='relu',
W_regularizer=l2(0.01)))
model.add(
... | [
"def",
"setup_model",
"(",
")",
":",
"model",
"=",
"Sequential",
"(",
")",
"model",
".",
"add",
"(",
"Dense",
"(",
"dim_hidden_1",
",",
"input_dim",
"=",
"dim_input",
",",
"init",
"=",
"'he_normal'",
",",
"activation",
"=",
"'relu'",
",",
"W_regularizer",
... | https://github.com/ApolloAuto/apollo/blob/463fb82f9e979d02dcb25044e60931293ab2dba0/modules/tools/prediction/data_pipelines/mlp_train.py#L127-L157 | |
p4lang/PI | 38d87e81253feff9fff0660d662c885be78fb719 | tools/cpplint.py | python | _OutputFormat | () | return _cpplint_state.output_format | Gets the module's output format. | Gets the module's output format. | [
"Gets",
"the",
"module",
"s",
"output",
"format",
"."
] | def _OutputFormat():
"""Gets the module's output format."""
return _cpplint_state.output_format | [
"def",
"_OutputFormat",
"(",
")",
":",
"return",
"_cpplint_state",
".",
"output_format"
] | https://github.com/p4lang/PI/blob/38d87e81253feff9fff0660d662c885be78fb719/tools/cpplint.py#L1416-L1418 | |
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | _Filters | () | return _cpplint_state.filters | Returns the module's list of output filters, as a list. | Returns the module's list of output filters, as a list. | [
"Returns",
"the",
"module",
"s",
"list",
"of",
"output",
"filters",
"as",
"a",
"list",
"."
] | def _Filters():
"""Returns the module's list of output filters, as a list."""
return _cpplint_state.filters | [
"def",
"_Filters",
"(",
")",
":",
"return",
"_cpplint_state",
".",
"filters"
] | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L996-L998 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/models.py | python | PreparedRequest.prepare_body | (self, data, files, json=None) | Prepares the given HTTP body data. | Prepares the given HTTP body data. | [
"Prepares",
"the",
"given",
"HTTP",
"body",
"data",
"."
] | def prepare_body(self, data, files, json=None):
"""Prepares the given HTTP body data."""
# Check if file, fo, generator, iterator.
# If not, run through normal process.
# Nottin' on you.
body = None
content_type = None
if not data and json is not None:
... | [
"def",
"prepare_body",
"(",
"self",
",",
"data",
",",
"files",
",",
"json",
"=",
"None",
")",
":",
"# Check if file, fo, generator, iterator.",
"# If not, run through normal process.",
"# Nottin' on you.",
"body",
"=",
"None",
"content_type",
"=",
"None",
"if",
"not",... | 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/models.py#L455-L522 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/imputil.py | python | ImportManager.uninstall | (self) | Restore the previous import mechanism. | Restore the previous import mechanism. | [
"Restore",
"the",
"previous",
"import",
"mechanism",
"."
] | def uninstall(self):
"Restore the previous import mechanism."
self.namespace['__import__'] = self.previous_importer | [
"def",
"uninstall",
"(",
"self",
")",
":",
"self",
".",
"namespace",
"[",
"'__import__'",
"]",
"=",
"self",
".",
"previous_importer"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/imputil.py#L49-L51 | ||
msftguy/ssh-rd | a5f3a79daeac5844edebf01916c9613563f1c390 | _3rd/boost_1_48_0/tools/build/v2/build/targets.py | python | AbstractTarget.__init__ | (self, name, project, manager = None) | manager: the Manager object
name: name of the target
project: the project target to which this one belongs
manager:the manager object. If none, uses project.manager () | manager: the Manager object
name: name of the target
project: the project target to which this one belongs
manager:the manager object. If none, uses project.manager () | [
"manager",
":",
"the",
"Manager",
"object",
"name",
":",
"name",
"of",
"the",
"target",
"project",
":",
"the",
"project",
"target",
"to",
"which",
"this",
"one",
"belongs",
"manager",
":",
"the",
"manager",
"object",
".",
"If",
"none",
"uses",
"project",
... | def __init__ (self, name, project, manager = None):
""" manager: the Manager object
name: name of the target
project: the project target to which this one belongs
manager:the manager object. If none, uses project.manager ()
"""
assert (isinstanc... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"project",
",",
"manager",
"=",
"None",
")",
":",
"assert",
"(",
"isinstance",
"(",
"project",
",",
"ProjectTarget",
")",
")",
"# Note: it might seem that we don't need either name or project at all.",
"# However, ther... | https://github.com/msftguy/ssh-rd/blob/a5f3a79daeac5844edebf01916c9613563f1c390/_3rd/boost_1_48_0/tools/build/v2/build/targets.py#L271-L291 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/traitlets/py3/traitlets/config/application.py | python | Application.emit_alias_help | (self) | Yield the lines for alias part of the help. | Yield the lines for alias part of the help. | [
"Yield",
"the",
"lines",
"for",
"alias",
"part",
"of",
"the",
"help",
"."
] | def emit_alias_help(self):
"""Yield the lines for alias part of the help."""
if not self.aliases:
return
classdict = {}
for cls in self.classes:
# include all parents (up to, but excluding Configurable) in available names
for c in cls.mro()[:-3]:
... | [
"def",
"emit_alias_help",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"aliases",
":",
"return",
"classdict",
"=",
"{",
"}",
"for",
"cls",
"in",
"self",
".",
"classes",
":",
"# include all parents (up to, but excluding Configurable) in available names",
"for",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/traitlets/py3/traitlets/config/application.py#L386-L424 | ||
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/google/protobuf/internal/python_message.py | python | _AddSerializePartialToStringMethod | (message_descriptor, cls) | Helper for _AddMessageMethods(). | Helper for _AddMessageMethods(). | [
"Helper",
"for",
"_AddMessageMethods",
"()",
"."
] | def _AddSerializePartialToStringMethod(message_descriptor, cls):
"""Helper for _AddMessageMethods()."""
def SerializePartialToString(self):
out = StringIO()
self._InternalSerialize(out.write)
return out.getvalue()
cls.SerializePartialToString = SerializePartialToString
def InternalSerialize(self, ... | [
"def",
"_AddSerializePartialToStringMethod",
"(",
"message_descriptor",
",",
"cls",
")",
":",
"def",
"SerializePartialToString",
"(",
"self",
")",
":",
"out",
"=",
"StringIO",
"(",
")",
"self",
".",
"_InternalSerialize",
"(",
"out",
".",
"write",
")",
"return",
... | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/google/protobuf/internal/python_message.py#L772-L787 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/config_key.py | python | GetKeysDialog.keys_ok | (self, keys) | return False | Validity check on user's 'basic' keybinding selection.
Doesn't check the string produced by the advanced dialog because
'modifiers' isn't set. | Validity check on user's 'basic' keybinding selection. | [
"Validity",
"check",
"on",
"user",
"s",
"basic",
"keybinding",
"selection",
"."
] | def keys_ok(self, keys):
"""Validity check on user's 'basic' keybinding selection.
Doesn't check the string produced by the advanced dialog because
'modifiers' isn't set.
"""
final_key = self.list_keys_final.get('anchor')
modifiers = self.get_modifiers()
title = ... | [
"def",
"keys_ok",
"(",
"self",
",",
"keys",
")",
":",
"final_key",
"=",
"self",
".",
"list_keys_final",
".",
"get",
"(",
"'anchor'",
")",
"modifiers",
"=",
"self",
".",
"get_modifiers",
"(",
")",
"title",
"=",
"self",
".",
"keyerror_title",
"key_sequences"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/config_key.py#L274-L303 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py | python | PhotoImage.__init__ | (self, name=None, cnf={}, master=None, **kw) | Create an image with NAME.
Valid resource names: data, format, file, gamma, height, palette,
width. | Create an image with NAME. | [
"Create",
"an",
"image",
"with",
"NAME",
"."
] | def __init__(self, name=None, cnf={}, master=None, **kw):
"""Create an image with NAME.
Valid resource names: data, format, file, gamma, height, palette,
width."""
Image.__init__(self, 'photo', name, cnf, master, **kw) | [
"def",
"__init__",
"(",
"self",
",",
"name",
"=",
"None",
",",
"cnf",
"=",
"{",
"}",
",",
"master",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"Image",
".",
"__init__",
"(",
"self",
",",
"'photo'",
",",
"name",
",",
"cnf",
",",
"master",
",",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py#L3540-L3545 | ||
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | interpreter/llvm/src/tools/clang/tools/scan-build-py/libscanbuild/intercept.py | python | write_exec_trace | (filename, entry) | Write execution report file.
This method shall be sync with the execution report writer in interception
library. The entry in the file is a JSON objects.
:param filename: path to the output execution trace file,
:param entry: the Execution object to append to that file. | Write execution report file. | [
"Write",
"execution",
"report",
"file",
"."
] | def write_exec_trace(filename, entry):
""" Write execution report file.
This method shall be sync with the execution report writer in interception
library. The entry in the file is a JSON objects.
:param filename: path to the output execution trace file,
:param entry: the Execution object... | [
"def",
"write_exec_trace",
"(",
"filename",
",",
"entry",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'ab'",
")",
"as",
"handler",
":",
"pid",
"=",
"str",
"(",
"entry",
".",
"pid",
")",
"command",
"=",
"US",
".",
"join",
"(",
"entry",
".",
"cm... | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/interpreter/llvm/src/tools/clang/tools/scan-build-py/libscanbuild/intercept.py#L167-L180 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/_lib/_gcutils.py | python | assert_deallocated | (func, *args, **kwargs) | Context manager to check that object is deallocated
This is useful for checking that an object can be freed directly by
reference counting, without requiring gc to break reference cycles.
GC is disabled inside the context manager.
This check is not available on PyPy.
Parameters
----------
... | Context manager to check that object is deallocated | [
"Context",
"manager",
"to",
"check",
"that",
"object",
"is",
"deallocated"
] | def assert_deallocated(func, *args, **kwargs):
"""Context manager to check that object is deallocated
This is useful for checking that an object can be freed directly by
reference counting, without requiring gc to break reference cycles.
GC is disabled inside the context manager.
This check is not... | [
"def",
"assert_deallocated",
"(",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"IS_PYPY",
":",
"raise",
"RuntimeError",
"(",
"\"assert_deallocated is unavailable on PyPy\"",
")",
"with",
"gc_state",
"(",
"False",
")",
":",
"obj",
"=",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/_lib/_gcutils.py#L61-L105 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.