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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExpandOwnersWithoutOWNERSFilePath | null | def testExpandOwnersWithoutOWNERSFilePath(self):
"""Checks that histograms without OWNERS file paths are unchanged."""
histograms_without_file_paths = xml.dom.minidom.parseString("""
<histograms>
<histogram name="Caffeination" units="mg">
<owner>joe@chromium.org</owner>
<summary>I like coffee.</summary>
<... | Checks that histograms without OWNERS file paths are unchanged. | Checks that histograms without OWNERS file paths are unchanged. | [
"Checks",
"that",
"histograms",
"without",
"OWNERS",
"file",
"paths",
"are",
"unchanged",
"."
] | def testExpandOwnersWithoutOWNERSFilePath(self):
histograms_without_file_paths = xml.dom.minidom.parseString("""
<histograms>
<histogram name="Caffeination" units="mg">
<owner>joe@chromium.org</owner>
<summary>I like coffee.</summary>
</histogram>
</histograms>
""")
expected_histograms = histograms_without_... | [
"def",
"testExpandOwnersWithoutOWNERSFilePath",
"(",
"self",
")",
":",
"histograms_without_file_paths",
"=",
"xml",
".",
"dom",
".",
"minidom",
".",
"parseString",
"(",
"\"\"\"\n<histograms>\n\n<histogram name=\"Caffeination\" units=\"mg\">\n <owner>joe@chromium.org</owner>\n <summ... | Checks that histograms without OWNERS file paths are unchanged. | [
"Checks",
"that",
"histograms",
"without",
"OWNERS",
"file",
"paths",
"are",
"unchanged",
"."
] | [
"\"\"\"Checks that histograms without OWNERS file paths are unchanged.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExpandOwnersWithoutValidPrimaryOwner_OwnersPath | null | def testExpandOwnersWithoutValidPrimaryOwner_OwnersPath(self):
"""Checks that an error is raised when the primary owner is a file path.
A valid primary owner is an individual's email address, e.g. rae@google.com,
sam@chromium.org, or the owner placeholder.
"""
histograms_without_valid_first_owner =... | Checks that an error is raised when the primary owner is a file path.
A valid primary owner is an individual's email address, e.g. rae@google.com,
sam@chromium.org, or the owner placeholder.
| Checks that an error is raised when the primary owner is a file path.
A valid primary owner is an individual's email address, e.g. | [
"Checks",
"that",
"an",
"error",
"is",
"raised",
"when",
"the",
"primary",
"owner",
"is",
"a",
"file",
"path",
".",
"A",
"valid",
"primary",
"owner",
"is",
"an",
"individual",
"'",
"s",
"email",
"address",
"e",
".",
"g",
"."
] | def testExpandOwnersWithoutValidPrimaryOwner_OwnersPath(self):
histograms_without_valid_first_owner = xml.dom.minidom.parseString("""
<histograms>
<histogram name="Caffeination" units="mg">
<owner>src/OWNERS</owner>
<summary>I like coffee.</summary>
</histogram>
</histograms>
""")
with self.assertRaisesRege... | [
"def",
"testExpandOwnersWithoutValidPrimaryOwner_OwnersPath",
"(",
"self",
")",
":",
"histograms_without_valid_first_owner",
"=",
"xml",
".",
"dom",
".",
"minidom",
".",
"parseString",
"(",
"\"\"\"\n<histograms>\n\n<histogram name=\"Caffeination\" units=\"mg\">\n <owner>src/OWNERS</... | Checks that an error is raised when the primary owner is a file path. | [
"Checks",
"that",
"an",
"error",
"is",
"raised",
"when",
"the",
"primary",
"owner",
"is",
"a",
"file",
"path",
"."
] | [
"\"\"\"Checks that an error is raised when the primary owner is a file path.\n\n A valid primary owner is an individual's email address, e.g. rae@google.com,\n sam@chromium.org, or the owner placeholder.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExpandOwnersWithoutValidPrimaryOwner_TeamEmail | null | def testExpandOwnersWithoutValidPrimaryOwner_TeamEmail(self):
"""Checks that an error is raised when the primary owner is a team.
A valid primary owner is an individual's email address, e.g. rae@google.com,
sam@chromium.org, or the owner placeholder.
"""
histograms_without_valid_first_owner = xml.d... | Checks that an error is raised when the primary owner is a team.
A valid primary owner is an individual's email address, e.g. rae@google.com,
sam@chromium.org, or the owner placeholder.
| Checks that an error is raised when the primary owner is a team.
A valid primary owner is an individual's email address, e.g. | [
"Checks",
"that",
"an",
"error",
"is",
"raised",
"when",
"the",
"primary",
"owner",
"is",
"a",
"team",
".",
"A",
"valid",
"primary",
"owner",
"is",
"an",
"individual",
"'",
"s",
"email",
"address",
"e",
".",
"g",
"."
] | def testExpandOwnersWithoutValidPrimaryOwner_TeamEmail(self):
histograms_without_valid_first_owner = xml.dom.minidom.parseString("""
<histograms>
<histogram name="Caffeination" units="mg">
<owner>coffee-team@google.com</owner>
<summary>I like coffee.</summary>
</histogram>
</histograms>
""")
with self.asser... | [
"def",
"testExpandOwnersWithoutValidPrimaryOwner_TeamEmail",
"(",
"self",
")",
":",
"histograms_without_valid_first_owner",
"=",
"xml",
".",
"dom",
".",
"minidom",
".",
"parseString",
"(",
"\"\"\"\n<histograms>\n\n<histogram name=\"Caffeination\" units=\"mg\">\n <owner>coffee-team@g... | Checks that an error is raised when the primary owner is a team. | [
"Checks",
"that",
"an",
"error",
"is",
"raised",
"when",
"the",
"primary",
"owner",
"is",
"a",
"team",
"."
] | [
"\"\"\"Checks that an error is raised when the primary owner is a team.\n\n A valid primary owner is an individual's email address, e.g. rae@google.com,\n sam@chromium.org, or the owner placeholder.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExpandOwnersWithoutValidPrimaryOwner_InvalidEmail | null | def testExpandOwnersWithoutValidPrimaryOwner_InvalidEmail(self):
"""Checks that an error is raised when the primary owner's email is invalid.
A valid primary owner is an individual's email address, e.g. rae@google.com,
sam@chromium.org, or the owner placeholder.
"""
histograms_without_valid_first_o... | Checks that an error is raised when the primary owner's email is invalid.
A valid primary owner is an individual's email address, e.g. rae@google.com,
sam@chromium.org, or the owner placeholder.
| Checks that an error is raised when the primary owner's email is invalid.
A valid primary owner is an individual's email address, e.g. | [
"Checks",
"that",
"an",
"error",
"is",
"raised",
"when",
"the",
"primary",
"owner",
"'",
"s",
"email",
"is",
"invalid",
".",
"A",
"valid",
"primary",
"owner",
"is",
"an",
"individual",
"'",
"s",
"email",
"address",
"e",
".",
"g",
"."
] | def testExpandOwnersWithoutValidPrimaryOwner_InvalidEmail(self):
histograms_without_valid_first_owner = xml.dom.minidom.parseString("""
<histograms>
<histogram name="Caffeination" units="mg">
<owner>alex@coffee.com</owner>
<summary>I like coffee.</summary>
</histogram>
</histograms>
""")
with self.assertRai... | [
"def",
"testExpandOwnersWithoutValidPrimaryOwner_InvalidEmail",
"(",
"self",
")",
":",
"histograms_without_valid_first_owner",
"=",
"xml",
".",
"dom",
".",
"minidom",
".",
"parseString",
"(",
"\"\"\"\n<histograms>\n\n<histogram name=\"Caffeination\" units=\"mg\">\n <owner>alex@coffe... | Checks that an error is raised when the primary owner's email is invalid. | [
"Checks",
"that",
"an",
"error",
"is",
"raised",
"when",
"the",
"primary",
"owner",
"'",
"s",
"email",
"is",
"invalid",
"."
] | [
"\"\"\"Checks that an error is raised when the primary owner's email is invalid.\n\n A valid primary owner is an individual's email address, e.g. rae@google.com,\n sam@chromium.org, or the owner placeholder.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExpandOwnersWithFakeFilePath | null | def testExpandOwnersWithFakeFilePath(self):
"""Checks that an error is raised with a fake OWNERS file path."""
histograms_with_fake_file_path = xml.dom.minidom.parseString("""
<histograms>
<histogram name="Caffeination" units="mg">
<owner>joe@chromium.org</owner>
<owner>src/medium/medium/roast/OWNERS</owne... | Checks that an error is raised with a fake OWNERS file path. | Checks that an error is raised with a fake OWNERS file path. | [
"Checks",
"that",
"an",
"error",
"is",
"raised",
"with",
"a",
"fake",
"OWNERS",
"file",
"path",
"."
] | def testExpandOwnersWithFakeFilePath(self):
histograms_with_fake_file_path = xml.dom.minidom.parseString("""
<histograms>
<histogram name="Caffeination" units="mg">
<owner>joe@chromium.org</owner>
<owner>src/medium/medium/roast/OWNERS</owner>
<summary>I like coffee.</summary>
</histogram>
</histograms>
""")
... | [
"def",
"testExpandOwnersWithFakeFilePath",
"(",
"self",
")",
":",
"histograms_with_fake_file_path",
"=",
"xml",
".",
"dom",
".",
"minidom",
".",
"parseString",
"(",
"\"\"\"\n<histograms>\n\n<histogram name=\"Caffeination\" units=\"mg\">\n <owner>joe@chromium.org</owner>\n <owner>sr... | Checks that an error is raised with a fake OWNERS file path. | [
"Checks",
"that",
"an",
"error",
"is",
"raised",
"with",
"a",
"fake",
"OWNERS",
"file",
"path",
"."
] | [
"\"\"\"Checks that an error is raised with a fake OWNERS file path.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExpandOwnersWithoutOwnersFromFile | null | def testExpandOwnersWithoutOwnersFromFile(self):
"""Checks that an error is raised when no owners can be derived."""
absolute_path = _MakeOwnersFile('empty_OWNERS', self.temp_dir)
src_relative_path = _GetSrcRelativePath(absolute_path)
with open(absolute_path, 'w') as owners_file:
owners_file.writ... | Checks that an error is raised when no owners can be derived. | Checks that an error is raised when no owners can be derived. | [
"Checks",
"that",
"an",
"error",
"is",
"raised",
"when",
"no",
"owners",
"can",
"be",
"derived",
"."
] | def testExpandOwnersWithoutOwnersFromFile(self):
absolute_path = _MakeOwnersFile('empty_OWNERS', self.temp_dir)
src_relative_path = _GetSrcRelativePath(absolute_path)
with open(absolute_path, 'w') as owners_file:
owners_file.write('')
histograms_without_owners_from_file = xml.dom.minidom.parseSt... | [
"def",
"testExpandOwnersWithoutOwnersFromFile",
"(",
"self",
")",
":",
"absolute_path",
"=",
"_MakeOwnersFile",
"(",
"'empty_OWNERS'",
",",
"self",
".",
"temp_dir",
")",
"src_relative_path",
"=",
"_GetSrcRelativePath",
"(",
"absolute_path",
")",
"with",
"open",
"(",
... | Checks that an error is raised when no owners can be derived. | [
"Checks",
"that",
"an",
"error",
"is",
"raised",
"when",
"no",
"owners",
"can",
"be",
"derived",
"."
] | [
"\"\"\"Checks that an error is raised when no owners can be derived.\"\"\"",
"# Write to the file so that it exists."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExpandOwnersWithSameOwners | null | def testExpandOwnersWithSameOwners(self):
"""
Checks that no error is raised when all owners in a file are already in
<owner> elements.
"""
absolute_path = _MakeOwnersFile('same_OWNERS', self.temp_dir)
src_relative_path = _GetSrcRelativePath(absolute_path)
with open(absolute_path, 'w') as o... |
Checks that no error is raised when all owners in a file are already in
<owner> elements.
| Checks that no error is raised when all owners in a file are already in
elements. | [
"Checks",
"that",
"no",
"error",
"is",
"raised",
"when",
"all",
"owners",
"in",
"a",
"file",
"are",
"already",
"in",
"elements",
"."
] | def testExpandOwnersWithSameOwners(self):
absolute_path = _MakeOwnersFile('same_OWNERS', self.temp_dir)
src_relative_path = _GetSrcRelativePath(absolute_path)
with open(absolute_path, 'w') as owners_file:
owners_file.write(
'joe@chromium.org')
histograms_string = xml.dom.minidom.parseS... | [
"def",
"testExpandOwnersWithSameOwners",
"(",
"self",
")",
":",
"absolute_path",
"=",
"_MakeOwnersFile",
"(",
"'same_OWNERS'",
",",
"self",
".",
"temp_dir",
")",
"src_relative_path",
"=",
"_GetSrcRelativePath",
"(",
"absolute_path",
")",
"with",
"open",
"(",
"absolu... | Checks that no error is raised when all owners in a file are already in
<owner> elements. | [
"Checks",
"that",
"no",
"error",
"is",
"raised",
"when",
"all",
"owners",
"in",
"a",
"file",
"are",
"already",
"in",
"<owner",
">",
"elements",
"."
] | [
"\"\"\"\n Checks that no error is raised when all owners in a file are already in\n <owner> elements.\n \"\"\"",
"# Write to the file so that it exists."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExpandOwnersWithoutOWNERSPathPrefix | null | def testExpandOwnersWithoutOWNERSPathPrefix(self):
"""Checks that an error is raised when the path is not well-formatted."""
histograms_without_src_prefix = xml.dom.minidom.parseString("""
<histograms>
<histogram name="Caffeination" units="mg">
<owner>joe@chromium.org</owner>
<owner>latte/OWNERS</owner>
... | Checks that an error is raised when the path is not well-formatted. | Checks that an error is raised when the path is not well-formatted. | [
"Checks",
"that",
"an",
"error",
"is",
"raised",
"when",
"the",
"path",
"is",
"not",
"well",
"-",
"formatted",
"."
] | def testExpandOwnersWithoutOWNERSPathPrefix(self):
histograms_without_src_prefix = xml.dom.minidom.parseString("""
<histograms>
<histogram name="Caffeination" units="mg">
<owner>joe@chromium.org</owner>
<owner>latte/OWNERS</owner>
<summary>I like coffee.</summary>
</histogram>
</histograms>
""")
with self... | [
"def",
"testExpandOwnersWithoutOWNERSPathPrefix",
"(",
"self",
")",
":",
"histograms_without_src_prefix",
"=",
"xml",
".",
"dom",
".",
"minidom",
".",
"parseString",
"(",
"\"\"\"\n<histograms>\n\n<histogram name=\"Caffeination\" units=\"mg\">\n <owner>joe@chromium.org</owner>\n <ow... | Checks that an error is raised when the path is not well-formatted. | [
"Checks",
"that",
"an",
"error",
"is",
"raised",
"when",
"the",
"path",
"is",
"not",
"well",
"-",
"formatted",
"."
] | [
"\"\"\"Checks that an error is raised when the path is not well-formatted.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExpandOwnersWithoutOWNERSPathSuffix | null | def testExpandOwnersWithoutOWNERSPathSuffix(self):
"""Checks that an error is raised when the path is not well-formatted."""
histograms_without_owners_suffix = xml.dom.minidom.parseString("""
<histograms>
<histogram name="Caffeination" units="mg">
<owner>joe@chromium.org</owner>
<owner>src/latte/file</owne... | Checks that an error is raised when the path is not well-formatted. | Checks that an error is raised when the path is not well-formatted. | [
"Checks",
"that",
"an",
"error",
"is",
"raised",
"when",
"the",
"path",
"is",
"not",
"well",
"-",
"formatted",
"."
] | def testExpandOwnersWithoutOWNERSPathSuffix(self):
histograms_without_owners_suffix = xml.dom.minidom.parseString("""
<histograms>
<histogram name="Caffeination" units="mg">
<owner>joe@chromium.org</owner>
<owner>src/latte/file</owner>
<summary>I like coffee.</summary>
</histogram>
</histograms>
""")
with... | [
"def",
"testExpandOwnersWithoutOWNERSPathSuffix",
"(",
"self",
")",
":",
"histograms_without_owners_suffix",
"=",
"xml",
".",
"dom",
".",
"minidom",
".",
"parseString",
"(",
"\"\"\"\n<histograms>\n\n<histogram name=\"Caffeination\" units=\"mg\">\n <owner>joe@chromium.org</owner>\n ... | Checks that an error is raised when the path is not well-formatted. | [
"Checks",
"that",
"an",
"error",
"is",
"raised",
"when",
"the",
"path",
"is",
"not",
"well",
"-",
"formatted",
"."
] | [
"\"\"\"Checks that an error is raised when the path is not well-formatted.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExtractEmailAddressesLoopRaisesError | null | def testExtractEmailAddressesLoopRaisesError(self):
"""Checks that an error is raised if OWNERS file path results in a loop."""
file_directive_absolute_path = _MakeOwnersFile('loop_OWNERS', self.temp_dir)
directive = _GetFileDirective(file_directive_absolute_path)
with open(file_directive_absolute_path... | Checks that an error is raised if OWNERS file path results in a loop. | Checks that an error is raised if OWNERS file path results in a loop. | [
"Checks",
"that",
"an",
"error",
"is",
"raised",
"if",
"OWNERS",
"file",
"path",
"results",
"in",
"a",
"loop",
"."
] | def testExtractEmailAddressesLoopRaisesError(self):
file_directive_absolute_path = _MakeOwnersFile('loop_OWNERS', self.temp_dir)
directive = _GetFileDirective(file_directive_absolute_path)
with open(file_directive_absolute_path, 'w') as owners_file:
owners_file.write(directive)
with self.assertRai... | [
"def",
"testExtractEmailAddressesLoopRaisesError",
"(",
"self",
")",
":",
"file_directive_absolute_path",
"=",
"_MakeOwnersFile",
"(",
"'loop_OWNERS'",
",",
"self",
".",
"temp_dir",
")",
"directive",
"=",
"_GetFileDirective",
"(",
"file_directive_absolute_path",
")",
"wit... | Checks that an error is raised if OWNERS file path results in a loop. | [
"Checks",
"that",
"an",
"error",
"is",
"raised",
"if",
"OWNERS",
"file",
"path",
"results",
"in",
"a",
"loop",
"."
] | [
"\"\"\"Checks that an error is raised if OWNERS file path results in a loop.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testGetHigherLevelPath | null | def testGetHigherLevelPath(self):
"""Checks that higher directories are recursively checked for OWNERS.
Also, checks that there isn't a recursive loop.
"""
path = expand_owners._GetOwnersFilePath('src/banana/chocolate/OWNERS')
result = expand_owners._GetHigherLevelOwnersFilePath(path)
# The co... | Checks that higher directories are recursively checked for OWNERS.
Also, checks that there isn't a recursive loop.
| Checks that higher directories are recursively checked for OWNERS.
Also, checks that there isn't a recursive loop. | [
"Checks",
"that",
"higher",
"directories",
"are",
"recursively",
"checked",
"for",
"OWNERS",
".",
"Also",
"checks",
"that",
"there",
"isn",
"'",
"t",
"a",
"recursive",
"loop",
"."
] | def testGetHigherLevelPath(self):
path = expand_owners._GetOwnersFilePath('src/banana/chocolate/OWNERS')
result = expand_owners._GetHigherLevelOwnersFilePath(path)
if os.path.basename(_GetToolsParentDir()) == 'src':
self.assertRegexpMatches(result, r'.*OWNERS')
else:
self.assertEqual(result,... | [
"def",
"testGetHigherLevelPath",
"(",
"self",
")",
":",
"path",
"=",
"expand_owners",
".",
"_GetOwnersFilePath",
"(",
"'src/banana/chocolate/OWNERS'",
")",
"result",
"=",
"expand_owners",
".",
"_GetHigherLevelOwnersFilePath",
"(",
"path",
")",
"if",
"os",
".",
"path... | Checks that higher directories are recursively checked for OWNERS. | [
"Checks",
"that",
"higher",
"directories",
"are",
"recursively",
"checked",
"for",
"OWNERS",
"."
] | [
"\"\"\"Checks that higher directories are recursively checked for OWNERS.\n\n Also, checks that there isn't a recursive loop.\n \"\"\"",
"# The condition is true when the tools directory's parent directory is src,",
"# which is generally the case locally. However, the parent directory is not",
"# always... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9313c83fd44b8bece1193361c0134f83a543e470 | sunlongbo/chromium | third_party/blink/PRESUBMIT_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testCheckChangeOnUploadWithBlinkAndChromiumFiles | null | def testCheckChangeOnUploadWithBlinkAndChromiumFiles(self, _):
"""This verifies that CheckChangeOnUpload will only call
check_blink_style.py on non-test files.
"""
diff_file_blink_h = ['some diff']
diff_file_chromium_h = ['another diff']
diff_file_test_expectations = ['mo... | This verifies that CheckChangeOnUpload will only call
check_blink_style.py on non-test files.
| This verifies that CheckChangeOnUpload will only call
check_blink_style.py on non-test files. | [
"This",
"verifies",
"that",
"CheckChangeOnUpload",
"will",
"only",
"call",
"check_blink_style",
".",
"py",
"on",
"non",
"-",
"test",
"files",
"."
] | def testCheckChangeOnUploadWithBlinkAndChromiumFiles(self, _):
diff_file_blink_h = ['some diff']
diff_file_chromium_h = ['another diff']
diff_file_test_expectations = ['more diff']
mock_input_api = MockInputApi()
mock_input_api.files = [
MockAffectedFile('file_blink.h... | [
"def",
"testCheckChangeOnUploadWithBlinkAndChromiumFiles",
"(",
"self",
",",
"_",
")",
":",
"diff_file_blink_h",
"=",
"[",
"'some diff'",
"]",
"diff_file_chromium_h",
"=",
"[",
"'another diff'",
"]",
"diff_file_test_expectations",
"=",
"[",
"'more diff'",
"]",
"mock_inp... | This verifies that CheckChangeOnUpload will only call
check_blink_style.py on non-test files. | [
"This",
"verifies",
"that",
"CheckChangeOnUpload",
"will",
"only",
"call",
"check_blink_style",
".",
"py",
"on",
"non",
"-",
"test",
"files",
"."
] | [
"\"\"\"This verifies that CheckChangeOnUpload will only call\n check_blink_style.py on non-test files.\n \"\"\"",
"# Access to a protected member _CheckStyle",
"# pylint: disable=W0212",
"# pylint: disable=E1101"
] | [
{
"param": "self",
"type": null
},
{
"param": "_",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "_",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
9313c83fd44b8bece1193361c0134f83a543e470 | sunlongbo/chromium | third_party/blink/PRESUBMIT_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testCheckChangeOnUploadWithEmptyAffectedFileList | null | def testCheckChangeOnUploadWithEmptyAffectedFileList(self, _):
"""This verifies that CheckChangeOnUpload will skip calling
check_blink_style.py if the affected file list is empty.
"""
diff_file_chromium1_h = ['some diff']
diff_file_chromium2_h = ['another diff']
diff_file... | This verifies that CheckChangeOnUpload will skip calling
check_blink_style.py if the affected file list is empty.
| This verifies that CheckChangeOnUpload will skip calling
check_blink_style.py if the affected file list is empty. | [
"This",
"verifies",
"that",
"CheckChangeOnUpload",
"will",
"skip",
"calling",
"check_blink_style",
".",
"py",
"if",
"the",
"affected",
"file",
"list",
"is",
"empty",
"."
] | def testCheckChangeOnUploadWithEmptyAffectedFileList(self, _):
diff_file_chromium1_h = ['some diff']
diff_file_chromium2_h = ['another diff']
diff_file_layout_test_html = ['more diff']
mock_input_api = MockInputApi()
mock_input_api.files = []
PRESUBMIT._CheckStyle(mock_in... | [
"def",
"testCheckChangeOnUploadWithEmptyAffectedFileList",
"(",
"self",
",",
"_",
")",
":",
"diff_file_chromium1_h",
"=",
"[",
"'some diff'",
"]",
"diff_file_chromium2_h",
"=",
"[",
"'another diff'",
"]",
"diff_file_layout_test_html",
"=",
"[",
"'more diff'",
"]",
"mock... | This verifies that CheckChangeOnUpload will skip calling
check_blink_style.py if the affected file list is empty. | [
"This",
"verifies",
"that",
"CheckChangeOnUpload",
"will",
"skip",
"calling",
"check_blink_style",
".",
"py",
"if",
"the",
"affected",
"file",
"list",
"is",
"empty",
"."
] | [
"\"\"\"This verifies that CheckChangeOnUpload will skip calling\n check_blink_style.py if the affected file list is empty.\n \"\"\"",
"# Access to a protected member _CheckStyle",
"# pylint: disable=W0212"
] | [
{
"param": "self",
"type": null
},
{
"param": "_",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "_",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
9313c83fd44b8bece1193361c0134f83a543e470 | sunlongbo/chromium | third_party/blink/PRESUBMIT_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testCheckPublicHeaderWithBlinkMojo | null | def testCheckPublicHeaderWithBlinkMojo(self):
"""This verifies that _CheckForWrongMojomIncludes detects -blink mojo
headers in public files.
"""
mock_input_api = MockInputApi()
potentially_bad_content = \
'#include "public/platform/modules/cache_storage.mojom-blink.h... | This verifies that _CheckForWrongMojomIncludes detects -blink mojo
headers in public files.
| This verifies that _CheckForWrongMojomIncludes detects -blink mojo
headers in public files. | [
"This",
"verifies",
"that",
"_CheckForWrongMojomIncludes",
"detects",
"-",
"blink",
"mojo",
"headers",
"in",
"public",
"files",
"."
] | def testCheckPublicHeaderWithBlinkMojo(self):
mock_input_api = MockInputApi()
potentially_bad_content = \
'#include "public/platform/modules/cache_storage.mojom-blink.h"'
mock_input_api.files = [
MockAffectedFile('third_party/blink/public/a_header.h',
... | [
"def",
"testCheckPublicHeaderWithBlinkMojo",
"(",
"self",
")",
":",
"mock_input_api",
"=",
"MockInputApi",
"(",
")",
"potentially_bad_content",
"=",
"'#include \"public/platform/modules/cache_storage.mojom-blink.h\"'",
"mock_input_api",
".",
"files",
"=",
"[",
"MockAffectedFile... | This verifies that _CheckForWrongMojomIncludes detects -blink mojo
headers in public files. | [
"This",
"verifies",
"that",
"_CheckForWrongMojomIncludes",
"detects",
"-",
"blink",
"mojo",
"headers",
"in",
"public",
"files",
"."
] | [
"\"\"\"This verifies that _CheckForWrongMojomIncludes detects -blink mojo\n headers in public files.\n \"\"\"",
"# Access to a protected member _CheckForWrongMojomIncludes",
"# pylint: disable=W0212"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9313c83fd44b8bece1193361c0134f83a543e470 | sunlongbo/chromium | third_party/blink/PRESUBMIT_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testCheckInternalHeaderWithBlinkMojo | null | def testCheckInternalHeaderWithBlinkMojo(self):
"""This verifies that _CheckForWrongMojomIncludes accepts -blink mojo
headers in blink internal files.
"""
mock_input_api = MockInputApi()
potentially_bad_content = """
#include "public/platform/modules/cache_storage.mojom-... | This verifies that _CheckForWrongMojomIncludes accepts -blink mojo
headers in blink internal files.
| This verifies that _CheckForWrongMojomIncludes accepts -blink mojo
headers in blink internal files. | [
"This",
"verifies",
"that",
"_CheckForWrongMojomIncludes",
"accepts",
"-",
"blink",
"mojo",
"headers",
"in",
"blink",
"internal",
"files",
"."
] | def testCheckInternalHeaderWithBlinkMojo(self):
mock_input_api = MockInputApi()
potentially_bad_content = """
#include "public/platform/modules/cache_storage.mojom-blink.h"
#include "public/platform/modules/cache_storage.mojom-blink-forward.h"
#include "public/platform/modules/ca... | [
"def",
"testCheckInternalHeaderWithBlinkMojo",
"(",
"self",
")",
":",
"mock_input_api",
"=",
"MockInputApi",
"(",
")",
"potentially_bad_content",
"=",
"\"\"\"\n #include \"public/platform/modules/cache_storage.mojom-blink.h\"\n #include \"public/platform/modules/cache_storage... | This verifies that _CheckForWrongMojomIncludes accepts -blink mojo
headers in blink internal files. | [
"This",
"verifies",
"that",
"_CheckForWrongMojomIncludes",
"accepts",
"-",
"blink",
"mojo",
"headers",
"in",
"blink",
"internal",
"files",
"."
] | [
"\"\"\"This verifies that _CheckForWrongMojomIncludes accepts -blink mojo\n headers in blink internal files.\n \"\"\"",
"# Access to a protected member _CheckForWrongMojomIncludes",
"# pylint: disable=W0212"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9c9d9d15b95b067efe5fbb69363b88b64ab7485c | sunlongbo/chromium | chrome/browser/resources/chromeos/semantic_css_checker_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExcludedFiles | null | def testExcludedFiles(self):
""" Only .html and .css files should be processed. """
mock_input_api = MockInputApi()
lines = [
'color: var(--google-grey-500);',
];
mock_input_api.files = [
MockAffectedFile('chrome/test.js',
lines),
]
mock_output_api = Mock... | Only .html and .css files should be processed. | Only .html and .css files should be processed. | [
"Only",
".",
"html",
"and",
".",
"css",
"files",
"should",
"be",
"processed",
"."
] | def testExcludedFiles(self):
mock_input_api = MockInputApi()
lines = [
'color: var(--google-grey-500);',
];
mock_input_api.files = [
MockAffectedFile('chrome/test.js',
lines),
]
mock_output_api = MockOutputApi()
errors = SemanticCssChecker.RunChecks(
... | [
"def",
"testExcludedFiles",
"(",
"self",
")",
":",
"mock_input_api",
"=",
"MockInputApi",
"(",
")",
"lines",
"=",
"[",
"'color: var(--google-grey-500);'",
",",
"]",
";",
"mock_input_api",
".",
"files",
"=",
"[",
"MockAffectedFile",
"(",
"'chrome/test.js'",
",",
... | Only .html and .css files should be processed. | [
"Only",
".",
"html",
"and",
".",
"css",
"files",
"should",
"be",
"processed",
"."
] | [
"\"\"\" Only .html and .css files should be processed. \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f73e1f2737483267ee57033b50462b9d6e91aabe | sunlongbo/chromium | tools/perf/scripts_smoke_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testRunPerformanceTestsTelemetry_NoTestResults | null | def testRunPerformanceTestsTelemetry_NoTestResults(self):
"""Test that test results output gets returned for complete failures."""
tempdir = tempfile.mkdtemp()
benchmarks = ['benchmark1', 'benchmark2']
return_code, stdout = self.RunPerfScript(
'../../testing/scripts/run_performance_tests.py '
... | Test that test results output gets returned for complete failures. | Test that test results output gets returned for complete failures. | [
"Test",
"that",
"test",
"results",
"output",
"gets",
"returned",
"for",
"complete",
"failures",
"."
] | def testRunPerformanceTestsTelemetry_NoTestResults(self):
tempdir = tempfile.mkdtemp()
benchmarks = ['benchmark1', 'benchmark2']
return_code, stdout = self.RunPerfScript(
'../../testing/scripts/run_performance_tests.py '
'../../tools/perf/testdata/fail_and_do_nothing '
'--benchmarks=... | [
"def",
"testRunPerformanceTestsTelemetry_NoTestResults",
"(",
"self",
")",
":",
"tempdir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"benchmarks",
"=",
"[",
"'benchmark1'",
",",
"'benchmark2'",
"]",
"return_code",
",",
"stdout",
"=",
"self",
".",
"RunPerfScript",... | Test that test results output gets returned for complete failures. | [
"Test",
"that",
"test",
"results",
"output",
"gets",
"returned",
"for",
"complete",
"failures",
"."
] | [
"\"\"\"Test that test results output gets returned for complete failures.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7863402b05d1a917a22673b86cbeeb1ff54c441d | sunlongbo/chromium | components/exo/wayland/compatibility_test/wayland_protocol_codegen.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | expand_template | str | def expand_template(template: str, context: Mapping[str, Any]) -> str:
"""Expands the template using context, and returns the result"""
# Loaded from third_party/jinja2 after a sys.path modification
import jinja2
env = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(template... | Expands the template using context, and returns the result | Expands the template using context, and returns the result | [
"Expands",
"the",
"template",
"using",
"context",
"and",
"returns",
"the",
"result"
] | def expand_template(template: str, context: Mapping[str, Any]) -> str:
import jinja2
env = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(template)),
keep_trailing_newline=True,
lstrip_blocks=True,
trim_blocks=True)
env.globals['get_c_arg_for_server_re... | [
"def",
"expand_template",
"(",
"template",
":",
"str",
",",
"context",
":",
"Mapping",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"str",
":",
"import",
"jinja2",
"env",
"=",
"jinja2",
".",
"Environment",
"(",
"loader",
"=",
"jinja2",
".",
"FileSystemLoader"... | Expands the template using context, and returns the result | [
"Expands",
"the",
"template",
"using",
"context",
"and",
"returns",
"the",
"result"
] | [
"\"\"\"Expands the template using context, and returns the result\"\"\"",
"# Loaded from third_party/jinja2 after a sys.path modification",
"# newline-terminate generated files",
"# so don't need {%- -%} everywhere",
"# Additional global functions",
"# Additional filters for transforming text"
] | [
{
"param": "template",
"type": "str"
},
{
"param": "context",
"type": "Mapping[str, Any]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "template",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "context",
"type": "Mapping[str, Any]",
"docstring": null,
... |
7863402b05d1a917a22673b86cbeeb1ff54c441d | sunlongbo/chromium | components/exo/wayland/compatibility_test/wayland_protocol_codegen.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | clang_format_source_text | str | def clang_format_source_text(source_text: str, clang_format_path: str,
effective_filename: str) -> str:
"""Runs clang-format on source_text and returns the result."""
# clang-format the output, for better readability and for
# -Wmisleading-indentation.
return subprocess.run(... | Runs clang-format on source_text and returns the result. | Runs clang-format on source_text and returns the result. | [
"Runs",
"clang",
"-",
"format",
"on",
"source_text",
"and",
"returns",
"the",
"result",
"."
] | def clang_format_source_text(source_text: str, clang_format_path: str,
effective_filename: str) -> str:
return subprocess.run(
[clang_format_path, '--assume-filename', effective_filename],
input=source_text,
capture_output=True,
check=True,
text=T... | [
"def",
"clang_format_source_text",
"(",
"source_text",
":",
"str",
",",
"clang_format_path",
":",
"str",
",",
"effective_filename",
":",
"str",
")",
"->",
"str",
":",
"return",
"subprocess",
".",
"run",
"(",
"[",
"clang_format_path",
",",
"'--assume-filename'",
... | Runs clang-format on source_text and returns the result. | [
"Runs",
"clang",
"-",
"format",
"on",
"source_text",
"and",
"returns",
"the",
"result",
"."
] | [
"\"\"\"Runs clang-format on source_text and returns the result.\"\"\"",
"# clang-format the output, for better readability and for",
"# -Wmisleading-indentation."
] | [
{
"param": "source_text",
"type": "str"
},
{
"param": "clang_format_path",
"type": "str"
},
{
"param": "effective_filename",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "source_text",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "clang_format_path",
"type": "str",
"docstring": null,
... |
7863402b05d1a917a22673b86cbeeb1ff54c441d | sunlongbo/chromium | components/exo/wayland/compatibility_test/wayland_protocol_codegen.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | write_if_changed | str | def write_if_changed(source_text: str, output: str) -> str:
"""Writes source_text to output, but only if different."""
if os.path.exists(output):
with open(output, 'rt') as infile:
if infile.read() == source_text:
return
with open(output, 'wt') as outfile:
outfil... | Writes source_text to output, but only if different. | Writes source_text to output, but only if different. | [
"Writes",
"source_text",
"to",
"output",
"but",
"only",
"if",
"different",
"."
] | def write_if_changed(source_text: str, output: str) -> str:
if os.path.exists(output):
with open(output, 'rt') as infile:
if infile.read() == source_text:
return
with open(output, 'wt') as outfile:
outfile.write(source_text) | [
"def",
"write_if_changed",
"(",
"source_text",
":",
"str",
",",
"output",
":",
"str",
")",
"->",
"str",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"output",
")",
":",
"with",
"open",
"(",
"output",
",",
"'rt'",
")",
"as",
"infile",
":",
"if"... | Writes source_text to output, but only if different. | [
"Writes",
"source_text",
"to",
"output",
"but",
"only",
"if",
"different",
"."
] | [
"\"\"\"Writes source_text to output, but only if different.\"\"\""
] | [
{
"param": "source_text",
"type": "str"
},
{
"param": "output",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "source_text",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output",
"type": "str",
"docstring": null,
"docstring... |
d039d8e7accc7d983a2322c0e42c8c74c8f977a9 | sunlongbo/chromium | media/tools/constrained_network_server/cns.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Get | <not_specific> | def Get(self, key, new_port=False, **kwargs):
"""Sets up a constrained port using the requested parameters.
Requests for the same key and constraints will result in a cached port being
returned if possible, subject to new_port.
Args:
key: Used to cache ports with the given constraints.
new... | Sets up a constrained port using the requested parameters.
Requests for the same key and constraints will result in a cached port being
returned if possible, subject to new_port.
Args:
key: Used to cache ports with the given constraints.
new_port: Whether to create a new port or use an existin... | Sets up a constrained port using the requested parameters.
Requests for the same key and constraints will result in a cached port being
returned if possible, subject to new_port. | [
"Sets",
"up",
"a",
"constrained",
"port",
"using",
"the",
"requested",
"parameters",
".",
"Requests",
"for",
"the",
"same",
"key",
"and",
"constraints",
"will",
"result",
"in",
"a",
"cached",
"port",
"being",
"returned",
"if",
"possible",
"subject",
"to",
"n... | def Get(self, key, new_port=False, **kwargs):
with self._port_lock:
full_key = (key,) + tuple(kwargs.values())
if not new_port:
for port, status in self._ports.iteritems():
if full_key == status['key']:
self._ports[port]['last_update'] = time.time()
return port
... | [
"def",
"Get",
"(",
"self",
",",
"key",
",",
"new_port",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"with",
"self",
".",
"_port_lock",
":",
"full_key",
"=",
"(",
"key",
",",
")",
"+",
"tuple",
"(",
"kwargs",
".",
"values",
"(",
")",
")",
"if",
... | Sets up a constrained port using the requested parameters. | [
"Sets",
"up",
"a",
"constrained",
"port",
"using",
"the",
"requested",
"parameters",
"."
] | [
"\"\"\"Sets up a constrained port using the requested parameters.\n\n Requests for the same key and constraints will result in a cached port being\n returned if possible, subject to new_port.\n\n Args:\n key: Used to cache ports with the given constraints.\n new_port: Whether to create a new port... | [
{
"param": "self",
"type": null
},
{
"param": "key",
"type": null
},
{
"param": "new_port",
"type": null
}
] | {
"returns": [
{
"docstring": "None if no port can be setup or the port number of the constrained port.",
"docstring_tokens": [
"None",
"if",
"no",
"port",
"can",
"be",
"setup",
"or",
"the",
"port",
"number",
... |
d039d8e7accc7d983a2322c0e42c8c74c8f977a9 | sunlongbo/chromium | media/tools/constrained_network_server/cns.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Cleanup | null | def Cleanup(self, all_ports, request_ip=None):
"""Cleans up expired ports, or if all_ports=True, all allocated ports.
By default, ports which haven't been used for self._expiry_time_secs are
torn down. If all_ports=True then they are torn down regardless.
Args:
all_ports: Should all ports be tor... | Cleans up expired ports, or if all_ports=True, all allocated ports.
By default, ports which haven't been used for self._expiry_time_secs are
torn down. If all_ports=True then they are torn down regardless.
Args:
all_ports: Should all ports be torn down regardless of expiration?
request_ip: Tea... | Cleans up expired ports, or if all_ports=True, all allocated ports.
By default, ports which haven't been used for self._expiry_time_secs are
torn down. If all_ports=True then they are torn down regardless. | [
"Cleans",
"up",
"expired",
"ports",
"or",
"if",
"all_ports",
"=",
"True",
"all",
"allocated",
"ports",
".",
"By",
"default",
"ports",
"which",
"haven",
"'",
"t",
"been",
"used",
"for",
"self",
".",
"_expiry_time_secs",
"are",
"torn",
"down",
".",
"If",
"... | def Cleanup(self, all_ports, request_ip=None):
with self._port_lock:
now = time.time()
for port, status in self._ports.items():
expired = now - status['last_update'] > self._expiry_time_secs
matching_ip = request_ip and status['key'][0].startswith(request_ip)
if all_ports or expi... | [
"def",
"Cleanup",
"(",
"self",
",",
"all_ports",
",",
"request_ip",
"=",
"None",
")",
":",
"with",
"self",
".",
"_port_lock",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"for",
"port",
",",
"status",
"in",
"self",
".",
"_ports",
".",
"items",
"... | Cleans up expired ports, or if all_ports=True, all allocated ports. | [
"Cleans",
"up",
"expired",
"ports",
"or",
"if",
"all_ports",
"=",
"True",
"all",
"allocated",
"ports",
"."
] | [
"\"\"\"Cleans up expired ports, or if all_ports=True, all allocated ports.\n\n By default, ports which haven't been used for self._expiry_time_secs are\n torn down. If all_ports=True then they are torn down regardless.\n\n Args:\n all_ports: Should all ports be torn down regardless of expiration?\n ... | [
{
"param": "self",
"type": null
},
{
"param": "all_ports",
"type": null
},
{
"param": "request_ip",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "all_ports",
"type": null,
"docstring": null,
"docstring_token... |
d039d8e7accc7d983a2322c0e42c8c74c8f977a9 | sunlongbo/chromium | media/tools/constrained_network_server/cns.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Cleanup | null | def Cleanup(self):
"""Cleans up all the ports allocated using the request IP address.
When requesting a constrained port, the cherrypy.request.remote.ip is used
as a key for that port (in addition to other request parameters). Such
ports created for the same IP address are removed.
"""
cherryp... | Cleans up all the ports allocated using the request IP address.
When requesting a constrained port, the cherrypy.request.remote.ip is used
as a key for that port (in addition to other request parameters). Such
ports created for the same IP address are removed.
| Cleans up all the ports allocated using the request IP address.
When requesting a constrained port, the cherrypy.request.remote.ip is used
as a key for that port (in addition to other request parameters). Such
ports created for the same IP address are removed. | [
"Cleans",
"up",
"all",
"the",
"ports",
"allocated",
"using",
"the",
"request",
"IP",
"address",
".",
"When",
"requesting",
"a",
"constrained",
"port",
"the",
"cherrypy",
".",
"request",
".",
"remote",
".",
"ip",
"is",
"used",
"as",
"a",
"key",
"for",
"th... | def Cleanup(self):
cherrypy.log('Cleaning up ports allocated by %s.' %
cherrypy.request.remote.ip)
self._port_allocator.Cleanup(all_ports=False,
request_ip=cherrypy.request.remote.ip) | [
"def",
"Cleanup",
"(",
"self",
")",
":",
"cherrypy",
".",
"log",
"(",
"'Cleaning up ports allocated by %s.'",
"%",
"cherrypy",
".",
"request",
".",
"remote",
".",
"ip",
")",
"self",
".",
"_port_allocator",
".",
"Cleanup",
"(",
"all_ports",
"=",
"False",
",",... | Cleans up all the ports allocated using the request IP address. | [
"Cleans",
"up",
"all",
"the",
"ports",
"allocated",
"using",
"the",
"request",
"IP",
"address",
"."
] | [
"\"\"\"Cleans up all the ports allocated using the request IP address.\n\n When requesting a constrained port, the cherrypy.request.remote.ip is used\n as a key for that port (in addition to other request parameters). Such\n ports created for the same IP address are removed.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d039d8e7accc7d983a2322c0e42c8c74c8f977a9 | sunlongbo/chromium | media/tools/constrained_network_server/cns.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ServeConstrained | <not_specific> | def ServeConstrained(self, f=None, bandwidth=None, latency=None, loss=None,
new_port=False, no_cache=False, **kwargs):
"""Serves the requested file with the requested constraints.
Subsequent requests for the same constraints from the same IP will share the
previously created port unl... | Serves the requested file with the requested constraints.
Subsequent requests for the same constraints from the same IP will share the
previously created port unless new_port equals True. If no constraints
are provided the file is served as is.
Args:
f: path relative to http root of file to serv... | Serves the requested file with the requested constraints.
Subsequent requests for the same constraints from the same IP will share the
previously created port unless new_port equals True. If no constraints
are provided the file is served as is. | [
"Serves",
"the",
"requested",
"file",
"with",
"the",
"requested",
"constraints",
".",
"Subsequent",
"requests",
"for",
"the",
"same",
"constraints",
"from",
"the",
"same",
"IP",
"will",
"share",
"the",
"previously",
"created",
"port",
"unless",
"new_port",
"equa... | def ServeConstrained(self, f=None, bandwidth=None, latency=None, loss=None,
new_port=False, no_cache=False, **kwargs):
if no_cache:
response = cherrypy.response
response.headers['Pragma'] = 'no-cache'
response.headers['Cache-Control'] = 'no-cache'
if not f:
raise c... | [
"def",
"ServeConstrained",
"(",
"self",
",",
"f",
"=",
"None",
",",
"bandwidth",
"=",
"None",
",",
"latency",
"=",
"None",
",",
"loss",
"=",
"None",
",",
"new_port",
"=",
"False",
",",
"no_cache",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"if",
... | Serves the requested file with the requested constraints. | [
"Serves",
"the",
"requested",
"file",
"with",
"the",
"requested",
"constraints",
"."
] | [
"\"\"\"Serves the requested file with the requested constraints.\n\n Subsequent requests for the same constraints from the same IP will share the\n previously created port unless new_port equals True. If no constraints\n are provided the file is served as is.\n\n Args:\n f: path relative to http ro... | [
{
"param": "self",
"type": null
},
{
"param": "f",
"type": null
},
{
"param": "bandwidth",
"type": null
},
{
"param": "latency",
"type": null
},
{
"param": "loss",
"type": null
},
{
"param": "new_port",
"type": null
},
{
"param": "no_cache"... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "f",
"type": null,
"docstring": "path relative to http root of file ... |
d039d8e7accc7d983a2322c0e42c8c74c8f977a9 | sunlongbo/chromium | media/tools/constrained_network_server/cns.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckRequestedFileExist | null | def _CheckRequestedFileExist(self, f):
"""Checks if the requested file exists, raises HTTPError otherwise."""
if self._options.local_server_port:
self._CheckFileExistOnLocalServer(f)
else:
self._CheckFileExistOnServer(f) | Checks if the requested file exists, raises HTTPError otherwise. | Checks if the requested file exists, raises HTTPError otherwise. | [
"Checks",
"if",
"the",
"requested",
"file",
"exists",
"raises",
"HTTPError",
"otherwise",
"."
] | def _CheckRequestedFileExist(self, f):
if self._options.local_server_port:
self._CheckFileExistOnLocalServer(f)
else:
self._CheckFileExistOnServer(f) | [
"def",
"_CheckRequestedFileExist",
"(",
"self",
",",
"f",
")",
":",
"if",
"self",
".",
"_options",
".",
"local_server_port",
":",
"self",
".",
"_CheckFileExistOnLocalServer",
"(",
"f",
")",
"else",
":",
"self",
".",
"_CheckFileExistOnServer",
"(",
"f",
")"
] | Checks if the requested file exists, raises HTTPError otherwise. | [
"Checks",
"if",
"the",
"requested",
"file",
"exists",
"raises",
"HTTPError",
"otherwise",
"."
] | [
"\"\"\"Checks if the requested file exists, raises HTTPError otherwise.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "f",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "f",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
d039d8e7accc7d983a2322c0e42c8c74c8f977a9 | sunlongbo/chromium | media/tools/constrained_network_server/cns.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckFileExistOnServer | null | def _CheckFileExistOnServer(self, f):
"""Checks if requested file f exists to be served by this server."""
# Sanitize and check the path to prevent www-root escapes.
sanitized_path = os.path.abspath(os.path.join(self._options.www_root, f))
if not sanitized_path.startswith(self._options.www_root):
... | Checks if requested file f exists to be served by this server. | Checks if requested file f exists to be served by this server. | [
"Checks",
"if",
"requested",
"file",
"f",
"exists",
"to",
"be",
"served",
"by",
"this",
"server",
"."
] | def _CheckFileExistOnServer(self, f):
sanitized_path = os.path.abspath(os.path.join(self._options.www_root, f))
if not sanitized_path.startswith(self._options.www_root):
raise cherrypy.HTTPError(403, 'Invalid file requested.')
if not os.path.exists(sanitized_path):
raise cherrypy.HTTPError(404, ... | [
"def",
"_CheckFileExistOnServer",
"(",
"self",
",",
"f",
")",
":",
"sanitized_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_options",
".",
"www_root",
",",
"f",
")",
")",
"if",
"not",
"sanitiz... | Checks if requested file f exists to be served by this server. | [
"Checks",
"if",
"requested",
"file",
"f",
"exists",
"to",
"be",
"served",
"by",
"this",
"server",
"."
] | [
"\"\"\"Checks if requested file f exists to be served by this server.\"\"\"",
"# Sanitize and check the path to prevent www-root escapes."
] | [
{
"param": "self",
"type": null
},
{
"param": "f",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "f",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
d039d8e7accc7d983a2322c0e42c8c74c8f977a9 | sunlongbo/chromium | media/tools/constrained_network_server/cns.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckFileExistOnLocalServer | <not_specific> | def _CheckFileExistOnLocalServer(self, f):
"""Checks if requested file exists on local server hosting files."""
test_url = self._GetServerURL(f, self._options.local_server_port)
try:
cherrypy.log('Check file exist using URL: %s' % test_url)
return urllib2.urlopen(test_url) is not None
except... | Checks if requested file exists on local server hosting files. | Checks if requested file exists on local server hosting files. | [
"Checks",
"if",
"requested",
"file",
"exists",
"on",
"local",
"server",
"hosting",
"files",
"."
] | def _CheckFileExistOnLocalServer(self, f):
test_url = self._GetServerURL(f, self._options.local_server_port)
try:
cherrypy.log('Check file exist using URL: %s' % test_url)
return urllib2.urlopen(test_url) is not None
except Exception:
raise cherrypy.HTTPError(404, 'File not found on local ... | [
"def",
"_CheckFileExistOnLocalServer",
"(",
"self",
",",
"f",
")",
":",
"test_url",
"=",
"self",
".",
"_GetServerURL",
"(",
"f",
",",
"self",
".",
"_options",
".",
"local_server_port",
")",
"try",
":",
"cherrypy",
".",
"log",
"(",
"'Check file exist using URL:... | Checks if requested file exists on local server hosting files. | [
"Checks",
"if",
"requested",
"file",
"exists",
"on",
"local",
"server",
"hosting",
"files",
"."
] | [
"\"\"\"Checks if requested file exists on local server hosting files.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "f",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "f",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
d039d8e7accc7d983a2322c0e42c8c74c8f977a9 | sunlongbo/chromium | media/tools/constrained_network_server/cns.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ServeFile | <not_specific> | def _ServeFile(self, f):
"""Serves the file as an http response."""
if self._options.local_server_port:
redirect_url = self._GetServerURL(f, self._options.local_server_port)
cherrypy.log('Redirect to %s' % redirect_url)
cherrypy.lib.cptools.redirect(redirect_url, internal=False)
else:
... | Serves the file as an http response. | Serves the file as an http response. | [
"Serves",
"the",
"file",
"as",
"an",
"http",
"response",
"."
] | def _ServeFile(self, f):
if self._options.local_server_port:
redirect_url = self._GetServerURL(f, self._options.local_server_port)
cherrypy.log('Redirect to %s' % redirect_url)
cherrypy.lib.cptools.redirect(redirect_url, internal=False)
else:
sanitized_path = os.path.abspath(os.path.join... | [
"def",
"_ServeFile",
"(",
"self",
",",
"f",
")",
":",
"if",
"self",
".",
"_options",
".",
"local_server_port",
":",
"redirect_url",
"=",
"self",
".",
"_GetServerURL",
"(",
"f",
",",
"self",
".",
"_options",
".",
"local_server_port",
")",
"cherrypy",
".",
... | Serves the file as an http response. | [
"Serves",
"the",
"file",
"as",
"an",
"http",
"response",
"."
] | [
"\"\"\"Serves the file as an http response.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "f",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "f",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
d039d8e7accc7d983a2322c0e42c8c74c8f977a9 | sunlongbo/chromium | media/tools/constrained_network_server/cns.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetServerURL | <not_specific> | def _GetServerURL(self, f, port, **kwargs):
"""Returns a URL for local server to serve the file on given port.
Args:
f: file name to serve on local server. Relative to www_root.
port: Local server port (it can be a configured constrained port).
kwargs: extra parameteres passed in the URL.
... | Returns a URL for local server to serve the file on given port.
Args:
f: file name to serve on local server. Relative to www_root.
port: Local server port (it can be a configured constrained port).
kwargs: extra parameteres passed in the URL.
| Returns a URL for local server to serve the file on given port. | [
"Returns",
"a",
"URL",
"for",
"local",
"server",
"to",
"serve",
"the",
"file",
"on",
"given",
"port",
"."
] | def _GetServerURL(self, f, port, **kwargs):
url = '%s?f=%s&' % (cherrypy.url(), f)
if self._options.local_server_port:
url = '%s/%s?' % (
cherrypy.url().replace('ServeConstrained', self._options.www_root), f)
url = url.replace(':%d' % self._options.port, ':%d' % port)
extra_args = urllib... | [
"def",
"_GetServerURL",
"(",
"self",
",",
"f",
",",
"port",
",",
"**",
"kwargs",
")",
":",
"url",
"=",
"'%s?f=%s&'",
"%",
"(",
"cherrypy",
".",
"url",
"(",
")",
",",
"f",
")",
"if",
"self",
".",
"_options",
".",
"local_server_port",
":",
"url",
"="... | Returns a URL for local server to serve the file on given port. | [
"Returns",
"a",
"URL",
"for",
"local",
"server",
"to",
"serve",
"the",
"file",
"on",
"given",
"port",
"."
] | [
"\"\"\"Returns a URL for local server to serve the file on given port.\n\n Args:\n f: file name to serve on local server. Relative to www_root.\n port: Local server port (it can be a configured constrained port).\n kwargs: extra parameteres passed in the URL.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "f",
"type": null
},
{
"param": "port",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "f",
"type": null,
"docstring": "file name to serve on local server.... |
d039d8e7accc7d983a2322c0e42c8c74c8f977a9 | sunlongbo/chromium | media/tools/constrained_network_server/cns.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetConstrainedPort | <not_specific> | def _GetConstrainedPort(self, f=None, bandwidth=None, latency=None, loss=None,
new_port=False, **kwargs):
"""Creates or gets a port with specified network constraints.
See ServeConstrained() for more details.
"""
# Validate inputs. isdigit() guarantees a natural number.
ba... | Creates or gets a port with specified network constraints.
See ServeConstrained() for more details.
| Creates or gets a port with specified network constraints.
See ServeConstrained() for more details. | [
"Creates",
"or",
"gets",
"a",
"port",
"with",
"specified",
"network",
"constraints",
".",
"See",
"ServeConstrained",
"()",
"for",
"more",
"details",
"."
] | def _GetConstrainedPort(self, f=None, bandwidth=None, latency=None, loss=None,
new_port=False, **kwargs):
bandwidth = self._ParseIntParameter(
bandwidth, 'Invalid bandwidth constraint.', lambda x: x > 0)
latency = self._ParseIntParameter(
latency, 'Invalid latency const... | [
"def",
"_GetConstrainedPort",
"(",
"self",
",",
"f",
"=",
"None",
",",
"bandwidth",
"=",
"None",
",",
"latency",
"=",
"None",
",",
"loss",
"=",
"None",
",",
"new_port",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"bandwidth",
"=",
"self",
".",
"_Par... | Creates or gets a port with specified network constraints. | [
"Creates",
"or",
"gets",
"a",
"port",
"with",
"specified",
"network",
"constraints",
"."
] | [
"\"\"\"Creates or gets a port with specified network constraints.\n\n See ServeConstrained() for more details.\n \"\"\"",
"# Validate inputs. isdigit() guarantees a natural number.",
"# Allocate a port using the given constraints. If a port with the requested",
"# key and kwargs already exist then reuse... | [
{
"param": "self",
"type": null
},
{
"param": "f",
"type": null
},
{
"param": "bandwidth",
"type": null
},
{
"param": "latency",
"type": null
},
{
"param": "loss",
"type": null
},
{
"param": "new_port",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "f",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
d039d8e7accc7d983a2322c0e42c8c74c8f977a9 | sunlongbo/chromium | media/tools/constrained_network_server/cns.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParseArgs | <not_specific> | def ParseArgs():
"""Define and parse the command-line arguments."""
parser = optparse.OptionParser()
parser.add_option('--expiry-time', type='int',
default=_DEFAULT_PORT_EXPIRY_TIME_SECS,
help=('Number of seconds before constrained ports expire '
... | Define and parse the command-line arguments. | Define and parse the command-line arguments. | [
"Define",
"and",
"parse",
"the",
"command",
"-",
"line",
"arguments",
"."
] | def ParseArgs():
parser = optparse.OptionParser()
parser.add_option('--expiry-time', type='int',
default=_DEFAULT_PORT_EXPIRY_TIME_SECS,
help=('Number of seconds before constrained ports expire '
'and are cleaned up. 0=Disabled. Default: %default'))
... | [
"def",
"ParseArgs",
"(",
")",
":",
"parser",
"=",
"optparse",
".",
"OptionParser",
"(",
")",
"parser",
".",
"add_option",
"(",
"'--expiry-time'",
",",
"type",
"=",
"'int'",
",",
"default",
"=",
"_DEFAULT_PORT_EXPIRY_TIME_SECS",
",",
"help",
"=",
"(",
"'Numbe... | Define and parse the command-line arguments. | [
"Define",
"and",
"parse",
"the",
"command",
"-",
"line",
"arguments",
"."
] | [
"\"\"\"Define and parse the command-line arguments.\"\"\"",
"# Convert port range into the desired tuple format.",
"# Convert the path to an absolute to remove any . or .."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
d039d8e7accc7d983a2322c0e42c8c74c8f977a9 | sunlongbo/chromium | media/tools/constrained_network_server/cns.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Main | <not_specific> | def Main():
"""Configure and start the ConstrainedNetworkServer."""
options = ParseArgs()
try:
traffic_control.CheckRequirements()
except traffic_control.TrafficControlError as e:
cherrypy.log(e.msg)
return
cherrypy.config.update({'server.socket_host': '::',
'server.soc... | Configure and start the ConstrainedNetworkServer. | Configure and start the ConstrainedNetworkServer. | [
"Configure",
"and",
"start",
"the",
"ConstrainedNetworkServer",
"."
] | def Main():
options = ParseArgs()
try:
traffic_control.CheckRequirements()
except traffic_control.TrafficControlError as e:
cherrypy.log(e.msg)
return
cherrypy.config.update({'server.socket_host': '::',
'server.socket_port': options.port})
if options.threads:
cherrypy... | [
"def",
"Main",
"(",
")",
":",
"options",
"=",
"ParseArgs",
"(",
")",
"try",
":",
"traffic_control",
".",
"CheckRequirements",
"(",
")",
"except",
"traffic_control",
".",
"TrafficControlError",
"as",
"e",
":",
"cherrypy",
".",
"log",
"(",
"e",
".",
"msg",
... | Configure and start the ConstrainedNetworkServer. | [
"Configure",
"and",
"start",
"the",
"ConstrainedNetworkServer",
"."
] | [
"\"\"\"Configure and start the ConstrainedNetworkServer.\"\"\"",
"# Setup port allocator here so we can call cleanup on failures/exit.",
"# Disable Ctrl-C handler to prevent interruption of cleanup."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
76d4277d2742277bf4bda056605296b30f10560c | sunlongbo/chromium | tools/disable_tests/conditions_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | powerset | <not_specific> | def powerset(iterable):
"""returns an iterator over all subsets of iterable."""
s = list(iterable)
return itertools.chain.from_iterable(
itertools.combinations(s, r) for r in range(len(s) + 1)) | returns an iterator over all subsets of iterable. | returns an iterator over all subsets of iterable. | [
"returns",
"an",
"iterator",
"over",
"all",
"subsets",
"of",
"iterable",
"."
] | def powerset(iterable):
s = list(iterable)
return itertools.chain.from_iterable(
itertools.combinations(s, r) for r in range(len(s) + 1)) | [
"def",
"powerset",
"(",
"iterable",
")",
":",
"s",
"=",
"list",
"(",
"iterable",
")",
"return",
"itertools",
".",
"chain",
".",
"from_iterable",
"(",
"itertools",
".",
"combinations",
"(",
"s",
",",
"r",
")",
"for",
"r",
"in",
"range",
"(",
"len",
"(... | returns an iterator over all subsets of iterable. | [
"returns",
"an",
"iterator",
"over",
"all",
"subsets",
"of",
"iterable",
"."
] | [
"\"\"\"returns an iterator over all subsets of iterable.\"\"\""
] | [
{
"param": "iterable",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "iterable",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
634248fd0fd229af568d93e3e1236d7f725896b7 | sunlongbo/chromium | chrome/chrome_cleaner/tools/import_paths.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetBuildDirectory | <not_specific> | def GetBuildDirectory(build_configuration):
"""Returns the path to the build directory relative to this file.
Args:
build_configuration: name of the build configuration whose directory
should be looked up, e.g. 'Debug' or 'Release'.
"""
return os.path.join(_ROOT_DIRECTORY, 'out', build_configuratio... | Returns the path to the build directory relative to this file.
Args:
build_configuration: name of the build configuration whose directory
should be looked up, e.g. 'Debug' or 'Release'.
| Returns the path to the build directory relative to this file. | [
"Returns",
"the",
"path",
"to",
"the",
"build",
"directory",
"relative",
"to",
"this",
"file",
"."
] | def GetBuildDirectory(build_configuration):
return os.path.join(_ROOT_DIRECTORY, 'out', build_configuration) | [
"def",
"GetBuildDirectory",
"(",
"build_configuration",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"_ROOT_DIRECTORY",
",",
"'out'",
",",
"build_configuration",
")"
] | Returns the path to the build directory relative to this file. | [
"Returns",
"the",
"path",
"to",
"the",
"build",
"directory",
"relative",
"to",
"this",
"file",
"."
] | [
"\"\"\"Returns the path to the build directory relative to this file.\n\n Args:\n build_configuration: name of the build configuration whose directory\n should be looked up, e.g. 'Debug' or 'Release'.\n \"\"\""
] | [
{
"param": "build_configuration",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "build_configuration",
"type": null,
"docstring": "name of the build configuration whose directory\nshould be looked up, e.g. 'Debug' or 'Release'.",
"docstring_tokens": [
"name",
"of",
"the",
"b... |
634248fd0fd229af568d93e3e1236d7f725896b7 | sunlongbo/chromium | chrome/chrome_cleaner/tools/import_paths.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AddDepotToolsToPath | <not_specific> | def AddDepotToolsToPath():
"""Locates a depot_tools checkout and adds it to the Python import path.
Returns:
The path to depot_tools.
"""
# Try to import find_depot_tools from the build subdir.
import_util.AddImportPath(os.path.join(_ROOT_DIRECTORY, 'build'))
import find_depot_tools
return find_depo... | Locates a depot_tools checkout and adds it to the Python import path.
Returns:
The path to depot_tools.
| Locates a depot_tools checkout and adds it to the Python import path. | [
"Locates",
"a",
"depot_tools",
"checkout",
"and",
"adds",
"it",
"to",
"the",
"Python",
"import",
"path",
"."
] | def AddDepotToolsToPath():
import_util.AddImportPath(os.path.join(_ROOT_DIRECTORY, 'build'))
import find_depot_tools
return find_depot_tools.add_depot_tools_to_path() | [
"def",
"AddDepotToolsToPath",
"(",
")",
":",
"import_util",
".",
"AddImportPath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"_ROOT_DIRECTORY",
",",
"'build'",
")",
")",
"import",
"find_depot_tools",
"return",
"find_depot_tools",
".",
"add_depot_tools_to_path",
"("... | Locates a depot_tools checkout and adds it to the Python import path. | [
"Locates",
"a",
"depot_tools",
"checkout",
"and",
"adds",
"it",
"to",
"the",
"Python",
"import",
"path",
"."
] | [
"\"\"\"Locates a depot_tools checkout and adds it to the Python import path.\n\n Returns:\n The path to depot_tools.\n \"\"\"",
"# Try to import find_depot_tools from the build subdir."
] | [] | {
"returns": [
{
"docstring": "The path to depot_tools.",
"docstring_tokens": [
"The",
"path",
"to",
"depot_tools",
"."
],
"type": null
}
],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
60246d08365a8f8059490f390dd9e733e2171da0 | sunlongbo/chromium | tools/bisect_repackage/bisect_repackage_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | IsGitCommitHash | <not_specific> | def IsGitCommitHash(regex_match):
"""Checks if match is correct SHA1 hash."""
matched_re = re.match(r'^[0-9,A-F]{40}$', regex_match.upper())
if matched_re: return True
return False | Checks if match is correct SHA1 hash. | Checks if match is correct SHA1 hash. | [
"Checks",
"if",
"match",
"is",
"correct",
"SHA1",
"hash",
"."
] | def IsGitCommitHash(regex_match):
matched_re = re.match(r'^[0-9,A-F]{40}$', regex_match.upper())
if matched_re: return True
return False | [
"def",
"IsGitCommitHash",
"(",
"regex_match",
")",
":",
"matched_re",
"=",
"re",
".",
"match",
"(",
"r'^[0-9,A-F]{40}$'",
",",
"regex_match",
".",
"upper",
"(",
")",
")",
"if",
"matched_re",
":",
"return",
"True",
"return",
"False"
] | Checks if match is correct SHA1 hash. | [
"Checks",
"if",
"match",
"is",
"correct",
"SHA1",
"hash",
"."
] | [
"\"\"\"Checks if match is correct SHA1 hash.\"\"\""
] | [
{
"param": "regex_match",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "regex_match",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
60246d08365a8f8059490f390dd9e733e2171da0 | sunlongbo/chromium | tools/bisect_repackage/bisect_repackage_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | IsCommitPosition | <not_specific> | def IsCommitPosition(regex_match):
"""Checks if match is correct revision(Cp number) format."""
matched_re = re.match(r'^[0-9]{6}$', regex_match)
if matched_re: return True
return False | Checks if match is correct revision(Cp number) format. | Checks if match is correct revision(Cp number) format. | [
"Checks",
"if",
"match",
"is",
"correct",
"revision",
"(",
"Cp",
"number",
")",
"format",
"."
] | def IsCommitPosition(regex_match):
matched_re = re.match(r'^[0-9]{6}$', regex_match)
if matched_re: return True
return False | [
"def",
"IsCommitPosition",
"(",
"regex_match",
")",
":",
"matched_re",
"=",
"re",
".",
"match",
"(",
"r'^[0-9]{6}$'",
",",
"regex_match",
")",
"if",
"matched_re",
":",
"return",
"True",
"return",
"False"
] | Checks if match is correct revision(Cp number) format. | [
"Checks",
"if",
"match",
"is",
"correct",
"revision",
"(",
"Cp",
"number",
")",
"format",
"."
] | [
"\"\"\"Checks if match is correct revision(Cp number) format.\"\"\""
] | [
{
"param": "regex_match",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "regex_match",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
60246d08365a8f8059490f390dd9e733e2171da0 | sunlongbo/chromium | tools/bisect_repackage/bisect_repackage_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunCommand | <not_specific> | def RunCommand(cmd, cwd=None):
"""Runs the given command and returns the exit code.
Args:
cmd: list of command arguments.
cwd: working directory to execute the command, or None if the current
working directory should be used.
Returns:
The exit code of the command.
"""
process = subproce... | Runs the given command and returns the exit code.
Args:
cmd: list of command arguments.
cwd: working directory to execute the command, or None if the current
working directory should be used.
Returns:
The exit code of the command.
| Runs the given command and returns the exit code. | [
"Runs",
"the",
"given",
"command",
"and",
"returns",
"the",
"exit",
"code",
"."
] | def RunCommand(cmd, cwd=None):
process = subprocess.Popen(cmd, cwd=cwd)
process.wait()
return process.returncode | [
"def",
"RunCommand",
"(",
"cmd",
",",
"cwd",
"=",
"None",
")",
":",
"process",
"=",
"subprocess",
".",
"Popen",
"(",
"cmd",
",",
"cwd",
"=",
"cwd",
")",
"process",
".",
"wait",
"(",
")",
"return",
"process",
".",
"returncode"
] | Runs the given command and returns the exit code. | [
"Runs",
"the",
"given",
"command",
"and",
"returns",
"the",
"exit",
"code",
"."
] | [
"\"\"\"Runs the given command and returns the exit code.\n\n Args:\n cmd: list of command arguments.\n cwd: working directory to execute the command, or None if the current\n working directory should be used.\n\n Returns:\n The exit code of the command.\n \"\"\""
] | [
{
"param": "cmd",
"type": null
},
{
"param": "cwd",
"type": null
}
] | {
"returns": [
{
"docstring": "The exit code of the command.",
"docstring_tokens": [
"The",
"exit",
"code",
"of",
"the",
"command",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cmd",
"t... |
60246d08365a8f8059490f390dd9e733e2171da0 | sunlongbo/chromium | tools/bisect_repackage/bisect_repackage_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RemoveDirectory | <not_specific> | def RemoveDirectory(*path):
"""Recursively removes a directory, even if it's marked read-only.
Remove the directory located at *path, if it exists.
shutil.rmtree() doesn't work on Windows if any of the files or directories
are read-only, which svn repositories and some .svn files are. We need to
be able to... | Recursively removes a directory, even if it's marked read-only.
Remove the directory located at *path, if it exists.
shutil.rmtree() doesn't work on Windows if any of the files or directories
are read-only, which svn repositories and some .svn files are. We need to
be able to force the files to be writable (... | Recursively removes a directory, even if it's marked read-only.
Remove the directory located at *path, if it exists.
shutil.rmtree() doesn't work on Windows if any of the files or directories
are read-only, which svn repositories and some .svn files are. We need to
be able to force the files to be writable as we tra... | [
"Recursively",
"removes",
"a",
"directory",
"even",
"if",
"it",
"'",
"s",
"marked",
"read",
"-",
"only",
".",
"Remove",
"the",
"directory",
"located",
"at",
"*",
"path",
"if",
"it",
"exists",
".",
"shutil",
".",
"rmtree",
"()",
"doesn",
"'",
"t",
"work... | def RemoveDirectory(*path):
file_path = os.path.join(*path)
if not os.path.exists(file_path):
return
if sys.platform == 'win32':
file_path = os.path.normcase(file_path)
for _ in xrange(3):
print('RemoveDirectory running %s' % (' '.join(
['cmd.exe', '/c', 'rd', '/q', '/s', file_path])))... | [
"def",
"RemoveDirectory",
"(",
"*",
"path",
")",
":",
"file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"*",
"path",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"file_path",
")",
":",
"return",
"if",
"sys",
".",
"platform",
"==",
... | Recursively removes a directory, even if it's marked read-only. | [
"Recursively",
"removes",
"a",
"directory",
"even",
"if",
"it",
"'",
"s",
"marked",
"read",
"-",
"only",
"."
] | [
"\"\"\"Recursively removes a directory, even if it's marked read-only.\n\n Remove the directory located at *path, if it exists.\n\n shutil.rmtree() doesn't work on Windows if any of the files or directories\n are read-only, which svn repositories and some .svn files are. We need to\n be able to force the files... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
60246d08365a8f8059490f390dd9e733e2171da0 | sunlongbo/chromium | tools/bisect_repackage/bisect_repackage_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MakeZip | <not_specific> | def MakeZip(output_dir, archive_name, file_list, file_relative_dir, dir_in_zip,
raise_error=True, remove_archive_directory=True, strip_files=None,
ignore_sub_folder=False):
"""Packs files into a new zip archive.
Files are first copied into a directory within the output_dir named for
the a... | Packs files into a new zip archive.
Files are first copied into a directory within the output_dir named for
the archive_name, which will be created if necessary and emptied if it
already exists. The files are then then packed using archive names
relative to the output_dir. That is, if the zipfile is unpacked... | Packs files into a new zip archive.
Files are first copied into a directory within the output_dir named for
the archive_name, which will be created if necessary and emptied if it
already exists. The files are then then packed using archive names
relative to the output_dir. That is, if the zipfile is unpacked in place... | [
"Packs",
"files",
"into",
"a",
"new",
"zip",
"archive",
".",
"Files",
"are",
"first",
"copied",
"into",
"a",
"directory",
"within",
"the",
"output_dir",
"named",
"for",
"the",
"archive_name",
"which",
"will",
"be",
"created",
"if",
"necessary",
"and",
"empti... | def MakeZip(output_dir, archive_name, file_list, file_relative_dir, dir_in_zip,
raise_error=True, remove_archive_directory=True, strip_files=None,
ignore_sub_folder=False):
start_time = time.clock()
archive_dir = os.path.join(output_dir, dir_in_zip)
print('output_dir: %s, archive_name: %s'... | [
"def",
"MakeZip",
"(",
"output_dir",
",",
"archive_name",
",",
"file_list",
",",
"file_relative_dir",
",",
"dir_in_zip",
",",
"raise_error",
"=",
"True",
",",
"remove_archive_directory",
"=",
"True",
",",
"strip_files",
"=",
"None",
",",
"ignore_sub_folder",
"=",
... | Packs files into a new zip archive. | [
"Packs",
"files",
"into",
"a",
"new",
"zip",
"archive",
"."
] | [
"\"\"\"Packs files into a new zip archive.\n\n Files are first copied into a directory within the output_dir named for\n the archive_name, which will be created if necessary and emptied if it\n already exists. The files are then then packed using archive names\n relative to the output_dir. That is, if the zip... | [
{
"param": "output_dir",
"type": null
},
{
"param": "archive_name",
"type": null
},
{
"param": "file_list",
"type": null
},
{
"param": "file_relative_dir",
"type": null
},
{
"param": "dir_in_zip",
"type": null
},
{
"param": "raise_error",
"type": n... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "output_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "archive_name",
"type": null,
"docstring": null,
"docstr... |
60246d08365a8f8059490f390dd9e733e2171da0 | sunlongbo/chromium | tools/bisect_repackage/bisect_repackage_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ExtractZip | null | def ExtractZip(filename, output_dir, extract_file_list=[], verbose=True):
"""Extract the zip archive in the output directory."""
MaybeMakeDirectory(output_dir)
# On Linux and Mac, we use the unzip command as it will
# handle links and file bits (executable), which is much
# easier then trying to do that with... | Extract the zip archive in the output directory. | Extract the zip archive in the output directory. | [
"Extract",
"the",
"zip",
"archive",
"in",
"the",
"output",
"directory",
"."
] | def ExtractZip(filename, output_dir, extract_file_list=[], verbose=True):
MaybeMakeDirectory(output_dir)
The Mac Version of unzip unfortunately does not support Zip64, whereas
the python module does, so we have to fallback to the python zip module
on Mac if the filesize is greater than 4GB.
On Windows, tr... | [
"def",
"ExtractZip",
"(",
"filename",
",",
"output_dir",
",",
"extract_file_list",
"=",
"[",
"]",
",",
"verbose",
"=",
"True",
")",
":",
"MaybeMakeDirectory",
"(",
"output_dir",
")",
"unzip_cmd",
"=",
"None",
"if",
"(",
"(",
"IsMac",
"(",
")",
"and",
"os... | Extract the zip archive in the output directory. | [
"Extract",
"the",
"zip",
"archive",
"in",
"the",
"output",
"directory",
"."
] | [
"\"\"\"Extract the zip archive in the output directory.\"\"\"",
"# On Linux and Mac, we use the unzip command as it will",
"# handle links and file bits (executable), which is much",
"# easier then trying to do that with ZipInfo options.",
"#",
"# The Mac Version of unzip unfortunately does not support Zi... | [
{
"param": "filename",
"type": null
},
{
"param": "output_dir",
"type": null
},
{
"param": "extract_file_list",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output_dir",
"type": null,
"docstring": null,
"docstring_... |
602697b9472be12df4f248283fc1d656baeae3d4 | sunlongbo/chromium | testing/unexpected_passes_common/result_output_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testRegularData | null | def testRegularData(self):
"""Tests that everything functions when regular data is provided."""
unmatched_results = {
'builder': [
data_types.Result('foo', ['win', 'intel'], 'Failure', 'step_name',
'build_id')
],
}
# TODO(crbug.com/1198237): Hard... | Tests that everything functions when regular data is provided. | Tests that everything functions when regular data is provided. | [
"Tests",
"that",
"everything",
"functions",
"when",
"regular",
"data",
"is",
"provided",
"."
] | def testRegularData(self):
unmatched_results = {
'builder': [
data_types.Result('foo', ['win', 'intel'], 'Failure', 'step_name',
'build_id')
],
}
expected_output = {
'foo': {
'builder': {
'step_name': [
... | [
"def",
"testRegularData",
"(",
"self",
")",
":",
"unmatched_results",
"=",
"{",
"'builder'",
":",
"[",
"data_types",
".",
"Result",
"(",
"'foo'",
",",
"[",
"'win'",
",",
"'intel'",
"]",
",",
"'Failure'",
",",
"'step_name'",
",",
"'build_id'",
")",
"]",
"... | Tests that everything functions when regular data is provided. | [
"Tests",
"that",
"everything",
"functions",
"when",
"regular",
"data",
"is",
"provided",
"."
] | [
"\"\"\"Tests that everything functions when regular data is provided.\"\"\"",
"# TODO(crbug.com/1198237): Hard-code the tag string once only Python 3 is",
"# supported."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602697b9472be12df4f248283fc1d656baeae3d4 | sunlongbo/chromium | testing/unexpected_passes_common/result_output_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testSemiStaleMap | null | def testSemiStaleMap(self):
"""Tests that everything functions when regular data is provided."""
expectation_map = data_types.TestExpectationMap({
'expectation_file':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo/test', ['win', 'intel'], [
... | Tests that everything functions when regular data is provided. | Tests that everything functions when regular data is provided. | [
"Tests",
"that",
"everything",
"functions",
"when",
"regular",
"data",
"is",
"provided",
"."
] | def testSemiStaleMap(self):
expectation_map = data_types.TestExpectationMap({
'expectation_file':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo/test', ['win', 'intel'], [
'RetryOnFailure'
]):
... | [
"def",
"testSemiStaleMap",
"(",
"self",
")",
":",
"expectation_map",
"=",
"data_types",
".",
"TestExpectationMap",
"(",
"{",
"'expectation_file'",
":",
"data_types",
".",
"ExpectationBuilderMap",
"(",
"{",
"data_types",
".",
"Expectation",
"(",
"'foo/test'",
",",
... | Tests that everything functions when regular data is provided. | [
"Tests",
"that",
"everything",
"functions",
"when",
"regular",
"data",
"is",
"provided",
"."
] | [
"\"\"\"Tests that everything functions when regular data is provided.\"\"\"",
"# TODO(crbug.com/1198237): Remove the Python 2 version once we are fully",
"# switched to Python 3.",
"# Set ordering does not appear to be stable between test runs, as we can",
"# get either order of tags. So, generate them now ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602697b9472be12df4f248283fc1d656baeae3d4 | sunlongbo/chromium | testing/unexpected_passes_common/result_output_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testRecursiveHtmlToFileExpectationMap | null | def testRecursiveHtmlToFileExpectationMap(self):
"""Tests _RecursiveHtmlToFile() with an expectation map as input."""
expectation_map = {
'foo': {
'"RetryOnFailure" expectation on "win intel"': {
'builder': {
'Fully passed in the following': [
... | Tests _RecursiveHtmlToFile() with an expectation map as input. | Tests _RecursiveHtmlToFile() with an expectation map as input. | [
"Tests",
"_RecursiveHtmlToFile",
"()",
"with",
"an",
"expectation",
"map",
"as",
"input",
"."
] | def testRecursiveHtmlToFileExpectationMap(self):
expectation_map = {
'foo': {
'"RetryOnFailure" expectation on "win intel"': {
'builder': {
'Fully passed in the following': [
'all_pass (2/2)',
],
... | [
"def",
"testRecursiveHtmlToFileExpectationMap",
"(",
"self",
")",
":",
"expectation_map",
"=",
"{",
"'foo'",
":",
"{",
"'\"RetryOnFailure\" expectation on \"win intel\"'",
":",
"{",
"'builder'",
":",
"{",
"'Fully passed in the following'",
":",
"[",
"'all_pass (2/2)'",
",... | Tests _RecursiveHtmlToFile() with an expectation map as input. | [
"Tests",
"_RecursiveHtmlToFile",
"()",
"with",
"an",
"expectation",
"map",
"as",
"input",
"."
] | [
"\"\"\"Tests _RecursiveHtmlToFile() with an expectation map as input.\"\"\"",
"# pylint: disable=line-too-long",
"# TODO(crbug.com/1198237): Remove the Python 2 version once we've fully",
"# switched to Python 3.",
"# pylint: enable=line-too-long"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602697b9472be12df4f248283fc1d656baeae3d4 | sunlongbo/chromium | testing/unexpected_passes_common/result_output_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testRecursivePrintToFileExpectationMap | null | def testRecursivePrintToFileExpectationMap(self):
"""Tests RecursivePrintToFile() with an expectation map as input."""
expectation_map = {
'foo': {
'"RetryOnFailure" expectation on "win intel"': {
'builder': {
'Fully passed in the following': [
... | Tests RecursivePrintToFile() with an expectation map as input. | Tests RecursivePrintToFile() with an expectation map as input. | [
"Tests",
"RecursivePrintToFile",
"()",
"with",
"an",
"expectation",
"map",
"as",
"input",
"."
] | def testRecursivePrintToFileExpectationMap(self):
expectation_map = {
'foo': {
'"RetryOnFailure" expectation on "win intel"': {
'builder': {
'Fully passed in the following': [
'all_pass (2/2)',
],
... | [
"def",
"testRecursivePrintToFileExpectationMap",
"(",
"self",
")",
":",
"expectation_map",
"=",
"{",
"'foo'",
":",
"{",
"'\"RetryOnFailure\" expectation on \"win intel\"'",
":",
"{",
"'builder'",
":",
"{",
"'Fully passed in the following'",
":",
"[",
"'all_pass (2/2)'",
"... | Tests RecursivePrintToFile() with an expectation map as input. | [
"Tests",
"RecursivePrintToFile",
"()",
"with",
"an",
"expectation",
"map",
"as",
"input",
"."
] | [
"\"\"\"Tests RecursivePrintToFile() with an expectation map as input.\"\"\"",
"# TODO(crbug.com/1198237): Keep the Python 3 version once we are fully",
"# switched."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602697b9472be12df4f248283fc1d656baeae3d4 | sunlongbo/chromium | testing/unexpected_passes_common/result_output_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testRecursivePrintToFileUnmatchedResults | null | def testRecursivePrintToFileUnmatchedResults(self):
"""Tests RecursivePrintToFile() with unmatched results as input."""
unmatched_results = {
'foo': {
'builder': {
None: [
'Expected "" on http://ci.chromium.org/b/build_id, got '
'"Failu... | Tests RecursivePrintToFile() with unmatched results as input. | Tests RecursivePrintToFile() with unmatched results as input. | [
"Tests",
"RecursivePrintToFile",
"()",
"with",
"unmatched",
"results",
"as",
"input",
"."
] | def testRecursivePrintToFileUnmatchedResults(self):
unmatched_results = {
'foo': {
'builder': {
None: [
'Expected "" on http://ci.chromium.org/b/build_id, got '
'"Failure" with tags []',
],
'step_name': [
... | [
"def",
"testRecursivePrintToFileUnmatchedResults",
"(",
"self",
")",
":",
"unmatched_results",
"=",
"{",
"'foo'",
":",
"{",
"'builder'",
":",
"{",
"None",
":",
"[",
"'Expected \"\" on http://ci.chromium.org/b/build_id, got '",
"'\"Failure\" with tags []'",
",",
"]",
",",
... | Tests RecursivePrintToFile() with unmatched results as input. | [
"Tests",
"RecursivePrintToFile",
"()",
"with",
"unmatched",
"results",
"as",
"input",
"."
] | [
"\"\"\"Tests RecursivePrintToFile() with unmatched results as input.\"\"\"",
"# pylint: disable=line-too-long",
"# Order is not guaranteed, so create permutations.",
"# pylint: enable=line-too-long"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602697b9472be12df4f248283fc1d656baeae3d4 | sunlongbo/chromium | testing/unexpected_passes_common/result_output_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testOutputResultsUnsupportedFormat | null | def testOutputResultsUnsupportedFormat(self):
"""Tests that passing in an unsupported format is an error."""
with self.assertRaises(RuntimeError):
result_output.OutputResults(data_types.TestExpectationMap(),
data_types.TestExpectationMap(),
... | Tests that passing in an unsupported format is an error. | Tests that passing in an unsupported format is an error. | [
"Tests",
"that",
"passing",
"in",
"an",
"unsupported",
"format",
"is",
"an",
"error",
"."
] | def testOutputResultsUnsupportedFormat(self):
with self.assertRaises(RuntimeError):
result_output.OutputResults(data_types.TestExpectationMap(),
data_types.TestExpectationMap(),
data_types.TestExpectationMap(), {}, {},
... | [
"def",
"testOutputResultsUnsupportedFormat",
"(",
"self",
")",
":",
"with",
"self",
".",
"assertRaises",
"(",
"RuntimeError",
")",
":",
"result_output",
".",
"OutputResults",
"(",
"data_types",
".",
"TestExpectationMap",
"(",
")",
",",
"data_types",
".",
"TestExpe... | Tests that passing in an unsupported format is an error. | [
"Tests",
"that",
"passing",
"in",
"an",
"unsupported",
"format",
"is",
"an",
"error",
"."
] | [
"\"\"\"Tests that passing in an unsupported format 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": []
} |
602697b9472be12df4f248283fc1d656baeae3d4 | sunlongbo/chromium | testing/unexpected_passes_common/result_output_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testOutputResultsSmoketest | null | def testOutputResultsSmoketest(self):
"""Test that nothing blows up when outputting."""
expectation_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win', 'intel'], 'RetryOnFailure'):
data_types.BuilderStepMap... | Test that nothing blows up when outputting. | Test that nothing blows up when outputting. | [
"Test",
"that",
"nothing",
"blows",
"up",
"when",
"outputting",
"."
] | def testOutputResultsSmoketest(self):
expectation_map = data_types.TestExpectationMap({
'foo':
data_types.ExpectationBuilderMap({
data_types.Expectation('foo', ['win', 'intel'], 'RetryOnFailure'):
data_types.BuilderStepMap({
'stale':
data_types... | [
"def",
"testOutputResultsSmoketest",
"(",
"self",
")",
":",
"expectation_map",
"=",
"data_types",
".",
"TestExpectationMap",
"(",
"{",
"'foo'",
":",
"data_types",
".",
"ExpectationBuilderMap",
"(",
"{",
"data_types",
".",
"Expectation",
"(",
"'foo'",
",",
"[",
"... | Test that nothing blows up when outputting. | [
"Test",
"that",
"nothing",
"blows",
"up",
"when",
"outputting",
"."
] | [
"\"\"\"Test that nothing blows up when outputting.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602697b9472be12df4f248283fc1d656baeae3d4 | sunlongbo/chromium | testing/unexpected_passes_common/result_output_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testOutput | null | def testOutput(self):
"""Tests that the output is correct."""
urls = [
'https://crbug.com/1234',
'https://crbug.com/angleproject/1234',
'http://crbug.com/2345',
'crbug.com/3456',
]
orphaned_urls = ['https://crbug.com/1234', 'crbug.com/3456']
result_output._OutputAffec... | Tests that the output is correct. | Tests that the output is correct. | [
"Tests",
"that",
"the",
"output",
"is",
"correct",
"."
] | def testOutput(self):
urls = [
'https://crbug.com/1234',
'https://crbug.com/angleproject/1234',
'http://crbug.com/2345',
'crbug.com/3456',
]
orphaned_urls = ['https://crbug.com/1234', 'crbug.com/3456']
result_output._OutputAffectedUrls(urls, orphaned_urls, self._file_hand... | [
"def",
"testOutput",
"(",
"self",
")",
":",
"urls",
"=",
"[",
"'https://crbug.com/1234'",
",",
"'https://crbug.com/angleproject/1234'",
",",
"'http://crbug.com/2345'",
",",
"'crbug.com/3456'",
",",
"]",
"orphaned_urls",
"=",
"[",
"'https://crbug.com/1234'",
",",
"'crbug... | Tests that the output is correct. | [
"Tests",
"that",
"the",
"output",
"is",
"correct",
"."
] | [
"\"\"\"Tests that the output is correct.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602697b9472be12df4f248283fc1d656baeae3d4 | sunlongbo/chromium | testing/unexpected_passes_common/result_output_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testSingleLine | null | def testSingleLine(self):
"""Tests when all bugs can fit on a single line."""
urls = [
'crbug.com/1234',
'https://crbug.com/angleproject/2345',
]
result_output._OutputUrlsForClDescription(urls, [], self._file_handle)
self._file_handle.close()
with open(self._filepath) as f:
... | Tests when all bugs can fit on a single line. | Tests when all bugs can fit on a single line. | [
"Tests",
"when",
"all",
"bugs",
"can",
"fit",
"on",
"a",
"single",
"line",
"."
] | def testSingleLine(self):
urls = [
'crbug.com/1234',
'https://crbug.com/angleproject/2345',
]
result_output._OutputUrlsForClDescription(urls, [], self._file_handle)
self._file_handle.close()
with open(self._filepath) as f:
self.assertEqual(f.read(), ('Affected bugs for CL descr... | [
"def",
"testSingleLine",
"(",
"self",
")",
":",
"urls",
"=",
"[",
"'crbug.com/1234'",
",",
"'https://crbug.com/angleproject/2345'",
",",
"]",
"result_output",
".",
"_OutputUrlsForClDescription",
"(",
"urls",
",",
"[",
"]",
",",
"self",
".",
"_file_handle",
")",
... | Tests when all bugs can fit on a single line. | [
"Tests",
"when",
"all",
"bugs",
"can",
"fit",
"on",
"a",
"single",
"line",
"."
] | [
"\"\"\"Tests when all bugs can fit on a single line.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602697b9472be12df4f248283fc1d656baeae3d4 | sunlongbo/chromium | testing/unexpected_passes_common/result_output_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testBugLimit | null | def testBugLimit(self):
"""Tests that only a certain number of bugs are allowed per line."""
urls = [
'crbug.com/1',
'crbug.com/2',
'crbug.com/3',
'crbug.com/4',
'crbug.com/5',
'crbug.com/6',
]
result_output._OutputUrlsForClDescription(urls, [], self._file... | Tests that only a certain number of bugs are allowed per line. | Tests that only a certain number of bugs are allowed per line. | [
"Tests",
"that",
"only",
"a",
"certain",
"number",
"of",
"bugs",
"are",
"allowed",
"per",
"line",
"."
] | def testBugLimit(self):
urls = [
'crbug.com/1',
'crbug.com/2',
'crbug.com/3',
'crbug.com/4',
'crbug.com/5',
'crbug.com/6',
]
result_output._OutputUrlsForClDescription(urls, [], self._file_handle)
self._file_handle.close()
with open(self._filepath) as f... | [
"def",
"testBugLimit",
"(",
"self",
")",
":",
"urls",
"=",
"[",
"'crbug.com/1'",
",",
"'crbug.com/2'",
",",
"'crbug.com/3'",
",",
"'crbug.com/4'",
",",
"'crbug.com/5'",
",",
"'crbug.com/6'",
",",
"]",
"result_output",
".",
"_OutputUrlsForClDescription",
"(",
"urls... | Tests that only a certain number of bugs are allowed per line. | [
"Tests",
"that",
"only",
"a",
"certain",
"number",
"of",
"bugs",
"are",
"allowed",
"per",
"line",
"."
] | [
"\"\"\"Tests that only a certain number of bugs are allowed per line.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602697b9472be12df4f248283fc1d656baeae3d4 | sunlongbo/chromium | testing/unexpected_passes_common/result_output_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testLengthLimit | null | def testLengthLimit(self):
"""Tests that only a certain number of characters are allowed per line."""
urls = [
'crbug.com/averylongprojectthatwillgooverthelinelength/1',
'crbug.com/averylongprojectthatwillgooverthelinelength/2',
]
result_output._OutputUrlsForClDescription(urls, [], self.... | Tests that only a certain number of characters are allowed per line. | Tests that only a certain number of characters are allowed per line. | [
"Tests",
"that",
"only",
"a",
"certain",
"number",
"of",
"characters",
"are",
"allowed",
"per",
"line",
"."
] | def testLengthLimit(self):
urls = [
'crbug.com/averylongprojectthatwillgooverthelinelength/1',
'crbug.com/averylongprojectthatwillgooverthelinelength/2',
]
result_output._OutputUrlsForClDescription(urls, [], self._file_handle)
self._file_handle.close()
with open(self._filepath) as f:... | [
"def",
"testLengthLimit",
"(",
"self",
")",
":",
"urls",
"=",
"[",
"'crbug.com/averylongprojectthatwillgooverthelinelength/1'",
",",
"'crbug.com/averylongprojectthatwillgooverthelinelength/2'",
",",
"]",
"result_output",
".",
"_OutputUrlsForClDescription",
"(",
"urls",
",",
"... | Tests that only a certain number of characters are allowed per line. | [
"Tests",
"that",
"only",
"a",
"certain",
"number",
"of",
"characters",
"are",
"allowed",
"per",
"line",
"."
] | [
"\"\"\"Tests that only a certain number of characters are allowed per line.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602697b9472be12df4f248283fc1d656baeae3d4 | sunlongbo/chromium | testing/unexpected_passes_common/result_output_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testSingleBugOverLineLimit | null | def testSingleBugOverLineLimit(self):
"""Tests the behavior when a single bug by itself is over the line limit."""
project_name = result_output.MAX_CHARACTERS_PER_CL_LINE * 'a'
urls = [
'crbug.com/%s/1' % project_name,
'crbug.com/2',
]
result_output._OutputUrlsForClDescription(urls, ... | Tests the behavior when a single bug by itself is over the line limit. | Tests the behavior when a single bug by itself is over the line limit. | [
"Tests",
"the",
"behavior",
"when",
"a",
"single",
"bug",
"by",
"itself",
"is",
"over",
"the",
"line",
"limit",
"."
] | def testSingleBugOverLineLimit(self):
project_name = result_output.MAX_CHARACTERS_PER_CL_LINE * 'a'
urls = [
'crbug.com/%s/1' % project_name,
'crbug.com/2',
]
result_output._OutputUrlsForClDescription(urls, [], self._file_handle)
self._file_handle.close()
with open(self._filepath... | [
"def",
"testSingleBugOverLineLimit",
"(",
"self",
")",
":",
"project_name",
"=",
"result_output",
".",
"MAX_CHARACTERS_PER_CL_LINE",
"*",
"'a'",
"urls",
"=",
"[",
"'crbug.com/%s/1'",
"%",
"project_name",
",",
"'crbug.com/2'",
",",
"]",
"result_output",
".",
"_Output... | Tests the behavior when a single bug by itself is over the line limit. | [
"Tests",
"the",
"behavior",
"when",
"a",
"single",
"bug",
"by",
"itself",
"is",
"over",
"the",
"line",
"limit",
"."
] | [
"\"\"\"Tests the behavior when a single bug by itself is over the line limit.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602697b9472be12df4f248283fc1d656baeae3d4 | sunlongbo/chromium | testing/unexpected_passes_common/result_output_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testOrphanedBugs | null | def testOrphanedBugs(self):
"""Tests that orphaned bugs are output properly alongside affected ones."""
urls = [
'crbug.com/1',
'crbug.com/2',
'crbug.com/3',
]
orphaned_urls = ['crbug.com/2']
result_output._OutputUrlsForClDescription(urls, orphaned_urls,
... | Tests that orphaned bugs are output properly alongside affected ones. | Tests that orphaned bugs are output properly alongside affected ones. | [
"Tests",
"that",
"orphaned",
"bugs",
"are",
"output",
"properly",
"alongside",
"affected",
"ones",
"."
] | def testOrphanedBugs(self):
urls = [
'crbug.com/1',
'crbug.com/2',
'crbug.com/3',
]
orphaned_urls = ['crbug.com/2']
result_output._OutputUrlsForClDescription(urls, orphaned_urls,
self._file_handle)
self._file_handle.close()
wi... | [
"def",
"testOrphanedBugs",
"(",
"self",
")",
":",
"urls",
"=",
"[",
"'crbug.com/1'",
",",
"'crbug.com/2'",
",",
"'crbug.com/3'",
",",
"]",
"orphaned_urls",
"=",
"[",
"'crbug.com/2'",
"]",
"result_output",
".",
"_OutputUrlsForClDescription",
"(",
"urls",
",",
"or... | Tests that orphaned bugs are output properly alongside affected ones. | [
"Tests",
"that",
"orphaned",
"bugs",
"are",
"output",
"properly",
"alongside",
"affected",
"ones",
"."
] | [
"\"\"\"Tests that orphaned bugs are output properly alongside affected ones.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602697b9472be12df4f248283fc1d656baeae3d4 | sunlongbo/chromium | testing/unexpected_passes_common/result_output_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testOnlyOrphanedBugs | null | def testOnlyOrphanedBugs(self):
"""Tests output when all affected bugs are orphaned bugs."""
urls = [
'crbug.com/1',
'crbug.com/2',
]
orphaned_urls = [
'crbug.com/1',
'crbug.com/2',
]
result_output._OutputUrlsForClDescription(urls, orphaned_urls,
... | Tests output when all affected bugs are orphaned bugs. | Tests output when all affected bugs are orphaned bugs. | [
"Tests",
"output",
"when",
"all",
"affected",
"bugs",
"are",
"orphaned",
"bugs",
"."
] | def testOnlyOrphanedBugs(self):
urls = [
'crbug.com/1',
'crbug.com/2',
]
orphaned_urls = [
'crbug.com/1',
'crbug.com/2',
]
result_output._OutputUrlsForClDescription(urls, orphaned_urls,
self._file_handle)
self._file_ha... | [
"def",
"testOnlyOrphanedBugs",
"(",
"self",
")",
":",
"urls",
"=",
"[",
"'crbug.com/1'",
",",
"'crbug.com/2'",
",",
"]",
"orphaned_urls",
"=",
"[",
"'crbug.com/1'",
",",
"'crbug.com/2'",
",",
"]",
"result_output",
".",
"_OutputUrlsForClDescription",
"(",
"urls",
... | Tests output when all affected bugs are orphaned bugs. | [
"Tests",
"output",
"when",
"all",
"affected",
"bugs",
"are",
"orphaned",
"bugs",
"."
] | [
"\"\"\"Tests output when all affected bugs are orphaned bugs.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602697b9472be12df4f248283fc1d656baeae3d4 | sunlongbo/chromium | testing/unexpected_passes_common/result_output_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testEmptyInput | null | def testEmptyInput(self):
"""Tests that an empty input doesn't cause breakage."""
output = result_output.ConvertBuilderMapToPassOrderedStringDict(
data_types.BuilderStepMap())
expected_output = collections.OrderedDict()
expected_output[result_output.FULL_PASS] = {}
expected_output[result_out... | Tests that an empty input doesn't cause breakage. | Tests that an empty input doesn't cause breakage. | [
"Tests",
"that",
"an",
"empty",
"input",
"doesn",
"'",
"t",
"cause",
"breakage",
"."
] | def testEmptyInput(self):
output = result_output.ConvertBuilderMapToPassOrderedStringDict(
data_types.BuilderStepMap())
expected_output = collections.OrderedDict()
expected_output[result_output.FULL_PASS] = {}
expected_output[result_output.NEVER_PASS] = {}
expected_output[result_output.PARTI... | [
"def",
"testEmptyInput",
"(",
"self",
")",
":",
"output",
"=",
"result_output",
".",
"ConvertBuilderMapToPassOrderedStringDict",
"(",
"data_types",
".",
"BuilderStepMap",
"(",
")",
")",
"expected_output",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"expected_o... | Tests that an empty input doesn't cause breakage. | [
"Tests",
"that",
"an",
"empty",
"input",
"doesn",
"'",
"t",
"cause",
"breakage",
"."
] | [
"\"\"\"Tests that an empty input doesn't cause breakage.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
602697b9472be12df4f248283fc1d656baeae3d4 | sunlongbo/chromium | testing/unexpected_passes_common/result_output_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testBasic | null | def testBasic(self):
"""Tests that a map is properly converted."""
builder_map = data_types.BuilderStepMap({
'fully pass':
data_types.StepBuildStatsMap({
'step1': uu.CreateStatsWithPassFails(1, 0),
}),
'never pass':
data_types.StepBuildStatsMap({
'... | Tests that a map is properly converted. | Tests that a map is properly converted. | [
"Tests",
"that",
"a",
"map",
"is",
"properly",
"converted",
"."
] | def testBasic(self):
builder_map = data_types.BuilderStepMap({
'fully pass':
data_types.StepBuildStatsMap({
'step1': uu.CreateStatsWithPassFails(1, 0),
}),
'never pass':
data_types.StepBuildStatsMap({
'step3': uu.CreateStatsWithPassFails(0, 1),
... | [
"def",
"testBasic",
"(",
"self",
")",
":",
"builder_map",
"=",
"data_types",
".",
"BuilderStepMap",
"(",
"{",
"'fully pass'",
":",
"data_types",
".",
"StepBuildStatsMap",
"(",
"{",
"'step1'",
":",
"uu",
".",
"CreateStatsWithPassFails",
"(",
"1",
",",
"0",
")... | Tests that a map is properly converted. | [
"Tests",
"that",
"a",
"map",
"is",
"properly",
"converted",
"."
] | [
"\"\"\"Tests that a map is properly converted.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a205c0791e9debf77ca4fdfb390c93096d9eb733 | sunlongbo/chromium | third_party/blink/tools/blinkpy/w3c/pr_cleanup_tool.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | close_pr_and_delete_branch | null | def close_pr_and_delete_branch(self, pull_request_number, comment):
"""Closes a PR with a comment and delete the corresponding branch."""
self.wpt_github.add_comment(pull_request_number, comment)
self.wpt_github.update_pr(pull_request_number, state='closed')
branch = self.wpt_github.get_... | Closes a PR with a comment and delete the corresponding branch. | Closes a PR with a comment and delete the corresponding branch. | [
"Closes",
"a",
"PR",
"with",
"a",
"comment",
"and",
"delete",
"the",
"corresponding",
"branch",
"."
] | def close_pr_and_delete_branch(self, pull_request_number, comment):
self.wpt_github.add_comment(pull_request_number, comment)
self.wpt_github.update_pr(pull_request_number, state='closed')
branch = self.wpt_github.get_pr_branch(pull_request_number)
self.wpt_github.delete_remote_branch(br... | [
"def",
"close_pr_and_delete_branch",
"(",
"self",
",",
"pull_request_number",
",",
"comment",
")",
":",
"self",
".",
"wpt_github",
".",
"add_comment",
"(",
"pull_request_number",
",",
"comment",
")",
"self",
".",
"wpt_github",
".",
"update_pr",
"(",
"pull_request_... | Closes a PR with a comment and delete the corresponding branch. | [
"Closes",
"a",
"PR",
"with",
"a",
"comment",
"and",
"delete",
"the",
"corresponding",
"branch",
"."
] | [
"\"\"\"Closes a PR with a comment and delete the corresponding branch.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "pull_request_number",
"type": null
},
{
"param": "comment",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pull_request_number",
"type": null,
"docstring": null,
"docst... |
a205c0791e9debf77ca4fdfb390c93096d9eb733 | sunlongbo/chromium | third_party/blink/tools/blinkpy/w3c/pr_cleanup_tool.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | log_affected_pr_details | null | def log_affected_pr_details(self, pull_request, comment):
"""Logs details of an affected PR."""
_log.info(comment)
_log.info('https://github.com/web-platform-tests/wpt/pull/%s',
pull_request.number)
_log.info(
self.wpt_github.extract_metadata('Reviewed-on: '... | Logs details of an affected PR. | Logs details of an affected PR. | [
"Logs",
"details",
"of",
"an",
"affected",
"PR",
"."
] | def log_affected_pr_details(self, pull_request, comment):
_log.info(comment)
_log.info('https://github.com/web-platform-tests/wpt/pull/%s',
pull_request.number)
_log.info(
self.wpt_github.extract_metadata('Reviewed-on: ',
... | [
"def",
"log_affected_pr_details",
"(",
"self",
",",
"pull_request",
",",
"comment",
")",
":",
"_log",
".",
"info",
"(",
"comment",
")",
"_log",
".",
"info",
"(",
"'https://github.com/web-platform-tests/wpt/pull/%s'",
",",
"pull_request",
".",
"number",
")",
"_log"... | Logs details of an affected PR. | [
"Logs",
"details",
"of",
"an",
"affected",
"PR",
"."
] | [
"\"\"\"Logs details of an affected PR.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "pull_request",
"type": null
},
{
"param": "comment",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pull_request",
"type": null,
"docstring": null,
"docstring_to... |
a20b8d3ed9d996cc0cb8d0c1b783912dfcf8f69b | sunlongbo/chromium | testing/unexpected_passes_common/data_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AppliesToResult | <not_specific> | def AppliesToResult(self, result):
"""Checks whether this expectation should have applied to |result|.
An expectation applies to a result if the test names match (including
wildcard expansion) and the expectation's tags are a subset of the result's
tags.
Args:
result: A Result instance to ch... | Checks whether this expectation should have applied to |result|.
An expectation applies to a result if the test names match (including
wildcard expansion) and the expectation's tags are a subset of the result's
tags.
Args:
result: A Result instance to check against.
Returns:
True if |... | Checks whether this expectation should have applied to |result|.
An expectation applies to a result if the test names match (including
wildcard expansion) and the expectation's tags are a subset of the result's
tags. | [
"Checks",
"whether",
"this",
"expectation",
"should",
"have",
"applied",
"to",
"|result|",
".",
"An",
"expectation",
"applies",
"to",
"a",
"result",
"if",
"the",
"test",
"names",
"match",
"(",
"including",
"wildcard",
"expansion",
")",
"and",
"the",
"expectati... | def AppliesToResult(self, result):
assert isinstance(result, BaseResult)
return (self._comp(result.test) and self.tags <= result.tags) | [
"def",
"AppliesToResult",
"(",
"self",
",",
"result",
")",
":",
"assert",
"isinstance",
"(",
"result",
",",
"BaseResult",
")",
"return",
"(",
"self",
".",
"_comp",
"(",
"result",
".",
"test",
")",
"and",
"self",
".",
"tags",
"<=",
"result",
".",
"tags"... | Checks whether this expectation should have applied to |result|. | [
"Checks",
"whether",
"this",
"expectation",
"should",
"have",
"applied",
"to",
"|result|",
"."
] | [
"\"\"\"Checks whether this expectation should have applied to |result|.\n\n An expectation applies to a result if the test names match (including\n wildcard expansion) and the expectation's tags are a subset of the result's\n tags.\n\n Args:\n result: A Result instance to check against.\n\n Retu... | [
{
"param": "self",
"type": null
},
{
"param": "result",
"type": null
}
] | {
"returns": [
{
"docstring": "True if |self| applies to |result|, otherwise False.",
"docstring_tokens": [
"True",
"if",
"|self|",
"applies",
"to",
"|result|",
"otherwise",
"False",
"."
],
"type": null
}
],
"r... |
a20b8d3ed9d996cc0cb8d0c1b783912dfcf8f69b | sunlongbo/chromium | testing/unexpected_passes_common/data_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MaybeAppliesToTest | <not_specific> | def MaybeAppliesToTest(self, test_name):
"""Similar to AppliesToResult, but used to do initial filtering.
Args:
test_name: A string containing the name of a test.
Returns:
True if |self| could apply to a test named |test_name|, otherwise False.
"""
return self._comp(test_name) | Similar to AppliesToResult, but used to do initial filtering.
Args:
test_name: A string containing the name of a test.
Returns:
True if |self| could apply to a test named |test_name|, otherwise False.
| Similar to AppliesToResult, but used to do initial filtering. | [
"Similar",
"to",
"AppliesToResult",
"but",
"used",
"to",
"do",
"initial",
"filtering",
"."
] | def MaybeAppliesToTest(self, test_name):
return self._comp(test_name) | [
"def",
"MaybeAppliesToTest",
"(",
"self",
",",
"test_name",
")",
":",
"return",
"self",
".",
"_comp",
"(",
"test_name",
")"
] | Similar to AppliesToResult, but used to do initial filtering. | [
"Similar",
"to",
"AppliesToResult",
"but",
"used",
"to",
"do",
"initial",
"filtering",
"."
] | [
"\"\"\"Similar to AppliesToResult, but used to do initial filtering.\n\n Args:\n test_name: A string containing the name of a test.\n\n Returns:\n True if |self| could apply to a test named |test_name|, otherwise False.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "test_name",
"type": null
}
] | {
"returns": [
{
"docstring": "True if |self| could apply to a test named |test_name|, otherwise False.",
"docstring_tokens": [
"True",
"if",
"|self|",
"could",
"apply",
"to",
"a",
"test",
"named",
"|test_name|",
"... |
a20b8d3ed9d996cc0cb8d0c1b783912dfcf8f69b | sunlongbo/chromium | testing/unexpected_passes_common/data_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | NeverNeededExpectation | <not_specific> | def NeverNeededExpectation(self, expectation): # pylint:disable=unused-argument
"""Returns whether the results tallied in |self| never needed |expectation|.
Args:
expectation: An Expectation object that |stats| is located under.
Returns:
True if all the results tallied in |self| would have pa... | Returns whether the results tallied in |self| never needed |expectation|.
Args:
expectation: An Expectation object that |stats| is located under.
Returns:
True if all the results tallied in |self| would have passed without
|expectation| being present. Otherwise, False.
| Returns whether the results tallied in |self| never needed |expectation|. | [
"Returns",
"whether",
"the",
"results",
"tallied",
"in",
"|self|",
"never",
"needed",
"|expectation|",
"."
] | def NeverNeededExpectation(self, expectation):
return self.did_fully_pass | [
"def",
"NeverNeededExpectation",
"(",
"self",
",",
"expectation",
")",
":",
"return",
"self",
".",
"did_fully_pass"
] | Returns whether the results tallied in |self| never needed |expectation|. | [
"Returns",
"whether",
"the",
"results",
"tallied",
"in",
"|self|",
"never",
"needed",
"|expectation|",
"."
] | [
"# pylint:disable=unused-argument",
"\"\"\"Returns whether the results tallied in |self| never needed |expectation|.\n\n Args:\n expectation: An Expectation object that |stats| is located under.\n\n Returns:\n True if all the results tallied in |self| would have passed without\n |expectation|... | [
{
"param": "self",
"type": null
},
{
"param": "expectation",
"type": null
}
] | {
"returns": [
{
"docstring": "True if all the results tallied in |self| would have passed without\n|expectation| being present. Otherwise, False.",
"docstring_tokens": [
"True",
"if",
"all",
"the",
"results",
"tallied",
"in",
"|self|",
... |
a20b8d3ed9d996cc0cb8d0c1b783912dfcf8f69b | sunlongbo/chromium | testing/unexpected_passes_common/data_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AlwaysNeededExpectation | <not_specific> | def AlwaysNeededExpectation(self, expectation): # pylint:disable=unused-argument
"""Returns whether the results tallied in |self| always needed |expectation.
Args:
expectation: An Expectation object that |stats| is located under.
Returns:
True if all the results tallied in |self| would have f... | Returns whether the results tallied in |self| always needed |expectation.
Args:
expectation: An Expectation object that |stats| is located under.
Returns:
True if all the results tallied in |self| would have failed without
|expectation| being present. Otherwise, False.
| Returns whether the results tallied in |self| always needed |expectation. | [
"Returns",
"whether",
"the",
"results",
"tallied",
"in",
"|self|",
"always",
"needed",
"|expectation",
"."
] | def AlwaysNeededExpectation(self, expectation):
return self.did_never_pass | [
"def",
"AlwaysNeededExpectation",
"(",
"self",
",",
"expectation",
")",
":",
"return",
"self",
".",
"did_never_pass"
] | Returns whether the results tallied in |self| always needed |expectation. | [
"Returns",
"whether",
"the",
"results",
"tallied",
"in",
"|self|",
"always",
"needed",
"|expectation",
"."
] | [
"# pylint:disable=unused-argument",
"\"\"\"Returns whether the results tallied in |self| always needed |expectation.\n\n Args:\n expectation: An Expectation object that |stats| is located under.\n\n Returns:\n True if all the results tallied in |self| would have failed without\n |expectation|... | [
{
"param": "self",
"type": null
},
{
"param": "expectation",
"type": null
}
] | {
"returns": [
{
"docstring": "True if all the results tallied in |self| would have failed without\n|expectation| being present. Otherwise, False.",
"docstring_tokens": [
"True",
"if",
"all",
"the",
"results",
"tallied",
"in",
"|self|",
... |
a20b8d3ed9d996cc0cb8d0c1b783912dfcf8f69b | sunlongbo/chromium | testing/unexpected_passes_common/data_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | IterToValueType | null | def IterToValueType(self, value_type):
"""Recursively iterates over contents until |value_type| is found.
Used to get rid of nested loops, instead using a single loop that
automatically iterates through all the contents at a certain depth.
Args:
value_type: The type to recurse to and then iterat... | Recursively iterates over contents until |value_type| is found.
Used to get rid of nested loops, instead using a single loop that
automatically iterates through all the contents at a certain depth.
Args:
value_type: The type to recurse to and then iterate over. For example,
"BuilderStepMap... | Recursively iterates over contents until |value_type| is found.
Used to get rid of nested loops, instead using a single loop that
automatically iterates through all the contents at a certain depth. | [
"Recursively",
"iterates",
"over",
"contents",
"until",
"|value_type|",
"is",
"found",
".",
"Used",
"to",
"get",
"rid",
"of",
"nested",
"loops",
"instead",
"using",
"a",
"single",
"loop",
"that",
"automatically",
"iterates",
"through",
"all",
"the",
"contents",
... | def IterToValueType(self, value_type):
if self._value_type() == value_type:
for k, v in self.items():
yield k, v
else:
for k, v in self.items():
for nested_value in v.IterToValueType(value_type):
yield (k, ) + nested_value | [
"def",
"IterToValueType",
"(",
"self",
",",
"value_type",
")",
":",
"if",
"self",
".",
"_value_type",
"(",
")",
"==",
"value_type",
":",
"for",
"k",
",",
"v",
"in",
"self",
".",
"items",
"(",
")",
":",
"yield",
"k",
",",
"v",
"else",
":",
"for",
... | Recursively iterates over contents until |value_type| is found. | [
"Recursively",
"iterates",
"over",
"contents",
"until",
"|value_type|",
"is",
"found",
"."
] | [
"\"\"\"Recursively iterates over contents until |value_type| is found.\n\n Used to get rid of nested loops, instead using a single loop that\n automatically iterates through all the contents at a certain depth.\n\n Args:\n value_type: The type to recurse to and then iterate over. For example,\n ... | [
{
"param": "self",
"type": null
},
{
"param": "value_type",
"type": null
}
] | {
"returns": [
{
"docstring": "A generator that yields tuples. The length and content of the tuples will\nvary depending on |value_type|. For example, using \"BuilderStepMap\" would\nresult in tuples of the form (test_name, expectation, builder_map), while\n\"BuildStats\" would result in (test_name, expecta... |
a20b8d3ed9d996cc0cb8d0c1b783912dfcf8f69b | sunlongbo/chromium | testing/unexpected_passes_common/data_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SplitByStaleness | <not_specific> | def SplitByStaleness(self):
"""Separates stored data based on expectation staleness.
Returns:
Three TestExpectationMaps (stale_dict, semi_stale_dict, active_dict). All
three combined contain the information of |self|. |stale_dict| contains
entries for expectations that are no longer being hel... | Separates stored data based on expectation staleness.
Returns:
Three TestExpectationMaps (stale_dict, semi_stale_dict, active_dict). All
three combined contain the information of |self|. |stale_dict| contains
entries for expectations that are no longer being helpful,
|semi_stale_dict| conta... | Separates stored data based on expectation staleness. | [
"Separates",
"stored",
"data",
"based",
"on",
"expectation",
"staleness",
"."
] | def SplitByStaleness(self):
stale_dict = TestExpectationMap()
semi_stale_dict = TestExpectationMap()
active_dict = TestExpectationMap()
for expectation_file, expectation_map in self.items():
for expectation, builder_map in expectation_map.items():
tmp_map = {
FULL_PASS: Builder... | [
"def",
"SplitByStaleness",
"(",
"self",
")",
":",
"stale_dict",
"=",
"TestExpectationMap",
"(",
")",
"semi_stale_dict",
"=",
"TestExpectationMap",
"(",
")",
"active_dict",
"=",
"TestExpectationMap",
"(",
")",
"for",
"expectation_file",
",",
"expectation_map",
"in",
... | Separates stored data based on expectation staleness. | [
"Separates",
"stored",
"data",
"based",
"on",
"expectation",
"staleness",
"."
] | [
"\"\"\"Separates stored data based on expectation staleness.\n\n Returns:\n Three TestExpectationMaps (stale_dict, semi_stale_dict, active_dict). All\n three combined contain the information of |self|. |stale_dict| contains\n entries for expectations that are no longer being helpful,\n |semi_... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "Three TestExpectationMaps (stale_dict, semi_stale_dict, active_dict). All\nthree combined contain the information of |self|. |stale_dict| contains\nentries for expectations that are no longer being helpful,\n|semi_stale_dict| contains entries for expectations that might be\nre... |
a20b8d3ed9d996cc0cb8d0c1b783912dfcf8f69b | sunlongbo/chromium | testing/unexpected_passes_common/data_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FilterOutUnusedExpectations | <not_specific> | def FilterOutUnusedExpectations(self):
"""Filters out any unused Expectations from stored data.
An Expectation is considered unused if its corresponding dictionary is
empty. If removing Expectations results in a top-level test key having an
empty dictionary, that test entry will also be removed.
R... | Filters out any unused Expectations from stored data.
An Expectation is considered unused if its corresponding dictionary is
empty. If removing Expectations results in a top-level test key having an
empty dictionary, that test entry will also be removed.
Returns:
A dict from expectation file nam... | Filters out any unused Expectations from stored data.
An Expectation is considered unused if its corresponding dictionary is
empty. If removing Expectations results in a top-level test key having an
empty dictionary, that test entry will also be removed. | [
"Filters",
"out",
"any",
"unused",
"Expectations",
"from",
"stored",
"data",
".",
"An",
"Expectation",
"is",
"considered",
"unused",
"if",
"its",
"corresponding",
"dictionary",
"is",
"empty",
".",
"If",
"removing",
"Expectations",
"results",
"in",
"a",
"top",
... | def FilterOutUnusedExpectations(self):
logging.info('Filtering out unused expectations')
unused = collections.defaultdict(list)
unused_count = 0
for (expectation_file, expectation,
builder_map) in self.IterBuilderStepMaps():
if not builder_map:
unused[expectation_file].append(expe... | [
"def",
"FilterOutUnusedExpectations",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Filtering out unused expectations'",
")",
"unused",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"unused_count",
"=",
"0",
"for",
"(",
"expectation_file",
",",... | Filters out any unused Expectations from stored data. | [
"Filters",
"out",
"any",
"unused",
"Expectations",
"from",
"stored",
"data",
"."
] | [
"\"\"\"Filters out any unused Expectations from stored data.\n\n An Expectation is considered unused if its corresponding dictionary is\n empty. If removing Expectations results in a top-level test key having an\n empty dictionary, that test entry will also be removed.\n\n Returns:\n A dict from ex... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "A dict from expectation file name (str) to set of unused expectations\n(str) from that file.",
"docstring_tokens": [
"A",
"dict",
"from",
"expectation",
"file",
"name",
"(",
"str",
")",
"to",... |
a20b8d3ed9d996cc0cb8d0c1b783912dfcf8f69b | sunlongbo/chromium | testing/unexpected_passes_common/data_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SplitBuildStatsByPass | <not_specific> | def SplitBuildStatsByPass(self, expectation):
"""Splits the underlying BuildStats data by passing-ness.
Args:
expectation: The Expectation that this BuilderStepMap is located under.
Returns:
A dict mapping builder name to a tuple (fully_passed, never_passed,
partially_passed). Each *_pas... | Splits the underlying BuildStats data by passing-ness.
Args:
expectation: The Expectation that this BuilderStepMap is located under.
Returns:
A dict mapping builder name to a tuple (fully_passed, never_passed,
partially_passed). Each *_passed is a StepBuildStatsMap containing data
for ... | Splits the underlying BuildStats data by passing-ness. | [
"Splits",
"the",
"underlying",
"BuildStats",
"data",
"by",
"passing",
"-",
"ness",
"."
] | def SplitBuildStatsByPass(self, expectation):
retval = {}
for builder_name, step_map in self.items():
fully_passed = StepBuildStatsMap()
never_passed = StepBuildStatsMap()
partially_passed = StepBuildStatsMap()
for step_name, stats in step_map.items():
if stats.NeverNeededExpecta... | [
"def",
"SplitBuildStatsByPass",
"(",
"self",
",",
"expectation",
")",
":",
"retval",
"=",
"{",
"}",
"for",
"builder_name",
",",
"step_map",
"in",
"self",
".",
"items",
"(",
")",
":",
"fully_passed",
"=",
"StepBuildStatsMap",
"(",
")",
"never_passed",
"=",
... | Splits the underlying BuildStats data by passing-ness. | [
"Splits",
"the",
"underlying",
"BuildStats",
"data",
"by",
"passing",
"-",
"ness",
"."
] | [
"\"\"\"Splits the underlying BuildStats data by passing-ness.\n\n Args:\n expectation: The Expectation that this BuilderStepMap is located under.\n\n Returns:\n A dict mapping builder name to a tuple (fully_passed, never_passed,\n partially_passed). Each *_passed is a StepBuildStatsMap containi... | [
{
"param": "self",
"type": null
},
{
"param": "expectation",
"type": null
}
] | {
"returns": [
{
"docstring": "A dict mapping builder name to a tuple (fully_passed, never_passed,\npartially_passed). Each *_passed is a StepBuildStatsMap containing data\nfor the steps that either fully passed on all builds, never passed on any\nbuilds, or passed some of the time.",
"docstring_token... |
a2172d63dc0ac12bd17f5658479b6aafeaf57e6a | sunlongbo/chromium | tools/json_schema_compiler/features_cc_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Generate | <not_specific> | def Generate(self):
"""Generates a Code object for features.
"""
c = Code()
(c.Append(cpp_util.CHROMIUM_LICENSE)
.Append()
.Append(cpp_util.GENERATED_FEATURE_MESSAGE %
cpp_util.ToPosixPath(self._source_file))
.Append()
.Append('#include <string>')
.Append()
... | Generates a Code object for features.
| Generates a Code object for features. | [
"Generates",
"a",
"Code",
"object",
"for",
"features",
"."
] | def Generate(self):
c = Code()
(c.Append(cpp_util.CHROMIUM_LICENSE)
.Append()
.Append(cpp_util.GENERATED_FEATURE_MESSAGE %
cpp_util.ToPosixPath(self._source_file))
.Append()
.Append('#include <string>')
.Append()
.Append('#include "%s.h"' %
cpp_uti... | [
"def",
"Generate",
"(",
"self",
")",
":",
"c",
"=",
"Code",
"(",
")",
"(",
"c",
".",
"Append",
"(",
"cpp_util",
".",
"CHROMIUM_LICENSE",
")",
".",
"Append",
"(",
")",
".",
"Append",
"(",
"cpp_util",
".",
"GENERATED_FEATURE_MESSAGE",
"%",
"cpp_util",
".... | Generates a Code object for features. | [
"Generates",
"a",
"Code",
"object",
"for",
"features",
"."
] | [
"\"\"\"Generates a Code object for features.\n \"\"\"",
"# Generate the constructor.",
"# Generate the ToString function.",
"# Generate the FromString function."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a9341ab2ddaa3144aca6589078df4d191b64a79e | sunlongbo/chromium | third_party/google_input_tools/update.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | process_file | <not_specific> | def process_file(filename):
"""Extracts provided and required namespaces.
Description:
Scans Javascript file for provied and required namespaces.
Args:
filename: name of the file to process.
Returns:
Pair of lists, where the first list contains namespaces provided by the file
and the second c... | Extracts provided and required namespaces.
Description:
Scans Javascript file for provied and required namespaces.
Args:
filename: name of the file to process.
Returns:
Pair of lists, where the first list contains namespaces provided by the file
and the second contains a list of requirements.
... | Extracts provided and required namespaces.
Description:
Scans Javascript file for provied and required namespaces. | [
"Extracts",
"provided",
"and",
"required",
"namespaces",
".",
"Description",
":",
"Scans",
"Javascript",
"file",
"for",
"provied",
"and",
"required",
"namespaces",
"."
] | def process_file(filename):
provides = []
requires = []
file_handle = open(filename, 'r')
try:
for line in file_handle:
if re.match(require_regex, line):
requires.append(re.search(require_regex, line).group(1))
if re.match(provide_regex, line):
provides.append(re.search(provide_r... | [
"def",
"process_file",
"(",
"filename",
")",
":",
"provides",
"=",
"[",
"]",
"requires",
"=",
"[",
"]",
"file_handle",
"=",
"open",
"(",
"filename",
",",
"'r'",
")",
"try",
":",
"for",
"line",
"in",
"file_handle",
":",
"if",
"re",
".",
"match",
"(",
... | Extracts provided and required namespaces. | [
"Extracts",
"provided",
"and",
"required",
"namespaces",
"."
] | [
"\"\"\"Extracts provided and required namespaces.\n\n Description:\n Scans Javascript file for provied and required namespaces.\n\n Args:\n filename: name of the file to process.\n\n Returns:\n Pair of lists, where the first list contains namespaces provided by the file\n and the second contains a li... | [
{
"param": "filename",
"type": null
}
] | {
"returns": [
{
"docstring": "Pair of lists, where the first list contains namespaces provided by the file\nand the second contains a list of requirements.",
"docstring_tokens": [
"Pair",
"of",
"lists",
"where",
"the",
"first",
"list",
"... |
a9341ab2ddaa3144aca6589078df4d191b64a79e | sunlongbo/chromium | third_party/google_input_tools/update.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | expand_directories | <not_specific> | def expand_directories(refs):
"""Expands any directory references into inputs.
Description:
Looks for any directories in the provided references. Found directories
are recursively searched for .js files.
Args:
refs: a list of directories.
Returns:
Pair of maps, where the first maps each name... | Expands any directory references into inputs.
Description:
Looks for any directories in the provided references. Found directories
are recursively searched for .js files.
Args:
refs: a list of directories.
Returns:
Pair of maps, where the first maps each namepace to the filename that
provi... | Expands any directory references into inputs.
Description:
Looks for any directories in the provided references. Found directories
are recursively searched for .js files. | [
"Expands",
"any",
"directory",
"references",
"into",
"inputs",
".",
"Description",
":",
"Looks",
"for",
"any",
"directories",
"in",
"the",
"provided",
"references",
".",
"Found",
"directories",
"are",
"recursively",
"searched",
"for",
".",
"js",
"files",
"."
] | def expand_directories(refs):
providers = {}
requirements = {}
for ref in refs:
if os.path.isdir(ref):
for (root, _, files) in os.walk(ref):
for name in files:
if name.endswith('js'):
filename = os.path.join(root, name)
provides, requires = process_file(filename... | [
"def",
"expand_directories",
"(",
"refs",
")",
":",
"providers",
"=",
"{",
"}",
"requirements",
"=",
"{",
"}",
"for",
"ref",
"in",
"refs",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"ref",
")",
":",
"for",
"(",
"root",
",",
"_",
",",
"files... | Expands any directory references into inputs. | [
"Expands",
"any",
"directory",
"references",
"into",
"inputs",
"."
] | [
"\"\"\"Expands any directory references into inputs.\n\n Description:\n Looks for any directories in the provided references. Found directories\n are recursively searched for .js files.\n\n Args:\n refs: a list of directories.\n\n Returns:\n Pair of maps, where the first maps each namepace to the fi... | [
{
"param": "refs",
"type": null
}
] | {
"returns": [
{
"docstring": "Pair of maps, where the first maps each namepace to the filename that\nprovides the namespace, and the second maps a filename to prerequisite\nnamespaces.",
"docstring_tokens": [
"Pair",
"of",
"maps",
"where",
"the",
"first... |
a9341ab2ddaa3144aca6589078df4d191b64a79e | sunlongbo/chromium | third_party/google_input_tools/update.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | extract_dependencies | null | def extract_dependencies(namespace, providers, requirements, dependencies):
"""Recursively extracts all dependencies for a namespace.
Description:
Recursively extracts all dependencies for a namespace.
Args:
namespace: The namespace to process.
providers: Mapping of namespace to filename that provid... | Recursively extracts all dependencies for a namespace.
Description:
Recursively extracts all dependencies for a namespace.
Args:
namespace: The namespace to process.
providers: Mapping of namespace to filename that provides the namespace.
requirements: Mapping of filename to a list of prerequisite... | Recursively extracts all dependencies for a namespace.
Description:
Recursively extracts all dependencies for a namespace. | [
"Recursively",
"extracts",
"all",
"dependencies",
"for",
"a",
"namespace",
".",
"Description",
":",
"Recursively",
"extracts",
"all",
"dependencies",
"for",
"a",
"namespace",
"."
] | def extract_dependencies(namespace, providers, requirements, dependencies):
if namespace in providers:
filename = providers[namespace]
if filename not in dependencies:
for ns in requirements[filename]:
extract_dependencies(ns, providers, requirements, dependencies)
dependencies.add(filename) | [
"def",
"extract_dependencies",
"(",
"namespace",
",",
"providers",
",",
"requirements",
",",
"dependencies",
")",
":",
"if",
"namespace",
"in",
"providers",
":",
"filename",
"=",
"providers",
"[",
"namespace",
"]",
"if",
"filename",
"not",
"in",
"dependencies",
... | Recursively extracts all dependencies for a namespace. | [
"Recursively",
"extracts",
"all",
"dependencies",
"for",
"a",
"namespace",
"."
] | [
"\"\"\"Recursively extracts all dependencies for a namespace.\n\n Description:\n Recursively extracts all dependencies for a namespace.\n\n Args:\n namespace: The namespace to process.\n providers: Mapping of namespace to filename that provides the namespace.\n requirements: Mapping of filename to a l... | [
{
"param": "namespace",
"type": null
},
{
"param": "providers",
"type": null
},
{
"param": "requirements",
"type": null
},
{
"param": "dependencies",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "namespace",
"type": null,
"docstring": "The namespace to process.",
"docstring_tokens": [
"The",
"n... |
a9341ab2ddaa3144aca6589078df4d191b64a79e | sunlongbo/chromium | third_party/google_input_tools/update.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | expand_path_relative_to_home | <not_specific> | def expand_path_relative_to_home(path):
"""Resolves a path that is relative to the home directory.
Args:
path: Relative path.
Returns:
Resolved path.
"""
return os.path.join(os.path.expanduser('~'), path) | Resolves a path that is relative to the home directory.
Args:
path: Relative path.
Returns:
Resolved path.
| Resolves a path that is relative to the home directory. | [
"Resolves",
"a",
"path",
"that",
"is",
"relative",
"to",
"the",
"home",
"directory",
"."
] | def expand_path_relative_to_home(path):
return os.path.join(os.path.expanduser('~'), path) | [
"def",
"expand_path_relative_to_home",
"(",
"path",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~'",
")",
",",
"path",
")"
] | Resolves a path that is relative to the home directory. | [
"Resolves",
"a",
"path",
"that",
"is",
"relative",
"to",
"the",
"home",
"directory",
"."
] | [
"\"\"\"Resolves a path that is relative to the home directory.\n\n Args:\n path: Relative path.\n\n Returns:\n Resolved path.\n \"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
a9341ab2ddaa3144aca6589078df4d191b64a79e | sunlongbo/chromium | third_party/google_input_tools/update.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | copy_file | null | def copy_file(source, target):
"""Copies a file from the source to the target location.
Args:
source: Path to the source file to copy.
target: Path to the target location to copy the file.
"""
if not os.path.exists(os.path.dirname(target)):
os.makedirs(os.path.dirname(target))
shutil.copy(source... | Copies a file from the source to the target location.
Args:
source: Path to the source file to copy.
target: Path to the target location to copy the file.
| Copies a file from the source to the target location. | [
"Copies",
"a",
"file",
"from",
"the",
"source",
"to",
"the",
"target",
"location",
"."
] | def copy_file(source, target):
if not os.path.exists(os.path.dirname(target)):
os.makedirs(os.path.dirname(target))
shutil.copy(source, target)
if target.endswith('py'):
subprocess.call(['chmod', '+x', target])
else:
subprocess.call(['chmod', '-x', target]) | [
"def",
"copy_file",
"(",
"source",
",",
"target",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"target",
")",
")",
":",
"os",
".",
"makedirs",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
... | Copies a file from the source to the target location. | [
"Copies",
"a",
"file",
"from",
"the",
"source",
"to",
"the",
"target",
"location",
"."
] | [
"\"\"\"Copies a file from the source to the target location.\n\n Args:\n source: Path to the source file to copy.\n target: Path to the target location to copy the file.\n \"\"\"",
"# Ensure correct file permissions."
] | [
{
"param": "source",
"type": null
},
{
"param": "target",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "source",
"type": null,
"docstring": "Path to the source file to copy.",
"docstring_tokens": [
"Path",
"to",
"the",
"source",
"file",
"to",
"copy",
"."
],
... |
a9341ab2ddaa3144aca6589078df4d191b64a79e | sunlongbo/chromium | third_party/google_input_tools/update.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | copy_dir | null | def copy_dir(input_path, sub_dir):
"""Copies all files in a subdirectory of google-input-tools.
Description:
Recursive copy of a directory under google-input-tools. Used to copy
localization and resource files.
Args:
input_path: Path to the google-input-tools-sandbox.
sub_dir: Subdirectory to c... | Copies all files in a subdirectory of google-input-tools.
Description:
Recursive copy of a directory under google-input-tools. Used to copy
localization and resource files.
Args:
input_path: Path to the google-input-tools-sandbox.
sub_dir: Subdirectory to copy within google-input-tools sandbox.
... | Copies all files in a subdirectory of google-input-tools.
Description:
Recursive copy of a directory under google-input-tools. Used to copy
localization and resource files. | [
"Copies",
"all",
"files",
"in",
"a",
"subdirectory",
"of",
"google",
"-",
"input",
"-",
"tools",
".",
"Description",
":",
"Recursive",
"copy",
"of",
"a",
"directory",
"under",
"google",
"-",
"input",
"-",
"tools",
".",
"Used",
"to",
"copy",
"localization",... | def copy_dir(input_path, sub_dir):
source_dir = os.path.join(input_path, 'chrome', 'os', sub_dir)
for (root, _, files) in os.walk(source_dir):
for name in files:
filename = os.path.join(root, name)
relative_path = filename[len(source_dir) + 1:]
target = os.path.join('src', 'chrome', 'os', sub_... | [
"def",
"copy_dir",
"(",
"input_path",
",",
"sub_dir",
")",
":",
"source_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"input_path",
",",
"'chrome'",
",",
"'os'",
",",
"sub_dir",
")",
"for",
"(",
"root",
",",
"_",
",",
"files",
")",
"in",
"os",
".... | Copies all files in a subdirectory of google-input-tools. | [
"Copies",
"all",
"files",
"in",
"a",
"subdirectory",
"of",
"google",
"-",
"input",
"-",
"tools",
"."
] | [
"\"\"\"Copies all files in a subdirectory of google-input-tools.\n\n Description:\n Recursive copy of a directory under google-input-tools. Used to copy\n localization and resource files.\n\n Args:\n input_path: Path to the google-input-tools-sandbox.\n sub_dir: Subdirectory to copy within google-inp... | [
{
"param": "input_path",
"type": null
},
{
"param": "sub_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_path",
"type": null,
"docstring": "Path to the google-input-tools-sandbox.",
"docstring_tokens": [
"Path",
"to",
"the",
"google",
"-",
"input",
"-",
"tools"... |
a9341ab2ddaa3144aca6589078df4d191b64a79e | sunlongbo/chromium | third_party/google_input_tools/update.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | main | null | def main():
"""The entrypoint for this script."""
logging.basicConfig(format='update.py: %(message)s', level=logging.INFO)
usage = 'usage: %prog [options] arg'
parser = optparse.OptionParser(usage)
parser.add_option('-i',
'--input',
dest='input',
a... | The entrypoint for this script. | The entrypoint for this script. | [
"The",
"entrypoint",
"for",
"this",
"script",
"."
] | def main():
logging.basicConfig(format='update.py: %(message)s', level=logging.INFO)
usage = 'usage: %prog [options] arg'
parser = optparse.OptionParser(usage)
parser.add_option('-i',
'--input',
dest='input',
action='append',
help='... | [
"def",
"main",
"(",
")",
":",
"logging",
".",
"basicConfig",
"(",
"format",
"=",
"'update.py: %(message)s'",
",",
"level",
"=",
"logging",
".",
"INFO",
")",
"usage",
"=",
"'usage: %prog [options] arg'",
"parser",
"=",
"optparse",
".",
"OptionParser",
"(",
"usa... | The entrypoint for this script. | [
"The",
"entrypoint",
"for",
"this",
"script",
"."
] | [
"\"\"\"The entrypoint for this script.\"\"\"",
"# Copy resources",
"# Copy extra support files."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3b6bf08aee53a8a120f17dc0bfd20a8e27a2f371 | sunlongbo/chromium | third_party/closure_compiler/js_binary.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CrawlDepsTree | <not_specific> | def CrawlDepsTree(deps):
"""Parses the dependency tree creating a post-order listing of sources."""
global depcache
if len(deps) == 0:
return ([], [])
new_sources = []
new_externs = []
for dep in deps:
if dep in depcache:
cur_sources, cur_externs = depcache[dep]
else:
dep_sources, ... | Parses the dependency tree creating a post-order listing of sources. | Parses the dependency tree creating a post-order listing of sources. | [
"Parses",
"the",
"dependency",
"tree",
"creating",
"a",
"post",
"-",
"order",
"listing",
"of",
"sources",
"."
] | def CrawlDepsTree(deps):
global depcache
if len(deps) == 0:
return ([], [])
new_sources = []
new_externs = []
for dep in deps:
if dep in depcache:
cur_sources, cur_externs = depcache[dep]
else:
dep_sources, dep_deps, dep_externs = ParseDepList(dep)
cur_sources, cur_externs = Craw... | [
"def",
"CrawlDepsTree",
"(",
"deps",
")",
":",
"global",
"depcache",
"if",
"len",
"(",
"deps",
")",
"==",
"0",
":",
"return",
"(",
"[",
"]",
",",
"[",
"]",
")",
"new_sources",
"=",
"[",
"]",
"new_externs",
"=",
"[",
"]",
"for",
"dep",
"in",
"deps... | Parses the dependency tree creating a post-order listing of sources. | [
"Parses",
"the",
"dependency",
"tree",
"creating",
"a",
"post",
"-",
"order",
"listing",
"of",
"sources",
"."
] | [
"\"\"\"Parses the dependency tree creating a post-order listing of sources.\"\"\"",
"# Add child dependencies of this node before the current node, then cache.",
"# Add the current node's sources and dedupe."
] | [
{
"param": "deps",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "deps",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b6bf08aee53a8a120f17dc0bfd20a8e27a2f371 | sunlongbo/chromium | third_party/closure_compiler/js_binary.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CrawlRootDepsTree | <not_specific> | def CrawlRootDepsTree(deps, target_sources, target_externs):
"""Parses the dependency tree and adds target sources."""
sources, externs = CrawlDepsTree(deps)
AppendUnique(sources, target_sources)
AppendUnique(externs, target_externs)
return sources, externs | Parses the dependency tree and adds target sources. | Parses the dependency tree and adds target sources. | [
"Parses",
"the",
"dependency",
"tree",
"and",
"adds",
"target",
"sources",
"."
] | def CrawlRootDepsTree(deps, target_sources, target_externs):
sources, externs = CrawlDepsTree(deps)
AppendUnique(sources, target_sources)
AppendUnique(externs, target_externs)
return sources, externs | [
"def",
"CrawlRootDepsTree",
"(",
"deps",
",",
"target_sources",
",",
"target_externs",
")",
":",
"sources",
",",
"externs",
"=",
"CrawlDepsTree",
"(",
"deps",
")",
"AppendUnique",
"(",
"sources",
",",
"target_sources",
")",
"AppendUnique",
"(",
"externs",
",",
... | Parses the dependency tree and adds target sources. | [
"Parses",
"the",
"dependency",
"tree",
"and",
"adds",
"target",
"sources",
"."
] | [
"\"\"\"Parses the dependency tree and adds target sources.\"\"\""
] | [
{
"param": "deps",
"type": null
},
{
"param": "target_sources",
"type": null
},
{
"param": "target_externs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "deps",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target_sources",
"type": null,
"docstring": null,
"docstring_... |
3b8d0b656c5c2f63d427541a5ee37452a47bd7e3 | sunlongbo/chromium | tools/variations/split_variations_cmd.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ParseForceFieldTrials | <not_specific> | def _ParseForceFieldTrials(data):
"""Parses --force-fieldtrials switch value string.
The switch value string is parsed to a list of _Trial objects.
"""
data = data.rstrip('/')
items = data.split('/')
if len(items) % 2 != 0:
raise ValueError('odd number of items in --force-fieldtrials value')
trial_na... | Parses --force-fieldtrials switch value string.
The switch value string is parsed to a list of _Trial objects.
| -force-fieldtrials switch value string.
The switch value string is parsed to a list of _Trial objects. | [
"-",
"force",
"-",
"fieldtrials",
"switch",
"value",
"string",
".",
"The",
"switch",
"value",
"string",
"is",
"parsed",
"to",
"a",
"list",
"of",
"_Trial",
"objects",
"."
] | def _ParseForceFieldTrials(data):
data = data.rstrip('/')
items = data.split('/')
if len(items) % 2 != 0:
raise ValueError('odd number of items in --force-fieldtrials value')
trial_names = items[0::2]
group_names = items[1::2]
results = []
for trial_name, group_name in zip(trial_names, group_names):
... | [
"def",
"_ParseForceFieldTrials",
"(",
"data",
")",
":",
"data",
"=",
"data",
".",
"rstrip",
"(",
"'/'",
")",
"items",
"=",
"data",
".",
"split",
"(",
"'/'",
")",
"if",
"len",
"(",
"items",
")",
"%",
"2",
"!=",
"0",
":",
"raise",
"ValueError",
"(",
... | Parses --force-fieldtrials switch value string. | [
"Parses",
"--",
"force",
"-",
"fieldtrials",
"switch",
"value",
"string",
"."
] | [
"\"\"\"Parses --force-fieldtrials switch value string.\n\n The switch value string is parsed to a list of _Trial objects.\n \"\"\""
] | [
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b8d0b656c5c2f63d427541a5ee37452a47bd7e3 | sunlongbo/chromium | tools/variations/split_variations_cmd.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _BuildForceFieldTrialsSwitchValue | <not_specific> | def _BuildForceFieldTrialsSwitchValue(trials):
"""Generates --force-fieldtrials switch value string.
This is the opposite of _ParseForceFieldTrials().
Args:
trials: A list of _Trial objects from which the switch value string
is generated.
"""
return ''.join('%s%s/%s/' % (
'*' if trial.st... | Generates --force-fieldtrials switch value string.
This is the opposite of _ParseForceFieldTrials().
Args:
trials: A list of _Trial objects from which the switch value string
is generated.
| -force-fieldtrials switch value string.
This is the opposite of _ParseForceFieldTrials(). | [
"-",
"force",
"-",
"fieldtrials",
"switch",
"value",
"string",
".",
"This",
"is",
"the",
"opposite",
"of",
"_ParseForceFieldTrials",
"()",
"."
] | def _BuildForceFieldTrialsSwitchValue(trials):
return ''.join('%s%s/%s/' % (
'*' if trial.star else '',
trial.trial_name,
trial.group_name
) for trial in trials) | [
"def",
"_BuildForceFieldTrialsSwitchValue",
"(",
"trials",
")",
":",
"return",
"''",
".",
"join",
"(",
"'%s%s/%s/'",
"%",
"(",
"'*'",
"if",
"trial",
".",
"star",
"else",
"''",
",",
"trial",
".",
"trial_name",
",",
"trial",
".",
"group_name",
")",
"for",
... | Generates --force-fieldtrials switch value string. | [
"Generates",
"--",
"force",
"-",
"fieldtrials",
"switch",
"value",
"string",
"."
] | [
"\"\"\"Generates --force-fieldtrials switch value string.\n\n This is the opposite of _ParseForceFieldTrials().\n\n Args:\n trials: A list of _Trial objects from which the switch value string\n is generated.\n \"\"\""
] | [
{
"param": "trials",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "trials",
"type": null,
"docstring": "A list of _Trial objects from which the switch value string\nis generated.",
"docstring_tokens": [
"A",
"list",
"of",
"_Trial",
"objects",
"f... |
3b8d0b656c5c2f63d427541a5ee37452a47bd7e3 | sunlongbo/chromium | tools/variations/split_variations_cmd.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ParseForceFieldTrialParams | <not_specific> | def _ParseForceFieldTrialParams(data):
"""Parses --force-fieldtrial-params switch value string.
The switch value string is parsed to a list of _TrialParams objects.
Format is trial_name.group_name:param0/value0/.../paramN/valueN.
"""
items = data.split(',')
results = []
for item in items:
tokens = i... | Parses --force-fieldtrial-params switch value string.
The switch value string is parsed to a list of _TrialParams objects.
Format is trial_name.group_name:param0/value0/.../paramN/valueN.
| -force-fieldtrial-params switch value string.
The switch value string is parsed to a list of _TrialParams objects.
| [
"-",
"force",
"-",
"fieldtrial",
"-",
"params",
"switch",
"value",
"string",
".",
"The",
"switch",
"value",
"string",
"is",
"parsed",
"to",
"a",
"list",
"of",
"_TrialParams",
"objects",
"."
] | def _ParseForceFieldTrialParams(data):
items = data.split(',')
results = []
for item in items:
tokens = item.split(':')
if len(tokens) != 2:
raise ValueError('Wrong format, expected trial_name.group_name:'
'p0/v0/.../pN/vN, got %s' % item)
trial_group = tokens[0].split('.'... | [
"def",
"_ParseForceFieldTrialParams",
"(",
"data",
")",
":",
"items",
"=",
"data",
".",
"split",
"(",
"','",
")",
"results",
"=",
"[",
"]",
"for",
"item",
"in",
"items",
":",
"tokens",
"=",
"item",
".",
"split",
"(",
"':'",
")",
"if",
"len",
"(",
"... | Parses --force-fieldtrial-params switch value string. | [
"Parses",
"--",
"force",
"-",
"fieldtrial",
"-",
"params",
"switch",
"value",
"string",
"."
] | [
"\"\"\"Parses --force-fieldtrial-params switch value string.\n\n The switch value string is parsed to a list of _TrialParams objects.\n\n Format is trial_name.group_name:param0/value0/.../paramN/valueN.\n \"\"\""
] | [
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b8d0b656c5c2f63d427541a5ee37452a47bd7e3 | sunlongbo/chromium | tools/variations/split_variations_cmd.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _BuildForceFieldTrialParamsSwitchValue | <not_specific> | def _BuildForceFieldTrialParamsSwitchValue(trials):
"""Generates --force-fieldtrial-params switch value string.
This is the opposite of _ParseForceFieldTrialParams().
Args:
trials: A list of _TrialParams objects from which the switch value
string is generated.
"""
return ','.join('%s.%s:%s' ... | Generates --force-fieldtrial-params switch value string.
This is the opposite of _ParseForceFieldTrialParams().
Args:
trials: A list of _TrialParams objects from which the switch value
string is generated.
| -force-fieldtrial-params switch value string.
This is the opposite of _ParseForceFieldTrialParams(). | [
"-",
"force",
"-",
"fieldtrial",
"-",
"params",
"switch",
"value",
"string",
".",
"This",
"is",
"the",
"opposite",
"of",
"_ParseForceFieldTrialParams",
"()",
"."
] | def _BuildForceFieldTrialParamsSwitchValue(trials):
return ','.join('%s.%s:%s' % (
trial.trial_name,
trial.group_name,
'/'.join('%s/%s' % (param.key, param.value) for param in trial.params),
) for trial in trials) | [
"def",
"_BuildForceFieldTrialParamsSwitchValue",
"(",
"trials",
")",
":",
"return",
"','",
".",
"join",
"(",
"'%s.%s:%s'",
"%",
"(",
"trial",
".",
"trial_name",
",",
"trial",
".",
"group_name",
",",
"'/'",
".",
"join",
"(",
"'%s/%s'",
"%",
"(",
"param",
".... | Generates --force-fieldtrial-params switch value string. | [
"Generates",
"--",
"force",
"-",
"fieldtrial",
"-",
"params",
"switch",
"value",
"string",
"."
] | [
"\"\"\"Generates --force-fieldtrial-params switch value string.\n\n This is the opposite of _ParseForceFieldTrialParams().\n\n Args:\n trials: A list of _TrialParams objects from which the switch value\n string is generated.\n \"\"\""
] | [
{
"param": "trials",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "trials",
"type": null,
"docstring": "A list of _TrialParams objects from which the switch value\nstring is generated.",
"docstring_tokens": [
"A",
"list",
"of",
"_TrialParams",
"objects"... |
3b8d0b656c5c2f63d427541a5ee37452a47bd7e3 | sunlongbo/chromium | tools/variations/split_variations_cmd.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ValidateForceFieldTrialsAndParams | null | def _ValidateForceFieldTrialsAndParams(trials, params):
"""Checks if all params have corresponding field trials specified.
|trials| comes from --force-fieldtrials switch, |params| comes from
--force-fieldtrial-params switch.
"""
if len(params) > len(trials):
raise ValueError("params size (%d) larger than... | Checks if all params have corresponding field trials specified.
|trials| comes from --force-fieldtrials switch, |params| comes from
--force-fieldtrial-params switch.
| Checks if all params have corresponding field trials specified. | [
"Checks",
"if",
"all",
"params",
"have",
"corresponding",
"field",
"trials",
"specified",
"."
] | def _ValidateForceFieldTrialsAndParams(trials, params):
if len(params) > len(trials):
raise ValueError("params size (%d) larger than trials size (%d)" %
(len(params), len(trials)))
trial_groups = {trial.trial_name: trial.group_name for trial in trials}
for param in params:
trial_name ... | [
"def",
"_ValidateForceFieldTrialsAndParams",
"(",
"trials",
",",
"params",
")",
":",
"if",
"len",
"(",
"params",
")",
">",
"len",
"(",
"trials",
")",
":",
"raise",
"ValueError",
"(",
"\"params size (%d) larger than trials size (%d)\"",
"%",
"(",
"len",
"(",
"par... | Checks if all params have corresponding field trials specified. | [
"Checks",
"if",
"all",
"params",
"have",
"corresponding",
"field",
"trials",
"specified",
"."
] | [
"\"\"\"Checks if all params have corresponding field trials specified.\n\n |trials| comes from --force-fieldtrials switch, |params| comes from\n --force-fieldtrial-params switch.\n \"\"\""
] | [
{
"param": "trials",
"type": null
},
{
"param": "params",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "trials",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "params",
"type": null,
"docstring": null,
"docstring_tokens... |
3b8d0b656c5c2f63d427541a5ee37452a47bd7e3 | sunlongbo/chromium | tools/variations/split_variations_cmd.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ParseFeatureListString | <not_specific> | def _ParseFeatureListString(data, is_disable):
"""Parses --enable/--disable-features switch value string.
The switch value string is parsed to a list of _Feature objects.
Args:
data: --enable-features or --disable-features switch value string.
is_disable: Parses --enable-features switch value string... | Parses --enable/--disable-features switch value string.
The switch value string is parsed to a list of _Feature objects.
Args:
data: --enable-features or --disable-features switch value string.
is_disable: Parses --enable-features switch value string if True;
--disable-features switch value ... | -enable/--disable-features switch value string.
The switch value string is parsed to a list of _Feature objects. | [
"-",
"enable",
"/",
"--",
"disable",
"-",
"features",
"switch",
"value",
"string",
".",
"The",
"switch",
"value",
"string",
"is",
"parsed",
"to",
"a",
"list",
"of",
"_Feature",
"objects",
"."
] | def _ParseFeatureListString(data, is_disable):
items = data.split(',')
results = []
for item in items:
pair = item.split('<', 1)
feature = pair[0]
value = None
if len(pair) > 1:
value = pair[1]
star = feature.startswith('*')
if star:
if is_disable:
raise ValueError('--d... | [
"def",
"_ParseFeatureListString",
"(",
"data",
",",
"is_disable",
")",
":",
"items",
"=",
"data",
".",
"split",
"(",
"','",
")",
"results",
"=",
"[",
"]",
"for",
"item",
"in",
"items",
":",
"pair",
"=",
"item",
".",
"split",
"(",
"'<'",
",",
"1",
"... | Parses --enable/--disable-features switch value string. | [
"Parses",
"--",
"enable",
"/",
"--",
"disable",
"-",
"features",
"switch",
"value",
"string",
"."
] | [
"\"\"\"Parses --enable/--disable-features switch value string.\n\n The switch value string is parsed to a list of _Feature objects.\n\n Args:\n data: --enable-features or --disable-features switch value string.\n is_disable: Parses --enable-features switch value string if True;\n --disable-feat... | [
{
"param": "data",
"type": null
},
{
"param": "is_disable",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": "enable-features or --disable-features switch value string.",
"docstring_tokens": [
"enable",
"-",
"features",
"or",
"--",
"disable",
"-... |
3b8d0b656c5c2f63d427541a5ee37452a47bd7e3 | sunlongbo/chromium | tools/variations/split_variations_cmd.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _SplitFeatures | <not_specific> | def _SplitFeatures(features):
"""Splits a list of _Features objects into two lists.
Note that either returned list could be empty, depending on the number of
elements in the input list.
"""
# Split a list of size N into two list: one of size middle, the other of size
# N - middle. This works even when N is... | Splits a list of _Features objects into two lists.
Note that either returned list could be empty, depending on the number of
elements in the input list.
| Splits a list of _Features objects into two lists.
Note that either returned list could be empty, depending on the number of
elements in the input list. | [
"Splits",
"a",
"list",
"of",
"_Features",
"objects",
"into",
"two",
"lists",
".",
"Note",
"that",
"either",
"returned",
"list",
"could",
"be",
"empty",
"depending",
"on",
"the",
"number",
"of",
"elements",
"in",
"the",
"input",
"list",
"."
] | def _SplitFeatures(features):
middle = (len(features) + 1) // 2
return features[:middle], features[middle:] | [
"def",
"_SplitFeatures",
"(",
"features",
")",
":",
"middle",
"=",
"(",
"len",
"(",
"features",
")",
"+",
"1",
")",
"//",
"2",
"return",
"features",
"[",
":",
"middle",
"]",
",",
"features",
"[",
"middle",
":",
"]"
] | Splits a list of _Features objects into two lists. | [
"Splits",
"a",
"list",
"of",
"_Features",
"objects",
"into",
"two",
"lists",
"."
] | [
"\"\"\"Splits a list of _Features objects into two lists.\n\n Note that either returned list could be empty, depending on the number of\n elements in the input list.\n \"\"\"",
"# Split a list of size N into two list: one of size middle, the other of size",
"# N - middle. This works even when N is 0 or 1, re... | [
{
"param": "features",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "features",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b8d0b656c5c2f63d427541a5ee37452a47bd7e3 | sunlongbo/chromium | tools/variations/split_variations_cmd.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParseVariationsCmdFromString | <not_specific> | def ParseVariationsCmdFromString(input_string):
"""Parses commandline switches string into internal representation.
Commandline switches string comes from chrome://version/?show-variations-cmd.
Currently we parse the following four command line switches:
--force-fieldtrials
--force-fieldtrial-params
... | Parses commandline switches string into internal representation.
Commandline switches string comes from chrome://version/?show-variations-cmd.
Currently we parse the following four command line switches:
--force-fieldtrials
--force-fieldtrial-params
--enable-features
--disable-features
| Parses commandline switches string into internal representation.
Commandline switches string comes from chrome://version/?show-variations-cmd. | [
"Parses",
"commandline",
"switches",
"string",
"into",
"internal",
"representation",
".",
"Commandline",
"switches",
"string",
"comes",
"from",
"chrome",
":",
"//",
"version",
"/",
"?show",
"-",
"variations",
"-",
"cmd",
"."
] | def ParseVariationsCmdFromString(input_string):
switch_data = ParseCommandLineSwitchesString(input_string)
results = {}
for switch_name, switch_value in switch_data.items():
built_switch_value = None
if switch_name == _FORCE_FIELD_TRIALS_SWITCH_NAME:
results[switch_name] = _ParseForceFieldTrials(swi... | [
"def",
"ParseVariationsCmdFromString",
"(",
"input_string",
")",
":",
"switch_data",
"=",
"ParseCommandLineSwitchesString",
"(",
"input_string",
")",
"results",
"=",
"{",
"}",
"for",
"switch_name",
",",
"switch_value",
"in",
"switch_data",
".",
"items",
"(",
")",
... | Parses commandline switches string into internal representation. | [
"Parses",
"commandline",
"switches",
"string",
"into",
"internal",
"representation",
"."
] | [
"\"\"\"Parses commandline switches string into internal representation.\n\n Commandline switches string comes from chrome://version/?show-variations-cmd.\n Currently we parse the following four command line switches:\n --force-fieldtrials\n --force-fieldtrial-params\n --enable-features\n --disable-fea... | [
{
"param": "input_string",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_string",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b8d0b656c5c2f63d427541a5ee37452a47bd7e3 | sunlongbo/chromium | tools/variations/split_variations_cmd.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParseVariationsCmdFromFile | <not_specific> | def ParseVariationsCmdFromFile(filename):
"""Parses commandline switches string into internal representation.
Same as ParseVariationsCmdFromString(), except the commandline switches
string comes from a file.
"""
with open(filename, 'r') as f:
data = f.read().replace('\n', ' ')
return ParseVariationsCmd... | Parses commandline switches string into internal representation.
Same as ParseVariationsCmdFromString(), except the commandline switches
string comes from a file.
| Parses commandline switches string into internal representation.
Same as ParseVariationsCmdFromString(), except the commandline switches
string comes from a file. | [
"Parses",
"commandline",
"switches",
"string",
"into",
"internal",
"representation",
".",
"Same",
"as",
"ParseVariationsCmdFromString",
"()",
"except",
"the",
"commandline",
"switches",
"string",
"comes",
"from",
"a",
"file",
"."
] | def ParseVariationsCmdFromFile(filename):
with open(filename, 'r') as f:
data = f.read().replace('\n', ' ')
return ParseVariationsCmdFromString(data) | [
"def",
"ParseVariationsCmdFromFile",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"f",
":",
"data",
"=",
"f",
".",
"read",
"(",
")",
".",
"replace",
"(",
"'\\n'",
",",
"' '",
")",
"return",
"ParseVariationsCmdFromStr... | Parses commandline switches string into internal representation. | [
"Parses",
"commandline",
"switches",
"string",
"into",
"internal",
"representation",
"."
] | [
"\"\"\"Parses commandline switches string into internal representation.\n\n Same as ParseVariationsCmdFromString(), except the commandline switches\n string comes from a file.\n \"\"\""
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b8d0b656c5c2f63d427541a5ee37452a47bd7e3 | sunlongbo/chromium | tools/variations/split_variations_cmd.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SplitVariationsCmd | <not_specific> | def SplitVariationsCmd(results):
"""Splits internal representation of commandline switches into two.
This function can be called recursively when bisecting a set of experiments
until one is identified to be responsble for a certain browser behavior.
The commandline switches come from chrome://version/?show-va... | Splits internal representation of commandline switches into two.
This function can be called recursively when bisecting a set of experiments
until one is identified to be responsble for a certain browser behavior.
The commandline switches come from chrome://version/?show-variations-cmd.
| Splits internal representation of commandline switches into two.
This function can be called recursively when bisecting a set of experiments
until one is identified to be responsble for a certain browser behavior.
The commandline switches come from chrome://version/?show-variations-cmd. | [
"Splits",
"internal",
"representation",
"of",
"commandline",
"switches",
"into",
"two",
".",
"This",
"function",
"can",
"be",
"called",
"recursively",
"when",
"bisecting",
"a",
"set",
"of",
"experiments",
"until",
"one",
"is",
"identified",
"to",
"be",
"responsb... | def SplitVariationsCmd(results):
enable_features = results.get(_ENABLE_FEATURES_SWITCH_NAME, [])
disable_features = results.get(_DISABLE_FEATURES_SWITCH_NAME, [])
field_trials = results.get(_FORCE_FIELD_TRIALS_SWITCH_NAME, [])
field_trial_params = results.get(_FORCE_FIELD_TRIAL_PARAMS_SWITCH_NAME, [])
enable_... | [
"def",
"SplitVariationsCmd",
"(",
"results",
")",
":",
"enable_features",
"=",
"results",
".",
"get",
"(",
"_ENABLE_FEATURES_SWITCH_NAME",
",",
"[",
"]",
")",
"disable_features",
"=",
"results",
".",
"get",
"(",
"_DISABLE_FEATURES_SWITCH_NAME",
",",
"[",
"]",
")... | Splits internal representation of commandline switches into two. | [
"Splits",
"internal",
"representation",
"of",
"commandline",
"switches",
"into",
"two",
"."
] | [
"\"\"\"Splits internal representation of commandline switches into two.\n\n This function can be called recursively when bisecting a set of experiments\n until one is identified to be responsble for a certain browser behavior.\n\n The commandline switches come from chrome://version/?show-variations-cmd.\n \"\"\... | [
{
"param": "results",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "results",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b8d0b656c5c2f63d427541a5ee37452a47bd7e3 | sunlongbo/chromium | tools/variations/split_variations_cmd.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SplitVariationsCmdFromString | <not_specific> | def SplitVariationsCmdFromString(input_string):
"""Splits commandline switches.
This function can be called recursively when bisecting a set of experiments
until one is identified to be responsble for a certain browser behavior.
Same as SplitVariationsCmd(), except data comes from a string rather than
an in... | Splits commandline switches.
This function can be called recursively when bisecting a set of experiments
until one is identified to be responsble for a certain browser behavior.
Same as SplitVariationsCmd(), except data comes from a string rather than
an internal representation.
Args:
input_string: V... | Splits commandline switches.
This function can be called recursively when bisecting a set of experiments
until one is identified to be responsble for a certain browser behavior.
Same as SplitVariationsCmd(), except data comes from a string rather than
an internal representation. | [
"Splits",
"commandline",
"switches",
".",
"This",
"function",
"can",
"be",
"called",
"recursively",
"when",
"bisecting",
"a",
"set",
"of",
"experiments",
"until",
"one",
"is",
"identified",
"to",
"be",
"responsble",
"for",
"a",
"certain",
"browser",
"behavior",
... | def SplitVariationsCmdFromString(input_string):
data = ParseVariationsCmdFromString(input_string)
splits = SplitVariationsCmd(data)
results = []
for split in splits:
cmd_list = VariationsCmdToStrings(split)
if cmd_list:
results.append(' '.join(cmd_list))
return results | [
"def",
"SplitVariationsCmdFromString",
"(",
"input_string",
")",
":",
"data",
"=",
"ParseVariationsCmdFromString",
"(",
"input_string",
")",
"splits",
"=",
"SplitVariationsCmd",
"(",
"data",
")",
"results",
"=",
"[",
"]",
"for",
"split",
"in",
"splits",
":",
"cm... | Splits commandline switches. | [
"Splits",
"commandline",
"switches",
"."
] | [
"\"\"\"Splits commandline switches.\n\n This function can be called recursively when bisecting a set of experiments\n until one is identified to be responsble for a certain browser behavior.\n\n Same as SplitVariationsCmd(), except data comes from a string rather than\n an internal representation.\n\n Args:\n ... | [
{
"param": "input_string",
"type": null
}
] | {
"returns": [
{
"docstring": "If input can be split, returns a list of two strings, each is half of\nthe input variations cmd; otherwise, returns a list of one string.",
"docstring_tokens": [
"If",
"input",
"can",
"be",
"split",
"returns",
"a",
... |
3b8d0b656c5c2f63d427541a5ee37452a47bd7e3 | sunlongbo/chromium | tools/variations/split_variations_cmd.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SplitVariationsCmdFromFile | <not_specific> | def SplitVariationsCmdFromFile(input_filename, output_dir=None):
"""Splits commandline switches.
This function can be called recursively when bisecting a set of experiments
until one is identified to be responsble for a certain browser behavior.
Same as SplitVariationsCmd(), except data comes from a file rath... | Splits commandline switches.
This function can be called recursively when bisecting a set of experiments
until one is identified to be responsble for a certain browser behavior.
Same as SplitVariationsCmd(), except data comes from a file rather than
an internal representation.
Args:
input_filename: V... | Splits commandline switches.
This function can be called recursively when bisecting a set of experiments
until one is identified to be responsble for a certain browser behavior.
Same as SplitVariationsCmd(), except data comes from a file rather than
an internal representation. | [
"Splits",
"commandline",
"switches",
".",
"This",
"function",
"can",
"be",
"called",
"recursively",
"when",
"bisecting",
"a",
"set",
"of",
"experiments",
"until",
"one",
"is",
"identified",
"to",
"be",
"responsble",
"for",
"a",
"certain",
"browser",
"behavior",
... | def SplitVariationsCmdFromFile(input_filename, output_dir=None):
with open(input_filename, 'r') as f:
input_string = f.read().replace('\n', ' ')
splits = SplitVariationsCmdFromString(input_string)
dirname, filename = os.path.split(input_filename)
basename, ext = os.path.splitext(filename)
if output_dir is... | [
"def",
"SplitVariationsCmdFromFile",
"(",
"input_filename",
",",
"output_dir",
"=",
"None",
")",
":",
"with",
"open",
"(",
"input_filename",
",",
"'r'",
")",
"as",
"f",
":",
"input_string",
"=",
"f",
".",
"read",
"(",
")",
".",
"replace",
"(",
"'\\n'",
"... | Splits commandline switches. | [
"Splits",
"commandline",
"switches",
"."
] | [
"\"\"\"Splits commandline switches.\n\n This function can be called recursively when bisecting a set of experiments\n until one is identified to be responsble for a certain browser behavior.\n\n Same as SplitVariationsCmd(), except data comes from a file rather than\n an internal representation.\n\n Args:\n ... | [
{
"param": "input_filename",
"type": null
},
{
"param": "output_dir",
"type": null
}
] | {
"returns": [
{
"docstring": "If input can be split, returns a list of two output filenames;\notherwise, returns a list of one output filename.",
"docstring_tokens": [
"If",
"input",
"can",
"be",
"split",
"returns",
"a",
"list",
... |
8549471c703fb3e9b3a3e2b3644aa3a2ee74034e | sunlongbo/chromium | chrome/test/mini_installer/chrome_helper.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetProcessIDs | <not_specific> | def GetProcessIDs(process_path):
"""Returns a list of IDs of processes whose path is |process_path|.
Args:
process_path: The path to the process.
Returns:
A list of process IDs.
"""
return [
pid for (pid, path) in GetProcessIDAndPathPairs()
if path == process_path
... | Returns a list of IDs of processes whose path is |process_path|.
Args:
process_path: The path to the process.
Returns:
A list of process IDs.
| Returns a list of IDs of processes whose path is |process_path|. | [
"Returns",
"a",
"list",
"of",
"IDs",
"of",
"processes",
"whose",
"path",
"is",
"|process_path|",
"."
] | def GetProcessIDs(process_path):
return [
pid for (pid, path) in GetProcessIDAndPathPairs()
if path == process_path
] | [
"def",
"GetProcessIDs",
"(",
"process_path",
")",
":",
"return",
"[",
"pid",
"for",
"(",
"pid",
",",
"path",
")",
"in",
"GetProcessIDAndPathPairs",
"(",
")",
"if",
"path",
"==",
"process_path",
"]"
] | Returns a list of IDs of processes whose path is |process_path|. | [
"Returns",
"a",
"list",
"of",
"IDs",
"of",
"processes",
"whose",
"path",
"is",
"|process_path|",
"."
] | [
"\"\"\"Returns a list of IDs of processes whose path is |process_path|.\n\n Args:\n process_path: The path to the process.\n\n Returns:\n A list of process IDs.\n \"\"\""
] | [
{
"param": "process_path",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of process IDs.",
"docstring_tokens": [
"A",
"list",
"of",
"process",
"IDs",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "process_path",
"type": null,
... |
8549471c703fb3e9b3a3e2b3644aa3a2ee74034e | sunlongbo/chromium | chrome/test/mini_installer/chrome_helper.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetChromeProcesses | <not_specific> | def GetChromeProcesses(chrome_path):
"""Returns a dict of all |chrome_path| processes indexed by pid."""
chrome_processes = dict()
for process in psutil.process_iter():
try:
if get_process_exe(process) == chrome_path:
chrome_processes[process.pid] ... | Returns a dict of all |chrome_path| processes indexed by pid. | Returns a dict of all |chrome_path| processes indexed by pid. | [
"Returns",
"a",
"dict",
"of",
"all",
"|chrome_path|",
"processes",
"indexed",
"by",
"pid",
"."
] | def GetChromeProcesses(chrome_path):
chrome_processes = dict()
for process in psutil.process_iter():
try:
if get_process_exe(process) == chrome_path:
chrome_processes[process.pid] = process
LOGGER.info('Found chrome process %s' %
... | [
"def",
"GetChromeProcesses",
"(",
"chrome_path",
")",
":",
"chrome_processes",
"=",
"dict",
"(",
")",
"for",
"process",
"in",
"psutil",
".",
"process_iter",
"(",
")",
":",
"try",
":",
"if",
"get_process_exe",
"(",
"process",
")",
"==",
"chrome_path",
":",
... | Returns a dict of all |chrome_path| processes indexed by pid. | [
"Returns",
"a",
"dict",
"of",
"all",
"|chrome_path|",
"processes",
"indexed",
"by",
"pid",
"."
] | [
"\"\"\"Returns a dict of all |chrome_path| processes indexed by pid.\"\"\""
] | [
{
"param": "chrome_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "chrome_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8549471c703fb3e9b3a3e2b3644aa3a2ee74034e | sunlongbo/chromium | chrome/test/mini_installer/chrome_helper.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetBrowserProcess | <not_specific> | def GetBrowserProcess(chrome_processes):
"""Returns a psutil.Process for the browser process in
|chrome_processes|.
"""
# Find the one whose parent isn't a chrome.exe process.
for process in chrome_processes.itervalues():
try:
if get_process_ppid(proce... | Returns a psutil.Process for the browser process in
|chrome_processes|.
| Returns a psutil.Process for the browser process in
|chrome_processes|. | [
"Returns",
"a",
"psutil",
".",
"Process",
"for",
"the",
"browser",
"process",
"in",
"|chrome_processes|",
"."
] | def GetBrowserProcess(chrome_processes):
for process in chrome_processes.itervalues():
try:
if get_process_ppid(process) not in chrome_processes:
return process
except psutil.Error:
pass
return None | [
"def",
"GetBrowserProcess",
"(",
"chrome_processes",
")",
":",
"for",
"process",
"in",
"chrome_processes",
".",
"itervalues",
"(",
")",
":",
"try",
":",
"if",
"get_process_ppid",
"(",
"process",
")",
"not",
"in",
"chrome_processes",
":",
"return",
"process",
"... | Returns a psutil.Process for the browser process in
|chrome_processes|. | [
"Returns",
"a",
"psutil",
".",
"Process",
"for",
"the",
"browser",
"process",
"in",
"|chrome_processes|",
"."
] | [
"\"\"\"Returns a psutil.Process for the browser process in\n |chrome_processes|.\n \"\"\"",
"# Find the one whose parent isn't a chrome.exe process."
] | [
{
"param": "chrome_processes",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "chrome_processes",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8549471c703fb3e9b3a3e2b3644aa3a2ee74034e | sunlongbo/chromium | chrome/test/mini_installer/chrome_helper.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetWindowHandles | <not_specific> | def GetWindowHandles(process_ids):
"""Returns a list of handles of windows owned by processes in |process_ids|.
Args:
process_ids: A list of process IDs.
Returns:
A list of handles of windows owned by processes in |process_ids|.
"""
hwnds = []
def EnumerateWindowCallback(hwnd,... | Returns a list of handles of windows owned by processes in |process_ids|.
Args:
process_ids: A list of process IDs.
Returns:
A list of handles of windows owned by processes in |process_ids|.
| Returns a list of handles of windows owned by processes in |process_ids|. | [
"Returns",
"a",
"list",
"of",
"handles",
"of",
"windows",
"owned",
"by",
"processes",
"in",
"|process_ids|",
"."
] | def GetWindowHandles(process_ids):
hwnds = []
def EnumerateWindowCallback(hwnd, _):
_, found_process_id = win32process.GetWindowThreadProcessId(hwnd)
if found_process_id in process_ids and win32gui.IsWindowVisible(hwnd):
hwnds.append(hwnd)
win32gui.EnumWindows(EnumerateWindowCall... | [
"def",
"GetWindowHandles",
"(",
"process_ids",
")",
":",
"hwnds",
"=",
"[",
"]",
"def",
"EnumerateWindowCallback",
"(",
"hwnd",
",",
"_",
")",
":",
"_",
",",
"found_process_id",
"=",
"win32process",
".",
"GetWindowThreadProcessId",
"(",
"hwnd",
")",
"if",
"f... | Returns a list of handles of windows owned by processes in |process_ids|. | [
"Returns",
"a",
"list",
"of",
"handles",
"of",
"windows",
"owned",
"by",
"processes",
"in",
"|process_ids|",
"."
] | [
"\"\"\"Returns a list of handles of windows owned by processes in |process_ids|.\n\n Args:\n process_ids: A list of process IDs.\n\n Returns:\n A list of handles of windows owned by processes in |process_ids|.\n \"\"\"",
"# Enumerate all the top-level windows and call the callback with the ... | [
{
"param": "process_ids",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of handles of windows owned by processes in |process_ids|.",
"docstring_tokens": [
"A",
"list",
"of",
"handles",
"of",
"windows",
"owned",
"by",
"processes",
"in",
"|process_id... |
8549471c703fb3e9b3a3e2b3644aa3a2ee74034e | sunlongbo/chromium | chrome/test/mini_installer/chrome_helper.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WindowExists | <not_specific> | def WindowExists(process_ids, class_pattern):
"""Returns whether there exists a window with the specified criteria.
This method returns whether there exists a window that is owned by a process
in |process_ids| and has a class name that matches |class_pattern|.
Args:
process_ids: A list of proc... | Returns whether there exists a window with the specified criteria.
This method returns whether there exists a window that is owned by a process
in |process_ids| and has a class name that matches |class_pattern|.
Args:
process_ids: A list of process IDs.
class_pattern: The regular expressio... | Returns whether there exists a window with the specified criteria.
This method returns whether there exists a window that is owned by a process
in |process_ids| and has a class name that matches |class_pattern|. | [
"Returns",
"whether",
"there",
"exists",
"a",
"window",
"with",
"the",
"specified",
"criteria",
".",
"This",
"method",
"returns",
"whether",
"there",
"exists",
"a",
"window",
"that",
"is",
"owned",
"by",
"a",
"process",
"in",
"|process_ids|",
"and",
"has",
"... | def WindowExists(process_ids, class_pattern):
for hwnd in GetWindowHandles(process_ids):
if re.match(class_pattern, win32gui.GetClassName(hwnd)):
return True
return False | [
"def",
"WindowExists",
"(",
"process_ids",
",",
"class_pattern",
")",
":",
"for",
"hwnd",
"in",
"GetWindowHandles",
"(",
"process_ids",
")",
":",
"if",
"re",
".",
"match",
"(",
"class_pattern",
",",
"win32gui",
".",
"GetClassName",
"(",
"hwnd",
")",
")",
"... | Returns whether there exists a window with the specified criteria. | [
"Returns",
"whether",
"there",
"exists",
"a",
"window",
"with",
"the",
"specified",
"criteria",
"."
] | [
"\"\"\"Returns whether there exists a window with the specified criteria.\n\n This method returns whether there exists a window that is owned by a process\n in |process_ids| and has a class name that matches |class_pattern|.\n\n Args:\n process_ids: A list of process IDs.\n class_pattern: The... | [
{
"param": "process_ids",
"type": null
},
{
"param": "class_pattern",
"type": null
}
] | {
"returns": [
{
"docstring": "A boolean indicating whether such window exists.",
"docstring_tokens": [
"A",
"boolean",
"indicating",
"whether",
"such",
"window",
"exists",
"."
],
"type": null
}
],
"raises": [],
"par... |
855960b6d538a18b584d66f095cf35539224a791 | sunlongbo/chromium | content/test/gpu/unexpected_passes/gpu_queries_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testWebGlVersion | null | def testWebGlVersion(self):
"""Tests that only results for the correct WebGL version are returned."""
query_results = [
{
'id':
'build-1234',
'test_id': ('ninja://chrome/test:telemetry_gpu_integration_test/'
'gpu_tests.webgl_conformance_integra... | Tests that only results for the correct WebGL version are returned. | Tests that only results for the correct WebGL version are returned. | [
"Tests",
"that",
"only",
"results",
"for",
"the",
"correct",
"WebGL",
"version",
"are",
"returned",
"."
] | def testWebGlVersion(self):
query_results = [
{
'id':
'build-1234',
'test_id': ('ninja://chrome/test:telemetry_gpu_integration_test/'
'gpu_tests.webgl_conformance_integration_test.'
'WebGLConformanceIntegrationTest.test_name... | [
"def",
"testWebGlVersion",
"(",
"self",
")",
":",
"query_results",
"=",
"[",
"{",
"'id'",
":",
"'build-1234'",
",",
"'test_id'",
":",
"(",
"'ninja://chrome/test:telemetry_gpu_integration_test/'",
"'gpu_tests.webgl_conformance_integration_test.'",
"'WebGLConformanceIntegrationTe... | Tests that only results for the correct WebGL version are returned. | [
"Tests",
"that",
"only",
"results",
"for",
"the",
"correct",
"WebGL",
"version",
"are",
"returned",
"."
] | [
"\"\"\"Tests that only results for the correct WebGL version are returned.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
855960b6d538a18b584d66f095cf35539224a791 | sunlongbo/chromium | content/test/gpu/unexpected_passes/gpu_queries_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testSuiteExceptionMap | null | def testSuiteExceptionMap(self):
"""Tests that the suite passed to the query changes for some suites."""
def assertSuiteInQuery(suite, call_args):
query = call_args[0][0][0]
s = 'r"gpu_tests\\.%s\\."' % suite
self.assertIn(s, query)
# Non-special cased suite.
querier = gpu_uu.CreateG... | Tests that the suite passed to the query changes for some suites. | Tests that the suite passed to the query changes for some suites. | [
"Tests",
"that",
"the",
"suite",
"passed",
"to",
"the",
"query",
"changes",
"for",
"some",
"suites",
"."
] | def testSuiteExceptionMap(self):
def assertSuiteInQuery(suite, call_args):
query = call_args[0][0][0]
s = 'r"gpu_tests\\.%s\\."' % suite
self.assertIn(s, query)
querier = gpu_uu.CreateGenericGpuQuerier()
with mock.patch.object(querier,
'_RunBigQueryCommandsForJso... | [
"def",
"testSuiteExceptionMap",
"(",
"self",
")",
":",
"def",
"assertSuiteInQuery",
"(",
"suite",
",",
"call_args",
")",
":",
"query",
"=",
"call_args",
"[",
"0",
"]",
"[",
"0",
"]",
"[",
"0",
"]",
"s",
"=",
"'r\"gpu_tests\\\\.%s\\\\.\"'",
"%",
"suite",
... | Tests that the suite passed to the query changes for some suites. | [
"Tests",
"that",
"the",
"suite",
"passed",
"to",
"the",
"query",
"changes",
"for",
"some",
"suites",
"."
] | [
"\"\"\"Tests that the suite passed to the query changes for some suites.\"\"\"",
"# Non-special cased suite.",
"# Special-cased suites."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
44396674d14b5ba4b284c54fd47c1363a898468c | sunlongbo/chromium | tools/perf/core/services/luci_auth.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckLoggedIn | null | def CheckLoggedIn():
"""Check that the user is currently logged in.
Otherwise sys.exit immediately with the error message from luci-auth
instructing the user how to log in.
"""
try:
GetAccessToken()
except AuthorizationError as exc:
sys.exit(str(exc)) | Check that the user is currently logged in.
Otherwise sys.exit immediately with the error message from luci-auth
instructing the user how to log in.
| Check that the user is currently logged in.
Otherwise sys.exit immediately with the error message from luci-auth
instructing the user how to log in. | [
"Check",
"that",
"the",
"user",
"is",
"currently",
"logged",
"in",
".",
"Otherwise",
"sys",
".",
"exit",
"immediately",
"with",
"the",
"error",
"message",
"from",
"luci",
"-",
"auth",
"instructing",
"the",
"user",
"how",
"to",
"log",
"in",
"."
] | def CheckLoggedIn():
try:
GetAccessToken()
except AuthorizationError as exc:
sys.exit(str(exc)) | [
"def",
"CheckLoggedIn",
"(",
")",
":",
"try",
":",
"GetAccessToken",
"(",
")",
"except",
"AuthorizationError",
"as",
"exc",
":",
"sys",
".",
"exit",
"(",
"str",
"(",
"exc",
")",
")"
] | Check that the user is currently logged in. | [
"Check",
"that",
"the",
"user",
"is",
"currently",
"logged",
"in",
"."
] | [
"\"\"\"Check that the user is currently logged in.\n\n Otherwise sys.exit immediately with the error message from luci-auth\n instructing the user how to log in.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
44396674d14b5ba4b284c54fd47c1363a898468c | sunlongbo/chromium | tools/perf/core/services/luci_auth.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetUserEmail | <not_specific> | def GetUserEmail():
"""Get the email address of the currently logged in user."""
output = _RunCommand('info')
m = re.match(_RE_INFO_USER_EMAIL, output, re.MULTILINE)
assert m, 'Failed to parse luci-auth info output.'
return m.group('email') | Get the email address of the currently logged in user. | Get the email address of the currently logged in user. | [
"Get",
"the",
"email",
"address",
"of",
"the",
"currently",
"logged",
"in",
"user",
"."
] | def GetUserEmail():
output = _RunCommand('info')
m = re.match(_RE_INFO_USER_EMAIL, output, re.MULTILINE)
assert m, 'Failed to parse luci-auth info output.'
return m.group('email') | [
"def",
"GetUserEmail",
"(",
")",
":",
"output",
"=",
"_RunCommand",
"(",
"'info'",
")",
"m",
"=",
"re",
".",
"match",
"(",
"_RE_INFO_USER_EMAIL",
",",
"output",
",",
"re",
".",
"MULTILINE",
")",
"assert",
"m",
",",
"'Failed to parse luci-auth info output.'",
... | Get the email address of the currently logged in user. | [
"Get",
"the",
"email",
"address",
"of",
"the",
"currently",
"logged",
"in",
"user",
"."
] | [
"\"\"\"Get the email address of the currently logged in user.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
44705e10b62d3cdf5ade680cb631c1864ec426fe | sunlongbo/chromium | tools/perf/cli_tools/soundwave/tables/__init__.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | DbSession | null | def DbSession(filename):
"""Context manage a session with a database connection.
Ensures that tables have been initialized.
"""
if filename != ':memory:':
parent_dir = os.path.dirname(filename)
if not os.path.exists(parent_dir):
os.makedirs(parent_dir)
con = sqlite3.connect(filename)
try:
... | Context manage a session with a database connection.
Ensures that tables have been initialized.
| Context manage a session with a database connection.
Ensures that tables have been initialized. | [
"Context",
"manage",
"a",
"session",
"with",
"a",
"database",
"connection",
".",
"Ensures",
"that",
"tables",
"have",
"been",
"initialized",
"."
] | def DbSession(filename):
if filename != ':memory:':
parent_dir = os.path.dirname(filename)
if not os.path.exists(parent_dir):
os.makedirs(parent_dir)
con = sqlite3.connect(filename)
try:
con.execute('PRAGMA journal_mode=WAL')
_CreateTablesIfNeeded(con)
yield con
finally:
con.close(... | [
"def",
"DbSession",
"(",
"filename",
")",
":",
"if",
"filename",
"!=",
"':memory:'",
":",
"parent_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"filename",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"parent_dir",
")",
":",
"os",
".... | Context manage a session with a database connection. | [
"Context",
"manage",
"a",
"session",
"with",
"a",
"database",
"connection",
"."
] | [
"\"\"\"Context manage a session with a database connection.\n\n Ensures that tables have been initialized.\n \"\"\"",
"# Tell sqlite to use a write-ahead log, which drastically increases its",
"# concurrency capabilities. This helps prevent 'database is locked'",
"# exceptions when we have many workers writ... | [
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
478d3c72993436247f9ad6c1ab104fd30b06d396 | sunlongbo/chromium | tools/android/dependency_analysis/count_cycles.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | find_cycles_from_node | List[List[List[graph.Node]]] | def find_cycles_from_node(
start_node: graph.Node,
max_cycle_length: int,
node_to_id: Dict[graph.Node, int],
) -> List[List[List[graph.Node]]]:
"""Finds all cycles starting at |start_node| in a subset of nodes.
Only nodes with ID >= |start_node|'s ID will be considered. This ensures
uniquely co... | Finds all cycles starting at |start_node| in a subset of nodes.
Only nodes with ID >= |start_node|'s ID will be considered. This ensures
uniquely counting all cycles since this function is called on all nodes of
the graph, one at a time in increasing order. Some justification: Consider
cycle C with sma... | Finds all cycles starting at |start_node| in a subset of nodes.
Only nodes with ID >= |start_node|'s ID will be considered. This ensures
uniquely counting all cycles since this function is called on all nodes of
the graph, one at a time in increasing order. Some justification: Consider
cycle C with smallest node n. Whe... | [
"Finds",
"all",
"cycles",
"starting",
"at",
"|start_node|",
"in",
"a",
"subset",
"of",
"nodes",
".",
"Only",
"nodes",
"with",
"ID",
">",
"=",
"|start_node|",
"'",
"s",
"ID",
"will",
"be",
"considered",
".",
"This",
"ensures",
"uniquely",
"counting",
"all",... | def find_cycles_from_node(
start_node: graph.Node,
max_cycle_length: int,
node_to_id: Dict[graph.Node, int],
) -> List[List[List[graph.Node]]]:
start_node_id = node_to_id[start_node]
cycles = [[] for _ in range(max_cycle_length + 1)]
def edge_is_interesting(start: graph.Node, end: graph.Node) ->... | [
"def",
"find_cycles_from_node",
"(",
"start_node",
":",
"graph",
".",
"Node",
",",
"max_cycle_length",
":",
"int",
",",
"node_to_id",
":",
"Dict",
"[",
"graph",
".",
"Node",
",",
"int",
"]",
",",
")",
"->",
"List",
"[",
"List",
"[",
"List",
"[",
"graph... | Finds all cycles starting at |start_node| in a subset of nodes. | [
"Finds",
"all",
"cycles",
"starting",
"at",
"|start_node|",
"in",
"a",
"subset",
"of",
"nodes",
"."
] | [
"\"\"\"Finds all cycles starting at |start_node| in a subset of nodes.\n\n Only nodes with ID >= |start_node|'s ID will be considered. This ensures\n uniquely counting all cycles since this function is called on all nodes of\n the graph, one at a time in increasing order. Some justification: Consider\n ... | [
{
"param": "start_node",
"type": "graph.Node"
},
{
"param": "max_cycle_length",
"type": "int"
},
{
"param": "node_to_id",
"type": "Dict[graph.Node, int]"
}
] | {
"returns": [
{
"docstring": "A list |cycles| of length |max_cycle_length| + 1, where cycles[i]\ncontains all relevant cycles of length i.",
"docstring_tokens": [
"A",
"list",
"|cycles|",
"of",
"length",
"|max_cycle_length|",
"+",
"1",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.