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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
075ef0ef1f71f359dd18247cf3c3cb2706c8f86f | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _find_in_search_path | <not_specific> | def _find_in_search_path(self, search_path, current_result,
results_by_directory):
"""Finds the index and the directory of a result on a search path."""
for index, directory in enumerate(search_path):
if (directory in results_by_directory
and ... | Finds the index and the directory of a result on a search path. | Finds the index and the directory of a result on a search path. | [
"Finds",
"the",
"index",
"and",
"the",
"directory",
"of",
"a",
"result",
"on",
"a",
"search",
"path",
"."
] | def _find_in_search_path(self, search_path, current_result,
results_by_directory):
for index, directory in enumerate(search_path):
if (directory in results_by_directory
and (results_by_directory[directory] == current_result)):
return i... | [
"def",
"_find_in_search_path",
"(",
"self",
",",
"search_path",
",",
"current_result",
",",
"results_by_directory",
")",
":",
"for",
"index",
",",
"directory",
"in",
"enumerate",
"(",
"search_path",
")",
":",
"if",
"(",
"directory",
"in",
"results_by_directory",
... | Finds the index and the directory of a result on a search path. | [
"Finds",
"the",
"index",
"and",
"the",
"directory",
"of",
"a",
"result",
"on",
"a",
"search",
"path",
"."
] | [
"\"\"\"Finds the index and the directory of a result on a search path.\"\"\"",
"# Implicit extra result at the root."
] | [
{
"param": "self",
"type": null
},
{
"param": "search_path",
"type": null
},
{
"param": "current_result",
"type": null
},
{
"param": "results_by_directory",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "search_path",
"type": null,
"docstring": null,
"docstring_tok... |
075ef0ef1f71f359dd18247cf3c3cb2706c8f86f | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _remove_extra_result_at_root | null | def _remove_extra_result_at_root(self, test_name, baseline_name):
"""Removes extra result at the non-virtual root."""
assert not self._virtual_base(baseline_name), \
'A virtual baseline is passed in.'
path = self._join_directory(self._baseline_root(), baseline_name)
if (self.... | Removes extra result at the non-virtual root. | Removes extra result at the non-virtual root. | [
"Removes",
"extra",
"result",
"at",
"the",
"non",
"-",
"virtual",
"root",
"."
] | def _remove_extra_result_at_root(self, test_name, baseline_name):
assert not self._virtual_base(baseline_name), \
'A virtual baseline is passed in.'
path = self._join_directory(self._baseline_root(), baseline_name)
if (self._filesystem.exists(path)
and ResultDigest(se... | [
"def",
"_remove_extra_result_at_root",
"(",
"self",
",",
"test_name",
",",
"baseline_name",
")",
":",
"assert",
"not",
"self",
".",
"_virtual_base",
"(",
"baseline_name",
")",
",",
"'A virtual baseline is passed in.'",
"path",
"=",
"self",
".",
"_join_directory",
"(... | Removes extra result at the non-virtual root. | [
"Removes",
"extra",
"result",
"at",
"the",
"non",
"-",
"virtual",
"root",
"."
] | [
"\"\"\"Removes extra result at the non-virtual root.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "test_name",
"type": null
},
{
"param": "baseline_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "test_name",
"type": null,
"docstring": null,
"docstring_token... |
7dd4e253a1eab6e1aabd197839fe313829c7897a | sunlongbo/chromium | tools/captured_sites/control.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _handle_signal | null | def _handle_signal(sig, _):
"""Handles received signals to make sure spawned test process are killed.
sig (int): An integer representing the received signal, for example SIGTERM.
"""
# Don't do any cleanup here, instead, leave it to the finally blocks.
# Assumption is based on https://docs.python.org/3/libr... | Handles received signals to make sure spawned test process are killed.
sig (int): An integer representing the received signal, for example SIGTERM.
| Handles received signals to make sure spawned test process are killed.
sig (int): An integer representing the received signal, for example SIGTERM. | [
"Handles",
"received",
"signals",
"to",
"make",
"sure",
"spawned",
"test",
"process",
"are",
"killed",
".",
"sig",
"(",
"int",
")",
":",
"An",
"integer",
"representing",
"the",
"received",
"signal",
"for",
"example",
"SIGTERM",
"."
] | def _handle_signal(sig, _):
print('Signal to quit received, waiting for potential WPR write to complete')
time.sleep(1)
sys.exit(128 + sig) | [
"def",
"_handle_signal",
"(",
"sig",
",",
"_",
")",
":",
"print",
"(",
"'Signal to quit received, waiting for potential WPR write to complete'",
")",
"time",
".",
"sleep",
"(",
"1",
")",
"sys",
".",
"exit",
"(",
"128",
"+",
"sig",
")"
] | Handles received signals to make sure spawned test process are killed. | [
"Handles",
"received",
"signals",
"to",
"make",
"sure",
"spawned",
"test",
"process",
"are",
"killed",
"."
] | [
"\"\"\"Handles received signals to make sure spawned test process are killed.\n\n sig (int): An integer representing the received signal, for example SIGTERM.\n \"\"\"",
"# Don't do any cleanup here, instead, leave it to the finally blocks.",
"# Assumption is based on https://docs.python.org/3/library/sys.htm... | [
{
"param": "sig",
"type": null
},
{
"param": "_",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sig",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "_",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
d286b4fd2b9fcd480c5645b85c8da286cfde8e81 | sunlongbo/chromium | tools/traffic_annotation/scripts/check_annotations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckFiles | <not_specific> | def CheckFiles(self, complete_run, limit, use_python_auditor):
"""Passes all given files to traffic_annotation_auditor to be checked for
possible violations of network traffic annotation rules.
Args:
complete_run: bool Flag requesting to run test on all relevant files.
use_python_auditor: bool ... | Passes all given files to traffic_annotation_auditor to be checked for
possible violations of network traffic annotation rules.
Args:
complete_run: bool Flag requesting to run test on all relevant files.
use_python_auditor: bool If True, test auditor.py instead of
t_a_auditor.exe.
lim... | Passes all given files to traffic_annotation_auditor to be checked for
possible violations of network traffic annotation rules. | [
"Passes",
"all",
"given",
"files",
"to",
"traffic_annotation_auditor",
"to",
"be",
"checked",
"for",
"possible",
"violations",
"of",
"network",
"traffic",
"annotation",
"rules",
"."
] | def CheckFiles(self, complete_run, limit, use_python_auditor):
if not self.tools.CanRunAuditor(use_python_auditor):
print("Network traffic annotation presubmit check was not performed. A "
"compiled build directory and traffic_annotation_auditor binary "
"are required to do it.")
... | [
"def",
"CheckFiles",
"(",
"self",
",",
"complete_run",
",",
"limit",
",",
"use_python_auditor",
")",
":",
"if",
"not",
"self",
".",
"tools",
".",
"CanRunAuditor",
"(",
"use_python_auditor",
")",
":",
"print",
"(",
"\"Network traffic annotation presubmit check was no... | Passes all given files to traffic_annotation_auditor to be checked for
possible violations of network traffic annotation rules. | [
"Passes",
"all",
"given",
"files",
"to",
"traffic_annotation_auditor",
"to",
"be",
"checked",
"for",
"possible",
"violations",
"of",
"network",
"traffic",
"annotation",
"rules",
"."
] | [
"\"\"\"Passes all given files to traffic_annotation_auditor to be checked for\n possible violations of network traffic annotation rules.\n\n Args:\n complete_run: bool Flag requesting to run test on all relevant files.\n use_python_auditor: bool If True, test auditor.py instead of\n t_a_audit... | [
{
"param": "self",
"type": null
},
{
"param": "complete_run",
"type": null
},
{
"param": "limit",
"type": null
},
{
"param": "use_python_auditor",
"type": null
}
] | {
"returns": [
{
"docstring": "int Exit code of the network traffic annotation auditor.",
"docstring_tokens": [
"int",
"Exit",
"code",
"of",
"the",
"network",
"traffic",
"annotation",
"auditor",
"."
],
"type": ... |
db2a754d0b13813f3b4ff17e5e8ea5729b02ac02 | sunlongbo/chromium | tools/gdb/gdb_chrome.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | typed_ptr | <not_specific> | def typed_ptr(ptr):
"""Prints a pointer along with its exact type.
By default, gdb would print just the address, which takes more
steps to interpret.
"""
# Returning this as a cast expression surrounded by parentheses
# makes it easier to cut+paste inside of gdb.
return '((%s)%s)' % (ptr.dynamic_ty... | Prints a pointer along with its exact type.
By default, gdb would print just the address, which takes more
steps to interpret.
| Prints a pointer along with its exact type.
By default, gdb would print just the address, which takes more
steps to interpret. | [
"Prints",
"a",
"pointer",
"along",
"with",
"its",
"exact",
"type",
".",
"By",
"default",
"gdb",
"would",
"print",
"just",
"the",
"address",
"which",
"takes",
"more",
"steps",
"to",
"interpret",
"."
] | def typed_ptr(ptr):
return '((%s)%s)' % (ptr.dynamic_type, ptr) | [
"def",
"typed_ptr",
"(",
"ptr",
")",
":",
"return",
"'((%s)%s)'",
"%",
"(",
"ptr",
".",
"dynamic_type",
",",
"ptr",
")"
] | Prints a pointer along with its exact type. | [
"Prints",
"a",
"pointer",
"along",
"with",
"its",
"exact",
"type",
"."
] | [
"\"\"\"Prints a pointer along with its exact type.\n\n By default, gdb would print just the address, which takes more\n steps to interpret.\n \"\"\"",
"# Returning this as a cast expression surrounded by parentheses",
"# makes it easier to cut+paste inside of gdb."
] | [
{
"param": "ptr",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ptr",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db2a754d0b13813f3b4ff17e5e8ea5729b02ac02 | sunlongbo/chromium | tools/gdb/gdb_chrome.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | yield_fields | null | def yield_fields(val):
"""Use this in a printer's children() method to print an object's fields.
e.g.
def children():
for result in yield_fields(self.val):
yield result
"""
try:
fields = val.type.target().fields()
except:
fields = val.type.fields()
for field in fields:
... | Use this in a printer's children() method to print an object's fields.
e.g.
def children():
for result in yield_fields(self.val):
yield result
| Use this in a printer's children() method to print an object's fields. | [
"Use",
"this",
"in",
"a",
"printer",
"'",
"s",
"children",
"()",
"method",
"to",
"print",
"an",
"object",
"'",
"s",
"fields",
"."
] | def yield_fields(val):
try:
fields = val.type.target().fields()
except:
fields = val.type.fields()
for field in fields:
if field.is_base_class:
yield (field.name, val.cast(gdb.lookup_type(field.name)))
else:
yield (field.name, val[field.name]) | [
"def",
"yield_fields",
"(",
"val",
")",
":",
"try",
":",
"fields",
"=",
"val",
".",
"type",
".",
"target",
"(",
")",
".",
"fields",
"(",
")",
"except",
":",
"fields",
"=",
"val",
".",
"type",
".",
"fields",
"(",
")",
"for",
"field",
"in",
"fields... | Use this in a printer's children() method to print an object's fields. | [
"Use",
"this",
"in",
"a",
"printer",
"'",
"s",
"children",
"()",
"method",
"to",
"print",
"an",
"object",
"'",
"s",
"fields",
"."
] | [
"\"\"\"Use this in a printer's children() method to print an object's fields.\n\n e.g.\n def children():\n for result in yield_fields(self.val):\n yield result\n \"\"\""
] | [
{
"param": "val",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "val",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db3843f2a186a0e0a977bfe8ad03ff07a9c6e0ed | sunlongbo/chromium | components/zucchini/fuzzers/create_seed_file_pair.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | read_to_proto_escaped_string | <not_specific> | def read_to_proto_escaped_string(filename):
"""Reads a file and converts it to hex escape sequences."""
with open(filename, 'rb') as f:
# Note that unicode-escape escapes all non-ASCII printable characters
# excluding ", which needs to be manually escaped.
return f.read().decode('latin1').encode('unicod... | Reads a file and converts it to hex escape sequences. | Reads a file and converts it to hex escape sequences. | [
"Reads",
"a",
"file",
"and",
"converts",
"it",
"to",
"hex",
"escape",
"sequences",
"."
] | def read_to_proto_escaped_string(filename):
with open(filename, 'rb') as f:
return f.read().decode('latin1').encode('unicode-escape').replace(
b'"', b'\\"') | [
"def",
"read_to_proto_escaped_string",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'rb'",
")",
"as",
"f",
":",
"return",
"f",
".",
"read",
"(",
")",
".",
"decode",
"(",
"'latin1'",
")",
".",
"encode",
"(",
"'unicode-escape'",
")",
... | Reads a file and converts it to hex escape sequences. | [
"Reads",
"a",
"file",
"and",
"converts",
"it",
"to",
"hex",
"escape",
"sequences",
"."
] | [
"\"\"\"Reads a file and converts it to hex escape sequences.\"\"\"",
"# Note that unicode-escape escapes all non-ASCII printable characters",
"# excluding \", which needs to be manually escaped."
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4fd97801b49b93b4378370090e8b089aba3af6 | sunlongbo/chromium | tools/fuchsia/comparative_tester/generate_perf_report.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ToString | str | def ToString(self) -> str:
"""Converts the line to a human-readable string."""
if self.sample_num > 1:
return "{}: {:.5f} σ={:.5f} {} with n={} cv={}".format(
self.desc, self.time_avg, self.time_dev, self.unit, self.sample_num,
self.cv)
else:
return "{}: {:.5f} with only one ... | Converts the line to a human-readable string. | Converts the line to a human-readable string. | [
"Converts",
"the",
"line",
"to",
"a",
"human",
"-",
"readable",
"string",
"."
] | def ToString(self) -> str:
if self.sample_num > 1:
return "{}: {:.5f} σ={:.5f} {} with n={} cv={}".format(
self.desc, self.time_avg, self.time_dev, self.unit, self.sample_num,
self.cv)
else:
return "{}: {:.5f} with only one sample".format(self.desc, self.time_avg) | [
"def",
"ToString",
"(",
"self",
")",
"->",
"str",
":",
"if",
"self",
".",
"sample_num",
">",
"1",
":",
"return",
"\"{}: {:.5f} σ={:.5f} {} with n={} cv={}\".",
"f",
"ormat(",
"",
"self",
".",
"desc",
",",
"self",
".",
"time_avg",
",",
"self",
".",
"time_de... | Converts the line to a human-readable string. | [
"Converts",
"the",
"line",
"to",
"a",
"human",
"-",
"readable",
"string",
"."
] | [
"\"\"\"Converts the line to a human-readable string.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4fd97801b49b93b4378370090e8b089aba3af6 | sunlongbo/chromium | tools/fuchsia/comparative_tester/generate_perf_report.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | LineFromList | LineStats | def LineFromList(lines: List[ResultLine]) -> LineStats:
"""Takes a list of ResultLines and generates statistics for them.
Args:
lines (List[ResultLine]): The list of lines to generate stats for.
Returns:
LineStats: the representation of statistical data for the lines.
"""
desc = lines[0].desc
uni... | Takes a list of ResultLines and generates statistics for them.
Args:
lines (List[ResultLine]): The list of lines to generate stats for.
Returns:
LineStats: the representation of statistical data for the lines.
| Takes a list of ResultLines and generates statistics for them. | [
"Takes",
"a",
"list",
"of",
"ResultLines",
"and",
"generates",
"statistics",
"for",
"them",
"."
] | def LineFromList(lines: List[ResultLine]) -> LineStats:
desc = lines[0].desc
unit = lines[0].unit
times = [line.meas for line in lines]
avg, dev, cv = GenStats(times)
return LineStats(desc, unit, avg, dev, cv, len(lines)) | [
"def",
"LineFromList",
"(",
"lines",
":",
"List",
"[",
"ResultLine",
"]",
")",
"->",
"LineStats",
":",
"desc",
"=",
"lines",
"[",
"0",
"]",
".",
"desc",
"unit",
"=",
"lines",
"[",
"0",
"]",
".",
"unit",
"times",
"=",
"[",
"line",
".",
"meas",
"fo... | Takes a list of ResultLines and generates statistics for them. | [
"Takes",
"a",
"list",
"of",
"ResultLines",
"and",
"generates",
"statistics",
"for",
"them",
"."
] | [
"\"\"\"Takes a list of ResultLines and generates statistics for them.\n\n Args:\n lines (List[ResultLine]): The list of lines to generate stats for.\n\n Returns:\n LineStats: the representation of statistical data for the lines.\n \"\"\""
] | [
{
"param": "lines",
"type": "List[ResultLine]"
}
] | {
"returns": [
{
"docstring": "the representation of statistical data for the lines.",
"docstring_tokens": [
"the",
"representation",
"of",
"statistical",
"data",
"for",
"the",
"lines",
"."
],
"type": "LineStats"
}... |
db4fd97801b49b93b4378370090e8b089aba3af6 | sunlongbo/chromium | tools/fuchsia/comparative_tester/generate_perf_report.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ToLines | List[str] | def ToLines(self) -> List[str]:
"""The stats of this test, as well as its constituent LineStats, in a human-
readable format.
Returns:
List[str]: The human-readable list of lines.
"""
lines = []
if self.sample_num > 1:
lines.append("{}: {:.5f} σ={:.5f}ms with n={} cv={}".format(
... | The stats of this test, as well as its constituent LineStats, in a human-
readable format.
Returns:
List[str]: The human-readable list of lines.
| The stats of this test, as well as its constituent LineStats, in a human
readable format. | [
"The",
"stats",
"of",
"this",
"test",
"as",
"well",
"as",
"its",
"constituent",
"LineStats",
"in",
"a",
"human",
"readable",
"format",
"."
] | def ToLines(self) -> List[str]:
lines = []
if self.sample_num > 1:
lines.append("{}: {:.5f} σ={:.5f}ms with n={} cv={}".format(
self.name, self.time_avg, self.time_dev, self.sample_num, self.cv))
else:
lines.append("{}: {:.5f} with only one sample".format(
self.name, self.tim... | [
"def",
"ToLines",
"(",
"self",
")",
"->",
"List",
"[",
"str",
"]",
":",
"lines",
"=",
"[",
"]",
"if",
"self",
".",
"sample_num",
">",
"1",
":",
"lines",
".",
"append",
"(",
"\"{}: {:.5f} σ={:.5f}ms with n={} cv={}\".",
"f",
"ormat(",
"",
"self",
".",
"... | The stats of this test, as well as its constituent LineStats, in a human
readable format. | [
"The",
"stats",
"of",
"this",
"test",
"as",
"well",
"as",
"its",
"constituent",
"LineStats",
"in",
"a",
"human",
"readable",
"format",
"."
] | [
"\"\"\"The stats of this test, as well as its constituent LineStats, in a human-\n readable format.\n\n Returns:\n List[str]: The human-readable list of lines.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "The human-readable list of lines.",
"docstring_tokens": [
"The",
"human",
"-",
"readable",
"list",
"of",
"lines",
"."
],
"type": "List[str]"
}
],
"raises": [],
"params": [
{
"... |
db4fd97801b49b93b4378370090e8b089aba3af6 | sunlongbo/chromium | tools/fuchsia/comparative_tester/generate_perf_report.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | TestFromList | TestStats | def TestFromList(tests: List[TestResult]) -> TestStats:
"""Coalesces a list of TestResults into a single TestStats object.
Args:
tests (List[TestResult]): The input sample of the tests.
Returns:
TestStats: A representation of the statistics of the tests.
"""
name = tests[0].name
avg, dev, cv = Ge... | Coalesces a list of TestResults into a single TestStats object.
Args:
tests (List[TestResult]): The input sample of the tests.
Returns:
TestStats: A representation of the statistics of the tests.
| Coalesces a list of TestResults into a single TestStats object. | [
"Coalesces",
"a",
"list",
"of",
"TestResults",
"into",
"a",
"single",
"TestStats",
"object",
"."
] | def TestFromList(tests: List[TestResult]) -> TestStats:
name = tests[0].name
avg, dev, cv = GenStats([test.time for test in tests])
lines = {}
for test in tests:
assert test.name == name
for line in test.lines:
if not line.desc in lines:
lines[line.desc] = [line]
else:
line... | [
"def",
"TestFromList",
"(",
"tests",
":",
"List",
"[",
"TestResult",
"]",
")",
"->",
"TestStats",
":",
"name",
"=",
"tests",
"[",
"0",
"]",
".",
"name",
"avg",
",",
"dev",
",",
"cv",
"=",
"GenStats",
"(",
"[",
"test",
".",
"time",
"for",
"test",
... | Coalesces a list of TestResults into a single TestStats object. | [
"Coalesces",
"a",
"list",
"of",
"TestResults",
"into",
"a",
"single",
"TestStats",
"object",
"."
] | [
"\"\"\"Coalesces a list of TestResults into a single TestStats object.\n\n Args:\n tests (List[TestResult]): The input sample of the tests.\n\n Returns:\n TestStats: A representation of the statistics of the tests.\n \"\"\"",
"# type: Dict[str, List[ResultLine]]"
] | [
{
"param": "tests",
"type": "List[TestResult]"
}
] | {
"returns": [
{
"docstring": "A representation of the statistics of the tests.",
"docstring_tokens": [
"A",
"representation",
"of",
"the",
"statistics",
"of",
"the",
"tests",
"."
],
"type": "TestStats"
}
],
"r... |
db4fd97801b49b93b4378370090e8b089aba3af6 | sunlongbo/chromium | tools/fuchsia/comparative_tester/generate_perf_report.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ToLines | List[str] | def ToLines(self) -> List[str]:
"""Converts the entire target into a list of lines in human-readable format.
Returns:
List[str]: The human-readable test lines.
"""
lines = []
if self.sample_num > 1:
lines.append("{}: ".format(self.name))
else:
lines.append("{}: with only one s... | Converts the entire target into a list of lines in human-readable format.
Returns:
List[str]: The human-readable test lines.
| Converts the entire target into a list of lines in human-readable format. | [
"Converts",
"the",
"entire",
"target",
"into",
"a",
"list",
"of",
"lines",
"in",
"human",
"-",
"readable",
"format",
"."
] | def ToLines(self) -> List[str]:
lines = []
if self.sample_num > 1:
lines.append("{}: ".format(self.name))
else:
lines.append("{}: with only one sample".format(self.name))
for test in self.tests:
for line in test.ToLines():
lines.append(" {}".format(line))
return lines | [
"def",
"ToLines",
"(",
"self",
")",
"->",
"List",
"[",
"str",
"]",
":",
"lines",
"=",
"[",
"]",
"if",
"self",
".",
"sample_num",
">",
"1",
":",
"lines",
".",
"append",
"(",
"\"{}: \"",
".",
"format",
"(",
"self",
".",
"name",
")",
")",
"else",
... | Converts the entire target into a list of lines in human-readable format. | [
"Converts",
"the",
"entire",
"target",
"into",
"a",
"list",
"of",
"lines",
"in",
"human",
"-",
"readable",
"format",
"."
] | [
"\"\"\"Converts the entire target into a list of lines in human-readable format.\n\n Returns:\n List[str]: The human-readable test lines.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "The human-readable test lines.",
"docstring_tokens": [
"The",
"human",
"-",
"readable",
"test",
"lines",
"."
],
"type": "List[str]"
}
],
"raises": [],
"params": [
{
"identifier": "sel... |
db4fd97801b49b93b4378370090e8b089aba3af6 | sunlongbo/chromium | tools/fuchsia/comparative_tester/generate_perf_report.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | TargetFromList | TargetStats | def TargetFromList(results: List[TargetResult]) -> TargetStats:
"""Coalesces a list of TargetResults into a single collection of stats.
Args:
results (List[TargetResult]): The sampling of target executions to generate
stats for.
Returns:
TargetStats: The body of stats for the sample given.
"""... | Coalesces a list of TargetResults into a single collection of stats.
Args:
results (List[TargetResult]): The sampling of target executions to generate
stats for.
Returns:
TargetStats: The body of stats for the sample given.
| Coalesces a list of TargetResults into a single collection of stats. | [
"Coalesces",
"a",
"list",
"of",
"TargetResults",
"into",
"a",
"single",
"collection",
"of",
"stats",
"."
] | def TargetFromList(results: List[TargetResult]) -> TargetStats:
name = results[0].name
sample_num = len(results)
tests = {}
for result in results:
assert result.name == name
for test in result.tests:
if not test.name in tests.keys():
tests[test.name] = [test]
tests[test.name].appen... | [
"def",
"TargetFromList",
"(",
"results",
":",
"List",
"[",
"TargetResult",
"]",
")",
"->",
"TargetStats",
":",
"name",
"=",
"results",
"[",
"0",
"]",
".",
"name",
"sample_num",
"=",
"len",
"(",
"results",
")",
"tests",
"=",
"{",
"}",
"for",
"result",
... | Coalesces a list of TargetResults into a single collection of stats. | [
"Coalesces",
"a",
"list",
"of",
"TargetResults",
"into",
"a",
"single",
"collection",
"of",
"stats",
"."
] | [
"\"\"\"Coalesces a list of TargetResults into a single collection of stats.\n\n Args:\n results (List[TargetResult]): The sampling of target executions to generate\n stats for.\n\n Returns:\n TargetStats: The body of stats for the sample given.\n \"\"\"",
"# type: Dict[str, List[TestResult]]",
"... | [
{
"param": "results",
"type": "List[TargetResult]"
}
] | {
"returns": [
{
"docstring": "The body of stats for the sample given.",
"docstring_tokens": [
"The",
"body",
"of",
"stats",
"for",
"the",
"sample",
"given",
"."
],
"type": "TargetStats"
}
],
"raises": [],
"p... |
db4fd97801b49b93b4378370090e8b089aba3af6 | sunlongbo/chromium | tools/fuchsia/comparative_tester/generate_perf_report.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GenStats | Tuple[float, float, float] | def GenStats(corpus: List[float]) -> Tuple[float, float, float]:
"""Generates statistics from a list of values
Args:
corpus (List[float]): The set of data to generate statistics for.
Returns:
Tuple[float, float, float]: The mean, standard deviation, and coefficient of
variation for the given sam... | Generates statistics from a list of values
Args:
corpus (List[float]): The set of data to generate statistics for.
Returns:
Tuple[float, float, float]: The mean, standard deviation, and coefficient of
variation for the given sample data.
| Generates statistics from a list of values | [
"Generates",
"statistics",
"from",
"a",
"list",
"of",
"values"
] | def GenStats(corpus: List[float]) -> Tuple[float, float, float]:
avg = sum(corpus) / len(corpus)
adjusted_sum = 0.0
for item in corpus:
adjusted = item - avg
adjusted_sum += adjusted * adjusted
dev = math.sqrt(adjusted_sum / len(corpus))
cv = dev / avg
return avg, dev, cv | [
"def",
"GenStats",
"(",
"corpus",
":",
"List",
"[",
"float",
"]",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
",",
"float",
"]",
":",
"avg",
"=",
"sum",
"(",
"corpus",
")",
"/",
"len",
"(",
"corpus",
")",
"adjusted_sum",
"=",
"0.0",
"for",
"i... | Generates statistics from a list of values | [
"Generates",
"statistics",
"from",
"a",
"list",
"of",
"values"
] | [
"\"\"\"Generates statistics from a list of values\n\n Args:\n corpus (List[float]): The set of data to generate statistics for.\n\n Returns:\n Tuple[float, float, float]: The mean, standard deviation, and coefficient of\n variation for the given sample data.\n \"\"\""
] | [
{
"param": "corpus",
"type": "List[float]"
}
] | {
"returns": [
{
"docstring": "The mean, standard deviation, and coefficient of\nvariation for the given sample data.",
"docstring_tokens": [
"The",
"mean",
"standard",
"deviation",
"and",
"coefficient",
"of",
"variation",
"for",
... |
db4fd97801b49b93b4378370090e8b089aba3af6 | sunlongbo/chromium | tools/fuchsia/comparative_tester/generate_perf_report.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | DirectoryStats | List[TargetStats] | def DirectoryStats(directory: str) -> List[TargetStats]:
"""Takes a path to directory, and uses JSON files in that directory to compile
a list of statistical objects for each independent test target it can detect
in the directory.
Args:
directory (str): The directory to scan for relevant JSONs
Returns:
... | Takes a path to directory, and uses JSON files in that directory to compile
a list of statistical objects for each independent test target it can detect
in the directory.
Args:
directory (str): The directory to scan for relevant JSONs
Returns:
List[TargetStats]: Each element in this list is one target... | Takes a path to directory, and uses JSON files in that directory to compile
a list of statistical objects for each independent test target it can detect
in the directory. | [
"Takes",
"a",
"path",
"to",
"directory",
"and",
"uses",
"JSON",
"files",
"in",
"that",
"directory",
"to",
"compile",
"a",
"list",
"of",
"statistical",
"objects",
"for",
"each",
"independent",
"test",
"target",
"it",
"can",
"detect",
"in",
"the",
"directory",... | def DirectoryStats(directory: str) -> List[TargetStats]:
resultMap = {}
for file in os.listdir(directory):
results = ReadTargetFromJson("{}/{}".format(directory, file))
if not results.name in resultMap.keys():
resultMap[results.name] = [results]
else:
resultMap[results.name].append(results... | [
"def",
"DirectoryStats",
"(",
"directory",
":",
"str",
")",
"->",
"List",
"[",
"TargetStats",
"]",
":",
"resultMap",
"=",
"{",
"}",
"for",
"file",
"in",
"os",
".",
"listdir",
"(",
"directory",
")",
":",
"results",
"=",
"ReadTargetFromJson",
"(",
"\"{}/{}... | Takes a path to directory, and uses JSON files in that directory to compile
a list of statistical objects for each independent test target it can detect
in the directory. | [
"Takes",
"a",
"path",
"to",
"directory",
"and",
"uses",
"JSON",
"files",
"in",
"that",
"directory",
"to",
"compile",
"a",
"list",
"of",
"statistical",
"objects",
"for",
"each",
"independent",
"test",
"target",
"it",
"can",
"detect",
"in",
"the",
"directory",... | [
"\"\"\"Takes a path to directory, and uses JSON files in that directory to compile\n a list of statistical objects for each independent test target it can detect\n in the directory.\n\n Args:\n directory (str): The directory to scan for relevant JSONs\n\n Returns:\n List[TargetStats]: Each element in this... | [
{
"param": "directory",
"type": "str"
}
] | {
"returns": [
{
"docstring": "Each element in this list is one target, averaged up over\nall of its executions.",
"docstring_tokens": [
"Each",
"element",
"in",
"this",
"list",
"is",
"one",
"target",
"averaged",
"up",
... |
db4fd97801b49b93b4378370090e8b089aba3af6 | sunlongbo/chromium | tools/fuchsia/comparative_tester/generate_perf_report.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CompareTargets | Dict[str, Any] | def CompareTargets(linux: TargetStats, fuchsia: TargetStats) -> Dict[str, Any]:
"""Compare takes a corpus of statistics from both Fuchsia and Linux, and then
lines up the values, compares them to each other, and writes them into a
dictionary that can be JSONified.
"""
if linux and fuchsia:
assert linux.na... | Compare takes a corpus of statistics from both Fuchsia and Linux, and then
lines up the values, compares them to each other, and writes them into a
dictionary that can be JSONified.
| Compare takes a corpus of statistics from both Fuchsia and Linux, and then
lines up the values, compares them to each other, and writes them into a
dictionary that can be JSONified. | [
"Compare",
"takes",
"a",
"corpus",
"of",
"statistics",
"from",
"both",
"Fuchsia",
"and",
"Linux",
"and",
"then",
"lines",
"up",
"the",
"values",
"compares",
"them",
"to",
"each",
"other",
"and",
"writes",
"them",
"into",
"a",
"dictionary",
"that",
"can",
"... | def CompareTargets(linux: TargetStats, fuchsia: TargetStats) -> Dict[str, Any]:
if linux and fuchsia:
assert linux.name == fuchsia.name
paired_tests = ZipListsByPredicate(linux.tests, fuchsia.tests,
lambda test: test.name)
paired_tests = MapDictValues(paired_tests, Com... | [
"def",
"CompareTargets",
"(",
"linux",
":",
"TargetStats",
",",
"fuchsia",
":",
"TargetStats",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"if",
"linux",
"and",
"fuchsia",
":",
"assert",
"linux",
".",
"name",
"==",
"fuchsia",
".",
"name",
"pai... | Compare takes a corpus of statistics from both Fuchsia and Linux, and then
lines up the values, compares them to each other, and writes them into a
dictionary that can be JSONified. | [
"Compare",
"takes",
"a",
"corpus",
"of",
"statistics",
"from",
"both",
"Fuchsia",
"and",
"Linux",
"and",
"then",
"lines",
"up",
"the",
"values",
"compares",
"them",
"to",
"each",
"other",
"and",
"writes",
"them",
"into",
"a",
"dictionary",
"that",
"can",
"... | [
"\"\"\"Compare takes a corpus of statistics from both Fuchsia and Linux, and then\n lines up the values, compares them to each other, and writes them into a\n dictionary that can be JSONified.\n \"\"\"",
"# One of them has to be non-null, by the way ZipListsByPredicate functions"
] | [
{
"param": "linux",
"type": "TargetStats"
},
{
"param": "fuchsia",
"type": "TargetStats"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "linux",
"type": "TargetStats",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fuchsia",
"type": "TargetStats",
"docstring": null,
... |
db4fd97801b49b93b4378370090e8b089aba3af6 | sunlongbo/chromium | tools/fuchsia/comparative_tester/generate_perf_report.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CompareTests | Dict[str, Any] | def CompareTests(linux: TestStats, fuchsia: TestStats) -> Dict[str, Any]:
"""As CompareTargets, but at the test level"""
if not linux and not fuchsia:
logging.error("Two null TestStats objects were passed to CompareTests.")
return {}
if not linux or not fuchsia:
if linux:
name = linux.name
... | As CompareTargets, but at the test level | As CompareTargets, but at the test level | [
"As",
"CompareTargets",
"but",
"at",
"the",
"test",
"level"
] | def CompareTests(linux: TestStats, fuchsia: TestStats) -> Dict[str, Any]:
if not linux and not fuchsia:
logging.error("Two null TestStats objects were passed to CompareTests.")
return {}
if not linux or not fuchsia:
if linux:
name = linux.name
failing_os = "Fuchsia"
else:
name = fu... | [
"def",
"CompareTests",
"(",
"linux",
":",
"TestStats",
",",
"fuchsia",
":",
"TestStats",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"if",
"not",
"linux",
"and",
"not",
"fuchsia",
":",
"logging",
".",
"error",
"(",
"\"Two null TestStats objects we... | As CompareTargets, but at the test level | [
"As",
"CompareTargets",
"but",
"at",
"the",
"test",
"level"
] | [
"\"\"\"As CompareTargets, but at the test level\"\"\"",
"# type: Dict[str, Any]"
] | [
{
"param": "linux",
"type": "TestStats"
},
{
"param": "fuchsia",
"type": "TestStats"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "linux",
"type": "TestStats",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fuchsia",
"type": "TestStats",
"docstring": null,
"do... |
db4fd97801b49b93b4378370090e8b089aba3af6 | sunlongbo/chromium | tools/fuchsia/comparative_tester/generate_perf_report.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CompareLines | Dict[str, Any] | def CompareLines(linux: LineStats, fuchsia: LineStats) -> Dict[str, Any]:
"""CompareLines wraps two LineStats objects up as a JSON-dumpable dict.
It also logs a warning every time a line is given which can't be matched up.
If both lines passed are None, or their units or descriptions are not the same
(which sho... | CompareLines wraps two LineStats objects up as a JSON-dumpable dict.
It also logs a warning every time a line is given which can't be matched up.
If both lines passed are None, or their units or descriptions are not the same
(which should never happen) this function fails.
| CompareLines wraps two LineStats objects up as a JSON-dumpable dict.
It also logs a warning every time a line is given which can't be matched up.
If both lines passed are None, or their units or descriptions are not the same
(which should never happen) this function fails. | [
"CompareLines",
"wraps",
"two",
"LineStats",
"objects",
"up",
"as",
"a",
"JSON",
"-",
"dumpable",
"dict",
".",
"It",
"also",
"logs",
"a",
"warning",
"every",
"time",
"a",
"line",
"is",
"given",
"which",
"can",
"'",
"t",
"be",
"matched",
"up",
".",
"If"... | def CompareLines(linux: LineStats, fuchsia: LineStats) -> Dict[str, Any]:
if linux != None and fuchsia != None:
assert linux.desc == fuchsia.desc
assert linux.unit == fuchsia.unit
assert linux != None or fuchsia != None
ref_test = linux if linux else fuchsia
result = {"desc": ref_test.desc, "unit": ref_... | [
"def",
"CompareLines",
"(",
"linux",
":",
"LineStats",
",",
"fuchsia",
":",
"LineStats",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"if",
"linux",
"!=",
"None",
"and",
"fuchsia",
"!=",
"None",
":",
"assert",
"linux",
".",
"desc",
"==",
"fuc... | CompareLines wraps two LineStats objects up as a JSON-dumpable dict. | [
"CompareLines",
"wraps",
"two",
"LineStats",
"objects",
"up",
"as",
"a",
"JSON",
"-",
"dumpable",
"dict",
"."
] | [
"\"\"\"CompareLines wraps two LineStats objects up as a JSON-dumpable dict.\n It also logs a warning every time a line is given which can't be matched up.\n If both lines passed are None, or their units or descriptions are not the same\n (which should never happen) this function fails.\n \"\"\"",
"# ref_test ... | [
{
"param": "linux",
"type": "LineStats"
},
{
"param": "fuchsia",
"type": "LineStats"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "linux",
"type": "LineStats",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fuchsia",
"type": "LineStats",
"docstring": null,
"do... |
db4fd97801b49b93b4378370090e8b089aba3af6 | sunlongbo/chromium | tools/fuchsia/comparative_tester/generate_perf_report.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ZipListsByPredicate | Dict[R, Tuple[T, T]] | def ZipListsByPredicate(left: List[T], right: List[T],
pred: Callable[[T], R]) -> Dict[R, Tuple[T, T]]:
"""This function takes two lists, and a predicate. The predicate is applied to
the values in both lists to obtain a keying value from them. Each item is then
inserted into the returned d... | This function takes two lists, and a predicate. The predicate is applied to
the values in both lists to obtain a keying value from them. Each item is then
inserted into the returned dictionary using the obtained key. The predicate
should not map multiple values from one list to the same key.
| This function takes two lists, and a predicate. The predicate is applied to
the values in both lists to obtain a keying value from them. Each item is then
inserted into the returned dictionary using the obtained key. The predicate
should not map multiple values from one list to the same key. | [
"This",
"function",
"takes",
"two",
"lists",
"and",
"a",
"predicate",
".",
"The",
"predicate",
"is",
"applied",
"to",
"the",
"values",
"in",
"both",
"lists",
"to",
"obtain",
"a",
"keying",
"value",
"from",
"them",
".",
"Each",
"item",
"is",
"then",
"inse... | def ZipListsByPredicate(left: List[T], right: List[T],
pred: Callable[[T], R]) -> Dict[R, Tuple[T, T]]:
paired_items = {}
for item in left:
key = pred(item)
assert key not in paired_items.keys()
paired_items[key] = item, None
for item in right:
key = pred(item)
if key... | [
"def",
"ZipListsByPredicate",
"(",
"left",
":",
"List",
"[",
"T",
"]",
",",
"right",
":",
"List",
"[",
"T",
"]",
",",
"pred",
":",
"Callable",
"[",
"[",
"T",
"]",
",",
"R",
"]",
")",
"->",
"Dict",
"[",
"R",
",",
"Tuple",
"[",
"T",
",",
"T",
... | This function takes two lists, and a predicate. | [
"This",
"function",
"takes",
"two",
"lists",
"and",
"a",
"predicate",
"."
] | [
"\"\"\"This function takes two lists, and a predicate. The predicate is applied to\n the values in both lists to obtain a keying value from them. Each item is then\n inserted into the returned dictionary using the obtained key. The predicate\n should not map multiple values from one list to the same key.\n \"\"... | [
{
"param": "left",
"type": "List[T]"
},
{
"param": "right",
"type": "List[T]"
},
{
"param": "pred",
"type": "Callable[[T], R]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "left",
"type": "List[T]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "right",
"type": "List[T]",
"docstring": null,
"docstring... |
db4fd97801b49b93b4378370090e8b089aba3af6 | sunlongbo/chromium | tools/fuchsia/comparative_tester/generate_perf_report.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MapDictValues | Dict[T, V] | def MapDictValues(dct: Dict[T, Tuple[R, U]],
predicate: Callable[[R, U], V]) -> Dict[T, V]:
"""This function applies the predicate to all the values in the dictionary,
returning a new dictionary with the new values.
"""
out_dict = {}
for key, val in dct.items():
out_dict[key] = predicate... | This function applies the predicate to all the values in the dictionary,
returning a new dictionary with the new values.
| This function applies the predicate to all the values in the dictionary,
returning a new dictionary with the new values. | [
"This",
"function",
"applies",
"the",
"predicate",
"to",
"all",
"the",
"values",
"in",
"the",
"dictionary",
"returning",
"a",
"new",
"dictionary",
"with",
"the",
"new",
"values",
"."
] | def MapDictValues(dct: Dict[T, Tuple[R, U]],
predicate: Callable[[R, U], V]) -> Dict[T, V]:
out_dict = {}
for key, val in dct.items():
out_dict[key] = predicate(*val)
return out_dict | [
"def",
"MapDictValues",
"(",
"dct",
":",
"Dict",
"[",
"T",
",",
"Tuple",
"[",
"R",
",",
"U",
"]",
"]",
",",
"predicate",
":",
"Callable",
"[",
"[",
"R",
",",
"U",
"]",
",",
"V",
"]",
")",
"->",
"Dict",
"[",
"T",
",",
"V",
"]",
":",
"out_dic... | This function applies the predicate to all the values in the dictionary,
returning a new dictionary with the new values. | [
"This",
"function",
"applies",
"the",
"predicate",
"to",
"all",
"the",
"values",
"in",
"the",
"dictionary",
"returning",
"a",
"new",
"dictionary",
"with",
"the",
"new",
"values",
"."
] | [
"\"\"\"This function applies the predicate to all the values in the dictionary,\n returning a new dictionary with the new values.\n \"\"\""
] | [
{
"param": "dct",
"type": "Dict[T, Tuple[R, U]]"
},
{
"param": "predicate",
"type": "Callable[[R, U], V]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dct",
"type": "Dict[T, Tuple[R, U]]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "predicate",
"type": "Callable[[R, U], V]",
"docstr... |
52734c97949466cfe367d7c508e27ad0cb104c1c | sunlongbo/chromium | tools/flakiness/find_flakiness.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FindShardingFlakiness | null | def FindShardingFlakiness(test_path, data_path, supervisor_args):
"""Finds flaky test cases by sharding and running a test for the specified
number of times. The data file is read at the beginning of each run to find
the last known counts and is overwritten at the end of each run with the new
counts. There is a... | Finds flaky test cases by sharding and running a test for the specified
number of times. The data file is read at the beginning of each run to find
the last known counts and is overwritten at the end of each run with the new
counts. There is an optional sleep interval between each run so the script can
be kille... | Finds flaky test cases by sharding and running a test for the specified
number of times. The data file is read at the beginning of each run to find
the last known counts and is overwritten at the end of each run with the new
counts. There is an optional sleep interval between each run so the script can
be killed withou... | [
"Finds",
"flaky",
"test",
"cases",
"by",
"sharding",
"and",
"running",
"a",
"test",
"for",
"the",
"specified",
"number",
"of",
"times",
".",
"The",
"data",
"file",
"is",
"read",
"at",
"the",
"beginning",
"of",
"each",
"run",
"to",
"find",
"the",
"last",
... | def FindShardingFlakiness(test_path, data_path, supervisor_args):
failed_tests = {}
if os.path.exists(data_path):
data_file = open(data_path, 'r')
num_runs = int(data_file.readline().split(' ')[0])
num_passes = int(data_file.readline().split(' ')[0])
for line in data_file:
if line:
spl... | [
"def",
"FindShardingFlakiness",
"(",
"test_path",
",",
"data_path",
",",
"supervisor_args",
")",
":",
"failed_tests",
"=",
"{",
"}",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"data_path",
")",
":",
"data_file",
"=",
"open",
"(",
"data_path",
",",
"'r'",... | Finds flaky test cases by sharding and running a test for the specified
number of times. | [
"Finds",
"flaky",
"test",
"cases",
"by",
"sharding",
"and",
"running",
"a",
"test",
"for",
"the",
"specified",
"number",
"of",
"times",
"."
] | [
"\"\"\"Finds flaky test cases by sharding and running a test for the specified\n number of times. The data file is read at the beginning of each run to find\n the last known counts and is overwritten at the end of each run with the new\n counts. There is an optional sleep interval between each run so the script ... | [
{
"param": "test_path",
"type": null
},
{
"param": "data_path",
"type": null
},
{
"param": "supervisor_args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "test_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data_path",
"type": null,
"docstring": null,
"docstring_... |
52734c97949466cfe367d7c508e27ad0cb104c1c | sunlongbo/chromium | tools/flakiness/find_flakiness.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FindUnaryFlakiness | null | def FindUnaryFlakiness(test_path, output_path, num_procs, num_repeats, timeout):
"""Runs all the test cases in a given test in parallel with itself, to get at
those that hold on to shared resources. The idea is that if a test uses a
unary resource, then running many instances of this test will purge out some
of... | Runs all the test cases in a given test in parallel with itself, to get at
those that hold on to shared resources. The idea is that if a test uses a
unary resource, then running many instances of this test will purge out some
of them as failures or timeouts.
| Runs all the test cases in a given test in parallel with itself, to get at
those that hold on to shared resources. The idea is that if a test uses a
unary resource, then running many instances of this test will purge out some
of them as failures or timeouts. | [
"Runs",
"all",
"the",
"test",
"cases",
"in",
"a",
"given",
"test",
"in",
"parallel",
"with",
"itself",
"to",
"get",
"at",
"those",
"that",
"hold",
"on",
"to",
"shared",
"resources",
".",
"The",
"idea",
"is",
"that",
"if",
"a",
"test",
"uses",
"a",
"u... | def FindUnaryFlakiness(test_path, output_path, num_procs, num_repeats, timeout):
test_name_regex = r'((\w+/)?\w+\.\w+(/\d+)?)'
test_start = re.compile('\[\s+RUN\s+\] ' + test_name_regex)
test_list = []
proc = subprocess.Popen([test_path], stdout=subprocess.PIPE)
while True:
line = proc.stdout.readline()
... | [
"def",
"FindUnaryFlakiness",
"(",
"test_path",
",",
"output_path",
",",
"num_procs",
",",
"num_repeats",
",",
"timeout",
")",
":",
"test_name_regex",
"=",
"r'((\\w+/)?\\w+\\.\\w+(/\\d+)?)'",
"test_start",
"=",
"re",
".",
"compile",
"(",
"'\\[\\s+RUN\\s+\\] '",
"+",
... | Runs all the test cases in a given test in parallel with itself, to get at
those that hold on to shared resources. | [
"Runs",
"all",
"the",
"test",
"cases",
"in",
"a",
"given",
"test",
"in",
"parallel",
"with",
"itself",
"to",
"get",
"at",
"those",
"that",
"hold",
"on",
"to",
"shared",
"resources",
"."
] | [
"\"\"\"Runs all the test cases in a given test in parallel with itself, to get at\n those that hold on to shared resources. The idea is that if a test uses a\n unary resource, then running many instances of this test will purge out some\n of them as failures or timeouts.\n \"\"\"",
"# Run the test to discover... | [
{
"param": "test_path",
"type": null
},
{
"param": "output_path",
"type": null
},
{
"param": "num_procs",
"type": null
},
{
"param": "num_repeats",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "test_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output_path",
"type": null,
"docstring": null,
"docstrin... |
8d34d88cc49f7ca09aad715ecdeb2f132daef647 | sunlongbo/chromium | tools/perf/cli_tools/flakiness_cli/frames.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | BuildersDataFrame | <not_specific> | def BuildersDataFrame(data):
"""Convert a builders request response into a data frame."""
def iter_rows():
for master in data['masters']:
for test_type, builders in master['tests'].items():
for builder_name in builders['builders']:
yield master['name'], builder_name, test_type
return ... | Convert a builders request response into a data frame. | Convert a builders request response into a data frame. | [
"Convert",
"a",
"builders",
"request",
"response",
"into",
"a",
"data",
"frame",
"."
] | def BuildersDataFrame(data):
def iter_rows():
for master in data['masters']:
for test_type, builders in master['tests'].items():
for builder_name in builders['builders']:
yield master['name'], builder_name, test_type
return pandas.DataFrame.from_records(
iter_rows(), columns=('mast... | [
"def",
"BuildersDataFrame",
"(",
"data",
")",
":",
"def",
"iter_rows",
"(",
")",
":",
"for",
"master",
"in",
"data",
"[",
"'masters'",
"]",
":",
"for",
"test_type",
",",
"builders",
"in",
"master",
"[",
"'tests'",
"]",
".",
"items",
"(",
")",
":",
"f... | Convert a builders request response into a data frame. | [
"Convert",
"a",
"builders",
"request",
"response",
"into",
"a",
"data",
"frame",
"."
] | [
"\"\"\"Convert a builders request response into a data frame.\"\"\""
] | [
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8d34d88cc49f7ca09aad715ecdeb2f132daef647 | sunlongbo/chromium | tools/perf/cli_tools/flakiness_cli/frames.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RunLengthDecode | null | def _RunLengthDecode(count_value_pairs):
"""Iterator to expand a run length encoded sequence.
The test results dashboard compresses some long lists using "run length
encoding", for example:
['F', 'F', 'F', 'P', 'P', 'P', 'P', 'F', 'F']
becomes:
[[3, 'F'], [4, 'P'], [2, 'F']]
This function takes t... | Iterator to expand a run length encoded sequence.
The test results dashboard compresses some long lists using "run length
encoding", for example:
['F', 'F', 'F', 'P', 'P', 'P', 'P', 'F', 'F']
becomes:
[[3, 'F'], [4, 'P'], [2, 'F']]
This function takes the encoded version and returns an iterator tha... | Iterator to expand a run length encoded sequence.
The test results dashboard compresses some long lists using "run length
encoding", for example.
This function takes the encoded version and returns an iterator that yields
the elements of the expanded one. | [
"Iterator",
"to",
"expand",
"a",
"run",
"length",
"encoded",
"sequence",
".",
"The",
"test",
"results",
"dashboard",
"compresses",
"some",
"long",
"lists",
"using",
"\"",
"run",
"length",
"encoding",
"\"",
"for",
"example",
".",
"This",
"function",
"takes",
... | def _RunLengthDecode(count_value_pairs):
for count, value in count_value_pairs:
for _ in range(count):
yield value | [
"def",
"_RunLengthDecode",
"(",
"count_value_pairs",
")",
":",
"for",
"count",
",",
"value",
"in",
"count_value_pairs",
":",
"for",
"_",
"in",
"range",
"(",
"count",
")",
":",
"yield",
"value"
] | Iterator to expand a run length encoded sequence. | [
"Iterator",
"to",
"expand",
"a",
"run",
"length",
"encoded",
"sequence",
"."
] | [
"\"\"\"Iterator to expand a run length encoded sequence.\n\n The test results dashboard compresses some long lists using \"run length\n encoding\", for example:\n\n ['F', 'F', 'F', 'P', 'P', 'P', 'P', 'F', 'F']\n\n becomes:\n\n [[3, 'F'], [4, 'P'], [2, 'F']]\n\n This function takes the encoded version and... | [
{
"param": "count_value_pairs",
"type": null
}
] | {
"returns": [
{
"docstring": "Each value of the expanded sequence, one at a time.",
"docstring_tokens": [
"Each",
"value",
"of",
"the",
"expanded",
"sequence",
"one",
"at",
"a",
"time",
"."
],
"type": ... |
8d34d88cc49f7ca09aad715ecdeb2f132daef647 | sunlongbo/chromium | tools/perf/cli_tools/flakiness_cli/frames.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddDataFrameColumn | null | def _AddDataFrameColumn(df, col, values, fill_value=0):
"""Add a sequence of values as a new column, filling values if needed.
Args:
df: A data frame on which to add the column, it is modified in place.
col: A string with the name for the new column.
values: A sequence of values for the column.
fil... | Add a sequence of values as a new column, filling values if needed.
Args:
df: A data frame on which to add the column, it is modified in place.
col: A string with the name for the new column.
values: A sequence of values for the column.
fill_value: If the sequence of values is shorter that the curren... | Add a sequence of values as a new column, filling values if needed. | [
"Add",
"a",
"sequence",
"of",
"values",
"as",
"a",
"new",
"column",
"filling",
"values",
"if",
"needed",
"."
] | def _AddDataFrameColumn(df, col, values, fill_value=0):
df[col] = pandas.Series(list(values)).reindex(df.index, fill_value=fill_value) | [
"def",
"_AddDataFrameColumn",
"(",
"df",
",",
"col",
",",
"values",
",",
"fill_value",
"=",
"0",
")",
":",
"df",
"[",
"col",
"]",
"=",
"pandas",
".",
"Series",
"(",
"list",
"(",
"values",
")",
")",
".",
"reindex",
"(",
"df",
".",
"index",
",",
"f... | Add a sequence of values as a new column, filling values if needed. | [
"Add",
"a",
"sequence",
"of",
"values",
"as",
"a",
"new",
"column",
"filling",
"values",
"if",
"needed",
"."
] | [
"\"\"\"Add a sequence of values as a new column, filling values if needed.\n\n Args:\n df: A data frame on which to add the column, it is modified in place.\n col: A string with the name for the new column.\n values: A sequence of values for the column.\n fill_value: If the sequence of values is shorte... | [
{
"param": "df",
"type": null
},
{
"param": "col",
"type": null
},
{
"param": "values",
"type": null
},
{
"param": "fill_value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "df",
"type": null,
"docstring": "A data frame on which to add the column, it is modified in place.",
"docstring_tokens": [
"A",
"data",
"frame",
"on",
"which",
"to",
"add... |
8d34d88cc49f7ca09aad715ecdeb2f132daef647 | sunlongbo/chromium | tools/perf/cli_tools/flakiness_cli/frames.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | TestResultsDataFrame | <not_specific> | def TestResultsDataFrame(data):
"""Convert a test results request response into a data frame."""
assert data['version'] == 4
dfs = []
for builder, builder_data in data.items():
if builder == 'version':
continue # Skip, not a builder.
builds = pandas.DataFrame()
builds['timestamp'] = pandas.t... | Convert a test results request response into a data frame. | Convert a test results request response into a data frame. | [
"Convert",
"a",
"test",
"results",
"request",
"response",
"into",
"a",
"data",
"frame",
"."
] | def TestResultsDataFrame(data):
assert data['version'] == 4
dfs = []
for builder, builder_data in data.items():
if builder == 'version':
continue
builds = pandas.DataFrame()
builds['timestamp'] = pandas.to_datetime(
builder_data['secondsSinceEpoch'], unit='s')
builds['builder'] = b... | [
"def",
"TestResultsDataFrame",
"(",
"data",
")",
":",
"assert",
"data",
"[",
"'version'",
"]",
"==",
"4",
"dfs",
"=",
"[",
"]",
"for",
"builder",
",",
"builder_data",
"in",
"data",
".",
"items",
"(",
")",
":",
"if",
"builder",
"==",
"'version'",
":",
... | Convert a test results request response into a data frame. | [
"Convert",
"a",
"test",
"results",
"request",
"response",
"into",
"a",
"data",
"frame",
"."
] | [
"\"\"\"Convert a test results request response into a data frame.\"\"\"",
"# Skip, not a builder.",
"# Return an empty data frame with the right column names otherwise."
] | [
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8d34d88cc49f7ca09aad715ecdeb2f132daef647 | sunlongbo/chromium | tools/perf/cli_tools/flakiness_cli/frames.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetWithCache | <not_specific> | def GetWithCache(filename, frame_maker, expires_after):
"""Get a data frame from cache or, if necessary, create and cache it.
Args:
filename: The name of a file for the cached copy of the data frame,
it will be stored in the CACHE_DIR.
frame_maker: A function that takes no arguments and returns a dat... | Get a data frame from cache or, if necessary, create and cache it.
Args:
filename: The name of a file for the cached copy of the data frame,
it will be stored in the CACHE_DIR.
frame_maker: A function that takes no arguments and returns a data frame,
only called to create the data frame if the ca... | Get a data frame from cache or, if necessary, create and cache it. | [
"Get",
"a",
"data",
"frame",
"from",
"cache",
"or",
"if",
"necessary",
"create",
"and",
"cache",
"it",
"."
] | def GetWithCache(filename, frame_maker, expires_after):
filepath = os.path.join(CACHE_DIR, filename)
try:
timestamp = os.path.getmtime(filepath)
last_modified = datetime.datetime.utcfromtimestamp(timestamp)
expired = datetime.datetime.utcnow() > last_modified + expires_after
except OSError:
expi... | [
"def",
"GetWithCache",
"(",
"filename",
",",
"frame_maker",
",",
"expires_after",
")",
":",
"filepath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"CACHE_DIR",
",",
"filename",
")",
"try",
":",
"timestamp",
"=",
"os",
".",
"path",
".",
"getmtime",
"(",
... | Get a data frame from cache or, if necessary, create and cache it. | [
"Get",
"a",
"data",
"frame",
"from",
"cache",
"or",
"if",
"necessary",
"create",
"and",
"cache",
"it",
"."
] | [
"\"\"\"Get a data frame from cache or, if necessary, create and cache it.\n\n Args:\n filename: The name of a file for the cached copy of the data frame,\n it will be stored in the CACHE_DIR.\n frame_maker: A function that takes no arguments and returns a data frame,\n only called to create the dat... | [
{
"param": "filename",
"type": null
},
{
"param": "frame_maker",
"type": null
},
{
"param": "expires_after",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": "The name of a file for the cached copy of the data frame,\nit will be stored in the CACHE_DIR.",
"docstring_tokens": [
"The",
"name",
"of",
"a",
"f... |
079011e97da6132fb124e73e48379f22cd250138 | sunlongbo/chromium | tools/perf/cli_tools/soundwave/commands.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _IterStaleTestPaths | null | def _IterStaleTestPaths(con, test_paths):
"""Iterate over test_paths yielding only those with stale or absent data.
A test_path is considered to be stale if the most recent data point we have
for it in the db is more than a day older.
"""
a_day_ago = pandas.Timestamp.utcnow() - pandas.Timedelta(days=1)
a_d... | Iterate over test_paths yielding only those with stale or absent data.
A test_path is considered to be stale if the most recent data point we have
for it in the db is more than a day older.
| Iterate over test_paths yielding only those with stale or absent data.
A test_path is considered to be stale if the most recent data point we have
for it in the db is more than a day older. | [
"Iterate",
"over",
"test_paths",
"yielding",
"only",
"those",
"with",
"stale",
"or",
"absent",
"data",
".",
"A",
"test_path",
"is",
"considered",
"to",
"be",
"stale",
"if",
"the",
"most",
"recent",
"data",
"point",
"we",
"have",
"for",
"it",
"in",
"the",
... | def _IterStaleTestPaths(con, test_paths):
a_day_ago = pandas.Timestamp.utcnow() - pandas.Timedelta(days=1)
a_day_ago = a_day_ago.tz_convert(tz=None)
for test_path in test_paths:
latest = tables.timeseries.GetMostRecentPoint(con, test_path)
if latest is None or latest['timestamp'] < a_day_ago:
yield ... | [
"def",
"_IterStaleTestPaths",
"(",
"con",
",",
"test_paths",
")",
":",
"a_day_ago",
"=",
"pandas",
".",
"Timestamp",
".",
"utcnow",
"(",
")",
"-",
"pandas",
".",
"Timedelta",
"(",
"days",
"=",
"1",
")",
"a_day_ago",
"=",
"a_day_ago",
".",
"tz_convert",
"... | Iterate over test_paths yielding only those with stale or absent data. | [
"Iterate",
"over",
"test_paths",
"yielding",
"only",
"those",
"with",
"stale",
"or",
"absent",
"data",
"."
] | [
"\"\"\"Iterate over test_paths yielding only those with stale or absent data.\n\n A test_path is considered to be stale if the most recent data point we have\n for it in the db is more than a day older.\n \"\"\""
] | [
{
"param": "con",
"type": null
},
{
"param": "test_paths",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "con",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "test_paths",
"type": null,
"docstring": null,
"docstring_token... |
c1138a7d90a103190501d50fcf4feaec299660d8 | sunlongbo/chromium | tools/perf/page_sets/login_helpers/facebook_login.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | LoginWithMobileSite | null | def LoginWithMobileSite(
action_runner,
credential='facebooktest', # Recommended testing account.
credentials_path=login_utils.DEFAULT_CREDENTIAL_PATH):
"""Logs in into mobile Facebook account.
This function navigates the tab into Facebook's login page and logs in a user
using credentials in |credent... | Logs in into mobile Facebook account.
This function navigates the tab into Facebook's login page and logs in a user
using credentials in |credential| part of the |credentials_path| file.
Args:
action_runner: Action runner responsible for running actions on the page.
credential: The credential to retriev... | Logs in into mobile Facebook account.
This function navigates the tab into Facebook's login page and logs in a user
using credentials in |credential| part of the |credentials_path| file.
Action runner responsible for running actions on the page.
credential: The credential to retrieve from the credentials file
(type st... | [
"Logs",
"in",
"into",
"mobile",
"Facebook",
"account",
".",
"This",
"function",
"navigates",
"the",
"tab",
"into",
"Facebook",
"'",
"s",
"login",
"page",
"and",
"logs",
"in",
"a",
"user",
"using",
"credentials",
"in",
"|credential|",
"part",
"of",
"the",
"... | def LoginWithMobileSite(
action_runner,
credential='facebooktest',
credentials_path=login_utils.DEFAULT_CREDENTIAL_PATH):
account_name, password = login_utils.GetAccountNameAndPassword(
credential, credentials_path=credentials_path)
action_runner.Navigate(
'https://m.facebook.com/login?con... | [
"def",
"LoginWithMobileSite",
"(",
"action_runner",
",",
"credential",
"=",
"'facebooktest'",
",",
"credentials_path",
"=",
"login_utils",
".",
"DEFAULT_CREDENTIAL_PATH",
")",
":",
"account_name",
",",
"password",
"=",
"login_utils",
".",
"GetAccountNameAndPassword",
"(... | Logs in into mobile Facebook account. | [
"Logs",
"in",
"into",
"mobile",
"Facebook",
"account",
"."
] | [
"# Recommended testing account.",
"\"\"\"Logs in into mobile Facebook account.\n\n This function navigates the tab into Facebook's login page and logs in a user\n using credentials in |credential| part of the |credentials_path| file.\n\n Args:\n action_runner: Action runner responsible for running actions o... | [
{
"param": "action_runner",
"type": null
},
{
"param": "credential",
"type": null
},
{
"param": "credentials_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "action_runner",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "credential",
"type": null,
"docstring": null,
"docst... |
c137187eb1055ac76d5fe6a3ddb4bbee1f5d8505 | sunlongbo/chromium | tools/perf/metrics/__init__.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AddResults | null | def AddResults(self, tab, results):
"""Add the data collected into the results object for a measurement.
Metrics may implement AddResults to provide a common way to add results
to the PageTestResults in PageTest.ValidateOrMeasurePage --
results should be added with results.AddMeasurement(...).
"""
... | Add the data collected into the results object for a measurement.
Metrics may implement AddResults to provide a common way to add results
to the PageTestResults in PageTest.ValidateOrMeasurePage --
results should be added with results.AddMeasurement(...).
| Add the data collected into the results object for a measurement.
Metrics may implement AddResults to provide a common way to add results
to the PageTestResults in PageTest.ValidateOrMeasurePage
results should be added with results.AddMeasurement(...). | [
"Add",
"the",
"data",
"collected",
"into",
"the",
"results",
"object",
"for",
"a",
"measurement",
".",
"Metrics",
"may",
"implement",
"AddResults",
"to",
"provide",
"a",
"common",
"way",
"to",
"add",
"results",
"to",
"the",
"PageTestResults",
"in",
"PageTest",... | def AddResults(self, tab, results):
raise NotImplementedError() | [
"def",
"AddResults",
"(",
"self",
",",
"tab",
",",
"results",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | Add the data collected into the results object for a measurement. | [
"Add",
"the",
"data",
"collected",
"into",
"the",
"results",
"object",
"for",
"a",
"measurement",
"."
] | [
"\"\"\"Add the data collected into the results object for a measurement.\n\n Metrics may implement AddResults to provide a common way to add results\n to the PageTestResults in PageTest.ValidateOrMeasurePage --\n results should be added with results.AddMeasurement(...).\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tab",
"type": null
},
{
"param": "results",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tab",
"type": null,
"docstring": null,
"docstring_tokens": []... |
bfeb9e4a3776e1451f052b267fa4b5cc3c59fbd3 | sunlongbo/chromium | tools/binary_size/libsupersize/ar.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ExpandThinArchives | <not_specific> | def ExpandThinArchives(paths, output_directory):
"""Expands all thin archives found in |paths| into .o paths.
Args:
paths: List of paths relative to |output_directory|.
output_directory: Output directory.
Returns:
* A new list of paths with all thin archives replaced by .o paths.
* A set of all ... | Expands all thin archives found in |paths| into .o paths.
Args:
paths: List of paths relative to |output_directory|.
output_directory: Output directory.
Returns:
* A new list of paths with all thin archives replaced by .o paths.
* A set of all .a paths that were thin archives.
| Expands all thin archives found in |paths| into .o paths. | [
"Expands",
"all",
"thin",
"archives",
"found",
"in",
"|paths|",
"into",
".",
"o",
"paths",
"."
] | def ExpandThinArchives(paths, output_directory):
expanded_paths = []
thin_paths = set()
num_archives = 0
for path in paths:
if not path.endswith('.a'):
expanded_paths.append(path)
continue
num_archives += 1
abs_path = os.path.join(output_directory, path)
if not IsThinArchive(abs_path... | [
"def",
"ExpandThinArchives",
"(",
"paths",
",",
"output_directory",
")",
":",
"expanded_paths",
"=",
"[",
"]",
"thin_paths",
"=",
"set",
"(",
")",
"num_archives",
"=",
"0",
"for",
"path",
"in",
"paths",
":",
"if",
"not",
"path",
".",
"endswith",
"(",
"'.... | Expands all thin archives found in |paths| into .o paths. | [
"Expands",
"all",
"thin",
"archives",
"found",
"in",
"|paths|",
"into",
".",
"o",
"paths",
"."
] | [
"\"\"\"Expands all thin archives found in |paths| into .o paths.\n\n Args:\n paths: List of paths relative to |output_directory|.\n output_directory: Output directory.\n\n Returns:\n * A new list of paths with all thin archives replaced by .o paths.\n * A set of all .a paths that were thin archives.\n... | [
{
"param": "paths",
"type": null
},
{
"param": "output_directory",
"type": null
}
] | {
"returns": [
{
"docstring": "A new list of paths with all thin archives replaced by .o paths.\nA set of all .a paths that were thin archives.",
"docstring_tokens": [
"A",
"new",
"list",
"of",
"paths",
"with",
"all",
"thin",
"arc... |
16b76a357ea4b3560a2d8ca8cb8d3e1a49f2044d | sunlongbo/chromium | tools/mac/power/benchmark.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SignalHandler | null | def SignalHandler(sig, frame, driver):
"""Handle the run being aborted.
"""
driver.Teardown()
sys.exit(0) | Handle the run being aborted.
| Handle the run being aborted. | [
"Handle",
"the",
"run",
"being",
"aborted",
"."
] | def SignalHandler(sig, frame, driver):
driver.Teardown()
sys.exit(0) | [
"def",
"SignalHandler",
"(",
"sig",
",",
"frame",
",",
"driver",
")",
":",
"driver",
".",
"Teardown",
"(",
")",
"sys",
".",
"exit",
"(",
"0",
")"
] | Handle the run being aborted. | [
"Handle",
"the",
"run",
"being",
"aborted",
"."
] | [
"\"\"\"Handle the run being aborted.\n \"\"\""
] | [
{
"param": "sig",
"type": null
},
{
"param": "frame",
"type": null
},
{
"param": "driver",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sig",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "frame",
"type": null,
"docstring": null,
"docstring_tokens": [... |
16dc87adf7679b67981671bc584b811f23761090 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/net/file_uploader.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _encode_multipart_form_data | <not_specific> | def _encode_multipart_form_data(fields, files):
"""Encode form fields for multipart/form-data.
Args:
fields: A sequence of (name, value) elements for regular form fields.
files: A sequence of (name, filename, value) elements for data to be
uploaded as files.
Returns:
(content... | Encode form fields for multipart/form-data.
Args:
fields: A sequence of (name, value) elements for regular form fields.
files: A sequence of (name, filename, value) elements for data to be
uploaded as files.
Returns:
(content_type, body) ready for httplib.HTTP instance.
Sour... | Encode form fields for multipart/form-data. | [
"Encode",
"form",
"fields",
"for",
"multipart",
"/",
"form",
"-",
"data",
"."
] | def _encode_multipart_form_data(fields, files):
BOUNDARY = '-M-A-G-I-C---B-O-U-N-D-A-R-Y-'
CRLF = '\r\n'
lines = []
for key, value in fields:
lines.append('--' + BOUNDARY)
lines.append('Content-Disposition: form-data; name="%s"' % key)
lines.append('')
if isinstance(value... | [
"def",
"_encode_multipart_form_data",
"(",
"fields",
",",
"files",
")",
":",
"BOUNDARY",
"=",
"'-M-A-G-I-C---B-O-U-N-D-A-R-Y-'",
"CRLF",
"=",
"'\\r\\n'",
"lines",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"fields",
":",
"lines",
".",
"append",
"(",
"'... | Encode form fields for multipart/form-data. | [
"Encode",
"form",
"fields",
"for",
"multipart",
"/",
"form",
"-",
"data",
"."
] | [
"\"\"\"Encode form fields for multipart/form-data.\n\n Args:\n fields: A sequence of (name, value) elements for regular form fields.\n files: A sequence of (name, filename, value) elements for data to be\n uploaded as files.\n Returns:\n (content_type, body) ready for httplib.HTTP i... | [
{
"param": "fields",
"type": null
},
{
"param": "files",
"type": null
}
] | {
"returns": [
{
"docstring": "(content_type, body) ready for httplib.HTTP instance.",
"docstring_tokens": [
"(",
"content_type",
"body",
")",
"ready",
"for",
"httplib",
".",
"HTTP",
"instance",
"."
],
... |
9d2b86d9e3a7f8480890e384eca46c95e9bfdd05 | sunlongbo/chromium | components/policy/tools/template_writers/writers/adm_writer_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CompareOutputs | null | def CompareOutputs(self, output, expected_output):
'''Compares the output of the adm_writer with its expected output.
Args:
output: The output of the adm writer.
expected_output: The expected output.
Raises:
AssertionError: if the two strings are not equivalent.
'''
self.assertEq... | Compares the output of the adm_writer with its expected output.
Args:
output: The output of the adm writer.
expected_output: The expected output.
Raises:
AssertionError: if the two strings are not equivalent.
| Compares the output of the adm_writer with its expected output. | [
"Compares",
"the",
"output",
"of",
"the",
"adm_writer",
"with",
"its",
"expected",
"output",
"."
] | def CompareOutputs(self, output, expected_output):
self.assertEquals(output.strip(),
expected_output.strip().replace('\n', '\r\n')) | [
"def",
"CompareOutputs",
"(",
"self",
",",
"output",
",",
"expected_output",
")",
":",
"self",
".",
"assertEquals",
"(",
"output",
".",
"strip",
"(",
")",
",",
"expected_output",
".",
"strip",
"(",
")",
".",
"replace",
"(",
"'\\n'",
",",
"'\\r\\n'",
")",... | Compares the output of the adm_writer with its expected output. | [
"Compares",
"the",
"output",
"of",
"the",
"adm_writer",
"with",
"its",
"expected",
"output",
"."
] | [
"'''Compares the output of the adm_writer with its expected output.\n\n Args:\n output: The output of the adm writer.\n expected_output: The expected output.\n\n Raises:\n AssertionError: if the two strings are not equivalent.\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "output",
"type": null
},
{
"param": "expected_output",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "if the two strings are not equivalent.",
"docstring_tokens": [
"if",
"the",
"two",
"strings",
"are",
"not",
"equivalent",
"."
],
"type": "AssertionError"
}
],
"params": [
... |
98204bd8e5a257ceed01fadf082e292b8f0b5bbd | sunlongbo/chromium | components/breadcrumbs/core/generate_not_user_triggered_actions.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | not_user_triggered_actions | null | def not_user_triggered_actions(actions_file_path):
"""Generates list of not-user triggered and non-obsolete UMA User Actions.
Args:
actions_file_path: path to actions.xml file
"""
actions = ElementTree.parse(actions_file_path).getroot()
for action in actions:
if action.find('obsole... | Generates list of not-user triggered and non-obsolete UMA User Actions.
Args:
actions_file_path: path to actions.xml file
| Generates list of not-user triggered and non-obsolete UMA User Actions. | [
"Generates",
"list",
"of",
"not",
"-",
"user",
"triggered",
"and",
"non",
"-",
"obsolete",
"UMA",
"User",
"Actions",
"."
] | def not_user_triggered_actions(actions_file_path):
actions = ElementTree.parse(actions_file_path).getroot()
for action in actions:
if action.find('obsolete') is not None:
continue
if action.attrib.get('not_user_triggered') == 'true':
yield action.attrib['name'] | [
"def",
"not_user_triggered_actions",
"(",
"actions_file_path",
")",
":",
"actions",
"=",
"ElementTree",
".",
"parse",
"(",
"actions_file_path",
")",
".",
"getroot",
"(",
")",
"for",
"action",
"in",
"actions",
":",
"if",
"action",
".",
"find",
"(",
"'obsolete'"... | Generates list of not-user triggered and non-obsolete UMA User Actions. | [
"Generates",
"list",
"of",
"not",
"-",
"user",
"triggered",
"and",
"non",
"-",
"obsolete",
"UMA",
"User",
"Actions",
"."
] | [
"\"\"\"Generates list of not-user triggered and non-obsolete UMA User Actions.\n\n Args:\n actions_file_path: path to actions.xml file\n \"\"\""
] | [
{
"param": "actions_file_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "actions_file_path",
"type": null,
"docstring": "path to actions.xml file",
"docstring_tokens": [
"path",
"to",
"actions",
".",
"xml",
"file"
],
"default": null,
... |
98204bd8e5a257ceed01fadf082e292b8f0b5bbd | sunlongbo/chromium | components/breadcrumbs/core/generate_not_user_triggered_actions.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | main | <not_specific> | def main(actions_file_path, output_file_path):
"""Produces C++ file with sorted array of UMA User Actions strings.
Array is a global kNotUserTriggeredActions constant in anonymous namespace.
Args:
actions_file_path: path to actions.xml file
output_file_path: path to output C++ file
"""... | Produces C++ file with sorted array of UMA User Actions strings.
Array is a global kNotUserTriggeredActions constant in anonymous namespace.
Args:
actions_file_path: path to actions.xml file
output_file_path: path to output C++ file
| Produces C++ file with sorted array of UMA User Actions strings.
Array is a global kNotUserTriggeredActions constant in anonymous namespace. | [
"Produces",
"C",
"++",
"file",
"with",
"sorted",
"array",
"of",
"UMA",
"User",
"Actions",
"strings",
".",
"Array",
"is",
"a",
"global",
"kNotUserTriggeredActions",
"constant",
"in",
"anonymous",
"namespace",
"."
] | def main(actions_file_path, output_file_path):
actions = not_user_triggered_actions(actions_file_path)
if not actions:
sys.stderr.write(
'There are no not-user triggered and non-obsolete in %s',
actions_file_path)
return -1
with open(output_file_path ,'w') as output_f... | [
"def",
"main",
"(",
"actions_file_path",
",",
"output_file_path",
")",
":",
"actions",
"=",
"not_user_triggered_actions",
"(",
"actions_file_path",
")",
"if",
"not",
"actions",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"'There are no not-user triggered and non-obs... | Produces C++ file with sorted array of UMA User Actions strings. | [
"Produces",
"C",
"++",
"file",
"with",
"sorted",
"array",
"of",
"UMA",
"User",
"Actions",
"strings",
"."
] | [
"\"\"\"Produces C++ file with sorted array of UMA User Actions strings.\n\n Array is a global kNotUserTriggeredActions constant in anonymous namespace.\n\n Args:\n actions_file_path: path to actions.xml file\n output_file_path: path to output C++ file\n \"\"\""
] | [
{
"param": "actions_file_path",
"type": null
},
{
"param": "output_file_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "actions_file_path",
"type": null,
"docstring": "path to actions.xml file",
"docstring_tokens": [
"path",
"to",
"actions",
".",
"xml",
"file"
],
"default": null,
... |
6bc0394cc9110e913cfdb63abc6360514875d7d1 | sunlongbo/chromium | tools/cygprofile/cluster.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ClusterToList | <not_specific> | def ClusterToList(self, size_map=None):
"""Merge the clusters with the smallest distances.
Args:
size_map ({symbol: size} or None): Map symbol names to their size. Cluster
growth will be stopped at MAX_CLUSTER_SIZE. If None, sizes are taken to
be zero and cluster growth is not stopped.
... | Merge the clusters with the smallest distances.
Args:
size_map ({symbol: size} or None): Map symbol names to their size. Cluster
growth will be stopped at MAX_CLUSTER_SIZE. If None, sizes are taken to
be zero and cluster growth is not stopped.
Returns:
An ordered list of symbols fr... | Merge the clusters with the smallest distances. | [
"Merge",
"the",
"clusters",
"with",
"the",
"smallest",
"distances",
"."
] | def ClusterToList(self, size_map=None):
if size_map:
self._symbol_size = lambda s: size_map[s]
if not self._num_lists or not self._neighbors:
return []
logging.info('Sorting %s neighbors', len(self._neighbors))
self._neighbors.sort(key=lambda n: (-n.dist, n.src, n.dst))
logging.info('Clu... | [
"def",
"ClusterToList",
"(",
"self",
",",
"size_map",
"=",
"None",
")",
":",
"if",
"size_map",
":",
"self",
".",
"_symbol_size",
"=",
"lambda",
"s",
":",
"size_map",
"[",
"s",
"]",
"if",
"not",
"self",
".",
"_num_lists",
"or",
"not",
"self",
".",
"_n... | Merge the clusters with the smallest distances. | [
"Merge",
"the",
"clusters",
"with",
"the",
"smallest",
"distances",
"."
] | [
"\"\"\"Merge the clusters with the smallest distances.\n\n Args:\n size_map ({symbol: size} or None): Map symbol names to their size. Cluster\n growth will be stopped at MAX_CLUSTER_SIZE. If None, sizes are taken to\n be zero and cluster growth is not stopped.\n\n Returns:\n An ordered... | [
{
"param": "self",
"type": null
},
{
"param": "size_map",
"type": null
}
] | {
"returns": [
{
"docstring": "An ordered list of symbols from AddSymbolLists, appropriately clustered.",
"docstring_tokens": [
"An",
"ordered",
"list",
"of",
"symbols",
"from",
"AddSymbolLists",
"appropriately",
"clustered",
... |
6bc0394cc9110e913cfdb63abc6360514875d7d1 | sunlongbo/chromium | tools/cygprofile/cluster.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetSymbolsCallGraph | <not_specific> | def _GetSymbolsCallGraph(profiles, processor):
"""Maps each offset in the call graph to the corresponding symbol name.
Args:
profiles (ProfileManager) Manager of the profile dump files.
processor (SymbolOffsetProcessor) Symbol table processor for the dumps.
Returns:
A dict that maps each process typ... | Maps each offset in the call graph to the corresponding symbol name.
Args:
profiles (ProfileManager) Manager of the profile dump files.
processor (SymbolOffsetProcessor) Symbol table processor for the dumps.
Returns:
A dict that maps each process type (ex: browser, renderer, etc.) to a list
of pro... | Maps each offset in the call graph to the corresponding symbol name.
Args:
profiles (ProfileManager) Manager of the profile dump files.
processor (SymbolOffsetProcessor) Symbol table processor for the dumps.
A dict that maps each process type (ex: browser, renderer, etc.) to a list
of processes of that type. Each proc... | [
"Maps",
"each",
"offset",
"in",
"the",
"call",
"graph",
"to",
"the",
"corresponding",
"symbol",
"name",
".",
"Args",
":",
"profiles",
"(",
"ProfileManager",
")",
"Manager",
"of",
"the",
"profile",
"dump",
"files",
".",
"processor",
"(",
"SymbolOffsetProcessor"... | def _GetSymbolsCallGraph(profiles, processor):
offsets_graph = profiles.GetProcessOffsetGraph();
process_symbols_graph = collections.defaultdict(list)
for process_type in offsets_graph:
for process in offsets_graph[process_type]:
process = sorted(process, key=lambda k: int(k['index']))
graph_list ... | [
"def",
"_GetSymbolsCallGraph",
"(",
"profiles",
",",
"processor",
")",
":",
"offsets_graph",
"=",
"profiles",
".",
"GetProcessOffsetGraph",
"(",
")",
";",
"process_symbols_graph",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"process_type",
"in... | Maps each offset in the call graph to the corresponding symbol name. | [
"Maps",
"each",
"offset",
"in",
"the",
"call",
"graph",
"to",
"the",
"corresponding",
"symbol",
"name",
"."
] | [
"\"\"\"Maps each offset in the call graph to the corresponding symbol name.\n\n Args:\n profiles (ProfileManager) Manager of the profile dump files.\n processor (SymbolOffsetProcessor) Symbol table processor for the dumps.\n\n Returns:\n A dict that maps each process type (ex: browser, renderer, etc.) to... | [
{
"param": "profiles",
"type": null
},
{
"param": "processor",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "profiles",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "processor",
"type": null,
"docstring": null,
"docstring_t... |
6bc0394cc9110e913cfdb63abc6360514875d7d1 | sunlongbo/chromium | tools/cygprofile/cluster.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ClusterOffsets | <not_specific> | def ClusterOffsets(profiles, processor, limit_cluster_size=False,
call_graph=False):
"""Cluster profile offsets.
Args:
profiles (ProfileManager) Manager of the profile dump files.
processor (SymbolOffsetProcessor) Symbol table processor for the dumps.
call_graph (bool) whether the ca... | Cluster profile offsets.
Args:
profiles (ProfileManager) Manager of the profile dump files.
processor (SymbolOffsetProcessor) Symbol table processor for the dumps.
call_graph (bool) whether the call graph instrumentation was used.
Returns:
A list of clustered symbol offsets.
| Cluster profile offsets.
Args:
profiles (ProfileManager) Manager of the profile dump files.
processor (SymbolOffsetProcessor) Symbol table processor for the dumps.
call_graph (bool) whether the call graph instrumentation was used.
A list of clustered symbol offsets. | [
"Cluster",
"profile",
"offsets",
".",
"Args",
":",
"profiles",
"(",
"ProfileManager",
")",
"Manager",
"of",
"the",
"profile",
"dump",
"files",
".",
"processor",
"(",
"SymbolOffsetProcessor",
")",
"Symbol",
"table",
"processor",
"for",
"the",
"dumps",
".",
"cal... | def ClusterOffsets(profiles, processor, limit_cluster_size=False,
call_graph=False):
if not call_graph:
return _ClusterOffsetsLists(profiles, processor, limit_cluster_size)
else:
return _ClusterOffsetsFromCallGraph(profiles, processor) | [
"def",
"ClusterOffsets",
"(",
"profiles",
",",
"processor",
",",
"limit_cluster_size",
"=",
"False",
",",
"call_graph",
"=",
"False",
")",
":",
"if",
"not",
"call_graph",
":",
"return",
"_ClusterOffsetsLists",
"(",
"profiles",
",",
"processor",
",",
"limit_clust... | Cluster profile offsets. | [
"Cluster",
"profile",
"offsets",
"."
] | [
"\"\"\"Cluster profile offsets.\n\n Args:\n profiles (ProfileManager) Manager of the profile dump files.\n processor (SymbolOffsetProcessor) Symbol table processor for the dumps.\n call_graph (bool) whether the call graph instrumentation was used.\n\n Returns:\n A list of clustered symbol offsets.\n\"... | [
{
"param": "profiles",
"type": null
},
{
"param": "processor",
"type": null
},
{
"param": "limit_cluster_size",
"type": null
},
{
"param": "call_graph",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "profiles",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "processor",
"type": null,
"docstring": null,
"docstring_t... |
f3b92e405440b7532510a7ba24abef9987e10f58 | sunlongbo/chromium | tools/json_schema_compiler/idl_schema.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ProcessComment | <not_specific> | def ProcessComment(comment):
'''
Convert a comment into a parent comment and a list of parameter comments.
Function comments are of the form:
Function documentation. May contain HTML and multiple lines.
|arg1_name|: Description of arg1. Use <var>argument</var> to refer
to other arguments.
|arg2_... |
Convert a comment into a parent comment and a list of parameter comments.
Function comments are of the form:
Function documentation. May contain HTML and multiple lines.
|arg1_name|: Description of arg1. Use <var>argument</var> to refer
to other arguments.
|arg2_name|: Description of arg2...
N... | Convert a comment into a parent comment and a list of parameter comments.
Function comments are of the form:
Function documentation. May contain HTML and multiple lines.
|arg1_name|: Description of arg1. Use argument to refer
to other arguments.
|arg2_name|: Description of arg2
Newlines are removed, and leading and t... | [
"Convert",
"a",
"comment",
"into",
"a",
"parent",
"comment",
"and",
"a",
"list",
"of",
"parameter",
"comments",
".",
"Function",
"comments",
"are",
"of",
"the",
"form",
":",
"Function",
"documentation",
".",
"May",
"contain",
"HTML",
"and",
"multiple",
"line... | def ProcessComment(comment):
jsexterns = None
match = re.search('<jsexterns>(.*)</jsexterns>', comment, re.DOTALL)
if match:
jsexterns = match.group(1).strip()
comment = comment[:match.start()] + comment[match.end():]
def add_paragraphs(content):
paragraphs = content.split('\n\n')
if len(paragra... | [
"def",
"ProcessComment",
"(",
"comment",
")",
":",
"jsexterns",
"=",
"None",
"match",
"=",
"re",
".",
"search",
"(",
"'<jsexterns>(.*)</jsexterns>'",
",",
"comment",
",",
"re",
".",
"DOTALL",
")",
"if",
"match",
":",
"jsexterns",
"=",
"match",
".",
"group"... | Convert a comment into a parent comment and a list of parameter comments. | [
"Convert",
"a",
"comment",
"into",
"a",
"parent",
"comment",
"and",
"a",
"list",
"of",
"parameter",
"comments",
"."
] | [
"'''\n Convert a comment into a parent comment and a list of parameter comments.\n\n Function comments are of the form:\n Function documentation. May contain HTML and multiple lines.\n\n |arg1_name|: Description of arg1. Use <var>argument</var> to refer\n to other arguments.\n |arg2_name|: Description... | [
{
"param": "comment",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "comment",
"type": null,
"docstring": "The string from a Comment node.",
"docstring_tokens": [
"The",
"string",
"from",
"a",
"Comment",
"node",
"."
],
"default... |
f3b92e405440b7532510a7ba24abef9987e10f58 | sunlongbo/chromium | tools/json_schema_compiler/idl_schema.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | cast_from_json_type | <not_specific> | def cast_from_json_type(self, json_type, string_value):
'''Casts from string |string_value| to a real Python type based on a JSON
Schema type |json_type|. For example, a string value of '42' and a JSON
Schema type 'integer' will cast to int('42') ==> 42.
'''
if json_type == 'integer':
return i... | Casts from string |string_value| to a real Python type based on a JSON
Schema type |json_type|. For example, a string value of '42' and a JSON
Schema type 'integer' will cast to int('42') ==> 42.
| Casts from string |string_value| to a real Python type based on a JSON
Schema type |json_type|. | [
"Casts",
"from",
"string",
"|string_value|",
"to",
"a",
"real",
"Python",
"type",
"based",
"on",
"a",
"JSON",
"Schema",
"type",
"|json_type|",
"."
] | def cast_from_json_type(self, json_type, string_value):
if json_type == 'integer':
return int(string_value)
if json_type == 'number':
return float(string_value)
assert json_type == 'string', (
'No rule exists to cast JSON Schema type "%s" to its equivalent '
'Python type fo... | [
"def",
"cast_from_json_type",
"(",
"self",
",",
"json_type",
",",
"string_value",
")",
":",
"if",
"json_type",
"==",
"'integer'",
":",
"return",
"int",
"(",
"string_value",
")",
"if",
"json_type",
"==",
"'number'",
":",
"return",
"float",
"(",
"string_value",
... | Casts from string |string_value| to a real Python type based on a JSON
Schema type |json_type|. | [
"Casts",
"from",
"string",
"|string_value|",
"to",
"a",
"real",
"Python",
"type",
"based",
"on",
"a",
"JSON",
"Schema",
"type",
"|json_type|",
"."
] | [
"'''Casts from string |string_value| to a real Python type based on a JSON\n Schema type |json_type|. For example, a string value of '42' and a JSON\n Schema type 'integer' will cast to int('42') ==> 42.\n '''",
"# Add more as necessary."
] | [
{
"param": "self",
"type": null
},
{
"param": "json_type",
"type": null
},
{
"param": "string_value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "json_type",
"type": null,
"docstring": null,
"docstring_token... |
f3b92e405440b7532510a7ba24abef9987e10f58 | sunlongbo/chromium | tools/json_schema_compiler/idl_schema.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Load | <not_specific> | def Load(filename):
'''
Given the filename of an IDL file, parses it and returns an equivalent
Python dictionary in a format that the JSON schema compiler expects to see.
'''
with open(filename, 'rb') as handle:
contents = handle.read().decode('utf-8')
return Process(contents, filename) |
Given the filename of an IDL file, parses it and returns an equivalent
Python dictionary in a format that the JSON schema compiler expects to see.
| Given the filename of an IDL file, parses it and returns an equivalent
Python dictionary in a format that the JSON schema compiler expects to see. | [
"Given",
"the",
"filename",
"of",
"an",
"IDL",
"file",
"parses",
"it",
"and",
"returns",
"an",
"equivalent",
"Python",
"dictionary",
"in",
"a",
"format",
"that",
"the",
"JSON",
"schema",
"compiler",
"expects",
"to",
"see",
"."
] | def Load(filename):
with open(filename, 'rb') as handle:
contents = handle.read().decode('utf-8')
return Process(contents, filename) | [
"def",
"Load",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'rb'",
")",
"as",
"handle",
":",
"contents",
"=",
"handle",
".",
"read",
"(",
")",
".",
"decode",
"(",
"'utf-8'",
")",
"return",
"Process",
"(",
"contents",
",",
"filena... | Given the filename of an IDL file, parses it and returns an equivalent
Python dictionary in a format that the JSON schema compiler expects to see. | [
"Given",
"the",
"filename",
"of",
"an",
"IDL",
"file",
"parses",
"it",
"and",
"returns",
"an",
"equivalent",
"Python",
"dictionary",
"in",
"a",
"format",
"that",
"the",
"JSON",
"schema",
"compiler",
"expects",
"to",
"see",
"."
] | [
"'''\n Given the filename of an IDL file, parses it and returns an equivalent\n Python dictionary in a format that the JSON schema compiler expects to see.\n '''"
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f3b92e405440b7532510a7ba24abef9987e10f58 | sunlongbo/chromium | tools/json_schema_compiler/idl_schema.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Process | <not_specific> | def Process(contents, filename):
'''
Processes the contents of a file and returns an equivalent Python dictionary
in a format that the JSON schema compiler expects to see. (Separate from
Load primarily for testing purposes.)
'''
idl = idl_parser.IDLParser().ParseData(contents, filename)
idl_schema = IDLS... |
Processes the contents of a file and returns an equivalent Python dictionary
in a format that the JSON schema compiler expects to see. (Separate from
Load primarily for testing purposes.)
| Processes the contents of a file and returns an equivalent Python dictionary
in a format that the JSON schema compiler expects to see. (Separate from
Load primarily for testing purposes.) | [
"Processes",
"the",
"contents",
"of",
"a",
"file",
"and",
"returns",
"an",
"equivalent",
"Python",
"dictionary",
"in",
"a",
"format",
"that",
"the",
"JSON",
"schema",
"compiler",
"expects",
"to",
"see",
".",
"(",
"Separate",
"from",
"Load",
"primarily",
"for... | def Process(contents, filename):
idl = idl_parser.IDLParser().ParseData(contents, filename)
idl_schema = IDLSchema(idl)
return idl_schema.process() | [
"def",
"Process",
"(",
"contents",
",",
"filename",
")",
":",
"idl",
"=",
"idl_parser",
".",
"IDLParser",
"(",
")",
".",
"ParseData",
"(",
"contents",
",",
"filename",
")",
"idl_schema",
"=",
"IDLSchema",
"(",
"idl",
")",
"return",
"idl_schema",
".",
"pr... | Processes the contents of a file and returns an equivalent Python dictionary
in a format that the JSON schema compiler expects to see. | [
"Processes",
"the",
"contents",
"of",
"a",
"file",
"and",
"returns",
"an",
"equivalent",
"Python",
"dictionary",
"in",
"a",
"format",
"that",
"the",
"JSON",
"schema",
"compiler",
"expects",
"to",
"see",
"."
] | [
"'''\n Processes the contents of a file and returns an equivalent Python dictionary\n in a format that the JSON schema compiler expects to see. (Separate from\n Load primarily for testing purposes.)\n '''"
] | [
{
"param": "contents",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "contents",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_to... |
f3b92e405440b7532510a7ba24abef9987e10f58 | sunlongbo/chromium | tools/json_schema_compiler/idl_schema.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Main | null | def Main():
'''
Dump a json serialization of parse result for the IDL files whose names
were passed in on the command line.
'''
if len(sys.argv) > 1:
for filename in sys.argv[1:]:
schema = Load(filename)
print(json.dumps(schema, indent=2))
else:
contents = sys.stdin.read()
idl = idl_... |
Dump a json serialization of parse result for the IDL files whose names
were passed in on the command line.
| Dump a json serialization of parse result for the IDL files whose names
were passed in on the command line. | [
"Dump",
"a",
"json",
"serialization",
"of",
"parse",
"result",
"for",
"the",
"IDL",
"files",
"whose",
"names",
"were",
"passed",
"in",
"on",
"the",
"command",
"line",
"."
] | def Main():
if len(sys.argv) > 1:
for filename in sys.argv[1:]:
schema = Load(filename)
print(json.dumps(schema, indent=2))
else:
contents = sys.stdin.read()
idl = idl_parser.IDLParser().ParseData(contents, '<stdin>')
schema = IDLSchema(idl).process()
print(json.dumps(schema, indent=... | [
"def",
"Main",
"(",
")",
":",
"if",
"len",
"(",
"sys",
".",
"argv",
")",
">",
"1",
":",
"for",
"filename",
"in",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
":",
"schema",
"=",
"Load",
"(",
"filename",
")",
"print",
"(",
"json",
".",
"dumps",
"("... | Dump a json serialization of parse result for the IDL files whose names
were passed in on the command line. | [
"Dump",
"a",
"json",
"serialization",
"of",
"parse",
"result",
"for",
"the",
"IDL",
"files",
"whose",
"names",
"were",
"passed",
"in",
"on",
"the",
"command",
"line",
"."
] | [
"'''\n Dump a json serialization of parse result for the IDL files whose names\n were passed in on the command line.\n '''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
f3beba8e7dc1aec502baf45d21f1e9b10aa5450c | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/literal_constant.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | idl_type | <not_specific> | def idl_type(self):
"""
Returns the type of the literal constant.
The types of the following literals are represented as follows.
- null: any?
- []: sequence<any>
- {}: object
- true / false: boolean
- INTEGER_NUMERICS: long
- FLOATING_POINTS: dou... |
Returns the type of the literal constant.
The types of the following literals are represented as follows.
- null: any?
- []: sequence<any>
- {}: object
- true / false: boolean
- INTEGER_NUMERICS: long
- FLOATING_POINTS: double
- STRING: DOMString... | Returns the type of the literal constant.
The types of the following literals are represented as follows.
null: any. | [
"Returns",
"the",
"type",
"of",
"the",
"literal",
"constant",
".",
"The",
"types",
"of",
"the",
"following",
"literals",
"are",
"represented",
"as",
"follows",
".",
"null",
":",
"any",
"."
] | def idl_type(self):
return self._idl_type | [
"def",
"idl_type",
"(",
"self",
")",
":",
"return",
"self",
".",
"_idl_type"
] | Returns the type of the literal constant. | [
"Returns",
"the",
"type",
"of",
"the",
"literal",
"constant",
"."
] | [
"\"\"\"\n Returns the type of the literal constant.\n\n The types of the following literals are represented as follows.\n - null: any?\n - []: sequence<any>\n - {}: object\n - true / false: boolean\n - INTEGER_NUMERICS: long\n - FLOATING_POINTS: double\n ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f3beba8e7dc1aec502baf45d21f1e9b10aa5450c | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/literal_constant.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | is_type_compatible_with | <not_specific> | def is_type_compatible_with(self, idl_type):
"""Returns True if |idl_type| can store this value."""
assert isinstance(idl_type, IdlType)
idl_type = idl_type.unwrap(nullable=False)
if idl_type.is_any:
return True
if self.idl_type.is_nullable:
return idl_... | Returns True if |idl_type| can store this value. | Returns True if |idl_type| can store this value. | [
"Returns",
"True",
"if",
"|idl_type|",
"can",
"store",
"this",
"value",
"."
] | def is_type_compatible_with(self, idl_type):
assert isinstance(idl_type, IdlType)
idl_type = idl_type.unwrap(nullable=False)
if idl_type.is_any:
return True
if self.idl_type.is_nullable:
return idl_type.does_include_nullable_type
idl_type = idl_type.unwrap... | [
"def",
"is_type_compatible_with",
"(",
"self",
",",
"idl_type",
")",
":",
"assert",
"isinstance",
"(",
"idl_type",
",",
"IdlType",
")",
"idl_type",
"=",
"idl_type",
".",
"unwrap",
"(",
"nullable",
"=",
"False",
")",
"if",
"idl_type",
".",
"is_any",
":",
"r... | Returns True if |idl_type| can store this value. | [
"Returns",
"True",
"if",
"|idl_type|",
"can",
"store",
"this",
"value",
"."
] | [
"\"\"\"Returns True if |idl_type| can store this value.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "idl_type",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "idl_type",
"type": null,
"docstring": null,
"docstring_tokens... |
a9cd1d61b86c0b4d125f2e743b34ad1afe6934e0 | sunlongbo/chromium | tools/binary_size/libsupersize/obj_analyzer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RunNm | null | def _RunNm(self, paths_by_type):
"""Calls nm to get symbols and (for non-BC files) string addresses."""
# Downstream functions rely upon .a not being grouped.
batches = self._MakeBatches(paths_by_type.arch, None)
# Combine object files and Bitcode files for nm.
BATCH_SIZE = 50 # Arbitrarily chosen.... | Calls nm to get symbols and (for non-BC files) string addresses. | Calls nm to get symbols and (for non-BC files) string addresses. | [
"Calls",
"nm",
"to",
"get",
"symbols",
"and",
"(",
"for",
"non",
"-",
"BC",
"files",
")",
"string",
"addresses",
"."
] | def _RunNm(self, paths_by_type):
batches = self._MakeBatches(paths_by_type.arch, None)
BATCH_SIZE = 50
batches.extend(
self._MakeBatches(paths_by_type.obj + paths_by_type.bc, BATCH_SIZE))
results = self._DoBulkFork(nm.RunNmOnIntermediates, batches)
all_paths_by_name = self._paths_by_name
... | [
"def",
"_RunNm",
"(",
"self",
",",
"paths_by_type",
")",
":",
"batches",
"=",
"self",
".",
"_MakeBatches",
"(",
"paths_by_type",
".",
"arch",
",",
"None",
")",
"BATCH_SIZE",
"=",
"50",
"batches",
".",
"extend",
"(",
"self",
".",
"_MakeBatches",
"(",
"pat... | Calls nm to get symbols and (for non-BC files) string addresses. | [
"Calls",
"nm",
"to",
"get",
"symbols",
"and",
"(",
"for",
"non",
"-",
"BC",
"files",
")",
"string",
"addresses",
"."
] | [
"\"\"\"Calls nm to get symbols and (for non-BC files) string addresses.\"\"\"",
"# Downstream functions rely upon .a not being grouped.",
"# Combine object files and Bitcode files for nm.",
"# Arbitrarily chosen.",
"# Names are still mangled."
] | [
{
"param": "self",
"type": null
},
{
"param": "paths_by_type",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "paths_by_type",
"type": null,
"docstring": null,
"docstring_t... |
a9cd1d61b86c0b4d125f2e743b34ad1afe6934e0 | sunlongbo/chromium | tools/binary_size/libsupersize/obj_analyzer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RunLlvmBcAnalyzer | null | def _RunLlvmBcAnalyzer(self, paths_by_type):
"""Calls llvm-bcanalyzer to extract string data (for LLD-LTO)."""
BATCH_SIZE = 50 # Arbitrarily chosen.
batches = self._MakeBatches(paths_by_type.bc, BATCH_SIZE)
results = self._DoBulkFork(
bcanalyzer.RunBcAnalyzerOnIntermediates, batches)
for en... | Calls llvm-bcanalyzer to extract string data (for LLD-LTO). | Calls llvm-bcanalyzer to extract string data (for LLD-LTO). | [
"Calls",
"llvm",
"-",
"bcanalyzer",
"to",
"extract",
"string",
"data",
"(",
"for",
"LLD",
"-",
"LTO",
")",
"."
] | def _RunLlvmBcAnalyzer(self, paths_by_type):
BATCH_SIZE = 50
batches = self._MakeBatches(paths_by_type.bc, BATCH_SIZE)
results = self._DoBulkFork(
bcanalyzer.RunBcAnalyzerOnIntermediates, batches)
for encoded_strs in results:
if encoded_strs != parallel.EMPTY_ENCODED_DICT:
self._... | [
"def",
"_RunLlvmBcAnalyzer",
"(",
"self",
",",
"paths_by_type",
")",
":",
"BATCH_SIZE",
"=",
"50",
"batches",
"=",
"self",
".",
"_MakeBatches",
"(",
"paths_by_type",
".",
"bc",
",",
"BATCH_SIZE",
")",
"results",
"=",
"self",
".",
"_DoBulkFork",
"(",
"bcanaly... | Calls llvm-bcanalyzer to extract string data (for LLD-LTO). | [
"Calls",
"llvm",
"-",
"bcanalyzer",
"to",
"extract",
"string",
"data",
"(",
"for",
"LLD",
"-",
"LTO",
")",
"."
] | [
"\"\"\"Calls llvm-bcanalyzer to extract string data (for LLD-LTO).\"\"\"",
"# Arbitrarily chosen."
] | [
{
"param": "self",
"type": null
},
{
"param": "paths_by_type",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "paths_by_type",
"type": null,
"docstring": null,
"docstring_t... |
ec9e9eeda7cb7b594a1936c3cc2130a0a4391c6c | sunlongbo/chromium | build/toolchain/win/setup_toolchain.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _LoadToolchainEnv | <not_specific> | def _LoadToolchainEnv(cpu, toolchain_root, sdk_dir, target_store):
"""Returns a dictionary with environment variables that must be set while
running binaries from the toolchain (e.g. INCLUDE and PATH for cl.exe)."""
# Check if we are running in the SDK command line environment and use
# the setup script from th... | Returns a dictionary with environment variables that must be set while
running binaries from the toolchain (e.g. INCLUDE and PATH for cl.exe). | Returns a dictionary with environment variables that must be set while
running binaries from the toolchain . | [
"Returns",
"a",
"dictionary",
"with",
"environment",
"variables",
"that",
"must",
"be",
"set",
"while",
"running",
"binaries",
"from",
"the",
"toolchain",
"."
] | def _LoadToolchainEnv(cpu, toolchain_root, sdk_dir, target_store):
assert cpu in ('x86', 'x64', 'arm', 'arm64')
if bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', 1))) and sdk_dir:
env = os.path.normpath(os.path.join(sdk_dir, 'bin/SetEnv.%s.json' % cpu))
env = json.load(open(env))['env']
if env['VS... | [
"def",
"_LoadToolchainEnv",
"(",
"cpu",
",",
"toolchain_root",
",",
"sdk_dir",
",",
"target_store",
")",
":",
"assert",
"cpu",
"in",
"(",
"'x86'",
",",
"'x64'",
",",
"'arm'",
",",
"'arm64'",
")",
"if",
"bool",
"(",
"int",
"(",
"os",
".",
"environ",
"."... | Returns a dictionary with environment variables that must be set while
running binaries from the toolchain (e.g. | [
"Returns",
"a",
"dictionary",
"with",
"environment",
"variables",
"that",
"must",
"be",
"set",
"while",
"running",
"binaries",
"from",
"the",
"toolchain",
"(",
"e",
".",
"g",
"."
] | [
"\"\"\"Returns a dictionary with environment variables that must be set while\n running binaries from the toolchain (e.g. INCLUDE and PATH for cl.exe).\"\"\"",
"# Check if we are running in the SDK command line environment and use",
"# the setup script from the SDK if so. |cpu| should be either",
"# 'x86' or... | [
{
"param": "cpu",
"type": null
},
{
"param": "toolchain_root",
"type": null
},
{
"param": "sdk_dir",
"type": null
},
{
"param": "target_store",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpu",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "toolchain_root",
"type": null,
"docstring": null,
"docstring_t... |
e40e65af6e63bd9cc9fcdd454ed0bd538fe8c749 | sunlongbo/chromium | tools/metrics/histograms/generate_expired_histograms_array.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetExpiredHistograms | <not_specific> | def _GetExpiredHistograms(histograms, base_date, current_milestone):
"""Filters histograms to find expired ones if date format is used.
Args:
histograms(Dict[str, Dict]): Histogram descriptions in the form
{name: content}.
base_date(datetime.date): A date to check expiry dates against.
Returns:
... | Filters histograms to find expired ones if date format is used.
Args:
histograms(Dict[str, Dict]): Histogram descriptions in the form
{name: content}.
base_date(datetime.date): A date to check expiry dates against.
Returns:
List of strings with names of expired histograms.
Raises:
Error i... | Filters histograms to find expired ones if date format is used.
Args:
histograms(Dict[str, Dict]): Histogram descriptions in the form
{name: content}.
base_date(datetime.date): A date to check expiry dates against.
List of strings with names of expired histograms.
Error if there is an expiry date that doesn't match e... | [
"Filters",
"histograms",
"to",
"find",
"expired",
"ones",
"if",
"date",
"format",
"is",
"used",
".",
"Args",
":",
"histograms",
"(",
"Dict",
"[",
"str",
"Dict",
"]",
")",
":",
"Histogram",
"descriptions",
"in",
"the",
"form",
"{",
"name",
":",
"content",... | def _GetExpiredHistograms(histograms, base_date, current_milestone):
expired_histograms_names = []
for name, content in histograms.items():
if "obsolete" in content or "expires_after" not in content:
continue
expiry_str = content["expires_after"]
if expiry_str == "never":
continue
match ... | [
"def",
"_GetExpiredHistograms",
"(",
"histograms",
",",
"base_date",
",",
"current_milestone",
")",
":",
"expired_histograms_names",
"=",
"[",
"]",
"for",
"name",
",",
"content",
"in",
"histograms",
".",
"items",
"(",
")",
":",
"if",
"\"obsolete\"",
"in",
"con... | Filters histograms to find expired ones if date format is used. | [
"Filters",
"histograms",
"to",
"find",
"expired",
"ones",
"if",
"date",
"format",
"is",
"used",
"."
] | [
"\"\"\"Filters histograms to find expired ones if date format is used.\n\n Args:\n histograms(Dict[str, Dict]): Histogram descriptions in the form\n {name: content}.\n base_date(datetime.date): A date to check expiry dates against.\n\n Returns:\n List of strings with names of expired histograms.\n\n... | [
{
"param": "histograms",
"type": null
},
{
"param": "base_date",
"type": null
},
{
"param": "current_milestone",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "histograms",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "base_date",
"type": null,
"docstring": null,
"docstring... |
e40e65af6e63bd9cc9fcdd454ed0bd538fe8c749 | sunlongbo/chromium | tools/metrics/histograms/generate_expired_histograms_array.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetBaseDate | <not_specific> | def _GetBaseDate(content, regex):
"""Fetches base date from |content| to compare expiry dates with.
Args:
content: A string with the base date.
regex: A regular expression object that matches the base date.
Returns:
A base date as datetime.date object.
Raises:
Error if |content| doesn't match |r... | Fetches base date from |content| to compare expiry dates with.
Args:
content: A string with the base date.
regex: A regular expression object that matches the base date.
Returns:
A base date as datetime.date object.
Raises:
Error if |content| doesn't match |regex| or the matched date has invalid
... | Fetches base date from |content| to compare expiry dates with.
Args:
content: A string with the base date.
regex: A regular expression object that matches the base date.
A base date as datetime.date object.
Error if |content| doesn't match |regex| or the matched date has invalid
format. | [
"Fetches",
"base",
"date",
"from",
"|content|",
"to",
"compare",
"expiry",
"dates",
"with",
".",
"Args",
":",
"content",
":",
"A",
"string",
"with",
"the",
"base",
"date",
".",
"regex",
":",
"A",
"regular",
"expression",
"object",
"that",
"matches",
"the",... | def _GetBaseDate(content, regex):
base_date_str = _FindMatch(content, regex, 1)
if not base_date_str:
return None
try:
base_date = datetime.datetime.strptime(
base_date_str, extract_histograms.EXPIRY_DATE_PATTERN).date()
return base_date
except ValueError:
raise Error("Unable to parse ba... | [
"def",
"_GetBaseDate",
"(",
"content",
",",
"regex",
")",
":",
"base_date_str",
"=",
"_FindMatch",
"(",
"content",
",",
"regex",
",",
"1",
")",
"if",
"not",
"base_date_str",
":",
"return",
"None",
"try",
":",
"base_date",
"=",
"datetime",
".",
"datetime",
... | Fetches base date from |content| to compare expiry dates with. | [
"Fetches",
"base",
"date",
"from",
"|content|",
"to",
"compare",
"expiry",
"dates",
"with",
"."
] | [
"\"\"\"Fetches base date from |content| to compare expiry dates with.\n\n Args:\n content: A string with the base date.\n regex: A regular expression object that matches the base date.\n\n Returns:\n A base date as datetime.date object.\n\n Raises:\n Error if |content| doesn't match |regex| or the match... | [
{
"param": "content",
"type": null
},
{
"param": "regex",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "content",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "regex",
"type": null,
"docstring": null,
"docstring_tokens... |
e40e65af6e63bd9cc9fcdd454ed0bd538fe8c749 | sunlongbo/chromium | tools/metrics/histograms/generate_expired_histograms_array.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateFileContent | <not_specific> | def _GenerateFileContent(descriptions, branch_file_content,
mstone_file_content, header_filename, namespace):
"""Generates header file containing array with hashes of expired histograms.
Args:
descriptions: Combined histogram descriptions.
branch_file_content: Content of file with ... | Generates header file containing array with hashes of expired histograms.
Args:
descriptions: Combined histogram descriptions.
branch_file_content: Content of file with base date.
mstone_file_content: Content of file with milestone information.
header_filename: A filename of the generated header file... | Generates header file containing array with hashes of expired histograms.
Args:
descriptions: Combined histogram descriptions.
branch_file_content: Content of file with base date.
mstone_file_content: Content of file with milestone information.
header_filename: A filename of the generated header file.
namespace: A name... | [
"Generates",
"header",
"file",
"containing",
"array",
"with",
"hashes",
"of",
"expired",
"histograms",
".",
"Args",
":",
"descriptions",
":",
"Combined",
"histogram",
"descriptions",
".",
"branch_file_content",
":",
"Content",
"of",
"file",
"with",
"base",
"date",... | def _GenerateFileContent(descriptions, branch_file_content,
mstone_file_content, header_filename, namespace):
histograms, had_errors = (
extract_histograms.ExtractHistogramsFromDom(descriptions))
if had_errors:
raise Error("Error parsing inputs.")
base_date = _GetBaseDate(branch... | [
"def",
"_GenerateFileContent",
"(",
"descriptions",
",",
"branch_file_content",
",",
"mstone_file_content",
",",
"header_filename",
",",
"namespace",
")",
":",
"histograms",
",",
"had_errors",
"=",
"(",
"extract_histograms",
".",
"ExtractHistogramsFromDom",
"(",
"descri... | Generates header file containing array with hashes of expired histograms. | [
"Generates",
"header",
"file",
"containing",
"array",
"with",
"hashes",
"of",
"expired",
"histograms",
"."
] | [
"\"\"\"Generates header file containing array with hashes of expired histograms.\n\n Args:\n descriptions: Combined histogram descriptions.\n branch_file_content: Content of file with base date.\n mstone_file_content: Content of file with milestone information.\n header_filename: A filename of the gene... | [
{
"param": "descriptions",
"type": null
},
{
"param": "branch_file_content",
"type": null
},
{
"param": "mstone_file_content",
"type": null
},
{
"param": "header_filename",
"type": null
},
{
"param": "namespace",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "descriptions",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "branch_file_content",
"type": null,
"docstring": null,
... |
e40e65af6e63bd9cc9fcdd454ed0bd538fe8c749 | sunlongbo/chromium | tools/metrics/histograms/generate_expired_histograms_array.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateFile | null | def _GenerateFile(arguments):
"""Generates header file containing array with hashes of expired histograms.
Args:
arguments: An object with the following attributes:
arguments.inputs: A list of xml files with histogram descriptions.
arguments.header_filename: A filename of the generated header file.... | Generates header file containing array with hashes of expired histograms.
Args:
arguments: An object with the following attributes:
arguments.inputs: A list of xml files with histogram descriptions.
arguments.header_filename: A filename of the generated header file.
arguments.namespace: A names... | Generates header file containing array with hashes of expired histograms. | [
"Generates",
"header",
"file",
"containing",
"array",
"with",
"hashes",
"of",
"expired",
"histograms",
"."
] | def _GenerateFile(arguments):
to_add, to_remove = CheckUnsyncedHistograms(arguments.inputs)
assert len(to_add) == 0 and len(to_remove) == 0, (
"The --inputs is not in sync with the most updated list of xmls. Please "
"update the inputs in "
"components/metrics/generate_expired_histograms_array.gni... | [
"def",
"_GenerateFile",
"(",
"arguments",
")",
":",
"to_add",
",",
"to_remove",
"=",
"CheckUnsyncedHistograms",
"(",
"arguments",
".",
"inputs",
")",
"assert",
"len",
"(",
"to_add",
")",
"==",
"0",
"and",
"len",
"(",
"to_remove",
")",
"==",
"0",
",",
"("... | Generates header file containing array with hashes of expired histograms. | [
"Generates",
"header",
"file",
"containing",
"array",
"with",
"hashes",
"of",
"expired",
"histograms",
"."
] | [
"\"\"\"Generates header file containing array with hashes of expired histograms.\n\n Args:\n arguments: An object with the following attributes:\n arguments.inputs: A list of xml files with histogram descriptions.\n arguments.header_filename: A filename of the generated header file.\n arguments.n... | [
{
"param": "arguments",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arguments",
"type": null,
"docstring": "An object with the following attributes:\narguments.inputs: A list of xml files with histogram descriptions.\narguments.header_filename: A filename of the generated header file.\narguments.nam... |
e40e65af6e63bd9cc9fcdd454ed0bd538fe8c749 | sunlongbo/chromium | tools/metrics/histograms/generate_expired_histograms_array.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ParseArguments | <not_specific> | def _ParseArguments():
"""Defines and parses arguments from the command line."""
arg_parser = argparse.ArgumentParser(
description="Generate array of expired histograms' hashes.")
arg_parser.add_argument(
"--output_dir",
"-o",
required=True,
help="Base directory to for generated file... | Defines and parses arguments from the command line. | Defines and parses arguments from the command line. | [
"Defines",
"and",
"parses",
"arguments",
"from",
"the",
"command",
"line",
"."
] | def _ParseArguments():
arg_parser = argparse.ArgumentParser(
description="Generate array of expired histograms' hashes.")
arg_parser.add_argument(
"--output_dir",
"-o",
required=True,
help="Base directory to for generated files.")
arg_parser.add_argument(
"--header_filename",
... | [
"def",
"_ParseArguments",
"(",
")",
":",
"arg_parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"Generate array of expired histograms' hashes.\"",
")",
"arg_parser",
".",
"add_argument",
"(",
"\"--output_dir\"",
",",
"\"-o\"",
",",
"required",
... | Defines and parses arguments from the command line. | [
"Defines",
"and",
"parses",
"arguments",
"from",
"the",
"command",
"line",
"."
] | [
"\"\"\"Defines and parses arguments from the command line.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3c2cb4c9034c6a892e13387f4276246837bd702a | sunlongbo/chromium | chrome/android/features/create_stripped_java_factory.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ParseImports | <not_specific> | def _ParseImports(imports):
"""Returns dict mapping from type name to import path."""
import_dict = {}
for import_ in imports:
if import_.static:
continue
assert not import_.wildcard
name = import_.path.split('.')[-1]
import_dict[name] = import_.path
return import_dict | Returns dict mapping from type name to import path. | Returns dict mapping from type name to import path. | [
"Returns",
"dict",
"mapping",
"from",
"type",
"name",
"to",
"import",
"path",
"."
] | def _ParseImports(imports):
import_dict = {}
for import_ in imports:
if import_.static:
continue
assert not import_.wildcard
name = import_.path.split('.')[-1]
import_dict[name] = import_.path
return import_dict | [
"def",
"_ParseImports",
"(",
"imports",
")",
":",
"import_dict",
"=",
"{",
"}",
"for",
"import_",
"in",
"imports",
":",
"if",
"import_",
".",
"static",
":",
"continue",
"assert",
"not",
"import_",
".",
"wildcard",
"name",
"=",
"import_",
".",
"path",
"."... | Returns dict mapping from type name to import path. | [
"Returns",
"dict",
"mapping",
"from",
"type",
"name",
"to",
"import",
"path",
"."
] | [
"\"\"\"Returns dict mapping from type name to import path.\"\"\""
] | [
{
"param": "imports",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "imports",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3c2cb4c9034c6a892e13387f4276246837bd702a | sunlongbo/chromium | chrome/android/features/create_stripped_java_factory.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ParsePublicMethodsSignatureTypes | <not_specific> | def _ParsePublicMethodsSignatureTypes(clazz):
"""Returns set of type names used in the signatures of all public methods of
the given class.
"""
types = set()
for method in clazz.methods:
if 'public' in method.modifiers:
for p in method.parameters:
types.update(_GetNames(p.type))
types.... | Returns set of type names used in the signatures of all public methods of
the given class.
| Returns set of type names used in the signatures of all public methods of
the given class. | [
"Returns",
"set",
"of",
"type",
"names",
"used",
"in",
"the",
"signatures",
"of",
"all",
"public",
"methods",
"of",
"the",
"given",
"class",
"."
] | def _ParsePublicMethodsSignatureTypes(clazz):
types = set()
for method in clazz.methods:
if 'public' in method.modifiers:
for p in method.parameters:
types.update(_GetNames(p.type))
types.update(_GetNames(method.return_type))
return types | [
"def",
"_ParsePublicMethodsSignatureTypes",
"(",
"clazz",
")",
":",
"types",
"=",
"set",
"(",
")",
"for",
"method",
"in",
"clazz",
".",
"methods",
":",
"if",
"'public'",
"in",
"method",
".",
"modifiers",
":",
"for",
"p",
"in",
"method",
".",
"parameters",
... | Returns set of type names used in the signatures of all public methods of
the given class. | [
"Returns",
"set",
"of",
"type",
"names",
"used",
"in",
"the",
"signatures",
"of",
"all",
"public",
"methods",
"of",
"the",
"given",
"class",
"."
] | [
"\"\"\"Returns set of type names used in the signatures of all public methods of\n the given class.\n \"\"\""
] | [
{
"param": "clazz",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clazz",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3c2cb4c9034c6a892e13387f4276246837bd702a | sunlongbo/chromium | chrome/android/features/create_stripped_java_factory.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _FilterAndFormatImports | <not_specific> | def _FilterAndFormatImports(import_dict, signature_types):
"""Returns formatted imports required by the passed signature types."""
formatted_imports = [
'import %s;' % import_dict[t] for t in signature_types if t in import_dict
]
return sorted(formatted_imports) | Returns formatted imports required by the passed signature types. | Returns formatted imports required by the passed signature types. | [
"Returns",
"formatted",
"imports",
"required",
"by",
"the",
"passed",
"signature",
"types",
"."
] | def _FilterAndFormatImports(import_dict, signature_types):
formatted_imports = [
'import %s;' % import_dict[t] for t in signature_types if t in import_dict
]
return sorted(formatted_imports) | [
"def",
"_FilterAndFormatImports",
"(",
"import_dict",
",",
"signature_types",
")",
":",
"formatted_imports",
"=",
"[",
"'import %s;'",
"%",
"import_dict",
"[",
"t",
"]",
"for",
"t",
"in",
"signature_types",
"if",
"t",
"in",
"import_dict",
"]",
"return",
"sorted"... | Returns formatted imports required by the passed signature types. | [
"Returns",
"formatted",
"imports",
"required",
"by",
"the",
"passed",
"signature",
"types",
"."
] | [
"\"\"\"Returns formatted imports required by the passed signature types.\"\"\""
] | [
{
"param": "import_dict",
"type": null
},
{
"param": "signature_types",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "import_dict",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "signature_types",
"type": null,
"docstring": null,
"do... |
054670d46e1e1a476aac53f5a00e31f87cd177b9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/w3c/chromium_commit.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | num_behind_main | <not_specific> | def num_behind_main(self):
"""Returns the number of commits this commit is behind origin/main.
It is inclusive of this commit and of the latest commit.
"""
return len(
self.host.executive.run_command(
['git', 'rev-list', '{}..origin/main'.format(self.sha)],
... | Returns the number of commits this commit is behind origin/main.
It is inclusive of this commit and of the latest commit.
| Returns the number of commits this commit is behind origin/main.
It is inclusive of this commit and of the latest commit. | [
"Returns",
"the",
"number",
"of",
"commits",
"this",
"commit",
"is",
"behind",
"origin",
"/",
"main",
".",
"It",
"is",
"inclusive",
"of",
"this",
"commit",
"and",
"of",
"the",
"latest",
"commit",
"."
] | def num_behind_main(self):
return len(
self.host.executive.run_command(
['git', 'rev-list', '{}..origin/main'.format(self.sha)],
cwd=self.absolute_chromium_dir).splitlines()) | [
"def",
"num_behind_main",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"host",
".",
"executive",
".",
"run_command",
"(",
"[",
"'git'",
",",
"'rev-list'",
",",
"'{}..origin/main'",
".",
"format",
"(",
"self",
".",
"sha",
")",
"]",
",",
"cw... | Returns the number of commits this commit is behind origin/main. | [
"Returns",
"the",
"number",
"of",
"commits",
"this",
"commit",
"is",
"behind",
"origin",
"/",
"main",
"."
] | [
"\"\"\"Returns the number of commits this commit is behind origin/main.\n\n It is inclusive of this commit and of the latest commit.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
054670d46e1e1a476aac53f5a00e31f87cd177b9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/w3c/chromium_commit.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | message | <not_specific> | def message(self):
"""Returns a string with a commit's subject and body."""
return self.host.executive.run_command(
['git', 'show', '--format=%B', '--no-patch', self.sha],
cwd=self.absolute_chromium_dir) | Returns a string with a commit's subject and body. | Returns a string with a commit's subject and body. | [
"Returns",
"a",
"string",
"with",
"a",
"commit",
"'",
"s",
"subject",
"and",
"body",
"."
] | def message(self):
return self.host.executive.run_command(
['git', 'show', '--format=%B', '--no-patch', self.sha],
cwd=self.absolute_chromium_dir) | [
"def",
"message",
"(",
"self",
")",
":",
"return",
"self",
".",
"host",
".",
"executive",
".",
"run_command",
"(",
"[",
"'git'",
",",
"'show'",
",",
"'--format=%B'",
",",
"'--no-patch'",
",",
"self",
".",
"sha",
"]",
",",
"cwd",
"=",
"self",
".",
"ab... | Returns a string with a commit's subject and body. | [
"Returns",
"a",
"string",
"with",
"a",
"commit",
"'",
"s",
"subject",
"and",
"body",
"."
] | [
"\"\"\"Returns a string with a commit's subject and body.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
054670d46e1e1a476aac53f5a00e31f87cd177b9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/w3c/chromium_commit.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | change_id | <not_specific> | def change_id(self):
"""Returns the Change-Id footer if it is present."""
return self.host.executive.run_command(
['git', 'footers', '--key', 'Change-Id', self.sha],
cwd=self.absolute_chromium_dir).strip() | Returns the Change-Id footer if it is present. | Returns the Change-Id footer if it is present. | [
"Returns",
"the",
"Change",
"-",
"Id",
"footer",
"if",
"it",
"is",
"present",
"."
] | def change_id(self):
return self.host.executive.run_command(
['git', 'footers', '--key', 'Change-Id', self.sha],
cwd=self.absolute_chromium_dir).strip() | [
"def",
"change_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"host",
".",
"executive",
".",
"run_command",
"(",
"[",
"'git'",
",",
"'footers'",
",",
"'--key'",
",",
"'Change-Id'",
",",
"self",
".",
"sha",
"]",
",",
"cwd",
"=",
"self",
".",
"abso... | Returns the Change-Id footer if it is present. | [
"Returns",
"the",
"Change",
"-",
"Id",
"footer",
"if",
"it",
"is",
"present",
"."
] | [
"\"\"\"Returns the Change-Id footer if it is present.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
054670d46e1e1a476aac53f5a00e31f87cd177b9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/w3c/chromium_commit.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | filtered_changed_files | <not_specific> | def filtered_changed_files(self):
"""Returns a list of modified exportable files."""
changed_files = self.host.executive.run_command(
[
'git', 'diff-tree', '--name-only', '--no-commit-id', '-r',
self.sha, '--', self.absolute_chromium_wpt_dir
],
... | Returns a list of modified exportable files. | Returns a list of modified exportable files. | [
"Returns",
"a",
"list",
"of",
"modified",
"exportable",
"files",
"."
] | def filtered_changed_files(self):
changed_files = self.host.executive.run_command(
[
'git', 'diff-tree', '--name-only', '--no-commit-id', '-r',
self.sha, '--', self.absolute_chromium_wpt_dir
],
cwd=self.absolute_chromium_dir).splitlines()
... | [
"def",
"filtered_changed_files",
"(",
"self",
")",
":",
"changed_files",
"=",
"self",
".",
"host",
".",
"executive",
".",
"run_command",
"(",
"[",
"'git'",
",",
"'diff-tree'",
",",
"'--name-only'",
",",
"'--no-commit-id'",
",",
"'-r'",
",",
"self",
".",
"sha... | Returns a list of modified exportable files. | [
"Returns",
"a",
"list",
"of",
"modified",
"exportable",
"files",
"."
] | [
"\"\"\"Returns a list of modified exportable files.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
054670d46e1e1a476aac53f5a00e31f87cd177b9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/w3c/chromium_commit.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | format_patch | <not_specific> | def format_patch(self):
"""Makes a patch with only exportable changes."""
filtered_files = self.filtered_changed_files()
if not filtered_files:
return ''
return self.host.executive.run_command(
['git', 'format-patch', '-1', '--stdout', self.sha, '--'] +
... | Makes a patch with only exportable changes. | Makes a patch with only exportable changes. | [
"Makes",
"a",
"patch",
"with",
"only",
"exportable",
"changes",
"."
] | def format_patch(self):
filtered_files = self.filtered_changed_files()
if not filtered_files:
return ''
return self.host.executive.run_command(
['git', 'format-patch', '-1', '--stdout', self.sha, '--'] +
filtered_files,
cwd=self.absolute_chromium_d... | [
"def",
"format_patch",
"(",
"self",
")",
":",
"filtered_files",
"=",
"self",
".",
"filtered_changed_files",
"(",
")",
"if",
"not",
"filtered_files",
":",
"return",
"''",
"return",
"self",
".",
"host",
".",
"executive",
".",
"run_command",
"(",
"[",
"'git'",
... | Makes a patch with only exportable changes. | [
"Makes",
"a",
"patch",
"with",
"only",
"exportable",
"changes",
"."
] | [
"\"\"\"Makes a patch with only exportable changes.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
054ed723a84981c671ed90b6fa63360d71c38c7f | sunlongbo/chromium | tools/perf/fetch_benchmark_deps.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _FetchDependenciesIfNeeded | <not_specific> | def _FetchDependenciesIfNeeded(story_set):
""" Download files needed by a user story set. """
# Download files in serving_dirs.
serving_dirs = story_set.serving_dirs
for directory in serving_dirs:
cloud_storage.GetFilesInDirectoryIfChanged(directory, story_set.bucket)
if not story_set.wpr_archive_info:
... | Download files needed by a user story set. | Download files needed by a user story set. | [
"Download",
"files",
"needed",
"by",
"a",
"user",
"story",
"set",
"."
] | def _FetchDependenciesIfNeeded(story_set):
serving_dirs = story_set.serving_dirs
for directory in serving_dirs:
cloud_storage.GetFilesInDirectoryIfChanged(directory, story_set.bucket)
if not story_set.wpr_archive_info:
return
story_names = [s.name for s in story_set if not s.is_local]
story_set.wpr_ar... | [
"def",
"_FetchDependenciesIfNeeded",
"(",
"story_set",
")",
":",
"serving_dirs",
"=",
"story_set",
".",
"serving_dirs",
"for",
"directory",
"in",
"serving_dirs",
":",
"cloud_storage",
".",
"GetFilesInDirectoryIfChanged",
"(",
"directory",
",",
"story_set",
".",
"bucke... | Download files needed by a user story set. | [
"Download",
"files",
"needed",
"by",
"a",
"user",
"story",
"set",
"."
] | [
"\"\"\" Download files needed by a user story set. \"\"\"",
"# Download files in serving_dirs.",
"# Download WPR files."
] | [
{
"param": "story_set",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "story_set",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
054ed723a84981c671ed90b6fa63360d71c38c7f | sunlongbo/chromium | tools/perf/fetch_benchmark_deps.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _EnumerateDependencies | <not_specific> | def _EnumerateDependencies(story_set):
"""Enumerates paths of files needed by a user story set."""
deps = set()
# Enumerate WPRs
for story in story_set:
deps.add(story_set.WprFilePathForStory(story))
# Enumerate files in serving_dirs
for directory in story_set.serving_dirs:
if not os.path.isdir(dir... | Enumerates paths of files needed by a user story set. | Enumerates paths of files needed by a user story set. | [
"Enumerates",
"paths",
"of",
"files",
"needed",
"by",
"a",
"user",
"story",
"set",
"."
] | def _EnumerateDependencies(story_set):
deps = set()
for story in story_set:
deps.add(story_set.WprFilePathForStory(story))
for directory in story_set.serving_dirs:
if not os.path.isdir(directory):
raise ValueError('Must provide a valid directory.')
if directory == os.path.abspath(os.sep):
... | [
"def",
"_EnumerateDependencies",
"(",
"story_set",
")",
":",
"deps",
"=",
"set",
"(",
")",
"for",
"story",
"in",
"story_set",
":",
"deps",
".",
"add",
"(",
"story_set",
".",
"WprFilePathForStory",
"(",
"story",
")",
")",
"for",
"directory",
"in",
"story_se... | Enumerates paths of files needed by a user story set. | [
"Enumerates",
"paths",
"of",
"files",
"needed",
"by",
"a",
"user",
"story",
"set",
"."
] | [
"\"\"\"Enumerates paths of files needed by a user story set.\"\"\"",
"# Enumerate WPRs",
"# Enumerate files in serving_dirs",
"# Don't allow the root directory to be a serving_dir.",
"# Return relative paths."
] | [
{
"param": "story_set",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "story_set",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9e9038e6c702bc4224fce490ec20c76e73fa0294 | sunlongbo/chromium | third_party/blink/tools/blinkpy/w3c/test_exporter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | create_or_update_pr_from_landed_commit | null | def create_or_update_pr_from_landed_commit(self, commit,
pull_request=None):
"""Creates or updates a PR from a landed Chromium commit.
Args:
commit: A ChromiumCommit object.
pull_request: Optional, a PullRequest namedtuple.
... | Creates or updates a PR from a landed Chromium commit.
Args:
commit: A ChromiumCommit object.
pull_request: Optional, a PullRequest namedtuple.
If specified, updates the PR instead of creating one.
| Creates or updates a PR from a landed Chromium commit. | [
"Creates",
"or",
"updates",
"a",
"PR",
"from",
"a",
"landed",
"Chromium",
"commit",
"."
] | def create_or_update_pr_from_landed_commit(self, commit,
pull_request=None):
if pull_request:
self.create_or_update_pr_from_commit(
commit, provisional=False, pr_number=pull_request.number)
else:
branch_name = 'chromi... | [
"def",
"create_or_update_pr_from_landed_commit",
"(",
"self",
",",
"commit",
",",
"pull_request",
"=",
"None",
")",
":",
"if",
"pull_request",
":",
"self",
".",
"create_or_update_pr_from_commit",
"(",
"commit",
",",
"provisional",
"=",
"False",
",",
"pr_number",
"... | Creates or updates a PR from a landed Chromium commit. | [
"Creates",
"or",
"updates",
"a",
"PR",
"from",
"a",
"landed",
"Chromium",
"commit",
"."
] | [
"\"\"\"Creates or updates a PR from a landed Chromium commit.\n\n Args:\n commit: A ChromiumCommit object.\n pull_request: Optional, a PullRequest namedtuple.\n If specified, updates the PR instead of creating one.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "commit",
"type": null
},
{
"param": "pull_request",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "commit",
"type": null,
"docstring": "A ChromiumCommit object.",
... |
9e9038e6c702bc4224fce490ec20c76e73fa0294 | sunlongbo/chromium | third_party/blink/tools/blinkpy/w3c/test_exporter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | create_or_update_pr_from_inflight_cl | <not_specific> | def create_or_update_pr_from_inflight_cl(self, cl, pull_request=None):
"""Creates or updates a PR from an in-flight Gerrit CL.
Args:
cl: A GerritCL object.
pull_request: Optional, a PullRequest namedtuple.
If specified, updates the PR instead of creating one.
... | Creates or updates a PR from an in-flight Gerrit CL.
Args:
cl: A GerritCL object.
pull_request: Optional, a PullRequest namedtuple.
If specified, updates the PR instead of creating one.
| Creates or updates a PR from an in-flight Gerrit CL. | [
"Creates",
"or",
"updates",
"a",
"PR",
"from",
"an",
"in",
"-",
"flight",
"Gerrit",
"CL",
"."
] | def create_or_update_pr_from_inflight_cl(self, cl, pull_request=None):
commit = cl.fetch_current_revision_commit(self.host)
patch = commit.format_patch()
success, error = self.local_wpt.test_patch(patch)
if not success:
_log.error('Gerrit CL patch did not apply cleanly:')
... | [
"def",
"create_or_update_pr_from_inflight_cl",
"(",
"self",
",",
"cl",
",",
"pull_request",
"=",
"None",
")",
":",
"commit",
"=",
"cl",
".",
"fetch_current_revision_commit",
"(",
"self",
".",
"host",
")",
"patch",
"=",
"commit",
".",
"format_patch",
"(",
")",
... | Creates or updates a PR from an in-flight Gerrit CL. | [
"Creates",
"or",
"updates",
"a",
"PR",
"from",
"an",
"in",
"-",
"flight",
"Gerrit",
"CL",
"."
] | [
"\"\"\"Creates or updates a PR from an in-flight Gerrit CL.\n\n Args:\n cl: A GerritCL object.\n pull_request: Optional, a PullRequest namedtuple.\n If specified, updates the PR instead of creating one.\n \"\"\"",
"# Change-Id can be deleted from the body of an i... | [
{
"param": "self",
"type": null
},
{
"param": "cl",
"type": null
},
{
"param": "pull_request",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cl",
"type": null,
"docstring": "A GerritCL object.",
"docstr... |
9e9038e6c702bc4224fce490ec20c76e73fa0294 | sunlongbo/chromium | third_party/blink/tools/blinkpy/w3c/test_exporter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | create_or_update_pr_from_commit | <not_specific> | def create_or_update_pr_from_commit(self,
commit,
provisional,
pr_number=None,
pr_footer='',
pr_branch_name=None):
... | Creates or updates a PR from a Chromium commit.
The commit can be either landed or in-flight. The exportable portion of
the patch is extracted and applied to a new branch in the local WPT
repo, whose name is determined by pr_branch_name (if the branch already
exists, it will be recreate... | Creates or updates a PR from a Chromium commit.
The commit can be either landed or in-flight. The exportable portion of
the patch is extracted and applied to a new branch in the local WPT
repo, whose name is determined by pr_branch_name (if the branch already
exists, it will be recreated from main). The branch is then ... | [
"Creates",
"or",
"updates",
"a",
"PR",
"from",
"a",
"Chromium",
"commit",
".",
"The",
"commit",
"can",
"be",
"either",
"landed",
"or",
"in",
"-",
"flight",
".",
"The",
"exportable",
"portion",
"of",
"the",
"patch",
"is",
"extracted",
"and",
"applied",
"t... | def create_or_update_pr_from_commit(self,
commit,
provisional,
pr_number=None,
pr_footer='',
pr_branch_name=None):
... | [
"def",
"create_or_update_pr_from_commit",
"(",
"self",
",",
"commit",
",",
"provisional",
",",
"pr_number",
"=",
"None",
",",
"pr_footer",
"=",
"''",
",",
"pr_branch_name",
"=",
"None",
")",
":",
"patch",
"=",
"commit",
".",
"format_patch",
"(",
")",
"messag... | Creates or updates a PR from a Chromium commit. | [
"Creates",
"or",
"updates",
"a",
"PR",
"from",
"a",
"Chromium",
"commit",
"."
] | [
"\"\"\"Creates or updates a PR from a Chromium commit.\n\n The commit can be either landed or in-flight. The exportable portion of\n the patch is extracted and applied to a new branch in the local WPT\n repo, whose name is determined by pr_branch_name (if the branch already\n exists, it ... | [
{
"param": "self",
"type": null
},
{
"param": "commit",
"type": null
},
{
"param": "provisional",
"type": null
},
{
"param": "pr_number",
"type": null
},
{
"param": "pr_footer",
"type": null
},
{
"param": "pr_branch_name",
"type": null
}
] | {
"returns": [
{
"docstring": "The issue number (an int) of the updated/created PR, or None if no\nchange is made.",
"docstring_tokens": [
"The",
"issue",
"number",
"(",
"an",
"int",
")",
"of",
"the",
"updated",
"/... |
d647b5306e98e9edcc8dea8691abea883862ed39 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/controllers/manager.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | run | <not_specific> | def run(self, args):
"""Runs the tests and return a RunDetails object with the results."""
start_time = time.time()
self._printer.write_update('Collecting tests ...')
running_all_tests = False
try:
paths, all_test_names, running_all_tests = self._collect_tests(
... | Runs the tests and return a RunDetails object with the results. | Runs the tests and return a RunDetails object with the results. | [
"Runs",
"the",
"tests",
"and",
"return",
"a",
"RunDetails",
"object",
"with",
"the",
"results",
"."
] | def run(self, args):
start_time = time.time()
self._printer.write_update('Collecting tests ...')
running_all_tests = False
try:
paths, all_test_names, running_all_tests = self._collect_tests(
args)
except IOError:
return test_run_results.Ru... | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"self",
".",
"_printer",
".",
"write_update",
"(",
"'Collecting tests ...'",
")",
"running_all_tests",
"=",
"False",
"try",
":",
"paths",
",",
"all_test_nam... | Runs the tests and return a RunDetails object with the results. | [
"Runs",
"the",
"tests",
"and",
"return",
"a",
"RunDetails",
"object",
"with",
"the",
"results",
"."
] | [
"\"\"\"Runs the tests and return a RunDetails object with the results.\"\"\"",
"# This is raised if --test-list doesn't exist",
"# Restore the test order to user specified order.",
"# base.tests() may change the order as it returns tests in the",
"# real, external/wpt, virtual order.",
"# Check to make su... | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
d647b5306e98e9edcc8dea8691abea883862ed39 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/controllers/manager.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _look_for_new_crash_logs | null | def _look_for_new_crash_logs(self, run_results, start_time):
"""Looks for and writes new crash logs, at the end of the test run.
Since crash logs can take a long time to be written out if the system is
under stress, do a second pass at the end of the test run.
Args:
run_res... | Looks for and writes new crash logs, at the end of the test run.
Since crash logs can take a long time to be written out if the system is
under stress, do a second pass at the end of the test run.
Args:
run_results: The results of the test run.
start_time: Time the test... | Looks for and writes new crash logs, at the end of the test run.
Since crash logs can take a long time to be written out if the system is
under stress, do a second pass at the end of the test run. | [
"Looks",
"for",
"and",
"writes",
"new",
"crash",
"logs",
"at",
"the",
"end",
"of",
"the",
"test",
"run",
".",
"Since",
"crash",
"logs",
"can",
"take",
"a",
"long",
"time",
"to",
"be",
"written",
"out",
"if",
"the",
"system",
"is",
"under",
"stress",
... | def _look_for_new_crash_logs(self, run_results, start_time):
crashed_processes = []
test_to_crash_failure = {}
test_failures.AbstractTestResultType.port = self._port
test_failures.AbstractTestResultType.result_directory = self._results_directory
test_failures.AbstractTestResultTy... | [
"def",
"_look_for_new_crash_logs",
"(",
"self",
",",
"run_results",
",",
"start_time",
")",
":",
"crashed_processes",
"=",
"[",
"]",
"test_to_crash_failure",
"=",
"{",
"}",
"test_failures",
".",
"AbstractTestResultType",
".",
"port",
"=",
"self",
".",
"_port",
"... | Looks for and writes new crash logs, at the end of the test run. | [
"Looks",
"for",
"and",
"writes",
"new",
"crash",
"logs",
"at",
"the",
"end",
"of",
"the",
"test",
"run",
"."
] | [
"\"\"\"Looks for and writes new crash logs, at the end of the test run.\n\n Since crash logs can take a long time to be written out if the system is\n under stress, do a second pass at the end of the test run.\n\n Args:\n run_results: The results of the test run.\n start_t... | [
{
"param": "self",
"type": null
},
{
"param": "run_results",
"type": null
},
{
"param": "start_time",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "run_results",
"type": null,
"docstring": "The results of the test r... |
d647b5306e98e9edcc8dea8691abea883862ed39 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/controllers/manager.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _copy_results_html_file | null | def _copy_results_html_file(self, destination_dir, filename):
"""Copies a file from the template directory to the results directory."""
template_dir = self._path_finder.path_from_web_tests('fast', 'harness')
source_path = self._filesystem.join(template_dir, filename)
destination_path = s... | Copies a file from the template directory to the results directory. | Copies a file from the template directory to the results directory. | [
"Copies",
"a",
"file",
"from",
"the",
"template",
"directory",
"to",
"the",
"results",
"directory",
"."
] | def _copy_results_html_file(self, destination_dir, filename):
template_dir = self._path_finder.path_from_web_tests('fast', 'harness')
source_path = self._filesystem.join(template_dir, filename)
destination_path = self._filesystem.join(destination_dir, filename)
if self._filesystem.exists... | [
"def",
"_copy_results_html_file",
"(",
"self",
",",
"destination_dir",
",",
"filename",
")",
":",
"template_dir",
"=",
"self",
".",
"_path_finder",
".",
"path_from_web_tests",
"(",
"'fast'",
",",
"'harness'",
")",
"source_path",
"=",
"self",
".",
"_filesystem",
... | Copies a file from the template directory to the results directory. | [
"Copies",
"a",
"file",
"from",
"the",
"template",
"directory",
"to",
"the",
"results",
"directory",
"."
] | [
"\"\"\"Copies a file from the template directory to the results directory.\"\"\"",
"# Note that the results.html template file won't exist when",
"# we're using a MockFileSystem during unit tests, so make sure",
"# it exists before we try to copy it."
] | [
{
"param": "self",
"type": null
},
{
"param": "destination_dir",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destination_dir",
"type": null,
"docstring": null,
"docstring... |
14a0fc8047d3b1dd92daee4575ab21751d8b1a8d | sunlongbo/chromium | tools/perf/core/benchmark_runner_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testMain_ReturnCode | null | def testMain_ReturnCode(self):
"""Test that benchmark_runner.main() respects return code from Telemetry."""
config = mock.Mock()
with mock.patch('core.benchmark_runner.command_line') as telemetry_cli:
telemetry_cli.ParseArgs.side_effect = _FakeParseArgs
telemetry_cli.RunCommand.return_value = 42... | Test that benchmark_runner.main() respects return code from Telemetry. | Test that benchmark_runner.main() respects return code from Telemetry. | [
"Test",
"that",
"benchmark_runner",
".",
"main",
"()",
"respects",
"return",
"code",
"from",
"Telemetry",
"."
] | def testMain_ReturnCode(self):
config = mock.Mock()
with mock.patch('core.benchmark_runner.command_line') as telemetry_cli:
telemetry_cli.ParseArgs.side_effect = _FakeParseArgs
telemetry_cli.RunCommand.return_value = 42
return_code = benchmark_runner.main(config, [
'run', 'some.bench... | [
"def",
"testMain_ReturnCode",
"(",
"self",
")",
":",
"config",
"=",
"mock",
".",
"Mock",
"(",
")",
"with",
"mock",
".",
"patch",
"(",
"'core.benchmark_runner.command_line'",
")",
"as",
"telemetry_cli",
":",
"telemetry_cli",
".",
"ParseArgs",
".",
"side_effect",
... | Test that benchmark_runner.main() respects return code from Telemetry. | [
"Test",
"that",
"benchmark_runner",
".",
"main",
"()",
"respects",
"return",
"code",
"from",
"Telemetry",
"."
] | [
"\"\"\"Test that benchmark_runner.main() respects return code from Telemetry.\"\"\"",
"# Note: We pass `--output-format none` and a non-existent output",
"# dir to prevent the results processor from processing any results."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
14a0fc8047d3b1dd92daee4575ab21751d8b1a8d | sunlongbo/chromium | tools/perf/core/benchmark_runner_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | assertHasDiagnostic | null | def assertHasDiagnostic(self, hist, diag_info, value=None):
"""Assert that a histogram is associated with the given diagnostic."""
self.assertIn(diag_info.name, hist.diagnostics)
diag = hist.diagnostics[diag_info.name]
self.assertIsInstance(
diag, all_diagnostics.GetDiagnosticClassForName(diag_i... | Assert that a histogram is associated with the given diagnostic. | Assert that a histogram is associated with the given diagnostic. | [
"Assert",
"that",
"a",
"histogram",
"is",
"associated",
"with",
"the",
"given",
"diagnostic",
"."
] | def assertHasDiagnostic(self, hist, diag_info, value=None):
self.assertIn(diag_info.name, hist.diagnostics)
diag = hist.diagnostics[diag_info.name]
self.assertIsInstance(
diag, all_diagnostics.GetDiagnosticClassForName(diag_info.type))
if value is not None:
self.assertEqual(len(diag), 1)
... | [
"def",
"assertHasDiagnostic",
"(",
"self",
",",
"hist",
",",
"diag_info",
",",
"value",
"=",
"None",
")",
":",
"self",
".",
"assertIn",
"(",
"diag_info",
".",
"name",
",",
"hist",
".",
"diagnostics",
")",
"diag",
"=",
"hist",
".",
"diagnostics",
"[",
"... | Assert that a histogram is associated with the given diagnostic. | [
"Assert",
"that",
"a",
"histogram",
"is",
"associated",
"with",
"the",
"given",
"diagnostic",
"."
] | [
"\"\"\"Assert that a histogram is associated with the given diagnostic.\"\"\"",
"# Assume we expect singleton GenericSet with the given value."
] | [
{
"param": "self",
"type": null
},
{
"param": "hist",
"type": null
},
{
"param": "diag_info",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "hist",
"type": null,
"docstring": null,
"docstring_tokens": [... |
14a0fc8047d3b1dd92daee4575ab21751d8b1a8d | sunlongbo/chromium | tools/perf/core/benchmark_runner_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunBenchmark | <not_specific> | def RunBenchmark(self, benchmark_class):
"""Run a benchmark, process results, and return generated histograms."""
# TODO(crbug.com/985712): Ideally we should be able to just call
# telemetry.command_line.RunCommand(self.options) with the right set
# of options chosen. However, argument parsing and comma... | Run a benchmark, process results, and return generated histograms. | Run a benchmark, process results, and return generated histograms. | [
"Run",
"a",
"benchmark",
"process",
"results",
"and",
"return",
"generated",
"histograms",
"."
] | def RunBenchmark(self, benchmark_class):
run_return_code = benchmark_class().Run(self.options)
self.assertEqual(run_return_code, 0)
process_return_code = results_processor.ProcessResults(self.options,
is_unittest=True)
self.assertEqual(process_r... | [
"def",
"RunBenchmark",
"(",
"self",
",",
"benchmark_class",
")",
":",
"run_return_code",
"=",
"benchmark_class",
"(",
")",
".",
"Run",
"(",
"self",
".",
"options",
")",
"self",
".",
"assertEqual",
"(",
"run_return_code",
",",
"0",
")",
"process_return_code",
... | Run a benchmark, process results, and return generated histograms. | [
"Run",
"a",
"benchmark",
"process",
"results",
"and",
"return",
"generated",
"histograms",
"."
] | [
"\"\"\"Run a benchmark, process results, and return generated histograms.\"\"\"",
"# TODO(crbug.com/985712): Ideally we should be able to just call",
"# telemetry.command_line.RunCommand(self.options) with the right set",
"# of options chosen. However, argument parsing and command running are",
"# currently... | [
{
"param": "self",
"type": null
},
{
"param": "benchmark_class",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "benchmark_class",
"type": null,
"docstring": null,
"docstring... |
14a92c7e51f8a57e4eed958ddc33f2f35a731d99 | sunlongbo/chromium | tools/binary_size/libsupersize/zip_util.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MeasureApkSignatureBlock | <not_specific> | def MeasureApkSignatureBlock(zip_file):
"""Measures the size of the v2 / v3 signing block.
Refer to: https://source.android.com/security/apksigning/v2
"""
# Seek to "end of central directory" struct.
eocd_offset_from_end = -22 - len(zip_file.comment)
zip_file.fp.seek(eocd_offset_from_end, os.SEEK_END)
as... | Measures the size of the v2 / v3 signing block.
Refer to: https://source.android.com/security/apksigning/v2
| Measures the size of the v2 / v3 signing block. | [
"Measures",
"the",
"size",
"of",
"the",
"v2",
"/",
"v3",
"signing",
"block",
"."
] | def MeasureApkSignatureBlock(zip_file):
eocd_offset_from_end = -22 - len(zip_file.comment)
zip_file.fp.seek(eocd_offset_from_end, os.SEEK_END)
assert zip_file.fp.read(4) == b'PK\005\006', (
'failed to find end-of-central-directory')
zip_file.fp.seek(eocd_offset_from_end + 16, os.SEEK_END)
start_of_centr... | [
"def",
"MeasureApkSignatureBlock",
"(",
"zip_file",
")",
":",
"eocd_offset_from_end",
"=",
"-",
"22",
"-",
"len",
"(",
"zip_file",
".",
"comment",
")",
"zip_file",
".",
"fp",
".",
"seek",
"(",
"eocd_offset_from_end",
",",
"os",
".",
"SEEK_END",
")",
"assert"... | Measures the size of the v2 / v3 signing block. | [
"Measures",
"the",
"size",
"of",
"the",
"v2",
"/",
"v3",
"signing",
"block",
"."
] | [
"\"\"\"Measures the size of the v2 / v3 signing block.\n\n Refer to: https://source.android.com/security/apksigning/v2\n \"\"\"",
"# Seek to \"end of central directory\" struct.",
"# Read out the \"start of central directory\" offset.",
"# Compute the offset after the last zip entry."
] | [
{
"param": "zip_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "zip_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a5565d59d1ac45afc6e82a0cf6ca1f08905a4ccd | sunlongbo/chromium | tools/flags/generate_unexpire_flags.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | recent_mstones | <not_specific> | def recent_mstones(mstone):
"""Returns the list of milestones considered 'recent' for the given mstone.
Flag unexpiry is available only for flags that expired at recent mstones."""
return [mstone - 1, mstone] | Returns the list of milestones considered 'recent' for the given mstone.
Flag unexpiry is available only for flags that expired at recent mstones. | Returns the list of milestones considered 'recent' for the given mstone.
Flag unexpiry is available only for flags that expired at recent mstones. | [
"Returns",
"the",
"list",
"of",
"milestones",
"considered",
"'",
"recent",
"'",
"for",
"the",
"given",
"mstone",
".",
"Flag",
"unexpiry",
"is",
"available",
"only",
"for",
"flags",
"that",
"expired",
"at",
"recent",
"mstones",
"."
] | def recent_mstones(mstone):
return [mstone - 1, mstone] | [
"def",
"recent_mstones",
"(",
"mstone",
")",
":",
"return",
"[",
"mstone",
"-",
"1",
",",
"mstone",
"]"
] | Returns the list of milestones considered 'recent' for the given mstone. | [
"Returns",
"the",
"list",
"of",
"milestones",
"considered",
"'",
"recent",
"'",
"for",
"the",
"given",
"mstone",
"."
] | [
"\"\"\"Returns the list of milestones considered 'recent' for the given mstone.\n\n Flag unexpiry is available only for flags that expired at recent mstones.\"\"\""
] | [
{
"param": "mstone",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mstone",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a5565d59d1ac45afc6e82a0cf6ca1f08905a4ccd | sunlongbo/chromium | tools/flags/generate_unexpire_flags.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | file_header | <not_specific> | def file_header(prog_name):
"""Returns the header to use on generated files."""
return """// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This is a generated file. Do not edit it! It was generate... | Returns the header to use on generated files. | Returns the header to use on generated files. | [
"Returns",
"the",
"header",
"to",
"use",
"on",
"generated",
"files",
"."
] | def file_header(prog_name):
return """// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This is a generated file. Do not edit it! It was generated by:
// {prog_name}
""".format(prog_name=prog_name) | [
"def",
"file_header",
"(",
"prog_name",
")",
":",
"return",
"\"\"\"// Copyright 2020 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n// This is a generated file. Do not edit it! It was generated by:... | Returns the header to use on generated files. | [
"Returns",
"the",
"header",
"to",
"use",
"on",
"generated",
"files",
"."
] | [
"\"\"\"Returns the header to use on generated files.\"\"\""
] | [
{
"param": "prog_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "prog_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a5565d59d1ac45afc6e82a0cf6ca1f08905a4ccd | sunlongbo/chromium | tools/flags/generate_unexpire_flags.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | gen_features_impl | <not_specific> | def gen_features_impl(prog_name, mstone):
"""Generates the definitions for the unexpiry features and the expiry-check
function.
This function generates the contents of a complete C++ source file,
which defines base::Features for unexpiration of flags from recent milestones,
as well as a function ExpiryEna... | Generates the definitions for the unexpiry features and the expiry-check
function.
This function generates the contents of a complete C++ source file,
which defines base::Features for unexpiration of flags from recent milestones,
as well as a function ExpiryEnabledForMilestone().
| Generates the definitions for the unexpiry features and the expiry-check
function.
This function generates the contents of a complete C++ source file,
which defines base::Features for unexpiration of flags from recent milestones,
as well as a function ExpiryEnabledForMilestone(). | [
"Generates",
"the",
"definitions",
"for",
"the",
"unexpiry",
"features",
"and",
"the",
"expiry",
"-",
"check",
"function",
".",
"This",
"function",
"generates",
"the",
"contents",
"of",
"a",
"complete",
"C",
"++",
"source",
"file",
"which",
"defines",
"base",
... | def gen_features_impl(prog_name, mstone):
body = file_header(prog_name)
body += """
#include "base/feature_list.h"
#include "chrome/browser/unexpire_flags_gen.h"
namespace flags {
"""
features = [(m, 'UnexpireFlagsM' + str(m)) for m in recent_mstones(mstone)]
for feature in features:
body += 'const base::Fe... | [
"def",
"gen_features_impl",
"(",
"prog_name",
",",
"mstone",
")",
":",
"body",
"=",
"file_header",
"(",
"prog_name",
")",
"body",
"+=",
"\"\"\"\n#include \"base/feature_list.h\"\n#include \"chrome/browser/unexpire_flags_gen.h\"\n\nnamespace flags {\n\n\"\"\"",
"features",
"=",
... | Generates the definitions for the unexpiry features and the expiry-check
function. | [
"Generates",
"the",
"definitions",
"for",
"the",
"unexpiry",
"features",
"and",
"the",
"expiry",
"-",
"check",
"function",
"."
] | [
"\"\"\"Generates the definitions for the unexpiry features and the expiry-check\n function.\n\n This function generates the contents of a complete C++ source file,\n which defines base::Features for unexpiration of flags from recent milestones,\n as well as a function ExpiryEnabledForMilestone().\n \"\"\""
... | [
{
"param": "prog_name",
"type": null
},
{
"param": "mstone",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "prog_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mstone",
"type": null,
"docstring": null,
"docstring_tok... |
a5565d59d1ac45afc6e82a0cf6ca1f08905a4ccd | sunlongbo/chromium | tools/flags/generate_unexpire_flags.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | gen_features_header | <not_specific> | def gen_features_header(prog_name, mstone):
"""Generate a header file declaring features and the expiry predicate.
This header declares the features and function described in
gen_features_impl().
"""
body = file_header(prog_name)
body += """
#ifndef GEN_CHROME_BROWSER_UNEXPIRE_FLAGS_GEN_H_
#define GEN_CHR... | Generate a header file declaring features and the expiry predicate.
This header declares the features and function described in
gen_features_impl().
| Generate a header file declaring features and the expiry predicate.
This header declares the features and function described in
gen_features_impl(). | [
"Generate",
"a",
"header",
"file",
"declaring",
"features",
"and",
"the",
"expiry",
"predicate",
".",
"This",
"header",
"declares",
"the",
"features",
"and",
"function",
"described",
"in",
"gen_features_impl",
"()",
"."
] | def gen_features_header(prog_name, mstone):
body = file_header(prog_name)
body += """
#ifndef GEN_CHROME_BROWSER_UNEXPIRE_FLAGS_GEN_H_
#define GEN_CHROME_BROWSER_UNEXPIRE_FLAGS_GEN_H_
namespace flags {
"""
for m in recent_mstones(mstone):
body += 'extern const base::Feature kUnexpireFlagsM{m};\n'.format(m=m)
... | [
"def",
"gen_features_header",
"(",
"prog_name",
",",
"mstone",
")",
":",
"body",
"=",
"file_header",
"(",
"prog_name",
")",
"body",
"+=",
"\"\"\"\n#ifndef GEN_CHROME_BROWSER_UNEXPIRE_FLAGS_GEN_H_\n#define GEN_CHROME_BROWSER_UNEXPIRE_FLAGS_GEN_H_\n\nnamespace flags {\n\n\"\"\"",
"fo... | Generate a header file declaring features and the expiry predicate. | [
"Generate",
"a",
"header",
"file",
"declaring",
"features",
"and",
"the",
"expiry",
"predicate",
"."
] | [
"\"\"\"Generate a header file declaring features and the expiry predicate.\n\n This header declares the features and function described in\n gen_features_impl().\n \"\"\""
] | [
{
"param": "prog_name",
"type": null
},
{
"param": "mstone",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "prog_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mstone",
"type": null,
"docstring": null,
"docstring_tok... |
a5565d59d1ac45afc6e82a0cf6ca1f08905a4ccd | sunlongbo/chromium | tools/flags/generate_unexpire_flags.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | gen_flags_fragment | <not_specific> | def gen_flags_fragment(prog_name, mstone):
"""Generates a .inc file containing flag definitions.
This creates a C++ source fragment defining flags, which are bound to the
features described in gen_features_impl().
"""
# Note: The exact format of the flag name (temporary-unexpire-flags-m{m}) is
# depended o... | Generates a .inc file containing flag definitions.
This creates a C++ source fragment defining flags, which are bound to the
features described in gen_features_impl().
| Generates a .inc file containing flag definitions.
This creates a C++ source fragment defining flags, which are bound to the
features described in gen_features_impl(). | [
"Generates",
"a",
".",
"inc",
"file",
"containing",
"flag",
"definitions",
".",
"This",
"creates",
"a",
"C",
"++",
"source",
"fragment",
"defining",
"flags",
"which",
"are",
"bound",
"to",
"the",
"features",
"described",
"in",
"gen_features_impl",
"()",
"."
] | def gen_flags_fragment(prog_name, mstone):
fragment = """
{{"temporary-unexpire-flags-m{m}",
"Temporarily unexpire M{m} flags.",
"Temporarily unexpire flags that expired as of M{m}. These flags will be"
" removed soon.",
kOsAll | flags_ui::kFlagInfrastructure,
FEATURE_VALUE_TYPE(flags::kU... | [
"def",
"gen_flags_fragment",
"(",
"prog_name",
",",
"mstone",
")",
":",
"fragment",
"=",
"\"\"\"\n {{\"temporary-unexpire-flags-m{m}\",\n \"Temporarily unexpire M{m} flags.\",\n \"Temporarily unexpire flags that expired as of M{m}. These flags will be\"\n \" removed soon.\",\n ... | Generates a .inc file containing flag definitions. | [
"Generates",
"a",
".",
"inc",
"file",
"containing",
"flag",
"definitions",
"."
] | [
"\"\"\"Generates a .inc file containing flag definitions.\n\n This creates a C++ source fragment defining flags, which are bound to the\n features described in gen_features_impl().\n \"\"\"",
"# Note: The exact format of the flag name (temporary-unexpire-flags-m{m}) is",
"# depended on by a hack in Unexpired... | [
{
"param": "prog_name",
"type": null
},
{
"param": "mstone",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "prog_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mstone",
"type": null,
"docstring": null,
"docstring_tok... |
a5565d59d1ac45afc6e82a0cf6ca1f08905a4ccd | sunlongbo/chromium | tools/flags/generate_unexpire_flags.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | update_file_if_stale | <not_specific> | def update_file_if_stale(filename, data):
"""Writes data to filename if data is different from file's contents on disk.
"""
try:
disk_data = open(filename, 'r').read()
if disk_data == data:
return
except IOError:
pass
open(filename, 'w').write(data) | Writes data to filename if data is different from file's contents on disk.
| Writes data to filename if data is different from file's contents on disk. | [
"Writes",
"data",
"to",
"filename",
"if",
"data",
"is",
"different",
"from",
"file",
"'",
"s",
"contents",
"on",
"disk",
"."
] | def update_file_if_stale(filename, data):
try:
disk_data = open(filename, 'r').read()
if disk_data == data:
return
except IOError:
pass
open(filename, 'w').write(data) | [
"def",
"update_file_if_stale",
"(",
"filename",
",",
"data",
")",
":",
"try",
":",
"disk_data",
"=",
"open",
"(",
"filename",
",",
"'r'",
")",
".",
"read",
"(",
")",
"if",
"disk_data",
"==",
"data",
":",
"return",
"except",
"IOError",
":",
"pass",
"ope... | Writes data to filename if data is different from file's contents on disk. | [
"Writes",
"data",
"to",
"filename",
"if",
"data",
"is",
"different",
"from",
"file",
"'",
"s",
"contents",
"on",
"disk",
"."
] | [
"\"\"\"Writes data to filename if data is different from file's contents on disk.\n \"\"\""
] | [
{
"param": "filename",
"type": null
},
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens... |
b227903c4b8359fa45de084d28b609640144503f | sunlongbo/chromium | tools/mac/power/driver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckEnv | null | def CheckEnv(self, throw_on_bad_env):
"""Verifies that the environment is conducive to proper profiling or
measurements.
Args:
throw_on_bad_env: False if executions continues no matter what and
only warnings are printed.
Raises:
SystemExit: When the environment is invalid and throw_o... | Verifies that the environment is conducive to proper profiling or
measurements.
Args:
throw_on_bad_env: False if executions continues no matter what and
only warnings are printed.
Raises:
SystemExit: When the environment is invalid and throw_on_bad_env is
True.
| Verifies that the environment is conducive to proper profiling or
measurements.
False if executions continues no matter what and
only warnings are printed.
When the environment is invalid and throw_on_bad_env is
True. | [
"Verifies",
"that",
"the",
"environment",
"is",
"conducive",
"to",
"proper",
"profiling",
"or",
"measurements",
".",
"False",
"if",
"executions",
"continues",
"no",
"matter",
"what",
"and",
"only",
"warnings",
"are",
"printed",
".",
"When",
"the",
"environment",... | def CheckEnv(self, throw_on_bad_env):
if throw_on_bad_env:
logging_function = logging.error
else:
logging_function = logging.warning
logging.warning("Trying sudo access. Possibly enter password:")
sudo_check = subprocess.Popen(["sudo", "ls"],
stdout=subprocess.DEVNULL,
... | [
"def",
"CheckEnv",
"(",
"self",
",",
"throw_on_bad_env",
")",
":",
"if",
"throw_on_bad_env",
":",
"logging_function",
"=",
"logging",
".",
"error",
"else",
":",
"logging_function",
"=",
"logging",
".",
"warning",
"logging",
".",
"warning",
"(",
"\"Trying sudo ac... | Verifies that the environment is conducive to proper profiling or
measurements. | [
"Verifies",
"that",
"the",
"environment",
"is",
"conducive",
"to",
"proper",
"profiling",
"or",
"measurements",
"."
] | [
"\"\"\"Verifies that the environment is conducive to proper profiling or\n measurements.\n\n Args:\n throw_on_bad_env: False if executions continues no matter what and\n only warnings are printed.\n\n Raises:\n SystemExit: When the environment is invalid and throw_on_bad_env is\n True.\... | [
{
"param": "self",
"type": null
},
{
"param": "throw_on_bad_env",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "throw_on_bad_env",
"type": null,
"docstring": null,
"docstrin... |
b227903c4b8359fa45de084d28b609640144503f | sunlongbo/chromium | tools/mac/power/driver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Teardown | null | def Teardown(self):
"""Cleans up global state after all calls to Record()/Profile().
Makes sure that all processes started for measurement/profiling are exited
and that the execution can move on to the next one.
"""
# Cleanup can't be achieved with a simple call to psutil.waitprocs() because
#... | Cleans up global state after all calls to Record()/Profile().
Makes sure that all processes started for measurement/profiling are exited
and that the execution can move on to the next one.
| Cleans up global state after all calls to Record()/Profile().
Makes sure that all processes started for measurement/profiling are exited
and that the execution can move on to the next one. | [
"Cleans",
"up",
"global",
"state",
"after",
"all",
"calls",
"to",
"Record",
"()",
"/",
"Profile",
"()",
".",
"Makes",
"sure",
"that",
"all",
"processes",
"started",
"for",
"measurement",
"/",
"profiling",
"are",
"exited",
"and",
"that",
"the",
"execution",
... | def Teardown(self):
for process in self._started_processeds:
logging.info(f"Terminating PID:{process.pid}")
try:
process.terminate()
process.wait(0.5)
except psutil.NoSuchProcess:
continue
except (psutil.TimeoutExpired, psutil.AccessDenied) as e:
logging.info(... | [
"def",
"Teardown",
"(",
"self",
")",
":",
"for",
"process",
"in",
"self",
".",
"_started_processeds",
":",
"logging",
".",
"info",
"(",
"f\"Terminating PID:{process.pid}\"",
")",
"try",
":",
"process",
".",
"terminate",
"(",
")",
"process",
".",
"wait",
"(",... | Cleans up global state after all calls to Record()/Profile(). | [
"Cleans",
"up",
"global",
"state",
"after",
"all",
"calls",
"to",
"Record",
"()",
"/",
"Profile",
"()",
"."
] | [
"\"\"\"Cleans up global state after all calls to Record()/Profile().\n\n Makes sure that all processes started for measurement/profiling are exited\n and that the execution can move on to the next one.\n \"\"\"",
"# Cleanup can't be achieved with a simple call to psutil.waitprocs() because",
"# some ex... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b227903c4b8359fa45de084d28b609640144503f | sunlongbo/chromium | tools/mac/power/driver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FindBrowserProcess | <not_specific> | def FindBrowserProcess(self, browser):
"""Looks for the process associated with |browser|.
Args:
browser: A string of the browser name
Returns:
A psutil.process representation of the browser process.
Raises:
SystemExit: When no process is found for the browser.
"""
process_... | Looks for the process associated with |browser|.
Args:
browser: A string of the browser name
Returns:
A psutil.process representation of the browser process.
Raises:
SystemExit: When no process is found for the browser.
| Looks for the process associated with |browser|. | [
"Looks",
"for",
"the",
"process",
"associated",
"with",
"|browser|",
"."
] | def FindBrowserProcess(self, browser):
process_name = utils.get_browser_property(browser, 'process_name')
processes = filter(lambda p: p.name() == process_name,
psutil.process_iter())
browser_process = None
for process in processes:
if not browser_process:
browser_pr... | [
"def",
"FindBrowserProcess",
"(",
"self",
",",
"browser",
")",
":",
"process_name",
"=",
"utils",
".",
"get_browser_property",
"(",
"browser",
",",
"'process_name'",
")",
"processes",
"=",
"filter",
"(",
"lambda",
"p",
":",
"p",
".",
"name",
"(",
")",
"=="... | Looks for the process associated with |browser|. | [
"Looks",
"for",
"the",
"process",
"associated",
"with",
"|browser|",
"."
] | [
"\"\"\"Looks for the process associated with |browser|.\n\n Args:\n browser: A string of the browser name\n\n Returns:\n A psutil.process representation of the browser process.\n\n Raises:\n SystemExit: When no process is found for the browser.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "browser",
"type": null
}
] | {
"returns": [
{
"docstring": "A psutil.process representation of the browser process.",
"docstring_tokens": [
"A",
"psutil",
".",
"process",
"representation",
"of",
"the",
"browser",
"process",
"."
],
"type": ... |
b227903c4b8359fa45de084d28b609640144503f | sunlongbo/chromium | tools/mac/power/driver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunScenario | <not_specific> | def RunScenario(self, scenario_config):
"""Start the browser and initiate the scenario
Args:
scenario_config: A dictionary describing the scenario.
Returns: A psutil.process representation the driver script process.
"""
scenario_browser = scenario_config["browser"]
if scenario_browser ... | Start the browser and initiate the scenario
Args:
scenario_config: A dictionary describing the scenario.
Returns: A psutil.process representation the driver script process.
| Start the browser and initiate the scenario | [
"Start",
"the",
"browser",
"and",
"initiate",
"the",
"scenario"
] | def RunScenario(self, scenario_config):
scenario_browser = scenario_config["browser"]
if scenario_browser is not None:
browser_executable = utils.get_browser_property(scenario_browser,
'executable')
if scenario_browser in ["Chromium", "Chrome", "... | [
"def",
"RunScenario",
"(",
"self",
",",
"scenario_config",
")",
":",
"scenario_browser",
"=",
"scenario_config",
"[",
"\"browser\"",
"]",
"if",
"scenario_browser",
"is",
"not",
"None",
":",
"browser_executable",
"=",
"utils",
".",
"get_browser_property",
"(",
"sce... | Start the browser and initiate the scenario | [
"Start",
"the",
"browser",
"and",
"initiate",
"the",
"scenario"
] | [
"\"\"\"Start the browser and initiate the scenario\n\n Args:\n scenario_config: A dictionary describing the scenario.\n\n Returns: A psutil.process representation the driver script process.\n \"\"\"",
"# Call prep_safari.scpt to make sure the run starts clean. See file",
"# comment for details.",
... | [
{
"param": "self",
"type": null
},
{
"param": "scenario_config",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scenario_config",
"type": null,
"docstring": "A dictionary describi... |
b227903c4b8359fa45de084d28b609640144503f | sunlongbo/chromium | tools/mac/power/driver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Record | null | def Record(self, scenario_config):
"""Cover the running of the scenario with powermetrics and save
the results
Args:
scenario_config: A dictionary describing the scenario.
"""
output_file = \
f'./{self.__output_dir}/{scenario_config["name"]}_powermetrics.plist'
with open(output_... | Cover the running of the scenario with powermetrics and save
the results
Args:
scenario_config: A dictionary describing the scenario.
| Cover the running of the scenario with powermetrics and save
the results | [
"Cover",
"the",
"running",
"of",
"the",
"scenario",
"with",
"powermetrics",
"and",
"save",
"the",
"results"
] | def Record(self, scenario_config):
output_file = \
f'./{self.__output_dir}/{scenario_config["name"]}_powermetrics.plist'
with open(output_file, "w") as powermetrics_output:
powermetrics_args = [
"sudo", "powermetrics", "-f", "plist", "--samplers", "all",
"--show-responsible-pid... | [
"def",
"Record",
"(",
"self",
",",
"scenario_config",
")",
":",
"output_file",
"=",
"f'./{self.__output_dir}/{scenario_config[\"name\"]}_powermetrics.plist'",
"with",
"open",
"(",
"output_file",
",",
"\"w\"",
")",
"as",
"powermetrics_output",
":",
"powermetrics_args",
"="... | Cover the running of the scenario with powermetrics and save
the results | [
"Cover",
"the",
"running",
"of",
"the",
"scenario",
"with",
"powermetrics",
"and",
"save",
"the",
"results"
] | [
"\"\"\"Cover the running of the scenario with powermetrics and save\n the results\n\n Args:\n scenario_config: A dictionary describing the scenario.\n \"\"\"",
"# TODO(crbug.com/1224994): Narrow down samplers to only those of interest.",
"# No need to add |scenario_process| to |self._started_proce... | [
{
"param": "self",
"type": null
},
{
"param": "scenario_config",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scenario_config",
"type": null,
"docstring": "A dictionary describi... |
b227903c4b8359fa45de084d28b609640144503f | sunlongbo/chromium | tools/mac/power/driver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetAllPids | <not_specific> | def GetAllPids(self, browser_process):
"""Get the pids for the browser and all children. w
Args:
browser_process: A psutil.Process object associated with the
browser process.
Returns:
A list of pids as integers.
"""
pids = [browser_process.pid]
try:
children = browser_... | Get the pids for the browser and all children. w
Args:
browser_process: A psutil.Process object associated with the
browser process.
Returns:
A list of pids as integers.
| Get the pids for the browser and all children. w
Args:
browser_process: A psutil.Process object associated with the
browser process.
A list of pids as integers. | [
"Get",
"the",
"pids",
"for",
"the",
"browser",
"and",
"all",
"children",
".",
"w",
"Args",
":",
"browser_process",
":",
"A",
"psutil",
".",
"Process",
"object",
"associated",
"with",
"the",
"browser",
"process",
".",
"A",
"list",
"of",
"pids",
"as",
"int... | def GetAllPids(self, browser_process):
pids = [browser_process.pid]
try:
children = browser_process.children(recursive=True)
except psutil.NoSuchProcess:
return []
for child in children:
pids.append(child.pid)
return pids | [
"def",
"GetAllPids",
"(",
"self",
",",
"browser_process",
")",
":",
"pids",
"=",
"[",
"browser_process",
".",
"pid",
"]",
"try",
":",
"children",
"=",
"browser_process",
".",
"children",
"(",
"recursive",
"=",
"True",
")",
"except",
"psutil",
".",
"NoSuchP... | Get the pids for the browser and all children. | [
"Get",
"the",
"pids",
"for",
"the",
"browser",
"and",
"all",
"children",
"."
] | [
"\"\"\"Get the pids for the browser and all children. w\n\n Args:\n browser_process: A psutil.Process object associated with the\n browser process.\n\n Returns:\n A list of pids as integers.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "browser_process",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "browser_process",
"type": null,
"docstring": null,
"docstring... |
b227903c4b8359fa45de084d28b609640144503f | sunlongbo/chromium | tools/mac/power/driver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Profile | <not_specific> | def Profile(self, scenario_config, profile_mode):
"""Cover the running of the scenario with DTrace and save the
results.
Args:
profile_mode: A string describing the Profile mode between "wakeups"
and "cpu_time".
Raises:
TimeoutExpired: When a DTrace process takes more than 30 seconds... | Cover the running of the scenario with DTrace and save the
results.
Args:
profile_mode: A string describing the Profile mode between "wakeups"
and "cpu_time".
Raises:
TimeoutExpired: When a DTrace process takes more than 30 seconds to
terminate after the end of the scenario.
| Cover the running of the scenario with DTrace and save the
results.
A string describing the Profile mode between "wakeups"
and "cpu_time".
When a DTrace process takes more than 30 seconds to
terminate after the end of the scenario. | [
"Cover",
"the",
"running",
"of",
"the",
"scenario",
"with",
"DTrace",
"and",
"save",
"the",
"results",
".",
"A",
"string",
"describing",
"the",
"Profile",
"mode",
"between",
"\"",
"wakeups",
"\"",
"and",
"\"",
"cpu_time",
"\"",
".",
"When",
"a",
"DTrace",
... | def Profile(self, scenario_config, profile_mode):
if scenario_config["browser"] != "Chromium":
logging.error("Only Chromium can be profiled! Skipping.")
return
script_process = self.RunScenario(scenario_config)
browser_process = self.FindBrowserProcess(scenario_config["browser"])
dtrace_env ... | [
"def",
"Profile",
"(",
"self",
",",
"scenario_config",
",",
"profile_mode",
")",
":",
"if",
"scenario_config",
"[",
"\"browser\"",
"]",
"!=",
"\"Chromium\"",
":",
"logging",
".",
"error",
"(",
"\"Only Chromium can be profiled! Skipping.\"",
")",
"return",
"script_pr... | Cover the running of the scenario with DTrace and save the
results. | [
"Cover",
"the",
"running",
"of",
"the",
"scenario",
"with",
"DTrace",
"and",
"save",
"the",
"results",
"."
] | [
"\"\"\"Cover the running of the scenario with DTrace and save the\n results.\n\n Args:\n profile_mode: A string describing the Profile mode between \"wakeups\"\n and \"cpu_time\".\n\n Raises:\n TimeoutExpired: When a DTrace process takes more than 30 seconds to\n terminate after the end... | [
{
"param": "self",
"type": null
},
{
"param": "scenario_config",
"type": null
},
{
"param": "profile_mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scenario_config",
"type": null,
"docstring": null,
"docstring... |
46c6f2aacf8616022d21f14013d5956f87007145 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/filter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | validate_filter_rules | null | def validate_filter_rules(filter_rules, all_categories):
"""Validate the given filter rules, and raise a ValueError if not valid.
Args:
filter_rules: A list of boolean filter rules, for example--
["-whitespace", "+whitespace/braces"]
all_categories: A list of all available categ... | Validate the given filter rules, and raise a ValueError if not valid.
Args:
filter_rules: A list of boolean filter rules, for example--
["-whitespace", "+whitespace/braces"]
all_categories: A list of all available category names, for example--
["whitespace/tabs... | Validate the given filter rules, and raise a ValueError if not valid. | [
"Validate",
"the",
"given",
"filter",
"rules",
"and",
"raise",
"a",
"ValueError",
"if",
"not",
"valid",
"."
] | def validate_filter_rules(filter_rules, all_categories):
for rule in filter_rules:
if not (rule.startswith('+') or rule.startswith('-')):
raise ValueError('Invalid filter rule "%s": every rule '
'must start with + or -.' % rule)
for category in all_categories... | [
"def",
"validate_filter_rules",
"(",
"filter_rules",
",",
"all_categories",
")",
":",
"for",
"rule",
"in",
"filter_rules",
":",
"if",
"not",
"(",
"rule",
".",
"startswith",
"(",
"'+'",
")",
"or",
"rule",
".",
"startswith",
"(",
"'-'",
")",
")",
":",
"rai... | Validate the given filter rules, and raise a ValueError if not valid. | [
"Validate",
"the",
"given",
"filter",
"rules",
"and",
"raise",
"a",
"ValueError",
"if",
"not",
"valid",
"."
] | [
"\"\"\"Validate the given filter rules, and raise a ValueError if not valid.\n\n Args:\n filter_rules: A list of boolean filter rules, for example--\n [\"-whitespace\", \"+whitespace/braces\"]\n all_categories: A list of all available category names, for example--\n ... | [
{
"param": "filter_rules",
"type": null
},
{
"param": "all_categories",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "An error occurs if a filter rule does not begin\nwith \"+\" or \"-\" or if a filter rule does not match\nthe beginning of some category name in the list\nof all available categories.",
"docstring_tokens": [
"An",
"error",
"occurs",... |
46c6f2aacf8616022d21f14013d5956f87007145 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/filter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | should_check | <not_specific> | def should_check(self, category):
"""Return whether the category should be checked.
The rules for determining whether a category should be checked
are as follows. By default all categories should be checked.
Then apply the filter rules in order from first to last, with
later fl... | Return whether the category should be checked.
The rules for determining whether a category should be checked
are as follows. By default all categories should be checked.
Then apply the filter rules in order from first to last, with
later flags taking precedence.
A filter rule... | Return whether the category should be checked.
The rules for determining whether a category should be checked
are as follows. By default all categories should be checked.
Then apply the filter rules in order from first to last, with
later flags taking precedence.
A filter rule applies to a category if the string afte... | [
"Return",
"whether",
"the",
"category",
"should",
"be",
"checked",
".",
"The",
"rules",
"for",
"determining",
"whether",
"a",
"category",
"should",
"be",
"checked",
"are",
"as",
"follows",
".",
"By",
"default",
"all",
"categories",
"should",
"be",
"checked",
... | def should_check(self, category):
if category in self._should_check_category:
return self._should_check_category[category]
should_check = True
for rule in self._filter_rules:
if not category.startswith(rule[1:]):
continue
should_check = rule.... | [
"def",
"should_check",
"(",
"self",
",",
"category",
")",
":",
"if",
"category",
"in",
"self",
".",
"_should_check_category",
":",
"return",
"self",
".",
"_should_check_category",
"[",
"category",
"]",
"should_check",
"=",
"True",
"for",
"rule",
"in",
"self",
... | Return whether the category should be checked. | [
"Return",
"whether",
"the",
"category",
"should",
"be",
"checked",
"."
] | [
"\"\"\"Return whether the category should be checked.\n\n The rules for determining whether a category should be checked\n are as follows. By default all categories should be checked.\n Then apply the filter rules in order from first to last, with\n later flags taking precedence.\n\n ... | [
{
"param": "self",
"type": null
},
{
"param": "category",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "category",
"type": null,
"docstring": null,
"docstring_tokens... |
46c6f2aacf8616022d21f14013d5956f87007145 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/filter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _get_path_specific_lower | <not_specific> | def _get_path_specific_lower(self):
"""Return a copy of self._path_specific with the paths lower-cased."""
if self._path_specific_lower is None:
self._path_specific_lower = []
for (sub_paths, path_rules) in self._path_specific:
sub_paths = list(map(str.lower, sub_... | Return a copy of self._path_specific with the paths lower-cased. | Return a copy of self._path_specific with the paths lower-cased. | [
"Return",
"a",
"copy",
"of",
"self",
".",
"_path_specific",
"with",
"the",
"paths",
"lower",
"-",
"cased",
"."
] | def _get_path_specific_lower(self):
if self._path_specific_lower is None:
self._path_specific_lower = []
for (sub_paths, path_rules) in self._path_specific:
sub_paths = list(map(str.lower, sub_paths))
self._path_specific_lower.append((sub_paths, path_rules... | [
"def",
"_get_path_specific_lower",
"(",
"self",
")",
":",
"if",
"self",
".",
"_path_specific_lower",
"is",
"None",
":",
"self",
".",
"_path_specific_lower",
"=",
"[",
"]",
"for",
"(",
"sub_paths",
",",
"path_rules",
")",
"in",
"self",
".",
"_path_specific",
... | Return a copy of self._path_specific with the paths lower-cased. | [
"Return",
"a",
"copy",
"of",
"self",
".",
"_path_specific",
"with",
"the",
"paths",
"lower",
"-",
"cased",
"."
] | [
"\"\"\"Return a copy of self._path_specific with the paths lower-cased.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
46c6f2aacf8616022d21f14013d5956f87007145 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/filter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _path_rules_from_path | <not_specific> | def _path_rules_from_path(self, path):
"""Determine the path-specific rules to use, and return as a tuple.
This method returns a tuple rather than a list so the return
value can be passed to _filter_from_path_rules() without change.
"""
path = path.lower()
for (sub_pat... | Determine the path-specific rules to use, and return as a tuple.
This method returns a tuple rather than a list so the return
value can be passed to _filter_from_path_rules() without change.
| Determine the path-specific rules to use, and return as a tuple.
This method returns a tuple rather than a list so the return
value can be passed to _filter_from_path_rules() without change. | [
"Determine",
"the",
"path",
"-",
"specific",
"rules",
"to",
"use",
"and",
"return",
"as",
"a",
"tuple",
".",
"This",
"method",
"returns",
"a",
"tuple",
"rather",
"than",
"a",
"list",
"so",
"the",
"return",
"value",
"can",
"be",
"passed",
"to",
"_filter_f... | def _path_rules_from_path(self, path):
path = path.lower()
for (sub_paths, path_rules) in self._get_path_specific_lower():
for sub_path in sub_paths:
if path.find(sub_path) > -1:
return tuple(path_rules)
return () | [
"def",
"_path_rules_from_path",
"(",
"self",
",",
"path",
")",
":",
"path",
"=",
"path",
".",
"lower",
"(",
")",
"for",
"(",
"sub_paths",
",",
"path_rules",
")",
"in",
"self",
".",
"_get_path_specific_lower",
"(",
")",
":",
"for",
"sub_path",
"in",
"sub_... | Determine the path-specific rules to use, and return as a tuple. | [
"Determine",
"the",
"path",
"-",
"specific",
"rules",
"to",
"use",
"and",
"return",
"as",
"a",
"tuple",
"."
] | [
"\"\"\"Determine the path-specific rules to use, and return as a tuple.\n\n This method returns a tuple rather than a list so the return\n value can be passed to _filter_from_path_rules() without change.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [... |
46c6f2aacf8616022d21f14013d5956f87007145 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/filter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _filter_from_path_rules | <not_specific> | def _filter_from_path_rules(self, path_rules):
"""Return the CategoryFilter associated to the given path rules.
Args:
path_rules: A tuple of path rules. We require a tuple rather
than a list so the value can be used as a dictionary
key in self._pat... | Return the CategoryFilter associated to the given path rules.
Args:
path_rules: A tuple of path rules. We require a tuple rather
than a list so the value can be used as a dictionary
key in self._path_rules_to_filter.
| Return the CategoryFilter associated to the given path rules. | [
"Return",
"the",
"CategoryFilter",
"associated",
"to",
"the",
"given",
"path",
"rules",
"."
] | def _filter_from_path_rules(self, path_rules):
if path_rules not in self._path_rules_to_filter:
rules = list(self._base_rules)
rules.extend(path_rules)
rules.extend(self._user_rules)
self._path_rules_to_filter[path_rules] = _CategoryFilter(rules)
return ... | [
"def",
"_filter_from_path_rules",
"(",
"self",
",",
"path_rules",
")",
":",
"if",
"path_rules",
"not",
"in",
"self",
".",
"_path_rules_to_filter",
":",
"rules",
"=",
"list",
"(",
"self",
".",
"_base_rules",
")",
"rules",
".",
"extend",
"(",
"path_rules",
")"... | Return the CategoryFilter associated to the given path rules. | [
"Return",
"the",
"CategoryFilter",
"associated",
"to",
"the",
"given",
"path",
"rules",
"."
] | [
"\"\"\"Return the CategoryFilter associated to the given path rules.\n\n Args:\n path_rules: A tuple of path rules. We require a tuple rather\n than a list so the value can be used as a dictionary\n key in self._path_rules_to_filter.\n \"\"\"",
"# ... | [
{
"param": "self",
"type": null
},
{
"param": "path_rules",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path_rules",
"type": null,
"docstring": "A tuple of path rules. We... |
46c6f2aacf8616022d21f14013d5956f87007145 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/filter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _filter_from_path | <not_specific> | def _filter_from_path(self, path):
"""Return the CategoryFilter associated to a path."""
if path not in self._path_to_filter:
path_rules = self._path_rules_from_path(path)
filter = self._filter_from_path_rules(path_rules)
self._path_to_filter[path] = filter
r... | Return the CategoryFilter associated to a path. | Return the CategoryFilter associated to a path. | [
"Return",
"the",
"CategoryFilter",
"associated",
"to",
"a",
"path",
"."
] | def _filter_from_path(self, path):
if path not in self._path_to_filter:
path_rules = self._path_rules_from_path(path)
filter = self._filter_from_path_rules(path_rules)
self._path_to_filter[path] = filter
return self._path_to_filter[path] | [
"def",
"_filter_from_path",
"(",
"self",
",",
"path",
")",
":",
"if",
"path",
"not",
"in",
"self",
".",
"_path_to_filter",
":",
"path_rules",
"=",
"self",
".",
"_path_rules_from_path",
"(",
"path",
")",
"filter",
"=",
"self",
".",
"_filter_from_path_rules",
... | Return the CategoryFilter associated to a path. | [
"Return",
"the",
"CategoryFilter",
"associated",
"to",
"a",
"path",
"."
] | [
"\"\"\"Return the CategoryFilter associated to a path.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [... |
46c6f2aacf8616022d21f14013d5956f87007145 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/filter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | should_check | <not_specific> | def should_check(self, category, path):
"""Return whether the given category should be checked.
This method determines whether a category should be checked
by checking the category name against the filter rules for
the given path.
For a given path, the filter rules are the comb... | Return whether the given category should be checked.
This method determines whether a category should be checked
by checking the category name against the filter rules for
the given path.
For a given path, the filter rules are the combination of
the base rules, the path-specifi... | Return whether the given category should be checked.
This method determines whether a category should be checked
by checking the category name against the filter rules for
the given path.
For a given path, the filter rules are the combination of
the base rules, the path-specific rules, and the user-provided
rules -- i... | [
"Return",
"whether",
"the",
"given",
"category",
"should",
"be",
"checked",
".",
"This",
"method",
"determines",
"whether",
"a",
"category",
"should",
"be",
"checked",
"by",
"checking",
"the",
"category",
"name",
"against",
"the",
"filter",
"rules",
"for",
"th... | def should_check(self, category, path):
return self._filter_from_path(path).should_check(category) | [
"def",
"should_check",
"(",
"self",
",",
"category",
",",
"path",
")",
":",
"return",
"self",
".",
"_filter_from_path",
"(",
"path",
")",
".",
"should_check",
"(",
"category",
")"
] | Return whether the given category should be checked. | [
"Return",
"whether",
"the",
"given",
"category",
"should",
"be",
"checked",
"."
] | [
"\"\"\"Return whether the given category should be checked.\n\n This method determines whether a category should be checked\n by checking the category name against the filter rules for\n the given path.\n\n For a given path, the filter rules are the combination of\n the base rules... | [
{
"param": "self",
"type": null
},
{
"param": "category",
"type": null
},
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "category",
"type": null,
"docstring": "The category name.",
"... |
ab46476ae657795cb4e39dfbe7e8854902c893d0 | sunlongbo/chromium | tools/binary_size/libsupersize/bcanalyzer_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _MakeBytes | <not_specific> | def _MakeBytes(bits, toks):
"""Creates a multi-byte string from ASCII strings and/or ASCII codes.
Args:
bits: Number of bits per character, must be in {8, 16, 32}.
toks: A list of tokens, each of which is a ASCII strings or an integer
representing a character's ASCII value (e.g., 0 for terminating nu... | Creates a multi-byte string from ASCII strings and/or ASCII codes.
Args:
bits: Number of bits per character, must be in {8, 16, 32}.
toks: A list of tokens, each of which is a ASCII strings or an integer
representing a character's ASCII value (e.g., 0 for terminating null).
Returns: A flattened stri... | Creates a multi-byte string from ASCII strings and/or ASCII codes. | [
"Creates",
"a",
"multi",
"-",
"byte",
"string",
"from",
"ASCII",
"strings",
"and",
"/",
"or",
"ASCII",
"codes",
"."
] | def _MakeBytes(bits, toks):
cfi = itertools.chain.from_iterable
chars = cfi(map(ord, t) if isinstance(t, str) else (t, ) for t in toks)
return bytes(cfi((c >> (8 * i) for i in range(bits // 8)) for c in chars)) | [
"def",
"_MakeBytes",
"(",
"bits",
",",
"toks",
")",
":",
"cfi",
"=",
"itertools",
".",
"chain",
".",
"from_iterable",
"chars",
"=",
"cfi",
"(",
"map",
"(",
"ord",
",",
"t",
")",
"if",
"isinstance",
"(",
"t",
",",
"str",
")",
"else",
"(",
"t",
","... | Creates a multi-byte string from ASCII strings and/or ASCII codes. | [
"Creates",
"a",
"multi",
"-",
"byte",
"string",
"from",
"ASCII",
"strings",
"and",
"/",
"or",
"ASCII",
"codes",
"."
] | [
"\"\"\"Creates a multi-byte string from ASCII strings and/or ASCII codes.\n\n Args:\n bits: Number of bits per character, must be in {8, 16, 32}.\n toks: A list of tokens, each of which is a ASCII strings or an integer\n representing a character's ASCII value (e.g., 0 for terminating null).\n\n Returns... | [
{
"param": "bits",
"type": null
},
{
"param": "toks",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bits",
"type": null,
"docstring": "Number of bits per character, must be in {8, 16, 32}.",
"docstring_tokens": [
"Number",
"of",
"bits",
"per",
"character",
"must",
"be",... |
3bba7dd2858128342b2f0b26ddccf6e3ed07c883 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/module.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Repr | <not_specific> | def Repr(obj, as_ref=True):
"""A version of __repr__ that can distinguish references.
Sometimes we like to print an object's full representation
(e.g. with its fields) and sometimes we just want to reference an
object that was printed in full elsewhere. This function allows us
to make that distinction.
Ar... | A version of __repr__ that can distinguish references.
Sometimes we like to print an object's full representation
(e.g. with its fields) and sometimes we just want to reference an
object that was printed in full elsewhere. This function allows us
to make that distinction.
Args:
obj: The object whose str... | A version of __repr__ that can distinguish references.
Sometimes we like to print an object's full representation
and sometimes we just want to reference an
object that was printed in full elsewhere. This function allows us
to make that distinction. | [
"A",
"version",
"of",
"__repr__",
"that",
"can",
"distinguish",
"references",
".",
"Sometimes",
"we",
"like",
"to",
"print",
"an",
"object",
"'",
"s",
"full",
"representation",
"and",
"sometimes",
"we",
"just",
"want",
"to",
"reference",
"an",
"object",
"tha... | def Repr(obj, as_ref=True):
if hasattr(obj, 'Repr'):
return obj.Repr(as_ref=as_ref)
elif isinstance(obj, list):
if not obj:
return '[]'
else:
return ('[\n%s\n]' % (',\n'.join(
' %s' % Repr(elem, as_ref).replace('\n', '\n ')
for elem in obj)))
elif isinstance(obj, ... | [
"def",
"Repr",
"(",
"obj",
",",
"as_ref",
"=",
"True",
")",
":",
"if",
"hasattr",
"(",
"obj",
",",
"'Repr'",
")",
":",
"return",
"obj",
".",
"Repr",
"(",
"as_ref",
"=",
"as_ref",
")",
"elif",
"isinstance",
"(",
"obj",
",",
"list",
")",
":",
"if",... | A version of __repr__ that can distinguish references. | [
"A",
"version",
"of",
"__repr__",
"that",
"can",
"distinguish",
"references",
"."
] | [
"\"\"\"A version of __repr__ that can distinguish references.\n\n Sometimes we like to print an object's full representation\n (e.g. with its fields) and sometimes we just want to reference an\n object that was printed in full elsewhere. This function allows us\n to make that distinction.\n\n Args:\n obj: T... | [
{
"param": "obj",
"type": null
},
{
"param": "as_ref",
"type": null
}
] | {
"returns": [
{
"docstring": "A str representation of |obj|.",
"docstring_tokens": [
"A",
"str",
"representation",
"of",
"|obj|",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "obj",
"type": nul... |
3bba7dd2858128342b2f0b26ddccf6e3ed07c883 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/module.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GenericRepr | <not_specific> | def GenericRepr(obj, names):
"""Compute generic Repr for |obj| based on the attributes in |names|.
Args:
obj: The object to compute a Repr for.
names: A dict from attribute names to include, to booleans
specifying whether those attributes should be shown as
references or not.
Returns:
... | Compute generic Repr for |obj| based on the attributes in |names|.
Args:
obj: The object to compute a Repr for.
names: A dict from attribute names to include, to booleans
specifying whether those attributes should be shown as
references or not.
Returns:
A str representation of |obj|.
... | Compute generic Repr for |obj| based on the attributes in |names|. | [
"Compute",
"generic",
"Repr",
"for",
"|obj|",
"based",
"on",
"the",
"attributes",
"in",
"|names|",
"."
] | def GenericRepr(obj, names):
def ReprIndent(name, as_ref):
return ' %s=%s' % (name, Repr(getattr(obj, name), as_ref).replace(
'\n', '\n '))
return '%s(\n%s\n)' % (obj.__class__.__name__, ',\n'.join(
ReprIndent(name, as_ref) for (name, as_ref) in names.items())) | [
"def",
"GenericRepr",
"(",
"obj",
",",
"names",
")",
":",
"def",
"ReprIndent",
"(",
"name",
",",
"as_ref",
")",
":",
"return",
"' %s=%s'",
"%",
"(",
"name",
",",
"Repr",
"(",
"getattr",
"(",
"obj",
",",
"name",
")",
",",
"as_ref",
")",
".",
"rep... | Compute generic Repr for |obj| based on the attributes in |names|. | [
"Compute",
"generic",
"Repr",
"for",
"|obj|",
"based",
"on",
"the",
"attributes",
"in",
"|names|",
"."
] | [
"\"\"\"Compute generic Repr for |obj| based on the attributes in |names|.\n\n Args:\n obj: The object to compute a Repr for.\n names: A dict from attribute names to include, to booleans\n specifying whether those attributes should be shown as\n references or not.\n\n Returns:\n A str repres... | [
{
"param": "obj",
"type": null
},
{
"param": "names",
"type": null
}
] | {
"returns": [
{
"docstring": "A str representation of |obj|.",
"docstring_tokens": [
"A",
"str",
"representation",
"of",
"|obj|",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "obj",
"type": nul... |
3bba7dd2858128342b2f0b26ddccf6e3ed07c883 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/module.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AddSharedProperty | <not_specific> | def AddSharedProperty(cls, name):
"""Adds a property |name| to |cls|, which accesses the corresponding item in
|shared_definition|.
The reason of adding such indirection is to enable sharing definition
between a reference kind and its nullable variation. For example:
a = Struct('test_... | Adds a property |name| to |cls|, which accesses the corresponding item in
|shared_definition|.
The reason of adding such indirection is to enable sharing definition
between a reference kind and its nullable variation. For example:
a = Struct('test_struct_1')
b = a.MakeNullableKin... |
The reason of adding such indirection is to enable sharing definition
between a reference kind and its nullable variation. | [
"The",
"reason",
"of",
"adding",
"such",
"indirection",
"is",
"to",
"enable",
"sharing",
"definition",
"between",
"a",
"reference",
"kind",
"and",
"its",
"nullable",
"variation",
"."
] | def AddSharedProperty(cls, name):
def Get(self):
try:
return self.shared_definition[name]
except KeyError:
raise AttributeError
def Set(self, value):
self.shared_definition[name] = value
setattr(cls, name, property(Get, Set)) | [
"def",
"AddSharedProperty",
"(",
"cls",
",",
"name",
")",
":",
"def",
"Get",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"shared_definition",
"[",
"name",
"]",
"except",
"KeyError",
":",
"raise",
"AttributeError",
"def",
"Set",
"(",
"self",... | Adds a property |name| to |cls|, which accesses the corresponding item in
|shared_definition|. | [
"Adds",
"a",
"property",
"|name|",
"to",
"|cls|",
"which",
"accesses",
"the",
"corresponding",
"item",
"in",
"|shared_definition|",
"."
] | [
"\"\"\"Adds a property |name| to |cls|, which accesses the corresponding item in\n |shared_definition|.\n\n The reason of adding such indirection is to enable sharing definition\n between a reference kind and its nullable variation. For example:\n a = Struct('test_struct_1')\n b = ... | [
{
"param": "cls",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": []... |
3bba7dd2858128342b2f0b26ddccf6e3ed07c883 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/module.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | IsBackwardCompatible | <not_specific> | def IsBackwardCompatible(self, older_struct, checker):
"""This struct is backward-compatible with older_struct if and only if all
of the following conditions hold:
- Any newly added field is tagged with a [MinVersion] attribute specifying
a version number greater than all previously used [MinVersi... | This struct is backward-compatible with older_struct if and only if all
of the following conditions hold:
- Any newly added field is tagged with a [MinVersion] attribute specifying
a version number greater than all previously used [MinVersion]
attributes within the struct.
- All fields p... | This struct is backward-compatible with older_struct if and only if all
of the following conditions hold:
Any newly added field is tagged with a [MinVersion] attribute specifying
a version number greater than all previously used [MinVersion]
attributes within the struct.
All fields present in older_struct remain presen... | [
"This",
"struct",
"is",
"backward",
"-",
"compatible",
"with",
"older_struct",
"if",
"and",
"only",
"if",
"all",
"of",
"the",
"following",
"conditions",
"hold",
":",
"Any",
"newly",
"added",
"field",
"is",
"tagged",
"with",
"a",
"[",
"MinVersion",
"]",
"at... | def IsBackwardCompatible(self, older_struct, checker):
def buildOrdinalFieldMap(struct):
fields_by_ordinal = {}
for field in struct.fields:
if field.ordinal in fields_by_ordinal:
raise Exception('Multiple fields with ordinal %s in struct %s.' %
(field.ordinal,... | [
"def",
"IsBackwardCompatible",
"(",
"self",
",",
"older_struct",
",",
"checker",
")",
":",
"def",
"buildOrdinalFieldMap",
"(",
"struct",
")",
":",
"fields_by_ordinal",
"=",
"{",
"}",
"for",
"field",
"in",
"struct",
".",
"fields",
":",
"if",
"field",
".",
"... | This struct is backward-compatible with older_struct if and only if all
of the following conditions hold:
Any newly added field is tagged with a [MinVersion] attribute specifying
a version number greater than all previously used [MinVersion]
attributes within the struct. | [
"This",
"struct",
"is",
"backward",
"-",
"compatible",
"with",
"older_struct",
"if",
"and",
"only",
"if",
"all",
"of",
"the",
"following",
"conditions",
"hold",
":",
"Any",
"newly",
"added",
"field",
"is",
"tagged",
"with",
"a",
"[",
"MinVersion",
"]",
"at... | [
"\"\"\"This struct is backward-compatible with older_struct if and only if all\n of the following conditions hold:\n - Any newly added field is tagged with a [MinVersion] attribute specifying\n a version number greater than all previously used [MinVersion]\n attributes within the struct.\n ... | [
{
"param": "self",
"type": null
},
{
"param": "older_struct",
"type": null
},
{
"param": "checker",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "older_struct",
"type": null,
"docstring": null,
"docstring_to... |
3bba7dd2858128342b2f0b26ddccf6e3ed07c883 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/module.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | IsBackwardCompatible | <not_specific> | def IsBackwardCompatible(self, older_union, checker):
"""This union is backward-compatible with older_union if and only if all
of the following conditions hold:
- Any newly added field is tagged with a [MinVersion] attribute specifying
a version number greater than all previously used [MinVersion]... | This union is backward-compatible with older_union if and only if all
of the following conditions hold:
- Any newly added field is tagged with a [MinVersion] attribute specifying
a version number greater than all previously used [MinVersion]
attributes within the union.
- All fields pres... | This union is backward-compatible with older_union if and only if all
of the following conditions hold:
Any newly added field is tagged with a [MinVersion] attribute specifying
a version number greater than all previously used [MinVersion]
attributes within the union.
All fields present in older_union remain present in... | [
"This",
"union",
"is",
"backward",
"-",
"compatible",
"with",
"older_union",
"if",
"and",
"only",
"if",
"all",
"of",
"the",
"following",
"conditions",
"hold",
":",
"Any",
"newly",
"added",
"field",
"is",
"tagged",
"with",
"a",
"[",
"MinVersion",
"]",
"attr... | def IsBackwardCompatible(self, older_union, checker):
def buildOrdinalFieldMap(union):
fields_by_ordinal = {}
for field in union.fields:
if field.ordinal in fields_by_ordinal:
raise Exception('Multiple fields with ordinal %s in union %s.' %
(field.ordinal, uni... | [
"def",
"IsBackwardCompatible",
"(",
"self",
",",
"older_union",
",",
"checker",
")",
":",
"def",
"buildOrdinalFieldMap",
"(",
"union",
")",
":",
"fields_by_ordinal",
"=",
"{",
"}",
"for",
"field",
"in",
"union",
".",
"fields",
":",
"if",
"field",
".",
"ord... | This union is backward-compatible with older_union if and only if all
of the following conditions hold:
Any newly added field is tagged with a [MinVersion] attribute specifying
a version number greater than all previously used [MinVersion]
attributes within the union. | [
"This",
"union",
"is",
"backward",
"-",
"compatible",
"with",
"older_union",
"if",
"and",
"only",
"if",
"all",
"of",
"the",
"following",
"conditions",
"hold",
":",
"Any",
"newly",
"added",
"field",
"is",
"tagged",
"with",
"a",
"[",
"MinVersion",
"]",
"attr... | [
"\"\"\"This union is backward-compatible with older_union if and only if all\n of the following conditions hold:\n - Any newly added field is tagged with a [MinVersion] attribute specifying\n a version number greater than all previously used [MinVersion]\n attributes within the union.\n -... | [
{
"param": "self",
"type": null
},
{
"param": "older_union",
"type": null
},
{
"param": "checker",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "older_union",
"type": null,
"docstring": null,
"docstring_tok... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.