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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
509745ee1971149664876c5f5d7a7c308e83dccd | sunlongbo/chromium | chrome/browser/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CommonChecks | <not_specific> | def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
results = []
results.extend(_CheckUnwantedDependencies(input_api, output_api))
results.extend(_RunHistogramChecks(input_api, output_api,
"BadMessageReasonChrome"))
return results | Checks common to both upload and commit. | Checks common to both upload and commit. | [
"Checks",
"common",
"to",
"both",
"upload",
"and",
"commit",
"."
] | def _CommonChecks(input_api, output_api):
results = []
results.extend(_CheckUnwantedDependencies(input_api, output_api))
results.extend(_RunHistogramChecks(input_api, output_api,
"BadMessageReasonChrome"))
return results | [
"def",
"_CommonChecks",
"(",
"input_api",
",",
"output_api",
")",
":",
"results",
"=",
"[",
"]",
"results",
".",
"extend",
"(",
"_CheckUnwantedDependencies",
"(",
"input_api",
",",
"output_api",
")",
")",
"results",
".",
"extend",
"(",
"_RunHistogramChecks",
"... | Checks common to both upload and commit. | [
"Checks",
"common",
"to",
"both",
"upload",
"and",
"commit",
"."
] | [
"\"\"\"Checks common to both upload and commit.\"\"\""
] | [
{
"param": "input_api",
"type": null
},
{
"param": "output_api",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_api",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output_api",
"type": null,
"docstring": null,
"docstring... |
0008ebabdcc349adba28b3bbf69dba406ae6d8be | sunlongbo/chromium | tools/metrics/histograms/extract_histograms_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testComponentExtraction | null | def testComponentExtraction(self):
"""Checks that components are successfully extracted from histograms."""
histogram = xml.dom.minidom.parseString("""
<histogram-configuration>
<histograms>
<histogram name="Coffee" expires_after="2022-01-01">
<owner>histogram_owner@google.com</owner>
<summary>An ode ... | Checks that components are successfully extracted from histograms. | Checks that components are successfully extracted from histograms. | [
"Checks",
"that",
"components",
"are",
"successfully",
"extracted",
"from",
"histograms",
"."
] | def testComponentExtraction(self):
histogram = xml.dom.minidom.parseString("""
<histogram-configuration>
<histograms>
<histogram name="Coffee" expires_after="2022-01-01">
<owner>histogram_owner@google.com</owner>
<summary>An ode to coffee.</summary>
<component>Liquid>Hot</component>
<component>... | [
"def",
"testComponentExtraction",
"(",
"self",
")",
":",
"histogram",
"=",
"xml",
".",
"dom",
".",
"minidom",
".",
"parseString",
"(",
"\"\"\"\n<histogram-configuration>\n<histograms>\n <histogram name=\"Coffee\" expires_after=\"2022-01-01\">\n <owner>histogram_owner@google.com</... | Checks that components are successfully extracted from histograms. | [
"Checks",
"that",
"components",
"are",
"successfully",
"extracted",
"from",
"histograms",
"."
] | [
"\"\"\"Checks that components are successfully extracted from histograms.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0008ebabdcc349adba28b3bbf69dba406ae6d8be | sunlongbo/chromium | tools/metrics/histograms/extract_histograms_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testUpdateNameDuplicateVariant | null | def testUpdateNameDuplicateVariant(self, _, input_xml):
"""Tests that if duplicate names are generated due to multiple tokens
having the same variant and empty string variant, an error is reported."""
histogram_with_duplicate_variant = xml.dom.minidom.parseString(input_xml)
histograms_dict, _ = extract_... | Tests that if duplicate names are generated due to multiple tokens
having the same variant and empty string variant, an error is reported. | Tests that if duplicate names are generated due to multiple tokens
having the same variant and empty string variant, an error is reported. | [
"Tests",
"that",
"if",
"duplicate",
"names",
"are",
"generated",
"due",
"to",
"multiple",
"tokens",
"having",
"the",
"same",
"variant",
"and",
"empty",
"string",
"variant",
"an",
"error",
"is",
"reported",
"."
] | def testUpdateNameDuplicateVariant(self, _, input_xml):
histogram_with_duplicate_variant = xml.dom.minidom.parseString(input_xml)
histograms_dict, _ = extract_histograms._ExtractHistogramsFromXmlTree(
histogram_with_duplicate_variant, {})
_, have_errors = extract_histograms._UpdateHistogramsWithToke... | [
"def",
"testUpdateNameDuplicateVariant",
"(",
"self",
",",
"_",
",",
"input_xml",
")",
":",
"histogram_with_duplicate_variant",
"=",
"xml",
".",
"dom",
".",
"minidom",
".",
"parseString",
"(",
"input_xml",
")",
"histograms_dict",
",",
"_",
"=",
"extract_histograms... | Tests that if duplicate names are generated due to multiple tokens
having the same variant and empty string variant, an error is reported. | [
"Tests",
"that",
"if",
"duplicate",
"names",
"are",
"generated",
"due",
"to",
"multiple",
"tokens",
"having",
"the",
"same",
"variant",
"and",
"empty",
"string",
"variant",
"an",
"error",
"is",
"reported",
"."
] | [
"\"\"\"Tests that if duplicate names are generated due to multiple tokens\n having the same variant and empty string variant, an error is reported.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "_",
"type": null
},
{
"param": "input_xml",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "_",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
df14cbbf939380b854a55418b462276bc4c0ea3d | sunlongbo/chromium | tools/nocompile_driver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ValidateInput | null | def ValidateInput(compiler, parallelism, sourcefile_path, cflags,
resultfile_path):
"""Make sure the arguments being passed in are sane."""
assert os.path.isfile(compiler)
assert parallelism >= 1
assert type(sourcefile_path) is str
assert type(cflags) is list
for flag in cflags:
assert... | Make sure the arguments being passed in are sane. | Make sure the arguments being passed in are sane. | [
"Make",
"sure",
"the",
"arguments",
"being",
"passed",
"in",
"are",
"sane",
"."
] | def ValidateInput(compiler, parallelism, sourcefile_path, cflags,
resultfile_path):
assert os.path.isfile(compiler)
assert parallelism >= 1
assert type(sourcefile_path) is str
assert type(cflags) is list
for flag in cflags:
assert type(flag) is str
assert type(resultfile_path) is str | [
"def",
"ValidateInput",
"(",
"compiler",
",",
"parallelism",
",",
"sourcefile_path",
",",
"cflags",
",",
"resultfile_path",
")",
":",
"assert",
"os",
".",
"path",
".",
"isfile",
"(",
"compiler",
")",
"assert",
"parallelism",
">=",
"1",
"assert",
"type",
"(",... | Make sure the arguments being passed in are sane. | [
"Make",
"sure",
"the",
"arguments",
"being",
"passed",
"in",
"are",
"sane",
"."
] | [
"\"\"\"Make sure the arguments being passed in are sane.\"\"\""
] | [
{
"param": "compiler",
"type": null
},
{
"param": "parallelism",
"type": null
},
{
"param": "sourcefile_path",
"type": null
},
{
"param": "cflags",
"type": null
},
{
"param": "resultfile_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "compiler",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parallelism",
"type": null,
"docstring": null,
"docstring... |
df14cbbf939380b854a55418b462276bc4c0ea3d | sunlongbo/chromium | tools/nocompile_driver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParseExpectation | <not_specific> | def ParseExpectation(expectation_string):
"""Extracts expectation definition from the trailing comment on the ifdef.
See the comment on NCTEST_CONFIG_RE for examples of the format we are parsing.
Args:
expectation_string: A string like "// [r'some_regex']"
Returns:
A list of compiled regular expressi... | Extracts expectation definition from the trailing comment on the ifdef.
See the comment on NCTEST_CONFIG_RE for examples of the format we are parsing.
Args:
expectation_string: A string like "// [r'some_regex']"
Returns:
A list of compiled regular expressions indicating all possible valid
compiler ... | Extracts expectation definition from the trailing comment on the ifdef.
See the comment on NCTEST_CONFIG_RE for examples of the format we are parsing. | [
"Extracts",
"expectation",
"definition",
"from",
"the",
"trailing",
"comment",
"on",
"the",
"ifdef",
".",
"See",
"the",
"comment",
"on",
"NCTEST_CONFIG_RE",
"for",
"examples",
"of",
"the",
"format",
"we",
"are",
"parsing",
"."
] | def ParseExpectation(expectation_string):
assert expectation_string is not None
match = EXTRACT_EXPECTATION_RE.match(expectation_string)
assert match
raw_expectation = ast.literal_eval(match.group(1))
assert type(raw_expectation) is list
expectation = []
for regex_str in raw_expectation:
assert type(r... | [
"def",
"ParseExpectation",
"(",
"expectation_string",
")",
":",
"assert",
"expectation_string",
"is",
"not",
"None",
"match",
"=",
"EXTRACT_EXPECTATION_RE",
".",
"match",
"(",
"expectation_string",
")",
"assert",
"match",
"raw_expectation",
"=",
"ast",
".",
"literal... | Extracts expectation definition from the trailing comment on the ifdef. | [
"Extracts",
"expectation",
"definition",
"from",
"the",
"trailing",
"comment",
"on",
"the",
"ifdef",
"."
] | [
"\"\"\"Extracts expectation definition from the trailing comment on the ifdef.\n\n See the comment on NCTEST_CONFIG_RE for examples of the format we are parsing.\n\n Args:\n expectation_string: A string like \"// [r'some_regex']\"\n\n Returns:\n A list of compiled regular expressions indicating all possibl... | [
{
"param": "expectation_string",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of compiled regular expressions indicating all possible valid\ncompiler outputs. If the list is empty, all outputs are considered valid.",
"docstring_tokens": [
"A",
"list",
"of",
"compiled",
"regular",
"expressions... |
df14cbbf939380b854a55418b462276bc4c0ea3d | sunlongbo/chromium | tools/nocompile_driver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ExtractTestConfigs | <not_specific> | def ExtractTestConfigs(sourcefile_path, suite_name):
"""Parses the source file for test configurations.
Each no-compile test in the file is separated by an ifdef macro. We scan
the source file with the NCTEST_CONFIG_RE to find all ifdefs that look like
they demark one no-compile test and try to extract the te... | Parses the source file for test configurations.
Each no-compile test in the file is separated by an ifdef macro. We scan
the source file with the NCTEST_CONFIG_RE to find all ifdefs that look like
they demark one no-compile test and try to extract the test configuration
from that.
Args:
sourcefile_path... | Parses the source file for test configurations.
Each no-compile test in the file is separated by an ifdef macro. We scan
the source file with the NCTEST_CONFIG_RE to find all ifdefs that look like
they demark one no-compile test and try to extract the test configuration
from that. | [
"Parses",
"the",
"source",
"file",
"for",
"test",
"configurations",
".",
"Each",
"no",
"-",
"compile",
"test",
"in",
"the",
"file",
"is",
"separated",
"by",
"an",
"ifdef",
"macro",
".",
"We",
"scan",
"the",
"source",
"file",
"with",
"the",
"NCTEST_CONFIG_R... | def ExtractTestConfigs(sourcefile_path, suite_name):
sourcefile = open(sourcefile_path, 'r')
test_configs = []
for line in sourcefile:
match_result = NCTEST_CONFIG_RE.match(line)
if not match_result:
continue
groups = match_result.groups()
name = groups[0]
strip_result = STRIP_DEFINED_RE... | [
"def",
"ExtractTestConfigs",
"(",
"sourcefile_path",
",",
"suite_name",
")",
":",
"sourcefile",
"=",
"open",
"(",
"sourcefile_path",
",",
"'r'",
")",
"test_configs",
"=",
"[",
"]",
"for",
"line",
"in",
"sourcefile",
":",
"match_result",
"=",
"NCTEST_CONFIG_RE",
... | Parses the source file for test configurations. | [
"Parses",
"the",
"source",
"file",
"for",
"test",
"configurations",
"."
] | [
"\"\"\"Parses the source file for test configurations.\n\n Each no-compile test in the file is separated by an ifdef macro. We scan\n the source file with the NCTEST_CONFIG_RE to find all ifdefs that look like\n they demark one no-compile test and try to extract the test configuration\n from that.\n\n Args:\n... | [
{
"param": "sourcefile_path",
"type": null
},
{
"param": "suite_name",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of test configurations. Each test configuration is a dictionary of\nthe form.\n\n{ name: 'NCTEST_NAME'\nsuite_name: 'SOURCE_FILE_NAME'\nexpectations: [re.Pattern, re.Pattern] }\n\nThe |suite_name| is used to generate a pretty gtest output on successful\ncompletion of th... |
df14cbbf939380b854a55418b462276bc4c0ea3d | sunlongbo/chromium | tools/nocompile_driver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | StartTest | <not_specific> | def StartTest(compiler, sourcefile_path, tempfile_dir, cflags, config):
"""Start one negative compile test.
Args:
sourcefile_path: The path to the source file.
tempfile_dir: A directory to store temporary data from tests.
cflags: An array of strings with all the CFLAGS to give to gcc.
config: A dic... | Start one negative compile test.
Args:
sourcefile_path: The path to the source file.
tempfile_dir: A directory to store temporary data from tests.
cflags: An array of strings with all the CFLAGS to give to gcc.
config: A dictionary describing the test. See ExtractTestConfigs
for a description ... | Start one negative compile test. | [
"Start",
"one",
"negative",
"compile",
"test",
"."
] | def StartTest(compiler, sourcefile_path, tempfile_dir, cflags, config):
cmdline = [compiler]
cmdline.extend(cflags)
name = config['name']
expectations = config['expectations']
if expectations is not None:
cmdline.append('-D%s' % name)
cmdline.extend(['-o', '/dev/null', '-c', '-x', 'c++',
... | [
"def",
"StartTest",
"(",
"compiler",
",",
"sourcefile_path",
",",
"tempfile_dir",
",",
"cflags",
",",
"config",
")",
":",
"cmdline",
"=",
"[",
"compiler",
"]",
"cmdline",
".",
"extend",
"(",
"cflags",
")",
"name",
"=",
"config",
"[",
"'name'",
"]",
"expe... | Start one negative compile test. | [
"Start",
"one",
"negative",
"compile",
"test",
"."
] | [
"\"\"\"Start one negative compile test.\n\n Args:\n sourcefile_path: The path to the source file.\n tempfile_dir: A directory to store temporary data from tests.\n cflags: An array of strings with all the CFLAGS to give to gcc.\n config: A dictionary describing the test. See ExtractTestConfigs\n ... | [
{
"param": "compiler",
"type": null
},
{
"param": "sourcefile_path",
"type": null
},
{
"param": "tempfile_dir",
"type": null
},
{
"param": "cflags",
"type": null
},
{
"param": "config",
"type": null
}
] | {
"returns": [
{
"docstring": "A dictionary containing all the information about the started test. The\nfields in the dictionary are as follows:\n{ 'proc': A subprocess object representing the compiler run.\n'cmdline': The executed command line.\n'name': The name of the test.\n'suite_name': The suite name t... |
df14cbbf939380b854a55418b462276bc4c0ea3d | sunlongbo/chromium | tools/nocompile_driver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PassTest | null | def PassTest(resultfile, resultlog, test):
"""Logs the result of a test started by StartTest(), or a disabled test
configuration.
Args:
resultfile: File object for .cc file that results are written to.
resultlog: File object for the log file.
test: An instance of the dictionary returned by StartTest(... | Logs the result of a test started by StartTest(), or a disabled test
configuration.
Args:
resultfile: File object for .cc file that results are written to.
resultlog: File object for the log file.
test: An instance of the dictionary returned by StartTest(), a
configuration from ExtractTestCon... | Logs the result of a test started by StartTest(), or a disabled test
configuration. | [
"Logs",
"the",
"result",
"of",
"a",
"test",
"started",
"by",
"StartTest",
"()",
"or",
"a",
"disabled",
"test",
"configuration",
"."
] | def PassTest(resultfile, resultlog, test):
resultfile.write(GUNIT_TEMPLATE % (
test['suite_name'], test['name']))
if 'started_at' in test:
resultlog.write(LOG_TEMPLATE % (
test['suite_name'], test['name'],
test['finished_at'] - test['started_at'],
test['started_at'], test['finished... | [
"def",
"PassTest",
"(",
"resultfile",
",",
"resultlog",
",",
"test",
")",
":",
"resultfile",
".",
"write",
"(",
"GUNIT_TEMPLATE",
"%",
"(",
"test",
"[",
"'suite_name'",
"]",
",",
"test",
"[",
"'name'",
"]",
")",
")",
"if",
"'started_at'",
"in",
"test",
... | Logs the result of a test started by StartTest(), or a disabled test
configuration. | [
"Logs",
"the",
"result",
"of",
"a",
"test",
"started",
"by",
"StartTest",
"()",
"or",
"a",
"disabled",
"test",
"configuration",
"."
] | [
"\"\"\"Logs the result of a test started by StartTest(), or a disabled test\n configuration.\n\n Args:\n resultfile: File object for .cc file that results are written to.\n resultlog: File object for the log file.\n test: An instance of the dictionary returned by StartTest(), a\n configuration f... | [
{
"param": "resultfile",
"type": null
},
{
"param": "resultlog",
"type": null
},
{
"param": "test",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "resultfile",
"type": null,
"docstring": "File object for .cc file that results are written to.",
"docstring_tokens": [
"File",
"object",
"for",
".",
"cc",
"file",
"that",... |
df14cbbf939380b854a55418b462276bc4c0ea3d | sunlongbo/chromium | tools/nocompile_driver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FailTest | null | def FailTest(resultfile, test, error, stdout=None, stderr=None):
"""Logs the result of a test started by StartTest()
Args:
resultfile: File object for .cc file that results are written to.
test: An instance of the dictionary returned by StartTest()
error: The printable reason for the failure.
stdou... | Logs the result of a test started by StartTest()
Args:
resultfile: File object for .cc file that results are written to.
test: An instance of the dictionary returned by StartTest()
error: The printable reason for the failure.
stdout: The test's output to stdout.
stderr: The test's output to stder... | Logs the result of a test started by StartTest() | [
"Logs",
"the",
"result",
"of",
"a",
"test",
"started",
"by",
"StartTest",
"()"
] | def FailTest(resultfile, test, error, stdout=None, stderr=None):
resultfile.write('#error "%s Failed: %s"\n' % (test['name'], error))
resultfile.write('#error "compile line: %s"\n' % test['cmdline'])
if stdout and len(stdout) != 0:
resultfile.write('#error "%s stdout:"\n' % test['name'])
for line in stdou... | [
"def",
"FailTest",
"(",
"resultfile",
",",
"test",
",",
"error",
",",
"stdout",
"=",
"None",
",",
"stderr",
"=",
"None",
")",
":",
"resultfile",
".",
"write",
"(",
"'#error \"%s Failed: %s\"\\n'",
"%",
"(",
"test",
"[",
"'name'",
"]",
",",
"error",
")",
... | Logs the result of a test started by StartTest() | [
"Logs",
"the",
"result",
"of",
"a",
"test",
"started",
"by",
"StartTest",
"()"
] | [
"\"\"\"Logs the result of a test started by StartTest()\n\n Args:\n resultfile: File object for .cc file that results are written to.\n test: An instance of the dictionary returned by StartTest()\n error: The printable reason for the failure.\n stdout: The test's output to stdout.\n stderr: The test... | [
{
"param": "resultfile",
"type": null
},
{
"param": "test",
"type": null
},
{
"param": "error",
"type": null
},
{
"param": "stdout",
"type": null
},
{
"param": "stderr",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "resultfile",
"type": null,
"docstring": "File object for .cc file that results are written to.",
"docstring_tokens": [
"File",
"object",
"for",
".",
"cc",
"file",
"that",... |
df14cbbf939380b854a55418b462276bc4c0ea3d | sunlongbo/chromium | tools/nocompile_driver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteStats | null | def WriteStats(resultlog, suite_name, timings):
"""Logs the peformance timings for each stage of the script.
Args:
resultlog: File object for the log file.
suite_name: The name of the GUnit suite this test belongs to.
timings: Dictionary with timestamps for each stage of the script run.
"""
stats_t... | Logs the peformance timings for each stage of the script.
Args:
resultlog: File object for the log file.
suite_name: The name of the GUnit suite this test belongs to.
timings: Dictionary with timestamps for each stage of the script run.
| Logs the peformance timings for each stage of the script. | [
"Logs",
"the",
"peformance",
"timings",
"for",
"each",
"stage",
"of",
"the",
"script",
"."
] | def WriteStats(resultlog, suite_name, timings):
stats_template = """
TEST(%s): Started %f, Ended %f, Total %fs, Extract %fs, Compile %fs, Process %fs
"""
total_secs = timings['results_processed'] - timings['started']
extract_secs = timings['extract_done'] - timings['started']
compile_secs = timings['compile_don... | [
"def",
"WriteStats",
"(",
"resultlog",
",",
"suite_name",
",",
"timings",
")",
":",
"stats_template",
"=",
"\"\"\"\nTEST(%s): Started %f, Ended %f, Total %fs, Extract %fs, Compile %fs, Process %fs\n\"\"\"",
"total_secs",
"=",
"timings",
"[",
"'results_processed'",
"]",
"-",
"... | Logs the peformance timings for each stage of the script. | [
"Logs",
"the",
"peformance",
"timings",
"for",
"each",
"stage",
"of",
"the",
"script",
"."
] | [
"\"\"\"Logs the peformance timings for each stage of the script.\n\n Args:\n resultlog: File object for the log file.\n suite_name: The name of the GUnit suite this test belongs to.\n timings: Dictionary with timestamps for each stage of the script run.\n \"\"\""
] | [
{
"param": "resultlog",
"type": null
},
{
"param": "suite_name",
"type": null
},
{
"param": "timings",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "resultlog",
"type": null,
"docstring": "File object for the log file.",
"docstring_tokens": [
"File",
"object",
"for",
"the",
"log",
"file",
"."
],
"default":... |
df14cbbf939380b854a55418b462276bc4c0ea3d | sunlongbo/chromium | tools/nocompile_driver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ProcessTestResult | <not_specific> | def ProcessTestResult(resultfile, resultlog, test):
"""Interprets and logs the result of a test started by StartTest()
Args:
resultfile: File object for .cc file that results are written to.
resultlog: File object for the log file.
test: The dictionary from StartTest() to process.
"""
proc = test['... | Interprets and logs the result of a test started by StartTest()
Args:
resultfile: File object for .cc file that results are written to.
resultlog: File object for the log file.
test: The dictionary from StartTest() to process.
| Interprets and logs the result of a test started by StartTest() | [
"Interprets",
"and",
"logs",
"the",
"result",
"of",
"a",
"test",
"started",
"by",
"StartTest",
"()"
] | def ProcessTestResult(resultfile, resultlog, test):
proc = test['proc']
proc.wait()
(stdout, stderr) = ExtractTestOutputAndCleanup(test)
if test['aborted_at'] != 0:
FailTest(resultfile, test, "Compile timed out. Started %f ended %f." %
(test['started_at'], test['aborted_at']))
return
if p... | [
"def",
"ProcessTestResult",
"(",
"resultfile",
",",
"resultlog",
",",
"test",
")",
":",
"proc",
"=",
"test",
"[",
"'proc'",
"]",
"proc",
".",
"wait",
"(",
")",
"(",
"stdout",
",",
"stderr",
")",
"=",
"ExtractTestOutputAndCleanup",
"(",
"test",
")",
"if",... | Interprets and logs the result of a test started by StartTest() | [
"Interprets",
"and",
"logs",
"the",
"result",
"of",
"a",
"test",
"started",
"by",
"StartTest",
"()"
] | [
"\"\"\"Interprets and logs the result of a test started by StartTest()\n\n Args:\n resultfile: File object for .cc file that results are written to.\n resultlog: File object for the log file.\n test: The dictionary from StartTest() to process.\n \"\"\"",
"# Handle failure due to successful compile.",
... | [
{
"param": "resultfile",
"type": null
},
{
"param": "resultlog",
"type": null
},
{
"param": "test",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "resultfile",
"type": null,
"docstring": "File object for .cc file that results are written to.",
"docstring_tokens": [
"File",
"object",
"for",
".",
"cc",
"file",
"that",... |
df14cbbf939380b854a55418b462276bc4c0ea3d | sunlongbo/chromium | tools/nocompile_driver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CompleteAtLeastOneTest | <not_specific> | def CompleteAtLeastOneTest(executing_tests):
"""Blocks until at least one task is removed from executing_tests.
This function removes completed tests from executing_tests, logging failures
and output. If no tests can be removed, it will enter a poll-loop until one
test finishes or times out. On a timeout, th... | Blocks until at least one task is removed from executing_tests.
This function removes completed tests from executing_tests, logging failures
and output. If no tests can be removed, it will enter a poll-loop until one
test finishes or times out. On a timeout, this function is responsible for
terminating the p... | Blocks until at least one task is removed from executing_tests.
This function removes completed tests from executing_tests, logging failures
and output. If no tests can be removed, it will enter a poll-loop until one
test finishes or times out. On a timeout, this function is responsible for
terminating the process in... | [
"Blocks",
"until",
"at",
"least",
"one",
"task",
"is",
"removed",
"from",
"executing_tests",
".",
"This",
"function",
"removes",
"completed",
"tests",
"from",
"executing_tests",
"logging",
"failures",
"and",
"output",
".",
"If",
"no",
"tests",
"can",
"be",
"re... | def CompleteAtLeastOneTest(executing_tests):
finished_tests = []
busy_loop_timeout = time.time() + BUSY_LOOP_MAX_TIME_SEC
while len(finished_tests) == 0:
assert busy_loop_timeout > time.time()
read_set = []
for test in executing_tests.values():
read_set.extend([test['stdout'], test['stderr']])
... | [
"def",
"CompleteAtLeastOneTest",
"(",
"executing_tests",
")",
":",
"finished_tests",
"=",
"[",
"]",
"busy_loop_timeout",
"=",
"time",
".",
"time",
"(",
")",
"+",
"BUSY_LOOP_MAX_TIME_SEC",
"while",
"len",
"(",
"finished_tests",
")",
"==",
"0",
":",
"assert",
"b... | Blocks until at least one task is removed from executing_tests. | [
"Blocks",
"until",
"at",
"least",
"one",
"task",
"is",
"removed",
"from",
"executing_tests",
"."
] | [
"\"\"\"Blocks until at least one task is removed from executing_tests.\n\n This function removes completed tests from executing_tests, logging failures\n and output. If no tests can be removed, it will enter a poll-loop until one\n test finishes or times out. On a timeout, this function is responsible for\n t... | [
{
"param": "executing_tests",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of tests that have finished.",
"docstring_tokens": [
"A",
"list",
"of",
"tests",
"that",
"have",
"finished",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"ident... |
2fcf4641fe7a6c9d93c1d46bd6e7d1f10aafcc17 | sunlongbo/chromium | tools/web_dev_style/js_checker.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunEsLintChecks | <not_specific> | def RunEsLintChecks(self, affected_js_files, format="stylish"):
"""Runs lint checks using ESLint. The ESLint rules being applied are defined
in the .eslintrc.js configuration file.
"""
os_path = self.input_api.os_path
# Extract paths to be passed to ESLint.
affected_js_files_paths = []
f... | Runs lint checks using ESLint. The ESLint rules being applied are defined
in the .eslintrc.js configuration file.
| Runs lint checks using ESLint. The ESLint rules being applied are defined
in the .eslintrc.js configuration file. | [
"Runs",
"lint",
"checks",
"using",
"ESLint",
".",
"The",
"ESLint",
"rules",
"being",
"applied",
"are",
"defined",
"in",
"the",
".",
"eslintrc",
".",
"js",
"configuration",
"file",
"."
] | def RunEsLintChecks(self, affected_js_files, format="stylish"):
os_path = self.input_api.os_path
affected_js_files_paths = []
for f in affected_js_files:
affected_js_files_paths.append(f.AbsoluteLocalPath())
from os import isatty as os_isatty
args = ["--color"] if os_isatty(self.input_api.sys.... | [
"def",
"RunEsLintChecks",
"(",
"self",
",",
"affected_js_files",
",",
"format",
"=",
"\"stylish\"",
")",
":",
"os_path",
"=",
"self",
".",
"input_api",
".",
"os_path",
"affected_js_files_paths",
"=",
"[",
"]",
"for",
"f",
"in",
"affected_js_files",
":",
"affec... | Runs lint checks using ESLint. | [
"Runs",
"lint",
"checks",
"using",
"ESLint",
"."
] | [
"\"\"\"Runs lint checks using ESLint. The ESLint rules being applied are defined\n in the .eslintrc.js configuration file.\n \"\"\"",
"# Extract paths to be passed to ESLint."
] | [
{
"param": "self",
"type": null
},
{
"param": "affected_js_files",
"type": null
},
{
"param": "format",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "affected_js_files",
"type": null,
"docstring": null,
"docstri... |
2fcf4641fe7a6c9d93c1d46bd6e7d1f10aafcc17 | sunlongbo/chromium | tools/web_dev_style/js_checker.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetErrorHighlight | <not_specific> | def _GetErrorHighlight(self, start, length):
"""Takes a start position and a length, and produces a row of "^"s to
highlight the corresponding part of a string.
"""
return start * " " + length * "^" | Takes a start position and a length, and produces a row of "^"s to
highlight the corresponding part of a string.
| Takes a start position and a length, and produces a row of "^"s to
highlight the corresponding part of a string. | [
"Takes",
"a",
"start",
"position",
"and",
"a",
"length",
"and",
"produces",
"a",
"row",
"of",
"\"",
"^",
"\"",
"s",
"to",
"highlight",
"the",
"corresponding",
"part",
"of",
"a",
"string",
"."
] | def _GetErrorHighlight(self, start, length):
return start * " " + length * "^" | [
"def",
"_GetErrorHighlight",
"(",
"self",
",",
"start",
",",
"length",
")",
":",
"return",
"start",
"*",
"\" \"",
"+",
"length",
"*",
"\"^\""
] | Takes a start position and a length, and produces a row of "^"s to
highlight the corresponding part of a string. | [
"Takes",
"a",
"start",
"position",
"and",
"a",
"length",
"and",
"produces",
"a",
"row",
"of",
"\"",
"^",
"\"",
"s",
"to",
"highlight",
"the",
"corresponding",
"part",
"of",
"a",
"string",
"."
] | [
"\"\"\"Takes a start position and a length, and produces a row of \"^\"s to\n highlight the corresponding part of a string.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "start",
"type": null
},
{
"param": "length",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "start",
"type": null,
"docstring": null,
"docstring_tokens": ... |
2fcf4641fe7a6c9d93c1d46bd6e7d1f10aafcc17 | sunlongbo/chromium | tools/web_dev_style/js_checker.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunChecks | <not_specific> | def RunChecks(self):
"""Check for violations of the Chromium JavaScript style guide. See
https://chromium.googlesource.com/chromium/src/+/main/styleguide/web/web.md#JavaScript
"""
results = []
affected_files = self.input_api.AffectedFiles(file_filter=self.file_filter,
... | Check for violations of the Chromium JavaScript style guide. See
https://chromium.googlesource.com/chromium/src/+/main/styleguide/web/web.md#JavaScript
| Check for violations of the Chromium JavaScript style guide. | [
"Check",
"for",
"violations",
"of",
"the",
"Chromium",
"JavaScript",
"style",
"guide",
"."
] | def RunChecks(self):
results = []
affected_files = self.input_api.AffectedFiles(file_filter=self.file_filter,
include_deletes=False)
affected_js_files = [
f for f in affected_files if f.LocalPath().endswith((".js", "ts"))
]
if affected_js_fil... | [
"def",
"RunChecks",
"(",
"self",
")",
":",
"results",
"=",
"[",
"]",
"affected_files",
"=",
"self",
".",
"input_api",
".",
"AffectedFiles",
"(",
"file_filter",
"=",
"self",
".",
"file_filter",
",",
"include_deletes",
"=",
"False",
")",
"affected_js_files",
"... | Check for violations of the Chromium JavaScript style guide. | [
"Check",
"for",
"violations",
"of",
"the",
"Chromium",
"JavaScript",
"style",
"guide",
"."
] | [
"\"\"\"Check for violations of the Chromium JavaScript style guide. See\n https://chromium.googlesource.com/chromium/src/+/main/styleguide/web/web.md#JavaScript\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | autoninja | <not_specific> | def autoninja():
"""
Returns the name of the autoninja executable to invoke.
"""
name = os.path.normpath(
os.path.join(
os.path.dirname(__file__), '..', '..', '..', 'third_party',
'depot_tools', 'autoninja'))
if os.name == 'nt':
return name + '.bat'
else:
return name |
Returns the name of the autoninja executable to invoke.
| Returns the name of the autoninja executable to invoke. | [
"Returns",
"the",
"name",
"of",
"the",
"autoninja",
"executable",
"to",
"invoke",
"."
] | def autoninja():
name = os.path.normpath(
os.path.join(
os.path.dirname(__file__), '..', '..', '..', 'third_party',
'depot_tools', 'autoninja'))
if os.name == 'nt':
return name + '.bat'
else:
return name | [
"def",
"autoninja",
"(",
")",
":",
"name",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"'..'",
",",
"'..'",
",",
"'..'",
",",
"'third_party'",
",... | Returns the name of the autoninja executable to invoke. | [
"Returns",
"the",
"name",
"of",
"the",
"autoninja",
"executable",
"to",
"invoke",
"."
] | [
"\"\"\"\n Returns the name of the autoninja executable to invoke.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ensure_dir | <not_specific> | def ensure_dir(path):
"""
Creates path as a directory if it does not already exist.
"""
if not path:
return
try:
os.makedirs(path)
except OSError as e:
if e.errno != errno.EEXIST:
raise |
Creates path as a directory if it does not already exist.
| Creates path as a directory if it does not already exist. | [
"Creates",
"path",
"as",
"a",
"directory",
"if",
"it",
"does",
"not",
"already",
"exist",
"."
] | def ensure_dir(path):
if not path:
return
try:
os.makedirs(path)
except OSError as e:
if e.errno != errno.EEXIST:
raise | [
"def",
"ensure_dir",
"(",
"path",
")",
":",
"if",
"not",
"path",
":",
"return",
"try",
":",
"os",
".",
"makedirs",
"(",
"path",
")",
"except",
"OSError",
"as",
"e",
":",
"if",
"e",
".",
"errno",
"!=",
"errno",
".",
"EEXIST",
":",
"raise"
] | Creates path as a directory if it does not already exist. | [
"Creates",
"path",
"as",
"a",
"directory",
"if",
"it",
"does",
"not",
"already",
"exist",
"."
] | [
"\"\"\"\n Creates path as a directory if it does not already exist.\n \"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ensure_file | null | def ensure_file(path):
"""
Creates an empty file at path if it does not already exist.
Also creates directories as needed.
"""
ensure_dir(os.path.dirname(path))
try:
fd = os.open(path, os.O_CREAT | os.O_EXCL | os.O_WRONLY, 0o644)
os.close(fd)
except OSError as e:
if e.errno != errno.EEXIST:
... |
Creates an empty file at path if it does not already exist.
Also creates directories as needed.
| Creates an empty file at path if it does not already exist.
Also creates directories as needed. | [
"Creates",
"an",
"empty",
"file",
"at",
"path",
"if",
"it",
"does",
"not",
"already",
"exist",
".",
"Also",
"creates",
"directories",
"as",
"needed",
"."
] | def ensure_file(path):
ensure_dir(os.path.dirname(path))
try:
fd = os.open(path, os.O_CREAT | os.O_EXCL | os.O_WRONLY, 0o644)
os.close(fd)
except OSError as e:
if e.errno != errno.EEXIST:
raise | [
"def",
"ensure_file",
"(",
"path",
")",
":",
"ensure_dir",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
")",
"try",
":",
"fd",
"=",
"os",
".",
"open",
"(",
"path",
",",
"os",
".",
"O_CREAT",
"|",
"os",
".",
"O_EXCL",
"|",
"os",
"."... | Creates an empty file at path if it does not already exist. | [
"Creates",
"an",
"empty",
"file",
"at",
"path",
"if",
"it",
"does",
"not",
"already",
"exist",
"."
] | [
"\"\"\"\n Creates an empty file at path if it does not already exist.\n Also creates directories as needed.\n \"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | is_bitcode_file | <not_specific> | def is_bitcode_file(path):
"""
Returns True if path contains a LLVM bitcode file, False if not.
"""
with open(path, 'rb') as f:
return f.read(4) == b'BC\xc0\xde' |
Returns True if path contains a LLVM bitcode file, False if not.
| Returns True if path contains a LLVM bitcode file, False if not. | [
"Returns",
"True",
"if",
"path",
"contains",
"a",
"LLVM",
"bitcode",
"file",
"False",
"if",
"not",
"."
] | def is_bitcode_file(path):
with open(path, 'rb') as f:
return f.read(4) == b'BC\xc0\xde' | [
"def",
"is_bitcode_file",
"(",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"f",
":",
"return",
"f",
".",
"read",
"(",
"4",
")",
"==",
"b'BC\\xc0\\xde'"
] | Returns True if path contains a LLVM bitcode file, False if not. | [
"Returns",
"True",
"if",
"path",
"contains",
"a",
"LLVM",
"bitcode",
"file",
"False",
"if",
"not",
"."
] | [
"\"\"\"\n Returns True if path contains a LLVM bitcode file, False if not.\n \"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | is_thin_archive | <not_specific> | def is_thin_archive(path):
"""
Returns True if path refers to a thin archive (ar file), False if not.
"""
with open(path, 'rb') as f:
return f.read(8) == b'!<thin>\n' |
Returns True if path refers to a thin archive (ar file), False if not.
| Returns True if path refers to a thin archive (ar file), False if not. | [
"Returns",
"True",
"if",
"path",
"refers",
"to",
"a",
"thin",
"archive",
"(",
"ar",
"file",
")",
"False",
"if",
"not",
"."
] | def is_thin_archive(path):
with open(path, 'rb') as f:
return f.read(8) == b'!<thin>\n' | [
"def",
"is_thin_archive",
"(",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"f",
":",
"return",
"f",
".",
"read",
"(",
"8",
")",
"==",
"b'!<thin>\\n'"
] | Returns True if path refers to a thin archive (ar file), False if not. | [
"Returns",
"True",
"if",
"path",
"refers",
"to",
"a",
"thin",
"archive",
"(",
"ar",
"file",
")",
"False",
"if",
"not",
"."
] | [
"\"\"\"\n Returns True if path refers to a thin archive (ar file), False if not.\n \"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | names_in_archive | null | def names_in_archive(path):
"""
Yields the member names in the archive file at path.
"""
# Note: This could alternatively be implemented by invoking some
# external utility, e.g. llvm-ar, which would avoid having logic here
# to parse thin archives. The current approach was chosen because it
# avoids spaw... |
Yields the member names in the archive file at path.
| Yields the member names in the archive file at path. | [
"Yields",
"the",
"member",
"names",
"in",
"the",
"archive",
"file",
"at",
"path",
"."
] | def names_in_archive(path):
with open(path, 'rb') as f:
long_names = None
f.seek(8, io.SEEK_CUR)
while True:
file_id = f.read(16)
if len(file_id) == 0:
break
f.seek(32, io.SEEK_CUR)
m = re.match(b'/([0-9]+)', file_id)
if long_names and m:
name_pos = long(m.gro... | [
"def",
"names_in_archive",
"(",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"f",
":",
"long_names",
"=",
"None",
"f",
".",
"seek",
"(",
"8",
",",
"io",
".",
"SEEK_CUR",
")",
"while",
"True",
":",
"file_id",
"=",
"f",
".... | Yields the member names in the archive file at path. | [
"Yields",
"the",
"member",
"names",
"in",
"the",
"archive",
"file",
"at",
"path",
"."
] | [
"\"\"\"\n Yields the member names in the archive file at path.\n \"\"\"",
"# Note: This could alternatively be implemented by invoking some",
"# external utility, e.g. llvm-ar, which would avoid having logic here",
"# to parse thin archives. The current approach was chosen because it",
"# avoids spawning ... | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ninjaenc | <not_specific> | def ninjaenc(s):
"""
Encodes string s for use in ninja files.
"""
return s.replace('$', '$$') |
Encodes string s for use in ninja files.
| Encodes string s for use in ninja files. | [
"Encodes",
"string",
"s",
"for",
"use",
"in",
"ninja",
"files",
"."
] | def ninjaenc(s):
return s.replace('$', '$$') | [
"def",
"ninjaenc",
"(",
"s",
")",
":",
"return",
"s",
".",
"replace",
"(",
"'$'",
",",
"'$$'",
")"
] | Encodes string s for use in ninja files. | [
"Encodes",
"string",
"s",
"for",
"use",
"in",
"ninja",
"files",
"."
] | [
"\"\"\"\n Encodes string s for use in ninja files.\n \"\"\""
] | [
{
"param": "s",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "s",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ninjajoin | <not_specific> | def ninjajoin(l):
"""
Encodes list of strings l to a string encoded for use in a ninja file.
"""
return ' '.join(map(ninjaenc, l)) |
Encodes list of strings l to a string encoded for use in a ninja file.
| Encodes list of strings l to a string encoded for use in a ninja file. | [
"Encodes",
"list",
"of",
"strings",
"l",
"to",
"a",
"string",
"encoded",
"for",
"use",
"in",
"a",
"ninja",
"file",
"."
] | def ninjajoin(l):
return ' '.join(map(ninjaenc, l)) | [
"def",
"ninjajoin",
"(",
"l",
")",
":",
"return",
"' '",
".",
"join",
"(",
"map",
"(",
"ninjaenc",
",",
"l",
")",
")"
] | Encodes list of strings l to a string encoded for use in a ninja file. | [
"Encodes",
"list",
"of",
"strings",
"l",
"to",
"a",
"string",
"encoded",
"for",
"use",
"in",
"a",
"ninja",
"file",
"."
] | [
"\"\"\"\n Encodes list of strings l to a string encoded for use in a ninja file.\n \"\"\""
] | [
{
"param": "l",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "l",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | parse_args | <not_specific> | def parse_args(args):
"""
Parses the command line and returns a structure with the results.
"""
# The basic invocation is to pass in the command line that would be used
# for a local ThinLTO link. Optionally, this may be preceded by options
# that set some values for this script. If these optional options a... |
Parses the command line and returns a structure with the results.
| Parses the command line and returns a structure with the results. | [
"Parses",
"the",
"command",
"line",
"and",
"returns",
"a",
"structure",
"with",
"the",
"results",
"."
] | def parse_args(args):
ap = argparse.ArgumentParser()
ap.add_argument('--generate',
action='store_true',
help='generate ninja file, but do not invoke it.')
ap.add_argument('--gomacc', help='path to gomacc.')
ap.add_argument('--jobs', '-j', help='maximum number of concurrent jo... | [
"def",
"parse_args",
"(",
"args",
")",
":",
"ap",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"ap",
".",
"add_argument",
"(",
"'--generate'",
",",
"action",
"=",
"'store_true'",
",",
"help",
"=",
"'generate ninja file, but do not invoke it.'",
")",
"ap",
... | Parses the command line and returns a structure with the results. | [
"Parses",
"the",
"command",
"line",
"and",
"returns",
"a",
"structure",
"with",
"the",
"results",
"."
] | [
"\"\"\"\n Parses the command line and returns a structure with the results.\n \"\"\"",
"# The basic invocation is to pass in the command line that would be used",
"# for a local ThinLTO link. Optionally, this may be preceded by options",
"# that set some values for this script. If these optional options are... | [
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | report_run | <not_specific> | def report_run(cmd, *args, **kwargs):
"""
Runs a command using subprocess.check_call, first writing the command line
to standard error.
"""
sys.stderr.write('%s: %s\n' % (sys.argv[0], ' '.join(map(shquote, cmd))))
sys.stderr.flush()
return subprocess.check_call(cmd, *args, **kwargs) |
Runs a command using subprocess.check_call, first writing the command line
to standard error.
| Runs a command using subprocess.check_call, first writing the command line
to standard error. | [
"Runs",
"a",
"command",
"using",
"subprocess",
".",
"check_call",
"first",
"writing",
"the",
"command",
"line",
"to",
"standard",
"error",
"."
] | def report_run(cmd, *args, **kwargs):
sys.stderr.write('%s: %s\n' % (sys.argv[0], ' '.join(map(shquote, cmd))))
sys.stderr.flush()
return subprocess.check_call(cmd, *args, **kwargs) | [
"def",
"report_run",
"(",
"cmd",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"'%s: %s\\n'",
"%",
"(",
"sys",
".",
"argv",
"[",
"0",
"]",
",",
"' '",
".",
"join",
"(",
"map",
"(",
"shquote",
",",
"cm... | Runs a command using subprocess.check_call, first writing the command line
to standard error. | [
"Runs",
"a",
"command",
"using",
"subprocess",
".",
"check_call",
"first",
"writing",
"the",
"command",
"line",
"to",
"standard",
"error",
"."
] | [
"\"\"\"\n Runs a command using subprocess.check_call, first writing the command line\n to standard error.\n \"\"\""
] | [
{
"param": "cmd",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cmd",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _no_codegen | <not_specific> | def _no_codegen(self, args):
"""
Helper function for the case where no distributed code generation
is necessary. It invokes the original command, unless --generate
was passed, in which case it informs the user that no code generation
is necessary.
"""
if args.generate:
sys.stderr.write... |
Helper function for the case where no distributed code generation
is necessary. It invokes the original command, unless --generate
was passed, in which case it informs the user that no code generation
is necessary.
| Helper function for the case where no distributed code generation
is necessary. It invokes the original command, unless --generate
was passed, in which case it informs the user that no code generation
is necessary. | [
"Helper",
"function",
"for",
"the",
"case",
"where",
"no",
"distributed",
"code",
"generation",
"is",
"necessary",
".",
"It",
"invokes",
"the",
"original",
"command",
"unless",
"--",
"generate",
"was",
"passed",
"in",
"which",
"case",
"it",
"informs",
"the",
... | def _no_codegen(self, args):
if args.generate:
sys.stderr.write(
'No code generation required; no ninja file generated.\n')
return 5
return subprocess.call([args.linker] + args.linker_args) | [
"def",
"_no_codegen",
"(",
"self",
",",
"args",
")",
":",
"if",
"args",
".",
"generate",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"'No code generation required; no ninja file generated.\\n'",
")",
"return",
"5",
"return",
"subprocess",
".",
"call",
"(",
"... | Helper function for the case where no distributed code generation
is necessary. | [
"Helper",
"function",
"for",
"the",
"case",
"where",
"no",
"distributed",
"code",
"generation",
"is",
"necessary",
"."
] | [
"\"\"\"\n Helper function for the case where no distributed code generation\n is necessary. It invokes the original command, unless --generate\n was passed, in which case it informs the user that no code generation\n is necessary.\n \"\"\"",
"# Indicates no code generation required."
] | [
{
"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": [... |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | transform_codegen_param_common | <not_specific> | def transform_codegen_param_common(self, param):
"""
If param is a parameter relevant to code generation, returns the
parameter in a form that is suitable to pass to clang. For values
of param that are not relevant to code generation, returns None.
"""
match = self.MACHINE_RE.match(param)
i... |
If param is a parameter relevant to code generation, returns the
parameter in a form that is suitable to pass to clang. For values
of param that are not relevant to code generation, returns None.
| If param is a parameter relevant to code generation, returns the
parameter in a form that is suitable to pass to clang. For values
of param that are not relevant to code generation, returns None. | [
"If",
"param",
"is",
"a",
"parameter",
"relevant",
"to",
"code",
"generation",
"returns",
"the",
"parameter",
"in",
"a",
"form",
"that",
"is",
"suitable",
"to",
"pass",
"to",
"clang",
".",
"For",
"values",
"of",
"param",
"that",
"are",
"not",
"relevant",
... | def transform_codegen_param_common(self, param):
match = self.MACHINE_RE.match(param)
if match and match.group(1).lower() in ['x86', 'i386', 'arm', '32']:
return ['-m32']
match = self.MLLVM_RE.match(param)
if match:
if match.group(2):
return ['-mllvm', match.group(2)]
else:
... | [
"def",
"transform_codegen_param_common",
"(",
"self",
",",
"param",
")",
":",
"match",
"=",
"self",
".",
"MACHINE_RE",
".",
"match",
"(",
"param",
")",
"if",
"match",
"and",
"match",
".",
"group",
"(",
"1",
")",
".",
"lower",
"(",
")",
"in",
"[",
"'x... | If param is a parameter relevant to code generation, returns the
parameter in a form that is suitable to pass to clang. | [
"If",
"param",
"is",
"a",
"parameter",
"relevant",
"to",
"code",
"generation",
"returns",
"the",
"parameter",
"in",
"a",
"form",
"that",
"is",
"suitable",
"to",
"pass",
"to",
"clang",
"."
] | [
"\"\"\"\n If param is a parameter relevant to code generation, returns the\n parameter in a form that is suitable to pass to clang. For values\n of param that are not relevant to code generation, returns None.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "param",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": null,
"docstring": null,
"docstring_tokens": ... |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | output_path | <not_specific> | def output_path(self, args):
"""
Analyzes command line arguments in args and returns the output
path if one is specified by args. If no output path is specified
by args, returns None.
"""
i = 2
while i < len(args):
output, next_i = self.process_output_param(args, i)
if output is ... |
Analyzes command line arguments in args and returns the output
path if one is specified by args. If no output path is specified
by args, returns None.
| Analyzes command line arguments in args and returns the output
path if one is specified by args. If no output path is specified
by args, returns None. | [
"Analyzes",
"command",
"line",
"arguments",
"in",
"args",
"and",
"returns",
"the",
"output",
"path",
"if",
"one",
"is",
"specified",
"by",
"args",
".",
"If",
"no",
"output",
"path",
"is",
"specified",
"by",
"args",
"returns",
"None",
"."
] | def output_path(self, args):
i = 2
while i < len(args):
output, next_i = self.process_output_param(args, i)
if output is not None:
return output
i = next_i
return None | [
"def",
"output_path",
"(",
"self",
",",
"args",
")",
":",
"i",
"=",
"2",
"while",
"i",
"<",
"len",
"(",
"args",
")",
":",
"output",
",",
"next_i",
"=",
"self",
".",
"process_output_param",
"(",
"args",
",",
"i",
")",
"if",
"output",
"is",
"not",
... | Analyzes command line arguments in args and returns the output
path if one is specified by args. | [
"Analyzes",
"command",
"line",
"arguments",
"in",
"args",
"and",
"returns",
"the",
"output",
"path",
"if",
"one",
"is",
"specified",
"by",
"args",
"."
] | [
"\"\"\"\n Analyzes command line arguments in args and returns the output\n path if one is specified by args. If no output path is specified\n by args, returns None.\n \"\"\""
] | [
{
"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": [... |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | write_rsp | null | def write_rsp(self, path, params):
"""
Writes params to a newly created response file at path.
"""
ensure_dir(os.path.basename(path))
with open(path, 'wb') as f:
f.write('\n'.join(map(self.rspenc, params)).encode('UTF-8')) |
Writes params to a newly created response file at path.
| Writes params to a newly created response file at path. | [
"Writes",
"params",
"to",
"a",
"newly",
"created",
"response",
"file",
"at",
"path",
"."
] | def write_rsp(self, path, params):
ensure_dir(os.path.basename(path))
with open(path, 'wb') as f:
f.write('\n'.join(map(self.rspenc, params)).encode('UTF-8')) | [
"def",
"write_rsp",
"(",
"self",
",",
"path",
",",
"params",
")",
":",
"ensure_dir",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")",
")",
"with",
"open",
"(",
"path",
",",
"'wb'",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"'\\n'",
... | Writes params to a newly created response file at path. | [
"Writes",
"params",
"to",
"a",
"newly",
"created",
"response",
"file",
"at",
"path",
"."
] | [
"\"\"\"\n Writes params to a newly created response file at path.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": null
},
{
"param": "params",
"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": [... |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | rspenc | <not_specific> | def rspenc(self, param):
"""
Encodes param for use in an rsp file.
"""
return param.replace('\\%', '%') |
Encodes param for use in an rsp file.
| Encodes param for use in an rsp file. | [
"Encodes",
"param",
"for",
"use",
"in",
"an",
"rsp",
"file",
"."
] | def rspenc(self, param):
return param.replace('\\%', '%') | [
"def",
"rspenc",
"(",
"self",
",",
"param",
")",
":",
"return",
"param",
".",
"replace",
"(",
"'\\\\%'",
",",
"'%'",
")"
] | Encodes param for use in an rsp file. | [
"Encodes",
"param",
"for",
"use",
"in",
"an",
"rsp",
"file",
"."
] | [
"\"\"\"\n Encodes param for use in an rsp file.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "param",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": null,
"docstring": null,
"docstring_tokens": ... |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | expand_rsp | <not_specific> | def expand_rsp(self, rspname):
"""
Returns the parameters found in the response file at rspname.
"""
with open(rspname) as f:
return shlex.split(f.read()) |
Returns the parameters found in the response file at rspname.
| Returns the parameters found in the response file at rspname. | [
"Returns",
"the",
"parameters",
"found",
"in",
"the",
"response",
"file",
"at",
"rspname",
"."
] | def expand_rsp(self, rspname):
with open(rspname) as f:
return shlex.split(f.read()) | [
"def",
"expand_rsp",
"(",
"self",
",",
"rspname",
")",
":",
"with",
"open",
"(",
"rspname",
")",
"as",
"f",
":",
"return",
"shlex",
".",
"split",
"(",
"f",
".",
"read",
"(",
")",
")"
] | Returns the parameters found in the response file at rspname. | [
"Returns",
"the",
"parameters",
"found",
"in",
"the",
"response",
"file",
"at",
"rspname",
"."
] | [
"\"\"\"\n Returns the parameters found in the response file at rspname.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "rspname",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rspname",
"type": null,
"docstring": null,
"docstring_tokens"... |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | expand_args_rsps | null | def expand_args_rsps(self, args):
"""
Yields args, expanding @rsp file references into the commands mentioned
in the rsp file.
"""
result = []
for arg in args:
if len(arg) > 0 and arg[0] == '@':
for x in self.expand_rsp(arg[1:]):
yield x
else:
yield arg |
Yields args, expanding @rsp file references into the commands mentioned
in the rsp file.
| Yields args, expanding @rsp file references into the commands mentioned
in the rsp file. | [
"Yields",
"args",
"expanding",
"@rsp",
"file",
"references",
"into",
"the",
"commands",
"mentioned",
"in",
"the",
"rsp",
"file",
"."
] | def expand_args_rsps(self, args):
result = []
for arg in args:
if len(arg) > 0 and arg[0] == '@':
for x in self.expand_rsp(arg[1:]):
yield x
else:
yield arg | [
"def",
"expand_args_rsps",
"(",
"self",
",",
"args",
")",
":",
"result",
"=",
"[",
"]",
"for",
"arg",
"in",
"args",
":",
"if",
"len",
"(",
"arg",
")",
">",
"0",
"and",
"arg",
"[",
"0",
"]",
"==",
"'@'",
":",
"for",
"x",
"in",
"self",
".",
"ex... | Yields args, expanding @rsp file references into the commands mentioned
in the rsp file. | [
"Yields",
"args",
"expanding",
"@rsp",
"file",
"references",
"into",
"the",
"commands",
"mentioned",
"in",
"the",
"rsp",
"file",
"."
] | [
"\"\"\"\n Yields args, expanding @rsp file references into the commands mentioned\n in the rsp file.\n \"\"\""
] | [
{
"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": [... |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | expand_thin_archives | null | def expand_thin_archives(self, args):
"""
Yields the parameters in args, with thin archives replaced by a sequence
of '-start-lib', the member names, and '-end-lib'. This is used to get a
command line where members of thin archives are mentioned explicitly.
"""
for arg in args:
prefix = os... |
Yields the parameters in args, with thin archives replaced by a sequence
of '-start-lib', the member names, and '-end-lib'. This is used to get a
command line where members of thin archives are mentioned explicitly.
| Yields the parameters in args, with thin archives replaced by a sequence
of '-start-lib', the member names, and '-end-lib'. This is used to get a
command line where members of thin archives are mentioned explicitly. | [
"Yields",
"the",
"parameters",
"in",
"args",
"with",
"thin",
"archives",
"replaced",
"by",
"a",
"sequence",
"of",
"'",
"-",
"start",
"-",
"lib",
"'",
"the",
"member",
"names",
"and",
"'",
"-",
"end",
"-",
"lib",
"'",
".",
"This",
"is",
"used",
"to",
... | def expand_thin_archives(self, args):
for arg in args:
prefix = os.path.dirname(arg)
if prefix:
prefix += '/'
if (self.LIB_RE.match(arg) and os.path.exists(arg)
and is_thin_archive(arg)):
yield (self.WL + '-start-lib')
for name in names_in_archive(arg):
... | [
"def",
"expand_thin_archives",
"(",
"self",
",",
"args",
")",
":",
"for",
"arg",
"in",
"args",
":",
"prefix",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"arg",
")",
"if",
"prefix",
":",
"prefix",
"+=",
"'/'",
"if",
"(",
"self",
".",
"LIB_RE",
"."... | Yields the parameters in args, with thin archives replaced by a sequence
of '-start-lib', the member names, and '-end-lib'. | [
"Yields",
"the",
"parameters",
"in",
"args",
"with",
"thin",
"archives",
"replaced",
"by",
"a",
"sequence",
"of",
"'",
"-",
"start",
"-",
"lib",
"'",
"the",
"member",
"names",
"and",
"'",
"-",
"end",
"-",
"lib",
"'",
"."
] | [
"\"\"\"\n Yields the parameters in args, with thin archives replaced by a sequence\n of '-start-lib', the member names, and '-end-lib'. This is used to get a\n command line where members of thin archives are mentioned explicitly.\n \"\"\""
] | [
{
"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": [... |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | analyze_args | <not_specific> | def analyze_args(self, args, gen_dir, common_dir, use_common_objects):
"""
Analyzes the command line arguments in args.
If no ThinLTO code generation is necessary, returns None.
Else, returns an AnalyzeArgsResult value.
Args:
args: the command line as returned by parse_args().
gen_dir: ... |
Analyzes the command line arguments in args.
If no ThinLTO code generation is necessary, returns None.
Else, returns an AnalyzeArgsResult value.
Args:
args: the command line as returned by parse_args().
gen_dir: directory in which to generate files specific to this target.
common_dir... | Analyzes the command line arguments in args.
If no ThinLTO code generation is necessary, returns None.
Else, returns an AnalyzeArgsResult value. | [
"Analyzes",
"the",
"command",
"line",
"arguments",
"in",
"args",
".",
"If",
"no",
"ThinLTO",
"code",
"generation",
"is",
"necessary",
"returns",
"None",
".",
"Else",
"returns",
"an",
"AnalyzeArgsResult",
"value",
"."
] | def analyze_args(self, args, gen_dir, common_dir, use_common_objects):
if os.path.basename(args.linker).startswith('pnacl-'):
return None
rsp_expanded = list(self.expand_args_rsps(args.linker_args))
expanded_args = list(self.expand_thin_archives(rsp_expanded))
return self.analyze_expanded_args(exp... | [
"def",
"analyze_args",
"(",
"self",
",",
"args",
",",
"gen_dir",
",",
"common_dir",
",",
"use_common_objects",
")",
":",
"if",
"os",
".",
"path",
".",
"basename",
"(",
"args",
".",
"linker",
")",
".",
"startswith",
"(",
"'pnacl-'",
")",
":",
"return",
... | Analyzes the command line arguments in args. | [
"Analyzes",
"the",
"command",
"line",
"arguments",
"in",
"args",
"."
] | [
"\"\"\"\n Analyzes the command line arguments in args.\n If no ThinLTO code generation is necessary, returns None.\n Else, returns an AnalyzeArgsResult value.\n\n Args:\n args: the command line as returned by parse_args().\n gen_dir: directory in which to generate files specific to this target... | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
},
{
"param": "gen_dir",
"type": null
},
{
"param": "common_dir",
"type": null
},
{
"param": "use_common_objects",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": "the command line as returned by ... |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | analyze_expanded_args | <not_specific> | def analyze_expanded_args(self, args, output, linker, gen_dir, common_dir,
use_common_objects):
"""
Helper function for analyze_args. This is called by analyze_args after
expanding rsp files and determining which files are bitcode files, and
produces codegen_params, final_par... |
Helper function for analyze_args. This is called by analyze_args after
expanding rsp files and determining which files are bitcode files, and
produces codegen_params, final_params, and index_params.
This function interacts with the filesystem through os.path.exists,
is_bitcode_file, and ensure_fil... | Helper function for analyze_args. This is called by analyze_args after
expanding rsp files and determining which files are bitcode files, and
produces codegen_params, final_params, and index_params.
This function interacts with the filesystem through os.path.exists,
is_bitcode_file, and ensure_file. | [
"Helper",
"function",
"for",
"analyze_args",
".",
"This",
"is",
"called",
"by",
"analyze_args",
"after",
"expanding",
"rsp",
"files",
"and",
"determining",
"which",
"files",
"are",
"bitcode",
"files",
"and",
"produces",
"codegen_params",
"final_params",
"and",
"in... | def analyze_expanded_args(self, args, output, linker, gen_dir, common_dir,
use_common_objects):
if 'clang' in os.path.basename(linker):
compiler = linker
else:
compiler_dir = os.path.dirname(linker)
if compiler_dir:
compiler_dir += '/'
else:
co... | [
"def",
"analyze_expanded_args",
"(",
"self",
",",
"args",
",",
"output",
",",
"linker",
",",
"gen_dir",
",",
"common_dir",
",",
"use_common_objects",
")",
":",
"if",
"'clang'",
"in",
"os",
".",
"path",
".",
"basename",
"(",
"linker",
")",
":",
"compiler",
... | Helper function for analyze_args. | [
"Helper",
"function",
"for",
"analyze_args",
"."
] | [
"\"\"\"\n Helper function for analyze_args. This is called by analyze_args after\n expanding rsp files and determining which files are bitcode files, and\n produces codegen_params, final_params, and index_params.\n\n This function interacts with the filesystem through os.path.exists,\n is_bitcode_fil... | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
},
{
"param": "output",
"type": null
},
{
"param": "linker",
"type": null
},
{
"param": "gen_dir",
"type": null
},
{
"param": "common_dir",
"type": null
},
{
"param": "use_c... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | extract_opt_level | <not_specific> | def extract_opt_level(param):
"""
If param is a parameter that specifies the LTO optimization level,
returns the level. If not, returns None.
"""
match = re.match('(?:-Wl,)?--lto-O(.+)', param)
if match:
return match.group(1)
match = re.match('[-/]opt:.*lldlto=([^:]*)',... |
If param is a parameter that specifies the LTO optimization level,
returns the level. If not, returns None.
| If param is a parameter that specifies the LTO optimization level,
returns the level. If not, returns None. | [
"If",
"param",
"is",
"a",
"parameter",
"that",
"specifies",
"the",
"LTO",
"optimization",
"level",
"returns",
"the",
"level",
".",
"If",
"not",
"returns",
"None",
"."
] | def extract_opt_level(param):
match = re.match('(?:-Wl,)?--lto-O(.+)', param)
if match:
return match.group(1)
match = re.match('[-/]opt:.*lldlto=([^:]*)', param, re.IGNORECASE)
if match:
return match.group(1)
return None | [
"def",
"extract_opt_level",
"(",
"param",
")",
":",
"match",
"=",
"re",
".",
"match",
"(",
"'(?:-Wl,)?--lto-O(.+)'",
",",
"param",
")",
"if",
"match",
":",
"return",
"match",
".",
"group",
"(",
"1",
")",
"match",
"=",
"re",
".",
"match",
"(",
"'[-/]opt... | If param is a parameter that specifies the LTO optimization level,
returns the level. | [
"If",
"param",
"is",
"a",
"parameter",
"that",
"specifies",
"the",
"LTO",
"optimization",
"level",
"returns",
"the",
"level",
"."
] | [
"\"\"\"\n If param is a parameter that specifies the LTO optimization level,\n returns the level. If not, returns None.\n \"\"\""
] | [
{
"param": "param",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "param",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | process_param | <not_specific> | def process_param(param):
"""
Common code for processing a single parameter from the either the
command line or an rsp file.
"""
def helper():
"""
This exists so that we can use return instead of
nested if statements to use the first matching case.
"""
... |
Common code for processing a single parameter from the either the
command line or an rsp file.
| Common code for processing a single parameter from the either the
command line or an rsp file. | [
"Common",
"code",
"for",
"processing",
"a",
"single",
"parameter",
"from",
"the",
"either",
"the",
"command",
"line",
"or",
"an",
"rsp",
"file",
"."
] | def process_param(param):
def helper():
if in_mllvm[0]:
if param.startswith('-Wl,'):
codegen_params.append(param[4:])
else:
codegen_params.append(param)
in_mllvm[0] = False
return
o = extract_opt_level(param)
if o is not None:... | [
"def",
"process_param",
"(",
"param",
")",
":",
"def",
"helper",
"(",
")",
":",
"\"\"\"\n This exists so that we can use return instead of\n nested if statements to use the first matching case.\n \"\"\"",
"if",
"in_mllvm",
"[",
"0",
"]",
":",
"if",
"param",... | Common code for processing a single parameter from the either the
command line or an rsp file. | [
"Common",
"code",
"for",
"processing",
"a",
"single",
"parameter",
"from",
"the",
"either",
"the",
"command",
"line",
"or",
"an",
"rsp",
"file",
"."
] | [
"\"\"\"\n Common code for processing a single parameter from the either the\n command line or an rsp file.\n \"\"\"",
"\"\"\"\n This exists so that we can use return instead of\n nested if statements to use the first matching case.\n \"\"\"",
"# After -mllvm, just pass on the... | [
{
"param": "param",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "param",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | helper | <not_specific> | def helper():
"""
This exists so that we can use return instead of
nested if statements to use the first matching case.
"""
# After -mllvm, just pass on the param.
if in_mllvm[0]:
if param.startswith('-Wl,'):
codegen_params.append(param[4:])
... |
This exists so that we can use return instead of
nested if statements to use the first matching case.
| This exists so that we can use return instead of
nested if statements to use the first matching case. | [
"This",
"exists",
"so",
"that",
"we",
"can",
"use",
"return",
"instead",
"of",
"nested",
"if",
"statements",
"to",
"use",
"the",
"first",
"matching",
"case",
"."
] | def helper():
if in_mllvm[0]:
if param.startswith('-Wl,'):
codegen_params.append(param[4:])
else:
codegen_params.append(param)
in_mllvm[0] = False
return
o = extract_opt_level(param)
if o is not None:
optlevel[0] = o
... | [
"def",
"helper",
"(",
")",
":",
"if",
"in_mllvm",
"[",
"0",
"]",
":",
"if",
"param",
".",
"startswith",
"(",
"'-Wl,'",
")",
":",
"codegen_params",
".",
"append",
"(",
"param",
"[",
"4",
":",
"]",
")",
"else",
":",
"codegen_params",
".",
"append",
"... | This exists so that we can use return instead of
nested if statements to use the first matching case. | [
"This",
"exists",
"so",
"that",
"we",
"can",
"use",
"return",
"instead",
"of",
"nested",
"if",
"statements",
"to",
"use",
"the",
"first",
"matching",
"case",
"."
] | [
"\"\"\"\n This exists so that we can use return instead of\n nested if statements to use the first matching case.\n \"\"\"",
"# After -mllvm, just pass on the param.",
"# Check for params that specify LTO optimization level.",
"# Check for params that affect code generation.",
"# No ret... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | gen_ninja | null | def gen_ninja(self, ninjaname, params, gen_dir):
"""
Generates a ninja build file at path ninjaname, using original command line
params and with objs being a list of bitcode files for which to generate
native code.
"""
if self.gomacc:
gomacc_prefix = ninjaenc(self.gomacc) + ' '
else:
... |
Generates a ninja build file at path ninjaname, using original command line
params and with objs being a list of bitcode files for which to generate
native code.
| Generates a ninja build file at path ninjaname, using original command line
params and with objs being a list of bitcode files for which to generate
native code. | [
"Generates",
"a",
"ninja",
"build",
"file",
"at",
"path",
"ninjaname",
"using",
"original",
"command",
"line",
"params",
"and",
"with",
"objs",
"being",
"a",
"list",
"of",
"bitcode",
"files",
"for",
"which",
"to",
"generate",
"native",
"code",
"."
] | def gen_ninja(self, ninjaname, params, gen_dir):
if self.gomacc:
gomacc_prefix = ninjaenc(self.gomacc) + ' '
else:
gomacc_prefix = ''
base = gen_dir + '/' + os.path.basename(params.output)
ensure_dir(gen_dir)
ensure_dir(os.path.dirname(ninjaname))
codegen_cmd = ('%s%s -c %s -fthinlto... | [
"def",
"gen_ninja",
"(",
"self",
",",
"ninjaname",
",",
"params",
",",
"gen_dir",
")",
":",
"if",
"self",
".",
"gomacc",
":",
"gomacc_prefix",
"=",
"ninjaenc",
"(",
"self",
".",
"gomacc",
")",
"+",
"' '",
"else",
":",
"gomacc_prefix",
"=",
"''",
"base"... | Generates a ninja build file at path ninjaname, using original command line
params and with objs being a list of bitcode files for which to generate
native code. | [
"Generates",
"a",
"ninja",
"build",
"file",
"at",
"path",
"ninjaname",
"using",
"original",
"command",
"line",
"params",
"and",
"with",
"objs",
"being",
"a",
"list",
"of",
"bitcode",
"files",
"for",
"which",
"to",
"generate",
"native",
"code",
"."
] | [
"\"\"\"\n Generates a ninja build file at path ninjaname, using original command line\n params and with objs being a list of bitcode files for which to generate\n native code.\n \"\"\"",
"# We use grep here to only codegen native objects which are actually",
"# used by the native link step. Ninja 1.... | [
{
"param": "self",
"type": null
},
{
"param": "ninjaname",
"type": null
},
{
"param": "params",
"type": null
},
{
"param": "gen_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ninjaname",
"type": null,
"docstring": null,
"docstring_token... |
a101dc93bfd7de59c50740fe8efc1116993a6df6 | sunlongbo/chromium | tools/clang/scripts/goma_link.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | do_main | <not_specific> | def do_main(self, argv):
"""
This function contains the main code to run. Not intended to be called
directly. Call main instead, which returns exit status for failing
subprocesses.
"""
args = parse_args(argv)
args.output = self.output_path(argv[1:])
if args.output is None:
return s... |
This function contains the main code to run. Not intended to be called
directly. Call main instead, which returns exit status for failing
subprocesses.
| This function contains the main code to run. Not intended to be called
directly. Call main instead, which returns exit status for failing
subprocesses. | [
"This",
"function",
"contains",
"the",
"main",
"code",
"to",
"run",
".",
"Not",
"intended",
"to",
"be",
"called",
"directly",
".",
"Call",
"main",
"instead",
"which",
"returns",
"exit",
"status",
"for",
"failing",
"subprocesses",
"."
] | def do_main(self, argv):
args = parse_args(argv)
args.output = self.output_path(argv[1:])
if args.output is None:
return self._no_codegen(args)
if args.gomacc:
self.gomacc = args.gomacc
if args.no_gomacc:
self.gomacc = None
if args.jobs:
self.jobs = int(args.jobs)
bas... | [
"def",
"do_main",
"(",
"self",
",",
"argv",
")",
":",
"args",
"=",
"parse_args",
"(",
"argv",
")",
"args",
".",
"output",
"=",
"self",
".",
"output_path",
"(",
"argv",
"[",
"1",
":",
"]",
")",
"if",
"args",
".",
"output",
"is",
"None",
":",
"retu... | This function contains the main code to run. | [
"This",
"function",
"contains",
"the",
"main",
"code",
"to",
"run",
"."
] | [
"\"\"\"\n This function contains the main code to run. Not intended to be called\n directly. Call main instead, which returns exit status for failing\n subprocesses.\n \"\"\"",
"# Only generate tailored native object files for targets on the allow list.",
"# TODO: Find a better way to structure this... | [
{
"param": "self",
"type": null
},
{
"param": "argv",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": null,
"docstring": null,
"docstring_tokens": [... |
a126d34096b951855beccd4636dcb7a5b67f5ee7 | sunlongbo/chromium | components/policy/tools/template_writers/writers/google_adml_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetWriter | <not_specific> | def GetWriter(config):
'''Factory method for instanciating the GoogleADMLWriter. Every Writer needs a
GetWriter method because the TemplateFormatter uses this method to
instantiate a Writer.
'''
return GoogleADMLWriter(None, config) # platforms unused | Factory method for instanciating the GoogleADMLWriter. Every Writer needs a
GetWriter method because the TemplateFormatter uses this method to
instantiate a Writer.
| Factory method for instanciating the GoogleADMLWriter. Every Writer needs a
GetWriter method because the TemplateFormatter uses this method to
instantiate a Writer. | [
"Factory",
"method",
"for",
"instanciating",
"the",
"GoogleADMLWriter",
".",
"Every",
"Writer",
"needs",
"a",
"GetWriter",
"method",
"because",
"the",
"TemplateFormatter",
"uses",
"this",
"method",
"to",
"instantiate",
"a",
"Writer",
"."
] | def GetWriter(config):
return GoogleADMLWriter(None, config) | [
"def",
"GetWriter",
"(",
"config",
")",
":",
"return",
"GoogleADMLWriter",
"(",
"None",
",",
"config",
")"
] | Factory method for instanciating the GoogleADMLWriter. | [
"Factory",
"method",
"for",
"instanciating",
"the",
"GoogleADMLWriter",
"."
] | [
"'''Factory method for instanciating the GoogleADMLWriter. Every Writer needs a\n GetWriter method because the TemplateFormatter uses this method to\n instantiate a Writer.\n '''",
"# platforms unused"
] | [
{
"param": "config",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a126d34096b951855beccd4636dcb7a5b67f5ee7 | sunlongbo/chromium | components/policy/tools/template_writers/writers/google_adml_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteTemplate | <not_specific> | def WriteTemplate(self, template):
'''Returns the contents of the google.adml file. It's independent of
policy_templates.json.
'''
return '''<?xml version="1.0" ?>
<policyDefinitionResources revision="1.0" schemaVersion="1.0">
<displayName/>
<description/>
<resources>
<stringTable>
<s... | Returns the contents of the google.adml file. It's independent of
policy_templates.json.
| Returns the contents of the google.adml file. | [
"Returns",
"the",
"contents",
"of",
"the",
"google",
".",
"adml",
"file",
"."
] | def WriteTemplate(self, template):
return '''<?xml version="1.0" ?>
<policyDefinitionResources revision="1.0" schemaVersion="1.0">
<displayName/>
<description/>
<resources>
<stringTable>
<string id="google">Google</string>
</stringTable>
</resources>
</policyDefinitionResources>
''' | [
"def",
"WriteTemplate",
"(",
"self",
",",
"template",
")",
":",
"return",
"'''<?xml version=\"1.0\" ?>\n<policyDefinitionResources revision=\"1.0\" schemaVersion=\"1.0\">\n <displayName/>\n <description/>\n <resources>\n <stringTable>\n <string id=\"google\">Google</string>\n </strin... | Returns the contents of the google.adml file. | [
"Returns",
"the",
"contents",
"of",
"the",
"google",
".",
"adml",
"file",
"."
] | [
"'''Returns the contents of the google.adml file. It's independent of\n policy_templates.json.\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "template",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "template",
"type": null,
"docstring": null,
"docstring_tokens... |
a130490270ebbfa76865d9ab6c136550586b2ef1 | sunlongbo/chromium | tools/site_compare/scrapers/ie/__init__.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetScraper | <not_specific> | def GetScraper(version):
"""Returns the scraper module for the given version.
Args:
version: version string of IE, or None for most recent
Returns:
scrape module for given version
"""
# Pychecker will warn that the parameter is unused; we only
# support one version of IE at this time
# We only... | Returns the scraper module for the given version.
Args:
version: version string of IE, or None for most recent
Returns:
scrape module for given version
| Returns the scraper module for the given version. | [
"Returns",
"the",
"scraper",
"module",
"for",
"the",
"given",
"version",
"."
] | def GetScraper(version):
return __import__("ie7", globals(), locals(), ['']) | [
"def",
"GetScraper",
"(",
"version",
")",
":",
"return",
"__import__",
"(",
"\"ie7\"",
",",
"globals",
"(",
")",
",",
"locals",
"(",
")",
",",
"[",
"''",
"]",
")"
] | Returns the scraper module for the given version. | [
"Returns",
"the",
"scraper",
"module",
"for",
"the",
"given",
"version",
"."
] | [
"\"\"\"Returns the scraper module for the given version.\n\n Args:\n version: version string of IE, or None for most recent\n\n Returns:\n scrape module for given version\n \"\"\"",
"# Pychecker will warn that the parameter is unused; we only",
"# support one version of IE at this time",
"# We only h... | [
{
"param": "version",
"type": null
}
] | {
"returns": [
{
"docstring": "scrape module for given version",
"docstring_tokens": [
"scrape",
"module",
"for",
"given",
"version"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "version",
"type": null,
... |
b6713168a828616dea4b28651bf9fd9df197ebab | sunlongbo/chromium | headless/lib/browser/devtools_api/client_api_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParseArguments | <not_specific> | def ParseArguments(args):
"""Parses command line arguments and returns a (json_api, output_dir) tuple.
"""
cmdline_parser = argparse.ArgumentParser()
cmdline_parser.add_argument('--protocol', required=True)
cmdline_parser.add_argument('--output_dir', required=True)
args = cmdline_parser.parse_args(args)
... | Parses command line arguments and returns a (json_api, output_dir) tuple.
| Parses command line arguments and returns a (json_api, output_dir) tuple. | [
"Parses",
"command",
"line",
"arguments",
"and",
"returns",
"a",
"(",
"json_api",
"output_dir",
")",
"tuple",
"."
] | def ParseArguments(args):
cmdline_parser = argparse.ArgumentParser()
cmdline_parser.add_argument('--protocol', required=True)
cmdline_parser.add_argument('--output_dir', required=True)
args = cmdline_parser.parse_args(args)
with open(args.protocol, 'r') as f:
return json.load(f), args.output_dir | [
"def",
"ParseArguments",
"(",
"args",
")",
":",
"cmdline_parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"cmdline_parser",
".",
"add_argument",
"(",
"'--protocol'",
",",
"required",
"=",
"True",
")",
"cmdline_parser",
".",
"add_argument",
"(",
"'--out... | Parses command line arguments and returns a (json_api, output_dir) tuple. | [
"Parses",
"command",
"line",
"arguments",
"and",
"returns",
"a",
"(",
"json_api",
"output_dir",
")",
"tuple",
"."
] | [
"\"\"\"Parses command line arguments and returns a (json_api, output_dir) tuple.\n \"\"\""
] | [
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6713168a828616dea4b28651bf9fd9df197ebab | sunlongbo/chromium | headless/lib/browser/devtools_api/client_api_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SynthesizeCommandTypes | null | def SynthesizeCommandTypes(json_api):
"""Generate types for command parameters, return values and enum
properties.
"""
for domain in json_api['domains']:
if not 'types' in domain:
domain['types'] = []
for type in domain['types']:
if type['type'] == 'object':
for property in type.g... | Generate types for command parameters, return values and enum
properties.
| Generate types for command parameters, return values and enum
properties. | [
"Generate",
"types",
"for",
"command",
"parameters",
"return",
"values",
"and",
"enum",
"properties",
"."
] | def SynthesizeCommandTypes(json_api):
for domain in json_api['domains']:
if not 'types' in domain:
domain['types'] = []
for type in domain['types']:
if type['type'] == 'object':
for property in type.get('properties', []):
if 'enum' in property and not '$ref' in property:
... | [
"def",
"SynthesizeCommandTypes",
"(",
"json_api",
")",
":",
"for",
"domain",
"in",
"json_api",
"[",
"'domains'",
"]",
":",
"if",
"not",
"'types'",
"in",
"domain",
":",
"domain",
"[",
"'types'",
"]",
"=",
"[",
"]",
"for",
"type",
"in",
"domain",
"[",
"'... | Generate types for command parameters, return values and enum
properties. | [
"Generate",
"types",
"for",
"command",
"parameters",
"return",
"values",
"and",
"enum",
"properties",
"."
] | [
"\"\"\"Generate types for command parameters, return values and enum\n properties.\n \"\"\""
] | [
{
"param": "json_api",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "json_api",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6713168a828616dea4b28651bf9fd9df197ebab | sunlongbo/chromium | headless/lib/browser/devtools_api/client_api_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SynthesizeEventTypes | null | def SynthesizeEventTypes(json_api):
"""Generate types for events and their properties.
Note that parameter objects are also created for events without parameters to
make it easier to introduce parameters later.
"""
for domain in json_api['domains']:
if not 'types' in domain:
domain['types'] = []
... | Generate types for events and their properties.
Note that parameter objects are also created for events without parameters to
make it easier to introduce parameters later.
| Generate types for events and their properties.
Note that parameter objects are also created for events without parameters to
make it easier to introduce parameters later. | [
"Generate",
"types",
"for",
"events",
"and",
"their",
"properties",
".",
"Note",
"that",
"parameter",
"objects",
"are",
"also",
"created",
"for",
"events",
"without",
"parameters",
"to",
"make",
"it",
"easier",
"to",
"introduce",
"parameters",
"later",
"."
] | def SynthesizeEventTypes(json_api):
for domain in json_api['domains']:
if not 'types' in domain:
domain['types'] = []
for event in domain.get('events', []):
for parameter in event.get('parameters', []):
if 'enum' in parameter and not '$ref' in parameter:
SynthesizeEnumType(domain... | [
"def",
"SynthesizeEventTypes",
"(",
"json_api",
")",
":",
"for",
"domain",
"in",
"json_api",
"[",
"'domains'",
"]",
":",
"if",
"not",
"'types'",
"in",
"domain",
":",
"domain",
"[",
"'types'",
"]",
"=",
"[",
"]",
"for",
"event",
"in",
"domain",
".",
"ge... | Generate types for events and their properties. | [
"Generate",
"types",
"for",
"events",
"and",
"their",
"properties",
"."
] | [
"\"\"\"Generate types for events and their properties.\n\n Note that parameter objects are also created for events without parameters to\n make it easier to introduce parameters later.\n \"\"\""
] | [
{
"param": "json_api",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "json_api",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6713168a828616dea4b28651bf9fd9df197ebab | sunlongbo/chromium | headless/lib/browser/devtools_api/client_api_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | InitializeDomainDependencies | <not_specific> | def InitializeDomainDependencies(json_api):
"""For each domain create list of domains given domain depends on,
including itself."""
direct_deps = collections.defaultdict(set)
types_required = collections.defaultdict(set)
def GetDomainDepsFromRefs(domain_name, json):
if isinstance(json, list):
for ... | For each domain create list of domains given domain depends on,
including itself. | For each domain create list of domains given domain depends on,
including itself. | [
"For",
"each",
"domain",
"create",
"list",
"of",
"domains",
"given",
"domain",
"depends",
"on",
"including",
"itself",
"."
] | def InitializeDomainDependencies(json_api):
direct_deps = collections.defaultdict(set)
types_required = collections.defaultdict(set)
def GetDomainDepsFromRefs(domain_name, json):
if isinstance(json, list):
for value in json:
GetDomainDepsFromRefs(domain_name, value)
return
if not isins... | [
"def",
"InitializeDomainDependencies",
"(",
"json_api",
")",
":",
"direct_deps",
"=",
"collections",
".",
"defaultdict",
"(",
"set",
")",
"types_required",
"=",
"collections",
".",
"defaultdict",
"(",
"set",
")",
"def",
"GetDomainDepsFromRefs",
"(",
"domain_name",
... | For each domain create list of domains given domain depends on,
including itself. | [
"For",
"each",
"domain",
"create",
"list",
"of",
"domains",
"given",
"domain",
"depends",
"on",
"including",
"itself",
"."
] | [
"\"\"\"For each domain create list of domains given domain depends on,\n including itself.\"\"\""
] | [
{
"param": "json_api",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "json_api",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6713168a828616dea4b28651bf9fd9df197ebab | sunlongbo/chromium | headless/lib/browser/devtools_api/client_api_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PatchExperimentalCommandsAndEvents | null | def PatchExperimentalCommandsAndEvents(json_api):
"""Mark all commands and events in experimental domains as experimental
and make sure experimental commands have at least empty parameters
and return values.
"""
for domain in json_api['domains']:
if domain.get('experimental', False):
for command in ... | Mark all commands and events in experimental domains as experimental
and make sure experimental commands have at least empty parameters
and return values.
| Mark all commands and events in experimental domains as experimental
and make sure experimental commands have at least empty parameters
and return values. | [
"Mark",
"all",
"commands",
"and",
"events",
"in",
"experimental",
"domains",
"as",
"experimental",
"and",
"make",
"sure",
"experimental",
"commands",
"have",
"at",
"least",
"empty",
"parameters",
"and",
"return",
"values",
"."
] | def PatchExperimentalCommandsAndEvents(json_api):
for domain in json_api['domains']:
if domain.get('experimental', False):
for command in domain.get('commands', []):
command['experimental'] = True
for event in domain.get('events', []):
event['experimental'] = True | [
"def",
"PatchExperimentalCommandsAndEvents",
"(",
"json_api",
")",
":",
"for",
"domain",
"in",
"json_api",
"[",
"'domains'",
"]",
":",
"if",
"domain",
".",
"get",
"(",
"'experimental'",
",",
"False",
")",
":",
"for",
"command",
"in",
"domain",
".",
"get",
... | Mark all commands and events in experimental domains as experimental
and make sure experimental commands have at least empty parameters
and return values. | [
"Mark",
"all",
"commands",
"and",
"events",
"in",
"experimental",
"domains",
"as",
"experimental",
"and",
"make",
"sure",
"experimental",
"commands",
"have",
"at",
"least",
"empty",
"parameters",
"and",
"return",
"values",
"."
] | [
"\"\"\"Mark all commands and events in experimental domains as experimental\n and make sure experimental commands have at least empty parameters\n and return values.\n \"\"\""
] | [
{
"param": "json_api",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "json_api",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6713168a828616dea4b28651bf9fd9df197ebab | sunlongbo/chromium | headless/lib/browser/devtools_api/client_api_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | EnsureCommandsHaveParametersAndReturnTypes | null | def EnsureCommandsHaveParametersAndReturnTypes(json_api):
"""Make sure all commands have at least empty parameters and return values.
This guarantees API compatibility if a previously experimental command is made
stable.
"""
for domain in json_api['domains']:
for command in domain.get('commands', []):
... | Make sure all commands have at least empty parameters and return values.
This guarantees API compatibility if a previously experimental command is made
stable.
| Make sure all commands have at least empty parameters and return values.
This guarantees API compatibility if a previously experimental command is made
stable. | [
"Make",
"sure",
"all",
"commands",
"have",
"at",
"least",
"empty",
"parameters",
"and",
"return",
"values",
".",
"This",
"guarantees",
"API",
"compatibility",
"if",
"a",
"previously",
"experimental",
"command",
"is",
"made",
"stable",
"."
] | def EnsureCommandsHaveParametersAndReturnTypes(json_api):
for domain in json_api['domains']:
for command in domain.get('commands', []):
if not 'parameters' in command:
command['parameters'] = []
if not 'returns' in command:
command['returns'] = []
for event in domain.get('events', ... | [
"def",
"EnsureCommandsHaveParametersAndReturnTypes",
"(",
"json_api",
")",
":",
"for",
"domain",
"in",
"json_api",
"[",
"'domains'",
"]",
":",
"for",
"command",
"in",
"domain",
".",
"get",
"(",
"'commands'",
",",
"[",
"]",
")",
":",
"if",
"not",
"'parameters... | Make sure all commands have at least empty parameters and return values. | [
"Make",
"sure",
"all",
"commands",
"have",
"at",
"least",
"empty",
"parameters",
"and",
"return",
"values",
"."
] | [
"\"\"\"Make sure all commands have at least empty parameters and return values.\n This guarantees API compatibility if a previously experimental command is made\n stable.\n \"\"\""
] | [
{
"param": "json_api",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "json_api",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5324c8ed749c952d450694198807c40639486cd7 | sunlongbo/chromium | native_client_sdk/src/tools/getos.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckVersion | null | def CheckVersion(required_version):
"""Determines whether the current SDK version meets the required version.
Args:
required_version: (major, position) pair, where position is the
Cr-Commit-Position number.
Raises:
Error: The SDK version is older than required_version.
"""
version = GetSDKVersio... | Determines whether the current SDK version meets the required version.
Args:
required_version: (major, position) pair, where position is the
Cr-Commit-Position number.
Raises:
Error: The SDK version is older than required_version.
| Determines whether the current SDK version meets the required version.
Args:
required_version: (major, position) pair, where position is the
Cr-Commit-Position number.
The SDK version is older than required_version. | [
"Determines",
"whether",
"the",
"current",
"SDK",
"version",
"meets",
"the",
"required",
"version",
".",
"Args",
":",
"required_version",
":",
"(",
"major",
"position",
")",
"pair",
"where",
"position",
"is",
"the",
"Cr",
"-",
"Commit",
"-",
"Position",
"num... | def CheckVersion(required_version):
version = GetSDKVersion()[:2]
if version < required_version:
raise Error("SDK version too old (current: %d.%d, required: %d.%d)"
% (version[0], version[1], required_version[0], required_version[1])) | [
"def",
"CheckVersion",
"(",
"required_version",
")",
":",
"version",
"=",
"GetSDKVersion",
"(",
")",
"[",
":",
"2",
"]",
"if",
"version",
"<",
"required_version",
":",
"raise",
"Error",
"(",
"\"SDK version too old (current: %d.%d, required: %d.%d)\"",
"%",
"(",
"v... | Determines whether the current SDK version meets the required version. | [
"Determines",
"whether",
"the",
"current",
"SDK",
"version",
"meets",
"the",
"required",
"version",
"."
] | [
"\"\"\"Determines whether the current SDK version meets the required version.\n\n Args:\n required_version: (major, position) pair, where position is the\n Cr-Commit-Position number.\n\n Raises:\n Error: The SDK version is older than required_version.\n \"\"\""
] | [
{
"param": "required_version",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "required_version",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b340bfcb8d0340dd9f8bca4eefd4ca4927c531d1 | sunlongbo/chromium | tools/perf/cli_tools/soundwave/pandas_sqlite.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | DataFrame | <not_specific> | def DataFrame(column_types, index=None, rows=None):
"""Create a DataFrame with given column types as index.
Unlike usual pandas DataFrame constructors, this allows to have explicitly
typed column values, even when no rows of data are provided. And, when such
data is available, values are explicitly casted, ins... | Create a DataFrame with given column types as index.
Unlike usual pandas DataFrame constructors, this allows to have explicitly
typed column values, even when no rows of data are provided. And, when such
data is available, values are explicitly casted, instead of letting pandas
guess a type.
Args:
colum... | Create a DataFrame with given column types as index.
Unlike usual pandas DataFrame constructors, this allows to have explicitly
typed column values, even when no rows of data are provided. And, when such
data is available, values are explicitly casted, instead of letting pandas
guess a type. | [
"Create",
"a",
"DataFrame",
"with",
"given",
"column",
"types",
"as",
"index",
".",
"Unlike",
"usual",
"pandas",
"DataFrame",
"constructors",
"this",
"allows",
"to",
"have",
"explicitly",
"typed",
"column",
"values",
"even",
"when",
"no",
"rows",
"of",
"data",... | def DataFrame(column_types, index=None, rows=None):
if rows:
cols = list(zip(*rows))
assert len(cols) == len(column_types)
cols = (list(vs) for vs in cols)
else:
cols = (None for _ in column_types)
df = pandas.DataFrame()
for (column, dtype), values in zip(column_types, cols):
df[column] = p... | [
"def",
"DataFrame",
"(",
"column_types",
",",
"index",
"=",
"None",
",",
"rows",
"=",
"None",
")",
":",
"if",
"rows",
":",
"cols",
"=",
"list",
"(",
"zip",
"(",
"*",
"rows",
")",
")",
"assert",
"len",
"(",
"cols",
")",
"==",
"len",
"(",
"column_t... | Create a DataFrame with given column types as index. | [
"Create",
"a",
"DataFrame",
"with",
"given",
"column",
"types",
"as",
"index",
"."
] | [
"\"\"\"Create a DataFrame with given column types as index.\n\n Unlike usual pandas DataFrame constructors, this allows to have explicitly\n typed column values, even when no rows of data are provided. And, when such\n data is available, values are explicitly casted, instead of letting pandas\n guess a type.\n\... | [
{
"param": "column_types",
"type": null
},
{
"param": "index",
"type": null
},
{
"param": "rows",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "column_types",
"type": null,
"docstring": "A sequence of (name, dtype) pairs to define the columns.",
"docstring_tokens": [
"A",
"sequence",
"of",
"(",
"name",
"dtype",
"... |
b340bfcb8d0340dd9f8bca4eefd4ca4927c531d1 | sunlongbo/chromium | tools/perf/cli_tools/soundwave/pandas_sqlite.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreateTableIfNotExists | null | def CreateTableIfNotExists(con, name, frame):
"""Create a new empty table, if it doesn't already exist.
Args:
con: A sqlite connection object.
name: Name of SQL table to create.
frame: A DataFrame used to infer the schema of the table; the index of the
DataFrame is set as PRIMARY KEY of the table... | Create a new empty table, if it doesn't already exist.
Args:
con: A sqlite connection object.
name: Name of SQL table to create.
frame: A DataFrame used to infer the schema of the table; the index of the
DataFrame is set as PRIMARY KEY of the table.
| Create a new empty table, if it doesn't already exist. | [
"Create",
"a",
"new",
"empty",
"table",
"if",
"it",
"doesn",
"'",
"t",
"already",
"exist",
"."
] | def CreateTableIfNotExists(con, name, frame):
keys = [k for k in frame.index.names if k is not None]
if not keys:
keys = None
db = pandas.io.sql.SQLiteDatabase(con)
table = pandas.io.sql.SQLiteTable(
name, db, frame=frame, index=keys is not None, keys=keys,
if_exists='append')
table.create() | [
"def",
"CreateTableIfNotExists",
"(",
"con",
",",
"name",
",",
"frame",
")",
":",
"keys",
"=",
"[",
"k",
"for",
"k",
"in",
"frame",
".",
"index",
".",
"names",
"if",
"k",
"is",
"not",
"None",
"]",
"if",
"not",
"keys",
":",
"keys",
"=",
"None",
"d... | Create a new empty table, if it doesn't already exist. | [
"Create",
"a",
"new",
"empty",
"table",
"if",
"it",
"doesn",
"'",
"t",
"already",
"exist",
"."
] | [
"\"\"\"Create a new empty table, if it doesn't already exist.\n\n Args:\n con: A sqlite connection object.\n name: Name of SQL table to create.\n frame: A DataFrame used to infer the schema of the table; the index of the\n DataFrame is set as PRIMARY KEY of the table.\n \"\"\""
] | [
{
"param": "con",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "frame",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "con",
"type": null,
"docstring": "A sqlite connection object.",
"docstring_tokens": [
"A",
"sqlite",
"connection",
"object",
"."
],
"default": null,
"is_optional": null... |
b36899db189939243979eeb9734744e8047a15b6 | sunlongbo/chromium | tools/metrics/ukm/ukm_model.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PrettifyXML | <not_specific> | def PrettifyXML(original_xml):
"""Parses the original xml and return a pretty printed version.
Args:
original_xml: A string containing the original xml file contents.
Returns:
A pretty-printed xml string, or None if the config contains errors.
"""
config = UKM_XML_TYPE.Parse(original_xml)
return U... | Parses the original xml and return a pretty printed version.
Args:
original_xml: A string containing the original xml file contents.
Returns:
A pretty-printed xml string, or None if the config contains errors.
| Parses the original xml and return a pretty printed version. | [
"Parses",
"the",
"original",
"xml",
"and",
"return",
"a",
"pretty",
"printed",
"version",
"."
] | def PrettifyXML(original_xml):
config = UKM_XML_TYPE.Parse(original_xml)
return UKM_XML_TYPE.PrettyPrint(config) | [
"def",
"PrettifyXML",
"(",
"original_xml",
")",
":",
"config",
"=",
"UKM_XML_TYPE",
".",
"Parse",
"(",
"original_xml",
")",
"return",
"UKM_XML_TYPE",
".",
"PrettyPrint",
"(",
"config",
")"
] | Parses the original xml and return a pretty printed version. | [
"Parses",
"the",
"original",
"xml",
"and",
"return",
"a",
"pretty",
"printed",
"version",
"."
] | [
"\"\"\"Parses the original xml and return a pretty printed version.\n\n Args:\n original_xml: A string containing the original xml file contents.\n\n Returns:\n A pretty-printed xml string, or None if the config contains errors.\n \"\"\""
] | [
{
"param": "original_xml",
"type": null
}
] | {
"returns": [
{
"docstring": "A pretty-printed xml string, or None if the config contains errors.",
"docstring_tokens": [
"A",
"pretty",
"-",
"printed",
"xml",
"string",
"or",
"None",
"if",
"the",
"config",
... |
d1b7e0d2a75d29516a88d57381de6dd19e8ae03a | sunlongbo/chromium | tools/traffic_annotation/scripts/traffic_annotation_auditor_tests.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckAuditorResults | <not_specific> | def CheckAuditorResults(self):
"""Runs auditor using different configurations, expecting to run error free,
and having equal results in the exported TSV file in all cases. The TSV file
provides a summary of all annotations and their content.
Returns:
bool True if all results are as expected.
... | Runs auditor using different configurations, expecting to run error free,
and having equal results in the exported TSV file in all cases. The TSV file
provides a summary of all annotations and their content.
Returns:
bool True if all results are as expected.
| Runs auditor using different configurations, expecting to run error free,
and having equal results in the exported TSV file in all cases. The TSV file
provides a summary of all annotations and their content. | [
"Runs",
"auditor",
"using",
"different",
"configurations",
"expecting",
"to",
"run",
"error",
"free",
"and",
"having",
"equal",
"results",
"in",
"the",
"exported",
"TSV",
"file",
"in",
"all",
"cases",
".",
"The",
"TSV",
"file",
"provides",
"a",
"summary",
"o... | def CheckAuditorResults(self):
configs = [
[
"--test-only",
"--error-resilient",
],
[
"--test-only",
],
[
"--test-only",
"--no-filtering",
],
]
self.last_result = None
for config in configs:
result = self._RunTes... | [
"def",
"CheckAuditorResults",
"(",
"self",
")",
":",
"configs",
"=",
"[",
"[",
"\"--test-only\"",
",",
"\"--error-resilient\"",
",",
"]",
",",
"[",
"\"--test-only\"",
",",
"]",
",",
"[",
"\"--test-only\"",
",",
"\"--no-filtering\"",
",",
"]",
",",
"]",
"self... | Runs auditor using different configurations, expecting to run error free,
and having equal results in the exported TSV file in all cases. | [
"Runs",
"auditor",
"using",
"different",
"configurations",
"expecting",
"to",
"run",
"error",
"free",
"and",
"having",
"equal",
"results",
"in",
"the",
"exported",
"TSV",
"file",
"in",
"all",
"cases",
"."
] | [
"\"\"\"Runs auditor using different configurations, expecting to run error free,\n and having equal results in the exported TSV file in all cases. The TSV file\n provides a summary of all annotations and their content.\n\n Returns:\n bool True if all results are as expected.\n \"\"\"",
"# Similar... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "bool True if all results are as expected.",
"docstring_tokens": [
"bool",
"True",
"if",
"all",
"results",
"are",
"as",
"expected",
"."
],
"type": null
}
],
"raises": [],
"params... |
d1b7e0d2a75d29516a88d57381de6dd19e8ae03a | sunlongbo/chromium | tools/traffic_annotation/scripts/traffic_annotation_auditor_tests.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RunTest | <not_specific> | def _RunTest(self, args, use_python_auditor):
"""Runs the auditor test with given |args|, and returns the extracted
annotations.
Args:
args: list of str Arguments to be passed to auditor.
use_python_auditor: If True, test auditor.py instead of
traffic_annotation_auditor.exe.
Return... | Runs the auditor test with given |args|, and returns the extracted
annotations.
Args:
args: list of str Arguments to be passed to auditor.
use_python_auditor: If True, test auditor.py instead of
traffic_annotation_auditor.exe.
Returns:
str Content of annotations.tsv file if succe... | Runs the auditor test with given |args|, and returns the extracted
annotations. | [
"Runs",
"the",
"auditor",
"test",
"with",
"given",
"|args|",
"and",
"returns",
"the",
"extracted",
"annotations",
"."
] | def _RunTest(self, args, use_python_auditor):
if use_python_auditor:
auditor_name = "auditor.py"
else:
auditor_name = "traffic_annotation_auditor"
print("Running %s using config: %s" % (auditor_name, args))
try:
os.remove(self.annotations_filename)
except OSError:
pass
st... | [
"def",
"_RunTest",
"(",
"self",
",",
"args",
",",
"use_python_auditor",
")",
":",
"if",
"use_python_auditor",
":",
"auditor_name",
"=",
"\"auditor.py\"",
"else",
":",
"auditor_name",
"=",
"\"traffic_annotation_auditor\"",
"print",
"(",
"\"Running %s using config: %s\"",... | Runs the auditor test with given |args|, and returns the extracted
annotations. | [
"Runs",
"the",
"auditor",
"test",
"with",
"given",
"|args|",
"and",
"returns",
"the",
"extracted",
"annotations",
"."
] | [
"\"\"\"Runs the auditor test with given |args|, and returns the extracted\n annotations.\n\n Args:\n args: list of str Arguments to be passed to auditor.\n use_python_auditor: If True, test auditor.py instead of\n traffic_annotation_auditor.exe.\n\n Returns:\n str Content of annotatio... | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
},
{
"param": "use_python_auditor",
"type": null
}
] | {
"returns": [
{
"docstring": "str Content of annotations.tsv file if successful, otherwise None.",
"docstring_tokens": [
"str",
"Content",
"of",
"annotations",
".",
"tsv",
"file",
"if",
"successful",
"otherwise",
... |
d1ee7ef9c291647f4323a4711f759d6775f6032f | sunlongbo/chromium | chrome/test/mini_installer/file_operations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | VerifyFileExpectation | <not_specific> | def VerifyFileExpectation(expectation_name, expectation, variable_expander):
"""Verifies that a file is present or absent, throwing an AssertionError if
the expectation is not met.
Args:
expectation_name: Path to the file being verified (may contain variables
to be expanded).
ex... | Verifies that a file is present or absent, throwing an AssertionError if
the expectation is not met.
Args:
expectation_name: Path to the file being verified (may contain variables
to be expanded).
expectation: A dictionary with the following key and value:
'exists' a boo... | Verifies that a file is present or absent, throwing an AssertionError if
the expectation is not met. | [
"Verifies",
"that",
"a",
"file",
"is",
"present",
"or",
"absent",
"throwing",
"an",
"AssertionError",
"if",
"the",
"expectation",
"is",
"not",
"met",
"."
] | def VerifyFileExpectation(expectation_name, expectation, variable_expander):
def GetDirContents(path):
contents = []
for dirpath, dirnames, filenames in os.walk(path):
for a_dir in dirnames:
contents.append('%s\\' % os.path.join(dirpath, a_dir))
for a_file in ... | [
"def",
"VerifyFileExpectation",
"(",
"expectation_name",
",",
"expectation",
",",
"variable_expander",
")",
":",
"def",
"GetDirContents",
"(",
"path",
")",
":",
"\"\"\"Returns a list of all files and directories in a directory.\"\"\"",
"contents",
"=",
"[",
"]",
"for",
"d... | Verifies that a file is present or absent, throwing an AssertionError if
the expectation is not met. | [
"Verifies",
"that",
"a",
"file",
"is",
"present",
"or",
"absent",
"throwing",
"an",
"AssertionError",
"if",
"the",
"expectation",
"is",
"not",
"met",
"."
] | [
"\"\"\"Verifies that a file is present or absent, throwing an AssertionError if\n the expectation is not met.\n\n Args:\n expectation_name: Path to the file being verified (may contain variables\n to be expanded).\n expectation: A dictionary with the following key and value:\n ... | [
{
"param": "expectation_name",
"type": null
},
{
"param": "expectation",
"type": null
},
{
"param": "variable_expander",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "If an expectation is not satisfied.",
"docstring_tokens": [
"If",
"an",
"expectation",
"is",
"not",
"satisfied",
"."
],
"type": "AssertionError"
}
],
"params": [
{
"iden... |
d1ee7ef9c291647f4323a4711f759d6775f6032f | sunlongbo/chromium | chrome/test/mini_installer/file_operations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetDirContents | <not_specific> | def GetDirContents(path):
"""Returns a list of all files and directories in a directory."""
contents = []
for dirpath, dirnames, filenames in os.walk(path):
for a_dir in dirnames:
contents.append('%s\\' % os.path.join(dirpath, a_dir))
for a_file in filenam... | Returns a list of all files and directories in a directory. | Returns a list of all files and directories in a directory. | [
"Returns",
"a",
"list",
"of",
"all",
"files",
"and",
"directories",
"in",
"a",
"directory",
"."
] | def GetDirContents(path):
contents = []
for dirpath, dirnames, filenames in os.walk(path):
for a_dir in dirnames:
contents.append('%s\\' % os.path.join(dirpath, a_dir))
for a_file in filenames:
contents.append(os.path.join(dirpath, a_file))
... | [
"def",
"GetDirContents",
"(",
"path",
")",
":",
"contents",
"=",
"[",
"]",
"for",
"dirpath",
",",
"dirnames",
",",
"filenames",
"in",
"os",
".",
"walk",
"(",
"path",
")",
":",
"for",
"a_dir",
"in",
"dirnames",
":",
"contents",
".",
"append",
"(",
"'%... | Returns a list of all files and directories in a directory. | [
"Returns",
"a",
"list",
"of",
"all",
"files",
"and",
"directories",
"in",
"a",
"directory",
"."
] | [
"\"\"\"Returns a list of all files and directories in a directory.\"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d1ee7ef9c291647f4323a4711f759d6775f6032f | sunlongbo/chromium | chrome/test/mini_installer/file_operations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CleanFile | null | def CleanFile(expectation_name, expectation, variable_expander):
"""Deletes files or directories based on expectations.
Args:
expectation_name: Path to the file/directory to be cleaned.
expectation: A dictionary describing the state of the path:
'exists': A boolean False indicating ... | Deletes files or directories based on expectations.
Args:
expectation_name: Path to the file/directory to be cleaned.
expectation: A dictionary describing the state of the path:
'exists': A boolean False indicating that the path must not exist.
variable_expander: A VariableExpan... | Deletes files or directories based on expectations. | [
"Deletes",
"files",
"or",
"directories",
"based",
"on",
"expectations",
"."
] | def CleanFile(expectation_name, expectation, variable_expander):
file_path = variable_expander.Expand(expectation_name)
assert not expectation['exists'], (
'Invalid expectation for CleanFile operation: \'exists\' property for '
+ 'path %s must not be True' % file_path)
try:
if stat.S... | [
"def",
"CleanFile",
"(",
"expectation_name",
",",
"expectation",
",",
"variable_expander",
")",
":",
"file_path",
"=",
"variable_expander",
".",
"Expand",
"(",
"expectation_name",
")",
"assert",
"not",
"expectation",
"[",
"'exists'",
"]",
",",
"(",
"'Invalid expec... | Deletes files or directories based on expectations. | [
"Deletes",
"files",
"or",
"directories",
"based",
"on",
"expectations",
"."
] | [
"\"\"\"Deletes files or directories based on expectations.\n\n Args:\n expectation_name: Path to the file/directory to be cleaned.\n expectation: A dictionary describing the state of the path:\n 'exists': A boolean False indicating that the path must not exist.\n variable_expander... | [
{
"param": "expectation_name",
"type": null
},
{
"param": "expectation",
"type": null
},
{
"param": "variable_expander",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "If an expectation is not satisfied.",
"docstring_tokens": [
"If",
"an",
"expectation",
"is",
"not",
"satisfied",
"."
],
"type": "AssertionError"
},
{
"docstring": "If an err... |
d1f7eb69af3947a25e41c01bab5ff9d17ef81ac0 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/attribute.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | does_inherit_getter | <not_specific> | def does_inherit_getter(self):
"""
Returns True if this attribute inherits its getter.
https://webidl.spec.whatwg.org/#dfn-inherit-getter
"""
return self._does_inherit_getter |
Returns True if this attribute inherits its getter.
https://webidl.spec.whatwg.org/#dfn-inherit-getter
| Returns True if this attribute inherits its getter. | [
"Returns",
"True",
"if",
"this",
"attribute",
"inherits",
"its",
"getter",
"."
] | def does_inherit_getter(self):
return self._does_inherit_getter | [
"def",
"does_inherit_getter",
"(",
"self",
")",
":",
"return",
"self",
".",
"_does_inherit_getter"
] | Returns True if this attribute inherits its getter. | [
"Returns",
"True",
"if",
"this",
"attribute",
"inherits",
"its",
"getter",
"."
] | [
"\"\"\"\n Returns True if this attribute inherits its getter.\n https://webidl.spec.whatwg.org/#dfn-inherit-getter\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
193e6c83cf115e3246a46e82c5de5365953509f6 | sunlongbo/chromium | tools/perf/page_sets/system_health/system_health_story.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GenerateStoryDescription | <not_specific> | def GenerateStoryDescription(cls):
""" Subclasses of SystemHealthStory can override this to auto generate
their story description.
However, it's recommended to use the Python docstring to describe the user
stories instead and this should only be used for very repetitive cases.
"""
return None | Subclasses of SystemHealthStory can override this to auto generate
their story description.
However, it's recommended to use the Python docstring to describe the user
stories instead and this should only be used for very repetitive cases.
| Subclasses of SystemHealthStory can override this to auto generate
their story description.
However, it's recommended to use the Python docstring to describe the user
stories instead and this should only be used for very repetitive cases. | [
"Subclasses",
"of",
"SystemHealthStory",
"can",
"override",
"this",
"to",
"auto",
"generate",
"their",
"story",
"description",
".",
"However",
"it",
"'",
"s",
"recommended",
"to",
"use",
"the",
"Python",
"docstring",
"to",
"describe",
"the",
"user",
"stories",
... | def GenerateStoryDescription(cls):
return None | [
"def",
"GenerateStoryDescription",
"(",
"cls",
")",
":",
"return",
"None"
] | Subclasses of SystemHealthStory can override this to auto generate
their story description. | [
"Subclasses",
"of",
"SystemHealthStory",
"can",
"override",
"this",
"to",
"auto",
"generate",
"their",
"story",
"description",
"."
] | [
"\"\"\" Subclasses of SystemHealthStory can override this to auto generate\n their story description.\n However, it's recommended to use the Python docstring to describe the user\n stories instead and this should only be used for very repetitive cases.\n \"\"\""
] | [
{
"param": "cls",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c162fbd33c4e3ccd54e0aaed6d0fec0f5094fd66 | sunlongbo/chromium | third_party/pefile_py3/pefile.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | parse_export_directory | <not_specific> | def parse_export_directory(self, rva, size, forwarded_only=False):
"""Parse the export directory.
Given the RVA of the export directory, it will process all
its entries.
The exports will be made available as a list of ExportData
instances in the 'IMAGE_DIRECTORY_ENTRY_EXPORT' P... | Parse the export directory.
Given the RVA of the export directory, it will process all
its entries.
The exports will be made available as a list of ExportData
instances in the 'IMAGE_DIRECTORY_ENTRY_EXPORT' PE attribute.
| Parse the export directory.
Given the RVA of the export directory, it will process all
its entries.
The exports will be made available as a list of ExportData
instances in the 'IMAGE_DIRECTORY_ENTRY_EXPORT' PE attribute. | [
"Parse",
"the",
"export",
"directory",
".",
"Given",
"the",
"RVA",
"of",
"the",
"export",
"directory",
"it",
"will",
"process",
"all",
"its",
"entries",
".",
"The",
"exports",
"will",
"be",
"made",
"available",
"as",
"a",
"list",
"of",
"ExportData",
"insta... | def parse_export_directory(self, rva, size, forwarded_only=False):
try:
export_dir = self.__unpack_data__(
self.__IMAGE_EXPORT_DIRECTORY_format__,
self.get_data( rva, Structure(self.__IMAGE_EXPORT_DIRECTORY_format__).sizeof() ),
file_offset = self.get... | [
"def",
"parse_export_directory",
"(",
"self",
",",
"rva",
",",
"size",
",",
"forwarded_only",
"=",
"False",
")",
":",
"try",
":",
"export_dir",
"=",
"self",
".",
"__unpack_data__",
"(",
"self",
".",
"__IMAGE_EXPORT_DIRECTORY_format__",
",",
"self",
".",
"get_d... | Parse the export directory. | [
"Parse",
"the",
"export",
"directory",
"."
] | [
"\"\"\"Parse the export directory.\n\n Given the RVA of the export directory, it will process all\n its entries.\n\n The exports will be made available as a list of ExportData\n instances in the 'IMAGE_DIRECTORY_ENTRY_EXPORT' PE attribute.\n \"\"\"",
"# We keep track of the byte... | [
{
"param": "self",
"type": null
},
{
"param": "rva",
"type": null
},
{
"param": "size",
"type": null
},
{
"param": "forwarded_only",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rva",
"type": null,
"docstring": null,
"docstring_tokens": []... |
c162fbd33c4e3ccd54e0aaed6d0fec0f5094fd66 | sunlongbo/chromium | third_party/pefile_py3/pefile.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | parse_delay_import_directory | <not_specific> | def parse_delay_import_directory(self, rva, size):
"""Walk and parse the delay import directory."""
import_descs = []
error_count = 0
while True:
try:
# If the RVA is invalid all would blow up. Some PEs seem to be
# specially nasty and have a... | Walk and parse the delay import directory. | Walk and parse the delay import directory. | [
"Walk",
"and",
"parse",
"the",
"delay",
"import",
"directory",
"."
] | def parse_delay_import_directory(self, rva, size):
import_descs = []
error_count = 0
while True:
try:
data = self.get_data( rva, Structure(self.__IMAGE_DELAY_IMPORT_DESCRIPTOR_format__).sizeof() )
except PEFormatError as e:
self.__warnings... | [
"def",
"parse_delay_import_directory",
"(",
"self",
",",
"rva",
",",
"size",
")",
":",
"import_descs",
"=",
"[",
"]",
"error_count",
"=",
"0",
"while",
"True",
":",
"try",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"rva",
",",
"Structure",
"(",
"s... | Walk and parse the delay import directory. | [
"Walk",
"and",
"parse",
"the",
"delay",
"import",
"directory",
"."
] | [
"\"\"\"Walk and parse the delay import directory.\"\"\"",
"# If the RVA is invalid all would blow up. Some PEs seem to be",
"# specially nasty and have an invalid RVA.",
"# If the structure is all zeros, we reached the end of the list",
"# Handle old import descriptor that has Virtual Addresses instead of R... | [
{
"param": "self",
"type": null
},
{
"param": "rva",
"type": null
},
{
"param": "size",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rva",
"type": null,
"docstring": null,
"docstring_tokens": []... |
c162fbd33c4e3ccd54e0aaed6d0fec0f5094fd66 | sunlongbo/chromium | third_party/pefile_py3/pefile.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | parse_import_directory | <not_specific> | def parse_import_directory(self, rva, size, dllnames_only=False):
"""Walk and parse the import directory."""
import_descs = []
error_count = 0
while True:
try:
# If the RVA is invalid all would blow up. Some EXEs seem to be
# specially nasty ... | Walk and parse the import directory. | Walk and parse the import directory. | [
"Walk",
"and",
"parse",
"the",
"import",
"directory",
"."
] | def parse_import_directory(self, rva, size, dllnames_only=False):
import_descs = []
error_count = 0
while True:
try:
data = self.get_data(rva, Structure(
self.__IMAGE_IMPORT_DESCRIPTOR_format__).sizeof() )
except PEFormatError as e... | [
"def",
"parse_import_directory",
"(",
"self",
",",
"rva",
",",
"size",
",",
"dllnames_only",
"=",
"False",
")",
":",
"import_descs",
"=",
"[",
"]",
"error_count",
"=",
"0",
"while",
"True",
":",
"try",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"r... | Walk and parse the import directory. | [
"Walk",
"and",
"parse",
"the",
"import",
"directory",
"."
] | [
"\"\"\"Walk and parse the import directory.\"\"\"",
"# If the RVA is invalid all would blow up. Some EXEs seem to be",
"# specially nasty and have an invalid RVA.",
"# If the structure is all zeros, we reached the end of the list",
"# If the array of thunks is somewhere earlier than the import",
"# descri... | [
{
"param": "self",
"type": null
},
{
"param": "rva",
"type": null
},
{
"param": "size",
"type": null
},
{
"param": "dllnames_only",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rva",
"type": null,
"docstring": null,
"docstring_tokens": []... |
c162fbd33c4e3ccd54e0aaed6d0fec0f5094fd66 | sunlongbo/chromium | third_party/pefile_py3/pefile.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | parse_imports | <not_specific> | def parse_imports(
self, original_first_thunk, first_thunk,
forwarder_chain, max_length=None, contains_addresses=False):
"""Parse the imported symbols.
It will fill a list, which will be available as the dictionary
attribute "imports". Its keys will be the DLL names and ... | Parse the imported symbols.
It will fill a list, which will be available as the dictionary
attribute "imports". Its keys will be the DLL names and the values
of all the symbols imported from that object.
| Parse the imported symbols.
It will fill a list, which will be available as the dictionary
attribute "imports". Its keys will be the DLL names and the values
of all the symbols imported from that object. | [
"Parse",
"the",
"imported",
"symbols",
".",
"It",
"will",
"fill",
"a",
"list",
"which",
"will",
"be",
"available",
"as",
"the",
"dictionary",
"attribute",
"\"",
"imports",
"\"",
".",
"Its",
"keys",
"will",
"be",
"the",
"DLL",
"names",
"and",
"the",
"valu... | def parse_imports(
self, original_first_thunk, first_thunk,
forwarder_chain, max_length=None, contains_addresses=False):
imported_symbols = []
ilt = self.get_import_table(original_first_thunk, max_length, contains_addresses)
iat = self.get_import_table(first_thunk, max_le... | [
"def",
"parse_imports",
"(",
"self",
",",
"original_first_thunk",
",",
"first_thunk",
",",
"forwarder_chain",
",",
"max_length",
"=",
"None",
",",
"contains_addresses",
"=",
"False",
")",
":",
"imported_symbols",
"=",
"[",
"]",
"ilt",
"=",
"self",
".",
"get_im... | Parse the imported symbols. | [
"Parse",
"the",
"imported",
"symbols",
"."
] | [
"\"\"\"Parse the imported symbols.\n\n It will fill a list, which will be available as the dictionary\n attribute \"imports\". Its keys will be the DLL names and the values\n of all the symbols imported from that object.\n \"\"\"",
"# Import Lookup Table. Contains ordinals or pointers ... | [
{
"param": "self",
"type": null
},
{
"param": "original_first_thunk",
"type": null
},
{
"param": "first_thunk",
"type": null
},
{
"param": "forwarder_chain",
"type": null
},
{
"param": "max_length",
"type": null
},
{
"param": "contains_addresses",
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "original_first_thunk",
"type": null,
"docstring": null,
"docs... |
c162fbd33c4e3ccd54e0aaed6d0fec0f5094fd66 | sunlongbo/chromium | third_party/pefile_py3/pefile.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | relocate_image | null | def relocate_image(self, new_ImageBase):
"""Apply the relocation information to the image using the provided new image base.
This method will apply the relocation information to the image. Given the new base,
all the relocations will be processed and both the raw data and the section's data
... | Apply the relocation information to the image using the provided new image base.
This method will apply the relocation information to the image. Given the new base,
all the relocations will be processed and both the raw data and the section's data
will be fixed accordingly.
The resultin... | Apply the relocation information to the image using the provided new image base.
This method will apply the relocation information to the image. Given the new base,
all the relocations will be processed and both the raw data and the section's data
will be fixed accordingly.
The resulting image can be retrieved as well ... | [
"Apply",
"the",
"relocation",
"information",
"to",
"the",
"image",
"using",
"the",
"provided",
"new",
"image",
"base",
".",
"This",
"method",
"will",
"apply",
"the",
"relocation",
"information",
"to",
"the",
"image",
".",
"Given",
"the",
"new",
"base",
"all"... | def relocate_image(self, new_ImageBase):
relocation_difference = new_ImageBase - self.OPTIONAL_HEADER.ImageBase
if (len(self.OPTIONAL_HEADER.DATA_DIRECTORY)>=6 and
self.OPTIONAL_HEADER.DATA_DIRECTORY[5].Size):
if not hasattr(self, 'DIRECTORY_ENTRY_BASERELOC'):
sel... | [
"def",
"relocate_image",
"(",
"self",
",",
"new_ImageBase",
")",
":",
"relocation_difference",
"=",
"new_ImageBase",
"-",
"self",
".",
"OPTIONAL_HEADER",
".",
"ImageBase",
"if",
"(",
"len",
"(",
"self",
".",
"OPTIONAL_HEADER",
".",
"DATA_DIRECTORY",
")",
">=",
... | Apply the relocation information to the image using the provided new image base. | [
"Apply",
"the",
"relocation",
"information",
"to",
"the",
"image",
"using",
"the",
"provided",
"new",
"image",
"base",
"."
] | [
"\"\"\"Apply the relocation information to the image using the provided new image base.\n\n This method will apply the relocation information to the image. Given the new base,\n all the relocations will be processed and both the raw data and the section's data\n will be fixed accordingly.\n ... | [
{
"param": "self",
"type": null
},
{
"param": "new_ImageBase",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "new_ImageBase",
"type": null,
"docstring": null,
"docstring_t... |
c162fbd33c4e3ccd54e0aaed6d0fec0f5094fd66 | sunlongbo/chromium | third_party/pefile_py3/pefile.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | is_driver | <not_specific> | def is_driver(self):
"""Check whether the file is a Windows driver.
This will return true only if there are reliable indicators of the image
being a driver.
"""
# Checking that the ImageBase field of the OptionalHeader is above or
# equal to 0x80000000 (that is, whether... | Check whether the file is a Windows driver.
This will return true only if there are reliable indicators of the image
being a driver.
| Check whether the file is a Windows driver.
This will return true only if there are reliable indicators of the image
being a driver. | [
"Check",
"whether",
"the",
"file",
"is",
"a",
"Windows",
"driver",
".",
"This",
"will",
"return",
"true",
"only",
"if",
"there",
"are",
"reliable",
"indicators",
"of",
"the",
"image",
"being",
"a",
"driver",
"."
] | def is_driver(self):
if any((section.Characteristics &
SECTION_CHARACTERISTICS['IMAGE_SCN_MEM_NOT_PAGED']) for
section in self.sections ):
return True
If the import directory was not parsed (fast_load = True); do it now.
if not hasattr(self, 'DIRE... | [
"def",
"is_driver",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'DIRECTORY_ENTRY_IMPORT'",
")",
":",
"self",
".",
"parse_data_directories",
"(",
"directories",
"=",
"[",
"DIRECTORY_ENTRY",
"[",
"'IMAGE_DIRECTORY_ENTRY_IMPORT'",
"]",
"]",
")... | Check whether the file is a Windows driver. | [
"Check",
"whether",
"the",
"file",
"is",
"a",
"Windows",
"driver",
"."
] | [
"\"\"\"Check whether the file is a Windows driver.\n\n This will return true only if there are reliable indicators of the image\n being a driver.\n \"\"\"",
"# Checking that the ImageBase field of the OptionalHeader is above or",
"# equal to 0x80000000 (that is, whether it lies in the upper... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c76cfbc053c2e103cc98d02f2e4a7fce24acecbd | sunlongbo/chromium | components/zucchini/fuzzers/generate_fuzzer_data.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | parse_args | <not_specific> | def parse_args():
"""Parses arguments from command-line."""
parser = argparse.ArgumentParser()
parser.add_argument('--raw', help='Whether to use Raw Zucchini.',
action='store_true')
parser.add_argument('old_file', help='Old file to generate/apply patch.')
parser.add_argument('new_file', ... | Parses arguments from command-line. | Parses arguments from command-line. | [
"Parses",
"arguments",
"from",
"command",
"-",
"line",
"."
] | def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--raw', help='Whether to use Raw Zucchini.',
action='store_true')
parser.add_argument('old_file', help='Old file to generate/apply patch.')
parser.add_argument('new_file', help='New file to generate patch from.')
p... | [
"def",
"parse_args",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'--raw'",
",",
"help",
"=",
"'Whether to use Raw Zucchini.'",
",",
"action",
"=",
"'store_true'",
")",
"parser",
".",
"add_argu... | Parses arguments from command-line. | [
"Parses",
"arguments",
"from",
"command",
"-",
"line",
"."
] | [
"\"\"\"Parses arguments from command-line.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
c76cfbc053c2e103cc98d02f2e4a7fce24acecbd | sunlongbo/chromium | components/zucchini/fuzzers/generate_fuzzer_data.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | gen | <not_specific> | def gen(old_file, new_file, patch_file, output_file, is_raw, is_win):
"""Generates a new patch and binary encodes a protobuf pair."""
# Create output directory if missing.
output_dir = os.path.dirname(output_file)
if not os.path.exists(output_dir):
os.makedirs(output_dir)
# Handle Windows executable name... | Generates a new patch and binary encodes a protobuf pair. | Generates a new patch and binary encodes a protobuf pair. | [
"Generates",
"a",
"new",
"patch",
"and",
"binary",
"encodes",
"a",
"protobuf",
"pair",
"."
] | def gen(old_file, new_file, patch_file, output_file, is_raw, is_win):
output_dir = os.path.dirname(output_file)
if not os.path.exists(output_dir):
os.makedirs(output_dir)
zucchini = 'zucchini'
protoc = 'protoc'
if is_win:
zucchini += '.exe'
protoc += '.exe'
zuc_cmd = [os.path.abspath(zucchini), ... | [
"def",
"gen",
"(",
"old_file",
",",
"new_file",
",",
"patch_file",
",",
"output_file",
",",
"is_raw",
",",
"is_win",
")",
":",
"output_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"output_file",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",... | Generates a new patch and binary encodes a protobuf pair. | [
"Generates",
"a",
"new",
"patch",
"and",
"binary",
"encodes",
"a",
"protobuf",
"pair",
"."
] | [
"\"\"\"Generates a new patch and binary encodes a protobuf pair.\"\"\"",
"# Create output directory if missing.",
"# Handle Windows executable names.",
"# Generate a new patch.",
"# Binary encode the protobuf pair."
] | [
{
"param": "old_file",
"type": null
},
{
"param": "new_file",
"type": null
},
{
"param": "patch_file",
"type": null
},
{
"param": "output_file",
"type": null
},
{
"param": "is_raw",
"type": null
},
{
"param": "is_win",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "old_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "new_file",
"type": null,
"docstring": null,
"docstring_to... |
c7ed467d13548940478918d967b216211f643f09 | sunlongbo/chromium | testing/unexpected_passes_common/result_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RecursiveHtmlToFile | null | def _RecursiveHtmlToFile(element, file_handle):
"""Recursively outputs |element| as HTMl to |file_handle|.
Iterables will be output as a collapsible section containing any of the
iterable's contents.
Any link-like text will be turned into anchor tags.
Args:
element: A dict, list, or str/unicode to outp... | Recursively outputs |element| as HTMl to |file_handle|.
Iterables will be output as a collapsible section containing any of the
iterable's contents.
Any link-like text will be turned into anchor tags.
Args:
element: A dict, list, or str/unicode to output.
file_handle: An open file-like object to outp... | Recursively outputs |element| as HTMl to |file_handle|.
Iterables will be output as a collapsible section containing any of the
iterable's contents.
Any link-like text will be turned into anchor tags. | [
"Recursively",
"outputs",
"|element|",
"as",
"HTMl",
"to",
"|file_handle|",
".",
"Iterables",
"will",
"be",
"output",
"as",
"a",
"collapsible",
"section",
"containing",
"any",
"of",
"the",
"iterable",
"'",
"s",
"contents",
".",
"Any",
"link",
"-",
"like",
"t... | def _RecursiveHtmlToFile(element, file_handle):
if isinstance(element, six.string_types):
file_handle.write('<p>%s</p>\n' % _LinkifyString(element))
elif isinstance(element, dict):
for k, v in element.items():
html_class = 'collapsible_group'
if k and FULL_PASS in k:
html_class = 'highli... | [
"def",
"_RecursiveHtmlToFile",
"(",
"element",
",",
"file_handle",
")",
":",
"if",
"isinstance",
"(",
"element",
",",
"six",
".",
"string_types",
")",
":",
"file_handle",
".",
"write",
"(",
"'<p>%s</p>\\n'",
"%",
"_LinkifyString",
"(",
"element",
")",
")",
"... | Recursively outputs |element| as HTMl to |file_handle|. | [
"Recursively",
"outputs",
"|element|",
"as",
"HTMl",
"to",
"|file_handle|",
"."
] | [
"\"\"\"Recursively outputs |element| as HTMl to |file_handle|.\n\n Iterables will be output as a collapsible section containing any of the\n iterable's contents.\n\n Any link-like text will be turned into anchor tags.\n\n Args:\n element: A dict, list, or str/unicode to output.\n file_handle: An open file... | [
{
"param": "element",
"type": null
},
{
"param": "file_handle",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "element",
"type": null,
"docstring": "A dict, list, or str/unicode to output.",
"docstring_tokens": [
"A",
"dict",
"list",
"or",
"str",
"/",
"unicode",
"to",
... |
c7ed467d13548940478918d967b216211f643f09 | sunlongbo/chromium | testing/unexpected_passes_common/result_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _LinkifyString | <not_specific> | def _LinkifyString(s):
"""Turns instances of links into anchor tags.
Args:
s: The string to linkify.
Returns:
A copy of |s| with instances of links turned into anchor tags pointing to
the link.
"""
for component in s.split():
if component.startswith('http'):
component = component.strip... | Turns instances of links into anchor tags.
Args:
s: The string to linkify.
Returns:
A copy of |s| with instances of links turned into anchor tags pointing to
the link.
| Turns instances of links into anchor tags. | [
"Turns",
"instances",
"of",
"links",
"into",
"anchor",
"tags",
"."
] | def _LinkifyString(s):
for component in s.split():
if component.startswith('http'):
component = component.strip(',.!')
s = s.replace(component, '<a href="%s">%s</a>' % (component, component))
return s | [
"def",
"_LinkifyString",
"(",
"s",
")",
":",
"for",
"component",
"in",
"s",
".",
"split",
"(",
")",
":",
"if",
"component",
".",
"startswith",
"(",
"'http'",
")",
":",
"component",
"=",
"component",
".",
"strip",
"(",
"',.!'",
")",
"s",
"=",
"s",
"... | Turns instances of links into anchor tags. | [
"Turns",
"instances",
"of",
"links",
"into",
"anchor",
"tags",
"."
] | [
"\"\"\"Turns instances of links into anchor tags.\n\n Args:\n s: The string to linkify.\n\n Returns:\n A copy of |s| with instances of links turned into anchor tags pointing to\n the link.\n \"\"\""
] | [
{
"param": "s",
"type": null
}
] | {
"returns": [
{
"docstring": "A copy of |s| with instances of links turned into anchor tags pointing to\nthe link.",
"docstring_tokens": [
"A",
"copy",
"of",
"|s|",
"with",
"instances",
"of",
"links",
"turned",
"into",
... |
c7ed467d13548940478918d967b216211f643f09 | sunlongbo/chromium | testing/unexpected_passes_common/result_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ConvertTestExpectationMapToStringDict | <not_specific> | def _ConvertTestExpectationMapToStringDict(test_expectation_map):
"""Converts |test_expectation_map| to a dict of strings for reporting.
Args:
test_expectation_map: A data_types.TestExpectationMap.
Returns:
A string dictionary representation of |test_expectation_map| in the
following format:
{
... | Converts |test_expectation_map| to a dict of strings for reporting.
Args:
test_expectation_map: A data_types.TestExpectationMap.
Returns:
A string dictionary representation of |test_expectation_map| in the
following format:
{
expectation_file: {
test_name: {
expectation_sum... | Converts |test_expectation_map| to a dict of strings for reporting. | [
"Converts",
"|test_expectation_map|",
"to",
"a",
"dict",
"of",
"strings",
"for",
"reporting",
"."
] | def _ConvertTestExpectationMapToStringDict(test_expectation_map):
assert isinstance(test_expectation_map, data_types.TestExpectationMap)
output_dict = {}
for expectation_file, expectation_map in test_expectation_map.items():
output_dict[expectation_file] = {}
for expectation, builder_map in expectation_ma... | [
"def",
"_ConvertTestExpectationMapToStringDict",
"(",
"test_expectation_map",
")",
":",
"assert",
"isinstance",
"(",
"test_expectation_map",
",",
"data_types",
".",
"TestExpectationMap",
")",
"output_dict",
"=",
"{",
"}",
"for",
"expectation_file",
",",
"expectation_map",... | Converts |test_expectation_map| to a dict of strings for reporting. | [
"Converts",
"|test_expectation_map|",
"to",
"a",
"dict",
"of",
"strings",
"for",
"reporting",
"."
] | [
"\"\"\"Converts |test_expectation_map| to a dict of strings for reporting.\n\n Args:\n test_expectation_map: A data_types.TestExpectationMap.\n\n Returns:\n A string dictionary representation of |test_expectation_map| in the\n following format:\n {\n expectation_file: {\n test_name: {\n ... | [
{
"param": "test_expectation_map",
"type": null
}
] | {
"returns": [
{
"docstring": "A string dictionary representation of |test_expectation_map| in the\nfollowing format:\n{\nexpectation_file: {\ntest_name: {\nexpectation_summary: {\nbuilder_name: {\n'Fully passed in the following': [\nstep1,\n],\n'Partially passed in the following': {\nstep2: [\nfailure_link... |
c7ed467d13548940478918d967b216211f643f09 | sunlongbo/chromium | testing/unexpected_passes_common/result_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ConvertUnmatchedResultsToStringDict | <not_specific> | def _ConvertUnmatchedResultsToStringDict(unmatched_results):
"""Converts |unmatched_results| to a dict of strings for reporting.
Args:
unmatched_results: A dict mapping builder names (string) to lists of
data_types.Result who did not have a matching expectation.
Returns:
A string dictionary repr... | Converts |unmatched_results| to a dict of strings for reporting.
Args:
unmatched_results: A dict mapping builder names (string) to lists of
data_types.Result who did not have a matching expectation.
Returns:
A string dictionary representation of |unmatched_results| in the following
format:
... | Converts |unmatched_results| to a dict of strings for reporting. | [
"Converts",
"|unmatched_results|",
"to",
"a",
"dict",
"of",
"strings",
"for",
"reporting",
"."
] | def _ConvertUnmatchedResultsToStringDict(unmatched_results):
output_dict = {}
for builder, results in unmatched_results.items():
for r in results:
builder_map = output_dict.setdefault(r.test, {})
step_map = builder_map.setdefault(builder, {})
result_str = 'Got "%s" on %s with tags [%s]' % (
... | [
"def",
"_ConvertUnmatchedResultsToStringDict",
"(",
"unmatched_results",
")",
":",
"output_dict",
"=",
"{",
"}",
"for",
"builder",
",",
"results",
"in",
"unmatched_results",
".",
"items",
"(",
")",
":",
"for",
"r",
"in",
"results",
":",
"builder_map",
"=",
"ou... | Converts |unmatched_results| to a dict of strings for reporting. | [
"Converts",
"|unmatched_results|",
"to",
"a",
"dict",
"of",
"strings",
"for",
"reporting",
"."
] | [
"\"\"\"Converts |unmatched_results| to a dict of strings for reporting.\n\n Args:\n unmatched_results: A dict mapping builder names (string) to lists of\n data_types.Result who did not have a matching expectation.\n\n Returns:\n A string dictionary representation of |unmatched_results| in the followi... | [
{
"param": "unmatched_results",
"type": null
}
] | {
"returns": [
{
"docstring": "A string dictionary representation of |unmatched_results| in the following\nformat:\n{\ntest_name: {\nbuilder_name: {\nstep_name: [\nindividual_result_string_1,\nindividual_result_string_2,\n\n],\n\n},\n\n},\n\n}",
"docstring_tokens": [
"A",
"string",
... |
c7ed467d13548940478918d967b216211f643f09 | sunlongbo/chromium | testing/unexpected_passes_common/result_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ConvertUnusedExpectationsToStringDict | <not_specific> | def _ConvertUnusedExpectationsToStringDict(unused_expectations):
"""Converts |unused_expectations| to a dict of strings for reporting.
Args:
unused_expectations: A dict mapping expectation file (str) to lists of
data_types.Expectation who did not have any matching results.
Returns:
A string dict... | Converts |unused_expectations| to a dict of strings for reporting.
Args:
unused_expectations: A dict mapping expectation file (str) to lists of
data_types.Expectation who did not have any matching results.
Returns:
A string dictionary representation of |unused_expectations| in the following
fo... | Converts |unused_expectations| to a dict of strings for reporting. | [
"Converts",
"|unused_expectations|",
"to",
"a",
"dict",
"of",
"strings",
"for",
"reporting",
"."
] | def _ConvertUnusedExpectationsToStringDict(unused_expectations):
output_dict = {}
for expectation_file, expectations in unused_expectations.items():
expectation_str_list = []
for e in expectations:
expectation_str_list.append(
'[ %s ] %s [ %s ]' %
(' '.join(e.tags), e.test, ' '.joi... | [
"def",
"_ConvertUnusedExpectationsToStringDict",
"(",
"unused_expectations",
")",
":",
"output_dict",
"=",
"{",
"}",
"for",
"expectation_file",
",",
"expectations",
"in",
"unused_expectations",
".",
"items",
"(",
")",
":",
"expectation_str_list",
"=",
"[",
"]",
"for... | Converts |unused_expectations| to a dict of strings for reporting. | [
"Converts",
"|unused_expectations|",
"to",
"a",
"dict",
"of",
"strings",
"for",
"reporting",
"."
] | [
"\"\"\"Converts |unused_expectations| to a dict of strings for reporting.\n\n Args:\n unused_expectations: A dict mapping expectation file (str) to lists of\n data_types.Expectation who did not have any matching results.\n\n Returns:\n A string dictionary representation of |unused_expectations| in th... | [
{
"param": "unused_expectations",
"type": null
}
] | {
"returns": [
{
"docstring": "A string dictionary representation of |unused_expectations| in the following\nformat:\n{\nexpectation_file: [\nexpectation1,\nexpectation2,\n],\n}\nThe expectations are in a format similar to what would be present as a line\nin an expectation file.",
"docstring_tokens": ... |
c7ed467d13548940478918d967b216211f643f09 | sunlongbo/chromium | testing/unexpected_passes_common/result_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | OutputAffectedUrls | null | def OutputAffectedUrls(removed_urls, orphaned_urls=None):
"""Outputs URLs of affected expectations for easier consumption by the user.
Outputs the following:
1. A string suitable for passing to Chrome via the command line to
open all bugs in the browser.
2. A string suitable for copying into the CL descr... | Outputs URLs of affected expectations for easier consumption by the user.
Outputs the following:
1. A string suitable for passing to Chrome via the command line to
open all bugs in the browser.
2. A string suitable for copying into the CL description to associate the CL
with all the affected bugs.
3... | Outputs URLs of affected expectations for easier consumption by the user.
Outputs the following.
1. A string suitable for passing to Chrome via the command line to
open all bugs in the browser.
2. A string suitable for copying into the CL description to associate the CL
with all the affected bugs.
3. A string containi... | [
"Outputs",
"URLs",
"of",
"affected",
"expectations",
"for",
"easier",
"consumption",
"by",
"the",
"user",
".",
"Outputs",
"the",
"following",
".",
"1",
".",
"A",
"string",
"suitable",
"for",
"passing",
"to",
"Chrome",
"via",
"the",
"command",
"line",
"to",
... | def OutputAffectedUrls(removed_urls, orphaned_urls=None):
removed_urls = list(removed_urls)
removed_urls.sort()
orphaned_urls = orphaned_urls or []
orphaned_urls = list(orphaned_urls)
orphaned_urls.sort()
_OutputAffectedUrls(removed_urls, orphaned_urls)
_OutputUrlsForClDescription(removed_urls, orphaned_u... | [
"def",
"OutputAffectedUrls",
"(",
"removed_urls",
",",
"orphaned_urls",
"=",
"None",
")",
":",
"removed_urls",
"=",
"list",
"(",
"removed_urls",
")",
"removed_urls",
".",
"sort",
"(",
")",
"orphaned_urls",
"=",
"orphaned_urls",
"or",
"[",
"]",
"orphaned_urls",
... | Outputs URLs of affected expectations for easier consumption by the user. | [
"Outputs",
"URLs",
"of",
"affected",
"expectations",
"for",
"easier",
"consumption",
"by",
"the",
"user",
"."
] | [
"\"\"\"Outputs URLs of affected expectations for easier consumption by the user.\n\n Outputs the following:\n\n 1. A string suitable for passing to Chrome via the command line to\n open all bugs in the browser.\n 2. A string suitable for copying into the CL description to associate the CL\n with all the ... | [
{
"param": "removed_urls",
"type": null
},
{
"param": "orphaned_urls",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "removed_urls",
"type": null,
"docstring": "A set or list of strings containing bug URLs.",
"docstring_tokens": [
"A",
"set",
"or",
"list",
"of",
"strings",
"containing",
... |
c7ed467d13548940478918d967b216211f643f09 | sunlongbo/chromium | testing/unexpected_passes_common/result_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _OutputAffectedUrls | null | def _OutputAffectedUrls(affected_urls, orphaned_urls, file_handle=None):
"""Outputs |urls| for opening in a browser as affected bugs.
Args:
affected_urls: A list of strings containing URLs to output.
orphaned_urls: A list of strings containing URLs to output as closable.
file_handle: A file handle to w... | Outputs |urls| for opening in a browser as affected bugs.
Args:
affected_urls: A list of strings containing URLs to output.
orphaned_urls: A list of strings containing URLs to output as closable.
file_handle: A file handle to write the string to. Defaults to stdout.
| Outputs |urls| for opening in a browser as affected bugs. | [
"Outputs",
"|urls|",
"for",
"opening",
"in",
"a",
"browser",
"as",
"affected",
"bugs",
"."
] | def _OutputAffectedUrls(affected_urls, orphaned_urls, file_handle=None):
_OutputUrlsForCommandLine(affected_urls, "Affected bugs", file_handle)
if orphaned_urls:
_OutputUrlsForCommandLine(orphaned_urls, "Closable bugs", file_handle) | [
"def",
"_OutputAffectedUrls",
"(",
"affected_urls",
",",
"orphaned_urls",
",",
"file_handle",
"=",
"None",
")",
":",
"_OutputUrlsForCommandLine",
"(",
"affected_urls",
",",
"\"Affected bugs\"",
",",
"file_handle",
")",
"if",
"orphaned_urls",
":",
"_OutputUrlsForCommandL... | Outputs |urls| for opening in a browser as affected bugs. | [
"Outputs",
"|urls|",
"for",
"opening",
"in",
"a",
"browser",
"as",
"affected",
"bugs",
"."
] | [
"\"\"\"Outputs |urls| for opening in a browser as affected bugs.\n\n Args:\n affected_urls: A list of strings containing URLs to output.\n orphaned_urls: A list of strings containing URLs to output as closable.\n file_handle: A file handle to write the string to. Defaults to stdout.\n \"\"\""
] | [
{
"param": "affected_urls",
"type": null
},
{
"param": "orphaned_urls",
"type": null
},
{
"param": "file_handle",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "affected_urls",
"type": null,
"docstring": "A list of strings containing URLs to output.",
"docstring_tokens": [
"A",
"list",
"of",
"strings",
"containing",
"URLs",
"to",... |
c7ed467d13548940478918d967b216211f643f09 | sunlongbo/chromium | testing/unexpected_passes_common/result_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _OutputUrlsForCommandLine | <not_specific> | def _OutputUrlsForCommandLine(urls, description, file_handle=None):
"""Outputs |urls| for opening in a browser.
The output string is meant to be passed to a browser via the command line in
order to open all URLs in that browser, e.g.
`google-chrome https://crbug.com/1234 https://crbug.com/2345`
Args:
u... | Outputs |urls| for opening in a browser.
The output string is meant to be passed to a browser via the command line in
order to open all URLs in that browser, e.g.
`google-chrome https://crbug.com/1234 https://crbug.com/2345`
Args:
urls: A list of strings containing URLs to output.
description: A desc... | Outputs |urls| for opening in a browser.
The output string is meant to be passed to a browser via the command line in
order to open all URLs in that browser, e.g.
| [
"Outputs",
"|urls|",
"for",
"opening",
"in",
"a",
"browser",
".",
"The",
"output",
"string",
"is",
"meant",
"to",
"be",
"passed",
"to",
"a",
"browser",
"via",
"the",
"command",
"line",
"in",
"order",
"to",
"open",
"all",
"URLs",
"in",
"that",
"browser",
... | def _OutputUrlsForCommandLine(urls, description, file_handle=None):
file_handle = file_handle or sys.stdout
def _StartsWithHttp(url):
return url.startswith('https://') or url.startswith('http://')
urls = [u if _StartsWithHttp(u) else 'https://%s' % u for u in urls]
file_handle.write('%s: %s\n' % (descriptio... | [
"def",
"_OutputUrlsForCommandLine",
"(",
"urls",
",",
"description",
",",
"file_handle",
"=",
"None",
")",
":",
"file_handle",
"=",
"file_handle",
"or",
"sys",
".",
"stdout",
"def",
"_StartsWithHttp",
"(",
"url",
")",
":",
"return",
"url",
".",
"startswith",
... | Outputs |urls| for opening in a browser. | [
"Outputs",
"|urls|",
"for",
"opening",
"in",
"a",
"browser",
"."
] | [
"\"\"\"Outputs |urls| for opening in a browser.\n\n The output string is meant to be passed to a browser via the command line in\n order to open all URLs in that browser, e.g.\n\n `google-chrome https://crbug.com/1234 https://crbug.com/2345`\n\n Args:\n urls: A list of strings containing URLs to output.\n ... | [
{
"param": "urls",
"type": null
},
{
"param": "description",
"type": null
},
{
"param": "file_handle",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "urls",
"type": null,
"docstring": "A list of strings containing URLs to output.",
"docstring_tokens": [
"A",
"list",
"of",
"strings",
"containing",
"URLs",
"to",
... |
c7ed467d13548940478918d967b216211f643f09 | sunlongbo/chromium | testing/unexpected_passes_common/result_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _OutputUrlsForClDescription | <not_specific> | def _OutputUrlsForClDescription(affected_urls, orphaned_urls, file_handle=None):
"""Outputs |urls| for use in a CL description.
Output adheres to the line length recommendation and max number of bugs per
line supported in Gerrit.
Args:
affected_urls: A list of strings containing URLs to output.
orphan... | Outputs |urls| for use in a CL description.
Output adheres to the line length recommendation and max number of bugs per
line supported in Gerrit.
Args:
affected_urls: A list of strings containing URLs to output.
orphaned_urls: A list of strings containing URLs to output as closable.
file_handle: A f... | Outputs |urls| for use in a CL description.
Output adheres to the line length recommendation and max number of bugs per
line supported in Gerrit. | [
"Outputs",
"|urls|",
"for",
"use",
"in",
"a",
"CL",
"description",
".",
"Output",
"adheres",
"to",
"the",
"line",
"length",
"recommendation",
"and",
"max",
"number",
"of",
"bugs",
"per",
"line",
"supported",
"in",
"Gerrit",
"."
] | def _OutputUrlsForClDescription(affected_urls, orphaned_urls, file_handle=None):
def AddBugTypeToOutputString(urls, prefix):
output_str = ''
current_line = ''
bugs_on_line = 0
urls = collections.deque(urls)
while len(urls):
current_bug = urls.popleft()
current_bug = current_bug.split('... | [
"def",
"_OutputUrlsForClDescription",
"(",
"affected_urls",
",",
"orphaned_urls",
",",
"file_handle",
"=",
"None",
")",
":",
"def",
"AddBugTypeToOutputString",
"(",
"urls",
",",
"prefix",
")",
":",
"output_str",
"=",
"''",
"current_line",
"=",
"''",
"bugs_on_line"... | Outputs |urls| for use in a CL description. | [
"Outputs",
"|urls|",
"for",
"use",
"in",
"a",
"CL",
"description",
"."
] | [
"\"\"\"Outputs |urls| for use in a CL description.\n\n Output adheres to the line length recommendation and max number of bugs per\n line supported in Gerrit.\n\n Args:\n affected_urls: A list of strings containing URLs to output.\n orphaned_urls: A list of strings containing URLs to output as closable.\n ... | [
{
"param": "affected_urls",
"type": null
},
{
"param": "orphaned_urls",
"type": null
},
{
"param": "file_handle",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "affected_urls",
"type": null,
"docstring": "A list of strings containing URLs to output.",
"docstring_tokens": [
"A",
"list",
"of",
"strings",
"containing",
"URLs",
"to",... |
c7ed467d13548940478918d967b216211f643f09 | sunlongbo/chromium | testing/unexpected_passes_common/result_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ConvertBuilderMapToPassOrderedStringDict | <not_specific> | def ConvertBuilderMapToPassOrderedStringDict(builder_map):
"""Converts |builder_map| into an ordered dict split by pass type.
Args:
builder_map: A data_types.BuildStepMap.
Returns:
A collections.OrderedDict in the following format:
{
result_output.FULL_PASS: {
builder_name: [
... | Converts |builder_map| into an ordered dict split by pass type.
Args:
builder_map: A data_types.BuildStepMap.
Returns:
A collections.OrderedDict in the following format:
{
result_output.FULL_PASS: {
builder_name: [
step_name (total passes / total builds)
],
},
... | Converts |builder_map| into an ordered dict split by pass type. | [
"Converts",
"|builder_map|",
"into",
"an",
"ordered",
"dict",
"split",
"by",
"pass",
"type",
"."
] | def ConvertBuilderMapToPassOrderedStringDict(builder_map):
str_dict = collections.OrderedDict()
str_dict[FULL_PASS] = {}
str_dict[NEVER_PASS] = {}
str_dict[PARTIAL_PASS] = {}
for builder_name, step_name, stats in builder_map.IterBuildStats():
step_str = AddStatsToStr(step_name, stats)
if stats.did_ful... | [
"def",
"ConvertBuilderMapToPassOrderedStringDict",
"(",
"builder_map",
")",
":",
"str_dict",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"str_dict",
"[",
"FULL_PASS",
"]",
"=",
"{",
"}",
"str_dict",
"[",
"NEVER_PASS",
"]",
"=",
"{",
"}",
"str_dict",
"[",... | Converts |builder_map| into an ordered dict split by pass type. | [
"Converts",
"|builder_map|",
"into",
"an",
"ordered",
"dict",
"split",
"by",
"pass",
"type",
"."
] | [
"\"\"\"Converts |builder_map| into an ordered dict split by pass type.\n\n Args:\n builder_map: A data_types.BuildStepMap.\n\n Returns:\n A collections.OrderedDict in the following format:\n {\n result_output.FULL_PASS: {\n builder_name: [\n step_name (total passes / total builds)\n ... | [
{
"param": "builder_map",
"type": null
}
] | {
"returns": [
{
"docstring": "A collections.OrderedDict in the following format:\n{\nresult_output.FULL_PASS: {\nbuilder_name: [\nstep_name (total passes / total builds)\n],\n},\nresult_output.NEVER_PASS: {\nbuilder_name: [\nstep_name (total passes / total builds)\n],\n},\nresult_output.PARTIAL_PASS: {\nbu... |
c7f0d5e6aa3e30e07723af7802ef81ba0d5d29fb | sunlongbo/chromium | tools/perf/cli_tools/soundwave/tables/timeseries_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SamplePoint | <not_specific> | def SamplePoint(point_id, value, timestamp=None, missing_commit_pos=False):
"""Build a sample point as returned by timeseries2 API."""
revisions = {
'r_commit_pos': str(point_id),
'r_chromium': 'chromium@%d' % point_id,
}
annotations = {
'a_tracing_uri': 'http://example.com/trace/%d' % point_i... | Build a sample point as returned by timeseries2 API. | Build a sample point as returned by timeseries2 API. | [
"Build",
"a",
"sample",
"point",
"as",
"returned",
"by",
"timeseries2",
"API",
"."
] | def SamplePoint(point_id, value, timestamp=None, missing_commit_pos=False):
revisions = {
'r_commit_pos': str(point_id),
'r_chromium': 'chromium@%d' % point_id,
}
annotations = {
'a_tracing_uri': 'http://example.com/trace/%d' % point_id
}
if timestamp is None:
timestamp = datetime.dateti... | [
"def",
"SamplePoint",
"(",
"point_id",
",",
"value",
",",
"timestamp",
"=",
"None",
",",
"missing_commit_pos",
"=",
"False",
")",
":",
"revisions",
"=",
"{",
"'r_commit_pos'",
":",
"str",
"(",
"point_id",
")",
",",
"'r_chromium'",
":",
"'chromium@%d'",
"%",
... | Build a sample point as returned by timeseries2 API. | [
"Build",
"a",
"sample",
"point",
"as",
"returned",
"by",
"timeseries2",
"API",
"."
] | [
"\"\"\"Build a sample point as returned by timeseries2 API.\"\"\"",
"# Some data points have a missing commit position."
] | [
{
"param": "point_id",
"type": null
},
{
"param": "value",
"type": null
},
{
"param": "timestamp",
"type": null
},
{
"param": "missing_commit_pos",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "point_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": null,
"docstring": null,
"docstring_token... |
6e0b11d73e40068874557aa1a16f8d661dd383cb | sunlongbo/chromium | tools/android/instant_start/benchmark.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | main | null | def main():
"""Entry point of the benchmark script"""
parser = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--control-apk',
default='out/Release/bin/monochrome_apk',
... | Entry point of the benchmark script | Entry point of the benchmark script | [
"Entry",
"point",
"of",
"the",
"benchmark",
"script"
] | def main():
parser = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--control-apk',
default='out/Release/bin/monochrome_apk',
help='The APK script file for control behavior... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"__doc__",
",",
"formatter_class",
"=",
"argparse",
".",
"ArgumentDefaultsHelpFormatter",
")",
"parser",
".",
"add_argument",
"(",
"'--control-apk'",
",",
"d... | Entry point of the benchmark script | [
"Entry",
"point",
"of",
"the",
"benchmark",
"script"
] | [
"\"\"\"Entry point of the benchmark script\"\"\"",
"# List control/experiment APKs for side-by-side comparison.",
"# try to avoid overloading the device."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
f3a2fcd772d0b4d2b0a3c2c9a3242df77b3f63d2 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | reset | null | def reset(self):
"""
Resets the rendering states of this object. Must be called before
the first call to |render| or |render_text|.
"""
self._text_buffer = mako.util.FastEncodingBuffer()
self._is_invalidated = False |
Resets the rendering states of this object. Must be called before
the first call to |render| or |render_text|.
| Resets the rendering states of this object. Must be called before
the first call to |render| or |render_text|. | [
"Resets",
"the",
"rendering",
"states",
"of",
"this",
"object",
".",
"Must",
"be",
"called",
"before",
"the",
"first",
"call",
"to",
"|render|",
"or",
"|render_text|",
"."
] | def reset(self):
self._text_buffer = mako.util.FastEncodingBuffer()
self._is_invalidated = False | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"_text_buffer",
"=",
"mako",
".",
"util",
".",
"FastEncodingBuffer",
"(",
")",
"self",
".",
"_is_invalidated",
"=",
"False"
] | Resets the rendering states of this object. | [
"Resets",
"the",
"rendering",
"states",
"of",
"this",
"object",
"."
] | [
"\"\"\"\n Resets the rendering states of this object. Must be called before\n the first call to |render| or |render_text|.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f3a2fcd772d0b4d2b0a3c2c9a3242df77b3f63d2 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | render | null | def render(self, caller, template, template_vars):
"""
Renders the template with variable bindings.
It's okay to invoke |render| method recursively and |caller| is pushed
onto the call stack, which is accessible via
|callers_from_first_to_last| method, etc.
Args:
... |
Renders the template with variable bindings.
It's okay to invoke |render| method recursively and |caller| is pushed
onto the call stack, which is accessible via
|callers_from_first_to_last| method, etc.
Args:
caller: An object to be pushed onto the call stack.
... | Renders the template with variable bindings. | [
"Renders",
"the",
"template",
"with",
"variable",
"bindings",
"."
] | def render(self, caller, template, template_vars):
assert caller is not None
assert isinstance(template, MakoTemplate)
assert isinstance(template_vars, dict)
self._caller_stack.append(caller)
try:
mako_template = template.mako_template(
pass_key=_MAKO_... | [
"def",
"render",
"(",
"self",
",",
"caller",
",",
"template",
",",
"template_vars",
")",
":",
"assert",
"caller",
"is",
"not",
"None",
"assert",
"isinstance",
"(",
"template",
",",
"MakoTemplate",
")",
"assert",
"isinstance",
"(",
"template_vars",
",",
"dict... | Renders the template with variable bindings. | [
"Renders",
"the",
"template",
"with",
"variable",
"bindings",
"."
] | [
"\"\"\"\n Renders the template with variable bindings.\n\n It's okay to invoke |render| method recursively and |caller| is pushed\n onto the call stack, which is accessible via\n |callers_from_first_to_last| method, etc.\n\n Args:\n caller: An object to be pushed onto t... | [
{
"param": "self",
"type": null
},
{
"param": "caller",
"type": null
},
{
"param": "template",
"type": null
},
{
"param": "template_vars",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "caller",
"type": null,
"docstring": "An object to be pushed onto th... |
f3a2fcd772d0b4d2b0a3c2c9a3242df77b3f63d2 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | callers_from_first_to_last | <not_specific> | def callers_from_first_to_last(self):
"""
Returns the callers of this renderer in the order from the first caller
to the last caller.
"""
return iter(self._caller_stack) |
Returns the callers of this renderer in the order from the first caller
to the last caller.
| Returns the callers of this renderer in the order from the first caller
to the last caller. | [
"Returns",
"the",
"callers",
"of",
"this",
"renderer",
"in",
"the",
"order",
"from",
"the",
"first",
"caller",
"to",
"the",
"last",
"caller",
"."
] | def callers_from_first_to_last(self):
return iter(self._caller_stack) | [
"def",
"callers_from_first_to_last",
"(",
"self",
")",
":",
"return",
"iter",
"(",
"self",
".",
"_caller_stack",
")"
] | Returns the callers of this renderer in the order from the first caller
to the last caller. | [
"Returns",
"the",
"callers",
"of",
"this",
"renderer",
"in",
"the",
"order",
"from",
"the",
"first",
"caller",
"to",
"the",
"last",
"caller",
"."
] | [
"\"\"\"\n Returns the callers of this renderer in the order from the first caller\n to the last caller.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f3a2fcd772d0b4d2b0a3c2c9a3242df77b3f63d2 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | callers_from_last_to_first | <not_specific> | def callers_from_last_to_first(self):
"""
Returns the callers of this renderer in the order from the last caller
to the first caller.
"""
return reversed(self._caller_stack) |
Returns the callers of this renderer in the order from the last caller
to the first caller.
| Returns the callers of this renderer in the order from the last caller
to the first caller. | [
"Returns",
"the",
"callers",
"of",
"this",
"renderer",
"in",
"the",
"order",
"from",
"the",
"last",
"caller",
"to",
"the",
"first",
"caller",
"."
] | def callers_from_last_to_first(self):
return reversed(self._caller_stack) | [
"def",
"callers_from_last_to_first",
"(",
"self",
")",
":",
"return",
"reversed",
"(",
"self",
".",
"_caller_stack",
")"
] | Returns the callers of this renderer in the order from the last caller
to the first caller. | [
"Returns",
"the",
"callers",
"of",
"this",
"renderer",
"in",
"the",
"order",
"from",
"the",
"last",
"caller",
"to",
"the",
"first",
"caller",
"."
] | [
"\"\"\"\n Returns the callers of this renderer in the order from the last caller\n to the first caller.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f3a2fcd772d0b4d2b0a3c2c9a3242df77b3f63d2 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | callers_on_error | <not_specific> | def callers_on_error(self):
"""
Returns the callers of this renderer in the order from the last caller
to the first caller at the moment when an exception was thrown.
"""
return reversed(self._caller_stack_on_error) |
Returns the callers of this renderer in the order from the last caller
to the first caller at the moment when an exception was thrown.
| Returns the callers of this renderer in the order from the last caller
to the first caller at the moment when an exception was thrown. | [
"Returns",
"the",
"callers",
"of",
"this",
"renderer",
"in",
"the",
"order",
"from",
"the",
"last",
"caller",
"to",
"the",
"first",
"caller",
"at",
"the",
"moment",
"when",
"an",
"exception",
"was",
"thrown",
"."
] | def callers_on_error(self):
return reversed(self._caller_stack_on_error) | [
"def",
"callers_on_error",
"(",
"self",
")",
":",
"return",
"reversed",
"(",
"self",
".",
"_caller_stack_on_error",
")"
] | Returns the callers of this renderer in the order from the last caller
to the first caller at the moment when an exception was thrown. | [
"Returns",
"the",
"callers",
"of",
"this",
"renderer",
"in",
"the",
"order",
"from",
"the",
"last",
"caller",
"to",
"the",
"first",
"caller",
"at",
"the",
"moment",
"when",
"an",
"exception",
"was",
"thrown",
"."
] | [
"\"\"\"\n Returns the callers of this renderer in the order from the last caller\n to the first caller at the moment when an exception was thrown.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f3a2fcd772d0b4d2b0a3c2c9a3242df77b3f63d2 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | last_caller_on_error | <not_specific> | def last_caller_on_error(self):
"""
Returns the deepest caller at the moment when an exception was thrown.
"""
return self._caller_stack_on_error[-1] |
Returns the deepest caller at the moment when an exception was thrown.
| Returns the deepest caller at the moment when an exception was thrown. | [
"Returns",
"the",
"deepest",
"caller",
"at",
"the",
"moment",
"when",
"an",
"exception",
"was",
"thrown",
"."
] | def last_caller_on_error(self):
return self._caller_stack_on_error[-1] | [
"def",
"last_caller_on_error",
"(",
"self",
")",
":",
"return",
"self",
".",
"_caller_stack_on_error",
"[",
"-",
"1",
"]"
] | Returns the deepest caller at the moment when an exception was thrown. | [
"Returns",
"the",
"deepest",
"caller",
"at",
"the",
"moment",
"when",
"an",
"exception",
"was",
"thrown",
"."
] | [
"\"\"\"\n Returns the deepest caller at the moment when an exception was thrown.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
74f9a14b6b9b1254b9ff4ec539e23ebc3d5a1fac | sunlongbo/chromium | content/test/gpu/gpu_tests/context_lost_integration_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GenerateBrowserArgs | <not_specific> | def GenerateBrowserArgs(cls, additional_args):
"""Adds default arguments to |additional_args|.
See the parent class' method documentation for additional information.
"""
default_args = super(ContextLostIntegrationTest,
cls).GenerateBrowserArgs(additional_args)
default_args.... | Adds default arguments to |additional_args|.
See the parent class' method documentation for additional information.
| Adds default arguments to |additional_args|.
See the parent class' method documentation for additional information. | [
"Adds",
"default",
"arguments",
"to",
"|additional_args|",
".",
"See",
"the",
"parent",
"class",
"'",
"method",
"documentation",
"for",
"additional",
"information",
"."
] | def GenerateBrowserArgs(cls, additional_args):
default_args = super(ContextLostIntegrationTest,
cls).GenerateBrowserArgs(additional_args)
default_args.extend([
cba.ENABLE_GPU_BENCHMARKING,
cba.DISABLE_DEVICE_DISCOVERY_NOTIFICATIONS,
])
return default_args | [
"def",
"GenerateBrowserArgs",
"(",
"cls",
",",
"additional_args",
")",
":",
"default_args",
"=",
"super",
"(",
"ContextLostIntegrationTest",
",",
"cls",
")",
".",
"GenerateBrowserArgs",
"(",
"additional_args",
")",
"default_args",
".",
"extend",
"(",
"[",
"cba",
... | Adds default arguments to |additional_args|. | [
"Adds",
"default",
"arguments",
"to",
"|additional_args|",
"."
] | [
"\"\"\"Adds default arguments to |additional_args|.\n\n See the parent class' method documentation for additional information.\n \"\"\"",
"# Required to call crashGpuProcess.",
"# Disable:",
"# Do you want the application \"Chromium Helper.app\" to accept incoming",
"# network connections?",
"# ... | [
{
"param": "cls",
"type": null
},
{
"param": "additional_args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "additional_args",
"type": null,
"docstring": null,
"docstring_... |
c41838442163ad4f252463302c279bed97e7e636 | sunlongbo/chromium | tools/perf/core/services/pinpoint_service.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Job | <not_specific> | def Job(job_id, with_state=False, with_tags=False):
"""Get job information from its id."""
params = []
if with_state:
params.append(('o', 'STATE'))
if with_tags:
params.append(('o', 'TAGS'))
return Request('/job/%s' % job_id, params=params) | Get job information from its id. | Get job information from its id. | [
"Get",
"job",
"information",
"from",
"its",
"id",
"."
] | def Job(job_id, with_state=False, with_tags=False):
params = []
if with_state:
params.append(('o', 'STATE'))
if with_tags:
params.append(('o', 'TAGS'))
return Request('/job/%s' % job_id, params=params) | [
"def",
"Job",
"(",
"job_id",
",",
"with_state",
"=",
"False",
",",
"with_tags",
"=",
"False",
")",
":",
"params",
"=",
"[",
"]",
"if",
"with_state",
":",
"params",
".",
"append",
"(",
"(",
"'o'",
",",
"'STATE'",
")",
")",
"if",
"with_tags",
":",
"p... | Get job information from its id. | [
"Get",
"job",
"information",
"from",
"its",
"id",
"."
] | [
"\"\"\"Get job information from its id.\"\"\""
] | [
{
"param": "job_id",
"type": null
},
{
"param": "with_state",
"type": null
},
{
"param": "with_tags",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "job_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "with_state",
"type": null,
"docstring": null,
"docstring_to... |
c41838442163ad4f252463302c279bed97e7e636 | sunlongbo/chromium | tools/perf/core/services/pinpoint_service.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | NewJob | <not_specific> | def NewJob(**kwargs):
"""Create a new pinpoint job."""
if 'user' not in kwargs:
kwargs['user'] = luci_auth.GetUserEmail()
return Request('/new', method='POST', data=kwargs) | Create a new pinpoint job. | Create a new pinpoint job. | [
"Create",
"a",
"new",
"pinpoint",
"job",
"."
] | def NewJob(**kwargs):
if 'user' not in kwargs:
kwargs['user'] = luci_auth.GetUserEmail()
return Request('/new', method='POST', data=kwargs) | [
"def",
"NewJob",
"(",
"**",
"kwargs",
")",
":",
"if",
"'user'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'user'",
"]",
"=",
"luci_auth",
".",
"GetUserEmail",
"(",
")",
"return",
"Request",
"(",
"'/new'",
",",
"method",
"=",
"'POST'",
",",
"data",
... | Create a new pinpoint job. | [
"Create",
"a",
"new",
"pinpoint",
"job",
"."
] | [
"\"\"\"Create a new pinpoint job.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
fa4c5fff418ac717a776ce2b4cde7cd02b03ae01 | sunlongbo/chromium | third_party/chevron/chevron/renderer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _get_key | <not_specific> | def _get_key(key, scopes):
"""Get a key from the current scope"""
# If the key is a dot
if key == '.':
# Then just return the current scope
return scopes[0]
# Loop through the scopes
for scope in scopes:
try:
# For every dot seperated key
for child i... | Get a key from the current scope | Get a key from the current scope | [
"Get",
"a",
"key",
"from",
"the",
"current",
"scope"
] | def _get_key(key, scopes):
if key == '.':
return scopes[0]
for scope in scopes:
try:
for child in key.split('.'):
try:
scope = scope[child]
except (TypeError, AttributeError):
scope = scope.__dict__[child]
... | [
"def",
"_get_key",
"(",
"key",
",",
"scopes",
")",
":",
"if",
"key",
"==",
"'.'",
":",
"return",
"scopes",
"[",
"0",
"]",
"for",
"scope",
"in",
"scopes",
":",
"try",
":",
"for",
"child",
"in",
"key",
".",
"split",
"(",
"'.'",
")",
":",
"try",
"... | Get a key from the current scope | [
"Get",
"a",
"key",
"from",
"the",
"current",
"scope"
] | [
"\"\"\"Get a key from the current scope\"\"\"",
"# If the key is a dot",
"# Then just return the current scope",
"# Loop through the scopes",
"# For every dot seperated key",
"# Move into the scope",
"# Try subscripting (Normal dictionaries)",
"# Try the dictionary (Complex types)",
"# Return an emp... | [
{
"param": "key",
"type": null
},
{
"param": "scopes",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "key",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scopes",
"type": null,
"docstring": null,
"docstring_tokens": ... |
b15719746aa82b8263ff97446744959616a56bd7 | sunlongbo/chromium | tools/python/google/httpd_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | UrlIsAlive | <not_specific> | def UrlIsAlive(url):
"""Checks to see if we get an http response from |url|.
We poll the url 5 times with a 1 second delay. If we don't
get a reply in that time, we give up and assume the httpd
didn't start properly.
Args:
url: The URL to check.
Return:
True if the url is alive.
"""
wait_time ... | Checks to see if we get an http response from |url|.
We poll the url 5 times with a 1 second delay. If we don't
get a reply in that time, we give up and assume the httpd
didn't start properly.
Args:
url: The URL to check.
Return:
True if the url is alive.
| Checks to see if we get an http response from |url|.
We poll the url 5 times with a 1 second delay. If we don't
get a reply in that time, we give up and assume the httpd
didn't start properly. | [
"Checks",
"to",
"see",
"if",
"we",
"get",
"an",
"http",
"response",
"from",
"|url|",
".",
"We",
"poll",
"the",
"url",
"5",
"times",
"with",
"a",
"1",
"second",
"delay",
".",
"If",
"we",
"don",
"'",
"t",
"get",
"a",
"reply",
"in",
"that",
"time",
... | def UrlIsAlive(url):
wait_time = 5
while wait_time > 0:
try:
response = urllib.urlopen(url)
return True
except IOError:
pass
wait_time -= 1
time.sleep(1)
return False | [
"def",
"UrlIsAlive",
"(",
"url",
")",
":",
"wait_time",
"=",
"5",
"while",
"wait_time",
">",
"0",
":",
"try",
":",
"response",
"=",
"urllib",
".",
"urlopen",
"(",
"url",
")",
"return",
"True",
"except",
"IOError",
":",
"pass",
"wait_time",
"-=",
"1",
... | Checks to see if we get an http response from |url|. | [
"Checks",
"to",
"see",
"if",
"we",
"get",
"an",
"http",
"response",
"from",
"|url|",
"."
] | [
"\"\"\"Checks to see if we get an http response from |url|.\n We poll the url 5 times with a 1 second delay. If we don't\n get a reply in that time, we give up and assume the httpd\n didn't start properly.\n\n Args:\n url: The URL to check.\n Return:\n True if the url is alive.\n \"\"\"",
"# Server i... | [
{
"param": "url",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "url",
"type": null,
"docstring": "The URL to check.",
"docstring_tokens": [
"The",
"URL",
"to",
"check",
"."
],
"default": null,
"is_optional": null
}
],
"outli... |
b15719746aa82b8263ff97446744959616a56bd7 | sunlongbo/chromium | tools/python/google/httpd_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetCygserverPath | <not_specific> | def GetCygserverPath(start_dir, apache2=False):
"""Returns the path to the directory holding cygserver.exe file."""
cygserver_path = None
if apache2:
cygserver_path = google.path_utils.FindUpward(start_dir, 'third_party',
'cygwin', 'usr', 'sbin')
return cygs... | Returns the path to the directory holding cygserver.exe file. | Returns the path to the directory holding cygserver.exe file. | [
"Returns",
"the",
"path",
"to",
"the",
"directory",
"holding",
"cygserver",
".",
"exe",
"file",
"."
] | def GetCygserverPath(start_dir, apache2=False):
cygserver_path = None
if apache2:
cygserver_path = google.path_utils.FindUpward(start_dir, 'third_party',
'cygwin', 'usr', 'sbin')
return cygserver_path | [
"def",
"GetCygserverPath",
"(",
"start_dir",
",",
"apache2",
"=",
"False",
")",
":",
"cygserver_path",
"=",
"None",
"if",
"apache2",
":",
"cygserver_path",
"=",
"google",
".",
"path_utils",
".",
"FindUpward",
"(",
"start_dir",
",",
"'third_party'",
",",
"'cygw... | Returns the path to the directory holding cygserver.exe file. | [
"Returns",
"the",
"path",
"to",
"the",
"directory",
"holding",
"cygserver",
".",
"exe",
"file",
"."
] | [
"\"\"\"Returns the path to the directory holding cygserver.exe file.\"\"\""
] | [
{
"param": "start_dir",
"type": null
},
{
"param": "apache2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "start_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "apache2",
"type": null,
"docstring": null,
"docstring_to... |
b15719746aa82b8263ff97446744959616a56bd7 | sunlongbo/chromium | tools/python/google/httpd_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | StartServer | <not_specific> | def StartServer(document_root=None, output_dir=None, apache2=False):
"""Starts a local server on port 8000 using the basic configuration files.
Args:
document_root: If present, specifies the document root for the server;
otherwise, the filesystem's root (e.g., C:/ or /) will be used.
output_dir: If... | Starts a local server on port 8000 using the basic configuration files.
Args:
document_root: If present, specifies the document root for the server;
otherwise, the filesystem's root (e.g., C:/ or /) will be used.
output_dir: If present, specifies where to put server logs; otherwise,
they'll b... | Starts a local server on port 8000 using the basic configuration files. | [
"Starts",
"a",
"local",
"server",
"on",
"port",
"8000",
"using",
"the",
"basic",
"configuration",
"files",
"."
] | def StartServer(document_root=None, output_dir=None, apache2=False):
script_dir = google.path_utils.ScriptDir()
platform_util = google.platform_utils.PlatformUtility(script_dir)
if not output_dir:
output_dir = platform_util.GetTempDirectory()
if not document_root:
document_root = platform_util.GetFilesy... | [
"def",
"StartServer",
"(",
"document_root",
"=",
"None",
",",
"output_dir",
"=",
"None",
",",
"apache2",
"=",
"False",
")",
":",
"script_dir",
"=",
"google",
".",
"path_utils",
".",
"ScriptDir",
"(",
")",
"platform_util",
"=",
"google",
".",
"platform_utils"... | Starts a local server on port 8000 using the basic configuration files. | [
"Starts",
"a",
"local",
"server",
"on",
"port",
"8000",
"using",
"the",
"basic",
"configuration",
"files",
"."
] | [
"\"\"\"Starts a local server on port 8000 using the basic configuration files.\n\n Args:\n document_root: If present, specifies the document root for the server;\n otherwise, the filesystem's root (e.g., C:/ or /) will be used.\n output_dir: If present, specifies where to put server logs; otherwise,\n... | [
{
"param": "document_root",
"type": null
},
{
"param": "output_dir",
"type": null
},
{
"param": "apache2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "document_root",
"type": null,
"docstring": "If present, specifies the document root for the server;\notherwise, the filesystem's root will be used.",
"docstring_tokens": [
"If",
"present",
"specifies",... |
b15719746aa82b8263ff97446744959616a56bd7 | sunlongbo/chromium | tools/python/google/httpd_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | StopServers | null | def StopServers(apache2=False):
"""Calls the platform's stop command on a newly created server, forcing it
to stop.
The details depend on the behavior of the platform stop command. For example,
it's often implemented to kill all running httpd processes, as implied by
the name of this function.
Args:
a... | Calls the platform's stop command on a newly created server, forcing it
to stop.
The details depend on the behavior of the platform stop command. For example,
it's often implemented to kill all running httpd processes, as implied by
the name of this function.
Args:
apache2: boolean if true will cause th... | Calls the platform's stop command on a newly created server, forcing it
to stop.
The details depend on the behavior of the platform stop command. For example,
it's often implemented to kill all running httpd processes, as implied by
the name of this function. | [
"Calls",
"the",
"platform",
"'",
"s",
"stop",
"command",
"on",
"a",
"newly",
"created",
"server",
"forcing",
"it",
"to",
"stop",
".",
"The",
"details",
"depend",
"on",
"the",
"behavior",
"of",
"the",
"platform",
"stop",
"command",
".",
"For",
"example",
... | def StopServers(apache2=False):
script_dir = google.path_utils.ScriptDir()
platform_util = google.platform_utils.PlatformUtility(script_dir)
httpd = ApacheHttpd('', platform_util.GetStopHttpdCommand(), [],
cygserver_path=GetCygserverPath(script_dir, apache2))
httpd.StopServer(force=True) | [
"def",
"StopServers",
"(",
"apache2",
"=",
"False",
")",
":",
"script_dir",
"=",
"google",
".",
"path_utils",
".",
"ScriptDir",
"(",
")",
"platform_util",
"=",
"google",
".",
"platform_utils",
".",
"PlatformUtility",
"(",
"script_dir",
")",
"httpd",
"=",
"Ap... | Calls the platform's stop command on a newly created server, forcing it
to stop. | [
"Calls",
"the",
"platform",
"'",
"s",
"stop",
"command",
"on",
"a",
"newly",
"created",
"server",
"forcing",
"it",
"to",
"stop",
"."
] | [
"\"\"\"Calls the platform's stop command on a newly created server, forcing it\n to stop.\n\n The details depend on the behavior of the platform stop command. For example,\n it's often implemented to kill all running httpd processes, as implied by\n the name of this function.\n\n Args:\n apache2: boolean if... | [
{
"param": "apache2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "apache2",
"type": null,
"docstring": "boolean if true will cause this function to configure\nfor Apache 2.x as opposed to Apache 1.3.x",
"docstring_tokens": [
"boolean",
"if",
"true",
"will",
... |
b15719746aa82b8263ff97446744959616a56bd7 | sunlongbo/chromium | tools/python/google/httpd_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | StopServer | null | def StopServer(self, force=False):
"""If we started an httpd.exe process, or if force is True, call
self._stop_command (passed in on init so it can be platform-dependent).
This will presumably kill it, and may also kill any other httpd.exe
processes that are running.
"""
if force or self._http_s... | If we started an httpd.exe process, or if force is True, call
self._stop_command (passed in on init so it can be platform-dependent).
This will presumably kill it, and may also kill any other httpd.exe
processes that are running.
| If we started an httpd.exe process, or if force is True, call
self._stop_command (passed in on init so it can be platform-dependent).
This will presumably kill it, and may also kill any other httpd.exe
processes that are running. | [
"If",
"we",
"started",
"an",
"httpd",
".",
"exe",
"process",
"or",
"if",
"force",
"is",
"True",
"call",
"self",
".",
"_stop_command",
"(",
"passed",
"in",
"on",
"init",
"so",
"it",
"can",
"be",
"platform",
"-",
"dependent",
")",
".",
"This",
"will",
... | def StopServer(self, force=False):
if force or self._http_server_proc:
logging.info('Stopping http server')
kill_proc = subprocess.Popen(self._stop_command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
logging.info('%s\n%s' %... | [
"def",
"StopServer",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"if",
"force",
"or",
"self",
".",
"_http_server_proc",
":",
"logging",
".",
"info",
"(",
"'Stopping http server'",
")",
"kill_proc",
"=",
"subprocess",
".",
"Popen",
"(",
"self",
".",
... | If we started an httpd.exe process, or if force is True, call
self._stop_command (passed in on init so it can be platform-dependent). | [
"If",
"we",
"started",
"an",
"httpd",
".",
"exe",
"process",
"or",
"if",
"force",
"is",
"True",
"call",
"self",
".",
"_stop_command",
"(",
"passed",
"in",
"on",
"init",
"so",
"it",
"can",
"be",
"platform",
"-",
"dependent",
")",
"."
] | [
"\"\"\"If we started an httpd.exe process, or if force is True, call\n self._stop_command (passed in on init so it can be platform-dependent).\n This will presumably kill it, and may also kill any other httpd.exe\n processes that are running.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "force",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "force",
"type": null,
"docstring": null,
"docstring_tokens": ... |
06a5d1ae4c046657787ae6bad5afa5d23fc2f4bb | sunlongbo/chromium | tools/traffic_annotation/scripts/annotation_tokenizer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _get_token | <not_specific> | def _get_token(self):
"""Return the token here, or None on failure."""
# Skip initial whitespace.
pos = self._skip_whitespace()
# Find the token here, if there's one.
token = None
for (token_type, regex) in TOKEN_REGEXEN:
re_match = regex.match(self.body, pos)
if re_match:
... | Return the token here, or None on failure. | Return the token here, or None on failure. | [
"Return",
"the",
"token",
"here",
"or",
"None",
"on",
"failure",
"."
] | def _get_token(self):
pos = self._skip_whitespace()
token = None
for (token_type, regex) in TOKEN_REGEXEN:
re_match = regex.match(self.body, pos)
if re_match:
token_content = next(g for g in re_match.groups() if g is not None)
token = Token(token_type, token_content, re_match.end... | [
"def",
"_get_token",
"(",
"self",
")",
":",
"pos",
"=",
"self",
".",
"_skip_whitespace",
"(",
")",
"token",
"=",
"None",
"for",
"(",
"token_type",
",",
"regex",
")",
"in",
"TOKEN_REGEXEN",
":",
"re_match",
"=",
"regex",
".",
"match",
"(",
"self",
".",
... | Return the token here, or None on failure. | [
"Return",
"the",
"token",
"here",
"or",
"None",
"on",
"failure",
"."
] | [
"\"\"\"Return the token here, or None on failure.\"\"\"",
"# Skip initial whitespace.",
"# Find the token here, if there's one."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
06a5d1ae4c046657787ae6bad5afa5d23fc2f4bb | sunlongbo/chromium | tools/traffic_annotation/scripts/annotation_tokenizer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | maybe_advance | Optional[str] | def maybe_advance(self, expected_type: str) -> Optional[str]:
"""Advance the tokenizer by one token if it has |expected_type|.
Args:
expected_type: expected |type| attribute of the token.
Returns:
The |value| attribute of the token if it has the right type, or None if it
has another type... | Advance the tokenizer by one token if it has |expected_type|.
Args:
expected_type: expected |type| attribute of the token.
Returns:
The |value| attribute of the token if it has the right type, or None if it
has another type.
| Advance the tokenizer by one token if it has |expected_type|. | [
"Advance",
"the",
"tokenizer",
"by",
"one",
"token",
"if",
"it",
"has",
"|expected_type|",
"."
] | def maybe_advance(self, expected_type: str) -> Optional[str]:
token = self._get_token()
if token and token.type == expected_type:
self.pos = token.pos
return token.value
return None | [
"def",
"maybe_advance",
"(",
"self",
",",
"expected_type",
":",
"str",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"token",
"=",
"self",
".",
"_get_token",
"(",
")",
"if",
"token",
"and",
"token",
".",
"type",
"==",
"expected_type",
":",
"self",
".",
... | Advance the tokenizer by one token if it has |expected_type|. | [
"Advance",
"the",
"tokenizer",
"by",
"one",
"token",
"if",
"it",
"has",
"|expected_type|",
"."
] | [
"\"\"\"Advance the tokenizer by one token if it has |expected_type|.\n\n Args:\n expected_type: expected |type| attribute of the token.\n\n Returns:\n The |value| attribute of the token if it has the right type, or None if it\n has another type.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "expected_type",
"type": "str"
}
] | {
"returns": [
{
"docstring": "The |value| attribute of the token if it has the right type, or None if it\nhas another type.",
"docstring_tokens": [
"The",
"|value|",
"attribute",
"of",
"the",
"token",
"if",
"it",
"has",
"... |
06a5d1ae4c046657787ae6bad5afa5d23fc2f4bb | sunlongbo/chromium | tools/traffic_annotation/scripts/annotation_tokenizer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | advance | str | def advance(self, expected_type: str) -> str:
"""Advance the tokenizer by one token, asserting its type.
Throws an error if the token at point has the wrong type.
Args:
expected_type: expected |type| attribute of the token.
Returns:
The |value| attribute of the token at point.
"""
... | Advance the tokenizer by one token, asserting its type.
Throws an error if the token at point has the wrong type.
Args:
expected_type: expected |type| attribute of the token.
Returns:
The |value| attribute of the token at point.
| Advance the tokenizer by one token, asserting its type.
Throws an error if the token at point has the wrong type. | [
"Advance",
"the",
"tokenizer",
"by",
"one",
"token",
"asserting",
"its",
"type",
".",
"Throws",
"an",
"error",
"if",
"the",
"token",
"at",
"point",
"has",
"the",
"wrong",
"type",
"."
] | def advance(self, expected_type: str) -> str:
token = self._get_token()
self._assert_token_type(token, expected_type)
self.pos = token.pos
return token.value | [
"def",
"advance",
"(",
"self",
",",
"expected_type",
":",
"str",
")",
"->",
"str",
":",
"token",
"=",
"self",
".",
"_get_token",
"(",
")",
"self",
".",
"_assert_token_type",
"(",
"token",
",",
"expected_type",
")",
"self",
".",
"pos",
"=",
"token",
"."... | Advance the tokenizer by one token, asserting its type. | [
"Advance",
"the",
"tokenizer",
"by",
"one",
"token",
"asserting",
"its",
"type",
"."
] | [
"\"\"\"Advance the tokenizer by one token, asserting its type.\n\n Throws an error if the token at point has the wrong type.\n\n Args:\n expected_type: expected |type| attribute of the token.\n\n Returns:\n The |value| attribute of the token at point.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "expected_type",
"type": "str"
}
] | {
"returns": [
{
"docstring": "The |value| attribute of the token at point.",
"docstring_tokens": [
"The",
"|value|",
"attribute",
"of",
"the",
"token",
"at",
"point",
"."
],
"type": null
}
],
"raises": [],
"... |
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968 | sunlongbo/chromium | tools/site_compare/command_line.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AddDependency | null | def AddDependency(self, arg):
"""Makes this argument dependent on another argument.
Args:
arg: name of the argument this one depends on
"""
if arg not in self.depends:
self.depends.append(arg) | Makes this argument dependent on another argument.
Args:
arg: name of the argument this one depends on
| Makes this argument dependent on another argument. | [
"Makes",
"this",
"argument",
"dependent",
"on",
"another",
"argument",
"."
] | def AddDependency(self, arg):
if arg not in self.depends:
self.depends.append(arg) | [
"def",
"AddDependency",
"(",
"self",
",",
"arg",
")",
":",
"if",
"arg",
"not",
"in",
"self",
".",
"depends",
":",
"self",
".",
"depends",
".",
"append",
"(",
"arg",
")"
] | Makes this argument dependent on another argument. | [
"Makes",
"this",
"argument",
"dependent",
"on",
"another",
"argument",
"."
] | [
"\"\"\"Makes this argument dependent on another argument.\n\n Args:\n arg: name of the argument this one depends on\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "arg",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg",
"type": null,
"docstring": "name of the argument this one dep... |
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968 | sunlongbo/chromium | tools/site_compare/command_line.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AddMutualExclusion | null | def AddMutualExclusion(self, arg):
"""Makes this argument invalid if another is specified.
Args:
arg: name of the mutually exclusive argument.
"""
if arg not in self.mutex:
self.mutex.append(arg) | Makes this argument invalid if another is specified.
Args:
arg: name of the mutually exclusive argument.
| Makes this argument invalid if another is specified. | [
"Makes",
"this",
"argument",
"invalid",
"if",
"another",
"is",
"specified",
"."
] | def AddMutualExclusion(self, arg):
if arg not in self.mutex:
self.mutex.append(arg) | [
"def",
"AddMutualExclusion",
"(",
"self",
",",
"arg",
")",
":",
"if",
"arg",
"not",
"in",
"self",
".",
"mutex",
":",
"self",
".",
"mutex",
".",
"append",
"(",
"arg",
")"
] | Makes this argument invalid if another is specified. | [
"Makes",
"this",
"argument",
"invalid",
"if",
"another",
"is",
"specified",
"."
] | [
"\"\"\"Makes this argument invalid if another is specified.\n\n Args:\n arg: name of the mutually exclusive argument.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "arg",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg",
"type": null,
"docstring": "name of the mutually exclusive ar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.