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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c08a7d8380caac90d9634b27071fc1a117f30911 | sunlongbo/chromium | tools/perf/process_perf_results.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _handle_perf_results | <not_specific> | def _handle_perf_results(
benchmark_enabled_map, benchmark_directory_map, configuration_name,
build_properties, extra_links, output_results_dir):
"""
Upload perf results to the perf dashboard.
This method also upload the perf results to logdog and augment it to
|extra_links|.
Returns:
... |
Upload perf results to the perf dashboard.
This method also upload the perf results to logdog and augment it to
|extra_links|.
Returns:
(return_code, benchmark_upload_result_map)
return_code is 0 if this upload to perf dashboard successfully, 1
otherwise.
benchmark_upload_r... | Upload perf results to the perf dashboard.
This method also upload the perf results to logdog and augment it to
|extra_links|. | [
"Upload",
"perf",
"results",
"to",
"the",
"perf",
"dashboard",
".",
"This",
"method",
"also",
"upload",
"the",
"perf",
"results",
"to",
"logdog",
"and",
"augment",
"it",
"to",
"|extra_links|",
"."
] | def _handle_perf_results(
benchmark_enabled_map, benchmark_directory_map, configuration_name,
build_properties, extra_links, output_results_dir):
begin_time = time.time()
results_dict = {}
invocations = []
for benchmark_name, directories in benchmark_directory_map.items():
if not benchmark_enabled_m... | [
"def",
"_handle_perf_results",
"(",
"benchmark_enabled_map",
",",
"benchmark_directory_map",
",",
"configuration_name",
",",
"build_properties",
",",
"extra_links",
",",
"output_results_dir",
")",
":",
"begin_time",
"=",
"time",
".",
"time",
"(",
")",
"results_dict",
... | Upload perf results to the perf dashboard. | [
"Upload",
"perf",
"results",
"to",
"the",
"perf",
"dashboard",
"."
] | [
"\"\"\"\n Upload perf results to the perf dashboard.\n\n This method also upload the perf results to logdog and augment it to\n |extra_links|.\n\n Returns:\n (return_code, benchmark_upload_result_map)\n return_code is 0 if this upload to perf dashboard successfully, 1\n otherwise.\n ... | [
{
"param": "benchmark_enabled_map",
"type": null
},
{
"param": "benchmark_directory_map",
"type": null
},
{
"param": "configuration_name",
"type": null
},
{
"param": "build_properties",
"type": null
},
{
"param": "extra_links",
"type": null
},
{
"param... | {
"returns": [
{
"docstring": "(return_code, benchmark_upload_result_map)\nreturn_code is 0 if this upload to perf dashboard successfully, 1\notherwise.\nbenchmark_upload_result_map is a dictionary describes which benchmark\nwas successfully uploaded.",
"docstring_tokens": [
"(",
"retu... |
c08a7d8380caac90d9634b27071fc1a117f30911 | sunlongbo/chromium | tools/perf/process_perf_results.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | main | <not_specific> | def main():
""" See collect_task.collect_task for more on the merge script API. """
logging.info(sys.argv)
parser = argparse.ArgumentParser()
# configuration-name (previously perf-id) is the name of bot the tests run on
# For example, buildbot-test is the name of the android-go-perf bot
# configuration-name... | See collect_task.collect_task for more on the merge script API. | See collect_task.collect_task for more on the merge script API. | [
"See",
"collect_task",
".",
"collect_task",
"for",
"more",
"on",
"the",
"merge",
"script",
"API",
"."
] | def main():
logging.info(sys.argv)
parser = argparse.ArgumentParser()
parser.add_argument('--configuration-name', help=argparse.SUPPRESS)
parser.add_argument('--build-properties', help=argparse.SUPPRESS)
parser.add_argument('--summary-json', help=argparse.SUPPRESS)
parser.add_argument('--task-output-dir', h... | [
"def",
"main",
"(",
")",
":",
"logging",
".",
"info",
"(",
"sys",
".",
"argv",
")",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'--configuration-name'",
",",
"help",
"=",
"argparse",
".",
"SUPPRESS",
"... | See collect_task.collect_task for more on the merge script API. | [
"See",
"collect_task",
".",
"collect_task",
"for",
"more",
"on",
"the",
"merge",
"script",
"API",
"."
] | [
"\"\"\" See collect_task.collect_task for more on the merge script API. \"\"\"",
"# configuration-name (previously perf-id) is the name of bot the tests run on",
"# For example, buildbot-test is the name of the android-go-perf bot",
"# configuration-name and results-url are set in the json file which is going... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
7e8b362f34ec542e3cbec976dc450a0fc9fa4f80 | sunlongbo/chromium | testing/buildbot/filters/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckFilterFileFormat | <not_specific> | def _CheckFilterFileFormat(input_api, output_api):
"""This ensures all modified filter files are free of common syntax errors.
See the following for the correct syntax of these files:
https://chromium.googlesource.com/chromium/src/+/main/testing/buildbot/filters/README.md#file-syntax
As well as:
https://bit.... | This ensures all modified filter files are free of common syntax errors.
See the following for the correct syntax of these files:
https://chromium.googlesource.com/chromium/src/+/main/testing/buildbot/filters/README.md#file-syntax
As well as:
https://bit.ly/chromium-test-list-format
| This ensures all modified filter files are free of common syntax errors. | [
"This",
"ensures",
"all",
"modified",
"filter",
"files",
"are",
"free",
"of",
"common",
"syntax",
"errors",
"."
] | def _CheckFilterFileFormat(input_api, output_api):
errors = []
warnings = []
for f in input_api.AffectedFiles():
filename = os.path.basename(f.LocalPath())
if not filename.endswith('.filter'):
continue
inclusions = 0
exclusions = 0
for line_num, line in enumerate(f.NewContents()):
... | [
"def",
"_CheckFilterFileFormat",
"(",
"input_api",
",",
"output_api",
")",
":",
"errors",
"=",
"[",
"]",
"warnings",
"=",
"[",
"]",
"for",
"f",
"in",
"input_api",
".",
"AffectedFiles",
"(",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"basename",
... | This ensures all modified filter files are free of common syntax errors. | [
"This",
"ensures",
"all",
"modified",
"filter",
"files",
"are",
"free",
"of",
"common",
"syntax",
"errors",
"."
] | [
"\"\"\"This ensures all modified filter files are free of common syntax errors.\n\n See the following for the correct syntax of these files:\n https://chromium.googlesource.com/chromium/src/+/main/testing/buildbot/filters/README.md#file-syntax\n As well as:\n https://bit.ly/chromium-test-list-format\n \"\"\"",... | [
{
"param": "input_api",
"type": null
},
{
"param": "output_api",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_api",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output_api",
"type": null,
"docstring": null,
"docstring... |
996b82dc46f1dc24e8c73b8e5e3afb13b6d7a89a | sunlongbo/chromium | third_party/blink/renderer/build/scripts/core/css/make_css_value_id_mappings.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _find_continuous_segment | <not_specific> | def _find_continuous_segment(numbers):
"""Find the longest continuous segment in a list of numbers.
For example:
input:
1, 2, 3, 4, 5, 6
22,70,23,24,25,26
output:
number_list_sorted:
1, 3, 4, 5, 6, 2
22,23,24,25,26,70
... | Find the longest continuous segment in a list of numbers.
For example:
input:
1, 2, 3, 4, 5, 6
22,70,23,24,25,26
output:
number_list_sorted:
1, 3, 4, 5, 6, 2
22,23,24,25,26,70
segments:
0, 1, 5, 6
... | Find the longest continuous segment in a list of numbers. | [
"Find",
"the",
"longest",
"continuous",
"segment",
"in",
"a",
"list",
"of",
"numbers",
"."
] | def _find_continuous_segment(numbers):
segments = [0]
number_list_sorted = sorted(numbers, key=lambda elem: elem[0])
for i in range(len(number_list_sorted) - 1):
if (number_list_sorted[i + 1][0] - number_list_sorted[i][0] != 1 or
number_list_sorted[i + 1][1] - number_list_sorted[i][1... | [
"def",
"_find_continuous_segment",
"(",
"numbers",
")",
":",
"segments",
"=",
"[",
"0",
"]",
"number_list_sorted",
"=",
"sorted",
"(",
"numbers",
",",
"key",
"=",
"lambda",
"elem",
":",
"elem",
"[",
"0",
"]",
")",
"for",
"i",
"in",
"range",
"(",
"len",... | Find the longest continuous segment in a list of numbers. | [
"Find",
"the",
"longest",
"continuous",
"segment",
"in",
"a",
"list",
"of",
"numbers",
"."
] | [
"\"\"\"Find the longest continuous segment in a list of numbers.\n For example:\n input:\n 1, 2, 3, 4, 5, 6\n 22,70,23,24,25,26\n output:\n number_list_sorted:\n 1, 3, 4, 5, 6, 2\n 22,23,24,25,26,70\n segments:\n ... | [
{
"param": "numbers",
"type": null
}
] | {
"returns": [
{
"docstring": "a list containing the indices of the segment start point\nand end point.\nnumber_list: sorted by the first element version of the input.",
"docstring_tokens": [
"a",
"list",
"containing",
"the",
"indices",
"of",
"th... |
996b82dc46f1dc24e8c73b8e5e3afb13b6d7a89a | sunlongbo/chromium | third_party/blink/renderer/build/scripts/core/css/make_css_value_id_mappings.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _find_enum_longest_continuous_segment | <not_specific> | def _find_enum_longest_continuous_segment(property_,
name_to_position_dictionary):
"""Find the longest continuous segment in the list of keywords
Finding the continuous segment will allows us to do the subtraction
between keywords so that the distance between 2 keyw... | Find the longest continuous segment in the list of keywords
Finding the continuous segment will allows us to do the subtraction
between keywords so that the distance between 2 keywords in this
enum is equal to the distance of corresponding keywords in another
enum.
Step 1:
Convert keyword e... | Find the longest continuous segment in the list of keywords
Finding the continuous segment will allows us to do the subtraction
between keywords so that the distance between 2 keywords in this
enum is equal to the distance of corresponding keywords in another
enum.
Step 1:
Convert keyword enums into number.
Sort and f... | [
"Find",
"the",
"longest",
"continuous",
"segment",
"in",
"the",
"list",
"of",
"keywords",
"Finding",
"the",
"continuous",
"segment",
"will",
"allows",
"us",
"to",
"do",
"the",
"subtraction",
"between",
"keywords",
"so",
"that",
"the",
"distance",
"between",
"2... | def _find_enum_longest_continuous_segment(property_,
name_to_position_dictionary):
property_enum_order = range(len(property_['keywords']))
css_enum_order = [
name_to_position_dictionary[x] for x in property_['keywords']
]
enum_pair_list = zip(css_enum_or... | [
"def",
"_find_enum_longest_continuous_segment",
"(",
"property_",
",",
"name_to_position_dictionary",
")",
":",
"property_enum_order",
"=",
"range",
"(",
"len",
"(",
"property_",
"[",
"'keywords'",
"]",
")",
")",
"css_enum_order",
"=",
"[",
"name_to_position_dictionary"... | Find the longest continuous segment in the list of keywords
Finding the continuous segment will allows us to do the subtraction
between keywords so that the distance between 2 keywords in this
enum is equal to the distance of corresponding keywords in another
enum. | [
"Find",
"the",
"longest",
"continuous",
"segment",
"in",
"the",
"list",
"of",
"keywords",
"Finding",
"the",
"continuous",
"segment",
"will",
"allows",
"us",
"to",
"do",
"the",
"subtraction",
"between",
"keywords",
"so",
"that",
"the",
"distance",
"between",
"2... | [
"\"\"\"Find the longest continuous segment in the list of keywords\n Finding the continuous segment will allows us to do the subtraction\n between keywords so that the distance between 2 keywords in this\n enum is equal to the distance of corresponding keywords in another\n enum.\n\n Step 1:\n ... | [
{
"param": "property_",
"type": null
},
{
"param": "name_to_position_dictionary",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "property_",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name_to_position_dictionary",
"type": null,
"docstring": null,... |
5d1c1b8309635bb86d197280b94738d89b54c0c1 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/optparser.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | to_flag_string | <not_specific> | def to_flag_string(self, options):
"""Return a flag string of the given CommandOptionValues instance.
This method orders the flag values alphabetically by the flag key.
Args:
options: A CommandOptionValues instance.
"""
flags = {}
flags['min-confidence'] = opt... | Return a flag string of the given CommandOptionValues instance.
This method orders the flag values alphabetically by the flag key.
Args:
options: A CommandOptionValues instance.
| Return a flag string of the given CommandOptionValues instance.
This method orders the flag values alphabetically by the flag key. | [
"Return",
"a",
"flag",
"string",
"of",
"the",
"given",
"CommandOptionValues",
"instance",
".",
"This",
"method",
"orders",
"the",
"flag",
"values",
"alphabetically",
"by",
"the",
"flag",
"key",
"."
] | def to_flag_string(self, options):
flags = {}
flags['min-confidence'] = options.min_confidence
flags['output'] = options.output_format
filter_rules = options.filter_rules
if filter_rules:
flags['filter'] = ','.join(filter_rules)
if options.git_commit:
... | [
"def",
"to_flag_string",
"(",
"self",
",",
"options",
")",
":",
"flags",
"=",
"{",
"}",
"flags",
"[",
"'min-confidence'",
"]",
"=",
"options",
".",
"min_confidence",
"flags",
"[",
"'output'",
"]",
"=",
"options",
".",
"output_format",
"filter_rules",
"=",
... | Return a flag string of the given CommandOptionValues instance. | [
"Return",
"a",
"flag",
"string",
"of",
"the",
"given",
"CommandOptionValues",
"instance",
"."
] | [
"\"\"\"Return a flag string of the given CommandOptionValues instance.\n\n This method orders the flag values alphabetically by the flag key.\n\n Args:\n options: A CommandOptionValues instance.\n \"\"\"",
"# Only include the filter flag if user-provided rules are present.",
"# Alp... | [
{
"param": "self",
"type": null
},
{
"param": "options",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "options",
"type": null,
"docstring": "A CommandOptionValues instanc... |
5d1c1b8309635bb86d197280b94738d89b54c0c1 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/optparser.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _parse_error | null | def _parse_error(self, error_message):
"""Print the help string and an error message, and exit."""
# The method format_help() includes both the usage string and
# the flag options.
help = self._parser.format_help()
# Separate help from the error message with a single blank line.
... | Print the help string and an error message, and exit. | Print the help string and an error message, and exit. | [
"Print",
"the",
"help",
"string",
"and",
"an",
"error",
"message",
"and",
"exit",
"."
] | def _parse_error(self, error_message):
help = self._parser.format_help()
self.stderr_write(help + '\n')
if error_message:
_log.error(error_message)
As additional background, Python documentation says--
"Unix programs generally use 2 for command line syntax errors
... | [
"def",
"_parse_error",
"(",
"self",
",",
"error_message",
")",
":",
"help",
"=",
"self",
".",
"_parser",
".",
"format_help",
"(",
")",
"self",
".",
"stderr_write",
"(",
"help",
"+",
"'\\n'",
")",
"if",
"error_message",
":",
"_log",
".",
"error",
"(",
"... | Print the help string and an error message, and exit. | [
"Print",
"the",
"help",
"string",
"and",
"an",
"error",
"message",
"and",
"exit",
"."
] | [
"\"\"\"Print the help string and an error message, and exit.\"\"\"",
"# The method format_help() includes both the usage string and",
"# the flag options.",
"# Separate help from the error message with a single blank line.",
"# Since we are using this method to replace/override the Python",
"# module optp... | [
{
"param": "self",
"type": null
},
{
"param": "error_message",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "error_message",
"type": null,
"docstring": null,
"docstring_t... |
5d1c1b8309635bb86d197280b94738d89b54c0c1 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/optparser.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _exit_with_categories | null | def _exit_with_categories(self):
"""Exit and print the style categories and default filter rules."""
self.stderr_write('\nAll categories:\n')
for category in sorted(self._all_categories):
self.stderr_write(' ' + category + '\n')
self.stderr_write('\nDefault filter rules**... | Exit and print the style categories and default filter rules. | Exit and print the style categories and default filter rules. | [
"Exit",
"and",
"print",
"the",
"style",
"categories",
"and",
"default",
"filter",
"rules",
"."
] | def _exit_with_categories(self):
self.stderr_write('\nAll categories:\n')
for category in sorted(self._all_categories):
self.stderr_write(' ' + category + '\n')
self.stderr_write('\nDefault filter rules**:\n')
for filter_rule in sorted(self._base_filter_rules):
... | [
"def",
"_exit_with_categories",
"(",
"self",
")",
":",
"self",
".",
"stderr_write",
"(",
"'\\nAll categories:\\n'",
")",
"for",
"category",
"in",
"sorted",
"(",
"self",
".",
"_all_categories",
")",
":",
"self",
".",
"stderr_write",
"(",
"' '",
"+",
"categor... | Exit and print the style categories and default filter rules. | [
"Exit",
"and",
"print",
"the",
"style",
"categories",
"and",
"default",
"filter",
"rules",
"."
] | [
"\"\"\"Exit and print the style categories and default filter rules.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5d1c1b8309635bb86d197280b94738d89b54c0c1 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/optparser.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _parse_filter_flag | <not_specific> | def _parse_filter_flag(self, flag_value):
"""Parse the --filter flag, and return a list of filter rules.
Args:
flag_value: A string of comma-separated filter rules, for
example "-whitespace,+whitespace/indent".
"""
filters = []
for uncleaned_filte... | Parse the --filter flag, and return a list of filter rules.
Args:
flag_value: A string of comma-separated filter rules, for
example "-whitespace,+whitespace/indent".
| Parse the --filter flag, and return a list of filter rules. | [
"Parse",
"the",
"--",
"filter",
"flag",
"and",
"return",
"a",
"list",
"of",
"filter",
"rules",
"."
] | def _parse_filter_flag(self, flag_value):
filters = []
for uncleaned_filter in flag_value.split(','):
filter = uncleaned_filter.strip()
if not filter:
continue
filters.append(filter)
return filters | [
"def",
"_parse_filter_flag",
"(",
"self",
",",
"flag_value",
")",
":",
"filters",
"=",
"[",
"]",
"for",
"uncleaned_filter",
"in",
"flag_value",
".",
"split",
"(",
"','",
")",
":",
"filter",
"=",
"uncleaned_filter",
".",
"strip",
"(",
")",
"if",
"not",
"f... | Parse the --filter flag, and return a list of filter rules. | [
"Parse",
"the",
"--",
"filter",
"flag",
"and",
"return",
"a",
"list",
"of",
"filter",
"rules",
"."
] | [
"\"\"\"Parse the --filter flag, and return a list of filter rules.\n\n Args:\n flag_value: A string of comma-separated filter rules, for\n example \"-whitespace,+whitespace/indent\".\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "flag_value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flag_value",
"type": null,
"docstring": "A string of comma-separate... |
5d1c1b8309635bb86d197280b94738d89b54c0c1 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/optparser.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | parse | <not_specific> | def parse(self, args):
"""Parse the command line arguments to check_blink_style.py.
Args:
args: A list of command-line arguments as returned by sys.argv[1:].
Returns:
A tuple of (paths, options)
paths: The list of paths to check.
options: A CommandOptio... | Parse the command line arguments to check_blink_style.py.
Args:
args: A list of command-line arguments as returned by sys.argv[1:].
Returns:
A tuple of (paths, options)
paths: The list of paths to check.
options: A CommandOptionValues instance.
| Parse the command line arguments to check_blink_style.py. | [
"Parse",
"the",
"command",
"line",
"arguments",
"to",
"check_blink_style",
".",
"py",
"."
] | def parse(self, args):
(options, paths) = self._parser.parse_args(args=args)
filter_value = options.filter_value
git_commit = options.git_commit
diff_files = options.diff_files
is_verbose = options.is_verbose
min_confidence = options.min_confidence
output_format =... | [
"def",
"parse",
"(",
"self",
",",
"args",
")",
":",
"(",
"options",
",",
"paths",
")",
"=",
"self",
".",
"_parser",
".",
"parse_args",
"(",
"args",
"=",
"args",
")",
"filter_value",
"=",
"options",
".",
"filter_value",
"git_commit",
"=",
"options",
"."... | Parse the command line arguments to check_blink_style.py. | [
"Parse",
"the",
"command",
"line",
"arguments",
"to",
"check_blink_style",
".",
"py",
"."
] | [
"\"\"\"Parse the command line arguments to check_blink_style.py.\n\n Args:\n args: A list of command-line arguments as returned by sys.argv[1:].\n\n Returns:\n A tuple of (paths, options)\n\n paths: The list of paths to check.\n options: A CommandOptionValues instan... | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [
{
"docstring": "A tuple of (paths, options)\n\nThe list of paths to check.\noptions: A CommandOptionValues instance.",
"docstring_tokens": [
"A",
"tuple",
"of",
"(",
"paths",
"options",
")",
"The",
"list",
"... |
09e19b36d23b85161d821510b9ae9d89e153c4b7 | sunlongbo/chromium | tools/infra/clobber_cache_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | clobber_caches | <not_specific> | def clobber_caches(swarming_server,
pool,
realm,
cache,
mount_rel_path,
dry_run,
bot_id=None):
"""Clobber caches on bots.
The set of bots in `pool` in `swarming_server` with a cache named `cache` will
... | Clobber caches on bots.
The set of bots in `pool` in `swarming_server` with a cache named `cache` will
be looked up and printed out then the user will be asked to confirm that the
caches should be clobbered. If the user confirms, tasks that clobber the cache
will be triggered on each bot or if `dry_run` is tru... | Clobber caches on bots.
The swarming_server instance to lookup bots to clobber
caches on.
pool - The pool of machines to lookup bots to clobber caches on.
realm - The realm to trigger tasks into.
cache - The name of the cache to clobber.
mount_rel_path - The relative path to mount the cache to when clobbering.
dry_run... | [
"Clobber",
"caches",
"on",
"bots",
".",
"The",
"swarming_server",
"instance",
"to",
"lookup",
"bots",
"to",
"clobber",
"caches",
"on",
".",
"pool",
"-",
"The",
"pool",
"of",
"machines",
"to",
"lookup",
"bots",
"to",
"clobber",
"caches",
"on",
".",
"realm",... | def clobber_caches(swarming_server,
pool,
realm,
cache,
mount_rel_path,
dry_run,
bot_id=None):
if bot_id:
bots = [bot_id]
else:
bots = _get_bots(swarming_server, pool, cache)
print('The follow... | [
"def",
"clobber_caches",
"(",
"swarming_server",
",",
"pool",
",",
"realm",
",",
"cache",
",",
"mount_rel_path",
",",
"dry_run",
",",
"bot_id",
"=",
"None",
")",
":",
"if",
"bot_id",
":",
"bots",
"=",
"[",
"bot_id",
"]",
"else",
":",
"bots",
"=",
"_get... | Clobber caches on bots. | [
"Clobber",
"caches",
"on",
"bots",
"."
] | [
"\"\"\"Clobber caches on bots.\n\n The set of bots in `pool` in `swarming_server` with a cache named `cache` will\n be looked up and printed out then the user will be asked to confirm that the\n caches should be clobbered. If the user confirms, tasks that clobber the cache\n will be triggered on each bot or if ... | [
{
"param": "swarming_server",
"type": null
},
{
"param": "pool",
"type": null
},
{
"param": "realm",
"type": null
},
{
"param": "cache",
"type": null
},
{
"param": "mount_rel_path",
"type": null
},
{
"param": "dry_run",
"type": null
},
{
"p... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "swarming_server",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pool",
"type": null,
"docstring": null,
"docstring... |
942f2c48594c8eb3eb2736f6ebc47c806e53c0f6 | sunlongbo/chromium | tools/metrics/histograms/validate_obsolete_histograms.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ValidateObsoleteXml | <not_specific> | def ValidateObsoleteXml():
"""Checks that all the histograms in the obsolete file are obsolete.
Returns:
True if at least a histogram is not obsolete, False otherwise.
"""
has_obsolete_error = False
tree = xml.dom.minidom.parse(histogram_paths.OBSOLETE_XML)
for node in extract_histograms.IterElementsW... | Checks that all the histograms in the obsolete file are obsolete.
Returns:
True if at least a histogram is not obsolete, False otherwise.
| Checks that all the histograms in the obsolete file are obsolete. | [
"Checks",
"that",
"all",
"the",
"histograms",
"in",
"the",
"obsolete",
"file",
"are",
"obsolete",
"."
] | def ValidateObsoleteXml():
has_obsolete_error = False
tree = xml.dom.minidom.parse(histogram_paths.OBSOLETE_XML)
for node in extract_histograms.IterElementsWithTag(tree, 'histogram', 3):
obsolete_tag_nodelist = node.getElementsByTagName('obsolete')
if len(obsolete_tag_nodelist) > 0:
continue
has... | [
"def",
"ValidateObsoleteXml",
"(",
")",
":",
"has_obsolete_error",
"=",
"False",
"tree",
"=",
"xml",
".",
"dom",
".",
"minidom",
".",
"parse",
"(",
"histogram_paths",
".",
"OBSOLETE_XML",
")",
"for",
"node",
"in",
"extract_histograms",
".",
"IterElementsWithTag"... | Checks that all the histograms in the obsolete file are obsolete. | [
"Checks",
"that",
"all",
"the",
"histograms",
"in",
"the",
"obsolete",
"file",
"are",
"obsolete",
"."
] | [
"\"\"\"Checks that all the histograms in the obsolete file are obsolete.\n\n Returns:\n True if at least a histogram is not obsolete, False otherwise.\n \"\"\"",
"# If histogram is not obsolete, find out the directory that it should be",
"# placed in."
] | [] | {
"returns": [
{
"docstring": "True if at least a histogram is not obsolete, False otherwise.",
"docstring_tokens": [
"True",
"if",
"at",
"least",
"a",
"histogram",
"is",
"not",
"obsolete",
"False",
"otherwise",
... |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _DownloadFromCloudStorage | null | def _DownloadFromCloudStorage(bucket, sha1_file_name):
"""Download the given file based on a hash file."""
cmd = ['download_from_google_storage', '--no_resume',
'--bucket', bucket, '-s', sha1_file_name]
print('Executing command ' + ' '.join(cmd))
process = subprocess.Popen(cmd)
process.wait()
if pr... | Download the given file based on a hash file. | Download the given file based on a hash file. | [
"Download",
"the",
"given",
"file",
"based",
"on",
"a",
"hash",
"file",
"."
] | def _DownloadFromCloudStorage(bucket, sha1_file_name):
cmd = ['download_from_google_storage', '--no_resume',
'--bucket', bucket, '-s', sha1_file_name]
print('Executing command ' + ' '.join(cmd))
process = subprocess.Popen(cmd)
process.wait()
if process.returncode != 0:
raise Exception('Exception ... | [
"def",
"_DownloadFromCloudStorage",
"(",
"bucket",
",",
"sha1_file_name",
")",
":",
"cmd",
"=",
"[",
"'download_from_google_storage'",
",",
"'--no_resume'",
",",
"'--bucket'",
",",
"bucket",
",",
"'-s'",
",",
"sha1_file_name",
"]",
"print",
"(",
"'Executing command ... | Download the given file based on a hash file. | [
"Download",
"the",
"given",
"file",
"based",
"on",
"a",
"hash",
"file",
"."
] | [
"\"\"\"Download the given file based on a hash file.\"\"\""
] | [
{
"param": "bucket",
"type": null
},
{
"param": "sha1_file_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bucket",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sha1_file_name",
"type": null,
"docstring": null,
"docstrin... |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _SimulateSwipe | null | def _SimulateSwipe(device, x1, y1, x2, y2):
"""Simulates a swipe on a device from (x1, y1) to (x2, y2).
Coordinates are in (device dependent) pixels, and the origin is at the upper
left corner.
The simulated swipe will take 300ms.
Args:
device: (device_utils.DeviceUtils) device to run the command on.
... | Simulates a swipe on a device from (x1, y1) to (x2, y2).
Coordinates are in (device dependent) pixels, and the origin is at the upper
left corner.
The simulated swipe will take 300ms.
Args:
device: (device_utils.DeviceUtils) device to run the command on.
x1, y1, x2, y2: (int) Coordinates.
| Simulates a swipe on a device from (x1, y1) to (x2, y2).
Coordinates are in (device dependent) pixels, and the origin is at the upper
left corner.
The simulated swipe will take 300ms. | [
"Simulates",
"a",
"swipe",
"on",
"a",
"device",
"from",
"(",
"x1",
"y1",
")",
"to",
"(",
"x2",
"y2",
")",
".",
"Coordinates",
"are",
"in",
"(",
"device",
"dependent",
")",
"pixels",
"and",
"the",
"origin",
"is",
"at",
"the",
"upper",
"left",
"corner"... | def _SimulateSwipe(device, x1, y1, x2, y2):
args = [str(x) for x in (x1, y1, x2, y2)]
device.RunShellCommand(['input', 'swipe'] + args) | [
"def",
"_SimulateSwipe",
"(",
"device",
",",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
")",
":",
"args",
"=",
"[",
"str",
"(",
"x",
")",
"for",
"x",
"in",
"(",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
")",
"]",
"device",
".",
"RunShellCommand",
"(... | Simulates a swipe on a device from (x1, y1) to (x2, y2). | [
"Simulates",
"a",
"swipe",
"on",
"a",
"device",
"from",
"(",
"x1",
"y1",
")",
"to",
"(",
"x2",
"y2",
")",
"."
] | [
"\"\"\"Simulates a swipe on a device from (x1, y1) to (x2, y2).\n\n Coordinates are in (device dependent) pixels, and the origin is at the upper\n left corner.\n The simulated swipe will take 300ms.\n\n Args:\n device: (device_utils.DeviceUtils) device to run the command on.\n x1, y1, x2, y2: (int) Coordi... | [
{
"param": "device",
"type": null
},
{
"param": "x1",
"type": null
},
{
"param": "y1",
"type": null
},
{
"param": "x2",
"type": null
},
{
"param": "y2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": null,
"docstring": "(device_utils.DeviceUtils) device to run the command on.",
"docstring_tokens": [
"(",
"device_utils",
".",
"DeviceUtils",
")",
"device",
... |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _BringUpWpr | null | def _BringUpWpr(self):
"""Start the WPR server on the host and the forwarder on the device."""
print('Starting WPR on host...')
_DownloadFromCloudStorage(self._WPR_BUCKET, self._wpr_archive_hash)
if binary_manager.NeedsInit():
binary_manager.InitDependencyManager([])
self._wpr_server = webpage... | Start the WPR server on the host and the forwarder on the device. | Start the WPR server on the host and the forwarder on the device. | [
"Start",
"the",
"WPR",
"server",
"on",
"the",
"host",
"and",
"the",
"forwarder",
"on",
"the",
"device",
"."
] | def _BringUpWpr(self):
print('Starting WPR on host...')
_DownloadFromCloudStorage(self._WPR_BUCKET, self._wpr_archive_hash)
if binary_manager.NeedsInit():
binary_manager.InitDependencyManager([])
self._wpr_server = webpagereplay_go_server.ReplayServer(
self._wpr_archive, '127.0.0.1', 0, 0,... | [
"def",
"_BringUpWpr",
"(",
"self",
")",
":",
"print",
"(",
"'Starting WPR on host...'",
")",
"_DownloadFromCloudStorage",
"(",
"self",
".",
"_WPR_BUCKET",
",",
"self",
".",
"_wpr_archive_hash",
")",
"if",
"binary_manager",
".",
"NeedsInit",
"(",
")",
":",
"binar... | Start the WPR server on the host and the forwarder on the device. | [
"Start",
"the",
"WPR",
"server",
"on",
"the",
"host",
"and",
"the",
"forwarder",
"on",
"the",
"device",
"."
] | [
"\"\"\"Start the WPR server on the host and the forwarder on the device.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _StopWpr | null | def _StopWpr(self):
""" Stop the WPR and forwarder."""
print('Stopping WPR on host...')
if self._wpr_server:
self._wpr_server.StopServer()
self._wpr_server = None | Stop the WPR and forwarder. | Stop the WPR and forwarder. | [
"Stop",
"the",
"WPR",
"and",
"forwarder",
"."
] | def _StopWpr(self):
print('Stopping WPR on host...')
if self._wpr_server:
self._wpr_server.StopServer()
self._wpr_server = None | [
"def",
"_StopWpr",
"(",
"self",
")",
":",
"print",
"(",
"'Stopping WPR on host...'",
")",
"if",
"self",
".",
"_wpr_server",
":",
"self",
".",
"_wpr_server",
".",
"StopServer",
"(",
")",
"self",
".",
"_wpr_server",
"=",
"None"
] | Stop the WPR and forwarder. | [
"Stop",
"the",
"WPR",
"and",
"forwarder",
"."
] | [
"\"\"\" Stop the WPR and forwarder.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _StartForwarder | <not_specific> | def _StartForwarder(self):
"""Sets up forwarding of device ports to the host, and configures chrome
to use those ports.
"""
if not self._wpr_server:
logging.warning('No host WPR server to forward to.')
return
print('Starting device forwarder...')
forwarder.Forwarder.Map([(0, self._ho... | Sets up forwarding of device ports to the host, and configures chrome
to use those ports.
| Sets up forwarding of device ports to the host, and configures chrome
to use those ports. | [
"Sets",
"up",
"forwarding",
"of",
"device",
"ports",
"to",
"the",
"host",
"and",
"configures",
"chrome",
"to",
"use",
"those",
"ports",
"."
] | def _StartForwarder(self):
if not self._wpr_server:
logging.warning('No host WPR server to forward to.')
return
print('Starting device forwarder...')
forwarder.Forwarder.Map([(0, self._host_http_port),
(0, self._host_https_port)],
self._de... | [
"def",
"_StartForwarder",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_wpr_server",
":",
"logging",
".",
"warning",
"(",
"'No host WPR server to forward to.'",
")",
"return",
"print",
"(",
"'Starting device forwarder...'",
")",
"forwarder",
".",
"Forwarder",
... | Sets up forwarding of device ports to the host, and configures chrome
to use those ports. | [
"Sets",
"up",
"forwarding",
"of",
"device",
"ports",
"to",
"the",
"host",
"and",
"configures",
"chrome",
"to",
"use",
"those",
"ports",
"."
] | [
"\"\"\"Sets up forwarding of device ports to the host, and configures chrome\n to use those ports.\n \"\"\"",
"# Allows to selectively avoid certificate errors in Chrome. Unlike",
"# --ignore-certificate-errors this allows exercising the HTTP disk cache",
"# and avoids re-establishing socket connections... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _StopForwarder | null | def _StopForwarder(self):
"""Shuts down the port forwarding service."""
if self._flag_changer:
print('Restoring flags while stopping forwarder, but why?...')
self._flag_changer.Restore()
self._flag_changer = None
print('Stopping device forwarder...')
forwarder.Forwarder.UnmapAllDeviceP... | Shuts down the port forwarding service. | Shuts down the port forwarding service. | [
"Shuts",
"down",
"the",
"port",
"forwarding",
"service",
"."
] | def _StopForwarder(self):
if self._flag_changer:
print('Restoring flags while stopping forwarder, but why?...')
self._flag_changer.Restore()
self._flag_changer = None
print('Stopping device forwarder...')
forwarder.Forwarder.UnmapAllDevicePorts(self._device) | [
"def",
"_StopForwarder",
"(",
"self",
")",
":",
"if",
"self",
".",
"_flag_changer",
":",
"print",
"(",
"'Restoring flags while stopping forwarder, but why?...'",
")",
"self",
".",
"_flag_changer",
".",
"Restore",
"(",
")",
"self",
".",
"_flag_changer",
"=",
"None"... | Shuts down the port forwarding service. | [
"Shuts",
"down",
"the",
"port",
"forwarding",
"service",
"."
] | [
"\"\"\"Shuts down the port forwarding service.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SetPregeneratedProfiles | null | def SetPregeneratedProfiles(self, files):
"""Set pregenerated profiles.
The pregenerated files will be returned as profile data instead of running
an actual profiling step.
Args:
files: ([str]) List of pregenerated files.
"""
logging.info('Using pregenerated profiles')
self._pregener... | Set pregenerated profiles.
The pregenerated files will be returned as profile data instead of running
an actual profiling step.
Args:
files: ([str]) List of pregenerated files.
| Set pregenerated profiles.
The pregenerated files will be returned as profile data instead of running
an actual profiling step. | [
"Set",
"pregenerated",
"profiles",
".",
"The",
"pregenerated",
"files",
"will",
"be",
"returned",
"as",
"profile",
"data",
"instead",
"of",
"running",
"an",
"actual",
"profiling",
"step",
"."
] | def SetPregeneratedProfiles(self, files):
logging.info('Using pregenerated profiles')
self._pregenerated_profiles = files | [
"def",
"SetPregeneratedProfiles",
"(",
"self",
",",
"files",
")",
":",
"logging",
".",
"info",
"(",
"'Using pregenerated profiles'",
")",
"self",
".",
"_pregenerated_profiles",
"=",
"files"
] | Set pregenerated profiles. | [
"Set",
"pregenerated",
"profiles",
"."
] | [
"\"\"\"Set pregenerated profiles.\n\n The pregenerated files will be returned as profile data instead of running\n an actual profiling step.\n\n Args:\n files: ([str]) List of pregenerated files.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "files",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "files",
"type": null,
"docstring": "([str]) List of pregenerated fi... |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunCygprofileTests | <not_specific> | def RunCygprofileTests(self):
"""Run the cygprofile unit tests suite on the device.
Returns:
The exit code for the tests.
"""
device_path = '/data/local/tmp/cygprofile_unittests'
self._device.PushChangedFiles([(self._cygprofile_tests, device_path)])
try:
self._device.RunShellCommand... | Run the cygprofile unit tests suite on the device.
Returns:
The exit code for the tests.
| Run the cygprofile unit tests suite on the device. | [
"Run",
"the",
"cygprofile",
"unit",
"tests",
"suite",
"on",
"the",
"device",
"."
] | def RunCygprofileTests(self):
device_path = '/data/local/tmp/cygprofile_unittests'
self._device.PushChangedFiles([(self._cygprofile_tests, device_path)])
try:
self._device.RunShellCommand(device_path, check_return=True)
except (device_errors.CommandFailedError,
device_errors.DeviceUnre... | [
"def",
"RunCygprofileTests",
"(",
"self",
")",
":",
"device_path",
"=",
"'/data/local/tmp/cygprofile_unittests'",
"self",
".",
"_device",
".",
"PushChangedFiles",
"(",
"[",
"(",
"self",
".",
"_cygprofile_tests",
",",
"device_path",
")",
"]",
")",
"try",
":",
"se... | Run the cygprofile unit tests suite on the device. | [
"Run",
"the",
"cygprofile",
"unit",
"tests",
"suite",
"on",
"the",
"device",
"."
] | [
"\"\"\"Run the cygprofile unit tests suite on the device.\n\n Returns:\n The exit code for the tests.\n \"\"\"",
"# TODO(jbudorick): Let the exception propagate up once clients can",
"# handle it."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "The exit code for the tests.",
"docstring_tokens": [
"The",
"exit",
"code",
"for",
"the",
"tests",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"ty... |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CollectProfile | <not_specific> | def CollectProfile(self, apk, package_info):
"""Run a profile and collect the log files.
Args:
apk: The location of the chrome apk to profile.
package_info: A PackageInfo structure describing the chrome apk,
as from pylib/constants.
Returns:
A list of cygprofile data ... | Run a profile and collect the log files.
Args:
apk: The location of the chrome apk to profile.
package_info: A PackageInfo structure describing the chrome apk,
as from pylib/constants.
Returns:
A list of cygprofile data files.
Raises:
NoProfileDataError: No dat... | Run a profile and collect the log files. | [
"Run",
"a",
"profile",
"and",
"collect",
"the",
"log",
"files",
"."
] | def CollectProfile(self, apk, package_info):
if self._pregenerated_profiles:
logging.info('Using pregenerated profiles instead of running profile')
logging.info('Profile files:\n%s', '\n'.join(self._pregenerated_profiles))
return self._pregenerated_profiles
self._device.adb.Logcat(clear=True)
... | [
"def",
"CollectProfile",
"(",
"self",
",",
"apk",
",",
"package_info",
")",
":",
"if",
"self",
".",
"_pregenerated_profiles",
":",
"logging",
".",
"info",
"(",
"'Using pregenerated profiles instead of running profile'",
")",
"logging",
".",
"info",
"(",
"'Profile fi... | Run a profile and collect the log files. | [
"Run",
"a",
"profile",
"and",
"collect",
"the",
"log",
"files",
"."
] | [
"\"\"\"Run a profile and collect the log files.\n\n Args:\n apk: The location of the chrome apk to profile.\n package_info: A PackageInfo structure describing the chrome apk,\n as from pylib/constants.\n\n Returns:\n A list of cygprofile data files.\n\n Raises:\n NoPr... | [
{
"param": "self",
"type": null
},
{
"param": "apk",
"type": null
},
{
"param": "package_info",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of cygprofile data files.",
"docstring_tokens": [
"A",
"list",
"of",
"cygprofile",
"data",
"files",
"."
],
"type": null
}
],
"raises": [
{
"docstring": "No data was found on the ... |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CollectSystemHealthProfile | <not_specific> | def CollectSystemHealthProfile(self, apk):
"""Run the orderfile system health benchmarks and collect log files.
Args:
apk: The location of the chrome apk file to profile.
Returns:
A list of cygprofile data files.
Raises:
NoProfileDataError: No data was found on the device.
"""
... | Run the orderfile system health benchmarks and collect log files.
Args:
apk: The location of the chrome apk file to profile.
Returns:
A list of cygprofile data files.
Raises:
NoProfileDataError: No data was found on the device.
| Run the orderfile system health benchmarks and collect log files. | [
"Run",
"the",
"orderfile",
"system",
"health",
"benchmarks",
"and",
"collect",
"log",
"files",
"."
] | def CollectSystemHealthProfile(self, apk):
if self._pregenerated_profiles:
logging.info('Using pregenerated profiles instead of running '
'system health profile')
logging.info('Profile files: %s', '\n'.join(self._pregenerated_profiles))
return self._pregenerated_profiles
log... | [
"def",
"CollectSystemHealthProfile",
"(",
"self",
",",
"apk",
")",
":",
"if",
"self",
".",
"_pregenerated_profiles",
":",
"logging",
".",
"info",
"(",
"'Using pregenerated profiles instead of running '",
"'system health profile'",
")",
"logging",
".",
"info",
"(",
"'P... | Run the orderfile system health benchmarks and collect log files. | [
"Run",
"the",
"orderfile",
"system",
"health",
"benchmarks",
"and",
"collect",
"log",
"files",
"."
] | [
"\"\"\"Run the orderfile system health benchmarks and collect log files.\n\n Args:\n apk: The location of the chrome apk file to profile.\n\n Returns:\n A list of cygprofile data files.\n\n Raises:\n NoProfileDataError: No data was found on the device.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "apk",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of cygprofile data files.",
"docstring_tokens": [
"A",
"list",
"of",
"cygprofile",
"data",
"files",
"."
],
"type": null
}
],
"raises": [
{
"docstring": "No data was found on the ... |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RunCommand | <not_specific> | def _RunCommand(cls, command):
"""Run a command from current build directory root.
Args:
command: A list of command strings.
Returns:
The process's return code.
"""
root = constants.DIR_SOURCE_ROOT
print('Executing {} in {}'.format(' '.join(command), root))
process = subprocess... | Run a command from current build directory root.
Args:
command: A list of command strings.
Returns:
The process's return code.
| Run a command from current build directory root. | [
"Run",
"a",
"command",
"from",
"current",
"build",
"directory",
"root",
"."
] | def _RunCommand(cls, command):
root = constants.DIR_SOURCE_ROOT
print('Executing {} in {}'.format(' '.join(command), root))
process = subprocess.Popen(command, cwd=root, env=os.environ)
process.wait()
return process.returncode | [
"def",
"_RunCommand",
"(",
"cls",
",",
"command",
")",
":",
"root",
"=",
"constants",
".",
"DIR_SOURCE_ROOT",
"print",
"(",
"'Executing {} in {}'",
".",
"format",
"(",
"' '",
".",
"join",
"(",
"command",
")",
",",
"root",
")",
")",
"process",
"=",
"subpr... | Run a command from current build directory root. | [
"Run",
"a",
"command",
"from",
"current",
"build",
"directory",
"root",
"."
] | [
"\"\"\"Run a command from current build directory root.\n\n Args:\n command: A list of command strings.\n\n Returns:\n The process's return code.\n \"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "command",
"type": null
}
] | {
"returns": [
{
"docstring": "The process's return code.",
"docstring_tokens": [
"The",
"process",
"'",
"s",
"return",
"code",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type"... |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RunProfileCollection | null | def _RunProfileCollection(self, package_info, simulate_user):
"""Runs the profile collection tasks.
If |simulate_user| is True, then try to simulate a real user, with swiping.
Also do a first load of the page instead of about:blank, in order to
exercise the cache. This is not desirable with a page that... | Runs the profile collection tasks.
If |simulate_user| is True, then try to simulate a real user, with swiping.
Also do a first load of the page instead of about:blank, in order to
exercise the cache. This is not desirable with a page that only contains
cachable resources, as in this instance the networ... | Runs the profile collection tasks.
If |simulate_user| is True, then try to simulate a real user, with swiping.
Also do a first load of the page instead of about:blank, in order to
exercise the cache. This is not desirable with a page that only contains
cachable resources, as in this instance the network code will not b... | [
"Runs",
"the",
"profile",
"collection",
"tasks",
".",
"If",
"|simulate_user|",
"is",
"True",
"then",
"try",
"to",
"simulate",
"a",
"real",
"user",
"with",
"swiping",
".",
"Also",
"do",
"a",
"first",
"load",
"of",
"the",
"page",
"instead",
"of",
"about",
... | def _RunProfileCollection(self, package_info, simulate_user):
initial_url = self._urls[0] if simulate_user else 'about:blank'
self._StartChrome(package_info, initial_url)
time.sleep(15)
self._KillChrome(package_info)
self._SetUpDeviceFolders()
for url in self._urls:
self._StartChrome(packa... | [
"def",
"_RunProfileCollection",
"(",
"self",
",",
"package_info",
",",
"simulate_user",
")",
":",
"initial_url",
"=",
"self",
".",
"_urls",
"[",
"0",
"]",
"if",
"simulate_user",
"else",
"'about:blank'",
"self",
".",
"_StartChrome",
"(",
"package_info",
",",
"i... | Runs the profile collection tasks. | [
"Runs",
"the",
"profile",
"collection",
"tasks",
"."
] | [
"\"\"\"Runs the profile collection tasks.\n\n If |simulate_user| is True, then try to simulate a real user, with swiping.\n Also do a first load of the page instead of about:blank, in order to\n exercise the cache. This is not desirable with a page that only contains\n cachable resources, as in this ins... | [
{
"param": "self",
"type": null
},
{
"param": "package_info",
"type": null
},
{
"param": "simulate_user",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "package_info",
"type": null,
"docstring": "Which Chrome package to ... |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _Install | null | def _Install(self, apk):
"""Installs Chrome.apk on the device.
Args:
apk: The location of the chrome apk to profile.
"""
print('Installing apk...')
self._device.Install(apk) | Installs Chrome.apk on the device.
Args:
apk: The location of the chrome apk to profile.
| Installs Chrome.apk on the device. | [
"Installs",
"Chrome",
".",
"apk",
"on",
"the",
"device",
"."
] | def _Install(self, apk):
print('Installing apk...')
self._device.Install(apk) | [
"def",
"_Install",
"(",
"self",
",",
"apk",
")",
":",
"print",
"(",
"'Installing apk...'",
")",
"self",
".",
"_device",
".",
"Install",
"(",
"apk",
")"
] | Installs Chrome.apk on the device. | [
"Installs",
"Chrome",
".",
"apk",
"on",
"the",
"device",
"."
] | [
"\"\"\"Installs Chrome.apk on the device.\n\n Args:\n apk: The location of the chrome apk to profile.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "apk",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "apk",
"type": null,
"docstring": "The location of the chrome apk to... |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _SetUpDeviceFolders | null | def _SetUpDeviceFolders(self):
"""Creates folders on the device to store profile data."""
print('Setting up device folders...')
self._DeleteDeviceData()
self._device.RunShellCommand(['mkdir', '-p', self._DEVICE_PROFILE_DIR],
check_return=True) | Creates folders on the device to store profile data. | Creates folders on the device to store profile data. | [
"Creates",
"folders",
"on",
"the",
"device",
"to",
"store",
"profile",
"data",
"."
] | def _SetUpDeviceFolders(self):
print('Setting up device folders...')
self._DeleteDeviceData()
self._device.RunShellCommand(['mkdir', '-p', self._DEVICE_PROFILE_DIR],
check_return=True) | [
"def",
"_SetUpDeviceFolders",
"(",
"self",
")",
":",
"print",
"(",
"'Setting up device folders...'",
")",
"self",
".",
"_DeleteDeviceData",
"(",
")",
"self",
".",
"_device",
".",
"RunShellCommand",
"(",
"[",
"'mkdir'",
",",
"'-p'",
",",
"self",
".",
"_DEVICE_P... | Creates folders on the device to store profile data. | [
"Creates",
"folders",
"on",
"the",
"device",
"to",
"store",
"profile",
"data",
"."
] | [
"\"\"\"Creates folders on the device to store profile data.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _DeleteDeviceData | null | def _DeleteDeviceData(self):
"""Clears out profile storage locations on the device. """
for profile_dir in [self._DEVICE_PROFILE_DIR] + self._LEGACY_PROFILE_DIRS:
self._device.RunShellCommand(
['rm', '-rf', str(profile_dir)],
check_return=True) | Clears out profile storage locations on the device. | Clears out profile storage locations on the device. | [
"Clears",
"out",
"profile",
"storage",
"locations",
"on",
"the",
"device",
"."
] | def _DeleteDeviceData(self):
for profile_dir in [self._DEVICE_PROFILE_DIR] + self._LEGACY_PROFILE_DIRS:
self._device.RunShellCommand(
['rm', '-rf', str(profile_dir)],
check_return=True) | [
"def",
"_DeleteDeviceData",
"(",
"self",
")",
":",
"for",
"profile_dir",
"in",
"[",
"self",
".",
"_DEVICE_PROFILE_DIR",
"]",
"+",
"self",
".",
"_LEGACY_PROFILE_DIRS",
":",
"self",
".",
"_device",
".",
"RunShellCommand",
"(",
"[",
"'rm'",
",",
"'-rf'",
",",
... | Clears out profile storage locations on the device. | [
"Clears",
"out",
"profile",
"storage",
"locations",
"on",
"the",
"device",
"."
] | [
"\"\"\"Clears out profile storage locations on the device. \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _PullProfileData | <not_specific> | def _PullProfileData(self):
"""Pulls the profile data off of the device.
Returns:
A list of profile data files which were pulled.
Raises:
NoProfileDataError: No data was found on the device.
"""
print('Pulling profile data...')
self._SetUpHostFolders()
self._device.PullFile(sel... | Pulls the profile data off of the device.
Returns:
A list of profile data files which were pulled.
Raises:
NoProfileDataError: No data was found on the device.
| Pulls the profile data off of the device. | [
"Pulls",
"the",
"profile",
"data",
"off",
"of",
"the",
"device",
"."
] | def _PullProfileData(self):
print('Pulling profile data...')
self._SetUpHostFolders()
self._device.PullFile(self._DEVICE_PROFILE_DIR, self._host_profile_dir,
timeout=300)
files = []
redundant_dir_root = os.path.basename(self._DEVICE_PROFILE_DIR)
for root_file in os.list... | [
"def",
"_PullProfileData",
"(",
"self",
")",
":",
"print",
"(",
"'Pulling profile data...'",
")",
"self",
".",
"_SetUpHostFolders",
"(",
")",
"self",
".",
"_device",
".",
"PullFile",
"(",
"self",
".",
"_DEVICE_PROFILE_DIR",
",",
"self",
".",
"_host_profile_dir",... | Pulls the profile data off of the device. | [
"Pulls",
"the",
"profile",
"data",
"off",
"of",
"the",
"device",
"."
] | [
"\"\"\"Pulls the profile data off of the device.\n\n Returns:\n A list of profile data files which were pulled.\n\n Raises:\n NoProfileDataError: No data was found on the device.\n \"\"\"",
"# Temporary workaround/investigation: if (for unknown reason) 'adb pull' of",
"# the directory 'orderf... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of profile data files which were pulled.",
"docstring_tokens": [
"A",
"list",
"of",
"profile",
"data",
"files",
"which",
"were",
"pulled",
"."
],
"type": null
}
],
... |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AddProfileCollectionArguments | null | def AddProfileCollectionArguments(parser):
"""Adds the profiling collection arguments to |parser|."""
parser.add_argument(
'--no-wpr', action='store_true', help='Don\'t use WPR.')
parser.add_argument('--urls', type=str, help='URLs to load.',
default=[AndroidProfileTool.TEST_URL],
... | Adds the profiling collection arguments to |parser|. | Adds the profiling collection arguments to |parser|. | [
"Adds",
"the",
"profiling",
"collection",
"arguments",
"to",
"|parser|",
"."
] | def AddProfileCollectionArguments(parser):
parser.add_argument(
'--no-wpr', action='store_true', help='Don\'t use WPR.')
parser.add_argument('--urls', type=str, help='URLs to load.',
default=[AndroidProfileTool.TEST_URL],
nargs='+')
parser.add_argument(
'--s... | [
"def",
"AddProfileCollectionArguments",
"(",
"parser",
")",
":",
"parser",
".",
"add_argument",
"(",
"'--no-wpr'",
",",
"action",
"=",
"'store_true'",
",",
"help",
"=",
"'Don\\'t use WPR.'",
")",
"parser",
".",
"add_argument",
"(",
"'--urls'",
",",
"type",
"=",
... | Adds the profiling collection arguments to |parser|. | [
"Adds",
"the",
"profiling",
"collection",
"arguments",
"to",
"|parser|",
"."
] | [
"\"\"\"Adds the profiling collection arguments to |parser|.\"\"\""
] | [
{
"param": "parser",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "parser",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0eb957709c86920f4e7bf038ac477e56569c8cc6 | sunlongbo/chromium | tools/cygprofile/profile_android_startup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreateArgumentParser | <not_specific> | def CreateArgumentParser():
"""Creates and return the argument parser."""
parser = argparse.ArgumentParser()
parser.add_argument(
'--adb-path', type=os.path.realpath,
help='adb binary')
parser.add_argument(
'--apk-path', type=os.path.realpath, required=True,
help='APK to profile')
pars... | Creates and return the argument parser. | Creates and return the argument parser. | [
"Creates",
"and",
"return",
"the",
"argument",
"parser",
"."
] | def CreateArgumentParser():
parser = argparse.ArgumentParser()
parser.add_argument(
'--adb-path', type=os.path.realpath,
help='adb binary')
parser.add_argument(
'--apk-path', type=os.path.realpath, required=True,
help='APK to profile')
parser.add_argument(
'--output-directory', typ... | [
"def",
"CreateArgumentParser",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'--adb-path'",
",",
"type",
"=",
"os",
".",
"path",
".",
"realpath",
",",
"help",
"=",
"'adb binary'",
")",
"pars... | Creates and return the argument parser. | [
"Creates",
"and",
"return",
"the",
"argument",
"parser",
"."
] | [
"\"\"\"Creates and return the argument parser.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
d8d6fb2a741fec9dcdda06baee64500e835a9616 | sunlongbo/chromium | tools/android/customtabs_benchmark/scripts/chrome_setup.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ResetChromeLocalState | null | def ResetChromeLocalState(device, package):
"""Remove the Chrome Profile and the various disk caches."""
profile_dirs = ['app_chrome/Default', 'cache', 'app_chrome/ShaderCache',
'app_tabs']
cmd = ['rm', '-rf']
cmd.extend(
'/data/data/{}/{}'.format(package, d) for d in profile_dirs)
dev... | Remove the Chrome Profile and the various disk caches. | Remove the Chrome Profile and the various disk caches. | [
"Remove",
"the",
"Chrome",
"Profile",
"and",
"the",
"various",
"disk",
"caches",
"."
] | def ResetChromeLocalState(device, package):
profile_dirs = ['app_chrome/Default', 'cache', 'app_chrome/ShaderCache',
'app_tabs']
cmd = ['rm', '-rf']
cmd.extend(
'/data/data/{}/{}'.format(package, d) for d in profile_dirs)
device.adb.Shell(subprocess.list2cmdline(cmd)) | [
"def",
"ResetChromeLocalState",
"(",
"device",
",",
"package",
")",
":",
"profile_dirs",
"=",
"[",
"'app_chrome/Default'",
",",
"'cache'",
",",
"'app_chrome/ShaderCache'",
",",
"'app_tabs'",
"]",
"cmd",
"=",
"[",
"'rm'",
",",
"'-rf'",
"]",
"cmd",
".",
"extend"... | Remove the Chrome Profile and the various disk caches. | [
"Remove",
"the",
"Chrome",
"Profile",
"and",
"the",
"various",
"disk",
"caches",
"."
] | [
"\"\"\"Remove the Chrome Profile and the various disk caches.\"\"\""
] | [
{
"param": "device",
"type": null
},
{
"param": "package",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "package",
"type": null,
"docstring": null,
"docstring_token... |
d8eb08f8ac231a9ea36fb15b9a639ed86ea72e35 | sunlongbo/chromium | gpu/gles2_conform_support/generate_gles2_embedded_data.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AddFiles | null | def AddFiles(self, scan_dir):
"""Scan a folder and embed the contents of files."""
files_to_embed = os.listdir(scan_dir)
sub_dirs = []
for file_to_embed in files_to_embed:
full_path = os.path.join(scan_dir, file_to_embed)
ext = os.path.splitext(file_to_embed)[1]
base_path = full_path[l... | Scan a folder and embed the contents of files. | Scan a folder and embed the contents of files. | [
"Scan",
"a",
"folder",
"and",
"embed",
"the",
"contents",
"of",
"files",
"."
] | def AddFiles(self, scan_dir):
files_to_embed = os.listdir(scan_dir)
sub_dirs = []
for file_to_embed in files_to_embed:
full_path = os.path.join(scan_dir, file_to_embed)
ext = os.path.splitext(file_to_embed)[1]
base_path = full_path[len(self.scan_dir) + 1:]
if os.path.isdir(full_path)... | [
"def",
"AddFiles",
"(",
"self",
",",
"scan_dir",
")",
":",
"files_to_embed",
"=",
"os",
".",
"listdir",
"(",
"scan_dir",
")",
"sub_dirs",
"=",
"[",
"]",
"for",
"file_to_embed",
"in",
"files_to_embed",
":",
"full_path",
"=",
"os",
".",
"path",
".",
"join"... | Scan a folder and embed the contents of files. | [
"Scan",
"a",
"folder",
"and",
"embed",
"the",
"contents",
"of",
"files",
"."
] | [
"\"\"\"Scan a folder and embed the contents of files.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "scan_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scan_dir",
"type": null,
"docstring": null,
"docstring_tokens... |
d8eb08f8ac231a9ea36fb15b9a639ed86ea72e35 | sunlongbo/chromium | gpu/gles2_conform_support/generate_gles2_embedded_data.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | main | <not_specific> | def main(argv):
"""This is the main function."""
if len(argv) >= 1:
scan_dir = argv[0]
else:
scan_dir = '.'
if len(argv) >= 2:
base_dir = argv[1]
else:
base_dir = None
GenerateEmbeddedFiles(scan_dir, base_dir)
return 0 | This is the main function. | This is the main function. | [
"This",
"is",
"the",
"main",
"function",
"."
] | def main(argv):
if len(argv) >= 1:
scan_dir = argv[0]
else:
scan_dir = '.'
if len(argv) >= 2:
base_dir = argv[1]
else:
base_dir = None
GenerateEmbeddedFiles(scan_dir, base_dir)
return 0 | [
"def",
"main",
"(",
"argv",
")",
":",
"if",
"len",
"(",
"argv",
")",
">=",
"1",
":",
"scan_dir",
"=",
"argv",
"[",
"0",
"]",
"else",
":",
"scan_dir",
"=",
"'.'",
"if",
"len",
"(",
"argv",
")",
">=",
"2",
":",
"base_dir",
"=",
"argv",
"[",
"1"... | This is the main function. | [
"This",
"is",
"the",
"main",
"function",
"."
] | [
"\"\"\"This is the main function.\"\"\""
] | [
{
"param": "argv",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argv",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e07602c663423df0b4a1373e69137305d81bfc0c | sunlongbo/chromium | components/variations/proto/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckChange | <not_specific> | def CheckChange(input_api, output_api):
"""Checks that changes to client_variations.proto are mirrored."""
has_proto_update = False
has_parser_update = False
cwd = input_api.PresubmitLocalPath()
for path in input_api.AbsoluteLocalPaths():
if not path.startswith(cwd):
continue
name = input_api.os... | Checks that changes to client_variations.proto are mirrored. | Checks that changes to client_variations.proto are mirrored. | [
"Checks",
"that",
"changes",
"to",
"client_variations",
".",
"proto",
"are",
"mirrored",
"."
] | def CheckChange(input_api, output_api):
has_proto_update = False
has_parser_update = False
cwd = input_api.PresubmitLocalPath()
for path in input_api.AbsoluteLocalPaths():
if not path.startswith(cwd):
continue
name = input_api.os_path.relpath(path, cwd)
if name == 'client_variations.proto':
... | [
"def",
"CheckChange",
"(",
"input_api",
",",
"output_api",
")",
":",
"has_proto_update",
"=",
"False",
"has_parser_update",
"=",
"False",
"cwd",
"=",
"input_api",
".",
"PresubmitLocalPath",
"(",
")",
"for",
"path",
"in",
"input_api",
".",
"AbsoluteLocalPaths",
"... | Checks that changes to client_variations.proto are mirrored. | [
"Checks",
"that",
"changes",
"to",
"client_variations",
".",
"proto",
"are",
"mirrored",
"."
] | [
"\"\"\"Checks that changes to client_variations.proto are mirrored.\"\"\""
] | [
{
"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... |
b6eb5e7d5d4b1dab609fdb2e0c6a4d0eea8c672e | sunlongbo/chromium | components/policy/tools/generate_extension_admx.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ToId | <not_specific> | def _ToId(self, id_str):
'''
Replaces all non-alphanumeric characters by underscores.
'''
return re.sub('[^0-9a-zA-Z]+', '_', id_str) if id_str else None |
Replaces all non-alphanumeric characters by underscores.
| Replaces all non-alphanumeric characters by underscores. | [
"Replaces",
"all",
"non",
"-",
"alphanumeric",
"characters",
"by",
"underscores",
"."
] | def _ToId(self, id_str):
return re.sub('[^0-9a-zA-Z]+', '_', id_str) if id_str else None | [
"def",
"_ToId",
"(",
"self",
",",
"id_str",
")",
":",
"return",
"re",
".",
"sub",
"(",
"'[^0-9a-zA-Z]+'",
",",
"'_'",
",",
"id_str",
")",
"if",
"id_str",
"else",
"None"
] | Replaces all non-alphanumeric characters by underscores. | [
"Replaces",
"all",
"non",
"-",
"alphanumeric",
"characters",
"by",
"underscores",
"."
] | [
"'''\n Replaces all non-alphanumeric characters by underscores.\n\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "id_str",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id_str",
"type": null,
"docstring": null,
"docstring_tokens":... |
b6eb5e7d5d4b1dab609fdb2e0c6a4d0eea8c672e | sunlongbo/chromium | components/policy/tools/generate_extension_admx.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddString | null | def _AddString(self, string_id, text):
'''
Adds a string with ID |string_id| to the strings table in the ADML doc or
reuses an existing string.
'''
string_id = self._ToId(string_id)
if string_id in self._strings_seen:
assert text == self._strings_seen[string_id]
else:
self._stri... |
Adds a string with ID |string_id| to the strings table in the ADML doc or
reuses an existing string.
| Adds a string with ID |string_id| to the strings table in the ADML doc or
reuses an existing string. | [
"Adds",
"a",
"string",
"with",
"ID",
"|string_id|",
"to",
"the",
"strings",
"table",
"in",
"the",
"ADML",
"doc",
"or",
"reuses",
"an",
"existing",
"string",
"."
] | def _AddString(self, string_id, text):
string_id = self._ToId(string_id)
if string_id in self._strings_seen:
assert text == self._strings_seen[string_id]
else:
self._strings_seen[string_id] = text
string_elem = self._AddElement(self._string_table_elem, 'string')
self._SetAttribute(st... | [
"def",
"_AddString",
"(",
"self",
",",
"string_id",
",",
"text",
")",
":",
"string_id",
"=",
"self",
".",
"_ToId",
"(",
"string_id",
")",
"if",
"string_id",
"in",
"self",
".",
"_strings_seen",
":",
"assert",
"text",
"==",
"self",
".",
"_strings_seen",
"[... | Adds a string with ID |string_id| to the strings table in the ADML doc or
reuses an existing string. | [
"Adds",
"a",
"string",
"with",
"ID",
"|string_id|",
"to",
"the",
"strings",
"table",
"in",
"the",
"ADML",
"doc",
"or",
"reuses",
"an",
"existing",
"string",
"."
] | [
"'''\n Adds a string with ID |string_id| to the strings table in the ADML doc or\n reuses an existing string.\n\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "string_id",
"type": null
},
{
"param": "text",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "string_id",
"type": null,
"docstring": null,
"docstring_token... |
b6eb5e7d5d4b1dab609fdb2e0c6a4d0eea8c672e | sunlongbo/chromium | components/policy/tools/generate_extension_admx.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddNamespace | null | def _AddNamespace(self, namespaces_elem, elem_name, namespace, prefix):
'''
Adds an ADMX namespace node.
'''
namespace_elem = self._AddElement(namespaces_elem, elem_name)
self._SetAttribute(namespace_elem, 'namespace', namespace)
self._SetAttribute(namespace_elem, 'prefix', prefix) |
Adds an ADMX namespace node.
| Adds an ADMX namespace node. | [
"Adds",
"an",
"ADMX",
"namespace",
"node",
"."
] | def _AddNamespace(self, namespaces_elem, elem_name, namespace, prefix):
namespace_elem = self._AddElement(namespaces_elem, elem_name)
self._SetAttribute(namespace_elem, 'namespace', namespace)
self._SetAttribute(namespace_elem, 'prefix', prefix) | [
"def",
"_AddNamespace",
"(",
"self",
",",
"namespaces_elem",
",",
"elem_name",
",",
"namespace",
",",
"prefix",
")",
":",
"namespace_elem",
"=",
"self",
".",
"_AddElement",
"(",
"namespaces_elem",
",",
"elem_name",
")",
"self",
".",
"_SetAttribute",
"(",
"name... | Adds an ADMX namespace node. | [
"Adds",
"an",
"ADMX",
"namespace",
"node",
"."
] | [
"'''\n Adds an ADMX namespace node.\n\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "namespaces_elem",
"type": null
},
{
"param": "elem_name",
"type": null
},
{
"param": "namespace",
"type": null
},
{
"param": "prefix",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "namespaces_elem",
"type": null,
"docstring": null,
"docstring... |
b6eb5e7d5d4b1dab609fdb2e0c6a4d0eea8c672e | sunlongbo/chromium | components/policy/tools/generate_extension_admx.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _BeginAdmlTemplate | null | def _BeginAdmlTemplate(self):
'''
Writes the header of the ADML doc.
'''
dom_impl = minidom.getDOMImplementation('')
self._adml_doc = dom_impl.createDocument(None, 'policyDefinitionResources',
None)
root_elem = self._adml_doc.documentElement
self... |
Writes the header of the ADML doc.
| Writes the header of the ADML doc. | [
"Writes",
"the",
"header",
"of",
"the",
"ADML",
"doc",
"."
] | def _BeginAdmlTemplate(self):
dom_impl = minidom.getDOMImplementation('')
self._adml_doc = dom_impl.createDocument(None, 'policyDefinitionResources',
None)
root_elem = self._adml_doc.documentElement
self._SetAttribute(root_elem, 'revision', '1.0')
self._S... | [
"def",
"_BeginAdmlTemplate",
"(",
"self",
")",
":",
"dom_impl",
"=",
"minidom",
".",
"getDOMImplementation",
"(",
"''",
")",
"self",
".",
"_adml_doc",
"=",
"dom_impl",
".",
"createDocument",
"(",
"None",
",",
"'policyDefinitionResources'",
",",
"None",
")",
"r... | Writes the header of the ADML doc. | [
"Writes",
"the",
"header",
"of",
"the",
"ADML",
"doc",
"."
] | [
"'''\n Writes the header of the ADML doc.\n\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6eb5e7d5d4b1dab609fdb2e0c6a4d0eea8c672e | sunlongbo/chromium | components/policy/tools/generate_extension_admx.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _BeginAdmxTemplate | null | def _BeginAdmxTemplate(self):
'''
Writes the header of the ADMX doc.
'''
dom_impl = minidom.getDOMImplementation('')
self._admx_doc = dom_impl.createDocument(None, 'policyDefinitions', None)
root_elem = self._admx_doc.documentElement
self._SetAttribute(root_elem, 'revision', '1.0')
self... |
Writes the header of the ADMX doc.
| Writes the header of the ADMX doc. | [
"Writes",
"the",
"header",
"of",
"the",
"ADMX",
"doc",
"."
] | def _BeginAdmxTemplate(self):
dom_impl = minidom.getDOMImplementation('')
self._admx_doc = dom_impl.createDocument(None, 'policyDefinitions', None)
root_elem = self._admx_doc.documentElement
self._SetAttribute(root_elem, 'revision', '1.0')
self._SetAttribute(root_elem, 'schemaVersion', '1.0')
na... | [
"def",
"_BeginAdmxTemplate",
"(",
"self",
")",
":",
"dom_impl",
"=",
"minidom",
".",
"getDOMImplementation",
"(",
"''",
")",
"self",
".",
"_admx_doc",
"=",
"dom_impl",
".",
"createDocument",
"(",
"None",
",",
"'policyDefinitions'",
",",
"None",
")",
"root_elem... | Writes the header of the ADMX doc. | [
"Writes",
"the",
"header",
"of",
"the",
"ADMX",
"doc",
"."
] | [
"'''\n Writes the header of the ADMX doc.\n\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6eb5e7d5d4b1dab609fdb2e0c6a4d0eea8c672e | sunlongbo/chromium | components/policy/tools/generate_extension_admx.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | main | <not_specific> | def main():
'''Main function, usage see top of file.'''
parser = ArgumentParser(usage=__doc__)
parser.add_argument(
'--name',
dest='extension_name',
help='extension name (e.g. Managed Bookmarks)')
parser.add_argument(
'--id',
dest='extension_id',
help='extension id (e.g. gihm... | Main function, usage see top of file. | Main function, usage see top of file. | [
"Main",
"function",
"usage",
"see",
"top",
"of",
"file",
"."
] | def main():
parser = ArgumentParser(usage=__doc__)
parser.add_argument(
'--name',
dest='extension_name',
help='extension name (e.g. Managed Bookmarks)')
parser.add_argument(
'--id',
dest='extension_id',
help='extension id (e.g. gihmafigllmhbppdfjnfecimiohcljba)')
parser.add_a... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"ArgumentParser",
"(",
"usage",
"=",
"__doc__",
")",
"parser",
".",
"add_argument",
"(",
"'--name'",
",",
"dest",
"=",
"'extension_name'",
",",
"help",
"=",
"'extension name (e.g. Managed Bookmarks)'",
")",
"parser",
... | Main function, usage see top of file. | [
"Main",
"function",
"usage",
"see",
"top",
"of",
"file",
"."
] | [
"'''Main function, usage see top of file.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
df67bea4c9819ec52d3d60e17f46ad9238dc3a6d | sunlongbo/chromium | third_party/blink/renderer/build/scripts/make_runtime_features_utilities.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | origin_trials | <not_specific> | def origin_trials(features):
"""
This function returns all features that are in origin trial.
The dependency is considered in origin trial if itself is in origin trial
or any of its dependencies are in origin trial. Propagate dependency
tag use DFS can find all features that are in origin trial.
... |
This function returns all features that are in origin trial.
The dependency is considered in origin trial if itself is in origin trial
or any of its dependencies are in origin trial. Propagate dependency
tag use DFS can find all features that are in origin trial.
@param features: a List[Dict]. Eac... | This function returns all features that are in origin trial.
The dependency is considered in origin trial if itself is in origin trial
or any of its dependencies are in origin trial. Propagate dependency
tag use DFS can find all features that are in origin trial.
@param features: a List[Dict]. | [
"This",
"function",
"returns",
"all",
"features",
"that",
"are",
"in",
"origin",
"trial",
".",
"The",
"dependency",
"is",
"considered",
"in",
"origin",
"trial",
"if",
"itself",
"is",
"in",
"origin",
"trial",
"or",
"any",
"of",
"its",
"dependencies",
"are",
... | def origin_trials(features):
_validate_runtime_features_graph(features)
origin_trials_set = set()
graph = defaultdict(list)
for feature in features:
for dependency in feature['depends_on']:
graph[dependency].append(str(feature['name']))
def dfs(node):
origin_trials_set.ad... | [
"def",
"origin_trials",
"(",
"features",
")",
":",
"_validate_runtime_features_graph",
"(",
"features",
")",
"origin_trials_set",
"=",
"set",
"(",
")",
"graph",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"feature",
"in",
"features",
":",
"for",
"dependency",
... | This function returns all features that are in origin trial. | [
"This",
"function",
"returns",
"all",
"features",
"that",
"are",
"in",
"origin",
"trial",
"."
] | [
"\"\"\"\n This function returns all features that are in origin trial.\n The dependency is considered in origin trial if itself is in origin trial\n or any of its dependencies are in origin trial. Propagate dependency\n tag use DFS can find all features that are in origin trial.\n\n @param features: ... | [
{
"param": "features",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "features",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
df9579e43f209a46e0b5f8f05d29a2c2e1cf8ab5 | sunlongbo/chromium | components/certificate_transparency/tools/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RunMakeCTLogListTests | <not_specific> | def _RunMakeCTLogListTests(input_api, output_api):
"""Runs make_ct_known_logs_list unittests if related files were modified."""
files = (input_api.os_path.normpath(x) for x in
('components/certificate_transparency/tools/make_ct_known_logs_list.py',
'components/certificate_transparency/tools/m... | Runs make_ct_known_logs_list unittests if related files were modified. | Runs make_ct_known_logs_list unittests if related files were modified. | [
"Runs",
"make_ct_known_logs_list",
"unittests",
"if",
"related",
"files",
"were",
"modified",
"."
] | def _RunMakeCTLogListTests(input_api, output_api):
files = (input_api.os_path.normpath(x) for x in
('components/certificate_transparency/tools/make_ct_known_logs_list.py',
'components/certificate_transparency/tools/make_ct_known_logs_list_unittest.py',
'components/certificate_transp... | [
"def",
"_RunMakeCTLogListTests",
"(",
"input_api",
",",
"output_api",
")",
":",
"files",
"=",
"(",
"input_api",
".",
"os_path",
".",
"normpath",
"(",
"x",
")",
"for",
"x",
"in",
"(",
"'components/certificate_transparency/tools/make_ct_known_logs_list.py'",
",",
"'co... | Runs make_ct_known_logs_list unittests if related files were modified. | [
"Runs",
"make_ct_known_logs_list",
"unittests",
"if",
"related",
"files",
"were",
"modified",
"."
] | [
"\"\"\"Runs make_ct_known_logs_list unittests if related files were modified.\"\"\""
] | [
{
"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... |
f08eed66fc02628640c2c1a80912826c4c8ada9a | sunlongbo/chromium | chrome/test/enterprise/e2e/infra/test_util.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _get_chrome_windows | <not_specific> | def _get_chrome_windows():
"""Gets the list of hwnd of Chrome windows."""
window_list = []
win32gui.EnumWindows(_window_enum_handler, window_list)
return window_list | Gets the list of hwnd of Chrome windows. | Gets the list of hwnd of Chrome windows. | [
"Gets",
"the",
"list",
"of",
"hwnd",
"of",
"Chrome",
"windows",
"."
] | def _get_chrome_windows():
window_list = []
win32gui.EnumWindows(_window_enum_handler, window_list)
return window_list | [
"def",
"_get_chrome_windows",
"(",
")",
":",
"window_list",
"=",
"[",
"]",
"win32gui",
".",
"EnumWindows",
"(",
"_window_enum_handler",
",",
"window_list",
")",
"return",
"window_list"
] | Gets the list of hwnd of Chrome windows. | [
"Gets",
"the",
"list",
"of",
"hwnd",
"of",
"Chrome",
"windows",
"."
] | [
"\"\"\"Gets the list of hwnd of Chrome windows.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
f08eed66fc02628640c2c1a80912826c4c8ada9a | sunlongbo/chromium | chrome/test/enterprise/e2e/infra/test_util.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | shutdown_chrome | null | def shutdown_chrome():
"""Shutdown Chrome cleanly.
Surprisingly there is no easy way in chromedriver to shutdown Chrome
cleanly on Windows. So we have to use win32 API to do that: we find
the chrome window first, then send WM_CLOSE message to it.
"""
window_list = _get_chrome_windows()
if not windo... | Shutdown Chrome cleanly.
Surprisingly there is no easy way in chromedriver to shutdown Chrome
cleanly on Windows. So we have to use win32 API to do that: we find
the chrome window first, then send WM_CLOSE message to it.
| Shutdown Chrome cleanly.
Surprisingly there is no easy way in chromedriver to shutdown Chrome
cleanly on Windows. So we have to use win32 API to do that: we find
the chrome window first, then send WM_CLOSE message to it. | [
"Shutdown",
"Chrome",
"cleanly",
".",
"Surprisingly",
"there",
"is",
"no",
"easy",
"way",
"in",
"chromedriver",
"to",
"shutdown",
"Chrome",
"cleanly",
"on",
"Windows",
".",
"So",
"we",
"have",
"to",
"use",
"win32",
"API",
"to",
"do",
"that",
":",
"we",
"... | def shutdown_chrome():
window_list = _get_chrome_windows()
if not window_list:
raise RuntimeError("Cannot find chrome windows")
for win in window_list:
win32gui.SendMessage(win, win32con.WM_CLOSE, 0, 0)
time.sleep(2) | [
"def",
"shutdown_chrome",
"(",
")",
":",
"window_list",
"=",
"_get_chrome_windows",
"(",
")",
"if",
"not",
"window_list",
":",
"raise",
"RuntimeError",
"(",
"\"Cannot find chrome windows\"",
")",
"for",
"win",
"in",
"window_list",
":",
"win32gui",
".",
"SendMessag... | Shutdown Chrome cleanly. | [
"Shutdown",
"Chrome",
"cleanly",
"."
] | [
"\"\"\"Shutdown Chrome cleanly.\n\n Surprisingly there is no easy way in chromedriver to shutdown Chrome\n cleanly on Windows. So we have to use win32 API to do that: we find\n the chrome window first, then send WM_CLOSE message to it.\n \"\"\"",
"# wait a little bit for chrome processes to end.",
"# ... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
f08eed66fc02628640c2c1a80912826c4c8ada9a | sunlongbo/chromium | chrome/test/enterprise/e2e/infra/test_util.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | create_chrome_webdriver | <not_specific> | def create_chrome_webdriver(chrome_options=None, incognito=False, prefs=None):
"""Configures and returns a Chrome WebDriver object."
Args:
chrome_options: The default ChromeOptions to use.
incognito: Whether or not to launch Chrome in incognito mode.
prefs: Profile preferences. None for defaults.
"""... | Configures and returns a Chrome WebDriver object."
Args:
chrome_options: The default ChromeOptions to use.
incognito: Whether or not to launch Chrome in incognito mode.
prefs: Profile preferences. None for defaults.
| Configures and returns a Chrome WebDriver object." | [
"Configures",
"and",
"returns",
"a",
"Chrome",
"WebDriver",
"object",
".",
"\""
] | def create_chrome_webdriver(chrome_options=None, incognito=False, prefs=None):
if chrome_options == None:
chrome_options = Options()
if incognito:
chrome_options.add_argument('incognito')
if prefs != None:
chrome_options.add_experimental_option("prefs", prefs)
os.environ["CHROME_LOG_FILE"] = r"c:\te... | [
"def",
"create_chrome_webdriver",
"(",
"chrome_options",
"=",
"None",
",",
"incognito",
"=",
"False",
",",
"prefs",
"=",
"None",
")",
":",
"if",
"chrome_options",
"==",
"None",
":",
"chrome_options",
"=",
"Options",
"(",
")",
"if",
"incognito",
":",
"chrome_... | Configures and returns a Chrome WebDriver object." | [
"Configures",
"and",
"returns",
"a",
"Chrome",
"WebDriver",
"object",
".",
"\""
] | [
"\"\"\"Configures and returns a Chrome WebDriver object.\"\n\n Args:\n chrome_options: The default ChromeOptions to use.\n incognito: Whether or not to launch Chrome in incognito mode.\n prefs: Profile preferences. None for defaults.\n \"\"\""
] | [
{
"param": "chrome_options",
"type": null
},
{
"param": "incognito",
"type": null
},
{
"param": "prefs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "chrome_options",
"type": null,
"docstring": "The default ChromeOptions to use.",
"docstring_tokens": [
"The",
"default",
"ChromeOptions",
"to",
"use",
"."
],
"default... |
f09b7dd7a0ced08e7722bc324f331c4f53bede33 | sunlongbo/chromium | third_party/closure_compiler/compiler.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | run_jar | <not_specific> | def run_jar(self, jar, args):
"""Runs a .jar from the command line with arguments.
Args:
jar: A file path to a .jar file
args: A list of command line arguments to be passed when running the .jar.
Return:
(exit_code, stderr) The exit code of the command (e.g. 0 for success) and
... | Runs a .jar from the command line with arguments.
Args:
jar: A file path to a .jar file
args: A list of command line arguments to be passed when running the .jar.
Return:
(exit_code, stderr) The exit code of the command (e.g. 0 for success) and
the stderr collected while running |j... | Runs a .jar from the command line with arguments. | [
"Runs",
"a",
".",
"jar",
"from",
"the",
"command",
"line",
"with",
"arguments",
"."
] | def run_jar(self, jar, args):
shell_command = " ".join(self._JAR_COMMAND + [jar] + args)
self._log_debug("Running jar: %s" % shell_command)
devnull = open(os.devnull, "w")
process = subprocess.Popen(shell_command, universal_newlines=True,
shell=True, stdout=devnull,
... | [
"def",
"run_jar",
"(",
"self",
",",
"jar",
",",
"args",
")",
":",
"shell_command",
"=",
"\" \"",
".",
"join",
"(",
"self",
".",
"_JAR_COMMAND",
"+",
"[",
"jar",
"]",
"+",
"args",
")",
"self",
".",
"_log_debug",
"(",
"\"Running jar: %s\"",
"%",
"shell_c... | Runs a .jar from the command line with arguments. | [
"Runs",
"a",
".",
"jar",
"from",
"the",
"command",
"line",
"with",
"arguments",
"."
] | [
"\"\"\"Runs a .jar from the command line with arguments.\n\n Args:\n jar: A file path to a .jar file\n args: A list of command line arguments to be passed when running the .jar.\n\n Return:\n (exit_code, stderr) The exit code of the command (e.g. 0 for success) and\n the stderr collect... | [
{
"param": "self",
"type": null
},
{
"param": "jar",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "jar",
"type": null,
"docstring": "A file path to a .jar file",
... |
f09d8cc9fdd31eedf4e35f7dc94c0cdd6be837bd | sunlongbo/chromium | tools/remove_duplicate_includes.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FindIncludeSet | <not_specific> | def FindIncludeSet(input_lines, h_path_to_include_set, cc_file_name):
"""Finds and returns the corresponding include set for the given .cc file.
This is done by finding the first include in the file and then trying to look
up an .h file in the passed in map. If not present, then None is returned
immediately.
... | Finds and returns the corresponding include set for the given .cc file.
This is done by finding the first include in the file and then trying to look
up an .h file in the passed in map. If not present, then None is returned
immediately.
| Finds and returns the corresponding include set for the given .cc file.
This is done by finding the first include in the file and then trying to look
up an .h file in the passed in map. If not present, then None is returned
immediately. | [
"Finds",
"and",
"returns",
"the",
"corresponding",
"include",
"set",
"for",
"the",
"given",
".",
"cc",
"file",
".",
"This",
"is",
"done",
"by",
"finding",
"the",
"first",
"include",
"in",
"the",
"file",
"and",
"then",
"trying",
"to",
"look",
"up",
"an",
... | def FindIncludeSet(input_lines, h_path_to_include_set, cc_file_name):
for line in input_lines:
match = INCLUDE_REGEX.search(line)
if match:
h_file_path = os.path.join(os.getcwd(), match.group(2))
if h_file_path not in h_path_to_include_set:
print('First include did not match to a known .h ... | [
"def",
"FindIncludeSet",
"(",
"input_lines",
",",
"h_path_to_include_set",
",",
"cc_file_name",
")",
":",
"for",
"line",
"in",
"input_lines",
":",
"match",
"=",
"INCLUDE_REGEX",
".",
"search",
"(",
"line",
")",
"if",
"match",
":",
"h_file_path",
"=",
"os",
"... | Finds and returns the corresponding include set for the given .cc file. | [
"Finds",
"and",
"returns",
"the",
"corresponding",
"include",
"set",
"for",
"the",
"given",
".",
"cc",
"file",
"."
] | [
"\"\"\"Finds and returns the corresponding include set for the given .cc file.\n\n This is done by finding the first include in the file and then trying to look\n up an .h file in the passed in map. If not present, then None is returned\n immediately.\n \"\"\"",
"# The first include match should be the corres... | [
{
"param": "input_lines",
"type": null
},
{
"param": "h_path_to_include_set",
"type": null
},
{
"param": "cc_file_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_lines",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "h_path_to_include_set",
"type": null,
"docstring": null,
... |
f09d8cc9fdd31eedf4e35f7dc94c0cdd6be837bd | sunlongbo/chromium | tools/remove_duplicate_includes.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WithoutDuplicates | <not_specific> | def WithoutDuplicates(input_lines, include_set, cc_file_name):
"""Checks every input line and sees if we can remove it based on the contents
of the given include set.
Returns what the new contents of the file should be.
"""
output_lines = []
# When a section of includes are completely removed, we want to r... | Checks every input line and sees if we can remove it based on the contents
of the given include set.
Returns what the new contents of the file should be.
| Checks every input line and sees if we can remove it based on the contents
of the given include set.
Returns what the new contents of the file should be. | [
"Checks",
"every",
"input",
"line",
"and",
"sees",
"if",
"we",
"can",
"remove",
"it",
"based",
"on",
"the",
"contents",
"of",
"the",
"given",
"include",
"set",
".",
"Returns",
"what",
"the",
"new",
"contents",
"of",
"the",
"file",
"should",
"be",
"."
] | def WithoutDuplicates(input_lines, include_set, cc_file_name):
output_lines = []
lastCopiedLineWasEmpty = False
lastLineWasOmitted = False
for line in input_lines:
match = INCLUDE_REGEX.search(line)
if match and match.group(2) in include_set:
print('Removed ' + match.group(1) + ' from ' + cc... | [
"def",
"WithoutDuplicates",
"(",
"input_lines",
",",
"include_set",
",",
"cc_file_name",
")",
":",
"output_lines",
"=",
"[",
"]",
"lastCopiedLineWasEmpty",
"=",
"False",
"lastLineWasOmitted",
"=",
"False",
"for",
"line",
"in",
"input_lines",
":",
"match",
"=",
"... | Checks every input line and sees if we can remove it based on the contents
of the given include set. | [
"Checks",
"every",
"input",
"line",
"and",
"sees",
"if",
"we",
"can",
"remove",
"it",
"based",
"on",
"the",
"contents",
"of",
"the",
"given",
"include",
"set",
"."
] | [
"\"\"\"Checks every input line and sees if we can remove it based on the contents\n of the given include set.\n\n Returns what the new contents of the file should be.\n \"\"\"",
"# When a section of includes are completely removed, we want to remove the",
"# trailing empty as well."
] | [
{
"param": "input_lines",
"type": null
},
{
"param": "include_set",
"type": null
},
{
"param": "cc_file_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_lines",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "include_set",
"type": null,
"docstring": null,
"docstr... |
f0a2dea8d44f17c0cf715ed136e81e59da2642aa | sunlongbo/chromium | third_party/android_platform/development/scripts/symbol.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetApkPackageName | <not_specific> | def _GetApkPackageName(apk_path):
"""Return the package name of a given apk."""
package_name = _package_name_cache.get(apk_path, None)
if package_name:
return package_name
aapt_path = host_paths.GetAaptPath()
aapt_output = subprocess.check_output(
[aapt_path, 'dump', 'badging', apk_path]).split('\n... | Return the package name of a given apk. | Return the package name of a given apk. | [
"Return",
"the",
"package",
"name",
"of",
"a",
"given",
"apk",
"."
] | def _GetApkPackageName(apk_path):
package_name = _package_name_cache.get(apk_path, None)
if package_name:
return package_name
aapt_path = host_paths.GetAaptPath()
aapt_output = subprocess.check_output(
[aapt_path, 'dump', 'badging', apk_path]).split('\n')
for line in aapt_output:
match = _PACKAG... | [
"def",
"_GetApkPackageName",
"(",
"apk_path",
")",
":",
"package_name",
"=",
"_package_name_cache",
".",
"get",
"(",
"apk_path",
",",
"None",
")",
"if",
"package_name",
":",
"return",
"package_name",
"aapt_path",
"=",
"host_paths",
".",
"GetAaptPath",
"(",
")",
... | Return the package name of a given apk. | [
"Return",
"the",
"package",
"name",
"of",
"a",
"given",
"apk",
"."
] | [
"\"\"\"Return the package name of a given apk.\"\"\""
] | [
{
"param": "apk_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "apk_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f0a2dea8d44f17c0cf715ed136e81e59da2642aa | sunlongbo/chromium | third_party/android_platform/development/scripts/symbol.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _PathListJoin | <not_specific> | def _PathListJoin(prefix_list, suffix_list):
"""Returns each prefix in prefix_list joined with each suffix in suffix list.
Args:
prefix_list: list of path prefixes.
suffix_list: list of path suffixes.
Returns:
List of paths each of which joins a prefix with a suffix.
"""
return [
os.... | Returns each prefix in prefix_list joined with each suffix in suffix list.
Args:
prefix_list: list of path prefixes.
suffix_list: list of path suffixes.
Returns:
List of paths each of which joins a prefix with a suffix.
| Returns each prefix in prefix_list joined with each suffix in suffix list. | [
"Returns",
"each",
"prefix",
"in",
"prefix_list",
"joined",
"with",
"each",
"suffix",
"in",
"suffix",
"list",
"."
] | def _PathListJoin(prefix_list, suffix_list):
return [
os.path.join(prefix, suffix)
for suffix in suffix_list for prefix in prefix_list ] | [
"def",
"_PathListJoin",
"(",
"prefix_list",
",",
"suffix_list",
")",
":",
"return",
"[",
"os",
".",
"path",
".",
"join",
"(",
"prefix",
",",
"suffix",
")",
"for",
"suffix",
"in",
"suffix_list",
"for",
"prefix",
"in",
"prefix_list",
"]"
] | Returns each prefix in prefix_list joined with each suffix in suffix list. | [
"Returns",
"each",
"prefix",
"in",
"prefix_list",
"joined",
"with",
"each",
"suffix",
"in",
"suffix",
"list",
"."
] | [
"\"\"\"Returns each prefix in prefix_list joined with each suffix in suffix list.\n\n Args:\n prefix_list: list of path prefixes.\n suffix_list: list of path suffixes.\n\n Returns:\n List of paths each of which joins a prefix with a suffix.\n \"\"\""
] | [
{
"param": "prefix_list",
"type": null
},
{
"param": "suffix_list",
"type": null
}
] | {
"returns": [
{
"docstring": "List of paths each of which joins a prefix with a suffix.",
"docstring_tokens": [
"List",
"of",
"paths",
"each",
"of",
"which",
"joins",
"a",
"prefix",
"with",
"a",
"suffix",
... |
f0a2dea8d44f17c0cf715ed136e81e59da2642aa | sunlongbo/chromium | third_party/android_platform/development/scripts/symbol.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetCandidates | <not_specific> | def GetCandidates(dirs, filepart, candidate_fun):
"""Returns a list of candidate filenames, sorted by modification time.
Args:
dirs: a list of the directory part of the pathname.
filepart: the file part of the pathname.
candidate_fun: a function to apply to each candidate, returns a list.
Returns:
... | Returns a list of candidate filenames, sorted by modification time.
Args:
dirs: a list of the directory part of the pathname.
filepart: the file part of the pathname.
candidate_fun: a function to apply to each candidate, returns a list.
Returns:
A list of candidate files ordered by modification ti... | Returns a list of candidate filenames, sorted by modification time. | [
"Returns",
"a",
"list",
"of",
"candidate",
"filenames",
"sorted",
"by",
"modification",
"time",
"."
] | def GetCandidates(dirs, filepart, candidate_fun):
candidates = _PathListJoin(dirs, [filepart])
logging.debug('GetCandidates: prefiltered candidates = %s' % candidates)
candidates = list(
itertools.chain.from_iterable(map(candidate_fun, candidates)))
candidates.sort(key=os.path.getmtime, reverse=True)
re... | [
"def",
"GetCandidates",
"(",
"dirs",
",",
"filepart",
",",
"candidate_fun",
")",
":",
"candidates",
"=",
"_PathListJoin",
"(",
"dirs",
",",
"[",
"filepart",
"]",
")",
"logging",
".",
"debug",
"(",
"'GetCandidates: prefiltered candidates = %s'",
"%",
"candidates",
... | Returns a list of candidate filenames, sorted by modification time. | [
"Returns",
"a",
"list",
"of",
"candidate",
"filenames",
"sorted",
"by",
"modification",
"time",
"."
] | [
"\"\"\"Returns a list of candidate filenames, sorted by modification time.\n\n Args:\n dirs: a list of the directory part of the pathname.\n filepart: the file part of the pathname.\n candidate_fun: a function to apply to each candidate, returns a list.\n\n Returns:\n A list of candidate files ordered... | [
{
"param": "dirs",
"type": null
},
{
"param": "filepart",
"type": null
},
{
"param": "candidate_fun",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of candidate files ordered by modification time, newest first.",
"docstring_tokens": [
"A",
"list",
"of",
"candidate",
"files",
"ordered",
"by",
"modification",
"time",
"newest",
... |
f0a2dea8d44f17c0cf715ed136e81e59da2642aa | sunlongbo/chromium | third_party/android_platform/development/scripts/symbol.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetCandidateApks | <not_specific> | def _GetCandidateApks():
"""Returns a list of APKs which could contain the library.
Args:
None
Returns:
list of APK file paths which could contain the library.
"""
global _cached_candidate_apks
if _cached_candidate_apks is not None:
return _cached_candidate_apks
apk_dir = os.path.join(const... | Returns a list of APKs which could contain the library.
Args:
None
Returns:
list of APK file paths which could contain the library.
| Returns a list of APKs which could contain the library.
Args:
None
list of APK file paths which could contain the library. | [
"Returns",
"a",
"list",
"of",
"APKs",
"which",
"could",
"contain",
"the",
"library",
".",
"Args",
":",
"None",
"list",
"of",
"APK",
"file",
"paths",
"which",
"could",
"contain",
"the",
"library",
"."
] | def _GetCandidateApks():
global _cached_candidate_apks
if _cached_candidate_apks is not None:
return _cached_candidate_apks
apk_dir = os.path.join(constants.GetOutDirectory(), 'apks')
candidates = GetCandidates([apk_dir], '*.apk', glob.glob)
_cached_candidate_apks = candidates
return candidates | [
"def",
"_GetCandidateApks",
"(",
")",
":",
"global",
"_cached_candidate_apks",
"if",
"_cached_candidate_apks",
"is",
"not",
"None",
":",
"return",
"_cached_candidate_apks",
"apk_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"constants",
".",
"GetOutDirectory",
"... | Returns a list of APKs which could contain the library. | [
"Returns",
"a",
"list",
"of",
"APKs",
"which",
"could",
"contain",
"the",
"library",
"."
] | [
"\"\"\"Returns a list of APKs which could contain the library.\n\n Args:\n None\n\n Returns:\n list of APK file paths which could contain the library.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
f0a2dea8d44f17c0cf715ed136e81e59da2642aa | sunlongbo/chromium | third_party/android_platform/development/scripts/symbol.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetCrazyLib | <not_specific> | def GetCrazyLib(apk_filename):
"""Returns the name of the first crazy library from this APK.
Args:
apk_filename: name of an APK file.
Returns:
Name of the first library which would be crazy loaded from this APK.
"""
zip_file = zipfile.ZipFile(apk_filename, 'r')
for filename in zip_file.namelist():... | Returns the name of the first crazy library from this APK.
Args:
apk_filename: name of an APK file.
Returns:
Name of the first library which would be crazy loaded from this APK.
| Returns the name of the first crazy library from this APK. | [
"Returns",
"the",
"name",
"of",
"the",
"first",
"crazy",
"library",
"from",
"this",
"APK",
"."
] | def GetCrazyLib(apk_filename):
zip_file = zipfile.ZipFile(apk_filename, 'r')
for filename in zip_file.namelist():
match = re.match('lib/[^/]*/crazy.(lib.*[.]so)', filename)
if match:
return match.group(1)
return None | [
"def",
"GetCrazyLib",
"(",
"apk_filename",
")",
":",
"zip_file",
"=",
"zipfile",
".",
"ZipFile",
"(",
"apk_filename",
",",
"'r'",
")",
"for",
"filename",
"in",
"zip_file",
".",
"namelist",
"(",
")",
":",
"match",
"=",
"re",
".",
"match",
"(",
"'lib/[^/]*... | Returns the name of the first crazy library from this APK. | [
"Returns",
"the",
"name",
"of",
"the",
"first",
"crazy",
"library",
"from",
"this",
"APK",
"."
] | [
"\"\"\"Returns the name of the first crazy library from this APK.\n\n Args:\n apk_filename: name of an APK file.\n\n Returns:\n Name of the first library which would be crazy loaded from this APK.\n \"\"\""
] | [
{
"param": "apk_filename",
"type": null
}
] | {
"returns": [
{
"docstring": "Name of the first library which would be crazy loaded from this APK.",
"docstring_tokens": [
"Name",
"of",
"the",
"first",
"library",
"which",
"would",
"be",
"crazy",
"loaded",
"from"... |
f0a2dea8d44f17c0cf715ed136e81e59da2642aa | sunlongbo/chromium | third_party/android_platform/development/scripts/symbol.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetMatchingApks | <not_specific> | def GetMatchingApks(package_name):
"""Find any APKs which match the package indicated by the device_apk_name.
Args:
package_name: package name of the APK on the device.
Returns:
A list of APK filenames which could contain the desired library.
"""
return [apk_path for apk_path in _GetCandidateApks(... | Find any APKs which match the package indicated by the device_apk_name.
Args:
package_name: package name of the APK on the device.
Returns:
A list of APK filenames which could contain the desired library.
| Find any APKs which match the package indicated by the device_apk_name. | [
"Find",
"any",
"APKs",
"which",
"match",
"the",
"package",
"indicated",
"by",
"the",
"device_apk_name",
"."
] | def GetMatchingApks(package_name):
return [apk_path for apk_path in _GetCandidateApks() if (
_GetApkPackageName(apk_path) == package_name)] | [
"def",
"GetMatchingApks",
"(",
"package_name",
")",
":",
"return",
"[",
"apk_path",
"for",
"apk_path",
"in",
"_GetCandidateApks",
"(",
")",
"if",
"(",
"_GetApkPackageName",
"(",
"apk_path",
")",
"==",
"package_name",
")",
"]"
] | Find any APKs which match the package indicated by the device_apk_name. | [
"Find",
"any",
"APKs",
"which",
"match",
"the",
"package",
"indicated",
"by",
"the",
"device_apk_name",
"."
] | [
"\"\"\"Find any APKs which match the package indicated by the device_apk_name.\n\n Args:\n package_name: package name of the APK on the device.\n\n Returns:\n A list of APK filenames which could contain the desired library.\n \"\"\""
] | [
{
"param": "package_name",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of APK filenames which could contain the desired library.",
"docstring_tokens": [
"A",
"list",
"of",
"APK",
"filenames",
"which",
"could",
"contain",
"the",
"desired",
"library... |
f0a2dea8d44f17c0cf715ed136e81e59da2642aa | sunlongbo/chromium | third_party/android_platform/development/scripts/symbol.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MapDeviceApkToLibrary | <not_specific> | def MapDeviceApkToLibrary(device_apk_name):
"""Provide a library name which corresponds with device_apk_name.
Args:
device_apk_name: name of the APK on the device.
Returns:
Name of the library which corresponds to that APK.
"""
matching_apks = GetMatchingApks(device_apk_name)
logging.debug('MapDev... | Provide a library name which corresponds with device_apk_name.
Args:
device_apk_name: name of the APK on the device.
Returns:
Name of the library which corresponds to that APK.
| Provide a library name which corresponds with device_apk_name. | [
"Provide",
"a",
"library",
"name",
"which",
"corresponds",
"with",
"device_apk_name",
"."
] | def MapDeviceApkToLibrary(device_apk_name):
matching_apks = GetMatchingApks(device_apk_name)
logging.debug('MapDeviceApkToLibrary: matching_apks=%s' % matching_apks)
for matching_apk in matching_apks:
crazy_lib = GetCrazyLib(matching_apk)
if crazy_lib:
return crazy_lib
return None | [
"def",
"MapDeviceApkToLibrary",
"(",
"device_apk_name",
")",
":",
"matching_apks",
"=",
"GetMatchingApks",
"(",
"device_apk_name",
")",
"logging",
".",
"debug",
"(",
"'MapDeviceApkToLibrary: matching_apks=%s'",
"%",
"matching_apks",
")",
"for",
"matching_apk",
"in",
"ma... | Provide a library name which corresponds with device_apk_name. | [
"Provide",
"a",
"library",
"name",
"which",
"corresponds",
"with",
"device_apk_name",
"."
] | [
"\"\"\"Provide a library name which corresponds with device_apk_name.\n\n Args:\n device_apk_name: name of the APK on the device.\n\n Returns:\n Name of the library which corresponds to that APK.\n \"\"\""
] | [
{
"param": "device_apk_name",
"type": null
}
] | {
"returns": [
{
"docstring": "Name of the library which corresponds to that APK.",
"docstring_tokens": [
"Name",
"of",
"the",
"library",
"which",
"corresponds",
"to",
"that",
"APK",
"."
],
"type": null
}
... |
f0a2dea8d44f17c0cf715ed136e81e59da2642aa | sunlongbo/chromium | third_party/android_platform/development/scripts/symbol.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetLibrarySearchPaths | <not_specific> | def GetLibrarySearchPaths():
"""Return a list of directories where to find native shared libraries."""
if _SECONDARY_ABI_OUTPUT_PATH:
return _PathListJoin([_SECONDARY_ABI_OUTPUT_PATH], ['lib.unstripped', '.'])
if CHROME_SYMBOLS_DIR:
return [CHROME_SYMBOLS_DIR]
output_dir = constants.GetOutDirectory()
... | Return a list of directories where to find native shared libraries. | Return a list of directories where to find native shared libraries. | [
"Return",
"a",
"list",
"of",
"directories",
"where",
"to",
"find",
"native",
"shared",
"libraries",
"."
] | def GetLibrarySearchPaths():
if _SECONDARY_ABI_OUTPUT_PATH:
return _PathListJoin([_SECONDARY_ABI_OUTPUT_PATH], ['lib.unstripped', '.'])
if CHROME_SYMBOLS_DIR:
return [CHROME_SYMBOLS_DIR]
output_dir = constants.GetOutDirectory()
return _PathListJoin([output_dir], ['lib.unstripped', '.']) | [
"def",
"GetLibrarySearchPaths",
"(",
")",
":",
"if",
"_SECONDARY_ABI_OUTPUT_PATH",
":",
"return",
"_PathListJoin",
"(",
"[",
"_SECONDARY_ABI_OUTPUT_PATH",
"]",
",",
"[",
"'lib.unstripped'",
",",
"'.'",
"]",
")",
"if",
"CHROME_SYMBOLS_DIR",
":",
"return",
"[",
"CHR... | Return a list of directories where to find native shared libraries. | [
"Return",
"a",
"list",
"of",
"directories",
"where",
"to",
"find",
"native",
"shared",
"libraries",
"."
] | [
"\"\"\"Return a list of directories where to find native shared libraries.\"\"\"",
"# GN places stripped libraries under $CHROMIUM_OUTPUT_DIR and unstripped ones",
"# under $CHROMIUM_OUTPUT_OUT/lib.unstripped. Place the unstripped path before",
"# to get symbols from them when they exist."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
f0a2dea8d44f17c0cf715ed136e81e59da2642aa | sunlongbo/chromium | third_party/android_platform/development/scripts/symbol.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetCandidateLibraries | <not_specific> | def GetCandidateLibraries(library_name):
"""Returns a list of candidate library filenames.
Args:
library_name: basename of the library to match.
Returns:
A list of matching library filenames for library_name.
"""
def extant_library(filename):
if (os.path.exists(filename)
and elf_symboliz... | Returns a list of candidate library filenames.
Args:
library_name: basename of the library to match.
Returns:
A list of matching library filenames for library_name.
| Returns a list of candidate library filenames. | [
"Returns",
"a",
"list",
"of",
"candidate",
"library",
"filenames",
"."
] | def GetCandidateLibraries(library_name):
def extant_library(filename):
if (os.path.exists(filename)
and elf_symbolizer.ContainsElfMagic(filename)):
return [filename]
return []
candidates = GetCandidates(
GetLibrarySearchPaths(), library_name,
extant_library)
candidates.sort(key=l... | [
"def",
"GetCandidateLibraries",
"(",
"library_name",
")",
":",
"def",
"extant_library",
"(",
"filename",
")",
":",
"if",
"(",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
"and",
"elf_symbolizer",
".",
"ContainsElfMagic",
"(",
"filename",
")",
")",... | Returns a list of candidate library filenames. | [
"Returns",
"a",
"list",
"of",
"candidate",
"library",
"filenames",
"."
] | [
"\"\"\"Returns a list of candidate library filenames.\n\n Args:\n library_name: basename of the library to match.\n\n Returns:\n A list of matching library filenames for library_name.\n \"\"\"",
"# For GN, candidates includes both stripped an unstripped libraries. Stripped",
"# libraries are always new... | [
{
"param": "library_name",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of matching library filenames for library_name.",
"docstring_tokens": [
"A",
"list",
"of",
"matching",
"library",
"filenames",
"for",
"library_name",
"."
],
"type": null
}
],... |
f0a2dea8d44f17c0cf715ed136e81e59da2642aa | sunlongbo/chromium | third_party/android_platform/development/scripts/symbol.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SymbolInformationForSet | <not_specific> | def SymbolInformationForSet(lib, unique_addrs, get_detailed_info,
cpu_arch=ARCH):
"""Look up symbol information for a set of addresses from the given library.
Args:
lib: library (or executable) pathname containing symbols
unique_addrs: set of hexidecimal addresses
get_detail... | Look up symbol information for a set of addresses from the given library.
Args:
lib: library (or executable) pathname containing symbols
unique_addrs: set of hexidecimal addresses
get_detailed_info: If True, add additional info from objdump.
cpu_arch: Target CPU architecture.
Returns:
A dictio... | Look up symbol information for a set of addresses from the given library. | [
"Look",
"up",
"symbol",
"information",
"for",
"a",
"set",
"of",
"addresses",
"from",
"the",
"given",
"library",
"."
] | def SymbolInformationForSet(lib, unique_addrs, get_detailed_info,
cpu_arch=ARCH):
if not lib:
return None
addr_to_line = _CallAddr2LineForSet(lib, unique_addrs, cpu_arch)
if not addr_to_line:
return None
if get_detailed_info:
addr_to_objdump = _CallObjdumpForSet(lib, uniq... | [
"def",
"SymbolInformationForSet",
"(",
"lib",
",",
"unique_addrs",
",",
"get_detailed_info",
",",
"cpu_arch",
"=",
"ARCH",
")",
":",
"if",
"not",
"lib",
":",
"return",
"None",
"addr_to_line",
"=",
"_CallAddr2LineForSet",
"(",
"lib",
",",
"unique_addrs",
",",
"... | Look up symbol information for a set of addresses from the given library. | [
"Look",
"up",
"symbol",
"information",
"for",
"a",
"set",
"of",
"addresses",
"from",
"the",
"given",
"library",
"."
] | [
"\"\"\"Look up symbol information for a set of addresses from the given library.\n\n Args:\n lib: library (or executable) pathname containing symbols\n unique_addrs: set of hexidecimal addresses\n get_detailed_info: If True, add additional info from objdump.\n cpu_arch: Target CPU architecture.\n\n Re... | [
{
"param": "lib",
"type": null
},
{
"param": "unique_addrs",
"type": null
},
{
"param": "get_detailed_info",
"type": null
},
{
"param": "cpu_arch",
"type": null
}
] | {
"returns": [
{
"docstring": "A dictionary of the form {addr: [(source_symbol, source_location,\nobject_symbol_with_offset)]} where each address has a list of\nassociated symbols and locations. The list is always non-empty.\n\nIf the function has been inlined then the list may contain\nmore than one eleme... |
f0a2dea8d44f17c0cf715ed136e81e59da2642aa | sunlongbo/chromium | third_party/android_platform/development/scripts/symbol.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CallAddr2LineForSet | <not_specific> | def _CallAddr2LineForSet(lib, unique_addrs, cpu_arch):
"""Look up line and symbol information for a set of addresses.
Args:
lib: library (or executable) pathname containing symbols
unique_addrs: set of string hexidecimal addresses look up.
cpu_arch: Target CPU architecture.
Returns:
A dictionary... | Look up line and symbol information for a set of addresses.
Args:
lib: library (or executable) pathname containing symbols
unique_addrs: set of string hexidecimal addresses look up.
cpu_arch: Target CPU architecture.
Returns:
A dictionary of the form {addr: [(symbol, file:line)]} where
each ad... | Look up line and symbol information for a set of addresses. | [
"Look",
"up",
"line",
"and",
"symbol",
"information",
"for",
"a",
"set",
"of",
"addresses",
"."
] | def _CallAddr2LineForSet(lib, unique_addrs, cpu_arch):
if not lib:
return None
symbols = SYMBOLS_DIR + lib
if not os.path.splitext(symbols)[1] in ['', '.so', '.apk']:
return None
if not os.path.isfile(symbols):
return None
addrs = sorted(unique_addrs)
result = {}
def _Callback(sym, addr):
... | [
"def",
"_CallAddr2LineForSet",
"(",
"lib",
",",
"unique_addrs",
",",
"cpu_arch",
")",
":",
"if",
"not",
"lib",
":",
"return",
"None",
"symbols",
"=",
"SYMBOLS_DIR",
"+",
"lib",
"if",
"not",
"os",
".",
"path",
".",
"splitext",
"(",
"symbols",
")",
"[",
... | Look up line and symbol information for a set of addresses. | [
"Look",
"up",
"line",
"and",
"symbol",
"information",
"for",
"a",
"set",
"of",
"addresses",
"."
] | [
"\"\"\"Look up line and symbol information for a set of addresses.\n\n Args:\n lib: library (or executable) pathname containing symbols\n unique_addrs: set of string hexidecimal addresses look up.\n cpu_arch: Target CPU architecture.\n\n Returns:\n A dictionary of the form {addr: [(symbol, file:line)]... | [
{
"param": "lib",
"type": null
},
{
"param": "unique_addrs",
"type": null
},
{
"param": "cpu_arch",
"type": null
}
] | {
"returns": [
{
"docstring": "A dictionary of the form {addr: [(symbol, file:line)]} where\neach address has a list of associated symbols and locations\nor an empty list if no symbol information was found.\n\nIf the function has been inlined then the list may contain\nmore than one element with the symbols... |
f0a2dea8d44f17c0cf715ed136e81e59da2642aa | sunlongbo/chromium | third_party/android_platform/development/scripts/symbol.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _StripPC | <not_specific> | def _StripPC(addr, cpu_arch):
"""Strips the Thumb bit a program counter address when appropriate.
Args:
addr: the program counter address
cpu_arch: Target CPU architecture.
Returns:
The stripped program counter address.
"""
if cpu_arch == "arm":
return addr & ~1
return addr | Strips the Thumb bit a program counter address when appropriate.
Args:
addr: the program counter address
cpu_arch: Target CPU architecture.
Returns:
The stripped program counter address.
| Strips the Thumb bit a program counter address when appropriate. | [
"Strips",
"the",
"Thumb",
"bit",
"a",
"program",
"counter",
"address",
"when",
"appropriate",
"."
] | def _StripPC(addr, cpu_arch):
if cpu_arch == "arm":
return addr & ~1
return addr | [
"def",
"_StripPC",
"(",
"addr",
",",
"cpu_arch",
")",
":",
"if",
"cpu_arch",
"==",
"\"arm\"",
":",
"return",
"addr",
"&",
"~",
"1",
"return",
"addr"
] | Strips the Thumb bit a program counter address when appropriate. | [
"Strips",
"the",
"Thumb",
"bit",
"a",
"program",
"counter",
"address",
"when",
"appropriate",
"."
] | [
"\"\"\"Strips the Thumb bit a program counter address when appropriate.\n\n Args:\n addr: the program counter address\n cpu_arch: Target CPU architecture.\n\n Returns:\n The stripped program counter address.\n \"\"\""
] | [
{
"param": "addr",
"type": null
},
{
"param": "cpu_arch",
"type": null
}
] | {
"returns": [
{
"docstring": "The stripped program counter address.",
"docstring_tokens": [
"The",
"stripped",
"program",
"counter",
"address",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "addr",
... |
f0a2dea8d44f17c0cf715ed136e81e59da2642aa | sunlongbo/chromium | third_party/android_platform/development/scripts/symbol.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CallObjdumpForSet | <not_specific> | def _CallObjdumpForSet(lib, unique_addrs, cpu_arch):
"""Use objdump to find out the names of the containing functions.
Args:
lib: library (or executable) pathname containing symbols
unique_addrs: set of string hexidecimal addresses to find the functions for.
cpu_arch: Target CPU architecture.
Return... | Use objdump to find out the names of the containing functions.
Args:
lib: library (or executable) pathname containing symbols
unique_addrs: set of string hexidecimal addresses to find the functions for.
cpu_arch: Target CPU architecture.
Returns:
A dictionary of the form {addr: (string symbol, off... | Use objdump to find out the names of the containing functions. | [
"Use",
"objdump",
"to",
"find",
"out",
"the",
"names",
"of",
"the",
"containing",
"functions",
"."
] | def _CallObjdumpForSet(lib, unique_addrs, cpu_arch):
if not lib:
return None
symbols = SYMBOLS_DIR + lib
if not os.path.exists(symbols):
return None
symbols = SYMBOLS_DIR + lib
if not os.path.exists(symbols):
return None
result = {}
func_regexp = re.compile("(^[a-f0-9]*) \<(.*)\>:$")
offset_... | [
"def",
"_CallObjdumpForSet",
"(",
"lib",
",",
"unique_addrs",
",",
"cpu_arch",
")",
":",
"if",
"not",
"lib",
":",
"return",
"None",
"symbols",
"=",
"SYMBOLS_DIR",
"+",
"lib",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"symbols",
")",
":",
"ret... | Use objdump to find out the names of the containing functions. | [
"Use",
"objdump",
"to",
"find",
"out",
"the",
"names",
"of",
"the",
"containing",
"functions",
"."
] | [
"\"\"\"Use objdump to find out the names of the containing functions.\n\n Args:\n lib: library (or executable) pathname containing symbols\n unique_addrs: set of string hexidecimal addresses to find the functions for.\n cpu_arch: Target CPU architecture.\n\n Returns:\n A dictionary of the form {addr: ... | [
{
"param": "lib",
"type": null
},
{
"param": "unique_addrs",
"type": null
},
{
"param": "cpu_arch",
"type": null
}
] | {
"returns": [
{
"docstring": "A dictionary of the form {addr: (string symbol, offset)}.",
"docstring_tokens": [
"A",
"dictionary",
"of",
"the",
"form",
"{",
"addr",
":",
"(",
"string",
"symbol",
"offset",
... |
2b88f453058c8af71b2b46bfd25b2a08ce175c6f | sunlongbo/chromium | ios/build/tools/convert_gn_xcodeproj.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | LoadSchemeTemplate | <not_specific> | def LoadSchemeTemplate(root):
"""Return a string.Template object for scheme file loaded relative to root."""
path = os.path.join(root, 'ios', 'build', 'tools', 'xcodescheme.template')
with open(path) as file:
return Template(file.read()) | Return a string.Template object for scheme file loaded relative to root. | Return a string.Template object for scheme file loaded relative to root. | [
"Return",
"a",
"string",
".",
"Template",
"object",
"for",
"scheme",
"file",
"loaded",
"relative",
"to",
"root",
"."
] | def LoadSchemeTemplate(root):
path = os.path.join(root, 'ios', 'build', 'tools', 'xcodescheme.template')
with open(path) as file:
return Template(file.read()) | [
"def",
"LoadSchemeTemplate",
"(",
"root",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"'ios'",
",",
"'build'",
",",
"'tools'",
",",
"'xcodescheme.template'",
")",
"with",
"open",
"(",
"path",
")",
"as",
"file",
":",
"return... | Return a string.Template object for scheme file loaded relative to root. | [
"Return",
"a",
"string",
".",
"Template",
"object",
"for",
"scheme",
"file",
"loaded",
"relative",
"to",
"root",
"."
] | [
"\"\"\"Return a string.Template object for scheme file loaded relative to root.\"\"\""
] | [
{
"param": "root",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "root",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2b88f453058c8af71b2b46bfd25b2a08ce175c6f | sunlongbo/chromium | ios/build/tools/convert_gn_xcodeproj.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GenerateSchemeForTarget | null | def GenerateSchemeForTarget(project, old_project, name, product_name, template):
"""Generates the .xcsheme file for target named |name|.
The file is generated in the new project schemes directory from a template.
If there is an existing previous project, then the old scheme file is copied
and the lldbinit sett... | Generates the .xcsheme file for target named |name|.
The file is generated in the new project schemes directory from a template.
If there is an existing previous project, then the old scheme file is copied
and the lldbinit setting is set. If lldbinit setting is already correct, the
file is not modified, just c... | Generates the .xcsheme file for target named |name|.
The file is generated in the new project schemes directory from a template.
If there is an existing previous project, then the old scheme file is copied
and the lldbinit setting is set. If lldbinit setting is already correct, the
file is not modified, just copied. | [
"Generates",
"the",
".",
"xcsheme",
"file",
"for",
"target",
"named",
"|name|",
".",
"The",
"file",
"is",
"generated",
"in",
"the",
"new",
"project",
"schemes",
"directory",
"from",
"a",
"template",
".",
"If",
"there",
"is",
"an",
"existing",
"previous",
"... | def GenerateSchemeForTarget(project, old_project, name, product_name, template):
relative_path = os.path.join('xcshareddata', 'xcschemes', name + '.xcscheme')
identifier = CreateIdentifier('%s %s' % (name, product_name))
scheme_path = os.path.join(project, relative_path)
if not os.path.isdir(os.path.dirname(sch... | [
"def",
"GenerateSchemeForTarget",
"(",
"project",
",",
"old_project",
",",
"name",
",",
"product_name",
",",
"template",
")",
":",
"relative_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"'xcshareddata'",
",",
"'xcschemes'",
",",
"name",
"+",
"'.xcscheme'",... | Generates the .xcsheme file for target named |name|. | [
"Generates",
"the",
".",
"xcsheme",
"file",
"for",
"target",
"named",
"|name|",
"."
] | [
"\"\"\"Generates the .xcsheme file for target named |name|.\n\n The file is generated in the new project schemes directory from a template.\n If there is an existing previous project, then the old scheme file is copied\n and the lldbinit setting is set. If lldbinit setting is already correct, the\n file is not ... | [
{
"param": "project",
"type": null
},
{
"param": "old_project",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "product_name",
"type": null
},
{
"param": "template",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "project",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "old_project",
"type": null,
"docstring": null,
"docstring_... |
2b88f453058c8af71b2b46bfd25b2a08ce175c6f | sunlongbo/chromium | ios/build/tools/convert_gn_xcodeproj.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | UpdateXcodeProject | null | def UpdateXcodeProject(project_dir, old_project_dir, configurations, root_dir):
"""Update inplace Xcode project to support multiple configurations.
Args:
project_dir: path to the input Xcode project
configurations: list of string corresponding to the configurations that
need to be supported by the tw... | Update inplace Xcode project to support multiple configurations.
Args:
project_dir: path to the input Xcode project
configurations: list of string corresponding to the configurations that
need to be supported by the tweaked Xcode projects, must contains at
least one value.
root_dir: path to t... | Update inplace Xcode project to support multiple configurations. | [
"Update",
"inplace",
"Xcode",
"project",
"to",
"support",
"multiple",
"configurations",
"."
] | def UpdateXcodeProject(project_dir, old_project_dir, configurations, root_dir):
json_data = json.loads(LoadXcodeProjectAsJSON(project_dir))
project = XcodeProject(json_data['objects'])
schemes_template = None
objects_to_remove = []
for value in list(project.objects.values()):
isa = value['isa']
if isa... | [
"def",
"UpdateXcodeProject",
"(",
"project_dir",
",",
"old_project_dir",
",",
"configurations",
",",
"root_dir",
")",
":",
"json_data",
"=",
"json",
".",
"loads",
"(",
"LoadXcodeProjectAsJSON",
"(",
"project_dir",
")",
")",
"project",
"=",
"XcodeProject",
"(",
"... | Update inplace Xcode project to support multiple configurations. | [
"Update",
"inplace",
"Xcode",
"project",
"to",
"support",
"multiple",
"configurations",
"."
] | [
"\"\"\"Update inplace Xcode project to support multiple configurations.\n\n Args:\n project_dir: path to the input Xcode project\n configurations: list of string corresponding to the configurations that\n need to be supported by the tweaked Xcode projects, must contains at\n least one value.\n r... | [
{
"param": "project_dir",
"type": null
},
{
"param": "old_project_dir",
"type": null
},
{
"param": "configurations",
"type": null
},
{
"param": "root_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "project_dir",
"type": null,
"docstring": "path to the input Xcode project",
"docstring_tokens": [
"path",
"to",
"the",
"input",
"Xcode",
"project"
],
"default": null,... |
aed2b667204d7ce63a4307e7389ae7029e202bd3 | sunlongbo/chromium | tools/metrics/ukm/xml_validations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _isMetricValidAsIndexField | <not_specific> | def _isMetricValidAsIndexField(metric_node):
"""Checks if a given metric node can be used as a field in an index tag.
Has the following requirements:
* 'history' is the only aggregation target (no others are considered)
* there will be at most 1 'aggregation', 1 'history', and 1 'statistic'
element i... | Checks if a given metric node can be used as a field in an index tag.
Has the following requirements:
* 'history' is the only aggregation target (no others are considered)
* there will be at most 1 'aggregation', 1 'history', and 1 'statistic'
element in a metric element
* enumerations are the only... | Checks if a given metric node can be used as a field in an index tag. | [
"Checks",
"if",
"a",
"given",
"metric",
"node",
"can",
"be",
"used",
"as",
"a",
"field",
"in",
"an",
"index",
"tag",
"."
] | def _isMetricValidAsIndexField(metric_node):
aggregation_nodes = metric_node.getElementsByTagName('aggregation')
if aggregation_nodes.length != 1:
return False
history_nodes = aggregation_nodes[0].getElementsByTagName('history')
if history_nodes.length != 1:
return False
statistic_nodes = history_node... | [
"def",
"_isMetricValidAsIndexField",
"(",
"metric_node",
")",
":",
"aggregation_nodes",
"=",
"metric_node",
".",
"getElementsByTagName",
"(",
"'aggregation'",
")",
"if",
"aggregation_nodes",
".",
"length",
"!=",
"1",
":",
"return",
"False",
"history_nodes",
"=",
"ag... | Checks if a given metric node can be used as a field in an index tag. | [
"Checks",
"if",
"a",
"given",
"metric",
"node",
"can",
"be",
"used",
"as",
"a",
"field",
"in",
"an",
"index",
"tag",
"."
] | [
"\"\"\"Checks if a given metric node can be used as a field in an index tag.\n\n Has the following requirements:\n * 'history' is the only aggregation target (no others are considered)\n * there will be at most 1 'aggregation', 1 'history', and 1 'statistic'\n element in a metric element\n * enumerat... | [
{
"param": "metric_node",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "metric_node",
"type": null,
"docstring": "A metric node to check.",
"docstring_tokens": [
"A",
"metric",
"node",
"to",
"check",
"."
],
"default": null,
"is_opti... |
aed2b667204d7ce63a4307e7389ae7029e202bd3 | sunlongbo/chromium | tools/metrics/ukm/xml_validations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _getIndexFields | <not_specific> | def _getIndexFields(metric_node):
"""Get a list of fields from index node descendents of a metric_node."""
aggregation_nodes = metric_node.getElementsByTagName('aggregation')
if not aggregation_nodes:
return []
history_nodes = aggregation_nodes[0].getElementsByTagName('history')
if not history_nodes:
... | Get a list of fields from index node descendents of a metric_node. | Get a list of fields from index node descendents of a metric_node. | [
"Get",
"a",
"list",
"of",
"fields",
"from",
"index",
"node",
"descendents",
"of",
"a",
"metric_node",
"."
] | def _getIndexFields(metric_node):
aggregation_nodes = metric_node.getElementsByTagName('aggregation')
if not aggregation_nodes:
return []
history_nodes = aggregation_nodes[0].getElementsByTagName('history')
if not history_nodes:
return []
index_nodes = history_nodes[0].getElementsByTagName('index')
... | [
"def",
"_getIndexFields",
"(",
"metric_node",
")",
":",
"aggregation_nodes",
"=",
"metric_node",
".",
"getElementsByTagName",
"(",
"'aggregation'",
")",
"if",
"not",
"aggregation_nodes",
":",
"return",
"[",
"]",
"history_nodes",
"=",
"aggregation_nodes",
"[",
"0",
... | Get a list of fields from index node descendents of a metric_node. | [
"Get",
"a",
"list",
"of",
"fields",
"from",
"index",
"node",
"descendents",
"of",
"a",
"metric_node",
"."
] | [
"\"\"\"Get a list of fields from index node descendents of a metric_node.\"\"\""
] | [
{
"param": "metric_node",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "metric_node",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
aed2b667204d7ce63a4307e7389ae7029e202bd3 | sunlongbo/chromium | tools/metrics/ukm/xml_validations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _getLocalMetricIndexFields | <not_specific> | def _getLocalMetricIndexFields(metric_node):
"""Gets a set of metric names being used as local-metric index fields."""
index_fields = _getIndexFields(metric_node)
local_metric_fields = set()
for fields in index_fields:
local_metric_fields.update(LOCAL_METRIC_RE.findall(fields))
return local_metric_fields | Gets a set of metric names being used as local-metric index fields. | Gets a set of metric names being used as local-metric index fields. | [
"Gets",
"a",
"set",
"of",
"metric",
"names",
"being",
"used",
"as",
"local",
"-",
"metric",
"index",
"fields",
"."
] | def _getLocalMetricIndexFields(metric_node):
index_fields = _getIndexFields(metric_node)
local_metric_fields = set()
for fields in index_fields:
local_metric_fields.update(LOCAL_METRIC_RE.findall(fields))
return local_metric_fields | [
"def",
"_getLocalMetricIndexFields",
"(",
"metric_node",
")",
":",
"index_fields",
"=",
"_getIndexFields",
"(",
"metric_node",
")",
"local_metric_fields",
"=",
"set",
"(",
")",
"for",
"fields",
"in",
"index_fields",
":",
"local_metric_fields",
".",
"update",
"(",
... | Gets a set of metric names being used as local-metric index fields. | [
"Gets",
"a",
"set",
"of",
"metric",
"names",
"being",
"used",
"as",
"local",
"-",
"metric",
"index",
"fields",
"."
] | [
"\"\"\"Gets a set of metric names being used as local-metric index fields.\"\"\""
] | [
{
"param": "metric_node",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "metric_node",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
aed2b667204d7ce63a4307e7389ae7029e202bd3 | sunlongbo/chromium | tools/metrics/ukm/xml_validations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | checkEventsHaveOwners | <not_specific> | def checkEventsHaveOwners(self):
"""Check that every event in the config has at least one owner."""
errors = []
for event_node in self.config.getElementsByTagName('event'):
event_name = event_node.getAttribute('name')
owner_nodes = event_node.getElementsByTagName('owner')
# Check <owner>... | Check that every event in the config has at least one owner. | Check that every event in the config has at least one owner. | [
"Check",
"that",
"every",
"event",
"in",
"the",
"config",
"has",
"at",
"least",
"one",
"owner",
"."
] | def checkEventsHaveOwners(self):
errors = []
for event_node in self.config.getElementsByTagName('event'):
event_name = event_node.getAttribute('name')
owner_nodes = event_node.getElementsByTagName('owner')
if not owner_nodes:
errors.append("<owner> tag is required for event '%s'." % ev... | [
"def",
"checkEventsHaveOwners",
"(",
"self",
")",
":",
"errors",
"=",
"[",
"]",
"for",
"event_node",
"in",
"self",
".",
"config",
".",
"getElementsByTagName",
"(",
"'event'",
")",
":",
"event_name",
"=",
"event_node",
".",
"getAttribute",
"(",
"'name'",
")",... | Check that every event in the config has at least one owner. | [
"Check",
"that",
"every",
"event",
"in",
"the",
"config",
"has",
"at",
"least",
"one",
"owner",
"."
] | [
"\"\"\"Check that every event in the config has at least one owner.\"\"\"",
"# Check <owner> tag is present for each event.",
"# Check <owner> tag actually has some content.",
"# Check <owner> tag's content is an email address, not a username."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
aed2b667204d7ce63a4307e7389ae7029e202bd3 | sunlongbo/chromium | tools/metrics/ukm/xml_validations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | checkMetricTypeIsSpecified | <not_specific> | def checkMetricTypeIsSpecified(self):
"""Check each metric is either specified with an enum or a unit."""
errors = []
warnings = []
enum_tree = merge_xml.MergeFiles([histogram_paths.ENUMS_XML])
enums, _ = extract_histograms.ExtractEnumsFromXmlTree(enum_tree)
for event_node in self.config.getEl... | Check each metric is either specified with an enum or a unit. | Check each metric is either specified with an enum or a unit. | [
"Check",
"each",
"metric",
"is",
"either",
"specified",
"with",
"an",
"enum",
"or",
"a",
"unit",
"."
] | def checkMetricTypeIsSpecified(self):
errors = []
warnings = []
enum_tree = merge_xml.MergeFiles([histogram_paths.ENUMS_XML])
enums, _ = extract_histograms.ExtractEnumsFromXmlTree(enum_tree)
for event_node in self.config.getElementsByTagName('event'):
for metric_node in event_node.getElementsB... | [
"def",
"checkMetricTypeIsSpecified",
"(",
"self",
")",
":",
"errors",
"=",
"[",
"]",
"warnings",
"=",
"[",
"]",
"enum_tree",
"=",
"merge_xml",
".",
"MergeFiles",
"(",
"[",
"histogram_paths",
".",
"ENUMS_XML",
"]",
")",
"enums",
",",
"_",
"=",
"extract_hist... | Check each metric is either specified with an enum or a unit. | [
"Check",
"each",
"metric",
"is",
"either",
"specified",
"with",
"an",
"enum",
"or",
"a",
"unit",
"."
] | [
"\"\"\"Check each metric is either specified with an enum or a unit.\"\"\"",
"# Check if the enum is defined in enums.xml."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
aed2b667204d7ce63a4307e7389ae7029e202bd3 | sunlongbo/chromium | tools/metrics/ukm/xml_validations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | checkLocalMetricIsAggregated | <not_specific> | def checkLocalMetricIsAggregated(self):
"""Checks that index fields don't list invalid metrics."""
errors = []
for event_node in self.config.getElementsByTagName('event'):
metric_nodes = event_node.getElementsByTagName('metric')
valid_index_field_metrics = {node.getAttribute('name')
... | Checks that index fields don't list invalid metrics. | Checks that index fields don't list invalid metrics. | [
"Checks",
"that",
"index",
"fields",
"don",
"'",
"t",
"list",
"invalid",
"metrics",
"."
] | def checkLocalMetricIsAggregated(self):
errors = []
for event_node in self.config.getElementsByTagName('event'):
metric_nodes = event_node.getElementsByTagName('metric')
valid_index_field_metrics = {node.getAttribute('name')
for node in metric_nodes
... | [
"def",
"checkLocalMetricIsAggregated",
"(",
"self",
")",
":",
"errors",
"=",
"[",
"]",
"for",
"event_node",
"in",
"self",
".",
"config",
".",
"getElementsByTagName",
"(",
"'event'",
")",
":",
"metric_nodes",
"=",
"event_node",
".",
"getElementsByTagName",
"(",
... | Checks that index fields don't list invalid metrics. | [
"Checks",
"that",
"index",
"fields",
"don",
"'",
"t",
"list",
"invalid",
"metrics",
"."
] | [
"\"\"\"Checks that index fields don't list invalid metrics.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
aed38638de8e89772b9250e9907ad0ccb9827345 | sunlongbo/chromium | tools/yes_no.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | YesNo | <not_specific> | def YesNo(prompt):
"""Prompts with a yes/no question, returns True if yes."""
print(prompt, end=' ')
sys.stdout.flush()
# http://code.activestate.com/recipes/134892/
if sys.platform == 'win32':
import msvcrt
ch = msvcrt.getch()
else:
import termios
import tty
fd = sys.stdin.fileno()
... | Prompts with a yes/no question, returns True if yes. | Prompts with a yes/no question, returns True if yes. | [
"Prompts",
"with",
"a",
"yes",
"/",
"no",
"question",
"returns",
"True",
"if",
"yes",
"."
] | def YesNo(prompt):
print(prompt, end=' ')
sys.stdout.flush()
if sys.platform == 'win32':
import msvcrt
ch = msvcrt.getch()
else:
import termios
import tty
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
ch = 'n'
try:
tty.setraw(sys.stdin.fileno())
ch = sy... | [
"def",
"YesNo",
"(",
"prompt",
")",
":",
"print",
"(",
"prompt",
",",
"end",
"=",
"' '",
")",
"sys",
".",
"stdout",
".",
"flush",
"(",
")",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"import",
"msvcrt",
"ch",
"=",
"msvcrt",
".",
"getch",
... | Prompts with a yes/no question, returns True if yes. | [
"Prompts",
"with",
"a",
"yes",
"/",
"no",
"question",
"returns",
"True",
"if",
"yes",
"."
] | [
"\"\"\"Prompts with a yes/no question, returns True if yes.\"\"\"",
"# http://code.activestate.com/recipes/134892/"
] | [
{
"param": "prompt",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "prompt",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
aed91fc561879b7d35e8874493b93bbac407c925 | sunlongbo/chromium | tools/variations/split_variations_cmd_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CompareCommandLineSwitches | <not_specific> | def _CompareCommandLineSwitches(self, filename, cmd_list):
"""Compares two sets of command line switches.
Args:
filename: Name to a file that contains a set of commandline switches.
cmd_list: A list of strings in the form of '--switch_name=switch_value'.
Return True if they contain the sam... | Compares two sets of command line switches.
Args:
filename: Name to a file that contains a set of commandline switches.
cmd_list: A list of strings in the form of '--switch_name=switch_value'.
Return True if they contain the same switches and each switch's values
are the same.
| Compares two sets of command line switches. | [
"Compares",
"two",
"sets",
"of",
"command",
"line",
"switches",
"."
] | def _CompareCommandLineSwitches(self, filename, cmd_list):
assert os.path.isfile(filename)
data = None
with open(filename, 'r') as f:
data = f.read().replace('\n', ' ')
switches = split_variations_cmd.ParseCommandLineSwitchesString(data)
if len(switches) != len(cmd_list):
return False
... | [
"def",
"_CompareCommandLineSwitches",
"(",
"self",
",",
"filename",
",",
"cmd_list",
")",
":",
"assert",
"os",
".",
"path",
".",
"isfile",
"(",
"filename",
")",
"data",
"=",
"None",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"f",
":",
"dat... | Compares two sets of command line switches. | [
"Compares",
"two",
"sets",
"of",
"command",
"line",
"switches",
"."
] | [
"\"\"\"Compares two sets of command line switches.\n\n Args:\n filename: Name to a file that contains a set of commandline switches.\n cmd_list: A list of strings in the form of '--switch_name=switch_value'.\n\n Return True if they contain the same switches and each switch's values\n are the ... | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
},
{
"param": "cmd_list",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": "Name to a file that contains... |
aed91fc561879b7d35e8874493b93bbac407c925 | sunlongbo/chromium | tools/variations/split_variations_cmd_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _VerifySplits | <not_specific> | def _VerifySplits(self, switch_name, splits, ref_switch_data):
"""Verifies splitting commandline switches works correctly.
Compare that when we combine switch data from all |splits| into one,
it's exactly the same as the |ref_switch_data|. Also check the splits are
almost evenly distributed, that is, t... | Verifies splitting commandline switches works correctly.
Compare that when we combine switch data from all |splits| into one,
it's exactly the same as the |ref_switch_data|. Also check the splits are
almost evenly distributed, that is, their data size are almost the same.
Args:
switch_name: Th... | Verifies splitting commandline switches works correctly.
Compare that when we combine switch data from all |splits| into one,
it's exactly the same as the |ref_switch_data|. Also check the splits are
almost evenly distributed, that is, their data size are almost the same. | [
"Verifies",
"splitting",
"commandline",
"switches",
"works",
"correctly",
".",
"Compare",
"that",
"when",
"we",
"combine",
"switch",
"data",
"from",
"all",
"|splits|",
"into",
"one",
"it",
"'",
"s",
"exactly",
"the",
"same",
"as",
"the",
"|ref_switch_data|",
"... | def _VerifySplits(self, switch_name, splits, ref_switch_data):
data_lists = [
split[switch_name] for split in splits if switch_name in split]
if len(data_lists) == 0:
self.assertFalse(ref_switch_data)
return
max_size = max(len(data) for data in data_lists)
min_size = min(len(data) fo... | [
"def",
"_VerifySplits",
"(",
"self",
",",
"switch_name",
",",
"splits",
",",
"ref_switch_data",
")",
":",
"data_lists",
"=",
"[",
"split",
"[",
"switch_name",
"]",
"for",
"split",
"in",
"splits",
"if",
"switch_name",
"in",
"split",
"]",
"if",
"len",
"(",
... | Verifies splitting commandline switches works correctly. | [
"Verifies",
"splitting",
"commandline",
"switches",
"works",
"correctly",
"."
] | [
"\"\"\"Verifies splitting commandline switches works correctly.\n\n Compare that when we combine switch data from all |splits| into one,\n it's exactly the same as the |ref_switch_data|. Also check the splits are\n almost evenly distributed, that is, their data size are almost the same.\n\n Args:\n ... | [
{
"param": "self",
"type": null
},
{
"param": "switch_name",
"type": null
},
{
"param": "splits",
"type": null
},
{
"param": "ref_switch_data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "switch_name",
"type": null,
"docstring": "The name of the switch th... |
cb2b4ddd2bc1ac72d16d9b76f17871596f11805c | sunlongbo/chromium | tools/code_coverage/coverage_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RecursiveDirectoryListing | <not_specific> | def _RecursiveDirectoryListing(dirpath):
"""Returns a list of relative paths to all files in a given directory."""
result = []
for root, _, files in os.walk(dirpath):
for f in files:
result.append(os.path.relpath(os.path.join(root, f), dirpath))
return result | Returns a list of relative paths to all files in a given directory. | Returns a list of relative paths to all files in a given directory. | [
"Returns",
"a",
"list",
"of",
"relative",
"paths",
"to",
"all",
"files",
"in",
"a",
"given",
"directory",
"."
] | def _RecursiveDirectoryListing(dirpath):
result = []
for root, _, files in os.walk(dirpath):
for f in files:
result.append(os.path.relpath(os.path.join(root, f), dirpath))
return result | [
"def",
"_RecursiveDirectoryListing",
"(",
"dirpath",
")",
":",
"result",
"=",
"[",
"]",
"for",
"root",
",",
"_",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"dirpath",
")",
":",
"for",
"f",
"in",
"files",
":",
"result",
".",
"append",
"(",
"os",
".... | Returns a list of relative paths to all files in a given directory. | [
"Returns",
"a",
"list",
"of",
"relative",
"paths",
"to",
"all",
"files",
"in",
"a",
"given",
"directory",
"."
] | [
"\"\"\"Returns a list of relative paths to all files in a given directory.\"\"\""
] | [
{
"param": "dirpath",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dirpath",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb2b4ddd2bc1ac72d16d9b76f17871596f11805c | sunlongbo/chromium | tools/code_coverage/coverage_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | verify_component_view | null | def verify_component_view(self, filepath):
"""Asserts that a given component view looks correct."""
# There must be several Blink and Internals components.
with open(filepath) as f:
data = f.read()
counts = data.count('Blink') + data.count('Internals')
self.assertGreater(counts, 5) | Asserts that a given component view looks correct. | Asserts that a given component view looks correct. | [
"Asserts",
"that",
"a",
"given",
"component",
"view",
"looks",
"correct",
"."
] | def verify_component_view(self, filepath):
with open(filepath) as f:
data = f.read()
counts = data.count('Blink') + data.count('Internals')
self.assertGreater(counts, 5) | [
"def",
"verify_component_view",
"(",
"self",
",",
"filepath",
")",
":",
"with",
"open",
"(",
"filepath",
")",
"as",
"f",
":",
"data",
"=",
"f",
".",
"read",
"(",
")",
"counts",
"=",
"data",
".",
"count",
"(",
"'Blink'",
")",
"+",
"data",
".",
"coun... | Asserts that a given component view looks correct. | [
"Asserts",
"that",
"a",
"given",
"component",
"view",
"looks",
"correct",
"."
] | [
"\"\"\"Asserts that a given component view looks correct.\"\"\"",
"# There must be several Blink and Internals components."
] | [
{
"param": "self",
"type": null
},
{
"param": "filepath",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filepath",
"type": null,
"docstring": null,
"docstring_tokens... |
cb2b4ddd2bc1ac72d16d9b76f17871596f11805c | sunlongbo/chromium | tools/code_coverage/coverage_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | verify_directory_view | null | def verify_directory_view(self, filepath):
"""Asserts that a given directory view looks correct."""
# Directory view page does a redirect to another page, extract its URL.
with open(filepath) as f:
data = f.read()
url = re.search(r'.*refresh.*url=([a-zA-Z0-9_\-\/.]+).*', data).group(1)
direct... | Asserts that a given directory view looks correct. | Asserts that a given directory view looks correct. | [
"Asserts",
"that",
"a",
"given",
"directory",
"view",
"looks",
"correct",
"."
] | def verify_directory_view(self, filepath):
with open(filepath) as f:
data = f.read()
url = re.search(r'.*refresh.*url=([a-zA-Z0-9_\-\/.]+).*', data).group(1)
directory_view_path = os.path.join(os.path.dirname(filepath), url)
with open(directory_view_path) as f:
data = f.read()
self.asser... | [
"def",
"verify_directory_view",
"(",
"self",
",",
"filepath",
")",
":",
"with",
"open",
"(",
"filepath",
")",
"as",
"f",
":",
"data",
"=",
"f",
".",
"read",
"(",
")",
"url",
"=",
"re",
".",
"search",
"(",
"r'.*refresh.*url=([a-zA-Z0-9_\\-\\/.]+).*'",
",",
... | Asserts that a given directory view looks correct. | [
"Asserts",
"that",
"a",
"given",
"directory",
"view",
"looks",
"correct",
"."
] | [
"\"\"\"Asserts that a given directory view looks correct.\"\"\"",
"# Directory view page does a redirect to another page, extract its URL.",
"# There must be at least 'crypto' and 'third_party' directories."
] | [
{
"param": "self",
"type": null
},
{
"param": "filepath",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filepath",
"type": null,
"docstring": null,
"docstring_tokens... |
cb2b4ddd2bc1ac72d16d9b76f17871596f11805c | sunlongbo/chromium | tools/code_coverage/coverage_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | verify_file_view | null | def verify_file_view(self, filepath):
"""Asserts that a given file view looks correct."""
# There must be hundreds of '.*crypto.*' files and 10+ of '.*libpng.*'.
with open(filepath) as f:
data = f.read()
self.assertGreater(data.count('crypto'), 100)
self.assertGreater(data.count('libpng'), 10... | Asserts that a given file view looks correct. | Asserts that a given file view looks correct. | [
"Asserts",
"that",
"a",
"given",
"file",
"view",
"looks",
"correct",
"."
] | def verify_file_view(self, filepath):
with open(filepath) as f:
data = f.read()
self.assertGreater(data.count('crypto'), 100)
self.assertGreater(data.count('libpng'), 10) | [
"def",
"verify_file_view",
"(",
"self",
",",
"filepath",
")",
":",
"with",
"open",
"(",
"filepath",
")",
"as",
"f",
":",
"data",
"=",
"f",
".",
"read",
"(",
")",
"self",
".",
"assertGreater",
"(",
"data",
".",
"count",
"(",
"'crypto'",
")",
",",
"1... | Asserts that a given file view looks correct. | [
"Asserts",
"that",
"a",
"given",
"file",
"view",
"looks",
"correct",
"."
] | [
"\"\"\"Asserts that a given file view looks correct.\"\"\"",
"# There must be hundreds of '.*crypto.*' files and 10+ of '.*libpng.*'."
] | [
{
"param": "self",
"type": null
},
{
"param": "filepath",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filepath",
"type": null,
"docstring": null,
"docstring_tokens... |
cb2b4ddd2bc1ac72d16d9b76f17871596f11805c | sunlongbo/chromium | tools/code_coverage/coverage_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | verify_lcov_file | null | def verify_lcov_file(self, filepath):
"""Asserts that a given lcov file looks correct."""
with open(filepath) as f:
data = f.read()
self.assertGreater(data.count('SF:'), 100)
self.assertGreater(data.count('crypto'), 100)
self.assertGreater(data.count('libpng'), 10) | Asserts that a given lcov file looks correct. | Asserts that a given lcov file looks correct. | [
"Asserts",
"that",
"a",
"given",
"lcov",
"file",
"looks",
"correct",
"."
] | def verify_lcov_file(self, filepath):
with open(filepath) as f:
data = f.read()
self.assertGreater(data.count('SF:'), 100)
self.assertGreater(data.count('crypto'), 100)
self.assertGreater(data.count('libpng'), 10) | [
"def",
"verify_lcov_file",
"(",
"self",
",",
"filepath",
")",
":",
"with",
"open",
"(",
"filepath",
")",
"as",
"f",
":",
"data",
"=",
"f",
".",
"read",
"(",
")",
"self",
".",
"assertGreater",
"(",
"data",
".",
"count",
"(",
"'SF:'",
")",
",",
"100"... | Asserts that a given lcov file looks correct. | [
"Asserts",
"that",
"a",
"given",
"lcov",
"file",
"looks",
"correct",
"."
] | [
"\"\"\"Asserts that a given lcov file looks correct.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filepath",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filepath",
"type": null,
"docstring": null,
"docstring_tokens... |
14ebf3082e88dc1acf48498748b5dab788aa0bdf | sunlongbo/chromium | tools/perf/contrib/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CommonChecks | <not_specific> | def _CommonChecks(input_api, output_api):
"""Performs common checks, which includes running pylint."""
results = []
results.extend(_CheckContribDir(input_api, output_api))
return results | Performs common checks, which includes running pylint. | Performs common checks, which includes running pylint. | [
"Performs",
"common",
"checks",
"which",
"includes",
"running",
"pylint",
"."
] | def _CommonChecks(input_api, output_api):
results = []
results.extend(_CheckContribDir(input_api, output_api))
return results | [
"def",
"_CommonChecks",
"(",
"input_api",
",",
"output_api",
")",
":",
"results",
"=",
"[",
"]",
"results",
".",
"extend",
"(",
"_CheckContribDir",
"(",
"input_api",
",",
"output_api",
")",
")",
"return",
"results"
] | Performs common checks, which includes running pylint. | [
"Performs",
"common",
"checks",
"which",
"includes",
"running",
"pylint",
"."
] | [
"\"\"\"Performs common checks, which includes running pylint.\"\"\""
] | [
{
"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... |
1dea3515203db39d3f1d3e3853383bd6d794e19a | sunlongbo/chromium | tools/mac/show_mod_init_func.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ShowModuleInitializers | <not_specific> | def ShowModuleInitializers(binary, xcode_path):
"""Gathers the module initializers for |binary| and symbolizes the addresses.
"""
initializers = GetModuleInitializers(binary, xcode_path)
if not initializers:
# atos will do work even if there are no addresses, so bail early.
return
symbols = SymbolizeA... | Gathers the module initializers for |binary| and symbolizes the addresses.
| Gathers the module initializers for |binary| and symbolizes the addresses. | [
"Gathers",
"the",
"module",
"initializers",
"for",
"|binary|",
"and",
"symbolizes",
"the",
"addresses",
"."
] | def ShowModuleInitializers(binary, xcode_path):
initializers = GetModuleInitializers(binary, xcode_path)
if not initializers:
return
symbols = SymbolizeAddresses(binary, initializers, xcode_path)
print(binary)
for initializer in zip(initializers, symbols):
print('%s @ %s' % initializer) | [
"def",
"ShowModuleInitializers",
"(",
"binary",
",",
"xcode_path",
")",
":",
"initializers",
"=",
"GetModuleInitializers",
"(",
"binary",
",",
"xcode_path",
")",
"if",
"not",
"initializers",
":",
"return",
"symbols",
"=",
"SymbolizeAddresses",
"(",
"binary",
",",
... | Gathers the module initializers for |binary| and symbolizes the addresses. | [
"Gathers",
"the",
"module",
"initializers",
"for",
"|binary|",
"and",
"symbolizes",
"the",
"addresses",
"."
] | [
"\"\"\"Gathers the module initializers for |binary| and symbolizes the addresses.\n \"\"\"",
"# atos will do work even if there are no addresses, so bail early."
] | [
{
"param": "binary",
"type": null
},
{
"param": "xcode_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "binary",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xcode_path",
"type": null,
"docstring": null,
"docstring_to... |
1dea3515203db39d3f1d3e3853383bd6d794e19a | sunlongbo/chromium | tools/mac/show_mod_init_func.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetModuleInitializers | <not_specific> | def GetModuleInitializers(binary, xcode_path):
"""Parses the __DATA,__mod_init_func segment of |binary| and returns a list
of string hexadecimal addresses of the module initializers.
"""
if xcode_path:
otool_path = os.path.join(xcode_path, 'Contents', 'Developer',
'Toolchains', 'XcodeDefault.xctoolc... | Parses the __DATA,__mod_init_func segment of |binary| and returns a list
of string hexadecimal addresses of the module initializers.
| Parses the __DATA,__mod_init_func segment of |binary| and returns a list
of string hexadecimal addresses of the module initializers. | [
"Parses",
"the",
"__DATA",
"__mod_init_func",
"segment",
"of",
"|binary|",
"and",
"returns",
"a",
"list",
"of",
"string",
"hexadecimal",
"addresses",
"of",
"the",
"module",
"initializers",
"."
] | def GetModuleInitializers(binary, xcode_path):
if xcode_path:
otool_path = os.path.join(xcode_path, 'Contents', 'Developer',
'Toolchains', 'XcodeDefault.xctoolchain', 'usr', 'bin', 'otool')
else:
otool_path = 'otool'
otool = [otool_path, '-v', '-s', '__DATA', '__mod_init_func', binary]
lines = s... | [
"def",
"GetModuleInitializers",
"(",
"binary",
",",
"xcode_path",
")",
":",
"if",
"xcode_path",
":",
"otool_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"xcode_path",
",",
"'Contents'",
",",
"'Developer'",
",",
"'Toolchains'",
",",
"'XcodeDefault.xctoolchain... | Parses the __DATA,__mod_init_func segment of |binary| and returns a list
of string hexadecimal addresses of the module initializers. | [
"Parses",
"the",
"__DATA",
"__mod_init_func",
"segment",
"of",
"|binary|",
"and",
"returns",
"a",
"list",
"of",
"string",
"hexadecimal",
"addresses",
"of",
"the",
"module",
"initializers",
"."
] | [
"\"\"\"Parses the __DATA,__mod_init_func segment of |binary| and returns a list\n of string hexadecimal addresses of the module initializers.\n \"\"\"",
"# The -v flag will display the addresses in a usable form (as opposed to",
"# just its on-disk little-endian byte representation).",
"# Skip the first two... | [
{
"param": "binary",
"type": null
},
{
"param": "xcode_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "binary",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xcode_path",
"type": null,
"docstring": null,
"docstring_to... |
bb063ce8b7e1967d94419b0e0778c91e76f3f7d2 | sunlongbo/chromium | third_party/android_crazy_linker/src/tests/pylib/elf_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GenerateStringTable | <not_specific> | def GenerateStringTable(symbol_names):
"""Generate the string table that corresponds to a list of symbol names.
Args:
symbol_names: List of input symbol names.
Returns:
A (string_table, symbol_offsets) tuple, where |string_table| is the
actual string table (terminated by two '\0' chars), and |symbol_... | Generate the string table that corresponds to a list of symbol names.
Args:
symbol_names: List of input symbol names.
Returns:
A (string_table, symbol_offsets) tuple, where |string_table| is the
actual string table (terminated by two '\0' chars), and |symbol_offsets|
is a list of starting offsets f... | Generate the string table that corresponds to a list of symbol names. | [
"Generate",
"the",
"string",
"table",
"that",
"corresponds",
"to",
"a",
"list",
"of",
"symbol",
"names",
"."
] | def GenerateStringTable(symbol_names):
symbol_offsets = []
string_table = "\0"
next_offset = 1
for symbol in symbol_names:
symbol_offsets.append(next_offset)
string_table += symbol
string_table += "\0"
next_offset += len(symbol) + 1
string_table += "\0"
return string_table, symbol_offsets | [
"def",
"GenerateStringTable",
"(",
"symbol_names",
")",
":",
"symbol_offsets",
"=",
"[",
"]",
"string_table",
"=",
"\"\\0\"",
"next_offset",
"=",
"1",
"for",
"symbol",
"in",
"symbol_names",
":",
"symbol_offsets",
".",
"append",
"(",
"next_offset",
")",
"string_t... | Generate the string table that corresponds to a list of symbol names. | [
"Generate",
"the",
"string",
"table",
"that",
"corresponds",
"to",
"a",
"list",
"of",
"symbol",
"names",
"."
] | [
"\"\"\"Generate the string table that corresponds to a list of symbol names.\n\n Args:\n symbol_names: List of input symbol names.\n Returns:\n A (string_table, symbol_offsets) tuple, where |string_table| is the\n actual string table (terminated by two '\\0' chars), and |symbol_offsets|\n is a list of... | [
{
"param": "symbol_names",
"type": null
}
] | {
"returns": [
{
"docstring": "A (string_table, symbol_offsets) tuple, where |string_table| is the\nactual string table (terminated by two '\\0' chars), and |symbol_offsets|\nis a list of starting offsets for each symbol inside the table.",
"docstring_tokens": [
"A",
"(",
"stri... |
bb063ce8b7e1967d94419b0e0778c91e76f3f7d2 | sunlongbo/chromium | third_party/android_crazy_linker/src/tests/pylib/elf_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CSourceForElfSymbolTable | <not_specific> | def CSourceForElfSymbolTable(variable_prefix, names, str_offsets):
"""Generate C source definition for an ELF symbol table.
Args:
variable_prefix: variable name prefix
names: List of symbol names.
str_offsets: List of symbol name offsets in string table.
Returns:
String containing C source fragme... | Generate C source definition for an ELF symbol table.
Args:
variable_prefix: variable name prefix
names: List of symbol names.
str_offsets: List of symbol name offsets in string table.
Returns:
String containing C source fragment.
| Generate C source definition for an ELF symbol table. | [
"Generate",
"C",
"source",
"definition",
"for",
"an",
"ELF",
"symbol",
"table",
"."
] | def CSourceForElfSymbolTable(variable_prefix, names, str_offsets):
out = (
r'''// NOTE: ELF32_Sym and ELF64_Sym have very different layout.
#if UINTPTR_MAX == UINT32_MAX // ELF32_Sym
# define DEFINE_ELF_SYMBOL(name, name_offset, address, size) \
{ (name_offset), (address), (size), ELF_ST_INFO(STB_GLOBAL, STT_FU... | [
"def",
"CSourceForElfSymbolTable",
"(",
"variable_prefix",
",",
"names",
",",
"str_offsets",
")",
":",
"out",
"=",
"(",
"r'''// NOTE: ELF32_Sym and ELF64_Sym have very different layout.\n#if UINTPTR_MAX == UINT32_MAX // ELF32_Sym\n# define DEFINE_ELF_SYMBOL(name, name_offset, address, si... | Generate C source definition for an ELF symbol table. | [
"Generate",
"C",
"source",
"definition",
"for",
"an",
"ELF",
"symbol",
"table",
"."
] | [
"\"\"\"Generate C source definition for an ELF symbol table.\n\n Args:\n variable_prefix: variable name prefix\n names: List of symbol names.\n str_offsets: List of symbol name offsets in string table.\n Returns:\n String containing C source fragment.\n \"\"\""
] | [
{
"param": "variable_prefix",
"type": null
},
{
"param": "names",
"type": null
},
{
"param": "str_offsets",
"type": null
}
] | {
"returns": [
{
"docstring": "String containing C source fragment.",
"docstring_tokens": [
"String",
"containing",
"C",
"source",
"fragment",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "variable_pr... |
bb063ce8b7e1967d94419b0e0778c91e76f3f7d2 | sunlongbo/chromium | third_party/android_crazy_linker/src/tests/pylib/elf_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CSourceForElfSymbolListMacro | <not_specific> | def CSourceForElfSymbolListMacro(variable_prefix, names, name_offsets,
base_address=0x10000, symbol_size=16,
spacing_size=16):
"""Generate C source definition for a macro listing ELF symbols.
Args:
macro_suffix: Macro name suffix.
names: Lis... | Generate C source definition for a macro listing ELF symbols.
Args:
macro_suffix: Macro name suffix.
names: List of symbol names.
name_offsets: List of symbol offsets.
base_address: Base starting address for symbols,
symbol_size: Symbol size in bytes (all have the same size).
spacing_size: Ad... | Generate C source definition for a macro listing ELF symbols. | [
"Generate",
"C",
"source",
"definition",
"for",
"a",
"macro",
"listing",
"ELF",
"symbols",
"."
] | def CSourceForElfSymbolListMacro(variable_prefix, names, name_offsets,
base_address=0x10000, symbol_size=16,
spacing_size=16):
out = (
r'''// Auto-generated macro used to list all symbols
// XX must be a macro that takes the following parameters:
// ... | [
"def",
"CSourceForElfSymbolListMacro",
"(",
"variable_prefix",
",",
"names",
",",
"name_offsets",
",",
"base_address",
"=",
"0x10000",
",",
"symbol_size",
"=",
"16",
",",
"spacing_size",
"=",
"16",
")",
":",
"out",
"=",
"(",
"r'''// Auto-generated macro used to list... | Generate C source definition for a macro listing ELF symbols. | [
"Generate",
"C",
"source",
"definition",
"for",
"a",
"macro",
"listing",
"ELF",
"symbols",
"."
] | [
"\"\"\"Generate C source definition for a macro listing ELF symbols.\n\n Args:\n macro_suffix: Macro name suffix.\n names: List of symbol names.\n name_offsets: List of symbol offsets.\n base_address: Base starting address for symbols,\n symbol_size: Symbol size in bytes (all have the same size).\n ... | [
{
"param": "variable_prefix",
"type": null
},
{
"param": "names",
"type": null
},
{
"param": "name_offsets",
"type": null
},
{
"param": "base_address",
"type": null
},
{
"param": "symbol_size",
"type": null
},
{
"param": "spacing_size",
"type": nul... | {
"returns": [
{
"docstring": "String containing C source fragment.",
"docstring_tokens": [
"String",
"containing",
"C",
"source",
"fragment",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "variable_pr... |
83c27295ddbce9f324f992f71f51b24dfda11d4c | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/error_handlers.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _add_reportable_error | <not_specific> | def _add_reportable_error(self, category):
"""Increment the error count and return the new category total."""
self._increment_error_count() # Increment the total.
# Increment the category total.
if not category in self._category_totals:
self._category_totals[category] = 1
... | Increment the error count and return the new category total. | Increment the error count and return the new category total. | [
"Increment",
"the",
"error",
"count",
"and",
"return",
"the",
"new",
"category",
"total",
"."
] | def _add_reportable_error(self, category):
self._increment_error_count()
if not category in self._category_totals:
self._category_totals[category] = 1
else:
self._category_totals[category] += 1
return self._category_totals[category] | [
"def",
"_add_reportable_error",
"(",
"self",
",",
"category",
")",
":",
"self",
".",
"_increment_error_count",
"(",
")",
"if",
"not",
"category",
"in",
"self",
".",
"_category_totals",
":",
"self",
".",
"_category_totals",
"[",
"category",
"]",
"=",
"1",
"el... | Increment the error count and return the new category total. | [
"Increment",
"the",
"error",
"count",
"and",
"return",
"the",
"new",
"category",
"total",
"."
] | [
"\"\"\"Increment the error count and return the new category total.\"\"\"",
"# Increment the total.",
"# Increment the category total."
] | [
{
"param": "self",
"type": null
},
{
"param": "category",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "category",
"type": null,
"docstring": null,
"docstring_tokens... |
83c27295ddbce9f324f992f71f51b24dfda11d4c | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/error_handlers.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _max_reports | <not_specific> | def _max_reports(self, category):
"""Return the maximum number of errors to report."""
if not category in self._configuration.max_reports_per_category:
return None
return self._configuration.max_reports_per_category[category] | Return the maximum number of errors to report. | Return the maximum number of errors to report. | [
"Return",
"the",
"maximum",
"number",
"of",
"errors",
"to",
"report",
"."
] | def _max_reports(self, category):
if not category in self._configuration.max_reports_per_category:
return None
return self._configuration.max_reports_per_category[category] | [
"def",
"_max_reports",
"(",
"self",
",",
"category",
")",
":",
"if",
"not",
"category",
"in",
"self",
".",
"_configuration",
".",
"max_reports_per_category",
":",
"return",
"None",
"return",
"self",
".",
"_configuration",
".",
"max_reports_per_category",
"[",
"c... | Return the maximum number of errors to report. | [
"Return",
"the",
"maximum",
"number",
"of",
"errors",
"to",
"report",
"."
] | [
"\"\"\"Return the maximum number of errors to report.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "category",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "category",
"type": null,
"docstring": null,
"docstring_tokens... |
3575af58790234c3675e87932e87a7abe5f53f56 | sunlongbo/chromium | tools/media_engagement_preload/make_dafsa_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExample1 | null | def testExample1(self):
"""Tests Example 1 from make_dafsa.py."""
infile = '["https://www.example.com:8081", "http://www.example.org"]'
outfile = b'\n\x1c\x81www.example\xae\x02\x84org\x81com:8081\x80'
self.assertEqual(make_dafsa.words_to_proto(make_dafsa.parse_json(infile)),
outfi... | Tests Example 1 from make_dafsa.py. | Tests Example 1 from make_dafsa.py. | [
"Tests",
"Example",
"1",
"from",
"make_dafsa",
".",
"py",
"."
] | def testExample1(self):
infile = '["https://www.example.com:8081", "http://www.example.org"]'
outfile = b'\n\x1c\x81www.example\xae\x02\x84org\x81com:8081\x80'
self.assertEqual(make_dafsa.words_to_proto(make_dafsa.parse_json(infile)),
outfile) | [
"def",
"testExample1",
"(",
"self",
")",
":",
"infile",
"=",
"'[\"https://www.example.com:8081\", \"http://www.example.org\"]'",
"outfile",
"=",
"b'\\n\\x1c\\x81www.example\\xae\\x02\\x84org\\x81com:8081\\x80'",
"self",
".",
"assertEqual",
"(",
"make_dafsa",
".",
"words_to_proto"... | Tests Example 1 from make_dafsa.py. | [
"Tests",
"Example",
"1",
"from",
"make_dafsa",
".",
"py",
"."
] | [
"\"\"\"Tests Example 1 from make_dafsa.py.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3575af58790234c3675e87932e87a7abe5f53f56 | sunlongbo/chromium | tools/media_engagement_preload/make_dafsa_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExample2 | null | def testExample2(self):
"""Tests Example 2 from make_dafsa.py."""
infile = '["https://www.example.org", "http://www.google.com"]'
outfile = b'\n\x1e\x81www\xae\x02\x8bgoogle.com\x81example.org\x80'
self.assertEqual(make_dafsa.words_to_proto(make_dafsa.parse_json(infile)),
outfile) | Tests Example 2 from make_dafsa.py. | Tests Example 2 from make_dafsa.py. | [
"Tests",
"Example",
"2",
"from",
"make_dafsa",
".",
"py",
"."
] | def testExample2(self):
infile = '["https://www.example.org", "http://www.google.com"]'
outfile = b'\n\x1e\x81www\xae\x02\x8bgoogle.com\x81example.org\x80'
self.assertEqual(make_dafsa.words_to_proto(make_dafsa.parse_json(infile)),
outfile) | [
"def",
"testExample2",
"(",
"self",
")",
":",
"infile",
"=",
"'[\"https://www.example.org\", \"http://www.google.com\"]'",
"outfile",
"=",
"b'\\n\\x1e\\x81www\\xae\\x02\\x8bgoogle.com\\x81example.org\\x80'",
"self",
".",
"assertEqual",
"(",
"make_dafsa",
".",
"words_to_proto",
... | Tests Example 2 from make_dafsa.py. | [
"Tests",
"Example",
"2",
"from",
"make_dafsa",
".",
"py",
"."
] | [
"\"\"\"Tests Example 2 from make_dafsa.py.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
35934ee6ff4f6128e49b167b417fc318d378878c | sunlongbo/chromium | third_party/chevron/chevron/main.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | cli_main | <not_specific> | def cli_main():
"""Render mustache templates using json files"""
import argparse
import os
def is_file_or_pipe(arg):
if not os.path.exists(arg) or os.path.isdir(arg):
parser.error('The file {0} does not exist!'.format(arg))
else:
return arg
def is_dir(arg):
... | Render mustache templates using json files | Render mustache templates using json files | [
"Render",
"mustache",
"templates",
"using",
"json",
"files"
] | def cli_main():
import argparse
import os
def is_file_or_pipe(arg):
if not os.path.exists(arg) or os.path.isdir(arg):
parser.error('The file {0} does not exist!'.format(arg))
else:
return arg
def is_dir(arg):
if not os.path.isdir(arg):
parser.e... | [
"def",
"cli_main",
"(",
")",
":",
"import",
"argparse",
"import",
"os",
"def",
"is_file_or_pipe",
"(",
"arg",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"arg",
")",
"or",
"os",
".",
"path",
".",
"isdir",
"(",
"arg",
")",
":",
"... | Render mustache templates using json files | [
"Render",
"mustache",
"templates",
"using",
"json",
"files"
] | [
"\"\"\"Render mustache templates using json files\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
80b96ad8b1572f92175f71c61e5399fc714c3841 | sunlongbo/chromium | tools/android/modularization/owners/owners_exporter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | to_json_file | None | def to_json_file(paths_with_data: List[
Tuple[owners_data.RequestedPath, owners_data.PathData]],
output_path: str) -> None:
'''Exports the data to an output json.'''
with open(output_path, 'w') as f:
for requested_path, path_data in paths_with_data:
data_dict: Dict = _to_data_dict(re... | Exports the data to an output json. | Exports the data to an output json. | [
"Exports",
"the",
"data",
"to",
"an",
"output",
"json",
"."
] | def to_json_file(paths_with_data: List[
Tuple[owners_data.RequestedPath, owners_data.PathData]],
output_path: str) -> None:
with open(output_path, 'w') as f:
for requested_path, path_data in paths_with_data:
data_dict: Dict = _to_data_dict(requested_path, path_data)
json.dump(data... | [
"def",
"to_json_file",
"(",
"paths_with_data",
":",
"List",
"[",
"Tuple",
"[",
"owners_data",
".",
"RequestedPath",
",",
"owners_data",
".",
"PathData",
"]",
"]",
",",
"output_path",
":",
"str",
")",
"->",
"None",
":",
"with",
"open",
"(",
"output_path",
"... | Exports the data to an output json. | [
"Exports",
"the",
"data",
"to",
"an",
"output",
"json",
"."
] | [
"'''Exports the data to an output json.'''"
] | [
{
"param": "paths_with_data",
"type": "List[\n Tuple[owners_data.RequestedPath, owners_data.PathData]]"
},
{
"param": "output_path",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "paths_with_data",
"type": "List[\n Tuple[owners_data.RequestedPath, owners_data.PathData]]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "outp... |
80b96ad8b1572f92175f71c61e5399fc714c3841 | sunlongbo/chromium | tools/android/modularization/owners/owners_exporter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _to_data_dict | Dict | def _to_data_dict(requested_path: owners_data.RequestedPath,
path_data: owners_data.PathData) -> Dict:
'''Transforms the RequestPath into a flat dictionary to be converted to json.
'''
def _joinppl(ppl, include_count=False):
r = []
for p in ppl:
r.append(p[0] if not include_count ... | Transforms the RequestPath into a flat dictionary to be converted to json.
| Transforms the RequestPath into a flat dictionary to be converted to json. | [
"Transforms",
"the",
"RequestPath",
"into",
"a",
"flat",
"dictionary",
"to",
"be",
"converted",
"to",
"json",
"."
] | def _to_data_dict(requested_path: owners_data.RequestedPath,
path_data: owners_data.PathData) -> Dict:
def _joinppl(ppl, include_count=False):
r = []
for p in ppl:
r.append(p[0] if not include_count else '{} ({})'.format(p[0], p[1]))
return r
owners = path_data.owner
dir_metada... | [
"def",
"_to_data_dict",
"(",
"requested_path",
":",
"owners_data",
".",
"RequestedPath",
",",
"path_data",
":",
"owners_data",
".",
"PathData",
")",
"->",
"Dict",
":",
"def",
"_joinppl",
"(",
"ppl",
",",
"include_count",
"=",
"False",
")",
":",
"r",
"=",
"... | Transforms the RequestPath into a flat dictionary to be converted to json. | [
"Transforms",
"the",
"RequestPath",
"into",
"a",
"flat",
"dictionary",
"to",
"be",
"converted",
"to",
"json",
"."
] | [
"'''Transforms the RequestPath into a flat dictionary to be converted to json.\n '''"
] | [
{
"param": "requested_path",
"type": "owners_data.RequestedPath"
},
{
"param": "path_data",
"type": "owners_data.PathData"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "requested_path",
"type": "owners_data.RequestedPath",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path_data",
"type": "owners_data.PathDat... |
2b5654797c1805e717d72c2e5e856534078ccfc8 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/layout_package/bot_test_expectations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | flakes_by_path | <not_specific> | def flakes_by_path(self, only_consider_very_flaky,
ignore_bot_expected_results=False, consider_only_flaky_runs=True):
"""Sets test expectations to bot results if there are at least two distinct results."""
flakes_by_path = {}
for test_path, entry in self.results_json.walk_... | Sets test expectations to bot results if there are at least two distinct results. | Sets test expectations to bot results if there are at least two distinct results. | [
"Sets",
"test",
"expectations",
"to",
"bot",
"results",
"if",
"there",
"are",
"at",
"least",
"two",
"distinct",
"results",
"."
] | def flakes_by_path(self, only_consider_very_flaky,
ignore_bot_expected_results=False, consider_only_flaky_runs=True):
flakes_by_path = {}
for test_path, entry in self.results_json.walk_results():
flaky_types = self._flaky_types_in_results(entry,
... | [
"def",
"flakes_by_path",
"(",
"self",
",",
"only_consider_very_flaky",
",",
"ignore_bot_expected_results",
"=",
"False",
",",
"consider_only_flaky_runs",
"=",
"True",
")",
":",
"flakes_by_path",
"=",
"{",
"}",
"for",
"test_path",
",",
"entry",
"in",
"self",
".",
... | Sets test expectations to bot results if there are at least two distinct results. | [
"Sets",
"test",
"expectations",
"to",
"bot",
"results",
"if",
"there",
"are",
"at",
"least",
"two",
"distinct",
"results",
"."
] | [
"\"\"\"Sets test expectations to bot results if there are at least two distinct results.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "only_consider_very_flaky",
"type": null
},
{
"param": "ignore_bot_expected_results",
"type": null
},
{
"param": "consider_only_flaky_runs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "only_consider_very_flaky",
"type": null,
"docstring": null,
"... |
2b5654797c1805e717d72c2e5e856534078ccfc8 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/layout_package/bot_test_expectations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | all_results_by_path | <not_specific> | def all_results_by_path(self):
"""Returns all seen result types for each test.
Returns a dictionary from each test path that has a result to a list of distinct, sorted result
strings. For example, if the test results are as follows:
a.html IMAGE IMAGE PASS PASS PASS TIMEOUT PASS TE... | Returns all seen result types for each test.
Returns a dictionary from each test path that has a result to a list of distinct, sorted result
strings. For example, if the test results are as follows:
a.html IMAGE IMAGE PASS PASS PASS TIMEOUT PASS TEXT
b.html PASS PASS PASS PASS ... | Returns all seen result types for each test.
Returns a dictionary from each test path that has a result to a list of distinct, sorted result
strings. For example, if the test results are as follows.
| [
"Returns",
"all",
"seen",
"result",
"types",
"for",
"each",
"test",
".",
"Returns",
"a",
"dictionary",
"from",
"each",
"test",
"path",
"that",
"has",
"a",
"result",
"to",
"a",
"list",
"of",
"distinct",
"sorted",
"result",
"strings",
".",
"For",
"example",
... | def all_results_by_path(self):
results_by_path = {}
for test_path, entry in self.results_json.walk_results():
results_dict = entry.get(self.results_json.RESULTS_KEY, {})
result_types = self._all_types_in_results(results_dict)
if not result_types:
conti... | [
"def",
"all_results_by_path",
"(",
"self",
")",
":",
"results_by_path",
"=",
"{",
"}",
"for",
"test_path",
",",
"entry",
"in",
"self",
".",
"results_json",
".",
"walk_results",
"(",
")",
":",
"results_dict",
"=",
"entry",
".",
"get",
"(",
"self",
".",
"r... | Returns all seen result types for each test. | [
"Returns",
"all",
"seen",
"result",
"types",
"for",
"each",
"test",
"."
] | [
"\"\"\"Returns all seen result types for each test.\n\n Returns a dictionary from each test path that has a result to a list of distinct, sorted result\n strings. For example, if the test results are as follows:\n\n a.html IMAGE IMAGE PASS PASS PASS TIMEOUT PASS TEXT\n b.html PAS... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2b5654797c1805e717d72c2e5e856534078ccfc8 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/layout_package/bot_test_expectations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _flaky_types_in_results | <not_specific> | def _flaky_types_in_results(self, results_entry, only_consider_very_flaky,
ignore_bot_expected_results=False,
consider_only_flaky_runs=True):
"""Returns flaky results for a single test using its results entry
retrieved from the test results... | Returns flaky results for a single test using its results entry
retrieved from the test results server
args:
results_entry: Test run results aggregated from the last N builds
only_consider_very_flaky: Flag for considering only test runs
with more than one retry
... | Returns flaky results for a single test using its results entry
retrieved from the test results server
Test run results aggregated from the last N builds
only_consider_very_flaky: Flag for considering only test runs
with more than one retry
ignore_bot_expected_results: Flag for ignoring expected results
retrieved from... | [
"Returns",
"flaky",
"results",
"for",
"a",
"single",
"test",
"using",
"its",
"results",
"entry",
"retrieved",
"from",
"the",
"test",
"results",
"server",
"Test",
"run",
"results",
"aggregated",
"from",
"the",
"last",
"N",
"builds",
"only_consider_very_flaky",
":... | def _flaky_types_in_results(self, results_entry, only_consider_very_flaky,
ignore_bot_expected_results=False,
consider_only_flaky_runs=True):
flaky_results = set()
if ignore_bot_expected_results:
latest_expectations = []
... | [
"def",
"_flaky_types_in_results",
"(",
"self",
",",
"results_entry",
",",
"only_consider_very_flaky",
",",
"ignore_bot_expected_results",
"=",
"False",
",",
"consider_only_flaky_runs",
"=",
"True",
")",
":",
"flaky_results",
"=",
"set",
"(",
")",
"if",
"ignore_bot_exp... | Returns flaky results for a single test using its results entry
retrieved from the test results server | [
"Returns",
"flaky",
"results",
"for",
"a",
"single",
"test",
"using",
"its",
"results",
"entry",
"retrieved",
"from",
"the",
"test",
"results",
"server"
] | [
"\"\"\"Returns flaky results for a single test using its results entry\n retrieved from the test results server\n\n args:\n results_entry: Test run results aggregated from the last N builds\n only_consider_very_flaky: Flag for considering only test runs\n with more than ... | [
{
"param": "self",
"type": null
},
{
"param": "results_entry",
"type": null
},
{
"param": "only_consider_very_flaky",
"type": null
},
{
"param": "ignore_bot_expected_results",
"type": null
},
{
"param": "consider_only_flaky_runs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "results_entry",
"type": null,
"docstring": null,
"docstring_t... |
8c7f1542eb91870cec8e9fb66ebb2d420c08b072 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _create_arguments | <not_specific> | def _create_arguments(self, args):
"""
Constructs a list of new instances of Argument.
Args:
args: A list of argument parameters. Each argument parameter is
a list of argument identifier, type name in str, and optional
default value in str.
"... |
Constructs a list of new instances of Argument.
Args:
args: A list of argument parameters. Each argument parameter is
a list of argument identifier, type name in str, and optional
default value in str.
| Constructs a list of new instances of Argument. | [
"Constructs",
"a",
"list",
"of",
"new",
"instances",
"of",
"Argument",
"."
] | def _create_arguments(self, args):
assert isinstance(args, (list, tuple))
arguments = []
index = 0
for arg in args:
assert isinstance(arg, (list, tuple))
assert len(arg) == 2 or len(arg) == 3
identifier = arg[0]
if isinstance(arg[1], str):
... | [
"def",
"_create_arguments",
"(",
"self",
",",
"args",
")",
":",
"assert",
"isinstance",
"(",
"args",
",",
"(",
"list",
",",
"tuple",
")",
")",
"arguments",
"=",
"[",
"]",
"index",
"=",
"0",
"for",
"arg",
"in",
"args",
":",
"assert",
"isinstance",
"("... | Constructs a list of new instances of Argument. | [
"Constructs",
"a",
"list",
"of",
"new",
"instances",
"of",
"Argument",
"."
] | [
"\"\"\"\n Constructs a list of new instances of Argument.\n\n Args:\n args: A list of argument parameters. Each argument parameter is\n a list of argument identifier, type name in str, and optional\n default value in str.\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": "A list of argument parameters. ... |
8c7f1542eb91870cec8e9fb66ebb2d420c08b072 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _create_attribute | <not_specific> | def _create_attribute(self,
identifier,
idl_type,
is_readonly=False,
extended_attributes=None,
node=None):
"""Constructs a new Attribute.IR from simple parameters."""
if isin... | Constructs a new Attribute.IR from simple parameters. | Constructs a new Attribute.IR from simple parameters. | [
"Constructs",
"a",
"new",
"Attribute",
".",
"IR",
"from",
"simple",
"parameters",
"."
] | def _create_attribute(self,
identifier,
idl_type,
is_readonly=False,
extended_attributes=None,
node=None):
if isinstance(idl_type, str):
idl_type = self._create_type(idl_... | [
"def",
"_create_attribute",
"(",
"self",
",",
"identifier",
",",
"idl_type",
",",
"is_readonly",
"=",
"False",
",",
"extended_attributes",
"=",
"None",
",",
"node",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"idl_type",
",",
"str",
")",
":",
"idl_type... | Constructs a new Attribute.IR from simple parameters. | [
"Constructs",
"a",
"new",
"Attribute",
".",
"IR",
"from",
"simple",
"parameters",
"."
] | [
"\"\"\"Constructs a new Attribute.IR from simple parameters.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "identifier",
"type": null
},
{
"param": "idl_type",
"type": null
},
{
"param": "is_readonly",
"type": null
},
{
"param": "extended_attributes",
"type": null
},
{
"param": "node",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "identifier",
"type": null,
"docstring": null,
"docstring_toke... |
8c7f1542eb91870cec8e9fb66ebb2d420c08b072 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _create_extended_attributes | <not_specific> | def _create_extended_attributes(self, key_values):
"""
Constructs a new ExtendedAttributes from a dict of key and values.
"""
assert isinstance(key_values, dict)
return ExtendedAttributes([
ExtendedAttribute(key=key, values=values)
for key, values in key_... |
Constructs a new ExtendedAttributes from a dict of key and values.
| Constructs a new ExtendedAttributes from a dict of key and values. | [
"Constructs",
"a",
"new",
"ExtendedAttributes",
"from",
"a",
"dict",
"of",
"key",
"and",
"values",
"."
] | def _create_extended_attributes(self, key_values):
assert isinstance(key_values, dict)
return ExtendedAttributes([
ExtendedAttribute(key=key, values=values)
for key, values in key_values.items()
]) | [
"def",
"_create_extended_attributes",
"(",
"self",
",",
"key_values",
")",
":",
"assert",
"isinstance",
"(",
"key_values",
",",
"dict",
")",
"return",
"ExtendedAttributes",
"(",
"[",
"ExtendedAttribute",
"(",
"key",
"=",
"key",
",",
"values",
"=",
"values",
")... | Constructs a new ExtendedAttributes from a dict of key and values. | [
"Constructs",
"a",
"new",
"ExtendedAttributes",
"from",
"a",
"dict",
"of",
"key",
"and",
"values",
"."
] | [
"\"\"\"\n Constructs a new ExtendedAttributes from a dict of key and values.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "key_values",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "key_values",
"type": null,
"docstring": null,
"docstring_toke... |
8c7f1542eb91870cec8e9fb66ebb2d420c08b072 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _create_iterator_operations | <not_specific> | def _create_iterator_operations(self, node):
"""Constructs a set of iterator operations."""
return {
Identifier('forEach'):
self._create_operation(
Identifier('forEach'),
arguments=self._create_arguments([
(Identifier('callback'... | Constructs a set of iterator operations. | Constructs a set of iterator operations. | [
"Constructs",
"a",
"set",
"of",
"iterator",
"operations",
"."
] | def _create_iterator_operations(self, node):
return {
Identifier('forEach'):
self._create_operation(
Identifier('forEach'),
arguments=self._create_arguments([
(Identifier('callback'),
Identifier('ForEachIteratorCall... | [
"def",
"_create_iterator_operations",
"(",
"self",
",",
"node",
")",
":",
"return",
"{",
"Identifier",
"(",
"'forEach'",
")",
":",
"self",
".",
"_create_operation",
"(",
"Identifier",
"(",
"'forEach'",
")",
",",
"arguments",
"=",
"self",
".",
"_create_argument... | Constructs a set of iterator operations. | [
"Constructs",
"a",
"set",
"of",
"iterator",
"operations",
"."
] | [
"\"\"\"Constructs a set of iterator operations.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "node",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node",
"type": null,
"docstring": null,
"docstring_tokens": [... |
8c7f1542eb91870cec8e9fb66ebb2d420c08b072 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _create_operation | <not_specific> | def _create_operation(self,
identifier,
arguments=None,
return_type=None,
extended_attributes=None,
node=None):
"""Constructs a new Operation.IR from simple parameters."""
if... | Constructs a new Operation.IR from simple parameters. | Constructs a new Operation.IR from simple parameters. | [
"Constructs",
"a",
"new",
"Operation",
".",
"IR",
"from",
"simple",
"parameters",
"."
] | def _create_operation(self,
identifier,
arguments=None,
return_type=None,
extended_attributes=None,
node=None):
if not return_type:
return_type = self._create_type('void'... | [
"def",
"_create_operation",
"(",
"self",
",",
"identifier",
",",
"arguments",
"=",
"None",
",",
"return_type",
"=",
"None",
",",
"extended_attributes",
"=",
"None",
",",
"node",
"=",
"None",
")",
":",
"if",
"not",
"return_type",
":",
"return_type",
"=",
"s... | Constructs a new Operation.IR from simple parameters. | [
"Constructs",
"a",
"new",
"Operation",
".",
"IR",
"from",
"simple",
"parameters",
"."
] | [
"\"\"\"Constructs a new Operation.IR from simple parameters.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "identifier",
"type": null
},
{
"param": "arguments",
"type": null
},
{
"param": "return_type",
"type": null
},
{
"param": "extended_attributes",
"type": null
},
{
"param": "node",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "identifier",
"type": null,
"docstring": null,
"docstring_toke... |
8c7f1542eb91870cec8e9fb66ebb2d420c08b072 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _create_type | <not_specific> | def _create_type(self, keyword_or_identifier, **kwargs):
"""Constructs a new IdlType from a type keyword or identifier."""
name = keyword_or_identifier
if isinstance(name, Identifier):
return self._idl_type_factory.reference_type(name, **kwargs)
elif isinstance(name, str):
... | Constructs a new IdlType from a type keyword or identifier. | Constructs a new IdlType from a type keyword or identifier. | [
"Constructs",
"a",
"new",
"IdlType",
"from",
"a",
"type",
"keyword",
"or",
"identifier",
"."
] | def _create_type(self, keyword_or_identifier, **kwargs):
name = keyword_or_identifier
if isinstance(name, Identifier):
return self._idl_type_factory.reference_type(name, **kwargs)
elif isinstance(name, str):
return self._idl_type_factory.simple_type(name, **kwargs)
... | [
"def",
"_create_type",
"(",
"self",
",",
"keyword_or_identifier",
",",
"**",
"kwargs",
")",
":",
"name",
"=",
"keyword_or_identifier",
"if",
"isinstance",
"(",
"name",
",",
"Identifier",
")",
":",
"return",
"self",
".",
"_idl_type_factory",
".",
"reference_type"... | Constructs a new IdlType from a type keyword or identifier. | [
"Constructs",
"a",
"new",
"IdlType",
"from",
"a",
"type",
"keyword",
"or",
"identifier",
"."
] | [
"\"\"\"Constructs a new IdlType from a type keyword or identifier.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "keyword_or_identifier",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "keyword_or_identifier",
"type": null,
"docstring": null,
"doc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.