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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9f92347a6cbeebbed5564df79a968a171c624e79 | sunlongbo/chromium | components/policy/tools/template_writers/writers/doc_atomic_groups_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddPolicyRow | null | def _AddPolicyRow(self, parent, policy):
'''Adds a row for the policy in the summary table.
Args:
parent: The DOM node of the summary table.
policy: The data structure of the policy.
'''
tr = self._AddStyledElement(parent, 'tr', ['tr'])
indent = 'padding-left: %dpx;' % (7 + self._indent... | Adds a row for the policy in the summary table.
Args:
parent: The DOM node of the summary table.
policy: The data structure of the policy.
| Adds a row for the policy in the summary table. | [
"Adds",
"a",
"row",
"for",
"the",
"policy",
"in",
"the",
"summary",
"table",
"."
] | def _AddPolicyRow(self, parent, policy):
tr = self._AddStyledElement(parent, 'tr', ['tr'])
indent = 'padding-left: %dpx;' % (7 + self._indent_level * 14)
if policy['type'] != 'group':
name_td = self._AddStyledElement(tr, 'td', ['td', 'td.left'],
{'style': indent}... | [
"def",
"_AddPolicyRow",
"(",
"self",
",",
"parent",
",",
"policy",
")",
":",
"tr",
"=",
"self",
".",
"_AddStyledElement",
"(",
"parent",
",",
"'tr'",
",",
"[",
"'tr'",
"]",
")",
"indent",
"=",
"'padding-left: %dpx;'",
"%",
"(",
"7",
"+",
"self",
".",
... | Adds a row for the policy in the summary table. | [
"Adds",
"a",
"row",
"for",
"the",
"policy",
"in",
"the",
"summary",
"table",
"."
] | [
"'''Adds a row for the policy in the summary table.\n\n Args:\n parent: The DOM node of the summary table.\n policy: The data structure of the policy.\n '''",
"# Normal policies get two columns with name and caption.",
"# Groups get one column with caption."
] | [
{
"param": "self",
"type": null
},
{
"param": "parent",
"type": null
},
{
"param": "policy",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parent",
"type": null,
"docstring": "The DOM node of the summary ta... |
9f92347a6cbeebbed5564df79a968a171c624e79 | sunlongbo/chromium | components/policy/tools/template_writers/writers/doc_atomic_groups_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteTemplate | <not_specific> | def WriteTemplate(self, template):
'''Writes the given template definition.
Args:
template: Template definition to write.
Returns:
Generated output for the passed template definition.
'''
self.messages = template['messages']
self.Init()
policies = self.PreprocessPolicies(
... | Writes the given template definition.
Args:
template: Template definition to write.
Returns:
Generated output for the passed template definition.
| Writes the given template definition. | [
"Writes",
"the",
"given",
"template",
"definition",
"."
] | def WriteTemplate(self, template):
self.messages = template['messages']
self.Init()
policies = self.PreprocessPolicies(
template['policy_atomic_group_definitions'])
self.BeginTemplate()
for policy in policies:
if policy['type'] != 'atomic_group':
continue
self.BeginPolicy... | [
"def",
"WriteTemplate",
"(",
"self",
",",
"template",
")",
":",
"self",
".",
"messages",
"=",
"template",
"[",
"'messages'",
"]",
"self",
".",
"Init",
"(",
")",
"policies",
"=",
"self",
".",
"PreprocessPolicies",
"(",
"template",
"[",
"'policy_atomic_group_d... | Writes the given template definition. | [
"Writes",
"the",
"given",
"template",
"definition",
"."
] | [
"'''Writes the given template definition.\n\n Args:\n template: Template definition to write.\n\n Returns:\n Generated output for the passed template definition.\n '''",
"# Nesting of groups is currently not supported."
] | [
{
"param": "self",
"type": null
},
{
"param": "template",
"type": null
}
] | {
"returns": [
{
"docstring": "Generated output for the passed template definition.",
"docstring_tokens": [
"Generated",
"output",
"for",
"the",
"passed",
"template",
"definition",
"."
],
"type": null
}
],
"raises": []... |
8b5b6a4360c7e60fd16dd00b7629bb38b91d5b95 | sunlongbo/chromium | third_party/blink/renderer/modules/bluetooth/testing/clusterfuzz/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RunTests | <not_specific> | def _RunTests(input_api, output_api):
"""Runs all test files in the directory."""
cmd_name = 'all_python_tests'
cmd = ['python', '-m', 'unittest', 'discover', '-p', '*test.py']
test_cmd = input_api.Command(
name=cmd_name, cmd=cmd, kwargs={}, message=output_api.PresubmitError)
if input_api.ve... | Runs all test files in the directory. | Runs all test files in the directory. | [
"Runs",
"all",
"test",
"files",
"in",
"the",
"directory",
"."
] | def _RunTests(input_api, output_api):
cmd_name = 'all_python_tests'
cmd = ['python', '-m', 'unittest', 'discover', '-p', '*test.py']
test_cmd = input_api.Command(
name=cmd_name, cmd=cmd, kwargs={}, message=output_api.PresubmitError)
if input_api.verbose:
print('Running ' + cmd_name)
... | [
"def",
"_RunTests",
"(",
"input_api",
",",
"output_api",
")",
":",
"cmd_name",
"=",
"'all_python_tests'",
"cmd",
"=",
"[",
"'python'",
",",
"'-m'",
",",
"'unittest'",
",",
"'discover'",
",",
"'-p'",
",",
"'*test.py'",
"]",
"test_cmd",
"=",
"input_api",
".",
... | Runs all test files in the directory. | [
"Runs",
"all",
"test",
"files",
"in",
"the",
"directory",
"."
] | [
"\"\"\"Runs all test files in the directory.\"\"\""
] | [
{
"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... |
51f280c673cd513be9ba48e4f8776edff8090bca | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/servers/server_base.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | start | null | def start(self):
"""Starts the server. It is an error to start an already started server.
This method also stops any stale servers started by a previous instance.
"""
assert not self._pid, '%s server is already running' % self._name
# Stop any stale servers left over from previ... | Starts the server. It is an error to start an already started server.
This method also stops any stale servers started by a previous instance.
| Starts the server. It is an error to start an already started server.
This method also stops any stale servers started by a previous instance. | [
"Starts",
"the",
"server",
".",
"It",
"is",
"an",
"error",
"to",
"start",
"an",
"already",
"started",
"server",
".",
"This",
"method",
"also",
"stops",
"any",
"stale",
"servers",
"started",
"by",
"a",
"previous",
"instance",
"."
] | def start(self):
assert not self._pid, '%s server is already running' % self._name
if self._filesystem.exists(self._pid_file):
try:
self._pid = int(
self._filesystem.read_text_file(self._pid_file))
_log.debug('stale %s pid file, pid %d', se... | [
"def",
"start",
"(",
"self",
")",
":",
"assert",
"not",
"self",
".",
"_pid",
",",
"'%s server is already running'",
"%",
"self",
".",
"_name",
"if",
"self",
".",
"_filesystem",
".",
"exists",
"(",
"self",
".",
"_pid_file",
")",
":",
"try",
":",
"self",
... | Starts the server. | [
"Starts",
"the",
"server",
"."
] | [
"\"\"\"Starts the server. It is an error to start an already started server.\n\n This method also stops any stale servers started by a previous instance.\n \"\"\"",
"# Stop any stale servers left over from previous instances.",
"# These could be raised if the pid file is corrupt."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
51f280c673cd513be9ba48e4f8776edff8090bca | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/servers/server_base.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | stop | <not_specific> | def stop(self):
"""Stops the server. Stopping a server that isn't started is harmless."""
actual_pid = None
try:
if self._filesystem.exists(self._pid_file):
try:
actual_pid = int(
self._filesystem.read_text_file(self._pid_fi... | Stops the server. Stopping a server that isn't started is harmless. | Stops the server. Stopping a server that isn't started is harmless. | [
"Stops",
"the",
"server",
".",
"Stopping",
"a",
"server",
"that",
"isn",
"'",
"t",
"started",
"is",
"harmless",
"."
] | def stop(self):
actual_pid = None
try:
if self._filesystem.exists(self._pid_file):
try:
actual_pid = int(
self._filesystem.read_text_file(self._pid_file))
except (ValueError, UnicodeDecodeError):
... | [
"def",
"stop",
"(",
"self",
")",
":",
"actual_pid",
"=",
"None",
"try",
":",
"if",
"self",
".",
"_filesystem",
".",
"exists",
"(",
"self",
".",
"_pid_file",
")",
":",
"try",
":",
"actual_pid",
"=",
"int",
"(",
"self",
".",
"_filesystem",
".",
"read_t... | Stops the server. | [
"Stops",
"the",
"server",
"."
] | [
"\"\"\"Stops the server. Stopping a server that isn't started is harmless.\"\"\"",
"# These could be raised if the pid file is corrupt.",
"# Try to kill the existing pid, anyway, in case it got orphaned.",
"# Make sure we delete the pid file no matter what happens."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
51f280c673cd513be9ba48e4f8776edff8090bca | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/servers/server_base.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | alive | <not_specific> | def alive(self):
"""Checks whether the server is alive."""
# This by default checks both the process and ports.
# At this point, we think the server has started up, so successes are
# normal while failures are not.
return self._is_server_running_on_all_ports(
success_... | Checks whether the server is alive. | Checks whether the server is alive. | [
"Checks",
"whether",
"the",
"server",
"is",
"alive",
"."
] | def alive(self):
return self._is_server_running_on_all_ports(
success_log_level=logging.DEBUG, failure_log_level=logging.INFO) | [
"def",
"alive",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_server_running_on_all_ports",
"(",
"success_log_level",
"=",
"logging",
".",
"DEBUG",
",",
"failure_log_level",
"=",
"logging",
".",
"INFO",
")"
] | Checks whether the server is alive. | [
"Checks",
"whether",
"the",
"server",
"is",
"alive",
"."
] | [
"\"\"\"Checks whether the server is alive.\"\"\"",
"# This by default checks both the process and ports.",
"# At this point, we think the server has started up, so successes are",
"# normal while failures are not."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
51f280c673cd513be9ba48e4f8776edff8090bca | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/servers/server_base.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _remove_stale_logs | null | def _remove_stale_logs(self):
"""This routine can be overridden by subclasses to try and remove logs
left over from a prior run. This routine should log warnings if the
files cannot be deleted, but should not fail unless failure to
delete the logs will actually cause start() to fail.
... | This routine can be overridden by subclasses to try and remove logs
left over from a prior run. This routine should log warnings if the
files cannot be deleted, but should not fail unless failure to
delete the logs will actually cause start() to fail.
| This routine can be overridden by subclasses to try and remove logs
left over from a prior run. This routine should log warnings if the
files cannot be deleted, but should not fail unless failure to
delete the logs will actually cause start() to fail. | [
"This",
"routine",
"can",
"be",
"overridden",
"by",
"subclasses",
"to",
"try",
"and",
"remove",
"logs",
"left",
"over",
"from",
"a",
"prior",
"run",
".",
"This",
"routine",
"should",
"log",
"warnings",
"if",
"the",
"files",
"cannot",
"be",
"deleted",
"but"... | def _remove_stale_logs(self):
for log_prefix in self._log_prefixes:
try:
self._remove_log_files(self._output_dir, log_prefix)
except OSError:
_log.warning('Failed to remove old %s %s files', self._name,
log_prefix) | [
"def",
"_remove_stale_logs",
"(",
"self",
")",
":",
"for",
"log_prefix",
"in",
"self",
".",
"_log_prefixes",
":",
"try",
":",
"self",
".",
"_remove_log_files",
"(",
"self",
".",
"_output_dir",
",",
"log_prefix",
")",
"except",
"OSError",
":",
"_log",
".",
... | This routine can be overridden by subclasses to try and remove logs
left over from a prior run. | [
"This",
"routine",
"can",
"be",
"overridden",
"by",
"subclasses",
"to",
"try",
"and",
"remove",
"logs",
"left",
"over",
"from",
"a",
"prior",
"run",
"."
] | [
"\"\"\"This routine can be overridden by subclasses to try and remove logs\n left over from a prior run. This routine should log warnings if the\n files cannot be deleted, but should not fail unless failure to\n delete the logs will actually cause start() to fail.\n \"\"\"",
"# Sometim... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
51f280c673cd513be9ba48e4f8776edff8090bca | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/servers/server_base.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _wait_for_action | <not_specific> | def _wait_for_action(self, action, wait_secs=20.0, sleep_secs=1.0):
"""Repeat the action for wait_sec or until it succeeds, sleeping for sleep_secs
in between each attempt. Returns whether it succeeded.
"""
start_time = self._port_obj.host.time()
while self._port_obj.host.time() ... | Repeat the action for wait_sec or until it succeeds, sleeping for sleep_secs
in between each attempt. Returns whether it succeeded.
| Repeat the action for wait_sec or until it succeeds, sleeping for sleep_secs
in between each attempt. Returns whether it succeeded. | [
"Repeat",
"the",
"action",
"for",
"wait_sec",
"or",
"until",
"it",
"succeeds",
"sleeping",
"for",
"sleep_secs",
"in",
"between",
"each",
"attempt",
".",
"Returns",
"whether",
"it",
"succeeded",
"."
] | def _wait_for_action(self, action, wait_secs=20.0, sleep_secs=1.0):
start_time = self._port_obj.host.time()
while self._port_obj.host.time() - start_time < wait_secs:
if action():
return True
_log.debug('Waiting for action: %s', action)
self._port_obj.... | [
"def",
"_wait_for_action",
"(",
"self",
",",
"action",
",",
"wait_secs",
"=",
"20.0",
",",
"sleep_secs",
"=",
"1.0",
")",
":",
"start_time",
"=",
"self",
".",
"_port_obj",
".",
"host",
".",
"time",
"(",
")",
"while",
"self",
".",
"_port_obj",
".",
"hos... | Repeat the action for wait_sec or until it succeeds, sleeping for sleep_secs
in between each attempt. | [
"Repeat",
"the",
"action",
"for",
"wait_sec",
"or",
"until",
"it",
"succeeds",
"sleeping",
"for",
"sleep_secs",
"in",
"between",
"each",
"attempt",
"."
] | [
"\"\"\"Repeat the action for wait_sec or until it succeeds, sleeping for sleep_secs\n in between each attempt. Returns whether it succeeded.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "action",
"type": null
},
{
"param": "wait_secs",
"type": null
},
{
"param": "sleep_secs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "action",
"type": null,
"docstring": null,
"docstring_tokens":... |
51f280c673cd513be9ba48e4f8776edff8090bca | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/servers/server_base.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _is_server_running_on_all_ports | <not_specific> | def _is_server_running_on_all_ports(self,
success_log_level=logging.INFO,
failure_log_level=logging.DEBUG):
"""Returns whether the server is running on all the desired ports.
Args:
success_log_level: Logging lev... | Returns whether the server is running on all the desired ports.
Args:
success_log_level: Logging level for success (default: INFO)
failure_log_level: Logging level for failure (default: DEBUG)
| Returns whether the server is running on all the desired ports. | [
"Returns",
"whether",
"the",
"server",
"is",
"running",
"on",
"all",
"the",
"desired",
"ports",
"."
] | def _is_server_running_on_all_ports(self,
success_log_level=logging.INFO,
failure_log_level=logging.DEBUG):
if (not self._platform.is_win()
and not self._executive.check_running_pid(self._pid)):
_log.debu... | [
"def",
"_is_server_running_on_all_ports",
"(",
"self",
",",
"success_log_level",
"=",
"logging",
".",
"INFO",
",",
"failure_log_level",
"=",
"logging",
".",
"DEBUG",
")",
":",
"if",
"(",
"not",
"self",
".",
"_platform",
".",
"is_win",
"(",
")",
"and",
"not",... | Returns whether the server is running on all the desired ports. | [
"Returns",
"whether",
"the",
"server",
"is",
"running",
"on",
"all",
"the",
"desired",
"ports",
"."
] | [
"\"\"\"Returns whether the server is running on all the desired ports.\n\n Args:\n success_log_level: Logging level for success (default: INFO)\n failure_log_level: Logging level for failure (default: DEBUG)\n \"\"\"",
"# Check self._pid instead of self._process because the lat... | [
{
"param": "self",
"type": null
},
{
"param": "success_log_level",
"type": null
},
{
"param": "failure_log_level",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "success_log_level",
"type": null,
"docstring": "Logging level for s... |
78f41607cae42f0843a0375422944b0899f02e19 | sunlongbo/chromium | content/test/gpu/flake_suppressor/result_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GenerateHtmlOutputFile | null | def GenerateHtmlOutputFile(aggregated_results, outfile=None):
"""Generates an HTML results file.
Args:
aggregated_results: A map containing the aggregated test results.
outfile: A file-like object to output to. Will create one if not provided.
"""
outfile = outfile or tempfile.NamedTemporaryFile(
... | Generates an HTML results file.
Args:
aggregated_results: A map containing the aggregated test results.
outfile: A file-like object to output to. Will create one if not provided.
| Generates an HTML results file. | [
"Generates",
"an",
"HTML",
"results",
"file",
"."
] | def GenerateHtmlOutputFile(aggregated_results, outfile=None):
outfile = outfile or tempfile.NamedTemporaryFile(
mode='w', delete=False, suffix='.html')
try:
outfile.write('<html>\n<body>\n')
string_map = _ConvertAggregatedResultsToStringMap(aggregated_results)
_OutputMapToHtmlFile(string_map, 'Gro... | [
"def",
"GenerateHtmlOutputFile",
"(",
"aggregated_results",
",",
"outfile",
"=",
"None",
")",
":",
"outfile",
"=",
"outfile",
"or",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"mode",
"=",
"'w'",
",",
"delete",
"=",
"False",
",",
"suffix",
"=",
"'.html'",
")... | Generates an HTML results file. | [
"Generates",
"an",
"HTML",
"results",
"file",
"."
] | [
"\"\"\"Generates an HTML results file.\n\n Args:\n aggregated_results: A map containing the aggregated test results.\n outfile: A file-like object to output to. Will create one if not provided.\n \"\"\""
] | [
{
"param": "aggregated_results",
"type": null
},
{
"param": "outfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "aggregated_results",
"type": null,
"docstring": "A map containing the aggregated test results.",
"docstring_tokens": [
"A",
"map",
"containing",
"the",
"aggregated",
"test",
... |
78f41607cae42f0843a0375422944b0899f02e19 | sunlongbo/chromium | content/test/gpu/flake_suppressor/result_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _OutputMapToHtmlFile | null | def _OutputMapToHtmlFile(string_map, result_header, output_file):
"""Outputs a map to a file as a nested list.
Args:
string_map: The string map to output.
result_header: A string containing the header contents placed before the
nested list.
output_file: A file-like object to output the map to.
... | Outputs a map to a file as a nested list.
Args:
string_map: The string map to output.
result_header: A string containing the header contents placed before the
nested list.
output_file: A file-like object to output the map to.
| Outputs a map to a file as a nested list. | [
"Outputs",
"a",
"map",
"to",
"a",
"file",
"as",
"a",
"nested",
"list",
"."
] | def _OutputMapToHtmlFile(string_map, result_header, output_file):
output_file.write('<h1>%s</h1>\n' % result_header)
output_file.write('<ul>\n')
_RecursiveHtmlToFile(string_map, output_file)
output_file.write('</ul>\n') | [
"def",
"_OutputMapToHtmlFile",
"(",
"string_map",
",",
"result_header",
",",
"output_file",
")",
":",
"output_file",
".",
"write",
"(",
"'<h1>%s</h1>\\n'",
"%",
"result_header",
")",
"output_file",
".",
"write",
"(",
"'<ul>\\n'",
")",
"_RecursiveHtmlToFile",
"(",
... | Outputs a map to a file as a nested list. | [
"Outputs",
"a",
"map",
"to",
"a",
"file",
"as",
"a",
"nested",
"list",
"."
] | [
"\"\"\"Outputs a map to a file as a nested list.\n\n Args:\n string_map: The string map to output.\n result_header: A string containing the header contents placed before the\n nested list.\n output_file: A file-like object to output the map to.\n \"\"\""
] | [
{
"param": "string_map",
"type": null
},
{
"param": "result_header",
"type": null
},
{
"param": "output_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "string_map",
"type": null,
"docstring": "The string map to output.",
"docstring_tokens": [
"The",
"string",
"map",
"to",
"output",
"."
],
"default": null,
"is_o... |
78f41607cae42f0843a0375422944b0899f02e19 | sunlongbo/chromium | content/test/gpu/flake_suppressor/result_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RecursiveHtmlToFile | null | def _RecursiveHtmlToFile(node, output_file):
"""Recursively outputs a string map to an output file as HTML.
Specifically, contents are output as an unordered list (<ul>).
Args:
node: The current node to output. Must be either a dict or list.
output_file: A file-like object to output the HTML to.
"""
... | Recursively outputs a string map to an output file as HTML.
Specifically, contents are output as an unordered list (<ul>).
Args:
node: The current node to output. Must be either a dict or list.
output_file: A file-like object to output the HTML to.
| Recursively outputs a string map to an output file as HTML.
Specifically, contents are output as an unordered list (). | [
"Recursively",
"outputs",
"a",
"string",
"map",
"to",
"an",
"output",
"file",
"as",
"HTML",
".",
"Specifically",
"contents",
"are",
"output",
"as",
"an",
"unordered",
"list",
"()",
"."
] | def _RecursiveHtmlToFile(node, output_file):
if isinstance(node, dict):
for key, value in node.items():
output_file.write('<li>%s</li>\n' % key)
output_file.write('<ul>\n')
_RecursiveHtmlToFile(value, output_file)
output_file.write('</ul>\n')
elif isinstance(node, list):
for element ... | [
"def",
"_RecursiveHtmlToFile",
"(",
"node",
",",
"output_file",
")",
":",
"if",
"isinstance",
"(",
"node",
",",
"dict",
")",
":",
"for",
"key",
",",
"value",
"in",
"node",
".",
"items",
"(",
")",
":",
"output_file",
".",
"write",
"(",
"'<li>%s</li>\\n'",... | Recursively outputs a string map to an output file as HTML. | [
"Recursively",
"outputs",
"a",
"string",
"map",
"to",
"an",
"output",
"file",
"as",
"HTML",
"."
] | [
"\"\"\"Recursively outputs a string map to an output file as HTML.\n\n Specifically, contents are output as an unordered list (<ul>).\n\n Args:\n node: The current node to output. Must be either a dict or list.\n output_file: A file-like object to output the HTML to.\n \"\"\""
] | [
{
"param": "node",
"type": null
},
{
"param": "output_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node",
"type": null,
"docstring": "The current node to output. Must be either a dict or list.",
"docstring_tokens": [
"The",
"current",
"node",
"to",
"output",
".",
"Must... |
78f41607cae42f0843a0375422944b0899f02e19 | sunlongbo/chromium | content/test/gpu/flake_suppressor/result_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ConvertAggregatedResultsToStringMap | <not_specific> | def _ConvertAggregatedResultsToStringMap(aggregated_results):
"""Converts aggregated results to a format usable by _RecursiveHtmlToFile.
Specifically, updates the string representation of the typ tags and replaces
the lowest level dict with the build URL list.
Args:
aggregated_results: A map containing th... | Converts aggregated results to a format usable by _RecursiveHtmlToFile.
Specifically, updates the string representation of the typ tags and replaces
the lowest level dict with the build URL list.
Args:
aggregated_results: A map containing the aggregated test results.
Returns:
A map in the format:
... | Converts aggregated results to a format usable by _RecursiveHtmlToFile.
Specifically, updates the string representation of the typ tags and replaces
the lowest level dict with the build URL list. | [
"Converts",
"aggregated",
"results",
"to",
"a",
"format",
"usable",
"by",
"_RecursiveHtmlToFile",
".",
"Specifically",
"updates",
"the",
"string",
"representation",
"of",
"the",
"typ",
"tags",
"and",
"replaces",
"the",
"lowest",
"level",
"dict",
"with",
"the",
"... | def _ConvertAggregatedResultsToStringMap(aggregated_results):
string_map = {}
for suite, test_map in aggregated_results.items():
for test, tag_map in test_map.items():
for typ_tags, build_url_list in tag_map.items():
str_typ_tags = ' '.join(typ_tags)
string_map.setdefault(suite,
... | [
"def",
"_ConvertAggregatedResultsToStringMap",
"(",
"aggregated_results",
")",
":",
"string_map",
"=",
"{",
"}",
"for",
"suite",
",",
"test_map",
"in",
"aggregated_results",
".",
"items",
"(",
")",
":",
"for",
"test",
",",
"tag_map",
"in",
"test_map",
".",
"it... | Converts aggregated results to a format usable by _RecursiveHtmlToFile. | [
"Converts",
"aggregated",
"results",
"to",
"a",
"format",
"usable",
"by",
"_RecursiveHtmlToFile",
"."
] | [
"\"\"\"Converts aggregated results to a format usable by _RecursiveHtmlToFile.\n\n Specifically, updates the string representation of the typ tags and replaces\n the lowest level dict with the build URL list.\n\n Args:\n aggregated_results: A map containing the aggregated test results.\n\n Returns:\n A ma... | [
{
"param": "aggregated_results",
"type": null
}
] | {
"returns": [
{
"docstring": "A map in the format:\n{\n'suite': {\n'test': {\n'space separated typ tags': ['build', 'url', 'list']\n}\n}\n}",
"docstring_tokens": [
"A",
"map",
"in",
"the",
"format",
":",
"{",
"'",
"suite",
... |
78f41607cae42f0843a0375422944b0899f02e19 | sunlongbo/chromium | content/test/gpu/flake_suppressor/result_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ConvertFromTestGroupingToConfigGrouping | <not_specific> | def _ConvertFromTestGroupingToConfigGrouping(string_map):
"""Converts |string| map to be grouped by typ tags/configuration.
Args:
string_map: The output of _ConvertAggregatedResultsToStringMap.
Returns:
A map in the format:
{
'space separated typ tags': {
'suite': {
'test': [... | Converts |string| map to be grouped by typ tags/configuration.
Args:
string_map: The output of _ConvertAggregatedResultsToStringMap.
Returns:
A map in the format:
{
'space separated typ tags': {
'suite': {
'test': ['build', 'url', 'list']
}
}
}
| Converts |string| map to be grouped by typ tags/configuration. | [
"Converts",
"|string|",
"map",
"to",
"be",
"grouped",
"by",
"typ",
"tags",
"/",
"configuration",
"."
] | def _ConvertFromTestGroupingToConfigGrouping(string_map):
converted_map = {}
for suite, test_map in string_map.items():
for test, tag_map in test_map.items():
for typ_tags, build_urls in tag_map.items():
converted_map.setdefault(typ_tags, {}).setdefault(suite,
... | [
"def",
"_ConvertFromTestGroupingToConfigGrouping",
"(",
"string_map",
")",
":",
"converted_map",
"=",
"{",
"}",
"for",
"suite",
",",
"test_map",
"in",
"string_map",
".",
"items",
"(",
")",
":",
"for",
"test",
",",
"tag_map",
"in",
"test_map",
".",
"items",
"... | Converts |string| map to be grouped by typ tags/configuration. | [
"Converts",
"|string|",
"map",
"to",
"be",
"grouped",
"by",
"typ",
"tags",
"/",
"configuration",
"."
] | [
"\"\"\"Converts |string| map to be grouped by typ tags/configuration.\n\n Args:\n string_map: The output of _ConvertAggregatedResultsToStringMap.\n\n Returns:\n A map in the format:\n {\n 'space separated typ tags': {\n 'suite': {\n 'test': ['build', 'url', 'list']\n }\n ... | [
{
"param": "string_map",
"type": null
}
] | {
"returns": [
{
"docstring": "A map in the format:\n{\n'space separated typ tags': {\n'suite': {\n'test': ['build', 'url', 'list']\n}\n}\n}",
"docstring_tokens": [
"A",
"map",
"in",
"the",
"format",
":",
"{",
"'",
"space",
... |
b285a543a01efc7a54e9a9bfdf1a4606ff91ff19 | sunlongbo/chromium | third_party/libxslt/chromium/roll.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | libxml_path_option | <not_specific> | def libxml_path_option(src_path):
"""Gets the path to libxml/linux in Chromium.
libxslt needs to be configured with libxml source.
Args:
src_path: The Chromium src path.
Returns:
The path to the libxml2 third_party/libxml/linux configure
output.
"""
libxml_linux_path =... | Gets the path to libxml/linux in Chromium.
libxslt needs to be configured with libxml source.
Args:
src_path: The Chromium src path.
Returns:
The path to the libxml2 third_party/libxml/linux configure
output.
| Gets the path to libxml/linux in Chromium.
libxslt needs to be configured with libxml source. | [
"Gets",
"the",
"path",
"to",
"libxml",
"/",
"linux",
"in",
"Chromium",
".",
"libxslt",
"needs",
"to",
"be",
"configured",
"with",
"libxml",
"source",
"."
] | def libxml_path_option(src_path):
libxml_linux_path = os.path.join(src_path, THIRD_PARTY_LIBXML_LINUX)
return ['--with-libxml-src=%s' % libxml_linux_path] | [
"def",
"libxml_path_option",
"(",
"src_path",
")",
":",
"libxml_linux_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"src_path",
",",
"THIRD_PARTY_LIBXML_LINUX",
")",
"return",
"[",
"'--with-libxml-src=%s'",
"%",
"libxml_linux_path",
"]"
] | Gets the path to libxml/linux in Chromium. | [
"Gets",
"the",
"path",
"to",
"libxml",
"/",
"linux",
"in",
"Chromium",
"."
] | [
"\"\"\"Gets the path to libxml/linux in Chromium.\n\n libxslt needs to be configured with libxml source.\n\n Args:\n src_path: The Chromium src path.\n\n Returns:\n The path to the libxml2 third_party/libxml/linux configure\n output.\n \"\"\""
] | [
{
"param": "src_path",
"type": null
}
] | {
"returns": [
{
"docstring": "The path to the libxml2 third_party/libxml/linux configure\noutput.",
"docstring_tokens": [
"The",
"path",
"to",
"the",
"libxml2",
"third_party",
"/",
"libxml",
"/",
"linux",
"configu... |
b285a543a01efc7a54e9a9bfdf1a4606ff91ff19 | sunlongbo/chromium | third_party/libxslt/chromium/roll.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | git | null | def git(*args):
"""Runs a git subcommand.
On Windows this uses the shell because there's a git wrapper
batch file in depot_tools.
Arguments:
args: The arguments to pass to git.
"""
command = ['git'] + list(args)
subprocess.check_call(command, shell=(os.name == 'nt')) | Runs a git subcommand.
On Windows this uses the shell because there's a git wrapper
batch file in depot_tools.
Arguments:
args: The arguments to pass to git.
| Runs a git subcommand.
On Windows this uses the shell because there's a git wrapper
batch file in depot_tools. | [
"Runs",
"a",
"git",
"subcommand",
".",
"On",
"Windows",
"this",
"uses",
"the",
"shell",
"because",
"there",
"'",
"s",
"a",
"git",
"wrapper",
"batch",
"file",
"in",
"depot_tools",
"."
] | def git(*args):
command = ['git'] + list(args)
subprocess.check_call(command, shell=(os.name == 'nt')) | [
"def",
"git",
"(",
"*",
"args",
")",
":",
"command",
"=",
"[",
"'git'",
"]",
"+",
"list",
"(",
"args",
")",
"subprocess",
".",
"check_call",
"(",
"command",
",",
"shell",
"=",
"(",
"os",
".",
"name",
"==",
"'nt'",
")",
")"
] | Runs a git subcommand. | [
"Runs",
"a",
"git",
"subcommand",
"."
] | [
"\"\"\"Runs a git subcommand.\n\n On Windows this uses the shell because there's a git wrapper\n batch file in depot_tools.\n\n Arguments:\n args: The arguments to pass to git.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [
{
"identifier": "args",
"type": null,
"docstring": "The arguments to pass to git.",
"docstring_tokens": [
"The",
"arguments",
"to",
"pass",
"to",
"git",
"."
... |
b285a543a01efc7a54e9a9bfdf1a4606ff91ff19 | sunlongbo/chromium | third_party/libxslt/chromium/roll.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | remove_tracked_and_local_dir | null | def remove_tracked_and_local_dir(path):
"""Removes the contents of a directory from git, and the filesystem.
Arguments:
path: The path to remove.
"""
remove_tracked_files([path])
shutil.rmtree(path, ignore_errors=True)
os.mkdir(path) | Removes the contents of a directory from git, and the filesystem.
Arguments:
path: The path to remove.
| Removes the contents of a directory from git, and the filesystem. | [
"Removes",
"the",
"contents",
"of",
"a",
"directory",
"from",
"git",
"and",
"the",
"filesystem",
"."
] | def remove_tracked_and_local_dir(path):
remove_tracked_files([path])
shutil.rmtree(path, ignore_errors=True)
os.mkdir(path) | [
"def",
"remove_tracked_and_local_dir",
"(",
"path",
")",
":",
"remove_tracked_files",
"(",
"[",
"path",
"]",
")",
"shutil",
".",
"rmtree",
"(",
"path",
",",
"ignore_errors",
"=",
"True",
")",
"os",
".",
"mkdir",
"(",
"path",
")"
] | Removes the contents of a directory from git, and the filesystem. | [
"Removes",
"the",
"contents",
"of",
"a",
"directory",
"from",
"git",
"and",
"the",
"filesystem",
"."
] | [
"\"\"\"Removes the contents of a directory from git, and the filesystem.\n\n Arguments:\n path: The path to remove.\n \"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": "The path to remove.",
"docstring_tokens": [
"The",
"path",
"to",
"remove",
"."
],
"default": null,
"is_optional": null
}
],
"... |
b285a543a01efc7a54e9a9bfdf1a4606ff91ff19 | sunlongbo/chromium | third_party/libxslt/chromium/roll.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | remove_tracked_files | null | def remove_tracked_files(files_to_remove):
"""Removes tracked files from git.
Arguments:
files_to_remove: The files to remove.
"""
files_to_remove = [f for f in files_to_remove if os.path.exists(f)]
git('rm', '-rf', *files_to_remove) | Removes tracked files from git.
Arguments:
files_to_remove: The files to remove.
| Removes tracked files from git. | [
"Removes",
"tracked",
"files",
"from",
"git",
"."
] | def remove_tracked_files(files_to_remove):
files_to_remove = [f for f in files_to_remove if os.path.exists(f)]
git('rm', '-rf', *files_to_remove) | [
"def",
"remove_tracked_files",
"(",
"files_to_remove",
")",
":",
"files_to_remove",
"=",
"[",
"f",
"for",
"f",
"in",
"files_to_remove",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"f",
")",
"]",
"git",
"(",
"'rm'",
",",
"'-rf'",
",",
"*",
"files_to_remo... | Removes tracked files from git. | [
"Removes",
"tracked",
"files",
"from",
"git",
"."
] | [
"\"\"\"Removes tracked files from git.\n\n Arguments:\n files_to_remove: The files to remove.\n \"\"\""
] | [
{
"param": "files_to_remove",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "files_to_remove",
"type": null,
"docstring": "The files to remove.",
"docstring_tokens": [
"The",
"files",
"to",
"remove",
"."
],
"default": null,
"is_optional": null
... |
b285a543a01efc7a54e9a9bfdf1a4606ff91ff19 | sunlongbo/chromium | third_party/libxslt/chromium/roll.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | sed_in_place | null | def sed_in_place(input_filename, program):
"""Replaces text in a file.
Arguments:
input_filename: The file to edit.
program: The sed program to perform edits on the file.
"""
# OS X's sed requires -e
subprocess.check_call(['sed', '-i', '-e', program, input_filename]) | Replaces text in a file.
Arguments:
input_filename: The file to edit.
program: The sed program to perform edits on the file.
| Replaces text in a file. | [
"Replaces",
"text",
"in",
"a",
"file",
"."
] | def sed_in_place(input_filename, program):
subprocess.check_call(['sed', '-i', '-e', program, input_filename]) | [
"def",
"sed_in_place",
"(",
"input_filename",
",",
"program",
")",
":",
"subprocess",
".",
"check_call",
"(",
"[",
"'sed'",
",",
"'-i'",
",",
"'-e'",
",",
"program",
",",
"input_filename",
"]",
")"
] | Replaces text in a file. | [
"Replaces",
"text",
"in",
"a",
"file",
"."
] | [
"\"\"\"Replaces text in a file.\n\n Arguments:\n input_filename: The file to edit.\n program: The sed program to perform edits on the file.\n \"\"\"",
"# OS X's sed requires -e"
] | [
{
"param": "input_filename",
"type": null
},
{
"param": "program",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_filename",
"type": null,
"docstring": "The file to edit.",
"docstring_tokens": [
"The",
"file",
"to",
"edit",
"."
],
"default": null,
"is_optional": null
},
... |
b285a543a01efc7a54e9a9bfdf1a4606ff91ff19 | sunlongbo/chromium | third_party/libxslt/chromium/roll.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | patch_config | null | def patch_config():
"""Changes autoconf results which can not be changed with options."""
sed_in_place('config.h', 's/#define HAVE_CLOCK_GETTIME 1//')
# https://crbug.com/670720
sed_in_place('config.h', 's/#define HAVE_ASCTIME 1//')
sed_in_place('config.h', 's/#define HAVE_LOCALTIME 1//')
sed_i... | Changes autoconf results which can not be changed with options. | Changes autoconf results which can not be changed with options. | [
"Changes",
"autoconf",
"results",
"which",
"can",
"not",
"be",
"changed",
"with",
"options",
"."
] | def patch_config():
sed_in_place('config.h', 's/#define HAVE_CLOCK_GETTIME 1//')
sed_in_place('config.h', 's/#define HAVE_ASCTIME 1//')
sed_in_place('config.h', 's/#define HAVE_LOCALTIME 1//')
sed_in_place('config.h', 's/#define HAVE_MKTIME 1//')
sed_in_place('config.log',
's/[a-z.0... | [
"def",
"patch_config",
"(",
")",
":",
"sed_in_place",
"(",
"'config.h'",
",",
"'s/#define HAVE_CLOCK_GETTIME 1//'",
")",
"sed_in_place",
"(",
"'config.h'",
",",
"'s/#define HAVE_ASCTIME 1//'",
")",
"sed_in_place",
"(",
"'config.h'",
",",
"'s/#define HAVE_LOCALTIME 1//'",
... | Changes autoconf results which can not be changed with options. | [
"Changes",
"autoconf",
"results",
"which",
"can",
"not",
"be",
"changed",
"with",
"options",
"."
] | [
"\"\"\"Changes autoconf results which can not be changed with options.\"\"\"",
"# https://crbug.com/670720"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
7ca492d282d2bc75e24274a04f2d183b3ff586c3 | sunlongbo/chromium | chrome/browser/resources/chromeos/accessibility/chromevox/tools/generate_deps.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _HasSameContent | <not_specific> | def _HasSameContent(filename, content):
'''Returns true if the given file is readable and has the given content.'''
try:
with open(filename) as file:
return file.read() == content
except:
# Ignore all errors and fall back on a safe bet.
return False | Returns true if the given file is readable and has the given content. | Returns true if the given file is readable and has the given content. | [
"Returns",
"true",
"if",
"the",
"given",
"file",
"is",
"readable",
"and",
"has",
"the",
"given",
"content",
"."
] | def _HasSameContent(filename, content):
try:
with open(filename) as file:
return file.read() == content
except:
return False | [
"def",
"_HasSameContent",
"(",
"filename",
",",
"content",
")",
":",
"try",
":",
"with",
"open",
"(",
"filename",
")",
"as",
"file",
":",
"return",
"file",
".",
"read",
"(",
")",
"==",
"content",
"except",
":",
"return",
"False"
] | Returns true if the given file is readable and has the given content. | [
"Returns",
"true",
"if",
"the",
"given",
"file",
"is",
"readable",
"and",
"has",
"the",
"given",
"content",
"."
] | [
"'''Returns true if the given file is readable and has the given content.'''",
"# Ignore all errors and fall back on a safe bet."
] | [
{
"param": "filename",
"type": null
},
{
"param": "content",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "content",
"type": null,
"docstring": null,
"docstring_tok... |
0d57685018910e6464ff7735eb8decdaa88ec9ce | sunlongbo/chromium | third_party/xcbproto/src/xcbgen/matcher.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | import_ | null | def import_(node, module, namespace):
'''
For imports, we load the file, create a new namespace object,
execute recursively, then record the import (for header files, etc.)
'''
# To avoid circular import error
from xcbgen import state
module.import_level = module.import_level + 1
new_fil... |
For imports, we load the file, create a new namespace object,
execute recursively, then record the import (for header files, etc.)
| For imports, we load the file, create a new namespace object,
execute recursively, then record the import (for header files, etc.) | [
"For",
"imports",
"we",
"load",
"the",
"file",
"create",
"a",
"new",
"namespace",
"object",
"execute",
"recursively",
"then",
"record",
"the",
"import",
"(",
"for",
"header",
"files",
"etc",
".",
")"
] | def import_(node, module, namespace):
from xcbgen import state
module.import_level = module.import_level + 1
new_file = join(namespace.dir, '%s.xml' % node.text)
new_root = parse(new_file).getroot()
new_namespace = state.Namespace(new_file)
execute(module, new_namespace)
module.import_level ... | [
"def",
"import_",
"(",
"node",
",",
"module",
",",
"namespace",
")",
":",
"from",
"xcbgen",
"import",
"state",
"module",
".",
"import_level",
"=",
"module",
".",
"import_level",
"+",
"1",
"new_file",
"=",
"join",
"(",
"namespace",
".",
"dir",
",",
"'%s.x... | For imports, we load the file, create a new namespace object,
execute recursively, then record the import (for header files, etc.) | [
"For",
"imports",
"we",
"load",
"the",
"file",
"create",
"a",
"new",
"namespace",
"object",
"execute",
"recursively",
"then",
"record",
"the",
"import",
"(",
"for",
"header",
"files",
"etc",
".",
")"
] | [
"'''\n For imports, we load the file, create a new namespace object,\n execute recursively, then record the import (for header files, etc.)\n '''",
"# To avoid circular import error"
] | [
{
"param": "node",
"type": null
},
{
"param": "module",
"type": null
},
{
"param": "namespace",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "module",
"type": null,
"docstring": null,
"docstring_tokens":... |
c9f1c2c5052515c1160e1dcdf8c6d3e0c388570b | sunlongbo/chromium | components/policy/tools/template_writers/writers/chromeos_admx_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetWriter | <not_specific> | def GetWriter(config):
'''Factory method for creating ADMXWriter objects for the Chrome OS platform
See the constructor of TemplateWriter for description of arguments.
'''
return ChromeOSADMXWriter(['chrome_os'], config) | Factory method for creating ADMXWriter objects for the Chrome OS platform
See the constructor of TemplateWriter for description of arguments.
| Factory method for creating ADMXWriter objects for the Chrome OS platform
See the constructor of TemplateWriter for description of arguments. | [
"Factory",
"method",
"for",
"creating",
"ADMXWriter",
"objects",
"for",
"the",
"Chrome",
"OS",
"platform",
"See",
"the",
"constructor",
"of",
"TemplateWriter",
"for",
"description",
"of",
"arguments",
"."
] | def GetWriter(config):
return ChromeOSADMXWriter(['chrome_os'], config) | [
"def",
"GetWriter",
"(",
"config",
")",
":",
"return",
"ChromeOSADMXWriter",
"(",
"[",
"'chrome_os'",
"]",
",",
"config",
")"
] | Factory method for creating ADMXWriter objects for the Chrome OS platform
See the constructor of TemplateWriter for description of arguments. | [
"Factory",
"method",
"for",
"creating",
"ADMXWriter",
"objects",
"for",
"the",
"Chrome",
"OS",
"platform",
"See",
"the",
"constructor",
"of",
"TemplateWriter",
"for",
"description",
"of",
"arguments",
"."
] | [
"'''Factory method for creating ADMXWriter objects for the Chrome OS platform\n See the constructor of TemplateWriter for description of arguments.\n '''"
] | [
{
"param": "config",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
97edbfe352e89b09824957736f508ebedda14ec7 | sunlongbo/chromium | tools/json_schema_compiler/h_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Generate | <not_specific> | def Generate(self):
"""Generates a Code object with the .h for a single namespace.
"""
c = Code()
(c.Append(cpp_util.CHROMIUM_LICENSE)
.Append()
.Append(cpp_util.GENERATED_FILE_MESSAGE %
cpp_util.ToPosixPath(self._namespace.source_file))
.Append()
)
# Hack: for t... | Generates a Code object with the .h for a single namespace.
| Generates a Code object with the .h for a single namespace. | [
"Generates",
"a",
"Code",
"object",
"with",
"the",
".",
"h",
"for",
"a",
"single",
"namespace",
"."
] | def Generate(self):
c = Code()
(c.Append(cpp_util.CHROMIUM_LICENSE)
.Append()
.Append(cpp_util.GENERATED_FILE_MESSAGE %
cpp_util.ToPosixPath(self._namespace.source_file))
.Append()
)
output_file = os.path.splitext(self._namespace.source_file)[0] + '.h'
ifndef_name = c... | [
"def",
"Generate",
"(",
"self",
")",
":",
"c",
"=",
"Code",
"(",
")",
"(",
"c",
".",
"Append",
"(",
"cpp_util",
".",
"CHROMIUM_LICENSE",
")",
".",
"Append",
"(",
")",
".",
"Append",
"(",
"cpp_util",
".",
"GENERATED_FILE_MESSAGE",
"%",
"cpp_util",
".",
... | Generates a Code object with the .h for a single namespace. | [
"Generates",
"a",
"Code",
"object",
"with",
"the",
".",
"h",
"for",
"a",
"single",
"namespace",
"."
] | [
"\"\"\"Generates a Code object with the .h for a single namespace.\n \"\"\"",
"# Hack: for the purpose of gyp the header file will always be the source",
"# file with its file extension replaced by '.h'. Assume so.",
"# Hack: tabs and windows have circular references, so only generate hard",
"# reference... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
97edbfe352e89b09824957736f508ebedda14ec7 | sunlongbo/chromium | tools/json_schema_compiler/h_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateEnumDeclaration | <not_specific> | def _GenerateEnumDeclaration(self, enum_name, type_):
"""Generate a code object with the declaration of a C++ enum.
"""
c = Code()
c.Sblock('enum %s {' % enum_name)
c.Append(self._type_helper.GetEnumNoneValue(type_) + ',')
for value in type_.enum_values:
current_enum_string = self._type_h... | Generate a code object with the declaration of a C++ enum.
| Generate a code object with the declaration of a C++ enum. | [
"Generate",
"a",
"code",
"object",
"with",
"the",
"declaration",
"of",
"a",
"C",
"++",
"enum",
"."
] | def _GenerateEnumDeclaration(self, enum_name, type_):
c = Code()
c.Sblock('enum %s {' % enum_name)
c.Append(self._type_helper.GetEnumNoneValue(type_) + ',')
for value in type_.enum_values:
current_enum_string = self._type_helper.GetEnumValue(type_, value)
c.Append(current_enum_string + ',')
... | [
"def",
"_GenerateEnumDeclaration",
"(",
"self",
",",
"enum_name",
",",
"type_",
")",
":",
"c",
"=",
"Code",
"(",
")",
"c",
".",
"Sblock",
"(",
"'enum %s {'",
"%",
"enum_name",
")",
"c",
".",
"Append",
"(",
"self",
".",
"_type_helper",
".",
"GetEnumNoneVa... | Generate a code object with the declaration of a C++ enum. | [
"Generate",
"a",
"code",
"object",
"with",
"the",
"declaration",
"of",
"a",
"C",
"++",
"enum",
"."
] | [
"\"\"\"Generate a code object with the declaration of a C++ enum.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "enum_name",
"type": null
},
{
"param": "type_",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "enum_name",
"type": null,
"docstring": null,
"docstring_token... |
97edbfe352e89b09824957736f508ebedda14ec7 | sunlongbo/chromium | tools/json_schema_compiler/h_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateFields | <not_specific> | def _GenerateFields(self, props):
"""Generates the field declarations when declaring a type.
"""
c = Code()
needs_blank_line = False
for prop in props:
if needs_blank_line:
c.Append()
needs_blank_line = True
if prop.description:
c.Comment(prop.description)
# A... | Generates the field declarations when declaring a type.
| Generates the field declarations when declaring a type. | [
"Generates",
"the",
"field",
"declarations",
"when",
"declaring",
"a",
"type",
"."
] | def _GenerateFields(self, props):
c = Code()
needs_blank_line = False
for prop in props:
if needs_blank_line:
c.Append()
needs_blank_line = True
if prop.description:
c.Comment(prop.description)
is_ptr = prop.optional or prop.type_.property_type == PropertyType.ANY
... | [
"def",
"_GenerateFields",
"(",
"self",
",",
"props",
")",
":",
"c",
"=",
"Code",
"(",
")",
"needs_blank_line",
"=",
"False",
"for",
"prop",
"in",
"props",
":",
"if",
"needs_blank_line",
":",
"c",
".",
"Append",
"(",
")",
"needs_blank_line",
"=",
"True",
... | Generates the field declarations when declaring a type. | [
"Generates",
"the",
"field",
"declarations",
"when",
"declaring",
"a",
"type",
"."
] | [
"\"\"\"Generates the field declarations when declaring a type.\n \"\"\"",
"# ANY is a base::Value which is abstract and cannot be a direct member, so",
"# we always need to wrap it in a scoped_ptr."
] | [
{
"param": "self",
"type": null
},
{
"param": "props",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "props",
"type": null,
"docstring": null,
"docstring_tokens": ... |
97edbfe352e89b09824957736f508ebedda14ec7 | sunlongbo/chromium | tools/json_schema_compiler/h_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateType | <not_specific> | def _GenerateType(self, type_, is_toplevel=False, generate_typedefs=False):
"""Generates a struct for |type_|.
|is_toplevel| implies that the type was declared in the "types" field
of an API schema. This determines the correct function
modifier(s).
|gen... | Generates a struct for |type_|.
|is_toplevel| implies that the type was declared in the "types" field
of an API schema. This determines the correct function
modifier(s).
|generate_typedefs| controls whether primitive types should be generated as
... | Generates a struct for |type_|.
|is_toplevel| implies that the type was declared in the "types" field
of an API schema. This determines the correct function
modifier(s).
|generate_typedefs| controls whether primitive types should be generated as
a typedef. This may not always be desired. If false,
primitive types... | [
"Generates",
"a",
"struct",
"for",
"|type_|",
".",
"|is_toplevel|",
"implies",
"that",
"the",
"type",
"was",
"declared",
"in",
"the",
"\"",
"types",
"\"",
"field",
"of",
"an",
"API",
"schema",
".",
"This",
"determines",
"the",
"correct",
"function",
"modifie... | def _GenerateType(self, type_, is_toplevel=False, generate_typedefs=False):
classname = cpp_util.Classname(schema_util.StripNamespace(type_.name))
c = Code()
if type_.functions:
(c.Append('namespace %s {' % classname)
.Append()
)
for function in type_.functions.values():
c.... | [
"def",
"_GenerateType",
"(",
"self",
",",
"type_",
",",
"is_toplevel",
"=",
"False",
",",
"generate_typedefs",
"=",
"False",
")",
":",
"classname",
"=",
"cpp_util",
".",
"Classname",
"(",
"schema_util",
".",
"StripNamespace",
"(",
"type_",
".",
"name",
")",
... | Generates a struct for |type_|. | [
"Generates",
"a",
"struct",
"for",
"|type_|",
"."
] | [
"\"\"\"Generates a struct for |type_|.\n\n |is_toplevel| implies that the type was declared in the \"types\" field\n of an API schema. This determines the correct function\n modifier(s).\n |generate_typedefs| controls whether primitive types should be genera... | [
{
"param": "self",
"type": null
},
{
"param": "type_",
"type": null
},
{
"param": "is_toplevel",
"type": null
},
{
"param": "generate_typedefs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type_",
"type": null,
"docstring": null,
"docstring_tokens": ... |
97edbfe352e89b09824957736f508ebedda14ec7 | sunlongbo/chromium | tools/json_schema_compiler/h_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateEvent | <not_specific> | def _GenerateEvent(self, event):
"""Generates the namespaces for an event.
"""
c = Code()
# TODO(kalman): use event.unix_name not Classname.
event_namespace = cpp_util.Classname(event.name)
(c.Append('namespace %s {' % event_namespace)
.Append()
.Concat(self._GenerateEventNameConstan... | Generates the namespaces for an event.
| Generates the namespaces for an event. | [
"Generates",
"the",
"namespaces",
"for",
"an",
"event",
"."
] | def _GenerateEvent(self, event):
c = Code()
event_namespace = cpp_util.Classname(event.name)
(c.Append('namespace %s {' % event_namespace)
.Append()
.Concat(self._GenerateEventNameConstant(event))
.Concat(self._GenerateAsyncResponseArguments(event.params))
.Append('} // namespace %s... | [
"def",
"_GenerateEvent",
"(",
"self",
",",
"event",
")",
":",
"c",
"=",
"Code",
"(",
")",
"event_namespace",
"=",
"cpp_util",
".",
"Classname",
"(",
"event",
".",
"name",
")",
"(",
"c",
".",
"Append",
"(",
"'namespace %s {'",
"%",
"event_namespace",
")",... | Generates the namespaces for an event. | [
"Generates",
"the",
"namespaces",
"for",
"an",
"event",
"."
] | [
"\"\"\"Generates the namespaces for an event.\n \"\"\"",
"# TODO(kalman): use event.unix_name not Classname."
] | [
{
"param": "self",
"type": null
},
{
"param": "event",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event",
"type": null,
"docstring": null,
"docstring_tokens": ... |
97edbfe352e89b09824957736f508ebedda14ec7 | sunlongbo/chromium | tools/json_schema_compiler/h_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateFunction | <not_specific> | def _GenerateFunction(self, function):
"""Generates the namespaces and structs for a function.
"""
c = Code()
# TODO(kalman): Use function.unix_name not Classname here.
function_namespace = cpp_util.Classname(function.name)
# Windows has a #define for SendMessage, so to avoid any issues, we need... | Generates the namespaces and structs for a function.
| Generates the namespaces and structs for a function. | [
"Generates",
"the",
"namespaces",
"and",
"structs",
"for",
"a",
"function",
"."
] | def _GenerateFunction(self, function):
c = Code()
function_namespace = cpp_util.Classname(function.name)
if function_namespace == 'SendMessage':
function_namespace = 'PassMessage'
(c.Append('namespace %s {' % function_namespace)
.Append()
.Cblock(self._GenerateFunctionParams(function))... | [
"def",
"_GenerateFunction",
"(",
"self",
",",
"function",
")",
":",
"c",
"=",
"Code",
"(",
")",
"function_namespace",
"=",
"cpp_util",
".",
"Classname",
"(",
"function",
".",
"name",
")",
"if",
"function_namespace",
"==",
"'SendMessage'",
":",
"function_namesp... | Generates the namespaces and structs for a function. | [
"Generates",
"the",
"namespaces",
"and",
"structs",
"for",
"a",
"function",
"."
] | [
"\"\"\"Generates the namespaces and structs for a function.\n \"\"\"",
"# TODO(kalman): Use function.unix_name not Classname here.",
"# Windows has a #define for SendMessage, so to avoid any issues, we need",
"# to not use the name."
] | [
{
"param": "self",
"type": null
},
{
"param": "function",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "function",
"type": null,
"docstring": null,
"docstring_tokens... |
97edbfe352e89b09824957736f508ebedda14ec7 | sunlongbo/chromium | tools/json_schema_compiler/h_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateFunctionParams | <not_specific> | def _GenerateFunctionParams(self, function):
"""Generates the struct for passing parameters from JSON to a function.
"""
if not function.params:
return Code()
c = Code()
(c.Sblock('struct Params {')
.Append('static std::unique_ptr<Params> Create(%s);' %
self._GenerateP... | Generates the struct for passing parameters from JSON to a function.
| Generates the struct for passing parameters from JSON to a function. | [
"Generates",
"the",
"struct",
"for",
"passing",
"parameters",
"from",
"JSON",
"to",
"a",
"function",
"."
] | def _GenerateFunctionParams(self, function):
if not function.params:
return Code()
c = Code()
(c.Sblock('struct Params {')
.Append('static std::unique_ptr<Params> Create(%s);' %
self._GenerateParams(
('const base::Value::ConstListView& args',)))
.App... | [
"def",
"_GenerateFunctionParams",
"(",
"self",
",",
"function",
")",
":",
"if",
"not",
"function",
".",
"params",
":",
"return",
"Code",
"(",
")",
"c",
"=",
"Code",
"(",
")",
"(",
"c",
".",
"Sblock",
"(",
"'struct Params {'",
")",
".",
"Append",
"(",
... | Generates the struct for passing parameters from JSON to a function. | [
"Generates",
"the",
"struct",
"for",
"passing",
"parameters",
"from",
"JSON",
"to",
"a",
"function",
"."
] | [
"\"\"\"Generates the struct for passing parameters from JSON to a function.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "function",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "function",
"type": null,
"docstring": null,
"docstring_tokens... |
97edbfe352e89b09824957736f508ebedda14ec7 | sunlongbo/chromium | tools/json_schema_compiler/h_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateTypes | <not_specific> | def _GenerateTypes(self, types, is_toplevel=False, generate_typedefs=False):
"""Generate the structures required by a property such as OBJECT classes
and enums.
"""
c = Code()
for type_ in types:
c.Cblock(self._GenerateType(type_,
is_toplevel=is_toplevel,
... | Generate the structures required by a property such as OBJECT classes
and enums.
| Generate the structures required by a property such as OBJECT classes
and enums. | [
"Generate",
"the",
"structures",
"required",
"by",
"a",
"property",
"such",
"as",
"OBJECT",
"classes",
"and",
"enums",
"."
] | def _GenerateTypes(self, types, is_toplevel=False, generate_typedefs=False):
c = Code()
for type_ in types:
c.Cblock(self._GenerateType(type_,
is_toplevel=is_toplevel,
generate_typedefs=generate_typedefs))
return c | [
"def",
"_GenerateTypes",
"(",
"self",
",",
"types",
",",
"is_toplevel",
"=",
"False",
",",
"generate_typedefs",
"=",
"False",
")",
":",
"c",
"=",
"Code",
"(",
")",
"for",
"type_",
"in",
"types",
":",
"c",
".",
"Cblock",
"(",
"self",
".",
"_GenerateType... | Generate the structures required by a property such as OBJECT classes
and enums. | [
"Generate",
"the",
"structures",
"required",
"by",
"a",
"property",
"such",
"as",
"OBJECT",
"classes",
"and",
"enums",
"."
] | [
"\"\"\"Generate the structures required by a property such as OBJECT classes\n and enums.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "types",
"type": null
},
{
"param": "is_toplevel",
"type": null
},
{
"param": "generate_typedefs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "types",
"type": null,
"docstring": null,
"docstring_tokens": ... |
97edbfe352e89b09824957736f508ebedda14ec7 | sunlongbo/chromium | tools/json_schema_compiler/h_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateManifestKeys | <not_specific> | def _GenerateManifestKeys(self):
# type: () -> Code
"""Generates the types and parsing code for manifest keys.
"""
assert self._namespace.manifest_keys
assert self._namespace.manifest_keys.property_type == PropertyType.OBJECT
return self._GenerateType(self._namespace.manifest_keys) | Generates the types and parsing code for manifest keys.
| Generates the types and parsing code for manifest keys. | [
"Generates",
"the",
"types",
"and",
"parsing",
"code",
"for",
"manifest",
"keys",
"."
] | def _GenerateManifestKeys(self):
assert self._namespace.manifest_keys
assert self._namespace.manifest_keys.property_type == PropertyType.OBJECT
return self._GenerateType(self._namespace.manifest_keys) | [
"def",
"_GenerateManifestKeys",
"(",
"self",
")",
":",
"assert",
"self",
".",
"_namespace",
".",
"manifest_keys",
"assert",
"self",
".",
"_namespace",
".",
"manifest_keys",
".",
"property_type",
"==",
"PropertyType",
".",
"OBJECT",
"return",
"self",
".",
"_Gener... | Generates the types and parsing code for manifest keys. | [
"Generates",
"the",
"types",
"and",
"parsing",
"code",
"for",
"manifest",
"keys",
"."
] | [
"# type: () -> Code",
"\"\"\"Generates the types and parsing code for manifest keys.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
97edbfe352e89b09824957736f508ebedda14ec7 | sunlongbo/chromium | tools/json_schema_compiler/h_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateParseFromDictionary | <not_specific> | def _GenerateParseFromDictionary(self, type_, classname):
# type: (Type, str) -> Code
"""Generates the ParseFromDictionary method declaration.
"""
# Omit |key| and |error_path_reversed| argument for the top level
# ManifestKeys type. These are an implementation detail for the inner
# manifest ty... | Generates the ParseFromDictionary method declaration.
| Generates the ParseFromDictionary method declaration. | [
"Generates",
"the",
"ParseFromDictionary",
"method",
"declaration",
"."
] | def _GenerateParseFromDictionary(self, type_, classname):
if type_.IsRootManifestKeyType():
params = [
'const base::DictionaryValue& root_dict',
'%s* out' % classname,
'std::u16string* error'
]
comment = (
'Parses manifest keys for this namespace. Any keys not avail... | [
"def",
"_GenerateParseFromDictionary",
"(",
"self",
",",
"type_",
",",
"classname",
")",
":",
"if",
"type_",
".",
"IsRootManifestKeyType",
"(",
")",
":",
"params",
"=",
"[",
"'const base::DictionaryValue& root_dict'",
",",
"'%s* out'",
"%",
"classname",
",",
"'std... | Generates the ParseFromDictionary method declaration. | [
"Generates",
"the",
"ParseFromDictionary",
"method",
"declaration",
"."
] | [
"# type: (Type, str) -> Code",
"\"\"\"Generates the ParseFromDictionary method declaration.\n \"\"\"",
"# Omit |key| and |error_path_reversed| argument for the top level",
"# ManifestKeys type. These are an implementation detail for the inner",
"# manifest types.",
"# Make |generate_error_messages| Fal... | [
{
"param": "self",
"type": null
},
{
"param": "type_",
"type": null
},
{
"param": "classname",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type_",
"type": null,
"docstring": null,
"docstring_tokens": ... |
97edbfe352e89b09824957736f508ebedda14ec7 | sunlongbo/chromium | tools/json_schema_compiler/h_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateManifestKeyConstants | <not_specific> | def _GenerateManifestKeyConstants(self, properties):
# type: (list[Property]) -> Code
"""Generates string constants for manifest keys for the given |properties|.
"""
c = Code()
for prop in properties:
c.Append('static constexpr char %s[] = "%s";' %
(cpp_util.UnixNameToConstantN... | Generates string constants for manifest keys for the given |properties|.
| Generates string constants for manifest keys for the given |properties|. | [
"Generates",
"string",
"constants",
"for",
"manifest",
"keys",
"for",
"the",
"given",
"|properties|",
"."
] | def _GenerateManifestKeyConstants(self, properties):
c = Code()
for prop in properties:
c.Append('static constexpr char %s[] = "%s";' %
(cpp_util.UnixNameToConstantName(prop.unix_name), prop.name))
return c | [
"def",
"_GenerateManifestKeyConstants",
"(",
"self",
",",
"properties",
")",
":",
"c",
"=",
"Code",
"(",
")",
"for",
"prop",
"in",
"properties",
":",
"c",
".",
"Append",
"(",
"'static constexpr char %s[] = \"%s\";'",
"%",
"(",
"cpp_util",
".",
"UnixNameToConstan... | Generates string constants for manifest keys for the given |properties|. | [
"Generates",
"string",
"constants",
"for",
"manifest",
"keys",
"for",
"the",
"given",
"|properties|",
"."
] | [
"# type: (list[Property]) -> Code",
"\"\"\"Generates string constants for manifest keys for the given |properties|.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "properties",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "properties",
"type": null,
"docstring": null,
"docstring_toke... |
97edbfe352e89b09824957736f508ebedda14ec7 | sunlongbo/chromium | tools/json_schema_compiler/h_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateAsyncResponseArguments | <not_specific> | def _GenerateAsyncResponseArguments(self, params):
"""Generates a function to create the arguments to pass as results to a
function callback, promise or event details.
"""
c = Code()
c.Cblock(self._GenerateTypes((p.type_ for p in params), is_toplevel=True))
declaration_list = []
for param i... | Generates a function to create the arguments to pass as results to a
function callback, promise or event details.
| Generates a function to create the arguments to pass as results to a
function callback, promise or event details. | [
"Generates",
"a",
"function",
"to",
"create",
"the",
"arguments",
"to",
"pass",
"as",
"results",
"to",
"a",
"function",
"callback",
"promise",
"or",
"event",
"details",
"."
] | def _GenerateAsyncResponseArguments(self, params):
c = Code()
c.Cblock(self._GenerateTypes((p.type_ for p in params), is_toplevel=True))
declaration_list = []
for param in params:
if param.description:
c.Comment(param.description)
declaration_list.append(cpp_util.GetParameterDeclarat... | [
"def",
"_GenerateAsyncResponseArguments",
"(",
"self",
",",
"params",
")",
":",
"c",
"=",
"Code",
"(",
")",
"c",
".",
"Cblock",
"(",
"self",
".",
"_GenerateTypes",
"(",
"(",
"p",
".",
"type_",
"for",
"p",
"in",
"params",
")",
",",
"is_toplevel",
"=",
... | Generates a function to create the arguments to pass as results to a
function callback, promise or event details. | [
"Generates",
"a",
"function",
"to",
"create",
"the",
"arguments",
"to",
"pass",
"as",
"results",
"to",
"a",
"function",
"callback",
"promise",
"or",
"event",
"details",
"."
] | [
"\"\"\"Generates a function to create the arguments to pass as results to a\n function callback, promise or event details.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "params",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "params",
"type": null,
"docstring": null,
"docstring_tokens":... |
97edbfe352e89b09824957736f508ebedda14ec7 | sunlongbo/chromium | tools/json_schema_compiler/h_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateEventNameConstant | <not_specific> | def _GenerateEventNameConstant(self, event):
"""Generates a constant string array for the event name.
"""
c = Code()
c.Append('extern const char kEventName[]; // "%s.%s"' % (
self._namespace.name, event.name))
c.Append()
return c | Generates a constant string array for the event name.
| Generates a constant string array for the event name. | [
"Generates",
"a",
"constant",
"string",
"array",
"for",
"the",
"event",
"name",
"."
] | def _GenerateEventNameConstant(self, event):
c = Code()
c.Append('extern const char kEventName[]; // "%s.%s"' % (
self._namespace.name, event.name))
c.Append()
return c | [
"def",
"_GenerateEventNameConstant",
"(",
"self",
",",
"event",
")",
":",
"c",
"=",
"Code",
"(",
")",
"c",
".",
"Append",
"(",
"'extern const char kEventName[]; // \"%s.%s\"'",
"%",
"(",
"self",
".",
"_namespace",
".",
"name",
",",
"event",
".",
"name",
")"... | Generates a constant string array for the event name. | [
"Generates",
"a",
"constant",
"string",
"array",
"for",
"the",
"event",
"name",
"."
] | [
"\"\"\"Generates a constant string array for the event name.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "event",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event",
"type": null,
"docstring": null,
"docstring_tokens": ... |
97edbfe352e89b09824957736f508ebedda14ec7 | sunlongbo/chromium | tools/json_schema_compiler/h_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateFunctionResults | <not_specific> | def _GenerateFunctionResults(self, returns_async):
"""Generates namespace for passing a function's result back.
"""
c = Code()
(c.Append('namespace Results {')
.Append()
.Concat(self._GenerateAsyncResponseArguments(returns_async.params))
.Append('} // namespace Results')
)
ret... | Generates namespace for passing a function's result back.
| Generates namespace for passing a function's result back. | [
"Generates",
"namespace",
"for",
"passing",
"a",
"function",
"'",
"s",
"result",
"back",
"."
] | def _GenerateFunctionResults(self, returns_async):
c = Code()
(c.Append('namespace Results {')
.Append()
.Concat(self._GenerateAsyncResponseArguments(returns_async.params))
.Append('} // namespace Results')
)
return c | [
"def",
"_GenerateFunctionResults",
"(",
"self",
",",
"returns_async",
")",
":",
"c",
"=",
"Code",
"(",
")",
"(",
"c",
".",
"Append",
"(",
"'namespace Results {'",
")",
".",
"Append",
"(",
")",
".",
"Concat",
"(",
"self",
".",
"_GenerateAsyncResponseArguments... | Generates namespace for passing a function's result back. | [
"Generates",
"namespace",
"for",
"passing",
"a",
"function",
"'",
"s",
"result",
"back",
"."
] | [
"\"\"\"Generates namespace for passing a function's result back.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "returns_async",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "returns_async",
"type": null,
"docstring": null,
"docstring_t... |
e213fbfa760f43dd4798b2b72db66d4894c1fff5 | sunlongbo/chromium | mojo/public/tools/mojom/mojom_parser_test_case.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParseMojoms | null | def ParseMojoms(self, mojoms, metadata=None):
"""Parse all input mojoms relative the temp dir."""
out_dir = self.GetPath('out')
args = [
'--input-root', self._temp_dir, '--input-root', out_dir,
'--output-root', out_dir, '--mojoms'
] + list(map(lambda mojom: os.path.join(self._temp_dir, m... | Parse all input mojoms relative the temp dir. | Parse all input mojoms relative the temp dir. | [
"Parse",
"all",
"input",
"mojoms",
"relative",
"the",
"temp",
"dir",
"."
] | def ParseMojoms(self, mojoms, metadata=None):
out_dir = self.GetPath('out')
args = [
'--input-root', self._temp_dir, '--input-root', out_dir,
'--output-root', out_dir, '--mojoms'
] + list(map(lambda mojom: os.path.join(self._temp_dir, mojom), mojoms))
if metadata:
args.extend(['--c... | [
"def",
"ParseMojoms",
"(",
"self",
",",
"mojoms",
",",
"metadata",
"=",
"None",
")",
":",
"out_dir",
"=",
"self",
".",
"GetPath",
"(",
"'out'",
")",
"args",
"=",
"[",
"'--input-root'",
",",
"self",
".",
"_temp_dir",
",",
"'--input-root'",
",",
"out_dir",... | Parse all input mojoms relative the temp dir. | [
"Parse",
"all",
"input",
"mojoms",
"relative",
"the",
"temp",
"dir",
"."
] | [
"\"\"\"Parse all input mojoms relative the temp dir.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "mojoms",
"type": null
},
{
"param": "metadata",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mojoms",
"type": null,
"docstring": null,
"docstring_tokens":... |
dd9804e584e017f48f831bdd8ee9bee43d75e861 | sunlongbo/chromium | build/fuchsia/remote_cmd.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunCommand | <not_specific> | def RunCommand(self, command, silent, timeout_secs=None):
"""Executes an SSH command on the remote host and blocks until completion.
command: A list of strings containing the command and its arguments.
silent: If true, suppresses all output from 'ssh'.
timeout_secs: If set, limits the amount of time th... | Executes an SSH command on the remote host and blocks until completion.
command: A list of strings containing the command and its arguments.
silent: If true, suppresses all output from 'ssh'.
timeout_secs: If set, limits the amount of time that |command| may run.
Commands which exceed the... | Executes an SSH command on the remote host and blocks until completion.
command: A list of strings containing the command and its arguments.
silent: If true, suppresses all output from 'ssh'.
timeout_secs: If set, limits the amount of time that |command| may run.
Commands which exceed the timeout are killed.
Returns t... | [
"Executes",
"an",
"SSH",
"command",
"on",
"the",
"remote",
"host",
"and",
"blocks",
"until",
"completion",
".",
"command",
":",
"A",
"list",
"of",
"strings",
"containing",
"the",
"command",
"and",
"its",
"arguments",
".",
"silent",
":",
"If",
"true",
"supp... | def RunCommand(self, command, silent, timeout_secs=None):
ssh_command = self._GetSshCommandLinePrefix() + command
logging.debug(ssh_command)
_SSH_LOGGER.debug('ssh exec: ' + ' '.join(ssh_command))
retval, _, _ = SubprocessCallWithTimeout(ssh_command, silent, timeout_secs)
return retval | [
"def",
"RunCommand",
"(",
"self",
",",
"command",
",",
"silent",
",",
"timeout_secs",
"=",
"None",
")",
":",
"ssh_command",
"=",
"self",
".",
"_GetSshCommandLinePrefix",
"(",
")",
"+",
"command",
"logging",
".",
"debug",
"(",
"ssh_command",
")",
"_SSH_LOGGER... | Executes an SSH command on the remote host and blocks until completion. | [
"Executes",
"an",
"SSH",
"command",
"on",
"the",
"remote",
"host",
"and",
"blocks",
"until",
"completion",
"."
] | [
"\"\"\"Executes an SSH command on the remote host and blocks until completion.\n\n command: A list of strings containing the command and its arguments.\n silent: If true, suppresses all output from 'ssh'.\n timeout_secs: If set, limits the amount of time that |command| may run.\n Commands ... | [
{
"param": "self",
"type": null
},
{
"param": "command",
"type": null
},
{
"param": "silent",
"type": null
},
{
"param": "timeout_secs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "command",
"type": null,
"docstring": null,
"docstring_tokens"... |
dd9804e584e017f48f831bdd8ee9bee43d75e861 | sunlongbo/chromium | build/fuchsia/remote_cmd.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunCommandPiped | <not_specific> | def RunCommandPiped(self, command, stdout, stderr, ssh_args = None, **kwargs):
"""Executes an SSH command on the remote host and returns a process object
with access to the command's stdio streams. Does not block.
command: A list of strings containing the command and its arguments.
stdout: subprocess s... | Executes an SSH command on the remote host and returns a process object
with access to the command's stdio streams. Does not block.
command: A list of strings containing the command and its arguments.
stdout: subprocess stdout. Must not be None.
stderr: subprocess stderr. Must not be None.
ssh_ar... | Executes an SSH command on the remote host and returns a process object
with access to the command's stdio streams. Does not block.
A list of strings containing the command and its arguments.
stdout: subprocess stdout. Must not be None.
stderr: subprocess stderr. Must not be None.
ssh_args: Arguments that will be pa... | [
"Executes",
"an",
"SSH",
"command",
"on",
"the",
"remote",
"host",
"and",
"returns",
"a",
"process",
"object",
"with",
"access",
"to",
"the",
"command",
"'",
"s",
"stdio",
"streams",
".",
"Does",
"not",
"block",
".",
"A",
"list",
"of",
"strings",
"contai... | def RunCommandPiped(self, command, stdout, stderr, ssh_args = None, **kwargs):
if not stdout or not stderr:
raise Exception('Stdout/stderr must be specified explicitly')
if not ssh_args:
ssh_args = []
ssh_command = self._GetSshCommandLinePrefix() + ssh_args + ['--'] + command
logging.debug(s... | [
"def",
"RunCommandPiped",
"(",
"self",
",",
"command",
",",
"stdout",
",",
"stderr",
",",
"ssh_args",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"stdout",
"or",
"not",
"stderr",
":",
"raise",
"Exception",
"(",
"'Stdout/stderr must be specified ... | Executes an SSH command on the remote host and returns a process object
with access to the command's stdio streams. | [
"Executes",
"an",
"SSH",
"command",
"on",
"the",
"remote",
"host",
"and",
"returns",
"a",
"process",
"object",
"with",
"access",
"to",
"the",
"command",
"'",
"s",
"stdio",
"streams",
"."
] | [
"\"\"\"Executes an SSH command on the remote host and returns a process object\n with access to the command's stdio streams. Does not block.\n\n command: A list of strings containing the command and its arguments.\n stdout: subprocess stdout. Must not be None.\n stderr: subprocess stderr. Must not be ... | [
{
"param": "self",
"type": null
},
{
"param": "command",
"type": null
},
{
"param": "stdout",
"type": null
},
{
"param": "stderr",
"type": null
},
{
"param": "ssh_args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "command",
"type": null,
"docstring": null,
"docstring_tokens"... |
dd9804e584e017f48f831bdd8ee9bee43d75e861 | sunlongbo/chromium | build/fuchsia/remote_cmd.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunScp | null | def RunScp(self, sources, dest, direction, recursive=False):
"""Copies a file to or from a remote host using SCP and blocks until
completion.
sources: Paths of the files to be copied.
dest: The path that |source| will be copied to.
direction: Indicates whether the file should be copied to
... | Copies a file to or from a remote host using SCP and blocks until
completion.
sources: Paths of the files to be copied.
dest: The path that |source| will be copied to.
direction: Indicates whether the file should be copied to
or from the remote side.
Valid values are COPY_... | Copies a file to or from a remote host using SCP and blocks until
completion.
Paths of the files to be copied.
dest: The path that |source| will be copied to.
direction: Indicates whether the file should be copied to
or from the remote side.
Function will raise an assertion if a failure occurred. | [
"Copies",
"a",
"file",
"to",
"or",
"from",
"a",
"remote",
"host",
"using",
"SCP",
"and",
"blocks",
"until",
"completion",
".",
"Paths",
"of",
"the",
"files",
"to",
"be",
"copied",
".",
"dest",
":",
"The",
"path",
"that",
"|source|",
"will",
"be",
"copi... | def RunScp(self, sources, dest, direction, recursive=False):
scp_command = _SCP[:]
if _SSH_LOGGER.getEffectiveLevel() == logging.DEBUG:
scp_command.append('-v')
if recursive:
scp_command.append('-r')
host = _EscapeIfIPv6Address(self._host)
if direction == COPY_TO_TARGET:
dest = "%s... | [
"def",
"RunScp",
"(",
"self",
",",
"sources",
",",
"dest",
",",
"direction",
",",
"recursive",
"=",
"False",
")",
":",
"scp_command",
"=",
"_SCP",
"[",
":",
"]",
"if",
"_SSH_LOGGER",
".",
"getEffectiveLevel",
"(",
")",
"==",
"logging",
".",
"DEBUG",
":... | Copies a file to or from a remote host using SCP and blocks until
completion. | [
"Copies",
"a",
"file",
"to",
"or",
"from",
"a",
"remote",
"host",
"using",
"SCP",
"and",
"blocks",
"until",
"completion",
"."
] | [
"\"\"\"Copies a file to or from a remote host using SCP and blocks until\n completion.\n\n sources: Paths of the files to be copied.\n dest: The path that |source| will be copied to.\n direction: Indicates whether the file should be copied to\n or from the remote side.\n Vali... | [
{
"param": "self",
"type": null
},
{
"param": "sources",
"type": null
},
{
"param": "dest",
"type": null
},
{
"param": "direction",
"type": null
},
{
"param": "recursive",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sources",
"type": null,
"docstring": null,
"docstring_tokens"... |
0960b9f3145083da4aad79fcef8905b44c20ee01 | sunlongbo/chromium | tools/android/modularization/convenience/build_gn_editor.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | parse_from | bool | def parse_from(self, content: str) -> bool:
"""Parses list elements from content and returns True on success.
The expected list format must be a valid gn list. i.e.
1. []
2. [ "foo" ]
3. [
"foo",
"bar",
...
]
"""
start = content.find('[')
if start < 0:
... | Parses list elements from content and returns True on success.
The expected list format must be a valid gn list. i.e.
1. []
2. [ "foo" ]
3. [
"foo",
"bar",
...
]
| Parses list elements from content and returns True on success.
The expected list format must be a valid gn list. | [
"Parses",
"list",
"elements",
"from",
"content",
"and",
"returns",
"True",
"on",
"success",
".",
"The",
"expected",
"list",
"format",
"must",
"be",
"a",
"valid",
"gn",
"list",
"."
] | def parse_from(self, content: str) -> bool:
start = content.find('[')
if start < 0:
return False
end = start + content[start:].find(']')
if end <= start:
return False
bracketless_content = content[start + 1:end].strip()
if not bracketless_content:
return True
whitespace = r... | [
"def",
"parse_from",
"(",
"self",
",",
"content",
":",
"str",
")",
"->",
"bool",
":",
"start",
"=",
"content",
".",
"find",
"(",
"'['",
")",
"if",
"start",
"<",
"0",
":",
"return",
"False",
"end",
"=",
"start",
"+",
"content",
"[",
"start",
":",
... | Parses list elements from content and returns True on success. | [
"Parses",
"list",
"elements",
"from",
"content",
"and",
"returns",
"True",
"on",
"success",
"."
] | [
"\"\"\"Parses list elements from content and returns True on success.\n\n The expected list format must be a valid gn list. i.e.\n 1. []\n 2. [ \"foo\" ]\n 3. [\n \"foo\",\n \"bar\",\n ...\n ]\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "content",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "content",
"type": "str",
"docstring": null,
"docstring_tokens... |
0960b9f3145083da4aad79fcef8905b44c20ee01 | sunlongbo/chromium | tools/android/modularization/convenience/build_gn_editor.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | add_elements | None | def add_elements(self, elements: List[str]) -> None:
"""Appends unique elements to the existing list."""
if not self._elements:
self._elements = list(dict.fromkeys(elements))
return
all_elements = list(self._elements)
all_elements.extend(elements)
self._elements = list(dict.fromkeys(all... | Appends unique elements to the existing list. | Appends unique elements to the existing list. | [
"Appends",
"unique",
"elements",
"to",
"the",
"existing",
"list",
"."
] | def add_elements(self, elements: List[str]) -> None:
if not self._elements:
self._elements = list(dict.fromkeys(elements))
return
all_elements = list(self._elements)
all_elements.extend(elements)
self._elements = list(dict.fromkeys(all_elements)) | [
"def",
"add_elements",
"(",
"self",
",",
"elements",
":",
"List",
"[",
"str",
"]",
")",
"->",
"None",
":",
"if",
"not",
"self",
".",
"_elements",
":",
"self",
".",
"_elements",
"=",
"list",
"(",
"dict",
".",
"fromkeys",
"(",
"elements",
")",
")",
"... | Appends unique elements to the existing list. | [
"Appends",
"unique",
"elements",
"to",
"the",
"existing",
"list",
"."
] | [
"\"\"\"Appends unique elements to the existing list.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "elements",
"type": "List[str]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "elements",
"type": "List[str]",
"docstring": null,
"docstring... |
0960b9f3145083da4aad79fcef8905b44c20ee01 | sunlongbo/chromium | tools/android/modularization/convenience/build_gn_editor.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | add_variable | None | def add_variable(self, variable: TargetVariable) -> None:
"""Adds the variable to the end of the content.
Warning: this does not check for prior existence."""
self._content += variable.serialize() | Adds the variable to the end of the content.
Warning: this does not check for prior existence. | Adds the variable to the end of the content.
Warning: this does not check for prior existence. | [
"Adds",
"the",
"variable",
"to",
"the",
"end",
"of",
"the",
"content",
".",
"Warning",
":",
"this",
"does",
"not",
"check",
"for",
"prior",
"existence",
"."
] | def add_variable(self, variable: TargetVariable) -> None:
self._content += variable.serialize() | [
"def",
"add_variable",
"(",
"self",
",",
"variable",
":",
"TargetVariable",
")",
"->",
"None",
":",
"self",
".",
"_content",
"+=",
"variable",
".",
"serialize",
"(",
")"
] | Adds the variable to the end of the content. | [
"Adds",
"the",
"variable",
"to",
"the",
"end",
"of",
"the",
"content",
"."
] | [
"\"\"\"Adds the variable to the end of the content.\n\n Warning: this does not check for prior existence.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "variable",
"type": "TargetVariable"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "variable",
"type": "TargetVariable",
"docstring": null,
"docs... |
0960b9f3145083da4aad79fcef8905b44c20ee01 | sunlongbo/chromium | tools/android/modularization/convenience/build_gn_editor.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | replace_variable | None | def replace_variable(self, variable: TargetVariable) -> None:
"""Replaces an existing variable and returns True on success."""
pattern = re.compile(fr'^\s*{variable.get_name()} =', re.MULTILINE)
match = pattern.search(self._content)
if not match:
raise BuildFileUpdateError(
f'{self._targ... | Replaces an existing variable and returns True on success. | Replaces an existing variable and returns True on success. | [
"Replaces",
"an",
"existing",
"variable",
"and",
"returns",
"True",
"on",
"success",
"."
] | def replace_variable(self, variable: TargetVariable) -> None:
pattern = re.compile(fr'^\s*{variable.get_name()} =', re.MULTILINE)
match = pattern.search(self._content)
if not match:
raise BuildFileUpdateError(
f'{self._target_type}("{self._target_name}") variable '
f'{variable.get_... | [
"def",
"replace_variable",
"(",
"self",
",",
"variable",
":",
"TargetVariable",
")",
"->",
"None",
":",
"pattern",
"=",
"re",
".",
"compile",
"(",
"fr'^\\s*{variable.get_name()} ='",
",",
"re",
".",
"MULTILINE",
")",
"match",
"=",
"pattern",
".",
"search",
"... | Replaces an existing variable and returns True on success. | [
"Replaces",
"an",
"existing",
"variable",
"and",
"returns",
"True",
"on",
"success",
"."
] | [
"\"\"\"Replaces an existing variable and returns True on success.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "variable",
"type": "TargetVariable"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "variable",
"type": "TargetVariable",
"docstring": null,
"docs... |
0960b9f3145083da4aad79fcef8905b44c20ee01 | sunlongbo/chromium | tools/android/modularization/convenience/build_gn_editor.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | add_target | None | def add_target(self, target: BuildTarget) -> None:
"""Adds the target to the end of the content.
Warning: this does not check for prior existence."""
self._content += target.serialize() | Adds the target to the end of the content.
Warning: this does not check for prior existence. | Adds the target to the end of the content.
Warning: this does not check for prior existence. | [
"Adds",
"the",
"target",
"to",
"the",
"end",
"of",
"the",
"content",
".",
"Warning",
":",
"this",
"does",
"not",
"check",
"for",
"prior",
"existence",
"."
] | def add_target(self, target: BuildTarget) -> None:
self._content += target.serialize() | [
"def",
"add_target",
"(",
"self",
",",
"target",
":",
"BuildTarget",
")",
"->",
"None",
":",
"self",
".",
"_content",
"+=",
"target",
".",
"serialize",
"(",
")"
] | Adds the target to the end of the content. | [
"Adds",
"the",
"target",
"to",
"the",
"end",
"of",
"the",
"content",
"."
] | [
"\"\"\"Adds the target to the end of the content.\n\n Warning: this does not check for prior existence.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "target",
"type": "BuildTarget"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target",
"type": "BuildTarget",
"docstring": null,
"docstring... |
0960b9f3145083da4aad79fcef8905b44c20ee01 | sunlongbo/chromium | tools/android/modularization/convenience/build_gn_editor.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | replace_target | None | def replace_target(self, target: BuildTarget) -> None:
"""Replaces an existing target and returns True on success."""
pattern = re.compile(fr'^\s*{target.get_type()}\(\"{target.get_name()}\"\)',
re.MULTILINE)
match = pattern.search(self._content)
if not match:
raise BuildF... | Replaces an existing target and returns True on success. | Replaces an existing target and returns True on success. | [
"Replaces",
"an",
"existing",
"target",
"and",
"returns",
"True",
"on",
"success",
"."
] | def replace_target(self, target: BuildTarget) -> None:
pattern = re.compile(fr'^\s*{target.get_type()}\(\"{target.get_name()}\"\)',
re.MULTILINE)
match = pattern.search(self._content)
if not match:
raise BuildFileUpdateError(
f'{target.get_type()}("{target.get_name()... | [
"def",
"replace_target",
"(",
"self",
",",
"target",
":",
"BuildTarget",
")",
"->",
"None",
":",
"pattern",
"=",
"re",
".",
"compile",
"(",
"fr'^\\s*{target.get_type()}\\(\\\"{target.get_name()}\\\"\\)'",
",",
"re",
".",
"MULTILINE",
")",
"match",
"=",
"pattern",
... | Replaces an existing target and returns True on success. | [
"Replaces",
"an",
"existing",
"target",
"and",
"returns",
"True",
"on",
"success",
"."
] | [
"\"\"\"Replaces an existing target and returns True on success.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "target",
"type": "BuildTarget"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target",
"type": "BuildTarget",
"docstring": null,
"docstring... |
17641c689947970915c682af8de730256afbeb2e | sunlongbo/chromium | components/policy/tools/syntax_check_policy_template_json.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckHighestId | null | def _CheckHighestId(self, policy_ids, highest_id):
'''
Checks that the 'highest_id_currently_used' value is actually set to the
highest id in use by any policy.
'''
highest_id_in_policies = max(policy_ids)
if highest_id != highest_id_in_policies:
self._Error(("'highest_id_currently_used' m... |
Checks that the 'highest_id_currently_used' value is actually set to the
highest id in use by any policy.
| Checks that the 'highest_id_currently_used' value is actually set to the
highest id in use by any policy. | [
"Checks",
"that",
"the",
"'",
"highest_id_currently_used",
"'",
"value",
"is",
"actually",
"set",
"to",
"the",
"highest",
"id",
"in",
"use",
"by",
"any",
"policy",
"."
] | def _CheckHighestId(self, policy_ids, highest_id):
highest_id_in_policies = max(policy_ids)
if highest_id != highest_id_in_policies:
self._Error(("'highest_id_currently_used' must be set to the highest"
"policy id in use, which is currently %s (vs %s).") %
(highest_id_... | [
"def",
"_CheckHighestId",
"(",
"self",
",",
"policy_ids",
",",
"highest_id",
")",
":",
"highest_id_in_policies",
"=",
"max",
"(",
"policy_ids",
")",
"if",
"highest_id",
"!=",
"highest_id_in_policies",
":",
"self",
".",
"_Error",
"(",
"(",
"\"'highest_id_currently_... | Checks that the 'highest_id_currently_used' value is actually set to the
highest id in use by any policy. | [
"Checks",
"that",
"the",
"'",
"highest_id_currently_used",
"'",
"value",
"is",
"actually",
"set",
"to",
"the",
"highest",
"id",
"in",
"use",
"by",
"any",
"policy",
"."
] | [
"'''\n Checks that the 'highest_id_currently_used' value is actually set to the\n highest id in use by any policy.\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "policy_ids",
"type": null
},
{
"param": "highest_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "policy_ids",
"type": null,
"docstring": null,
"docstring_toke... |
17641c689947970915c682af8de730256afbeb2e | sunlongbo/chromium | components/policy/tools/syntax_check_policy_template_json.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetReleasedPlatforms | <not_specific> | def _GetReleasedPlatforms(self, policy, current_version):
'''
Returns a dictionary that contains released platforms and their released
version. Returns empty dictionary if policy is None or policy.future is
True.
Args:
policy: A dictionary contains all policy data from policy_templates.json.
... |
Returns a dictionary that contains released platforms and their released
version. Returns empty dictionary if policy is None or policy.future is
True.
Args:
policy: A dictionary contains all policy data from policy_templates.json.
current_version: A integer represents the current major mil... | Returns a dictionary that contains released platforms and their released
version. Returns empty dictionary if policy is None or policy.future is
True. | [
"Returns",
"a",
"dictionary",
"that",
"contains",
"released",
"platforms",
"and",
"their",
"released",
"version",
".",
"Returns",
"empty",
"dictionary",
"if",
"policy",
"is",
"None",
"or",
"policy",
".",
"future",
"is",
"True",
"."
] | def _GetReleasedPlatforms(self, policy, current_version):
released_platforms = {}
rolling_out_platform = {}
if not policy or policy.get('future', False):
return released_platforms, rolling_out_platform
for supported_on in policy.get('supported_on', []):
supported_platform, supported_from, _ ... | [
"def",
"_GetReleasedPlatforms",
"(",
"self",
",",
"policy",
",",
"current_version",
")",
":",
"released_platforms",
"=",
"{",
"}",
"rolling_out_platform",
"=",
"{",
"}",
"if",
"not",
"policy",
"or",
"policy",
".",
"get",
"(",
"'future'",
",",
"False",
")",
... | Returns a dictionary that contains released platforms and their released
version. | [
"Returns",
"a",
"dictionary",
"that",
"contains",
"released",
"platforms",
"and",
"their",
"released",
"version",
"."
] | [
"'''\n Returns a dictionary that contains released platforms and their released\n version. Returns empty dictionary if policy is None or policy.future is\n True.\n\n Args:\n policy: A dictionary contains all policy data from policy_templates.json.\n current_version: A integer represents the cu... | [
{
"param": "self",
"type": null
},
{
"param": "policy",
"type": null
},
{
"param": "current_version",
"type": null
}
] | {
"returns": [
{
"docstring": "A dictionary contains all platforms that have been\nreleased to stable and their released version.\nrolling_out_platform: A dictionary contains all platforms that have been\nreleased but haven't reached stable.",
"docstring_tokens": [
"A",
"dictionary",
... |
17641c689947970915c682af8de730256afbeb2e | sunlongbo/chromium | components/policy/tools/syntax_check_policy_template_json.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckPolicyDefinitionChangeCompatibility | null | def _CheckPolicyDefinitionChangeCompatibility(self, original_policy,
original_released_platforms,
new_policy,
new_released_platforms,
... |
Checks if the new policy definition is compatible with the original policy
definition.
Args:
original_policy: The policy definition as it was in the original policy
templates file.
original_released_platforms: A dictionary contains a released platforms
... | Checks if the new policy definition is compatible with the original policy
definition.
The policy definition as it was in the original policy
templates file.
original_released_platforms: A dictionary contains a released platforms
and their release version in the original
policy template files.
new_policy: The policy ... | [
"Checks",
"if",
"the",
"new",
"policy",
"definition",
"is",
"compatible",
"with",
"the",
"original",
"policy",
"definition",
".",
"The",
"policy",
"definition",
"as",
"it",
"was",
"in",
"the",
"original",
"policy",
"templates",
"file",
".",
"original_released_pl... | def _CheckPolicyDefinitionChangeCompatibility(self, original_policy,
original_released_platforms,
new_policy,
new_released_platforms,
... | [
"def",
"_CheckPolicyDefinitionChangeCompatibility",
"(",
"self",
",",
"original_policy",
",",
"original_released_platforms",
",",
"new_policy",
",",
"new_released_platforms",
",",
"current_version",
")",
":",
"for",
"platform",
"in",
"original_released_platforms",
":",
"if"... | Checks if the new policy definition is compatible with the original policy
definition. | [
"Checks",
"if",
"the",
"new",
"policy",
"definition",
"is",
"compatible",
"with",
"the",
"original",
"policy",
"definition",
"."
] | [
"'''\n Checks if the new policy definition is compatible with the original policy\n definition.\n\n Args:\n original_policy: The policy definition as it was in the original policy\n templates file.\n original_released_platforms: A dictionary contains a released platforms\n ... | [
{
"param": "self",
"type": null
},
{
"param": "original_policy",
"type": null
},
{
"param": "original_released_platforms",
"type": null
},
{
"param": "new_policy",
"type": null
},
{
"param": "new_released_platforms",
"type": null
},
{
"param": "current... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "original_policy",
"type": null,
"docstring": null,
"docstring... |
17641c689947970915c682af8de730256afbeb2e | sunlongbo/chromium | components/policy/tools/syntax_check_policy_template_json.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckNewReleasedPlatforms | null | def _CheckNewReleasedPlatforms(self, original_platforms, new_platforms,
current_version, policy_name):
'''If released version has changed, it should be the current version unless
there is a special reason.'''
for platform in new_platforms:
new_version = new_platform... | If released version has changed, it should be the current version unless
there is a special reason. | If released version has changed, it should be the current version unless
there is a special reason. | [
"If",
"released",
"version",
"has",
"changed",
"it",
"should",
"be",
"the",
"current",
"version",
"unless",
"there",
"is",
"a",
"special",
"reason",
"."
] | def _CheckNewReleasedPlatforms(self, original_platforms, new_platforms,
current_version, policy_name):
for platform in new_platforms:
new_version = new_platforms[platform]
if new_version == original_platforms.get(platform):
continue
if new_version == curren... | [
"def",
"_CheckNewReleasedPlatforms",
"(",
"self",
",",
"original_platforms",
",",
"new_platforms",
",",
"current_version",
",",
"policy_name",
")",
":",
"for",
"platform",
"in",
"new_platforms",
":",
"new_version",
"=",
"new_platforms",
"[",
"platform",
"]",
"if",
... | If released version has changed, it should be the current version unless
there is a special reason. | [
"If",
"released",
"version",
"has",
"changed",
"it",
"should",
"be",
"the",
"current",
"version",
"unless",
"there",
"is",
"a",
"special",
"reason",
"."
] | [
"'''If released version has changed, it should be the current version unless\n there is a special reason.'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "original_platforms",
"type": null
},
{
"param": "new_platforms",
"type": null
},
{
"param": "current_version",
"type": null
},
{
"param": "policy_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "original_platforms",
"type": null,
"docstring": null,
"docstr... |
17641c689947970915c682af8de730256afbeb2e | sunlongbo/chromium | components/policy/tools/syntax_check_policy_template_json.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckDeprecatedFutureField | null | def _CheckDeprecatedFutureField(self, original_policy, new_policy,
policy_name):
'''The 'future' flag has been deprecated, it shouldn't be used for any new
policy.'''
if ('future' in new_policy
and (original_policy is None or 'future' not in original_policy)):
... | The 'future' flag has been deprecated, it shouldn't be used for any new
policy. | The 'future' flag has been deprecated, it shouldn't be used for any new
policy. | [
"The",
"'",
"future",
"'",
"flag",
"has",
"been",
"deprecated",
"it",
"shouldn",
"'",
"t",
"be",
"used",
"for",
"any",
"new",
"policy",
"."
] | def _CheckDeprecatedFutureField(self, original_policy, new_policy,
policy_name):
if ('future' in new_policy
and (original_policy is None or 'future' not in original_policy)):
self.non_compatibility_error_count += 1
self._Error(
"The 'future' flag has b... | [
"def",
"_CheckDeprecatedFutureField",
"(",
"self",
",",
"original_policy",
",",
"new_policy",
",",
"policy_name",
")",
":",
"if",
"(",
"'future'",
"in",
"new_policy",
"and",
"(",
"original_policy",
"is",
"None",
"or",
"'future'",
"not",
"in",
"original_policy",
... | The 'future' flag has been deprecated, it shouldn't be used for any new
policy. | [
"The",
"'",
"future",
"'",
"flag",
"has",
"been",
"deprecated",
"it",
"shouldn",
"'",
"t",
"be",
"used",
"for",
"any",
"new",
"policy",
"."
] | [
"'''The 'future' flag has been deprecated, it shouldn't be used for any new\n policy.'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "original_policy",
"type": null
},
{
"param": "new_policy",
"type": null
},
{
"param": "policy_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "original_policy",
"type": null,
"docstring": null,
"docstring... |
17641c689947970915c682af8de730256afbeb2e | sunlongbo/chromium | components/policy/tools/syntax_check_policy_template_json.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckPolicyDefinitionsChangeCompatibility | <not_specific> | def _CheckPolicyDefinitionsChangeCompatibility(
self, policy_definitions, original_file_contents, current_version):
'''
Checks if all the |policy_definitions| in the modified policy templates file
are compatible with the policy definitions defined in the original policy
templates file with |origin... |
Checks if all the |policy_definitions| in the modified policy templates file
are compatible with the policy definitions defined in the original policy
templates file with |original_file_contents| .
|policy_definitions|: The policy definition as it is in the modified policy
templates file.
|o... | Checks if all the |policy_definitions| in the modified policy templates file
are compatible with the policy definitions defined in the original policy
templates file with |original_file_contents| .
|policy_definitions|: The policy definition as it is in the modified policy
templates file.
|original_file_contents|: The... | [
"Checks",
"if",
"all",
"the",
"|policy_definitions|",
"in",
"the",
"modified",
"policy",
"templates",
"file",
"are",
"compatible",
"with",
"the",
"policy",
"definitions",
"defined",
"in",
"the",
"original",
"policy",
"templates",
"file",
"with",
"|original_file_cont... | def _CheckPolicyDefinitionsChangeCompatibility(
self, policy_definitions, original_file_contents, current_version):
try:
original_container = eval(original_file_contents)
except:
import traceback
traceback.print_exc(file=sys.stdout)
self._Error('Invalid Python/JSON syntax in origin... | [
"def",
"_CheckPolicyDefinitionsChangeCompatibility",
"(",
"self",
",",
"policy_definitions",
",",
"original_file_contents",
",",
"current_version",
")",
":",
"try",
":",
"original_container",
"=",
"eval",
"(",
"original_file_contents",
")",
"except",
":",
"import",
"tra... | Checks if all the |policy_definitions| in the modified policy templates file
are compatible with the policy definitions defined in the original policy
templates file with |original_file_contents| . | [
"Checks",
"if",
"all",
"the",
"|policy_definitions|",
"in",
"the",
"modified",
"policy",
"templates",
"file",
"are",
"compatible",
"with",
"the",
"policy",
"definitions",
"defined",
"in",
"the",
"original",
"policy",
"templates",
"file",
"with",
"|original_file_cont... | [
"'''\n Checks if all the |policy_definitions| in the modified policy templates file\n are compatible with the policy definitions defined in the original policy\n templates file with |original_file_contents| .\n\n |policy_definitions|: The policy definition as it is in the modified policy\n template... | [
{
"param": "self",
"type": null
},
{
"param": "policy_definitions",
"type": null
},
{
"param": "original_file_contents",
"type": null
},
{
"param": "current_version",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "policy_definitions",
"type": null,
"docstring": null,
"docstr... |
f1670d3e2e5c204a8e79afdd3ebcaf57f8dcff05 | sunlongbo/chromium | tools/json_schema_compiler/util_cc_helper.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PopulateArrayFromListFunction | <not_specific> | def PopulateArrayFromListFunction(self, optional):
"""Returns the function to turn a list into a vector.
"""
populate_list_fn = ('PopulateOptionalArrayFromList' if optional
else 'PopulateArrayFromList')
return ('%s::%s') % (_API_UTIL_NAMESPACE, populate_list_fn) | Returns the function to turn a list into a vector.
| Returns the function to turn a list into a vector. | [
"Returns",
"the",
"function",
"to",
"turn",
"a",
"list",
"into",
"a",
"vector",
"."
] | def PopulateArrayFromListFunction(self, optional):
populate_list_fn = ('PopulateOptionalArrayFromList' if optional
else 'PopulateArrayFromList')
return ('%s::%s') % (_API_UTIL_NAMESPACE, populate_list_fn) | [
"def",
"PopulateArrayFromListFunction",
"(",
"self",
",",
"optional",
")",
":",
"populate_list_fn",
"=",
"(",
"'PopulateOptionalArrayFromList'",
"if",
"optional",
"else",
"'PopulateArrayFromList'",
")",
"return",
"(",
"'%s::%s'",
")",
"%",
"(",
"_API_UTIL_NAMESPACE",
... | Returns the function to turn a list into a vector. | [
"Returns",
"the",
"function",
"to",
"turn",
"a",
"list",
"into",
"a",
"vector",
"."
] | [
"\"\"\"Returns the function to turn a list into a vector.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "optional",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "optional",
"type": null,
"docstring": null,
"docstring_tokens... |
f1670d3e2e5c204a8e79afdd3ebcaf57f8dcff05 | sunlongbo/chromium | tools/json_schema_compiler/util_cc_helper.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreateValueFromArray | <not_specific> | def CreateValueFromArray(self, src):
"""Generates code to create a scoped_pt<Value> from the array at src.
|src| The variable to convert, either a vector or std::unique_ptr<vector>.
"""
return '%s::CreateValueFromArray(%s)' % (_API_UTIL_NAMESPACE, src) | Generates code to create a scoped_pt<Value> from the array at src.
|src| The variable to convert, either a vector or std::unique_ptr<vector>.
| Generates code to create a scoped_pt from the array at src.
|src| The variable to convert, either a vector or std::unique_ptr. | [
"Generates",
"code",
"to",
"create",
"a",
"scoped_pt",
"from",
"the",
"array",
"at",
"src",
".",
"|src|",
"The",
"variable",
"to",
"convert",
"either",
"a",
"vector",
"or",
"std",
"::",
"unique_ptr",
"."
] | def CreateValueFromArray(self, src):
return '%s::CreateValueFromArray(%s)' % (_API_UTIL_NAMESPACE, src) | [
"def",
"CreateValueFromArray",
"(",
"self",
",",
"src",
")",
":",
"return",
"'%s::CreateValueFromArray(%s)'",
"%",
"(",
"_API_UTIL_NAMESPACE",
",",
"src",
")"
] | Generates code to create a scoped_pt<Value> from the array at src. | [
"Generates",
"code",
"to",
"create",
"a",
"scoped_pt<Value",
">",
"from",
"the",
"array",
"at",
"src",
"."
] | [
"\"\"\"Generates code to create a scoped_pt<Value> from the array at src.\n\n |src| The variable to convert, either a vector or std::unique_ptr<vector>.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "src",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src",
"type": null,
"docstring": null,
"docstring_tokens": []... |
9806d376e84cfa20c909bf6a5700a425e81968ba | sunlongbo/chromium | chrome/android/monochrome/scripts/monochrome_apk_checker_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | VerifySameFile | null | def VerifySameFile(self, monochrome_dict, apk, changes, apk_name):
"""Verify apk file content matches same files in monochrome.
Verify files from apk are same as those in monochrome except files
in changes.
"""
diff = []
for a in apk:
# File may not exists due to exists_in_some_form().
... | Verify apk file content matches same files in monochrome.
Verify files from apk are same as those in monochrome except files
in changes.
| Verify apk file content matches same files in monochrome.
Verify files from apk are same as those in monochrome except files
in changes. | [
"Verify",
"apk",
"file",
"content",
"matches",
"same",
"files",
"in",
"monochrome",
".",
"Verify",
"files",
"from",
"apk",
"are",
"same",
"as",
"those",
"in",
"monochrome",
"except",
"files",
"in",
"changes",
"."
] | def VerifySameFile(self, monochrome_dict, apk, changes, apk_name):
diff = []
for a in apk:
m = monochrome_dict.get(a.filename)
if m and m.CRC != a.CRC and not changes.match(m.filename):
diff.append(a.filename)
self.assertEquals(len(diff), 0, """\
Unless specifcially excepted, all files ... | [
"def",
"VerifySameFile",
"(",
"self",
",",
"monochrome_dict",
",",
"apk",
",",
"changes",
",",
"apk_name",
")",
":",
"diff",
"=",
"[",
"]",
"for",
"a",
"in",
"apk",
":",
"m",
"=",
"monochrome_dict",
".",
"get",
"(",
"a",
".",
"filename",
")",
"if",
... | Verify apk file content matches same files in monochrome. | [
"Verify",
"apk",
"file",
"content",
"matches",
"same",
"files",
"in",
"monochrome",
"."
] | [
"\"\"\"Verify apk file content matches same files in monochrome.\n\n Verify files from apk are same as those in monochrome except files\n in changes.\n \"\"\"",
"# File may not exists due to exists_in_some_form()."
] | [
{
"param": "self",
"type": null
},
{
"param": "monochrome_dict",
"type": null
},
{
"param": "apk",
"type": null
},
{
"param": "changes",
"type": null
},
{
"param": "apk_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "monochrome_dict",
"type": null,
"docstring": null,
"docstring... |
9806d376e84cfa20c909bf6a5700a425e81968ba | sunlongbo/chromium | chrome/android/monochrome/scripts/monochrome_apk_checker_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | VerifyUncompressed | null | def VerifyUncompressed(self, monochrome, apk, apk_name):
"""Verify uncompressed files in apk are a subset of those in monochrome.
Verify files not being compressed in apk are also uncompressed in
Monochrome APK.
"""
uncompressed = [i.filename for i in apk if i.uncompressed ]
monochrome_uncompre... | Verify uncompressed files in apk are a subset of those in monochrome.
Verify files not being compressed in apk are also uncompressed in
Monochrome APK.
| Verify uncompressed files in apk are a subset of those in monochrome.
Verify files not being compressed in apk are also uncompressed in
Monochrome APK. | [
"Verify",
"uncompressed",
"files",
"in",
"apk",
"are",
"a",
"subset",
"of",
"those",
"in",
"monochrome",
".",
"Verify",
"files",
"not",
"being",
"compressed",
"in",
"apk",
"are",
"also",
"uncompressed",
"in",
"Monochrome",
"APK",
"."
] | def VerifyUncompressed(self, monochrome, apk, apk_name):
uncompressed = [i.filename for i in apk if i.uncompressed ]
monochrome_uncompressed = [i.filename for i in monochrome if i.uncompressed]
compressed = [u for u in uncompressed if u not in monochrome_uncompressed]
self.assertEquals(len(compressed), ... | [
"def",
"VerifyUncompressed",
"(",
"self",
",",
"monochrome",
",",
"apk",
",",
"apk_name",
")",
":",
"uncompressed",
"=",
"[",
"i",
".",
"filename",
"for",
"i",
"in",
"apk",
"if",
"i",
".",
"uncompressed",
"]",
"monochrome_uncompressed",
"=",
"[",
"i",
".... | Verify uncompressed files in apk are a subset of those in monochrome. | [
"Verify",
"uncompressed",
"files",
"in",
"apk",
"are",
"a",
"subset",
"of",
"those",
"in",
"monochrome",
"."
] | [
"\"\"\"Verify uncompressed files in apk are a subset of those in monochrome.\n\n Verify files not being compressed in apk are also uncompressed in\n Monochrome APK.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "monochrome",
"type": null
},
{
"param": "apk",
"type": null
},
{
"param": "apk_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "monochrome",
"type": null,
"docstring": null,
"docstring_toke... |
9806d376e84cfa20c909bf6a5700a425e81968ba | sunlongbo/chromium | chrome/android/monochrome/scripts/monochrome_apk_checker_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SuperSetOf | <not_specific> | def SuperSetOf(self, monochrome, apk, apk_name):
"""Verify Monochrome is super set of apk."""
def exists_in_some_form(f):
if f in monochrome:
return True
# Chrome.apk may have an extra classes.dex due to jdk library desugaring.
if f.startswith('classes') and f.endswith('.dex'):
... | Verify Monochrome is super set of apk. | Verify Monochrome is super set of apk. | [
"Verify",
"Monochrome",
"is",
"super",
"set",
"of",
"apk",
"."
] | def SuperSetOf(self, monochrome, apk, apk_name):
def exists_in_some_form(f):
if f in monochrome:
return True
if f.startswith('classes') and f.endswith('.dex'):
return True
if not f.startswith('res/'):
return False
name = '/' + posixpath.basename(f)
return any(x.... | [
"def",
"SuperSetOf",
"(",
"self",
",",
"monochrome",
",",
"apk",
",",
"apk_name",
")",
":",
"def",
"exists_in_some_form",
"(",
"f",
")",
":",
"if",
"f",
"in",
"monochrome",
":",
"return",
"True",
"if",
"f",
".",
"startswith",
"(",
"'classes'",
")",
"an... | Verify Monochrome is super set of apk. | [
"Verify",
"Monochrome",
"is",
"super",
"set",
"of",
"apk",
"."
] | [
"\"\"\"Verify Monochrome is super set of apk.\"\"\"",
"# Chrome.apk may have an extra classes.dex due to jdk library desugaring.",
"# Some resources will exists in apk but not in monochrome due to the",
"# difference in minSdkVersion. https://crbug.com/794438",
"# E.g.:",
"# apk could have: res/drawable/f... | [
{
"param": "self",
"type": null
},
{
"param": "monochrome",
"type": null
},
{
"param": "apk",
"type": null
},
{
"param": "apk_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "monochrome",
"type": null,
"docstring": null,
"docstring_toke... |
9806d376e84cfa20c909bf6a5700a425e81968ba | sunlongbo/chromium | chrome/android/monochrome/scripts/monochrome_apk_checker_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | LoadPathmap | <not_specific> | def LoadPathmap(self, pathmap_path):
"""Load the pathmap of obfuscated resource paths.
Returns: A dict mapping from obfuscated paths to original paths or an
empty dict if passed a None |pathmap_path|.
"""
if pathmap_path is None or not os.path.exists(pathmap_path):
return {}
pathm... | Load the pathmap of obfuscated resource paths.
Returns: A dict mapping from obfuscated paths to original paths or an
empty dict if passed a None |pathmap_path|.
| Load the pathmap of obfuscated resource paths.
Returns: A dict mapping from obfuscated paths to original paths or an
empty dict if passed a None |pathmap_path|. | [
"Load",
"the",
"pathmap",
"of",
"obfuscated",
"resource",
"paths",
".",
"Returns",
":",
"A",
"dict",
"mapping",
"from",
"obfuscated",
"paths",
"to",
"original",
"paths",
"or",
"an",
"empty",
"dict",
"if",
"passed",
"a",
"None",
"|pathmap_path|",
"."
] | def LoadPathmap(self, pathmap_path):
if pathmap_path is None or not os.path.exists(pathmap_path):
return {}
pathmap = {}
with open(pathmap_path, 'r') as f:
for line in f:
line = line.strip()
if line.startswith('#') or line == '':
continue
original, renamed = lin... | [
"def",
"LoadPathmap",
"(",
"self",
",",
"pathmap_path",
")",
":",
"if",
"pathmap_path",
"is",
"None",
"or",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"pathmap_path",
")",
":",
"return",
"{",
"}",
"pathmap",
"=",
"{",
"}",
"with",
"open",
"(",
"pa... | Load the pathmap of obfuscated resource paths. | [
"Load",
"the",
"pathmap",
"of",
"obfuscated",
"resource",
"paths",
"."
] | [
"\"\"\"Load the pathmap of obfuscated resource paths.\n\n Returns: A dict mapping from obfuscated paths to original paths or an\n empty dict if passed a None |pathmap_path|.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "pathmap_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pathmap_path",
"type": null,
"docstring": null,
"docstring_to... |
42d8f06cf5f610ce81794424a62aef9389df7546 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/merge_results.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | add_helper | null | def add_helper(self, match_func, merge_func):
"""Add function which merges values.
match_func and merge_func are dependent on the merger object type.
When the function returns true, the merge_func will be called.
Helpers are searched in last added, first checked order. This allows
... | Add function which merges values.
match_func and merge_func are dependent on the merger object type.
When the function returns true, the merge_func will be called.
Helpers are searched in last added, first checked order. This allows
more specific helpers to be added after more generic ... | Add function which merges values.
match_func and merge_func are dependent on the merger object type.
When the function returns true, the merge_func will be called.
Helpers are searched in last added, first checked order. This allows
more specific helpers to be added after more generic helpers. | [
"Add",
"function",
"which",
"merges",
"values",
".",
"match_func",
"and",
"merge_func",
"are",
"dependent",
"on",
"the",
"merger",
"object",
"type",
".",
"When",
"the",
"function",
"returns",
"true",
"the",
"merge_func",
"will",
"be",
"called",
".",
"Helpers",... | def add_helper(self, match_func, merge_func):
self.helpers.append((match_func, merge_func)) | [
"def",
"add_helper",
"(",
"self",
",",
"match_func",
",",
"merge_func",
")",
":",
"self",
".",
"helpers",
".",
"append",
"(",
"(",
"match_func",
",",
"merge_func",
")",
")"
] | Add function which merges values. | [
"Add",
"function",
"which",
"merges",
"values",
"."
] | [
"\"\"\"Add function which merges values.\n\n match_func and merge_func are dependent on the merger object type.\n When the function returns true, the merge_func will be called.\n\n Helpers are searched in last added, first checked order. This allows\n more specific helpers to be added af... | [
{
"param": "self",
"type": null
},
{
"param": "match_func",
"type": null
},
{
"param": "merge_func",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "match_func",
"type": null,
"docstring": null,
"docstring_toke... |
42d8f06cf5f610ce81794424a62aef9389df7546 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/merge_results.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | merge_dictlike | <not_specific> | def merge_dictlike(self,
dicts,
name=None,
order_cls=collections.OrderedDict):
"""Merge things which are dictionaries.
Args:
dicts (list of dict): Dictionary like objects to merge (should all
be the same ty... | Merge things which are dictionaries.
Args:
dicts (list of dict): Dictionary like objects to merge (should all
be the same type).
name (str): Name of the objects being merged (used for error
messages).
order_cls: Dict like object class used to ... | Merge things which are dictionaries. | [
"Merge",
"things",
"which",
"are",
"dictionaries",
"."
] | def merge_dictlike(self,
dicts,
name=None,
order_cls=collections.OrderedDict):
MergeFailure.assert_type_eq(name, dicts)
dict_mid = order_cls()
for dobj in dicts:
for key in dobj:
dict_mid.setdefault(... | [
"def",
"merge_dictlike",
"(",
"self",
",",
"dicts",
",",
"name",
"=",
"None",
",",
"order_cls",
"=",
"collections",
".",
"OrderedDict",
")",
":",
"MergeFailure",
".",
"assert_type_eq",
"(",
"name",
",",
"dicts",
")",
"dict_mid",
"=",
"order_cls",
"(",
")",... | Merge things which are dictionaries. | [
"Merge",
"things",
"which",
"are",
"dictionaries",
"."
] | [
"\"\"\"Merge things which are dictionaries.\n\n Args:\n dicts (list of dict): Dictionary like objects to merge (should all\n be the same type).\n name (str): Name of the objects being merged (used for error\n messages).\n order_cls: Dict like obj... | [
{
"param": "self",
"type": null
},
{
"param": "dicts",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "order_cls",
"type": null
}
] | {
"returns": [
{
"docstring": "Merged dictionary object of same type as the objects in\ndicts.",
"docstring_tokens": [
"Merged",
"dictionary",
"object",
"of",
"same",
"type",
"as",
"the",
"objects",
"in",
"dicts",
... |
42d8f06cf5f610ce81794424a62aef9389df7546 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/merge_results.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | merge | <not_specific> | def merge(self, objs, name=""):
"""Generic merge function.
name is a string representing the current key value separated by
semicolons. For example, if file.json had the following;
{'key1': {'key2': 3}}
Then the name of the value 3 is 'file.json:key1:key2'
"""
... | Generic merge function.
name is a string representing the current key value separated by
semicolons. For example, if file.json had the following;
{'key1': {'key2': 3}}
Then the name of the value 3 is 'file.json:key1:key2'
| Generic merge function.
name is a string representing the current key value separated by
semicolons. For example, if file.json had the following.
Then the name of the value 3 is 'file.json:key1:key2' | [
"Generic",
"merge",
"function",
".",
"name",
"is",
"a",
"string",
"representing",
"the",
"current",
"key",
"value",
"separated",
"by",
"semicolons",
".",
"For",
"example",
"if",
"file",
".",
"json",
"had",
"the",
"following",
".",
"Then",
"the",
"name",
"o... | def merge(self, objs, name=""):
objs = [o for o in objs if o is not None]
if not objs:
return None
MergeFailure.assert_type_eq(name, objs)
for match_func, merge_func in reversed(self.helpers):
for obj in objs:
if match_func(obj, name):
... | [
"def",
"merge",
"(",
"self",
",",
"objs",
",",
"name",
"=",
"\"\"",
")",
":",
"objs",
"=",
"[",
"o",
"for",
"o",
"in",
"objs",
"if",
"o",
"is",
"not",
"None",
"]",
"if",
"not",
"objs",
":",
"return",
"None",
"MergeFailure",
".",
"assert_type_eq",
... | Generic merge function. | [
"Generic",
"merge",
"function",
"."
] | [
"\"\"\"Generic merge function.\n\n name is a string representing the current key value separated by\n semicolons. For example, if file.json had the following;\n\n {'key1': {'key2': 3}}\n\n Then the name of the value 3 is 'file.json:key1:key2'\n \"\"\"",
"# Try the merge help... | [
{
"param": "self",
"type": null
},
{
"param": "objs",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "objs",
"type": null,
"docstring": null,
"docstring_tokens": [... |
42d8f06cf5f610ce81794424a62aef9389df7546 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/merge_results.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | load_jsonp | <not_specific> | def load_jsonp(fd):
"""Load a JSONP file and return the JSON data parsed.
JSONP files have a JSON data structure wrapped in a function call or
other non-JSON data.
"""
in_data = fd.read()
begin = in_data.find(b'{')
end = in_data.rfind(b'}') + 1
before =... | Load a JSONP file and return the JSON data parsed.
JSONP files have a JSON data structure wrapped in a function call or
other non-JSON data.
| Load a JSONP file and return the JSON data parsed.
JSONP files have a JSON data structure wrapped in a function call or
other non-JSON data. | [
"Load",
"a",
"JSONP",
"file",
"and",
"return",
"the",
"JSON",
"data",
"parsed",
".",
"JSONP",
"files",
"have",
"a",
"JSON",
"data",
"structure",
"wrapped",
"in",
"a",
"function",
"call",
"or",
"other",
"non",
"-",
"JSON",
"data",
"."
] | def load_jsonp(fd):
in_data = fd.read()
begin = in_data.find(b'{')
end = in_data.rfind(b'}') + 1
before = in_data[:begin]
data = in_data[begin:end]
after = in_data[end:]
if before == b'' and after == b'':
fd.seek(0)
json_data = json.load(fd... | [
"def",
"load_jsonp",
"(",
"fd",
")",
":",
"in_data",
"=",
"fd",
".",
"read",
"(",
")",
"begin",
"=",
"in_data",
".",
"find",
"(",
"b'{'",
")",
"end",
"=",
"in_data",
".",
"rfind",
"(",
"b'}'",
")",
"+",
"1",
"before",
"=",
"in_data",
"[",
":",
... | Load a JSONP file and return the JSON data parsed. | [
"Load",
"a",
"JSONP",
"file",
"and",
"return",
"the",
"JSON",
"data",
"parsed",
"."
] | [
"\"\"\"Load a JSONP file and return the JSON data parsed.\n\n JSONP files have a JSON data structure wrapped in a function call or\n other non-JSON data.\n \"\"\"",
"# If just a JSON file, use json.load to get better error message output."
] | [
{
"param": "fd",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fd",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
42d8f06cf5f610ce81794424a62aef9389df7546 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/merge_results.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | dump_jsonp | null | def dump_jsonp(fd, before, json_data, after):
"""Write a JSONP file.
JSONP files have a JSON data structure wrapped in a function call or
other non-JSON data.
"""
fd.write(before)
fd.write(json.dumps(json_data,
separators=(",", ":"),
... | Write a JSONP file.
JSONP files have a JSON data structure wrapped in a function call or
other non-JSON data.
| Write a JSONP file.
JSONP files have a JSON data structure wrapped in a function call or
other non-JSON data. | [
"Write",
"a",
"JSONP",
"file",
".",
"JSONP",
"files",
"have",
"a",
"JSON",
"data",
"structure",
"wrapped",
"in",
"a",
"function",
"call",
"or",
"other",
"non",
"-",
"JSON",
"data",
"."
] | def dump_jsonp(fd, before, json_data, after):
fd.write(before)
fd.write(json.dumps(json_data,
separators=(",", ":"),
sort_keys=True).encode('utf-8'))
fd.write(after) | [
"def",
"dump_jsonp",
"(",
"fd",
",",
"before",
",",
"json_data",
",",
"after",
")",
":",
"fd",
".",
"write",
"(",
"before",
")",
"fd",
".",
"write",
"(",
"json",
".",
"dumps",
"(",
"json_data",
",",
"separators",
"=",
"(",
"\",\"",
",",
"\":\"",
")... | Write a JSONP file. | [
"Write",
"a",
"JSONP",
"file",
"."
] | [
"\"\"\"Write a JSONP file.\n\n JSONP files have a JSON data structure wrapped in a function call or\n other non-JSON data.\n \"\"\""
] | [
{
"param": "fd",
"type": null
},
{
"param": "before",
"type": null
},
{
"param": "json_data",
"type": null
},
{
"param": "after",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fd",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "before",
"type": null,
"docstring": null,
"docstring_tokens": [... |
42d8f06cf5f610ce81794424a62aef9389df7546 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/merge_results.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ensure_empty_dir | <not_specific> | def ensure_empty_dir(fs, directory, allow_existing, remove_existing):
"""Ensure an empty directory exists.
Args:
allow_existing (bool): Allow the empty directory to already exist.
remove_existing (bool): Remove the contents if the directory
already exists.
"""
if not fs.exis... | Ensure an empty directory exists.
Args:
allow_existing (bool): Allow the empty directory to already exist.
remove_existing (bool): Remove the contents if the directory
already exists.
| Ensure an empty directory exists. | [
"Ensure",
"an",
"empty",
"directory",
"exists",
"."
] | def ensure_empty_dir(fs, directory, allow_existing, remove_existing):
if not fs.exists(directory):
fs.maybe_make_directory(directory)
return
logging.warning('Output directory exists %r', directory)
if not allow_existing:
raise IOError(
('Output directory %s exists!\n'
... | [
"def",
"ensure_empty_dir",
"(",
"fs",
",",
"directory",
",",
"allow_existing",
",",
"remove_existing",
")",
":",
"if",
"not",
"fs",
".",
"exists",
"(",
"directory",
")",
":",
"fs",
".",
"maybe_make_directory",
"(",
"directory",
")",
"return",
"logging",
".",... | Ensure an empty directory exists. | [
"Ensure",
"an",
"empty",
"directory",
"exists",
"."
] | [
"\"\"\"Ensure an empty directory exists.\n\n Args:\n allow_existing (bool): Allow the empty directory to already exist.\n remove_existing (bool): Remove the contents if the directory\n already exists.\n \"\"\""
] | [
{
"param": "fs",
"type": null
},
{
"param": "directory",
"type": null
},
{
"param": "allow_existing",
"type": null
},
{
"param": "remove_existing",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fs",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "directory",
"type": null,
"docstring": null,
"docstring_tokens"... |
42d8f06cf5f610ce81794424a62aef9389df7546 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/merge_results.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | mark_missing_shards | null | def mark_missing_shards(summary_json,
input_directories,
merged_output_json,
fs=None):
"""Merge the contents of one or more results JSONs into a single JSON.
Args:
summary_json: swarming summary containing shard info.
input... | Merge the contents of one or more results JSONs into a single JSON.
Args:
summary_json: swarming summary containing shard info.
input_directories: A list of dir paths to JSON files that should be merged.
merged_output_json: A path to a JSON file to which the merged results should be
... | Merge the contents of one or more results JSONs into a single JSON.
Args:
summary_json: swarming summary containing shard info.
input_directories: A list of dir paths to JSON files that should be merged.
merged_output_json: A path to a JSON file to which the merged results should be
written.
fs: filesystem object - Moc... | [
"Merge",
"the",
"contents",
"of",
"one",
"or",
"more",
"results",
"JSONs",
"into",
"a",
"single",
"JSON",
".",
"Args",
":",
"summary_json",
":",
"swarming",
"summary",
"containing",
"shard",
"info",
".",
"input_directories",
":",
"A",
"list",
"of",
"dir",
... | def mark_missing_shards(summary_json,
input_directories,
merged_output_json,
fs=None):
if fs != None:
filesystem = fs
else:
filesystem = FileSystem()
try:
with filesystem.open_binary_file_for_reading(summary_json... | [
"def",
"mark_missing_shards",
"(",
"summary_json",
",",
"input_directories",
",",
"merged_output_json",
",",
"fs",
"=",
"None",
")",
":",
"if",
"fs",
"!=",
"None",
":",
"filesystem",
"=",
"fs",
"else",
":",
"filesystem",
"=",
"FileSystem",
"(",
")",
"try",
... | Merge the contents of one or more results JSONs into a single JSON. | [
"Merge",
"the",
"contents",
"of",
"one",
"or",
"more",
"results",
"JSONs",
"into",
"a",
"single",
"JSON",
"."
] | [
"\"\"\"Merge the contents of one or more results JSONs into a single JSON.\n\n Args:\n summary_json: swarming summary containing shard info.\n input_directories: A list of dir paths to JSON files that should be merged.\n merged_output_json: A path to a JSON file to which the merged results s... | [
{
"param": "summary_json",
"type": null
},
{
"param": "input_directories",
"type": null
},
{
"param": "merged_output_json",
"type": null
},
{
"param": "fs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "summary_json",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_directories",
"type": null,
"docstring": null,
... |
42d8f06cf5f610ce81794424a62aef9389df7546 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/merge_results.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | find_shard_output_path | <not_specific> | def find_shard_output_path(index, task_id, input_directories):
"""Finds the shard matching the index/task-id.
Args:
index: The index of the shard to load data for, this is for old api.
task_id: The directory of the shard to load data for, this is for new api.
input_directories: A contai... | Finds the shard matching the index/task-id.
Args:
index: The index of the shard to load data for, this is for old api.
task_id: The directory of the shard to load data for, this is for new api.
input_directories: A container of file paths for shards that emitted output.
Returns:
... | Finds the shard matching the index/task-id. | [
"Finds",
"the",
"shard",
"matching",
"the",
"index",
"/",
"task",
"-",
"id",
"."
] | def find_shard_output_path(index, task_id, input_directories):
matching_json_files = [
j for j in input_directories
if (os.path.basename(j) == str(index) or os.path.basename(j) == task_id
)
]
if not matching_json_files:
_log.warning('shard %s test output missing', index)
... | [
"def",
"find_shard_output_path",
"(",
"index",
",",
"task_id",
",",
"input_directories",
")",
":",
"matching_json_files",
"=",
"[",
"j",
"for",
"j",
"in",
"input_directories",
"if",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"j",
")",
"==",
"str",
"(",
... | Finds the shard matching the index/task-id. | [
"Finds",
"the",
"shard",
"matching",
"the",
"index",
"/",
"task",
"-",
"id",
"."
] | [
"\"\"\"Finds the shard matching the index/task-id.\n\n Args:\n index: The index of the shard to load data for, this is for old api.\n task_id: The directory of the shard to load data for, this is for new api.\n input_directories: A container of file paths for shards that emitted output.\n\n ... | [
{
"param": "index",
"type": null
},
{
"param": "task_id",
"type": null
},
{
"param": "input_directories",
"type": null
}
] | {
"returns": [
{
"docstring": "The matching path, or None",
"docstring_tokens": [
"The",
"matching",
"path",
"or",
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "index",
"type": null,
"docstring... |
9fb656ca61f05aa456946eb177caf24d9ac9af58 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | assert_positions_equal | null | def assert_positions_equal(self, position, tuple_position):
"""Checks if the two positions are equal.
position: a cpp_style.Position object.
tuple_position: a tuple (row, column) to compare against.
"""
self.assertEqual(
(position.row, position.column), tuple_positio... | Checks if the two positions are equal.
position: a cpp_style.Position object.
tuple_position: a tuple (row, column) to compare against.
| Checks if the two positions are equal. | [
"Checks",
"if",
"the",
"two",
"positions",
"are",
"equal",
"."
] | def assert_positions_equal(self, position, tuple_position):
self.assertEqual(
(position.row, position.column), tuple_position,
'position %s, tuple_position %s' % (position, tuple_position)) | [
"def",
"assert_positions_equal",
"(",
"self",
",",
"position",
",",
"tuple_position",
")",
":",
"self",
".",
"assertEqual",
"(",
"(",
"position",
".",
"row",
",",
"position",
".",
"column",
")",
",",
"tuple_position",
",",
"'position %s, tuple_position %s'",
"%"... | Checks if the two positions are equal. | [
"Checks",
"if",
"the",
"two",
"positions",
"are",
"equal",
"."
] | [
"\"\"\"Checks if the two positions are equal.\n\n position: a cpp_style.Position object.\n tuple_position: a tuple (row, column) to compare against.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "position",
"type": null
},
{
"param": "tuple_position",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "position",
"type": null,
"docstring": null,
"docstring_tokens... |
9fb656ca61f05aa456946eb177caf24d9ac9af58 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | assert_function_lengths_check | null | def assert_function_lengths_check(self, code, expected_message):
"""Check warnings for long function bodies are as expected.
Args:
code: C++ source code expected to generate a warning message.
expected_message: Message expected to be generated by the C++ code.
"""
se... | Check warnings for long function bodies are as expected.
Args:
code: C++ source code expected to generate a warning message.
expected_message: Message expected to be generated by the C++ code.
| Check warnings for long function bodies are as expected. | [
"Check",
"warnings",
"for",
"long",
"function",
"bodies",
"are",
"as",
"expected",
"."
] | def assert_function_lengths_check(self, code, expected_message):
self.assertEqual(expected_message,
self.perform_function_lengths_check(code)) | [
"def",
"assert_function_lengths_check",
"(",
"self",
",",
"code",
",",
"expected_message",
")",
":",
"self",
".",
"assertEqual",
"(",
"expected_message",
",",
"self",
".",
"perform_function_lengths_check",
"(",
"code",
")",
")"
] | Check warnings for long function bodies are as expected. | [
"Check",
"warnings",
"for",
"long",
"function",
"bodies",
"are",
"as",
"expected",
"."
] | [
"\"\"\"Check warnings for long function bodies are as expected.\n\n Args:\n code: C++ source code expected to generate a warning message.\n expected_message: Message expected to be generated by the C++ code.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "code",
"type": null
},
{
"param": "expected_message",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": null,
"docstring": "C++ source code expected to gene... |
9fb656ca61f05aa456946eb177caf24d9ac9af58 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | trigger_lines | <not_specific> | def trigger_lines(self, error_level):
"""Return number of lines needed to trigger a function length warning.
Args:
error_level: --v setting for cpp_style.
Returns:
Number of lines needed to trigger a function length warning.
"""
return cpp_style._FunctionSta... | Return number of lines needed to trigger a function length warning.
Args:
error_level: --v setting for cpp_style.
Returns:
Number of lines needed to trigger a function length warning.
| Return number of lines needed to trigger a function length warning. | [
"Return",
"number",
"of",
"lines",
"needed",
"to",
"trigger",
"a",
"function",
"length",
"warning",
"."
] | def trigger_lines(self, error_level):
return cpp_style._FunctionState._NORMAL_TRIGGER * 2**error_level | [
"def",
"trigger_lines",
"(",
"self",
",",
"error_level",
")",
":",
"return",
"cpp_style",
".",
"_FunctionState",
".",
"_NORMAL_TRIGGER",
"*",
"2",
"**",
"error_level"
] | Return number of lines needed to trigger a function length warning. | [
"Return",
"number",
"of",
"lines",
"needed",
"to",
"trigger",
"a",
"function",
"length",
"warning",
"."
] | [
"\"\"\"Return number of lines needed to trigger a function length warning.\n\n Args:\n error_level: --v setting for cpp_style.\n\n Returns:\n Number of lines needed to trigger a function length warning.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "error_level",
"type": null
}
] | {
"returns": [
{
"docstring": "Number of lines needed to trigger a function length warning.",
"docstring_tokens": [
"Number",
"of",
"lines",
"needed",
"to",
"trigger",
"a",
"function",
"length",
"warning",
"."
... |
9fb656ca61f05aa456946eb177caf24d9ac9af58 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | assert_function_length_check_definition | null | def assert_function_length_check_definition(self, lines, error_level):
"""Generate long function definition and check warnings are as expected.
Args:
lines: Number of lines to generate.
error_level: --v setting for cpp_style.
"""
trigger_level = self.trigger_lines(s... | Generate long function definition and check warnings are as expected.
Args:
lines: Number of lines to generate.
error_level: --v setting for cpp_style.
| Generate long function definition and check warnings are as expected. | [
"Generate",
"long",
"function",
"definition",
"and",
"check",
"warnings",
"are",
"as",
"expected",
"."
] | def assert_function_length_check_definition(self, lines, error_level):
trigger_level = self.trigger_lines(self.min_confidence)
self.assert_function_lengths_check(
'void test(int x)' + self.function_body(lines),
('Small and focused functions are preferred: '
'test() h... | [
"def",
"assert_function_length_check_definition",
"(",
"self",
",",
"lines",
",",
"error_level",
")",
":",
"trigger_level",
"=",
"self",
".",
"trigger_lines",
"(",
"self",
".",
"min_confidence",
")",
"self",
".",
"assert_function_lengths_check",
"(",
"'void test(int x... | Generate long function definition and check warnings are as expected. | [
"Generate",
"long",
"function",
"definition",
"and",
"check",
"warnings",
"are",
"as",
"expected",
"."
] | [
"\"\"\"Generate long function definition and check warnings are as expected.\n\n Args:\n lines: Number of lines to generate.\n error_level: --v setting for cpp_style.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "lines",
"type": null
},
{
"param": "error_level",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lines",
"type": null,
"docstring": "Number of lines to generate.",
... |
9fb656ca61f05aa456946eb177caf24d9ac9af58 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | assert_function_length_check_definition_ok | null | def assert_function_length_check_definition_ok(self, lines):
"""Generate shorter function definition and check no warning is produced.
Args:
lines: Number of lines to generate.
"""
self.assert_function_lengths_check(
'void test(int x)' + self.function_body(lines), ... | Generate shorter function definition and check no warning is produced.
Args:
lines: Number of lines to generate.
| Generate shorter function definition and check no warning is produced. | [
"Generate",
"shorter",
"function",
"definition",
"and",
"check",
"no",
"warning",
"is",
"produced",
"."
] | def assert_function_length_check_definition_ok(self, lines):
self.assert_function_lengths_check(
'void test(int x)' + self.function_body(lines), '') | [
"def",
"assert_function_length_check_definition_ok",
"(",
"self",
",",
"lines",
")",
":",
"self",
".",
"assert_function_lengths_check",
"(",
"'void test(int x)'",
"+",
"self",
".",
"function_body",
"(",
"lines",
")",
",",
"''",
")"
] | Generate shorter function definition and check no warning is produced. | [
"Generate",
"shorter",
"function",
"definition",
"and",
"check",
"no",
"warning",
"is",
"produced",
"."
] | [
"\"\"\"Generate shorter function definition and check no warning is produced.\n\n Args:\n lines: Number of lines to generate.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "lines",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lines",
"type": null,
"docstring": "Number of lines to generate.",
... |
9fb656ca61f05aa456946eb177caf24d9ac9af58 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | assert_function_length_check_at_error_level | null | def assert_function_length_check_at_error_level(self, error_level):
"""Generate and check function at the trigger level for --v setting.
Args:
error_level: --v setting for cpp_style.
"""
self.assert_function_length_check_definition(
self.trigger_lines(error_level),... | Generate and check function at the trigger level for --v setting.
Args:
error_level: --v setting for cpp_style.
| Generate and check function at the trigger level for --v setting. | [
"Generate",
"and",
"check",
"function",
"at",
"the",
"trigger",
"level",
"for",
"--",
"v",
"setting",
"."
] | def assert_function_length_check_at_error_level(self, error_level):
self.assert_function_length_check_definition(
self.trigger_lines(error_level), error_level) | [
"def",
"assert_function_length_check_at_error_level",
"(",
"self",
",",
"error_level",
")",
":",
"self",
".",
"assert_function_length_check_definition",
"(",
"self",
".",
"trigger_lines",
"(",
"error_level",
")",
",",
"error_level",
")"
] | Generate and check function at the trigger level for --v setting. | [
"Generate",
"and",
"check",
"function",
"at",
"the",
"trigger",
"level",
"for",
"--",
"v",
"setting",
"."
] | [
"\"\"\"Generate and check function at the trigger level for --v setting.\n\n Args:\n error_level: --v setting for cpp_style.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "error_level",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "error_level",
"type": null,
"docstring": "v setting for cpp_style."... |
9fb656ca61f05aa456946eb177caf24d9ac9af58 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | assert_function_length_check_below_error_level | null | def assert_function_length_check_below_error_level(self, error_level):
"""Generate and check function just below the trigger level for --v setting.
Args:
error_level: --v setting for cpp_style.
"""
self.assert_function_length_check_definition(
self.trigger_lines(er... | Generate and check function just below the trigger level for --v setting.
Args:
error_level: --v setting for cpp_style.
| Generate and check function just below the trigger level for --v setting. | [
"Generate",
"and",
"check",
"function",
"just",
"below",
"the",
"trigger",
"level",
"for",
"--",
"v",
"setting",
"."
] | def assert_function_length_check_below_error_level(self, error_level):
self.assert_function_length_check_definition(
self.trigger_lines(error_level) - 1, error_level - 1) | [
"def",
"assert_function_length_check_below_error_level",
"(",
"self",
",",
"error_level",
")",
":",
"self",
".",
"assert_function_length_check_definition",
"(",
"self",
".",
"trigger_lines",
"(",
"error_level",
")",
"-",
"1",
",",
"error_level",
"-",
"1",
")"
] | Generate and check function just below the trigger level for --v setting. | [
"Generate",
"and",
"check",
"function",
"just",
"below",
"the",
"trigger",
"level",
"for",
"--",
"v",
"setting",
"."
] | [
"\"\"\"Generate and check function just below the trigger level for --v setting.\n\n Args:\n error_level: --v setting for cpp_style.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "error_level",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "error_level",
"type": null,
"docstring": "v setting for cpp_style."... |
9fb656ca61f05aa456946eb177caf24d9ac9af58 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | assert_function_length_check_above_error_level | null | def assert_function_length_check_above_error_level(self, error_level):
"""Generate and check function just above the trigger level for --v setting.
Args:
error_level: --v setting for cpp_style.
"""
self.assert_function_length_check_definition(
self.trigger_lines(er... | Generate and check function just above the trigger level for --v setting.
Args:
error_level: --v setting for cpp_style.
| Generate and check function just above the trigger level for --v setting. | [
"Generate",
"and",
"check",
"function",
"just",
"above",
"the",
"trigger",
"level",
"for",
"--",
"v",
"setting",
"."
] | def assert_function_length_check_above_error_level(self, error_level):
self.assert_function_length_check_definition(
self.trigger_lines(error_level) + 1, error_level) | [
"def",
"assert_function_length_check_above_error_level",
"(",
"self",
",",
"error_level",
")",
":",
"self",
".",
"assert_function_length_check_definition",
"(",
"self",
".",
"trigger_lines",
"(",
"error_level",
")",
"+",
"1",
",",
"error_level",
")"
] | Generate and check function just above the trigger level for --v setting. | [
"Generate",
"and",
"check",
"function",
"just",
"above",
"the",
"trigger",
"level",
"for",
"--",
"v",
"setting",
"."
] | [
"\"\"\"Generate and check function just above the trigger level for --v setting.\n\n Args:\n error_level: --v setting for cpp_style.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "error_level",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "error_level",
"type": null,
"docstring": "v setting for cpp_style."... |
9fb656ca61f05aa456946eb177caf24d9ac9af58 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | assert_pass_ptr_check | null | def assert_pass_ptr_check(self, code, expected_message):
"""Check warnings for Pass*Ptr are as expected.
Args:
code: C++ source code expected to generate a warning message.
expected_message: Message expected to be generated by the C++ code.
"""
self.assertEqual(expec... | Check warnings for Pass*Ptr are as expected.
Args:
code: C++ source code expected to generate a warning message.
expected_message: Message expected to be generated by the C++ code.
| Check warnings for Pass*Ptr are as expected. | [
"Check",
"warnings",
"for",
"Pass",
"*",
"Ptr",
"are",
"as",
"expected",
"."
] | def assert_pass_ptr_check(self, code, expected_message):
self.assertEqual(expected_message, self.perform_pass_ptr_check(code)) | [
"def",
"assert_pass_ptr_check",
"(",
"self",
",",
"code",
",",
"expected_message",
")",
":",
"self",
".",
"assertEqual",
"(",
"expected_message",
",",
"self",
".",
"perform_pass_ptr_check",
"(",
"code",
")",
")"
] | Check warnings for Pass*Ptr are as expected. | [
"Check",
"warnings",
"for",
"Pass",
"*",
"Ptr",
"are",
"as",
"expected",
"."
] | [
"\"\"\"Check warnings for Pass*Ptr are as expected.\n\n Args:\n code: C++ source code expected to generate a warning message.\n expected_message: Message expected to be generated by the C++ code.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "code",
"type": null
},
{
"param": "expected_message",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": null,
"docstring": "C++ source code expected to gene... |
693bdf76b1581f603100d865f81a4c87c819c7ac | sunlongbo/chromium | tools/binary_size/libsupersize/nm.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreateUniqueSymbols | <not_specific> | def CreateUniqueSymbols(elf_path, tool_prefix, section_ranges):
"""Creates symbols from nm --print-size output.
Creates only one symbol for each address (does not create symbol aliases).
"""
# Filter to sections we care about and sort by (address, size).
section_ranges = [
x for x in section_ranges.ite... | Creates symbols from nm --print-size output.
Creates only one symbol for each address (does not create symbol aliases).
| Creates symbols from nm --print-size output.
Creates only one symbol for each address (does not create symbol aliases). | [
"Creates",
"symbols",
"from",
"nm",
"--",
"print",
"-",
"size",
"output",
".",
"Creates",
"only",
"one",
"symbol",
"for",
"each",
"address",
"(",
"does",
"not",
"create",
"symbol",
"aliases",
")",
"."
] | def CreateUniqueSymbols(elf_path, tool_prefix, section_ranges):
section_ranges = [
x for x in section_ranges.items() if x[0] in models.NATIVE_SECTIONS
]
section_ranges.sort(key=lambda x: x[1])
min_address = section_ranges[0][1][0]
max_address = sum(section_ranges[-1][1])
args = [
path_util.GetNm... | [
"def",
"CreateUniqueSymbols",
"(",
"elf_path",
",",
"tool_prefix",
",",
"section_ranges",
")",
":",
"section_ranges",
"=",
"[",
"x",
"for",
"x",
"in",
"section_ranges",
".",
"items",
"(",
")",
"if",
"x",
"[",
"0",
"]",
"in",
"models",
".",
"NATIVE_SECTIONS... | Creates symbols from nm --print-size output. | [
"Creates",
"symbols",
"from",
"nm",
"--",
"print",
"-",
"size",
"output",
"."
] | [
"\"\"\"Creates symbols from nm --print-size output.\n\n Creates only one symbol for each address (does not create symbol aliases).\n \"\"\"",
"# Filter to sections we care about and sort by (address, size).",
"# pylint: disable=unexpected-keyword-arg",
"# Example 32-bit output:",
"# 00857f94 00000004 t __... | [
{
"param": "elf_path",
"type": null
},
{
"param": "tool_prefix",
"type": null
},
{
"param": "section_ranges",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "elf_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tool_prefix",
"type": null,
"docstring": null,
"docstring... |
6962841b43c3c543882ec6090ab313ea2fae20c9 | sunlongbo/chromium | tools/perf/cli_tools/flakiness_cli/analysis.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ResultsKey | <not_specific> | def ResultsKey():
"""Create a DataFrame with information about result values."""
return pandas.DataFrame.from_records([
('P', 'PASS', '-', 0.0),
('N', 'NO DATA', ' ', 0.0),
('X', 'SKIP', '~', 0.0),
('Q', 'FAIL', 'F', 1.0),
('Y', 'NOTRUN', '?', 0.1),
('L', 'FLAKY', '!', 0.5),
],... | Create a DataFrame with information about result values. | Create a DataFrame with information about result values. | [
"Create",
"a",
"DataFrame",
"with",
"information",
"about",
"result",
"values",
"."
] | def ResultsKey():
return pandas.DataFrame.from_records([
('P', 'PASS', '-', 0.0),
('N', 'NO DATA', ' ', 0.0),
('X', 'SKIP', '~', 0.0),
('Q', 'FAIL', 'F', 1.0),
('Y', 'NOTRUN', '?', 0.1),
('L', 'FLAKY', '!', 0.5),
], columns=('code', 'result', 'char', 'badness'), index='code') | [
"def",
"ResultsKey",
"(",
")",
":",
"return",
"pandas",
".",
"DataFrame",
".",
"from_records",
"(",
"[",
"(",
"'P'",
",",
"'PASS'",
",",
"'-'",
",",
"0.0",
")",
",",
"(",
"'N'",
",",
"'NO DATA'",
",",
"' '",
",",
"0.0",
")",
",",
"(",
"'X'",
",",... | Create a DataFrame with information about result values. | [
"Create",
"a",
"DataFrame",
"with",
"information",
"about",
"result",
"values",
"."
] | [
"\"\"\"Create a DataFrame with information about result values.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
6962841b43c3c543882ec6090ab313ea2fae20c9 | sunlongbo/chromium | tools/perf/cli_tools/flakiness_cli/analysis.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FilterBy | <not_specific> | def FilterBy(df, **kwargs):
"""Filter out a data frame by applying patterns to columns.
Args:
df: A data frame to filter.
**kwargs: Remaining keyword arguments are interpreted as column=pattern
specifications. The pattern may contain shell-style wildcards, only rows
whose value in the specified... | Filter out a data frame by applying patterns to columns.
Args:
df: A data frame to filter.
**kwargs: Remaining keyword arguments are interpreted as column=pattern
specifications. The pattern may contain shell-style wildcards, only rows
whose value in the specified column matches the pattern will ... | Filter out a data frame by applying patterns to columns. | [
"Filter",
"out",
"a",
"data",
"frame",
"by",
"applying",
"patterns",
"to",
"columns",
"."
] | def FilterBy(df, **kwargs):
for column, pattern in kwargs.items():
if pattern is not None:
df = df[df[column].str.match(fnmatch.translate(pattern), case=False)]
return df | [
"def",
"FilterBy",
"(",
"df",
",",
"**",
"kwargs",
")",
":",
"for",
"column",
",",
"pattern",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"pattern",
"is",
"not",
"None",
":",
"df",
"=",
"df",
"[",
"df",
"[",
"column",
"]",
".",
"str",
".... | Filter out a data frame by applying patterns to columns. | [
"Filter",
"out",
"a",
"data",
"frame",
"by",
"applying",
"patterns",
"to",
"columns",
"."
] | [
"\"\"\"Filter out a data frame by applying patterns to columns.\n\n Args:\n df: A data frame to filter.\n **kwargs: Remaining keyword arguments are interpreted as column=pattern\n specifications. The pattern may contain shell-style wildcards, only rows\n whose value in the specified column matches ... | [
{
"param": "df",
"type": null
}
] | {
"returns": [
{
"docstring": "The filtered data frame (a view on the original data frame).",
"docstring_tokens": [
"The",
"filtered",
"data",
"frame",
"(",
"a",
"view",
"on",
"the",
"original",
"data",
"fr... |
6962841b43c3c543882ec6090ab313ea2fae20c9 | sunlongbo/chromium | tools/perf/cli_tools/flakiness_cli/analysis.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CompactResults | <not_specific> | def CompactResults(results):
"""Aggregate results from multime runs into a single result code."""
def Compact(result):
if len(result) == 1:
return result # Test ran once; use same value.
elif all(r == 'Q' for r in result):
return 'Q' # All runs failed; test failed.
else:
return 'L' ... | Aggregate results from multime runs into a single result code. | Aggregate results from multime runs into a single result code. | [
"Aggregate",
"results",
"from",
"multime",
"runs",
"into",
"a",
"single",
"result",
"code",
"."
] | def CompactResults(results):
def Compact(result):
if len(result) == 1:
return result
elif all(r == 'Q' for r in result):
return 'Q'
else:
return 'L'
return results.map({r: Compact(r) for r in results.unique()}) | [
"def",
"CompactResults",
"(",
"results",
")",
":",
"def",
"Compact",
"(",
"result",
")",
":",
"if",
"len",
"(",
"result",
")",
"==",
"1",
":",
"return",
"result",
"elif",
"all",
"(",
"r",
"==",
"'Q'",
"for",
"r",
"in",
"result",
")",
":",
"return",... | Aggregate results from multime runs into a single result code. | [
"Aggregate",
"results",
"from",
"multime",
"runs",
"into",
"a",
"single",
"result",
"code",
"."
] | [
"\"\"\"Aggregate results from multime runs into a single result code.\"\"\"",
"# Test ran once; use same value.",
"# All runs failed; test failed.",
"# Sometimes failed, sometimes not; test flaky."
] | [
{
"param": "results",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "results",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6962841b43c3c543882ec6090ab313ea2fae20c9 | sunlongbo/chromium | tools/perf/cli_tools/flakiness_cli/analysis.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AggregateBuilds | <not_specific> | def AggregateBuilds(df, half_life):
"""Aggregate results from multiple builds of the same test configuration.
Also computes the "flakiness" of a test configuration.
Args:
df: A data frame with test results per build for a single test
configuration (i.e. fixed master, builder, test_type).
half_life... | Aggregate results from multiple builds of the same test configuration.
Also computes the "flakiness" of a test configuration.
Args:
df: A data frame with test results per build for a single test
configuration (i.e. fixed master, builder, test_type).
half_life: A number of days. Builds failures from ... | Aggregate results from multiple builds of the same test configuration.
Also computes the "flakiness" of a test configuration. | [
"Aggregate",
"results",
"from",
"multiple",
"builds",
"of",
"the",
"same",
"test",
"configuration",
".",
"Also",
"computes",
"the",
"\"",
"flakiness",
"\"",
"of",
"a",
"test",
"configuration",
"."
] | def AggregateBuilds(df, half_life):
results_key = ResultsKey()
df = df.copy()
df['result'] = CompactResults(df['result'])
df['status'] = df['result'].map(results_key['char'])
df['flakiness'] = df['result'].map(results_key['badness'])
time_ago = df['timestamp'].max() - df['timestamp']
days_ago = time_ago.d... | [
"def",
"AggregateBuilds",
"(",
"df",
",",
"half_life",
")",
":",
"results_key",
"=",
"ResultsKey",
"(",
")",
"df",
"=",
"df",
".",
"copy",
"(",
")",
"df",
"[",
"'result'",
"]",
"=",
"CompactResults",
"(",
"df",
"[",
"'result'",
"]",
")",
"df",
"[",
... | Aggregate results from multiple builds of the same test configuration. | [
"Aggregate",
"results",
"from",
"multiple",
"builds",
"of",
"the",
"same",
"test",
"configuration",
"."
] | [
"\"\"\"Aggregate results from multiple builds of the same test configuration.\n\n Also computes the \"flakiness\" of a test configuration.\n\n Args:\n df: A data frame with test results per build for a single test\n configuration (i.e. fixed master, builder, test_type).\n half_life: A number of days. B... | [
{
"param": "df",
"type": null
},
{
"param": "half_life",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "df",
"type": null,
"docstring": "A data frame with test results per build for a single test\nconfiguration .",
"docstring_tokens": [
"A",
"data",
"frame",
"with",
"test",
"result... |
a8053db20a9ca3c0d71c4758b1d65a033e2fa3ef | sunlongbo/chromium | third_party/tflite_support/src/tensorflow_lite_support/cc/port/build_defs.bzl | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | support_cc_proto_library | null | def support_cc_proto_library(name, srcs, visibility = None, deps = [], cc_deps = [], testonly = 0):
"""Generate cc_proto_library for TFLite Support open source version.
Args:
name: the name of the cc_proto_library.
srcs: the .proto files of the cc_proto_library for Bazel use.
visibili... | Generate cc_proto_library for TFLite Support open source version.
Args:
name: the name of the cc_proto_library.
srcs: the .proto files of the cc_proto_library for Bazel use.
visibility: visibility of this target.
deps: a list of dependency labels for Bazel use; must be cc_proto_li... | Generate cc_proto_library for TFLite Support open source version. | [
"Generate",
"cc_proto_library",
"for",
"TFLite",
"Support",
"open",
"source",
"version",
"."
] | def support_cc_proto_library(name, srcs, visibility = None, deps = [], cc_deps = [], testonly = 0):
_ignore = [deps]
cc_proto_library(**provided_args(
name = name,
srcs = srcs,
visibility = visibility,
deps = cc_deps,
testonly = testonly,
cc_libs = ["@com_google_p... | [
"def",
"support_cc_proto_library",
"(",
"name",
",",
"srcs",
",",
"visibility",
"=",
"None",
",",
"deps",
"=",
"[",
"]",
",",
"cc_deps",
"=",
"[",
"]",
",",
"testonly",
"=",
"0",
")",
":",
"_ignore",
"=",
"[",
"deps",
"]",
"cc_proto_library",
"(",
"*... | Generate cc_proto_library for TFLite Support open source version. | [
"Generate",
"cc_proto_library",
"for",
"TFLite",
"Support",
"open",
"source",
"version",
"."
] | [
"\"\"\"Generate cc_proto_library for TFLite Support open source version.\n\n Args:\n name: the name of the cc_proto_library.\n srcs: the .proto files of the cc_proto_library for Bazel use.\n visibility: visibility of this target.\n deps: a list of dependency labels for Bazel use; mu... | [
{
"param": "name",
"type": null
},
{
"param": "srcs",
"type": null
},
{
"param": "visibility",
"type": null
},
{
"param": "deps",
"type": null
},
{
"param": "cc_deps",
"type": null
},
{
"param": "testonly",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": "the name of the cc_proto_library.",
"docstring_tokens": [
"the",
"name",
"of",
"the",
"cc_proto_library",
"."
],
"default": null,
... |
3e0cb3a56d411afec258628e0bb11999df60d058 | sunlongbo/chromium | tools/accessibility/nvda/nvda_chrome_tests.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetSpeechFromNvdaLogFile | <not_specific> | def _GetSpeechFromNvdaLogFile(self):
"""Return everything NVDA would have spoken as a list of strings.
Parses lines like this from NVDA's log file:
Speaking [LangChangeCommand ('en'), u'Google Chrome', u'window']
Speaking character u'slash'
Returns a single list of strings like this:
[u'... | Return everything NVDA would have spoken as a list of strings.
Parses lines like this from NVDA's log file:
Speaking [LangChangeCommand ('en'), u'Google Chrome', u'window']
Speaking character u'slash'
Returns a single list of strings like this:
[u'Google Chrome', u'window', u'slash']
| Return everything NVDA would have spoken as a list of strings.
| [
"Return",
"everything",
"NVDA",
"would",
"have",
"spoken",
"as",
"a",
"list",
"of",
"strings",
"."
] | def _GetSpeechFromNvdaLogFile(self):
if not os.access(NVDA_LOGPATH, os.F_OK):
return []
lines = open(NVDA_LOGPATH).readlines()[self.last_nvda_log_line:]
regex = re.compile(r"u'((?:[^\'\\]|\\.)*)\'")
result = []
for line in lines:
for m in regex.finditer(line):
speech_with_whitesp... | [
"def",
"_GetSpeechFromNvdaLogFile",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"access",
"(",
"NVDA_LOGPATH",
",",
"os",
".",
"F_OK",
")",
":",
"return",
"[",
"]",
"lines",
"=",
"open",
"(",
"NVDA_LOGPATH",
")",
".",
"readlines",
"(",
")",
"[",
"... | Return everything NVDA would have spoken as a list of strings. | [
"Return",
"everything",
"NVDA",
"would",
"have",
"spoken",
"as",
"a",
"list",
"of",
"strings",
"."
] | [
"\"\"\"Return everything NVDA would have spoken as a list of strings.\n\n Parses lines like this from NVDA's log file:\n Speaking [LangChangeCommand ('en'), u'Google Chrome', u'window']\n Speaking character u'slash'\n\n Returns a single list of strings like this:\n [u'Google Chrome', u'window',... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3e0cb3a56d411afec258628e0bb11999df60d058 | sunlongbo/chromium | tools/accessibility/nvda/nvda_chrome_tests.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _TestForSpeech | <not_specific> | def _TestForSpeech(self, expected):
"""Block until the last speech in NVDA's log file is the given string(s).
Repeatedly parses the log file until the last speech line(s) in the
log file match the given strings, or it times out.
Args:
expected: string or a list of string - only succeeds if these... | Block until the last speech in NVDA's log file is the given string(s).
Repeatedly parses the log file until the last speech line(s) in the
log file match the given strings, or it times out.
Args:
expected: string or a list of string - only succeeds if these are the last
strings spoken, in or... | Block until the last speech in NVDA's log file is the given string(s).
Repeatedly parses the log file until the last speech line(s) in the
log file match the given strings, or it times out. | [
"Block",
"until",
"the",
"last",
"speech",
"in",
"NVDA",
"'",
"s",
"log",
"file",
"is",
"the",
"given",
"string",
"(",
"s",
")",
".",
"Repeatedly",
"parses",
"the",
"log",
"file",
"until",
"the",
"last",
"speech",
"line",
"(",
"s",
")",
"in",
"the",
... | def _TestForSpeech(self, expected):
if type(expected) is type(''):
expected = [expected]
start_time = time.time()
while True:
lines = self._GetSpeechFromNvdaLogFile()
if self._ArrayInArray(lines, expected):
return True
if time.time() - start_time >= WAIT_FOR_SPEECH_TIMEOUT_SE... | [
"def",
"_TestForSpeech",
"(",
"self",
",",
"expected",
")",
":",
"if",
"type",
"(",
"expected",
")",
"is",
"type",
"(",
"''",
")",
":",
"expected",
"=",
"[",
"expected",
"]",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"while",
"True",
":",
"... | Block until the last speech in NVDA's log file is the given string(s). | [
"Block",
"until",
"the",
"last",
"speech",
"in",
"NVDA",
"'",
"s",
"log",
"file",
"is",
"the",
"given",
"string",
"(",
"s",
")",
"."
] | [
"\"\"\"Block until the last speech in NVDA's log file is the given string(s).\n\n Repeatedly parses the log file until the last speech line(s) in the\n log file match the given strings, or it times out.\n\n Args:\n expected: string or a list of string - only succeeds if these are the last\n str... | [
{
"param": "self",
"type": null
},
{
"param": "expected",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "expected",
"type": null,
"docstring": "string or a list of string -... |
3fbd0a6b3583b7ddb6c3c0072ba982d2adc725dd | sunlongbo/chromium | components/policy/tools/template_writers/writers/reg_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetWriter | <not_specific> | def GetWriter(config):
'''Factory method for creating RegWriter objects.
See the constructor of TemplateWriter for description of
arguments.
'''
return RegWriter(['win', 'win7'], config) | Factory method for creating RegWriter objects.
See the constructor of TemplateWriter for description of
arguments.
| Factory method for creating RegWriter objects.
See the constructor of TemplateWriter for description of
arguments. | [
"Factory",
"method",
"for",
"creating",
"RegWriter",
"objects",
".",
"See",
"the",
"constructor",
"of",
"TemplateWriter",
"for",
"description",
"of",
"arguments",
"."
] | def GetWriter(config):
return RegWriter(['win', 'win7'], config) | [
"def",
"GetWriter",
"(",
"config",
")",
":",
"return",
"RegWriter",
"(",
"[",
"'win'",
",",
"'win7'",
"]",
",",
"config",
")"
] | Factory method for creating RegWriter objects. | [
"Factory",
"method",
"for",
"creating",
"RegWriter",
"objects",
"."
] | [
"'''Factory method for creating RegWriter objects.\n See the constructor of TemplateWriter for description of\n arguments.\n '''"
] | [
{
"param": "config",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3fbd0a6b3583b7ddb6c3c0072ba982d2adc725dd | sunlongbo/chromium | components/policy/tools/template_writers/writers/reg_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetPolicySortingKey | <not_specific> | def GetPolicySortingKey(self, policy):
'''Extracts a sorting key from a policy. These keys can be used for
list.sort() methods to sort policies.
See TemplateWriter.SortPoliciesGroupsFirst for usage.
'''
is_list = policy['type'] in ('list', 'string-enum-list')
# Lists come after regular policies.... | Extracts a sorting key from a policy. These keys can be used for
list.sort() methods to sort policies.
See TemplateWriter.SortPoliciesGroupsFirst for usage.
| Extracts a sorting key from a policy. These keys can be used for
list.sort() methods to sort policies. | [
"Extracts",
"a",
"sorting",
"key",
"from",
"a",
"policy",
".",
"These",
"keys",
"can",
"be",
"used",
"for",
"list",
".",
"sort",
"()",
"methods",
"to",
"sort",
"policies",
"."
] | def GetPolicySortingKey(self, policy):
is_list = policy['type'] in ('list', 'string-enum-list')
return (is_list, policy['name']) | [
"def",
"GetPolicySortingKey",
"(",
"self",
",",
"policy",
")",
":",
"is_list",
"=",
"policy",
"[",
"'type'",
"]",
"in",
"(",
"'list'",
",",
"'string-enum-list'",
")",
"return",
"(",
"is_list",
",",
"policy",
"[",
"'name'",
"]",
")"
] | Extracts a sorting key from a policy. | [
"Extracts",
"a",
"sorting",
"key",
"from",
"a",
"policy",
"."
] | [
"'''Extracts a sorting key from a policy. These keys can be used for\n list.sort() methods to sort policies.\n See TemplateWriter.SortPoliciesGroupsFirst for usage.\n '''",
"# Lists come after regular policies."
] | [
{
"param": "self",
"type": null
},
{
"param": "policy",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "policy",
"type": null,
"docstring": null,
"docstring_tokens":... |
3fecdf49f324fdc1e4f17972dd351bf24632fa50 | sunlongbo/chromium | ui/resources/resource_check/resource_scale_factors.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunChecks | <not_specific> | def RunChecks(self):
"""Verifies the scale factors of resources being added or modified.
Returns:
An array of presubmit errors if any images were detected not
having the correct dimensions.
"""
def ImageSize(filename):
with open(filename, 'rb', buffering=0) as f:
data = f.... | Verifies the scale factors of resources being added or modified.
Returns:
An array of presubmit errors if any images were detected not
having the correct dimensions.
| Verifies the scale factors of resources being added or modified. | [
"Verifies",
"the",
"scale",
"factors",
"of",
"resources",
"being",
"added",
"or",
"modified",
"."
] | def RunChecks(self):
def ImageSize(filename):
with open(filename, 'rb', buffering=0) as f:
data = f.read(24)
if data[:8] != b'\x89PNG\r\n\x1A\n' or data[12:16] != b'IHDR':
raise InvalidPNGException
return struct.unpack('>ii', data[16:24])
def ValidSizes(base_size, scale_percent... | [
"def",
"RunChecks",
"(",
"self",
")",
":",
"def",
"ImageSize",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'rb'",
",",
"buffering",
"=",
"0",
")",
"as",
"f",
":",
"data",
"=",
"f",
".",
"read",
"(",
"24",
")",
"if",
"data",
... | Verifies the scale factors of resources being added or modified. | [
"Verifies",
"the",
"scale",
"factors",
"of",
"resources",
"being",
"added",
"or",
"modified",
"."
] | [
"\"\"\"Verifies the scale factors of resources being added or modified.\n\n Returns:\n An array of presubmit errors if any images were detected not\n having the correct dimensions.\n \"\"\"",
"# Returns a list of valid scaled image sizes. The valid sizes are the",
"# floor and ceiling of (ba... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "An array of presubmit errors if any images were detected not\nhaving the correct dimensions.",
"docstring_tokens": [
"An",
"array",
"of",
"presubmit",
"errors",
"if",
"any",
"images",
"were",
... |
c5a0104bc9ea53471b7c500c42bb9b83a2bc5a41 | sunlongbo/chromium | components/policy/tools/template_writers/writers/doc_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddTextWithLinks | null | def _AddTextWithLinks(self, parent, text):
'''Parse a string for URLs and add it to a DOM node with the URLs replaced
with <a> HTML links.
Args:
parent: The DOM node to which the text will be added.
text: The string to be added.
'''
# A simple regexp to search for URLs. It is enough for... | Parse a string for URLs and add it to a DOM node with the URLs replaced
with <a> HTML links.
Args:
parent: The DOM node to which the text will be added.
text: The string to be added.
| Parse a string for URLs and add it to a DOM node with the URLs replaced
with HTML links. | [
"Parse",
"a",
"string",
"for",
"URLs",
"and",
"add",
"it",
"to",
"a",
"DOM",
"node",
"with",
"the",
"URLs",
"replaced",
"with",
"HTML",
"links",
"."
] | def _AddTextWithLinks(self, parent, text):
url_matcher = re.compile('(https?://[^\\s]*[^\\s\\.\\)\\"])')
while True:
res = url_matcher.search(text)
if not res:
break
url = res.group(0)
start = res.start(0)
end = res.end(0)
self.AddText(parent, text[:start])
self... | [
"def",
"_AddTextWithLinks",
"(",
"self",
",",
"parent",
",",
"text",
")",
":",
"url_matcher",
"=",
"re",
".",
"compile",
"(",
"'(https?://[^\\\\s]*[^\\\\s\\\\.\\\\)\\\\\"])'",
")",
"while",
"True",
":",
"res",
"=",
"url_matcher",
".",
"search",
"(",
"text",
")... | Parse a string for URLs and add it to a DOM node with the URLs replaced
with <a> HTML links. | [
"Parse",
"a",
"string",
"for",
"URLs",
"and",
"add",
"it",
"to",
"a",
"DOM",
"node",
"with",
"the",
"URLs",
"replaced",
"with",
"<a",
">",
"HTML",
"links",
"."
] | [
"'''Parse a string for URLs and add it to a DOM node with the URLs replaced\n with <a> HTML links.\n\n Args:\n parent: The DOM node to which the text will be added.\n text: The string to be added.\n '''",
"# A simple regexp to search for URLs. It is enough for now.",
"# Iterate through all th... | [
{
"param": "self",
"type": null
},
{
"param": "parent",
"type": null
},
{
"param": "text",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parent",
"type": null,
"docstring": "The DOM node to which the text... |
c5a0104bc9ea53471b7c500c42bb9b83a2bc5a41 | sunlongbo/chromium | components/policy/tools/template_writers/writers/doc_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddDescription | null | def _AddDescription(self, parent, policy):
'''Adds a string containing the description of the policy. URLs are
replaced with links and the possible choices are enumerated in case
of 'string-enum' and 'int-enum' type policies.
Args:
parent: The DOM node for which the feature list will be added.
... | Adds a string containing the description of the policy. URLs are
replaced with links and the possible choices are enumerated in case
of 'string-enum' and 'int-enum' type policies.
Args:
parent: The DOM node for which the feature list will be added.
policy: The data structure of a policy.
| Adds a string containing the description of the policy. URLs are
replaced with links and the possible choices are enumerated in case
of 'string-enum' and 'int-enum' type policies. | [
"Adds",
"a",
"string",
"containing",
"the",
"description",
"of",
"the",
"policy",
".",
"URLs",
"are",
"replaced",
"with",
"links",
"and",
"the",
"possible",
"choices",
"are",
"enumerated",
"in",
"case",
"of",
"'",
"string",
"-",
"enum",
"'",
"and",
"'",
... | def _AddDescription(self, parent, policy):
self._AddParagraphs(parent, policy['desc'])
if policy['type'] in ('string-enum', 'int-enum', 'string-enum-list'):
ul = self.AddElement(parent, 'ul')
for item in policy['items']:
if policy['type'] == 'int-enum':
value_string = str(item['val... | [
"def",
"_AddDescription",
"(",
"self",
",",
"parent",
",",
"policy",
")",
":",
"self",
".",
"_AddParagraphs",
"(",
"parent",
",",
"policy",
"[",
"'desc'",
"]",
")",
"if",
"policy",
"[",
"'type'",
"]",
"in",
"(",
"'string-enum'",
",",
"'int-enum'",
",",
... | Adds a string containing the description of the policy. | [
"Adds",
"a",
"string",
"containing",
"the",
"description",
"of",
"the",
"policy",
"."
] | [
"'''Adds a string containing the description of the policy. URLs are\n replaced with links and the possible choices are enumerated in case\n of 'string-enum' and 'int-enum' type policies.\n\n Args:\n parent: The DOM node for which the feature list will be added.\n policy: The data structure of a ... | [
{
"param": "self",
"type": null
},
{
"param": "parent",
"type": null
},
{
"param": "policy",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parent",
"type": null,
"docstring": "The DOM node for which the fea... |
c5a0104bc9ea53471b7c500c42bb9b83a2bc5a41 | sunlongbo/chromium | components/policy/tools/template_writers/writers/doc_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddSchema | null | def _AddSchema(self, parent, schema):
'''Adds a schema to a DOM node.
Args:
parent: The DOM node for which the schema will be added.
schema: The schema of a policy.
'''
dd = self._AddPolicyAttribute(parent, 'schema', None,
['.monospace', '.pre-wrap'])
#... | Adds a schema to a DOM node.
Args:
parent: The DOM node for which the schema will be added.
schema: The schema of a policy.
| Adds a schema to a DOM node. | [
"Adds",
"a",
"schema",
"to",
"a",
"DOM",
"node",
"."
] | def _AddSchema(self, parent, schema):
dd = self._AddPolicyAttribute(parent, 'schema', None,
['.monospace', '.pre-wrap'])
schema_json = json.dumps(schema,
indent=2,
sort_keys=True,
separators=... | [
"def",
"_AddSchema",
"(",
"self",
",",
"parent",
",",
"schema",
")",
":",
"dd",
"=",
"self",
".",
"_AddPolicyAttribute",
"(",
"parent",
",",
"'schema'",
",",
"None",
",",
"[",
"'.monospace'",
",",
"'.pre-wrap'",
"]",
")",
"schema_json",
"=",
"json",
".",... | Adds a schema to a DOM node. | [
"Adds",
"a",
"schema",
"to",
"a",
"DOM",
"node",
"."
] | [
"'''Adds a schema to a DOM node.\n\n Args:\n parent: The DOM node for which the schema will be added.\n schema: The schema of a policy.\n '''",
"# Explicitly specify separators since defaults depend on python version."
] | [
{
"param": "self",
"type": null
},
{
"param": "parent",
"type": null
},
{
"param": "schema",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parent",
"type": null,
"docstring": "The DOM node for which the sch... |
c5a0104bc9ea53471b7c500c42bb9b83a2bc5a41 | sunlongbo/chromium | components/policy/tools/template_writers/writers/doc_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddFeatures | null | def _AddFeatures(self, parent, policy):
'''Adds a string containing the list of supported features of a policy
to a DOM node. The text will look like as:
Feature_X: Yes, Feature_Y: No
Args:
parent: The DOM node for which the feature list will be added.
policy: The data structure of a poli... | Adds a string containing the list of supported features of a policy
to a DOM node. The text will look like as:
Feature_X: Yes, Feature_Y: No
Args:
parent: The DOM node for which the feature list will be added.
policy: The data structure of a policy.
| Adds a string containing the list of supported features of a policy
to a DOM node. The text will look like as:
Feature_X: Yes, Feature_Y: No | [
"Adds",
"a",
"string",
"containing",
"the",
"list",
"of",
"supported",
"features",
"of",
"a",
"policy",
"to",
"a",
"DOM",
"node",
".",
"The",
"text",
"will",
"look",
"like",
"as",
":",
"Feature_X",
":",
"Yes",
"Feature_Y",
":",
"No"
] | def _AddFeatures(self, parent, policy):
features = []
keys = sorted(policy['features'].keys())
for key in keys:
key_name = self._FEATURE_MAP[key]
if policy['features'][key]:
value_name = self.GetLocalizedMessage('supported')
else:
value_name = self.GetLocalizedMessage('not_... | [
"def",
"_AddFeatures",
"(",
"self",
",",
"parent",
",",
"policy",
")",
":",
"features",
"=",
"[",
"]",
"keys",
"=",
"sorted",
"(",
"policy",
"[",
"'features'",
"]",
".",
"keys",
"(",
")",
")",
"for",
"key",
"in",
"keys",
":",
"key_name",
"=",
"self... | Adds a string containing the list of supported features of a policy
to a DOM node. | [
"Adds",
"a",
"string",
"containing",
"the",
"list",
"of",
"supported",
"features",
"of",
"a",
"policy",
"to",
"a",
"DOM",
"node",
"."
] | [
"'''Adds a string containing the list of supported features of a policy\n to a DOM node. The text will look like as:\n Feature_X: Yes, Feature_Y: No\n\n Args:\n parent: The DOM node for which the feature list will be added.\n policy: The data structure of a policy.\n '''",
"# The sorting i... | [
{
"param": "self",
"type": null
},
{
"param": "parent",
"type": null
},
{
"param": "policy",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parent",
"type": null,
"docstring": "The DOM node for which the fea... |
c5a0104bc9ea53471b7c500c42bb9b83a2bc5a41 | sunlongbo/chromium | components/policy/tools/template_writers/writers/doc_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddListExampleMac | null | def _AddListExampleMac(self, parent, policy):
'''Adds an example value for Mac of a 'list' policy to a DOM node.
Args:
parent: The DOM node for which the example will be added.
policy: A policy of type 'list', for which the Mac example value
is generated.
'''
example_value = policy[... | Adds an example value for Mac of a 'list' policy to a DOM node.
Args:
parent: The DOM node for which the example will be added.
policy: A policy of type 'list', for which the Mac example value
is generated.
| Adds an example value for Mac of a 'list' policy to a DOM node. | [
"Adds",
"an",
"example",
"value",
"for",
"Mac",
"of",
"a",
"'",
"list",
"'",
"policy",
"to",
"a",
"DOM",
"node",
"."
] | def _AddListExampleMac(self, parent, policy):
example_value = policy['example_value']
self.AddElement(parent, 'dt', {}, 'Mac:')
mac = self._AddStyledElement(parent, 'dd', ['.monospace', '.pre-wrap'])
mac_text = ['<array>']
for item in example_value:
mac_text.append(' <string>%s</string>' % it... | [
"def",
"_AddListExampleMac",
"(",
"self",
",",
"parent",
",",
"policy",
")",
":",
"example_value",
"=",
"policy",
"[",
"'example_value'",
"]",
"self",
".",
"AddElement",
"(",
"parent",
",",
"'dt'",
",",
"{",
"}",
",",
"'Mac:'",
")",
"mac",
"=",
"self",
... | Adds an example value for Mac of a 'list' policy to a DOM node. | [
"Adds",
"an",
"example",
"value",
"for",
"Mac",
"of",
"a",
"'",
"list",
"'",
"policy",
"to",
"a",
"DOM",
"node",
"."
] | [
"'''Adds an example value for Mac of a 'list' policy to a DOM node.\n\n Args:\n parent: The DOM node for which the example will be added.\n policy: A policy of type 'list', for which the Mac example value\n is generated.\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "parent",
"type": null
},
{
"param": "policy",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parent",
"type": null,
"docstring": "The DOM node for which the exa... |
c5a0104bc9ea53471b7c500c42bb9b83a2bc5a41 | sunlongbo/chromium | components/policy/tools/template_writers/writers/doc_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddListExampleWindowsChromeOS | null | def _AddListExampleWindowsChromeOS(self, parent, policy, is_win):
'''Adds an example value for Windows or Chromium/Google Chrome OS of a
'list' policy to a DOM node.
Args:
parent: The DOM node for which the example will be added.
policy: A policy of type 'list', for which the Windows example va... | Adds an example value for Windows or Chromium/Google Chrome OS of a
'list' policy to a DOM node.
Args:
parent: The DOM node for which the example will be added.
policy: A policy of type 'list', for which the Windows example value
is generated.
is_win: True for Windows, False for Chrom... | Adds an example value for Windows or Chromium/Google Chrome OS of a
'list' policy to a DOM node. | [
"Adds",
"an",
"example",
"value",
"for",
"Windows",
"or",
"Chromium",
"/",
"Google",
"Chrome",
"OS",
"of",
"a",
"'",
"list",
"'",
"policy",
"to",
"a",
"DOM",
"node",
"."
] | def _AddListExampleWindowsChromeOS(self, parent, policy, is_win):
example_value = policy['example_value']
os_header = self.GetLocalizedMessage('win_example_value') if is_win else \
self.GetLocalizedMessage('chrome_os_example_value')
self.AddElement(parent, 'dt', {}, os_header)
element = ... | [
"def",
"_AddListExampleWindowsChromeOS",
"(",
"self",
",",
"parent",
",",
"policy",
",",
"is_win",
")",
":",
"example_value",
"=",
"policy",
"[",
"'example_value'",
"]",
"os_header",
"=",
"self",
".",
"GetLocalizedMessage",
"(",
"'win_example_value'",
")",
"if",
... | Adds an example value for Windows or Chromium/Google Chrome OS of a
'list' policy to a DOM node. | [
"Adds",
"an",
"example",
"value",
"for",
"Windows",
"or",
"Chromium",
"/",
"Google",
"Chrome",
"OS",
"of",
"a",
"'",
"list",
"'",
"policy",
"to",
"a",
"DOM",
"node",
"."
] | [
"'''Adds an example value for Windows or Chromium/Google Chrome OS of a\n 'list' policy to a DOM node.\n\n Args:\n parent: The DOM node for which the example will be added.\n policy: A policy of type 'list', for which the Windows example value\n is generated.\n is_win: True for Windows, ... | [
{
"param": "self",
"type": null
},
{
"param": "parent",
"type": null
},
{
"param": "policy",
"type": null
},
{
"param": "is_win",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parent",
"type": null,
"docstring": "The DOM node for which the exa... |
c5a0104bc9ea53471b7c500c42bb9b83a2bc5a41 | sunlongbo/chromium | components/policy/tools/template_writers/writers/doc_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddListExampleAndroidLinux | null | def _AddListExampleAndroidLinux(self, parent, policy):
'''Adds an example value for Android/Linux of a 'list' policy to a DOM node.
Args:
parent: The DOM node for which the example will be added.
policy: A policy of type 'list', for which the Android/Linux example value
is generated.
''... | Adds an example value for Android/Linux of a 'list' policy to a DOM node.
Args:
parent: The DOM node for which the example will be added.
policy: A policy of type 'list', for which the Android/Linux example value
is generated.
| Adds an example value for Android/Linux of a 'list' policy to a DOM node. | [
"Adds",
"an",
"example",
"value",
"for",
"Android",
"/",
"Linux",
"of",
"a",
"'",
"list",
"'",
"policy",
"to",
"a",
"DOM",
"node",
"."
] | def _AddListExampleAndroidLinux(self, parent, policy):
example_value = policy['example_value']
self.AddElement(parent, 'dt', {}, 'Android/Linux:')
element = self._AddStyledElement(parent, 'dd', ['.monospace', '.pre-wrap'])
self.AddText(
element,
'[\n%s\n]' % ',\n'.join(' "%s"' % item fo... | [
"def",
"_AddListExampleAndroidLinux",
"(",
"self",
",",
"parent",
",",
"policy",
")",
":",
"example_value",
"=",
"policy",
"[",
"'example_value'",
"]",
"self",
".",
"AddElement",
"(",
"parent",
",",
"'dt'",
",",
"{",
"}",
",",
"'Android/Linux:'",
")",
"eleme... | Adds an example value for Android/Linux of a 'list' policy to a DOM node. | [
"Adds",
"an",
"example",
"value",
"for",
"Android",
"/",
"Linux",
"of",
"a",
"'",
"list",
"'",
"policy",
"to",
"a",
"DOM",
"node",
"."
] | [
"'''Adds an example value for Android/Linux of a 'list' policy to a DOM node.\n\n Args:\n parent: The DOM node for which the example will be added.\n policy: A policy of type 'list', for which the Android/Linux example value\n is generated.\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "parent",
"type": null
},
{
"param": "policy",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parent",
"type": null,
"docstring": "The DOM node for which the exa... |
c5a0104bc9ea53471b7c500c42bb9b83a2bc5a41 | sunlongbo/chromium | components/policy/tools/template_writers/writers/doc_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _PythonObjectToPlist | <not_specific> | def _PythonObjectToPlist(self, obj, indent=''):
'''Converts a python object to an equivalent XML plist.
Returns a list of lines.'''
obj_type = type(obj)
if obj_type == bool:
return ['%s<%s/>' % (indent, 'true' if obj else 'false')]
elif obj_type == int:
return ['%s<integer>%s</integer>'... | Converts a python object to an equivalent XML plist.
Returns a list of lines. | Converts a python object to an equivalent XML plist.
Returns a list of lines. | [
"Converts",
"a",
"python",
"object",
"to",
"an",
"equivalent",
"XML",
"plist",
".",
"Returns",
"a",
"list",
"of",
"lines",
"."
] | def _PythonObjectToPlist(self, obj, indent=''):
obj_type = type(obj)
if obj_type == bool:
return ['%s<%s/>' % (indent, 'true' if obj else 'false')]
elif obj_type == int:
return ['%s<integer>%s</integer>' % (indent, obj)]
elif obj_type == str:
return ['%s<string>%s</string>' % (indent, ... | [
"def",
"_PythonObjectToPlist",
"(",
"self",
",",
"obj",
",",
"indent",
"=",
"''",
")",
":",
"obj_type",
"=",
"type",
"(",
"obj",
")",
"if",
"obj_type",
"==",
"bool",
":",
"return",
"[",
"'%s<%s/>'",
"%",
"(",
"indent",
",",
"'true'",
"if",
"obj",
"el... | Converts a python object to an equivalent XML plist. | [
"Converts",
"a",
"python",
"object",
"to",
"an",
"equivalent",
"XML",
"plist",
"."
] | [
"'''Converts a python object to an equivalent XML plist.\n\n Returns a list of lines.'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "obj",
"type": null
},
{
"param": "indent",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "obj",
"type": null,
"docstring": null,
"docstring_tokens": []... |
c5a0104bc9ea53471b7c500c42bb9b83a2bc5a41 | sunlongbo/chromium | components/policy/tools/template_writers/writers/doc_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddDictionaryExampleMac | null | def _AddDictionaryExampleMac(self, parent, policy):
'''Adds an example value for Mac of a 'dict' or 'external' policy to a DOM
node.
Args:
parent: The DOM node for which the example will be added.
policy: A policy of type 'dict', for which the Mac example value
is generated.
'''
... | Adds an example value for Mac of a 'dict' or 'external' policy to a DOM
node.
Args:
parent: The DOM node for which the example will be added.
policy: A policy of type 'dict', for which the Mac example value
is generated.
| Adds an example value for Mac of a 'dict' or 'external' policy to a DOM
node. | [
"Adds",
"an",
"example",
"value",
"for",
"Mac",
"of",
"a",
"'",
"dict",
"'",
"or",
"'",
"external",
"'",
"policy",
"to",
"a",
"DOM",
"node",
"."
] | def _AddDictionaryExampleMac(self, parent, policy):
example_value = policy['example_value']
self.AddElement(parent, 'dt', {}, 'Mac:')
mac = self._AddStyledElement(parent, 'dd', ['.monospace', '.pre-wrap'])
mac_text = ['<key>%s</key>' % (policy['name'])]
mac_text += self._PythonObjectToPlist(example_... | [
"def",
"_AddDictionaryExampleMac",
"(",
"self",
",",
"parent",
",",
"policy",
")",
":",
"example_value",
"=",
"policy",
"[",
"'example_value'",
"]",
"self",
".",
"AddElement",
"(",
"parent",
",",
"'dt'",
",",
"{",
"}",
",",
"'Mac:'",
")",
"mac",
"=",
"se... | Adds an example value for Mac of a 'dict' or 'external' policy to a DOM
node. | [
"Adds",
"an",
"example",
"value",
"for",
"Mac",
"of",
"a",
"'",
"dict",
"'",
"or",
"'",
"external",
"'",
"policy",
"to",
"a",
"DOM",
"node",
"."
] | [
"'''Adds an example value for Mac of a 'dict' or 'external' policy to a DOM\n node.\n\n Args:\n parent: The DOM node for which the example will be added.\n policy: A policy of type 'dict', for which the Mac example value\n is generated.\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "parent",
"type": null
},
{
"param": "policy",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parent",
"type": null,
"docstring": "The DOM node for which the exa... |
c5a0104bc9ea53471b7c500c42bb9b83a2bc5a41 | sunlongbo/chromium | components/policy/tools/template_writers/writers/doc_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddDictionaryExampleWindowsChromeOS | null | def _AddDictionaryExampleWindowsChromeOS(self, parent, policy, is_win):
'''Adds an example value for Windows of a 'dict' or 'external' policy to a
DOM node.
Args:
parent: The DOM node for which the example will be added.
policy: A policy of type 'dict', for which the Windows example value
... | Adds an example value for Windows of a 'dict' or 'external' policy to a
DOM node.
Args:
parent: The DOM node for which the example will be added.
policy: A policy of type 'dict', for which the Windows example value
is generated.
| Adds an example value for Windows of a 'dict' or 'external' policy to a
DOM node. | [
"Adds",
"an",
"example",
"value",
"for",
"Windows",
"of",
"a",
"'",
"dict",
"'",
"or",
"'",
"external",
"'",
"policy",
"to",
"a",
"DOM",
"node",
"."
] | def _AddDictionaryExampleWindowsChromeOS(self, parent, policy, is_win):
os_header = self.GetLocalizedMessage('win_example_value') if is_win else \
self.GetLocalizedMessage('chrome_os_example_value')
self.AddElement(parent, 'dt', {}, os_header)
element = self._AddStyledElement(parent, 'dd', [... | [
"def",
"_AddDictionaryExampleWindowsChromeOS",
"(",
"self",
",",
"parent",
",",
"policy",
",",
"is_win",
")",
":",
"os_header",
"=",
"self",
".",
"GetLocalizedMessage",
"(",
"'win_example_value'",
")",
"if",
"is_win",
"else",
"self",
".",
"GetLocalizedMessage",
"(... | Adds an example value for Windows of a 'dict' or 'external' policy to a
DOM node. | [
"Adds",
"an",
"example",
"value",
"for",
"Windows",
"of",
"a",
"'",
"dict",
"'",
"or",
"'",
"external",
"'",
"policy",
"to",
"a",
"DOM",
"node",
"."
] | [
"'''Adds an example value for Windows of a 'dict' or 'external' policy to a\n DOM node.\n\n Args:\n parent: The DOM node for which the example will be added.\n policy: A policy of type 'dict', for which the Windows example value\n is generated.\n '''",
"# Explicitly specify separators si... | [
{
"param": "self",
"type": null
},
{
"param": "parent",
"type": null
},
{
"param": "policy",
"type": null
},
{
"param": "is_win",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parent",
"type": null,
"docstring": "The DOM node for which the exa... |
c5a0104bc9ea53471b7c500c42bb9b83a2bc5a41 | sunlongbo/chromium | components/policy/tools/template_writers/writers/doc_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddDictionaryExampleAndroidLinux | null | def _AddDictionaryExampleAndroidLinux(self, parent, policy):
'''Adds an example value for Android/Linux of a 'dict' or 'external' policy
to a DOM node.
Args:
parent: The DOM node for which the example will be added.
policy: A policy of type 'dict', for which the Android/Linux example value
... | Adds an example value for Android/Linux of a 'dict' or 'external' policy
to a DOM node.
Args:
parent: The DOM node for which the example will be added.
policy: A policy of type 'dict', for which the Android/Linux example value
is generated.
| Adds an example value for Android/Linux of a 'dict' or 'external' policy
to a DOM node. | [
"Adds",
"an",
"example",
"value",
"for",
"Android",
"/",
"Linux",
"of",
"a",
"'",
"dict",
"'",
"or",
"'",
"external",
"'",
"policy",
"to",
"a",
"DOM",
"node",
"."
] | def _AddDictionaryExampleAndroidLinux(self, parent, policy):
self.AddElement(parent, 'dt', {}, 'Android/Linux:')
element = self._AddStyledElement(parent, 'dd', ['.monospace', '.pre-wrap'])
example = json.dumps(policy['example_value'],
indent=2,
sort_keys=Tru... | [
"def",
"_AddDictionaryExampleAndroidLinux",
"(",
"self",
",",
"parent",
",",
"policy",
")",
":",
"self",
".",
"AddElement",
"(",
"parent",
",",
"'dt'",
",",
"{",
"}",
",",
"'Android/Linux:'",
")",
"element",
"=",
"self",
".",
"_AddStyledElement",
"(",
"paren... | Adds an example value for Android/Linux of a 'dict' or 'external' policy
to a DOM node. | [
"Adds",
"an",
"example",
"value",
"for",
"Android",
"/",
"Linux",
"of",
"a",
"'",
"dict",
"'",
"or",
"'",
"external",
"'",
"policy",
"to",
"a",
"DOM",
"node",
"."
] | [
"'''Adds an example value for Android/Linux of a 'dict' or 'external' policy\n to a DOM node.\n\n Args:\n parent: The DOM node for which the example will be added.\n policy: A policy of type 'dict', for which the Android/Linux example value\n is generated.\n '''",
"# Explicitly specify s... | [
{
"param": "self",
"type": null
},
{
"param": "parent",
"type": null
},
{
"param": "policy",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parent",
"type": null,
"docstring": "The DOM node for which the exa... |
c5a0104bc9ea53471b7c500c42bb9b83a2bc5a41 | sunlongbo/chromium | components/policy/tools/template_writers/writers/doc_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddDictionaryExample | null | def _AddDictionaryExample(self, parent, policy):
'''Adds the example value of a 'dict' or 'external' policy to a DOM node.
Example output:
<dl>
<dt>Windows (Windows clients):</dt>
<dd>
Software\Policies\Chromium\ProxySettings = {
"ProxyMode": "direct"
}
</dd>
... | Adds the example value of a 'dict' or 'external' policy to a DOM node.
Example output:
<dl>
<dt>Windows (Windows clients):</dt>
<dd>
Software\Policies\Chromium\ProxySettings = {
"ProxyMode": "direct"
}
</dd>
<dt>Windows (Chromium OS clients):</dt>
<dd>
... | Adds the example value of a 'dict' or 'external' policy to a DOM node. | [
"Adds",
"the",
"example",
"value",
"of",
"a",
"'",
"dict",
"'",
"or",
"'",
"external",
"'",
"policy",
"to",
"a",
"DOM",
"node",
"."
] | def _AddDictionaryExample(self, parent, policy):
examples = self._AddStyledElement(parent, 'dl', ['dd dl'])
if self.IsPolicySupportedOnWindows(policy):
self._AddDictionaryExampleWindowsChromeOS(examples, policy, True)
if self.IsPolicyOrItemSupportedOnPlatform(
policy, 'chrome_os', management='... | [
"def",
"_AddDictionaryExample",
"(",
"self",
",",
"parent",
",",
"policy",
")",
":",
"examples",
"=",
"self",
".",
"_AddStyledElement",
"(",
"parent",
",",
"'dl'",
",",
"[",
"'dd dl'",
"]",
")",
"if",
"self",
".",
"IsPolicySupportedOnWindows",
"(",
"policy",... | Adds the example value of a 'dict' or 'external' policy to a DOM node. | [
"Adds",
"the",
"example",
"value",
"of",
"a",
"'",
"dict",
"'",
"or",
"'",
"external",
"'",
"policy",
"to",
"a",
"DOM",
"node",
"."
] | [
"'''Adds the example value of a 'dict' or 'external' policy to a DOM node.\n\n Example output:\n <dl>\n <dt>Windows (Windows clients):</dt>\n <dd>\n Software\\Policies\\Chromium\\ProxySettings = {\n \"ProxyMode\": \"direct\"\n }\n </dd>\n <dt>Windows (Chromium OS cli... | [
{
"param": "self",
"type": null
},
{
"param": "parent",
"type": null
},
{
"param": "policy",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parent",
"type": null,
"docstring": "The DOM node for which the exa... |
c5a0104bc9ea53471b7c500c42bb9b83a2bc5a41 | sunlongbo/chromium | components/policy/tools/template_writers/writers/doc_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddExample | null | def _AddExample(self, parent, policy):
'''Adds the HTML DOM representation of the example value of a policy to
a DOM node. It is simple text for boolean policies, like
'0x00000001 (Windows), true (Linux), true (Android), <true /> (Mac)'
in case of boolean policies, but it may also contain other HTML ele... | Adds the HTML DOM representation of the example value of a policy to
a DOM node. It is simple text for boolean policies, like
'0x00000001 (Windows), true (Linux), true (Android), <true /> (Mac)'
in case of boolean policies, but it may also contain other HTML elements.
(See method _AddListExample.)
... | Adds the HTML DOM representation of the example value of a policy to
a DOM node. It is simple text for boolean policies, like
'0x00000001 (Windows), true (Linux), true (Android), (Mac)'
in case of boolean policies, but it may also contain other HTML elements. | [
"Adds",
"the",
"HTML",
"DOM",
"representation",
"of",
"the",
"example",
"value",
"of",
"a",
"policy",
"to",
"a",
"DOM",
"node",
".",
"It",
"is",
"simple",
"text",
"for",
"boolean",
"policies",
"like",
"'",
"0x00000001",
"(",
"Windows",
")",
"true",
"(",
... | def _AddExample(self, parent, policy):
example_value = policy['example_value']
policy_type = policy['type']
if policy_type == 'main':
pieces = []
if self.IsPolicySupportedOnWindows(policy) or \
self.IsPolicyOrItemSupportedOnPlatform(policy, 'chrome_os',
... | [
"def",
"_AddExample",
"(",
"self",
",",
"parent",
",",
"policy",
")",
":",
"example_value",
"=",
"policy",
"[",
"'example_value'",
"]",
"policy_type",
"=",
"policy",
"[",
"'type'",
"]",
"if",
"policy_type",
"==",
"'main'",
":",
"pieces",
"=",
"[",
"]",
"... | Adds the HTML DOM representation of the example value of a policy to
a DOM node. | [
"Adds",
"the",
"HTML",
"DOM",
"representation",
"of",
"the",
"example",
"value",
"of",
"a",
"policy",
"to",
"a",
"DOM",
"node",
"."
] | [
"'''Adds the HTML DOM representation of the example value of a policy to\n a DOM node. It is simple text for boolean policies, like\n '0x00000001 (Windows), true (Linux), true (Android), <true /> (Mac)'\n in case of boolean policies, but it may also contain other HTML elements.\n (See method _AddListExa... | [
{
"param": "self",
"type": null
},
{
"param": "parent",
"type": null
},
{
"param": "policy",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "If the type of the policy is unknown or the example value\nof the policy is out of its expected range.",
"docstring_tokens": [
"If",
"the",
"type",
"of",
"the",
"policy",
"is",
"unknown",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.