hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b23dca5689042e1e6f0742ea79c3dcfcc65d168c | sunlongbo/chromium | tools/json_schema_compiler/feature_compiler.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Parse | null | def Parse(self, parsed_json, shared_values):
"""Parses the feature from the given json value."""
for key in parsed_json.keys():
if key not in FEATURE_GRAMMAR:
self._AddKeyError(key, 'Unrecognized key')
for key, key_grammar in FEATURE_GRAMMAR.items():
self._ParseKey(key, parsed_json, shar... | Parses the feature from the given json value. | Parses the feature from the given json value. | [
"Parses",
"the",
"feature",
"from",
"the",
"given",
"json",
"value",
"."
] | def Parse(self, parsed_json, shared_values):
for key in parsed_json.keys():
if key not in FEATURE_GRAMMAR:
self._AddKeyError(key, 'Unrecognized key')
for key, key_grammar in FEATURE_GRAMMAR.items():
self._ParseKey(key, parsed_json, shared_values, key_grammar) | [
"def",
"Parse",
"(",
"self",
",",
"parsed_json",
",",
"shared_values",
")",
":",
"for",
"key",
"in",
"parsed_json",
".",
"keys",
"(",
")",
":",
"if",
"key",
"not",
"in",
"FEATURE_GRAMMAR",
":",
"self",
".",
"_AddKeyError",
"(",
"key",
",",
"'Unrecognized... | Parses the feature from the given json value. | [
"Parses",
"the",
"feature",
"from",
"the",
"given",
"json",
"value",
"."
] | [
"\"\"\"Parses the feature from the given json value.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "parsed_json",
"type": null
},
{
"param": "shared_values",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parsed_json",
"type": null,
"docstring": null,
"docstring_tok... |
b23dca5689042e1e6f0742ea79c3dcfcc65d168c | sunlongbo/chromium | tools/json_schema_compiler/feature_compiler.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _FindParent | <not_specific> | def _FindParent(self, feature_name, feature_value):
"""Checks to see if a feature has a parent. If it does, returns the
parent."""
no_parent = False
if type(feature_value) is list:
no_parent_values = ['noparent' in v for v in feature_value]
no_parent = all(no_parent_values)
assert no_p... | Checks to see if a feature has a parent. If it does, returns the
parent. | Checks to see if a feature has a parent. If it does, returns the
parent. | [
"Checks",
"to",
"see",
"if",
"a",
"feature",
"has",
"a",
"parent",
".",
"If",
"it",
"does",
"returns",
"the",
"parent",
"."
] | def _FindParent(self, feature_name, feature_value):
no_parent = False
if type(feature_value) is list:
no_parent_values = ['noparent' in v for v in feature_value]
no_parent = all(no_parent_values)
assert no_parent or not any(no_parent_values), (
'"%s:" All child features must cont... | [
"def",
"_FindParent",
"(",
"self",
",",
"feature_name",
",",
"feature_value",
")",
":",
"no_parent",
"=",
"False",
"if",
"type",
"(",
"feature_value",
")",
"is",
"list",
":",
"no_parent_values",
"=",
"[",
"'noparent'",
"in",
"v",
"for",
"v",
"in",
"feature... | Checks to see if a feature has a parent. | [
"Checks",
"to",
"see",
"if",
"a",
"feature",
"has",
"a",
"parent",
"."
] | [
"\"\"\"Checks to see if a feature has a parent. If it does, returns the\n parent.\"\"\"",
"# This recursion allows for a feature to have a parent that isn't a direct",
"# ancestor. For instance, we could have feature 'alpha', and feature",
"# 'alpha.child.child', where 'alpha.child.child' inherits from 'al... | [
{
"param": "self",
"type": null
},
{
"param": "feature_name",
"type": null
},
{
"param": "feature_value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "feature_name",
"type": null,
"docstring": null,
"docstring_to... |
b23dca5689042e1e6f0742ea79c3dcfcc65d168c | sunlongbo/chromium | tools/json_schema_compiler/feature_compiler.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Render | <not_specific> | def Render(self):
"""Returns the Code object for the body of the .cc file, which handles the
initialization of all features."""
c = Code()
c.Sblock()
for k in sorted(self._features.keys()):
c.Sblock('{')
feature = self._features[k]
c.Concat(feature.GetCode(self._feature_type))
... | Returns the Code object for the body of the .cc file, which handles the
initialization of all features. | Returns the Code object for the body of the .cc file, which handles the
initialization of all features. | [
"Returns",
"the",
"Code",
"object",
"for",
"the",
"body",
"of",
"the",
".",
"cc",
"file",
"which",
"handles",
"the",
"initialization",
"of",
"all",
"features",
"."
] | def Render(self):
c = Code()
c.Sblock()
for k in sorted(self._features.keys()):
c.Sblock('{')
feature = self._features[k]
c.Concat(feature.GetCode(self._feature_type))
c.Append('provider->AddFeature("%s", feature);' % k)
c.Eblock('}')
c.Eblock()
return c | [
"def",
"Render",
"(",
"self",
")",
":",
"c",
"=",
"Code",
"(",
")",
"c",
".",
"Sblock",
"(",
")",
"for",
"k",
"in",
"sorted",
"(",
"self",
".",
"_features",
".",
"keys",
"(",
")",
")",
":",
"c",
".",
"Sblock",
"(",
"'{'",
")",
"feature",
"=",... | Returns the Code object for the body of the .cc file, which handles the
initialization of all features. | [
"Returns",
"the",
"Code",
"object",
"for",
"the",
"body",
"of",
"the",
".",
"cc",
"file",
"which",
"handles",
"the",
"initialization",
"of",
"all",
"features",
"."
] | [
"\"\"\"Returns the Code object for the body of the .cc file, which handles the\n initialization of all features.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b255b19a515edda057eeba875258dda3b3deb99e | sunlongbo/chromium | tools/metrics/histograms/histogram_paths.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _FindHistogramsXmlFiles | <not_specific> | def _FindHistogramsXmlFiles():
"""Gets a list relative path to all histograms xmls under metadata/."""
files = []
for dir_name, _, file_list in os.walk(PATH_TO_METADATA_DIR):
for filename in file_list:
if (filename == 'histograms.xml'
or filename == 'histogram_suffixes_list.xml'):
# Co... | Gets a list relative path to all histograms xmls under metadata/. | Gets a list relative path to all histograms xmls under metadata/. | [
"Gets",
"a",
"list",
"relative",
"path",
"to",
"all",
"histograms",
"xmls",
"under",
"metadata",
"/",
"."
] | def _FindHistogramsXmlFiles():
files = []
for dir_name, _, file_list in os.walk(PATH_TO_METADATA_DIR):
for filename in file_list:
if (filename == 'histograms.xml'
or filename == 'histogram_suffixes_list.xml'):
file_path = os.path.relpath(os.path.join(dir_name, filename),
... | [
"def",
"_FindHistogramsXmlFiles",
"(",
")",
":",
"files",
"=",
"[",
"]",
"for",
"dir_name",
",",
"_",
",",
"file_list",
"in",
"os",
".",
"walk",
"(",
"PATH_TO_METADATA_DIR",
")",
":",
"for",
"filename",
"in",
"file_list",
":",
"if",
"(",
"filename",
"=="... | Gets a list relative path to all histograms xmls under metadata/. | [
"Gets",
"a",
"list",
"relative",
"path",
"to",
"all",
"histograms",
"xmls",
"under",
"metadata",
"/",
"."
] | [
"\"\"\"Gets a list relative path to all histograms xmls under metadata/.\"\"\"",
"# Compute the relative path of the histograms xml file."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
4a13080ba9fb7e4b45111e0f195dbce3a4cfb728 | sunlongbo/chromium | content/test/gpu/gpu_tests/gpu_integration_test_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RunIntegrationTest | null | def _RunIntegrationTest(self, test_args):
"""Runs an integration and asserts fail/success/skip expectations.
Args:
test_args: A _IntegrationTestArgs instance to use.
"""
config = chromium_config.ChromiumConfig(
top_level_dir=path_util.GetGpuTestDir(),
benchmark_dirs=[
... | Runs an integration and asserts fail/success/skip expectations.
Args:
test_args: A _IntegrationTestArgs instance to use.
| Runs an integration and asserts fail/success/skip expectations. | [
"Runs",
"an",
"integration",
"and",
"asserts",
"fail",
"/",
"success",
"/",
"skip",
"expectations",
"."
] | def _RunIntegrationTest(self, test_args):
config = chromium_config.ChromiumConfig(
top_level_dir=path_util.GetGpuTestDir(),
benchmark_dirs=[
os.path.join(path_util.GetGpuTestDir(), 'unittest_data')
])
with binary_manager.TemporarilyReplaceBinaryManager(None), \
tempf... | [
"def",
"_RunIntegrationTest",
"(",
"self",
",",
"test_args",
")",
":",
"config",
"=",
"chromium_config",
".",
"ChromiumConfig",
"(",
"top_level_dir",
"=",
"path_util",
".",
"GetGpuTestDir",
"(",
")",
",",
"benchmark_dirs",
"=",
"[",
"os",
".",
"path",
".",
"... | Runs an integration and asserts fail/success/skip expectations. | [
"Runs",
"an",
"integration",
"and",
"asserts",
"fail",
"/",
"success",
"/",
"skip",
"expectations",
"."
] | [
"\"\"\"Runs an integration and asserts fail/success/skip expectations.\n\n Args:\n test_args: A _IntegrationTestArgs instance to use.\n \"\"\"",
"# We are processing ChromiumConfig instance and getting the argument",
"# list. Then we pass it directly to run_browser_tests.RunTests. If",
"# we called... | [
{
"param": "self",
"type": null
},
{
"param": "test_args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "test_args",
"type": null,
"docstring": "A _IntegrationTestArgs inst... |
4a1c73fcf82f5a05844ac9673964c9863041075f | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AddComputedData | <not_specific> | def AddComputedData(module):
"""Adds computed data to the given module. The data is computed once and
used repeatedly in the generation process."""
def _AddStructComputedData(exported, struct):
struct.packed = pack.PackedStruct(struct)
struct.bytes = pack.GetByteLayout(struct.packed)
struct.versions ... | Adds computed data to the given module. The data is computed once and
used repeatedly in the generation process. | Adds computed data to the given module. The data is computed once and
used repeatedly in the generation process. | [
"Adds",
"computed",
"data",
"to",
"the",
"given",
"module",
".",
"The",
"data",
"is",
"computed",
"once",
"and",
"used",
"repeatedly",
"in",
"the",
"generation",
"process",
"."
] | def AddComputedData(module):
def _AddStructComputedData(exported, struct):
struct.packed = pack.PackedStruct(struct)
struct.bytes = pack.GetByteLayout(struct.packed)
struct.versions = pack.GetVersionInfo(struct.packed)
struct.exported = exported
def _AddInterfaceComputedData(interface):
interfac... | [
"def",
"AddComputedData",
"(",
"module",
")",
":",
"def",
"_AddStructComputedData",
"(",
"exported",
",",
"struct",
")",
":",
"struct",
".",
"packed",
"=",
"pack",
".",
"PackedStruct",
"(",
"struct",
")",
"struct",
".",
"bytes",
"=",
"pack",
".",
"GetByteL... | Adds computed data to the given module. | [
"Adds",
"computed",
"data",
"to",
"the",
"given",
"module",
"."
] | [
"\"\"\"Adds computed data to the given module. The data is computed once and\n used repeatedly in the generation process.\"\"\"",
"# this field is never scrambled",
"\"\"\"Converts a method's parameters into the fields of a struct.\"\"\"",
"\"\"\"Converts a method's response_parameters into the fields of a s... | [
{
"param": "module",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "module",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a1c73fcf82f5a05844ac9673964c9863041075f | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetStructFromMethod | <not_specific> | def _GetStructFromMethod(method):
"""Converts a method's parameters into the fields of a struct."""
params_class = "%s_%s_Params" % (method.interface.mojom_name,
method.mojom_name)
struct = mojom.Struct(params_class,
module=method.interface.modu... | Converts a method's parameters into the fields of a struct. | Converts a method's parameters into the fields of a struct. | [
"Converts",
"a",
"method",
"'",
"s",
"parameters",
"into",
"the",
"fields",
"of",
"a",
"struct",
"."
] | def _GetStructFromMethod(method):
params_class = "%s_%s_Params" % (method.interface.mojom_name,
method.mojom_name)
struct = mojom.Struct(params_class,
module=method.interface.module,
attributes={})
for param in method.p... | [
"def",
"_GetStructFromMethod",
"(",
"method",
")",
":",
"params_class",
"=",
"\"%s_%s_Params\"",
"%",
"(",
"method",
".",
"interface",
".",
"mojom_name",
",",
"method",
".",
"mojom_name",
")",
"struct",
"=",
"mojom",
".",
"Struct",
"(",
"params_class",
",",
... | Converts a method's parameters into the fields of a struct. | [
"Converts",
"a",
"method",
"'",
"s",
"parameters",
"into",
"the",
"fields",
"of",
"a",
"struct",
"."
] | [
"\"\"\"Converts a method's parameters into the fields of a struct.\"\"\""
] | [
{
"param": "method",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "method",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a1c73fcf82f5a05844ac9673964c9863041075f | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetResponseStructFromMethod | <not_specific> | def _GetResponseStructFromMethod(method):
"""Converts a method's response_parameters into the fields of a struct."""
params_class = "%s_%s_ResponseParams" % (method.interface.mojom_name,
method.mojom_name)
struct = mojom.Struct(params_class,
... | Converts a method's response_parameters into the fields of a struct. | Converts a method's response_parameters into the fields of a struct. | [
"Converts",
"a",
"method",
"'",
"s",
"response_parameters",
"into",
"the",
"fields",
"of",
"a",
"struct",
"."
] | def _GetResponseStructFromMethod(method):
params_class = "%s_%s_ResponseParams" % (method.interface.mojom_name,
method.mojom_name)
struct = mojom.Struct(params_class,
module=method.interface.module,
attributes={})
... | [
"def",
"_GetResponseStructFromMethod",
"(",
"method",
")",
":",
"params_class",
"=",
"\"%s_%s_ResponseParams\"",
"%",
"(",
"method",
".",
"interface",
".",
"mojom_name",
",",
"method",
".",
"mojom_name",
")",
"struct",
"=",
"mojom",
".",
"Struct",
"(",
"params_c... | Converts a method's response_parameters into the fields of a struct. | [
"Converts",
"a",
"method",
"'",
"s",
"response_parameters",
"into",
"the",
"fields",
"of",
"a",
"struct",
"."
] | [
"\"\"\"Converts a method's response_parameters into the fields of a struct.\"\"\""
] | [
{
"param": "method",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "method",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a3441d09f08c3f42a0790be7b3830bb45638c60 | sunlongbo/chromium | chrome/test/mini_installer/update_lastrun.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | UpdateLastrun | <not_specific> | def UpdateLastrun(client_state_key_path):
""" Updates Chrome's "lastrun" value in the registry to the current time.
Args:
client_state_key_path: The path to Chrome's ClientState key in the
registry.
"""
# time.time returns seconds since the Unix epoch. Chrome uses microseconds
#... | Updates Chrome's "lastrun" value in the registry to the current time.
Args:
client_state_key_path: The path to Chrome's ClientState key in the
registry.
| Updates Chrome's "lastrun" value in the registry to the current time. | [
"Updates",
"Chrome",
"'",
"s",
"\"",
"lastrun",
"\"",
"value",
"in",
"the",
"registry",
"to",
"the",
"current",
"time",
"."
] | def UpdateLastrun(client_state_key_path):
now_us = str(int(time.time() * 1000000 + 11644473600000000L))
try:
with _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, client_state_key_path,
0, _winreg.KEY_SET_VALUE
| _winreg.KEY_WOW64_32KEY) as key:
... | [
"def",
"UpdateLastrun",
"(",
"client_state_key_path",
")",
":",
"now_us",
"=",
"str",
"(",
"int",
"(",
"time",
".",
"time",
"(",
")",
"*",
"1000000",
"+",
"11644473600000000L",
")",
")",
"try",
":",
"with",
"_winreg",
".",
"OpenKey",
"(",
"_winreg",
".",... | Updates Chrome's "lastrun" value in the registry to the current time. | [
"Updates",
"Chrome",
"'",
"s",
"\"",
"lastrun",
"\"",
"value",
"in",
"the",
"registry",
"to",
"the",
"current",
"time",
"."
] | [
"\"\"\" Updates Chrome's \"lastrun\" value in the registry to the current time.\n\n Args:\n client_state_key_path: The path to Chrome's ClientState key in the\n registry.\n \"\"\"",
"# time.time returns seconds since the Unix epoch. Chrome uses microseconds",
"# since the Windows epoch. ... | [
{
"param": "client_state_key_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "client_state_key_path",
"type": null,
"docstring": "The path to Chrome's ClientState key in the\nregistry.",
"docstring_tokens": [
"The",
"path",
"to",
"Chrome",
"'",
"s",
... |
7a581d4108019aa487d4396180d89aa55d9ca4cf | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | is_always_false | <not_specific> | def is_always_false(self):
"""
The expression is always False, and code generators have chances of
optimizations.
"""
return self._is_always_false |
The expression is always False, and code generators have chances of
optimizations.
| The expression is always False, and code generators have chances of
optimizations. | [
"The",
"expression",
"is",
"always",
"False",
"and",
"code",
"generators",
"have",
"chances",
"of",
"optimizations",
"."
] | def is_always_false(self):
return self._is_always_false | [
"def",
"is_always_false",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_always_false"
] | The expression is always False, and code generators have chances of
optimizations. | [
"The",
"expression",
"is",
"always",
"False",
"and",
"code",
"generators",
"have",
"chances",
"of",
"optimizations",
"."
] | [
"\"\"\"\n The expression is always False, and code generators have chances of\n optimizations.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7a581d4108019aa487d4396180d89aa55d9ca4cf | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | is_always_true | <not_specific> | def is_always_true(self):
"""
The expression is always True, and code generators have chances of
optimizations.
"""
return self._is_always_true |
The expression is always True, and code generators have chances of
optimizations.
| The expression is always True, and code generators have chances of
optimizations. | [
"The",
"expression",
"is",
"always",
"True",
"and",
"code",
"generators",
"have",
"chances",
"of",
"optimizations",
"."
] | def is_always_true(self):
return self._is_always_true | [
"def",
"is_always_true",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_always_true"
] | The expression is always True, and code generators have chances of
optimizations. | [
"The",
"expression",
"is",
"always",
"True",
"and",
"code",
"generators",
"have",
"chances",
"of",
"optimizations",
"."
] | [
"\"\"\"\n The expression is always True, and code generators have chances of\n optimizations.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7a581d4108019aa487d4396180d89aa55d9ca4cf | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | expr_from_exposure | <not_specific> | def expr_from_exposure(exposure,
global_names=None,
may_use_feature_selector=False):
"""
Returns an expression to determine whether this property should be exposed
or not.
Args:
exposure: web_idl.Exposure of the target construct.
global_name... |
Returns an expression to determine whether this property should be exposed
or not.
Args:
exposure: web_idl.Exposure of the target construct.
global_names: When specified, it's taken into account that the global
object implements |global_names|.
may_use_feature_selector:... | Returns an expression to determine whether this property should be exposed
or not. | [
"Returns",
"an",
"expression",
"to",
"determine",
"whether",
"this",
"property",
"should",
"be",
"exposed",
"or",
"not",
"."
] | def expr_from_exposure(exposure,
global_names=None,
may_use_feature_selector=False):
assert isinstance(exposure, web_idl.Exposure)
assert (global_names is None
or (isinstance(global_names, (list, tuple))
and all(isinstance(name, str) for ... | [
"def",
"expr_from_exposure",
"(",
"exposure",
",",
"global_names",
"=",
"None",
",",
"may_use_feature_selector",
"=",
"False",
")",
":",
"assert",
"isinstance",
"(",
"exposure",
",",
"web_idl",
".",
"Exposure",
")",
"assert",
"(",
"global_names",
"is",
"None",
... | Returns an expression to determine whether this property should be exposed
or not. | [
"Returns",
"an",
"expression",
"to",
"determine",
"whether",
"this",
"property",
"should",
"be",
"exposed",
"or",
"not",
"."
] | [
"\"\"\"\n Returns an expression to determine whether this property should be exposed\n or not.\n\n Args:\n exposure: web_idl.Exposure of the target construct.\n global_names: When specified, it's taken into account that the global\n object implements |global_names|.\n may_us... | [
{
"param": "exposure",
"type": null
},
{
"param": "global_names",
"type": null
},
{
"param": "may_use_feature_selector",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "exposure",
"type": null,
"docstring": "web_idl.Exposure of the target construct.",
"docstring_tokens": [
"web_idl",
".",
"Exposure",
"of",
"the",
"target",
"construct",
... |
a232ee38a9598c18666771c07c271eb6b2a4d2ea | sunlongbo/chromium | tools/cr/cr/loader.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _TryImport | <not_specific> | def _TryImport(name):
"""Try to import a module or package if it is not already imported."""
try:
return _Import(name)
except ImportError:
if cr.context.verbose:
print('Warning: Failed to load module', name)
return None | Try to import a module or package if it is not already imported. | Try to import a module or package if it is not already imported. | [
"Try",
"to",
"import",
"a",
"module",
"or",
"package",
"if",
"it",
"is",
"not",
"already",
"imported",
"."
] | def _TryImport(name):
try:
return _Import(name)
except ImportError:
if cr.context.verbose:
print('Warning: Failed to load module', name)
return None | [
"def",
"_TryImport",
"(",
"name",
")",
":",
"try",
":",
"return",
"_Import",
"(",
"name",
")",
"except",
"ImportError",
":",
"if",
"cr",
".",
"context",
".",
"verbose",
":",
"print",
"(",
"'Warning: Failed to load module'",
",",
"name",
")",
"return",
"Non... | Try to import a module or package if it is not already imported. | [
"Try",
"to",
"import",
"a",
"module",
"or",
"package",
"if",
"it",
"is",
"not",
"already",
"imported",
"."
] | [
"\"\"\"Try to import a module or package if it is not already imported.\"\"\""
] | [
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a232ee38a9598c18666771c07c271eb6b2a4d2ea | sunlongbo/chromium | tools/cr/cr/loader.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ScanPackage | <not_specific> | def _ScanPackage(package):
"""Scan a package for child packages and modules."""
modules = []
# Recurse sub folders.
for path in package.__path__:
try:
basenames = sorted(os.listdir(path))
except OSError:
basenames = []
packages = []
for basename in basenames:
fullpath = os.path... | Scan a package for child packages and modules. | Scan a package for child packages and modules. | [
"Scan",
"a",
"package",
"for",
"child",
"packages",
"and",
"modules",
"."
] | def _ScanPackage(package):
modules = []
for path in package.__path__:
try:
basenames = sorted(os.listdir(path))
except OSError:
basenames = []
packages = []
for basename in basenames:
fullpath = os.path.join(path, basename)
if os.path.isdir(fullpath):
name = '.'.join(... | [
"def",
"_ScanPackage",
"(",
"package",
")",
":",
"modules",
"=",
"[",
"]",
"for",
"path",
"in",
"package",
".",
"__path__",
":",
"try",
":",
"basenames",
"=",
"sorted",
"(",
"os",
".",
"listdir",
"(",
"path",
")",
")",
"except",
"OSError",
":",
"base... | Scan a package for child packages and modules. | [
"Scan",
"a",
"package",
"for",
"child",
"packages",
"and",
"modules",
"."
] | [
"\"\"\"Scan a package for child packages and modules.\"\"\"",
"# Recurse sub folders."
] | [
{
"param": "package",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "package",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a232ee38a9598c18666771c07c271eb6b2a4d2ea | sunlongbo/chromium | tools/cr/cr/loader.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Scan | null | def Scan():
"""Scans from the cr package down, loading modules as needed.
This finds all packages and modules below the cr package, by scanning the
file system. It imports all the packages, and then runs post import hooks on
each module to do any automated work. One example of this is the hook that
finds all... | Scans from the cr package down, loading modules as needed.
This finds all packages and modules below the cr package, by scanning the
file system. It imports all the packages, and then runs post import hooks on
each module to do any automated work. One example of this is the hook that
finds all classes that ext... | Scans from the cr package down, loading modules as needed.
This finds all packages and modules below the cr package, by scanning the
file system. It imports all the packages, and then runs post import hooks on
each module to do any automated work. One example of this is the hook that
finds all classes that extend AutoE... | [
"Scans",
"from",
"the",
"cr",
"package",
"down",
"loading",
"modules",
"as",
"needed",
".",
"This",
"finds",
"all",
"packages",
"and",
"modules",
"below",
"the",
"cr",
"package",
"by",
"scanning",
"the",
"file",
"system",
".",
"It",
"imports",
"all",
"the"... | def Scan():
modules = _ScanPackage(cr)
for module in modules:
_ScanModule(module) | [
"def",
"Scan",
"(",
")",
":",
"modules",
"=",
"_ScanPackage",
"(",
"cr",
")",
"for",
"module",
"in",
"modules",
":",
"_ScanModule",
"(",
"module",
")"
] | Scans from the cr package down, loading modules as needed. | [
"Scans",
"from",
"the",
"cr",
"package",
"down",
"loading",
"modules",
"as",
"needed",
"."
] | [
"\"\"\"Scans from the cr package down, loading modules as needed.\n\n This finds all packages and modules below the cr package, by scanning the\n file system. It imports all the packages, and then runs post import hooks on\n each module to do any automated work. One example of this is the hook that\n finds all ... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
a23536e5ec891297cc72c917439b162556c75ef1 | sunlongbo/chromium | tools/android/memdump/memsymbols.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetResidentPagesSet | <not_specific> | def _GetResidentPagesSet(memdump_contents, lib_name, verbose):
"""Parses the memdump output and extracts the resident page set for lib_name.
Args:
memdump_contents: Array of strings (lines) of a memdump output.
lib_name: A string containing the name of the library.so to be matched.
verbose: Print a verb... | Parses the memdump output and extracts the resident page set for lib_name.
Args:
memdump_contents: Array of strings (lines) of a memdump output.
lib_name: A string containing the name of the library.so to be matched.
verbose: Print a verbose header for each mapping matched.
Returns:
A set of reside... | Parses the memdump output and extracts the resident page set for lib_name. | [
"Parses",
"the",
"memdump",
"output",
"and",
"extracts",
"the",
"resident",
"page",
"set",
"for",
"lib_name",
"."
] | def _GetResidentPagesSet(memdump_contents, lib_name, verbose):
resident_pages = set()
MAP_RX = re.compile(
r'^([0-9a-f]+)-([0-9a-f]+) ([\w-]+) ([0-9a-f]+) .* "(.*)" \[(.*)\]$')
for line in memdump_contents:
line = line.rstrip('\r\n')
if line.startswith('[ PID'):
continue
r = MAP_RX.match(l... | [
"def",
"_GetResidentPagesSet",
"(",
"memdump_contents",
",",
"lib_name",
",",
"verbose",
")",
":",
"resident_pages",
"=",
"set",
"(",
")",
"MAP_RX",
"=",
"re",
".",
"compile",
"(",
"r'^([0-9a-f]+)-([0-9a-f]+) ([\\w-]+) ([0-9a-f]+) .* \"(.*)\" \\[(.*)\\]$'",
")",
"for",
... | Parses the memdump output and extracts the resident page set for lib_name. | [
"Parses",
"the",
"memdump",
"output",
"and",
"extracts",
"the",
"resident",
"page",
"set",
"for",
"lib_name",
"."
] | [
"\"\"\"Parses the memdump output and extracts the resident page set for lib_name.\n Args:\n memdump_contents: Array of strings (lines) of a memdump output.\n lib_name: A string containing the name of the library.so to be matched.\n verbose: Print a verbose header for each mapping matched.\n\n Returns:\n ... | [
{
"param": "memdump_contents",
"type": null
},
{
"param": "lib_name",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [
{
"docstring": "A set of resident pages (the key is the page index) for all the\nmappings matching .*lib_name.",
"docstring_tokens": [
"A",
"set",
"of",
"resident",
"pages",
"(",
"the",
"key",
"is",
"the",
... |
a24fb443dbccd2a545c22be738968ba898f116f0 | sunlongbo/chromium | tools/resources/list_unused_grit_header.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FilterResourceIds | <not_specific> | def FilterResourceIds(resource_id):
"""If the resource starts with IDR_, find its base resource id."""
if resource_id.startswith('IDR_'):
return GetBaseResourceId(resource_id)
return resource_id | If the resource starts with IDR_, find its base resource id. | If the resource starts with IDR_, find its base resource id. | [
"If",
"the",
"resource",
"starts",
"with",
"IDR_",
"find",
"its",
"base",
"resource",
"id",
"."
] | def FilterResourceIds(resource_id):
if resource_id.startswith('IDR_'):
return GetBaseResourceId(resource_id)
return resource_id | [
"def",
"FilterResourceIds",
"(",
"resource_id",
")",
":",
"if",
"resource_id",
".",
"startswith",
"(",
"'IDR_'",
")",
":",
"return",
"GetBaseResourceId",
"(",
"resource_id",
")",
"return",
"resource_id"
] | If the resource starts with IDR_, find its base resource id. | [
"If",
"the",
"resource",
"starts",
"with",
"IDR_",
"find",
"its",
"base",
"resource",
"id",
"."
] | [
"\"\"\"If the resource starts with IDR_, find its base resource id.\"\"\""
] | [
{
"param": "resource_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "resource_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a24fb443dbccd2a545c22be738968ba898f116f0 | sunlongbo/chromium | tools/resources/list_unused_grit_header.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetResourcesForNode | <not_specific> | def GetResourcesForNode(node, parent_file, resource_tag):
"""Recursively iterate through a node and extract resource names.
Args:
node: The node to iterate through.
parent_file: The file that contains node.
resource_tag: The resource tag to extract names from.
Returns:
A list of resource names.
... | Recursively iterate through a node and extract resource names.
Args:
node: The node to iterate through.
parent_file: The file that contains node.
resource_tag: The resource tag to extract names from.
Returns:
A list of resource names.
| Recursively iterate through a node and extract resource names. | [
"Recursively",
"iterate",
"through",
"a",
"node",
"and",
"extract",
"resource",
"names",
"."
] | def GetResourcesForNode(node, parent_file, resource_tag):
resources = []
for child in node.getchildren():
if child.tag == resource_tag:
resources.append(child.attrib['name'])
elif child.tag in IF_ELSE_THEN_TAGS:
resources.extend(GetResourcesForNode(child, parent_file, resource_tag))
elif chi... | [
"def",
"GetResourcesForNode",
"(",
"node",
",",
"parent_file",
",",
"resource_tag",
")",
":",
"resources",
"=",
"[",
"]",
"for",
"child",
"in",
"node",
".",
"getchildren",
"(",
")",
":",
"if",
"child",
".",
"tag",
"==",
"resource_tag",
":",
"resources",
... | Recursively iterate through a node and extract resource names. | [
"Recursively",
"iterate",
"through",
"a",
"node",
"and",
"extract",
"resource",
"names",
"."
] | [
"\"\"\"Recursively iterate through a node and extract resource names.\n\n Args:\n node: The node to iterate through.\n parent_file: The file that contains node.\n resource_tag: The resource tag to extract names from.\n\n Returns:\n A list of resource names.\n \"\"\"",
"# Handle the special case for... | [
{
"param": "node",
"type": null
},
{
"param": "parent_file",
"type": null
},
{
"param": "resource_tag",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of resource names.",
"docstring_tokens": [
"A",
"list",
"of",
"resource",
"names",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "node",
"type": null,
... |
a24fb443dbccd2a545c22be738968ba898f116f0 | sunlongbo/chromium | tools/resources/list_unused_grit_header.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FindNodeWithTag | <not_specific> | def FindNodeWithTag(node, tag):
"""Look through a node's children for a child node with a given tag.
Args:
root: The node to examine.
tag: The tag on a child node to look for.
Returns:
A child node with the given tag, or None.
"""
result = None
for n in node.getchildren():
if n.tag == tag:... | Look through a node's children for a child node with a given tag.
Args:
root: The node to examine.
tag: The tag on a child node to look for.
Returns:
A child node with the given tag, or None.
| Look through a node's children for a child node with a given tag. | [
"Look",
"through",
"a",
"node",
"'",
"s",
"children",
"for",
"a",
"child",
"node",
"with",
"a",
"given",
"tag",
"."
] | def FindNodeWithTag(node, tag):
result = None
for n in node.getchildren():
if n.tag == tag:
assert not result
result = n
return result | [
"def",
"FindNodeWithTag",
"(",
"node",
",",
"tag",
")",
":",
"result",
"=",
"None",
"for",
"n",
"in",
"node",
".",
"getchildren",
"(",
")",
":",
"if",
"n",
".",
"tag",
"==",
"tag",
":",
"assert",
"not",
"result",
"result",
"=",
"n",
"return",
"resu... | Look through a node's children for a child node with a given tag. | [
"Look",
"through",
"a",
"node",
"'",
"s",
"children",
"for",
"a",
"child",
"node",
"with",
"a",
"given",
"tag",
"."
] | [
"\"\"\"Look through a node's children for a child node with a given tag.\n\n Args:\n root: The node to examine.\n tag: The tag on a child node to look for.\n\n Returns:\n A child node with the given tag, or None.\n \"\"\""
] | [
{
"param": "node",
"type": null
},
{
"param": "tag",
"type": null
}
] | {
"returns": [
{
"docstring": "A child node with the given tag, or None.",
"docstring_tokens": [
"A",
"child",
"node",
"with",
"the",
"given",
"tag",
"or",
"None",
"."
],
"type": null
}
],
"raises": [],... |
a24fb443dbccd2a545c22be738968ba898f116f0 | sunlongbo/chromium | tools/resources/list_unused_grit_header.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetResourcesForGrdFile | <not_specific> | def GetResourcesForGrdFile(tree, grd_file):
"""Find all the message and include resources from a given grit file.
Args:
tree: The XML tree.
grd_file: The file that contains the XML tree.
Returns:
A list of resource names.
"""
root = tree.getroot()
assert root.tag == 'grit'
release_node = Fin... | Find all the message and include resources from a given grit file.
Args:
tree: The XML tree.
grd_file: The file that contains the XML tree.
Returns:
A list of resource names.
| Find all the message and include resources from a given grit file. | [
"Find",
"all",
"the",
"message",
"and",
"include",
"resources",
"from",
"a",
"given",
"grit",
"file",
"."
] | def GetResourcesForGrdFile(tree, grd_file):
root = tree.getroot()
assert root.tag == 'grit'
release_node = FindNodeWithTag(root, 'release')
assert release_node != None
resources = set()
for node_type in ('message', 'include', 'structure'):
resources_node = FindNodeWithTag(release_node, node_type + 's')
... | [
"def",
"GetResourcesForGrdFile",
"(",
"tree",
",",
"grd_file",
")",
":",
"root",
"=",
"tree",
".",
"getroot",
"(",
")",
"assert",
"root",
".",
"tag",
"==",
"'grit'",
"release_node",
"=",
"FindNodeWithTag",
"(",
"root",
",",
"'release'",
")",
"assert",
"rel... | Find all the message and include resources from a given grit file. | [
"Find",
"all",
"the",
"message",
"and",
"include",
"resources",
"from",
"a",
"given",
"grit",
"file",
"."
] | [
"\"\"\"Find all the message and include resources from a given grit file.\n\n Args:\n tree: The XML tree.\n grd_file: The file that contains the XML tree.\n\n Returns:\n A list of resource names.\n \"\"\""
] | [
{
"param": "tree",
"type": null
},
{
"param": "grd_file",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of resource names.",
"docstring_tokens": [
"A",
"list",
"of",
"resource",
"names",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "tree",
"type": null,
... |
a24fb443dbccd2a545c22be738968ba898f116f0 | sunlongbo/chromium | tools/resources/list_unused_grit_header.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetOutputFileForNode | <not_specific> | def GetOutputFileForNode(node):
"""Find the output file starting from a given node.
Args:
node: The root node to scan from.
Returns:
A grit header file name.
"""
output_file = None
for child in node.getchildren():
if child.tag == 'output':
if child.attrib['type'] == 'rc_header':
... | Find the output file starting from a given node.
Args:
node: The root node to scan from.
Returns:
A grit header file name.
| Find the output file starting from a given node. | [
"Find",
"the",
"output",
"file",
"starting",
"from",
"a",
"given",
"node",
"."
] | def GetOutputFileForNode(node):
output_file = None
for child in node.getchildren():
if child.tag == 'output':
if child.attrib['type'] == 'rc_header':
assert output_file is None
output_file = child.attrib['filename']
elif child.tag in IF_ELSE_THEN_TAGS:
child_output_file = GetOutp... | [
"def",
"GetOutputFileForNode",
"(",
"node",
")",
":",
"output_file",
"=",
"None",
"for",
"child",
"in",
"node",
".",
"getchildren",
"(",
")",
":",
"if",
"child",
".",
"tag",
"==",
"'output'",
":",
"if",
"child",
".",
"attrib",
"[",
"'type'",
"]",
"==",... | Find the output file starting from a given node. | [
"Find",
"the",
"output",
"file",
"starting",
"from",
"a",
"given",
"node",
"."
] | [
"\"\"\"Find the output file starting from a given node.\n\n Args:\n node: The root node to scan from.\n\n Returns:\n A grit header file name.\n \"\"\""
] | [
{
"param": "node",
"type": null
}
] | {
"returns": [
{
"docstring": "A grit header file name.",
"docstring_tokens": [
"A",
"grit",
"header",
"file",
"name",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "node",
"type": null,
"d... |
a24fb443dbccd2a545c22be738968ba898f116f0 | sunlongbo/chromium | tools/resources/list_unused_grit_header.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetOutputHeaderFile | <not_specific> | def GetOutputHeaderFile(tree):
"""Find the output file for a given tree.
Args:
tree: The tree to scan.
Returns:
A grit header file name.
"""
root = tree.getroot()
assert root.tag == 'grit'
output_node = FindNodeWithTag(root, 'outputs')
assert output_node != None
return GetOutputFileForNode(o... | Find the output file for a given tree.
Args:
tree: The tree to scan.
Returns:
A grit header file name.
| Find the output file for a given tree. | [
"Find",
"the",
"output",
"file",
"for",
"a",
"given",
"tree",
"."
] | def GetOutputHeaderFile(tree):
root = tree.getroot()
assert root.tag == 'grit'
output_node = FindNodeWithTag(root, 'outputs')
assert output_node != None
return GetOutputFileForNode(output_node) | [
"def",
"GetOutputHeaderFile",
"(",
"tree",
")",
":",
"root",
"=",
"tree",
".",
"getroot",
"(",
")",
"assert",
"root",
".",
"tag",
"==",
"'grit'",
"output_node",
"=",
"FindNodeWithTag",
"(",
"root",
",",
"'outputs'",
")",
"assert",
"output_node",
"!=",
"Non... | Find the output file for a given tree. | [
"Find",
"the",
"output",
"file",
"for",
"a",
"given",
"tree",
"."
] | [
"\"\"\"Find the output file for a given tree.\n\n Args:\n tree: The tree to scan.\n\n Returns:\n A grit header file name.\n \"\"\""
] | [
{
"param": "tree",
"type": null
}
] | {
"returns": [
{
"docstring": "A grit header file name.",
"docstring_tokens": [
"A",
"grit",
"header",
"file",
"name",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "tree",
"type": null,
"d... |
a24fb443dbccd2a545c22be738968ba898f116f0 | sunlongbo/chromium | tools/resources/list_unused_grit_header.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ShouldScanFile | <not_specific> | def ShouldScanFile(filename):
"""Return if the filename has one of the extensions below."""
extensions = ['.cc', '.cpp', '.h', '.mm']
file_extension = os.path.splitext(filename)[1]
return file_extension in extensions | Return if the filename has one of the extensions below. | Return if the filename has one of the extensions below. | [
"Return",
"if",
"the",
"filename",
"has",
"one",
"of",
"the",
"extensions",
"below",
"."
] | def ShouldScanFile(filename):
extensions = ['.cc', '.cpp', '.h', '.mm']
file_extension = os.path.splitext(filename)[1]
return file_extension in extensions | [
"def",
"ShouldScanFile",
"(",
"filename",
")",
":",
"extensions",
"=",
"[",
"'.cc'",
",",
"'.cpp'",
",",
"'.h'",
",",
"'.mm'",
"]",
"file_extension",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"[",
"1",
"]",
"return",
"file_extension"... | Return if the filename has one of the extensions below. | [
"Return",
"if",
"the",
"filename",
"has",
"one",
"of",
"the",
"extensions",
"below",
"."
] | [
"\"\"\"Return if the filename has one of the extensions below.\"\"\""
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a24fb443dbccd2a545c22be738968ba898f116f0 | sunlongbo/chromium | tools/resources/list_unused_grit_header.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | NeedsGritInclude | <not_specific> | def NeedsGritInclude(grit_header, resources, filename):
"""Return whether a file needs a given grit header or not.
Args:
grit_header: The grit header file name.
resources: The list of resource names in grit_header.
filename: The file to scan.
Returns:
True if the file should include the grit hea... | Return whether a file needs a given grit header or not.
Args:
grit_header: The grit header file name.
resources: The list of resource names in grit_header.
filename: The file to scan.
Returns:
True if the file should include the grit header.
| Return whether a file needs a given grit header or not. | [
"Return",
"whether",
"a",
"file",
"needs",
"a",
"given",
"grit",
"header",
"or",
"not",
"."
] | def NeedsGritInclude(grit_header, resources, filename):
SPECIAL_KEYWORDS = (
'#include "ui_localizer_table.h"',
'DECLARE_RESOURCE_ID',
)
with open(filename, 'rb') as f:
grit_header_line = grit_header + '"\n'
has_grit_header = False
while True:
line = f.readline()
if not... | [
"def",
"NeedsGritInclude",
"(",
"grit_header",
",",
"resources",
",",
"filename",
")",
":",
"SPECIAL_KEYWORDS",
"=",
"(",
"'#include \"ui_localizer_table.h\"'",
",",
"'DECLARE_RESOURCE_ID'",
",",
")",
"with",
"open",
"(",
"filename",
",",
"'rb'",
")",
"as",
"f",
... | Return whether a file needs a given grit header or not. | [
"Return",
"whether",
"a",
"file",
"needs",
"a",
"given",
"grit",
"header",
"or",
"not",
"."
] | [
"\"\"\"Return whether a file needs a given grit header or not.\n\n Args:\n grit_header: The grit header file name.\n resources: The list of resource names in grit_header.\n filename: The file to scan.\n\n Returns:\n True if the file should include the grit header.\n \"\"\"",
"# A list of special ke... | [
{
"param": "grit_header",
"type": null
},
{
"param": "resources",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [
{
"docstring": "True if the file should include the grit header.",
"docstring_tokens": [
"True",
"if",
"the",
"file",
"should",
"include",
"the",
"grit",
"header",
"."
],
"type": null
}
],
... |
ba5e0268563cb15aac0bb4202ed36c6522e0ffb5 | sunlongbo/chromium | tools/android/elf_compression/elf_headers.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParseBytes | null | def ParseBytes(self, data, offset):
"""Parses Entry fields from data starting at offset using _fields.
Args:
data: bytes.
offset: int. The start point of parsing.
"""
current_offset = offset
for field_name, field_size in self._fields:
value = int.from_bytes(
data[cur... | Parses Entry fields from data starting at offset using _fields.
Args:
data: bytes.
offset: int. The start point of parsing.
| Parses Entry fields from data starting at offset using _fields. | [
"Parses",
"Entry",
"fields",
"from",
"data",
"starting",
"at",
"offset",
"using",
"_fields",
"."
] | def ParseBytes(self, data, offset):
current_offset = offset
for field_name, field_size in self._fields:
value = int.from_bytes(
data[current_offset:current_offset + field_size],
byteorder=self.byte_order)
setattr(self, field_name, value)
current_offset += field_size | [
"def",
"ParseBytes",
"(",
"self",
",",
"data",
",",
"offset",
")",
":",
"current_offset",
"=",
"offset",
"for",
"field_name",
",",
"field_size",
"in",
"self",
".",
"_fields",
":",
"value",
"=",
"int",
".",
"from_bytes",
"(",
"data",
"[",
"current_offset",
... | Parses Entry fields from data starting at offset using _fields. | [
"Parses",
"Entry",
"fields",
"from",
"data",
"starting",
"at",
"offset",
"using",
"_fields",
"."
] | [
"\"\"\"Parses Entry fields from data starting at offset using _fields.\n\n Args:\n data: bytes.\n offset: int. The start point of parsing.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": null
},
{
"param": "offset",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [... |
ba5e0268563cb15aac0bb4202ed36c6522e0ffb5 | sunlongbo/chromium | tools/android/elf_compression/elf_headers.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ApplyKwargs | null | def ApplyKwargs(self, **kwargs):
"""Set the fields from kwargs matching the _fields array entries."""
for field_name, _ in self._fields:
if field_name not in kwargs:
logging.error('field_name %s not found in kwargs', field_name)
continue
setattr(self, field_name, kwargs[field_name]) | Set the fields from kwargs matching the _fields array entries. | Set the fields from kwargs matching the _fields array entries. | [
"Set",
"the",
"fields",
"from",
"kwargs",
"matching",
"the",
"_fields",
"array",
"entries",
"."
] | def ApplyKwargs(self, **kwargs):
for field_name, _ in self._fields:
if field_name not in kwargs:
logging.error('field_name %s not found in kwargs', field_name)
continue
setattr(self, field_name, kwargs[field_name]) | [
"def",
"ApplyKwargs",
"(",
"self",
",",
"**",
"kwargs",
")",
":",
"for",
"field_name",
",",
"_",
"in",
"self",
".",
"_fields",
":",
"if",
"field_name",
"not",
"in",
"kwargs",
":",
"logging",
".",
"error",
"(",
"'field_name %s not found in kwargs'",
",",
"f... | Set the fields from kwargs matching the _fields array entries. | [
"Set",
"the",
"fields",
"from",
"kwargs",
"matching",
"the",
"_fields",
"array",
"entries",
"."
] | [
"\"\"\"Set the fields from kwargs matching the _fields array entries.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ba5e0268563cb15aac0bb4202ed36c6522e0ffb5 | sunlongbo/chromium | tools/android/elf_compression/elf_headers.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ToBytes | <not_specific> | def ToBytes(self):
"""Returns byte representation of ELF entry."""
bytearr = bytearray()
for field_name, field_size in self._fields:
field_bytes = getattr(self, field_name).to_bytes(
field_size, byteorder=self.byte_order)
bytearr.extend(field_bytes)
return bytearr | Returns byte representation of ELF entry. | Returns byte representation of ELF entry. | [
"Returns",
"byte",
"representation",
"of",
"ELF",
"entry",
"."
] | def ToBytes(self):
bytearr = bytearray()
for field_name, field_size in self._fields:
field_bytes = getattr(self, field_name).to_bytes(
field_size, byteorder=self.byte_order)
bytearr.extend(field_bytes)
return bytearr | [
"def",
"ToBytes",
"(",
"self",
")",
":",
"bytearr",
"=",
"bytearray",
"(",
")",
"for",
"field_name",
",",
"field_size",
"in",
"self",
".",
"_fields",
":",
"field_bytes",
"=",
"getattr",
"(",
"self",
",",
"field_name",
")",
".",
"to_bytes",
"(",
"field_si... | Returns byte representation of ELF entry. | [
"Returns",
"byte",
"representation",
"of",
"ELF",
"entry",
"."
] | [
"\"\"\"Returns byte representation of ELF entry.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ba5e0268563cb15aac0bb4202ed36c6522e0ffb5 | sunlongbo/chromium | tools/android/elf_compression/elf_headers.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Create | <not_specific> | def Create(cls, byte_order, **kwargs):
"""Static wrapper around ApplyKwargs method.
Args:
byte_order: str. Either 'little' for little endian or 'big' for big
endian.
**kwargs: will be passed directly to the ApplyKwargs method.
"""
obj = cls(byte_order)
obj.ApplyKwargs(**kwargs)
... | Static wrapper around ApplyKwargs method.
Args:
byte_order: str. Either 'little' for little endian or 'big' for big
endian.
**kwargs: will be passed directly to the ApplyKwargs method.
| Static wrapper around ApplyKwargs method. | [
"Static",
"wrapper",
"around",
"ApplyKwargs",
"method",
"."
] | def Create(cls, byte_order, **kwargs):
obj = cls(byte_order)
obj.ApplyKwargs(**kwargs)
return obj | [
"def",
"Create",
"(",
"cls",
",",
"byte_order",
",",
"**",
"kwargs",
")",
":",
"obj",
"=",
"cls",
"(",
"byte_order",
")",
"obj",
".",
"ApplyKwargs",
"(",
"**",
"kwargs",
")",
"return",
"obj"
] | Static wrapper around ApplyKwargs method. | [
"Static",
"wrapper",
"around",
"ApplyKwargs",
"method",
"."
] | [
"\"\"\"Static wrapper around ApplyKwargs method.\n\n Args:\n byte_order: str. Either 'little' for little endian or 'big' for big\n endian.\n **kwargs: will be passed directly to the ApplyKwargs method.\n \"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "byte_order",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "byte_order",
"type": null,
"docstring": "str. Either 'little' for li... |
ba5e0268563cb15aac0bb4202ed36c6522e0ffb5 | sunlongbo/chromium | tools/android/elf_compression/elf_headers.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FromBytes | <not_specific> | def FromBytes(cls, byte_order, data, offset):
"""Static wrapper around ParseBytes method.
Args:
byte_order: str. Either 'little' for little endian or 'big' for big
endian.
data: bytes.
offset: int. The start point of parsing.
"""
obj = cls(byte_order)
obj.ParseBytes(data, ... | Static wrapper around ParseBytes method.
Args:
byte_order: str. Either 'little' for little endian or 'big' for big
endian.
data: bytes.
offset: int. The start point of parsing.
| Static wrapper around ParseBytes method. | [
"Static",
"wrapper",
"around",
"ParseBytes",
"method",
"."
] | def FromBytes(cls, byte_order, data, offset):
obj = cls(byte_order)
obj.ParseBytes(data, offset)
return obj | [
"def",
"FromBytes",
"(",
"cls",
",",
"byte_order",
",",
"data",
",",
"offset",
")",
":",
"obj",
"=",
"cls",
"(",
"byte_order",
")",
"obj",
".",
"ParseBytes",
"(",
"data",
",",
"offset",
")",
"return",
"obj"
] | Static wrapper around ParseBytes method. | [
"Static",
"wrapper",
"around",
"ParseBytes",
"method",
"."
] | [
"\"\"\"Static wrapper around ParseBytes method.\n\n Args:\n byte_order: str. Either 'little' for little endian or 'big' for big\n endian.\n data: bytes.\n offset: int. The start point of parsing.\n \"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "byte_order",
"type": null
},
{
"param": "data",
"type": null
},
{
"param": "offset",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "byte_order",
"type": null,
"docstring": "str. Either 'little' for li... |
ba5e0268563cb15aac0bb4202ed36c6522e0ffb5 | sunlongbo/chromium | tools/android/elf_compression/elf_headers.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SetStrName | null | def SetStrName(self, name):
"""Sets the resolved sh_name to provided str.
Changes made by this method WILL NOT propagate into data after PatchData
call.
Args:
name: str. Name to set.
"""
self._str_name = name | Sets the resolved sh_name to provided str.
Changes made by this method WILL NOT propagate into data after PatchData
call.
Args:
name: str. Name to set.
| Sets the resolved sh_name to provided str.
Changes made by this method WILL NOT propagate into data after PatchData
call. | [
"Sets",
"the",
"resolved",
"sh_name",
"to",
"provided",
"str",
".",
"Changes",
"made",
"by",
"this",
"method",
"WILL",
"NOT",
"propagate",
"into",
"data",
"after",
"PatchData",
"call",
"."
] | def SetStrName(self, name):
self._str_name = name | [
"def",
"SetStrName",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"_str_name",
"=",
"name"
] | Sets the resolved sh_name to provided str. | [
"Sets",
"the",
"resolved",
"sh_name",
"to",
"provided",
"str",
"."
] | [
"\"\"\"Sets the resolved sh_name to provided str.\n\n Changes made by this method WILL NOT propagate into data after PatchData\n call.\n\n Args:\n name: str. Name to set.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": "str. Name to set.",
"docst... |
ba5e0268563cb15aac0bb4202ed36c6522e0ffb5 | sunlongbo/chromium | tools/android/elf_compression/elf_headers.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetName | <not_specific> | def GetName(self, data, string_index):
"""Returns the name located on string_index table's offset.
Args:
data: bytearray. The file's data.
string_index: int. Offset from the beginning of the string table to the
required name.
"""
begin = self.sh_offset + string_index
end = data.... | Returns the name located on string_index table's offset.
Args:
data: bytearray. The file's data.
string_index: int. Offset from the beginning of the string table to the
required name.
| Returns the name located on string_index table's offset. | [
"Returns",
"the",
"name",
"located",
"on",
"string_index",
"table",
"'",
"s",
"offset",
"."
] | def GetName(self, data, string_index):
begin = self.sh_offset + string_index
end = data.find(0, begin)
if end == -1:
raise RuntimeError('Failed to find null terminator for StringTable entry')
return data[begin:end].decode('ascii') | [
"def",
"GetName",
"(",
"self",
",",
"data",
",",
"string_index",
")",
":",
"begin",
"=",
"self",
".",
"sh_offset",
"+",
"string_index",
"end",
"=",
"data",
".",
"find",
"(",
"0",
",",
"begin",
")",
"if",
"end",
"==",
"-",
"1",
":",
"raise",
"Runtim... | Returns the name located on string_index table's offset. | [
"Returns",
"the",
"name",
"located",
"on",
"string_index",
"table",
"'",
"s",
"offset",
"."
] | [
"\"\"\"Returns the name located on string_index table's offset.\n\n Args:\n data: bytearray. The file's data.\n string_index: int. Offset from the beginning of the string table to the\n required name.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": null
},
{
"param": "string_index",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": "bytearray. The file's data.",
... |
ba5e0268563cb15aac0bb4202ed36c6522e0ffb5 | sunlongbo/chromium | tools/android/elf_compression/elf_headers.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ReadByteOrder | <not_specific> | def _ReadByteOrder(self, data):
"""Reads and returns the file's byte order."""
ei_data = data[self._EI_DATA_OFFSET]
if ei_data == ElfHeader.EiData.ELFDATALSB:
return 'little'
elif ei_data == ElfHeader.EiData.ELFDATAMSB:
return 'big'
raise RuntimeError('Failed to parse ei_data') | Reads and returns the file's byte order. | Reads and returns the file's byte order. | [
"Reads",
"and",
"returns",
"the",
"file",
"'",
"s",
"byte",
"order",
"."
] | def _ReadByteOrder(self, data):
ei_data = data[self._EI_DATA_OFFSET]
if ei_data == ElfHeader.EiData.ELFDATALSB:
return 'little'
elif ei_data == ElfHeader.EiData.ELFDATAMSB:
return 'big'
raise RuntimeError('Failed to parse ei_data') | [
"def",
"_ReadByteOrder",
"(",
"self",
",",
"data",
")",
":",
"ei_data",
"=",
"data",
"[",
"self",
".",
"_EI_DATA_OFFSET",
"]",
"if",
"ei_data",
"==",
"ElfHeader",
".",
"EiData",
".",
"ELFDATALSB",
":",
"return",
"'little'",
"elif",
"ei_data",
"==",
"ElfHea... | Reads and returns the file's byte order. | [
"Reads",
"and",
"returns",
"the",
"file",
"'",
"s",
"byte",
"order",
"."
] | [
"\"\"\"Reads and returns the file's byte order.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [... |
ba5e0268563cb15aac0bb4202ed36c6522e0ffb5 | sunlongbo/chromium | tools/android/elf_compression/elf_headers.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AddProgramHeader | null | def AddProgramHeader(self, phdr):
"""Adds a new ProgramHeader entry correcting the e_phnum variable.
This method will increase the size of LOAD segment containing the program
headers without correcting the other offsets. It is up to the caller to
deal with the results. One way to avoid any problems wou... | Adds a new ProgramHeader entry correcting the e_phnum variable.
This method will increase the size of LOAD segment containing the program
headers without correcting the other offsets. It is up to the caller to
deal with the results. One way to avoid any problems would be to move
program headers to the ... | Adds a new ProgramHeader entry correcting the e_phnum variable.
This method will increase the size of LOAD segment containing the program
headers without correcting the other offsets. It is up to the caller to
deal with the results. One way to avoid any problems would be to move
program headers to the end of the file. | [
"Adds",
"a",
"new",
"ProgramHeader",
"entry",
"correcting",
"the",
"e_phnum",
"variable",
".",
"This",
"method",
"will",
"increase",
"the",
"size",
"of",
"LOAD",
"segment",
"containing",
"the",
"program",
"headers",
"without",
"correcting",
"the",
"other",
"offs... | def AddProgramHeader(self, phdr):
self.phdrs.append(phdr)
phdrs_size = self.e_phnum * self.e_phentsize
phdr_found = False
for phdr in self.GetProgramHeadersByType(ProgramHeader.Type.PT_LOAD):
if phdr.p_offset > self.e_phoff:
continue
if phdr.FilePositionEnd() < self.e_phoff + phdrs_s... | [
"def",
"AddProgramHeader",
"(",
"self",
",",
"phdr",
")",
":",
"self",
".",
"phdrs",
".",
"append",
"(",
"phdr",
")",
"phdrs_size",
"=",
"self",
".",
"e_phnum",
"*",
"self",
".",
"e_phentsize",
"phdr_found",
"=",
"False",
"for",
"phdr",
"in",
"self",
"... | Adds a new ProgramHeader entry correcting the e_phnum variable. | [
"Adds",
"a",
"new",
"ProgramHeader",
"entry",
"correcting",
"the",
"e_phnum",
"variable",
"."
] | [
"\"\"\"Adds a new ProgramHeader entry correcting the e_phnum variable.\n\n This method will increase the size of LOAD segment containing the program\n headers without correcting the other offsets. It is up to the caller to\n deal with the results. One way to avoid any problems would be to move\n program... | [
{
"param": "self",
"type": null
},
{
"param": "phdr",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "phdr",
"type": null,
"docstring": "ProgramHeader. Instance of Progr... |
ba5e0268563cb15aac0bb4202ed36c6522e0ffb5 | sunlongbo/chromium | tools/android/elf_compression/elf_headers.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _OrderProgramHeaders | <not_specific> | def _OrderProgramHeaders(self):
"""Orders program LOAD headers by p_vaddr to comply with standard."""
def HeaderToKey(phdr):
# ELF standard required PT_INTERP and PT_PHDR to be strictly before
# PT_LOAD.
if phdr.p_type == ProgramHeader.Type.PT_INTERP:
return (0, phdr.p_vaddr)
el... | Orders program LOAD headers by p_vaddr to comply with standard. | Orders program LOAD headers by p_vaddr to comply with standard. | [
"Orders",
"program",
"LOAD",
"headers",
"by",
"p_vaddr",
"to",
"comply",
"with",
"standard",
"."
] | def _OrderProgramHeaders(self):
def HeaderToKey(phdr):
if phdr.p_type == ProgramHeader.Type.PT_INTERP:
return (0, phdr.p_vaddr)
elif phdr.p_type == ProgramHeader.Type.PT_PHDR:
return (1, phdr.p_vaddr)
elif phdr.p_type == ProgramHeader.Type.PT_LOAD:
return (2, phdr.p_vaddr)
... | [
"def",
"_OrderProgramHeaders",
"(",
"self",
")",
":",
"def",
"HeaderToKey",
"(",
"phdr",
")",
":",
"if",
"phdr",
".",
"p_type",
"==",
"ProgramHeader",
".",
"Type",
".",
"PT_INTERP",
":",
"return",
"(",
"0",
",",
"phdr",
".",
"p_vaddr",
")",
"elif",
"ph... | Orders program LOAD headers by p_vaddr to comply with standard. | [
"Orders",
"program",
"LOAD",
"headers",
"by",
"p_vaddr",
"to",
"comply",
"with",
"standard",
"."
] | [
"\"\"\"Orders program LOAD headers by p_vaddr to comply with standard.\"\"\"",
"# ELF standard required PT_INTERP and PT_PHDR to be strictly before",
"# PT_LOAD.",
"# We want to preserve the order of non LOAD segments."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ba5e0268563cb15aac0bb4202ed36c6522e0ffb5 | sunlongbo/chromium | tools/android/elf_compression/elf_headers.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PatchData | null | def PatchData(self, data):
"""Patches the given data array to reflect all changes made to the header.
This method doesn't completely rewrite the data, instead it patches
inplace. Not only the ElfHeader is patched but all of its ProgramHeader
as well.
The important limitation is that this method do... | Patches the given data array to reflect all changes made to the header.
This method doesn't completely rewrite the data, instead it patches
inplace. Not only the ElfHeader is patched but all of its ProgramHeader
as well.
The important limitation is that this method doesn't take changes of sizes
an... | Patches the given data array to reflect all changes made to the header.
This method doesn't completely rewrite the data, instead it patches
inplace. Not only the ElfHeader is patched but all of its ProgramHeader
as well.
The important limitation is that this method doesn't take changes of sizes
and offsets into accoun... | [
"Patches",
"the",
"given",
"data",
"array",
"to",
"reflect",
"all",
"changes",
"made",
"to",
"the",
"header",
".",
"This",
"method",
"doesn",
"'",
"t",
"completely",
"rewrite",
"the",
"data",
"instead",
"it",
"patches",
"inplace",
".",
"Not",
"only",
"the"... | def PatchData(self, data):
elf_bytes = self.ToBytes()
data[:len(elf_bytes)] = elf_bytes
self._PatchProgramHeaders(data)
self._PatchSectionHeaders(data) | [
"def",
"PatchData",
"(",
"self",
",",
"data",
")",
":",
"elf_bytes",
"=",
"self",
".",
"ToBytes",
"(",
")",
"data",
"[",
":",
"len",
"(",
"elf_bytes",
")",
"]",
"=",
"elf_bytes",
"self",
".",
"_PatchProgramHeaders",
"(",
"data",
")",
"self",
".",
"_P... | Patches the given data array to reflect all changes made to the header. | [
"Patches",
"the",
"given",
"data",
"array",
"to",
"reflect",
"all",
"changes",
"made",
"to",
"the",
"header",
"."
] | [
"\"\"\"Patches the given data array to reflect all changes made to the header.\n\n This method doesn't completely rewrite the data, instead it patches\n inplace. Not only the ElfHeader is patched but all of its ProgramHeader\n as well.\n\n The important limitation is that this method doesn't take change... | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": "bytearray. The data array to be ... |
5f3c587e47aa970bfba71a9d7a49a4b6d9f0eaba | sunlongbo/chromium | tools/perf/core/benchmark_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetBenchmarkStoryInfo | <not_specific> | def GetBenchmarkStoryInfo(benchmark):
"""Return a list with StoryInfo objects for each story in a benchmark."""
stories = [
StoryInfo(name=story.name, description=DescribeStory(story),
tags=list(story.tags))
for story in GetBenchmarkStorySet(benchmark)
]
stories.sort(key=lambda s: s.... | Return a list with StoryInfo objects for each story in a benchmark. | Return a list with StoryInfo objects for each story in a benchmark. | [
"Return",
"a",
"list",
"with",
"StoryInfo",
"objects",
"for",
"each",
"story",
"in",
"a",
"benchmark",
"."
] | def GetBenchmarkStoryInfo(benchmark):
stories = [
StoryInfo(name=story.name, description=DescribeStory(story),
tags=list(story.tags))
for story in GetBenchmarkStorySet(benchmark)
]
stories.sort(key=lambda s: s.name)
return stories | [
"def",
"GetBenchmarkStoryInfo",
"(",
"benchmark",
")",
":",
"stories",
"=",
"[",
"StoryInfo",
"(",
"name",
"=",
"story",
".",
"name",
",",
"description",
"=",
"DescribeStory",
"(",
"story",
")",
",",
"tags",
"=",
"list",
"(",
"story",
".",
"tags",
")",
... | Return a list with StoryInfo objects for each story in a benchmark. | [
"Return",
"a",
"list",
"with",
"StoryInfo",
"objects",
"for",
"each",
"story",
"in",
"a",
"benchmark",
"."
] | [
"\"\"\"Return a list with StoryInfo objects for each story in a benchmark.\"\"\""
] | [
{
"param": "benchmark",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "benchmark",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5f3c587e47aa970bfba71a9d7a49a4b6d9f0eaba | sunlongbo/chromium | tools/perf/core/benchmark_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetBenchmarkStoryNames | <not_specific> | def GetBenchmarkStoryNames(benchmark):
"""Return the list of all stories names in the benchmark.
This guarantees the order of the stories in the list is exactly the same
of the order of stories to be run by benchmark.
"""
story_list = []
for story in GetBenchmarkStorySet(benchmark):
story_list.append(st... | Return the list of all stories names in the benchmark.
This guarantees the order of the stories in the list is exactly the same
of the order of stories to be run by benchmark.
| Return the list of all stories names in the benchmark.
This guarantees the order of the stories in the list is exactly the same
of the order of stories to be run by benchmark. | [
"Return",
"the",
"list",
"of",
"all",
"stories",
"names",
"in",
"the",
"benchmark",
".",
"This",
"guarantees",
"the",
"order",
"of",
"the",
"stories",
"in",
"the",
"list",
"is",
"exactly",
"the",
"same",
"of",
"the",
"order",
"of",
"stories",
"to",
"be",... | def GetBenchmarkStoryNames(benchmark):
story_list = []
for story in GetBenchmarkStorySet(benchmark):
story_list.append(story.name)
return story_list | [
"def",
"GetBenchmarkStoryNames",
"(",
"benchmark",
")",
":",
"story_list",
"=",
"[",
"]",
"for",
"story",
"in",
"GetBenchmarkStorySet",
"(",
"benchmark",
")",
":",
"story_list",
".",
"append",
"(",
"story",
".",
"name",
")",
"return",
"story_list"
] | Return the list of all stories names in the benchmark. | [
"Return",
"the",
"list",
"of",
"all",
"stories",
"names",
"in",
"the",
"benchmark",
"."
] | [
"\"\"\"Return the list of all stories names in the benchmark.\n This guarantees the order of the stories in the list is exactly the same\n of the order of stories to be run by benchmark.\n \"\"\""
] | [
{
"param": "benchmark",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "benchmark",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5f3c587e47aa970bfba71a9d7a49a4b6d9f0eaba | sunlongbo/chromium | tools/perf/core/benchmark_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | DescribeStory | <not_specific> | def DescribeStory(story):
"""Get the docstring title out of a given story."""
description = story.__doc__
if description:
return description.strip().splitlines()[0]
else:
return '' | Get the docstring title out of a given story. | Get the docstring title out of a given story. | [
"Get",
"the",
"docstring",
"title",
"out",
"of",
"a",
"given",
"story",
"."
] | def DescribeStory(story):
description = story.__doc__
if description:
return description.strip().splitlines()[0]
else:
return '' | [
"def",
"DescribeStory",
"(",
"story",
")",
":",
"description",
"=",
"story",
".",
"__doc__",
"if",
"description",
":",
"return",
"description",
".",
"strip",
"(",
")",
".",
"splitlines",
"(",
")",
"[",
"0",
"]",
"else",
":",
"return",
"''"
] | Get the docstring title out of a given story. | [
"Get",
"the",
"docstring",
"title",
"out",
"of",
"a",
"given",
"story",
"."
] | [
"\"\"\"Get the docstring title out of a given story.\"\"\""
] | [
{
"param": "story",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "story",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5f3e4ccc0a57a3dd6270cc51090eb75ec070b635 | sunlongbo/chromium | tools/cr/cr/targets/target.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreateTarget | <not_specific> | def CreateTarget(cls, target_name):
"""Attempts to build a target by name.
This searches the set of installed targets in priority order to see if any
of them are willing to handle the supplied name.
If a target cannot be found, the program will be aborted.
Args:
target_name: The name of the t... | Attempts to build a target by name.
This searches the set of installed targets in priority order to see if any
of them are willing to handle the supplied name.
If a target cannot be found, the program will be aborted.
Args:
target_name: The name of the target we are searching for.
Returns:
... | Attempts to build a target by name.
This searches the set of installed targets in priority order to see if any
of them are willing to handle the supplied name.
If a target cannot be found, the program will be aborted. | [
"Attempts",
"to",
"build",
"a",
"target",
"by",
"name",
".",
"This",
"searches",
"the",
"set",
"of",
"installed",
"targets",
"in",
"priority",
"order",
"to",
"see",
"if",
"any",
"of",
"them",
"are",
"willing",
"to",
"handle",
"the",
"supplied",
"name",
"... | def CreateTarget(cls, target_name):
target_clses = sorted(
cls.AllTargets(),
key=operator.attrgetter('PRIORITY'),
reverse=True
)
for handler in target_clses:
target = handler.Build(target_name)
if target:
if not target.valid:
print('Invalid target {0} as... | [
"def",
"CreateTarget",
"(",
"cls",
",",
"target_name",
")",
":",
"target_clses",
"=",
"sorted",
"(",
"cls",
".",
"AllTargets",
"(",
")",
",",
"key",
"=",
"operator",
".",
"attrgetter",
"(",
"'PRIORITY'",
")",
",",
"reverse",
"=",
"True",
")",
"for",
"h... | Attempts to build a target by name. | [
"Attempts",
"to",
"build",
"a",
"target",
"by",
"name",
"."
] | [
"\"\"\"Attempts to build a target by name.\n\n This searches the set of installed targets in priority order to see if any\n of them are willing to handle the supplied name.\n If a target cannot be found, the program will be aborted.\n Args:\n target_name: The name of the target we are searching for... | [
{
"param": "cls",
"type": null
},
{
"param": "target_name",
"type": null
}
] | {
"returns": [
{
"docstring": "The target that matched.",
"docstring_tokens": [
"The",
"target",
"that",
"matched",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": n... |
b2f8aa2a08fc9d8a5ddeda1032f3c94d0b41d2c8 | sunlongbo/chromium | tools/binary_size/libsupersize/dwarfdump_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testParseNonContiguousAddressRange | null | def testParseNonContiguousAddressRange(self):
"""Test parsing DW_TAG_compile_unit with non-contiguous address range."""
lines = [
'DW_TAG_compile_unit',
'DW_AT_name ("solution.cc")',
'DW_AT_low_pc (0x0)',
'DW_AT_ranges (0x1',
'[0x10, 0x21)',
'[0x31, 0x41))',
]... | Test parsing DW_TAG_compile_unit with non-contiguous address range. | Test parsing DW_TAG_compile_unit with non-contiguous address range. | [
"Test",
"parsing",
"DW_TAG_compile_unit",
"with",
"non",
"-",
"contiguous",
"address",
"range",
"."
] | def testParseNonContiguousAddressRange(self):
lines = [
'DW_TAG_compile_unit',
'DW_AT_name ("solution.cc")',
'DW_AT_low_pc (0x0)',
'DW_AT_ranges (0x1',
'[0x10, 0x21)',
'[0x31, 0x41))',
]
expected_info_list = [(0x10, 0x21, 'solution.cc'),
... | [
"def",
"testParseNonContiguousAddressRange",
"(",
"self",
")",
":",
"lines",
"=",
"[",
"'DW_TAG_compile_unit'",
",",
"'DW_AT_name (\"solution.cc\")'",
",",
"'DW_AT_low_pc (0x0)'",
",",
"'DW_AT_ranges (0x1'",
",",
"'[0x10, 0x21)'",
",",
"'[0x31, 0x41))'",
",",
"]",
"expect... | Test parsing DW_TAG_compile_unit with non-contiguous address range. | [
"Test",
"parsing",
"DW_TAG_compile_unit",
"with",
"non",
"-",
"contiguous",
"address",
"range",
"."
] | [
"\"\"\"Test parsing DW_TAG_compile_unit with non-contiguous address range.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b2f8aa2a08fc9d8a5ddeda1032f3c94d0b41d2c8 | sunlongbo/chromium | tools/binary_size/libsupersize/dwarfdump_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testParseNonContiguousAddressRangeOtherBrackets | null | def testParseNonContiguousAddressRangeOtherBrackets(self):
"""Test parsing DW_AT_ranges when non-standard brackets are used."""
lines = [
'DW_TAG_compile_unit',
'DW_AT_name ("solution.cc")',
'DW_AT_low_pc (0x0)',
'DW_AT_ranges [0x1',
'(0x10, 0x21)',
'[0x31, 0x41]]... | Test parsing DW_AT_ranges when non-standard brackets are used. | Test parsing DW_AT_ranges when non-standard brackets are used. | [
"Test",
"parsing",
"DW_AT_ranges",
"when",
"non",
"-",
"standard",
"brackets",
"are",
"used",
"."
] | def testParseNonContiguousAddressRangeOtherBrackets(self):
lines = [
'DW_TAG_compile_unit',
'DW_AT_name ("solution.cc")',
'DW_AT_low_pc (0x0)',
'DW_AT_ranges [0x1',
'(0x10, 0x21)',
'[0x31, 0x41]]',
]
expected_info_list = [(0x10, 0x21, 'solution.cc'),
... | [
"def",
"testParseNonContiguousAddressRangeOtherBrackets",
"(",
"self",
")",
":",
"lines",
"=",
"[",
"'DW_TAG_compile_unit'",
",",
"'DW_AT_name (\"solution.cc\")'",
",",
"'DW_AT_low_pc (0x0)'",
",",
"'DW_AT_ranges [0x1'",
",",
"'(0x10, 0x21)'",
",",
"'[0x31, 0x41]]'",
",",
"... | Test parsing DW_AT_ranges when non-standard brackets are used. | [
"Test",
"parsing",
"DW_AT_ranges",
"when",
"non",
"-",
"standard",
"brackets",
"are",
"used",
"."
] | [
"\"\"\"Test parsing DW_AT_ranges when non-standard brackets are used.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b2f8aa2a08fc9d8a5ddeda1032f3c94d0b41d2c8 | sunlongbo/chromium | tools/binary_size/libsupersize/dwarfdump_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testParseNonContiguousIgnoreEmptyRanges | null | def testParseNonContiguousIgnoreEmptyRanges(self):
"""Test that empty ranges are ignored when parsing DW_AT_ranges."""
lines = [
'DW_TAG_compile_unit',
'DW_AT_name ("solution.cc")',
'DW_AT_ranges (0x1',
'[0x1, 0x1)',
'[0x10, 0x21)',
'[0x22, 0x22)',
'[0x31,... | Test that empty ranges are ignored when parsing DW_AT_ranges. | Test that empty ranges are ignored when parsing DW_AT_ranges. | [
"Test",
"that",
"empty",
"ranges",
"are",
"ignored",
"when",
"parsing",
"DW_AT_ranges",
"."
] | def testParseNonContiguousIgnoreEmptyRanges(self):
lines = [
'DW_TAG_compile_unit',
'DW_AT_name ("solution.cc")',
'DW_AT_ranges (0x1',
'[0x1, 0x1)',
'[0x10, 0x21)',
'[0x22, 0x22)',
'[0x31, 0x41)',
'[0x42, 0x42))',
]
expected_info_list = [(0x10,... | [
"def",
"testParseNonContiguousIgnoreEmptyRanges",
"(",
"self",
")",
":",
"lines",
"=",
"[",
"'DW_TAG_compile_unit'",
",",
"'DW_AT_name (\"solution.cc\")'",
",",
"'DW_AT_ranges (0x1'",
",",
"'[0x1, 0x1)'",
",",
"'[0x10, 0x21)'",
",",
"'[0x22, 0x22)'",
",",
"'[0x31, 0x41)'",
... | Test that empty ranges are ignored when parsing DW_AT_ranges. | [
"Test",
"that",
"empty",
"ranges",
"are",
"ignored",
"when",
"parsing",
"DW_AT_ranges",
"."
] | [
"\"\"\"Test that empty ranges are ignored when parsing DW_AT_ranges.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b2f8aa2a08fc9d8a5ddeda1032f3c94d0b41d2c8 | sunlongbo/chromium | tools/binary_size/libsupersize/dwarfdump_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testParseContiguousAddressRange | null | def testParseContiguousAddressRange(self):
"""Test parsing DW_TAG_compile_unit with contiguous address range."""
lines = [
'DW_TAG_compile_unit',
'DW_AT_name ("solution.cc")',
'DW_AT_low_pc (0x1)',
'DW_AT_high_pc (0x10)',
]
expected_info_list = [
(0x1, 0x10, 'solu... | Test parsing DW_TAG_compile_unit with contiguous address range. | Test parsing DW_TAG_compile_unit with contiguous address range. | [
"Test",
"parsing",
"DW_TAG_compile_unit",
"with",
"contiguous",
"address",
"range",
"."
] | def testParseContiguousAddressRange(self):
lines = [
'DW_TAG_compile_unit',
'DW_AT_name ("solution.cc")',
'DW_AT_low_pc (0x1)',
'DW_AT_high_pc (0x10)',
]
expected_info_list = [
(0x1, 0x10, 'solution.cc'),
]
self.assertEqual(self._MakeRangeInfoList(expected_inf... | [
"def",
"testParseContiguousAddressRange",
"(",
"self",
")",
":",
"lines",
"=",
"[",
"'DW_TAG_compile_unit'",
",",
"'DW_AT_name (\"solution.cc\")'",
",",
"'DW_AT_low_pc (0x1)'",
",",
"'DW_AT_high_pc (0x10)'",
",",
"]",
"expected_info_list",
"=",
"[",
"(",
"0x1",
",",
"... | Test parsing DW_TAG_compile_unit with contiguous address range. | [
"Test",
"parsing",
"DW_TAG_compile_unit",
"with",
"contiguous",
"address",
"range",
"."
] | [
"\"\"\"Test parsing DW_TAG_compile_unit with contiguous address range.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b2f8aa2a08fc9d8a5ddeda1032f3c94d0b41d2c8 | sunlongbo/chromium | tools/binary_size/libsupersize/dwarfdump_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testParseSingleAddress | null | def testParseSingleAddress(self):
"""Test parsing DW_TAG_compile_unit with single address."""
lines = [
'DW_TAG_compile_unit',
'DW_AT_name ("solution.cc")',
'DW_AT_low_pc (0x10)',
]
expected_info_list = [
(0x10, 0x11, 'solution.cc'),
]
self.assertEqual(self._MakeR... | Test parsing DW_TAG_compile_unit with single address. | Test parsing DW_TAG_compile_unit with single address. | [
"Test",
"parsing",
"DW_TAG_compile_unit",
"with",
"single",
"address",
"."
] | def testParseSingleAddress(self):
lines = [
'DW_TAG_compile_unit',
'DW_AT_name ("solution.cc")',
'DW_AT_low_pc (0x10)',
]
expected_info_list = [
(0x10, 0x11, 'solution.cc'),
]
self.assertEqual(self._MakeRangeInfoList(expected_info_list),
dwarfdump... | [
"def",
"testParseSingleAddress",
"(",
"self",
")",
":",
"lines",
"=",
"[",
"'DW_TAG_compile_unit'",
",",
"'DW_AT_name (\"solution.cc\")'",
",",
"'DW_AT_low_pc (0x10)'",
",",
"]",
"expected_info_list",
"=",
"[",
"(",
"0x10",
",",
"0x11",
",",
"'solution.cc'",
")",
... | Test parsing DW_TAG_compile_unit with single address. | [
"Test",
"parsing",
"DW_TAG_compile_unit",
"with",
"single",
"address",
"."
] | [
"\"\"\"Test parsing DW_TAG_compile_unit with single address.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
66fcb0cdc892f66d7fe440a9c678ba2149fee228 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/controllers/web_test_finder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | filter_out_exact_negative_matches | <not_specific> | def filter_out_exact_negative_matches(tests, negative_matches):
"""Similar to filter_tests, but filters only negative match filters for more speed
With globbing disallowed, we can use sets, which have O(1) lookup time in
CPython. This allows for larger filter lists.
negative_filters is a list of lists... | Similar to filter_tests, but filters only negative match filters for more speed
With globbing disallowed, we can use sets, which have O(1) lookup time in
CPython. This allows for larger filter lists.
negative_filters is a list of lists of filters (because the user can pass the flag
multiple times
| Similar to filter_tests, but filters only negative match filters for more speed
With globbing disallowed, we can use sets, which have O(1) lookup time in
CPython. This allows for larger filter lists.
negative_filters is a list of lists of filters (because the user can pass the flag
multiple times | [
"Similar",
"to",
"filter_tests",
"but",
"filters",
"only",
"negative",
"match",
"filters",
"for",
"more",
"speed",
"With",
"globbing",
"disallowed",
"we",
"can",
"use",
"sets",
"which",
"have",
"O",
"(",
"1",
")",
"lookup",
"time",
"in",
"CPython",
".",
"T... | def filter_out_exact_negative_matches(tests, negative_matches):
filter_set = set(fil[1:] for fil in negative_matches)
return [test for test in tests if test not in filter_set] | [
"def",
"filter_out_exact_negative_matches",
"(",
"tests",
",",
"negative_matches",
")",
":",
"filter_set",
"=",
"set",
"(",
"fil",
"[",
"1",
":",
"]",
"for",
"fil",
"in",
"negative_matches",
")",
"return",
"[",
"test",
"for",
"test",
"in",
"tests",
"if",
"... | Similar to filter_tests, but filters only negative match filters for more speed
With globbing disallowed, we can use sets, which have O(1) lookup time in
CPython. | [
"Similar",
"to",
"filter_tests",
"but",
"filters",
"only",
"negative",
"match",
"filters",
"for",
"more",
"speed",
"With",
"globbing",
"disallowed",
"we",
"can",
"use",
"sets",
"which",
"have",
"O",
"(",
"1",
")",
"lookup",
"time",
"in",
"CPython",
"."
] | [
"\"\"\"Similar to filter_tests, but filters only negative match filters for more speed\n\n With globbing disallowed, we can use sets, which have O(1) lookup time in\n CPython. This allows for larger filter lists.\n\n negative_filters is a list of lists of filters (because the user can pass the flag\n mu... | [
{
"param": "tests",
"type": null
},
{
"param": "negative_matches",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tests",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "negative_matches",
"type": null,
"docstring": null,
"docstri... |
dfd15df4173c88bdeafa30e29e7e32a5a5236314 | sunlongbo/chromium | android_webview/support_library/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckAnnotatedInvocationHandlers | <not_specific> | def _CheckAnnotatedInvocationHandlers(input_api, output_api):
"""Checks that all references to InvocationHandlers are annotated with a
comment describing the class the InvocationHandler represents. This does not
check .../support_lib_boundary/util/, because this has legitimate reasons to
refer to InvocationHand... | Checks that all references to InvocationHandlers are annotated with a
comment describing the class the InvocationHandler represents. This does not
check .../support_lib_boundary/util/, because this has legitimate reasons to
refer to InvocationHandlers without them standing for a specific type.
| Checks that all references to InvocationHandlers are annotated with a
comment describing the class the InvocationHandler represents. This does not
check .../support_lib_boundary/util/, because this has legitimate reasons to
refer to InvocationHandlers without them standing for a specific type. | [
"Checks",
"that",
"all",
"references",
"to",
"InvocationHandlers",
"are",
"annotated",
"with",
"a",
"comment",
"describing",
"the",
"class",
"the",
"InvocationHandler",
"represents",
".",
"This",
"does",
"not",
"check",
"...",
"/",
"support_lib_boundary",
"/",
"ut... | def _CheckAnnotatedInvocationHandlers(input_api, output_api):
invocation_handler_str = r'\bInvocationHandler\b'
annotation_str = r'/\* \w+ \*/\s+'
invocation_handler_import_pattern = input_api.re.compile(
r'^import.*' + invocation_handler_str + ';$')
possibly_annotated_handler_pattern = input_api.re.compi... | [
"def",
"_CheckAnnotatedInvocationHandlers",
"(",
"input_api",
",",
"output_api",
")",
":",
"invocation_handler_str",
"=",
"r'\\bInvocationHandler\\b'",
"annotation_str",
"=",
"r'/\\* \\w+ \\*/\\s+'",
"invocation_handler_import_pattern",
"=",
"input_api",
".",
"re",
".",
"comp... | Checks that all references to InvocationHandlers are annotated with a
comment describing the class the InvocationHandler represents. | [
"Checks",
"that",
"all",
"references",
"to",
"InvocationHandlers",
"are",
"annotated",
"with",
"a",
"comment",
"describing",
"the",
"class",
"the",
"InvocationHandler",
"represents",
"."
] | [
"\"\"\"Checks that all references to InvocationHandlers are annotated with a\n comment describing the class the InvocationHandler represents. This does not\n check .../support_lib_boundary/util/, because this has legitimate reasons to\n refer to InvocationHandlers without them standing for a specific type.\n \"... | [
{
"param": "input_api",
"type": null
},
{
"param": "output_api",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_api",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output_api",
"type": null,
"docstring": null,
"docstring... |
dfd15df4173c88bdeafa30e29e7e32a5a5236314 | sunlongbo/chromium | android_webview/support_library/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckFeatureDevSuffix | <not_specific> | def _CheckFeatureDevSuffix(input_api, output_api):
"""Checks that Features.DEV_SUFFIX is not used in boundary_interfaces. The
right place to use it is SupportLibWebViewChromiumFactory.
"""
pattern = input_api.re.compile(r'\bDEV_SUFFIX\b')
problems = []
filt = lambda f: 'boundary_interfaces' in f.LocalPath... | Checks that Features.DEV_SUFFIX is not used in boundary_interfaces. The
right place to use it is SupportLibWebViewChromiumFactory.
| Checks that Features.DEV_SUFFIX is not used in boundary_interfaces. The
right place to use it is SupportLibWebViewChromiumFactory. | [
"Checks",
"that",
"Features",
".",
"DEV_SUFFIX",
"is",
"not",
"used",
"in",
"boundary_interfaces",
".",
"The",
"right",
"place",
"to",
"use",
"it",
"is",
"SupportLibWebViewChromiumFactory",
"."
] | def _CheckFeatureDevSuffix(input_api, output_api):
pattern = input_api.re.compile(r'\bDEV_SUFFIX\b')
problems = []
filt = lambda f: 'boundary_interfaces' in f.LocalPath()
for f in input_api.AffectedFiles(file_filter=filt):
for line_num, line in f.ChangedContents():
m = pattern.search(line)
if m:... | [
"def",
"_CheckFeatureDevSuffix",
"(",
"input_api",
",",
"output_api",
")",
":",
"pattern",
"=",
"input_api",
".",
"re",
".",
"compile",
"(",
"r'\\bDEV_SUFFIX\\b'",
")",
"problems",
"=",
"[",
"]",
"filt",
"=",
"lambda",
"f",
":",
"'boundary_interfaces'",
"in",
... | Checks that Features.DEV_SUFFIX is not used in boundary_interfaces. | [
"Checks",
"that",
"Features",
".",
"DEV_SUFFIX",
"is",
"not",
"used",
"in",
"boundary_interfaces",
"."
] | [
"\"\"\"Checks that Features.DEV_SUFFIX is not used in boundary_interfaces. The\n right place to use it is SupportLibWebViewChromiumFactory.\n \"\"\""
] | [
{
"param": "input_api",
"type": null
},
{
"param": "output_api",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_api",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output_api",
"type": null,
"docstring": null,
"docstring... |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testIterBuilderStepMaps | null | def testIterBuilderStepMaps(self):
"""Tests that iterating to BuilderStepMap works as expected."""
test_expectation_map = self._GetSampleTestExpectationMap()
expected_values = []
for test_name, expectation_map in test_expectation_map.items():
for expectation, builder_map in expectation_map.items()... | Tests that iterating to BuilderStepMap works as expected. | Tests that iterating to BuilderStepMap works as expected. | [
"Tests",
"that",
"iterating",
"to",
"BuilderStepMap",
"works",
"as",
"expected",
"."
] | def testIterBuilderStepMaps(self):
test_expectation_map = self._GetSampleTestExpectationMap()
expected_values = []
for test_name, expectation_map in test_expectation_map.items():
for expectation, builder_map in expectation_map.items():
expected_values.append((test_name, expectation, builder_ma... | [
"def",
"testIterBuilderStepMaps",
"(",
"self",
")",
":",
"test_expectation_map",
"=",
"self",
".",
"_GetSampleTestExpectationMap",
"(",
")",
"expected_values",
"=",
"[",
"]",
"for",
"test_name",
",",
"expectation_map",
"in",
"test_expectation_map",
".",
"items",
"("... | Tests that iterating to BuilderStepMap works as expected. | [
"Tests",
"that",
"iterating",
"to",
"BuilderStepMap",
"works",
"as",
"expected",
"."
] | [
"\"\"\"Tests that iterating to BuilderStepMap works as expected.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testEmptyBaseMap | null | def testEmptyBaseMap(self):
"""Tests that a merge with an empty base map copies the merge map."""
base_map = data_types.TestExpectationMap()
merge_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win'], 'Failure'):
... | Tests that a merge with an empty base map copies the merge map. | Tests that a merge with an empty base map copies the merge map. | [
"Tests",
"that",
"a",
"merge",
"with",
"an",
"empty",
"base",
"map",
"copies",
"the",
"merge",
"map",
"."
] | def testEmptyBaseMap(self):
base_map = data_types.TestExpectationMap()
merge_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win'], 'Failure'):
data_types.BuilderStepMap({
'builder':
... | [
"def",
"testEmptyBaseMap",
"(",
"self",
")",
":",
"base_map",
"=",
"data_types",
".",
"TestExpectationMap",
"(",
")",
"merge_map",
"=",
"data_types",
".",
"TestExpectationMap",
"(",
"{",
"'foo'",
":",
"data_types",
".",
"ExpectationBuilderMap",
"(",
"{",
"data_t... | Tests that a merge with an empty base map copies the merge map. | [
"Tests",
"that",
"a",
"merge",
"with",
"an",
"empty",
"base",
"map",
"copies",
"the",
"merge",
"map",
"."
] | [
"\"\"\"Tests that a merge with an empty base map copies the merge map.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testEmptyMergeMap | null | def testEmptyMergeMap(self):
"""Tests that a merge with an empty merge map is a no-op."""
base_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win'], 'Failure'):
data_types.BuilderStepMap({
'b... | Tests that a merge with an empty merge map is a no-op. | Tests that a merge with an empty merge map is a no-op. | [
"Tests",
"that",
"a",
"merge",
"with",
"an",
"empty",
"merge",
"map",
"is",
"a",
"no",
"-",
"op",
"."
] | def testEmptyMergeMap(self):
base_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win'], 'Failure'):
data_types.BuilderStepMap({
'builder':
data_types.StepBuildStatsMap({
... | [
"def",
"testEmptyMergeMap",
"(",
"self",
")",
":",
"base_map",
"=",
"data_types",
".",
"TestExpectationMap",
"(",
"{",
"'foo'",
":",
"data_types",
".",
"ExpectationBuilderMap",
"(",
"{",
"data_types",
".",
"Expectation",
"(",
"'foo'",
",",
"[",
"'win'",
"]",
... | Tests that a merge with an empty merge map is a no-op. | [
"Tests",
"that",
"a",
"merge",
"with",
"an",
"empty",
"merge",
"map",
"is",
"a",
"no",
"-",
"op",
"."
] | [
"\"\"\"Tests that a merge with an empty merge map is a no-op.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testMissingKeys | null | def testMissingKeys(self):
"""Tests that missing keys are properly copied to the base map."""
base_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win'], 'Failure'):
data_types.BuilderStepMap({
... | Tests that missing keys are properly copied to the base map. | Tests that missing keys are properly copied to the base map. | [
"Tests",
"that",
"missing",
"keys",
"are",
"properly",
"copied",
"to",
"the",
"base",
"map",
"."
] | def testMissingKeys(self):
base_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win'], 'Failure'):
data_types.BuilderStepMap({
'builder':
data_types.StepBuildStatsMap({
... | [
"def",
"testMissingKeys",
"(",
"self",
")",
":",
"base_map",
"=",
"data_types",
".",
"TestExpectationMap",
"(",
"{",
"'foo'",
":",
"data_types",
".",
"ExpectationBuilderMap",
"(",
"{",
"data_types",
".",
"Expectation",
"(",
"'foo'",
",",
"[",
"'win'",
"]",
"... | Tests that missing keys are properly copied to the base map. | [
"Tests",
"that",
"missing",
"keys",
"are",
"properly",
"copied",
"to",
"the",
"base",
"map",
"."
] | [
"\"\"\"Tests that missing keys are properly copied to the base map.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testMergeBuildStats | null | def testMergeBuildStats(self):
"""Tests that BuildStats for the same step are merged properly."""
base_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win'], 'Failure'):
data_types.BuilderStepMap({
... | Tests that BuildStats for the same step are merged properly. | Tests that BuildStats for the same step are merged properly. | [
"Tests",
"that",
"BuildStats",
"for",
"the",
"same",
"step",
"are",
"merged",
"properly",
"."
] | def testMergeBuildStats(self):
base_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win'], 'Failure'):
data_types.BuilderStepMap({
'builder':
data_types.StepBuildStatsMap({
... | [
"def",
"testMergeBuildStats",
"(",
"self",
")",
":",
"base_map",
"=",
"data_types",
".",
"TestExpectationMap",
"(",
"{",
"'foo'",
":",
"data_types",
".",
"ExpectationBuilderMap",
"(",
"{",
"data_types",
".",
"Expectation",
"(",
"'foo'",
",",
"[",
"'win'",
"]",... | Tests that BuildStats for the same step are merged properly. | [
"Tests",
"that",
"BuildStats",
"for",
"the",
"same",
"step",
"are",
"merged",
"properly",
"."
] | [
"\"\"\"Tests that BuildStats for the same step are merged properly.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testInvalidMerge | null | def testInvalidMerge(self):
"""Tests that updating a BuildStats instance twice is an error."""
base_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win'], 'Failure'):
data_types.BuilderStepMap({
... | Tests that updating a BuildStats instance twice is an error. | Tests that updating a BuildStats instance twice is an error. | [
"Tests",
"that",
"updating",
"a",
"BuildStats",
"instance",
"twice",
"is",
"an",
"error",
"."
] | def testInvalidMerge(self):
base_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win'], 'Failure'):
data_types.BuilderStepMap({
'builder':
data_types.StepBuildStatsMap({
... | [
"def",
"testInvalidMerge",
"(",
"self",
")",
":",
"base_map",
"=",
"data_types",
".",
"TestExpectationMap",
"(",
"{",
"'foo'",
":",
"data_types",
".",
"ExpectationBuilderMap",
"(",
"{",
"data_types",
".",
"Expectation",
"(",
"'foo'",
",",
"[",
"'win'",
"]",
... | Tests that updating a BuildStats instance twice is an error. | [
"Tests",
"that",
"updating",
"a",
"BuildStats",
"instance",
"twice",
"is",
"an",
"error",
"."
] | [
"\"\"\"Tests that updating a BuildStats instance twice is an error.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testRetryOnlyPassMatching | null | def testRetryOnlyPassMatching(self):
"""Tests when the only tests are retry expectations that pass and match."""
foo_result = data_types.Result('foo/test', ['win10'], 'Pass', 'pixel_tests',
'build_id')
expectation_map = self.GetEmptyMapForGenericRetryExpectation()
unma... | Tests when the only tests are retry expectations that pass and match. | Tests when the only tests are retry expectations that pass and match. | [
"Tests",
"when",
"the",
"only",
"tests",
"are",
"retry",
"expectations",
"that",
"pass",
"and",
"match",
"."
] | def testRetryOnlyPassMatching(self):
foo_result = data_types.Result('foo/test', ['win10'], 'Pass', 'pixel_tests',
'build_id')
expectation_map = self.GetEmptyMapForGenericRetryExpectation()
unmatched_results = expectation_map.AddResultList('builder', [foo_result])
self.... | [
"def",
"testRetryOnlyPassMatching",
"(",
"self",
")",
":",
"foo_result",
"=",
"data_types",
".",
"Result",
"(",
"'foo/test'",
",",
"[",
"'win10'",
"]",
",",
"'Pass'",
",",
"'pixel_tests'",
",",
"'build_id'",
")",
"expectation_map",
"=",
"self",
".",
"GetEmptyM... | Tests when the only tests are retry expectations that pass and match. | [
"Tests",
"when",
"the",
"only",
"tests",
"are",
"retry",
"expectations",
"that",
"pass",
"and",
"match",
"."
] | [
"\"\"\"Tests when the only tests are retry expectations that pass and match.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testRetryOnlyFailMatching | null | def testRetryOnlyFailMatching(self):
"""Tests when the only tests are retry expectations that fail and match."""
foo_result = data_types.Result('foo/test', ['win10'], 'Failure',
'pixel_tests', 'build_id')
expectation_map = self.GetEmptyMapForGenericRetryExpectation()
u... | Tests when the only tests are retry expectations that fail and match. | Tests when the only tests are retry expectations that fail and match. | [
"Tests",
"when",
"the",
"only",
"tests",
"are",
"retry",
"expectations",
"that",
"fail",
"and",
"match",
"."
] | def testRetryOnlyFailMatching(self):
foo_result = data_types.Result('foo/test', ['win10'], 'Failure',
'pixel_tests', 'build_id')
expectation_map = self.GetEmptyMapForGenericRetryExpectation()
unmatched_results = expectation_map.AddResultList('builder', [foo_result])
se... | [
"def",
"testRetryOnlyFailMatching",
"(",
"self",
")",
":",
"foo_result",
"=",
"data_types",
".",
"Result",
"(",
"'foo/test'",
",",
"[",
"'win10'",
"]",
",",
"'Failure'",
",",
"'pixel_tests'",
",",
"'build_id'",
")",
"expectation_map",
"=",
"self",
".",
"GetEmp... | Tests when the only tests are retry expectations that fail and match. | [
"Tests",
"when",
"the",
"only",
"tests",
"are",
"retry",
"expectations",
"that",
"fail",
"and",
"match",
"."
] | [
"\"\"\"Tests when the only tests are retry expectations that fail and match.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testRetryFailThenPassMatching | null | def testRetryFailThenPassMatching(self):
"""Tests when there are pass and fail results for retry expectations."""
foo_fail_result = data_types.Result('foo/test', ['win10'], 'Failure',
'pixel_tests', 'build_id')
foo_pass_result = data_types.Result('foo/test', ['win10']... | Tests when there are pass and fail results for retry expectations. | Tests when there are pass and fail results for retry expectations. | [
"Tests",
"when",
"there",
"are",
"pass",
"and",
"fail",
"results",
"for",
"retry",
"expectations",
"."
] | def testRetryFailThenPassMatching(self):
foo_fail_result = data_types.Result('foo/test', ['win10'], 'Failure',
'pixel_tests', 'build_id')
foo_pass_result = data_types.Result('foo/test', ['win10'], 'Pass',
'pixel_tests', 'build_id')
... | [
"def",
"testRetryFailThenPassMatching",
"(",
"self",
")",
":",
"foo_fail_result",
"=",
"data_types",
".",
"Result",
"(",
"'foo/test'",
",",
"[",
"'win10'",
"]",
",",
"'Failure'",
",",
"'pixel_tests'",
",",
"'build_id'",
")",
"foo_pass_result",
"=",
"data_types",
... | Tests when there are pass and fail results for retry expectations. | [
"Tests",
"when",
"there",
"are",
"pass",
"and",
"fail",
"results",
"for",
"retry",
"expectations",
"."
] | [
"\"\"\"Tests when there are pass and fail results for retry expectations.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testFailurePassMatching | null | def testFailurePassMatching(self):
"""Tests when there are pass results for failure expectations."""
foo_result = data_types.Result('foo/test', ['win10'], 'Pass', 'pixel_tests',
'build_id')
expectation_map = self.GetEmptyMapForGenericFailureExpectation()
unmatched_resu... | Tests when there are pass results for failure expectations. | Tests when there are pass results for failure expectations. | [
"Tests",
"when",
"there",
"are",
"pass",
"results",
"for",
"failure",
"expectations",
"."
] | def testFailurePassMatching(self):
foo_result = data_types.Result('foo/test', ['win10'], 'Pass', 'pixel_tests',
'build_id')
expectation_map = self.GetEmptyMapForGenericFailureExpectation()
unmatched_results = expectation_map.AddResultList('builder', [foo_result])
self.... | [
"def",
"testFailurePassMatching",
"(",
"self",
")",
":",
"foo_result",
"=",
"data_types",
".",
"Result",
"(",
"'foo/test'",
",",
"[",
"'win10'",
"]",
",",
"'Pass'",
",",
"'pixel_tests'",
",",
"'build_id'",
")",
"expectation_map",
"=",
"self",
".",
"GetEmptyMap... | Tests when there are pass results for failure expectations. | [
"Tests",
"when",
"there",
"are",
"pass",
"results",
"for",
"failure",
"expectations",
"."
] | [
"\"\"\"Tests when there are pass results for failure expectations.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testFailureFailureMatching | null | def testFailureFailureMatching(self):
"""Tests when there are failure results for failure expectations."""
foo_result = data_types.Result('foo/test', ['win10'], 'Failure',
'pixel_tests', 'build_id')
expectation_map = self.GetEmptyMapForGenericFailureExpectation()
unmat... | Tests when there are failure results for failure expectations. | Tests when there are failure results for failure expectations. | [
"Tests",
"when",
"there",
"are",
"failure",
"results",
"for",
"failure",
"expectations",
"."
] | def testFailureFailureMatching(self):
foo_result = data_types.Result('foo/test', ['win10'], 'Failure',
'pixel_tests', 'build_id')
expectation_map = self.GetEmptyMapForGenericFailureExpectation()
unmatched_results = expectation_map.AddResultList('builder', [foo_result])
... | [
"def",
"testFailureFailureMatching",
"(",
"self",
")",
":",
"foo_result",
"=",
"data_types",
".",
"Result",
"(",
"'foo/test'",
",",
"[",
"'win10'",
"]",
",",
"'Failure'",
",",
"'pixel_tests'",
",",
"'build_id'",
")",
"expectation_map",
"=",
"self",
".",
"GetEm... | Tests when there are failure results for failure expectations. | [
"Tests",
"when",
"there",
"are",
"failure",
"results",
"for",
"failure",
"expectations",
"."
] | [
"\"\"\"Tests when there are failure results for failure expectations.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testMismatches | null | def testMismatches(self):
"""Tests that unmatched results get returned."""
foo_match_result = data_types.Result('foo/test', ['win10'], 'Pass',
'pixel_tests', 'build_id')
foo_mismatch_result = data_types.Result('foo/not_a_test', ['win10'],
... | Tests that unmatched results get returned. | Tests that unmatched results get returned. | [
"Tests",
"that",
"unmatched",
"results",
"get",
"returned",
"."
] | def testMismatches(self):
foo_match_result = data_types.Result('foo/test', ['win10'], 'Pass',
'pixel_tests', 'build_id')
foo_mismatch_result = data_types.Result('foo/not_a_test', ['win10'],
'Failure', 'pixel_tests',
... | [
"def",
"testMismatches",
"(",
"self",
")",
":",
"foo_match_result",
"=",
"data_types",
".",
"Result",
"(",
"'foo/test'",
",",
"[",
"'win10'",
"]",
",",
"'Pass'",
",",
"'pixel_tests'",
",",
"'build_id'",
")",
"foo_mismatch_result",
"=",
"data_types",
".",
"Resu... | Tests that unmatched results get returned. | [
"Tests",
"that",
"unmatched",
"results",
"get",
"returned",
"."
] | [
"\"\"\"Tests that unmatched results get returned.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testResultMatchPassingNew | null | def testResultMatchPassingNew(self):
"""Test adding a passing result when no results for a builder exist."""
r = data_types.Result('some/test/case', ['win', 'win10'], 'Pass',
'pixel_tests', 'build_id')
e = data_types.Expectation('some/test/*', ['win10'], 'Failure')
expectation_... | Test adding a passing result when no results for a builder exist. | Test adding a passing result when no results for a builder exist. | [
"Test",
"adding",
"a",
"passing",
"result",
"when",
"no",
"results",
"for",
"a",
"builder",
"exist",
"."
] | def testResultMatchPassingNew(self):
r = data_types.Result('some/test/case', ['win', 'win10'], 'Pass',
'pixel_tests', 'build_id')
e = data_types.Expectation('some/test/*', ['win10'], 'Failure')
expectation_map = data_types.TestExpectationMap({
'expectation_file':
da... | [
"def",
"testResultMatchPassingNew",
"(",
"self",
")",
":",
"r",
"=",
"data_types",
".",
"Result",
"(",
"'some/test/case'",
",",
"[",
"'win'",
",",
"'win10'",
"]",
",",
"'Pass'",
",",
"'pixel_tests'",
",",
"'build_id'",
")",
"e",
"=",
"data_types",
".",
"Ex... | Test adding a passing result when no results for a builder exist. | [
"Test",
"adding",
"a",
"passing",
"result",
"when",
"no",
"results",
"for",
"a",
"builder",
"exist",
"."
] | [
"\"\"\"Test adding a passing result when no results for a builder exist.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testResultMatchFailingNew | null | def testResultMatchFailingNew(self):
"""Test adding a failing result when no results for a builder exist."""
r = data_types.Result('some/test/case', ['win', 'win10'], 'Failure',
'pixel_tests', 'build_id')
e = data_types.Expectation('some/test/*', ['win10'], 'Failure')
expectati... | Test adding a failing result when no results for a builder exist. | Test adding a failing result when no results for a builder exist. | [
"Test",
"adding",
"a",
"failing",
"result",
"when",
"no",
"results",
"for",
"a",
"builder",
"exist",
"."
] | def testResultMatchFailingNew(self):
r = data_types.Result('some/test/case', ['win', 'win10'], 'Failure',
'pixel_tests', 'build_id')
e = data_types.Expectation('some/test/*', ['win10'], 'Failure')
expectation_map = data_types.TestExpectationMap({
'expectation_file':
... | [
"def",
"testResultMatchFailingNew",
"(",
"self",
")",
":",
"r",
"=",
"data_types",
".",
"Result",
"(",
"'some/test/case'",
",",
"[",
"'win'",
",",
"'win10'",
"]",
",",
"'Failure'",
",",
"'pixel_tests'",
",",
"'build_id'",
")",
"e",
"=",
"data_types",
".",
... | Test adding a failing result when no results for a builder exist. | [
"Test",
"adding",
"a",
"failing",
"result",
"when",
"no",
"results",
"for",
"a",
"builder",
"exist",
"."
] | [
"\"\"\"Test adding a failing result when no results for a builder exist.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testResultMatchPassingExisting | null | def testResultMatchPassingExisting(self):
"""Test adding a passing result when results for a builder exist."""
r = data_types.Result('some/test/case', ['win', 'win10'], 'Pass',
'pixel_tests', 'build_id')
e = data_types.Expectation('some/test/*', ['win10'], 'Failure')
stats = da... | Test adding a passing result when results for a builder exist. | Test adding a passing result when results for a builder exist. | [
"Test",
"adding",
"a",
"passing",
"result",
"when",
"results",
"for",
"a",
"builder",
"exist",
"."
] | def testResultMatchPassingExisting(self):
r = data_types.Result('some/test/case', ['win', 'win10'], 'Pass',
'pixel_tests', 'build_id')
e = data_types.Expectation('some/test/*', ['win10'], 'Failure')
stats = data_types.BuildStats()
stats.AddFailedBuild('build_id')
expectatio... | [
"def",
"testResultMatchPassingExisting",
"(",
"self",
")",
":",
"r",
"=",
"data_types",
".",
"Result",
"(",
"'some/test/case'",
",",
"[",
"'win'",
",",
"'win10'",
"]",
",",
"'Pass'",
",",
"'pixel_tests'",
",",
"'build_id'",
")",
"e",
"=",
"data_types",
".",
... | Test adding a passing result when results for a builder exist. | [
"Test",
"adding",
"a",
"passing",
"result",
"when",
"results",
"for",
"a",
"builder",
"exist",
"."
] | [
"\"\"\"Test adding a passing result when results for a builder exist.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testResultMatchFailingExisting | null | def testResultMatchFailingExisting(self):
"""Test adding a failing result when results for a builder exist."""
r = data_types.Result('some/test/case', ['win', 'win10'], 'Failure',
'pixel_tests', 'build_id')
e = data_types.Expectation('some/test/*', ['win10'], 'Failure')
stats =... | Test adding a failing result when results for a builder exist. | Test adding a failing result when results for a builder exist. | [
"Test",
"adding",
"a",
"failing",
"result",
"when",
"results",
"for",
"a",
"builder",
"exist",
"."
] | def testResultMatchFailingExisting(self):
r = data_types.Result('some/test/case', ['win', 'win10'], 'Failure',
'pixel_tests', 'build_id')
e = data_types.Expectation('some/test/*', ['win10'], 'Failure')
stats = data_types.BuildStats()
stats.AddPassedBuild()
expectation_map =... | [
"def",
"testResultMatchFailingExisting",
"(",
"self",
")",
":",
"r",
"=",
"data_types",
".",
"Result",
"(",
"'some/test/case'",
",",
"[",
"'win'",
",",
"'win10'",
"]",
",",
"'Failure'",
",",
"'pixel_tests'",
",",
"'build_id'",
")",
"e",
"=",
"data_types",
".... | Test adding a failing result when results for a builder exist. | [
"Test",
"adding",
"a",
"failing",
"result",
"when",
"results",
"for",
"a",
"builder",
"exist",
"."
] | [
"\"\"\"Test adding a failing result when results for a builder exist.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testResultMatchMultiMatch | null | def testResultMatchMultiMatch(self):
"""Test adding a passing result when multiple expectations match."""
r = data_types.Result('some/test/case', ['win', 'win10'], 'Pass',
'pixel_tests', 'build_id')
e = data_types.Expectation('some/test/*', ['win10'], 'Failure')
e2 = data_types... | Test adding a passing result when multiple expectations match. | Test adding a passing result when multiple expectations match. | [
"Test",
"adding",
"a",
"passing",
"result",
"when",
"multiple",
"expectations",
"match",
"."
] | def testResultMatchMultiMatch(self):
r = data_types.Result('some/test/case', ['win', 'win10'], 'Pass',
'pixel_tests', 'build_id')
e = data_types.Expectation('some/test/*', ['win10'], 'Failure')
e2 = data_types.Expectation('some/test/case', ['win10'], 'Failure')
expectation_map ... | [
"def",
"testResultMatchMultiMatch",
"(",
"self",
")",
":",
"r",
"=",
"data_types",
".",
"Result",
"(",
"'some/test/case'",
",",
"[",
"'win'",
",",
"'win10'",
"]",
",",
"'Pass'",
",",
"'pixel_tests'",
",",
"'build_id'",
")",
"e",
"=",
"data_types",
".",
"Ex... | Test adding a passing result when multiple expectations match. | [
"Test",
"adding",
"a",
"passing",
"result",
"when",
"multiple",
"expectations",
"match",
"."
] | [
"\"\"\"Test adding a passing result when multiple expectations match.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testResultNoMatch | null | def testResultNoMatch(self):
"""Tests that a result is not added if no match is found."""
r = data_types.Result('some/test/case', ['win', 'win10'], 'Failure',
'pixel_tests', 'build_id')
e = data_types.Expectation('some/test/*', ['win10', 'foo'], 'Failure')
expectation_map = dat... | Tests that a result is not added if no match is found. | Tests that a result is not added if no match is found. | [
"Tests",
"that",
"a",
"result",
"is",
"not",
"added",
"if",
"no",
"match",
"is",
"found",
"."
] | def testResultNoMatch(self):
r = data_types.Result('some/test/case', ['win', 'win10'], 'Failure',
'pixel_tests', 'build_id')
e = data_types.Expectation('some/test/*', ['win10', 'foo'], 'Failure')
expectation_map = data_types.TestExpectationMap({
'expectation_file':
... | [
"def",
"testResultNoMatch",
"(",
"self",
")",
":",
"r",
"=",
"data_types",
".",
"Result",
"(",
"'some/test/case'",
",",
"[",
"'win'",
",",
"'win10'",
"]",
",",
"'Failure'",
",",
"'pixel_tests'",
",",
"'build_id'",
")",
"e",
"=",
"data_types",
".",
"Expecta... | Tests that a result is not added if no match is found. | [
"Tests",
"that",
"a",
"result",
"is",
"not",
"added",
"if",
"no",
"match",
"is",
"found",
"."
] | [
"\"\"\"Tests that a result is not added if no match is found.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testResultMatchSpecificExpectationFiles | null | def testResultMatchSpecificExpectationFiles(self):
"""Tests that a match can be found when specifying expectation files."""
r = data_types.Result('some/test/case', ['win'], 'Pass', 'pixel_tests',
'build_id')
e = data_types.Expectation('some/test/case', ['win'], 'Failure')
expec... | Tests that a match can be found when specifying expectation files. | Tests that a match can be found when specifying expectation files. | [
"Tests",
"that",
"a",
"match",
"can",
"be",
"found",
"when",
"specifying",
"expectation",
"files",
"."
] | def testResultMatchSpecificExpectationFiles(self):
r = data_types.Result('some/test/case', ['win'], 'Pass', 'pixel_tests',
'build_id')
e = data_types.Expectation('some/test/case', ['win'], 'Failure')
expectation_map = data_types.TestExpectationMap({
'foo_expectations':
... | [
"def",
"testResultMatchSpecificExpectationFiles",
"(",
"self",
")",
":",
"r",
"=",
"data_types",
".",
"Result",
"(",
"'some/test/case'",
",",
"[",
"'win'",
"]",
",",
"'Pass'",
",",
"'pixel_tests'",
",",
"'build_id'",
")",
"e",
"=",
"data_types",
".",
"Expectat... | Tests that a match can be found when specifying expectation files. | [
"Tests",
"that",
"a",
"match",
"can",
"be",
"found",
"when",
"specifying",
"expectation",
"files",
"."
] | [
"\"\"\"Tests that a match can be found when specifying expectation files.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testMultipleResults | null | def testMultipleResults(self):
"""Tests that behavior is as expected when multiple results are given."""
r1 = data_types.Result('some/test/case', ['win'], 'Pass', 'pixel_tests',
'build_id')
r2 = data_types.Result('some/test/case', ['linux'], 'Pass', 'pixel_tests',
... | Tests that behavior is as expected when multiple results are given. | Tests that behavior is as expected when multiple results are given. | [
"Tests",
"that",
"behavior",
"is",
"as",
"expected",
"when",
"multiple",
"results",
"are",
"given",
"."
] | def testMultipleResults(self):
r1 = data_types.Result('some/test/case', ['win'], 'Pass', 'pixel_tests',
'build_id')
r2 = data_types.Result('some/test/case', ['linux'], 'Pass', 'pixel_tests',
'build_id')
r3 = data_types.Result('some/other/test', ['win'], ... | [
"def",
"testMultipleResults",
"(",
"self",
")",
":",
"r1",
"=",
"data_types",
".",
"Result",
"(",
"'some/test/case'",
",",
"[",
"'win'",
"]",
",",
"'Pass'",
",",
"'pixel_tests'",
",",
"'build_id'",
")",
"r2",
"=",
"data_types",
".",
"Result",
"(",
"'some/t... | Tests that behavior is as expected when multiple results are given. | [
"Tests",
"that",
"behavior",
"is",
"as",
"expected",
"when",
"multiple",
"results",
"are",
"given",
"."
] | [
"\"\"\"Tests that behavior is as expected when multiple results are given.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testEmptyInput | null | def testEmptyInput(self):
"""Tests that nothing blows up with empty input."""
stale_dict, semi_stale_dict, active_dict =\
data_types.TestExpectationMap().SplitByStaleness()
self.assertEqual(stale_dict, {})
self.assertEqual(semi_stale_dict, {})
self.assertEqual(active_dict, {})
self.asser... | Tests that nothing blows up with empty input. | Tests that nothing blows up with empty input. | [
"Tests",
"that",
"nothing",
"blows",
"up",
"with",
"empty",
"input",
"."
] | def testEmptyInput(self):
stale_dict, semi_stale_dict, active_dict =\
data_types.TestExpectationMap().SplitByStaleness()
self.assertEqual(stale_dict, {})
self.assertEqual(semi_stale_dict, {})
self.assertEqual(active_dict, {})
self.assertIsInstance(stale_dict, data_types.TestExpectationMap)
... | [
"def",
"testEmptyInput",
"(",
"self",
")",
":",
"stale_dict",
",",
"semi_stale_dict",
",",
"active_dict",
"=",
"data_types",
".",
"TestExpectationMap",
"(",
")",
".",
"SplitByStaleness",
"(",
")",
"self",
".",
"assertEqual",
"(",
"stale_dict",
",",
"{",
"}",
... | Tests that nothing blows up with empty input. | [
"Tests",
"that",
"nothing",
"blows",
"up",
"with",
"empty",
"input",
"."
] | [
"\"\"\"Tests that nothing blows up with empty input.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testStaleExpectations | null | def testStaleExpectations(self):
"""Tests output when only stale expectations are provided."""
expectation_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win'], ['Failure']):
data_types.BuilderStepMap({
... | Tests output when only stale expectations are provided. | Tests output when only stale expectations are provided. | [
"Tests",
"output",
"when",
"only",
"stale",
"expectations",
"are",
"provided",
"."
] | def testStaleExpectations(self):
expectation_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win'], ['Failure']):
data_types.BuilderStepMap({
'foo_builder':
data_types.StepBuildSta... | [
"def",
"testStaleExpectations",
"(",
"self",
")",
":",
"expectation_map",
"=",
"data_types",
".",
"TestExpectationMap",
"(",
"{",
"'foo'",
":",
"data_types",
".",
"ExpectationBuilderMap",
"(",
"{",
"data_types",
".",
"Expectation",
"(",
"'foo'",
",",
"[",
"'win'... | Tests output when only stale expectations are provided. | [
"Tests",
"output",
"when",
"only",
"stale",
"expectations",
"are",
"provided",
"."
] | [
"\"\"\"Tests output when only stale expectations are provided.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testActiveExpectations | null | def testActiveExpectations(self):
"""Tests output when only active expectations are provided."""
expectation_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win'], ['Failure']):
data_types.BuilderStepMap({
... | Tests output when only active expectations are provided. | Tests output when only active expectations are provided. | [
"Tests",
"output",
"when",
"only",
"active",
"expectations",
"are",
"provided",
"."
] | def testActiveExpectations(self):
expectation_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win'], ['Failure']):
data_types.BuilderStepMap({
'foo_builder':
data_types.StepBuildSt... | [
"def",
"testActiveExpectations",
"(",
"self",
")",
":",
"expectation_map",
"=",
"data_types",
".",
"TestExpectationMap",
"(",
"{",
"'foo'",
":",
"data_types",
".",
"ExpectationBuilderMap",
"(",
"{",
"data_types",
".",
"Expectation",
"(",
"'foo'",
",",
"[",
"'win... | Tests output when only active expectations are provided. | [
"Tests",
"output",
"when",
"only",
"active",
"expectations",
"are",
"provided",
"."
] | [
"\"\"\"Tests output when only active expectations are provided.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testSemiStaleExpectations | null | def testSemiStaleExpectations(self):
"""Tests output when only semi-stale expectations are provided."""
expectation_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win'], ['Failure']):
data_types.BuilderStepM... | Tests output when only semi-stale expectations are provided. | Tests output when only semi-stale expectations are provided. | [
"Tests",
"output",
"when",
"only",
"semi",
"-",
"stale",
"expectations",
"are",
"provided",
"."
] | def testSemiStaleExpectations(self):
expectation_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win'], ['Failure']):
data_types.BuilderStepMap({
'foo_builder':
data_types.StepBuil... | [
"def",
"testSemiStaleExpectations",
"(",
"self",
")",
":",
"expectation_map",
"=",
"data_types",
".",
"TestExpectationMap",
"(",
"{",
"'foo'",
":",
"data_types",
".",
"ExpectationBuilderMap",
"(",
"{",
"data_types",
".",
"Expectation",
"(",
"'foo'",
",",
"[",
"'... | Tests output when only semi-stale expectations are provided. | [
"Tests",
"output",
"when",
"only",
"semi",
"-",
"stale",
"expectations",
"are",
"provided",
"."
] | [
"\"\"\"Tests output when only semi-stale expectations are provided.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testAllExpectations | null | def testAllExpectations(self):
"""Tests output when all three types of expectations are provided."""
expectation_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['stale'], 'Failure'):
data_types.BuilderStepMap(... | Tests output when all three types of expectations are provided. | Tests output when all three types of expectations are provided. | [
"Tests",
"output",
"when",
"all",
"three",
"types",
"of",
"expectations",
"are",
"provided",
"."
] | def testAllExpectations(self):
expectation_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['stale'], 'Failure'):
data_types.BuilderStepMap({
'foo_builder':
data_types.StepBuildStats... | [
"def",
"testAllExpectations",
"(",
"self",
")",
":",
"expectation_map",
"=",
"data_types",
".",
"TestExpectationMap",
"(",
"{",
"'foo'",
":",
"data_types",
".",
"ExpectationBuilderMap",
"(",
"{",
"data_types",
".",
"Expectation",
"(",
"'foo'",
",",
"[",
"'stale'... | Tests output when all three types of expectations are provided. | [
"Tests",
"output",
"when",
"all",
"three",
"types",
"of",
"expectations",
"are",
"provided",
"."
] | [
"\"\"\"Tests output when all three types of expectations are provided.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testNoUnused | null | def testNoUnused(self):
"""Tests that filtering is a no-op if there are no unused expectations."""
expectation_map = data_types.TestExpectationMap({
'expectation_file':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo/test', ['win'], ['Failure']):
data_types... | Tests that filtering is a no-op if there are no unused expectations. | Tests that filtering is a no-op if there are no unused expectations. | [
"Tests",
"that",
"filtering",
"is",
"a",
"no",
"-",
"op",
"if",
"there",
"are",
"no",
"unused",
"expectations",
"."
] | def testNoUnused(self):
expectation_map = data_types.TestExpectationMap({
'expectation_file':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo/test', ['win'], ['Failure']):
data_types.BuilderStepMap({
'SomeBuilder':
data_types.Ste... | [
"def",
"testNoUnused",
"(",
"self",
")",
":",
"expectation_map",
"=",
"data_types",
".",
"TestExpectationMap",
"(",
"{",
"'expectation_file'",
":",
"data_types",
".",
"ExpectationBuilderMap",
"(",
"{",
"data_types",
".",
"Expectation",
"(",
"'foo/test'",
",",
"[",... | Tests that filtering is a no-op if there are no unused expectations. | [
"Tests",
"that",
"filtering",
"is",
"a",
"no",
"-",
"op",
"if",
"there",
"are",
"no",
"unused",
"expectations",
"."
] | [
"\"\"\"Tests that filtering is a no-op if there are no unused expectations.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testUnusedButNotEmpty | null | def testUnusedButNotEmpty(self):
"""Tests filtering if there is an unused expectation but no empty tests."""
expectation_map = data_types.TestExpectationMap({
'expectation_file':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo/test', ['win'], ['Failure']):
... | Tests filtering if there is an unused expectation but no empty tests. | Tests filtering if there is an unused expectation but no empty tests. | [
"Tests",
"filtering",
"if",
"there",
"is",
"an",
"unused",
"expectation",
"but",
"no",
"empty",
"tests",
"."
] | def testUnusedButNotEmpty(self):
expectation_map = data_types.TestExpectationMap({
'expectation_file':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo/test', ['win'], ['Failure']):
data_types.BuilderStepMap({
'SomeBuilder':
data_... | [
"def",
"testUnusedButNotEmpty",
"(",
"self",
")",
":",
"expectation_map",
"=",
"data_types",
".",
"TestExpectationMap",
"(",
"{",
"'expectation_file'",
":",
"data_types",
".",
"ExpectationBuilderMap",
"(",
"{",
"data_types",
".",
"Expectation",
"(",
"'foo/test'",
",... | Tests filtering if there is an unused expectation but no empty tests. | [
"Tests",
"filtering",
"if",
"there",
"is",
"an",
"unused",
"expectation",
"but",
"no",
"empty",
"tests",
"."
] | [
"\"\"\"Tests filtering if there is an unused expectation but no empty tests.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dc876538b75ee31f7ee8ad5c3a088cfb4dd1c5a | sunlongbo/chromium | testing/unexpected_passes_common/data_types_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testUnusedAndEmpty | null | def testUnusedAndEmpty(self):
"""Tests filtering if there is an expectation that causes an empty test."""
expectation_map = data_types.TestExpectationMap({
'expectation_file':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo/test', ['win'], ['Failure']):
dat... | Tests filtering if there is an expectation that causes an empty test. | Tests filtering if there is an expectation that causes an empty test. | [
"Tests",
"filtering",
"if",
"there",
"is",
"an",
"expectation",
"that",
"causes",
"an",
"empty",
"test",
"."
] | def testUnusedAndEmpty(self):
expectation_map = data_types.TestExpectationMap({
'expectation_file':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo/test', ['win'], ['Failure']):
data_types.BuilderStepMap(),
}),
})
expected_unused = {
'ex... | [
"def",
"testUnusedAndEmpty",
"(",
"self",
")",
":",
"expectation_map",
"=",
"data_types",
".",
"TestExpectationMap",
"(",
"{",
"'expectation_file'",
":",
"data_types",
".",
"ExpectationBuilderMap",
"(",
"{",
"data_types",
".",
"Expectation",
"(",
"'foo/test'",
",",
... | Tests filtering if there is an expectation that causes an empty test. | [
"Tests",
"filtering",
"if",
"there",
"is",
"an",
"expectation",
"that",
"causes",
"an",
"empty",
"test",
"."
] | [
"\"\"\"Tests filtering if there is an expectation that causes an empty test.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
87d89bad1cfc0295c7f8f885cb8d6dba63274ad9 | sunlongbo/chromium | tools/sort_sources.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ProcessFile | <not_specific> | def ProcessFile(filename, should_confirm):
"""Process the input file and rewrite if needed.
Args:
filename: Path to the input file.
should_confirm: If true, diff and confirmation prompt are shown.
"""
original_lines = []
with open(filename, 'r') as input_file:
for line in input_file:
origi... | Process the input file and rewrite if needed.
Args:
filename: Path to the input file.
should_confirm: If true, diff and confirmation prompt are shown.
| Process the input file and rewrite if needed. | [
"Process",
"the",
"input",
"file",
"and",
"rewrite",
"if",
"needed",
"."
] | def ProcessFile(filename, should_confirm):
original_lines = []
with open(filename, 'r') as input_file:
for line in input_file:
original_lines.append(line)
new_lines = SortSources(original_lines)
if original_lines == new_lines:
print('%s: no change' % filename)
return
if should_confirm:
d... | [
"def",
"ProcessFile",
"(",
"filename",
",",
"should_confirm",
")",
":",
"original_lines",
"=",
"[",
"]",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"input_file",
":",
"for",
"line",
"in",
"input_file",
":",
"original_lines",
".",
"append",
"("... | Process the input file and rewrite if needed. | [
"Process",
"the",
"input",
"file",
"and",
"rewrite",
"if",
"needed",
"."
] | [
"\"\"\"Process the input file and rewrite if needed.\n\n Args:\n filename: Path to the input file.\n should_confirm: If true, diff and confirmation prompt are shown.\n \"\"\""
] | [
{
"param": "filename",
"type": null
},
{
"param": "should_confirm",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": "Path to the input file.",
"docstring_tokens": [
"Path",
"to",
"the",
"input",
"file",
"."
],
"default": null,
"is_optiona... |
650f5d0e929332f7a5d1f3b4d4f327e3d0cccdbe | sunlongbo/chromium | tools/vim/ninja_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetNinjaOutputDirectory | <not_specific> | def GetNinjaOutputDirectory(chrome_root):
"""Returns <chrome_root>/<output_dir>/(Release|Debug|<other>).
If either of the following environment variables are set, their
value is used to determine the output directory:
1. CHROMIUM_OUT_DIR environment variable.
2. GYP_GENERATOR_FLAGS environment variable o... | Returns <chrome_root>/<output_dir>/(Release|Debug|<other>).
If either of the following environment variables are set, their
value is used to determine the output directory:
1. CHROMIUM_OUT_DIR environment variable.
2. GYP_GENERATOR_FLAGS environment variable output_dir property.
Otherwise, all directori... | Returns //(Release|Debug|).
If either of the following environment variables are set, their
value is used to determine the output directory:
1.
Otherwise, all directories starting with the word out are examined.
The configuration chosen is the one most recently generated/built. | [
"Returns",
"//",
"(",
"Release|Debug|",
")",
".",
"If",
"either",
"of",
"the",
"following",
"environment",
"variables",
"are",
"set",
"their",
"value",
"is",
"used",
"to",
"determine",
"the",
"output",
"directory",
":",
"1",
".",
"Otherwise",
"all",
"directo... | def GetNinjaOutputDirectory(chrome_root):
output_dirs = []
if ('CHROMIUM_OUT_DIR' in os.environ and
os.path.isdir(os.path.join(chrome_root, os.environ['CHROMIUM_OUT_DIR']))):
output_dirs = [os.environ['CHROMIUM_OUT_DIR']]
if not output_dirs:
generator_flags = os.getenv('GYP_GENERATOR_FLAGS', '').spl... | [
"def",
"GetNinjaOutputDirectory",
"(",
"chrome_root",
")",
":",
"output_dirs",
"=",
"[",
"]",
"if",
"(",
"'CHROMIUM_OUT_DIR'",
"in",
"os",
".",
"environ",
"and",
"os",
".",
"path",
".",
"isdir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"chrome_root",
",... | Returns <chrome_root>/<output_dir>/(Release|Debug|<other>). | [
"Returns",
"<chrome_root",
">",
"/",
"<output_dir",
">",
"/",
"(",
"Release|Debug|<other",
">",
")",
"."
] | [
"\"\"\"Returns <chrome_root>/<output_dir>/(Release|Debug|<other>).\n\n If either of the following environment variables are set, their\n value is used to determine the output directory:\n 1. CHROMIUM_OUT_DIR environment variable.\n 2. GYP_GENERATOR_FLAGS environment variable output_dir property.\n\n Otherw... | [
{
"param": "chrome_root",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "chrome_root",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
651d99230f187072cfcd5ef954531952648c6c46 | sunlongbo/chromium | tools/translation/helper/grd_helper.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetGrdMessages | <not_specific> | def GetGrdMessages(grd_path_or_string, dir_path):
"""Load the grd file and return a dict of message ids to messages.
Ignores non-translateable messages."""
doc = grit.grd_reader.Parse(
grd_path_or_string,
dir_path,
stop_after=None,
first_ids_file=None,
debug=False,
defines={'_... | Load the grd file and return a dict of message ids to messages.
Ignores non-translateable messages. | Load the grd file and return a dict of message ids to messages.
Ignores non-translateable messages. | [
"Load",
"the",
"grd",
"file",
"and",
"return",
"a",
"dict",
"of",
"message",
"ids",
"to",
"messages",
".",
"Ignores",
"non",
"-",
"translateable",
"messages",
"."
] | def GetGrdMessages(grd_path_or_string, dir_path):
doc = grit.grd_reader.Parse(
grd_path_or_string,
dir_path,
stop_after=None,
first_ids_file=None,
debug=False,
defines={'_chromium': 1},
tags_to_ignore=set(TAGS_TO_IGNORE))
return {
msg.attrs['name']: msg
for msg ... | [
"def",
"GetGrdMessages",
"(",
"grd_path_or_string",
",",
"dir_path",
")",
":",
"doc",
"=",
"grit",
".",
"grd_reader",
".",
"Parse",
"(",
"grd_path_or_string",
",",
"dir_path",
",",
"stop_after",
"=",
"None",
",",
"first_ids_file",
"=",
"None",
",",
"debug",
... | Load the grd file and return a dict of message ids to messages. | [
"Load",
"the",
"grd",
"file",
"and",
"return",
"a",
"dict",
"of",
"message",
"ids",
"to",
"messages",
"."
] | [
"\"\"\"Load the grd file and return a dict of message ids to messages.\n\n Ignores non-translateable messages.\"\"\""
] | [
{
"param": "grd_path_or_string",
"type": null
},
{
"param": "dir_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "grd_path_or_string",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dir_path",
"type": null,
"docstring": null,
"do... |
651d99230f187072cfcd5ef954531952648c6c46 | sunlongbo/chromium | tools/translation/helper/grd_helper.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetGrdpMessagesFromString | <not_specific> | def GetGrdpMessagesFromString(grdp_string):
"""Parses the contents of the grdp file given in grdp_string.
grd_reader can't parse grdp files directly. Instead, this replaces grd
specific tags in the input string with grdp specific tags, writes the output
string in a temporary file and loads the grd from t... | Parses the contents of the grdp file given in grdp_string.
grd_reader can't parse grdp files directly. Instead, this replaces grd
specific tags in the input string with grdp specific tags, writes the output
string in a temporary file and loads the grd from the temporary file.
This code previously crea... | Parses the contents of the grdp file given in grdp_string.
grd_reader can't parse grdp files directly. Instead, this replaces grd
specific tags in the input string with grdp specific tags, writes the output
string in a temporary file and loads the grd from the temporary file.
This code previously created a temporary d... | [
"Parses",
"the",
"contents",
"of",
"the",
"grdp",
"file",
"given",
"in",
"grdp_string",
".",
"grd_reader",
"can",
"'",
"t",
"parse",
"grdp",
"files",
"directly",
".",
"Instead",
"this",
"replaces",
"grd",
"specific",
"tags",
"in",
"the",
"input",
"string",
... | def GetGrdpMessagesFromString(grdp_string):
replaced_string = grdp_string.replace(
'<grit-part>',
"""<grit base_dir="." latest_public_release="1" current_release="1">
<release seq="1">
<messages fallback_to_english="true">
""")
replaced_string = replaced_string.replace(... | [
"def",
"GetGrdpMessagesFromString",
"(",
"grdp_string",
")",
":",
"replaced_string",
"=",
"grdp_string",
".",
"replace",
"(",
"'<grit-part>'",
",",
"\"\"\"<grit base_dir=\".\" latest_public_release=\"1\" current_release=\"1\">\n <release seq=\"1\">\n <messages fal... | Parses the contents of the grdp file given in grdp_string. | [
"Parses",
"the",
"contents",
"of",
"the",
"grdp",
"file",
"given",
"in",
"grdp_string",
"."
] | [
"\"\"\"Parses the contents of the grdp file given in grdp_string.\n\n grd_reader can't parse grdp files directly. Instead, this replaces grd\n specific tags in the input string with grdp specific tags, writes the output\n string in a temporary file and loads the grd from the temporary file.\n\n This cod... | [
{
"param": "grdp_string",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "grdp_string",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
653200c1adcff1703e032a27bc365524ca809a16 | sunlongbo/chromium | tools/perf/generate_perf_sharding.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetBuilderPlatforms | <not_specific> | def _GetBuilderPlatforms(builders, waterfall):
"""Get a list of PerfBuilder objects for the given builders or waterfall.
Otherwise, just return all platforms.
"""
if builders:
return {b for b in bot_platforms.ALL_PLATFORMS if b.name in
builders}
elif waterfall == 'perf':
return bot_pl... | Get a list of PerfBuilder objects for the given builders or waterfall.
Otherwise, just return all platforms.
| Get a list of PerfBuilder objects for the given builders or waterfall.
Otherwise, just return all platforms. | [
"Get",
"a",
"list",
"of",
"PerfBuilder",
"objects",
"for",
"the",
"given",
"builders",
"or",
"waterfall",
".",
"Otherwise",
"just",
"return",
"all",
"platforms",
"."
] | def _GetBuilderPlatforms(builders, waterfall):
if builders:
return {b for b in bot_platforms.ALL_PLATFORMS if b.name in
builders}
elif waterfall == 'perf':
return bot_platforms.OFFICIAL_PLATFORMS
elif waterfall == 'perf-fyi':
return bot_platforms.FYI_PLATFORMS
else:
return bot_pl... | [
"def",
"_GetBuilderPlatforms",
"(",
"builders",
",",
"waterfall",
")",
":",
"if",
"builders",
":",
"return",
"{",
"b",
"for",
"b",
"in",
"bot_platforms",
".",
"ALL_PLATFORMS",
"if",
"b",
".",
"name",
"in",
"builders",
"}",
"elif",
"waterfall",
"==",
"'perf... | Get a list of PerfBuilder objects for the given builders or waterfall. | [
"Get",
"a",
"list",
"of",
"PerfBuilder",
"objects",
"for",
"the",
"given",
"builders",
"or",
"waterfall",
"."
] | [
"\"\"\"Get a list of PerfBuilder objects for the given builders or waterfall.\n\n Otherwise, just return all platforms.\n \"\"\""
] | [
{
"param": "builders",
"type": null
},
{
"param": "waterfall",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "builders",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "waterfall",
"type": null,
"docstring": null,
"docstring_t... |
653200c1adcff1703e032a27bc365524ca809a16 | sunlongbo/chromium | tools/perf/generate_perf_sharding.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _DescheduleBenchmark | null | def _DescheduleBenchmark(args):
"""Remove benchmarks from the shard maps without re-sharding."""
del args
builders = bot_platforms.ALL_PLATFORMS
for b in builders:
benchmarks_to_keep = set(
benchmark.Name() for benchmark in b.benchmarks_to_run)
executables_to_keep = set(executable.name for execu... | Remove benchmarks from the shard maps without re-sharding. | Remove benchmarks from the shard maps without re-sharding. | [
"Remove",
"benchmarks",
"from",
"the",
"shard",
"maps",
"without",
"re",
"-",
"sharding",
"."
] | def _DescheduleBenchmark(args):
del args
builders = bot_platforms.ALL_PLATFORMS
for b in builders:
benchmarks_to_keep = set(
benchmark.Name() for benchmark in b.benchmarks_to_run)
executables_to_keep = set(executable.name for executable in b.executables)
with open(b.shards_map_file_path, 'r') ... | [
"def",
"_DescheduleBenchmark",
"(",
"args",
")",
":",
"del",
"args",
"builders",
"=",
"bot_platforms",
".",
"ALL_PLATFORMS",
"for",
"b",
"in",
"builders",
":",
"benchmarks_to_keep",
"=",
"set",
"(",
"benchmark",
".",
"Name",
"(",
")",
"for",
"benchmark",
"in... | Remove benchmarks from the shard maps without re-sharding. | [
"Remove",
"benchmarks",
"from",
"the",
"shard",
"maps",
"without",
"re",
"-",
"sharding",
"."
] | [
"\"\"\"Remove benchmarks from the shard maps without re-sharding.\"\"\""
] | [
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
653200c1adcff1703e032a27bc365524ca809a16 | sunlongbo/chromium | tools/perf/generate_perf_sharding.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ValidateShardMaps | <not_specific> | def _ValidateShardMaps(args):
"""Validate that the shard maps, csv files, etc. are consistent."""
del args
errors = []
tempdir = tempfile.mkdtemp()
try:
builders = _GetBuilderPlatforms(builders=None, waterfall='all')
for builder in builders:
output_file = os.path.join(
tempdir, os.pat... | Validate that the shard maps, csv files, etc. are consistent. | Validate that the shard maps, csv files, etc. are consistent. | [
"Validate",
"that",
"the",
"shard",
"maps",
"csv",
"files",
"etc",
".",
"are",
"consistent",
"."
] | def _ValidateShardMaps(args):
del args
errors = []
tempdir = tempfile.mkdtemp()
try:
builders = _GetBuilderPlatforms(builders=None, waterfall='all')
for builder in builders:
output_file = os.path.join(
tempdir, os.path.basename(builder.timing_file_path))
_FilterTimingData(builder, ... | [
"def",
"_ValidateShardMaps",
"(",
"args",
")",
":",
"del",
"args",
"errors",
"=",
"[",
"]",
"tempdir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"try",
":",
"builders",
"=",
"_GetBuilderPlatforms",
"(",
"builders",
"=",
"None",
",",
"waterfall",
"=",
"'... | Validate that the shard maps, csv files, etc. | [
"Validate",
"that",
"the",
"shard",
"maps",
"csv",
"files",
"etc",
"."
] | [
"\"\"\"Validate that the shard maps, csv files, etc. are consistent.\"\"\"",
"# Check that bot_platforms.py matches the actual shard maps",
"# Check that every official benchmark is scheduled on some shard map.",
"# TODO(crbug.com/963614): Note that this check can be deleted if we",
"# find some way other t... | [
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0477100491c3190880de92fe57a013d50ddd7fa4 | sunlongbo/chromium | ppapi/generators/idl_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GenerateFile | <not_specific> | def GenerateFile(self, filenode, releases, options):
"""Generates an output file from the IDL source.
Returns true if the generated file is different than the previously
generated file.
"""
__pychecker__ = 'unusednames=filenode,releases,options'
self.Error("Undefined release generator.")
re... | Generates an output file from the IDL source.
Returns true if the generated file is different than the previously
generated file.
| Generates an output file from the IDL source.
Returns true if the generated file is different than the previously
generated file. | [
"Generates",
"an",
"output",
"file",
"from",
"the",
"IDL",
"source",
".",
"Returns",
"true",
"if",
"the",
"generated",
"file",
"is",
"different",
"than",
"the",
"previously",
"generated",
"file",
"."
] | def GenerateFile(self, filenode, releases, options):
__pychecker__ = 'unusednames=filenode,releases,options'
self.Error("Undefined release generator.")
return 0 | [
"def",
"GenerateFile",
"(",
"self",
",",
"filenode",
",",
"releases",
",",
"options",
")",
":",
"__pychecker__",
"=",
"'unusednames=filenode,releases,options'",
"self",
".",
"Error",
"(",
"\"Undefined release generator.\"",
")",
"return",
"0"
] | Generates an output file from the IDL source. | [
"Generates",
"an",
"output",
"file",
"from",
"the",
"IDL",
"source",
"."
] | [
"\"\"\"Generates an output file from the IDL source.\n\n Returns true if the generated file is different than the previously\n generated file.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filenode",
"type": null
},
{
"param": "releases",
"type": null
},
{
"param": "options",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filenode",
"type": null,
"docstring": null,
"docstring_tokens... |
1f573860320ced3e81ceae498b98c3938dda8ca5 | sunlongbo/chromium | tools/metrics/common/models.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetUnexpectedChildren | <not_specific> | def GetUnexpectedChildren(node, tags):
"""Gets a set of unexpected children from |node|."""
# Ingore text and comment nodes.
return (set(child.nodeName for child in node.childNodes) - set(tags) - set(
('#comment', '#text'))) | Gets a set of unexpected children from |node|. | Gets a set of unexpected children from |node|. | [
"Gets",
"a",
"set",
"of",
"unexpected",
"children",
"from",
"|node|",
"."
] | def GetUnexpectedChildren(node, tags):
return (set(child.nodeName for child in node.childNodes) - set(tags) - set(
('#comment', '#text'))) | [
"def",
"GetUnexpectedChildren",
"(",
"node",
",",
"tags",
")",
":",
"return",
"(",
"set",
"(",
"child",
".",
"nodeName",
"for",
"child",
"in",
"node",
".",
"childNodes",
")",
"-",
"set",
"(",
"tags",
")",
"-",
"set",
"(",
"(",
"'#comment'",
",",
"'#t... | Gets a set of unexpected children from |node|. | [
"Gets",
"a",
"set",
"of",
"unexpected",
"children",
"from",
"|node|",
"."
] | [
"\"\"\"Gets a set of unexpected children from |node|.\"\"\"",
"# Ingore text and comment nodes."
] | [
{
"param": "node",
"type": null
},
{
"param": "tags",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tags",
"type": null,
"docstring": null,
"docstring_tokens": [... |
1f573860320ced3e81ceae498b98c3938dda8ca5 | sunlongbo/chromium | tools/metrics/common/models.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetRequiredAttributes | <not_specific> | def GetRequiredAttributes(self):
"""Gets a list of required attributes that this node has.
Returns:
A list of names of required attributes of the node.
"""
return [] | Gets a list of required attributes that this node has.
Returns:
A list of names of required attributes of the node.
| Gets a list of required attributes that this node has. | [
"Gets",
"a",
"list",
"of",
"required",
"attributes",
"that",
"this",
"node",
"has",
"."
] | def GetRequiredAttributes(self):
return [] | [
"def",
"GetRequiredAttributes",
"(",
"self",
")",
":",
"return",
"[",
"]"
] | Gets a list of required attributes that this node has. | [
"Gets",
"a",
"list",
"of",
"required",
"attributes",
"that",
"this",
"node",
"has",
"."
] | [
"\"\"\"Gets a list of required attributes that this node has.\n\n Returns:\n A list of names of required attributes of the node.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of names of required attributes of the node.",
"docstring_tokens": [
"A",
"list",
"of",
"names",
"of",
"required",
"attributes",
"of",
"the",
"node",
"."
],
"type":... |
1f573860320ced3e81ceae498b98c3938dda8ca5 | sunlongbo/chromium | tools/metrics/common/models.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Unmarshall | <not_specific> | def Unmarshall(self, node):
"""Extracts the content of the node to an object.
Args:
node: The XML node to extract data from.
Returns:
The object representation of the node.
"""
obj = {}
obj[COMMENT_KEY] = GetCommentsForNode(node)
if not node.firstChild:
return obj
t... | Extracts the content of the node to an object.
Args:
node: The XML node to extract data from.
Returns:
The object representation of the node.
| Extracts the content of the node to an object. | [
"Extracts",
"the",
"content",
"of",
"the",
"node",
"to",
"an",
"object",
"."
] | def Unmarshall(self, node):
obj = {}
obj[COMMENT_KEY] = GetCommentsForNode(node)
if not node.firstChild:
return obj
text = node.firstChild.nodeValue
obj[TEXT_KEY] = '\n\n'.join(pretty_print_xml.SplitParagraphs(text))
unexpected = GetUnexpectedChildren(node, set())
if unexpected:
... | [
"def",
"Unmarshall",
"(",
"self",
",",
"node",
")",
":",
"obj",
"=",
"{",
"}",
"obj",
"[",
"COMMENT_KEY",
"]",
"=",
"GetCommentsForNode",
"(",
"node",
")",
"if",
"not",
"node",
".",
"firstChild",
":",
"return",
"obj",
"text",
"=",
"node",
".",
"first... | Extracts the content of the node to an object. | [
"Extracts",
"the",
"content",
"of",
"the",
"node",
"to",
"an",
"object",
"."
] | [
"\"\"\"Extracts the content of the node to an object.\n\n Args:\n node: The XML node to extract data from.\n\n Returns:\n The object representation of the node.\n \"\"\"",
"# TextNode shouldn't have any child."
] | [
{
"param": "self",
"type": null
},
{
"param": "node",
"type": null
}
] | {
"returns": [
{
"docstring": "The object representation of the node.",
"docstring_tokens": [
"The",
"object",
"representation",
"of",
"the",
"node",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier... |
1f573860320ced3e81ceae498b98c3938dda8ca5 | sunlongbo/chromium | tools/metrics/common/models.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Marshall | <not_specific> | def Marshall(self, doc, obj):
"""Converts an object into an XML node of this type.
Args:
doc: A document to create an XML node in.
obj: An object to be encoded into the XML.
Returns:
An XML node encoding the object.
"""
node = doc.createElement(self.tag)
text = obj.get(TEXT_K... | Converts an object into an XML node of this type.
Args:
doc: A document to create an XML node in.
obj: An object to be encoded into the XML.
Returns:
An XML node encoding the object.
| Converts an object into an XML node of this type. | [
"Converts",
"an",
"object",
"into",
"an",
"XML",
"node",
"of",
"this",
"type",
"."
] | def Marshall(self, doc, obj):
node = doc.createElement(self.tag)
text = obj.get(TEXT_KEY)
if text:
node.appendChild(doc.createTextNode(text))
return node | [
"def",
"Marshall",
"(",
"self",
",",
"doc",
",",
"obj",
")",
":",
"node",
"=",
"doc",
".",
"createElement",
"(",
"self",
".",
"tag",
")",
"text",
"=",
"obj",
".",
"get",
"(",
"TEXT_KEY",
")",
"if",
"text",
":",
"node",
".",
"appendChild",
"(",
"d... | Converts an object into an XML node of this type. | [
"Converts",
"an",
"object",
"into",
"an",
"XML",
"node",
"of",
"this",
"type",
"."
] | [
"\"\"\"Converts an object into an XML node of this type.\n\n Args:\n doc: A document to create an XML node in.\n obj: An object to be encoded into the XML.\n\n Returns:\n An XML node encoding the object.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "doc",
"type": null
},
{
"param": "obj",
"type": null
}
] | {
"returns": [
{
"docstring": "An XML node encoding the object.",
"docstring_tokens": [
"An",
"XML",
"node",
"encoding",
"the",
"object",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
... |
1f573860320ced3e81ceae498b98c3938dda8ca5 | sunlongbo/chromium | tools/metrics/common/models.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Unmarshall | <not_specific> | def Unmarshall(self, node):
"""Extracts the content of the node to an object.
Args:
node: The XML node to extract data from.
Returns:
An object extracted from the node.
Raises:
ValueError: The node is missing required children.
"""
obj = {}
obj[COMMENT_KEY] = GetComments... | Extracts the content of the node to an object.
Args:
node: The XML node to extract data from.
Returns:
An object extracted from the node.
Raises:
ValueError: The node is missing required children.
| Extracts the content of the node to an object. | [
"Extracts",
"the",
"content",
"of",
"the",
"node",
"to",
"an",
"object",
"."
] | def Unmarshall(self, node):
obj = {}
obj[COMMENT_KEY] = GetCommentsForNode(node)
for attr, attr_type, attr_re in self.attributes:
if node.hasAttribute(attr):
obj[attr] = attr_type(node.getAttribute(attr))
if attr_re is not None:
attr_val = obj.get(attr, '')
if not re.matc... | [
"def",
"Unmarshall",
"(",
"self",
",",
"node",
")",
":",
"obj",
"=",
"{",
"}",
"obj",
"[",
"COMMENT_KEY",
"]",
"=",
"GetCommentsForNode",
"(",
"node",
")",
"for",
"attr",
",",
"attr_type",
",",
"attr_re",
"in",
"self",
".",
"attributes",
":",
"if",
"... | Extracts the content of the node to an object. | [
"Extracts",
"the",
"content",
"of",
"the",
"node",
"to",
"an",
"object",
"."
] | [
"\"\"\"Extracts the content of the node to an object.\n\n Args:\n node: The XML node to extract data from.\n\n Returns:\n An object extracted from the node.\n\n Raises:\n ValueError: The node is missing required children.\n \"\"\"",
"# We need to iterate through all the children and get... | [
{
"param": "self",
"type": null
},
{
"param": "node",
"type": null
}
] | {
"returns": [
{
"docstring": "An object extracted from the node.",
"docstring_tokens": [
"An",
"object",
"extracted",
"from",
"the",
"node",
"."
],
"type": null
}
],
"raises": [
{
"docstring": "The node is missing r... |
1f573860320ced3e81ceae498b98c3938dda8ca5 | sunlongbo/chromium | tools/metrics/common/models.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetRequiredAttributes | <not_specific> | def GetRequiredAttributes(self):
"""Gets a list of required attributes that this node has.
Returns:
A list of names of required attributes, or an empty list if there is no
required attribute.
"""
return self.required_attributes or [] | Gets a list of required attributes that this node has.
Returns:
A list of names of required attributes, or an empty list if there is no
required attribute.
| Gets a list of required attributes that this node has. | [
"Gets",
"a",
"list",
"of",
"required",
"attributes",
"that",
"this",
"node",
"has",
"."
] | def GetRequiredAttributes(self):
return self.required_attributes or [] | [
"def",
"GetRequiredAttributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"required_attributes",
"or",
"[",
"]"
] | Gets a list of required attributes that this node has. | [
"Gets",
"a",
"list",
"of",
"required",
"attributes",
"that",
"this",
"node",
"has",
"."
] | [
"\"\"\"Gets a list of required attributes that this node has.\n\n Returns:\n A list of names of required attributes, or an empty list if there is no\n required attribute.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of names of required attributes, or an empty list if there is no\nrequired attribute.",
"docstring_tokens": [
"A",
"list",
"of",
"names",
"of",
"required",
"attributes",
"or",
"an",
"e... |
1f573860320ced3e81ceae498b98c3938dda8ca5 | sunlongbo/chromium | tools/metrics/common/models.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Parse | <not_specific> | def Parse(self, input_file):
"""Parses the input file, which can be minidom, ET or xml string.
The flexibility of input is to accommodate the currently different
representations of ukm, enums, histograms and actions in their
respective pretty_print.py.
Args:
input_file: The input file can be... | Parses the input file, which can be minidom, ET or xml string.
The flexibility of input is to accommodate the currently different
representations of ukm, enums, histograms and actions in their
respective pretty_print.py.
Args:
input_file: The input file can be given in the form of minidom, ET
... | Parses the input file, which can be minidom, ET or xml string.
The flexibility of input is to accommodate the currently different
representations of ukm, enums, histograms and actions in their
respective pretty_print.py.
The input file can be given in the form of minidom, ET
or xml string.
An object representing the ... | [
"Parses",
"the",
"input",
"file",
"which",
"can",
"be",
"minidom",
"ET",
"or",
"xml",
"string",
".",
"The",
"flexibility",
"of",
"input",
"is",
"to",
"accommodate",
"the",
"currently",
"different",
"representations",
"of",
"ukm",
"enums",
"histograms",
"and",
... | def Parse(self, input_file):
if not isinstance(input_file, minidom.Document):
if isinstance(input_file, ET.Element):
input_file = ET.tostring(input_file, encoding='utf-8', method='xml')
input_file = minidom.parseString(input_file)
return self._ParseMinidom(input_file) | [
"def",
"Parse",
"(",
"self",
",",
"input_file",
")",
":",
"if",
"not",
"isinstance",
"(",
"input_file",
",",
"minidom",
".",
"Document",
")",
":",
"if",
"isinstance",
"(",
"input_file",
",",
"ET",
".",
"Element",
")",
":",
"input_file",
"=",
"ET",
".",... | Parses the input file, which can be minidom, ET or xml string. | [
"Parses",
"the",
"input",
"file",
"which",
"can",
"be",
"minidom",
"ET",
"or",
"xml",
"string",
"."
] | [
"\"\"\"Parses the input file, which can be minidom, ET or xml string.\n\n The flexibility of input is to accommodate the currently different\n representations of ukm, enums, histograms and actions in their\n respective pretty_print.py.\n\n Args:\n input_file: The input file can be given in the form... | [
{
"param": "self",
"type": null
},
{
"param": "input_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_file",
"type": null,
"docstring": null,
"docstring_toke... |
1f573860320ced3e81ceae498b98c3938dda8ca5 | sunlongbo/chromium | tools/metrics/common/models.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetPrintStyle | <not_specific> | def GetPrintStyle(self):
"""Gets an XmlStyle object for pretty printing a document of this type.
Returns:
An XML style object.
"""
types = self.root_type.GetNodeTypes()
return pretty_print_xml.XmlStyle(
attribute_order={t: types[t].GetAttributes()
for t in typ... | Gets an XmlStyle object for pretty printing a document of this type.
Returns:
An XML style object.
| Gets an XmlStyle object for pretty printing a document of this type. | [
"Gets",
"an",
"XmlStyle",
"object",
"for",
"pretty",
"printing",
"a",
"document",
"of",
"this",
"type",
"."
] | def GetPrintStyle(self):
types = self.root_type.GetNodeTypes()
return pretty_print_xml.XmlStyle(
attribute_order={t: types[t].GetAttributes()
for t in types},
required_attributes={
t: types[t].GetRequiredAttributes()
for t in types
},
... | [
"def",
"GetPrintStyle",
"(",
"self",
")",
":",
"types",
"=",
"self",
".",
"root_type",
".",
"GetNodeTypes",
"(",
")",
"return",
"pretty_print_xml",
".",
"XmlStyle",
"(",
"attribute_order",
"=",
"{",
"t",
":",
"types",
"[",
"t",
"]",
".",
"GetAttributes",
... | Gets an XmlStyle object for pretty printing a document of this type. | [
"Gets",
"an",
"XmlStyle",
"object",
"for",
"pretty",
"printing",
"a",
"document",
"of",
"this",
"type",
"."
] | [
"\"\"\"Gets an XmlStyle object for pretty printing a document of this type.\n\n Returns:\n An XML style object.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "An XML style object.",
"docstring_tokens": [
"An",
"XML",
"style",
"object",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
... |
5a3729fbee312d98adba00729ef7a863cd968cb1 | sunlongbo/chromium | testing/merge_scripts/standard_gtest_merge.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | merge_shard_results | <not_specific> | def merge_shard_results(summary_json, jsons_to_merge):
"""Reads JSON test output from all shards and combines them into one.
Returns dict with merged test output on success or None on failure. Emits
annotations.
"""
# summary.json is produced by swarming client itself. We are mostly interested
# in the num... | Reads JSON test output from all shards and combines them into one.
Returns dict with merged test output on success or None on failure. Emits
annotations.
| Reads JSON test output from all shards and combines them into one.
Returns dict with merged test output on success or None on failure. Emits
annotations. | [
"Reads",
"JSON",
"test",
"output",
"from",
"all",
"shards",
"and",
"combines",
"them",
"into",
"one",
".",
"Returns",
"dict",
"with",
"merged",
"test",
"output",
"on",
"success",
"or",
"None",
"on",
"failure",
".",
"Emits",
"annotations",
"."
] | def merge_shard_results(summary_json, jsons_to_merge):
try:
with open(summary_json) as f:
summary = json.load(f)
except (IOError, ValueError):
emit_warning(
'summary.json is missing or can not be read',
'Something is seriously wrong with swarming client or the bot.')
return None
... | [
"def",
"merge_shard_results",
"(",
"summary_json",
",",
"jsons_to_merge",
")",
":",
"try",
":",
"with",
"open",
"(",
"summary_json",
")",
"as",
"f",
":",
"summary",
"=",
"json",
".",
"load",
"(",
"f",
")",
"except",
"(",
"IOError",
",",
"ValueError",
")"... | Reads JSON test output from all shards and combines them into one. | [
"Reads",
"JSON",
"test",
"output",
"from",
"all",
"shards",
"and",
"combines",
"them",
"into",
"one",
"."
] | [
"\"\"\"Reads JSON test output from all shards and combines them into one.\n\n Returns dict with merged test output on success or None on failure. Emits\n annotations.\n \"\"\"",
"# summary.json is produced by swarming client itself. We are mostly interested",
"# in the number of shards.",
"# Merge all JSON... | [
{
"param": "summary_json",
"type": null
},
{
"param": "jsons_to_merge",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "summary_json",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "jsons_to_merge",
"type": null,
"docstring": null,
"do... |
5a3729fbee312d98adba00729ef7a863cd968cb1 | sunlongbo/chromium | testing/merge_scripts/standard_gtest_merge.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | load_shard_json | <not_specific> | def load_shard_json(index, task_id, jsons_to_merge):
"""Reads JSON output of the specified shard.
Args:
output_dir: The directory in which to look for the JSON output to load.
index: The index of the shard to load data for, this is for old api.
task_id: The directory of the shard to load data for, this... | Reads JSON output of the specified shard.
Args:
output_dir: The directory in which to look for the JSON output to load.
index: The index of the shard to load data for, this is for old api.
task_id: The directory of the shard to load data for, this is for new api.
Returns: A tuple containing:
* The... | Reads JSON output of the specified shard. | [
"Reads",
"JSON",
"output",
"of",
"the",
"specified",
"shard",
"."
] | def load_shard_json(index, task_id, jsons_to_merge):
matching_json_files = [
j for j in jsons_to_merge
if (os.path.basename(j) == 'output.json' and
(os.path.basename(os.path.dirname(j)) == str(index) or
os.path.basename(os.path.dirname(j)) == task_id))]
if not matching_json_files:
... | [
"def",
"load_shard_json",
"(",
"index",
",",
"task_id",
",",
"jsons_to_merge",
")",
":",
"matching_json_files",
"=",
"[",
"j",
"for",
"j",
"in",
"jsons_to_merge",
"if",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"j",
")",
"==",
"'output.json'",
"and",
... | Reads JSON output of the specified shard. | [
"Reads",
"JSON",
"output",
"of",
"the",
"specified",
"shard",
"."
] | [
"\"\"\"Reads JSON output of the specified shard.\n\n Args:\n output_dir: The directory in which to look for the JSON output to load.\n index: The index of the shard to load data for, this is for old api.\n task_id: The directory of the shard to load data for, this is for new api.\n\n Returns: A tuple con... | [
{
"param": "index",
"type": null
},
{
"param": "task_id",
"type": null
},
{
"param": "jsons_to_merge",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "index",
"type": null,
"docstring": "The index of the shard to load data for, this is for old api.",
"docstring_tokens": [
"The",
"index",
"of",
"the",
"shard",
"to",
"loa... |
6e48a80852f26f4ba7c1985e47e7b39696a3d932 | sunlongbo/chromium | tools/cygprofile/compare_orderfiles.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParseOrderfile | <not_specific> | def ParseOrderfile(filename):
"""Parses an orderfile into a list of symbols.
Args:
filename: (str) Path to the orderfile.
Returns:
[str] List of symbols.
"""
symbols = []
lines = []
already_seen = set()
with open(filename, 'r') as f:
lines = [line.strip() for line in f]
# The (new) orde... | Parses an orderfile into a list of symbols.
Args:
filename: (str) Path to the orderfile.
Returns:
[str] List of symbols.
| Parses an orderfile into a list of symbols. | [
"Parses",
"an",
"orderfile",
"into",
"a",
"list",
"of",
"symbols",
"."
] | def ParseOrderfile(filename):
symbols = []
lines = []
already_seen = set()
with open(filename, 'r') as f:
lines = [line.strip() for line in f]
if not lines[0].startswith('.text.'):
for entry in lines:
symbol_name = entry.rstrip('\n')
assert symbol_name != '*' and symbol_name != '.text'
... | [
"def",
"ParseOrderfile",
"(",
"filename",
")",
":",
"symbols",
"=",
"[",
"]",
"lines",
"=",
"[",
"]",
"already_seen",
"=",
"set",
"(",
")",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"f",
":",
"lines",
"=",
"[",
"line",
".",
"strip",
... | Parses an orderfile into a list of symbols. | [
"Parses",
"an",
"orderfile",
"into",
"a",
"list",
"of",
"symbols",
"."
] | [
"\"\"\"Parses an orderfile into a list of symbols.\n\n Args:\n filename: (str) Path to the orderfile.\n\n Returns:\n [str] List of symbols.\n \"\"\"",
"# The (new) orderfiles that are oriented at the LLD linker contain only symbol",
"# names (i.e. not prefixed with '.text'). The (old) orderfiles aimed ... | [
{
"param": "filename",
"type": null
}
] | {
"returns": [
{
"docstring": "[str] List of symbols.",
"docstring_tokens": [
"[",
"str",
"]",
"List",
"of",
"symbols",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "filename",
"type": n... |
6e48a80852f26f4ba7c1985e47e7b39696a3d932 | sunlongbo/chromium | tools/cygprofile/compare_orderfiles.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Compare | <not_specific> | def Compare(first_filename, second_filename):
"""Outputs a comparison of two orderfiles to stdout.
Args:
first_filename: (str) First orderfile.
second_filename: (str) Second orderfile.
Returns:
An instance of CompareResult.
"""
first_symbols = ParseOrderfile(first_filename)
second_symbols = Pa... | Outputs a comparison of two orderfiles to stdout.
Args:
first_filename: (str) First orderfile.
second_filename: (str) Second orderfile.
Returns:
An instance of CompareResult.
| Outputs a comparison of two orderfiles to stdout. | [
"Outputs",
"a",
"comparison",
"of",
"two",
"orderfiles",
"to",
"stdout",
"."
] | def Compare(first_filename, second_filename):
first_symbols = ParseOrderfile(first_filename)
second_symbols = ParseOrderfile(second_filename)
print('Symbols count:\n\tfirst:\t%d\n\tsecond:\t%d' % (len(first_symbols),
len(second_symbols)))
first_symbols = ... | [
"def",
"Compare",
"(",
"first_filename",
",",
"second_filename",
")",
":",
"first_symbols",
"=",
"ParseOrderfile",
"(",
"first_filename",
")",
"second_symbols",
"=",
"ParseOrderfile",
"(",
"second_filename",
")",
"print",
"(",
"'Symbols count:\\n\\tfirst:\\t%d\\n\\tsecond... | Outputs a comparison of two orderfiles to stdout. | [
"Outputs",
"a",
"comparison",
"of",
"two",
"orderfiles",
"to",
"stdout",
"."
] | [
"\"\"\"Outputs a comparison of two orderfiles to stdout.\n\n Args:\n first_filename: (str) First orderfile.\n second_filename: (str) Second orderfile.\n\n Returns:\n An instance of CompareResult.\n \"\"\"",
"# Distance between orderfiles.",
"# Each distance is in [0, len(common_symbols)] and there a... | [
{
"param": "first_filename",
"type": null
},
{
"param": "second_filename",
"type": null
}
] | {
"returns": [
{
"docstring": "An instance of CompareResult.",
"docstring_tokens": [
"An",
"instance",
"of",
"CompareResult",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "first_filename",
"type": null,... |
6e48a80852f26f4ba7c1985e47e7b39696a3d932 | sunlongbo/chromium | tools/cygprofile/compare_orderfiles.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckOrderfileCommit | null | def CheckOrderfileCommit(commit_hash, clank_path):
"""Asserts that a commit is an orderfile update from the bot.
Args:
commit_hash: (str) Git hash of the orderfile roll commit.
clank_path: (str) Path to the clank repository.
"""
output = subprocess.check_output(['git', 'show', r'--format=%s', commit_ha... | Asserts that a commit is an orderfile update from the bot.
Args:
commit_hash: (str) Git hash of the orderfile roll commit.
clank_path: (str) Path to the clank repository.
| Asserts that a commit is an orderfile update from the bot. | [
"Asserts",
"that",
"a",
"commit",
"is",
"an",
"orderfile",
"update",
"from",
"the",
"bot",
"."
] | def CheckOrderfileCommit(commit_hash, clank_path):
output = subprocess.check_output(['git', 'show', r'--format=%s', commit_hash],
cwd=clank_path)
first_line = output.split('\n')[0]
assert first_line.upper().endswith(
'Update Orderfile.'.upper()), ('Not an orderfile commit'... | [
"def",
"CheckOrderfileCommit",
"(",
"commit_hash",
",",
"clank_path",
")",
":",
"output",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'git'",
",",
"'show'",
",",
"r'--format=%s'",
",",
"commit_hash",
"]",
",",
"cwd",
"=",
"clank_path",
")",
"first_line"... | Asserts that a commit is an orderfile update from the bot. | [
"Asserts",
"that",
"a",
"commit",
"is",
"an",
"orderfile",
"update",
"from",
"the",
"bot",
"."
] | [
"\"\"\"Asserts that a commit is an orderfile update from the bot.\n\n Args:\n commit_hash: (str) Git hash of the orderfile roll commit.\n clank_path: (str) Path to the clank repository.\n \"\"\"",
"# Capitalization changed at some point. Not checking the bot name because it",
"# changed too."
] | [
{
"param": "commit_hash",
"type": null
},
{
"param": "clank_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "commit_hash",
"type": null,
"docstring": "(str) Git hash of the orderfile roll commit.",
"docstring_tokens": [
"(",
"str",
")",
"Git",
"hash",
"of",
"the",
"order... |
8df18ec01005e90525a5311ce3eb9784f8ba50e0 | sunlongbo/chromium | tools/android/elf_compression/test/elf_headers_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testElfHeaderSectionNames | null | def testElfHeaderSectionNames(self):
"""Test that the section names are correctly resolved"""
with open(self.library_path, 'rb') as f:
data = f.read()
elf = elf_headers.ElfHeader(data)
section_names = [
'',
'.hash',
'.gnu.hash',
'.dynsym',
'.dynstr',
... | Test that the section names are correctly resolved | Test that the section names are correctly resolved | [
"Test",
"that",
"the",
"section",
"names",
"are",
"correctly",
"resolved"
] | def testElfHeaderSectionNames(self):
with open(self.library_path, 'rb') as f:
data = f.read()
elf = elf_headers.ElfHeader(data)
section_names = [
'',
'.hash',
'.gnu.hash',
'.dynsym',
'.dynstr',
'.gnu.version',
'.gnu.version_r',
'.rela.dyn... | [
"def",
"testElfHeaderSectionNames",
"(",
"self",
")",
":",
"with",
"open",
"(",
"self",
".",
"library_path",
",",
"'rb'",
")",
"as",
"f",
":",
"data",
"=",
"f",
".",
"read",
"(",
")",
"elf",
"=",
"elf_headers",
".",
"ElfHeader",
"(",
"data",
")",
"se... | Test that the section names are correctly resolved | [
"Test",
"that",
"the",
"section",
"names",
"are",
"correctly",
"resolved"
] | [
"\"\"\"Test that the section names are correctly resolved\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8df18ec01005e90525a5311ce3eb9784f8ba50e0 | sunlongbo/chromium | tools/android/elf_compression/test/elf_headers_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testElfHeaderNoopPatching | null | def testElfHeaderNoopPatching(self):
"""Patching the ELF without any changes."""
with open(self.library_path, 'rb') as f:
data = bytearray(f.read())
data_copy = data[:]
elf = elf_headers.ElfHeader(data)
elf.PatchData(data)
self.assertEqual(data, data_copy) | Patching the ELF without any changes. | Patching the ELF without any changes. | [
"Patching",
"the",
"ELF",
"without",
"any",
"changes",
"."
] | def testElfHeaderNoopPatching(self):
with open(self.library_path, 'rb') as f:
data = bytearray(f.read())
data_copy = data[:]
elf = elf_headers.ElfHeader(data)
elf.PatchData(data)
self.assertEqual(data, data_copy) | [
"def",
"testElfHeaderNoopPatching",
"(",
"self",
")",
":",
"with",
"open",
"(",
"self",
".",
"library_path",
",",
"'rb'",
")",
"as",
"f",
":",
"data",
"=",
"bytearray",
"(",
"f",
".",
"read",
"(",
")",
")",
"data_copy",
"=",
"data",
"[",
":",
"]",
... | Patching the ELF without any changes. | [
"Patching",
"the",
"ELF",
"without",
"any",
"changes",
"."
] | [
"\"\"\"Patching the ELF without any changes.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8df18ec01005e90525a5311ce3eb9784f8ba50e0 | sunlongbo/chromium | tools/android/elf_compression/test/elf_headers_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testElfHeaderPatchingAndParsing | null | def testElfHeaderPatchingAndParsing(self):
"""Patching the ELF and validating that it worked."""
with open(self.library_path, 'rb') as f:
data = bytearray(f.read())
elf = elf_headers.ElfHeader(data)
# Changing some values.
elf.e_ehsize = 42
elf.GetProgramHeaders()[0].p_align = 1
elf.Ge... | Patching the ELF and validating that it worked. | Patching the ELF and validating that it worked. | [
"Patching",
"the",
"ELF",
"and",
"validating",
"that",
"it",
"worked",
"."
] | def testElfHeaderPatchingAndParsing(self):
with open(self.library_path, 'rb') as f:
data = bytearray(f.read())
elf = elf_headers.ElfHeader(data)
elf.e_ehsize = 42
elf.GetProgramHeaders()[0].p_align = 1
elf.GetProgramHeaders()[0].p_filesz = 10
elf.PatchData(data)
updated_elf = elf_heade... | [
"def",
"testElfHeaderPatchingAndParsing",
"(",
"self",
")",
":",
"with",
"open",
"(",
"self",
".",
"library_path",
",",
"'rb'",
")",
"as",
"f",
":",
"data",
"=",
"bytearray",
"(",
"f",
".",
"read",
"(",
")",
")",
"elf",
"=",
"elf_headers",
".",
"ElfHea... | Patching the ELF and validating that it worked. | [
"Patching",
"the",
"ELF",
"and",
"validating",
"that",
"it",
"worked",
"."
] | [
"\"\"\"Patching the ELF and validating that it worked.\"\"\"",
"# Changing some values.",
"# Validating all of the ELF header fields.",
"# Validating all of the fields of the first segment."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e1db078dab4c589c4edb4fb6629f74392b22377e | sunlongbo/chromium | tools/metrics/histograms/update_policies.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | UpdatePoliciesHistogramDefinitions | null | def UpdatePoliciesHistogramDefinitions(policy_templates, doc):
"""Sets the children of <enum name="EnterprisePolicies" ...> node in |doc| to
values generated from policy ids contained in |policy_templates|.
Args:
policy_templates: A list of dictionaries, defining policies or policy
grou... | Sets the children of <enum name="EnterprisePolicies" ...> node in |doc| to
values generated from policy ids contained in |policy_templates|.
Args:
policy_templates: A list of dictionaries, defining policies or policy
groups. The format is exactly the same as in
polic... | Sets the children of node in |doc| to
values generated from policy ids contained in |policy_templates|. | [
"Sets",
"the",
"children",
"of",
"node",
"in",
"|doc|",
"to",
"values",
"generated",
"from",
"policy",
"ids",
"contained",
"in",
"|policy_templates|",
"."
] | def UpdatePoliciesHistogramDefinitions(policy_templates, doc):
for enum_node in doc.getElementsByTagName('enum'):
if enum_node.attributes['name'].value == POLICIES_ENUM_NAME:
policy_enum_node = enum_node
break
else:
raise UserError('No policy enum node found')
while policy_enum_node.hasChildNo... | [
"def",
"UpdatePoliciesHistogramDefinitions",
"(",
"policy_templates",
",",
"doc",
")",
":",
"for",
"enum_node",
"in",
"doc",
".",
"getElementsByTagName",
"(",
"'enum'",
")",
":",
"if",
"enum_node",
".",
"attributes",
"[",
"'name'",
"]",
".",
"value",
"==",
"PO... | Sets the children of <enum name="EnterprisePolicies" ...> node in |doc| to
values generated from policy ids contained in |policy_templates|. | [
"Sets",
"the",
"children",
"of",
"<enum",
"name",
"=",
"\"",
"EnterprisePolicies",
"\"",
"...",
">",
"node",
"in",
"|doc|",
"to",
"values",
"generated",
"from",
"policy",
"ids",
"contained",
"in",
"|policy_templates|",
"."
] | [
"\"\"\"Sets the children of <enum name=\"EnterprisePolicies\" ...> node in |doc| to\n values generated from policy ids contained in |policy_templates|.\n\n Args:\n policy_templates: A list of dictionaries, defining policies or policy\n groups. The format is exactly the same as in\n ... | [
{
"param": "policy_templates",
"type": null
},
{
"param": "doc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "policy_templates",
"type": null,
"docstring": "A list of dictionaries, defining policies or policy\ngroups. The format is exactly the same as in\npolicy_templates.json file.",
"docstring_tokens": [
"A",
"list",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.