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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c42fdd3689f7d3446e83044306ca5c2c708ac630 | sunlongbo/chromium | components/variations/service/generate_ui_string_overrider.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateHeaderFileContent | <not_specific> | def _GenerateHeaderFileContent(namespace, header_filename):
"""Generates the .h for to the .cc generated by _GenerateSourceFileContent.
Args:
namespace: The namespace in which the generated code should be scoped. If
not defined, then the code will be in the global namespace.
header_filename: Path ... | Generates the .h for to the .cc generated by _GenerateSourceFileContent.
Args:
namespace: The namespace in which the generated code should be scoped. If
not defined, then the code will be in the global namespace.
header_filename: Path to the corresponding .h. Used to generate the include
gua... | Generates the .h for to the .cc generated by _GenerateSourceFileContent. | [
"Generates",
"the",
".",
"h",
"for",
"to",
"the",
".",
"cc",
"generated",
"by",
"_GenerateSourceFileContent",
"."
] | def _GenerateHeaderFileContent(namespace, header_filename):
include_guard = re.sub('[^A-Z]', '_', header_filename.upper()) + '_'
namespace_prefix, namespace_suffix = _GenerateNamespacePrefixAndSuffix(
namespace)
return (
"// This file was generated by %(script_name)s. Do not edit.\n"
"\n"
... | [
"def",
"_GenerateHeaderFileContent",
"(",
"namespace",
",",
"header_filename",
")",
":",
"include_guard",
"=",
"re",
".",
"sub",
"(",
"'[^A-Z]'",
",",
"'_'",
",",
"header_filename",
".",
"upper",
"(",
")",
")",
"+",
"'_'",
"namespace_prefix",
",",
"namespace_s... | Generates the .h for to the .cc generated by _GenerateSourceFileContent. | [
"Generates",
"the",
".",
"h",
"for",
"to",
"the",
".",
"cc",
"generated",
"by",
"_GenerateSourceFileContent",
"."
] | [
"\"\"\"Generates the .h for to the .cc generated by _GenerateSourceFileContent.\n\n Args:\n namespace: The namespace in which the generated code should be scoped. If\n not defined, then the code will be in the global namespace.\n\n header_filename: Path to the corresponding .h. Used to generate the in... | [
{
"param": "namespace",
"type": null
},
{
"param": "header_filename",
"type": null
}
] | {
"returns": [
{
"docstring": ".cc file content implementing the CreateUIStringOverrider() factory.",
"docstring_tokens": [
".",
"cc",
"file",
"content",
"implementing",
"the",
"CreateUIStringOverrider",
"()",
"factory",
"... |
d210b617da1b1984756385351a86b674d334b4cb | sunlongbo/chromium | ash/assistant/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckNoBannedFunctions | <not_specific> | def CheckNoBannedFunctions(input_api, output_api):
"""Make sure that banned functions are not used."""
warnings = []
def GetMessageForFunction(input_api, affected_file, line_num, line, func_name,
message):
result = []
if input_api.re.search(r"^ *//", line): # Ignore comments.... | Make sure that banned functions are not used. | Make sure that banned functions are not used. | [
"Make",
"sure",
"that",
"banned",
"functions",
"are",
"not",
"used",
"."
] | def CheckNoBannedFunctions(input_api, output_api):
warnings = []
def GetMessageForFunction(input_api, affected_file, line_num, line, func_name,
message):
result = []
if input_api.re.search(r"^ *//", line):
return result
if line.endswith(" nocheck"):
return res... | [
"def",
"CheckNoBannedFunctions",
"(",
"input_api",
",",
"output_api",
")",
":",
"warnings",
"=",
"[",
"]",
"def",
"GetMessageForFunction",
"(",
"input_api",
",",
"affected_file",
",",
"line_num",
",",
"line",
",",
"func_name",
",",
"message",
")",
":",
"result... | Make sure that banned functions are not used. | [
"Make",
"sure",
"that",
"banned",
"functions",
"are",
"not",
"used",
"."
] | [
"\"\"\"Make sure that banned functions are not used.\"\"\"",
"# Ignore comments.",
"# Ignore lines with nocheck comments."
] | [
{
"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... |
3d7ce357850bcf8ee8a3bd4f8a273c55e6448521 | sunlongbo/chromium | tools/metrics/histograms/update_editor_commands.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ReadHistogramValues | <not_specific> | def ReadHistogramValues(filename):
"""Returns a list of pairs (label, value) corresponding to HistogramValue.
Reads the EditorCommand.cpp file, locates the
HistogramValue enum definition and returns a pair for each entry.
"""
# Read the file as a list of lines
with open(path_util.GetInputFile(filename)) a... | Returns a list of pairs (label, value) corresponding to HistogramValue.
Reads the EditorCommand.cpp file, locates the
HistogramValue enum definition and returns a pair for each entry.
| Returns a list of pairs (label, value) corresponding to HistogramValue.
Reads the EditorCommand.cpp file, locates the
HistogramValue enum definition and returns a pair for each entry. | [
"Returns",
"a",
"list",
"of",
"pairs",
"(",
"label",
"value",
")",
"corresponding",
"to",
"HistogramValue",
".",
"Reads",
"the",
"EditorCommand",
".",
"cpp",
"file",
"locates",
"the",
"HistogramValue",
"enum",
"definition",
"and",
"returns",
"a",
"pair",
"for"... | def ReadHistogramValues(filename):
with open(path_util.GetInputFile(filename)) as f:
content = f.readlines()
inside_enum = False
result = []
for line in content:
if inside_enum:
if re.match(ENUM_END_MARKER, line):
inside_enum = False
else:
m = re.match("^{ \"([\w]+)\", \{([\... | [
"def",
"ReadHistogramValues",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"path_util",
".",
"GetInputFile",
"(",
"filename",
")",
")",
"as",
"f",
":",
"content",
"=",
"f",
".",
"readlines",
"(",
")",
"inside_enum",
"=",
"False",
"result",
"=",
"[",
... | Returns a list of pairs (label, value) corresponding to HistogramValue. | [
"Returns",
"a",
"list",
"of",
"pairs",
"(",
"label",
"value",
")",
"corresponding",
"to",
"HistogramValue",
"."
] | [
"\"\"\"Returns a list of pairs (label, value) corresponding to HistogramValue.\n\n Reads the EditorCommand.cpp file, locates the\n HistogramValue enum definition and returns a pair for each entry.\n \"\"\"",
"# Read the file as a list of lines",
"# Locate the enum definition and collect all entries in it",
... | [
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3d7ce357850bcf8ee8a3bd4f8a273c55e6448521 | sunlongbo/chromium | tools/metrics/histograms/update_editor_commands.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | UpdateHistogramDefinitions | null | def UpdateHistogramDefinitions(histogram_values, document):
"""Sets the children of <enum name="ExtensionFunctions" ...> node in
|document| to values generated from policy ids contained in
|policy_templates|.
Args:
histogram_values: A list of pairs (label, value) defining each extension
... | Sets the children of <enum name="ExtensionFunctions" ...> node in
|document| to values generated from policy ids contained in
|policy_templates|.
Args:
histogram_values: A list of pairs (label, value) defining each extension
function
document: A minidom.Document object representing ... | Sets the children of node in
|document| to values generated from policy ids contained in
|policy_templates|. | [
"Sets",
"the",
"children",
"of",
"node",
"in",
"|document|",
"to",
"values",
"generated",
"from",
"policy",
"ids",
"contained",
"in",
"|policy_templates|",
"."
] | def UpdateHistogramDefinitions(histogram_values, document):
for enum_node in document.getElementsByTagName('enum'):
if enum_node.attributes['name'].value == ENUM_NAME:
extension_functions_enum_node = enum_node
break
else:
raise UserError('No policy enum node found')
while extension_functions_e... | [
"def",
"UpdateHistogramDefinitions",
"(",
"histogram_values",
",",
"document",
")",
":",
"for",
"enum_node",
"in",
"document",
".",
"getElementsByTagName",
"(",
"'enum'",
")",
":",
"if",
"enum_node",
".",
"attributes",
"[",
"'name'",
"]",
".",
"value",
"==",
"... | Sets the children of <enum name="ExtensionFunctions" ...> node in
|document| to values generated from policy ids contained in
|policy_templates|. | [
"Sets",
"the",
"children",
"of",
"<enum",
"name",
"=",
"\"",
"ExtensionFunctions",
"\"",
"...",
">",
"node",
"in",
"|document|",
"to",
"values",
"generated",
"from",
"policy",
"ids",
"contained",
"in",
"|policy_templates|",
"."
] | [
"\"\"\"Sets the children of <enum name=\"ExtensionFunctions\" ...> node in\n |document| to values generated from policy ids contained in\n |policy_templates|.\n\n Args:\n histogram_values: A list of pairs (label, value) defining each extension\n function\n document: A minidom.Document ... | [
{
"param": "histogram_values",
"type": null
},
{
"param": "document",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "histogram_values",
"type": null,
"docstring": "A list of pairs (label, value) defining each extension\nfunction",
"docstring_tokens": [
"A",
"list",
"of",
"pairs",
"(",
"label",
... |
3d99e45703b180ac7eea2aa446552d1d505eb783 | sunlongbo/chromium | net/data/verify_signed_data_unittest/annotate_test_data.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Transform | <not_specific> | def Transform(file_data):
"""Returns a transformed (formatted) version of file_data"""
result = ''
for block in GetPemBlocks(file_data):
if len(result) != 0:
result += '\n'
# If there was a user comment (non-script-generated comment) associated
# with the block, output it immediately before t... | Returns a transformed (formatted) version of file_data | Returns a transformed (formatted) version of file_data | [
"Returns",
"a",
"transformed",
"(",
"formatted",
")",
"version",
"of",
"file_data"
] | def Transform(file_data):
result = ''
for block in GetPemBlocks(file_data):
if len(result) != 0:
result += '\n'
user_comment = GetUserComment(block.comment)
if user_comment:
result += user_comment
if block.name != 'DATA':
generated_comment = GenerateCommentForBlock(block.name, bloc... | [
"def",
"Transform",
"(",
"file_data",
")",
":",
"result",
"=",
"''",
"for",
"block",
"in",
"GetPemBlocks",
"(",
"file_data",
")",
":",
"if",
"len",
"(",
"result",
")",
"!=",
"0",
":",
"result",
"+=",
"'\\n'",
"user_comment",
"=",
"GetUserComment",
"(",
... | Returns a transformed (formatted) version of file_data | [
"Returns",
"a",
"transformed",
"(",
"formatted",
")",
"version",
"of",
"file_data"
] | [
"\"\"\"Returns a transformed (formatted) version of file_data\"\"\"",
"# If there was a user comment (non-script-generated comment) associated",
"# with the block, output it immediately before the block.",
"# For every block except for DATA, try to pretty print the parsed ASN.1.",
"# DATA blocks likely woul... | [
{
"param": "file_data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3d99e45703b180ac7eea2aa446552d1d505eb783 | sunlongbo/chromium | net/data/verify_signed_data_unittest/annotate_test_data.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GenerateCommentForBlock | <not_specific> | def GenerateCommentForBlock(block_name, block_data):
"""Returns a string describing the ASN.1 structure of block_data"""
p = subprocess.Popen(['openssl', 'asn1parse', '-i', '-inform', 'DER'],
stdout=subprocess.PIPE, stdin=subprocess.PIPE,
stderr=subprocess.PIPE)
stdo... | Returns a string describing the ASN.1 structure of block_data | Returns a string describing the ASN.1 structure of block_data | [
"Returns",
"a",
"string",
"describing",
"the",
"ASN",
".",
"1",
"structure",
"of",
"block_data"
] | def GenerateCommentForBlock(block_name, block_data):
p = subprocess.Popen(['openssl', 'asn1parse', '-i', '-inform', 'DER'],
stdout=subprocess.PIPE, stdin=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout_data, stderr_data = p.communicate(input=block_data)
generated_comm... | [
"def",
"GenerateCommentForBlock",
"(",
"block_name",
",",
"block_data",
")",
":",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"'openssl'",
",",
"'asn1parse'",
",",
"'-i'",
",",
"'-inform'",
",",
"'DER'",
"]",
",",
"stdout",
"=",
"subprocess",
".",
"PIP... | Returns a string describing the ASN.1 structure of block_data | [
"Returns",
"a",
"string",
"describing",
"the",
"ASN",
".",
"1",
"structure",
"of",
"block_data"
] | [
"\"\"\"Returns a string describing the ASN.1 structure of block_data\"\"\""
] | [
{
"param": "block_name",
"type": null
},
{
"param": "block_data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "block_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "block_data",
"type": null,
"docstring": null,
"docstrin... |
3d99e45703b180ac7eea2aa446552d1d505eb783 | sunlongbo/chromium | net/data/verify_signed_data_unittest/annotate_test_data.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetUserComment | <not_specific> | def GetUserComment(comment):
"""Removes any script-generated lines (everything after the $ openssl line)"""
# Consider everything after "$ openssl" to be a generated comment.
comment = comment.split('$ openssl asn1parse -i', 1)[0]
if IsEntirelyWhiteSpace(comment):
comment = ''
return comment | Removes any script-generated lines (everything after the $ openssl line) | Removes any script-generated lines (everything after the $ openssl line) | [
"Removes",
"any",
"script",
"-",
"generated",
"lines",
"(",
"everything",
"after",
"the",
"$",
"openssl",
"line",
")"
] | def GetUserComment(comment):
comment = comment.split('$ openssl asn1parse -i', 1)[0]
if IsEntirelyWhiteSpace(comment):
comment = ''
return comment | [
"def",
"GetUserComment",
"(",
"comment",
")",
":",
"comment",
"=",
"comment",
".",
"split",
"(",
"'$ openssl asn1parse -i'",
",",
"1",
")",
"[",
"0",
"]",
"if",
"IsEntirelyWhiteSpace",
"(",
"comment",
")",
":",
"comment",
"=",
"''",
"return",
"comment"
] | Removes any script-generated lines (everything after the $ openssl line) | [
"Removes",
"any",
"script",
"-",
"generated",
"lines",
"(",
"everything",
"after",
"the",
"$",
"openssl",
"line",
")"
] | [
"\"\"\"Removes any script-generated lines (everything after the $ openssl line)\"\"\"",
"# Consider everything after \"$ openssl\" to be a generated comment."
] | [
{
"param": "comment",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "comment",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3d99e45703b180ac7eea2aa446552d1d505eb783 | sunlongbo/chromium | net/data/verify_signed_data_unittest/annotate_test_data.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetPemFilePaths | <not_specific> | def GetPemFilePaths():
"""Returns an iterable for all the paths to the PEM test files"""
base_dir = os.path.dirname(os.path.realpath(__file__))
return glob.iglob(os.path.join(base_dir, '*.pem')) | Returns an iterable for all the paths to the PEM test files | Returns an iterable for all the paths to the PEM test files | [
"Returns",
"an",
"iterable",
"for",
"all",
"the",
"paths",
"to",
"the",
"PEM",
"test",
"files"
] | def GetPemFilePaths():
base_dir = os.path.dirname(os.path.realpath(__file__))
return glob.iglob(os.path.join(base_dir, '*.pem')) | [
"def",
"GetPemFilePaths",
"(",
")",
":",
"base_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"realpath",
"(",
"__file__",
")",
")",
"return",
"glob",
".",
"iglob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"base_dir",
"... | Returns an iterable for all the paths to the PEM test files | [
"Returns",
"an",
"iterable",
"for",
"all",
"the",
"paths",
"to",
"the",
"PEM",
"test",
"files"
] | [
"\"\"\"Returns an iterable for all the paths to the PEM test files\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
989bfa8c5aa8b356c5b6916f490a1eff6458999d | sunlongbo/chromium | tools/perf/experimental/representative_perf_test_limit_adjuster/adjust_upper_limits.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FetchItemIds | <not_specific> | def FetchItemIds(tags, limit):
"""Fetches the item id of tasks described by the tags.
Args:
tags: The tags which describe the task such as OS, builder_group and buildername.
limit: The number of runs to look at.
Returns:
A list containing the item Id of the tasks.
"""
query = [
SWARMING_P... | Fetches the item id of tasks described by the tags.
Args:
tags: The tags which describe the task such as OS, builder_group and buildername.
limit: The number of runs to look at.
Returns:
A list containing the item Id of the tasks.
| Fetches the item id of tasks described by the tags. | [
"Fetches",
"the",
"item",
"id",
"of",
"tasks",
"described",
"by",
"the",
"tags",
"."
] | def FetchItemIds(tags, limit):
query = [
SWARMING_PATH, 'tasks', '-S', 'chromium-swarm.appspot.com', '-limit',
str(limit), '-state=COMPLETED', '-field', 'items(task_id)', '-tag',
'builder_group:{builder_group}'.format(**tags), '-tag',
'os:{os}'.format(**tags), '-tag',
'name:rendering_rep... | [
"def",
"FetchItemIds",
"(",
"tags",
",",
"limit",
")",
":",
"query",
"=",
"[",
"SWARMING_PATH",
",",
"'tasks'",
",",
"'-S'",
",",
"'chromium-swarm.appspot.com'",
",",
"'-limit'",
",",
"str",
"(",
"limit",
")",
",",
"'-state=COMPLETED'",
",",
"'-field'",
",",... | Fetches the item id of tasks described by the tags. | [
"Fetches",
"the",
"item",
"id",
"of",
"tasks",
"described",
"by",
"the",
"tags",
"."
] | [
"\"\"\"Fetches the item id of tasks described by the tags.\n\n Args:\n tags: The tags which describe the task such as OS, builder_group and buildername.\n limit: The number of runs to look at.\n\n Returns:\n A list containing the item Id of the tasks.\n \"\"\""
] | [
{
"param": "tags",
"type": null
},
{
"param": "limit",
"type": null
}
] | {
"returns": [
{
"docstring": "A list containing the item Id of the tasks.",
"docstring_tokens": [
"A",
"list",
"containing",
"the",
"item",
"Id",
"of",
"the",
"tasks",
"."
],
"type": null
}
],
"raises"... |
989bfa8c5aa8b356c5b6916f490a1eff6458999d | sunlongbo/chromium | tools/perf/experimental/representative_perf_test_limit_adjuster/adjust_upper_limits.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FetchItemData | <not_specific> | def FetchItemData(task_id, benchmark, index, temp_dir):
"""Fetches the performance values (AVG & CI ranges) of tasks.
Args:
task_id: The list of item Ids to fetch dat for.
benchmark: The benchmark these task are on (desktop/mobile).
index: The index field of the data_frame
temp_dir: The temp direct... | Fetches the performance values (AVG & CI ranges) of tasks.
Args:
task_id: The list of item Ids to fetch dat for.
benchmark: The benchmark these task are on (desktop/mobile).
index: The index field of the data_frame
temp_dir: The temp directory to store task data in.
Returns:
A data_frame conta... | Fetches the performance values (AVG & CI ranges) of tasks. | [
"Fetches",
"the",
"performance",
"values",
"(",
"AVG",
"&",
"CI",
"ranges",
")",
"of",
"tasks",
"."
] | def FetchItemData(task_id, benchmark, index, temp_dir):
query = [
SWARMING_PATH, 'collect', '-S', 'chromium-swarm.appspot.com',
'-output-dir', temp_dir, '-perf', task_id
]
try:
subprocess.check_output(query)
except Exception as e:
print(e)
result_file_path = os.path.join(temp_dir, task_id,... | [
"def",
"FetchItemData",
"(",
"task_id",
",",
"benchmark",
",",
"index",
",",
"temp_dir",
")",
":",
"query",
"=",
"[",
"SWARMING_PATH",
",",
"'collect'",
",",
"'-S'",
",",
"'chromium-swarm.appspot.com'",
",",
"'-output-dir'",
",",
"temp_dir",
",",
"'-perf'",
",... | Fetches the performance values (AVG & CI ranges) of tasks. | [
"Fetches",
"the",
"performance",
"values",
"(",
"AVG",
"&",
"CI",
"ranges",
")",
"of",
"tasks",
"."
] | [
"\"\"\"Fetches the performance values (AVG & CI ranges) of tasks.\n\n Args:\n task_id: The list of item Ids to fetch dat for.\n benchmark: The benchmark these task are on (desktop/mobile).\n index: The index field of the data_frame\n temp_dir: The temp directory to store task data in.\n\n Returns:\n ... | [
{
"param": "task_id",
"type": null
},
{
"param": "benchmark",
"type": null
},
{
"param": "index",
"type": null
},
{
"param": "temp_dir",
"type": null
}
] | {
"returns": [
{
"docstring": "A data_frame containing the averages and confidence interval ranges.",
"docstring_tokens": [
"A",
"data_frame",
"containing",
"the",
"averages",
"and",
"confidence",
"interval",
"ranges",
"."... |
989bfa8c5aa8b356c5b6916f490a1eff6458999d | sunlongbo/chromium | tools/perf/experimental/representative_perf_test_limit_adjuster/adjust_upper_limits.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreateDataframe | <not_specific> | def CreateDataframe(benchmark, tags, limit):
"""Creates the dataframe of values recorded in recent runs.
Given the tags, benchmark this function fetches the data of last {limit}
runs, and returns a dataframe of values for focused metrics such as
frame_times and CPU_wall_time_ratio.
Args:
benchmark: The ... | Creates the dataframe of values recorded in recent runs.
Given the tags, benchmark this function fetches the data of last {limit}
runs, and returns a dataframe of values for focused metrics such as
frame_times and CPU_wall_time_ratio.
Args:
benchmark: The benchmark these task are on (desktop/mobile).
... | Creates the dataframe of values recorded in recent runs.
Given the tags, benchmark this function fetches the data of last {limit}
runs, and returns a dataframe of values for focused metrics such as
frame_times and CPU_wall_time_ratio. | [
"Creates",
"the",
"dataframe",
"of",
"values",
"recorded",
"in",
"recent",
"runs",
".",
"Given",
"the",
"tags",
"benchmark",
"this",
"function",
"fetches",
"the",
"data",
"of",
"last",
"{",
"limit",
"}",
"runs",
"and",
"returns",
"a",
"dataframe",
"of",
"v... | def CreateDataframe(benchmark, tags, limit):
items = []
for tag_set in tags:
items.extend(FetchItemIds(tag_set, limit))
dfs = []
try:
temp_dir = tempfile.mkdtemp('perf_csvs')
for idx, item in enumerate(items):
dfs.append(FetchItemData(item['task_id'], benchmark, idx, temp_dir))
idx += 1
... | [
"def",
"CreateDataframe",
"(",
"benchmark",
",",
"tags",
",",
"limit",
")",
":",
"items",
"=",
"[",
"]",
"for",
"tag_set",
"in",
"tags",
":",
"items",
".",
"extend",
"(",
"FetchItemIds",
"(",
"tag_set",
",",
"limit",
")",
")",
"dfs",
"=",
"[",
"]",
... | Creates the dataframe of values recorded in recent runs. | [
"Creates",
"the",
"dataframe",
"of",
"values",
"recorded",
"in",
"recent",
"runs",
"."
] | [
"\"\"\"Creates the dataframe of values recorded in recent runs.\n\n Given the tags, benchmark this function fetches the data of last {limit}\n runs, and returns a dataframe of values for focused metrics such as\n frame_times and CPU_wall_time_ratio.\n\n Args:\n benchmark: The benchmark these task are on (des... | [
{
"param": "benchmark",
"type": null
},
{
"param": "tags",
"type": null
},
{
"param": "limit",
"type": null
}
] | {
"returns": [
{
"docstring": "A dataframe with averages and confidence interval of frame_times, and\naverage value of CPU_wall_time_ratio of each story of each run.",
"docstring_tokens": [
"A",
"dataframe",
"with",
"averages",
"and",
"confidence",
... |
989bfa8c5aa8b356c5b6916f490a1eff6458999d | sunlongbo/chromium | tools/perf/experimental/representative_perf_test_limit_adjuster/adjust_upper_limits.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetPercentileValues | <not_specific> | def GetPercentileValues(data_frame, percentile):
"""Get the percentile value of each metric for recorded values in dataframe.
Args:
data_frame: The dataframe with averages and confidence intervals of each
story of each run.
percentile: the percentile to use for determining the upper limits.
Returns:... | Get the percentile value of each metric for recorded values in dataframe.
Args:
data_frame: The dataframe with averages and confidence intervals of each
story of each run.
percentile: the percentile to use for determining the upper limits.
Returns:
A dictionary with averages and confidence interva... | Get the percentile value of each metric for recorded values in dataframe.
Args:
data_frame: The dataframe with averages and confidence intervals of each
story of each run.
percentile: the percentile to use for determining the upper limits.
A dictionary with averages and confidence interval ranges calculated
from the p... | [
"Get",
"the",
"percentile",
"value",
"of",
"each",
"metric",
"for",
"recorded",
"values",
"in",
"dataframe",
".",
"Args",
":",
"data_frame",
":",
"The",
"dataframe",
"with",
"averages",
"and",
"confidence",
"intervals",
"of",
"each",
"story",
"of",
"each",
"... | def GetPercentileValues(data_frame, percentile):
if not data_frame.empty:
avg_df = data_frame.pivot(index='stories', columns='index', values='avg')
upper_limit = avg_df.quantile(percentile, axis = 1)
ci_df = data_frame.pivot(index='stories', columns='index', values='ci_095')
upper_limit_ci = ci_df.qua... | [
"def",
"GetPercentileValues",
"(",
"data_frame",
",",
"percentile",
")",
":",
"if",
"not",
"data_frame",
".",
"empty",
":",
"avg_df",
"=",
"data_frame",
".",
"pivot",
"(",
"index",
"=",
"'stories'",
",",
"columns",
"=",
"'index'",
",",
"values",
"=",
"'avg... | Get the percentile value of each metric for recorded values in dataframe. | [
"Get",
"the",
"percentile",
"value",
"of",
"each",
"metric",
"for",
"recorded",
"values",
"in",
"dataframe",
"."
] | [
"\"\"\"Get the percentile value of each metric for recorded values in dataframe.\n\n Args:\n data_frame: The dataframe with averages and confidence intervals of each\n story of each run.\n percentile: the percentile to use for determining the upper limits.\n\n Returns:\n A dictionary with averages and... | [
{
"param": "data_frame",
"type": null
},
{
"param": "percentile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data_frame",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "percentile",
"type": null,
"docstring": null,
"docstrin... |
989bfa8c5aa8b356c5b6916f490a1eff6458999d | sunlongbo/chromium | tools/perf/experimental/representative_perf_test_limit_adjuster/adjust_upper_limits.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RecalculateUpperLimits | null | def RecalculateUpperLimits(data_point_count):
"""Recalculates the upper limits using the data of recent runs.
This method replaces the existing JSON file which contains the upper limits
used by representative perf tests if the changes of upper limits are
significant.
Args:
data_point_count: The number o... | Recalculates the upper limits using the data of recent runs.
This method replaces the existing JSON file which contains the upper limits
used by representative perf tests if the changes of upper limits are
significant.
Args:
data_point_count: The number of runs to use for recalculation.
| Recalculates the upper limits using the data of recent runs.
This method replaces the existing JSON file which contains the upper limits
used by representative perf tests if the changes of upper limits are
significant. | [
"Recalculates",
"the",
"upper",
"limits",
"using",
"the",
"data",
"of",
"recent",
"runs",
".",
"This",
"method",
"replaces",
"the",
"existing",
"JSON",
"file",
"which",
"contains",
"the",
"upper",
"limits",
"used",
"by",
"representative",
"perf",
"tests",
"if"... | def RecalculateUpperLimits(data_point_count):
with open(os.path.join(UPPER_LIMITS_DATA_DIR,
'platform_specific_tags.json')) as tags_data:
platform_specific_tags = json.load(tags_data)
with open(
os.path.join(
UPPER_LIMITS_DATA_DIR,
'representatives_frame_times_upper_limit.json')) as ... | [
"def",
"RecalculateUpperLimits",
"(",
"data_point_count",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"UPPER_LIMITS_DATA_DIR",
",",
"'platform_specific_tags.json'",
")",
")",
"as",
"tags_data",
":",
"platform_specific_tags",
"=",
"json",
".... | Recalculates the upper limits using the data of recent runs. | [
"Recalculates",
"the",
"upper",
"limits",
"using",
"the",
"data",
"of",
"recent",
"runs",
"."
] | [
"\"\"\"Recalculates the upper limits using the data of recent runs.\n\n This method replaces the existing JSON file which contains the upper limits\n used by representative perf tests if the changes of upper limits are\n significant.\n\n Args:\n data_point_count: The number of runs to use for recalculation.\... | [
{
"param": "data_point_count",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data_point_count",
"type": null,
"docstring": "The number of runs to use for recalculation.",
"docstring_tokens": [
"The",
"number",
"of",
"runs",
"to",
"use",
"for",
... |
98c705add32b403b8f487818f1a3b225df5f3289 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/pack_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckPackSequence | null | def _CheckPackSequence(self, kinds, fields, offsets):
"""Checks the pack order and offsets of a sequence of mojom.Kinds.
Args:
kinds: A sequence of mojom.Kinds that specify the fields that are to be
created.
fields: The expected order of the resulting fields, with the integer "1"
first.... | Checks the pack order and offsets of a sequence of mojom.Kinds.
Args:
kinds: A sequence of mojom.Kinds that specify the fields that are to be
created.
fields: The expected order of the resulting fields, with the integer "1"
first.
offsets: The expected order of offsets, with the integ... | Checks the pack order and offsets of a sequence of mojom.Kinds.
Args:
kinds: A sequence of mojom.Kinds that specify the fields that are to be
created.
fields: The expected order of the resulting fields, with the integer "1"
first.
offsets: The expected order of offsets, with the integer "0" first. | [
"Checks",
"the",
"pack",
"order",
"and",
"offsets",
"of",
"a",
"sequence",
"of",
"mojom",
".",
"Kinds",
".",
"Args",
":",
"kinds",
":",
"A",
"sequence",
"of",
"mojom",
".",
"Kinds",
"that",
"specify",
"the",
"fields",
"that",
"are",
"to",
"be",
"create... | def _CheckPackSequence(self, kinds, fields, offsets):
struct = mojom.Struct('test')
index = 1
for kind in kinds:
struct.AddField('%d' % index, kind)
index += 1
ps = pack.PackedStruct(struct)
num_fields = len(ps.packed_fields)
self.assertEqual(len(kinds), num_fields)
for i in rang... | [
"def",
"_CheckPackSequence",
"(",
"self",
",",
"kinds",
",",
"fields",
",",
"offsets",
")",
":",
"struct",
"=",
"mojom",
".",
"Struct",
"(",
"'test'",
")",
"index",
"=",
"1",
"for",
"kind",
"in",
"kinds",
":",
"struct",
".",
"AddField",
"(",
"'%d'",
... | Checks the pack order and offsets of a sequence of mojom.Kinds. | [
"Checks",
"the",
"pack",
"order",
"and",
"offsets",
"of",
"a",
"sequence",
"of",
"mojom",
".",
"Kinds",
"."
] | [
"\"\"\"Checks the pack order and offsets of a sequence of mojom.Kinds.\n\n Args:\n kinds: A sequence of mojom.Kinds that specify the fields that are to be\n created.\n fields: The expected order of the resulting fields, with the integer \"1\"\n first.\n offsets: The expected order of off... | [
{
"param": "self",
"type": null
},
{
"param": "kinds",
"type": null
},
{
"param": "fields",
"type": null
},
{
"param": "offsets",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "kinds",
"type": null,
"docstring": null,
"docstring_tokens": ... |
98c705add32b403b8f487818f1a3b225df5f3289 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/pack_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testMinVersion | null | def testMinVersion(self):
"""Tests that |min_version| is properly set for packed fields."""
struct = mojom.Struct('test')
struct.AddField('field_2', mojom.BOOL, 2)
struct.AddField('field_0', mojom.INT32, 0)
struct.AddField('field_1', mojom.INT64, 1)
ps = pack.PackedStruct(struct)
self.asser... | Tests that |min_version| is properly set for packed fields. | Tests that |min_version| is properly set for packed fields. | [
"Tests",
"that",
"|min_version|",
"is",
"properly",
"set",
"for",
"packed",
"fields",
"."
] | def testMinVersion(self):
struct = mojom.Struct('test')
struct.AddField('field_2', mojom.BOOL, 2)
struct.AddField('field_0', mojom.INT32, 0)
struct.AddField('field_1', mojom.INT64, 1)
ps = pack.PackedStruct(struct)
self.assertEqual('field_0', ps.packed_fields[0].field.mojom_name)
self.assert... | [
"def",
"testMinVersion",
"(",
"self",
")",
":",
"struct",
"=",
"mojom",
".",
"Struct",
"(",
"'test'",
")",
"struct",
".",
"AddField",
"(",
"'field_2'",
",",
"mojom",
".",
"BOOL",
",",
"2",
")",
"struct",
".",
"AddField",
"(",
"'field_0'",
",",
"mojom",... | Tests that |min_version| is properly set for packed fields. | [
"Tests",
"that",
"|min_version|",
"is",
"properly",
"set",
"for",
"packed",
"fields",
"."
] | [
"\"\"\"Tests that |min_version| is properly set for packed fields.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
98c705add32b403b8f487818f1a3b225df5f3289 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/pack_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testGetVersionInfoEmptyStruct | null | def testGetVersionInfoEmptyStruct(self):
"""Tests that pack.GetVersionInfo() never returns an empty list, even for
empty structs.
"""
struct = mojom.Struct('test')
ps = pack.PackedStruct(struct)
versions = pack.GetVersionInfo(ps)
self.assertEqual(1, len(versions))
self.assertEqual(0, ve... | Tests that pack.GetVersionInfo() never returns an empty list, even for
empty structs.
| Tests that pack.GetVersionInfo() never returns an empty list, even for
empty structs. | [
"Tests",
"that",
"pack",
".",
"GetVersionInfo",
"()",
"never",
"returns",
"an",
"empty",
"list",
"even",
"for",
"empty",
"structs",
"."
] | def testGetVersionInfoEmptyStruct(self):
struct = mojom.Struct('test')
ps = pack.PackedStruct(struct)
versions = pack.GetVersionInfo(ps)
self.assertEqual(1, len(versions))
self.assertEqual(0, versions[0].version)
self.assertEqual(0, versions[0].num_fields)
self.assertEqual(8, versions[0].num... | [
"def",
"testGetVersionInfoEmptyStruct",
"(",
"self",
")",
":",
"struct",
"=",
"mojom",
".",
"Struct",
"(",
"'test'",
")",
"ps",
"=",
"pack",
".",
"PackedStruct",
"(",
"struct",
")",
"versions",
"=",
"pack",
".",
"GetVersionInfo",
"(",
"ps",
")",
"self",
... | Tests that pack.GetVersionInfo() never returns an empty list, even for
empty structs. | [
"Tests",
"that",
"pack",
".",
"GetVersionInfo",
"()",
"never",
"returns",
"an",
"empty",
"list",
"even",
"for",
"empty",
"structs",
"."
] | [
"\"\"\"Tests that pack.GetVersionInfo() never returns an empty list, even for\n empty structs.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
98c705add32b403b8f487818f1a3b225df5f3289 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/pack_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testGetVersionInfoComplexOrder | null | def testGetVersionInfoComplexOrder(self):
"""Tests pack.GetVersionInfo() using a struct whose definition order,
ordinal order and pack order for fields are all different.
"""
struct = mojom.Struct('test')
struct.AddField(
'field_3', mojom.BOOL, ordinal=3, attributes={'MinVersion': 3})
st... | Tests pack.GetVersionInfo() using a struct whose definition order,
ordinal order and pack order for fields are all different.
| Tests pack.GetVersionInfo() using a struct whose definition order,
ordinal order and pack order for fields are all different. | [
"Tests",
"pack",
".",
"GetVersionInfo",
"()",
"using",
"a",
"struct",
"whose",
"definition",
"order",
"ordinal",
"order",
"and",
"pack",
"order",
"for",
"fields",
"are",
"all",
"different",
"."
] | def testGetVersionInfoComplexOrder(self):
struct = mojom.Struct('test')
struct.AddField(
'field_3', mojom.BOOL, ordinal=3, attributes={'MinVersion': 3})
struct.AddField('field_0', mojom.INT32, ordinal=0)
struct.AddField(
'field_1', mojom.INT64, ordinal=1, attributes={'MinVersion': 2})
... | [
"def",
"testGetVersionInfoComplexOrder",
"(",
"self",
")",
":",
"struct",
"=",
"mojom",
".",
"Struct",
"(",
"'test'",
")",
"struct",
".",
"AddField",
"(",
"'field_3'",
",",
"mojom",
".",
"BOOL",
",",
"ordinal",
"=",
"3",
",",
"attributes",
"=",
"{",
"'Mi... | Tests pack.GetVersionInfo() using a struct whose definition order,
ordinal order and pack order for fields are all different. | [
"Tests",
"pack",
".",
"GetVersionInfo",
"()",
"using",
"a",
"struct",
"whose",
"definition",
"order",
"ordinal",
"order",
"and",
"pack",
"order",
"for",
"fields",
"are",
"all",
"different",
"."
] | [
"\"\"\"Tests pack.GetVersionInfo() using a struct whose definition order,\n ordinal order and pack order for fields are all different.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
98c705add32b403b8f487818f1a3b225df5f3289 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/pack_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testInterfaceAlignment | null | def testInterfaceAlignment(self):
"""Tests that interfaces are aligned on 4-byte boundaries, although the size
of an interface is 8 bytes.
"""
kinds = (mojom.INT32, mojom.Interface('test_interface'))
fields = (1, 2)
offsets = (0, 4)
self._CheckPackSequence(kinds, fields, offsets) | Tests that interfaces are aligned on 4-byte boundaries, although the size
of an interface is 8 bytes.
| Tests that interfaces are aligned on 4-byte boundaries, although the size
of an interface is 8 bytes. | [
"Tests",
"that",
"interfaces",
"are",
"aligned",
"on",
"4",
"-",
"byte",
"boundaries",
"although",
"the",
"size",
"of",
"an",
"interface",
"is",
"8",
"bytes",
"."
] | def testInterfaceAlignment(self):
kinds = (mojom.INT32, mojom.Interface('test_interface'))
fields = (1, 2)
offsets = (0, 4)
self._CheckPackSequence(kinds, fields, offsets) | [
"def",
"testInterfaceAlignment",
"(",
"self",
")",
":",
"kinds",
"=",
"(",
"mojom",
".",
"INT32",
",",
"mojom",
".",
"Interface",
"(",
"'test_interface'",
")",
")",
"fields",
"=",
"(",
"1",
",",
"2",
")",
"offsets",
"=",
"(",
"0",
",",
"4",
")",
"s... | Tests that interfaces are aligned on 4-byte boundaries, although the size
of an interface is 8 bytes. | [
"Tests",
"that",
"interfaces",
"are",
"aligned",
"on",
"4",
"-",
"byte",
"boundaries",
"although",
"the",
"size",
"of",
"an",
"interface",
"is",
"8",
"bytes",
"."
] | [
"\"\"\"Tests that interfaces are aligned on 4-byte boundaries, although the size\n of an interface is 8 bytes.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
98c705add32b403b8f487818f1a3b225df5f3289 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/pack_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testAssociatedInterfaceAlignment | null | def testAssociatedInterfaceAlignment(self):
"""Tests that associated interfaces are aligned on 4-byte boundaries,
although the size of an associated interface is 8 bytes.
"""
kinds = (mojom.INT32,
mojom.AssociatedInterface(mojom.Interface('test_interface')))
fields = (1, 2)
offsets ... | Tests that associated interfaces are aligned on 4-byte boundaries,
although the size of an associated interface is 8 bytes.
| Tests that associated interfaces are aligned on 4-byte boundaries,
although the size of an associated interface is 8 bytes. | [
"Tests",
"that",
"associated",
"interfaces",
"are",
"aligned",
"on",
"4",
"-",
"byte",
"boundaries",
"although",
"the",
"size",
"of",
"an",
"associated",
"interface",
"is",
"8",
"bytes",
"."
] | def testAssociatedInterfaceAlignment(self):
kinds = (mojom.INT32,
mojom.AssociatedInterface(mojom.Interface('test_interface')))
fields = (1, 2)
offsets = (0, 4)
self._CheckPackSequence(kinds, fields, offsets) | [
"def",
"testAssociatedInterfaceAlignment",
"(",
"self",
")",
":",
"kinds",
"=",
"(",
"mojom",
".",
"INT32",
",",
"mojom",
".",
"AssociatedInterface",
"(",
"mojom",
".",
"Interface",
"(",
"'test_interface'",
")",
")",
")",
"fields",
"=",
"(",
"1",
",",
"2",... | Tests that associated interfaces are aligned on 4-byte boundaries,
although the size of an associated interface is 8 bytes. | [
"Tests",
"that",
"associated",
"interfaces",
"are",
"aligned",
"on",
"4",
"-",
"byte",
"boundaries",
"although",
"the",
"size",
"of",
"an",
"associated",
"interface",
"is",
"8",
"bytes",
"."
] | [
"\"\"\"Tests that associated interfaces are aligned on 4-byte boundaries,\n although the size of an associated interface is 8 bytes.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
64c93bd49abc6d34362384504cc20a867f7a374b | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/bind_gen/package_initializer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | init | null | def init(**kwargs):
"""
Initializes this package. See PackageInitializer.__init__ for details
about the arguments.
"""
the_instance = PackageInitializer(**kwargs)
the_instance.init()
assert the_instance is PackageInitializer.the_instance() |
Initializes this package. See PackageInitializer.__init__ for details
about the arguments.
| Initializes this package. See PackageInitializer.__init__ for details
about the arguments. | [
"Initializes",
"this",
"package",
".",
"See",
"PackageInitializer",
".",
"__init__",
"for",
"details",
"about",
"the",
"arguments",
"."
] | def init(**kwargs):
the_instance = PackageInitializer(**kwargs)
the_instance.init()
assert the_instance is PackageInitializer.the_instance() | [
"def",
"init",
"(",
"**",
"kwargs",
")",
":",
"the_instance",
"=",
"PackageInitializer",
"(",
"**",
"kwargs",
")",
"the_instance",
".",
"init",
"(",
")",
"assert",
"the_instance",
"is",
"PackageInitializer",
".",
"the_instance",
"(",
")"
] | Initializes this package. | [
"Initializes",
"this",
"package",
"."
] | [
"\"\"\"\n Initializes this package. See PackageInitializer.__init__ for details\n about the arguments.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
64c93bd49abc6d34362384504cc20a867f7a374b | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/bind_gen/package_initializer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | package_initializer | <not_specific> | def package_initializer():
"""
Returns the instance of PackageInitializer that actually initialized this
package.
"""
the_instance = PackageInitializer.the_instance()
assert the_instance
return the_instance |
Returns the instance of PackageInitializer that actually initialized this
package.
| Returns the instance of PackageInitializer that actually initialized this
package. | [
"Returns",
"the",
"instance",
"of",
"PackageInitializer",
"that",
"actually",
"initialized",
"this",
"package",
"."
] | def package_initializer():
the_instance = PackageInitializer.the_instance()
assert the_instance
return the_instance | [
"def",
"package_initializer",
"(",
")",
":",
"the_instance",
"=",
"PackageInitializer",
".",
"the_instance",
"(",
")",
"assert",
"the_instance",
"return",
"the_instance"
] | Returns the instance of PackageInitializer that actually initialized this
package. | [
"Returns",
"the",
"instance",
"of",
"PackageInitializer",
"that",
"actually",
"initialized",
"this",
"package",
"."
] | [
"\"\"\"\n Returns the instance of PackageInitializer that actually initialized this\n package.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
64c93bd49abc6d34362384504cc20a867f7a374b | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/bind_gen/package_initializer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | web_idl_database | <not_specific> | def web_idl_database(self):
"""Returns the global instance of web_idl.Database."""
assert isinstance(PackageInitializer._the_web_idl_database,
web_idl.Database)
return PackageInitializer._the_web_idl_database | Returns the global instance of web_idl.Database. | Returns the global instance of web_idl.Database. | [
"Returns",
"the",
"global",
"instance",
"of",
"web_idl",
".",
"Database",
"."
] | def web_idl_database(self):
assert isinstance(PackageInitializer._the_web_idl_database,
web_idl.Database)
return PackageInitializer._the_web_idl_database | [
"def",
"web_idl_database",
"(",
"self",
")",
":",
"assert",
"isinstance",
"(",
"PackageInitializer",
".",
"_the_web_idl_database",
",",
"web_idl",
".",
"Database",
")",
"return",
"PackageInitializer",
".",
"_the_web_idl_database"
] | Returns the global instance of web_idl.Database. | [
"Returns",
"the",
"global",
"instance",
"of",
"web_idl",
".",
"Database",
"."
] | [
"\"\"\"Returns the global instance of web_idl.Database.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c90583c2f4ecb3f352e0d054dcba4aebf51f34f2 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/net/results_fetcher.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | results_url | <not_specific> | def results_url(self, builder_name, build_number=None, step_name=None):
"""Returns a URL for one set of archived web test results.
If a build number is given, this will be results for a particular run;
otherwise it will be the accumulated results URL, which should have
the latest result... | Returns a URL for one set of archived web test results.
If a build number is given, this will be results for a particular run;
otherwise it will be the accumulated results URL, which should have
the latest results.
| Returns a URL for one set of archived web test results.
If a build number is given, this will be results for a particular run;
otherwise it will be the accumulated results URL, which should have
the latest results. | [
"Returns",
"a",
"URL",
"for",
"one",
"set",
"of",
"archived",
"web",
"test",
"results",
".",
"If",
"a",
"build",
"number",
"is",
"given",
"this",
"will",
"be",
"results",
"for",
"a",
"particular",
"run",
";",
"otherwise",
"it",
"will",
"be",
"the",
"ac... | def results_url(self, builder_name, build_number=None, step_name=None):
if build_number:
assert str(build_number).isdigit(), \
'expected numeric build number, got %s' % build_number
url_base = self.builder_results_url_base(builder_name)
if step_name is None:
... | [
"def",
"results_url",
"(",
"self",
",",
"builder_name",
",",
"build_number",
"=",
"None",
",",
"step_name",
"=",
"None",
")",
":",
"if",
"build_number",
":",
"assert",
"str",
"(",
"build_number",
")",
".",
"isdigit",
"(",
")",
",",
"'expected numeric build n... | Returns a URL for one set of archived web test results. | [
"Returns",
"a",
"URL",
"for",
"one",
"set",
"of",
"archived",
"web",
"test",
"results",
"."
] | [
"\"\"\"Returns a URL for one set of archived web test results.\n\n If a build number is given, this will be results for a particular run;\n otherwise it will be the accumulated results URL, which should have\n the latest results.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "builder_name",
"type": null
},
{
"param": "build_number",
"type": null
},
{
"param": "step_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "builder_name",
"type": null,
"docstring": null,
"docstring_to... |
6fdf0cc95bc535a79c7efd15fdc0149110c524c9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/system/filesystem.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _path_for_access | <not_specific> | def _path_for_access(self, path):
"""Ensures a path can be used to access the file.
Pass a path through this method when and only when the path is about to
be accessed via a syscall (e.g. open()); DO NOT use this method if the
path is to be manipulated by (most of) the functions in os.p... | Ensures a path can be used to access the file.
Pass a path through this method when and only when the path is about to
be accessed via a syscall (e.g. open()); DO NOT use this method if the
path is to be manipulated by (most of) the functions in os.path, etc.
This method currently only... | Ensures a path can be used to access the file.
Pass a path through this method when and only when the path is about to
be accessed via a syscall ); DO NOT use this method if the
path is to be manipulated by (most of) the functions in os.path, etc.
This method currently only works around one issue: the maximum path
len... | [
"Ensures",
"a",
"path",
"can",
"be",
"used",
"to",
"access",
"the",
"file",
".",
"Pass",
"a",
"path",
"through",
"this",
"method",
"when",
"and",
"only",
"when",
"the",
"path",
"is",
"about",
"to",
"be",
"accessed",
"via",
"a",
"syscall",
")",
";",
"... | def _path_for_access(self, path):
if sys.platform == 'win32' and len(path) >= self.WINDOWS_MAX_PATH:
assert not path.startswith(r'\\'), "must not already be UNC"
return r'\\?\%s' % (self.abspath(path), )
return path | [
"def",
"_path_for_access",
"(",
"self",
",",
"path",
")",
":",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
"and",
"len",
"(",
"path",
")",
">=",
"self",
".",
"WINDOWS_MAX_PATH",
":",
"assert",
"not",
"path",
".",
"startswith",
"(",
"r'\\\\'",
")",
"... | Ensures a path can be used to access the file. | [
"Ensures",
"a",
"path",
"can",
"be",
"used",
"to",
"access",
"the",
"file",
"."
] | [
"\"\"\"Ensures a path can be used to access the file.\n\n Pass a path through this method when and only when the path is about to\n be accessed via a syscall (e.g. open()); DO NOT use this method if the\n path is to be manipulated by (most of) the functions in os.path, etc.\n\n This meth... | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [... |
6fdf0cc95bc535a79c7efd15fdc0149110c524c9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/system/filesystem.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | files_under | <not_specific> | def files_under(self, path, dirs_to_skip=None, file_filter=None):
"""Walks the filesystem tree under the given path in top-down order.
Args:
dirs_to_skip: A list of directories to skip over during the
traversal (e.g., .svn, resources, etc.).
file_filter: If not N... | Walks the filesystem tree under the given path in top-down order.
Args:
dirs_to_skip: A list of directories to skip over during the
traversal (e.g., .svn, resources, etc.).
file_filter: If not None, the filter will be invoked with the
filesystem object an... | Walks the filesystem tree under the given path in top-down order. | [
"Walks",
"the",
"filesystem",
"tree",
"under",
"the",
"given",
"path",
"in",
"top",
"-",
"down",
"order",
"."
] | def files_under(self, path, dirs_to_skip=None, file_filter=None):
dirs_to_skip = dirs_to_skip or []
def filter_all(fs, dirpath, basename):
return True
file_filter = file_filter or filter_all
files = []
if self.isfile(path):
if file_filter(self, self.dirnam... | [
"def",
"files_under",
"(",
"self",
",",
"path",
",",
"dirs_to_skip",
"=",
"None",
",",
"file_filter",
"=",
"None",
")",
":",
"dirs_to_skip",
"=",
"dirs_to_skip",
"or",
"[",
"]",
"def",
"filter_all",
"(",
"fs",
",",
"dirpath",
",",
"basename",
")",
":",
... | Walks the filesystem tree under the given path in top-down order. | [
"Walks",
"the",
"filesystem",
"tree",
"under",
"the",
"given",
"path",
"in",
"top",
"-",
"down",
"order",
"."
] | [
"\"\"\"Walks the filesystem tree under the given path in top-down order.\n\n Args:\n dirs_to_skip: A list of directories to skip over during the\n traversal (e.g., .svn, resources, etc.).\n file_filter: If not None, the filter will be invoked with the\n fil... | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": null
},
{
"param": "dirs_to_skip",
"type": null
},
{
"param": "file_filter",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of all files under the given path in top-down order.",
"docstring_tokens": [
"A",
"list",
"of",
"all",
"files",
"under",
"the",
"given",
"path",
"in",
"top",
"-",
... |
6fdf0cc95bc535a79c7efd15fdc0149110c524c9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/system/filesystem.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | mkdtemp | <not_specific> | def mkdtemp(self, **kwargs):
"""Creates and returns a uniquely-named directory.
This is like tempfile.mkdtemp, but if used in a with statement
the directory will self-delete at the end of the block (if the
directory is empty; non-empty directories raise errors). The
directory ca... | Creates and returns a uniquely-named directory.
This is like tempfile.mkdtemp, but if used in a with statement
the directory will self-delete at the end of the block (if the
directory is empty; non-empty directories raise errors). The
directory can be safely deleted inside the block as ... | Creates and returns a uniquely-named directory.
This is like tempfile.mkdtemp, but if used in a with statement
the directory will self-delete at the end of the block (if the
directory is empty; non-empty directories raise errors). The
directory can be safely deleted inside the block as well, if so
desired.
Note that t... | [
"Creates",
"and",
"returns",
"a",
"uniquely",
"-",
"named",
"directory",
".",
"This",
"is",
"like",
"tempfile",
".",
"mkdtemp",
"but",
"if",
"used",
"in",
"a",
"with",
"statement",
"the",
"directory",
"will",
"self",
"-",
"delete",
"at",
"the",
"end",
"o... | def mkdtemp(self, **kwargs):
class TemporaryDirectory(object):
def __init__(self, **kwargs):
self._kwargs = kwargs
self._directory_path = tempfile.mkdtemp(**self._kwargs)
def __str__(self):
return self._directory_path
def __ente... | [
"def",
"mkdtemp",
"(",
"self",
",",
"**",
"kwargs",
")",
":",
"class",
"TemporaryDirectory",
"(",
"object",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"**",
"kwargs",
")",
":",
"self",
".",
"_kwargs",
"=",
"kwargs",
"self",
".",
"_directory_path",
... | Creates and returns a uniquely-named directory. | [
"Creates",
"and",
"returns",
"a",
"uniquely",
"-",
"named",
"directory",
"."
] | [
"\"\"\"Creates and returns a uniquely-named directory.\n\n This is like tempfile.mkdtemp, but if used in a with statement\n the directory will self-delete at the end of the block (if the\n directory is empty; non-empty directories raise errors). The\n directory can be safely deleted insi... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6fdf0cc95bc535a79c7efd15fdc0149110c524c9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/system/filesystem.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | maybe_make_directory | null | def maybe_make_directory(self, *path):
"""Creates the specified directory if it doesn't already exist."""
try:
# os.makedirs() supports UNC paths:
# https://docs.python.org/2/library/os.html#os.makedirs
os.makedirs(self._path_for_access(self.join(*path)))
exce... | Creates the specified directory if it doesn't already exist. | Creates the specified directory if it doesn't already exist. | [
"Creates",
"the",
"specified",
"directory",
"if",
"it",
"doesn",
"'",
"t",
"already",
"exist",
"."
] | def maybe_make_directory(self, *path):
try:
os.makedirs(self._path_for_access(self.join(*path)))
except OSError as error:
if error.errno != errno.EEXIST:
raise | [
"def",
"maybe_make_directory",
"(",
"self",
",",
"*",
"path",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"self",
".",
"_path_for_access",
"(",
"self",
".",
"join",
"(",
"*",
"path",
")",
")",
")",
"except",
"OSError",
"as",
"error",
":",
"if",... | Creates the specified directory if it doesn't already exist. | [
"Creates",
"the",
"specified",
"directory",
"if",
"it",
"doesn",
"'",
"t",
"already",
"exist",
"."
] | [
"\"\"\"Creates the specified directory if it doesn't already exist.\"\"\"",
"# os.makedirs() supports UNC paths:",
"# https://docs.python.org/2/library/os.html#os.makedirs"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6fdf0cc95bc535a79c7efd15fdc0149110c524c9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/system/filesystem.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | open_binary_tempfile | <not_specific> | def open_binary_tempfile(self, suffix=''):
"""Creates, opens, and returns a binary temp file.
Returns a tuple of the file and the name.
"""
temp_fd, temp_name = tempfile.mkstemp(suffix)
f = os.fdopen(temp_fd, 'wb')
return f, temp_name | Creates, opens, and returns a binary temp file.
Returns a tuple of the file and the name.
| Creates, opens, and returns a binary temp file.
Returns a tuple of the file and the name. | [
"Creates",
"opens",
"and",
"returns",
"a",
"binary",
"temp",
"file",
".",
"Returns",
"a",
"tuple",
"of",
"the",
"file",
"and",
"the",
"name",
"."
] | def open_binary_tempfile(self, suffix=''):
temp_fd, temp_name = tempfile.mkstemp(suffix)
f = os.fdopen(temp_fd, 'wb')
return f, temp_name | [
"def",
"open_binary_tempfile",
"(",
"self",
",",
"suffix",
"=",
"''",
")",
":",
"temp_fd",
",",
"temp_name",
"=",
"tempfile",
".",
"mkstemp",
"(",
"suffix",
")",
"f",
"=",
"os",
".",
"fdopen",
"(",
"temp_fd",
",",
"'wb'",
")",
"return",
"f",
",",
"te... | Creates, opens, and returns a binary temp file. | [
"Creates",
"opens",
"and",
"returns",
"a",
"binary",
"temp",
"file",
"."
] | [
"\"\"\"Creates, opens, and returns a binary temp file.\n\n Returns a tuple of the file and the name.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "suffix",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "suffix",
"type": null,
"docstring": null,
"docstring_tokens":... |
6fdf0cc95bc535a79c7efd15fdc0149110c524c9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/system/filesystem.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | open_text_tempfile | <not_specific> | def open_text_tempfile(self, suffix=''):
"""Creates, opens, and returns a text temp file.
Returns a tuple of the file and the name.
"""
temp_fd, temp_name = tempfile.mkstemp(suffix)
# Close the OS fd opened by mkstemp as we will reopen the file with an
# explict encoding... | Creates, opens, and returns a text temp file.
Returns a tuple of the file and the name.
| Creates, opens, and returns a text temp file.
Returns a tuple of the file and the name. | [
"Creates",
"opens",
"and",
"returns",
"a",
"text",
"temp",
"file",
".",
"Returns",
"a",
"tuple",
"of",
"the",
"file",
"and",
"the",
"name",
"."
] | def open_text_tempfile(self, suffix=''):
temp_fd, temp_name = tempfile.mkstemp(suffix)
os.close(temp_fd)
f = codecs.open(temp_name, 'w', 'utf8')
return f, temp_name | [
"def",
"open_text_tempfile",
"(",
"self",
",",
"suffix",
"=",
"''",
")",
":",
"temp_fd",
",",
"temp_name",
"=",
"tempfile",
".",
"mkstemp",
"(",
"suffix",
")",
"os",
".",
"close",
"(",
"temp_fd",
")",
"f",
"=",
"codecs",
".",
"open",
"(",
"temp_name",
... | Creates, opens, and returns a text temp file. | [
"Creates",
"opens",
"and",
"returns",
"a",
"text",
"temp",
"file",
"."
] | [
"\"\"\"Creates, opens, and returns a text temp file.\n\n Returns a tuple of the file and the name.\n \"\"\"",
"# Close the OS fd opened by mkstemp as we will reopen the file with an",
"# explict encoding."
] | [
{
"param": "self",
"type": null
},
{
"param": "suffix",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "suffix",
"type": null,
"docstring": null,
"docstring_tokens":... |
6fdf0cc95bc535a79c7efd15fdc0149110c524c9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/system/filesystem.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | read_text_file | <not_specific> | def read_text_file(self, path):
"""Returns the contents of the file as a Unicode string.
The file is read assuming it is a UTF-8 encoded file with no BOM.
"""
with self.open_text_file_for_reading(path) as f:
return f.read() | Returns the contents of the file as a Unicode string.
The file is read assuming it is a UTF-8 encoded file with no BOM.
| Returns the contents of the file as a Unicode string.
The file is read assuming it is a UTF-8 encoded file with no BOM. | [
"Returns",
"the",
"contents",
"of",
"the",
"file",
"as",
"a",
"Unicode",
"string",
".",
"The",
"file",
"is",
"read",
"assuming",
"it",
"is",
"a",
"UTF",
"-",
"8",
"encoded",
"file",
"with",
"no",
"BOM",
"."
] | def read_text_file(self, path):
with self.open_text_file_for_reading(path) as f:
return f.read() | [
"def",
"read_text_file",
"(",
"self",
",",
"path",
")",
":",
"with",
"self",
".",
"open_text_file_for_reading",
"(",
"path",
")",
"as",
"f",
":",
"return",
"f",
".",
"read",
"(",
")"
] | Returns the contents of the file as a Unicode string. | [
"Returns",
"the",
"contents",
"of",
"the",
"file",
"as",
"a",
"Unicode",
"string",
"."
] | [
"\"\"\"Returns the contents of the file as a Unicode string.\n\n The file is read assuming it is a UTF-8 encoded file with no BOM.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [... |
6fdf0cc95bc535a79c7efd15fdc0149110c524c9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/system/filesystem.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | write_text_file | null | def write_text_file(self, path, contents):
"""Writes the contents to the file at the given location.
The file is written encoded as UTF-8 with no BOM.
"""
with self.open_text_file_for_writing(path) as f:
f.write(contents) | Writes the contents to the file at the given location.
The file is written encoded as UTF-8 with no BOM.
| Writes the contents to the file at the given location.
The file is written encoded as UTF-8 with no BOM. | [
"Writes",
"the",
"contents",
"to",
"the",
"file",
"at",
"the",
"given",
"location",
".",
"The",
"file",
"is",
"written",
"encoded",
"as",
"UTF",
"-",
"8",
"with",
"no",
"BOM",
"."
] | def write_text_file(self, path, contents):
with self.open_text_file_for_writing(path) as f:
f.write(contents) | [
"def",
"write_text_file",
"(",
"self",
",",
"path",
",",
"contents",
")",
":",
"with",
"self",
".",
"open_text_file_for_writing",
"(",
"path",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"contents",
")"
] | Writes the contents to the file at the given location. | [
"Writes",
"the",
"contents",
"to",
"the",
"file",
"at",
"the",
"given",
"location",
"."
] | [
"\"\"\"Writes the contents to the file at the given location.\n\n The file is written encoded as UTF-8 with no BOM.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": null
},
{
"param": "contents",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [... |
6fdf0cc95bc535a79c7efd15fdc0149110c524c9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/system/filesystem.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | remove | <not_specific> | def remove(self, path, osremove=os.remove, retry=True):
"""Removes a file.
On Windows, if a process was recently killed and it held on to a file,
the OS will hold on to the file for a short while. This makes attempts
to delete the file fail. To work around that, this method will retry
... | Removes a file.
On Windows, if a process was recently killed and it held on to a file,
the OS will hold on to the file for a short while. This makes attempts
to delete the file fail. To work around that, this method will retry
for a few seconds until Windows is done with the file.
... | Removes a file.
On Windows, if a process was recently killed and it held on to a file,
the OS will hold on to the file for a short while. This makes attempts
to delete the file fail. To work around that, this method will retry
for a few seconds until Windows is done with the file. | [
"Removes",
"a",
"file",
".",
"On",
"Windows",
"if",
"a",
"process",
"was",
"recently",
"killed",
"and",
"it",
"held",
"on",
"to",
"a",
"file",
"the",
"OS",
"will",
"hold",
"on",
"to",
"the",
"file",
"for",
"a",
"short",
"while",
".",
"This",
"makes",... | def remove(self, path, osremove=os.remove, retry=True):
try:
exceptions.WindowsError
except AttributeError:
exceptions.WindowsError = FileSystem._WindowsError
retry_timeout_sec = 3.0
sleep_interval = 0.1
while True:
try:
osremov... | [
"def",
"remove",
"(",
"self",
",",
"path",
",",
"osremove",
"=",
"os",
".",
"remove",
",",
"retry",
"=",
"True",
")",
":",
"try",
":",
"exceptions",
".",
"WindowsError",
"except",
"AttributeError",
":",
"exceptions",
".",
"WindowsError",
"=",
"FileSystem",... | Removes a file. | [
"Removes",
"a",
"file",
"."
] | [
"\"\"\"Removes a file.\n\n On Windows, if a process was recently killed and it held on to a file,\n the OS will hold on to the file for a short while. This makes attempts\n to delete the file fail. To work around that, this method will retry\n for a few seconds until Windows is done with... | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": null
},
{
"param": "osremove",
"type": null
},
{
"param": "retry",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [... |
6fdf0cc95bc535a79c7efd15fdc0149110c524c9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/system/filesystem.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | rmtree | null | def rmtree(self, path, ignore_errors=True, onerror=None):
"""Deletes the directory rooted at path, whether empty or not."""
if sys.platform == 'win32':
assert not path.startswith(r'\\'), 'root path cannot be UNC-style'
path_abs = self.abspath(path)
# Ensure the root ... | Deletes the directory rooted at path, whether empty or not. | Deletes the directory rooted at path, whether empty or not. | [
"Deletes",
"the",
"directory",
"rooted",
"at",
"path",
"whether",
"empty",
"or",
"not",
"."
] | def rmtree(self, path, ignore_errors=True, onerror=None):
if sys.platform == 'win32':
assert not path.startswith(r'\\'), 'root path cannot be UNC-style'
path_abs = self.abspath(path)
assert len(path_abs) < self.WINDOWS_MAX_PATH, \
'root path is too long'
... | [
"def",
"rmtree",
"(",
"self",
",",
"path",
",",
"ignore_errors",
"=",
"True",
",",
"onerror",
"=",
"None",
")",
":",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"assert",
"not",
"path",
".",
"startswith",
"(",
"r'\\\\'",
")",
",",
"'root path c... | Deletes the directory rooted at path, whether empty or not. | [
"Deletes",
"the",
"directory",
"rooted",
"at",
"path",
"whether",
"empty",
"or",
"not",
"."
] | [
"\"\"\"Deletes the directory rooted at path, whether empty or not.\"\"\"",
"# Ensure the root of the tree being rmtree'd is not a long path.",
"# We can't convert it to a long path (using _path_for_access),",
"# because long paths are not supported in 'rmdir' on Windows 7.",
"# Ensure (hopefully) that the q... | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": null
},
{
"param": "ignore_errors",
"type": null
},
{
"param": "onerror",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [... |
6fdf0cc95bc535a79c7efd15fdc0149110c524c9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/system/filesystem.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | remove_contents | <not_specific> | def remove_contents(self, dirname):
"""Attempts to remove the contents of a directory tree.
Args:
dirname (string): Directory to remove the contents of.
Returns:
bool: True if the directory is now empty.
"""
return _remove_contents(self, dirname) | Attempts to remove the contents of a directory tree.
Args:
dirname (string): Directory to remove the contents of.
Returns:
bool: True if the directory is now empty.
| Attempts to remove the contents of a directory tree. | [
"Attempts",
"to",
"remove",
"the",
"contents",
"of",
"a",
"directory",
"tree",
"."
] | def remove_contents(self, dirname):
return _remove_contents(self, dirname) | [
"def",
"remove_contents",
"(",
"self",
",",
"dirname",
")",
":",
"return",
"_remove_contents",
"(",
"self",
",",
"dirname",
")"
] | Attempts to remove the contents of a directory tree. | [
"Attempts",
"to",
"remove",
"the",
"contents",
"of",
"a",
"directory",
"tree",
"."
] | [
"\"\"\"Attempts to remove the contents of a directory tree.\n\n Args:\n dirname (string): Directory to remove the contents of.\n\n Returns:\n bool: True if the directory is now empty.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "dirname",
"type": null
}
] | {
"returns": [
{
"docstring": "True if the directory is now empty.",
"docstring_tokens": [
"True",
"if",
"the",
"directory",
"is",
"now",
"empty",
"."
],
"type": "bool"
}
],
"raises": [],
"params": [
{
"ide... |
6fdf0cc95bc535a79c7efd15fdc0149110c524c9 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/system/filesystem.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | sanitize_filename | <not_specific> | def sanitize_filename(self, filename, replacement='_'):
"""Replaces all illegal characters in a filename with a given character.
The list of illegal characters covers all restrictions on Linux, Mac and
Windows.
Args:
filename: A basename (or a part of the basename) of a fil... | Replaces all illegal characters in a filename with a given character.
The list of illegal characters covers all restrictions on Linux, Mac and
Windows.
Args:
filename: A basename (or a part of the basename) of a file to
sanitize. It cannot be a path because slashes ... | Replaces all illegal characters in a filename with a given character.
The list of illegal characters covers all restrictions on Linux, Mac and
Windows. | [
"Replaces",
"all",
"illegal",
"characters",
"in",
"a",
"filename",
"with",
"a",
"given",
"character",
".",
"The",
"list",
"of",
"illegal",
"characters",
"covers",
"all",
"restrictions",
"on",
"Linux",
"Mac",
"and",
"Windows",
"."
] | def sanitize_filename(self, filename, replacement='_'):
return _sanitize_filename(filename, replacement) | [
"def",
"sanitize_filename",
"(",
"self",
",",
"filename",
",",
"replacement",
"=",
"'_'",
")",
":",
"return",
"_sanitize_filename",
"(",
"filename",
",",
"replacement",
")"
] | Replaces all illegal characters in a filename with a given character. | [
"Replaces",
"all",
"illegal",
"characters",
"in",
"a",
"filename",
"with",
"a",
"given",
"character",
"."
] | [
"\"\"\"Replaces all illegal characters in a filename with a given character.\n\n The list of illegal characters covers all restrictions on Linux, Mac and\n Windows.\n\n Args:\n filename: A basename (or a part of the basename) of a file to\n sanitize. It cannot be a pat... | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
},
{
"param": "replacement",
"type": null
}
] | {
"returns": [
{
"docstring": "The sanitized filename.",
"docstring_tokens": [
"The",
"sanitized",
"filename",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"... |
e6f87b478213a4ea16379d359266322413128d62 | sunlongbo/chromium | native_client_sdk/src/tools/tests/create_nmf_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | StripSo | <not_specific> | def StripSo(name):
"""Strip trailing hexidecimal characters from the name of a shared object.
It strips everything after the last '.' in the name, and checks that the new
name ends with .so.
e.g.
libc.so.ad6acbfa => libc.so
foo.bar.baz => foo.bar.baz
"""
if '.' in name:
stripped_name, ext = name.... | Strip trailing hexidecimal characters from the name of a shared object.
It strips everything after the last '.' in the name, and checks that the new
name ends with .so.
e.g.
libc.so.ad6acbfa => libc.so
foo.bar.baz => foo.bar.baz
| Strip trailing hexidecimal characters from the name of a shared object.
It strips everything after the last '.' in the name, and checks that the new
name ends with .so.
| [
"Strip",
"trailing",
"hexidecimal",
"characters",
"from",
"the",
"name",
"of",
"a",
"shared",
"object",
".",
"It",
"strips",
"everything",
"after",
"the",
"last",
"'",
".",
"'",
"in",
"the",
"name",
"and",
"checks",
"that",
"the",
"new",
"name",
"ends",
... | def StripSo(name):
if '.' in name:
stripped_name, ext = name.rsplit('.', 1)
if stripped_name.endswith('.so') and len(ext) > 1:
return stripped_name
return name | [
"def",
"StripSo",
"(",
"name",
")",
":",
"if",
"'.'",
"in",
"name",
":",
"stripped_name",
",",
"ext",
"=",
"name",
".",
"rsplit",
"(",
"'.'",
",",
"1",
")",
"if",
"stripped_name",
".",
"endswith",
"(",
"'.so'",
")",
"and",
"len",
"(",
"ext",
")",
... | Strip trailing hexidecimal characters from the name of a shared object. | [
"Strip",
"trailing",
"hexidecimal",
"characters",
"from",
"the",
"name",
"of",
"a",
"shared",
"object",
"."
] | [
"\"\"\"Strip trailing hexidecimal characters from the name of a shared object.\n\n It strips everything after the last '.' in the name, and checks that the new\n name ends with .so.\n\n e.g.\n\n libc.so.ad6acbfa => libc.so\n foo.bar.baz => foo.bar.baz\n \"\"\""
] | [
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e6f87b478213a4ea16379d359266322413128d62 | sunlongbo/chromium | native_client_sdk/src/tools/tests/create_nmf_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CreateTestNexe | <not_specific> | def _CreateTestNexe(self, name, arch):
"""Create an empty test .nexe file for use in create_nmf tests.
This is used rather than checking in test binaries since the
checked in binaries depend on .so files that only exist in the
certain SDK that build them.
"""
if arch == 'arm':
toolchain =... | Create an empty test .nexe file for use in create_nmf tests.
This is used rather than checking in test binaries since the
checked in binaries depend on .so files that only exist in the
certain SDK that build them.
| Create an empty test .nexe file for use in create_nmf tests.
This is used rather than checking in test binaries since the
checked in binaries depend on .so files that only exist in the
certain SDK that build them. | [
"Create",
"an",
"empty",
"test",
".",
"nexe",
"file",
"for",
"use",
"in",
"create_nmf",
"tests",
".",
"This",
"is",
"used",
"rather",
"than",
"checking",
"in",
"test",
"binaries",
"since",
"the",
"checked",
"in",
"binaries",
"depend",
"on",
".",
"so",
"f... | def _CreateTestNexe(self, name, arch):
if arch == 'arm':
toolchain = ARM_GLIBC_TOOLCHAIN
else:
toolchain = X86_GLIBC_TOOLCHAIN
compiler = os.path.join(toolchain, 'bin', '%s-nacl-g++' % arch)
if os.name == 'nt':
compiler += '.exe'
os.environ['CYGWIN'] = 'nodosfilewarning'
prog... | [
"def",
"_CreateTestNexe",
"(",
"self",
",",
"name",
",",
"arch",
")",
":",
"if",
"arch",
"==",
"'arm'",
":",
"toolchain",
"=",
"ARM_GLIBC_TOOLCHAIN",
"else",
":",
"toolchain",
"=",
"X86_GLIBC_TOOLCHAIN",
"compiler",
"=",
"os",
".",
"path",
".",
"join",
"("... | Create an empty test .nexe file for use in create_nmf tests. | [
"Create",
"an",
"empty",
"test",
".",
"nexe",
"file",
"for",
"use",
"in",
"create_nmf",
"tests",
"."
] | [
"\"\"\"Create an empty test .nexe file for use in create_nmf tests.\n\n This is used rather than checking in test binaries since the\n checked in binaries depend on .so files that only exist in the\n certain SDK that build them.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "arch",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [... |
e6f87b478213a4ea16379d359266322413128d62 | sunlongbo/chromium | native_client_sdk/src/tools/tests/create_nmf_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CreateDynamicAndStageDeps | <not_specific> | def _CreateDynamicAndStageDeps(self, arch_path=None, **kwargs):
"""Create dynamic .nexe files and put them in a temporary directory, with
their dependencies staged in the same directory.
Args:
arch_path: A dictionary mapping architecture to the directory to generate
the .nexe for the archit... | Create dynamic .nexe files and put them in a temporary directory, with
their dependencies staged in the same directory.
Args:
arch_path: A dictionary mapping architecture to the directory to generate
the .nexe for the architecture in.
kwargs: Keyword arguments to pass through to create_nm... | Create dynamic .nexe files and put them in a temporary directory, with
their dependencies staged in the same directory. | [
"Create",
"dynamic",
".",
"nexe",
"files",
"and",
"put",
"them",
"in",
"a",
"temporary",
"directory",
"with",
"their",
"dependencies",
"staged",
"in",
"the",
"same",
"directory",
"."
] | def _CreateDynamicAndStageDeps(self, arch_path=None, **kwargs):
arch_path = arch_path or {}
nexes = []
for arch in ('x86_64', 'x86_32', 'arm'):
nexe_name = 'test_dynamic_%s.nexe' % arch
rel_nexe = os.path.join(arch_path.get(arch, ''), nexe_name)
arch_alt = 'i686' if arch == 'x86_32' else a... | [
"def",
"_CreateDynamicAndStageDeps",
"(",
"self",
",",
"arch_path",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"arch_path",
"=",
"arch_path",
"or",
"{",
"}",
"nexes",
"=",
"[",
"]",
"for",
"arch",
"in",
"(",
"'x86_64'",
",",
"'x86_32'",
",",
"'arm'",
... | Create dynamic .nexe files and put them in a temporary directory, with
their dependencies staged in the same directory. | [
"Create",
"dynamic",
".",
"nexe",
"files",
"and",
"put",
"them",
"in",
"a",
"temporary",
"directory",
"with",
"their",
"dependencies",
"staged",
"in",
"the",
"same",
"directory",
"."
] | [
"\"\"\"Create dynamic .nexe files and put them in a temporary directory, with\n their dependencies staged in the same directory.\n\n Args:\n arch_path: A dictionary mapping architecture to the directory to generate\n the .nexe for the architecture in.\n kwargs: Keyword arguments to pass thr... | [
{
"param": "self",
"type": null
},
{
"param": "arch_path",
"type": null
}
] | {
"returns": [
{
"docstring": "A tuple with 2 elements:\nThe generated NMF as a dictionary\nA list of the generated .nexe paths",
"docstring_tokens": [
"A",
"tuple",
"with",
"2",
"elements",
":",
"The",
"generated",
"NMF",
... |
e6f87b478213a4ea16379d359266322413128d62 | sunlongbo/chromium | native_client_sdk/src/tools/tests/create_nmf_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | assertManifestEquals | <not_specific> | def assertManifestEquals(self, manifest, expected):
"""Compare two manifest dictionaries.
The input manifest is regenerated with all string keys and values being
processed through StripSo, to remove the random hexidecimal characters at
the end of shared object names.
Args:
manifest: The gene... | Compare two manifest dictionaries.
The input manifest is regenerated with all string keys and values being
processed through StripSo, to remove the random hexidecimal characters at
the end of shared object names.
Args:
manifest: The generated manifest.
expected: The expected manifest.
| Compare two manifest dictionaries.
The input manifest is regenerated with all string keys and values being
processed through StripSo, to remove the random hexidecimal characters at
the end of shared object names. | [
"Compare",
"two",
"manifest",
"dictionaries",
".",
"The",
"input",
"manifest",
"is",
"regenerated",
"with",
"all",
"string",
"keys",
"and",
"values",
"being",
"processed",
"through",
"StripSo",
"to",
"remove",
"the",
"random",
"hexidecimal",
"characters",
"at",
... | def assertManifestEquals(self, manifest, expected):
def StripSoCopyDict(d):
new_d = {}
for k, v in d.iteritems():
new_k = StripSo(k)
if isinstance(v, (str, unicode)):
new_v = StripSo(v)
elif isinstance(v, list):
new_v = v[:]
elif isinstance(v, dict):
... | [
"def",
"assertManifestEquals",
"(",
"self",
",",
"manifest",
",",
"expected",
")",
":",
"def",
"StripSoCopyDict",
"(",
"d",
")",
":",
"new_d",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"d",
".",
"iteritems",
"(",
")",
":",
"new_k",
"=",
"StripSo",
... | Compare two manifest dictionaries. | [
"Compare",
"two",
"manifest",
"dictionaries",
"."
] | [
"\"\"\"Compare two manifest dictionaries.\n\n The input manifest is regenerated with all string keys and values being\n processed through StripSo, to remove the random hexidecimal characters at\n the end of shared object names.\n\n Args:\n manifest: The generated manifest.\n expected: The expe... | [
{
"param": "self",
"type": null
},
{
"param": "manifest",
"type": null
},
{
"param": "expected",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "manifest",
"type": null,
"docstring": "The generated manifest.",
... |
e6f87b478213a4ea16379d359266322413128d62 | sunlongbo/chromium | native_client_sdk/src/tools/tests/create_nmf_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testDynamicWithRelPath | null | def testDynamicWithRelPath(self):
"""Test that when the nmf root is a relative path that things work."""
old_path = os.getcwd()
try:
os.chdir(self.tempdir)
nmf, nexes = self._CreateDynamicAndStageDeps(self.arch_dir, nmf_root='')
expected_manifest = {
'files': {
'main.nexe... | Test that when the nmf root is a relative path that things work. | Test that when the nmf root is a relative path that things work. | [
"Test",
"that",
"when",
"the",
"nmf",
"root",
"is",
"a",
"relative",
"path",
"that",
"things",
"work",
"."
] | def testDynamicWithRelPath(self):
old_path = os.getcwd()
try:
os.chdir(self.tempdir)
nmf, nexes = self._CreateDynamicAndStageDeps(self.arch_dir, nmf_root='')
expected_manifest = {
'files': {
'main.nexe': {
'arm': {'url': 'arm/test_dynamic_arm.nexe'},
'... | [
"def",
"testDynamicWithRelPath",
"(",
"self",
")",
":",
"old_path",
"=",
"os",
".",
"getcwd",
"(",
")",
"try",
":",
"os",
".",
"chdir",
"(",
"self",
".",
"tempdir",
")",
"nmf",
",",
"nexes",
"=",
"self",
".",
"_CreateDynamicAndStageDeps",
"(",
"self",
... | Test that when the nmf root is a relative path that things work. | [
"Test",
"that",
"when",
"the",
"nmf",
"root",
"is",
"a",
"relative",
"path",
"that",
"things",
"work",
"."
] | [
"\"\"\"Test that when the nmf root is a relative path that things work.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1f76c3ff7c6371a698ba9d7b54514172f015c91d | sunlongbo/chromium | tools/perf/page_sets/login_helpers/chrome_login.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetGaiaContext | <not_specific> | def GetGaiaContext(tab):
"""Returns Gaia's login page context."""
for context in tab.GetWebviewContexts():
if context.GetUrl().startswith('https://accounts.google.com/'):
return context
return None | Returns Gaia's login page context. | Returns Gaia's login page context. | [
"Returns",
"Gaia",
"'",
"s",
"login",
"page",
"context",
"."
] | def GetGaiaContext(tab):
for context in tab.GetWebviewContexts():
if context.GetUrl().startswith('https://accounts.google.com/'):
return context
return None | [
"def",
"GetGaiaContext",
"(",
"tab",
")",
":",
"for",
"context",
"in",
"tab",
".",
"GetWebviewContexts",
"(",
")",
":",
"if",
"context",
".",
"GetUrl",
"(",
")",
".",
"startswith",
"(",
"'https://accounts.google.com/'",
")",
":",
"return",
"context",
"return... | Returns Gaia's login page context. | [
"Returns",
"Gaia",
"'",
"s",
"login",
"page",
"context",
"."
] | [
"\"\"\"Returns Gaia's login page context.\"\"\""
] | [
{
"param": "tab",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tab",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1f76c3ff7c6371a698ba9d7b54514172f015c91d | sunlongbo/chromium | tools/perf/page_sets/login_helpers/chrome_login.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | LoginChromeAccount | null | def LoginChromeAccount(action_runner, credential,
credentials_path=login_utils.DEFAULT_CREDENTIAL_PATH):
"""Logs in a Gaia account into Chrome.
This function navigates the tab into Chrome's login page and logs in a user
using credentials in |credential| part of the |credentials_path| file.... | Logs in a Gaia account into Chrome.
This function navigates the tab into Chrome's login page and logs in a user
using credentials in |credential| part of the |credentials_path| file.
Args:
action_runner: Action runner responsible for running actions on the page.
credential: The credential to retrieve fr... | Logs in a Gaia account into Chrome.
This function navigates the tab into Chrome's login page and logs in a user
using credentials in |credential| part of the |credentials_path| file. | [
"Logs",
"in",
"a",
"Gaia",
"account",
"into",
"Chrome",
".",
"This",
"function",
"navigates",
"the",
"tab",
"into",
"Chrome",
"'",
"s",
"login",
"page",
"and",
"logs",
"in",
"a",
"user",
"using",
"credentials",
"in",
"|credential|",
"part",
"of",
"the",
... | def LoginChromeAccount(action_runner, credential,
credentials_path=login_utils.DEFAULT_CREDENTIAL_PATH):
account_name, password = login_utils.GetAccountNameAndPassword(
credential, credentials_path=credentials_path)
action_runner.Navigate('chrome://chrome-signin')
gaia_context = py_ut... | [
"def",
"LoginChromeAccount",
"(",
"action_runner",
",",
"credential",
",",
"credentials_path",
"=",
"login_utils",
".",
"DEFAULT_CREDENTIAL_PATH",
")",
":",
"account_name",
",",
"password",
"=",
"login_utils",
".",
"GetAccountNameAndPassword",
"(",
"credential",
",",
... | Logs in a Gaia account into Chrome. | [
"Logs",
"in",
"a",
"Gaia",
"account",
"into",
"Chrome",
"."
] | [
"\"\"\"Logs in a Gaia account into Chrome.\n\n This function navigates the tab into Chrome's login page and logs in a user\n using credentials in |credential| part of the |credentials_path| file.\n\n Args:\n action_runner: Action runner responsible for running actions on the page.\n credential: The credent... | [
{
"param": "action_runner",
"type": null
},
{
"param": "credential",
"type": null
},
{
"param": "credentials_path",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "See GetWebviewContexts() and ExecuteJavaScript()\nfor a detailed list of possible exceptions.",
"docstring_tokens": [
"See",
"GetWebviewContexts",
"()",
"and",
"ExecuteJavaScript",
"()",
"for",
... |
b0447604ecc229cbc8726d884753599578abf5d6 | sunlongbo/chromium | testing/scripts/run_finch_smoke_tests_android.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _wait_for_local_state_file | <not_specific> | def _wait_for_local_state_file(self, browser_pkg_name):
"""Wait for local state file to be generated
Args:
browser_pkg_name: Name of the browser package
Returns
None
"""
max_wait_time_secs = 120
delta_secs = 10
total_wait_time_secs = 0
app_data_dir = posixpath.join(
... | Wait for local state file to be generated
Args:
browser_pkg_name: Name of the browser package
Returns
None
| Wait for local state file to be generated | [
"Wait",
"for",
"local",
"state",
"file",
"to",
"be",
"generated"
] | def _wait_for_local_state_file(self, browser_pkg_name):
max_wait_time_secs = 120
delta_secs = 10
total_wait_time_secs = 0
app_data_dir = posixpath.join(
self.device.GetApplicationDataDirectory(browser_pkg_name),
self.app_user_sub_dir())
local_state_file = posixpath.join(app_data_dir,... | [
"def",
"_wait_for_local_state_file",
"(",
"self",
",",
"browser_pkg_name",
")",
":",
"max_wait_time_secs",
"=",
"120",
"delta_secs",
"=",
"10",
"total_wait_time_secs",
"=",
"0",
"app_data_dir",
"=",
"posixpath",
".",
"join",
"(",
"self",
".",
"device",
".",
"Get... | Wait for local state file to be generated | [
"Wait",
"for",
"local",
"state",
"file",
"to",
"be",
"generated"
] | [
"\"\"\"Wait for local state file to be generated\n\n Args:\n browser_pkg_name: Name of the browser package\n\n Returns\n None\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "browser_pkg_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "browser_pkg_name",
"type": null,
"docstring": "Name of the browser ... |
b04c31831db038f2267f2687e3a7db77ef44526a | sunlongbo/chromium | tools/metrics/histograms/pretty_print.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PrettyPrintHistogramsTree | <not_specific> | def PrettyPrintHistogramsTree(tree):
"""Pretty-print the given ElementTree element.
Args:
tree: The ElementTree element.
Returns:
The pretty-printed version as an XML string.
"""
# Prevent accidentally adding enums to histograms.xml
DropNodesByTagName(tree, 'enums')
FixMisplacedHistogramsAndHist... | Pretty-print the given ElementTree element.
Args:
tree: The ElementTree element.
Returns:
The pretty-printed version as an XML string.
| Pretty-print the given ElementTree element. | [
"Pretty",
"-",
"print",
"the",
"given",
"ElementTree",
"element",
"."
] | def PrettyPrintHistogramsTree(tree):
DropNodesByTagName(tree, 'enums')
FixMisplacedHistogramsAndHistogramSuffixes(tree)
canonicalizeUnits(tree)
fixObsoleteOrder(tree)
return histogram_configuration_model.PrettifyTree(tree) | [
"def",
"PrettyPrintHistogramsTree",
"(",
"tree",
")",
":",
"DropNodesByTagName",
"(",
"tree",
",",
"'enums'",
")",
"FixMisplacedHistogramsAndHistogramSuffixes",
"(",
"tree",
")",
"canonicalizeUnits",
"(",
"tree",
")",
"fixObsoleteOrder",
"(",
"tree",
")",
"return",
... | Pretty-print the given ElementTree element. | [
"Pretty",
"-",
"print",
"the",
"given",
"ElementTree",
"element",
"."
] | [
"\"\"\"Pretty-print the given ElementTree element.\n\n Args:\n tree: The ElementTree element.\n\n Returns:\n The pretty-printed version as an XML string.\n \"\"\"",
"# Prevent accidentally adding enums to histograms.xml"
] | [
{
"param": "tree",
"type": null
}
] | {
"returns": [
{
"docstring": "The pretty-printed version as an XML string.",
"docstring_tokens": [
"The",
"pretty",
"-",
"printed",
"version",
"as",
"an",
"XML",
"string",
"."
],
"type": null
}
],
"rai... |
b04c31831db038f2267f2687e3a7db77ef44526a | sunlongbo/chromium | tools/metrics/histograms/pretty_print.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PrettyPrintEnums | <not_specific> | def PrettyPrintEnums(raw_xml):
"""Pretty print the given enums XML."""
root = etree_util.ParseXMLString(raw_xml)
# Prevent accidentally adding histograms to enums.xml
DropNodesByTagName(root, 'histograms')
DropNodesByTagName(root, 'histogram_suffixes_list')
top_level_content = etree_util.GetTopLevelConten... | Pretty print the given enums XML. | Pretty print the given enums XML. | [
"Pretty",
"print",
"the",
"given",
"enums",
"XML",
"."
] | def PrettyPrintEnums(raw_xml):
root = etree_util.ParseXMLString(raw_xml)
DropNodesByTagName(root, 'histograms')
DropNodesByTagName(root, 'histogram_suffixes_list')
top_level_content = etree_util.GetTopLevelContent(raw_xml)
formatted_xml = histogram_configuration_model.PrettifyTree(root)
return top_level_con... | [
"def",
"PrettyPrintEnums",
"(",
"raw_xml",
")",
":",
"root",
"=",
"etree_util",
".",
"ParseXMLString",
"(",
"raw_xml",
")",
"DropNodesByTagName",
"(",
"root",
",",
"'histograms'",
")",
"DropNodesByTagName",
"(",
"root",
",",
"'histogram_suffixes_list'",
")",
"top_... | Pretty print the given enums XML. | [
"Pretty",
"print",
"the",
"given",
"enums",
"XML",
"."
] | [
"\"\"\"Pretty print the given enums XML.\"\"\"",
"# Prevent accidentally adding histograms to enums.xml"
] | [
{
"param": "raw_xml",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "raw_xml",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b04c31831db038f2267f2687e3a7db77ef44526a | sunlongbo/chromium | tools/metrics/histograms/pretty_print.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | main | null | def main():
"""Pretty-prints the histograms or enums xml file at given relative path.
Args:
filepath: The relative path to xml file.
--non-interactive: (Optional) Does not print log info messages and does not
prompt user to accept the diff.
--presubmit: (Optional) Simply prints a message if the... | Pretty-prints the histograms or enums xml file at given relative path.
Args:
filepath: The relative path to xml file.
--non-interactive: (Optional) Does not print log info messages and does not
prompt user to accept the diff.
--presubmit: (Optional) Simply prints a message if the input is not
... | Pretty-prints the histograms or enums xml file at given relative path. | [
"Pretty",
"-",
"prints",
"the",
"histograms",
"or",
"enums",
"xml",
"file",
"at",
"given",
"relative",
"path",
"."
] | def main():
parser = argparse.ArgumentParser()
parser.add_argument('filepath', help="relative path to XML file")
parser.add_argument('--non-interactive', action="store_true")
parser.add_argument('--presubmit', action="store_true")
parser.add_argument('--diff', action="store_true")
args = parser.parse_args()... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'filepath'",
",",
"help",
"=",
"\"relative path to XML file\"",
")",
"parser",
".",
"add_argument",
"(",
"'--non-interactive'",
",",
... | Pretty-prints the histograms or enums xml file at given relative path. | [
"Pretty",
"-",
"prints",
"the",
"histograms",
"or",
"enums",
"xml",
"file",
"at",
"given",
"relative",
"path",
"."
] | [
"\"\"\"Pretty-prints the histograms or enums xml file at given relative path.\n\n Args:\n filepath: The relative path to xml file.\n --non-interactive: (Optional) Does not print log info messages and does not\n prompt user to accept the diff.\n --presubmit: (Optional) Simply prints a message if the... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [
{
"identifier": "filepath",
"type": null,
"docstring": "The relative path to xml file.",
"docstring_tokens": [
"The",
"relative",
"path",
"to",
"xml",
"file",
"."
... |
3a20ef744ab806be04f531749a06978b2335d194 | sunlongbo/chromium | tools/metrics/actions/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckChange | <not_specific> | def CheckChange(input_api, output_api):
"""Checks that actions.xml is up to date and pretty-printed."""
for f in input_api.AffectedTextFiles():
p = f.AbsoluteLocalPath()
if (input_api.basename(p) == 'actions.xml'
and input_api.os_path.dirname(p) == input_api.PresubmitLocalPath()):
cwd = input_... | Checks that actions.xml is up to date and pretty-printed. | Checks that actions.xml is up to date and pretty-printed. | [
"Checks",
"that",
"actions",
".",
"xml",
"is",
"up",
"to",
"date",
"and",
"pretty",
"-",
"printed",
"."
] | def CheckChange(input_api, output_api):
for f in input_api.AffectedTextFiles():
p = f.AbsoluteLocalPath()
if (input_api.basename(p) == 'actions.xml'
and input_api.os_path.dirname(p) == input_api.PresubmitLocalPath()):
cwd = input_api.os_path.dirname(p)
exit_code = input_api.subprocess.call... | [
"def",
"CheckChange",
"(",
"input_api",
",",
"output_api",
")",
":",
"for",
"f",
"in",
"input_api",
".",
"AffectedTextFiles",
"(",
")",
":",
"p",
"=",
"f",
".",
"AbsoluteLocalPath",
"(",
")",
"if",
"(",
"input_api",
".",
"basename",
"(",
"p",
")",
"=="... | Checks that actions.xml is up to date and pretty-printed. | [
"Checks",
"that",
"actions",
".",
"xml",
"is",
"up",
"to",
"date",
"and",
"pretty",
"-",
"printed",
"."
] | [
"\"\"\"Checks that actions.xml is up to date and pretty-printed.\"\"\""
] | [
{
"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... |
da7b279c6565b34d945ce0578fa295c695ede975 | sunlongbo/chromium | tools/perf/core/services/dashboard_service.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Request | <not_specific> | def Request(endpoint, **kwargs):
"""Send a request to some dashboard service endpoint."""
kwargs.setdefault('use_auth', True)
kwargs.setdefault('method', 'POST')
kwargs.setdefault('accept', 'json')
return request.Request(SERVICE_URL + endpoint, **kwargs) | Send a request to some dashboard service endpoint. | Send a request to some dashboard service endpoint. | [
"Send",
"a",
"request",
"to",
"some",
"dashboard",
"service",
"endpoint",
"."
] | def Request(endpoint, **kwargs):
kwargs.setdefault('use_auth', True)
kwargs.setdefault('method', 'POST')
kwargs.setdefault('accept', 'json')
return request.Request(SERVICE_URL + endpoint, **kwargs) | [
"def",
"Request",
"(",
"endpoint",
",",
"**",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'use_auth'",
",",
"True",
")",
"kwargs",
".",
"setdefault",
"(",
"'method'",
",",
"'POST'",
")",
"kwargs",
".",
"setdefault",
"(",
"'accept'",
",",
"'jso... | Send a request to some dashboard service endpoint. | [
"Send",
"a",
"request",
"to",
"some",
"dashboard",
"service",
"endpoint",
"."
] | [
"\"\"\"Send a request to some dashboard service endpoint.\"\"\""
] | [
{
"param": "endpoint",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "endpoint",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
da7b279c6565b34d945ce0578fa295c695ede975 | sunlongbo/chromium | tools/perf/core/services/dashboard_service.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Describe | <not_specific> | def Describe(test_suite):
"""Obtain information about a given test_suite.
Args:
test_suite: A string with the name of the test suite.
Returns:
A dict with information about: bots, caseTags, cases, and measurements.
"""
return Request('/api/describe', params={'test_suite': test_suite}) | Obtain information about a given test_suite.
Args:
test_suite: A string with the name of the test suite.
Returns:
A dict with information about: bots, caseTags, cases, and measurements.
| Obtain information about a given test_suite. | [
"Obtain",
"information",
"about",
"a",
"given",
"test_suite",
"."
] | def Describe(test_suite):
return Request('/api/describe', params={'test_suite': test_suite}) | [
"def",
"Describe",
"(",
"test_suite",
")",
":",
"return",
"Request",
"(",
"'/api/describe'",
",",
"params",
"=",
"{",
"'test_suite'",
":",
"test_suite",
"}",
")"
] | Obtain information about a given test_suite. | [
"Obtain",
"information",
"about",
"a",
"given",
"test_suite",
"."
] | [
"\"\"\"Obtain information about a given test_suite.\n\n Args:\n test_suite: A string with the name of the test suite.\n\n Returns:\n A dict with information about: bots, caseTags, cases, and measurements.\n \"\"\""
] | [
{
"param": "test_suite",
"type": null
}
] | {
"returns": [
{
"docstring": "A dict with information about: bots, caseTags, cases, and measurements.",
"docstring_tokens": [
"A",
"dict",
"with",
"information",
"about",
":",
"bots",
"caseTags",
"cases",
"and",
"... |
da7b279c6565b34d945ce0578fa295c695ede975 | sunlongbo/chromium | tools/perf/core/services/dashboard_service.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Timeseries2 | <not_specific> | def Timeseries2(**kwargs):
"""Get timeseries data for a particular test path.
Args:
test_suite: A string with the test suite or benchmark name.
measurement: A string with the metric name, e.g. timeToFirstContentfulPaint.
bot: A string with the bot name, usually of the form 'master:builder'.
columns... | Get timeseries data for a particular test path.
Args:
test_suite: A string with the test suite or benchmark name.
measurement: A string with the metric name, e.g. timeToFirstContentfulPaint.
bot: A string with the bot name, usually of the form 'master:builder'.
columns: A string with a comma separate... | Get timeseries data for a particular test path.
Args:
test_suite: A string with the test suite or benchmark name.
measurement: A string with the metric name, e.g.
A dict with timeseries data, alerts, Histograms, and SparseDiagnostics.
TypeError if any required arguments are missing.
KeyError if the timeseries is not ... | [
"Get",
"timeseries",
"data",
"for",
"a",
"particular",
"test",
"path",
".",
"Args",
":",
"test_suite",
":",
"A",
"string",
"with",
"the",
"test",
"suite",
"or",
"benchmark",
"name",
".",
"measurement",
":",
"A",
"string",
"with",
"the",
"metric",
"name",
... | def Timeseries2(**kwargs):
for col in ('test_suite', 'measurement', 'bot', 'columns'):
if col not in kwargs:
raise TypeError('Missing required argument: %s' % col)
try:
return Request('/api/timeseries2', params=kwargs)
except request.ClientError as exc:
if exc.response.status == 404:
raise... | [
"def",
"Timeseries2",
"(",
"**",
"kwargs",
")",
":",
"for",
"col",
"in",
"(",
"'test_suite'",
",",
"'measurement'",
",",
"'bot'",
",",
"'columns'",
")",
":",
"if",
"col",
"not",
"in",
"kwargs",
":",
"raise",
"TypeError",
"(",
"'Missing required argument: %s'... | Get timeseries data for a particular test path. | [
"Get",
"timeseries",
"data",
"for",
"a",
"particular",
"test",
"path",
"."
] | [
"\"\"\"Get timeseries data for a particular test path.\n\n Args:\n test_suite: A string with the test suite or benchmark name.\n measurement: A string with the metric name, e.g. timeToFirstContentfulPaint.\n bot: A string with the bot name, usually of the form 'master:builder'.\n columns: A string with... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
da7b279c6565b34d945ce0578fa295c695ede975 | sunlongbo/chromium | tools/perf/core/services/dashboard_service.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Timeseries | <not_specific> | def Timeseries(test_path, days=30):
"""Get timeseries for the given test path.
TODO(crbug.com/907121): Remove when no longer needed.
Args:
test_path: test path to get timeseries for.
days: Number of days to get data points for.
Returns:
A dict with timeseries data for the given test_path
Raise... | Get timeseries for the given test path.
TODO(crbug.com/907121): Remove when no longer needed.
Args:
test_path: test path to get timeseries for.
days: Number of days to get data points for.
Returns:
A dict with timeseries data for the given test_path
Raises:
KeyError if the test_path is not f... | Get timeseries for the given test path.
TODO(crbug.com/907121): Remove when no longer needed.
test path to get timeseries for.
days: Number of days to get data points for.
A dict with timeseries data for the given test_path
KeyError if the test_path is not found. | [
"Get",
"timeseries",
"for",
"the",
"given",
"test",
"path",
".",
"TODO",
"(",
"crbug",
".",
"com",
"/",
"907121",
")",
":",
"Remove",
"when",
"no",
"longer",
"needed",
".",
"test",
"path",
"to",
"get",
"timeseries",
"for",
".",
"days",
":",
"Number",
... | def Timeseries(test_path, days=30):
try:
return Request('/api/timeseries/%s' %
six.moves.urllib.parse.quote(test_path),
params={'num_days': days})
except request.ClientError as exc:
if 'Invalid test_path' in exc.json['error']:
raise KeyError(test_path)
else:
... | [
"def",
"Timeseries",
"(",
"test_path",
",",
"days",
"=",
"30",
")",
":",
"try",
":",
"return",
"Request",
"(",
"'/api/timeseries/%s'",
"%",
"six",
".",
"moves",
".",
"urllib",
".",
"parse",
".",
"quote",
"(",
"test_path",
")",
",",
"params",
"=",
"{",
... | Get timeseries for the given test path. | [
"Get",
"timeseries",
"for",
"the",
"given",
"test",
"path",
"."
] | [
"\"\"\"Get timeseries for the given test path.\n\n TODO(crbug.com/907121): Remove when no longer needed.\n\n Args:\n test_path: test path to get timeseries for.\n days: Number of days to get data points for.\n\n Returns:\n A dict with timeseries data for the given test_path\n\n Raises:\n KeyError if... | [
{
"param": "test_path",
"type": null
},
{
"param": "days",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "test_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "days",
"type": null,
"docstring": null,
"docstring_token... |
da7b279c6565b34d945ce0578fa295c695ede975 | sunlongbo/chromium | tools/perf/core/services/dashboard_service.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MatchTestPaths | <not_specific> | def MatchTestPaths(pattern, only_with_rows=False):
"""Lists test paths matching a given pattern.
The exact semantics of these patterns is defined by the implementation of
the dashboard.common.utils.TestMatchesPattern function.
Args:
pattern: String with glob-like pattern notation to match.
only_with_r... | Lists test paths matching a given pattern.
The exact semantics of these patterns is defined by the implementation of
the dashboard.common.utils.TestMatchesPattern function.
Args:
pattern: String with glob-like pattern notation to match.
only_with_rows: Only match test paths which have data points.
Re... | Lists test paths matching a given pattern.
The exact semantics of these patterns is defined by the implementation of
the dashboard.common.utils.TestMatchesPattern function. | [
"Lists",
"test",
"paths",
"matching",
"a",
"given",
"pattern",
".",
"The",
"exact",
"semantics",
"of",
"these",
"patterns",
"is",
"defined",
"by",
"the",
"implementation",
"of",
"the",
"dashboard",
".",
"common",
".",
"utils",
".",
"TestMatchesPattern",
"funct... | def MatchTestPaths(pattern, only_with_rows=False):
params = {'type': 'pattern', 'p': pattern}
if only_with_rows:
params['has_rows'] = '1'
return Request('/list_tests', params=params) | [
"def",
"MatchTestPaths",
"(",
"pattern",
",",
"only_with_rows",
"=",
"False",
")",
":",
"params",
"=",
"{",
"'type'",
":",
"'pattern'",
",",
"'p'",
":",
"pattern",
"}",
"if",
"only_with_rows",
":",
"params",
"[",
"'has_rows'",
"]",
"=",
"'1'",
"return",
... | Lists test paths matching a given pattern. | [
"Lists",
"test",
"paths",
"matching",
"a",
"given",
"pattern",
"."
] | [
"\"\"\"Lists test paths matching a given pattern.\n\n The exact semantics of these patterns is defined by the implementation of\n the dashboard.common.utils.TestMatchesPattern function.\n\n Args:\n pattern: String with glob-like pattern notation to match.\n only_with_rows: Only match test paths which have ... | [
{
"param": "pattern",
"type": null
},
{
"param": "only_with_rows",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of test paths. Ex.",
"docstring_tokens": [
"A",
"list",
"of",
"test",
"paths",
".",
"Ex",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "pattern",
... |
da7b279c6565b34d945ce0578fa295c695ede975 | sunlongbo/chromium | tools/perf/core/services/dashboard_service.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | IterAlerts | <not_specific> | def IterAlerts(**kwargs):
"""Returns alerts matching the supplied query parameters.
The response for the dashboard may be returned in multiple chunks, this
function will take care of following `next_cursor`s in responses and
iterate over all the chunks.
Args:
test_suite: Match alerts on a given test sui... | Returns alerts matching the supplied query parameters.
The response for the dashboard may be returned in multiple chunks, this
function will take care of following `next_cursor`s in responses and
iterate over all the chunks.
Args:
test_suite: Match alerts on a given test suite (benchmark).
sheriff: Ma... | Returns alerts matching the supplied query parameters.
The response for the dashboard may be returned in multiple chunks, this
function will take care of following `next_cursor`s in responses and
iterate over all the chunks. | [
"Returns",
"alerts",
"matching",
"the",
"supplied",
"query",
"parameters",
".",
"The",
"response",
"for",
"the",
"dashboard",
"may",
"be",
"returned",
"in",
"multiple",
"chunks",
"this",
"function",
"will",
"take",
"care",
"of",
"following",
"`",
"next_cursor",
... | def IterAlerts(**kwargs):
kwargs.setdefault('limit', 1000)
while True:
response = Request('/api/alerts', params=kwargs)
yield response
if 'next_cursor' in response:
kwargs['cursor'] = response['next_cursor']
else:
return | [
"def",
"IterAlerts",
"(",
"**",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'limit'",
",",
"1000",
")",
"while",
"True",
":",
"response",
"=",
"Request",
"(",
"'/api/alerts'",
",",
"params",
"=",
"kwargs",
")",
"yield",
"response",
"if",
"'nex... | Returns alerts matching the supplied query parameters. | [
"Returns",
"alerts",
"matching",
"the",
"supplied",
"query",
"parameters",
"."
] | [
"\"\"\"Returns alerts matching the supplied query parameters.\n\n The response for the dashboard may be returned in multiple chunks, this\n function will take care of following `next_cursor`s in responses and\n iterate over all the chunks.\n\n Args:\n test_suite: Match alerts on a given test suite (benchmark... | [] | {
"returns": [
{
"docstring": "Data for all the matching alerts in chunks.",
"docstring_tokens": [
"Data",
"for",
"all",
"the",
"matching",
"alerts",
"in",
"chunks",
"."
],
"type": null
}
],
"raises": [],
"pa... |
7421e6f92c031ce5d378749a4b145486acd14afd | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/runtime_enabled_features.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | is_context_dependent | <not_specific> | def is_context_dependent(cls, feature_name):
"""Returns True if the feature may be enabled per-context."""
assert cls._is_initialized, cls._REQUIRE_INIT_MESSAGE
assert isinstance(feature_name, str)
assert feature_name in cls._features, (
"Unknown runtime-enabled feature: {}".... | Returns True if the feature may be enabled per-context. | Returns True if the feature may be enabled per-context. | [
"Returns",
"True",
"if",
"the",
"feature",
"may",
"be",
"enabled",
"per",
"-",
"context",
"."
] | def is_context_dependent(cls, feature_name):
assert cls._is_initialized, cls._REQUIRE_INIT_MESSAGE
assert isinstance(feature_name, str)
assert feature_name in cls._features, (
"Unknown runtime-enabled feature: {}".format(feature_name))
return cls._features[feature_name].get(
... | [
"def",
"is_context_dependent",
"(",
"cls",
",",
"feature_name",
")",
":",
"assert",
"cls",
".",
"_is_initialized",
",",
"cls",
".",
"_REQUIRE_INIT_MESSAGE",
"assert",
"isinstance",
"(",
"feature_name",
",",
"str",
")",
"assert",
"feature_name",
"in",
"cls",
".",... | Returns True if the feature may be enabled per-context. | [
"Returns",
"True",
"if",
"the",
"feature",
"may",
"be",
"enabled",
"per",
"-",
"context",
"."
] | [
"\"\"\"Returns True if the feature may be enabled per-context.\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "feature_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "feature_name",
"type": null,
"docstring": null,
"docstring_tok... |
75db467bc5af6858d7d3160ff8920081bd9b2fa6 | sunlongbo/chromium | net/data/gencerts/openssl_conf.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ensure_property_name_not_duplicated | null | def ensure_property_name_not_duplicated(self, name):
"""Raises an exception of there is more than 1 property named |name|."""
count = 0
for prop in self.properties:
if prop.name == name:
count += 1
if count > 1:
raise Exception('Duplicate property: %s' % (name)) | Raises an exception of there is more than 1 property named |name|. | Raises an exception of there is more than 1 property named |name|. | [
"Raises",
"an",
"exception",
"of",
"there",
"is",
"more",
"than",
"1",
"property",
"named",
"|name|",
"."
] | def ensure_property_name_not_duplicated(self, name):
count = 0
for prop in self.properties:
if prop.name == name:
count += 1
if count > 1:
raise Exception('Duplicate property: %s' % (name)) | [
"def",
"ensure_property_name_not_duplicated",
"(",
"self",
",",
"name",
")",
":",
"count",
"=",
"0",
"for",
"prop",
"in",
"self",
".",
"properties",
":",
"if",
"prop",
".",
"name",
"==",
"name",
":",
"count",
"+=",
"1",
"if",
"count",
">",
"1",
":",
... | Raises an exception of there is more than 1 property named |name|. | [
"Raises",
"an",
"exception",
"of",
"there",
"is",
"more",
"than",
"1",
"property",
"named",
"|name|",
"."
] | [
"\"\"\"Raises an exception of there is more than 1 property named |name|.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [... |
75db467bc5af6858d7d3160ff8920081bd9b2fa6 | sunlongbo/chromium | net/data/gencerts/openssl_conf.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | remove_property | <not_specific> | def remove_property(self, name):
"""Removes the property with the indicated name, if it exists.
It is expected that there is AT MOST 1 property with the given name. If
that is not the case then this function will raise an error."""
self.ensure_property_name_not_duplicated(name)
for i in range(len(... | Removes the property with the indicated name, if it exists.
It is expected that there is AT MOST 1 property with the given name. If
that is not the case then this function will raise an error. | Removes the property with the indicated name, if it exists.
It is expected that there is AT MOST 1 property with the given name. If
that is not the case then this function will raise an error. | [
"Removes",
"the",
"property",
"with",
"the",
"indicated",
"name",
"if",
"it",
"exists",
".",
"It",
"is",
"expected",
"that",
"there",
"is",
"AT",
"MOST",
"1",
"property",
"with",
"the",
"given",
"name",
".",
"If",
"that",
"is",
"not",
"the",
"case",
"t... | def remove_property(self, name):
self.ensure_property_name_not_duplicated(name)
for i in range(len(self.properties)):
if self.properties[i].name == name:
self.properties.pop(i)
return | [
"def",
"remove_property",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"ensure_property_name_not_duplicated",
"(",
"name",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"properties",
")",
")",
":",
"if",
"self",
".",
"properties",
"["... | Removes the property with the indicated name, if it exists. | [
"Removes",
"the",
"property",
"with",
"the",
"indicated",
"name",
"if",
"it",
"exists",
"."
] | [
"\"\"\"Removes the property with the indicated name, if it exists.\n\n It is expected that there is AT MOST 1 property with the given name. If\n that is not the case then this function will raise an error.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [... |
75db467bc5af6858d7d3160ff8920081bd9b2fa6 | sunlongbo/chromium | net/data/gencerts/openssl_conf.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | write_to | null | def write_to(self, out):
"""Outputs the section in the format used by .cnf files"""
out.write('[%s]\n' % (self.name))
for prop in self.properties:
prop.write_to(out)
out.write('\n') | Outputs the section in the format used by .cnf files | Outputs the section in the format used by .cnf files | [
"Outputs",
"the",
"section",
"in",
"the",
"format",
"used",
"by",
".",
"cnf",
"files"
] | def write_to(self, out):
out.write('[%s]\n' % (self.name))
for prop in self.properties:
prop.write_to(out)
out.write('\n') | [
"def",
"write_to",
"(",
"self",
",",
"out",
")",
":",
"out",
".",
"write",
"(",
"'[%s]\\n'",
"%",
"(",
"self",
".",
"name",
")",
")",
"for",
"prop",
"in",
"self",
".",
"properties",
":",
"prop",
".",
"write_to",
"(",
"out",
")",
"out",
".",
"writ... | Outputs the section in the format used by .cnf files | [
"Outputs",
"the",
"section",
"in",
"the",
"format",
"used",
"by",
".",
"cnf",
"files"
] | [
"\"\"\"Outputs the section in the format used by .cnf files\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "out",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "out",
"type": null,
"docstring": null,
"docstring_tokens": []... |
75db467bc5af6858d7d3160ff8920081bd9b2fa6 | sunlongbo/chromium | net/data/gencerts/openssl_conf.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | write_to_file | null | def write_to_file(self, path):
"""Outputs the Config to a .cnf files."""
with open(path, 'w') as out:
for section in self.sections:
section.write_to(out) | Outputs the Config to a .cnf files. | Outputs the Config to a .cnf files. | [
"Outputs",
"the",
"Config",
"to",
"a",
".",
"cnf",
"files",
"."
] | def write_to_file(self, path):
with open(path, 'w') as out:
for section in self.sections:
section.write_to(out) | [
"def",
"write_to_file",
"(",
"self",
",",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"'w'",
")",
"as",
"out",
":",
"for",
"section",
"in",
"self",
".",
"sections",
":",
"section",
".",
"write_to",
"(",
"out",
")"
] | Outputs the Config to a .cnf files. | [
"Outputs",
"the",
"Config",
"to",
"a",
".",
"cnf",
"files",
"."
] | [
"\"\"\"Outputs the Config to a .cnf files.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [... |
042adfa29ee87a290cff9199d0e4e9757f4482ef | sunlongbo/chromium | third_party/tensorflow-text/src/tensorflow_text/python/ops/whitespace_tokenizer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | tokenize_with_offsets | <not_specific> | def tokenize_with_offsets(self, input): # pylint: disable=redefined-builtin
"""Tokenizes a tensor of UTF-8 strings on whitespaces.
The strings are split on ICU defined whitespace characters. These
whitespace characters are dropped.
Args:
input: A `RaggedTensor`or `Tensor` of UTF-8 strings with ... | Tokenizes a tensor of UTF-8 strings on whitespaces.
The strings are split on ICU defined whitespace characters. These
whitespace characters are dropped.
Args:
input: A `RaggedTensor`or `Tensor` of UTF-8 strings with any shape.
Returns:
A tuple `(tokens, start_offsets, end_offsets)` where:... | Tokenizes a tensor of UTF-8 strings on whitespaces.
The strings are split on ICU defined whitespace characters. These
whitespace characters are dropped. | [
"Tokenizes",
"a",
"tensor",
"of",
"UTF",
"-",
"8",
"strings",
"on",
"whitespaces",
".",
"The",
"strings",
"are",
"split",
"on",
"ICU",
"defined",
"whitespace",
"characters",
".",
"These",
"whitespace",
"characters",
"are",
"dropped",
"."
] | def tokenize_with_offsets(self, input):
name = None
with ops.name_scope(name, "WhitespaceTokenize", [input]):
input_tensor = ragged_tensor.convert_to_tensor_or_ragged_tensor(input)
if input_tensor.shape.ndims is None:
raise ValueError("Rank of input_tensor must be statically known.")
... | [
"def",
"tokenize_with_offsets",
"(",
"self",
",",
"input",
")",
":",
"name",
"=",
"None",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"\"WhitespaceTokenize\"",
",",
"[",
"input",
"]",
")",
":",
"input_tensor",
"=",
"ragged_tensor",
".",
"convert_to_t... | Tokenizes a tensor of UTF-8 strings on whitespaces. | [
"Tokenizes",
"a",
"tensor",
"of",
"UTF",
"-",
"8",
"strings",
"on",
"whitespaces",
"."
] | [
"# pylint: disable=redefined-builtin",
"\"\"\"Tokenizes a tensor of UTF-8 strings on whitespaces.\n\n The strings are split on ICU defined whitespace characters. These\n whitespace characters are dropped.\n\n Args:\n input: A `RaggedTensor`or `Tensor` of UTF-8 strings with any shape.\n\n Returns:... | [
{
"param": "self",
"type": null
},
{
"param": "input",
"type": null
}
] | {
"returns": [
{
"docstring": "A tuple `(tokens, start_offsets, end_offsets)` where.\n\n`tokens`: A `RaggedTensor` of tokenized text.\n`start_offsets`: A `RaggedTensor` of the tokens' starting byte offset.\n`end_offsets`: A `RaggedTensor` of the tokens' ending byte offset.",
"docstring_tokens": [
... |
042adfa29ee87a290cff9199d0e4e9757f4482ef | sunlongbo/chromium | third_party/tensorflow-text/src/tensorflow_text/python/ops/whitespace_tokenizer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _whitespace_tokenize_with_offsets_encode_decode_wrapper | <not_specific> | def _whitespace_tokenize_with_offsets_encode_decode_wrapper(
self, input_tensor):
"""Tokenizes a tensor of UTF-8 strings with rank of 1.
Args:
input_tensor: The single dimensional Tensor to tokenize.
Returns:
Tuple of RaggedTensors of tokenized text and byte offsets, with shapes
[n... | Tokenizes a tensor of UTF-8 strings with rank of 1.
Args:
input_tensor: The single dimensional Tensor to tokenize.
Returns:
Tuple of RaggedTensors of tokenized text and byte offsets, with shapes
[num_strings, (num_tokens or num_offsets)].
| Tokenizes a tensor of UTF-8 strings with rank of 1. | [
"Tokenizes",
"a",
"tensor",
"of",
"UTF",
"-",
"8",
"strings",
"with",
"rank",
"of",
"1",
"."
] | def _whitespace_tokenize_with_offsets_encode_decode_wrapper(
self, input_tensor):
(codepoints, byte_start_offsets) = (
ragged_string_ops.unicode_decode_with_offsets(input_tensor, "UTF-8"))
byte_end_offsets = array_ops.concat([
byte_start_offsets[:, 1:],
math_ops.cast(
a... | [
"def",
"_whitespace_tokenize_with_offsets_encode_decode_wrapper",
"(",
"self",
",",
"input_tensor",
")",
":",
"(",
"codepoints",
",",
"byte_start_offsets",
")",
"=",
"(",
"ragged_string_ops",
".",
"unicode_decode_with_offsets",
"(",
"input_tensor",
",",
"\"UTF-8\"",
")",
... | Tokenizes a tensor of UTF-8 strings with rank of 1. | [
"Tokenizes",
"a",
"tensor",
"of",
"UTF",
"-",
"8",
"strings",
"with",
"rank",
"of",
"1",
"."
] | [
"\"\"\"Tokenizes a tensor of UTF-8 strings with rank of 1.\n\n Args:\n input_tensor: The single dimensional Tensor to tokenize.\n\n Returns:\n Tuple of RaggedTensors of tokenized text and byte offsets, with shapes\n [num_strings, (num_tokens or num_offsets)].\n \"\"\"",
"# Decode the strin... | [
{
"param": "self",
"type": null
},
{
"param": "input_tensor",
"type": null
}
] | {
"returns": [
{
"docstring": "Tuple of RaggedTensors of tokenized text and byte offsets, with shapes\n[num_strings, (num_tokens or num_offsets)].",
"docstring_tokens": [
"Tuple",
"of",
"RaggedTensors",
"of",
"tokenized",
"text",
"and",
"... |
042adfa29ee87a290cff9199d0e4e9757f4482ef | sunlongbo/chromium | third_party/tensorflow-text/src/tensorflow_text/python/ops/whitespace_tokenizer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _whitespace_tokenize_codepoints_with_offsets | <not_specific> | def _whitespace_tokenize_codepoints_with_offsets(self, codepoints_tensor):
"""Tokenizes a tensor of codepoints with rank of 1.
Args:
codepoints_tensor: Single-dimension Tensor of codepoints to tokenize.
Returns:
Tuple of tokenized codepoints with offsets relative to the codepoints have
a... | Tokenizes a tensor of codepoints with rank of 1.
Args:
codepoints_tensor: Single-dimension Tensor of codepoints to tokenize.
Returns:
Tuple of tokenized codepoints with offsets relative to the codepoints have
a shape of [num_strings, (num_tokens or num_offsets)].
| Tokenizes a tensor of codepoints with rank of 1. | [
"Tokenizes",
"a",
"tensor",
"of",
"codepoints",
"with",
"rank",
"of",
"1",
"."
] | def _whitespace_tokenize_codepoints_with_offsets(self, codepoints_tensor):
(output_values, output_values_inner_splits, output_offset_starts,
output_offset_ends, output_outer_splits) = (
gen_whitespace_tokenizer.whitespace_tokenize_with_offsets(
input_values=codepoints_tensor.flat_values,
... | [
"def",
"_whitespace_tokenize_codepoints_with_offsets",
"(",
"self",
",",
"codepoints_tensor",
")",
":",
"(",
"output_values",
",",
"output_values_inner_splits",
",",
"output_offset_starts",
",",
"output_offset_ends",
",",
"output_outer_splits",
")",
"=",
"(",
"gen_whitespac... | Tokenizes a tensor of codepoints with rank of 1. | [
"Tokenizes",
"a",
"tensor",
"of",
"codepoints",
"with",
"rank",
"of",
"1",
"."
] | [
"\"\"\"Tokenizes a tensor of codepoints with rank of 1.\n\n Args:\n codepoints_tensor: Single-dimension Tensor of codepoints to tokenize.\n\n Returns:\n Tuple of tokenized codepoints with offsets relative to the codepoints have\n a shape of [num_strings, (num_tokens or num_offsets)].\n \"\"\... | [
{
"param": "self",
"type": null
},
{
"param": "codepoints_tensor",
"type": null
}
] | {
"returns": [
{
"docstring": "Tuple of tokenized codepoints with offsets relative to the codepoints have\na shape of [num_strings, (num_tokens or num_offsets)].",
"docstring_tokens": [
"Tuple",
"of",
"tokenized",
"codepoints",
"with",
"offsets",
... |
2eaf5fc87ae2aceb6b329f1a401bfe847c80e619 | sunlongbo/chromium | tools/perf/core/cli_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MergeIndexRanges | <not_specific> | def MergeIndexRanges(section_list):
"""Given a list of (begin, end) ranges, return the merged ranges.
Args:
range_list: a list of index ranges as (begin, end)
Return:
a list of merged index ranges.
"""
actions = []
for section in section_list:
if section[0] >= section[1]:
raise Va... | Given a list of (begin, end) ranges, return the merged ranges.
Args:
range_list: a list of index ranges as (begin, end)
Return:
a list of merged index ranges.
| Given a list of (begin, end) ranges, return the merged ranges. | [
"Given",
"a",
"list",
"of",
"(",
"begin",
"end",
")",
"ranges",
"return",
"the",
"merged",
"ranges",
"."
] | def MergeIndexRanges(section_list):
actions = []
for section in section_list:
if section[0] >= section[1]:
raise ValueError('Invalid range: (%d, %d)', section[0], section[1])
actions.append((section[0], 1))
actions.append((section[1], -1))
actions.sort(key=lambda x: (x[0], -x[1]))
merged_index... | [
"def",
"MergeIndexRanges",
"(",
"section_list",
")",
":",
"actions",
"=",
"[",
"]",
"for",
"section",
"in",
"section_list",
":",
"if",
"section",
"[",
"0",
"]",
">=",
"section",
"[",
"1",
"]",
":",
"raise",
"ValueError",
"(",
"'Invalid range: (%d, %d)'",
"... | Given a list of (begin, end) ranges, return the merged ranges. | [
"Given",
"a",
"list",
"of",
"(",
"begin",
"end",
")",
"ranges",
"return",
"the",
"merged",
"ranges",
"."
] | [
"\"\"\"Given a list of (begin, end) ranges, return the merged ranges.\n\n Args:\n range_list: a list of index ranges as (begin, end)\n Return:\n a list of merged index ranges.\n \"\"\""
] | [
{
"param": "section_list",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "section_list",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [
{
"identifier": "range_list",
"type": null,
"docst... |
cfd3e2a6b28679d757472b4c77c1e8d8b2e9c12a | sunlongbo/chromium | tools/web_dev_style/js_checker_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ShouldFailVariableNameCheck | null | def ShouldFailVariableNameCheck(self, line):
"""Checks that var unix_hacker, $dollar are style errors."""
error = self.checker.VariableNameCheck(1, line)
self.assertNotEqual("", error, "Should be flagged as style error: " + line)
highlight = test_util.GetHighlight(line, error)
self.assertFalse(any(d... | Checks that var unix_hacker, $dollar are style errors. | Checks that var unix_hacker, $dollar are style errors. | [
"Checks",
"that",
"var",
"unix_hacker",
"$dollar",
"are",
"style",
"errors",
"."
] | def ShouldFailVariableNameCheck(self, line):
error = self.checker.VariableNameCheck(1, line)
self.assertNotEqual("", error, "Should be flagged as style error: " + line)
highlight = test_util.GetHighlight(line, error)
self.assertFalse(any(dm in highlight for dm in _DECLARATION_METHODS)) | [
"def",
"ShouldFailVariableNameCheck",
"(",
"self",
",",
"line",
")",
":",
"error",
"=",
"self",
".",
"checker",
".",
"VariableNameCheck",
"(",
"1",
",",
"line",
")",
"self",
".",
"assertNotEqual",
"(",
"\"\"",
",",
"error",
",",
"\"Should be flagged as style e... | Checks that var unix_hacker, $dollar are style errors. | [
"Checks",
"that",
"var",
"unix_hacker",
"$dollar",
"are",
"style",
"errors",
"."
] | [
"\"\"\"Checks that var unix_hacker, $dollar are style errors.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "line",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "line",
"type": null,
"docstring": null,
"docstring_tokens": [... |
cffcb6b6071142173109370db06388ed8ef9504f | sunlongbo/chromium | third_party/google_input_tools/builder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | process_file | <not_specific> | def process_file(filename):
"""Extracts provided and required namespaces.
Description:
Scans Javascript file for provided and required namespaces.
Args:
filename: name of the file to process.
Returns:
Pair of lists, where the first list contains namespaces provided by the file
and the second ... | Extracts provided and required namespaces.
Description:
Scans Javascript file for provided and required namespaces.
Args:
filename: name of the file to process.
Returns:
Pair of lists, where the first list contains namespaces provided by the file
and the second contains a list of requirements.
... | Extracts provided and required namespaces.
Description:
Scans Javascript file for provided and required namespaces. | [
"Extracts",
"provided",
"and",
"required",
"namespaces",
".",
"Description",
":",
"Scans",
"Javascript",
"file",
"for",
"provided",
"and",
"required",
"namespaces",
"."
] | def process_file(filename):
provides = []
requires = []
with open(filename, 'r') as file_handle:
for line in file_handle:
if re.match(require_regex, line):
requires.append(re.search(require_regex, line).group(1))
if re.match(provide_regex, line):
provides.append(re.search(provide_r... | [
"def",
"process_file",
"(",
"filename",
")",
":",
"provides",
"=",
"[",
"]",
"requires",
"=",
"[",
"]",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"file_handle",
":",
"for",
"line",
"in",
"file_handle",
":",
"if",
"re",
".",
"match",
"("... | Extracts provided and required namespaces. | [
"Extracts",
"provided",
"and",
"required",
"namespaces",
"."
] | [
"\"\"\"Extracts provided and required namespaces.\n\n Description:\n Scans Javascript file for provided and required namespaces.\n\n Args:\n filename: name of the file to process.\n\n Returns:\n Pair of lists, where the first list contains namespaces provided by the file\n and the second contains a l... | [
{
"param": "filename",
"type": null
}
] | {
"returns": [
{
"docstring": "Pair of lists, where the first list contains namespaces provided by the file\nand the second contains a list of requirements.",
"docstring_tokens": [
"Pair",
"of",
"lists",
"where",
"the",
"first",
"list",
"... |
cffcb6b6071142173109370db06388ed8ef9504f | sunlongbo/chromium | third_party/google_input_tools/builder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | extract_dependencies | null | def extract_dependencies(filename, providers, requirements):
"""Extracts provided and required namespaces for a file.
Description:
Updates maps for namespace providers and file prerequisites.
Args:
filename: Path of the file to process.
providers: Mapping of namespace to filename that provides the n... | Extracts provided and required namespaces for a file.
Description:
Updates maps for namespace providers and file prerequisites.
Args:
filename: Path of the file to process.
providers: Mapping of namespace to filename that provides the namespace.
requirements: Mapping of filename to a list of prere... | Extracts provided and required namespaces for a file.
Description:
Updates maps for namespace providers and file prerequisites. | [
"Extracts",
"provided",
"and",
"required",
"namespaces",
"for",
"a",
"file",
".",
"Description",
":",
"Updates",
"maps",
"for",
"namespace",
"providers",
"and",
"file",
"prerequisites",
"."
] | def extract_dependencies(filename, providers, requirements):
p, r = process_file(filename)
for name in p:
providers[name] = filename
for name in r:
if filename not in requirements:
requirements[filename] = []
requirements[filename].append(name) | [
"def",
"extract_dependencies",
"(",
"filename",
",",
"providers",
",",
"requirements",
")",
":",
"p",
",",
"r",
"=",
"process_file",
"(",
"filename",
")",
"for",
"name",
"in",
"p",
":",
"providers",
"[",
"name",
"]",
"=",
"filename",
"for",
"name",
"in",... | Extracts provided and required namespaces for a file. | [
"Extracts",
"provided",
"and",
"required",
"namespaces",
"for",
"a",
"file",
"."
] | [
"\"\"\"Extracts provided and required namespaces for a file.\n\n Description:\n Updates maps for namespace providers and file prerequisites.\n\n Args:\n filename: Path of the file to process.\n providers: Mapping of namespace to filename that provides the namespace.\n requirements: Mapping of filename... | [
{
"param": "filename",
"type": null
},
{
"param": "providers",
"type": null
},
{
"param": "requirements",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": "Path of the file to process.",
"docstring_tokens": [
"Path",
"of",
"the",
"file",
"to",
"process",
"."
],
"default": nu... |
cffcb6b6071142173109370db06388ed8ef9504f | sunlongbo/chromium | third_party/google_input_tools/builder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | export | <not_specific> | def export(target_file, source_filename, providers, requirements, processed):
"""Writes the contents of a file.
Description:
Appends the contents of the source file to the target file. In order to
preserve proper dependencies, each file has its required namespaces
processed before exporting the source ... | Writes the contents of a file.
Description:
Appends the contents of the source file to the target file. In order to
preserve proper dependencies, each file has its required namespaces
processed before exporting the source file itself. The set of exported files
is tracked to guard against multiple exp... | Writes the contents of a file.
Description:
Appends the contents of the source file to the target file. In order to
preserve proper dependencies, each file has its required namespaces
processed before exporting the source file itself. The set of exported files
is tracked to guard against multiple exports of the same fi... | [
"Writes",
"the",
"contents",
"of",
"a",
"file",
".",
"Description",
":",
"Appends",
"the",
"contents",
"of",
"the",
"source",
"file",
"to",
"the",
"target",
"file",
".",
"In",
"order",
"to",
"preserve",
"proper",
"dependencies",
"each",
"file",
"has",
"its... | def export(target_file, source_filename, providers, requirements, processed):
if source_filename in processed:
return
if source_filename in requirements:
for namespace in requirements[source_filename]:
if namespace in providers:
dependency = providers[namespace]
if dependency:
... | [
"def",
"export",
"(",
"target_file",
",",
"source_filename",
",",
"providers",
",",
"requirements",
",",
"processed",
")",
":",
"if",
"source_filename",
"in",
"processed",
":",
"return",
"if",
"source_filename",
"in",
"requirements",
":",
"for",
"namespace",
"in... | Writes the contents of a file. | [
"Writes",
"the",
"contents",
"of",
"a",
"file",
"."
] | [
"\"\"\"Writes the contents of a file.\n\n Description:\n Appends the contents of the source file to the target file. In order to\n preserve proper dependencies, each file has its required namespaces\n processed before exporting the source file itself. The set of exported files\n is tracked to guard aga... | [
{
"param": "target_file",
"type": null
},
{
"param": "source_filename",
"type": null
},
{
"param": "providers",
"type": null
},
{
"param": "requirements",
"type": null
},
{
"param": "processed",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "target_file",
"type": null,
"docstring": "Handle to target file for export.",
"docstring_tokens": [
"Handle... |
cffcb6b6071142173109370db06388ed8ef9504f | sunlongbo/chromium | third_party/google_input_tools/builder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | extract_sources | <not_specific> | def extract_sources(options):
"""Extracts list of sources based on command line options.
Args:
options: Parsed command line options.
Returns:
List of source files. If the path option is specified then file paths are
absolute. Otherwise, relative paths may be used.
"""
sources = []
# Optional... | Extracts list of sources based on command line options.
Args:
options: Parsed command line options.
Returns:
List of source files. If the path option is specified then file paths are
absolute. Otherwise, relative paths may be used.
| Extracts list of sources based on command line options. | [
"Extracts",
"list",
"of",
"sources",
"based",
"on",
"command",
"line",
"options",
"."
] | def extract_sources(options):
sources = []
with open(options.sources_list[0], 'r') as f:
sources = shlex.split(f.read())
if options.path:
sources = [os.path.join(options.path, source) for source in sources]
return sources | [
"def",
"extract_sources",
"(",
"options",
")",
":",
"sources",
"=",
"[",
"]",
"with",
"open",
"(",
"options",
".",
"sources_list",
"[",
"0",
"]",
",",
"'r'",
")",
"as",
"f",
":",
"sources",
"=",
"shlex",
".",
"split",
"(",
"f",
".",
"read",
"(",
... | Extracts list of sources based on command line options. | [
"Extracts",
"list",
"of",
"sources",
"based",
"on",
"command",
"line",
"options",
"."
] | [
"\"\"\"Extracts list of sources based on command line options.\n\n Args:\n options: Parsed command line options.\n Returns:\n List of source files. If the path option is specified then file paths are\n absolute. Otherwise, relative paths may be used.\n \"\"\"",
"# Optionally load list of source file... | [
{
"param": "options",
"type": null
}
] | {
"returns": [
{
"docstring": "List of source files. If the path option is specified then file paths are\nabsolute. Otherwise, relative paths may be used.",
"docstring_tokens": [
"List",
"of",
"source",
"files",
".",
"If",
"the",
"path"... |
cffcb6b6071142173109370db06388ed8ef9504f | sunlongbo/chromium | third_party/google_input_tools/builder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | main | null | def main():
"""The entrypoint for this script."""
parser = argparse.ArgumentParser()
parser.add_argument('--sources-list', nargs=1)
parser.add_argument('--target', nargs=1)
parser.add_argument('--path', nargs='?')
options = parser.parse_args()
sources = extract_sources(options)
assert sources, 'Missing... | The entrypoint for this script. | The entrypoint for this script. | [
"The",
"entrypoint",
"for",
"this",
"script",
"."
] | def main():
parser = argparse.ArgumentParser()
parser.add_argument('--sources-list', nargs=1)
parser.add_argument('--target', nargs=1)
parser.add_argument('--path', nargs='?')
options = parser.parse_args()
sources = extract_sources(options)
assert sources, 'Missing source files.'
providers = {}
requir... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'--sources-list'",
",",
"nargs",
"=",
"1",
")",
"parser",
".",
"add_argument",
"(",
"'--target'",
",",
"nargs",
"=",
"1",
")",
... | The entrypoint for this script. | [
"The",
"entrypoint",
"for",
"this",
"script",
"."
] | [
"\"\"\"The entrypoint for this script.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
1fbc60ce5a8511548b2822ac3d01d2379436dbba | sunlongbo/chromium | tools/metrics/histograms/populate_enums.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetEventDetails | <not_specific> | def _GetEventDetails(event):
"""Returns a simple struct containing the event details.
Args:
event: An event description as defined in ukm.xml.
Returns:
A struct containing the event name, truncated hash, and whether the event is
considered obsolete.
"""
name = event.getAttribute('name')
# The ... | Returns a simple struct containing the event details.
Args:
event: An event description as defined in ukm.xml.
Returns:
A struct containing the event name, truncated hash, and whether the event is
considered obsolete.
| Returns a simple struct containing the event details. | [
"Returns",
"a",
"simple",
"struct",
"containing",
"the",
"event",
"details",
"."
] | def _GetEventDetails(event):
name = event.getAttribute('name')
hash = codegen.HashName(name) & 0x7fffffff
def _HasDirectObsoleteTag(node):
return any(
isinstance(child, xml.dom.minidom.Element)
and child.tagName == 'obsolete' for child in node.childNodes)
is_event_obsolete = _HasDirectObsole... | [
"def",
"_GetEventDetails",
"(",
"event",
")",
":",
"name",
"=",
"event",
".",
"getAttribute",
"(",
"'name'",
")",
"hash",
"=",
"codegen",
".",
"HashName",
"(",
"name",
")",
"&",
"0x7fffffff",
"def",
"_HasDirectObsoleteTag",
"(",
"node",
")",
":",
"return",... | Returns a simple struct containing the event details. | [
"Returns",
"a",
"simple",
"struct",
"containing",
"the",
"event",
"details",
"."
] | [
"\"\"\"Returns a simple struct containing the event details.\n\n Args:\n event: An event description as defined in ukm.xml.\n\n Returns:\n A struct containing the event name, truncated hash, and whether the event is\n considered obsolete.\n \"\"\"",
"# The value is UKM event name hash truncated to 31 ... | [
{
"param": "event",
"type": null
}
] | {
"returns": [
{
"docstring": "A struct containing the event name, truncated hash, and whether the event is\nconsidered obsolete.",
"docstring_tokens": [
"A",
"struct",
"containing",
"the",
"event",
"name",
"truncated",
"hash",
"a... |
1fbc60ce5a8511548b2822ac3d01d2379436dbba | sunlongbo/chromium | tools/metrics/histograms/populate_enums.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PopulateEnumWithUkmEvents | null | def PopulateEnumWithUkmEvents(doc, enum, ukm_events):
"""Populates the enum node with a list of ukm events.
Args:
doc: The document to create the node in.
enum: The enum node needed to be populated.
ukm_events: A list of ukm event nodes.
"""
event_details = [_GetEventDetails(event) for event in ukm... | Populates the enum node with a list of ukm events.
Args:
doc: The document to create the node in.
enum: The enum node needed to be populated.
ukm_events: A list of ukm event nodes.
| Populates the enum node with a list of ukm events. | [
"Populates",
"the",
"enum",
"node",
"with",
"a",
"list",
"of",
"ukm",
"events",
"."
] | def PopulateEnumWithUkmEvents(doc, enum, ukm_events):
event_details = [_GetEventDetails(event) for event in ukm_events]
event_details.sort(key=lambda event: event.hash)
for event in event_details:
node = doc.createElement('int')
node.attributes['value'] = str(event.hash)
label = event.name
if even... | [
"def",
"PopulateEnumWithUkmEvents",
"(",
"doc",
",",
"enum",
",",
"ukm_events",
")",
":",
"event_details",
"=",
"[",
"_GetEventDetails",
"(",
"event",
")",
"for",
"event",
"in",
"ukm_events",
"]",
"event_details",
".",
"sort",
"(",
"key",
"=",
"lambda",
"eve... | Populates the enum node with a list of ukm events. | [
"Populates",
"the",
"enum",
"node",
"with",
"a",
"list",
"of",
"ukm",
"events",
"."
] | [
"\"\"\"Populates the enum node with a list of ukm events.\n\n Args:\n doc: The document to create the node in.\n enum: The enum node needed to be populated.\n ukm_events: A list of ukm event nodes.\n \"\"\"",
"# If the event is obsolete, mark it in the int's label."
] | [
{
"param": "doc",
"type": null
},
{
"param": "enum",
"type": null
},
{
"param": "ukm_events",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "doc",
"type": null,
"docstring": "The document to create the node in.",
"docstring_tokens": [
"The",
"document",
"to",
"create",
"the",
"node",
"in",
"."
],... |
1fbc60ce5a8511548b2822ac3d01d2379436dbba | sunlongbo/chromium | tools/metrics/histograms/populate_enums.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PopulateEnumsWithUkmEvents | null | def PopulateEnumsWithUkmEvents(doc, enums, ukm_events):
"""Populates enum nodes in the enums with a list of ukm events
Args:
doc: The document to create the node in.
enums: The enums node to be iterated.
ukm_events: A list of ukm event nodes.
"""
for enum in extract_histograms.IterElementsWithTag(e... | Populates enum nodes in the enums with a list of ukm events
Args:
doc: The document to create the node in.
enums: The enums node to be iterated.
ukm_events: A list of ukm event nodes.
| Populates enum nodes in the enums with a list of ukm events | [
"Populates",
"enum",
"nodes",
"in",
"the",
"enums",
"with",
"a",
"list",
"of",
"ukm",
"events"
] | def PopulateEnumsWithUkmEvents(doc, enums, ukm_events):
for enum in extract_histograms.IterElementsWithTag(enums, 'enum', 1):
if enum.getAttribute('name') == 'UkmEventNameHash':
PopulateEnumWithUkmEvents(doc, enum, ukm_events) | [
"def",
"PopulateEnumsWithUkmEvents",
"(",
"doc",
",",
"enums",
",",
"ukm_events",
")",
":",
"for",
"enum",
"in",
"extract_histograms",
".",
"IterElementsWithTag",
"(",
"enums",
",",
"'enum'",
",",
"1",
")",
":",
"if",
"enum",
".",
"getAttribute",
"(",
"'name... | Populates enum nodes in the enums with a list of ukm events | [
"Populates",
"enum",
"nodes",
"in",
"the",
"enums",
"with",
"a",
"list",
"of",
"ukm",
"events"
] | [
"\"\"\"Populates enum nodes in the enums with a list of ukm events\n\n Args:\n doc: The document to create the node in.\n enums: The enums node to be iterated.\n ukm_events: A list of ukm event nodes.\n \"\"\"",
"# We only special case 'UkmEventNameHash' currently."
] | [
{
"param": "doc",
"type": null
},
{
"param": "enums",
"type": null
},
{
"param": "ukm_events",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "doc",
"type": null,
"docstring": "The document to create the node in.",
"docstring_tokens": [
"The",
"document",
"to",
"create",
"the",
"node",
"in",
"."
],... |
197420cd167677dc9699f175349f1e0ff1ab6bf3 | sunlongbo/chromium | tools/metrics/histograms/suffixes_to_variants.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ExtractObsoleteNode | <not_specific> | def _ExtractObsoleteNode(node, recursive=True):
"""Extracts obsolete child from |node|. Returns None if not exists."""
if not recursive:
obsolete = [
element for element in node.getElementsByTagName('obsolete')
if element.parentNode == node
]
else:
obsolete = node.getElementsByTagName(... | Extracts obsolete child from |node|. Returns None if not exists. | Extracts obsolete child from |node|. Returns None if not exists. | [
"Extracts",
"obsolete",
"child",
"from",
"|node|",
".",
"Returns",
"None",
"if",
"not",
"exists",
"."
] | def _ExtractObsoleteNode(node, recursive=True):
if not recursive:
obsolete = [
element for element in node.getElementsByTagName('obsolete')
if element.parentNode == node
]
else:
obsolete = node.getElementsByTagName('obsolete')
if not obsolete:
return None
assert len(obsolete) == ... | [
"def",
"_ExtractObsoleteNode",
"(",
"node",
",",
"recursive",
"=",
"True",
")",
":",
"if",
"not",
"recursive",
":",
"obsolete",
"=",
"[",
"element",
"for",
"element",
"in",
"node",
".",
"getElementsByTagName",
"(",
"'obsolete'",
")",
"if",
"element",
".",
... | Extracts obsolete child from |node|. | [
"Extracts",
"obsolete",
"child",
"from",
"|node|",
"."
] | [
"\"\"\"Extracts obsolete child from |node|. Returns None if not exists.\"\"\""
] | [
{
"param": "node",
"type": null
},
{
"param": "recursive",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "recursive",
"type": null,
"docstring": null,
"docstring_token... |
197420cd167677dc9699f175349f1e0ff1ab6bf3 | sunlongbo/chromium | tools/metrics/histograms/suffixes_to_variants.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RemoveSuffixesComment | null | def _RemoveSuffixesComment(node, histogram_suffixes_name):
"""Remove suffixes related comments from |node|."""
for child in node.childNodes:
if child.nodeType == minidom.Node.COMMENT_NODE:
if ('Name completed by' in child.data
and histogram_suffixes_name in child.data):
node.removeChild(... | Remove suffixes related comments from |node|. | Remove suffixes related comments from |node|. | [
"Remove",
"suffixes",
"related",
"comments",
"from",
"|node|",
"."
] | def _RemoveSuffixesComment(node, histogram_suffixes_name):
for child in node.childNodes:
if child.nodeType == minidom.Node.COMMENT_NODE:
if ('Name completed by' in child.data
and histogram_suffixes_name in child.data):
node.removeChild(child) | [
"def",
"_RemoveSuffixesComment",
"(",
"node",
",",
"histogram_suffixes_name",
")",
":",
"for",
"child",
"in",
"node",
".",
"childNodes",
":",
"if",
"child",
".",
"nodeType",
"==",
"minidom",
".",
"Node",
".",
"COMMENT_NODE",
":",
"if",
"(",
"'Name completed by... | Remove suffixes related comments from |node|. | [
"Remove",
"suffixes",
"related",
"comments",
"from",
"|node|",
"."
] | [
"\"\"\"Remove suffixes related comments from |node|.\"\"\""
] | [
{
"param": "node",
"type": null
},
{
"param": "histogram_suffixes_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "histogram_suffixes_name",
"type": null,
"docstring": null,
"d... |
197420cd167677dc9699f175349f1e0ff1ab6bf3 | sunlongbo/chromium | tools/metrics/histograms/suffixes_to_variants.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _UpdateSummary | null | def _UpdateSummary(histogram, histogram_suffixes_name):
"""Appends a placeholder string to the |histogram|'s summary node."""
summary = histogram.getElementsByTagName('summary')
assert len(summary) == 1, 'A histogram should have a single summary node.'
summary = summary[0]
if summary.firstChild.nodeType != su... | Appends a placeholder string to the |histogram|'s summary node. | Appends a placeholder string to the |histogram|'s summary node. | [
"Appends",
"a",
"placeholder",
"string",
"to",
"the",
"|histogram|",
"'",
"s",
"summary",
"node",
"."
] | def _UpdateSummary(histogram, histogram_suffixes_name):
summary = histogram.getElementsByTagName('summary')
assert len(summary) == 1, 'A histogram should have a single summary node.'
summary = summary[0]
if summary.firstChild.nodeType != summary.TEXT_NODE:
raise ValueError('summary_node doesn\'t contain tex... | [
"def",
"_UpdateSummary",
"(",
"histogram",
",",
"histogram_suffixes_name",
")",
":",
"summary",
"=",
"histogram",
".",
"getElementsByTagName",
"(",
"'summary'",
")",
"assert",
"len",
"(",
"summary",
")",
"==",
"1",
",",
"'A histogram should have a single summary node.... | Appends a placeholder string to the |histogram|'s summary node. | [
"Appends",
"a",
"placeholder",
"string",
"to",
"the",
"|histogram|",
"'",
"s",
"summary",
"node",
"."
] | [
"\"\"\"Appends a placeholder string to the |histogram|'s summary node.\"\"\""
] | [
{
"param": "histogram",
"type": null
},
{
"param": "histogram_suffixes_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "histogram",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "histogram_suffixes_name",
"type": null,
"docstring": null,
... |
197420cd167677dc9699f175349f1e0ff1ab6bf3 | sunlongbo/chromium | tools/metrics/histograms/suffixes_to_variants.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AreAllAffectedHistogramsFound | <not_specific> | def _AreAllAffectedHistogramsFound(affected_histograms, histograms):
"""Checks that are all affected histograms found in |histograms|."""
histogram_names = [histogram.getAttribute('name') for histogram in histograms]
return all(
affected_histogram.getAttribute('name') in histogram_names
for affected_h... | Checks that are all affected histograms found in |histograms|. | Checks that are all affected histograms found in |histograms|. | [
"Checks",
"that",
"are",
"all",
"affected",
"histograms",
"found",
"in",
"|histograms|",
"."
] | def _AreAllAffectedHistogramsFound(affected_histograms, histograms):
histogram_names = [histogram.getAttribute('name') for histogram in histograms]
return all(
affected_histogram.getAttribute('name') in histogram_names
for affected_histogram in affected_histograms) | [
"def",
"_AreAllAffectedHistogramsFound",
"(",
"affected_histograms",
",",
"histograms",
")",
":",
"histogram_names",
"=",
"[",
"histogram",
".",
"getAttribute",
"(",
"'name'",
")",
"for",
"histogram",
"in",
"histograms",
"]",
"return",
"all",
"(",
"affected_histogra... | Checks that are all affected histograms found in |histograms|. | [
"Checks",
"that",
"are",
"all",
"affected",
"histograms",
"found",
"in",
"|histograms|",
"."
] | [
"\"\"\"Checks that are all affected histograms found in |histograms|.\"\"\""
] | [
{
"param": "affected_histograms",
"type": null
},
{
"param": "histograms",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "affected_histograms",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "histograms",
"type": null,
"docstring": null,
... |
197420cd167677dc9699f175349f1e0ff1ab6bf3 | sunlongbo/chromium | tools/metrics/histograms/suffixes_to_variants.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetSuffixesDict | <not_specific> | def _GetSuffixesDict(nodes, all_histograms):
"""Gets a dict of simple histogram-suffixes to be used in the migration.
Returns two dicts of histogram-suffixes to be migrated to the new patterned
histograms syntax.
The first dict: the keys are the histogram-suffixes' affected histogram name
and the values are... | Gets a dict of simple histogram-suffixes to be used in the migration.
Returns two dicts of histogram-suffixes to be migrated to the new patterned
histograms syntax.
The first dict: the keys are the histogram-suffixes' affected histogram name
and the values are the histogram_suffixes nodes that have only one
... | Gets a dict of simple histogram-suffixes to be used in the migration.
Returns two dicts of histogram-suffixes to be migrated to the new patterned
histograms syntax.
The first dict: the keys are the histogram-suffixes' affected histogram name
and the values are the histogram_suffixes nodes that have only one
affected-h... | [
"Gets",
"a",
"dict",
"of",
"simple",
"histogram",
"-",
"suffixes",
"to",
"be",
"used",
"in",
"the",
"migration",
".",
"Returns",
"two",
"dicts",
"of",
"histogram",
"-",
"suffixes",
"to",
"be",
"migrated",
"to",
"the",
"new",
"patterned",
"histograms",
"syn... | def _GetSuffixesDict(nodes, all_histograms):
single_affected = {}
all_affected_found = {}
for histogram_suffixes in nodes:
affected_histograms = histogram_suffixes.getElementsByTagName(
'affected-histogram')
if len(affected_histograms) == 1:
affected_histogram = affected_histograms[0].getAtt... | [
"def",
"_GetSuffixesDict",
"(",
"nodes",
",",
"all_histograms",
")",
":",
"single_affected",
"=",
"{",
"}",
"all_affected_found",
"=",
"{",
"}",
"for",
"histogram_suffixes",
"in",
"nodes",
":",
"affected_histograms",
"=",
"histogram_suffixes",
".",
"getElementsByTag... | Gets a dict of simple histogram-suffixes to be used in the migration. | [
"Gets",
"a",
"dict",
"of",
"simple",
"histogram",
"-",
"suffixes",
"to",
"be",
"used",
"in",
"the",
"migration",
"."
] | [
"\"\"\"Gets a dict of simple histogram-suffixes to be used in the migration.\n\n Returns two dicts of histogram-suffixes to be migrated to the new patterned\n histograms syntax.\n\n The first dict: the keys are the histogram-suffixes' affected histogram name\n and the values are the histogram_suffixes nodes tha... | [
{
"param": "nodes",
"type": null
},
{
"param": "all_histograms",
"type": null
}
] | {
"returns": [
{
"docstring": "A dict of histograms-suffixes nodes keyed by their names.",
"docstring_tokens": [
"A",
"dict",
"of",
"histograms",
"-",
"suffixes",
"nodes",
"keyed",
"by",
"their",
"names",
"... |
197420cd167677dc9699f175349f1e0ff1ab6bf3 | sunlongbo/chromium | tools/metrics/histograms/suffixes_to_variants.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetBaseVariant | <not_specific> | def _GetBaseVariant(doc, histogram):
"""Returns a <variant> node whose name is an empty string as the base variant.
If histogram has attribute `base = True`, it means that the base histogram
should be marked as obsolete.
Args:
doc: A Document object which is used to create a new <variant> node.
histog... | Returns a <variant> node whose name is an empty string as the base variant.
If histogram has attribute `base = True`, it means that the base histogram
should be marked as obsolete.
Args:
doc: A Document object which is used to create a new <variant> node.
histogram: The <histogram> node to check whether... | Returns a node whose name is an empty string as the base variant.
If histogram has attribute `base = True`, it means that the base histogram
should be marked as obsolete. | [
"Returns",
"a",
"node",
"whose",
"name",
"is",
"an",
"empty",
"string",
"as",
"the",
"base",
"variant",
".",
"If",
"histogram",
"has",
"attribute",
"`",
"base",
"=",
"True",
"`",
"it",
"means",
"that",
"the",
"base",
"histogram",
"should",
"be",
"marked"... | def _GetBaseVariant(doc, histogram):
is_base = False
if histogram.hasAttribute('base'):
is_base = histogram.getAttribute('base').lower() == 'true'
histogram.removeAttribute('base')
base_variant = doc.createElement('variant')
base_variant.setAttribute('name', '')
if is_base:
base_obsolete_node = do... | [
"def",
"_GetBaseVariant",
"(",
"doc",
",",
"histogram",
")",
":",
"is_base",
"=",
"False",
"if",
"histogram",
".",
"hasAttribute",
"(",
"'base'",
")",
":",
"is_base",
"=",
"histogram",
".",
"getAttribute",
"(",
"'base'",
")",
".",
"lower",
"(",
")",
"=="... | Returns a <variant> node whose name is an empty string as the base variant. | [
"Returns",
"a",
"<variant",
">",
"node",
"whose",
"name",
"is",
"an",
"empty",
"string",
"as",
"the",
"base",
"variant",
"."
] | [
"\"\"\"Returns a <variant> node whose name is an empty string as the base variant.\n\n If histogram has attribute `base = True`, it means that the base histogram\n should be marked as obsolete.\n\n Args:\n doc: A Document object which is used to create a new <variant> node.\n histogram: The <histogram> nod... | [
{
"param": "doc",
"type": null
},
{
"param": "histogram",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "doc",
"type": null,
"docstring": "A Document object which is used to create a new node.",
"docstring_tokens": [
... |
197420cd167677dc9699f175349f1e0ff1ab6bf3 | sunlongbo/chromium | tools/metrics/histograms/suffixes_to_variants.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _PopulateVariantsWithSuffixes | <not_specific> | def _PopulateVariantsWithSuffixes(doc, node, histogram_suffixes):
"""Populates <variant> nodes to |node| from <suffix>.
This function returns True if none of the suffixes contains 'base' attribute.
If this function returns false, the caller's histogram node will not be
updated. This is mainly because base suff... | Populates <variant> nodes to |node| from <suffix>.
This function returns True if none of the suffixes contains 'base' attribute.
If this function returns false, the caller's histogram node will not be
updated. This is mainly because base suffix is a much more complicated case
and thus it can not be automatical... | Populates nodes to |node| from .
This function returns True if none of the suffixes contains 'base' attribute.
If this function returns false, the caller's histogram node will not be
updated. This is mainly because base suffix is a much more complicated case
and thus it can not be automatically updated at least for no... | [
"Populates",
"nodes",
"to",
"|node|",
"from",
".",
"This",
"function",
"returns",
"True",
"if",
"none",
"of",
"the",
"suffixes",
"contains",
"'",
"base",
"'",
"attribute",
".",
"If",
"this",
"function",
"returns",
"false",
"the",
"caller",
"'",
"s",
"histo... | def _PopulateVariantsWithSuffixes(doc, node, histogram_suffixes):
separator = histogram_suffixes.getAttribute('separator')
suffixes_owners = _ExtractOwnerNodes(histogram_suffixes)
suffixes_name = histogram_suffixes.getAttribute('name')
obsolete_histogram_suffix_node = _ExtractObsoleteNode(histogram_suffixes,
... | [
"def",
"_PopulateVariantsWithSuffixes",
"(",
"doc",
",",
"node",
",",
"histogram_suffixes",
")",
":",
"separator",
"=",
"histogram_suffixes",
".",
"getAttribute",
"(",
"'separator'",
")",
"suffixes_owners",
"=",
"_ExtractOwnerNodes",
"(",
"histogram_suffixes",
")",
"s... | Populates <variant> nodes to |node| from <suffix>. | [
"Populates",
"<variant",
">",
"nodes",
"to",
"|node|",
"from",
"<suffix",
">",
"."
] | [
"\"\"\"Populates <variant> nodes to |node| from <suffix>.\n\n This function returns True if none of the suffixes contains 'base' attribute.\n If this function returns false, the caller's histogram node will not be\n updated. This is mainly because base suffix is a much more complicated case\n and thus it can no... | [
{
"param": "doc",
"type": null
},
{
"param": "node",
"type": null
},
{
"param": "histogram_suffixes",
"type": null
}
] | {
"returns": [
{
"docstring": "True if the node can be updated automatically.",
"docstring_tokens": [
"True",
"if",
"the",
"node",
"can",
"be",
"updated",
"automatically",
"."
],
"type": null
}
],
"raises": [],... |
197420cd167677dc9699f175349f1e0ff1ab6bf3 | sunlongbo/chromium | tools/metrics/histograms/suffixes_to_variants.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _UpdateHistogramName | null | def _UpdateHistogramName(histogram, histogram_suffixes):
"""Adds histogram_suffixes's placeholder to the histogram name."""
histogram_name = histogram.getAttribute('name')
histogram_suffixes_name = histogram_suffixes.getAttribute('name')
ordering = histogram_suffixes.getAttribute('ordering')
if not ordering:
... | Adds histogram_suffixes's placeholder to the histogram name. | Adds histogram_suffixes's placeholder to the histogram name. | [
"Adds",
"histogram_suffixes",
"'",
"s",
"placeholder",
"to",
"the",
"histogram",
"name",
"."
] | def _UpdateHistogramName(histogram, histogram_suffixes):
histogram_name = histogram.getAttribute('name')
histogram_suffixes_name = histogram_suffixes.getAttribute('name')
ordering = histogram_suffixes.getAttribute('ordering')
if not ordering:
histogram.setAttribute('name',
'%s{%s}... | [
"def",
"_UpdateHistogramName",
"(",
"histogram",
",",
"histogram_suffixes",
")",
":",
"histogram_name",
"=",
"histogram",
".",
"getAttribute",
"(",
"'name'",
")",
"histogram_suffixes_name",
"=",
"histogram_suffixes",
".",
"getAttribute",
"(",
"'name'",
")",
"ordering"... | Adds histogram_suffixes's placeholder to the histogram name. | [
"Adds",
"histogram_suffixes",
"'",
"s",
"placeholder",
"to",
"the",
"histogram",
"name",
"."
] | [
"\"\"\"Adds histogram_suffixes's placeholder to the histogram name.\"\"\""
] | [
{
"param": "histogram",
"type": null
},
{
"param": "histogram_suffixes",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "histogram",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "histogram_suffixes",
"type": null,
"docstring": null,
"d... |
197420cd167677dc9699f175349f1e0ff1ab6bf3 | sunlongbo/chromium | tools/metrics/histograms/suffixes_to_variants.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MigrateToInlinePatterenedHistogram | null | def MigrateToInlinePatterenedHistogram(doc, histogram, histogram_suffixes):
"""Migates a single histogram suffixes to an inline patterned histogram."""
# Keep a deep copy in case when the |histogram| fails to be migrated.
old_histogram = histogram.cloneNode(deep=True)
# Update histogram's name with the histogra... | Migates a single histogram suffixes to an inline patterned histogram. | Migates a single histogram suffixes to an inline patterned histogram. | [
"Migates",
"a",
"single",
"histogram",
"suffixes",
"to",
"an",
"inline",
"patterned",
"histogram",
"."
] | def MigrateToInlinePatterenedHistogram(doc, histogram, histogram_suffixes):
old_histogram = histogram.cloneNode(deep=True)
histogram_suffixes_name = histogram_suffixes.getAttribute('name')
_UpdateHistogramName(histogram, histogram_suffixes)
_UpdateSummary(histogram, histogram_suffixes_name)
token = doc.create... | [
"def",
"MigrateToInlinePatterenedHistogram",
"(",
"doc",
",",
"histogram",
",",
"histogram_suffixes",
")",
":",
"old_histogram",
"=",
"histogram",
".",
"cloneNode",
"(",
"deep",
"=",
"True",
")",
"histogram_suffixes_name",
"=",
"histogram_suffixes",
".",
"getAttribute... | Migates a single histogram suffixes to an inline patterned histogram. | [
"Migates",
"a",
"single",
"histogram",
"suffixes",
"to",
"an",
"inline",
"patterned",
"histogram",
"."
] | [
"\"\"\"Migates a single histogram suffixes to an inline patterned histogram.\"\"\"",
"# Keep a deep copy in case when the |histogram| fails to be migrated.",
"# Update histogram's name with the histogram_suffixes' name.",
"# Append |histogram_suffixes_name| placeholder string to the summary text.",
"# Creat... | [
{
"param": "doc",
"type": null
},
{
"param": "histogram",
"type": null
},
{
"param": "histogram_suffixes",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "doc",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "histogram",
"type": null,
"docstring": null,
"docstring_tokens... |
197420cd167677dc9699f175349f1e0ff1ab6bf3 | sunlongbo/chromium | tools/metrics/histograms/suffixes_to_variants.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MigrateToOutOflinePatterenedHistogram | null | def MigrateToOutOflinePatterenedHistogram(doc, histogram, histogram_suffixes):
"""Migates a histogram suffixes to out-of-line patterned histogram."""
# Update histogram's name with the histogram_suffixes' name.
histogram_suffixes_name = histogram_suffixes.getAttribute('name')
_UpdateHistogramName(histogram, his... | Migates a histogram suffixes to out-of-line patterned histogram. | Migates a histogram suffixes to out-of-line patterned histogram. | [
"Migates",
"a",
"histogram",
"suffixes",
"to",
"out",
"-",
"of",
"-",
"line",
"patterned",
"histogram",
"."
] | def MigrateToOutOflinePatterenedHistogram(doc, histogram, histogram_suffixes):
histogram_suffixes_name = histogram_suffixes.getAttribute('name')
_UpdateHistogramName(histogram, histogram_suffixes)
_UpdateSummary(histogram, histogram_suffixes_name)
token = doc.createElement('token')
token.setAttribute('key', h... | [
"def",
"MigrateToOutOflinePatterenedHistogram",
"(",
"doc",
",",
"histogram",
",",
"histogram_suffixes",
")",
":",
"histogram_suffixes_name",
"=",
"histogram_suffixes",
".",
"getAttribute",
"(",
"'name'",
")",
"_UpdateHistogramName",
"(",
"histogram",
",",
"histogram_suff... | Migates a histogram suffixes to out-of-line patterned histogram. | [
"Migates",
"a",
"histogram",
"suffixes",
"to",
"out",
"-",
"of",
"-",
"line",
"patterned",
"histogram",
"."
] | [
"\"\"\"Migates a histogram suffixes to out-of-line patterned histogram.\"\"\"",
"# Update histogram's name with the histogram_suffixes' name.",
"# Append |histogram_suffixes_name| placeholder string to the summary text.",
"# Create a <token> node that links to an out-of-line <variants>.",
"# Remove obsolete... | [
{
"param": "doc",
"type": null
},
{
"param": "histogram",
"type": null
},
{
"param": "histogram_suffixes",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "doc",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "histogram",
"type": null,
"docstring": null,
"docstring_tokens... |
197420cd167677dc9699f175349f1e0ff1ab6bf3 | sunlongbo/chromium | tools/metrics/histograms/suffixes_to_variants.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _MigrateOutOfLineVariants | null | def _MigrateOutOfLineVariants(doc, histograms, suffixes_to_convert):
"""Converts a histogram-suffixes node to an out-of-line variants."""
histograms_node = histograms.getElementsByTagName('histograms')
assert len(histograms_node) == 1, (
'Every histograms.xml should have only one <histograms> node.')
for ... | Converts a histogram-suffixes node to an out-of-line variants. | Converts a histogram-suffixes node to an out-of-line variants. | [
"Converts",
"a",
"histogram",
"-",
"suffixes",
"node",
"to",
"an",
"out",
"-",
"of",
"-",
"line",
"variants",
"."
] | def _MigrateOutOfLineVariants(doc, histograms, suffixes_to_convert):
histograms_node = histograms.getElementsByTagName('histograms')
assert len(histograms_node) == 1, (
'Every histograms.xml should have only one <histograms> node.')
for suffixes in suffixes_to_convert:
histogram_suffixes_name = suffixes... | [
"def",
"_MigrateOutOfLineVariants",
"(",
"doc",
",",
"histograms",
",",
"suffixes_to_convert",
")",
":",
"histograms_node",
"=",
"histograms",
".",
"getElementsByTagName",
"(",
"'histograms'",
")",
"assert",
"len",
"(",
"histograms_node",
")",
"==",
"1",
",",
"(",... | Converts a histogram-suffixes node to an out-of-line variants. | [
"Converts",
"a",
"histogram",
"-",
"suffixes",
"node",
"to",
"an",
"out",
"-",
"of",
"-",
"line",
"variants",
"."
] | [
"\"\"\"Converts a histogram-suffixes node to an out-of-line variants.\"\"\""
] | [
{
"param": "doc",
"type": null
},
{
"param": "histograms",
"type": null
},
{
"param": "suffixes_to_convert",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "doc",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "histograms",
"type": null,
"docstring": null,
"docstring_token... |
197420cd167677dc9699f175349f1e0ff1ab6bf3 | sunlongbo/chromium | tools/metrics/histograms/suffixes_to_variants.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ChooseFiles | <not_specific> | def ChooseFiles(args):
"""Chooses a set of files to process so that we can migrate incrementally."""
paths = []
for path in sorted(histogram_paths.HISTOGRAMS_XMLS):
if 'metadata' in path and path.endswith('histograms.xml'):
name = os.path.basename(os.path.dirname(path))
if args.start <= name[0] <=... | Chooses a set of files to process so that we can migrate incrementally. | Chooses a set of files to process so that we can migrate incrementally. | [
"Chooses",
"a",
"set",
"of",
"files",
"to",
"process",
"so",
"that",
"we",
"can",
"migrate",
"incrementally",
"."
] | def ChooseFiles(args):
paths = []
for path in sorted(histogram_paths.HISTOGRAMS_XMLS):
if 'metadata' in path and path.endswith('histograms.xml'):
name = os.path.basename(os.path.dirname(path))
if args.start <= name[0] <= args.end:
paths.append(path)
if args.obsolete:
paths.append(histo... | [
"def",
"ChooseFiles",
"(",
"args",
")",
":",
"paths",
"=",
"[",
"]",
"for",
"path",
"in",
"sorted",
"(",
"histogram_paths",
".",
"HISTOGRAMS_XMLS",
")",
":",
"if",
"'metadata'",
"in",
"path",
"and",
"path",
".",
"endswith",
"(",
"'histograms.xml'",
")",
... | Chooses a set of files to process so that we can migrate incrementally. | [
"Chooses",
"a",
"set",
"of",
"files",
"to",
"process",
"so",
"that",
"we",
"can",
"migrate",
"incrementally",
"."
] | [
"\"\"\"Chooses a set of files to process so that we can migrate incrementally.\"\"\""
] | [
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
197420cd167677dc9699f175349f1e0ff1ab6bf3 | sunlongbo/chromium | tools/metrics/histograms/suffixes_to_variants.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SuffixesToVariantsMigration | null | def SuffixesToVariantsMigration(args):
"""Migates all histogram suffixes to patterned histograms."""
histogram_suffixes_list = minidom.parse(open(HISTOGRAM_SUFFIXES_LIST_PATH))
histogram_suffixes_nodes = histogram_suffixes_list.getElementsByTagName(
'histogram_suffixes')
doc = minidom.Document()
for hi... | Migates all histogram suffixes to patterned histograms. | Migates all histogram suffixes to patterned histograms. | [
"Migates",
"all",
"histogram",
"suffixes",
"to",
"patterned",
"histograms",
"."
] | def SuffixesToVariantsMigration(args):
histogram_suffixes_list = minidom.parse(open(HISTOGRAM_SUFFIXES_LIST_PATH))
histogram_suffixes_nodes = histogram_suffixes_list.getElementsByTagName(
'histogram_suffixes')
doc = minidom.Document()
for histograms_file in ChooseFiles(args):
histograms = minidom.pars... | [
"def",
"SuffixesToVariantsMigration",
"(",
"args",
")",
":",
"histogram_suffixes_list",
"=",
"minidom",
".",
"parse",
"(",
"open",
"(",
"HISTOGRAM_SUFFIXES_LIST_PATH",
")",
")",
"histogram_suffixes_nodes",
"=",
"histogram_suffixes_list",
".",
"getElementsByTagName",
"(",
... | Migates all histogram suffixes to patterned histograms. | [
"Migates",
"all",
"histogram",
"suffixes",
"to",
"patterned",
"histograms",
"."
] | [
"\"\"\"Migates all histogram suffixes to patterned histograms.\"\"\"",
"# Migrate inline patterned histograms.",
"# Update histograms.xml with patterned histograms.",
"# Remove histogram_suffixes that have already been migrated."
] | [
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
198044177ea05f421dbda65fee6c7fc76c1598cf | sunlongbo/chromium | tools/clang/scripts/test_tool.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateCompileCommands | <not_specific> | def _GenerateCompileCommands(files, include_paths):
"""Returns a JSON string containing a compilation database for the input."""
# Note: in theory, backslashes in the compile DB should work but the tools
# that write compile DBs and the tools that read them don't agree on the
# escaping convention: https://llvm... | Returns a JSON string containing a compilation database for the input. | Returns a JSON string containing a compilation database for the input. | [
"Returns",
"a",
"JSON",
"string",
"containing",
"a",
"compilation",
"database",
"for",
"the",
"input",
"."
] | def _GenerateCompileCommands(files, include_paths):
files = [f.replace('\\', '/') for f in files]
include_path_flags = ' '.join('-I %s' % include_path.replace('\\', '/')
for include_path in include_paths)
return json.dumps([{'directory': os.path.dirname(f),
'c... | [
"def",
"_GenerateCompileCommands",
"(",
"files",
",",
"include_paths",
")",
":",
"files",
"=",
"[",
"f",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")",
"for",
"f",
"in",
"files",
"]",
"include_path_flags",
"=",
"' '",
".",
"join",
"(",
"'-I %s'",
"%",
... | Returns a JSON string containing a compilation database for the input. | [
"Returns",
"a",
"JSON",
"string",
"containing",
"a",
"compilation",
"database",
"for",
"the",
"input",
"."
] | [
"\"\"\"Returns a JSON string containing a compilation database for the input.\"\"\"",
"# Note: in theory, backslashes in the compile DB should work but the tools",
"# that write compile DBs and the tools that read them don't agree on the",
"# escaping convention: https://llvm.org/bugs/show_bug.cgi?id=19687"
] | [
{
"param": "files",
"type": null
},
{
"param": "include_paths",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "files",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "include_paths",
"type": null,
"docstring": null,
"docstring_... |
52f4d5593bf61c3296345cd3906912385a51c7ef | sunlongbo/chromium | chrome/test/mini_installer/installer_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | tearDown | null | def tearDown(self):
"""Cleans up the machine if the test case fails."""
if self._clean_on_teardown:
# The last state in the test's traversal is its "clean" state, so
# use it to drive the cleanup operation.
clean_state_name = self._test[len(self._test) - 1]
... | Cleans up the machine if the test case fails. | Cleans up the machine if the test case fails. | [
"Cleans",
"up",
"the",
"machine",
"if",
"the",
"test",
"case",
"fails",
"."
] | def tearDown(self):
if self._clean_on_teardown:
clean_state_name = self._test[len(self._test) - 1]
RunCleanCommand(True,
InstallerTest._config.states[clean_state_name],
InstallerTest._variable_expander)
if InstallerTest.... | [
"def",
"tearDown",
"(",
"self",
")",
":",
"if",
"self",
".",
"_clean_on_teardown",
":",
"clean_state_name",
"=",
"self",
".",
"_test",
"[",
"len",
"(",
"self",
".",
"_test",
")",
"-",
"1",
"]",
"RunCleanCommand",
"(",
"True",
",",
"InstallerTest",
".",
... | Cleans up the machine if the test case fails. | [
"Cleans",
"up",
"the",
"machine",
"if",
"the",
"test",
"case",
"fails",
"."
] | [
"\"\"\"Cleans up the machine if the test case fails.\"\"\"",
"# The last state in the test's traversal is its \"clean\" state, so",
"# use it to drive the cleanup operation.",
"# Either copy the log to isolated outdir or dump it to console."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
52f4d5593bf61c3296345cd3906912385a51c7ef | sunlongbo/chromium | chrome/test/mini_installer/installer_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _VerifyState | null | def _VerifyState(self, state):
"""Verifies that the current machine state matches a given state.
Args:
state: A state name.
"""
LOGGER.info('Verifying state %s' % state)
try:
property_walker.Verify(InstallerTest._config.states[state],
... | Verifies that the current machine state matches a given state.
Args:
state: A state name.
| Verifies that the current machine state matches a given state. | [
"Verifies",
"that",
"the",
"current",
"machine",
"state",
"matches",
"a",
"given",
"state",
"."
] | def _VerifyState(self, state):
LOGGER.info('Verifying state %s' % state)
try:
property_walker.Verify(InstallerTest._config.states[state],
InstallerTest._variable_expander)
except AssertionError as e:
raise AssertionError("In state '%s', ... | [
"def",
"_VerifyState",
"(",
"self",
",",
"state",
")",
":",
"LOGGER",
".",
"info",
"(",
"'Verifying state %s'",
"%",
"state",
")",
"try",
":",
"property_walker",
".",
"Verify",
"(",
"InstallerTest",
".",
"_config",
".",
"states",
"[",
"state",
"]",
",",
... | Verifies that the current machine state matches a given state. | [
"Verifies",
"that",
"the",
"current",
"machine",
"state",
"matches",
"a",
"given",
"state",
"."
] | [
"\"\"\"Verifies that the current machine state matches a given state.\n\n Args:\n state: A state name.\n \"\"\"",
"# If an AssertionError occurs, we intercept it and add the state",
"# name to the error message so that we know where the test fails."
] | [
{
"param": "self",
"type": null
},
{
"param": "state",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": null,
"docstring": "A state name.",
"docstrin... |
52f4d5593bf61c3296345cd3906912385a51c7ef | sunlongbo/chromium | chrome/test/mini_installer/installer_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunCommand | null | def RunCommand(command, variable_expander):
"""Runs the given command from the current file's directory.
This function throws an Exception if the command returns with non-zero exit
status.
Args:
command: A command to run. It is expanded using Expand.
variable_expander: A VariableExpand... | Runs the given command from the current file's directory.
This function throws an Exception if the command returns with non-zero exit
status.
Args:
command: A command to run. It is expanded using Expand.
variable_expander: A VariableExpander object.
| Runs the given command from the current file's directory.
This function throws an Exception if the command returns with non-zero exit
status. | [
"Runs",
"the",
"given",
"command",
"from",
"the",
"current",
"file",
"'",
"s",
"directory",
".",
"This",
"function",
"throws",
"an",
"Exception",
"if",
"the",
"command",
"returns",
"with",
"non",
"-",
"zero",
"exit",
"status",
"."
] | def RunCommand(command, variable_expander):
expanded_command = variable_expander.Expand(command)
script_dir = os.path.dirname(os.path.abspath(__file__))
returncode = None
stdout = ''
stderr = ''
if 'uninstall_chrome.py' in expanded_command:
returncode = subprocess.call(expanded_command,
... | [
"def",
"RunCommand",
"(",
"command",
",",
"variable_expander",
")",
":",
"expanded_command",
"=",
"variable_expander",
".",
"Expand",
"(",
"command",
")",
"script_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"_... | Runs the given command from the current file's directory. | [
"Runs",
"the",
"given",
"command",
"from",
"the",
"current",
"file",
"'",
"s",
"directory",
"."
] | [
"\"\"\"Runs the given command from the current file's directory.\n\n This function throws an Exception if the command returns with non-zero exit\n status.\n\n Args:\n command: A command to run. It is expanded using Expand.\n variable_expander: A VariableExpander object.\n \"\"\"",
"# Uni... | [
{
"param": "command",
"type": null
},
{
"param": "variable_expander",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "command",
"type": null,
"docstring": "A command to run. It is expanded using Expand.",
"docstring_tokens": [
"A",
"command",
"to",
"run",
".",
"It",
"is",
"expand... |
52f4d5593bf61c3296345cd3906912385a51c7ef | sunlongbo/chromium | chrome/test/mini_installer/installer_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunCleanCommand | null | def RunCleanCommand(force_clean, clean_state, variable_expander):
"""Puts the machine in the clean state (e.g. Chrome not installed).
Args:
force_clean: A boolean indicating whether to force cleaning existing
installations.
clean_state: The state used to verify a clean machine after... | Puts the machine in the clean state (e.g. Chrome not installed).
Args:
force_clean: A boolean indicating whether to force cleaning existing
installations.
clean_state: The state used to verify a clean machine after each test.
This state is used to drive the cleanup operation... | Puts the machine in the clean state . | [
"Puts",
"the",
"machine",
"in",
"the",
"clean",
"state",
"."
] | def RunCleanCommand(force_clean, clean_state, variable_expander):
data = [
('$CHROME_LONG_NAME', ''),
('$CHROME_LONG_NAME', '--system-level'),
]
if variable_expander.Expand('$BRAND') == 'Google Chrome':
data.extend([('$CHROME_LONG_NAME_BETA', ''),
('$CHROME_LONG_... | [
"def",
"RunCleanCommand",
"(",
"force_clean",
",",
"clean_state",
",",
"variable_expander",
")",
":",
"data",
"=",
"[",
"(",
"'$CHROME_LONG_NAME'",
",",
"''",
")",
",",
"(",
"'$CHROME_LONG_NAME'",
",",
"'--system-level'",
")",
",",
"]",
"if",
"variable_expander"... | Puts the machine in the clean state (e.g. | [
"Puts",
"the",
"machine",
"in",
"the",
"clean",
"state",
"(",
"e",
".",
"g",
"."
] | [
"\"\"\"Puts the machine in the clean state (e.g. Chrome not installed).\n\n Args:\n force_clean: A boolean indicating whether to force cleaning existing\n installations.\n clean_state: The state used to verify a clean machine after each test.\n This state is used to drive the ... | [
{
"param": "force_clean",
"type": null
},
{
"param": "clean_state",
"type": null
},
{
"param": "variable_expander",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "force_clean",
"type": null,
"docstring": "A boolean indicating whether to force cleaning existing\ninstallations.",
"docstring_tokens": [
"A",
"boolean",
"indicating",
"whether",
"to",
... |
52f4d5593bf61c3296345cd3906912385a51c7ef | sunlongbo/chromium | chrome/test/mini_installer/installer_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MergePropertyDictionaries | null | def MergePropertyDictionaries(current_property, new_property):
"""Merges the new property dictionary into the current property dictionary.
This is different from general dictionary merging in that, in case there are
keys with the same name, we merge values together in the first level, and we
override e... | Merges the new property dictionary into the current property dictionary.
This is different from general dictionary merging in that, in case there are
keys with the same name, we merge values together in the first level, and we
override earlier values in the second level. For more details, take a look
a... | Merges the new property dictionary into the current property dictionary.
This is different from general dictionary merging in that, in case there are
keys with the same name, we merge values together in the first level, and we
override earlier values in the second level. | [
"Merges",
"the",
"new",
"property",
"dictionary",
"into",
"the",
"current",
"property",
"dictionary",
".",
"This",
"is",
"different",
"from",
"general",
"dictionary",
"merging",
"in",
"that",
"in",
"case",
"there",
"are",
"keys",
"with",
"the",
"same",
"name",... | def MergePropertyDictionaries(current_property, new_property):
for key, value in new_property.iteritems():
if key not in current_property:
current_property[key] = value
else:
assert (isinstance(current_property[key], dict)
and isinstance(value, dict))
... | [
"def",
"MergePropertyDictionaries",
"(",
"current_property",
",",
"new_property",
")",
":",
"for",
"key",
",",
"value",
"in",
"new_property",
".",
"iteritems",
"(",
")",
":",
"if",
"key",
"not",
"in",
"current_property",
":",
"current_property",
"[",
"key",
"]... | Merges the new property dictionary into the current property dictionary. | [
"Merges",
"the",
"new",
"property",
"dictionary",
"into",
"the",
"current",
"property",
"dictionary",
"."
] | [
"\"\"\"Merges the new property dictionary into the current property dictionary.\n\n This is different from general dictionary merging in that, in case there are\n keys with the same name, we merge values together in the first level, and we\n override earlier values in the second level. For more details, ta... | [
{
"param": "current_property",
"type": null
},
{
"param": "new_property",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "current_property",
"type": null,
"docstring": "The property dictionary to be modified.",
"docstring_tokens": [
"The",
"property",
"dictionary",
"to",
"be",
"modified",
".... |
52f4d5593bf61c3296345cd3906912385a51c7ef | sunlongbo/chromium | chrome/test/mini_installer/installer_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FilterConditionalElem | <not_specific> | def FilterConditionalElem(elem, condition_name, variable_expander):
"""Returns True if a conditional element should be processed.
Args:
elem: A dictionary.
condition_name: The name of the condition property in |elem|.
variable_expander: A variable expander used to evaluate conditions.
... | Returns True if a conditional element should be processed.
Args:
elem: A dictionary.
condition_name: The name of the condition property in |elem|.
variable_expander: A variable expander used to evaluate conditions.
Returns:
True if |elem| should be processed.
| Returns True if a conditional element should be processed. | [
"Returns",
"True",
"if",
"a",
"conditional",
"element",
"should",
"be",
"processed",
"."
] | def FilterConditionalElem(elem, condition_name, variable_expander):
if condition_name not in elem:
return True
condition = variable_expander.Expand(elem[condition_name])
return eval(condition, {'__builtins__': {'False': False, 'True': True}}) | [
"def",
"FilterConditionalElem",
"(",
"elem",
",",
"condition_name",
",",
"variable_expander",
")",
":",
"if",
"condition_name",
"not",
"in",
"elem",
":",
"return",
"True",
"condition",
"=",
"variable_expander",
".",
"Expand",
"(",
"elem",
"[",
"condition_name",
... | Returns True if a conditional element should be processed. | [
"Returns",
"True",
"if",
"a",
"conditional",
"element",
"should",
"be",
"processed",
"."
] | [
"\"\"\"Returns True if a conditional element should be processed.\n\n Args:\n elem: A dictionary.\n condition_name: The name of the condition property in |elem|.\n variable_expander: A variable expander used to evaluate conditions.\n\n Returns:\n True if |elem| should be processed.... | [
{
"param": "elem",
"type": null
},
{
"param": "condition_name",
"type": null
},
{
"param": "variable_expander",
"type": null
}
] | {
"returns": [
{
"docstring": "True if |elem| should be processed.",
"docstring_tokens": [
"True",
"if",
"|elem|",
"should",
"be",
"processed",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "el... |
52f4d5593bf61c3296345cd3906912385a51c7ef | sunlongbo/chromium | chrome/test/mini_installer/installer_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParsePropertyFiles | <not_specific> | def ParsePropertyFiles(directory, filenames, variable_expander):
"""Parses an array of .prop files.
Args:
directory: The directory where the Config file and all Property files
reside in.
filenames: An array of Property filenames.
variable_expander: A variable expander used t... | Parses an array of .prop files.
Args:
directory: The directory where the Config file and all Property files
reside in.
filenames: An array of Property filenames.
variable_expander: A variable expander used to evaluate conditions.
Returns:
A property dictionary creat... | Parses an array of .prop files. | [
"Parses",
"an",
"array",
"of",
".",
"prop",
"files",
"."
] | def ParsePropertyFiles(directory, filenames, variable_expander):
current_property = {}
for filename in filenames:
path = os.path.join(directory, filename)
new_property = json.load(open(path))
if not FilterConditionalElem(new_property, 'Condition',
var... | [
"def",
"ParsePropertyFiles",
"(",
"directory",
",",
"filenames",
",",
"variable_expander",
")",
":",
"current_property",
"=",
"{",
"}",
"for",
"filename",
"in",
"filenames",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"filename",... | Parses an array of .prop files. | [
"Parses",
"an",
"array",
"of",
".",
"prop",
"files",
"."
] | [
"\"\"\"Parses an array of .prop files.\n\n Args:\n directory: The directory where the Config file and all Property files\n reside in.\n filenames: An array of Property filenames.\n variable_expander: A variable expander used to evaluate conditions.\n\n Returns:\n A prope... | [
{
"param": "directory",
"type": null
},
{
"param": "filenames",
"type": null
},
{
"param": "variable_expander",
"type": null
}
] | {
"returns": [
{
"docstring": "A property dictionary created by merging all property dictionaries\nspecified in the array.",
"docstring_tokens": [
"A",
"property",
"dictionary",
"created",
"by",
"merging",
"all",
"property",
"dict... |
52f4d5593bf61c3296345cd3906912385a51c7ef | sunlongbo/chromium | chrome/test/mini_installer/installer_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ConfigureTempOnDrive | null | def ConfigureTempOnDrive(drive):
"""Ensures that TMP is on |drive|, restoring state on completion.
This does not change the current Python runtime's idea of tempdir.
"""
tmp_set = False
old_tmp = None
tmp_created = None
# Set TMP to something reasonable if the default temp path is not on th... | Ensures that TMP is on |drive|, restoring state on completion.
This does not change the current Python runtime's idea of tempdir.
| Ensures that TMP is on |drive|, restoring state on completion.
This does not change the current Python runtime's idea of tempdir. | [
"Ensures",
"that",
"TMP",
"is",
"on",
"|drive|",
"restoring",
"state",
"on",
"completion",
".",
"This",
"does",
"not",
"change",
"the",
"current",
"Python",
"runtime",
"'",
"s",
"idea",
"of",
"tempdir",
"."
] | def ConfigureTempOnDrive(drive):
tmp_set = False
old_tmp = None
tmp_created = None
temp = win32api.GetTempPath()
if not temp or os.path.splitdrive(temp)[0] != drive:
for candidate in [os.getenv(v) for v in ['LOCALAPPDATA', 'windir']]:
if candidate and os.path.splitdrive(candidate... | [
"def",
"ConfigureTempOnDrive",
"(",
"drive",
")",
":",
"tmp_set",
"=",
"False",
"old_tmp",
"=",
"None",
"tmp_created",
"=",
"None",
"temp",
"=",
"win32api",
".",
"GetTempPath",
"(",
")",
"if",
"not",
"temp",
"or",
"os",
".",
"path",
".",
"splitdrive",
"(... | Ensures that TMP is on |drive|, restoring state on completion. | [
"Ensures",
"that",
"TMP",
"is",
"on",
"|drive|",
"restoring",
"state",
"on",
"completion",
"."
] | [
"\"\"\"Ensures that TMP is on |drive|, restoring state on completion.\n\n This does not change the current Python runtime's idea of tempdir.\n \"\"\"",
"# Set TMP to something reasonable if the default temp path is not on the",
"# desired drive. Note that os.environ is used to mutate the environment",
"... | [
{
"param": "drive",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drive",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
52f4d5593bf61c3296345cd3906912385a51c7ef | sunlongbo/chromium | chrome/test/mini_installer/installer_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetAbsoluteExecutablePath | <not_specific> | def GetAbsoluteExecutablePath(path):
"""Gets the absolute path to the an executable.
The path can either be an absolute or relative path, as well as the
executable's name. These are used to probe user-specified and common
binary paths.
This method searches for the binary in common locations:
-... | Gets the absolute path to the an executable.
The path can either be an absolute or relative path, as well as the
executable's name. These are used to probe user-specified and common
binary paths.
This method searches for the binary in common locations:
- path location (when specifying a non-standa... | Gets the absolute path to the an executable.
The path can either be an absolute or relative path, as well as the
executable's name. These are used to probe user-specified and common
binary paths.
| [
"Gets",
"the",
"absolute",
"path",
"to",
"the",
"an",
"executable",
".",
"The",
"path",
"can",
"either",
"be",
"an",
"absolute",
"or",
"relative",
"path",
"as",
"well",
"as",
"the",
"executable",
"'",
"s",
"name",
".",
"These",
"are",
"used",
"to",
"pr... | def GetAbsoluteExecutablePath(path):
possible_paths = [
os.path.abspath(os.path.join(path)),
os.path.abspath(os.path.join('out', 'Release', path)),
os.path.abspath(os.path.join('out', 'Release_x64', path)),
os.path.abspath(os.path.join('out', 'Default', path)),
]
for _path in... | [
"def",
"GetAbsoluteExecutablePath",
"(",
"path",
")",
":",
"possible_paths",
"=",
"[",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"path",
")",
")",
",",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".... | Gets the absolute path to the an executable. | [
"Gets",
"the",
"absolute",
"path",
"to",
"the",
"an",
"executable",
"."
] | [
"\"\"\"Gets the absolute path to the an executable.\n\n The path can either be an absolute or relative path, as well as the\n executable's name. These are used to probe user-specified and common\n binary paths.\n\n This method searches for the binary in common locations:\n - path location (when speci... | [
{
"param": "path",
"type": null
}
] | {
"returns": [
{
"docstring": "Absolute path to installer.",
"docstring_tokens": [
"Absolute",
"path",
"to",
"installer",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstr... |
52f4d5593bf61c3296345cd3906912385a51c7ef | sunlongbo/chromium | chrome/test/mini_installer/installer_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetAbsoluteConfigPath | <not_specific> | def GetAbsoluteConfigPath(path):
"""Returns the absolute path to the config file.
Args:
path: The path to the file.
Returns:
Absolute path to the config file.
"""
if not os.path.exists(path):
path = os.path.join(CUR_DIR, 'config', path)
assert os.path.exists(path), 'Con... | Returns the absolute path to the config file.
Args:
path: The path to the file.
Returns:
Absolute path to the config file.
| Returns the absolute path to the config file. | [
"Returns",
"the",
"absolute",
"path",
"to",
"the",
"config",
"file",
"."
] | def GetAbsoluteConfigPath(path):
if not os.path.exists(path):
path = os.path.join(CUR_DIR, 'config', path)
assert os.path.exists(path), 'Config not found at %s' % path
LOGGER.info('Config found at %s', path)
return os.path.abspath(path) | [
"def",
"GetAbsoluteConfigPath",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"CUR_DIR",
",",
"'config'",
",",
"path",
")",
"assert",
"os",
".",
"path"... | Returns the absolute path to the config file. | [
"Returns",
"the",
"absolute",
"path",
"to",
"the",
"config",
"file",
"."
] | [
"\"\"\"Returns the absolute path to the config file.\n\n Args:\n path: The path to the file.\n\n Returns:\n Absolute path to the config file.\n \"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [
{
"docstring": "Absolute path to the config file.",
"docstring_tokens": [
"Absolute",
"path",
"to",
"the",
"config",
"file",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "path",... |
52f4d5593bf61c3296345cd3906912385a51c7ef | sunlongbo/chromium | chrome/test/mini_installer/installer_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _initialize | null | def _initialize():
"""Initializes the InstallerTest class.
This entails setting the class attributes and adding the configured test
methods to the class.
"""
args = ArgumentParser().parse_args()
log_level = (logging.ERROR if args.quiet else
logging.DEBUG if args.verbose else l... | Initializes the InstallerTest class.
This entails setting the class attributes and adding the configured test
methods to the class.
| Initializes the InstallerTest class.
This entails setting the class attributes and adding the configured test
methods to the class. | [
"Initializes",
"the",
"InstallerTest",
"class",
".",
"This",
"entails",
"setting",
"the",
"class",
"attributes",
"and",
"adding",
"the",
"configured",
"test",
"methods",
"to",
"the",
"class",
"."
] | def _initialize():
args = ArgumentParser().parse_args()
log_level = (logging.ERROR if args.quiet else
logging.DEBUG if args.verbose else logging.INFO)
LOGGER.setLevel(log_level)
handler = logging.StreamHandler()
handler.setFormatter(
logging.Formatter(
fmt='[%(as... | [
"def",
"_initialize",
"(",
")",
":",
"args",
"=",
"ArgumentParser",
"(",
")",
".",
"parse_args",
"(",
")",
"log_level",
"=",
"(",
"logging",
".",
"ERROR",
"if",
"args",
".",
"quiet",
"else",
"logging",
".",
"DEBUG",
"if",
"args",
".",
"verbose",
"else"... | Initializes the InstallerTest class. | [
"Initializes",
"the",
"InstallerTest",
"class",
"."
] | [
"\"\"\"Initializes the InstallerTest class.\n\n This entails setting the class attributes and adding the configured test\n methods to the class.\n \"\"\"",
"# Pull args from the parent proc out of the environment block.",
"# Add a test_Foo function to the InstallerTest class for each test in",
"# the... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
b23dca5689042e1e6f0742ea79c3dcfcc65d168c | sunlongbo/chromium | tools/json_schema_compiler/feature_compiler.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetCodeForFeatureValues | <not_specific> | def GetCodeForFeatureValues(feature_values):
""" Gets the Code object for setting feature values for this object. """
c = Code()
for key in sorted(feature_values.keys()):
if key in IGNORED_KEYS:
continue;
c.Append('feature->set_%s(%s);' % (key, feature_values[key]))
return c | Gets the Code object for setting feature values for this object. | Gets the Code object for setting feature values for this object. | [
"Gets",
"the",
"Code",
"object",
"for",
"setting",
"feature",
"values",
"for",
"this",
"object",
"."
] | def GetCodeForFeatureValues(feature_values):
c = Code()
for key in sorted(feature_values.keys()):
if key in IGNORED_KEYS:
continue;
c.Append('feature->set_%s(%s);' % (key, feature_values[key]))
return c | [
"def",
"GetCodeForFeatureValues",
"(",
"feature_values",
")",
":",
"c",
"=",
"Code",
"(",
")",
"for",
"key",
"in",
"sorted",
"(",
"feature_values",
".",
"keys",
"(",
")",
")",
":",
"if",
"key",
"in",
"IGNORED_KEYS",
":",
"continue",
";",
"c",
".",
"App... | Gets the Code object for setting feature values for this object. | [
"Gets",
"the",
"Code",
"object",
"for",
"setting",
"feature",
"values",
"for",
"this",
"object",
"."
] | [
"\"\"\" Gets the Code object for setting feature values for this object. \"\"\""
] | [
{
"param": "feature_values",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "feature_values",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b23dca5689042e1e6f0742ea79c3dcfcc65d168c | sunlongbo/chromium | tools/json_schema_compiler/feature_compiler.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetType | <not_specific> | def _GetType(self, value):
"""Returns the type of the given value.
"""
# For Py3 compatibility we use str in the grammar and treat unicode as str
# in Py2.
if sys.version_info.major == 2 and type(value) is unicode:
return str
return type(value) | Returns the type of the given value.
| Returns the type of the given value. | [
"Returns",
"the",
"type",
"of",
"the",
"given",
"value",
"."
] | def _GetType(self, value):
if sys.version_info.major == 2 and type(value) is unicode:
return str
return type(value) | [
"def",
"_GetType",
"(",
"self",
",",
"value",
")",
":",
"if",
"sys",
".",
"version_info",
".",
"major",
"==",
"2",
"and",
"type",
"(",
"value",
")",
"is",
"unicode",
":",
"return",
"str",
"return",
"type",
"(",
"value",
")"
] | Returns the type of the given value. | [
"Returns",
"the",
"type",
"of",
"the",
"given",
"value",
"."
] | [
"\"\"\"Returns the type of the given value.\n \"\"\"",
"# For Py3 compatibility we use str in the grammar and treat unicode as str",
"# in Py2."
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": null,
"docstring": null,
"docstring_tokens": ... |
b23dca5689042e1e6f0742ea79c3dcfcc65d168c | sunlongbo/chromium | tools/json_schema_compiler/feature_compiler.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetCheckedValue | <not_specific> | def _GetCheckedValue(self, key, expected_type, expected_values,
enum_map, value):
"""Returns a string to be used in the generated C++ code for a given key's
python value, or None if the value is invalid. For example, if the python
value is True, this returns 'true', for a string foo, ... | Returns a string to be used in the generated C++ code for a given key's
python value, or None if the value is invalid. For example, if the python
value is True, this returns 'true', for a string foo, this returns "foo",
and for an enum, this looks up the C++ definition in the enum map.
key: The key be... | Returns a string to be used in the generated C++ code for a given key's
python value, or None if the value is invalid. For example, if the python
value is True, this returns 'true', for a string foo, this returns "foo",
and for an enum, this looks up the C++ definition in the enum map.
key: The key being parsed.
expect... | [
"Returns",
"a",
"string",
"to",
"be",
"used",
"in",
"the",
"generated",
"C",
"++",
"code",
"for",
"a",
"given",
"key",
"'",
"s",
"python",
"value",
"or",
"None",
"if",
"the",
"value",
"is",
"invalid",
".",
"For",
"example",
"if",
"the",
"python",
"va... | def _GetCheckedValue(self, key, expected_type, expected_values,
enum_map, value):
valid = True
if expected_values and value not in expected_values:
self._AddKeyError(key, 'Illegal value: "%s"' % value)
valid = False
t = self._GetType(value)
if expected_type and t is no... | [
"def",
"_GetCheckedValue",
"(",
"self",
",",
"key",
",",
"expected_type",
",",
"expected_values",
",",
"enum_map",
",",
"value",
")",
":",
"valid",
"=",
"True",
"if",
"expected_values",
"and",
"value",
"not",
"in",
"expected_values",
":",
"self",
".",
"_AddK... | Returns a string to be used in the generated C++ code for a given key's
python value, or None if the value is invalid. | [
"Returns",
"a",
"string",
"to",
"be",
"used",
"in",
"the",
"generated",
"C",
"++",
"code",
"for",
"a",
"given",
"key",
"'",
"s",
"python",
"value",
"or",
"None",
"if",
"the",
"value",
"is",
"invalid",
"."
] | [
"\"\"\"Returns a string to be used in the generated C++ code for a given key's\n python value, or None if the value is invalid. For example, if the python\n value is True, this returns 'true', for a string foo, this returns \"foo\",\n and for an enum, this looks up the C++ definition in the enum map.\n ... | [
{
"param": "self",
"type": null
},
{
"param": "key",
"type": null
},
{
"param": "expected_type",
"type": null
},
{
"param": "expected_values",
"type": null
},
{
"param": "enum_map",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "key",
"type": null,
"docstring": null,
"docstring_tokens": []... |
b23dca5689042e1e6f0742ea79c3dcfcc65d168c | sunlongbo/chromium | tools/json_schema_compiler/feature_compiler.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ParseKey | <not_specific> | def _ParseKey(self, key, value, shared_values, grammar):
"""Parses the specific key according to the grammar rule for that key if it
is present in the json value.
key: The key to parse.
value: The full value for this feature.
shared_values: Set of shared vfalues associated with this feature.
... | Parses the specific key according to the grammar rule for that key if it
is present in the json value.
key: The key to parse.
value: The full value for this feature.
shared_values: Set of shared vfalues associated with this feature.
grammar: The rule for the specific key.
| Parses the specific key according to the grammar rule for that key if it
is present in the json value.
key: The key to parse.
value: The full value for this feature.
shared_values: Set of shared vfalues associated with this feature.
grammar: The rule for the specific key. | [
"Parses",
"the",
"specific",
"key",
"according",
"to",
"the",
"grammar",
"rule",
"for",
"that",
"key",
"if",
"it",
"is",
"present",
"in",
"the",
"json",
"value",
".",
"key",
":",
"The",
"key",
"to",
"parse",
".",
"value",
":",
"The",
"full",
"value",
... | def _ParseKey(self, key, value, shared_values, grammar):
if key not in value:
return
v = value[key]
is_all = False
if v == 'all' and list in grammar and 'allow_all' in grammar[list]:
assert grammar[list]['allow_all'], '`allow_all` only supports `True`.'
v = []
is_all = True
i... | [
"def",
"_ParseKey",
"(",
"self",
",",
"key",
",",
"value",
",",
"shared_values",
",",
"grammar",
")",
":",
"if",
"key",
"not",
"in",
"value",
":",
"return",
"v",
"=",
"value",
"[",
"key",
"]",
"is_all",
"=",
"False",
"if",
"v",
"==",
"'all'",
"and"... | Parses the specific key according to the grammar rule for that key if it
is present in the json value. | [
"Parses",
"the",
"specific",
"key",
"according",
"to",
"the",
"grammar",
"rule",
"for",
"that",
"key",
"if",
"it",
"is",
"present",
"in",
"the",
"json",
"value",
"."
] | [
"\"\"\"Parses the specific key according to the grammar rule for that key if it\n is present in the json value.\n key: The key to parse.\n value: The full value for this feature.\n shared_values: Set of shared vfalues associated with this feature.\n grammar: The rule for the specific key.\n ... | [
{
"param": "self",
"type": null
},
{
"param": "key",
"type": null
},
{
"param": "value",
"type": null
},
{
"param": "shared_values",
"type": null
},
{
"param": "grammar",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "key",
"type": null,
"docstring": null,
"docstring_tokens": []... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.