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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a57cf89aa74f04b5dacf93d34dd9cdb8bf37c4c4 | sunlongbo/chromium | tools/sublime/compile_current_file.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | run | <not_specific> | def run(self, edit, target_build):
"""The method called by Sublime Text to execute our command.
Note that this command is a toggle, so if the thread is are already running,
calling run will interrupt it.
Args:
edit: Sumblime Text specific edit brace.
target_build: Release/Debug/Other... Us... | The method called by Sublime Text to execute our command.
Note that this command is a toggle, so if the thread is are already running,
calling run will interrupt it.
Args:
edit: Sumblime Text specific edit brace.
target_build: Release/Debug/Other... Used for the subfolder of out.
| The method called by Sublime Text to execute our command.
Note that this command is a toggle, so if the thread is are already running,
calling run will interrupt it. | [
"The",
"method",
"called",
"by",
"Sublime",
"Text",
"to",
"execute",
"our",
"command",
".",
"Note",
"that",
"this",
"command",
"is",
"a",
"toggle",
"so",
"if",
"the",
"thread",
"is",
"are",
"already",
"running",
"calling",
"run",
"will",
"interrupt",
"it",... | def run(self, edit, target_build):
if self.thread and self.thread.is_alive():
self.interrupted = True
self.thread.join(5.0)
self.update_panel_text("\n\nInterrupted current command:\n%s\n" % command)
self.thread = None
return
self.start_time = datetime.datetime.now()
self.output... | [
"def",
"run",
"(",
"self",
",",
"edit",
",",
"target_build",
")",
":",
"if",
"self",
".",
"thread",
"and",
"self",
".",
"thread",
".",
"is_alive",
"(",
")",
":",
"self",
".",
"interrupted",
"=",
"True",
"self",
".",
"thread",
".",
"join",
"(",
"5.0... | The method called by Sublime Text to execute our command. | [
"The",
"method",
"called",
"by",
"Sublime",
"Text",
"to",
"execute",
"our",
"command",
"."
] | [
"\"\"\"The method called by Sublime Text to execute our command.\n\n Note that this command is a toggle, so if the thread is are already running,\n calling run will interrupt it.\n\n Args:\n edit: Sumblime Text specific edit brace.\n target_build: Release/Debug/Other... Used for the subfolder of ... | [
{
"param": "self",
"type": null
},
{
"param": "edit",
"type": null
},
{
"param": "target_build",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "edit",
"type": null,
"docstring": "Sumblime Text specific edit brac... |
a5820a6c52f2500d3925261c81be647380bed8fe | sunlongbo/chromium | tools/binary_size/libsupersize/upload_html_viewer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _FirebaseDeploy | null | def _FirebaseDeploy(project_dir, deploy_mode=PROD):
"""Deploy the project to firebase hosting."""
if deploy_mode == DEV:
subprocess.check_call([
'firebase', '-P', FIREBASE_PROJECT, 'emulators:start', '--only',
'hosting'
],
cwd=project_dir)
elif deploy_mode == STAG... | Deploy the project to firebase hosting. | Deploy the project to firebase hosting. | [
"Deploy",
"the",
"project",
"to",
"firebase",
"hosting",
"."
] | def _FirebaseDeploy(project_dir, deploy_mode=PROD):
if deploy_mode == DEV:
subprocess.check_call([
'firebase', '-P', FIREBASE_PROJECT, 'emulators:start', '--only',
'hosting'
],
cwd=project_dir)
elif deploy_mode == STAGING:
print('Note: deploying to staging requi... | [
"def",
"_FirebaseDeploy",
"(",
"project_dir",
",",
"deploy_mode",
"=",
"PROD",
")",
":",
"if",
"deploy_mode",
"==",
"DEV",
":",
"subprocess",
".",
"check_call",
"(",
"[",
"'firebase'",
",",
"'-P'",
",",
"FIREBASE_PROJECT",
",",
"'emulators:start'",
",",
"'--on... | Deploy the project to firebase hosting. | [
"Deploy",
"the",
"project",
"to",
"firebase",
"hosting",
"."
] | [
"\"\"\"Deploy the project to firebase hosting.\"\"\""
] | [
{
"param": "project_dir",
"type": null
},
{
"param": "deploy_mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "project_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "deploy_mode",
"type": null,
"docstring": null,
"docstr... |
a5820a6c52f2500d3925261c81be647380bed8fe | sunlongbo/chromium | tools/binary_size/libsupersize/upload_html_viewer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CopyStaticFiles | null | def _CopyStaticFiles(project_static_dir):
"""Copy over static files from the static directory."""
static_files = os.path.join(os.path.dirname(__file__), 'static')
shutil.copytree(static_files, project_static_dir)
if not all(
os.path.exists(os.path.join(static_files, f)) for f in CASPIAN_FILES):
print(... | Copy over static files from the static directory. | Copy over static files from the static directory. | [
"Copy",
"over",
"static",
"files",
"from",
"the",
"static",
"directory",
"."
] | def _CopyStaticFiles(project_static_dir):
static_files = os.path.join(os.path.dirname(__file__), 'static')
shutil.copytree(static_files, project_static_dir)
if not all(
os.path.exists(os.path.join(static_files, f)) for f in CASPIAN_FILES):
print('Some caspian files do not exist in ({}). Downloading *all... | [
"def",
"_CopyStaticFiles",
"(",
"project_static_dir",
")",
":",
"static_files",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"'static'",
")",
"shutil",
".",
"copytree",
"(",
"static_files",
",",
... | Copy over static files from the static directory. | [
"Copy",
"over",
"static",
"files",
"from",
"the",
"static",
"directory",
"."
] | [
"\"\"\"Copy over static files from the static directory.\"\"\""
] | [
{
"param": "project_static_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "project_static_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
01306dd82d3f9f6d9b7b6a8dd181fa3c2f0b0381 | sunlongbo/chromium | third_party/blink/web_tests/external/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _LintWPT | <not_specific> | def _LintWPT(input_api, output_api):
"""Lint functionality duplicated from web-platform-tests upstream.
This is to catch lint errors that would otherwise be caught in WPT CI.
See https://web-platform-tests.org/writing-tests/lint-tool.html for more
information about the lint tool.
"""
wpt_path =... | Lint functionality duplicated from web-platform-tests upstream.
This is to catch lint errors that would otherwise be caught in WPT CI.
See https://web-platform-tests.org/writing-tests/lint-tool.html for more
information about the lint tool.
| Lint functionality duplicated from web-platform-tests upstream.
This is to catch lint errors that would otherwise be caught in WPT CI. | [
"Lint",
"functionality",
"duplicated",
"from",
"web",
"-",
"platform",
"-",
"tests",
"upstream",
".",
"This",
"is",
"to",
"catch",
"lint",
"errors",
"that",
"would",
"otherwise",
"be",
"caught",
"in",
"WPT",
"CI",
"."
] | def _LintWPT(input_api, output_api):
wpt_path = input_api.os_path.join(input_api.PresubmitLocalPath(), 'wpt')
linter_path = input_api.os_path.join(input_api.change.RepositoryRoot(),
'third_party', 'wpt_tools', 'wpt',
'wpt')
pa... | [
"def",
"_LintWPT",
"(",
"input_api",
",",
"output_api",
")",
":",
"wpt_path",
"=",
"input_api",
".",
"os_path",
".",
"join",
"(",
"input_api",
".",
"PresubmitLocalPath",
"(",
")",
",",
"'wpt'",
")",
"linter_path",
"=",
"input_api",
".",
"os_path",
".",
"jo... | Lint functionality duplicated from web-platform-tests upstream. | [
"Lint",
"functionality",
"duplicated",
"from",
"web",
"-",
"platform",
"-",
"tests",
"upstream",
"."
] | [
"\"\"\"Lint functionality duplicated from web-platform-tests upstream.\n\n This is to catch lint errors that would otherwise be caught in WPT CI.\n See https://web-platform-tests.org/writing-tests/lint-tool.html for more\n information about the lint tool.\n \"\"\"",
"# If there are changes in LayoutTe... | [
{
"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... |
014f2bf04da4f2e11a13d57d910ecc8a8b489113 | sunlongbo/chromium | mojo/public/tools/bindings/generators/mojom_cpp_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ContainsOnlyEnums | <not_specific> | def _ContainsOnlyEnums(self):
"""Returns whether this module contains only enums.
When true, the generated headers can skip many includes.
"""
m = self.module
return (len(m.enums) > 0 and len(m.structs) == 0 and len(m.interfaces) == 0
and len(m.unions) == 0 and len(m.constants) == 0) | Returns whether this module contains only enums.
When true, the generated headers can skip many includes.
| Returns whether this module contains only enums.
When true, the generated headers can skip many includes. | [
"Returns",
"whether",
"this",
"module",
"contains",
"only",
"enums",
".",
"When",
"true",
"the",
"generated",
"headers",
"can",
"skip",
"many",
"includes",
"."
] | def _ContainsOnlyEnums(self):
m = self.module
return (len(m.enums) > 0 and len(m.structs) == 0 and len(m.interfaces) == 0
and len(m.unions) == 0 and len(m.constants) == 0) | [
"def",
"_ContainsOnlyEnums",
"(",
"self",
")",
":",
"m",
"=",
"self",
".",
"module",
"return",
"(",
"len",
"(",
"m",
".",
"enums",
")",
">",
"0",
"and",
"len",
"(",
"m",
".",
"structs",
")",
"==",
"0",
"and",
"len",
"(",
"m",
".",
"interfaces",
... | Returns whether this module contains only enums. | [
"Returns",
"whether",
"this",
"module",
"contains",
"only",
"enums",
"."
] | [
"\"\"\"Returns whether this module contains only enums.\n\n When true, the generated headers can skip many includes.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
014f2bf04da4f2e11a13d57d910ecc8a8b489113 | sunlongbo/chromium | mojo/public/tools/bindings/generators/mojom_cpp_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _IsFullHeaderRequiredForImport | <not_specific> | def _IsFullHeaderRequiredForImport(self, imported_module):
"""Determines whether a given import module requires a full header include,
or if the forward header is sufficient."""
# Type-mapped kinds may not have forward declarations, and nested kinds
# cannot be forward declared.
if any(kind.module ... | Determines whether a given import module requires a full header include,
or if the forward header is sufficient. | Determines whether a given import module requires a full header include,
or if the forward header is sufficient. | [
"Determines",
"whether",
"a",
"given",
"import",
"module",
"requires",
"a",
"full",
"header",
"include",
"or",
"if",
"the",
"forward",
"header",
"is",
"sufficient",
"."
] | def _IsFullHeaderRequiredForImport(self, imported_module):
if any(kind.module == imported_module and (
(self._IsTypemappedKind(kind) and not self.
_GetTypemappedForwardDeclaration(kind)) or kind.parent_kind != None)
for kind in self.module.imported_kinds.values()):
return True
... | [
"def",
"_IsFullHeaderRequiredForImport",
"(",
"self",
",",
"imported_module",
")",
":",
"if",
"any",
"(",
"kind",
".",
"module",
"==",
"imported_module",
"and",
"(",
"(",
"self",
".",
"_IsTypemappedKind",
"(",
"kind",
")",
"and",
"not",
"self",
".",
"_GetTyp... | Determines whether a given import module requires a full header include,
or if the forward header is sufficient. | [
"Determines",
"whether",
"a",
"given",
"import",
"module",
"requires",
"a",
"full",
"header",
"include",
"or",
"if",
"the",
"forward",
"header",
"is",
"sufficient",
"."
] | [
"\"\"\"Determines whether a given import module requires a full header include,\n or if the forward header is sufficient.\"\"\"",
"# Type-mapped kinds may not have forward declarations, and nested kinds",
"# cannot be forward declared.",
"# For most kinds, whether or not a full definition is needed depends... | [
{
"param": "self",
"type": null
},
{
"param": "imported_module",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "imported_module",
"type": null,
"docstring": null,
"docstring... |
833c2220c73ecb0bf3d17c6fd05c0eddf425241d | sunlongbo/chromium | tools/android/dependency_analysis/graph.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | sorted_edges_by_name | <not_specific> | def sorted_edges_by_name(edges):
"""Sorts a list of edges (tuples) by their names.
Prioritizes sorting by the first node in an edge."""
return sorted(edges, key=lambda edge: (edge[0].name, edge[1].name)) | Sorts a list of edges (tuples) by their names.
Prioritizes sorting by the first node in an edge. | Sorts a list of edges (tuples) by their names.
Prioritizes sorting by the first node in an edge. | [
"Sorts",
"a",
"list",
"of",
"edges",
"(",
"tuples",
")",
"by",
"their",
"names",
".",
"Prioritizes",
"sorting",
"by",
"the",
"first",
"node",
"in",
"an",
"edge",
"."
] | def sorted_edges_by_name(edges):
return sorted(edges, key=lambda edge: (edge[0].name, edge[1].name)) | [
"def",
"sorted_edges_by_name",
"(",
"edges",
")",
":",
"return",
"sorted",
"(",
"edges",
",",
"key",
"=",
"lambda",
"edge",
":",
"(",
"edge",
"[",
"0",
"]",
".",
"name",
",",
"edge",
"[",
"1",
"]",
".",
"name",
")",
")"
] | Sorts a list of edges (tuples) by their names. | [
"Sorts",
"a",
"list",
"of",
"edges",
"(",
"tuples",
")",
"by",
"their",
"names",
"."
] | [
"\"\"\"Sorts a list of edges (tuples) by their names.\n\n Prioritizes sorting by the first node in an edge.\"\"\""
] | [
{
"param": "edges",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "edges",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
833c2220c73ecb0bf3d17c6fd05c0eddf425241d | sunlongbo/chromium | tools/android/dependency_analysis/graph.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | create_node_from_key | <not_specific> | def create_node_from_key(self, key: str):
"""Given a unique key, creates and returns a Node object.
Should be overridden by child classes.
"""
return Node(key) | Given a unique key, creates and returns a Node object.
Should be overridden by child classes.
| Given a unique key, creates and returns a Node object.
Should be overridden by child classes. | [
"Given",
"a",
"unique",
"key",
"creates",
"and",
"returns",
"a",
"Node",
"object",
".",
"Should",
"be",
"overridden",
"by",
"child",
"classes",
"."
] | def create_node_from_key(self, key: str):
return Node(key) | [
"def",
"create_node_from_key",
"(",
"self",
",",
"key",
":",
"str",
")",
":",
"return",
"Node",
"(",
"key",
")"
] | Given a unique key, creates and returns a Node object. | [
"Given",
"a",
"unique",
"key",
"creates",
"and",
"returns",
"a",
"Node",
"object",
"."
] | [
"\"\"\"Given a unique key, creates and returns a Node object.\n\n Should be overridden by child classes.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "key",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "key",
"type": "str",
"docstring": null,
"docstring_tokens": [... |
833c2220c73ecb0bf3d17c6fd05c0eddf425241d | sunlongbo/chromium | tools/android/dependency_analysis/graph.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | add_node_if_new | Node | def add_node_if_new(self, key: str) -> Node:
"""Adds a Node to the graph.
A new Node object is constructed from the given key and added.
If the key already exists in the graph, no change is made to the graph.
Args:
key: A unique key to create the new Node from.
Ret... | Adds a Node to the graph.
A new Node object is constructed from the given key and added.
If the key already exists in the graph, no change is made to the graph.
Args:
key: A unique key to create the new Node from.
Returns:
The Node with the given key in the gra... | Adds a Node to the graph.
A new Node object is constructed from the given key and added.
If the key already exists in the graph, no change is made to the graph. | [
"Adds",
"a",
"Node",
"to",
"the",
"graph",
".",
"A",
"new",
"Node",
"object",
"is",
"constructed",
"from",
"the",
"given",
"key",
"and",
"added",
".",
"If",
"the",
"key",
"already",
"exists",
"in",
"the",
"graph",
"no",
"change",
"is",
"made",
"to",
... | def add_node_if_new(self, key: str) -> Node:
node = self._key_to_node.get(key)
if node is None:
node = self.create_node_from_key(key)
self._key_to_node[key] = node
return node | [
"def",
"add_node_if_new",
"(",
"self",
",",
"key",
":",
"str",
")",
"->",
"Node",
":",
"node",
"=",
"self",
".",
"_key_to_node",
".",
"get",
"(",
"key",
")",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"create_node_from_key",
"(",
"key... | Adds a Node to the graph. | [
"Adds",
"a",
"Node",
"to",
"the",
"graph",
"."
] | [
"\"\"\"Adds a Node to the graph.\n\n A new Node object is constructed from the given key and added.\n If the key already exists in the graph, no change is made to the graph.\n\n Args:\n key: A unique key to create the new Node from.\n\n Returns:\n The Node with the ... | [
{
"param": "self",
"type": null
},
{
"param": "key",
"type": "str"
}
] | {
"returns": [
{
"docstring": "The Node with the given key in the graph.",
"docstring_tokens": [
"The",
"Node",
"with",
"the",
"given",
"key",
"in",
"the",
"graph",
"."
],
"type": null
}
],
"raises": []... |
833c2220c73ecb0bf3d17c6fd05c0eddf425241d | sunlongbo/chromium | tools/android/dependency_analysis/graph.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | add_edge_if_new | bool | def add_edge_if_new(self, src: str, dest: str) -> bool:
"""Adds a directed edge to the graph.
The source and destination nodes are created and added if they
do not already exist. If the edge already exists in the graph,
this is a no-op.
Args:
src: A unique key repre... | Adds a directed edge to the graph.
The source and destination nodes are created and added if they
do not already exist. If the edge already exists in the graph,
this is a no-op.
Args:
src: A unique key representing the source node.
dest: A unique key representin... | Adds a directed edge to the graph.
The source and destination nodes are created and added if they
do not already exist. If the edge already exists in the graph,
this is a no-op. | [
"Adds",
"a",
"directed",
"edge",
"to",
"the",
"graph",
".",
"The",
"source",
"and",
"destination",
"nodes",
"are",
"created",
"and",
"added",
"if",
"they",
"do",
"not",
"already",
"exist",
".",
"If",
"the",
"edge",
"already",
"exists",
"in",
"the",
"grap... | def add_edge_if_new(self, src: str, dest: str) -> bool:
src_node = self.add_node_if_new(src)
dest_node = self.add_node_if_new(dest)
if dest_node not in src_node.outbound:
src_node.add_outbound(dest_node)
dest_node.add_inbound(src_node)
self._edges.append((src_... | [
"def",
"add_edge_if_new",
"(",
"self",
",",
"src",
":",
"str",
",",
"dest",
":",
"str",
")",
"->",
"bool",
":",
"src_node",
"=",
"self",
".",
"add_node_if_new",
"(",
"src",
")",
"dest_node",
"=",
"self",
".",
"add_node_if_new",
"(",
"dest",
")",
"if",
... | Adds a directed edge to the graph. | [
"Adds",
"a",
"directed",
"edge",
"to",
"the",
"graph",
"."
] | [
"\"\"\"Adds a directed edge to the graph.\n\n The source and destination nodes are created and added if they\n do not already exist. If the edge already exists in the graph,\n this is a no-op.\n\n Args:\n src: A unique key representing the source node.\n dest: A uni... | [
{
"param": "self",
"type": null
},
{
"param": "src",
"type": "str"
},
{
"param": "dest",
"type": "str"
}
] | {
"returns": [
{
"docstring": "True if the edge was added (did not already exist), else False",
"docstring_tokens": [
"True",
"if",
"the",
"edge",
"was",
"added",
"(",
"did",
"not",
"already",
"exist",
")",... |
8368448dba2d2e3eb5b2b4ba55a8f97464dd6c77 | sunlongbo/chromium | tools/perf/page_sets/media_cases.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ShouldMeasureMemory | <not_specific> | def ShouldMeasureMemory(self):
"""Returns whether the page should do a memory dump.
Also controls whether the pages enables the memory metric.
Subclasses should override to disable memory measurement.
Memory dumps are cpu-intensive, so it is reasonable keep it off in
some cases to avoid skewing cpu... | Returns whether the page should do a memory dump.
Also controls whether the pages enables the memory metric.
Subclasses should override to disable memory measurement.
Memory dumps are cpu-intensive, so it is reasonable keep it off in
some cases to avoid skewing cpu usage measurements.
| Returns whether the page should do a memory dump.
Also controls whether the pages enables the memory metric.
Subclasses should override to disable memory measurement.
Memory dumps are cpu-intensive, so it is reasonable keep it off in
some cases to avoid skewing cpu usage measurements. | [
"Returns",
"whether",
"the",
"page",
"should",
"do",
"a",
"memory",
"dump",
".",
"Also",
"controls",
"whether",
"the",
"pages",
"enables",
"the",
"memory",
"metric",
".",
"Subclasses",
"should",
"override",
"to",
"disable",
"memory",
"measurement",
".",
"Memor... | def ShouldMeasureMemory(self):
return self._measure_memory | [
"def",
"ShouldMeasureMemory",
"(",
"self",
")",
":",
"return",
"self",
".",
"_measure_memory"
] | Returns whether the page should do a memory dump. | [
"Returns",
"whether",
"the",
"page",
"should",
"do",
"a",
"memory",
"dump",
"."
] | [
"\"\"\"Returns whether the page should do a memory dump.\n\n Also controls whether the pages enables the memory metric.\n Subclasses should override to disable memory measurement.\n Memory dumps are cpu-intensive, so it is reasonable keep it off in\n some cases to avoid skewing cpu usage measurements.\n... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ff035a3fade02b40cd91944dab70394a5a12b795 | sunlongbo/chromium | tools/perf/cli_tools/soundwave/worker_pool.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Run | <not_specific> | def Run(label, worker, args, items, stream=None):
"""Use a pool of workers to concurrently process a sequence of items.
Args:
label: A string displayed by the progress indicator when the job starts.
worker: A function with the worker implementation. See example above.
args: An argparse.Namespace() obje... | Use a pool of workers to concurrently process a sequence of items.
Args:
label: A string displayed by the progress indicator when the job starts.
worker: A function with the worker implementation. See example above.
args: An argparse.Namespace() object used to initialize the workers. The
value of... | Use a pool of workers to concurrently process a sequence of items. | [
"Use",
"a",
"pool",
"of",
"workers",
"to",
"concurrently",
"process",
"a",
"sequence",
"of",
"items",
"."
] | def Run(label, worker, args, items, stream=None):
pool = multiprocessing.Pool(
processes=args.processes, initializer=worker, initargs=(args,))
time_started = pandas.Timestamp.utcnow()
try:
ProgressIndicator(label, pool.imap_unordered(_Worker, items), stream=stream)
time_finished = pandas.Timestamp.u... | [
"def",
"Run",
"(",
"label",
",",
"worker",
",",
"args",
",",
"items",
",",
"stream",
"=",
"None",
")",
":",
"pool",
"=",
"multiprocessing",
".",
"Pool",
"(",
"processes",
"=",
"args",
".",
"processes",
",",
"initializer",
"=",
"worker",
",",
"initargs"... | Use a pool of workers to concurrently process a sequence of items. | [
"Use",
"a",
"pool",
"of",
"workers",
"to",
"concurrently",
"process",
"a",
"sequence",
"of",
"items",
"."
] | [
"\"\"\"Use a pool of workers to concurrently process a sequence of items.\n\n Args:\n label: A string displayed by the progress indicator when the job starts.\n worker: A function with the worker implementation. See example above.\n args: An argparse.Namespace() object used to initialize the workers. The\... | [
{
"param": "label",
"type": null
},
{
"param": "worker",
"type": null
},
{
"param": "args",
"type": null
},
{
"param": "items",
"type": null
},
{
"param": "stream",
"type": null
}
] | {
"returns": [
{
"docstring": "Total time in seconds spent by the pool to process all items.",
"docstring_tokens": [
"Total",
"time",
"in",
"seconds",
"spent",
"by",
"the",
"pool",
"to",
"process",
"all",
"... |
ff36b98df5d844c792ea76b048e39b6bc8a6ba22 | sunlongbo/chromium | components/policy/tools/template_writers/writers/gpo_editor_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | IsPolicyOnWin7Only | <not_specific> | def IsPolicyOnWin7Only(self, policy):
''' Returns true if the policy is supported on win7 only.'''
for suppported_on in policy.get('supported_on', []):
if 'win7' == suppported_on.get('platform', []):
return True
return False | Returns true if the policy is supported on win7 only. | Returns true if the policy is supported on win7 only. | [
"Returns",
"true",
"if",
"the",
"policy",
"is",
"supported",
"on",
"win7",
"only",
"."
] | def IsPolicyOnWin7Only(self, policy):
for suppported_on in policy.get('supported_on', []):
if 'win7' == suppported_on.get('platform', []):
return True
return False | [
"def",
"IsPolicyOnWin7Only",
"(",
"self",
",",
"policy",
")",
":",
"for",
"suppported_on",
"in",
"policy",
".",
"get",
"(",
"'supported_on'",
",",
"[",
"]",
")",
":",
"if",
"'win7'",
"==",
"suppported_on",
".",
"get",
"(",
"'platform'",
",",
"[",
"]",
... | Returns true if the policy is supported on win7 only. | [
"Returns",
"true",
"if",
"the",
"policy",
"is",
"supported",
"on",
"win7",
"only",
"."
] | [
"''' Returns true if the policy is supported on win7 only.'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "policy",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "policy",
"type": null,
"docstring": null,
"docstring_tokens":... |
ff36b98df5d844c792ea76b048e39b6bc8a6ba22 | sunlongbo/chromium | components/policy/tools/template_writers/writers/gpo_editor_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RemovePoliciesFromList | null | def _RemovePoliciesFromList(self, policy_list, policies_to_remove):
'''Remove policies_to_remove from groups and the top-level list.'''
# We only compare the 'name' property.
policies_to_remove = set([p['name'] for p in policies_to_remove])
# Remove from top-level list.
policy_list[:] = [
p... | Remove policies_to_remove from groups and the top-level list. | Remove policies_to_remove from groups and the top-level list. | [
"Remove",
"policies_to_remove",
"from",
"groups",
"and",
"the",
"top",
"-",
"level",
"list",
"."
] | def _RemovePoliciesFromList(self, policy_list, policies_to_remove):
policies_to_remove = set([p['name'] for p in policies_to_remove])
policy_list[:] = [
p for p in policy_list if p['name'] not in policies_to_remove
]
for group in policy_list:
if group['type'] != 'group':
continue
... | [
"def",
"_RemovePoliciesFromList",
"(",
"self",
",",
"policy_list",
",",
"policies_to_remove",
")",
":",
"policies_to_remove",
"=",
"set",
"(",
"[",
"p",
"[",
"'name'",
"]",
"for",
"p",
"in",
"policies_to_remove",
"]",
")",
"policy_list",
"[",
":",
"]",
"=",
... | Remove policies_to_remove from groups and the top-level list. | [
"Remove",
"policies_to_remove",
"from",
"groups",
"and",
"the",
"top",
"-",
"level",
"list",
"."
] | [
"'''Remove policies_to_remove from groups and the top-level list.'''",
"# We only compare the 'name' property.",
"# Remove from top-level list.",
"# Remove from groups.",
"# Remove empty groups."
] | [
{
"param": "self",
"type": null
},
{
"param": "policy_list",
"type": null
},
{
"param": "policies_to_remove",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "policy_list",
"type": null,
"docstring": null,
"docstring_tok... |
4e538b4188968b9fa6a4a8967c3caca52e756c5f | sunlongbo/chromium | tools/mac/power/collapse_profile_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testEmpty | null | def testEmpty(self):
"""Tests that a directory with no valid stacks triggers a failure."""
with self.assertRaises(SystemExit):
collapser = StackCollapser('./samples.collapsed')
collapser.read_dtrace_logs('./test_data/empty/') | Tests that a directory with no valid stacks triggers a failure. | Tests that a directory with no valid stacks triggers a failure. | [
"Tests",
"that",
"a",
"directory",
"with",
"no",
"valid",
"stacks",
"triggers",
"a",
"failure",
"."
] | def testEmpty(self):
with self.assertRaises(SystemExit):
collapser = StackCollapser('./samples.collapsed')
collapser.read_dtrace_logs('./test_data/empty/') | [
"def",
"testEmpty",
"(",
"self",
")",
":",
"with",
"self",
".",
"assertRaises",
"(",
"SystemExit",
")",
":",
"collapser",
"=",
"StackCollapser",
"(",
"'./samples.collapsed'",
")",
"collapser",
".",
"read_dtrace_logs",
"(",
"'./test_data/empty/'",
")"
] | Tests that a directory with no valid stacks triggers a failure. | [
"Tests",
"that",
"a",
"directory",
"with",
"no",
"valid",
"stacks",
"triggers",
"a",
"failure",
"."
] | [
"\"\"\"Tests that a directory with no valid stacks triggers a failure.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e538b4188968b9fa6a4a8967c3caca52e756c5f | sunlongbo/chromium | tools/mac/power/collapse_profile_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testValidBlock | null | def testValidBlock(self):
"""Tests basic parsing of the DTrace format."""
collapser = StackCollapser('./samples.collapsed')
collapser.read_dtrace_logs('./test_data/valid/')
self.assertEquals(collapser.samples, [{
'frames': ['foo', 'bar', 'baz'],
'weight': 12
}]) | Tests basic parsing of the DTrace format. | Tests basic parsing of the DTrace format. | [
"Tests",
"basic",
"parsing",
"of",
"the",
"DTrace",
"format",
"."
] | def testValidBlock(self):
collapser = StackCollapser('./samples.collapsed')
collapser.read_dtrace_logs('./test_data/valid/')
self.assertEquals(collapser.samples, [{
'frames': ['foo', 'bar', 'baz'],
'weight': 12
}]) | [
"def",
"testValidBlock",
"(",
"self",
")",
":",
"collapser",
"=",
"StackCollapser",
"(",
"'./samples.collapsed'",
")",
"collapser",
".",
"read_dtrace_logs",
"(",
"'./test_data/valid/'",
")",
"self",
".",
"assertEquals",
"(",
"collapser",
".",
"samples",
",",
"[",
... | Tests basic parsing of the DTrace format. | [
"Tests",
"basic",
"parsing",
"of",
"the",
"DTrace",
"format",
"."
] | [
"\"\"\"Tests basic parsing of the DTrace format.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e538b4188968b9fa6a4a8967c3caca52e756c5f | sunlongbo/chromium | tools/mac/power/collapse_profile_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testRepeatedFunction | null | def testRepeatedFunction(self):
"""Tests accumulation of samples of the same function over many files."""
collapser = StackCollapser('./samples.collapsed')
collapser.read_dtrace_logs('./test_data/repeated/')
self.assertEquals(collapser.samples, [{
'frames': ['foo', 'bar', 'baz'],
'weigh... | Tests accumulation of samples of the same function over many files. | Tests accumulation of samples of the same function over many files. | [
"Tests",
"accumulation",
"of",
"samples",
"of",
"the",
"same",
"function",
"over",
"many",
"files",
"."
] | def testRepeatedFunction(self):
collapser = StackCollapser('./samples.collapsed')
collapser.read_dtrace_logs('./test_data/repeated/')
self.assertEquals(collapser.samples, [{
'frames': ['foo', 'bar', 'baz'],
'weight': 24
}]) | [
"def",
"testRepeatedFunction",
"(",
"self",
")",
":",
"collapser",
"=",
"StackCollapser",
"(",
"'./samples.collapsed'",
")",
"collapser",
".",
"read_dtrace_logs",
"(",
"'./test_data/repeated/'",
")",
"self",
".",
"assertEquals",
"(",
"collapser",
".",
"samples",
","... | Tests accumulation of samples of the same function over many files. | [
"Tests",
"accumulation",
"of",
"samples",
"of",
"the",
"same",
"function",
"over",
"many",
"files",
"."
] | [
"\"\"\"Tests accumulation of samples of the same function over many files.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e538b4188968b9fa6a4a8967c3caca52e756c5f | sunlongbo/chromium | tools/mac/power/collapse_profile_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testTrimFunctionOffset | null | def testTrimFunctionOffset(self):
"""Tests removal of the function offset markers in the DTrace format."""
collapser = StackCollapser('./samples.collapsed')
collapser.read_dtrace_logs('./test_data/with_offset/')
self.assertEquals(collapser.samples, [{
'frames': ['foo', 'bar', 'baz'],
'w... | Tests removal of the function offset markers in the DTrace format. | Tests removal of the function offset markers in the DTrace format. | [
"Tests",
"removal",
"of",
"the",
"function",
"offset",
"markers",
"in",
"the",
"DTrace",
"format",
"."
] | def testTrimFunctionOffset(self):
collapser = StackCollapser('./samples.collapsed')
collapser.read_dtrace_logs('./test_data/with_offset/')
self.assertEquals(collapser.samples, [{
'frames': ['foo', 'bar', 'baz'],
'weight': 12
}]) | [
"def",
"testTrimFunctionOffset",
"(",
"self",
")",
":",
"collapser",
"=",
"StackCollapser",
"(",
"'./samples.collapsed'",
")",
"collapser",
".",
"read_dtrace_logs",
"(",
"'./test_data/with_offset/'",
")",
"self",
".",
"assertEquals",
"(",
"collapser",
".",
"samples",
... | Tests removal of the function offset markers in the DTrace format. | [
"Tests",
"removal",
"of",
"the",
"function",
"offset",
"markers",
"in",
"the",
"DTrace",
"format",
"."
] | [
"\"\"\"Tests removal of the function offset markers in the DTrace format.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e538b4188968b9fa6a4a8967c3caca52e756c5f | sunlongbo/chromium | tools/mac/power/collapse_profile_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testDoublePostProcessFails | null | def testDoublePostProcessFails(self):
"""Tests that calling post_process_samples() twice triggers a failure."""
samples = [{'frames': ['foo', 'bar', 'baz'], 'weight': 24}]
stack_collapser = StackCollapser('./samples.collapsed')
stack_collapser.set_samples_for_testing(samples)
with self.assertRaise... | Tests that calling post_process_samples() twice triggers a failure. | Tests that calling post_process_samples() twice triggers a failure. | [
"Tests",
"that",
"calling",
"post_process_samples",
"()",
"twice",
"triggers",
"a",
"failure",
"."
] | def testDoublePostProcessFails(self):
samples = [{'frames': ['foo', 'bar', 'baz'], 'weight': 24}]
stack_collapser = StackCollapser('./samples.collapsed')
stack_collapser.set_samples_for_testing(samples)
with self.assertRaises(SystemExit):
stack_collapser.post_process_samples()
stack_collapse... | [
"def",
"testDoublePostProcessFails",
"(",
"self",
")",
":",
"samples",
"=",
"[",
"{",
"'frames'",
":",
"[",
"'foo'",
",",
"'bar'",
",",
"'baz'",
"]",
",",
"'weight'",
":",
"24",
"}",
"]",
"stack_collapser",
"=",
"StackCollapser",
"(",
"'./samples.collapsed'"... | Tests that calling post_process_samples() twice triggers a failure. | [
"Tests",
"that",
"calling",
"post_process_samples",
"()",
"twice",
"triggers",
"a",
"failure",
"."
] | [
"\"\"\"Tests that calling post_process_samples() twice triggers a failure.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e538b4188968b9fa6a4a8967c3caca52e756c5f | sunlongbo/chromium | tools/mac/power/collapse_profile_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testNoStackShortening | null | def testNoStackShortening(self):
"""Tests that sampes with no uninteresting frames don't get modified."""
samples = [{'frames': ['foo', 'bar', 'baz'], 'weight': 24}]
stack_collapser = StackCollapser('./samples.collapsed')
stack_collapser.set_samples_for_testing(samples)
stack_collapser.post_process... | Tests that sampes with no uninteresting frames don't get modified. | Tests that sampes with no uninteresting frames don't get modified. | [
"Tests",
"that",
"sampes",
"with",
"no",
"uninteresting",
"frames",
"don",
"'",
"t",
"get",
"modified",
"."
] | def testNoStackShortening(self):
samples = [{'frames': ['foo', 'bar', 'baz'], 'weight': 24}]
stack_collapser = StackCollapser('./samples.collapsed')
stack_collapser.set_samples_for_testing(samples)
stack_collapser.post_process_samples()
self.assertEquals(samples, stack_collapser.samples) | [
"def",
"testNoStackShortening",
"(",
"self",
")",
":",
"samples",
"=",
"[",
"{",
"'frames'",
":",
"[",
"'foo'",
",",
"'bar'",
",",
"'baz'",
"]",
",",
"'weight'",
":",
"24",
"}",
"]",
"stack_collapser",
"=",
"StackCollapser",
"(",
"'./samples.collapsed'",
"... | Tests that sampes with no uninteresting frames don't get modified. | [
"Tests",
"that",
"sampes",
"with",
"no",
"uninteresting",
"frames",
"don",
"'",
"t",
"get",
"modified",
"."
] | [
"\"\"\"Tests that sampes with no uninteresting frames don't get modified.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e538b4188968b9fa6a4a8967c3caca52e756c5f | sunlongbo/chromium | tools/mac/power/collapse_profile_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testTokenClean | null | def testTokenClean(self):
"""Tests that tokens that need to be removed are cleaned and others
are left untouched."""
samples = [{
'frames': ['Chromium Framework`foo', 'bar', 'baz'],
'weight': 24
}]
cleaned_samples = [{'frames': ['foo', 'bar', 'baz'], 'weight': 24}]
stack_collap... | Tests that tokens that need to be removed are cleaned and others
are left untouched. | Tests that tokens that need to be removed are cleaned and others
are left untouched. | [
"Tests",
"that",
"tokens",
"that",
"need",
"to",
"be",
"removed",
"are",
"cleaned",
"and",
"others",
"are",
"left",
"untouched",
"."
] | def testTokenClean(self):
samples = [{
'frames': ['Chromium Framework`foo', 'bar', 'baz'],
'weight': 24
}]
cleaned_samples = [{'frames': ['foo', 'bar', 'baz'], 'weight': 24}]
stack_collapser = StackCollapser('./samples.collapsed')
stack_collapser.set_samples_for_testing(samples)
... | [
"def",
"testTokenClean",
"(",
"self",
")",
":",
"samples",
"=",
"[",
"{",
"'frames'",
":",
"[",
"'Chromium Framework`foo'",
",",
"'bar'",
",",
"'baz'",
"]",
",",
"'weight'",
":",
"24",
"}",
"]",
"cleaned_samples",
"=",
"[",
"{",
"'frames'",
":",
"[",
"... | Tests that tokens that need to be removed are cleaned and others
are left untouched. | [
"Tests",
"that",
"tokens",
"that",
"need",
"to",
"be",
"removed",
"are",
"cleaned",
"and",
"others",
"are",
"left",
"untouched",
"."
] | [
"\"\"\"Tests that tokens that need to be removed are cleaned and others\n are left untouched.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e538b4188968b9fa6a4a8967c3caca52e756c5f | sunlongbo/chromium | tools/mac/power/collapse_profile_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testCutoffPointPreserved | null | def testCutoffPointPreserved(self):
"""Tests that shortening a stack is inclusive of the cutoff point."""
samples = [{
'frames':
['foo', 'bar', 'baz', 'base::MessagePumpNSRunLoop::DoRun', "biz"],
'weight':
24
}]
shortened_stack = [{
'frames': ['base::MessagePumpN... | Tests that shortening a stack is inclusive of the cutoff point. | Tests that shortening a stack is inclusive of the cutoff point. | [
"Tests",
"that",
"shortening",
"a",
"stack",
"is",
"inclusive",
"of",
"the",
"cutoff",
"point",
"."
] | def testCutoffPointPreserved(self):
samples = [{
'frames':
['foo', 'bar', 'baz', 'base::MessagePumpNSRunLoop::DoRun', "biz"],
'weight':
24
}]
shortened_stack = [{
'frames': ['base::MessagePumpNSRunLoop::DoRun', "biz"],
'weight': 24
}]
stack_collapser =... | [
"def",
"testCutoffPointPreserved",
"(",
"self",
")",
":",
"samples",
"=",
"[",
"{",
"'frames'",
":",
"[",
"'foo'",
",",
"'bar'",
",",
"'baz'",
",",
"'base::MessagePumpNSRunLoop::DoRun'",
",",
"\"biz\"",
"]",
",",
"'weight'",
":",
"24",
"}",
"]",
"shortened_s... | Tests that shortening a stack is inclusive of the cutoff point. | [
"Tests",
"that",
"shortening",
"a",
"stack",
"is",
"inclusive",
"of",
"the",
"cutoff",
"point",
"."
] | [
"\"\"\"Tests that shortening a stack is inclusive of the cutoff point.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e538b4188968b9fa6a4a8967c3caca52e756c5f | sunlongbo/chromium | tools/mac/power/collapse_profile_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testNoStackDisappearance | null | def testNoStackDisappearance(self):
"""Tests that a stack that finishes with an ignored frame isn't culled from
the report. It represents overhead and should be kept"""
samples = [{
'frames': ['foo', 'bar', 'baz', 'base::MessagePumpNSRunLoop::DoRun'],
'weight':
24
}]
shorten... | Tests that a stack that finishes with an ignored frame isn't culled from
the report. It represents overhead and should be kept | Tests that a stack that finishes with an ignored frame isn't culled from
the report. It represents overhead and should be kept | [
"Tests",
"that",
"a",
"stack",
"that",
"finishes",
"with",
"an",
"ignored",
"frame",
"isn",
"'",
"t",
"culled",
"from",
"the",
"report",
".",
"It",
"represents",
"overhead",
"and",
"should",
"be",
"kept"
] | def testNoStackDisappearance(self):
samples = [{
'frames': ['foo', 'bar', 'baz', 'base::MessagePumpNSRunLoop::DoRun'],
'weight':
24
}]
shortened_stack = [{
'frames': ['base::MessagePumpNSRunLoop::DoRun'],
'weight': 24
}]
stack_collapser = StackCollapser('./sam... | [
"def",
"testNoStackDisappearance",
"(",
"self",
")",
":",
"samples",
"=",
"[",
"{",
"'frames'",
":",
"[",
"'foo'",
",",
"'bar'",
",",
"'baz'",
",",
"'base::MessagePumpNSRunLoop::DoRun'",
"]",
",",
"'weight'",
":",
"24",
"}",
"]",
"shortened_stack",
"=",
"[",... | Tests that a stack that finishes with an ignored frame isn't culled from
the report. | [
"Tests",
"that",
"a",
"stack",
"that",
"finishes",
"with",
"an",
"ignored",
"frame",
"isn",
"'",
"t",
"culled",
"from",
"the",
"report",
"."
] | [
"\"\"\"Tests that a stack that finishes with an ignored frame isn't culled from\n the report. It represents overhead and should be kept\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e538b4188968b9fa6a4a8967c3caca52e756c5f | sunlongbo/chromium | tools/mac/power/collapse_profile_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testStackShortening | null | def testStackShortening(self):
"""Tests that stacks get shortened to drop frames of low interest."""
samples = [{
'frames': ['foo', 'bar', 'baz'],
'weight': 24
}, {
'frames': ['foo', 'bar', 'baz', 'base::MessagePumpNSRunLoop::DoRun'],
'weight':
24
}]
# Stack... | Tests that stacks get shortened to drop frames of low interest. | Tests that stacks get shortened to drop frames of low interest. | [
"Tests",
"that",
"stacks",
"get",
"shortened",
"to",
"drop",
"frames",
"of",
"low",
"interest",
"."
] | def testStackShortening(self):
samples = [{
'frames': ['foo', 'bar', 'baz'],
'weight': 24
}, {
'frames': ['foo', 'bar', 'baz', 'base::MessagePumpNSRunLoop::DoRun'],
'weight':
24
}]
shortened_samples = samples.copy()
shortened_samples[1]["frames"] = shortened_s... | [
"def",
"testStackShortening",
"(",
"self",
")",
":",
"samples",
"=",
"[",
"{",
"'frames'",
":",
"[",
"'foo'",
",",
"'bar'",
",",
"'baz'",
"]",
",",
"'weight'",
":",
"24",
"}",
",",
"{",
"'frames'",
":",
"[",
"'foo'",
",",
"'bar'",
",",
"'baz'",
","... | Tests that stacks get shortened to drop frames of low interest. | [
"Tests",
"that",
"stacks",
"get",
"shortened",
"to",
"drop",
"frames",
"of",
"low",
"interest",
"."
] | [
"\"\"\"Tests that stacks get shortened to drop frames of low interest.\"\"\"",
"# Stack will be shortened to remove anything before the uninteresting frame."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e538b4188968b9fa6a4a8967c3caca52e756c5f | sunlongbo/chromium | tools/mac/power/collapse_profile_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testSingleSyntheticMarker | null | def testSingleSyntheticMarker(self):
"""Tests that when a single frame of interest is found the appropriate
synthetic frame is added to the bottom of the stack."""
samples = [{'frames': ['foo', 'bar', 'baz'], 'weight': 24}]
# Stack will be augmented with mojo marker
augmented_stack = samples.copy(... | Tests that when a single frame of interest is found the appropriate
synthetic frame is added to the bottom of the stack. | Tests that when a single frame of interest is found the appropriate
synthetic frame is added to the bottom of the stack. | [
"Tests",
"that",
"when",
"a",
"single",
"frame",
"of",
"interest",
"is",
"found",
"the",
"appropriate",
"synthetic",
"frame",
"is",
"added",
"to",
"the",
"bottom",
"of",
"the",
"stack",
"."
] | def testSingleSyntheticMarker(self):
samples = [{'frames': ['foo', 'bar', 'baz'], 'weight': 24}]
augmented_stack = samples.copy()
augmented_stack[0]["frames"] = ['viz::'] + augmented_stack[0]["frames"]
stack_collapser = StackCollapser('./samples.collapsed')
stack_collapser.set_samples_for_testing(sa... | [
"def",
"testSingleSyntheticMarker",
"(",
"self",
")",
":",
"samples",
"=",
"[",
"{",
"'frames'",
":",
"[",
"'foo'",
",",
"'bar'",
",",
"'baz'",
"]",
",",
"'weight'",
":",
"24",
"}",
"]",
"augmented_stack",
"=",
"samples",
".",
"copy",
"(",
")",
"augmen... | Tests that when a single frame of interest is found the appropriate
synthetic frame is added to the bottom of the stack. | [
"Tests",
"that",
"when",
"a",
"single",
"frame",
"of",
"interest",
"is",
"found",
"the",
"appropriate",
"synthetic",
"frame",
"is",
"added",
"to",
"the",
"bottom",
"of",
"the",
"stack",
"."
] | [
"\"\"\"Tests that when a single frame of interest is found the appropriate\n synthetic frame is added to the bottom of the stack.\"\"\"",
"# Stack will be augmented with mojo marker"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e538b4188968b9fa6a4a8967c3caca52e756c5f | sunlongbo/chromium | tools/mac/power/collapse_profile_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testSynonymMarkers | null | def testSynonymMarkers(self):
"""Tests that two markers that are synonyms trigger the addition of the same
synthetic frame."""
samples = [{'frames': ['foo', 'bar', '::network'], 'weight': 24}]
stack_collapser = StackCollapser('./samples.collapsed')
stack_collapser.set_samples_for_testing(samples)
... | Tests that two markers that are synonyms trigger the addition of the same
synthetic frame. | Tests that two markers that are synonyms trigger the addition of the same
synthetic frame. | [
"Tests",
"that",
"two",
"markers",
"that",
"are",
"synonyms",
"trigger",
"the",
"addition",
"of",
"the",
"same",
"synthetic",
"frame",
"."
] | def testSynonymMarkers(self):
samples = [{'frames': ['foo', 'bar', '::network'], 'weight': 24}]
stack_collapser = StackCollapser('./samples.collapsed')
stack_collapser.set_samples_for_testing(samples)
stack_collapser.post_process_samples()
samples_2 = [{'frames': ['foo', 'bar', '::net'], 'weight': 2... | [
"def",
"testSynonymMarkers",
"(",
"self",
")",
":",
"samples",
"=",
"[",
"{",
"'frames'",
":",
"[",
"'foo'",
",",
"'bar'",
",",
"'::network'",
"]",
",",
"'weight'",
":",
"24",
"}",
"]",
"stack_collapser",
"=",
"StackCollapser",
"(",
"'./samples.collapsed'",
... | Tests that two markers that are synonyms trigger the addition of the same
synthetic frame. | [
"Tests",
"that",
"two",
"markers",
"that",
"are",
"synonyms",
"trigger",
"the",
"addition",
"of",
"the",
"same",
"synthetic",
"frame",
"."
] | [
"\"\"\"Tests that two markers that are synonyms trigger the addition of the same\n synthetic frame.\"\"\"",
"# Same synthetic stack frame is added."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e538b4188968b9fa6a4a8967c3caca52e756c5f | sunlongbo/chromium | tools/mac/power/collapse_profile_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testCompoundSyntheticMarker | null | def testCompoundSyntheticMarker(self):
"""Tests that when more than one frame of interest is found the correct
compound synthetic frame is added to the bottom of the stack."""
samples = [{'frames': ['foo', 'bar', 'viz', '::network'], 'weight': 24}]
# Stack will be augmented with mojo marker
augmen... | Tests that when more than one frame of interest is found the correct
compound synthetic frame is added to the bottom of the stack. | Tests that when more than one frame of interest is found the correct
compound synthetic frame is added to the bottom of the stack. | [
"Tests",
"that",
"when",
"more",
"than",
"one",
"frame",
"of",
"interest",
"is",
"found",
"the",
"correct",
"compound",
"synthetic",
"frame",
"is",
"added",
"to",
"the",
"bottom",
"of",
"the",
"stack",
"."
] | def testCompoundSyntheticMarker(self):
samples = [{'frames': ['foo', 'bar', 'viz', '::network'], 'weight': 24}]
augmented_stack = samples.copy()
augmented_stack[0]["frames"] = ['mojo::viz::'
] + augmented_stack[0]["frames"]
stack_collapser = StackCollapser('./samples.... | [
"def",
"testCompoundSyntheticMarker",
"(",
"self",
")",
":",
"samples",
"=",
"[",
"{",
"'frames'",
":",
"[",
"'foo'",
",",
"'bar'",
",",
"'viz'",
",",
"'::network'",
"]",
",",
"'weight'",
":",
"24",
"}",
"]",
"augmented_stack",
"=",
"samples",
".",
"copy... | Tests that when more than one frame of interest is found the correct
compound synthetic frame is added to the bottom of the stack. | [
"Tests",
"that",
"when",
"more",
"than",
"one",
"frame",
"of",
"interest",
"is",
"found",
"the",
"correct",
"compound",
"synthetic",
"frame",
"is",
"added",
"to",
"the",
"bottom",
"of",
"the",
"stack",
"."
] | [
"\"\"\"Tests that when more than one frame of interest is found the correct\n compound synthetic frame is added to the bottom of the stack.\"\"\"",
"# Stack will be augmented with mojo marker"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d0d449def40695bab702b9be727c7720cd94cd95 | sunlongbo/chromium | tools/android/native_lib_memory/parse_smaps.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetPageTableFootprint | <not_specific> | def _GetPageTableFootprint(device, pid):
"""Returns the page table footprint for a process in kiB."""
command = ['cat', '/proc/%d/status' % pid]
lines = device.RunShellCommand(command, check_return=True)
for line in lines:
if line.startswith('VmPTE:'):
value = int(line[len('VmPTE: '):line.index('kB')]... | Returns the page table footprint for a process in kiB. | Returns the page table footprint for a process in kiB. | [
"Returns",
"the",
"page",
"table",
"footprint",
"for",
"a",
"process",
"in",
"kiB",
"."
] | def _GetPageTableFootprint(device, pid):
command = ['cat', '/proc/%d/status' % pid]
lines = device.RunShellCommand(command, check_return=True)
for line in lines:
if line.startswith('VmPTE:'):
value = int(line[len('VmPTE: '):line.index('kB')])
return value | [
"def",
"_GetPageTableFootprint",
"(",
"device",
",",
"pid",
")",
":",
"command",
"=",
"[",
"'cat'",
",",
"'/proc/%d/status'",
"%",
"pid",
"]",
"lines",
"=",
"device",
".",
"RunShellCommand",
"(",
"command",
",",
"check_return",
"=",
"True",
")",
"for",
"li... | Returns the page table footprint for a process in kiB. | [
"Returns",
"the",
"page",
"table",
"footprint",
"for",
"a",
"process",
"in",
"kiB",
"."
] | [
"\"\"\"Returns the page table footprint for a process in kiB.\"\"\""
] | [
{
"param": "device",
"type": null
},
{
"param": "pid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pid",
"type": null,
"docstring": null,
"docstring_tokens": ... |
d0d449def40695bab702b9be727c7720cd94cd95 | sunlongbo/chromium | tools/android/native_lib_memory/parse_smaps.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _PrintMappingsMetric | null | def _PrintMappingsMetric(mappings, field_name):
"""Shows a summary of mappings for a given metric.
For the given field, compute its aggregate value over all mappings, and
prints the mappings sorted by decreasing metric value.
Args:
mappings: ([Mapping]) all process mappings.
field_name: (str) Mapping ... | Shows a summary of mappings for a given metric.
For the given field, compute its aggregate value over all mappings, and
prints the mappings sorted by decreasing metric value.
Args:
mappings: ([Mapping]) all process mappings.
field_name: (str) Mapping field to process.
| Shows a summary of mappings for a given metric.
For the given field, compute its aggregate value over all mappings, and
prints the mappings sorted by decreasing metric value. | [
"Shows",
"a",
"summary",
"of",
"mappings",
"for",
"a",
"given",
"metric",
".",
"For",
"the",
"given",
"field",
"compute",
"its",
"aggregate",
"value",
"over",
"all",
"mappings",
"and",
"prints",
"the",
"mappings",
"sorted",
"by",
"decreasing",
"metric",
"val... | def _PrintMappingsMetric(mappings, field_name):
total_kb = sum(m.fields[field_name] for m in mappings)
print('Total Size (kB) = %d' % total_kb)
sorted_by_metric = sorted(mappings,
key=lambda m: m.fields[field_name], reverse=True)
for mapping in sorted_by_metric:
metric = mapping.... | [
"def",
"_PrintMappingsMetric",
"(",
"mappings",
",",
"field_name",
")",
":",
"total_kb",
"=",
"sum",
"(",
"m",
".",
"fields",
"[",
"field_name",
"]",
"for",
"m",
"in",
"mappings",
")",
"print",
"(",
"'Total Size (kB) = %d'",
"%",
"total_kb",
")",
"sorted_by_... | Shows a summary of mappings for a given metric. | [
"Shows",
"a",
"summary",
"of",
"mappings",
"for",
"a",
"given",
"metric",
"."
] | [
"\"\"\"Shows a summary of mappings for a given metric.\n\n For the given field, compute its aggregate value over all mappings, and\n prints the mappings sorted by decreasing metric value.\n\n Args:\n mappings: ([Mapping]) all process mappings.\n field_name: (str) Mapping field to process.\n \"\"\""
] | [
{
"param": "mappings",
"type": null
},
{
"param": "field_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mappings",
"type": null,
"docstring": "([Mapping]) all process mappings.",
"docstring_tokens": [
"(",
"[",
"Mapping",
"]",
")",
"all",
"process",
"mappings",
... |
d0d449def40695bab702b9be727c7720cd94cd95 | sunlongbo/chromium | tools/android/native_lib_memory/parse_smaps.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ComputeEstimatedFootprint | <not_specific> | def _ComputeEstimatedFootprint(mappings, page_table_kb):
"""Returns the estimated footprint in kiB.
Args:
mappings: ([Mapping]) all process mappings.
page_table_kb: (int) Sizeof the page tables in kiB.
"""
footprint = page_table_kb
for mapping in mappings:
# Chrome shared memory.
#
# Even... | Returns the estimated footprint in kiB.
Args:
mappings: ([Mapping]) all process mappings.
page_table_kb: (int) Sizeof the page tables in kiB.
| Returns the estimated footprint in kiB. | [
"Returns",
"the",
"estimated",
"footprint",
"in",
"kiB",
"."
] | def _ComputeEstimatedFootprint(mappings, page_table_kb):
footprint = page_table_kb
for mapping in mappings:
Even though it is shared memory, it exists because the process exists, so
account for its entirety.
if mapping.pathname.startswith('/dev/ashmem/shared_memory'):
footprint += mapping.fields... | [
"def",
"_ComputeEstimatedFootprint",
"(",
"mappings",
",",
"page_table_kb",
")",
":",
"footprint",
"=",
"page_table_kb",
"for",
"mapping",
"in",
"mappings",
":",
"if",
"mapping",
".",
"pathname",
".",
"startswith",
"(",
"'/dev/ashmem/shared_memory'",
")",
":",
"fo... | Returns the estimated footprint in kiB. | [
"Returns",
"the",
"estimated",
"footprint",
"in",
"kiB",
"."
] | [
"\"\"\"Returns the estimated footprint in kiB.\n\n Args:\n mappings: ([Mapping]) all process mappings.\n page_table_kb: (int) Sizeof the page tables in kiB.\n \"\"\"",
"# Chrome shared memory.",
"#",
"# Even though it is shared memory, it exists because the process exists, so",
"# account for its en... | [
{
"param": "mappings",
"type": null
},
{
"param": "page_table_kb",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mappings",
"type": null,
"docstring": "([Mapping]) all process mappings.",
"docstring_tokens": [
"(",
"[",
"Mapping",
"]",
")",
"all",
"process",
"mappings",
... |
d0d449def40695bab702b9be727c7720cd94cd95 | sunlongbo/chromium | tools/android/native_lib_memory/parse_smaps.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ShowAllocatorFootprint | null | def _ShowAllocatorFootprint(mappings, allocator):
"""Shows the total footprint from a specific allocator.
Args:
mappings: ([Mapping]) all process mappings.
allocator: (str) Allocator name.
"""
total_footprint = 0
pathname = '[anon:%s]' % allocator
for mapping in mappings:
if mapping.pathname ==... | Shows the total footprint from a specific allocator.
Args:
mappings: ([Mapping]) all process mappings.
allocator: (str) Allocator name.
| Shows the total footprint from a specific allocator. | [
"Shows",
"the",
"total",
"footprint",
"from",
"a",
"specific",
"allocator",
"."
] | def _ShowAllocatorFootprint(mappings, allocator):
total_footprint = 0
pathname = '[anon:%s]' % allocator
for mapping in mappings:
if mapping.pathname == pathname:
total_footprint += _FootprintForAnonymousMapping(mapping)
print('\tFootprint from %s: %d kB' % (allocator, total_footprint)) | [
"def",
"_ShowAllocatorFootprint",
"(",
"mappings",
",",
"allocator",
")",
":",
"total_footprint",
"=",
"0",
"pathname",
"=",
"'[anon:%s]'",
"%",
"allocator",
"for",
"mapping",
"in",
"mappings",
":",
"if",
"mapping",
".",
"pathname",
"==",
"pathname",
":",
"tot... | Shows the total footprint from a specific allocator. | [
"Shows",
"the",
"total",
"footprint",
"from",
"a",
"specific",
"allocator",
"."
] | [
"\"\"\"Shows the total footprint from a specific allocator.\n\n Args:\n mappings: ([Mapping]) all process mappings.\n allocator: (str) Allocator name.\n \"\"\""
] | [
{
"param": "mappings",
"type": null
},
{
"param": "allocator",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mappings",
"type": null,
"docstring": "([Mapping]) all process mappings.",
"docstring_tokens": [
"(",
"[",
"Mapping",
"]",
")",
"all",
"process",
"mappings",
... |
d0da014a88a06bf61acb02440d6e886a8a6ada5d | sunlongbo/chromium | tools/symsrc/pdb_fingerprint_from_img.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetPDBInfoFromImg | <not_specific> | def GetPDBInfoFromImg(filename):
"""Returns the PDB fingerprint and the pdb filename given an image file"""
pe = pefile.PE(filename)
for dbg in pe.DIRECTORY_ENTRY_DEBUG:
if dbg.struct.Type == 2: # IMAGE_DEBUG_TYPE_CODEVIEW
off = dbg.struct.AddressOfRawData
size = dbg.struct.SizeOfData
dat... | Returns the PDB fingerprint and the pdb filename given an image file | Returns the PDB fingerprint and the pdb filename given an image file | [
"Returns",
"the",
"PDB",
"fingerprint",
"and",
"the",
"pdb",
"filename",
"given",
"an",
"image",
"file"
] | def GetPDBInfoFromImg(filename):
pe = pefile.PE(filename)
for dbg in pe.DIRECTORY_ENTRY_DEBUG:
if dbg.struct.Type == 2:
off = dbg.struct.AddressOfRawData
size = dbg.struct.SizeOfData
data = pe.get_memory_mapped_image()[off:off+size]
cv = pefile.Structure(__CV_INFO_PDB70_format__)
... | [
"def",
"GetPDBInfoFromImg",
"(",
"filename",
")",
":",
"pe",
"=",
"pefile",
".",
"PE",
"(",
"filename",
")",
"for",
"dbg",
"in",
"pe",
".",
"DIRECTORY_ENTRY_DEBUG",
":",
"if",
"dbg",
".",
"struct",
".",
"Type",
"==",
"2",
":",
"off",
"=",
"dbg",
".",... | Returns the PDB fingerprint and the pdb filename given an image file | [
"Returns",
"the",
"PDB",
"fingerprint",
"and",
"the",
"pdb",
"filename",
"given",
"an",
"image",
"file"
] | [
"\"\"\"Returns the PDB fingerprint and the pdb filename given an image file\"\"\"",
"# IMAGE_DEBUG_TYPE_CODEVIEW",
"# In non-py3 pefile, this is a list of bytes."
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ExtractModuleName | <not_specific> | def ExtractModuleName(infile_path):
"""Infers the module name from the input file path.
The input filename is supposed to be in the form "ModuleName.sigs".
This function splits the filename from the extension on that basename of
the path and returns that as the module name.
Args:
infile_path: String hol... | Infers the module name from the input file path.
The input filename is supposed to be in the form "ModuleName.sigs".
This function splits the filename from the extension on that basename of
the path and returns that as the module name.
Args:
infile_path: String holding the path to the input file.
Retur... | Infers the module name from the input file path.
The input filename is supposed to be in the form "ModuleName.sigs".
This function splits the filename from the extension on that basename of
the path and returns that as the module name. | [
"Infers",
"the",
"module",
"name",
"from",
"the",
"input",
"file",
"path",
".",
"The",
"input",
"filename",
"is",
"supposed",
"to",
"be",
"in",
"the",
"form",
"\"",
"ModuleName",
".",
"sigs",
"\"",
".",
"This",
"function",
"splits",
"the",
"filename",
"f... | def ExtractModuleName(infile_path):
basename = os.path.basename(infile_path)
while 1:
new_basename = os.path.splitext(basename)[0]
if basename == new_basename:
break
else:
basename = new_basename
return basename | [
"def",
"ExtractModuleName",
"(",
"infile_path",
")",
":",
"basename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"infile_path",
")",
"while",
"1",
":",
"new_basename",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"basename",
")",
"[",
"0",
"]",
"if... | Infers the module name from the input file path. | [
"Infers",
"the",
"module",
"name",
"from",
"the",
"input",
"file",
"path",
"."
] | [
"\"\"\"Infers the module name from the input file path.\n\n The input filename is supposed to be in the form \"ModuleName.sigs\".\n This function splits the filename from the extension on that basename of\n the path and returns that as the module name.\n\n Args:\n infile_path: String holding the path to the ... | [
{
"param": "infile_path",
"type": null
}
] | {
"returns": [
{
"docstring": "The module name as a string.",
"docstring_tokens": [
"The",
"module",
"name",
"as",
"a",
"string",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "infile_path",
... |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParseSignatures | <not_specific> | def ParseSignatures(infile):
"""Parses function signatures in the input file.
This function parses a file of signatures into a list of dictionaries that
represent the function signatures in the input file. Each dictionary has
the following keys:
return_type: A string with the return type.
name: A stri... | Parses function signatures in the input file.
This function parses a file of signatures into a list of dictionaries that
represent the function signatures in the input file. Each dictionary has
the following keys:
return_type: A string with the return type.
name: A string with the name of the function.
... | Parses function signatures in the input file.
This function parses a file of signatures into a list of dictionaries that
represent the function signatures in the input file. Each dictionary has
the following keys:
return_type: A string with the return type.
name: A string with the name of the function.
params: A list ... | [
"Parses",
"function",
"signatures",
"in",
"the",
"input",
"file",
".",
"This",
"function",
"parses",
"a",
"file",
"of",
"signatures",
"into",
"a",
"list",
"of",
"dictionaries",
"that",
"represent",
"the",
"function",
"signatures",
"in",
"the",
"input",
"file",... | def ParseSignatures(infile):
signatures = []
for line in infile:
line = line.strip()
if line and line[0] != '#' and line[0:2] != '//':
m = SIGNATURE_REGEX.match(line)
if m is None:
raise BadSignatureError('Unparsable line: %s' % line)
signatures.append({
'return_type':
... | [
"def",
"ParseSignatures",
"(",
"infile",
")",
":",
"signatures",
"=",
"[",
"]",
"for",
"line",
"in",
"infile",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"if",
"line",
"and",
"line",
"[",
"0",
"]",
"!=",
"'#'",
"and",
"line",
"[",
"0",
":"... | Parses function signatures in the input file. | [
"Parses",
"function",
"signatures",
"in",
"the",
"input",
"file",
"."
] | [
"\"\"\"Parses function signatures in the input file.\n\n This function parses a file of signatures into a list of dictionaries that\n represent the function signatures in the input file. Each dictionary has\n the following keys:\n return_type: A string with the return type.\n name: A string with the name ... | [
{
"param": "infile",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of dictionaries, where each dictionary represents one function\nsignature.",
"docstring_tokens": [
"A",
"list",
"of",
"dictionaries",
"where",
"each",
"dictionary",
"represents",
"one",
... |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreateWindowsLib | null | def CreateWindowsLib(module_name, signatures, intermediate_dir, outdir_path,
machine):
"""Creates a Windows library file.
Calling this function will create a lib file in the outdir_path that exports
the signatures passed into the object. A temporary def file will be created
in the interme... | Creates a Windows library file.
Calling this function will create a lib file in the outdir_path that exports
the signatures passed into the object. A temporary def file will be created
in the intermediate_dir.
Args:
module_name: The name of the module we are writing a stub for.
signatures: The list o... | Creates a Windows library file.
Calling this function will create a lib file in the outdir_path that exports
the signatures passed into the object. A temporary def file will be created
in the intermediate_dir. | [
"Creates",
"a",
"Windows",
"library",
"file",
".",
"Calling",
"this",
"function",
"will",
"create",
"a",
"lib",
"file",
"in",
"the",
"outdir_path",
"that",
"exports",
"the",
"signatures",
"passed",
"into",
"the",
"object",
".",
"A",
"temporary",
"def",
"file... | def CreateWindowsLib(module_name, signatures, intermediate_dir, outdir_path,
machine):
def_file_path = os.path.join(intermediate_dir, module_name + '.def')
lib_file_path = os.path.join(outdir_path, module_name + '.lib')
outfile = open(def_file_path, 'w')
try:
WriteWindowsDefFile(module_... | [
"def",
"CreateWindowsLib",
"(",
"module_name",
",",
"signatures",
",",
"intermediate_dir",
",",
"outdir_path",
",",
"machine",
")",
":",
"def_file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"intermediate_dir",
",",
"module_name",
"+",
"'.def'",
")",
"lib... | Creates a Windows library file. | [
"Creates",
"a",
"Windows",
"library",
"file",
"."
] | [
"\"\"\"Creates a Windows library file.\n\n Calling this function will create a lib file in the outdir_path that exports\n the signatures passed into the object. A temporary def file will be created\n in the intermediate_dir.\n\n Args:\n module_name: The name of the module we are writing a stub for.\n sig... | [
{
"param": "module_name",
"type": null
},
{
"param": "signatures",
"type": null
},
{
"param": "intermediate_dir",
"type": null
},
{
"param": "outdir_path",
"type": null
},
{
"param": "machine",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "If invoking the Windows \"lib\" tool fails, this is raised\nwith the error code.",
"docstring_tokens": [
"If",
"invoking",
"the",
"Windows",
"\"",
"lib",
"\"",
"tool",
"fails",
... |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | StubFunctionPointer | <not_specific> | def StubFunctionPointer(cls, signature):
"""Generates a function pointer declaration for the given signature.
Args:
signature: A signature hash, as produced by ParseSignatures,
representing the function signature.
Returns:
A string with the declaration of the function pointer ... | Generates a function pointer declaration for the given signature.
Args:
signature: A signature hash, as produced by ParseSignatures,
representing the function signature.
Returns:
A string with the declaration of the function pointer for the signature.
| Generates a function pointer declaration for the given signature. | [
"Generates",
"a",
"function",
"pointer",
"declaration",
"for",
"the",
"given",
"signature",
"."
] | def StubFunctionPointer(cls, signature):
return 'static %s (*%s_ptr)(%s) = nullptr;' % (signature['return_type'],
signature['name'], ', '.join(
signature['params'])) | [
"def",
"StubFunctionPointer",
"(",
"cls",
",",
"signature",
")",
":",
"return",
"'static %s (*%s_ptr)(%s) = nullptr;'",
"%",
"(",
"signature",
"[",
"'return_type'",
"]",
",",
"signature",
"[",
"'name'",
"]",
",",
"', '",
".",
"join",
"(",
"signature",
"[",
"'p... | Generates a function pointer declaration for the given signature. | [
"Generates",
"a",
"function",
"pointer",
"declaration",
"for",
"the",
"given",
"signature",
"."
] | [
"\"\"\"Generates a function pointer declaration for the given signature.\n\n Args:\n signature: A signature hash, as produced by ParseSignatures,\n representing the function signature.\n\n Returns:\n A string with the declaration of the function pointer for the signature.\n \"\"\"... | [
{
"param": "cls",
"type": null
},
{
"param": "signature",
"type": null
}
] | {
"returns": [
{
"docstring": "A string with the declaration of the function pointer for the signature.",
"docstring_tokens": [
"A",
"string",
"with",
"the",
"declaration",
"of",
"the",
"function",
"pointer",
"for",
... |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | StubFunction | <not_specific> | def StubFunction(cls, signature):
"""Generates a stub function definition for the given signature.
The function definitions are created with __attribute__((weak)) so that
they may be overridden by a real static link or mock versions to be used
when testing.
Args:
signature: A signature hash,... | Generates a stub function definition for the given signature.
The function definitions are created with __attribute__((weak)) so that
they may be overridden by a real static link or mock versions to be used
when testing.
Args:
signature: A signature hash, as produced by ParseSignatures,
... | Generates a stub function definition for the given signature.
The function definitions are created with __attribute__((weak)) so that
they may be overridden by a real static link or mock versions to be used
when testing. | [
"Generates",
"a",
"stub",
"function",
"definition",
"for",
"the",
"given",
"signature",
".",
"The",
"function",
"definitions",
"are",
"created",
"with",
"__attribute__",
"((",
"weak",
"))",
"so",
"that",
"they",
"may",
"be",
"overridden",
"by",
"a",
"real",
... | def StubFunction(cls, signature):
return_prefix = ''
if signature['return_type'] != 'void':
return_prefix = 'return '
arguments = [
re.split('[\*& ]', arg)[-1].strip() for arg in signature['params']
]
for i in range(0, len(arguments)):
if arguments[i].endswith('[]'):
argu... | [
"def",
"StubFunction",
"(",
"cls",
",",
"signature",
")",
":",
"return_prefix",
"=",
"''",
"if",
"signature",
"[",
"'return_type'",
"]",
"!=",
"'void'",
":",
"return_prefix",
"=",
"'return '",
"arguments",
"=",
"[",
"re",
".",
"split",
"(",
"'[\\*& ]'",
",... | Generates a stub function definition for the given signature. | [
"Generates",
"a",
"stub",
"function",
"definition",
"for",
"the",
"given",
"signature",
"."
] | [
"\"\"\"Generates a stub function definition for the given signature.\n\n The function definitions are created with __attribute__((weak)) so that\n they may be overridden by a real static link or mock versions to be used\n when testing.\n\n Args:\n signature: A signature hash, as produced by ParseSi... | [
{
"param": "cls",
"type": null
},
{
"param": "signature",
"type": null
}
] | {
"returns": [
{
"docstring": "A string with the stub function definition.",
"docstring_tokens": [
"A",
"string",
"with",
"the",
"stub",
"function",
"definition",
"."
],
"type": null
}
],
"raises": [],
"params": [
... |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteImplementationPreamble | null | def WriteImplementationPreamble(cls, header_path, outfile, logging_include):
"""Write the necessary includes for the implementation file.
Args:
header_path: The path to the header file.
outfile: The file handle to populate.
"""
outfile.write(IMPLEMENTATION_PREAMBLE % {
'header_path'... | Write the necessary includes for the implementation file.
Args:
header_path: The path to the header file.
outfile: The file handle to populate.
| Write the necessary includes for the implementation file. | [
"Write",
"the",
"necessary",
"includes",
"for",
"the",
"implementation",
"file",
"."
] | def WriteImplementationPreamble(cls, header_path, outfile, logging_include):
outfile.write(IMPLEMENTATION_PREAMBLE % {
'header_path': header_path,
'logging_include': logging_include
}) | [
"def",
"WriteImplementationPreamble",
"(",
"cls",
",",
"header_path",
",",
"outfile",
",",
"logging_include",
")",
":",
"outfile",
".",
"write",
"(",
"IMPLEMENTATION_PREAMBLE",
"%",
"{",
"'header_path'",
":",
"header_path",
",",
"'logging_include'",
":",
"logging_in... | Write the necessary includes for the implementation file. | [
"Write",
"the",
"necessary",
"includes",
"for",
"the",
"implementation",
"file",
"."
] | [
"\"\"\"Write the necessary includes for the implementation file.\n\n Args:\n header_path: The path to the header file.\n outfile: The file handle to populate.\n \"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "header_path",
"type": null
},
{
"param": "outfile",
"type": null
},
{
"param": "logging_include",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "header_path",
"type": null,
"docstring": "The path to the header fil... |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteUmbrellaInitializer | null | def WriteUmbrellaInitializer(cls, module_names, namespace, outfile,
logging_function):
"""Writes a single function that will open + initialize each module.
This intializer will take in an stl map of that lists the correct
dlopen target for each module. The map type is
st... | Writes a single function that will open + initialize each module.
This intializer will take in an stl map of that lists the correct
dlopen target for each module. The map type is
std::map<enum StubModules, vector<std::string>> which matches one module
to a list of paths to try in dlopen.
This fun... | Writes a single function that will open + initialize each module.
This intializer will take in an stl map of that lists the correct
dlopen target for each module. The map type is
std::map> which matches one module
to a list of paths to try in dlopen.
This function is an all-or-nothing function. If any module fails t... | [
"Writes",
"a",
"single",
"function",
"that",
"will",
"open",
"+",
"initialize",
"each",
"module",
".",
"This",
"intializer",
"will",
"take",
"in",
"an",
"stl",
"map",
"of",
"that",
"lists",
"the",
"correct",
"dlopen",
"target",
"for",
"each",
"module",
"."... | def WriteUmbrellaInitializer(cls, module_names, namespace, outfile,
logging_function):
outfile.write(UMBRELLA_INITIALIZER_START % namespace)
outfile.write(UMBRELLA_INITIALIZER_CLEANUP_FUNCTION)
outfile.write(UMBRELLA_INITIALIZER_INITIALIZE_FUNCTION_START %
{'... | [
"def",
"WriteUmbrellaInitializer",
"(",
"cls",
",",
"module_names",
",",
"namespace",
",",
"outfile",
",",
"logging_function",
")",
":",
"outfile",
".",
"write",
"(",
"UMBRELLA_INITIALIZER_START",
"%",
"namespace",
")",
"outfile",
".",
"write",
"(",
"UMBRELLA_INIT... | Writes a single function that will open + initialize each module. | [
"Writes",
"a",
"single",
"function",
"that",
"will",
"open",
"+",
"initialize",
"each",
"module",
"."
] | [
"\"\"\"Writes a single function that will open + initialize each module.\n\n This intializer will take in an stl map of that lists the correct\n dlopen target for each module. The map type is\n std::map<enum StubModules, vector<std::string>> which matches one module\n to a list of paths to try in dlope... | [
{
"param": "cls",
"type": null
},
{
"param": "module_names",
"type": null
},
{
"param": "namespace",
"type": null
},
{
"param": "outfile",
"type": null
},
{
"param": "logging_function",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "module_names",
"type": null,
"docstring": "A list with the names of ... |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteHeaderContents | null | def WriteHeaderContents(cls, module_names, namespace, header_guard, outfile):
"""Writes a header file for the stub file generated for module_names.
The header file exposes the following:
1) An enum, StubModules, listing with an entry for each enum.
2) A typedef for a StubPathMap allowing for spec... | Writes a header file for the stub file generated for module_names.
The header file exposes the following:
1) An enum, StubModules, listing with an entry for each enum.
2) A typedef for a StubPathMap allowing for specification of paths to
search for each module.
3) The IsInitialized/I... | Writes a header file for the stub file generated for module_names.
The header file exposes the following:
1) An enum, StubModules, listing with an entry for each enum.
2) A typedef for a StubPathMap allowing for specification of paths to
search for each module.
3) The IsInitialized/Initialize/Uninitialize functions for... | [
"Writes",
"a",
"header",
"file",
"for",
"the",
"stub",
"file",
"generated",
"for",
"module_names",
".",
"The",
"header",
"file",
"exposes",
"the",
"following",
":",
"1",
")",
"An",
"enum",
"StubModules",
"listing",
"with",
"an",
"entry",
"for",
"each",
"en... | def WriteHeaderContents(cls, module_names, namespace, header_guard, outfile):
outfile.write(STUB_HEADER_PREAMBLE % {
'guard_name': header_guard,
'namespace': namespace
})
outfile.write('// Individual module initializer functions.\n')
for name in module_names:
outfile.write(
... | [
"def",
"WriteHeaderContents",
"(",
"cls",
",",
"module_names",
",",
"namespace",
",",
"header_guard",
",",
"outfile",
")",
":",
"outfile",
".",
"write",
"(",
"STUB_HEADER_PREAMBLE",
"%",
"{",
"'guard_name'",
":",
"header_guard",
",",
"'namespace'",
":",
"namespa... | Writes a header file for the stub file generated for module_names. | [
"Writes",
"a",
"header",
"file",
"for",
"the",
"stub",
"file",
"generated",
"for",
"module_names",
"."
] | [
"\"\"\"Writes a header file for the stub file generated for module_names.\n\n The header file exposes the following:\n 1) An enum, StubModules, listing with an entry for each enum.\n 2) A typedef for a StubPathMap allowing for specification of paths to\n search for each module.\n 3) Th... | [
{
"param": "cls",
"type": null
},
{
"param": "module_names",
"type": null
},
{
"param": "namespace",
"type": null
},
{
"param": "header_guard",
"type": null
},
{
"param": "outfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "module_names",
"type": null,
"docstring": "A list with the names of ... |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteStubFunctions | null | def WriteStubFunctions(self, outfile):
"""Write the function stubs to handle dispatching to real implementations.
Functions that have a return type other than void will look as follows:
ReturnType FunctionName(A a) {
return FunctionName_ptr(a);
}
Functions with a return type of void w... | Write the function stubs to handle dispatching to real implementations.
Functions that have a return type other than void will look as follows:
ReturnType FunctionName(A a) {
return FunctionName_ptr(a);
}
Functions with a return type of void will look as follows:
void FunctionName(... | Write the function stubs to handle dispatching to real implementations.
Functions that have a return type other than void will look as follows.
Functions with a return type of void will look as follows.
| [
"Write",
"the",
"function",
"stubs",
"to",
"handle",
"dispatching",
"to",
"real",
"implementations",
".",
"Functions",
"that",
"have",
"a",
"return",
"type",
"other",
"than",
"void",
"will",
"look",
"as",
"follows",
".",
"Functions",
"with",
"a",
"return",
"... | def WriteStubFunctions(self, outfile):
outfile.write('// Stubs that dispatch to the real implementations.\n')
for sig in self.signatures:
sig['export'] = self.export_macro
outfile.write('%s\n' % PosixStubWriter.StubFunction(sig)) | [
"def",
"WriteStubFunctions",
"(",
"self",
",",
"outfile",
")",
":",
"outfile",
".",
"write",
"(",
"'// Stubs that dispatch to the real implementations.\\n'",
")",
"for",
"sig",
"in",
"self",
".",
"signatures",
":",
"sig",
"[",
"'export'",
"]",
"=",
"self",
".",
... | Write the function stubs to handle dispatching to real implementations. | [
"Write",
"the",
"function",
"stubs",
"to",
"handle",
"dispatching",
"to",
"real",
"implementations",
"."
] | [
"\"\"\"Write the function stubs to handle dispatching to real implementations.\n\n Functions that have a return type other than void will look as follows:\n\n ReturnType FunctionName(A a) {\n return FunctionName_ptr(a);\n }\n\n Functions with a return type of void will look as follows:\n\n ... | [
{
"param": "self",
"type": null
},
{
"param": "outfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "outfile",
"type": null,
"docstring": "The file handle to populate."... |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteModuleInitializeFunctions | null | def WriteModuleInitializeFunctions(self, outfile):
"""Write functions to initialize/query initlialization of the module.
This creates 2 functions IsModuleInitialized and InitializeModule where
"Module" is replaced with the module name, first letter capitalized.
The InitializeModule function takes a ha... | Write functions to initialize/query initlialization of the module.
This creates 2 functions IsModuleInitialized and InitializeModule where
"Module" is replaced with the module name, first letter capitalized.
The InitializeModule function takes a handle that is retrieved from dlopen
and attempts to ass... | Write functions to initialize/query initlialization of the module.
This creates 2 functions IsModuleInitialized and InitializeModule where
"Module" is replaced with the module name, first letter capitalized.
The InitializeModule function takes a handle that is retrieved from dlopen
and attempts to assign each function... | [
"Write",
"functions",
"to",
"initialize",
"/",
"query",
"initlialization",
"of",
"the",
"module",
".",
"This",
"creates",
"2",
"functions",
"IsModuleInitialized",
"and",
"InitializeModule",
"where",
"\"",
"Module",
"\"",
"is",
"replaced",
"with",
"the",
"module",
... | def WriteModuleInitializeFunctions(self, outfile):
ptr_names = ['%s_ptr' % sig['name'] for sig in self.signatures]
initialization_conditional = ' &&\n '.join(ptr_names)
outfile.write(MODULE_INITIALIZATION_CHECK_FUNCTION %
(PosixStubWriter.IsInitializedName(
se... | [
"def",
"WriteModuleInitializeFunctions",
"(",
"self",
",",
"outfile",
")",
":",
"ptr_names",
"=",
"[",
"'%s_ptr'",
"%",
"sig",
"[",
"'name'",
"]",
"for",
"sig",
"in",
"self",
".",
"signatures",
"]",
"initialization_conditional",
"=",
"' &&\\n '",
".",
... | Write functions to initialize/query initlialization of the module. | [
"Write",
"functions",
"to",
"initialize",
"/",
"query",
"initlialization",
"of",
"the",
"module",
"."
] | [
"\"\"\"Write functions to initialize/query initlialization of the module.\n\n This creates 2 functions IsModuleInitialized and InitializeModule where\n \"Module\" is replaced with the module name, first letter capitalized.\n\n The InitializeModule function takes a handle that is retrieved from dlopen\n ... | [
{
"param": "self",
"type": null
},
{
"param": "outfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "outfile",
"type": null,
"docstring": "The file handle to populate."... |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreateOptionParser | <not_specific> | def CreateOptionParser():
"""Creates an OptionParser for the configuration options of script.
Returns:
A OptionParser object.
"""
parser = optparse.OptionParser(usage='usage: %prog [options] input')
parser.add_option('-o',
'--output',
dest='out_dir',
... | Creates an OptionParser for the configuration options of script.
Returns:
A OptionParser object.
| Creates an OptionParser for the configuration options of script. | [
"Creates",
"an",
"OptionParser",
"for",
"the",
"configuration",
"options",
"of",
"script",
"."
] | def CreateOptionParser():
parser = optparse.OptionParser(usage='usage: %prog [options] input')
parser.add_option('-o',
'--output',
dest='out_dir',
default=None,
help='Output location.')
parser.add_option(
'-i',
'--intermed... | [
"def",
"CreateOptionParser",
"(",
")",
":",
"parser",
"=",
"optparse",
".",
"OptionParser",
"(",
"usage",
"=",
"'usage: %prog [options] input'",
")",
"parser",
".",
"add_option",
"(",
"'-o'",
",",
"'--output'",
",",
"dest",
"=",
"'out_dir'",
",",
"default",
"=... | Creates an OptionParser for the configuration options of script. | [
"Creates",
"an",
"OptionParser",
"for",
"the",
"configuration",
"options",
"of",
"script",
"."
] | [
"\"\"\"Creates an OptionParser for the configuration options of script.\n\n Returns:\n A OptionParser object.\n \"\"\""
] | [] | {
"returns": [
{
"docstring": "A OptionParser object.",
"docstring_tokens": [
"A",
"OptionParser",
"object",
"."
],
"type": null
}
],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParseOptions | <not_specific> | def ParseOptions():
"""Parses the options and terminates program if they are not sane.
Returns:
The pair (optparse.OptionValues, [string]), that is the output of
a successful call to parser.parse_args().
"""
parser = CreateOptionParser()
options, args = parser.parse_args()
if not args:
parser.... | Parses the options and terminates program if they are not sane.
Returns:
The pair (optparse.OptionValues, [string]), that is the output of
a successful call to parser.parse_args().
| Parses the options and terminates program if they are not sane. | [
"Parses",
"the",
"options",
"and",
"terminates",
"program",
"if",
"they",
"are",
"not",
"sane",
"."
] | def ParseOptions():
parser = CreateOptionParser()
options, args = parser.parse_args()
if not args:
parser.error('No inputs specified')
if options.out_dir is None:
parser.error('Output location not specified')
if (options.type not in [
FILE_TYPE_WIN_X86, FILE_TYPE_WIN_X64, FILE_TYPE_POSIX_STUB,
... | [
"def",
"ParseOptions",
"(",
")",
":",
"parser",
"=",
"CreateOptionParser",
"(",
")",
"options",
",",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"if",
"not",
"args",
":",
"parser",
".",
"error",
"(",
"'No inputs specified'",
")",
"if",
"options",
... | Parses the options and terminates program if they are not sane. | [
"Parses",
"the",
"options",
"and",
"terminates",
"program",
"if",
"they",
"are",
"not",
"sane",
"."
] | [
"\"\"\"Parses the options and terminates program if they are not sane.\n\n Returns:\n The pair (optparse.OptionValues, [string]), that is the output of\n a successful call to parser.parse_args().\n \"\"\""
] | [] | {
"returns": [
{
"docstring": "The pair (optparse.OptionValues, [string]), that is the output of\na successful call to parser.parse_args().",
"docstring_tokens": [
"The",
"pair",
"(",
"optparse",
".",
"OptionValues",
"[",
"string",
... |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | EnsureDirExists | null | def EnsureDirExists(dir):
"""Creates a directory. Does not use the more obvious 'if not exists: create'
to avoid race with other invocations of the same code, which will error out
on makedirs if another invocation has succeeded in creating the directory
since the existence check."""
try:
os.makedirs(dir)
... | Creates a directory. Does not use the more obvious 'if not exists: create'
to avoid race with other invocations of the same code, which will error out
on makedirs if another invocation has succeeded in creating the directory
since the existence check. | Creates a directory. Does not use the more obvious 'if not exists: create'
to avoid race with other invocations of the same code, which will error out
on makedirs if another invocation has succeeded in creating the directory
since the existence check. | [
"Creates",
"a",
"directory",
".",
"Does",
"not",
"use",
"the",
"more",
"obvious",
"'",
"if",
"not",
"exists",
":",
"create",
"'",
"to",
"avoid",
"race",
"with",
"other",
"invocations",
"of",
"the",
"same",
"code",
"which",
"will",
"error",
"out",
"on",
... | def EnsureDirExists(dir):
try:
os.makedirs(dir)
except:
if not os.path.isdir(dir):
raise | [
"def",
"EnsureDirExists",
"(",
"dir",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"dir",
")",
"except",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"dir",
")",
":",
"raise"
] | Creates a directory. | [
"Creates",
"a",
"directory",
"."
] | [
"\"\"\"Creates a directory. Does not use the more obvious 'if not exists: create'\n to avoid race with other invocations of the same code, which will error out\n on makedirs if another invocation has succeeded in creating the directory\n since the existence check.\"\"\""
] | [
{
"param": "dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreateOutputDirectories | <not_specific> | def CreateOutputDirectories(options):
"""Creates the intermediate and final output directories.
Given the parsed options, create the intermediate and final output
directories if they do not exist. Returns the paths to both directories
as a pair.
Args:
options: An OptionParser.OptionValues object with t... | Creates the intermediate and final output directories.
Given the parsed options, create the intermediate and final output
directories if they do not exist. Returns the paths to both directories
as a pair.
Args:
options: An OptionParser.OptionValues object with the parsed options.
Returns:
The pair... | Creates the intermediate and final output directories.
Given the parsed options, create the intermediate and final output
directories if they do not exist. Returns the paths to both directories
as a pair. | [
"Creates",
"the",
"intermediate",
"and",
"final",
"output",
"directories",
".",
"Given",
"the",
"parsed",
"options",
"create",
"the",
"intermediate",
"and",
"final",
"output",
"directories",
"if",
"they",
"do",
"not",
"exist",
".",
"Returns",
"the",
"paths",
"... | def CreateOutputDirectories(options):
out_dir = os.path.normpath(options.out_dir)
intermediate_dir = os.path.normpath(options.intermediate_dir)
if intermediate_dir is None:
intermediate_dir = out_dir
EnsureDirExists(out_dir)
EnsureDirExists(intermediate_dir)
return out_dir, intermediate_dir | [
"def",
"CreateOutputDirectories",
"(",
"options",
")",
":",
"out_dir",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"options",
".",
"out_dir",
")",
"intermediate_dir",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"options",
".",
"intermediate_dir",
")",
... | Creates the intermediate and final output directories. | [
"Creates",
"the",
"intermediate",
"and",
"final",
"output",
"directories",
"."
] | [
"\"\"\"Creates the intermediate and final output directories.\n\n Given the parsed options, create the intermediate and final output\n directories if they do not exist. Returns the paths to both directories\n as a pair.\n\n Args:\n options: An OptionParser.OptionValues object with the parsed options.\n\n R... | [
{
"param": "options",
"type": null
}
] | {
"returns": [
{
"docstring": "The pair (out_dir, intermediate_dir), both of which are strings.",
"docstring_tokens": [
"The",
"pair",
"(",
"out_dir",
"intermediate_dir",
")",
"both",
"of",
"which",
"are",
"strings... |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreateWindowsLibForSigFiles | null | def CreateWindowsLibForSigFiles(sig_files, out_dir, intermediate_dir, machine,
export_macro):
"""For each signature file, create a Windows lib.
Args:
sig_files: Array of strings with the paths to each signature file.
out_dir: String holding path to directory where the genera... | For each signature file, create a Windows lib.
Args:
sig_files: Array of strings with the paths to each signature file.
out_dir: String holding path to directory where the generated libs go.
intermediate_dir: String holding path to directory generated intermediate
artifacts.
mac... | For each signature file, create a Windows lib. | [
"For",
"each",
"signature",
"file",
"create",
"a",
"Windows",
"lib",
"."
] | def CreateWindowsLibForSigFiles(sig_files, out_dir, intermediate_dir, machine,
export_macro):
for input_path in sig_files:
infile = open(input_path, 'r')
try:
signatures = ParseSignatures(infile)
module_name = ExtractModuleName(os.path.basename(input_path))
fo... | [
"def",
"CreateWindowsLibForSigFiles",
"(",
"sig_files",
",",
"out_dir",
",",
"intermediate_dir",
",",
"machine",
",",
"export_macro",
")",
":",
"for",
"input_path",
"in",
"sig_files",
":",
"infile",
"=",
"open",
"(",
"input_path",
",",
"'r'",
")",
"try",
":",
... | For each signature file, create a Windows lib. | [
"For",
"each",
"signature",
"file",
"create",
"a",
"Windows",
"lib",
"."
] | [
"\"\"\"For each signature file, create a Windows lib.\n\n Args:\n sig_files: Array of strings with the paths to each signature file.\n out_dir: String holding path to directory where the generated libs go.\n intermediate_dir: String holding path to directory generated intermediate\n a... | [
{
"param": "sig_files",
"type": null
},
{
"param": "out_dir",
"type": null
},
{
"param": "intermediate_dir",
"type": null
},
{
"param": "machine",
"type": null
},
{
"param": "export_macro",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sig_files",
"type": null,
"docstring": "Array of strings with the paths to each signature file.",
"docstring_tokens": [
"Array",
"of",
"strings",
"with",
"the",
"paths",
... |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreateWindowsDefForSigFiles | null | def CreateWindowsDefForSigFiles(sig_files, out_dir, module_name):
"""For all signature files, create a single Windows def file.
Args:
sig_files: Array of strings with the paths to each signature file.
out_dir: String holding path to directory where the generated def goes.
module_name: Name of the outpu... | For all signature files, create a single Windows def file.
Args:
sig_files: Array of strings with the paths to each signature file.
out_dir: String holding path to directory where the generated def goes.
module_name: Name of the output DLL or LIB which will link in the def file.
| For all signature files, create a single Windows def file. | [
"For",
"all",
"signature",
"files",
"create",
"a",
"single",
"Windows",
"def",
"file",
"."
] | def CreateWindowsDefForSigFiles(sig_files, out_dir, module_name):
signatures = []
for input_path in sig_files:
infile = open(input_path, 'r')
try:
signatures += ParseSignatures(infile)
finally:
infile.close()
def_file_path = os.path.join(
out_dir,
os.path.splitext(os.path.basen... | [
"def",
"CreateWindowsDefForSigFiles",
"(",
"sig_files",
",",
"out_dir",
",",
"module_name",
")",
":",
"signatures",
"=",
"[",
"]",
"for",
"input_path",
"in",
"sig_files",
":",
"infile",
"=",
"open",
"(",
"input_path",
",",
"'r'",
")",
"try",
":",
"signatures... | For all signature files, create a single Windows def file. | [
"For",
"all",
"signature",
"files",
"create",
"a",
"single",
"Windows",
"def",
"file",
"."
] | [
"\"\"\"For all signature files, create a single Windows def file.\n\n Args:\n sig_files: Array of strings with the paths to each signature file.\n out_dir: String holding path to directory where the generated def goes.\n module_name: Name of the output DLL or LIB which will link in the def file.\n \"\"\"... | [
{
"param": "sig_files",
"type": null
},
{
"param": "out_dir",
"type": null
},
{
"param": "module_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sig_files",
"type": null,
"docstring": "Array of strings with the paths to each signature file.",
"docstring_tokens": [
"Array",
"of",
"strings",
"with",
"the",
"paths",
... |
f9ff0e06bdb41b123fb9227b45b25d166f227a88 | sunlongbo/chromium | tools/generate_stubs/generate_stubs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreatePosixStubsForSigFiles | null | def CreatePosixStubsForSigFiles(sig_files, stub_name, out_dir, intermediate_dir,
path_from_source, extra_stub_header,
export_macro, logging_function,
logging_include):
"""Create a POSIX stub library with a module for each ... | Create a POSIX stub library with a module for each signature file.
Args:
sig_files: Array of strings with the paths to each signature file.
stub_name: String with the basename of the generated stub file.
out_dir: String holding path to directory for the .h files.
intermediate_dir: String holding path... | Create a POSIX stub library with a module for each signature file. | [
"Create",
"a",
"POSIX",
"stub",
"library",
"with",
"a",
"module",
"for",
"each",
"signature",
"file",
"."
] | def CreatePosixStubsForSigFiles(sig_files, stub_name, out_dir, intermediate_dir,
path_from_source, extra_stub_header,
export_macro, logging_function,
logging_include):
header_base_name = stub_name + '.h'
header_path = os... | [
"def",
"CreatePosixStubsForSigFiles",
"(",
"sig_files",
",",
"stub_name",
",",
"out_dir",
",",
"intermediate_dir",
",",
"path_from_source",
",",
"extra_stub_header",
",",
"export_macro",
",",
"logging_function",
",",
"logging_include",
")",
":",
"header_base_name",
"=",... | Create a POSIX stub library with a module for each signature file. | [
"Create",
"a",
"POSIX",
"stub",
"library",
"with",
"a",
"module",
"for",
"each",
"signature",
"file",
"."
] | [
"\"\"\"Create a POSIX stub library with a module for each signature file.\n\n Args:\n sig_files: Array of strings with the paths to each signature file.\n stub_name: String with the basename of the generated stub file.\n out_dir: String holding path to directory for the .h files.\n intermediate_dir: St... | [
{
"param": "sig_files",
"type": null
},
{
"param": "stub_name",
"type": null
},
{
"param": "out_dir",
"type": null
},
{
"param": "intermediate_dir",
"type": null
},
{
"param": "path_from_source",
"type": null
},
{
"param": "extra_stub_header",
"typ... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sig_files",
"type": null,
"docstring": "Array of strings with the paths to each signature file.",
"docstring_tokens": [
"Array",
"of",
"strings",
"with",
"the",
"paths",
... |
6c02cc3e00f79873cff81e86abeef153907f4381 | sunlongbo/chromium | chrome/updater/test/service/win/rpc_client.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | TestConnection | <not_specific> | def TestConnection():
"""Test that connection to the XML RPC server."""
try:
proxy = GetProxy()
return 'hi' == proxy.echo('hi')
except RPCErrors as err:
logging.error('Unable connect to XML RPC server')
logging.exception(err)
return False | Test that connection to the XML RPC server. | Test that connection to the XML RPC server. | [
"Test",
"that",
"connection",
"to",
"the",
"XML",
"RPC",
"server",
"."
] | def TestConnection():
try:
proxy = GetProxy()
return 'hi' == proxy.echo('hi')
except RPCErrors as err:
logging.error('Unable connect to XML RPC server')
logging.exception(err)
return False | [
"def",
"TestConnection",
"(",
")",
":",
"try",
":",
"proxy",
"=",
"GetProxy",
"(",
")",
"return",
"'hi'",
"==",
"proxy",
".",
"echo",
"(",
"'hi'",
")",
"except",
"RPCErrors",
"as",
"err",
":",
"logging",
".",
"error",
"(",
"'Unable connect to XML RPC serve... | Test that connection to the XML RPC server. | [
"Test",
"that",
"connection",
"to",
"the",
"XML",
"RPC",
"server",
"."
] | [
"\"\"\"Test that connection to the XML RPC server.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
6c02cc3e00f79873cff81e86abeef153907f4381 | sunlongbo/chromium | chrome/updater/test/service/win/rpc_client.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunAsSystem | <not_specific> | def RunAsSystem(command, env=None, cwd=None, timeout=90):
"""Runs the command as SYSTEM user.
Args:
command: The command to run. This argument will be forwarded to
subprocess.Popen().
env: Environment variables to pass to command.
cwd: Working directory for the command.
timeout: How long the ... | Runs the command as SYSTEM user.
Args:
command: The command to run. This argument will be forwarded to
subprocess.Popen().
env: Environment variables to pass to command.
cwd: Working directory for the command.
timeout: How long the child process should wait for UAC before timeout.
Returns:
... | Runs the command as SYSTEM user. | [
"Runs",
"the",
"command",
"as",
"SYSTEM",
"user",
"."
] | def RunAsSystem(command, env=None, cwd=None, timeout=90):
try:
proxy = GetProxy()
env = env or dict(os.environ)
cwd = cwd or os.getcwd()
return proxy.RunAsSystem(command, env, cwd, timeout)
except RPCErrors as err:
logging.exception(err)
raise | [
"def",
"RunAsSystem",
"(",
"command",
",",
"env",
"=",
"None",
",",
"cwd",
"=",
"None",
",",
"timeout",
"=",
"90",
")",
":",
"try",
":",
"proxy",
"=",
"GetProxy",
"(",
")",
"env",
"=",
"env",
"or",
"dict",
"(",
"os",
".",
"environ",
")",
"cwd",
... | Runs the command as SYSTEM user. | [
"Runs",
"the",
"command",
"as",
"SYSTEM",
"user",
"."
] | [
"\"\"\"Runs the command as SYSTEM user.\n\n Args:\n command: The command to run. This argument will be forwarded to\n subprocess.Popen().\n env: Environment variables to pass to command.\n cwd: Working directory for the command.\n timeout: How long the child process should wait for UAC before time... | [
{
"param": "command",
"type": null
},
{
"param": "env",
"type": null
},
{
"param": "cwd",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [
{
"docstring": "(pid, exit_code, sdtout, stderr) tuple.",
"docstring_tokens": [
"(",
"pid",
"exit_code",
"sdtout",
"stderr",
")",
"tuple",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
... |
6c02cc3e00f79873cff81e86abeef153907f4381 | sunlongbo/chromium | chrome/updater/test/service/win/rpc_client.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunAsStandardUser | <not_specific> | def RunAsStandardUser(command_line, env=None, cwd=None, timeout=90):
"""Runs the command as the non-elevated logged-on user on default desktop.
Args:
command_line: The command line string, includes all arguments.
env: Environment variables to pass to command.
cwd: Working directory for the command.
... | Runs the command as the non-elevated logged-on user on default desktop.
Args:
command_line: The command line string, includes all arguments.
env: Environment variables to pass to command.
cwd: Working directory for the command.
timeout: How long the child process should wait before timeout.
Return... | Runs the command as the non-elevated logged-on user on default desktop. | [
"Runs",
"the",
"command",
"as",
"the",
"non",
"-",
"elevated",
"logged",
"-",
"on",
"user",
"on",
"default",
"desktop",
"."
] | def RunAsStandardUser(command_line, env=None, cwd=None, timeout=90):
try:
proxy = GetProxy()
env = env or dict(os.environ)
cwd = cwd or os.getcwd()
return proxy.RunAsStandardUser(command_line, env, cwd, timeout)
except RPCErrors as err:
logging.exception(err)
raise | [
"def",
"RunAsStandardUser",
"(",
"command_line",
",",
"env",
"=",
"None",
",",
"cwd",
"=",
"None",
",",
"timeout",
"=",
"90",
")",
":",
"try",
":",
"proxy",
"=",
"GetProxy",
"(",
")",
"env",
"=",
"env",
"or",
"dict",
"(",
"os",
".",
"environ",
")",... | Runs the command as the non-elevated logged-on user on default desktop. | [
"Runs",
"the",
"command",
"as",
"the",
"non",
"-",
"elevated",
"logged",
"-",
"on",
"user",
"on",
"default",
"desktop",
"."
] | [
"\"\"\"Runs the command as the non-elevated logged-on user on default desktop.\n\n Args:\n command_line: The command line string, includes all arguments.\n env: Environment variables to pass to command.\n cwd: Working directory for the command.\n timeout: How long the child process should wait before t... | [
{
"param": "command_line",
"type": null
},
{
"param": "env",
"type": null
},
{
"param": "cwd",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [
{
"docstring": "(pid, exit_code, sdtout, stderr) tuple.",
"docstring_tokens": [
"(",
"pid",
"exit_code",
"sdtout",
"stderr",
")",
"tuple",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
... |
6c02cc3e00f79873cff81e86abeef153907f4381 | sunlongbo/chromium | chrome/updater/test/service/win/rpc_client.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AnswerUpcomingUACPrompt | <not_specific> | def AnswerUpcomingUACPrompt(actions,
timeout=10,
wait_child=False,
source=''):
"""Answers upcoming UAC prompt that does not require username/password.
Args:
actions: Actions to take in string, such as 'AADDA', 'A' to accept,
... | Answers upcoming UAC prompt that does not require username/password.
Args:
actions: Actions to take in string, such as 'AADDA', 'A' to accept,
'D' to deny.
timeout: How long the child process should wait for each UAC click.
wait_child: Whether this thread should wait the completion of child proc.... | Answers upcoming UAC prompt that does not require username/password. | [
"Answers",
"upcoming",
"UAC",
"prompt",
"that",
"does",
"not",
"require",
"username",
"/",
"password",
"."
] | def AnswerUpcomingUACPrompt(actions,
timeout=10,
wait_child=False,
source=''):
try:
proxy = GetProxy()
return proxy.AnswerUpcomingUACPrompt(actions, timeout, wait_child, source)
except RPCErrors as err:
logging.exception... | [
"def",
"AnswerUpcomingUACPrompt",
"(",
"actions",
",",
"timeout",
"=",
"10",
",",
"wait_child",
"=",
"False",
",",
"source",
"=",
"''",
")",
":",
"try",
":",
"proxy",
"=",
"GetProxy",
"(",
")",
"return",
"proxy",
".",
"AnswerUpcomingUACPrompt",
"(",
"actio... | Answers upcoming UAC prompt that does not require username/password. | [
"Answers",
"upcoming",
"UAC",
"prompt",
"that",
"does",
"not",
"require",
"username",
"/",
"password",
"."
] | [
"\"\"\"Answers upcoming UAC prompt that does not require username/password.\n\n Args:\n actions: Actions to take in string, such as 'AADDA', 'A' to accept,\n 'D' to deny.\n timeout: How long the child process should wait for each UAC click.\n wait_child: Whether this thread should wait the completi... | [
{
"param": "actions",
"type": null
},
{
"param": "timeout",
"type": null
},
{
"param": "wait_child",
"type": null
},
{
"param": "source",
"type": null
}
] | {
"returns": [
{
"docstring": "(pid, exit_code) of the created UAC-answering process. If the sub-process\nis not created, or did not finish in wait time, returns (None, None).",
"docstring_tokens": [
"(",
"pid",
"exit_code",
")",
"of",
"the",
"cr... |
37cfec1e9e6de6a747884d1c29c22b01ab7b7e00 | sunlongbo/chromium | testing/clusterfuzz/common/fuzzy_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FuzzyInt | <not_specific> | def FuzzyInt(n):
"""Returns an integer derived from the input by one of several mutations."""
int_sizes = [8, 16, 32, 64, 128]
mutations = [
lambda n: utils.UniformExpoInteger(0, sys.maxsize.bit_length() + 1),
lambda n: -utils.UniformExpoInteger(0, sys.maxsize.bit_length()),
lambda n: 2 ** random.choi... | Returns an integer derived from the input by one of several mutations. | Returns an integer derived from the input by one of several mutations. | [
"Returns",
"an",
"integer",
"derived",
"from",
"the",
"input",
"by",
"one",
"of",
"several",
"mutations",
"."
] | def FuzzyInt(n):
int_sizes = [8, 16, 32, 64, 128]
mutations = [
lambda n: utils.UniformExpoInteger(0, sys.maxsize.bit_length() + 1),
lambda n: -utils.UniformExpoInteger(0, sys.maxsize.bit_length()),
lambda n: 2 ** random.choice(int_sizes) - 1,
lambda n: 2 ** random.choice(int_sizes),
lambda n: 0... | [
"def",
"FuzzyInt",
"(",
"n",
")",
":",
"int_sizes",
"=",
"[",
"8",
",",
"16",
",",
"32",
",",
"64",
",",
"128",
"]",
"mutations",
"=",
"[",
"lambda",
"n",
":",
"utils",
".",
"UniformExpoInteger",
"(",
"0",
",",
"sys",
".",
"maxsize",
".",
"bit_le... | Returns an integer derived from the input by one of several mutations. | [
"Returns",
"an",
"integer",
"derived",
"from",
"the",
"input",
"by",
"one",
"of",
"several",
"mutations",
"."
] | [
"\"\"\"Returns an integer derived from the input by one of several mutations.\"\"\""
] | [
{
"param": "n",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "n",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
37cfec1e9e6de6a747884d1c29c22b01ab7b7e00 | sunlongbo/chromium | testing/clusterfuzz/common/fuzzy_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FuzzyString | <not_specific> | def FuzzyString(s):
"""Returns a string derived from the input by one of several mutations."""
# First try some mutations that try to recognize certain types of strings
try:
s.decode("utf-8") # These mutations only make sense for textual data
except UnicodeDecodeError:
pass
else:
chained_mutation... | Returns a string derived from the input by one of several mutations. | Returns a string derived from the input by one of several mutations. | [
"Returns",
"a",
"string",
"derived",
"from",
"the",
"input",
"by",
"one",
"of",
"several",
"mutations",
"."
] | def FuzzyString(s):
try:
s.decode("utf-8")
except UnicodeDecodeError:
pass
else:
chained_mutations = [
FuzzIntsInString,
FuzzBase64InString,
FuzzListInString,
]
original = s
for mutation in chained_mutations:
s = mutation(s)
if s != original and random.getra... | [
"def",
"FuzzyString",
"(",
"s",
")",
":",
"try",
":",
"s",
".",
"decode",
"(",
"\"utf-8\"",
")",
"except",
"UnicodeDecodeError",
":",
"pass",
"else",
":",
"chained_mutations",
"=",
"[",
"FuzzIntsInString",
",",
"FuzzBase64InString",
",",
"FuzzListInString",
",... | Returns a string derived from the input by one of several mutations. | [
"Returns",
"a",
"string",
"derived",
"from",
"the",
"input",
"by",
"one",
"of",
"several",
"mutations",
"."
] | [
"\"\"\"Returns a string derived from the input by one of several mutations.\"\"\"",
"# First try some mutations that try to recognize certain types of strings",
"# These mutations only make sense for textual data",
"# Stop if we've modified the string and our coin comes up heads",
"# If we're still here, ap... | [
{
"param": "s",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "s",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
37cfec1e9e6de6a747884d1c29c22b01ab7b7e00 | sunlongbo/chromium | testing/clusterfuzz/common/fuzzy_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FuzzIntsInString | <not_specific> | def FuzzIntsInString(s):
"""Returns a string where some integers have been fuzzed with FuzzyInt."""
def ReplaceInt(m):
val = m.group()
if random.getrandbits(1): # Flip a coin to decide whether to fuzz
return val
if not random.getrandbits(4): # Delete the integer 1/16th of the time
return "... | Returns a string where some integers have been fuzzed with FuzzyInt. | Returns a string where some integers have been fuzzed with FuzzyInt. | [
"Returns",
"a",
"string",
"where",
"some",
"integers",
"have",
"been",
"fuzzed",
"with",
"FuzzyInt",
"."
] | def FuzzIntsInString(s):
def ReplaceInt(m):
val = m.group()
if random.getrandbits(1):
return val
if not random.getrandbits(4):
return ""
decimal = val.isdigit()
n = FuzzyInt(int(val) if decimal else int(val, 16))
return str(n) if decimal else "%x" % n
return re.sub(r"\b[a-f... | [
"def",
"FuzzIntsInString",
"(",
"s",
")",
":",
"def",
"ReplaceInt",
"(",
"m",
")",
":",
"val",
"=",
"m",
".",
"group",
"(",
")",
"if",
"random",
".",
"getrandbits",
"(",
"1",
")",
":",
"return",
"val",
"if",
"not",
"random",
".",
"getrandbits",
"("... | Returns a string where some integers have been fuzzed with FuzzyInt. | [
"Returns",
"a",
"string",
"where",
"some",
"integers",
"have",
"been",
"fuzzed",
"with",
"FuzzyInt",
"."
] | [
"\"\"\"Returns a string where some integers have been fuzzed with FuzzyInt.\"\"\"",
"# Flip a coin to decide whether to fuzz",
"# Delete the integer 1/16th of the time",
"# Assume decimal digits means a decimal number"
] | [
{
"param": "s",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "s",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
37cfec1e9e6de6a747884d1c29c22b01ab7b7e00 | sunlongbo/chromium | testing/clusterfuzz/common/fuzzy_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FuzzBase64InString | <not_specific> | def FuzzBase64InString(s):
"""Returns a string where Base64 components are fuzzed with FuzzyBuffer."""
def ReplaceBase64(m):
fb = FuzzyBuffer(base64.b64decode(m.group()))
fb.RandomMutation()
return base64.b64encode(fb)
# This only matches obvious Base64 words with trailing equals signs
return re.sub... | Returns a string where Base64 components are fuzzed with FuzzyBuffer. | Returns a string where Base64 components are fuzzed with FuzzyBuffer. | [
"Returns",
"a",
"string",
"where",
"Base64",
"components",
"are",
"fuzzed",
"with",
"FuzzyBuffer",
"."
] | def FuzzBase64InString(s):
def ReplaceBase64(m):
fb = FuzzyBuffer(base64.b64decode(m.group()))
fb.RandomMutation()
return base64.b64encode(fb)
return re.sub(r"(?<![A-Za-z0-9+/])"
r"(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)"
r"(?![A-Za-z0-9+/])", Replac... | [
"def",
"FuzzBase64InString",
"(",
"s",
")",
":",
"def",
"ReplaceBase64",
"(",
"m",
")",
":",
"fb",
"=",
"FuzzyBuffer",
"(",
"base64",
".",
"b64decode",
"(",
"m",
".",
"group",
"(",
")",
")",
")",
"fb",
".",
"RandomMutation",
"(",
")",
"return",
"base... | Returns a string where Base64 components are fuzzed with FuzzyBuffer. | [
"Returns",
"a",
"string",
"where",
"Base64",
"components",
"are",
"fuzzed",
"with",
"FuzzyBuffer",
"."
] | [
"\"\"\"Returns a string where Base64 components are fuzzed with FuzzyBuffer.\"\"\"",
"# This only matches obvious Base64 words with trailing equals signs"
] | [
{
"param": "s",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "s",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
37cfec1e9e6de6a747884d1c29c22b01ab7b7e00 | sunlongbo/chromium | testing/clusterfuzz/common/fuzzy_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FuzzListInString | <not_specific> | def FuzzListInString(s, separators=r", |,|; |;|\r\n|\s"):
"""Tries to interpret the string as a list, and fuzzes it if successful."""
seps = re.findall(separators, s)
if not seps:
return s
sep = random.choice(seps) # Ones that appear often are more likely
items = FuzzyList(s.split(sep))
items.RandomMut... | Tries to interpret the string as a list, and fuzzes it if successful. | Tries to interpret the string as a list, and fuzzes it if successful. | [
"Tries",
"to",
"interpret",
"the",
"string",
"as",
"a",
"list",
"and",
"fuzzes",
"it",
"if",
"successful",
"."
] | def FuzzListInString(s, separators=r", |,|; |;|\r\n|\s"):
seps = re.findall(separators, s)
if not seps:
return s
sep = random.choice(seps)
items = FuzzyList(s.split(sep))
items.RandomMutation()
return sep.join(items) | [
"def",
"FuzzListInString",
"(",
"s",
",",
"separators",
"=",
"r\", |,|; |;|\\r\\n|\\s\"",
")",
":",
"seps",
"=",
"re",
".",
"findall",
"(",
"separators",
",",
"s",
")",
"if",
"not",
"seps",
":",
"return",
"s",
"sep",
"=",
"random",
".",
"choice",
"(",
... | Tries to interpret the string as a list, and fuzzes it if successful. | [
"Tries",
"to",
"interpret",
"the",
"string",
"as",
"a",
"list",
"and",
"fuzzes",
"it",
"if",
"successful",
"."
] | [
"\"\"\"Tries to interpret the string as a list, and fuzzes it if successful.\"\"\"",
"# Ones that appear often are more likely"
] | [
{
"param": "s",
"type": null
},
{
"param": "separators",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "s",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "separators",
"type": null,
"docstring": null,
"docstring_tokens"... |
37cfec1e9e6de6a747884d1c29c22b01ab7b7e00 | sunlongbo/chromium | testing/clusterfuzz/common/fuzzy_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Overwrite | null | def Overwrite(self, value, location=None, amount=None):
"""Overwrite amount elements starting at location with value.
Value can be a function of no arguments, in which case it will be called
every time a new value is needed.
"""
if location is None:
location = random.randint(0, max(0, len(sel... | Overwrite amount elements starting at location with value.
Value can be a function of no arguments, in which case it will be called
every time a new value is needed.
| Overwrite amount elements starting at location with value.
Value can be a function of no arguments, in which case it will be called
every time a new value is needed. | [
"Overwrite",
"amount",
"elements",
"starting",
"at",
"location",
"with",
"value",
".",
"Value",
"can",
"be",
"a",
"function",
"of",
"no",
"arguments",
"in",
"which",
"case",
"it",
"will",
"be",
"called",
"every",
"time",
"a",
"new",
"value",
"is",
"needed"... | def Overwrite(self, value, location=None, amount=None):
if location is None:
location = random.randint(0, max(0, len(self) - 1))
if amount is None:
amount = utils.RandomLowInteger(min(1, len(self)), len(self) - location)
if hasattr(value, "__call__"):
new_elements = (value() for i in range... | [
"def",
"Overwrite",
"(",
"self",
",",
"value",
",",
"location",
"=",
"None",
",",
"amount",
"=",
"None",
")",
":",
"if",
"location",
"is",
"None",
":",
"location",
"=",
"random",
".",
"randint",
"(",
"0",
",",
"max",
"(",
"0",
",",
"len",
"(",
"s... | Overwrite amount elements starting at location with value. | [
"Overwrite",
"amount",
"elements",
"starting",
"at",
"location",
"with",
"value",
"."
] | [
"\"\"\"Overwrite amount elements starting at location with value.\n\n Value can be a function of no arguments, in which case it will be called\n every time a new value is needed.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": null
},
{
"param": "location",
"type": null
},
{
"param": "amount",
"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": ... |
37cfec1e9e6de6a747884d1c29c22b01ab7b7e00 | sunlongbo/chromium | testing/clusterfuzz/common/fuzzy_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Insert | null | def Insert(self, value, location=None, amount=None, max_exponent=14):
"""Insert amount elements starting at location.
Value can be a function of no arguments, in which case it will be called
every time a new value is needed.
"""
if location is None:
location = random.randint(0, max(0, len(sel... | Insert amount elements starting at location.
Value can be a function of no arguments, in which case it will be called
every time a new value is needed.
| Insert amount elements starting at location.
Value can be a function of no arguments, in which case it will be called
every time a new value is needed. | [
"Insert",
"amount",
"elements",
"starting",
"at",
"location",
".",
"Value",
"can",
"be",
"a",
"function",
"of",
"no",
"arguments",
"in",
"which",
"case",
"it",
"will",
"be",
"called",
"every",
"time",
"a",
"new",
"value",
"is",
"needed",
"."
] | def Insert(self, value, location=None, amount=None, max_exponent=14):
if location is None:
location = random.randint(0, max(0, len(self) - 1))
if amount is None:
amount = utils.UniformExpoInteger(0, max_exponent)
if hasattr(value, "__call__"):
new_elements = (value() for i in range(amount)... | [
"def",
"Insert",
"(",
"self",
",",
"value",
",",
"location",
"=",
"None",
",",
"amount",
"=",
"None",
",",
"max_exponent",
"=",
"14",
")",
":",
"if",
"location",
"is",
"None",
":",
"location",
"=",
"random",
".",
"randint",
"(",
"0",
",",
"max",
"(... | Insert amount elements starting at location. | [
"Insert",
"amount",
"elements",
"starting",
"at",
"location",
"."
] | [
"\"\"\"Insert amount elements starting at location.\n\n Value can be a function of no arguments, in which case it will be called\n every time a new value is needed.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": null
},
{
"param": "location",
"type": null
},
{
"param": "amount",
"type": null
},
{
"param": "max_exponent",
"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": ... |
37cfec1e9e6de6a747884d1c29c22b01ab7b7e00 | sunlongbo/chromium | testing/clusterfuzz/common/fuzzy_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Delete | null | def Delete(self, location=None, amount=None):
"""Delete amount elements starting at location."""
if location is None:
location = random.randint(0, max(0, len(self) - 1))
if amount is None:
amount = utils.RandomLowInteger(min(1, len(self)), len(self) - location)
del self[location:location+amo... | Delete amount elements starting at location. | Delete amount elements starting at location. | [
"Delete",
"amount",
"elements",
"starting",
"at",
"location",
"."
] | def Delete(self, location=None, amount=None):
if location is None:
location = random.randint(0, max(0, len(self) - 1))
if amount is None:
amount = utils.RandomLowInteger(min(1, len(self)), len(self) - location)
del self[location:location+amount] | [
"def",
"Delete",
"(",
"self",
",",
"location",
"=",
"None",
",",
"amount",
"=",
"None",
")",
":",
"if",
"location",
"is",
"None",
":",
"location",
"=",
"random",
".",
"randint",
"(",
"0",
",",
"max",
"(",
"0",
",",
"len",
"(",
"self",
")",
"-",
... | Delete amount elements starting at location. | [
"Delete",
"amount",
"elements",
"starting",
"at",
"location",
"."
] | [
"\"\"\"Delete amount elements starting at location.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "location",
"type": null
},
{
"param": "amount",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "location",
"type": null,
"docstring": null,
"docstring_tokens... |
37cfec1e9e6de6a747884d1c29c22b01ab7b7e00 | sunlongbo/chromium | testing/clusterfuzz/common/fuzzy_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RandomMutation | null | def RandomMutation(self, count=None, new_element=""):
"""Apply count random mutations chosen from a list."""
random_items = lambda: random.choice(self) if self else new_element
mutations = [
lambda: random.shuffle(self),
self.reverse,
functools.partial(self.Overwrite, new_element),
f... | Apply count random mutations chosen from a list. | Apply count random mutations chosen from a list. | [
"Apply",
"count",
"random",
"mutations",
"chosen",
"from",
"a",
"list",
"."
] | def RandomMutation(self, count=None, new_element=""):
random_items = lambda: random.choice(self) if self else new_element
mutations = [
lambda: random.shuffle(self),
self.reverse,
functools.partial(self.Overwrite, new_element),
functools.partial(self.Overwrite, random_items),
funct... | [
"def",
"RandomMutation",
"(",
"self",
",",
"count",
"=",
"None",
",",
"new_element",
"=",
"\"\"",
")",
":",
"random_items",
"=",
"lambda",
":",
"random",
".",
"choice",
"(",
"self",
")",
"if",
"self",
"else",
"new_element",
"mutations",
"=",
"[",
"lambda... | Apply count random mutations chosen from a list. | [
"Apply",
"count",
"random",
"mutations",
"chosen",
"from",
"a",
"list",
"."
] | [
"\"\"\"Apply count random mutations chosen from a list.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "count",
"type": null
},
{
"param": "new_element",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "count",
"type": null,
"docstring": null,
"docstring_tokens": ... |
37cfec1e9e6de6a747884d1c29c22b01ab7b7e00 | sunlongbo/chromium | testing/clusterfuzz/common/fuzzy_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FlipBits | null | def FlipBits(self, num_bits=None):
"""Flip num_bits bits in the buffer at random."""
if num_bits is None:
num_bits = utils.RandomLowInteger(min(1, len(self)), len(self) * 8)
for bit in random.sample(range(len(self) * 8), num_bits):
self[bit / 8] ^= 1 << (bit % 8) | Flip num_bits bits in the buffer at random. | Flip num_bits bits in the buffer at random. | [
"Flip",
"num_bits",
"bits",
"in",
"the",
"buffer",
"at",
"random",
"."
] | def FlipBits(self, num_bits=None):
if num_bits is None:
num_bits = utils.RandomLowInteger(min(1, len(self)), len(self) * 8)
for bit in random.sample(range(len(self) * 8), num_bits):
self[bit / 8] ^= 1 << (bit % 8) | [
"def",
"FlipBits",
"(",
"self",
",",
"num_bits",
"=",
"None",
")",
":",
"if",
"num_bits",
"is",
"None",
":",
"num_bits",
"=",
"utils",
".",
"RandomLowInteger",
"(",
"min",
"(",
"1",
",",
"len",
"(",
"self",
")",
")",
",",
"len",
"(",
"self",
")",
... | Flip num_bits bits in the buffer at random. | [
"Flip",
"num_bits",
"bits",
"in",
"the",
"buffer",
"at",
"random",
"."
] | [
"\"\"\"Flip num_bits bits in the buffer at random.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "num_bits",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num_bits",
"type": null,
"docstring": null,
"docstring_tokens... |
37cfec1e9e6de6a747884d1c29c22b01ab7b7e00 | sunlongbo/chromium | testing/clusterfuzz/common/fuzzy_types.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RandomMutation | null | def RandomMutation(self, count=None):
"""Apply count random mutations chosen from a weighted list."""
random_bytes = lambda: random.randint(0x00, 0xFF)
mutations = [
(self.FlipBits, 1),
(functools.partial(self.Overwrite, random_bytes), 1/3.0),
(functools.partial(self.Overwrite, 0xFF), 1/3.... | Apply count random mutations chosen from a weighted list. | Apply count random mutations chosen from a weighted list. | [
"Apply",
"count",
"random",
"mutations",
"chosen",
"from",
"a",
"weighted",
"list",
"."
] | def RandomMutation(self, count=None):
random_bytes = lambda: random.randint(0x00, 0xFF)
mutations = [
(self.FlipBits, 1),
(functools.partial(self.Overwrite, random_bytes), 1/3.0),
(functools.partial(self.Overwrite, 0xFF), 1/3.0),
(functools.partial(self.Overwrite, 0x00), 1/3.0),
(f... | [
"def",
"RandomMutation",
"(",
"self",
",",
"count",
"=",
"None",
")",
":",
"random_bytes",
"=",
"lambda",
":",
"random",
".",
"randint",
"(",
"0x00",
",",
"0xFF",
")",
"mutations",
"=",
"[",
"(",
"self",
".",
"FlipBits",
",",
"1",
")",
",",
"(",
"f... | Apply count random mutations chosen from a weighted list. | [
"Apply",
"count",
"random",
"mutations",
"chosen",
"from",
"a",
"weighted",
"list",
"."
] | [
"\"\"\"Apply count random mutations chosen from a weighted list.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "count",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "count",
"type": null,
"docstring": null,
"docstring_tokens": ... |
2a02b3b78074db8371e1a0c0e2532a3b62bb8fc4 | sunlongbo/chromium | tools/fuchsia/comparative_tester/comparative_tester.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunCommand | str | def RunCommand(command: List[str], msg: str) -> str:
"""Runs a command and returns the standard output.
Args:
command (List[str]): The list of command chunks to use in subprocess.run.
ex: ['git', 'grep', 'cat'] to find all instances of cat in a repo.
msg (str): An error message in case the subproce... | Runs a command and returns the standard output.
Args:
command (List[str]): The list of command chunks to use in subprocess.run.
ex: ['git', 'grep', 'cat'] to find all instances of cat in a repo.
msg (str): An error message in case the subprocess fails for some reason.
Raises:
subprocess.Subpro... | Runs a command and returns the standard output. | [
"Runs",
"a",
"command",
"and",
"returns",
"the",
"standard",
"output",
"."
] | def RunCommand(command: List[str], msg: str) -> str:
command = [piece for piece in command if piece != ""]
proc = subprocess.run(
command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.DEVNULL)
out = proc.stdout.decode("utf-8", errors="ignore")
err = proc.stderr.decode... | [
"def",
"RunCommand",
"(",
"command",
":",
"List",
"[",
"str",
"]",
",",
"msg",
":",
"str",
")",
"->",
"str",
":",
"command",
"=",
"[",
"piece",
"for",
"piece",
"in",
"command",
"if",
"piece",
"!=",
"\"\"",
"]",
"proc",
"=",
"subprocess",
".",
"run"... | Runs a command and returns the standard output. | [
"Runs",
"a",
"command",
"and",
"returns",
"the",
"standard",
"output",
"."
] | [
"\"\"\"Runs a command and returns the standard output.\n\n Args:\n command (List[str]): The list of command chunks to use in subprocess.run.\n ex: ['git', 'grep', 'cat'] to find all instances of cat in a repo.\n msg (str): An error message in case the subprocess fails for some reason.\n\n Raises:\n ... | [
{
"param": "command",
"type": "List[str]"
},
{
"param": "msg",
"type": "str"
}
] | {
"returns": [
{
"docstring": "the standard output of the subprocess.",
"docstring_tokens": [
"the",
"standard",
"output",
"of",
"the",
"subprocess",
"."
],
"type": "str"
}
],
"raises": [
{
"docstring": "Raises this ... |
2a02b3b78074db8371e1a0c0e2532a3b62bb8fc4 | sunlongbo/chromium | tools/fuchsia/comparative_tester/comparative_tester.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParseFilterFile | str | def ParseFilterFile(filepath: str,
p_filts: List[str],
n_filts: List[str]) -> str:
"""Takes a path to a filter file, parses it, and constructs a gtest_filter
string for test execution.
Args:
filepath (str): The path to the filter file to be parsed into a
--gtes... | Takes a path to a filter file, parses it, and constructs a gtest_filter
string for test execution.
Args:
filepath (str): The path to the filter file to be parsed into a
--gtest_filter flag.
p_filts (List[str]): An initial set of positive filters passed in a flag.
n_filts (List[str]): An initial... | Takes a path to a filter file, parses it, and constructs a gtest_filter
string for test execution. | [
"Takes",
"a",
"path",
"to",
"a",
"filter",
"file",
"parses",
"it",
"and",
"constructs",
"a",
"gtest_filter",
"string",
"for",
"test",
"execution",
"."
] | def ParseFilterFile(filepath: str,
p_filts: List[str],
n_filts: List[str]) -> str:
positive_filters = p_filts
negative_filters = n_filts
with open(filepath, "r") as file:
for line in file:
line = line.split("#", 1)[0].strip()
if line == "":
continue
... | [
"def",
"ParseFilterFile",
"(",
"filepath",
":",
"str",
",",
"p_filts",
":",
"List",
"[",
"str",
"]",
",",
"n_filts",
":",
"List",
"[",
"str",
"]",
")",
"->",
"str",
":",
"positive_filters",
"=",
"p_filts",
"negative_filters",
"=",
"n_filts",
"with",
"ope... | Takes a path to a filter file, parses it, and constructs a gtest_filter
string for test execution. | [
"Takes",
"a",
"path",
"to",
"a",
"filter",
"file",
"parses",
"it",
"and",
"constructs",
"a",
"gtest_filter",
"string",
"for",
"test",
"execution",
"."
] | [
"\"\"\"Takes a path to a filter file, parses it, and constructs a gtest_filter\n string for test execution.\n\n Args:\n filepath (str): The path to the filter file to be parsed into a\n --gtest_filter flag.\n p_filts (List[str]): An initial set of positive filters passed in a flag.\n n_filts (List... | [
{
"param": "filepath",
"type": "str"
},
{
"param": "p_filts",
"type": "List[str]"
},
{
"param": "n_filts",
"type": "List[str]"
}
] | {
"returns": [
{
"docstring": "The properly-joined together gtest_filter flag.",
"docstring_tokens": [
"The",
"properly",
"-",
"joined",
"together",
"gtest_filter",
"flag",
"."
],
"type": "str"
}
],
"raises": [],
"pa... |
2a02b3b78074db8371e1a0c0e2532a3b62bb8fc4 | sunlongbo/chromium | tools/fuchsia/comparative_tester/comparative_tester.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ExecFuchsia | str | def ExecFuchsia(self, out_dir: str, run_locally: bool) -> str:
"""Execute this test target's test on Fuchsia, either with QEMU or on actual
hardware.
Args:
out_dir (str): The Fuchsia output directory.
run_locally (bool): Whether to use QEMU(true) or a physical device(false)
Returns:
... | Execute this test target's test on Fuchsia, either with QEMU or on actual
hardware.
Args:
out_dir (str): The Fuchsia output directory.
run_locally (bool): Whether to use QEMU(true) or a physical device(false)
Returns:
str: The standard output of the test process.
| Execute this test target's test on Fuchsia, either with QEMU or on actual
hardware. | [
"Execute",
"this",
"test",
"target",
"'",
"s",
"test",
"on",
"Fuchsia",
"either",
"with",
"QEMU",
"or",
"on",
"actual",
"hardware",
"."
] | def ExecFuchsia(self, out_dir: str, run_locally: bool) -> str:
runner_name = "{}/bin/run_{}".format(out_dir, self._name)
command = [runner_name, self._filter_flag, "--exclude-system-logs"]
if not run_locally:
command.append("-d")
return RunCommand(command,
"Test {} failed on ... | [
"def",
"ExecFuchsia",
"(",
"self",
",",
"out_dir",
":",
"str",
",",
"run_locally",
":",
"bool",
")",
"->",
"str",
":",
"runner_name",
"=",
"\"{}/bin/run_{}\"",
".",
"format",
"(",
"out_dir",
",",
"self",
".",
"_name",
")",
"command",
"=",
"[",
"runner_na... | Execute this test target's test on Fuchsia, either with QEMU or on actual
hardware. | [
"Execute",
"this",
"test",
"target",
"'",
"s",
"test",
"on",
"Fuchsia",
"either",
"with",
"QEMU",
"or",
"on",
"actual",
"hardware",
"."
] | [
"\"\"\"Execute this test target's test on Fuchsia, either with QEMU or on actual\n hardware.\n\n Args:\n out_dir (str): The Fuchsia output directory.\n run_locally (bool): Whether to use QEMU(true) or a physical device(false)\n\n Returns:\n str: The standard output of the test process.\n ... | [
{
"param": "self",
"type": null
},
{
"param": "out_dir",
"type": "str"
},
{
"param": "run_locally",
"type": "bool"
}
] | {
"returns": [
{
"docstring": "The standard output of the test process.",
"docstring_tokens": [
"The",
"standard",
"output",
"of",
"the",
"test",
"process",
"."
],
"type": "str"
}
],
"raises": [],
"params": [
{
... |
2a02b3b78074db8371e1a0c0e2532a3b62bb8fc4 | sunlongbo/chromium | tools/fuchsia/comparative_tester/comparative_tester.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ExecLinux | str | def ExecLinux(self, out_dir: str, run_locally: bool) -> str:
"""Execute this test target's test on Linux, either with QEMU or on actual
hardware.
Args:
out_dir (str): The Linux output directory.
run_locally (bool): Whether to use the host machine(true) or a physical
device(false)
... | Execute this test target's test on Linux, either with QEMU or on actual
hardware.
Args:
out_dir (str): The Linux output directory.
run_locally (bool): Whether to use the host machine(true) or a physical
device(false)
Returns:
str: The standard output of the test process.
| Execute this test target's test on Linux, either with QEMU or on actual
hardware. | [
"Execute",
"this",
"test",
"target",
"'",
"s",
"test",
"on",
"Linux",
"either",
"with",
"QEMU",
"or",
"on",
"actual",
"hardware",
"."
] | def ExecLinux(self, out_dir: str, run_locally: bool) -> str:
command = []
user = target_spec.linux_device_user
ip = target_spec.linux_device_ip
host_machine = "{0}@{1}".format(user, ip)
if not run_locally:
self.TransferDependencies(out_dir, host_machine)
command = [
"ssh", "{... | [
"def",
"ExecLinux",
"(",
"self",
",",
"out_dir",
":",
"str",
",",
"run_locally",
":",
"bool",
")",
"->",
"str",
":",
"command",
"=",
"[",
"]",
"user",
"=",
"target_spec",
".",
"linux_device_user",
"ip",
"=",
"target_spec",
".",
"linux_device_ip",
"host_mac... | Execute this test target's test on Linux, either with QEMU or on actual
hardware. | [
"Execute",
"this",
"test",
"target",
"'",
"s",
"test",
"on",
"Linux",
"either",
"with",
"QEMU",
"or",
"on",
"actual",
"hardware",
"."
] | [
"\"\"\"Execute this test target's test on Linux, either with QEMU or on actual\n hardware.\n\n Args:\n out_dir (str): The Linux output directory.\n run_locally (bool): Whether to use the host machine(true) or a physical\n device(false)\n\n Returns:\n str: The standard output of the ... | [
{
"param": "self",
"type": null
},
{
"param": "out_dir",
"type": "str"
},
{
"param": "run_locally",
"type": "bool"
}
] | {
"returns": [
{
"docstring": "The standard output of the test process.",
"docstring_tokens": [
"The",
"standard",
"output",
"of",
"the",
"test",
"process",
"."
],
"type": "str"
}
],
"raises": [],
"params": [
{
... |
2a02b3b78074db8371e1a0c0e2532a3b62bb8fc4 | sunlongbo/chromium | tools/fuchsia/comparative_tester/comparative_tester.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | TransferDependencies | null | def TransferDependencies(self, out_dir: str, host: str):
"""Transfer the dependencies of this target to the machine to execute the
test.
Args:
out_dir (str): The output directory to find the dependencies in.
host (str): The IP address of the host to receive the dependencies.
"""
gn_des... | Transfer the dependencies of this target to the machine to execute the
test.
Args:
out_dir (str): The output directory to find the dependencies in.
host (str): The IP address of the host to receive the dependencies.
| Transfer the dependencies of this target to the machine to execute the
test. | [
"Transfer",
"the",
"dependencies",
"of",
"this",
"target",
"to",
"the",
"machine",
"to",
"execute",
"the",
"test",
"."
] | def TransferDependencies(self, out_dir: str, host: str):
gn_desc = ["gn", "desc", out_dir, self._target, "runtime_deps"]
out = RunCommand(
gn_desc, "Failed to get dependencies of target {}".format(self._target))
paths = []
for line in out.split("\n"):
if line == "":
continue
... | [
"def",
"TransferDependencies",
"(",
"self",
",",
"out_dir",
":",
"str",
",",
"host",
":",
"str",
")",
":",
"gn_desc",
"=",
"[",
"\"gn\"",
",",
"\"desc\"",
",",
"out_dir",
",",
"self",
".",
"_target",
",",
"\"runtime_deps\"",
"]",
"out",
"=",
"RunCommand"... | Transfer the dependencies of this target to the machine to execute the
test. | [
"Transfer",
"the",
"dependencies",
"of",
"this",
"target",
"to",
"the",
"machine",
"to",
"execute",
"the",
"test",
"."
] | [
"\"\"\"Transfer the dependencies of this target to the machine to execute the\n test.\n\n Args:\n out_dir (str): The output directory to find the dependencies in.\n host (str): The IP address of the host to receive the dependencies.\n \"\"\"",
"# Compress the dependencies of the test.",
"# Ma... | [
{
"param": "self",
"type": null
},
{
"param": "out_dir",
"type": "str"
},
{
"param": "host",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "out_dir",
"type": "str",
"docstring": "The output directory to find... |
2a02b3b78074db8371e1a0c0e2532a3b62bb8fc4 | sunlongbo/chromium | tools/fuchsia/comparative_tester/comparative_tester.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunTest | None | def RunTest(target: TestTarget, run_locally: bool = False) -> None:
"""Run the given TestTarget on both Linux and Fuchsia
Args:
target (TestTarget): The TestTarget to run.
run_locally (bool, optional): Defaults to False. Whether the test should be
run on the host machine, or sent to remote devices ... | Run the given TestTarget on both Linux and Fuchsia
Args:
target (TestTarget): The TestTarget to run.
run_locally (bool, optional): Defaults to False. Whether the test should be
run on the host machine, or sent to remote devices for execution.
Returns:
None: Technically an IO (), as it writes t... | Run the given TestTarget on both Linux and Fuchsia | [
"Run",
"the",
"given",
"TestTarget",
"on",
"both",
"Linux",
"and",
"Fuchsia"
] | def RunTest(target: TestTarget, run_locally: bool = False) -> None:
linux_out = target.ExecLinux(target_spec.linux_out_dir, run_locally)
linux_result = test_results.TargetResultFromStdout(linux_out.splitlines(),
target._name)
print("Ran Linux")
fuchsia_out = ... | [
"def",
"RunTest",
"(",
"target",
":",
"TestTarget",
",",
"run_locally",
":",
"bool",
"=",
"False",
")",
"->",
"None",
":",
"linux_out",
"=",
"target",
".",
"ExecLinux",
"(",
"target_spec",
".",
"linux_out_dir",
",",
"run_locally",
")",
"linux_result",
"=",
... | Run the given TestTarget on both Linux and Fuchsia | [
"Run",
"the",
"given",
"TestTarget",
"on",
"both",
"Linux",
"and",
"Fuchsia"
] | [
"\"\"\"Run the given TestTarget on both Linux and Fuchsia\n\n Args:\n target (TestTarget): The TestTarget to run.\n run_locally (bool, optional): Defaults to False. Whether the test should be\n run on the host machine, or sent to remote devices for execution.\n\n Returns:\n None: Technically an IO... | [
{
"param": "target",
"type": "TestTarget"
},
{
"param": "run_locally",
"type": "bool"
}
] | {
"returns": [
{
"docstring": "Technically an IO (), as it writes to the results files",
"docstring_tokens": [
"Technically",
"an",
"IO",
"()",
"as",
"it",
"writes",
"to",
"the",
"results",
"files"
],
"... |
2a02b3b78074db8371e1a0c0e2532a3b62bb8fc4 | sunlongbo/chromium | tools/fuchsia/comparative_tester/comparative_tester.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunGnForDirectory | None | def RunGnForDirectory(dir_name: str, target_os: str, is_debug: bool) -> None:
"""Create the output directory for test builds for an operating system.
Args:
dir_name (str): The name to use for the output directory. This will be
created if it does not exist.
target_os (str): The operating system to i... | Create the output directory for test builds for an operating system.
Args:
dir_name (str): The name to use for the output directory. This will be
created if it does not exist.
target_os (str): The operating system to initialize this directory for.
is_debug (bool): Whether or not this is a debug b... | Create the output directory for test builds for an operating system. | [
"Create",
"the",
"output",
"directory",
"for",
"test",
"builds",
"for",
"an",
"operating",
"system",
"."
] | def RunGnForDirectory(dir_name: str, target_os: str, is_debug: bool) -> None:
if not os.path.exists(dir_name):
os.makedirs(dir_name)
debug_str = str(is_debug).lower()
with open("{}/{}".format(dir_name, "args.gn"), "w") as args_file:
args_file.write("is_debug = {}\n".format(debug_str))
args_file.write(... | [
"def",
"RunGnForDirectory",
"(",
"dir_name",
":",
"str",
",",
"target_os",
":",
"str",
",",
"is_debug",
":",
"bool",
")",
"->",
"None",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dir_name",
")",
":",
"os",
".",
"makedirs",
"(",
"dir_na... | Create the output directory for test builds for an operating system. | [
"Create",
"the",
"output",
"directory",
"for",
"test",
"builds",
"for",
"an",
"operating",
"system",
"."
] | [
"\"\"\"Create the output directory for test builds for an operating system.\n\n Args:\n dir_name (str): The name to use for the output directory. This will be\n created if it does not exist.\n target_os (str): The operating system to initialize this directory for.\n is_debug (bool): Whether or not ... | [
{
"param": "dir_name",
"type": "str"
},
{
"param": "target_os",
"type": "str"
},
{
"param": "is_debug",
"type": "bool"
}
] | {
"returns": [
{
"docstring": "It has a side effect of replacing args.gn",
"docstring_tokens": [
"It",
"has",
"a",
"side",
"effect",
"of",
"replacing",
"args",
".",
"gn"
],
"type": "None"
}
],
"raises":... |
2a02b3b78074db8371e1a0c0e2532a3b62bb8fc4 | sunlongbo/chromium | tools/fuchsia/comparative_tester/comparative_tester.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GenerateTestData | null | def GenerateTestData(do_config: bool, do_build: bool, num_reps: int,
is_debug: bool, filter_flag: str):
"""Initializes directories, builds test targets, and repeatedly executes them
on both operating systems
Args:
do_config (bool): Whether or not to run GN for the output directories
... | Initializes directories, builds test targets, and repeatedly executes them
on both operating systems
Args:
do_config (bool): Whether or not to run GN for the output directories
do_build (bool): Whether or not to run ninja for the test targets.
num_reps (int): How many times to run each test on a given ... | Initializes directories, builds test targets, and repeatedly executes them
on both operating systems | [
"Initializes",
"directories",
"builds",
"test",
"targets",
"and",
"repeatedly",
"executes",
"them",
"on",
"both",
"operating",
"systems"
] | def GenerateTestData(do_config: bool, do_build: bool, num_reps: int,
is_debug: bool, filter_flag: str):
DIR_SOURCE_ROOT = os.path.abspath(
os.path.join(os.path.dirname(__file__), *([os.pardir] * 3)))
os.chdir(DIR_SOURCE_ROOT)
os.makedirs(target_spec.results_dir, exist_ok=True)
os.make... | [
"def",
"GenerateTestData",
"(",
"do_config",
":",
"bool",
",",
"do_build",
":",
"bool",
",",
"num_reps",
":",
"int",
",",
"is_debug",
":",
"bool",
",",
"filter_flag",
":",
"str",
")",
":",
"DIR_SOURCE_ROOT",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
... | Initializes directories, builds test targets, and repeatedly executes them
on both operating systems | [
"Initializes",
"directories",
"builds",
"test",
"targets",
"and",
"repeatedly",
"executes",
"them",
"on",
"both",
"operating",
"systems"
] | [
"\"\"\"Initializes directories, builds test targets, and repeatedly executes them\n on both operating systems\n\n Args:\n do_config (bool): Whether or not to run GN for the output directories\n do_build (bool): Whether or not to run ninja for the test targets.\n num_reps (int): How many times to run each... | [
{
"param": "do_config",
"type": "bool"
},
{
"param": "do_build",
"type": "bool"
},
{
"param": "num_reps",
"type": "int"
},
{
"param": "is_debug",
"type": "bool"
},
{
"param": "filter_flag",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "do_config",
"type": "bool",
"docstring": "Whether or not to run GN for the output directories",
"docstring_tokens": [
"Whether",
"or",
"not",
"to",
"run",
"GN",
"for",
... |
9d87dfec89bd0f86529f35e233613a3a8fa43122 | sunlongbo/chromium | tools/json_schema_compiler/js_interface_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetHeader | <not_specific> | def _GetHeader(self, tool, namespace):
"""Returns the file header text.
"""
return (
self._js_util.GetLicense() + '\n' + self._js_util.GetInfo(tool) + '\n' +
('/** @fileoverview Interface for %s that can be overriden. */' %
namespace)) | Returns the file header text.
| Returns the file header text. | [
"Returns",
"the",
"file",
"header",
"text",
"."
] | def _GetHeader(self, tool, namespace):
return (
self._js_util.GetLicense() + '\n' + self._js_util.GetInfo(tool) + '\n' +
('/** @fileoverview Interface for %s that can be overriden. */' %
namespace)) | [
"def",
"_GetHeader",
"(",
"self",
",",
"tool",
",",
"namespace",
")",
":",
"return",
"(",
"self",
".",
"_js_util",
".",
"GetLicense",
"(",
")",
"+",
"'\\n'",
"+",
"self",
".",
"_js_util",
".",
"GetInfo",
"(",
"tool",
")",
"+",
"'\\n'",
"+",
"(",
"'... | Returns the file header text. | [
"Returns",
"the",
"file",
"header",
"text",
"."
] | [
"\"\"\"Returns the file header text.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tool",
"type": null
},
{
"param": "namespace",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tool",
"type": null,
"docstring": null,
"docstring_tokens": [... |
9d87dfec89bd0f86529f35e233613a3a8fa43122 | sunlongbo/chromium | tools/json_schema_compiler/js_interface_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AppendFunction | <not_specific> | def _AppendFunction(self, c, function):
"""Appends the inteface for a function, including a JSDoc comment.
"""
if function.deprecated:
return
def getParamNames(f):
names = []
for param in f.params:
names.append(param.name)
# TODO(https://crbug.com/1142991) Update this to... | Appends the inteface for a function, including a JSDoc comment.
| Appends the inteface for a function, including a JSDoc comment. | [
"Appends",
"the",
"inteface",
"for",
"a",
"function",
"including",
"a",
"JSDoc",
"comment",
"."
] | def _AppendFunction(self, c, function):
if function.deprecated:
return
def getParamNames(f):
names = []
for param in f.params:
names.append(param.name)
if f.returns_async:
names.append(f.returns_async.name)
return names
self._js_util.AppendFunctionJsDoc(c, self.... | [
"def",
"_AppendFunction",
"(",
"self",
",",
"c",
",",
"function",
")",
":",
"if",
"function",
".",
"deprecated",
":",
"return",
"def",
"getParamNames",
"(",
"f",
")",
":",
"names",
"=",
"[",
"]",
"for",
"param",
"in",
"f",
".",
"params",
":",
"names"... | Appends the inteface for a function, including a JSDoc comment. | [
"Appends",
"the",
"inteface",
"for",
"a",
"function",
"including",
"a",
"JSDoc",
"comment",
"."
] | [
"\"\"\"Appends the inteface for a function, including a JSDoc comment.\n \"\"\"",
"# TODO(https://crbug.com/1142991) Update this to represent promises",
"# better, rather than just appended as a callback param."
] | [
{
"param": "self",
"type": null
},
{
"param": "c",
"type": null
},
{
"param": "function",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
9d87dfec89bd0f86529f35e233613a3a8fa43122 | sunlongbo/chromium | tools/json_schema_compiler/js_interface_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AppendEvent | null | def _AppendEvent(self, c, event):
"""Appends the interface for an event.
"""
c.Sblock(line='/**', line_prefix=' * ')
if (event.description):
c.Comment(event.description, comment_prefix='')
c.Append('@type {!ChromeEvent}')
self._js_util.AppendSeeLink(c, self._namespace.name, 'event', event.... | Appends the interface for an event.
| Appends the interface for an event. | [
"Appends",
"the",
"interface",
"for",
"an",
"event",
"."
] | def _AppendEvent(self, c, event):
c.Sblock(line='/**', line_prefix=' * ')
if (event.description):
c.Comment(event.description, comment_prefix='')
c.Append('@type {!ChromeEvent}')
self._js_util.AppendSeeLink(c, self._namespace.name, 'event', event.name)
c.Eblock(' */')
c.Append('%s.prototyp... | [
"def",
"_AppendEvent",
"(",
"self",
",",
"c",
",",
"event",
")",
":",
"c",
".",
"Sblock",
"(",
"line",
"=",
"'/**'",
",",
"line_prefix",
"=",
"' * '",
")",
"if",
"(",
"event",
".",
"description",
")",
":",
"c",
".",
"Comment",
"(",
"event",
".",
... | Appends the interface for an event. | [
"Appends",
"the",
"interface",
"for",
"an",
"event",
"."
] | [
"\"\"\"Appends the interface for an event.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "c",
"type": null
},
{
"param": "event",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
d3ae72bedf33a60ce6566ebed3087fa8d47e6fca | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/layout_package/json_results_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | convert_times_trie_to_flat_paths | <not_specific> | def convert_times_trie_to_flat_paths(trie, prefix=None):
"""Converts the directory structure in the given trie to flat paths, prepending a prefix to each."""
result = {}
for name, data in list(trie.items()):
if prefix:
name = prefix + "/" + name
if isinstance(data, int):
... | Converts the directory structure in the given trie to flat paths, prepending a prefix to each. | Converts the directory structure in the given trie to flat paths, prepending a prefix to each. | [
"Converts",
"the",
"directory",
"structure",
"in",
"the",
"given",
"trie",
"to",
"flat",
"paths",
"prepending",
"a",
"prefix",
"to",
"each",
"."
] | def convert_times_trie_to_flat_paths(trie, prefix=None):
result = {}
for name, data in list(trie.items()):
if prefix:
name = prefix + "/" + name
if isinstance(data, int):
result[name] = data
else:
result.update(convert_times_trie_to_flat_paths(data, na... | [
"def",
"convert_times_trie_to_flat_paths",
"(",
"trie",
",",
"prefix",
"=",
"None",
")",
":",
"result",
"=",
"{",
"}",
"for",
"name",
",",
"data",
"in",
"list",
"(",
"trie",
".",
"items",
"(",
")",
")",
":",
"if",
"prefix",
":",
"name",
"=",
"prefix"... | Converts the directory structure in the given trie to flat paths, prepending a prefix to each. | [
"Converts",
"the",
"directory",
"structure",
"in",
"the",
"given",
"trie",
"to",
"flat",
"paths",
"prepending",
"a",
"prefix",
"to",
"each",
"."
] | [
"\"\"\"Converts the directory structure in the given trie to flat paths, prepending a prefix to each.\"\"\""
] | [
{
"param": "trie",
"type": null
},
{
"param": "prefix",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "trie",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "prefix",
"type": null,
"docstring": null,
"docstring_tokens":... |
d3ae72bedf33a60ce6566ebed3087fa8d47e6fca | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/layout_package/json_results_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | add_path_to_trie | <not_specific> | def add_path_to_trie(path, value, trie):
"""Inserts a single flat directory path and associated value into a directory trie structure."""
if not "/" in path:
trie[path] = value
return
directory, _, rest = path.partition("/")
if not directory in trie:
trie[directory] = {}
add... | Inserts a single flat directory path and associated value into a directory trie structure. | Inserts a single flat directory path and associated value into a directory trie structure. | [
"Inserts",
"a",
"single",
"flat",
"directory",
"path",
"and",
"associated",
"value",
"into",
"a",
"directory",
"trie",
"structure",
"."
] | def add_path_to_trie(path, value, trie):
if not "/" in path:
trie[path] = value
return
directory, _, rest = path.partition("/")
if not directory in trie:
trie[directory] = {}
add_path_to_trie(rest, value, trie[directory]) | [
"def",
"add_path_to_trie",
"(",
"path",
",",
"value",
",",
"trie",
")",
":",
"if",
"not",
"\"/\"",
"in",
"path",
":",
"trie",
"[",
"path",
"]",
"=",
"value",
"return",
"directory",
",",
"_",
",",
"rest",
"=",
"path",
".",
"partition",
"(",
"\"/\"",
... | Inserts a single flat directory path and associated value into a directory trie structure. | [
"Inserts",
"a",
"single",
"flat",
"directory",
"path",
"and",
"associated",
"value",
"into",
"a",
"directory",
"trie",
"structure",
"."
] | [
"\"\"\"Inserts a single flat directory path and associated value into a directory trie structure.\"\"\""
] | [
{
"param": "path",
"type": null
},
{
"param": "value",
"type": null
},
{
"param": "trie",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": null,
"docstring": null,
"docstring_tokens": ... |
d3c636d6c689c5100ddfe356b8780ea61d1f8ffd | sunlongbo/chromium | media/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckNoLoggingOverrideInHeaders | <not_specific> | def _CheckNoLoggingOverrideInHeaders(input_api, output_api):
"""Checks to make sure no .h files include logging_override_if_enabled.h."""
files = []
pattern = input_api.re.compile(
r'^#include\s*"media/base/logging_override_if_enabled.h"',
input_api.re.MULTILINE)
for f in input_api.AffectedSourceFiles(i... | Checks to make sure no .h files include logging_override_if_enabled.h. | Checks to make sure no .h files include logging_override_if_enabled.h. | [
"Checks",
"to",
"make",
"sure",
"no",
".",
"h",
"files",
"include",
"logging_override_if_enabled",
".",
"h",
"."
] | def _CheckNoLoggingOverrideInHeaders(input_api, output_api):
files = []
pattern = input_api.re.compile(
r'^#include\s*"media/base/logging_override_if_enabled.h"',
input_api.re.MULTILINE)
for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
if not f.LocalPath().endswith('.h'):
cont... | [
"def",
"_CheckNoLoggingOverrideInHeaders",
"(",
"input_api",
",",
"output_api",
")",
":",
"files",
"=",
"[",
"]",
"pattern",
"=",
"input_api",
".",
"re",
".",
"compile",
"(",
"r'^#include\\s*\"media/base/logging_override_if_enabled.h\"'",
",",
"input_api",
".",
"re",
... | Checks to make sure no .h files include logging_override_if_enabled.h. | [
"Checks",
"to",
"make",
"sure",
"no",
".",
"h",
"files",
"include",
"logging_override_if_enabled",
".",
"h",
"."
] | [
"\"\"\"Checks to make sure no .h files include logging_override_if_enabled.h.\"\"\""
] | [
{
"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... |
d3c636d6c689c5100ddfe356b8780ea61d1f8ffd | sunlongbo/chromium | media/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckForNoV4L2AggregateInitialization | <not_specific> | def _CheckForNoV4L2AggregateInitialization(input_api, output_api):
"""Check that struct v4l2_* are not initialized as aggregates with a
braced-init-list"""
problems = []
v4l2_aggregate_initializer_re = re.compile(r'(^|\W)struct.+v4l2_.+=.+{+}+;')
for f in input_api.AffectedSourceFiles(_FilterFile):
for... | Check that struct v4l2_* are not initialized as aggregates with a
braced-init-list | Check that struct v4l2_* are not initialized as aggregates with a
braced-init-list | [
"Check",
"that",
"struct",
"v4l2_",
"*",
"are",
"not",
"initialized",
"as",
"aggregates",
"with",
"a",
"braced",
"-",
"init",
"-",
"list"
] | def _CheckForNoV4L2AggregateInitialization(input_api, output_api):
problems = []
v4l2_aggregate_initializer_re = re.compile(r'(^|\W)struct.+v4l2_.+=.+{+}+;')
for f in input_api.AffectedSourceFiles(_FilterFile):
for line_number, line in f.ChangedContents():
if v4l2_aggregate_initializer_re.search(line):
... | [
"def",
"_CheckForNoV4L2AggregateInitialization",
"(",
"input_api",
",",
"output_api",
")",
":",
"problems",
"=",
"[",
"]",
"v4l2_aggregate_initializer_re",
"=",
"re",
".",
"compile",
"(",
"r'(^|\\W)struct.+v4l2_.+=.+{+}+;'",
")",
"for",
"f",
"in",
"input_api",
".",
... | Check that struct v4l2_* are not initialized as aggregates with a
braced-init-list | [
"Check",
"that",
"struct",
"v4l2_",
"*",
"are",
"not",
"initialized",
"as",
"aggregates",
"with",
"a",
"braced",
"-",
"init",
"-",
"list"
] | [
"\"\"\"Check that struct v4l2_* are not initialized as aggregates with a\n braced-init-list\"\"\""
] | [
{
"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... |
bd85cb024bdd6a72ea206d76cb69543a4d2ab3f8 | sunlongbo/chromium | components/autofill/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckNoServerFieldTypeCasts | <not_specific> | def _CheckNoServerFieldTypeCasts(input_api, output_api):
"""Checks that no files cast (e.g., raw integers to) ServerFieldTypes."""
pattern = input_api.re.compile(
r'_cast<\s*ServerFieldType\b',
input_api.re.MULTILINE)
files = []
for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
... | Checks that no files cast (e.g., raw integers to) ServerFieldTypes. | Checks that no files cast ServerFieldTypes. | [
"Checks",
"that",
"no",
"files",
"cast",
"ServerFieldTypes",
"."
] | def _CheckNoServerFieldTypeCasts(input_api, output_api):
pattern = input_api.re.compile(
r'_cast<\s*ServerFieldType\b',
input_api.re.MULTILINE)
files = []
for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
if (f.LocalPath().startswith('components/autofill/') and
not f.Loca... | [
"def",
"_CheckNoServerFieldTypeCasts",
"(",
"input_api",
",",
"output_api",
")",
":",
"pattern",
"=",
"input_api",
".",
"re",
".",
"compile",
"(",
"r'_cast<\\s*ServerFieldType\\b'",
",",
"input_api",
".",
"re",
".",
"MULTILINE",
")",
"files",
"=",
"[",
"]",
"f... | Checks that no files cast (e.g., raw integers to) ServerFieldTypes. | [
"Checks",
"that",
"no",
"files",
"cast",
"(",
"e",
".",
"g",
".",
"raw",
"integers",
"to",
")",
"ServerFieldTypes",
"."
] | [
"\"\"\"Checks that no files cast (e.g., raw integers to) ServerFieldTypes.\"\"\""
] | [
{
"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... |
bd85cb024bdd6a72ea206d76cb69543a4d2ab3f8 | sunlongbo/chromium | components/autofill/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckFeatureNames | <not_specific> | def _CheckFeatureNames(input_api, output_api):
"""Checks that no features are enabled."""
pattern = input_api.re.compile(
r'\bbase::Feature\s+k(\w*)\s*{\s*"(\w*)"',
input_api.re.MULTILINE)
warnings = []
def exception(constant, feature):
if constant == "AutofillAddressEnhancementVotes" ... | Checks that no features are enabled. | Checks that no features are enabled. | [
"Checks",
"that",
"no",
"features",
"are",
"enabled",
"."
] | def _CheckFeatureNames(input_api, output_api):
pattern = input_api.re.compile(
r'\bbase::Feature\s+k(\w*)\s*{\s*"(\w*)"',
input_api.re.MULTILINE)
warnings = []
def exception(constant, feature):
if constant == "AutofillAddressEnhancementVotes" and \
feature == "kAutofillAddressEnhanc... | [
"def",
"_CheckFeatureNames",
"(",
"input_api",
",",
"output_api",
")",
":",
"pattern",
"=",
"input_api",
".",
"re",
".",
"compile",
"(",
"r'\\bbase::Feature\\s+k(\\w*)\\s*{\\s*\"(\\w*)\"'",
",",
"input_api",
".",
"re",
".",
"MULTILINE",
")",
"warnings",
"=",
"[",
... | Checks that no features are enabled. | [
"Checks",
"that",
"no",
"features",
"are",
"enabled",
"."
] | [
"\"\"\"Checks that no features are enabled.\"\"\""
] | [
{
"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... |
bd85cb024bdd6a72ea206d76cb69543a4d2ab3f8 | sunlongbo/chromium | components/autofill/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CommonChecks | <not_specific> | def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
results = []
results.extend(_CheckNoBaseTimeCalls(input_api, output_api))
results.extend(_CheckNoServerFieldTypeCasts(input_api, output_api))
results.extend(_CheckFeatureNames(input_api, output_api))
return results | Checks common to both upload and commit. | Checks common to both upload and commit. | [
"Checks",
"common",
"to",
"both",
"upload",
"and",
"commit",
"."
] | def _CommonChecks(input_api, output_api):
results = []
results.extend(_CheckNoBaseTimeCalls(input_api, output_api))
results.extend(_CheckNoServerFieldTypeCasts(input_api, output_api))
results.extend(_CheckFeatureNames(input_api, output_api))
return results | [
"def",
"_CommonChecks",
"(",
"input_api",
",",
"output_api",
")",
":",
"results",
"=",
"[",
"]",
"results",
".",
"extend",
"(",
"_CheckNoBaseTimeCalls",
"(",
"input_api",
",",
"output_api",
")",
")",
"results",
".",
"extend",
"(",
"_CheckNoServerFieldTypeCasts",... | Checks common to both upload and commit. | [
"Checks",
"common",
"to",
"both",
"upload",
"and",
"commit",
"."
] | [
"\"\"\"Checks common to both upload and commit.\"\"\""
] | [
{
"param": "input_api",
"type": null
},
{
"param": "output_api",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_api",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output_api",
"type": null,
"docstring": null,
"docstring... |
bd8b91887f41c602a740572ecdaf553afd356f33 | sunlongbo/chromium | tools/metrics/histograms/merge_xml.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CombineHistogramsSorted | <not_specific> | def CombineHistogramsSorted(doc, trees):
"""Sorts histograms related nodes by name and returns the combined nodes.
This function sorts nodes including <histogram>, <variant> and
<histogram_suffix>. Then it returns one <histograms> that contains the
sorted <histogram> and <variant> nodes and the other <histogra... | Sorts histograms related nodes by name and returns the combined nodes.
This function sorts nodes including <histogram>, <variant> and
<histogram_suffix>. Then it returns one <histograms> that contains the
sorted <histogram> and <variant> nodes and the other <histogram_suffixes_list>
node containing all <histog... | Sorts histograms related nodes by name and returns the combined nodes.
This function sorts nodes including , and
. Then it returns one that contains the
sorted and nodes and the other
node containing all nodes. | [
"Sorts",
"histograms",
"related",
"nodes",
"by",
"name",
"and",
"returns",
"the",
"combined",
"nodes",
".",
"This",
"function",
"sorts",
"nodes",
"including",
"and",
".",
"Then",
"it",
"returns",
"one",
"that",
"contains",
"the",
"sorted",
"and",
"nodes",
"a... | def CombineHistogramsSorted(doc, trees):
combined_histograms = doc.createElement('histograms')
def SortByLowerCaseName(node):
return node.getAttribute('name').lower()
variants_nodes = GetElementsByTagName(trees, 'variants', depth=3)
sorted_variants = sorted(variants_nodes, key=SortByLowerCaseName)
histogr... | [
"def",
"CombineHistogramsSorted",
"(",
"doc",
",",
"trees",
")",
":",
"combined_histograms",
"=",
"doc",
".",
"createElement",
"(",
"'histograms'",
")",
"def",
"SortByLowerCaseName",
"(",
"node",
")",
":",
"return",
"node",
".",
"getAttribute",
"(",
"'name'",
... | Sorts histograms related nodes by name and returns the combined nodes. | [
"Sorts",
"histograms",
"related",
"nodes",
"by",
"name",
"and",
"returns",
"the",
"combined",
"nodes",
"."
] | [
"\"\"\"Sorts histograms related nodes by name and returns the combined nodes.\n\n This function sorts nodes including <histogram>, <variant> and\n <histogram_suffix>. Then it returns one <histograms> that contains the\n sorted <histogram> and <variant> nodes and the other <histogram_suffixes_list>\n node contai... | [
{
"param": "doc",
"type": null
},
{
"param": "trees",
"type": null
}
] | {
"returns": [
{
"docstring": "A list containing the combined node and the combined\n node.",
"docstring_tokens": [
"A",
"list",
"containing",
"the",
"combined",
"node",
"and",
"the",
"combined",
"node",
"."
... |
bd8b91887f41c602a740572ecdaf553afd356f33 | sunlongbo/chromium | tools/metrics/histograms/merge_xml.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MakeNodeWithChildren | <not_specific> | def MakeNodeWithChildren(doc, tag, children):
"""Creates a DOM node with specified tag and child nodes.
Args:
doc: The document to create the node in.
tag: The tag to create the node with.
children: A list of DOM nodes to add as children.
Returns:
A DOM node.
"""
node = doc.createElement(tag... | Creates a DOM node with specified tag and child nodes.
Args:
doc: The document to create the node in.
tag: The tag to create the node with.
children: A list of DOM nodes to add as children.
Returns:
A DOM node.
| Creates a DOM node with specified tag and child nodes. | [
"Creates",
"a",
"DOM",
"node",
"with",
"specified",
"tag",
"and",
"child",
"nodes",
"."
] | def MakeNodeWithChildren(doc, tag, children):
node = doc.createElement(tag)
for child in children:
node.appendChild(child)
return node | [
"def",
"MakeNodeWithChildren",
"(",
"doc",
",",
"tag",
",",
"children",
")",
":",
"node",
"=",
"doc",
".",
"createElement",
"(",
"tag",
")",
"for",
"child",
"in",
"children",
":",
"node",
".",
"appendChild",
"(",
"child",
")",
"return",
"node"
] | Creates a DOM node with specified tag and child nodes. | [
"Creates",
"a",
"DOM",
"node",
"with",
"specified",
"tag",
"and",
"child",
"nodes",
"."
] | [
"\"\"\"Creates a DOM node with specified tag and child nodes.\n\n Args:\n doc: The document to create the node in.\n tag: The tag to create the node with.\n children: A list of DOM nodes to add as children.\n\n Returns:\n A DOM node.\n \"\"\""
] | [
{
"param": "doc",
"type": null
},
{
"param": "tag",
"type": null
},
{
"param": "children",
"type": null
}
] | {
"returns": [
{
"docstring": "A DOM node.",
"docstring_tokens": [
"A",
"DOM",
"node",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "doc",
"type": null,
"docstring": "The document to create the node in.",... |
bd8b91887f41c602a740572ecdaf553afd356f33 | sunlongbo/chromium | tools/metrics/histograms/merge_xml.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MergeTrees | <not_specific> | def MergeTrees(trees, should_expand_owners):
"""Merges a list of histograms.xml DOM trees.
Args:
trees: A list of histograms.xml DOM trees.
should_expand_owners: Whether we want to expand owners for histograms.
Returns:
A merged DOM tree.
"""
doc = xml.dom.minidom.Document()
doc.appendChild(
... | Merges a list of histograms.xml DOM trees.
Args:
trees: A list of histograms.xml DOM trees.
should_expand_owners: Whether we want to expand owners for histograms.
Returns:
A merged DOM tree.
| Merges a list of histograms.xml DOM trees. | [
"Merges",
"a",
"list",
"of",
"histograms",
".",
"xml",
"DOM",
"trees",
"."
] | def MergeTrees(trees, should_expand_owners):
doc = xml.dom.minidom.Document()
doc.appendChild(
MakeNodeWithChildren(
doc,
'histogram-configuration',
GetEnumsNodes(doc, trees) +
CombineHistogramsSorted(doc, trees)))
doc = xml.dom.minidom.parseString(doc.toxml().encode(... | [
"def",
"MergeTrees",
"(",
"trees",
",",
"should_expand_owners",
")",
":",
"doc",
"=",
"xml",
".",
"dom",
".",
"minidom",
".",
"Document",
"(",
")",
"doc",
".",
"appendChild",
"(",
"MakeNodeWithChildren",
"(",
"doc",
",",
"'histogram-configuration'",
",",
"Ge... | Merges a list of histograms.xml DOM trees. | [
"Merges",
"a",
"list",
"of",
"histograms",
".",
"xml",
"DOM",
"trees",
"."
] | [
"\"\"\"Merges a list of histograms.xml DOM trees.\n\n Args:\n trees: A list of histograms.xml DOM trees.\n should_expand_owners: Whether we want to expand owners for histograms.\n\n Returns:\n A merged DOM tree.\n \"\"\"",
"# This can result in the merged document having multiple <enums> and",
"# si... | [
{
"param": "trees",
"type": null
},
{
"param": "should_expand_owners",
"type": null
}
] | {
"returns": [
{
"docstring": "A merged DOM tree.",
"docstring_tokens": [
"A",
"merged",
"DOM",
"tree",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "trees",
"type": null,
"docstring": "A list of ... |
bd8b91887f41c602a740572ecdaf553afd356f33 | sunlongbo/chromium | tools/metrics/histograms/merge_xml.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MergeFiles | <not_specific> | def MergeFiles(filenames=[], files=[], should_expand_owners=False):
"""Merges a list of histograms.xml files.
Args:
filenames: A list of histograms.xml filenames.
files: A list of histograms.xml file-like objects.
should_expand_owners: Whether we want to expand owners. By default, it's
false beca... | Merges a list of histograms.xml files.
Args:
filenames: A list of histograms.xml filenames.
files: A list of histograms.xml file-like objects.
should_expand_owners: Whether we want to expand owners. By default, it's
false because most of the callers don't care about the owners for each
metada... | Merges a list of histograms.xml files. | [
"Merges",
"a",
"list",
"of",
"histograms",
".",
"xml",
"files",
"."
] | def MergeFiles(filenames=[], files=[], should_expand_owners=False):
all_files = files + filenames
trees = [xml.dom.minidom.parse(f) for f in all_files]
return MergeTrees(trees, should_expand_owners) | [
"def",
"MergeFiles",
"(",
"filenames",
"=",
"[",
"]",
",",
"files",
"=",
"[",
"]",
",",
"should_expand_owners",
"=",
"False",
")",
":",
"all_files",
"=",
"files",
"+",
"filenames",
"trees",
"=",
"[",
"xml",
".",
"dom",
".",
"minidom",
".",
"parse",
"... | Merges a list of histograms.xml files. | [
"Merges",
"a",
"list",
"of",
"histograms",
".",
"xml",
"files",
"."
] | [
"\"\"\"Merges a list of histograms.xml files.\n\n Args:\n filenames: A list of histograms.xml filenames.\n files: A list of histograms.xml file-like objects.\n should_expand_owners: Whether we want to expand owners. By default, it's\n false because most of the callers don't care about the owners for ... | [
{
"param": "filenames",
"type": null
},
{
"param": "files",
"type": null
},
{
"param": "should_expand_owners",
"type": null
}
] | {
"returns": [
{
"docstring": "A merged DOM tree.",
"docstring_tokens": [
"A",
"merged",
"DOM",
"tree",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "filenames",
"type": null,
"docstring": "A list... |
9870a4a82d28f91652b8846c137d9d5072c76576 | sunlongbo/chromium | third_party/blink/tools/print_stale_test_expectations_entries.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_expectations_line | <not_specific> | def check_expectations_line(self, line):
"""Checks the bugs in one test expectations line to see if they're stale.
Args:
line: A TestExpectationsLine instance.
Returns:
A CSV row (a list of strings), or None if there are no stale bugs.
"""
bug_links, tes... | Checks the bugs in one test expectations line to see if they're stale.
Args:
line: A TestExpectationsLine instance.
Returns:
A CSV row (a list of strings), or None if there are no stale bugs.
| Checks the bugs in one test expectations line to see if they're stale. | [
"Checks",
"the",
"bugs",
"in",
"one",
"test",
"expectations",
"line",
"to",
"see",
"if",
"they",
"'",
"re",
"stale",
"."
] | def check_expectations_line(self, line):
bug_links, test_name = line.bugs, line.name
try:
if bug_links:
for bug_link in bug_links:
self.populate_bug_info(bug_link, test_name)
if all(self.is_stale(bug_link) for bug_link in bug_links):
... | [
"def",
"check_expectations_line",
"(",
"self",
",",
"line",
")",
":",
"bug_links",
",",
"test_name",
"=",
"line",
".",
"bugs",
",",
"line",
".",
"name",
"try",
":",
"if",
"bug_links",
":",
"for",
"bug_link",
"in",
"bug_links",
":",
"self",
".",
"populate... | Checks the bugs in one test expectations line to see if they're stale. | [
"Checks",
"the",
"bugs",
"in",
"one",
"test",
"expectations",
"line",
"to",
"see",
"if",
"they",
"'",
"re",
"stale",
"."
] | [
"\"\"\"Checks the bugs in one test expectations line to see if they're stale.\n\n Args:\n line: A TestExpectationsLine instance.\n\n Returns:\n A CSV row (a list of strings), or None if there are no stale bugs.\n \"\"\"",
"# Prepopulate bug info.",
"# Return the stale ... | [
{
"param": "self",
"type": null
},
{
"param": "line",
"type": null
}
] | {
"returns": [
{
"docstring": "A CSV row (a list of strings), or None if there are no stale bugs.",
"docstring_tokens": [
"A",
"CSV",
"row",
"(",
"a",
"list",
"of",
"strings",
")",
"or",
"None",
"if",
... |
c47633c6a4ca2616c10cf4bc5655871cf2596453 | sunlongbo/chromium | tools/binary_size/diagnose_bloat.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ResultLines | <not_specific> | def _ResultLines(self, include_sections=None):
"""Generates diff lines for the specified sections (defaults to all)."""
section_lines = collections.defaultdict(list)
for section_name, section_results in self._diff.items():
if not include_sections or section_name in include_sections:
subsection... | Generates diff lines for the specified sections (defaults to all). | Generates diff lines for the specified sections (defaults to all). | [
"Generates",
"diff",
"lines",
"for",
"the",
"specified",
"sections",
"(",
"defaults",
"to",
"all",
")",
"."
] | def _ResultLines(self, include_sections=None):
section_lines = collections.defaultdict(list)
for section_name, section_results in self._diff.items():
if not include_sections or section_name in include_sections:
subsection_lines = []
section_sum = 0
units = ''
for name, valu... | [
"def",
"_ResultLines",
"(",
"self",
",",
"include_sections",
"=",
"None",
")",
":",
"section_lines",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"section_name",
",",
"section_results",
"in",
"self",
".",
"_diff",
".",
"items",
"(",
")",
... | Generates diff lines for the specified sections (defaults to all). | [
"Generates",
"diff",
"lines",
"for",
"the",
"specified",
"sections",
"(",
"defaults",
"to",
"all",
")",
"."
] | [
"\"\"\"Generates diff lines for the specified sections (defaults to all).\"\"\"",
"# Omit subsections with no changes for summaries.",
"# Omit sections with empty subsections."
] | [
{
"param": "self",
"type": null
},
{
"param": "include_sections",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "include_sections",
"type": null,
"docstring": null,
"docstrin... |
c47633c6a4ca2616c10cf4bc5655871cf2596453 | sunlongbo/chromium | tools/binary_size/diagnose_bloat.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Run | <not_specific> | def Run(self):
"""Run GN gen/ninja build and return the process returncode."""
logging.info('Building %s within %s (this might take a while).',
self.target, os.path.relpath(self.output_directory))
if self.clean:
_RunCmd([_GN_PATH, 'clean', self.output_directory], cwd=_SRC_ROOT)
re... | Run GN gen/ninja build and return the process returncode. | Run GN gen/ninja build and return the process returncode. | [
"Run",
"GN",
"gen",
"/",
"ninja",
"build",
"and",
"return",
"the",
"process",
"returncode",
"."
] | def Run(self):
logging.info('Building %s within %s (this might take a while).',
self.target, os.path.relpath(self.output_directory))
if self.clean:
_RunCmd([_GN_PATH, 'clean', self.output_directory], cwd=_SRC_ROOT)
retcode = _RunCmd(self._GenGnCmd(),
cwd=_SRC_ROO... | [
"def",
"Run",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Building %s within %s (this might take a while).'",
",",
"self",
".",
"target",
",",
"os",
".",
"path",
".",
"relpath",
"(",
"self",
".",
"output_directory",
")",
")",
"if",
"self",
".",
"... | Run GN gen/ninja build and return the process returncode. | [
"Run",
"GN",
"gen",
"/",
"ninja",
"build",
"and",
"return",
"the",
"process",
"returncode",
"."
] | [
"\"\"\"Run GN gen/ninja build and return the process returncode.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c47633c6a4ca2616c10cf4bc5655871cf2596453 | sunlongbo/chromium | tools/binary_size/diagnose_bloat.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ArchiveBuildResults | null | def ArchiveBuildResults(self, supersize_path, tool_prefix=None):
"""Save build artifacts necessary for diffing."""
logging.info('Saving build results to: %s', self.dir)
_EnsureDirsExist(self.dir)
if self.build.IsAndroid():
for path in self.build.abs_apk_paths:
self._ArchiveFile(path)
... | Save build artifacts necessary for diffing. | Save build artifacts necessary for diffing. | [
"Save",
"build",
"artifacts",
"necessary",
"for",
"diffing",
"."
] | def ArchiveBuildResults(self, supersize_path, tool_prefix=None):
logging.info('Saving build results to: %s', self.dir)
_EnsureDirsExist(self.dir)
if self.build.IsAndroid():
for path in self.build.abs_apk_paths:
self._ArchiveFile(path)
for path in self.build.abs_mapping_paths:
sel... | [
"def",
"ArchiveBuildResults",
"(",
"self",
",",
"supersize_path",
",",
"tool_prefix",
"=",
"None",
")",
":",
"logging",
".",
"info",
"(",
"'Saving build results to: %s'",
",",
"self",
".",
"dir",
")",
"_EnsureDirsExist",
"(",
"self",
".",
"dir",
")",
"if",
"... | Save build artifacts necessary for diffing. | [
"Save",
"build",
"artifacts",
"necessary",
"for",
"diffing",
"."
] | [
"\"\"\"Save build artifacts necessary for diffing.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "supersize_path",
"type": null
},
{
"param": "tool_prefix",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "supersize_path",
"type": null,
"docstring": null,
"docstring_... |
c47633c6a4ca2616c10cf4bc5655871cf2596453 | sunlongbo/chromium | tools/binary_size/diagnose_bloat.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GenerateHtmlReport | <not_specific> | def GenerateHtmlReport(self, before_id, after_id, is_internal=False):
"""Generate HTML report given two build archives."""
before = self.build_archives[before_id]
after = self.build_archives[after_id]
diff_path = self._DiffDir(before, after)
if not self._CanDiff(before, after):
logging.info(
... | Generate HTML report given two build archives. | Generate HTML report given two build archives. | [
"Generate",
"HTML",
"report",
"given",
"two",
"build",
"archives",
"."
] | def GenerateHtmlReport(self, before_id, after_id, is_internal=False):
before = self.build_archives[before_id]
after = self.build_archives[after_id]
diff_path = self._DiffDir(before, after)
if not self._CanDiff(before, after):
logging.info(
'Skipping HTML report for %s due to missing buil... | [
"def",
"GenerateHtmlReport",
"(",
"self",
",",
"before_id",
",",
"after_id",
",",
"is_internal",
"=",
"False",
")",
":",
"before",
"=",
"self",
".",
"build_archives",
"[",
"before_id",
"]",
"after",
"=",
"self",
".",
"build_archives",
"[",
"after_id",
"]",
... | Generate HTML report given two build archives. | [
"Generate",
"HTML",
"report",
"given",
"two",
"build",
"archives",
"."
] | [
"\"\"\"Generate HTML report given two build archives.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "before_id",
"type": null
},
{
"param": "after_id",
"type": null
},
{
"param": "is_internal",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "before_id",
"type": null,
"docstring": null,
"docstring_token... |
c47633c6a4ca2616c10cf4bc5655871cf2596453 | sunlongbo/chromium | tools/binary_size/diagnose_bloat.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RunCmd | <not_specific> | def _RunCmd(cmd, cwd=None, verbose=False, exit_on_failure=True):
"""Convenience function for running commands.
Args:
cmd: the command to run.
verbose: if this is True, then the stdout and stderr of the process will be
printed. If it's false, the stdout will be returned.
exit_on_failure: die if ... | Convenience function for running commands.
Args:
cmd: the command to run.
verbose: if this is True, then the stdout and stderr of the process will be
printed. If it's false, the stdout will be returned.
exit_on_failure: die if an error occurs when this is True.
Returns:
Tuple of (process s... | Convenience function for running commands. | [
"Convenience",
"function",
"for",
"running",
"commands",
"."
] | def _RunCmd(cmd, cwd=None, verbose=False, exit_on_failure=True):
assert not (verbose and exit_on_failure)
cmd_str = ' '.join(c for c in cmd)
logging.debug('Running: %s', cmd_str)
proc_stdout = proc_stderr = subprocess.PIPE
if verbose:
proc_stdout, proc_stderr = sys.stdout, subprocess.STDOUT
proc = subpr... | [
"def",
"_RunCmd",
"(",
"cmd",
",",
"cwd",
"=",
"None",
",",
"verbose",
"=",
"False",
",",
"exit_on_failure",
"=",
"True",
")",
":",
"assert",
"not",
"(",
"verbose",
"and",
"exit_on_failure",
")",
"cmd_str",
"=",
"' '",
".",
"join",
"(",
"c",
"for",
"... | Convenience function for running commands. | [
"Convenience",
"function",
"for",
"running",
"commands",
"."
] | [
"\"\"\"Convenience function for running commands.\n\n Args:\n cmd: the command to run.\n verbose: if this is True, then the stdout and stderr of the process will be\n printed. If it's false, the stdout will be returned.\n exit_on_failure: die if an error occurs when this is True.\n\n Returns:\n ... | [
{
"param": "cmd",
"type": null
},
{
"param": "cwd",
"type": null
},
{
"param": "verbose",
"type": null
},
{
"param": "exit_on_failure",
"type": null
}
] | {
"returns": [
{
"docstring": "Tuple of (process stdout, process returncode).",
"docstring_tokens": [
"Tuple",
"of",
"(",
"process",
"stdout",
"process",
"returncode",
")",
"."
],
"type": null
}
],
"raises": []... |
c47633c6a4ca2616c10cf4bc5655871cf2596453 | sunlongbo/chromium | tools/binary_size/diagnose_bloat.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _SyncAndBuild | <not_specific> | def _SyncAndBuild(archive, build, subrepo, no_gclient, extra_rev):
"""Sync, build and return non 0 if any commands failed."""
# Simply do a checkout if subrepo is used.
if _CurrentGitHash(subrepo) == archive.rev:
if subrepo != _SRC_ROOT:
logging.info('Skipping git checkout since already at desired rev')... | Sync, build and return non 0 if any commands failed. | Sync, build and return non 0 if any commands failed. | [
"Sync",
"build",
"and",
"return",
"non",
"0",
"if",
"any",
"commands",
"failed",
"."
] | def _SyncAndBuild(archive, build, subrepo, no_gclient, extra_rev):
if _CurrentGitHash(subrepo) == archive.rev:
if subrepo != _SRC_ROOT:
logging.info('Skipping git checkout since already at desired rev')
else:
logging.info('Skipping gclient sync since already at desired rev')
elif subrepo != _SRC... | [
"def",
"_SyncAndBuild",
"(",
"archive",
",",
"build",
",",
"subrepo",
",",
"no_gclient",
",",
"extra_rev",
")",
":",
"if",
"_CurrentGitHash",
"(",
"subrepo",
")",
"==",
"archive",
".",
"rev",
":",
"if",
"subrepo",
"!=",
"_SRC_ROOT",
":",
"logging",
".",
... | Sync, build and return non 0 if any commands failed. | [
"Sync",
"build",
"and",
"return",
"non",
"0",
"if",
"any",
"commands",
"failed",
"."
] | [
"\"\"\"Sync, build and return non 0 if any commands failed.\"\"\"",
"# Simply do a checkout if subrepo is used.",
"# Move to a detached state since gclient sync doesn't work with local",
"# commits on a branch."
] | [
{
"param": "archive",
"type": null
},
{
"param": "build",
"type": null
},
{
"param": "subrepo",
"type": null
},
{
"param": "no_gclient",
"type": null
},
{
"param": "extra_rev",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "archive",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "build",
"type": null,
"docstring": null,
"docstring_tokens... |
c47633c6a4ca2616c10cf4bc5655871cf2596453 | sunlongbo/chromium | tools/binary_size/diagnose_bloat.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _TmpCopyBinarySizeDir | null | def _TmpCopyBinarySizeDir():
"""Recursively copy files to a temp dir and yield temp paths."""
# Needs to be at same level of nesting as the real //tools/binary_size
# since supersize uses this to find d3 in //third_party.
tmp_dir = tempfile.mkdtemp(dir=_SRC_ROOT)
try:
bs_dir = os.path.join(tmp_dir, 'binar... | Recursively copy files to a temp dir and yield temp paths. | Recursively copy files to a temp dir and yield temp paths. | [
"Recursively",
"copy",
"files",
"to",
"a",
"temp",
"dir",
"and",
"yield",
"temp",
"paths",
"."
] | def _TmpCopyBinarySizeDir():
tmp_dir = tempfile.mkdtemp(dir=_SRC_ROOT)
try:
bs_dir = os.path.join(tmp_dir, 'binary_size')
shutil.copytree(_BINARY_SIZE_DIR, bs_dir)
tool_prefix = None
if os.path.exists(_CLANG_UPDATE_PATH):
if not os.path.exists(os.path.join(_LLVM_TOOLS_DIR, 'llvm-readelf')):
... | [
"def",
"_TmpCopyBinarySizeDir",
"(",
")",
":",
"tmp_dir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
"dir",
"=",
"_SRC_ROOT",
")",
"try",
":",
"bs_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmp_dir",
",",
"'binary_size'",
")",
"shutil",
".",
"copytree",... | Recursively copy files to a temp dir and yield temp paths. | [
"Recursively",
"copy",
"files",
"to",
"a",
"temp",
"dir",
"and",
"yield",
"temp",
"paths",
"."
] | [
"\"\"\"Recursively copy files to a temp dir and yield temp paths.\"\"\"",
"# Needs to be at same level of nesting as the real //tools/binary_size",
"# since supersize uses this to find d3 in //third_party.",
"# We also copy the tools supersize needs, but only if they exist."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
c4783b9d566f8e7730ed3deda452b3950d22352a | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/validator/framework/rule_store.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | register | null | def register(self, target_type, rule):
"""
Register a rule which validates objects of the `target_type`.
"""
assert isinstance(target_type, TargetType)
assert isinstance(rule, RuleBase)
self._target_rules_map.setdefault(target_type, []).append(rule) |
Register a rule which validates objects of the `target_type`.
| Register a rule which validates objects of the `target_type`. | [
"Register",
"a",
"rule",
"which",
"validates",
"objects",
"of",
"the",
"`",
"target_type",
"`",
"."
] | def register(self, target_type, rule):
assert isinstance(target_type, TargetType)
assert isinstance(rule, RuleBase)
self._target_rules_map.setdefault(target_type, []).append(rule) | [
"def",
"register",
"(",
"self",
",",
"target_type",
",",
"rule",
")",
":",
"assert",
"isinstance",
"(",
"target_type",
",",
"TargetType",
")",
"assert",
"isinstance",
"(",
"rule",
",",
"RuleBase",
")",
"self",
".",
"_target_rules_map",
".",
"setdefault",
"("... | Register a rule which validates objects of the `target_type`. | [
"Register",
"a",
"rule",
"which",
"validates",
"objects",
"of",
"the",
"`",
"target_type",
"`",
"."
] | [
"\"\"\"\n Register a rule which validates objects of the `target_type`.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "target_type",
"type": null
},
{
"param": "rule",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target_type",
"type": null,
"docstring": null,
"docstring_tok... |
c4783b9d566f8e7730ed3deda452b3950d22352a | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/validator/framework/rule_store.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | all_target_types | <not_specific> | def all_target_types(self):
"""
Returns all the target types registered in this class.
"""
return self._target_rules_map.keys() |
Returns all the target types registered in this class.
| Returns all the target types registered in this class. | [
"Returns",
"all",
"the",
"target",
"types",
"registered",
"in",
"this",
"class",
"."
] | def all_target_types(self):
return self._target_rules_map.keys() | [
"def",
"all_target_types",
"(",
"self",
")",
":",
"return",
"self",
".",
"_target_rules_map",
".",
"keys",
"(",
")"
] | Returns all the target types registered in this class. | [
"Returns",
"all",
"the",
"target",
"types",
"registered",
"in",
"this",
"class",
"."
] | [
"\"\"\"\n Returns all the target types registered in this class.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c08a7d8380caac90d9634b27071fc1a117f30911 | sunlongbo/chromium | tools/perf/process_perf_results.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _upload_perf_results | <not_specific> | def _upload_perf_results(json_to_upload, name, configuration_name,
build_properties, output_json_file):
"""Upload the contents of result JSON(s) to the perf dashboard."""
args= [
'--buildername', build_properties['buildername'],
'--buildnumber', build_properties['buildnumber'],
'--name', name,... | Upload the contents of result JSON(s) to the perf dashboard. | Upload the contents of result JSON(s) to the perf dashboard. | [
"Upload",
"the",
"contents",
"of",
"result",
"JSON",
"(",
"s",
")",
"to",
"the",
"perf",
"dashboard",
"."
] | def _upload_perf_results(json_to_upload, name, configuration_name,
build_properties, output_json_file):
args= [
'--buildername', build_properties['buildername'],
'--buildnumber', build_properties['buildnumber'],
'--name', name,
'--configuration-name', configuration_name,
'--results-f... | [
"def",
"_upload_perf_results",
"(",
"json_to_upload",
",",
"name",
",",
"configuration_name",
",",
"build_properties",
",",
"output_json_file",
")",
":",
"args",
"=",
"[",
"'--buildername'",
",",
"build_properties",
"[",
"'buildername'",
"]",
",",
"'--buildnumber'",
... | Upload the contents of result JSON(s) to the perf dashboard. | [
"Upload",
"the",
"contents",
"of",
"result",
"JSON",
"(",
"s",
")",
"to",
"the",
"perf",
"dashboard",
"."
] | [
"\"\"\"Upload the contents of result JSON(s) to the perf dashboard.\"\"\"",
"#TODO(crbug.com/1072729): log this in top level"
] | [
{
"param": "json_to_upload",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "configuration_name",
"type": null
},
{
"param": "build_properties",
"type": null
},
{
"param": "output_json_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "json_to_upload",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_... |
c08a7d8380caac90d9634b27071fc1a117f30911 | sunlongbo/chromium | tools/perf/process_perf_results.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _merge_json_output | <not_specific> | def _merge_json_output(output_json,
jsons_to_merge,
extra_links,
test_cross_device=False):
"""Merges the contents of one or more results JSONs.
Args:
output_json: A path to a JSON file to which the merged results should be
written.
... | Merges the contents of one or more results JSONs.
Args:
output_json: A path to a JSON file to which the merged results should be
written.
jsons_to_merge: A list of JSON files that should be merged.
extra_links: a (key, value) map in which keys are the human-readable strings
which describe the... | Merges the contents of one or more results JSONs. | [
"Merges",
"the",
"contents",
"of",
"one",
"or",
"more",
"results",
"JSONs",
"."
] | def _merge_json_output(output_json,
jsons_to_merge,
extra_links,
test_cross_device=False):
begin_time = time.time()
merged_results = results_merger.merge_test_results(jsons_to_merge,
test_cross_... | [
"def",
"_merge_json_output",
"(",
"output_json",
",",
"jsons_to_merge",
",",
"extra_links",
",",
"test_cross_device",
"=",
"False",
")",
":",
"begin_time",
"=",
"time",
".",
"time",
"(",
")",
"merged_results",
"=",
"results_merger",
".",
"merge_test_results",
"(",... | Merges the contents of one or more results JSONs. | [
"Merges",
"the",
"contents",
"of",
"one",
"or",
"more",
"results",
"JSONs",
"."
] | [
"\"\"\"Merges the contents of one or more results JSONs.\n\n Args:\n output_json: A path to a JSON file to which the merged results should be\n written.\n jsons_to_merge: A list of JSON files that should be merged.\n extra_links: a (key, value) map in which keys are the human-readable strings\n ... | [
{
"param": "output_json",
"type": null
},
{
"param": "jsons_to_merge",
"type": null
},
{
"param": "extra_links",
"type": null
},
{
"param": "test_cross_device",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "output_json",
"type": null,
"docstring": "A path to a JSON file to which the merged results should be\nwritten.",
"docstring_tokens": [
"A",
"path",
"to",
"a",
"JSON",
"file",
... |
c08a7d8380caac90d9634b27071fc1a117f30911 | sunlongbo/chromium | tools/perf/process_perf_results.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _handle_perf_logs | null | def _handle_perf_logs(benchmark_directory_map, extra_links):
""" Upload benchmark logs to logdog and add a page entry for them. """
begin_time = time.time()
benchmark_logs_links = collections.defaultdict(list)
for benchmark_name, directories in benchmark_directory_map.items():
for directory in directories:... | Upload benchmark logs to logdog and add a page entry for them. | Upload benchmark logs to logdog and add a page entry for them. | [
"Upload",
"benchmark",
"logs",
"to",
"logdog",
"and",
"add",
"a",
"page",
"entry",
"for",
"them",
"."
] | def _handle_perf_logs(benchmark_directory_map, extra_links):
begin_time = time.time()
benchmark_logs_links = collections.defaultdict(list)
for benchmark_name, directories in benchmark_directory_map.items():
for directory in directories:
benchmark_log_file = os.path.join(directory, 'benchmark_log.txt')
... | [
"def",
"_handle_perf_logs",
"(",
"benchmark_directory_map",
",",
"extra_links",
")",
":",
"begin_time",
"=",
"time",
".",
"time",
"(",
")",
"benchmark_logs_links",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"benchmark_name",
",",
"directories... | Upload benchmark logs to logdog and add a page entry for them. | [
"Upload",
"benchmark",
"logs",
"to",
"logdog",
"and",
"add",
"a",
"page",
"entry",
"for",
"them",
"."
] | [
"\"\"\" Upload benchmark logs to logdog and add a page entry for them. \"\"\""
] | [
{
"param": "benchmark_directory_map",
"type": null
},
{
"param": "extra_links",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "benchmark_directory_map",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "extra_links",
"type": null,
"docstring": null,
... |
c08a7d8380caac90d9634b27071fc1a117f30911 | sunlongbo/chromium | tools/perf/process_perf_results.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | process_perf_results | <not_specific> | def process_perf_results(output_json,
configuration_name,
build_properties,
task_output_dir,
smoke_test_mode,
output_results_dir,
lightweight=False,
... | Process perf results.
Consists of merging the json-test-format output, uploading the perf test
output (chartjson and histogram), and store the benchmark logs in logdog.
Each directory in the task_output_dir represents one benchmark
that was run. Within this directory, there is a subdirectory with the name
o... | Process perf results.
Consists of merging the json-test-format output, uploading the perf test
output (chartjson and histogram), and store the benchmark logs in logdog.
Each directory in the task_output_dir represents one benchmark
that was run. Within this directory, there is a subdirectory with the name
of the bench... | [
"Process",
"perf",
"results",
".",
"Consists",
"of",
"merging",
"the",
"json",
"-",
"test",
"-",
"format",
"output",
"uploading",
"the",
"perf",
"test",
"output",
"(",
"chartjson",
"and",
"histogram",
")",
"and",
"store",
"the",
"benchmark",
"logs",
"in",
... | def process_perf_results(output_json,
configuration_name,
build_properties,
task_output_dir,
smoke_test_mode,
output_results_dir,
lightweight=False,
... | [
"def",
"process_perf_results",
"(",
"output_json",
",",
"configuration_name",
",",
"build_properties",
",",
"task_output_dir",
",",
"smoke_test_mode",
",",
"output_results_dir",
",",
"lightweight",
"=",
"False",
",",
"skip_perf",
"=",
"False",
")",
":",
"handle_perf",... | Process perf results. | [
"Process",
"perf",
"results",
"."
] | [
"\"\"\"Process perf results.\n\n Consists of merging the json-test-format output, uploading the perf test\n output (chartjson and histogram), and store the benchmark logs in logdog.\n\n Each directory in the task_output_dir represents one benchmark\n that was run. Within this directory, there is a subdirectory ... | [
{
"param": "output_json",
"type": null
},
{
"param": "configuration_name",
"type": null
},
{
"param": "build_properties",
"type": null
},
{
"param": "task_output_dir",
"type": null
},
{
"param": "smoke_test_mode",
"type": null
},
{
"param": "output_res... | {
"returns": [
{
"docstring": "(return_code, upload_results_map):\nreturn_code is 0 if the whole operation is successful, non zero otherwise.\nbenchmark_upload_result_map: the dictionary that describe which benchmarks\nwere successfully uploaded.",
"docstring_tokens": [
"(",
"return_co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.