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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8c83bf4eee02c9f8bd6df396768d6758fed0ea9b | sunlongbo/chromium | chrome/test/chromedriver/log_replay/client_replay_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SubstituteVariableEntries | <not_specific> | def SubstituteVariableEntries(s):
"""Identifies and removes items that can legitimately vary between runs."""
white_list = r'(("(id|userDataDir|frameId|version' \
r'|element-6066-11e4-a52e-4f735466cecf|message|timestamp' \
r'|expiry|chromedriverVersion|sessionId)": ' \
r... | Identifies and removes items that can legitimately vary between runs. | Identifies and removes items that can legitimately vary between runs. | [
"Identifies",
"and",
"removes",
"items",
"that",
"can",
"legitimately",
"vary",
"between",
"runs",
"."
] | def SubstituteVariableEntries(s):
white_list = r'(("(id|userDataDir|frameId|version' \
r'|element-6066-11e4-a52e-4f735466cecf|message|timestamp' \
r'|expiry|chromedriverVersion|sessionId)": ' \
r'("[0-9]\.[0-9]*(\.[0-9]*)? \([a-f0-9]*\)"|[^\s},]*))' \
r'|CDw... | [
"def",
"SubstituteVariableEntries",
"(",
"s",
")",
":",
"white_list",
"=",
"r'((\"(id|userDataDir|frameId|version'",
"r'|element-6066-11e4-a52e-4f735466cecf|message|timestamp'",
"r'|expiry|chromedriverVersion|sessionId)\": '",
"r'(\"[0-9]\\.[0-9]*(\\.[0-9]*)? \\([a-f0-9]*\\)\"|[^\\s},]*))'",
... | Identifies and removes items that can legitimately vary between runs. | [
"Identifies",
"and",
"removes",
"items",
"that",
"can",
"legitimately",
"vary",
"between",
"runs",
"."
] | [
"\"\"\"Identifies and removes items that can legitimately vary between runs.\"\"\""
] | [
{
"param": "s",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "s",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8c83bf4eee02c9f8bd6df396768d6758fed0ea9b | sunlongbo/chromium | chrome/test/chromedriver/log_replay/client_replay_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckResponsesMatch | <not_specific> | def CheckResponsesMatch(self, real, logged):
"""Asserts that the given pair of responses match.
These are usually the replay response and the logged response.
Checks that they match, up to differences in session, window, element
IDs, timestamps, etc.
Args:
real: actual response from running ... | Asserts that the given pair of responses match.
These are usually the replay response and the logged response.
Checks that they match, up to differences in session, window, element
IDs, timestamps, etc.
Args:
real: actual response from running the command
logged: logged response, taken fro... | Asserts that the given pair of responses match.
These are usually the replay response and the logged response.
Checks that they match, up to differences in session, window, element
IDs, timestamps, etc. | [
"Asserts",
"that",
"the",
"given",
"pair",
"of",
"responses",
"match",
".",
"These",
"are",
"usually",
"the",
"replay",
"response",
"and",
"the",
"logged",
"response",
".",
"Checks",
"that",
"they",
"match",
"up",
"to",
"differences",
"in",
"session",
"windo... | def CheckResponsesMatch(self, real, logged):
if not real and not logged:
return
if isinstance(real, dict) and "message" in real:
real = "ERROR " + real["message"].split("\n")[0]
self.assertTrue(type(logged) == type(real)
or (isinstance(real, basestring)
... | [
"def",
"CheckResponsesMatch",
"(",
"self",
",",
"real",
",",
"logged",
")",
":",
"if",
"not",
"real",
"and",
"not",
"logged",
":",
"return",
"if",
"isinstance",
"(",
"real",
",",
"dict",
")",
"and",
"\"message\"",
"in",
"real",
":",
"real",
"=",
"\"ERR... | Asserts that the given pair of responses match. | [
"Asserts",
"that",
"the",
"given",
"pair",
"of",
"responses",
"match",
"."
] | [
"\"\"\"Asserts that the given pair of responses match.\n\n These are usually the replay response and the logged response.\n Checks that they match, up to differences in session, window, element\n IDs, timestamps, etc.\n\n Args:\n real: actual response from running the command\n logged: logged ... | [
{
"param": "self",
"type": null
},
{
"param": "real",
"type": null
},
{
"param": "logged",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "real",
"type": null,
"docstring": "actual response from running the... |
8c83bf4eee02c9f8bd6df396768d6758fed0ea9b | sunlongbo/chromium | chrome/test/chromedriver/log_replay/client_replay_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | runTest | null | def runTest(self, test_name):
"""Runs the test. Compares output from Chrome to the output in the log file.
Args:
test_name: name of the test to run from run_py_tests.py.
"""
log_file = os.path.join(ChromeDriverClientReplayTest.log_dir,
test_name + ".log")
GenerateT... | Runs the test. Compares output from Chrome to the output in the log file.
Args:
test_name: name of the test to run from run_py_tests.py.
| Runs the test. Compares output from Chrome to the output in the log file. | [
"Runs",
"the",
"test",
".",
"Compares",
"output",
"from",
"Chrome",
"to",
"the",
"output",
"in",
"the",
"log",
"file",
"."
] | def runTest(self, test_name):
log_file = os.path.join(ChromeDriverClientReplayTest.log_dir,
test_name + ".log")
GenerateTestLog(test_name, _CHROMEDRIVER, _CHROME, log_file)
with open(log_file) as lf:
replay_path = log_file if _OPTIONS.devtools_replay else ""
server = ... | [
"def",
"runTest",
"(",
"self",
",",
"test_name",
")",
":",
"log_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"ChromeDriverClientReplayTest",
".",
"log_dir",
",",
"test_name",
"+",
"\".log\"",
")",
"GenerateTestLog",
"(",
"test_name",
",",
"_CHROMEDRIVER",
... | Runs the test. | [
"Runs",
"the",
"test",
"."
] | [
"\"\"\"Runs the test. Compares output from Chrome to the output in the log file.\n\n Args:\n test_name: name of the test to run from run_py_tests.py.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "test_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "test_name",
"type": null,
"docstring": "name of the test to run fro... |
8c83bf4eee02c9f8bd6df396768d6758fed0ea9b | sunlongbo/chromium | chrome/test/chromedriver/log_replay/client_replay_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetNegativeFilter | <not_specific> | def GetNegativeFilter(chrome_version):
"""Construct the appropriate negative test filter for the chrome ."""
if _NEGATIVE_FILTER:
return "*-" + ":__main__.".join([""] + _NEGATIVE_FILTER)
return "*" | Construct the appropriate negative test filter for the chrome . | Construct the appropriate negative test filter for the chrome . | [
"Construct",
"the",
"appropriate",
"negative",
"test",
"filter",
"for",
"the",
"chrome",
"."
] | def GetNegativeFilter(chrome_version):
if _NEGATIVE_FILTER:
return "*-" + ":__main__.".join([""] + _NEGATIVE_FILTER)
return "*" | [
"def",
"GetNegativeFilter",
"(",
"chrome_version",
")",
":",
"if",
"_NEGATIVE_FILTER",
":",
"return",
"\"*-\"",
"+",
"\":__main__.\"",
".",
"join",
"(",
"[",
"\"\"",
"]",
"+",
"_NEGATIVE_FILTER",
")",
"return",
"\"*\""
] | Construct the appropriate negative test filter for the chrome . | [
"Construct",
"the",
"appropriate",
"negative",
"test",
"filter",
"for",
"the",
"chrome",
"."
] | [
"\"\"\"Construct the appropriate negative test filter for the chrome .\"\"\""
] | [
{
"param": "chrome_version",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "chrome_version",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8ca1a373b03eb9a869d8000dcebcc173843d1293 | sunlongbo/chromium | third_party/tensorflow-text/src/tensorflow_text/tftext.bzl | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | tf_deps | <not_specific> | def tf_deps(deps = []):
"""Generate deps for tensorflow that support android.
Args:
deps: Dependencies for linux build.
"""
# These are "random" deps likely needed by each library (http://b/142433427)
oss_deps = [
"@com_google_absl//absl/container:inlined_vector",
"@com_google... | Generate deps for tensorflow that support android.
Args:
deps: Dependencies for linux build.
| Generate deps for tensorflow that support android. | [
"Generate",
"deps",
"for",
"tensorflow",
"that",
"support",
"android",
"."
] | def tf_deps(deps = []):
oss_deps = [
"@com_google_absl//absl/container:inlined_vector",
"@com_google_absl//absl/functional:function_ref",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:cord",
"@com_google_absl//absl/types:optional",
"@com_google_abs... | [
"def",
"tf_deps",
"(",
"deps",
"=",
"[",
"]",
")",
":",
"oss_deps",
"=",
"[",
"\"@com_google_absl//absl/container:inlined_vector\"",
",",
"\"@com_google_absl//absl/functional:function_ref\"",
",",
"\"@com_google_absl//absl/strings\"",
",",
"\"@com_google_absl//absl/strings:cord\"... | Generate deps for tensorflow that support android. | [
"Generate",
"deps",
"for",
"tensorflow",
"that",
"support",
"android",
"."
] | [
"\"\"\"Generate deps for tensorflow that support android.\n\n Args:\n deps: Dependencies for linux build.\n \"\"\"",
"# These are \"random\" deps likely needed by each library (http://b/142433427)"
] | [
{
"param": "deps",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "deps",
"type": null,
"docstring": "Dependencies for linux build.",
"docstring_tokens": [
"Dependencies",
"for",
"linux",
"build",
"."
],
"default": null,
"is_optional":... |
84d581183af04447bbdbc546be44d329b063e09d | sunlongbo/chromium | chrome/test/webapps/test_analysis.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | DoesTestHaveActionWithPrefixes | <not_specific> | def DoesTestHaveActionWithPrefixes(test: CoverageTest):
"""Returns if the given tests has any actions with the given prefixes"""
nonlocal partition
for action in test.actions:
for prefix in partition.action_name_prefixes:
if action.name.startswith(prefix):
... | Returns if the given tests has any actions with the given prefixes | Returns if the given tests has any actions with the given prefixes | [
"Returns",
"if",
"the",
"given",
"tests",
"has",
"any",
"actions",
"with",
"the",
"given",
"prefixes"
] | def DoesTestHaveActionWithPrefixes(test: CoverageTest):
nonlocal partition
for action in test.actions:
for prefix in partition.action_name_prefixes:
if action.name.startswith(prefix):
return True | [
"def",
"DoesTestHaveActionWithPrefixes",
"(",
"test",
":",
"CoverageTest",
")",
":",
"nonlocal",
"partition",
"for",
"action",
"in",
"test",
".",
"actions",
":",
"for",
"prefix",
"in",
"partition",
".",
"action_name_prefixes",
":",
"if",
"action",
".",
"name",
... | Returns if the given tests has any actions with the given prefixes | [
"Returns",
"if",
"the",
"given",
"tests",
"has",
"any",
"actions",
"with",
"the",
"given",
"prefixes"
] | [
"\"\"\"Returns if the given tests has any actions with the given prefixes\"\"\""
] | [
{
"param": "test",
"type": "CoverageTest"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "test",
"type": "CoverageTest",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5f0fa9ec477363f4eee2179e6b75b0611c85f6a4 | sunlongbo/chromium | tools/android/native_lib_memory/extract_resident_pages.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ReadFileFromDevice | <not_specific> | def _ReadFileFromDevice(device_serial, file_path):
"""Reads the file from the device, and returns its content.
Args:
device_serial: (str) Device identifier
file_path: (str) On-device path to the residency file.
Returns:
(str or None) The file content.
"""
content = None
try:
device = devic... | Reads the file from the device, and returns its content.
Args:
device_serial: (str) Device identifier
file_path: (str) On-device path to the residency file.
Returns:
(str or None) The file content.
| Reads the file from the device, and returns its content. | [
"Reads",
"the",
"file",
"from",
"the",
"device",
"and",
"returns",
"its",
"content",
"."
] | def _ReadFileFromDevice(device_serial, file_path):
content = None
try:
device = device_utils.DeviceUtils(device_serial)
content = device.ReadFile(file_path, True)
except device_errors.CommandFailedError:
logging.exception(
'Possible failure reaching the device or reading the file')
return co... | [
"def",
"_ReadFileFromDevice",
"(",
"device_serial",
",",
"file_path",
")",
":",
"content",
"=",
"None",
"try",
":",
"device",
"=",
"device_utils",
".",
"DeviceUtils",
"(",
"device_serial",
")",
"content",
"=",
"device",
".",
"ReadFile",
"(",
"file_path",
",",
... | Reads the file from the device, and returns its content. | [
"Reads",
"the",
"file",
"from",
"the",
"device",
"and",
"returns",
"its",
"content",
"."
] | [
"\"\"\"Reads the file from the device, and returns its content.\n\n Args:\n device_serial: (str) Device identifier\n file_path: (str) On-device path to the residency file.\n\n Returns:\n (str or None) The file content.\n \"\"\""
] | [
{
"param": "device_serial",
"type": null
},
{
"param": "file_path",
"type": null
}
] | {
"returns": [
{
"docstring": "(str or None) The file content.",
"docstring_tokens": [
"(",
"str",
"or",
"None",
")",
"The",
"file",
"content",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"... |
5f0fa9ec477363f4eee2179e6b75b0611c85f6a4 | sunlongbo/chromium | tools/android/native_lib_memory/extract_resident_pages.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParseResidentPages | <not_specific> | def ParseResidentPages(resident_pages):
"""Parses and converts the residency data into a list where
the index corresponds to the page number and the value 1 if resident
and 0 otherwise.
|resident_pages| contains a string of resident pages:
0
1
...
...
N
Args:
resident_pages... | Parses and converts the residency data into a list where
the index corresponds to the page number and the value 1 if resident
and 0 otherwise.
|resident_pages| contains a string of resident pages:
0
1
...
...
N
Args:
resident_pages: (str) As returned by ReadFileFromDevice()
... | Parses and converts the residency data into a list where
the index corresponds to the page number and the value 1 if resident
and 0 otherwise.
|resident_pages| contains a string of resident pages:
0
1
N | [
"Parses",
"and",
"converts",
"the",
"residency",
"data",
"into",
"a",
"list",
"where",
"the",
"index",
"corresponds",
"to",
"the",
"page",
"number",
"and",
"the",
"value",
"1",
"if",
"resident",
"and",
"0",
"otherwise",
".",
"|resident_pages|",
"contains",
"... | def ParseResidentPages(resident_pages):
pages_list = []
expected = 0
for page in resident_pages.splitlines():
while expected < int(page):
pages_list.append(0)
expected += 1
pages_list.append(1)
expected += 1;
return pages_list | [
"def",
"ParseResidentPages",
"(",
"resident_pages",
")",
":",
"pages_list",
"=",
"[",
"]",
"expected",
"=",
"0",
"for",
"page",
"in",
"resident_pages",
".",
"splitlines",
"(",
")",
":",
"while",
"expected",
"<",
"int",
"(",
"page",
")",
":",
"pages_list",
... | Parses and converts the residency data into a list where
the index corresponds to the page number and the value 1 if resident
and 0 otherwise. | [
"Parses",
"and",
"converts",
"the",
"residency",
"data",
"into",
"a",
"list",
"where",
"the",
"index",
"corresponds",
"to",
"the",
"page",
"number",
"and",
"the",
"value",
"1",
"if",
"resident",
"and",
"0",
"otherwise",
"."
] | [
"\"\"\"Parses and converts the residency data into a list where\n the index corresponds to the page number and the value 1 if resident\n and 0 otherwise.\n\n |resident_pages| contains a string of resident pages:\n 0\n 1\n ...\n ...\n N\n\n Args:\n resident_pages: (str) As returned by... | [
{
"param": "resident_pages",
"type": null
}
] | {
"returns": [
{
"docstring": "(list) Pages list.",
"docstring_tokens": [
"(",
"list",
")",
"Pages",
"list",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "resident_pages",
"type": null,
"d... |
5f0fa9ec477363f4eee2179e6b75b0611c85f6a4 | sunlongbo/chromium | tools/android/native_lib_memory/extract_resident_pages.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetResidentPagesJSON | <not_specific> | def _GetResidentPagesJSON(pages_list):
"""Transforms the pages list to JSON object.
Args:
pages_list: (list) As returned by ParseResidentPages()
Returns:
(JSON object) Pages JSON object.
"""
json_data = []
for i in range(len(pages_list)):
json_data.append({'page_num': i, 'resident': pages_list... | Transforms the pages list to JSON object.
Args:
pages_list: (list) As returned by ParseResidentPages()
Returns:
(JSON object) Pages JSON object.
| Transforms the pages list to JSON object. | [
"Transforms",
"the",
"pages",
"list",
"to",
"JSON",
"object",
"."
] | def _GetResidentPagesJSON(pages_list):
json_data = []
for i in range(len(pages_list)):
json_data.append({'page_num': i, 'resident': pages_list[i]})
return json_data | [
"def",
"_GetResidentPagesJSON",
"(",
"pages_list",
")",
":",
"json_data",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"pages_list",
")",
")",
":",
"json_data",
".",
"append",
"(",
"{",
"'page_num'",
":",
"i",
",",
"'resident'",
":",
"pag... | Transforms the pages list to JSON object. | [
"Transforms",
"the",
"pages",
"list",
"to",
"JSON",
"object",
"."
] | [
"\"\"\"Transforms the pages list to JSON object.\n\n Args:\n pages_list: (list) As returned by ParseResidentPages()\n\n Returns:\n (JSON object) Pages JSON object.\n \"\"\""
] | [
{
"param": "pages_list",
"type": null
}
] | {
"returns": [
{
"docstring": "(JSON object) Pages JSON object.",
"docstring_tokens": [
"(",
"JSON",
"object",
")",
"Pages",
"JSON",
"object",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifie... |
5f0fa9ec477363f4eee2179e6b75b0611c85f6a4 | sunlongbo/chromium | tools/android/native_lib_memory/extract_resident_pages.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _WriteJSONToFile | null | def _WriteJSONToFile(json_data, output_file_path):
"""Dumps JSON data to file.
Args:
json_data: (JSON object) Data to be dumped in the file.
output_file_path: (str) Output file path
"""
with open(output_file_path, 'w') as f:
json.dump(json_data, f) | Dumps JSON data to file.
Args:
json_data: (JSON object) Data to be dumped in the file.
output_file_path: (str) Output file path
| Dumps JSON data to file. | [
"Dumps",
"JSON",
"data",
"to",
"file",
"."
] | def _WriteJSONToFile(json_data, output_file_path):
with open(output_file_path, 'w') as f:
json.dump(json_data, f) | [
"def",
"_WriteJSONToFile",
"(",
"json_data",
",",
"output_file_path",
")",
":",
"with",
"open",
"(",
"output_file_path",
",",
"'w'",
")",
"as",
"f",
":",
"json",
".",
"dump",
"(",
"json_data",
",",
"f",
")"
] | Dumps JSON data to file. | [
"Dumps",
"JSON",
"data",
"to",
"file",
"."
] | [
"\"\"\"Dumps JSON data to file.\n\n Args:\n json_data: (JSON object) Data to be dumped in the file.\n output_file_path: (str) Output file path\n \"\"\""
] | [
{
"param": "json_data",
"type": null
},
{
"param": "output_file_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "json_data",
"type": null,
"docstring": "(JSON object) Data to be dumped in the file.",
"docstring_tokens": [
"(",
"JSON",
"object",
")",
"Data",
"to",
"be",
"dump... |
5f13ef37f020e1a89986528e28754364bed2e5c8 | sunlongbo/chromium | chrome/browser/resources/chromeos/semantic_css_checker.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunChecks | <not_specific> | def RunChecks(input_api, output_api):
"""Runs check for any non-semantic CSS colors used.
Checks if the affected lines of code in input_api use non-semantic CSS
colors, and if so, returns a list containing the warnings that should
be displayed for each violation.
Args:
input_api: presubmit... | Runs check for any non-semantic CSS colors used.
Checks if the affected lines of code in input_api use non-semantic CSS
colors, and if so, returns a list containing the warnings that should
be displayed for each violation.
Args:
input_api: presubmit.InputApi containing information of the files... | Runs check for any non-semantic CSS colors used.
Checks if the affected lines of code in input_api use non-semantic CSS
colors, and if so, returns a list containing the warnings that should
be displayed for each violation. | [
"Runs",
"check",
"for",
"any",
"non",
"-",
"semantic",
"CSS",
"colors",
"used",
".",
"Checks",
"if",
"the",
"affected",
"lines",
"of",
"code",
"in",
"input_api",
"use",
"non",
"-",
"semantic",
"CSS",
"colors",
"and",
"if",
"so",
"returns",
"a",
"list",
... | def RunChecks(input_api, output_api):
results = []
for f in input_api.AffectedFiles():
exts = ['html', 'css']
if not any(f.LocalPath().endswith(ext) for ext in exts):
continue
for line_num, line in f.ChangedContents():
for pattern in _NON_SEMANTIC_CSS_COLOR_PATTERNS... | [
"def",
"RunChecks",
"(",
"input_api",
",",
"output_api",
")",
":",
"results",
"=",
"[",
"]",
"for",
"f",
"in",
"input_api",
".",
"AffectedFiles",
"(",
")",
":",
"exts",
"=",
"[",
"'html'",
",",
"'css'",
"]",
"if",
"not",
"any",
"(",
"f",
".",
"Loca... | Runs check for any non-semantic CSS colors used. | [
"Runs",
"check",
"for",
"any",
"non",
"-",
"semantic",
"CSS",
"colors",
"used",
"."
] | [
"\"\"\"Runs check for any non-semantic CSS colors used.\n\n Checks if the affected lines of code in input_api use non-semantic CSS\n colors, and if so, returns a list containing the warnings that should\n be displayed for each violation.\n\n Args:\n input_api: presubmit.InputApi containing inform... | [
{
"param": "input_api",
"type": null
},
{
"param": "output_api",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of presubmit warnings, each containing the line the violation\noccurred and the warning message.",
"docstring_tokens": [
"A",
"list",
"of",
"presubmit",
"warnings",
"each",
"containing",
"the",
... |
d55156064cf2d30569a2b0f2fcf7ce5c7b3fd81f | sunlongbo/chromium | tools/cr/cr/actions/adb.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetPids | <not_specific> | def GetPids(cls, target):
"""Gets the set of running PIDs that match the specified target."""
pids = []
with target:
output = cr.Host.Capture('{CR_ADB}', 'shell', 'ps')
pattern = re.compile(r'\S+\s+(\d+)\s+.*{CR_PROCESS}')
for line in output.split('\n'):
match = re.match(pattern, line)
... | Gets the set of running PIDs that match the specified target. | Gets the set of running PIDs that match the specified target. | [
"Gets",
"the",
"set",
"of",
"running",
"PIDs",
"that",
"match",
"the",
"specified",
"target",
"."
] | def GetPids(cls, target):
pids = []
with target:
output = cr.Host.Capture('{CR_ADB}', 'shell', 'ps')
pattern = re.compile(r'\S+\s+(\d+)\s+.*{CR_PROCESS}')
for line in output.split('\n'):
match = re.match(pattern, line)
if match:
pids.append(match.group(1))
return pids | [
"def",
"GetPids",
"(",
"cls",
",",
"target",
")",
":",
"pids",
"=",
"[",
"]",
"with",
"target",
":",
"output",
"=",
"cr",
".",
"Host",
".",
"Capture",
"(",
"'{CR_ADB}'",
",",
"'shell'",
",",
"'ps'",
")",
"pattern",
"=",
"re",
".",
"compile",
"(",
... | Gets the set of running PIDs that match the specified target. | [
"Gets",
"the",
"set",
"of",
"running",
"PIDs",
"that",
"match",
"the",
"specified",
"target",
"."
] | [
"\"\"\"Gets the set of running PIDs that match the specified target.\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "target",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target",
"type": null,
"docstring": null,
"docstring_tokens": ... |
d55156064cf2d30569a2b0f2fcf7ce5c7b3fd81f | sunlongbo/chromium | tools/cr/cr/actions/adb.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Run | null | def Run(cls, target, arguments):
"""Invoke a target binary on the device."""
with target:
cr.Host.Execute(
'{CR_ADB}', 'shell', 'am', 'start',
'-a', '{CR_ACTION}',
'-n', '{CR_INTENT}',
'{CR_RUN_ARGUMENTS}',
*arguments
) | Invoke a target binary on the device. | Invoke a target binary on the device. | [
"Invoke",
"a",
"target",
"binary",
"on",
"the",
"device",
"."
] | def Run(cls, target, arguments):
with target:
cr.Host.Execute(
'{CR_ADB}', 'shell', 'am', 'start',
'-a', '{CR_ACTION}',
'-n', '{CR_INTENT}',
'{CR_RUN_ARGUMENTS}',
*arguments
) | [
"def",
"Run",
"(",
"cls",
",",
"target",
",",
"arguments",
")",
":",
"with",
"target",
":",
"cr",
".",
"Host",
".",
"Execute",
"(",
"'{CR_ADB}'",
",",
"'shell'",
",",
"'am'",
",",
"'start'",
",",
"'-a'",
",",
"'{CR_ACTION}'",
",",
"'-n'",
",",
"'{CR_... | Invoke a target binary on the device. | [
"Invoke",
"a",
"target",
"binary",
"on",
"the",
"device",
"."
] | [
"\"\"\"Invoke a target binary on the device.\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "target",
"type": null
},
{
"param": "arguments",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target",
"type": null,
"docstring": null,
"docstring_tokens": ... |
d55156064cf2d30569a2b0f2fcf7ce5c7b3fd81f | sunlongbo/chromium | tools/cr/cr/actions/adb.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Kill | <not_specific> | def Kill(cls, target, _):
"""Kill all running processes for a target."""
target_name = target.build_target
if target_name in cls._kills:
# already killed this target, do nothing
return
pids = cls.GetPids(target)
if pids:
with target:
cr.Host.Execute('{CR_ADB}', 'shell', 'ki... | Kill all running processes for a target. | Kill all running processes for a target. | [
"Kill",
"all",
"running",
"processes",
"for",
"a",
"target",
"."
] | def Kill(cls, target, _):
target_name = target.build_target
if target_name in cls._kills:
return
pids = cls.GetPids(target)
if pids:
with target:
cr.Host.Execute('{CR_ADB}', 'shell', 'kill', *pids)
elif target.verbose:
print(target.Substitute('{CR_TARGET_NAME} not running')... | [
"def",
"Kill",
"(",
"cls",
",",
"target",
",",
"_",
")",
":",
"target_name",
"=",
"target",
".",
"build_target",
"if",
"target_name",
"in",
"cls",
".",
"_kills",
":",
"return",
"pids",
"=",
"cls",
".",
"GetPids",
"(",
"target",
")",
"if",
"pids",
":"... | Kill all running processes for a target. | [
"Kill",
"all",
"running",
"processes",
"for",
"a",
"target",
"."
] | [
"\"\"\"Kill all running processes for a target.\"\"\"",
"# already killed this target, do nothing"
] | [
{
"param": "cls",
"type": null
},
{
"param": "target",
"type": null
},
{
"param": "_",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target",
"type": null,
"docstring": null,
"docstring_tokens": ... |
0b28e7210ddfeae7e4f7c9e370f81522a97d4d55 | sunlongbo/chromium | tools/traffic_annotation/scripts/extractor.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | parse_definition | null | def parse_definition(self, re_match: re.Match):
"""Parses the annotation and populates object fields.
Args:
re_match: A Match obtained from the Language's call_detection_regex.
"""
definition_function = re_match.group(1)
self.type_name = self.language.annotation_types[definition_function]
... | Parses the annotation and populates object fields.
Args:
re_match: A Match obtained from the Language's call_detection_regex.
| Parses the annotation and populates object fields. | [
"Parses",
"the",
"annotation",
"and",
"populates",
"object",
"fields",
"."
] | def parse_definition(self, re_match: re.Match):
definition_function = re_match.group(1)
self.type_name = self.language.annotation_types[definition_function]
body = re_match.string[re_match.end():]
self._parse_body(body) | [
"def",
"parse_definition",
"(",
"self",
",",
"re_match",
":",
"re",
".",
"Match",
")",
":",
"definition_function",
"=",
"re_match",
".",
"group",
"(",
"1",
")",
"self",
".",
"type_name",
"=",
"self",
".",
"language",
".",
"annotation_types",
"[",
"definiti... | Parses the annotation and populates object fields. | [
"Parses",
"the",
"annotation",
"and",
"populates",
"object",
"fields",
"."
] | [
"\"\"\"Parses the annotation and populates object fields.\n\n Args:\n re_match: A Match obtained from the Language's call_detection_regex.\n \"\"\"",
"# Parse the arguments given to the definition function, populating",
"# |unique_id|, |text| and (possibly) |extra_id|."
] | [
{
"param": "self",
"type": null
},
{
"param": "re_match",
"type": "re.Match"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "re_match",
"type": "re.Match",
"docstring": "A Match obtained from ... |
0b28e7210ddfeae7e4f7c9e370f81522a97d4d55 | sunlongbo/chromium | tools/traffic_annotation/scripts/extractor.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | extractor_output_string | str | def extractor_output_string(self) -> str:
"""Returns a string formatted for output."""
return '\n'.join(
map(str, [
'==== NEW ANNOTATION ====',
self.file_path,
self.line_number,
self.type_name.value,
self.unique_id,
self.extra_id,
... | Returns a string formatted for output. | Returns a string formatted for output. | [
"Returns",
"a",
"string",
"formatted",
"for",
"output",
"."
] | def extractor_output_string(self) -> str:
return '\n'.join(
map(str, [
'==== NEW ANNOTATION ====',
self.file_path,
self.line_number,
self.type_name.value,
self.unique_id,
self.extra_id,
self.text,
'==== ANNOTATIO... | [
"def",
"extractor_output_string",
"(",
"self",
")",
"->",
"str",
":",
"return",
"'\\n'",
".",
"join",
"(",
"map",
"(",
"str",
",",
"[",
"'==== NEW ANNOTATION ===='",
",",
"self",
".",
"file_path",
",",
"self",
".",
"line_number",
",",
"self",
".",
"type_na... | Returns a string formatted for output. | [
"Returns",
"a",
"string",
"formatted",
"for",
"output",
"."
] | [
"\"\"\"Returns a string formatted for output.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0b28e7210ddfeae7e4f7c9e370f81522a97d4d55 | sunlongbo/chromium | tools/traffic_annotation/scripts/extractor.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _parse_body | <not_specific> | def _parse_body(self, body: str):
"""Tokenizes and parses the arguments given to the definition function."""
# Don't bother parsing CreateMutableNetworkTrafficAnnotationTag(), we don't
# care about its arguments anyways.
if self.type_name == AnnotationType.MUTABLE:
return
tokenizer = Tokenize... | Tokenizes and parses the arguments given to the definition function. | Tokenizes and parses the arguments given to the definition function. | [
"Tokenizes",
"and",
"parses",
"the",
"arguments",
"given",
"to",
"the",
"definition",
"function",
"."
] | def _parse_body(self, body: str):
if self.type_name == AnnotationType.MUTABLE:
return
tokenizer = Tokenizer(body, self.file_path, self.line_number)
self.unique_id = self._parse_string(tokenizer)
tokenizer.advance('comma')
if self.type_name in [
AnnotationType.PARTIAL, AnnotationType.BR... | [
"def",
"_parse_body",
"(",
"self",
",",
"body",
":",
"str",
")",
":",
"if",
"self",
".",
"type_name",
"==",
"AnnotationType",
".",
"MUTABLE",
":",
"return",
"tokenizer",
"=",
"Tokenizer",
"(",
"body",
",",
"self",
".",
"file_path",
",",
"self",
".",
"l... | Tokenizes and parses the arguments given to the definition function. | [
"Tokenizes",
"and",
"parses",
"the",
"arguments",
"given",
"to",
"the",
"definition",
"function",
"."
] | [
"\"\"\"Tokenizes and parses the arguments given to the definition function.\"\"\"",
"# Don't bother parsing CreateMutableNetworkTrafficAnnotationTag(), we don't",
"# care about its arguments anyways.",
"# unique_id",
"# extra_id (Partial/BranchedCompleting)",
"# partial_annotation (Completing/BranchedComp... | [
{
"param": "self",
"type": null
},
{
"param": "body",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "body",
"type": "str",
"docstring": null,
"docstring_tokens": ... |
0b28e7210ddfeae7e4f7c9e370f81522a97d4d55 | sunlongbo/chromium | tools/traffic_annotation/scripts/extractor.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _parse_string | str | def _parse_string(self, tokenizer: Tokenizer) -> str:
"""Parse a string value.
It could be a string literal by itself, or multiple string literals
concatenated together. Add a newline to the string for each
concatenation."""
text = tokenizer.advance('string_literal')
while True:
# Perform... | Parse a string value.
It could be a string literal by itself, or multiple string literals
concatenated together. Add a newline to the string for each
concatenation. | Parse a string value.
It could be a string literal by itself, or multiple string literals
concatenated together. Add a newline to the string for each
concatenation. | [
"Parse",
"a",
"string",
"value",
".",
"It",
"could",
"be",
"a",
"string",
"literal",
"by",
"itself",
"or",
"multiple",
"string",
"literals",
"concatenated",
"together",
".",
"Add",
"a",
"newline",
"to",
"the",
"string",
"for",
"each",
"concatenation",
"."
] | def _parse_string(self, tokenizer: Tokenizer) -> str:
text = tokenizer.advance('string_literal')
while True:
if tokenizer.maybe_advance('plus') is None:
break
text += '\n'
text += tokenizer.advance('string_literal')
return text | [
"def",
"_parse_string",
"(",
"self",
",",
"tokenizer",
":",
"Tokenizer",
")",
"->",
"str",
":",
"text",
"=",
"tokenizer",
".",
"advance",
"(",
"'string_literal'",
")",
"while",
"True",
":",
"if",
"tokenizer",
".",
"maybe_advance",
"(",
"'plus'",
")",
"is",... | Parse a string value. | [
"Parse",
"a",
"string",
"value",
"."
] | [
"\"\"\"Parse a string value.\n\n It could be a string literal by itself, or multiple string literals\n concatenated together. Add a newline to the string for each\n concatenation.\"\"\"",
"# Perform concatenations."
] | [
{
"param": "self",
"type": null
},
{
"param": "tokenizer",
"type": "Tokenizer"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tokenizer",
"type": "Tokenizer",
"docstring": null,
"docstrin... |
0b28e7210ddfeae7e4f7c9e370f81522a97d4d55 | sunlongbo/chromium | tools/traffic_annotation/scripts/extractor.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | extract_annotations | List[Annotation] | def extract_annotations(file_path: Path) -> List[Annotation]:
"""Extracts and returns annotations from the file at |file_path|."""
if file_path.suffix not in LANGUAGE_MAPPING:
raise ValueError("Unrecognized extension '{}' for file '{}'.".format(
file_path.suffix, str(file_path)))
language = LANGUAGE_... | Extracts and returns annotations from the file at |file_path|. | Extracts and returns annotations from the file at |file_path|. | [
"Extracts",
"and",
"returns",
"annotations",
"from",
"the",
"file",
"at",
"|file_path|",
"."
] | def extract_annotations(file_path: Path) -> List[Annotation]:
if file_path.suffix not in LANGUAGE_MAPPING:
raise ValueError("Unrecognized extension '{}' for file '{}'.".format(
file_path.suffix, str(file_path)))
language = LANGUAGE_MAPPING[file_path.suffix]
contents = file_path.read_text(encoding="utf... | [
"def",
"extract_annotations",
"(",
"file_path",
":",
"Path",
")",
"->",
"List",
"[",
"Annotation",
"]",
":",
"if",
"file_path",
".",
"suffix",
"not",
"in",
"LANGUAGE_MAPPING",
":",
"raise",
"ValueError",
"(",
"\"Unrecognized extension '{}' for file '{}'.\"",
".",
... | Extracts and returns annotations from the file at |file_path|. | [
"Extracts",
"and",
"returns",
"annotations",
"from",
"the",
"file",
"at",
"|file_path|",
"."
] | [
"\"\"\"Extracts and returns annotations from the file at |file_path|.\"\"\"",
"# Check for function calls (e.g. DefineNetworkTrafficAnnotation(...))",
"# Check for test annotations (e.g. TRAFFIC_ANNOTATION_FOR_TESTS)",
"# Check for MISSING_TRAFFIC_ANNOTATION.",
"# Check for NO_TRAFFIC_ANNOTATION_YET."
] | [
{
"param": "file_path",
"type": "Path"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_path",
"type": "Path",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a8c3519282970d89d55409a98dee124f6c5380b | sunlongbo/chromium | tools/media_engagement_preload/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RunMakeDafsaTests | <not_specific> | def _RunMakeDafsaTests(input_api, output_api):
"""Runs unittest for make_dafsa if any related file has been modified."""
files = ('tools/media_engagement_preload/make_dafsa.py',
'tools/media_engagement_preload/make_dafsa_unittest.py')
if not any(f in input_api.LocalPaths() for f in files):
return [... | Runs unittest for make_dafsa if any related file has been modified. | Runs unittest for make_dafsa if any related file has been modified. | [
"Runs",
"unittest",
"for",
"make_dafsa",
"if",
"any",
"related",
"file",
"has",
"been",
"modified",
"."
] | def _RunMakeDafsaTests(input_api, output_api):
files = ('tools/media_engagement_preload/make_dafsa.py',
'tools/media_engagement_preload/make_dafsa_unittest.py')
if not any(f in input_api.LocalPaths() for f in files):
return []
return input_api.RunTests(
input_api.canned_checks.RunUnitTestsInD... | [
"def",
"_RunMakeDafsaTests",
"(",
"input_api",
",",
"output_api",
")",
":",
"files",
"=",
"(",
"'tools/media_engagement_preload/make_dafsa.py'",
",",
"'tools/media_engagement_preload/make_dafsa_unittest.py'",
")",
"if",
"not",
"any",
"(",
"f",
"in",
"input_api",
".",
"L... | Runs unittest for make_dafsa if any related file has been modified. | [
"Runs",
"unittest",
"for",
"make_dafsa",
"if",
"any",
"related",
"file",
"has",
"been",
"modified",
"."
] | [
"\"\"\"Runs unittest for make_dafsa if any related file has been modified.\"\"\""
] | [
{
"param": "input_api",
"type": null
},
{
"param": "output_api",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_api",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output_api",
"type": null,
"docstring": null,
"docstring... |
009ec4a7403171165ed5ffd41f0a77c6feac7820 | sunlongbo/chromium | components/language/content/browser/ulp_language_code_locator/ulp_serialized_to_static_c.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ReadSerializedData | <not_specific> | def ReadSerializedData(input_path):
"""Read serialized ULP language quad tree"""
with open(input_path, 'rb') as input_file:
data = input_file.read()
linebreak = data.index(b'\n')
# First line is comma-separated list of languages.
language_codes = data[:linebreak].strip().decode(encoding="utf-8").split('... | Read serialized ULP language quad tree | Read serialized ULP language quad tree | [
"Read",
"serialized",
"ULP",
"language",
"quad",
"tree"
] | def ReadSerializedData(input_path):
with open(input_path, 'rb') as input_file:
data = input_file.read()
linebreak = data.index(b'\n')
language_codes = data[:linebreak].strip().decode(encoding="utf-8").split(',')
tree_bytes = data[linebreak+1:]
to_bytes = ord if sys.version_info.major == 2 else lambda x: x... | [
"def",
"ReadSerializedData",
"(",
"input_path",
")",
":",
"with",
"open",
"(",
"input_path",
",",
"'rb'",
")",
"as",
"input_file",
":",
"data",
"=",
"input_file",
".",
"read",
"(",
")",
"linebreak",
"=",
"data",
".",
"index",
"(",
"b'\\n'",
")",
"languag... | Read serialized ULP language quad tree | [
"Read",
"serialized",
"ULP",
"language",
"quad",
"tree"
] | [
"\"\"\"Read serialized ULP language quad tree\"\"\"",
"# First line is comma-separated list of languages.",
"# Rest of the file is the serialized tree.",
"# Strings are read in Python 2 so we need to use ord() to convert to bytes.",
"# We group the bytes in the string into 32 bits integers."
] | [
{
"param": "input_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
89c1dee318bffccc807befd37aa27a662c9a007e | sunlongbo/chromium | tools/perf/core/tbmv3/trace_processor_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreateEmptyProtoTrace | <not_specific> | def CreateEmptyProtoTrace(self):
"""Create an empty file as a proto trace."""
with tempfile.NamedTemporaryFile(dir=self.temp_dir,
delete=False) as trace_file:
# Open temp file and close it so it's written to disk.
pass
return trace_file.name | Create an empty file as a proto trace. | Create an empty file as a proto trace. | [
"Create",
"an",
"empty",
"file",
"as",
"a",
"proto",
"trace",
"."
] | def CreateEmptyProtoTrace(self):
with tempfile.NamedTemporaryFile(dir=self.temp_dir,
delete=False) as trace_file:
pass
return trace_file.name | [
"def",
"CreateEmptyProtoTrace",
"(",
"self",
")",
":",
"with",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"dir",
"=",
"self",
".",
"temp_dir",
",",
"delete",
"=",
"False",
")",
"as",
"trace_file",
":",
"pass",
"return",
"trace_file",
".",
"name"
] | Create an empty file as a proto trace. | [
"Create",
"an",
"empty",
"file",
"as",
"a",
"proto",
"trace",
"."
] | [
"\"\"\"Create an empty file as a proto trace.\"\"\"",
"# Open temp file and close it so it's written to disk."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d714d5b3f5e88c99e90edf0e025c7acb2f79c75f | sunlongbo/chromium | third_party/blink/renderer/build/scripts/core/css/field_alias_expander.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | expand_field_alias | null | def expand_field_alias(self, property_):
"""
Does expansion based on the value of field_template of a given property.
"""
if property_['field_template'] in self._field_aliases:
alias_template = property_['field_template']
for field in self._field_aliases[alias_tem... |
Does expansion based on the value of field_template of a given property.
| Does expansion based on the value of field_template of a given property. | [
"Does",
"expansion",
"based",
"on",
"the",
"value",
"of",
"field_template",
"of",
"a",
"given",
"property",
"."
] | def expand_field_alias(self, property_):
if property_['field_template'] in self._field_aliases:
alias_template = property_['field_template']
for field in self._field_aliases[alias_template]:
if field == 'name':
continue
property_[field]... | [
"def",
"expand_field_alias",
"(",
"self",
",",
"property_",
")",
":",
"if",
"property_",
"[",
"'field_template'",
"]",
"in",
"self",
".",
"_field_aliases",
":",
"alias_template",
"=",
"property_",
"[",
"'field_template'",
"]",
"for",
"field",
"in",
"self",
"."... | Does expansion based on the value of field_template of a given property. | [
"Does",
"expansion",
"based",
"on",
"the",
"value",
"of",
"field_template",
"of",
"a",
"given",
"property",
"."
] | [
"\"\"\"\n Does expansion based on the value of field_template of a given property.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "property_",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "property_",
"type": null,
"docstring": null,
"docstring_token... |
7658c644316cf72d7bccdb7614caa2497e52c5a1 | sunlongbo/chromium | tools/gypv8sh.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | HasSameContent | <not_specific> | def HasSameContent(filename, content):
'''Returns true if the given file is readable and has the given content.'''
try:
with open(filename, 'rb') as file:
return file.read() == content
except:
# Ignore all errors and fall back on a safe bet.
return False | Returns true if the given file is readable and has the given content. | Returns true if the given file is readable and has the given content. | [
"Returns",
"true",
"if",
"the",
"given",
"file",
"is",
"readable",
"and",
"has",
"the",
"given",
"content",
"."
] | def HasSameContent(filename, content):
try:
with open(filename, 'rb') as file:
return file.read() == content
except:
return False | [
"def",
"HasSameContent",
"(",
"filename",
",",
"content",
")",
":",
"try",
":",
"with",
"open",
"(",
"filename",
",",
"'rb'",
")",
"as",
"file",
":",
"return",
"file",
".",
"read",
"(",
")",
"==",
"content",
"except",
":",
"return",
"False"
] | Returns true if the given file is readable and has the given content. | [
"Returns",
"true",
"if",
"the",
"given",
"file",
"is",
"readable",
"and",
"has",
"the",
"given",
"content",
"."
] | [
"'''Returns true if the given file is readable and has the given content.'''",
"# Ignore all errors and fall back on a safe bet."
] | [
{
"param": "filename",
"type": null
},
{
"param": "content",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "content",
"type": null,
"docstring": null,
"docstring_tok... |
fdb32079fbfcb562b39ce12e7a6b9365b606bce1 | sunlongbo/chromium | components/crash/content/tools/dmp2minidump.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ProcessDump | <not_specific> | def ProcessDump(dump_file, minidump_file):
"""Extracts the part of the dump file that minidump_stackwalk can read.
The dump files generated by the breakpad integration multi-part form data
that include the minidump as file attachment.
Args:
dump_file: the dump file that needs to be processed.
minidump... | Extracts the part of the dump file that minidump_stackwalk can read.
The dump files generated by the breakpad integration multi-part form data
that include the minidump as file attachment.
Args:
dump_file: the dump file that needs to be processed.
minidump_file: the file to write the minidump to.
| Extracts the part of the dump file that minidump_stackwalk can read.
The dump files generated by the breakpad integration multi-part form data
that include the minidump as file attachment. | [
"Extracts",
"the",
"part",
"of",
"the",
"dump",
"file",
"that",
"minidump_stackwalk",
"can",
"read",
".",
"The",
"dump",
"files",
"generated",
"by",
"the",
"breakpad",
"integration",
"multi",
"-",
"part",
"form",
"data",
"that",
"include",
"the",
"minidump",
... | def ProcessDump(dump_file, minidump_file):
try:
dump = open(dump_file, 'rb')
boundary = dump.readline().strip()[2:]
data = parse_multipart(dump, {'boundary': boundary})
except:
print('Failed to read dmp file %s' % dump_file)
return
if not 'upload_file_minidump' in data:
print('Could not fi... | [
"def",
"ProcessDump",
"(",
"dump_file",
",",
"minidump_file",
")",
":",
"try",
":",
"dump",
"=",
"open",
"(",
"dump_file",
",",
"'rb'",
")",
"boundary",
"=",
"dump",
".",
"readline",
"(",
")",
".",
"strip",
"(",
")",
"[",
"2",
":",
"]",
"data",
"="... | Extracts the part of the dump file that minidump_stackwalk can read. | [
"Extracts",
"the",
"part",
"of",
"the",
"dump",
"file",
"that",
"minidump_stackwalk",
"can",
"read",
"."
] | [
"\"\"\"Extracts the part of the dump file that minidump_stackwalk can read.\n\n The dump files generated by the breakpad integration multi-part form data\n that include the minidump as file attachment.\n\n Args:\n dump_file: the dump file that needs to be processed.\n minidump_file: the file to write the m... | [
{
"param": "dump_file",
"type": null
},
{
"param": "minidump_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dump_file",
"type": null,
"docstring": "the dump file that needs to be processed.",
"docstring_tokens": [
"the",
"dump",
"file",
"that",
"needs",
"to",
"be",
"pro... |
fdd5e88cad67ead416bb4f9846135f15c245e112 | sunlongbo/chromium | ppapi/generators/idl_parser.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | p_param_item | null | def p_param_item(self, p):
"""param_item : modifiers optional typeref arrays identifier"""
typeref = self.BuildAttribute('TYPEREF', p[3])
children = ListFromConcat(p[1], p[2], typeref, p[4])
p[0] = self.BuildNamed('Param', p, 5, children)
if self.parse_debug: DumpReduction('param_item', p) | param_item : modifiers optional typeref arrays identifier | param_item : modifiers optional typeref arrays identifier | [
"param_item",
":",
"modifiers",
"optional",
"typeref",
"arrays",
"identifier"
] | def p_param_item(self, p):
typeref = self.BuildAttribute('TYPEREF', p[3])
children = ListFromConcat(p[1], p[2], typeref, p[4])
p[0] = self.BuildNamed('Param', p, 5, children)
if self.parse_debug: DumpReduction('param_item', p) | [
"def",
"p_param_item",
"(",
"self",
",",
"p",
")",
":",
"typeref",
"=",
"self",
".",
"BuildAttribute",
"(",
"'TYPEREF'",
",",
"p",
"[",
"3",
"]",
")",
"children",
"=",
"ListFromConcat",
"(",
"p",
"[",
"1",
"]",
",",
"p",
"[",
"2",
"]",
",",
"type... | param_item : modifiers optional typeref arrays identifier | [
"param_item",
":",
"modifiers",
"optional",
"typeref",
"arrays",
"identifier"
] | [
"\"\"\"param_item : modifiers optional typeref arrays identifier\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "p",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "p",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
fdd5e88cad67ead416bb4f9846135f15c245e112 | sunlongbo/chromium | ppapi/generators/idl_parser.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | p_member_attribute | null | def p_member_attribute(self, p):
"""member_attribute : modifiers typeref arrays questionmark identifier"""
typeref = self.BuildAttribute('TYPEREF', p[2])
children = ListFromConcat(p[1], typeref, p[3], p[4])
p[0] = self.BuildNamed('Member', p, 5, children)
if self.parse_debug: DumpReduction('attribut... | member_attribute : modifiers typeref arrays questionmark identifier | member_attribute : modifiers typeref arrays questionmark identifier | [
"member_attribute",
":",
"modifiers",
"typeref",
"arrays",
"questionmark",
"identifier"
] | def p_member_attribute(self, p):
typeref = self.BuildAttribute('TYPEREF', p[2])
children = ListFromConcat(p[1], typeref, p[3], p[4])
p[0] = self.BuildNamed('Member', p, 5, children)
if self.parse_debug: DumpReduction('attribute', p) | [
"def",
"p_member_attribute",
"(",
"self",
",",
"p",
")",
":",
"typeref",
"=",
"self",
".",
"BuildAttribute",
"(",
"'TYPEREF'",
",",
"p",
"[",
"2",
"]",
")",
"children",
"=",
"ListFromConcat",
"(",
"p",
"[",
"1",
"]",
",",
"typeref",
",",
"p",
"[",
... | member_attribute : modifiers typeref arrays questionmark identifier | [
"member_attribute",
":",
"modifiers",
"typeref",
"arrays",
"questionmark",
"identifier"
] | [
"\"\"\"member_attribute : modifiers typeref arrays questionmark identifier\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "p",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "p",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
fdd5e88cad67ead416bb4f9846135f15c245e112 | sunlongbo/chromium | ppapi/generators/idl_parser.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | p_member_function | null | def p_member_function(self, p):
"""member_function : modifiers static typeref arrays SYMBOL param_list"""
typeref = self.BuildAttribute('TYPEREF', p[3])
children = ListFromConcat(p[1], p[2], typeref, p[4], p[6])
p[0] = self.BuildNamed('Member', p, 5, children)
if self.parse_debug: DumpReduction('fun... | member_function : modifiers static typeref arrays SYMBOL param_list | member_function : modifiers static typeref arrays SYMBOL param_list | [
"member_function",
":",
"modifiers",
"static",
"typeref",
"arrays",
"SYMBOL",
"param_list"
] | def p_member_function(self, p):
typeref = self.BuildAttribute('TYPEREF', p[3])
children = ListFromConcat(p[1], p[2], typeref, p[4], p[6])
p[0] = self.BuildNamed('Member', p, 5, children)
if self.parse_debug: DumpReduction('function', p) | [
"def",
"p_member_function",
"(",
"self",
",",
"p",
")",
":",
"typeref",
"=",
"self",
".",
"BuildAttribute",
"(",
"'TYPEREF'",
",",
"p",
"[",
"3",
"]",
")",
"children",
"=",
"ListFromConcat",
"(",
"p",
"[",
"1",
"]",
",",
"p",
"[",
"2",
"]",
",",
... | member_function : modifiers static typeref arrays SYMBOL param_list | [
"member_function",
":",
"modifiers",
"static",
"typeref",
"arrays",
"SYMBOL",
"param_list"
] | [
"\"\"\"member_function : modifiers static typeref arrays SYMBOL param_list\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "p",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "p",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
9be1391c5aa97aa2ddfe3010c75d0ea1c6ef9e96 | sunlongbo/chromium | third_party/zxcvbn-cpp/data-scripts/build_frequency_lists.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | filter_frequency_lists | <not_specific> | def filter_frequency_lists(freq_lists):
'''
filters frequency data according to:
- filter out short tokens if they are too rare.
- filter out tokens if they already appear in another dict
at lower rank.
- cut off final freq_list at limits set in DICTIONARIES, if any.
'''
... |
filters frequency data according to:
- filter out short tokens if they are too rare.
- filter out tokens if they already appear in another dict
at lower rank.
- cut off final freq_list at limits set in DICTIONARIES, if any.
| filters frequency data according to:
filter out short tokens if they are too rare.
filter out tokens if they already appear in another dict
at lower rank.
cut off final freq_list at limits set in DICTIONARIES, if any. | [
"filters",
"frequency",
"data",
"according",
"to",
":",
"filter",
"out",
"short",
"tokens",
"if",
"they",
"are",
"too",
"rare",
".",
"filter",
"out",
"tokens",
"if",
"they",
"already",
"appear",
"in",
"another",
"dict",
"at",
"lower",
"rank",
".",
"cut",
... | def filter_frequency_lists(freq_lists):
filtered_token_and_rank = {}
token_count = {}
for name in freq_lists:
filtered_token_and_rank[name] = []
token_count[name] = 0
minimum_rank = {}
minimum_name = {}
for name, token_to_rank in sorted(freq_lists.items()):
... | [
"def",
"filter_frequency_lists",
"(",
"freq_lists",
")",
":",
"filtered_token_and_rank",
"=",
"{",
"}",
"token_count",
"=",
"{",
"}",
"for",
"name",
"in",
"freq_lists",
":",
"filtered_token_and_rank",
"[",
"name",
"]",
"=",
"[",
"]",
"token_count",
"[",
"name"... | filters frequency data according to:
filter out short tokens if they are too rare. | [
"filters",
"frequency",
"data",
"according",
"to",
":",
"filter",
"out",
"short",
"tokens",
"if",
"they",
"are",
"too",
"rare",
"."
] | [
"'''\n filters frequency data according to:\n - filter out short tokens if they are too rare.\n - filter out tokens if they already appear in another dict\n at lower rank.\n - cut off final freq_list at limits set in DICTIONARIES, if any.\n '''",
"# maps {name: [(token, rank), ... | [
{
"param": "freq_lists",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "freq_lists",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
253075dbe534450f64f425b00d1bf0b45bb44043 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/path_finder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | depot_tools_base | <not_specific> | def depot_tools_base(self):
"""Returns the path to depot_tools, or None if not found.
Expects depot_tools to be //third_party/depot_tools.
src.git's DEPS defines depot_tools to be there.
"""
depot_tools = self.path_from_chromium_base('third_party',
... | Returns the path to depot_tools, or None if not found.
Expects depot_tools to be //third_party/depot_tools.
src.git's DEPS defines depot_tools to be there.
| Returns the path to depot_tools, or None if not found. | [
"Returns",
"the",
"path",
"to",
"depot_tools",
"or",
"None",
"if",
"not",
"found",
"."
] | def depot_tools_base(self):
depot_tools = self.path_from_chromium_base('third_party',
'depot_tools')
return depot_tools if self._filesystem.isdir(depot_tools) else None | [
"def",
"depot_tools_base",
"(",
"self",
")",
":",
"depot_tools",
"=",
"self",
".",
"path_from_chromium_base",
"(",
"'third_party'",
",",
"'depot_tools'",
")",
"return",
"depot_tools",
"if",
"self",
".",
"_filesystem",
".",
"isdir",
"(",
"depot_tools",
")",
"else... | Returns the path to depot_tools, or None if not found. | [
"Returns",
"the",
"path",
"to",
"depot_tools",
"or",
"None",
"if",
"not",
"found",
"."
] | [
"\"\"\"Returns the path to depot_tools, or None if not found.\n\n Expects depot_tools to be //third_party/depot_tools.\n src.git's DEPS defines depot_tools to be there.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a655e095b51da336f977a1a42b5499c587a2256 | sunlongbo/chromium | chrome/test/chromedriver/server/server.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | terminate_process | null | def terminate_process(proc):
"""Terminates the process.
If an error occurs ignore it, just print out a message.
Args:
proc: A subprocess.
"""
try:
proc.terminate()
except OSError as ex:
print('Error while killing a process: %s' % ex) | Terminates the process.
If an error occurs ignore it, just print out a message.
Args:
proc: A subprocess.
| Terminates the process.
If an error occurs ignore it, just print out a message. | [
"Terminates",
"the",
"process",
".",
"If",
"an",
"error",
"occurs",
"ignore",
"it",
"just",
"print",
"out",
"a",
"message",
"."
] | def terminate_process(proc):
try:
proc.terminate()
except OSError as ex:
print('Error while killing a process: %s' % ex) | [
"def",
"terminate_process",
"(",
"proc",
")",
":",
"try",
":",
"proc",
".",
"terminate",
"(",
")",
"except",
"OSError",
"as",
"ex",
":",
"print",
"(",
"'Error while killing a process: %s'",
"%",
"ex",
")"
] | Terminates the process. | [
"Terminates",
"the",
"process",
"."
] | [
"\"\"\"Terminates the process.\n\n If an error occurs ignore it, just print out a message.\n\n Args:\n proc: A subprocess.\n \"\"\""
] | [
{
"param": "proc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "proc",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a655e095b51da336f977a1a42b5499c587a2256 | sunlongbo/chromium | chrome/test/chromedriver/server/server.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | IsRunning | <not_specific> | def IsRunning(self):
"""Returns whether the server is up and running."""
try:
urllib.request.urlopen(self.GetUrl() + '/status')
return True
except urllib.error.URLError:
return False | Returns whether the server is up and running. | Returns whether the server is up and running. | [
"Returns",
"whether",
"the",
"server",
"is",
"up",
"and",
"running",
"."
] | def IsRunning(self):
try:
urllib.request.urlopen(self.GetUrl() + '/status')
return True
except urllib.error.URLError:
return False | [
"def",
"IsRunning",
"(",
"self",
")",
":",
"try",
":",
"urllib",
".",
"request",
".",
"urlopen",
"(",
"self",
".",
"GetUrl",
"(",
")",
"+",
"'/status'",
")",
"return",
"True",
"except",
"urllib",
".",
"error",
".",
"URLError",
":",
"return",
"False"
] | Returns whether the server is up and running. | [
"Returns",
"whether",
"the",
"server",
"is",
"up",
"and",
"running",
"."
] | [
"\"\"\"Returns whether the server is up and running.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a655e095b51da336f977a1a42b5499c587a2256 | sunlongbo/chromium | chrome/test/chromedriver/server/server.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Kill | <not_specific> | def Kill(self):
"""Kills the ChromeDriver server, if it is running."""
if self._process is None:
return
try:
urllib.request.urlopen(self.GetUrl() + '/shutdown', timeout=10).close()
except:
self._process.terminate()
timer = threading.Timer(5, terminate_process, [self._process])
... | Kills the ChromeDriver server, if it is running. | Kills the ChromeDriver server, if it is running. | [
"Kills",
"the",
"ChromeDriver",
"server",
"if",
"it",
"is",
"running",
"."
] | def Kill(self):
if self._process is None:
return
try:
urllib.request.urlopen(self.GetUrl() + '/shutdown', timeout=10).close()
except:
self._process.terminate()
timer = threading.Timer(5, terminate_process, [self._process])
timer.start()
self._process.wait()
timer.cancel()
... | [
"def",
"Kill",
"(",
"self",
")",
":",
"if",
"self",
".",
"_process",
"is",
"None",
":",
"return",
"try",
":",
"urllib",
".",
"request",
".",
"urlopen",
"(",
"self",
".",
"GetUrl",
"(",
")",
"+",
"'/shutdown'",
",",
"timeout",
"=",
"10",
")",
".",
... | Kills the ChromeDriver server, if it is running. | [
"Kills",
"the",
"ChromeDriver",
"server",
"if",
"it",
"is",
"running",
"."
] | [
"\"\"\"Kills the ChromeDriver server, if it is running.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c899ae2c5915d955885a38f069940d60f316007c | sunlongbo/chromium | tools/android/dependency_analysis/chrome_names.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | shorten_build_target | str | def shorten_build_target(build_target: str) -> str:
"""Returns a shortened version of the build target."""
if build_target == '//chrome/android:chrome_java':
return 'chrome_java'
return build_target.replace('//chrome/browser/', '//c/b/') | Returns a shortened version of the build target. | Returns a shortened version of the build target. | [
"Returns",
"a",
"shortened",
"version",
"of",
"the",
"build",
"target",
"."
] | def shorten_build_target(build_target: str) -> str:
if build_target == '//chrome/android:chrome_java':
return 'chrome_java'
return build_target.replace('//chrome/browser/', '//c/b/') | [
"def",
"shorten_build_target",
"(",
"build_target",
":",
"str",
")",
"->",
"str",
":",
"if",
"build_target",
"==",
"'//chrome/android:chrome_java'",
":",
"return",
"'chrome_java'",
"return",
"build_target",
".",
"replace",
"(",
"'//chrome/browser/'",
",",
"'//c/b/'",
... | Returns a shortened version of the build target. | [
"Returns",
"a",
"shortened",
"version",
"of",
"the",
"build",
"target",
"."
] | [
"\"\"\"Returns a shortened version of the build target.\"\"\""
] | [
{
"param": "build_target",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "build_target",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
757ad15d7220b4fcf0484a4ad7a23b1bb90cc763 | sunlongbo/chromium | build/fuchsia/run_test_package.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunTestPackage | <not_specific> | def RunTestPackage(output_dir, target, package_paths, package_name,
package_args, args):
"""Installs the Fuchsia package at |package_path| on the target,
executes it with |package_args|, and symbolizes its output.
output_dir: The path containing the build output files.
target: The deployment... | Installs the Fuchsia package at |package_path| on the target,
executes it with |package_args|, and symbolizes its output.
output_dir: The path containing the build output files.
target: The deployment Target object that will run the package.
package_paths: The paths to the .far packages to be installed.
pack... | Installs the Fuchsia package at |package_path| on the target,
executes it with |package_args|, and symbolizes its output.
The path containing the build output files.
target: The deployment Target object that will run the package.
package_paths: The paths to the .far packages to be installed.
package_name: The name of ... | [
"Installs",
"the",
"Fuchsia",
"package",
"at",
"|package_path|",
"on",
"the",
"target",
"executes",
"it",
"with",
"|package_args|",
"and",
"symbolizes",
"its",
"output",
".",
"The",
"path",
"containing",
"the",
"build",
"output",
"files",
".",
"target",
":",
"... | def RunTestPackage(output_dir, target, package_paths, package_name,
package_args, args):
with target.GetPkgRepo():
start_time = time.time()
target.InstallPackage(package_paths)
logging.info('Test installed in {:.2f} seconds.'.format(time.time() -
... | [
"def",
"RunTestPackage",
"(",
"output_dir",
",",
"target",
",",
"package_paths",
",",
"package_name",
",",
"package_args",
",",
"args",
")",
":",
"with",
"target",
".",
"GetPkgRepo",
"(",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"target"... | Installs the Fuchsia package at |package_path| on the target,
executes it with |package_args|, and symbolizes its output. | [
"Installs",
"the",
"Fuchsia",
"package",
"at",
"|package_path|",
"on",
"the",
"target",
"executes",
"it",
"with",
"|package_args|",
"and",
"symbolizes",
"its",
"output",
"."
] | [
"\"\"\"Installs the Fuchsia package at |package_path| on the target,\n executes it with |package_args|, and symbolizes its output.\n\n output_dir: The path containing the build output files.\n target: The deployment Target object that will run the package.\n package_paths: The paths to the .far packages to be i... | [
{
"param": "output_dir",
"type": null
},
{
"param": "target",
"type": null
},
{
"param": "package_paths",
"type": null
},
{
"param": "package_name",
"type": null
},
{
"param": "package_args",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "output_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target",
"type": null,
"docstring": null,
"docstring_to... |
10dc88483ef850f37b0643f042be5e82ad46a2ac | sunlongbo/chromium | tools/mac/power/collapse_profile.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | shorten_stack | <not_specific> | def shorten_stack(self, stack):
"""Drop some frames that don't offer any valuable information. The part
above/before the frame is trimmed. This means that the base of the stack
can be dropped but no frame can "skipped".
Example (dropping biz):
foo;bar;biz;boo --> boo
foo;biz;bar;boo --> bar;bo... | Drop some frames that don't offer any valuable information. The part
above/before the frame is trimmed. This means that the base of the stack
can be dropped but no frame can "skipped".
Example (dropping biz):
foo;bar;biz;boo --> boo
foo;biz;bar;boo --> bar;boo
Args:
stack: An array of s... | Drop some frames that don't offer any valuable information. The part
above/before the frame is trimmed. This means that the base of the stack
can be dropped but no frame can "skipped".
Example (dropping biz).
| [
"Drop",
"some",
"frames",
"that",
"don",
"'",
"t",
"offer",
"any",
"valuable",
"information",
".",
"The",
"part",
"above",
"/",
"before",
"the",
"frame",
"is",
"trimmed",
".",
"This",
"means",
"that",
"the",
"base",
"of",
"the",
"stack",
"can",
"be",
"... | def shorten_stack(self, stack):
message_pump_roots = [
"base::MessagePumpNSRunLoop::DoRun", "base::MessagePumpDefault::Run",
"base::MessagePumpKqueue::Run", "base::MessagePumpCFRunLoopBase::Run",
"base::MessagePumpNSApplication::DoRun", "base::mac::CallWithEHFrame"
]
first_ignored_in... | [
"def",
"shorten_stack",
"(",
"self",
",",
"stack",
")",
":",
"message_pump_roots",
"=",
"[",
"\"base::MessagePumpNSRunLoop::DoRun\"",
",",
"\"base::MessagePumpDefault::Run\"",
",",
"\"base::MessagePumpKqueue::Run\"",
",",
"\"base::MessagePumpCFRunLoopBase::Run\"",
",",
"\"base:... | Drop some frames that don't offer any valuable information. | [
"Drop",
"some",
"frames",
"that",
"don",
"'",
"t",
"offer",
"any",
"valuable",
"information",
"."
] | [
"\"\"\"Drop some frames that don't offer any valuable information. The part\n above/before the frame is trimmed. This means that the base of the stack\n can be dropped but no frame can \"skipped\".\n\n Example (dropping biz):\n\n foo;bar;biz;boo --> boo\n foo;biz;bar;boo --> bar;boo\n\n Args:\n ... | [
{
"param": "self",
"type": null
},
{
"param": "stack",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stack",
"type": null,
"docstring": "An array of strings that repres... |
10dc88483ef850f37b0643f042be5e82ad46a2ac | sunlongbo/chromium | tools/mac/power/collapse_profile.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | add_category_from_any_frame | <not_specific> | def add_category_from_any_frame(self, stack):
"""Adds synthetic frame according to some generic categories to help
analyze the results.
Args:
stack: An array of strings that represent each frame of a stack trace.
Returns: The input array with zero or one element added.
"""
# Categories ... | Adds synthetic frame according to some generic categories to help
analyze the results.
Args:
stack: An array of strings that represent each frame of a stack trace.
Returns: The input array with zero or one element added.
| Adds synthetic frame according to some generic categories to help
analyze the results. | [
"Adds",
"synthetic",
"frame",
"according",
"to",
"some",
"generic",
"categories",
"to",
"help",
"analyze",
"the",
"results",
"."
] | def add_category_from_any_frame(self, stack):
special_markers = [['viz'], ['net::', 'network::'], ['blink::'], ['mojo::'],
['gpu::'], ['v8::'], ['sql::'], ['CoreText'], ['AppKit'],
['Security'], ['CoreFoundation']]
compound_marker = []
for synonyms in special_ma... | [
"def",
"add_category_from_any_frame",
"(",
"self",
",",
"stack",
")",
":",
"special_markers",
"=",
"[",
"[",
"'viz'",
"]",
",",
"[",
"'net::'",
",",
"'network::'",
"]",
",",
"[",
"'blink::'",
"]",
",",
"[",
"'mojo::'",
"]",
",",
"[",
"'gpu::'",
"]",
",... | Adds synthetic frame according to some generic categories to help
analyze the results. | [
"Adds",
"synthetic",
"frame",
"according",
"to",
"some",
"generic",
"categories",
"to",
"help",
"analyze",
"the",
"results",
"."
] | [
"\"\"\"Adds synthetic frame according to some generic categories to help\n analyze the results.\n\n Args:\n stack: An array of strings that represent each frame of a stack trace.\n\n Returns: The input array with zero or one element added.\n \"\"\"",
"# Categories ordered by importance. Each elem... | [
{
"param": "self",
"type": null
},
{
"param": "stack",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stack",
"type": null,
"docstring": "An array of strings that repres... |
10dc88483ef850f37b0643f042be5e82ad46a2ac | sunlongbo/chromium | tools/mac/power/collapse_profile.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | remove_tokens | <not_specific> | def remove_tokens(self, stack):
"""Removes some substrings from frames in the stack.
Args:
stack: An array of strings that represent each frame of a stack trace.
Returns: The input array with zero or more frames modified.
"""
# Drop parts of the function names that just add noise.
token... | Removes some substrings from frames in the stack.
Args:
stack: An array of strings that represent each frame of a stack trace.
Returns: The input array with zero or more frames modified.
| Removes some substrings from frames in the stack. | [
"Removes",
"some",
"substrings",
"from",
"frames",
"in",
"the",
"stack",
"."
] | def remove_tokens(self, stack):
tokens_to_remove = [
"Chromium Framework`", "libsystem_kernel.dylib`", "Security`"
]
for i, frame in enumerate(stack):
for token in tokens_to_remove:
if stack[i] != token:
stack[i] = stack[i].replace(token, "")
return stack | [
"def",
"remove_tokens",
"(",
"self",
",",
"stack",
")",
":",
"tokens_to_remove",
"=",
"[",
"\"Chromium Framework`\"",
",",
"\"libsystem_kernel.dylib`\"",
",",
"\"Security`\"",
"]",
"for",
"i",
",",
"frame",
"in",
"enumerate",
"(",
"stack",
")",
":",
"for",
"to... | Removes some substrings from frames in the stack. | [
"Removes",
"some",
"substrings",
"from",
"frames",
"in",
"the",
"stack",
"."
] | [
"\"\"\"Removes some substrings from frames in the stack.\n\n Args:\n stack: An array of strings that represent each frame of a stack trace.\n\n Returns: The input array with zero or more frames modified.\n \"\"\"",
"# Drop parts of the function names that just add noise.",
"# If removing the token... | [
{
"param": "self",
"type": null
},
{
"param": "stack",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stack",
"type": null,
"docstring": "An array of strings that repres... |
10dc88483ef850f37b0643f042be5e82ad46a2ac | sunlongbo/chromium | tools/mac/power/collapse_profile.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | write_down_samples | null | def write_down_samples(self):
"""Writes down self.samples to a file. In contrast to the Dtrace format full
stacks are writtent on a single line. At first the different are separated
by semi-colons and a space separates the weight associated with the
function.
Example:
base::foo;content::bar;bi... | Writes down self.samples to a file. In contrast to the Dtrace format full
stacks are writtent on a single line. At first the different are separated
by semi-colons and a space separates the weight associated with the
function.
Example:
base::foo;content::bar;biz::baz 17
base::biz;content::boo;... | Writes down self.samples to a file. In contrast to the Dtrace format full
stacks are writtent on a single line. At first the different are separated
by semi-colons and a space separates the weight associated with the
function. | [
"Writes",
"down",
"self",
".",
"samples",
"to",
"a",
"file",
".",
"In",
"contrast",
"to",
"the",
"Dtrace",
"format",
"full",
"stacks",
"are",
"writtent",
"on",
"a",
"single",
"line",
".",
"At",
"first",
"the",
"different",
"are",
"separated",
"by",
"semi... | def write_down_samples(self):
if not os.path.exists(os.path.dirname(self.output_filename)):
os.makedirs(os.path.dirname(self.output_filename))
with open(self.output_filename, 'w') as f:
for row in self.samples:
line = ';'.join(row["frames"])
weight = row["weight"]
f.write(f"{... | [
"def",
"write_down_samples",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"self",
".",
"output_filename",
")",
")",
":",
"os",
".",
"makedirs",
"(",
"os",
".",
"path",
".",
"dirn... | Writes down self.samples to a file. | [
"Writes",
"down",
"self",
".",
"samples",
"to",
"a",
"file",
"."
] | [
"\"\"\"Writes down self.samples to a file. In contrast to the Dtrace format full\n stacks are writtent on a single line. At first the different are separated\n by semi-colons and a space separates the weight associated with the\n function.\n\n Example:\n\n base::foo;content::bar;biz::baz 17\n base... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": [
{
"identifier": "examples",
"docstring": null,
... |
10dc88483ef850f37b0643f042be5e82ad46a2ac | sunlongbo/chromium | tools/mac/power/collapse_profile.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | post_process_samples | null | def post_process_samples(self):
"""Applies filtering and enhancing to self.samples(). This function can
only be called once.
Raises:
SystemExit: If this function is called twice on the same object.
"""
if self.post_processing_applied:
logging.error("Post processing cannot be applied t... | Applies filtering and enhancing to self.samples(). This function can
only be called once.
Raises:
SystemExit: If this function is called twice on the same object.
| Applies filtering and enhancing to self.samples(). This function can
only be called once. | [
"Applies",
"filtering",
"and",
"enhancing",
"to",
"self",
".",
"samples",
"()",
".",
"This",
"function",
"can",
"only",
"be",
"called",
"once",
"."
] | def post_process_samples(self):
if self.post_processing_applied:
logging.error("Post processing cannot be applied twice")
sys.exit(-1)
self.post_processing_applied = True
processed_samples = []
for row in self.samples:
row["frames"] = self.shorten_stack(row["frames"])
row["frames... | [
"def",
"post_process_samples",
"(",
"self",
")",
":",
"if",
"self",
".",
"post_processing_applied",
":",
"logging",
".",
"error",
"(",
"\"Post processing cannot be applied twice\"",
")",
"sys",
".",
"exit",
"(",
"-",
"1",
")",
"self",
".",
"post_processing_applied... | Applies filtering and enhancing to self.samples(). | [
"Applies",
"filtering",
"and",
"enhancing",
"to",
"self",
".",
"samples",
"()",
"."
] | [
"\"\"\"Applies filtering and enhancing to self.samples(). This function can\n only be called once.\n\n Raises:\n SystemExit: If this function is called twice on the same object.\n \"\"\"",
"# Filter out the frames we don't care about and all those under it."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "If this function is called twice on the same object.",
"docstring_tokens": [
"If",
"this",
"function",
"is",
"called",
"twice",
"on",
"the",
"same",
"object",
"."
... |
10f1b0f4948ca9668f9600a1253036ba70c1994f | sunlongbo/chromium | tools/traffic_annotation/scripts/generator_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | map_annotations | <not_specific> | def map_annotations(tsv_contents):
"""Creates a mapping between the unique_id of a given annotation and its
relevant attributes, e.g. description, trigger, data, etc.
Args:
tsv_contents: List[List]
Table of loaded annotations.
Returns:
unique_id_rel_attributes_map: <Dict[str, TrafficAnnotation]>... | Creates a mapping between the unique_id of a given annotation and its
relevant attributes, e.g. description, trigger, data, etc.
Args:
tsv_contents: List[List]
Table of loaded annotations.
Returns:
unique_id_rel_attributes_map: <Dict[str, TrafficAnnotation]>
| Creates a mapping between the unique_id of a given annotation and its
relevant attributes, e.g. description, trigger, data, etc. | [
"Creates",
"a",
"mapping",
"between",
"the",
"unique_id",
"of",
"a",
"given",
"annotation",
"and",
"its",
"relevant",
"attributes",
"e",
".",
"g",
".",
"description",
"trigger",
"data",
"etc",
"."
] | def map_annotations(tsv_contents):
unique_id_rel_attributes_map = {}
for annotation_row in tsv_contents:
unique_id = annotation_row[0].encode("utf-8")
description = annotation_row[3].encode("utf-8")
trigger = annotation_row[4].encode("utf-8")
data = annotation_row[5].encode("utf-8")
settings = a... | [
"def",
"map_annotations",
"(",
"tsv_contents",
")",
":",
"unique_id_rel_attributes_map",
"=",
"{",
"}",
"for",
"annotation_row",
"in",
"tsv_contents",
":",
"unique_id",
"=",
"annotation_row",
"[",
"0",
"]",
".",
"encode",
"(",
"\"utf-8\"",
")",
"description",
"=... | Creates a mapping between the unique_id of a given annotation and its
relevant attributes, e.g. | [
"Creates",
"a",
"mapping",
"between",
"the",
"unique_id",
"of",
"a",
"given",
"annotation",
"and",
"its",
"relevant",
"attributes",
"e",
".",
"g",
"."
] | [
"\"\"\"Creates a mapping between the unique_id of a given annotation and its\n relevant attributes, e.g. description, trigger, data, etc.\n\n Args:\n tsv_contents: List[List]\n Table of loaded annotations.\n\n Returns:\n unique_id_rel_attributes_map: <Dict[str, TrafficAnnotation]>\n \"\"\""
] | [
{
"param": "tsv_contents",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "unique_id_rel_attributes_map"
}
],
"raises": [],
"params": [
{
"identifier": "tsv_contents",
"type": null,
"docstring": "List[List]\nTable of loaded annotations.",
"do... |
10f1b0f4948ca9668f9600a1253036ba70c1994f | sunlongbo/chromium | tools/traffic_annotation/scripts/generator_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _sort_parsed_xml | null | def _sort_parsed_xml(self):
"""Sort on the group and sender keys in alphabetical order, note that
annotations are already sorted."""
self.parsed_xml = {
k: OrderedDict(sorted(v.items()))
for k, v in self.parsed_xml.items()
}
self.parsed_xml = OrderedDict(
sorted(self.parsed_x... | Sort on the group and sender keys in alphabetical order, note that
annotations are already sorted. | Sort on the group and sender keys in alphabetical order, note that
annotations are already sorted. | [
"Sort",
"on",
"the",
"group",
"and",
"sender",
"keys",
"in",
"alphabetical",
"order",
"note",
"that",
"annotations",
"are",
"already",
"sorted",
"."
] | def _sort_parsed_xml(self):
self.parsed_xml = {
k: OrderedDict(sorted(v.items()))
for k, v in self.parsed_xml.items()
}
self.parsed_xml = OrderedDict(
sorted(self.parsed_xml.items(), key=lambda t: t[0])) | [
"def",
"_sort_parsed_xml",
"(",
"self",
")",
":",
"self",
".",
"parsed_xml",
"=",
"{",
"k",
":",
"OrderedDict",
"(",
"sorted",
"(",
"v",
".",
"items",
"(",
")",
")",
")",
"for",
"k",
",",
"v",
"in",
"self",
".",
"parsed_xml",
".",
"items",
"(",
"... | Sort on the group and sender keys in alphabetical order, note that
annotations are already sorted. | [
"Sort",
"on",
"the",
"group",
"and",
"sender",
"keys",
"in",
"alphabetical",
"order",
"note",
"that",
"annotations",
"are",
"already",
"sorted",
"."
] | [
"\"\"\"Sort on the group and sender keys in alphabetical order, note that\n annotations are already sorted.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
10f1b0f4948ca9668f9600a1253036ba70c1994f | sunlongbo/chromium | tools/traffic_annotation/scripts/generator_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | extract_body | <not_specific> | def extract_body(document=None, target="body", json_file_path="template.json"):
"""Google Doc API returns a .json object. Parse this doc object to obtain its
body.
The |template.json| object of the current state of
the document can be obtained by running the update_annotations_doc.py script
using the --debug... | Google Doc API returns a .json object. Parse this doc object to obtain its
body.
The |template.json| object of the current state of
the document can be obtained by running the update_annotations_doc.py script
using the --debug flag.
| Google Doc API returns a .json object. Parse this doc object to obtain its
body.
The |template.json| object of the current state of
the document can be obtained by running the update_annotations_doc.py script
using the --debug flag. | [
"Google",
"Doc",
"API",
"returns",
"a",
".",
"json",
"object",
".",
"Parse",
"this",
"doc",
"object",
"to",
"obtain",
"its",
"body",
".",
"The",
"|template",
".",
"json|",
"object",
"of",
"the",
"current",
"state",
"of",
"the",
"document",
"can",
"be",
... | def extract_body(document=None, target="body", json_file_path="template.json"):
if document:
doc = document
else:
try:
with open(json_file_path) as json_file:
doc = json.load(json_file)
except IOError:
print("Couldn't find the .json file.")
if target == "all":
return doc
retu... | [
"def",
"extract_body",
"(",
"document",
"=",
"None",
",",
"target",
"=",
"\"body\"",
",",
"json_file_path",
"=",
"\"template.json\"",
")",
":",
"if",
"document",
":",
"doc",
"=",
"document",
"else",
":",
"try",
":",
"with",
"open",
"(",
"json_file_path",
"... | Google Doc API returns a .json object. | [
"Google",
"Doc",
"API",
"returns",
"a",
".",
"json",
"object",
"."
] | [
"\"\"\"Google Doc API returns a .json object. Parse this doc object to obtain its\n body.\n\n The |template.json| object of the current state of\n the document can be obtained by running the update_annotations_doc.py script\n using the --debug flag.\n \"\"\""
] | [
{
"param": "document",
"type": null
},
{
"param": "target",
"type": null
},
{
"param": "json_file_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "document",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target",
"type": null,
"docstring": null,
"docstring_toke... |
10f1b0f4948ca9668f9600a1253036ba70c1994f | sunlongbo/chromium | tools/traffic_annotation/scripts/generator_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | find_first_index | <not_specific> | def find_first_index(doc):
"""Finds the cursor index (location) that comes right after the Introduction
section. Namely, the endIndex of the paragraph block the |target_text| belongs
to.
Returns: int
The first cursor index (loc) of the template document, right after the
Introduction section.
"""
ta... | Finds the cursor index (location) that comes right after the Introduction
section. Namely, the endIndex of the paragraph block the |target_text| belongs
to.
Returns: int
The first cursor index (loc) of the template document, right after the
Introduction section.
| Finds the cursor index (location) that comes right after the Introduction
section. Namely, the endIndex of the paragraph block the |target_text| belongs
to.
int
The first cursor index (loc) of the template document, right after the
Introduction section. | [
"Finds",
"the",
"cursor",
"index",
"(",
"location",
")",
"that",
"comes",
"right",
"after",
"the",
"Introduction",
"section",
".",
"Namely",
"the",
"endIndex",
"of",
"the",
"paragraph",
"block",
"the",
"|target_text|",
"belongs",
"to",
".",
"int",
"The",
"fi... | def find_first_index(doc):
target_text = "The policy, if one exists, to control this type of network"
padding = 1
body = extract_body(document=doc)
contents = body["content"]
for element in contents:
if "paragraph" in element:
end_index = element["endIndex"]
lines = element["paragraph"]["ele... | [
"def",
"find_first_index",
"(",
"doc",
")",
":",
"target_text",
"=",
"\"The policy, if one exists, to control this type of network\"",
"padding",
"=",
"1",
"body",
"=",
"extract_body",
"(",
"document",
"=",
"doc",
")",
"contents",
"=",
"body",
"[",
"\"content\"",
"]... | Finds the cursor index (location) that comes right after the Introduction
section. | [
"Finds",
"the",
"cursor",
"index",
"(",
"location",
")",
"that",
"comes",
"right",
"after",
"the",
"Introduction",
"section",
"."
] | [
"\"\"\"Finds the cursor index (location) that comes right after the Introduction\n section. Namely, the endIndex of the paragraph block the |target_text| belongs\n to.\n\n Returns: int\n The first cursor index (loc) of the template document, right after the\n Introduction section.\n \"\"\"",
"# We pad s... | [
{
"param": "doc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "doc",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
10f1b0f4948ca9668f9600a1253036ba70c1994f | sunlongbo/chromium | tools/traffic_annotation/scripts/generator_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | find_last_index | <not_specific> | def find_last_index(doc):
"""
Returns: int
The last cursor index (loc) of the template document.
"""
body = extract_body(document=doc)
contents = body["content"]
last_index = contents[-1]["endIndex"]
return last_index - 1 |
Returns: int
The last cursor index (loc) of the template document.
| int
The last cursor index (loc) of the template document. | [
"int",
"The",
"last",
"cursor",
"index",
"(",
"loc",
")",
"of",
"the",
"template",
"document",
"."
] | def find_last_index(doc):
body = extract_body(document=doc)
contents = body["content"]
last_index = contents[-1]["endIndex"]
return last_index - 1 | [
"def",
"find_last_index",
"(",
"doc",
")",
":",
"body",
"=",
"extract_body",
"(",
"document",
"=",
"doc",
")",
"contents",
"=",
"body",
"[",
"\"content\"",
"]",
"last_index",
"=",
"contents",
"[",
"-",
"1",
"]",
"[",
"\"endIndex\"",
"]",
"return",
"last_... | Returns: int
The last cursor index (loc) of the template document. | [
"Returns",
":",
"int",
"The",
"last",
"cursor",
"index",
"(",
"loc",
")",
"of",
"the",
"template",
"document",
"."
] | [
"\"\"\"\n Returns: int\n The last cursor index (loc) of the template document.\n \"\"\""
] | [
{
"param": "doc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "doc",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
10f1b0f4948ca9668f9600a1253036ba70c1994f | sunlongbo/chromium | tools/traffic_annotation/scripts/generator_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | find_chrome_browser_version | <not_specific> | def find_chrome_browser_version(doc):
"""Finds what the current chrome browser version is in the document.
We grab the current "Chrome Browser version MAJOR.MINOR.BUILD.PATCH" from the
document's header.
Returns: str
The chrome browser version string.
"""
# Only one header.
header = extract_body(doc... | Finds what the current chrome browser version is in the document.
We grab the current "Chrome Browser version MAJOR.MINOR.BUILD.PATCH" from the
document's header.
Returns: str
The chrome browser version string.
| Finds what the current chrome browser version is in the document.
We grab the current "Chrome Browser version MAJOR.MINOR.BUILD.PATCH" from the
document's header.
str
The chrome browser version string. | [
"Finds",
"what",
"the",
"current",
"chrome",
"browser",
"version",
"is",
"in",
"the",
"document",
".",
"We",
"grab",
"the",
"current",
"\"",
"Chrome",
"Browser",
"version",
"MAJOR",
".",
"MINOR",
".",
"BUILD",
".",
"PATCH",
"\"",
"from",
"the",
"document",... | def find_chrome_browser_version(doc):
header = extract_body(document=doc, target="headers").values()[0]
header_elements = header["content"][0]["paragraph"]["elements"]
text = header_elements[0]["textRun"]["content"]
current_version = re.search(r"([\d.]+)", text).group()
return current_version | [
"def",
"find_chrome_browser_version",
"(",
"doc",
")",
":",
"header",
"=",
"extract_body",
"(",
"document",
"=",
"doc",
",",
"target",
"=",
"\"headers\"",
")",
".",
"values",
"(",
")",
"[",
"0",
"]",
"header_elements",
"=",
"header",
"[",
"\"content\"",
"]... | Finds what the current chrome browser version is in the document. | [
"Finds",
"what",
"the",
"current",
"chrome",
"browser",
"version",
"is",
"in",
"the",
"document",
"."
] | [
"\"\"\"Finds what the current chrome browser version is in the document.\n\n We grab the current \"Chrome Browser version MAJOR.MINOR.BUILD.PATCH\" from the\n document's header.\n\n Returns: str\n The chrome browser version string.\n \"\"\"",
"# Only one header."
] | [
{
"param": "doc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "doc",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
38875159c42300b6d0f829c57f5827af9ed3ebcf | sunlongbo/chromium | tools/perf/cli_tools/pinpoint_cli/histograms_df.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | IterRows | null | def IterRows(histogram_dicts):
"""Iterate over histogram dicts yielding rows for a DataFrame or csv."""
histograms = histogram_set.HistogramSet()
histograms.ImportDicts(histogram_dicts)
for hist in histograms:
row = [getattr(hist, name) for _, name in _PROPERTIES]
row.extend(
_DiagnosticValueToS... | Iterate over histogram dicts yielding rows for a DataFrame or csv. | Iterate over histogram dicts yielding rows for a DataFrame or csv. | [
"Iterate",
"over",
"histogram",
"dicts",
"yielding",
"rows",
"for",
"a",
"DataFrame",
"or",
"csv",
"."
] | def IterRows(histogram_dicts):
histograms = histogram_set.HistogramSet()
histograms.ImportDicts(histogram_dicts)
for hist in histograms:
row = [getattr(hist, name) for _, name in _PROPERTIES]
row.extend(
_DiagnosticValueToStr(hist.diagnostics.get(name))
for _, name in _DIAGNOSTICS)
yie... | [
"def",
"IterRows",
"(",
"histogram_dicts",
")",
":",
"histograms",
"=",
"histogram_set",
".",
"HistogramSet",
"(",
")",
"histograms",
".",
"ImportDicts",
"(",
"histogram_dicts",
")",
"for",
"hist",
"in",
"histograms",
":",
"row",
"=",
"[",
"getattr",
"(",
"h... | Iterate over histogram dicts yielding rows for a DataFrame or csv. | [
"Iterate",
"over",
"histogram",
"dicts",
"yielding",
"rows",
"for",
"a",
"DataFrame",
"or",
"csv",
"."
] | [
"\"\"\"Iterate over histogram dicts yielding rows for a DataFrame or csv.\"\"\""
] | [
{
"param": "histogram_dicts",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "histogram_dicts",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
38875159c42300b6d0f829c57f5827af9ed3ebcf | sunlongbo/chromium | tools/perf/cli_tools/pinpoint_cli/histograms_df.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | DataFrame | <not_specific> | def DataFrame(histogram_dicts):
"""Turn a list of histogram dicts into a pandas DataFrame."""
df = pandas.DataFrame.from_records(
IterRows(histogram_dicts), columns=COLUMNS)
df['benchmark_start'] = pandas.to_datetime(df['benchmark_start'])
return df | Turn a list of histogram dicts into a pandas DataFrame. | Turn a list of histogram dicts into a pandas DataFrame. | [
"Turn",
"a",
"list",
"of",
"histogram",
"dicts",
"into",
"a",
"pandas",
"DataFrame",
"."
] | def DataFrame(histogram_dicts):
df = pandas.DataFrame.from_records(
IterRows(histogram_dicts), columns=COLUMNS)
df['benchmark_start'] = pandas.to_datetime(df['benchmark_start'])
return df | [
"def",
"DataFrame",
"(",
"histogram_dicts",
")",
":",
"df",
"=",
"pandas",
".",
"DataFrame",
".",
"from_records",
"(",
"IterRows",
"(",
"histogram_dicts",
")",
",",
"columns",
"=",
"COLUMNS",
")",
"df",
"[",
"'benchmark_start'",
"]",
"=",
"pandas",
".",
"t... | Turn a list of histogram dicts into a pandas DataFrame. | [
"Turn",
"a",
"list",
"of",
"histogram",
"dicts",
"into",
"a",
"pandas",
"DataFrame",
"."
] | [
"\"\"\"Turn a list of histogram dicts into a pandas DataFrame.\"\"\""
] | [
{
"param": "histogram_dicts",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "histogram_dicts",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1becf073c0f702e01c7b976843fbc8681f85e783 | sunlongbo/chromium | tools/cr/cr/base/context.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AddCommonArguments | null | def AddCommonArguments(cls, parser):
"""Adds the command line arguments common to all commands in cr."""
parser.add_argument(
'-h', '--help',
action=_ShowHelp, nargs=0,
help='show the help message and exit.'
)
parser.add_argument(
'--dry-run', dest='CR_DRY_RUN',
a... | Adds the command line arguments common to all commands in cr. | Adds the command line arguments common to all commands in cr. | [
"Adds",
"the",
"command",
"line",
"arguments",
"common",
"to",
"all",
"commands",
"in",
"cr",
"."
] | def AddCommonArguments(cls, parser):
parser.add_argument(
'-h', '--help',
action=_ShowHelp, nargs=0,
help='show the help message and exit.'
)
parser.add_argument(
'--dry-run', dest='CR_DRY_RUN',
action='store_true', default=None,
help="""
Don't execu... | [
"def",
"AddCommonArguments",
"(",
"cls",
",",
"parser",
")",
":",
"parser",
".",
"add_argument",
"(",
"'-h'",
",",
"'--help'",
",",
"action",
"=",
"_ShowHelp",
",",
"nargs",
"=",
"0",
",",
"help",
"=",
"'show the help message and exit.'",
")",
"parser",
".",... | Adds the command line arguments common to all commands in cr. | [
"Adds",
"the",
"command",
"line",
"arguments",
"common",
"to",
"all",
"commands",
"in",
"cr",
"."
] | [
"\"\"\"Adds the command line arguments common to all commands in cr.\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "parser",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parser",
"type": null,
"docstring": null,
"docstring_tokens": ... |
1bed51fda77f3827f437f3929d725d17a1b81546 | sunlongbo/chromium | net/data/ssl/scripts/asn1.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ToDER | <not_specific> | def ToDER(obj):
'''ToDER converts the given object into DER encoding'''
if obj is None:
# None turns into NULL
return TagAndLength(5, 0)
if isinstance(obj, (str, bytes)):
# There are many ASN.1 string types, so rather than pick one implicitly,
# require the caller explicitly specify the encoding w... | ToDER converts the given object into DER encoding | ToDER converts the given object into DER encoding | [
"ToDER",
"converts",
"the",
"given",
"object",
"into",
"DER",
"encoding"
] | def ToDER(obj):
if obj is None:
return TagAndLength(5, 0)
if isinstance(obj, (str, bytes)):
raise TypeError("String types must be specified explicitly")
if isinstance(obj, bool):
val = b"\x00"
if obj:
val = b"\xff"
return TagAndData(1, val)
if isinstance(obj, int):
big_endian = byt... | [
"def",
"ToDER",
"(",
"obj",
")",
":",
"if",
"obj",
"is",
"None",
":",
"return",
"TagAndLength",
"(",
"5",
",",
"0",
")",
"if",
"isinstance",
"(",
"obj",
",",
"(",
"str",
",",
"bytes",
")",
")",
":",
"raise",
"TypeError",
"(",
"\"String types must be ... | ToDER converts the given object into DER encoding | [
"ToDER",
"converts",
"the",
"given",
"object",
"into",
"DER",
"encoding"
] | [
"'''ToDER converts the given object into DER encoding'''",
"# None turns into NULL",
"# There are many ASN.1 string types, so rather than pick one implicitly,",
"# require the caller explicitly specify the encoding with asn1.UTF8String,",
"# etc., below."
] | [
{
"param": "obj",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7bd49577b581ee1086b335c518da864170f5ae5c | sunlongbo/chromium | tools/android/dependency_analysis/serialization.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | create_json_obj_from_graph | Dict | def create_json_obj_from_graph(graph_obj: graph.Graph) -> Dict:
"""Generates a JSON representation of the current graph.
The list of nodes and edges is sorted in order to help with testing.
Structure:
{
'nodes': [
{ see create_json_obj_from_node }, ...
],
'edges': [
... | Generates a JSON representation of the current graph.
The list of nodes and edges is sorted in order to help with testing.
Structure:
{
'nodes': [
{ see create_json_obj_from_node }, ...
],
'edges': [
{
'begin': str,
'end': str,... | Generates a JSON representation of the current graph.
The list of nodes and edges is sorted in order to help with testing. | [
"Generates",
"a",
"JSON",
"representation",
"of",
"the",
"current",
"graph",
".",
"The",
"list",
"of",
"nodes",
"and",
"edges",
"is",
"sorted",
"in",
"order",
"to",
"help",
"with",
"testing",
"."
] | def create_json_obj_from_graph(graph_obj: graph.Graph) -> Dict:
sorted_nodes = graph.sorted_nodes_by_name(graph_obj.nodes)
json_nodes = [create_json_obj_from_node(node) for node in sorted_nodes]
json_edges = []
for begin_node, end_node in graph.sorted_edges_by_name(graph_obj.edges):
edge_json_ob... | [
"def",
"create_json_obj_from_graph",
"(",
"graph_obj",
":",
"graph",
".",
"Graph",
")",
"->",
"Dict",
":",
"sorted_nodes",
"=",
"graph",
".",
"sorted_nodes_by_name",
"(",
"graph_obj",
".",
"nodes",
")",
"json_nodes",
"=",
"[",
"create_json_obj_from_node",
"(",
"... | Generates a JSON representation of the current graph. | [
"Generates",
"a",
"JSON",
"representation",
"of",
"the",
"current",
"graph",
"."
] | [
"\"\"\"Generates a JSON representation of the current graph.\n\n The list of nodes and edges is sorted in order to help with testing.\n Structure:\n {\n 'nodes': [\n { see create_json_obj_from_node }, ...\n ],\n 'edges': [\n {\n 'begin': str,\n ... | [
{
"param": "graph_obj",
"type": "graph.Graph"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "graph_obj",
"type": "graph.Graph",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7bd49577b581ee1086b335c518da864170f5ae5c | sunlongbo/chromium | tools/android/dependency_analysis/serialization.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | create_class_graph_from_json_obj | class_dependency.JavaClassDependencyGraph | def create_class_graph_from_json_obj(
json_obj: Dict) -> class_dependency.JavaClassDependencyGraph:
"""Creates a JavaClassDependencyGraph from a JSON representation."""
class_graph = class_dependency.JavaClassDependencyGraph()
for node_json_obj in json_obj[json_consts.NODES]:
name = node_js... | Creates a JavaClassDependencyGraph from a JSON representation. | Creates a JavaClassDependencyGraph from a JSON representation. | [
"Creates",
"a",
"JavaClassDependencyGraph",
"from",
"a",
"JSON",
"representation",
"."
] | def create_class_graph_from_json_obj(
json_obj: Dict) -> class_dependency.JavaClassDependencyGraph:
class_graph = class_dependency.JavaClassDependencyGraph()
for node_json_obj in json_obj[json_consts.NODES]:
name = node_json_obj[json_consts.NAME]
nested = node_json_obj[json_consts.META][... | [
"def",
"create_class_graph_from_json_obj",
"(",
"json_obj",
":",
"Dict",
")",
"->",
"class_dependency",
".",
"JavaClassDependencyGraph",
":",
"class_graph",
"=",
"class_dependency",
".",
"JavaClassDependencyGraph",
"(",
")",
"for",
"node_json_obj",
"in",
"json_obj",
"["... | Creates a JavaClassDependencyGraph from a JSON representation. | [
"Creates",
"a",
"JavaClassDependencyGraph",
"from",
"a",
"JSON",
"representation",
"."
] | [
"\"\"\"Creates a JavaClassDependencyGraph from a JSON representation.\"\"\""
] | [
{
"param": "json_obj",
"type": "Dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "json_obj",
"type": "Dict",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7bd49577b581ee1086b335c518da864170f5ae5c | sunlongbo/chromium | tools/android/dependency_analysis/serialization.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | create_build_metadata | Dict | def create_build_metadata() -> Dict:
"""Creates metadata about the build the graph was extracted from.
"""
return {
json_consts.COMMIT_HASH: git_utils.get_last_commit_hash(),
json_consts.COMMIT_CR_POSITION:
git_utils.get_last_commit_cr_position(),
json_consts.COMMIT_TIME: git... | Creates metadata about the build the graph was extracted from.
| Creates metadata about the build the graph was extracted from. | [
"Creates",
"metadata",
"about",
"the",
"build",
"the",
"graph",
"was",
"extracted",
"from",
"."
] | def create_build_metadata() -> Dict:
return {
json_consts.COMMIT_HASH: git_utils.get_last_commit_hash(),
json_consts.COMMIT_CR_POSITION:
git_utils.get_last_commit_cr_position(),
json_consts.COMMIT_TIME: git_utils.get_last_commit_time(),
} | [
"def",
"create_build_metadata",
"(",
")",
"->",
"Dict",
":",
"return",
"{",
"json_consts",
".",
"COMMIT_HASH",
":",
"git_utils",
".",
"get_last_commit_hash",
"(",
")",
",",
"json_consts",
".",
"COMMIT_CR_POSITION",
":",
"git_utils",
".",
"get_last_commit_cr_position... | Creates metadata about the build the graph was extracted from. | [
"Creates",
"metadata",
"about",
"the",
"build",
"the",
"graph",
"was",
"extracted",
"from",
"."
] | [
"\"\"\"Creates metadata about the build the graph was extracted from.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
7bd49577b581ee1086b335c518da864170f5ae5c | sunlongbo/chromium | tools/android/dependency_analysis/serialization.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | dump_class_and_package_graphs_to_file | null | def dump_class_and_package_graphs_to_file(
class_graph: class_dependency.JavaClassDependencyGraph,
package_graph: package_dependency.JavaPackageDependencyGraph,
filename: str):
"""Dumps a JSON representation of the class + package graph to a file.
We dump both graphs together because th... | Dumps a JSON representation of the class + package graph to a file.
We dump both graphs together because the package graph in-memory holds
references to class nodes (for storing class edges comprising
a package edge), and hence the class graph is needed to recreate the
package graph. Since our use case... | Dumps a JSON representation of the class + package graph to a file.
We dump both graphs together because the package graph in-memory holds
references to class nodes (for storing class edges comprising
a package edge), and hence the class graph is needed to recreate the
package graph. Since our use cases always want the... | [
"Dumps",
"a",
"JSON",
"representation",
"of",
"the",
"class",
"+",
"package",
"graph",
"to",
"a",
"file",
".",
"We",
"dump",
"both",
"graphs",
"together",
"because",
"the",
"package",
"graph",
"in",
"-",
"memory",
"holds",
"references",
"to",
"class",
"nod... | def dump_class_and_package_graphs_to_file(
class_graph: class_dependency.JavaClassDependencyGraph,
package_graph: package_dependency.JavaPackageDependencyGraph,
filename: str):
json_obj = {
json_consts.CLASS_GRAPH: create_json_obj_from_graph(class_graph),
json_consts.PACKAGE_... | [
"def",
"dump_class_and_package_graphs_to_file",
"(",
"class_graph",
":",
"class_dependency",
".",
"JavaClassDependencyGraph",
",",
"package_graph",
":",
"package_dependency",
".",
"JavaPackageDependencyGraph",
",",
"filename",
":",
"str",
")",
":",
"json_obj",
"=",
"{",
... | Dumps a JSON representation of the class + package graph to a file. | [
"Dumps",
"a",
"JSON",
"representation",
"of",
"the",
"class",
"+",
"package",
"graph",
"to",
"a",
"file",
"."
] | [
"\"\"\"Dumps a JSON representation of the class + package graph to a file.\n\n We dump both graphs together because the package graph in-memory holds\n references to class nodes (for storing class edges comprising\n a package edge), and hence the class graph is needed to recreate the\n package graph. Si... | [
{
"param": "class_graph",
"type": "class_dependency.JavaClassDependencyGraph"
},
{
"param": "package_graph",
"type": "package_dependency.JavaPackageDependencyGraph"
},
{
"param": "filename",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "class_graph",
"type": "class_dependency.JavaClassDependencyGraph",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "package_graph",
"type": "pa... |
7bd49577b581ee1086b335c518da864170f5ae5c | sunlongbo/chromium | tools/android/dependency_analysis/serialization.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | load_class_graph_from_file | Tuple[class_dependency.JavaClassDependencyGraph, Dict] | def load_class_graph_from_file(
filename: str
) -> Tuple[class_dependency.JavaClassDependencyGraph, Dict]:
"""Recreates a JavaClassDependencyGraph from a JSON file.
The file is expected to be in the format dumped by
`dump_package_graph_to_file`.
"""
with open(filename, 'r') as json_file:
... | Recreates a JavaClassDependencyGraph from a JSON file.
The file is expected to be in the format dumped by
`dump_package_graph_to_file`.
| Recreates a JavaClassDependencyGraph from a JSON file.
The file is expected to be in the format dumped by
`dump_package_graph_to_file`. | [
"Recreates",
"a",
"JavaClassDependencyGraph",
"from",
"a",
"JSON",
"file",
".",
"The",
"file",
"is",
"expected",
"to",
"be",
"in",
"the",
"format",
"dumped",
"by",
"`",
"dump_package_graph_to_file",
"`",
"."
] | def load_class_graph_from_file(
filename: str
) -> Tuple[class_dependency.JavaClassDependencyGraph, Dict]:
with open(filename, 'r') as json_file:
json_obj = json.load(json_file)
class_graph_json_obj = json_obj[json_consts.CLASS_GRAPH]
return create_class_graph_from_json_obj(
... | [
"def",
"load_class_graph_from_file",
"(",
"filename",
":",
"str",
")",
"->",
"Tuple",
"[",
"class_dependency",
".",
"JavaClassDependencyGraph",
",",
"Dict",
"]",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"json_file",
":",
"json_obj",
"=",
... | Recreates a JavaClassDependencyGraph from a JSON file. | [
"Recreates",
"a",
"JavaClassDependencyGraph",
"from",
"a",
"JSON",
"file",
"."
] | [
"\"\"\"Recreates a JavaClassDependencyGraph from a JSON file.\n\n The file is expected to be in the format dumped by\n `dump_package_graph_to_file`.\n \"\"\""
] | [
{
"param": "filename",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7bd49577b581ee1086b335c518da864170f5ae5c | sunlongbo/chromium | tools/android/dependency_analysis/serialization.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | load_class_and_package_graphs_from_file | Tuple[class_dependency.JavaClassDependencyGraph, package_dependency.
JavaPackageDependencyGraph, Dict] | def load_class_and_package_graphs_from_file(
filename: str
) -> Tuple[class_dependency.JavaClassDependencyGraph, package_dependency.
JavaPackageDependencyGraph, Dict]:
"""Recreates a Java(Class+Package)DependencyGraph from a JSON file.
The file is expected to be in the format dumped by
`... | Recreates a Java(Class+Package)DependencyGraph from a JSON file.
The file is expected to be in the format dumped by
`dump_class_and_package_graphs_to_file`.
Note that we construct the package graph from the deserialized class graph,
not using the serialized package graph at all. This aligns with how w... | Recreates a Java(Class+Package)DependencyGraph from a JSON file.
The file is expected to be in the format dumped by
`dump_class_and_package_graphs_to_file`.
Note that we construct the package graph from the deserialized class graph,
not using the serialized package graph at all. This aligns with how we
construct the p... | [
"Recreates",
"a",
"Java",
"(",
"Class",
"+",
"Package",
")",
"DependencyGraph",
"from",
"a",
"JSON",
"file",
".",
"The",
"file",
"is",
"expected",
"to",
"be",
"in",
"the",
"format",
"dumped",
"by",
"`",
"dump_class_and_package_graphs_to_file",
"`",
".",
"Not... | def load_class_and_package_graphs_from_file(
filename: str
) -> Tuple[class_dependency.JavaClassDependencyGraph, package_dependency.
JavaPackageDependencyGraph, Dict]:
class_graph, metadata = load_class_graph_from_file(filename)
package_graph = package_dependency.JavaPackageDependencyGraph(cl... | [
"def",
"load_class_and_package_graphs_from_file",
"(",
"filename",
":",
"str",
")",
"->",
"Tuple",
"[",
"class_dependency",
".",
"JavaClassDependencyGraph",
",",
"package_dependency",
".",
"JavaPackageDependencyGraph",
",",
"Dict",
"]",
":",
"class_graph",
",",
"metadat... | Recreates a Java(Class+Package)DependencyGraph from a JSON file. | [
"Recreates",
"a",
"Java",
"(",
"Class",
"+",
"Package",
")",
"DependencyGraph",
"from",
"a",
"JSON",
"file",
"."
] | [
"\"\"\"Recreates a Java(Class+Package)DependencyGraph from a JSON file.\n\n The file is expected to be in the format dumped by\n `dump_class_and_package_graphs_to_file`.\n\n Note that we construct the package graph from the deserialized class graph,\n not using the serialized package graph at all. This ... | [
{
"param": "filename",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb06b6e76942d8a872de19cc0fe0f01ec486619c | sunlongbo/chromium | third_party/blink/renderer/modules/bluetooth/testing/clusterfuzz/parameter_fuzzer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FuzzParameters | <not_specific> | def FuzzParameters(test_file_data):
"""Fuzzes the data in the string provided.
For now this function only replaces the TRANSFORM_SERVICE_UUID parameter
with a valid UUID string.
Args:
test_file_data: String that contains parameters to be replaced.
Returns:
A string containing the valu... | Fuzzes the data in the string provided.
For now this function only replaces the TRANSFORM_SERVICE_UUID parameter
with a valid UUID string.
Args:
test_file_data: String that contains parameters to be replaced.
Returns:
A string containing the value of test_file_data but with all its
... | Fuzzes the data in the string provided.
For now this function only replaces the TRANSFORM_SERVICE_UUID parameter
with a valid UUID string. | [
"Fuzzes",
"the",
"data",
"in",
"the",
"string",
"provided",
".",
"For",
"now",
"this",
"function",
"only",
"replaces",
"the",
"TRANSFORM_SERVICE_UUID",
"parameter",
"with",
"a",
"valid",
"UUID",
"string",
"."
] | def FuzzParameters(test_file_data):
test_file_data = FillInParameter('TRANSFORM_BASIC_BASE',
constraints.GetBasicBase, test_file_data)
test_file_data = FillInParameter('TRANSFORM_DEVICE_DISCOVERY_BASE',
constraints.GetDeviceDiscoveryBase,... | [
"def",
"FuzzParameters",
"(",
"test_file_data",
")",
":",
"test_file_data",
"=",
"FillInParameter",
"(",
"'TRANSFORM_BASIC_BASE'",
",",
"constraints",
".",
"GetBasicBase",
",",
"test_file_data",
")",
"test_file_data",
"=",
"FillInParameter",
"(",
"'TRANSFORM_DEVICE_DISCOV... | Fuzzes the data in the string provided. | [
"Fuzzes",
"the",
"data",
"in",
"the",
"string",
"provided",
"."
] | [
"\"\"\"Fuzzes the data in the string provided.\n\n For now this function only replaces the TRANSFORM_SERVICE_UUID parameter\n with a valid UUID string.\n\n Args:\n test_file_data: String that contains parameters to be replaced.\n\n Returns:\n A string containing the value of test_file_data but... | [
{
"param": "test_file_data",
"type": null
}
] | {
"returns": [
{
"docstring": "A string containing the value of test_file_data but with all its\nparameters replaced.",
"docstring_tokens": [
"A",
"string",
"containing",
"the",
"value",
"of",
"test_file_data",
"but",
"with",
... |
9af88164b66cb8a718644a9971937b091d2ada45 | sunlongbo/chromium | components/policy/tools/template_writers/template_formatter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetWriter | <not_specific> | def GetWriter(writer_type, config):
'''Returns the template writer for the given writer type.
Args:
writer_type: Writer type, e.g. 'admx'.
config: Writer configuration, see writer_configuration.py.
'''
return eval(writer_type + '_writer.GetWriter(config)') | Returns the template writer for the given writer type.
Args:
writer_type: Writer type, e.g. 'admx'.
config: Writer configuration, see writer_configuration.py.
| Returns the template writer for the given writer type. | [
"Returns",
"the",
"template",
"writer",
"for",
"the",
"given",
"writer",
"type",
"."
] | def GetWriter(writer_type, config):
return eval(writer_type + '_writer.GetWriter(config)') | [
"def",
"GetWriter",
"(",
"writer_type",
",",
"config",
")",
":",
"return",
"eval",
"(",
"writer_type",
"+",
"'_writer.GetWriter(config)'",
")"
] | Returns the template writer for the given writer type. | [
"Returns",
"the",
"template",
"writer",
"for",
"the",
"given",
"writer",
"type",
"."
] | [
"'''Returns the template writer for the given writer type.\n\n Args:\n writer_type: Writer type, e.g. 'admx'.\n config: Writer configuration, see writer_configuration.py.\n '''"
] | [
{
"param": "writer_type",
"type": null
},
{
"param": "config",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "writer_type",
"type": null,
"docstring": "Writer type, e.g.",
"docstring_tokens": [
"Writer",
"type",
"e",
".",
"g",
"."
],
"default": null,
"is_optional": null... |
9af88164b66cb8a718644a9971937b091d2ada45 | sunlongbo/chromium | components/policy/tools/template_writers/template_formatter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetWriterConfiguration | <not_specific> | def _GetWriterConfiguration(grit_defines):
'''Returns the writer configuration based on grit defines.
Args:
grit_defines: Array of grit defines, see grit_rule.gni.
'''
# Build a dictionary from grit defines, which can be plain DEFs or KEY=VALUEs.
grit_defines_dict = {}
for define in grit_defines:
p... | Returns the writer configuration based on grit defines.
Args:
grit_defines: Array of grit defines, see grit_rule.gni.
| Returns the writer configuration based on grit defines. | [
"Returns",
"the",
"writer",
"configuration",
"based",
"on",
"grit",
"defines",
"."
] | def _GetWriterConfiguration(grit_defines):
grit_defines_dict = {}
for define in grit_defines:
parts = define.split('=', 1)
grit_defines_dict[parts[0]] = parts[1] if len(parts) > 1 else 1
return writer_configuration.GetConfigurationForBuild(grit_defines_dict) | [
"def",
"_GetWriterConfiguration",
"(",
"grit_defines",
")",
":",
"grit_defines_dict",
"=",
"{",
"}",
"for",
"define",
"in",
"grit_defines",
":",
"parts",
"=",
"define",
".",
"split",
"(",
"'='",
",",
"1",
")",
"grit_defines_dict",
"[",
"parts",
"[",
"0",
"... | Returns the writer configuration based on grit defines. | [
"Returns",
"the",
"writer",
"configuration",
"based",
"on",
"grit",
"defines",
"."
] | [
"'''Returns the writer configuration based on grit defines.\n\n Args:\n grit_defines: Array of grit defines, see grit_rule.gni.\n '''",
"# Build a dictionary from grit defines, which can be plain DEFs or KEY=VALUEs."
] | [
{
"param": "grit_defines",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "grit_defines",
"type": null,
"docstring": "Array of grit defines, see grit_rule.gni.",
"docstring_tokens": [
"Array",
"of",
"grit",
"defines",
"see",
"grit_rule",
".",
... |
9af88164b66cb8a718644a9971937b091d2ada45 | sunlongbo/chromium | components/policy/tools/template_writers/template_formatter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ParseVersionFile | <not_specific> | def _ParseVersionFile(version_path):
'''Parse version file, return the version if it exists.
Args:
version_path: The path of Chrome VERSION file containing the major version
number.
'''
version = {}
with open(version_path) as fp:
for line in fp:
key, _, value = line.partition(... | Parse version file, return the version if it exists.
Args:
version_path: The path of Chrome VERSION file containing the major version
number.
| Parse version file, return the version if it exists. | [
"Parse",
"version",
"file",
"return",
"the",
"version",
"if",
"it",
"exists",
"."
] | def _ParseVersionFile(version_path):
version = {}
with open(version_path) as fp:
for line in fp:
key, _, value = line.partition('=')
if key.strip() == 'MAJOR':
version['major'] = value.strip()
elif key.strip() == 'MINOR':
version['minor'] = value.strip()
elif key.strip() ... | [
"def",
"_ParseVersionFile",
"(",
"version_path",
")",
":",
"version",
"=",
"{",
"}",
"with",
"open",
"(",
"version_path",
")",
"as",
"fp",
":",
"for",
"line",
"in",
"fp",
":",
"key",
",",
"_",
",",
"value",
"=",
"line",
".",
"partition",
"(",
"'='",
... | Parse version file, return the version if it exists. | [
"Parse",
"version",
"file",
"return",
"the",
"version",
"if",
"it",
"exists",
"."
] | [
"'''Parse version file, return the version if it exists.\n\n Args:\n version_path: The path of Chrome VERSION file containing the major version\n number.\n '''"
] | [
{
"param": "version_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "version_path",
"type": null,
"docstring": "The path of Chrome VERSION file containing the major version\nnumber.",
"docstring_tokens": [
"The",
"path",
"of",
"Chrome",
"VERSION",
... |
325e0587732b4deaba1a4e0f3529b3c5d6ca6a7e | sunlongbo/chromium | ios/web_view/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckAbsolutePathInclusionInPublicHeaders | <not_specific> | def _CheckAbsolutePathInclusionInPublicHeaders(input_api, output_api):
"""Checks if all affected headers under //ios/web_view/public only include
the headers in the same directory by using relative path inclusions.
Because only these headers will be exported to the client side code,
and path above pub... | Checks if all affected headers under //ios/web_view/public only include
the headers in the same directory by using relative path inclusions.
Because only these headers will be exported to the client side code,
and path above public/ will be changed, the clients will not find the
headers that are no... | Checks if all affected headers under //ios/web_view/public only include
the headers in the same directory by using relative path inclusions.
Because only these headers will be exported to the client side code,
and path above public/ will be changed, the clients will not find the
headers that are not in that public dir... | [
"Checks",
"if",
"all",
"affected",
"headers",
"under",
"//",
"ios",
"/",
"web_view",
"/",
"public",
"only",
"include",
"the",
"headers",
"in",
"the",
"same",
"directory",
"by",
"using",
"relative",
"path",
"inclusions",
".",
"Because",
"only",
"these",
"head... | def _CheckAbsolutePathInclusionInPublicHeaders(input_api, output_api):
error_items = []
normpath = os.path.normpath
public_dir = normpath('%s/public/' % input_api.PresubmitLocalPath())
files_under_public_dir = list(filter(
lambda f: normpath(f.AbsoluteLocalPath()).startswith(public_dir),
input_api.cha... | [
"def",
"_CheckAbsolutePathInclusionInPublicHeaders",
"(",
"input_api",
",",
"output_api",
")",
":",
"error_items",
"=",
"[",
"]",
"normpath",
"=",
"os",
".",
"path",
".",
"normpath",
"public_dir",
"=",
"normpath",
"(",
"'%s/public/'",
"%",
"input_api",
".",
"Pre... | Checks if all affected headers under //ios/web_view/public only include
the headers in the same directory by using relative path inclusions. | [
"Checks",
"if",
"all",
"affected",
"headers",
"under",
"//",
"ios",
"/",
"web_view",
"/",
"public",
"only",
"include",
"the",
"headers",
"in",
"the",
"same",
"directory",
"by",
"using",
"relative",
"path",
"inclusions",
"."
] | [
"\"\"\"Checks if all affected headers under //ios/web_view/public only include\n the headers in the same directory by using relative path inclusions.\n\n Because only these headers will be exported to the client side code,\n and path above public/ will be changed, the clients will not find the\n hea... | [
{
"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... |
22eb46f00541313ef6d54d8fa72d252677eca561 | sunlongbo/chromium | ui/resources/resource_check/ico_files.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunChecks | <not_specific> | def RunChecks(self):
"""Verifies the correctness of the ICO files.
Returns:
An array of presubmit errors if any ICO files were broken in some way.
"""
results = []
affected_files = self.input_api.AffectedFiles(include_deletes=False)
for f in affected_files:
path = f.LocalPath()
... | Verifies the correctness of the ICO files.
Returns:
An array of presubmit errors if any ICO files were broken in some way.
| Verifies the correctness of the ICO files. | [
"Verifies",
"the",
"correctness",
"of",
"the",
"ICO",
"files",
"."
] | def RunChecks(self):
results = []
affected_files = self.input_api.AffectedFiles(include_deletes=False)
for f in affected_files:
path = f.LocalPath()
if os.path.splitext(path)[1].lower() != '.ico':
continue
import ico_tools
repository_path = self.input_api.change.RepositoryRoo... | [
"def",
"RunChecks",
"(",
"self",
")",
":",
"results",
"=",
"[",
"]",
"affected_files",
"=",
"self",
".",
"input_api",
".",
"AffectedFiles",
"(",
"include_deletes",
"=",
"False",
")",
"for",
"f",
"in",
"affected_files",
":",
"path",
"=",
"f",
".",
"LocalP... | Verifies the correctness of the ICO files. | [
"Verifies",
"the",
"correctness",
"of",
"the",
"ICO",
"files",
"."
] | [
"\"\"\"Verifies the correctness of the ICO files.\n\n Returns:\n An array of presubmit errors if any ICO files were broken in some way.\n \"\"\"",
"# Import this module from here (to avoid importing it in the highly common",
"# case where there are no ICO files being changed)."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "An array of presubmit errors if any ICO files were broken in some way.",
"docstring_tokens": [
"An",
"array",
"of",
"presubmit",
"errors",
"if",
"any",
"ICO",
"files",
"were",
"broken... |
3cab84d245f65b0090ca94935f275bc2806fbcb3 | sunlongbo/chromium | tools/perf/core/results_processor/compute_metrics.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ComputeTBMv2Metrics | <not_specific> | def ComputeTBMv2Metrics(test_result):
"""Compute metrics on aggregated traces in parallel.
For each test run that has an aggregate trace and some TBMv2 metrics listed
in its tags, compute the metrics and return the list of all resulting
histograms.
"""
artifacts = test_result.get('outputArtifacts', {})
... | Compute metrics on aggregated traces in parallel.
For each test run that has an aggregate trace and some TBMv2 metrics listed
in its tags, compute the metrics and return the list of all resulting
histograms.
| Compute metrics on aggregated traces in parallel.
For each test run that has an aggregate trace and some TBMv2 metrics listed
in its tags, compute the metrics and return the list of all resulting
histograms. | [
"Compute",
"metrics",
"on",
"aggregated",
"traces",
"in",
"parallel",
".",
"For",
"each",
"test",
"run",
"that",
"has",
"an",
"aggregate",
"trace",
"and",
"some",
"TBMv2",
"metrics",
"listed",
"in",
"its",
"tags",
"compute",
"the",
"metrics",
"and",
"return"... | def ComputeTBMv2Metrics(test_result):
artifacts = test_result.get('outputArtifacts', {})
if test_result['status'] == 'SKIP':
return
metrics = [tag['value'] for tag in test_result.get('tags', [])
if tag['key'] == 'tbmv2']
if not metrics:
logging.debug('%s: No TBMv2 metrics specified.', test_... | [
"def",
"ComputeTBMv2Metrics",
"(",
"test_result",
")",
":",
"artifacts",
"=",
"test_result",
".",
"get",
"(",
"'outputArtifacts'",
",",
"{",
"}",
")",
"if",
"test_result",
"[",
"'status'",
"]",
"==",
"'SKIP'",
":",
"return",
"metrics",
"=",
"[",
"tag",
"["... | Compute metrics on aggregated traces in parallel. | [
"Compute",
"metrics",
"on",
"aggregated",
"traces",
"in",
"parallel",
"."
] | [
"\"\"\"Compute metrics on aggregated traces in parallel.\n\n For each test run that has an aggregate trace and some TBMv2 metrics listed\n in its tags, compute the metrics and return the list of all resulting\n histograms.\n \"\"\"",
"# Bails out on traces that are too big. See crbug.com/812631 for more",
"... | [
{
"param": "test_result",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "test_result",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d597f7121befe68034ac32ae1ade6896134418c7 | sunlongbo/chromium | ppapi/generators/idl_c_header.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckTypedefs | null | def CheckTypedefs(filenode, releases):
"""Checks that typedefs don't specify callbacks that take some structs.
See http://crbug.com/233439 for details.
"""
cgen = CGen()
for node in filenode.GetListOf('Typedef'):
build_list = node.GetUniqueReleases(releases)
callnode = node.GetOneOf('Callspec')
i... | Checks that typedefs don't specify callbacks that take some structs.
See http://crbug.com/233439 for details.
| Checks that typedefs don't specify callbacks that take some structs. | [
"Checks",
"that",
"typedefs",
"don",
"'",
"t",
"specify",
"callbacks",
"that",
"take",
"some",
"structs",
"."
] | def CheckTypedefs(filenode, releases):
cgen = CGen()
for node in filenode.GetListOf('Typedef'):
build_list = node.GetUniqueReleases(releases)
callnode = node.GetOneOf('Callspec')
if callnode:
for param in callnode.GetListOf('Param'):
if param.GetListOf('Array'):
continue
... | [
"def",
"CheckTypedefs",
"(",
"filenode",
",",
"releases",
")",
":",
"cgen",
"=",
"CGen",
"(",
")",
"for",
"node",
"in",
"filenode",
".",
"GetListOf",
"(",
"'Typedef'",
")",
":",
"build_list",
"=",
"node",
".",
"GetUniqueReleases",
"(",
"releases",
")",
"... | Checks that typedefs don't specify callbacks that take some structs. | [
"Checks",
"that",
"typedefs",
"don",
"'",
"t",
"specify",
"callbacks",
"that",
"take",
"some",
"structs",
"."
] | [
"\"\"\"Checks that typedefs don't specify callbacks that take some structs.\n\n See http://crbug.com/233439 for details.\n \"\"\""
] | [
{
"param": "filenode",
"type": null
},
{
"param": "releases",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filenode",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "releases",
"type": null,
"docstring": null,
"docstring_to... |
d597f7121befe68034ac32ae1ade6896134418c7 | sunlongbo/chromium | ppapi/generators/idl_c_header.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckPassByValue | null | def CheckPassByValue(filenode, releases):
"""Checks that new pass-by-value structs are not introduced.
See http://crbug.com/233439 for details.
"""
cgen = CGen()
# DO NOT add any more entries to this whitelist.
# http://crbug.com/233439
type_whitelist = ['PP_ArrayOutput', 'PP_CompletionCallback',
... | Checks that new pass-by-value structs are not introduced.
See http://crbug.com/233439 for details.
| Checks that new pass-by-value structs are not introduced. | [
"Checks",
"that",
"new",
"pass",
"-",
"by",
"-",
"value",
"structs",
"are",
"not",
"introduced",
"."
] | def CheckPassByValue(filenode, releases):
cgen = CGen()
type_whitelist = ['PP_ArrayOutput', 'PP_CompletionCallback',
'PP_Ext_EventListener', 'PP_FloatPoint',
'PP_Point', 'PP_TouchPoint', 'PP_Var']
nodes_to_check = filenode.GetListOf('Struct')
nodes_to_check.extend(filenod... | [
"def",
"CheckPassByValue",
"(",
"filenode",
",",
"releases",
")",
":",
"cgen",
"=",
"CGen",
"(",
")",
"type_whitelist",
"=",
"[",
"'PP_ArrayOutput'",
",",
"'PP_CompletionCallback'",
",",
"'PP_Ext_EventListener'",
",",
"'PP_FloatPoint'",
",",
"'PP_Point'",
",",
"'P... | Checks that new pass-by-value structs are not introduced. | [
"Checks",
"that",
"new",
"pass",
"-",
"by",
"-",
"value",
"structs",
"are",
"not",
"introduced",
"."
] | [
"\"\"\"Checks that new pass-by-value structs are not introduced.\n\n See http://crbug.com/233439 for details.\n \"\"\"",
"# DO NOT add any more entries to this whitelist.",
"# http://crbug.com/233439"
] | [
{
"param": "filenode",
"type": null
},
{
"param": "releases",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filenode",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "releases",
"type": null,
"docstring": null,
"docstring_to... |
99b13be681b0d68ea2be3785090757c9b82ebb3e | sunlongbo/chromium | tools/metrics/ukm/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckChange | <not_specific> | def CheckChange(input_api, output_api):
"""Checks that ukm.xml is pretty-printed and well-formatted."""
for f in input_api.AffectedTextFiles():
p = f.AbsoluteLocalPath()
if (input_api.basename(p) == UKM_XML
and input_api.os_path.dirname(p) == input_api.PresubmitLocalPath()):
cwd = input_api.os... | Checks that ukm.xml is pretty-printed and well-formatted. | Checks that ukm.xml is pretty-printed and well-formatted. | [
"Checks",
"that",
"ukm",
".",
"xml",
"is",
"pretty",
"-",
"printed",
"and",
"well",
"-",
"formatted",
"."
] | def CheckChange(input_api, output_api):
for f in input_api.AffectedTextFiles():
p = f.AbsoluteLocalPath()
if (input_api.basename(p) == UKM_XML
and input_api.os_path.dirname(p) == input_api.PresubmitLocalPath()):
cwd = input_api.os_path.dirname(p)
exit_code = input_api.subprocess.call(
... | [
"def",
"CheckChange",
"(",
"input_api",
",",
"output_api",
")",
":",
"for",
"f",
"in",
"input_api",
".",
"AffectedTextFiles",
"(",
")",
":",
"p",
"=",
"f",
".",
"AbsoluteLocalPath",
"(",
")",
"if",
"(",
"input_api",
".",
"basename",
"(",
"p",
")",
"=="... | Checks that ukm.xml is pretty-printed and well-formatted. | [
"Checks",
"that",
"ukm",
".",
"xml",
"is",
"pretty",
"-",
"printed",
"and",
"well",
"-",
"formatted",
"."
] | [
"\"\"\"Checks that ukm.xml is pretty-printed and well-formatted.\"\"\""
] | [
{
"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... |
99d2f03ba9bc9e2eb0a97485510b384ca8838ae1 | sunlongbo/chromium | native_client_sdk/src/tools/lib/get_shared_deps.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GleanFromObjdump | <not_specific> | def GleanFromObjdump(files, arch, objdump, lib_path):
'''Get architecture and dependency information for given files
Args:
files: A list of files to examine.
[ '/path/to/my.nexe',
'/path/to/lib64/libmy.so',
'/path/to/mydata.so',
'/path/to/my.data' ]
arch: The architecu... | Get architecture and dependency information for given files
Args:
files: A list of files to examine.
[ '/path/to/my.nexe',
'/path/to/lib64/libmy.so',
'/path/to/mydata.so',
'/path/to/my.data' ]
arch: The architecure we are looking for, or None to accept any
arch... | Get architecture and dependency information for given files | [
"Get",
"architecture",
"and",
"dependency",
"information",
"for",
"given",
"files"
] | def GleanFromObjdump(files, arch, objdump, lib_path):
if not objdump:
raise NoObjdumpError('No objdump executable found!')
full_paths = set()
for filename in files:
if os.path.exists(filename):
full_paths.add(filename)
else:
for path in _FindLibsInPath(filename, lib_path):
full_pat... | [
"def",
"GleanFromObjdump",
"(",
"files",
",",
"arch",
",",
"objdump",
",",
"lib_path",
")",
":",
"if",
"not",
"objdump",
":",
"raise",
"NoObjdumpError",
"(",
"'No objdump executable found!'",
")",
"full_paths",
"=",
"set",
"(",
")",
"for",
"filename",
"in",
... | Get architecture and dependency information for given files | [
"Get",
"architecture",
"and",
"dependency",
"information",
"for",
"given",
"files"
] | [
"'''Get architecture and dependency information for given files\n\n Args:\n files: A list of files to examine.\n [ '/path/to/my.nexe',\n '/path/to/lib64/libmy.so',\n '/path/to/mydata.so',\n '/path/to/my.data' ]\n arch: The architecure we are looking for, or None to accept an... | [
{
"param": "files",
"type": null
},
{
"param": "arch",
"type": null
},
{
"param": "objdump",
"type": null
},
{
"param": "lib_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "files",
"type": null,
"docstring": "A list of files to examine.",
"docstring_tokens": [
"A",
"list",
"of",
"files",
"to",
"examine",
"."
],
"default": null,
... |
99de229fd6b1cf57a9d6356f23d29f8b98a76c44 | sunlongbo/chromium | tools/memory/partition_allocator/trace_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetAllocatorDumps | list | def _GetAllocatorDumps(trace: dict) -> list:
"""Takes in a trace (as returned from |LoadTrace|), and returns the parts
of it related to the allocators.
Args:
trace: Trace content as returned by LoadTrace.
Returns:
The parts of the trace related to allocator metrics. Note that these
entries are tak... | Takes in a trace (as returned from |LoadTrace|), and returns the parts
of it related to the allocators.
Args:
trace: Trace content as returned by LoadTrace.
Returns:
The parts of the trace related to allocator metrics. Note that these
entries are taken as-is from the trace.
Each entry of the re... | Takes in a trace (as returned from |LoadTrace|), and returns the parts
of it related to the allocators. | [
"Takes",
"in",
"a",
"trace",
"(",
"as",
"returned",
"from",
"|LoadTrace|",
")",
"and",
"returns",
"the",
"parts",
"of",
"it",
"related",
"to",
"the",
"allocators",
"."
] | def _GetAllocatorDumps(trace: dict) -> list:
events = trace['traceEvents']
memory_infra_events = [
e for e in events if e['cat'] == 'disabled-by-default-memory-infra'
]
dumps = [
e for e in memory_infra_events
if e['name'] == 'periodic_interval' and e['args']['dumps']
['level_of_detail']... | [
"def",
"_GetAllocatorDumps",
"(",
"trace",
":",
"dict",
")",
"->",
"list",
":",
"events",
"=",
"trace",
"[",
"'traceEvents'",
"]",
"memory_infra_events",
"=",
"[",
"e",
"for",
"e",
"in",
"events",
"if",
"e",
"[",
"'cat'",
"]",
"==",
"'disabled-by-default-m... | Takes in a trace (as returned from |LoadTrace|), and returns the parts
of it related to the allocators. | [
"Takes",
"in",
"a",
"trace",
"(",
"as",
"returned",
"from",
"|LoadTrace|",
")",
"and",
"returns",
"the",
"parts",
"of",
"it",
"related",
"to",
"the",
"allocators",
"."
] | [
"\"\"\"Takes in a trace (as returned from |LoadTrace|), and returns the parts\n of it related to the allocators.\n\n Args:\n trace: Trace content as returned by LoadTrace.\n\n Returns:\n The parts of the trace related to allocator metrics. Note that these\n entries are taken as-is from the trace.\n\n ... | [
{
"param": "trace",
"type": "dict"
}
] | {
"returns": [
{
"docstring": "The parts of the trace related to allocator metrics. Note that these\nentries are taken as-is from the trace.\n\nEach entry of the return value has\nthe following format. The important field here is 'args', but there are\nother unimportant ones as well (shown with ...):\n{\n'a... |
99de229fd6b1cf57a9d6356f23d29f8b98a76c44 | sunlongbo/chromium | tools/memory/partition_allocator/trace_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ProcessNamesAndLabels | (dict, dict) | def _ProcessNamesAndLabels(trace: dict) -> (dict, dict):
"""Get mappings of pid to name and pid to label.
Args:
trace: Trace content as returned by LoadTrace.
Returns:
A tuple containing two dicts. The first maps pids to names, the second maps
pids to labels.
"""
# Process names and labels.
pi... | Get mappings of pid to name and pid to label.
Args:
trace: Trace content as returned by LoadTrace.
Returns:
A tuple containing two dicts. The first maps pids to names, the second maps
pids to labels.
| Get mappings of pid to name and pid to label. | [
"Get",
"mappings",
"of",
"pid",
"to",
"name",
"and",
"pid",
"to",
"label",
"."
] | def _ProcessNamesAndLabels(trace: dict) -> (dict, dict):
pid_to_name = {}
pid_to_labels = {}
metadata_events = [
e for e in trace['traceEvents'] if e['cat'] == '__metadata'
]
process_name_events = [
e for e in metadata_events if e['name'] == 'process_name'
]
for e in process_name_events:
p... | [
"def",
"_ProcessNamesAndLabels",
"(",
"trace",
":",
"dict",
")",
"->",
"(",
"dict",
",",
"dict",
")",
":",
"pid_to_name",
"=",
"{",
"}",
"pid_to_labels",
"=",
"{",
"}",
"metadata_events",
"=",
"[",
"e",
"for",
"e",
"in",
"trace",
"[",
"'traceEvents'",
... | Get mappings of pid to name and pid to label. | [
"Get",
"mappings",
"of",
"pid",
"to",
"name",
"and",
"pid",
"to",
"label",
"."
] | [
"\"\"\"Get mappings of pid to name and pid to label.\n\n Args:\n trace: Trace content as returned by LoadTrace.\n\n Returns:\n A tuple containing two dicts. The first maps pids to names, the second maps\n pids to labels.\n \"\"\"",
"# Process names and labels."
] | [
{
"param": "trace",
"type": "dict"
}
] | {
"returns": [
{
"docstring": "A tuple containing two dicts. The first maps pids to names, the second maps\npids to labels.",
"docstring_tokens": [
"A",
"tuple",
"containing",
"two",
"dicts",
".",
"The",
"first",
"maps",
"... |
99de229fd6b1cf57a9d6356f23d29f8b98a76c44 | sunlongbo/chromium | tools/memory/partition_allocator/trace_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParseTrace | dict[int, dict] | def ParseTrace(trace: dict,
compute_result: Callable[[dict, dict], None]) -> dict[int, dict]:
"""Parses a trace, and returns thread cache stats.
Args:
trace: As returned by LoadTrace()
compute_result: function taking |result_for_pid| (which it modifies
in-place), and |allocators|. It s... | Parses a trace, and returns thread cache stats.
Args:
trace: As returned by LoadTrace()
compute_result: function taking |result_for_pid| (which it modifies
in-place), and |allocators|. It should add any results we'd like to graph
into |result_for_pid['data']|, as an |np.array|.
Returns:
{p... | Parses a trace, and returns thread cache stats. | [
"Parses",
"a",
"trace",
"and",
"returns",
"thread",
"cache",
"stats",
"."
] | def ParseTrace(trace: dict,
compute_result: Callable[[dict, dict], None]) -> dict[int, dict]:
dumps = _GetAllocatorDumps(trace)
pid_to_name, pid_to_labels = _ProcessNamesAndLabels(trace)
result = {}
for dump in dumps:
pid = dump['pid']
allocators = dump['args']['dumps']['allocators']
... | [
"def",
"ParseTrace",
"(",
"trace",
":",
"dict",
",",
"compute_result",
":",
"Callable",
"[",
"[",
"dict",
",",
"dict",
"]",
",",
"None",
"]",
")",
"->",
"dict",
"[",
"int",
",",
"dict",
"]",
":",
"dumps",
"=",
"_GetAllocatorDumps",
"(",
"trace",
")",... | Parses a trace, and returns thread cache stats. | [
"Parses",
"a",
"trace",
"and",
"returns",
"thread",
"cache",
"stats",
"."
] | [
"\"\"\"Parses a trace, and returns thread cache stats.\n\n Args:\n trace: As returned by LoadTrace()\n compute_result: function taking |result_for_pid| (which it modifies\n in-place), and |allocators|. It should add any results we'd like to graph\n into |result_for_pid['data']|, as an |np.array|.\n... | [
{
"param": "trace",
"type": "dict"
},
{
"param": "compute_result",
"type": "Callable[[dict, dict], None]"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "trace",
"type": "dict",
"docstring": "As returned by LoadTrace()",
"docstring_tokens": [
"As",
"ret... |
99de229fd6b1cf57a9d6356f23d29f8b98a76c44 | sunlongbo/chromium | tools/memory/partition_allocator/trace_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PlotProcessFragmentation | null | def PlotProcessFragmentation(title, data, output):
"""Plots the Fragmentation vs size for a single process.
Args:
title: Title of the graph
data: Data to plot. Should contain 'size' and 'fragmentation' entries.
output: Filename to save the result to.
"""
plt.figure(figsize=(16, 8))
plt.title(titl... | Plots the Fragmentation vs size for a single process.
Args:
title: Title of the graph
data: Data to plot. Should contain 'size' and 'fragmentation' entries.
output: Filename to save the result to.
| Plots the Fragmentation vs size for a single process. | [
"Plots",
"the",
"Fragmentation",
"vs",
"size",
"for",
"a",
"single",
"process",
"."
] | def PlotProcessFragmentation(title, data, output):
plt.figure(figsize=(16, 8))
plt.title(title)
plt.stem(data['data']['size'], data['data']['fragmentation'])
plt.xscale('log', base=2)
plt.yscale('linear')
plt.ylim(ymin=0, ymax=100)
plt.xlabel('Size (log)')
plt.ylabel('Fragmentation (%)')
plt.savefig(o... | [
"def",
"PlotProcessFragmentation",
"(",
"title",
",",
"data",
",",
"output",
")",
":",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"(",
"16",
",",
"8",
")",
")",
"plt",
".",
"title",
"(",
"title",
")",
"plt",
".",
"stem",
"(",
"data",
"[",
"'data'",... | Plots the Fragmentation vs size for a single process. | [
"Plots",
"the",
"Fragmentation",
"vs",
"size",
"for",
"a",
"single",
"process",
"."
] | [
"\"\"\"Plots the Fragmentation vs size for a single process.\n\n Args:\n title: Title of the graph\n data: Data to plot. Should contain 'size' and 'fragmentation' entries.\n output: Filename to save the result to.\n \"\"\""
] | [
{
"param": "title",
"type": null
},
{
"param": "data",
"type": null
},
{
"param": "output",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "title",
"type": null,
"docstring": "Title of the graph",
"docstring_tokens": [
"Title",
"of",
"the",
"graph"
],
"default": null,
"is_optional": null
},
{
"identif... |
99de229fd6b1cf57a9d6356f23d29f8b98a76c44 | sunlongbo/chromium | tools/memory/partition_allocator/trace_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PlotProcessWaste | null | def PlotProcessWaste(title, data, output):
"""Plots the Unused memory vs size for a single process.
Args:
title: Title of the graph
data: Data to plot. Should contain 'size' and 'unused' entries.
output: Filename to save the result to.
"""
plt.figure(figsize=(16, 8))
plt.title(title)
plt.xscale... | Plots the Unused memory vs size for a single process.
Args:
title: Title of the graph
data: Data to plot. Should contain 'size' and 'unused' entries.
output: Filename to save the result to.
| Plots the Unused memory vs size for a single process. | [
"Plots",
"the",
"Unused",
"memory",
"vs",
"size",
"for",
"a",
"single",
"process",
"."
] | def PlotProcessWaste(title, data, output):
plt.figure(figsize=(16, 8))
plt.title(title)
plt.xscale('log', base=2)
plt.yscale('log', base=2)
plt.stem(data['data']['size'][data['data']['unused'] != 0],
data['data']['unused'][data['data']['unused'] != 0])
plt.ylim(ymin=1, ymax=2**20)
plt.xlabel('S... | [
"def",
"PlotProcessWaste",
"(",
"title",
",",
"data",
",",
"output",
")",
":",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"(",
"16",
",",
"8",
")",
")",
"plt",
".",
"title",
"(",
"title",
")",
"plt",
".",
"xscale",
"(",
"'log'",
",",
"base",
"=",... | Plots the Unused memory vs size for a single process. | [
"Plots",
"the",
"Unused",
"memory",
"vs",
"size",
"for",
"a",
"single",
"process",
"."
] | [
"\"\"\"Plots the Unused memory vs size for a single process.\n\n Args:\n title: Title of the graph\n data: Data to plot. Should contain 'size' and 'unused' entries.\n output: Filename to save the result to.\n \"\"\""
] | [
{
"param": "title",
"type": null
},
{
"param": "data",
"type": null
},
{
"param": "output",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "title",
"type": null,
"docstring": "Title of the graph",
"docstring_tokens": [
"Title",
"of",
"the",
"graph"
],
"default": null,
"is_optional": null
},
{
"identif... |
842fce5f9bf4703e78315dc99ac2fb079937f550 | sunlongbo/chromium | chrome/browser/resources/chromeos/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(_CheckSemanticCssColors(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(_CheckSemanticCssColors(input_api, output_api))
return results | [
"def",
"_CommonChecks",
"(",
"input_api",
",",
"output_api",
")",
":",
"results",
"=",
"[",
"]",
"results",
".",
"extend",
"(",
"_CheckSemanticCssColors",
"(",
"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.\"\"\""
] | [
{
"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... |
34a5639e4a53d270880315baefb393d17bd45df1 | sunlongbo/chromium | tools/android/dependency_analysis/upload_html_viewer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckFirebaseCLI | null | def _CheckFirebaseCLI():
"""Fail with a proper error message, if Firebase CLI is not installed."""
if subprocess.call(['firebase', '--version'],
stdout=subprocess.DEVNULL) != 0:
link = 'https://firebase.google.com/docs/cli#install_the_firebase_cli'
raise Exception(
... | Fail with a proper error message, if Firebase CLI is not installed. | Fail with a proper error message, if Firebase CLI is not installed. | [
"Fail",
"with",
"a",
"proper",
"error",
"message",
"if",
"Firebase",
"CLI",
"is",
"not",
"installed",
"."
] | def _CheckFirebaseCLI():
if subprocess.call(['firebase', '--version'],
stdout=subprocess.DEVNULL) != 0:
link = 'https://firebase.google.com/docs/cli#install_the_firebase_cli'
raise Exception(
'Firebase CLI not installed or not on your PATH. Follow '
'th... | [
"def",
"_CheckFirebaseCLI",
"(",
")",
":",
"if",
"subprocess",
".",
"call",
"(",
"[",
"'firebase'",
",",
"'--version'",
"]",
",",
"stdout",
"=",
"subprocess",
".",
"DEVNULL",
")",
"!=",
"0",
":",
"link",
"=",
"'https://firebase.google.com/docs/cli#install_the_fi... | Fail with a proper error message, if Firebase CLI is not installed. | [
"Fail",
"with",
"a",
"proper",
"error",
"message",
"if",
"Firebase",
"CLI",
"is",
"not",
"installed",
"."
] | [
"\"\"\"Fail with a proper error message, if Firebase CLI is not installed.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
34a5639e4a53d270880315baefb393d17bd45df1 | sunlongbo/chromium | tools/android/dependency_analysis/upload_html_viewer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckNPM | null | def _CheckNPM():
"""Fail with a proper error message, if npm is not installed."""
if subprocess.call(['npm', '--version'], stdout=subprocess.DEVNULL) != 0:
link = 'https://nodejs.org'
raise Exception(
'npm not installed or not on your PATH. Either install Node.js '
'throu... | Fail with a proper error message, if npm is not installed. | Fail with a proper error message, if npm is not installed. | [
"Fail",
"with",
"a",
"proper",
"error",
"message",
"if",
"npm",
"is",
"not",
"installed",
"."
] | def _CheckNPM():
if subprocess.call(['npm', '--version'], stdout=subprocess.DEVNULL) != 0:
link = 'https://nodejs.org'
raise Exception(
'npm not installed or not on your PATH. Either install Node.js '
'through your package manager or download it from ' + link + '.') | [
"def",
"_CheckNPM",
"(",
")",
":",
"if",
"subprocess",
".",
"call",
"(",
"[",
"'npm'",
",",
"'--version'",
"]",
",",
"stdout",
"=",
"subprocess",
".",
"DEVNULL",
")",
"!=",
"0",
":",
"link",
"=",
"'https://nodejs.org'",
"raise",
"Exception",
"(",
"'npm n... | Fail with a proper error message, if npm is not installed. | [
"Fail",
"with",
"a",
"proper",
"error",
"message",
"if",
"npm",
"is",
"not",
"installed",
"."
] | [
"\"\"\"Fail with a proper error message, if npm is not installed.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
34a5639e4a53d270880315baefb393d17bd45df1 | sunlongbo/chromium | tools/android/dependency_analysis/upload_html_viewer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _FirebaseInitProjectDir | <not_specific> | def _FirebaseInitProjectDir(project_dir):
"""Create a firebase.json file that is needed for deployment."""
project_static_dir = project_dir / 'public'
with open(project_dir / 'firebase.json', 'w') as f:
f.write("""
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
... | Create a firebase.json file that is needed for deployment. | Create a firebase.json file that is needed for deployment. | [
"Create",
"a",
"firebase",
".",
"json",
"file",
"that",
"is",
"needed",
"for",
"deployment",
"."
] | def _FirebaseInitProjectDir(project_dir):
project_static_dir = project_dir / 'public'
with open(project_dir / 'firebase.json', 'w') as f:
f.write("""
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/README*",
"**/.*"
]
}
}
""")
return project_stat... | [
"def",
"_FirebaseInitProjectDir",
"(",
"project_dir",
")",
":",
"project_static_dir",
"=",
"project_dir",
"/",
"'public'",
"with",
"open",
"(",
"project_dir",
"/",
"'firebase.json'",
",",
"'w'",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"\"\"\"\n{\n \"hostin... | Create a firebase.json file that is needed for deployment. | [
"Create",
"a",
"firebase",
".",
"json",
"file",
"that",
"is",
"needed",
"for",
"deployment",
"."
] | [
"\"\"\"Create a firebase.json file that is needed for deployment.\"\"\""
] | [
{
"param": "project_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "project_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7c20a5a8e7822f382637b3fcfd363b612704cfc5 | sunlongbo/chromium | components/policy/tools/template_writers/writers/adm_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetWriter | <not_specific> | def GetWriter(config):
'''Factory method for creating AdmWriter objects.
See the constructor of TemplateWriter for description of
arguments.
'''
return AdmWriter(['win', 'win7'], config) | Factory method for creating AdmWriter objects.
See the constructor of TemplateWriter for description of
arguments.
| Factory method for creating AdmWriter objects.
See the constructor of TemplateWriter for description of
arguments. | [
"Factory",
"method",
"for",
"creating",
"AdmWriter",
"objects",
".",
"See",
"the",
"constructor",
"of",
"TemplateWriter",
"for",
"description",
"of",
"arguments",
"."
] | def GetWriter(config):
return AdmWriter(['win', 'win7'], config) | [
"def",
"GetWriter",
"(",
"config",
")",
":",
"return",
"AdmWriter",
"(",
"[",
"'win'",
",",
"'win7'",
"]",
",",
"config",
")"
] | Factory method for creating AdmWriter objects. | [
"Factory",
"method",
"for",
"creating",
"AdmWriter",
"objects",
"."
] | [
"'''Factory method for creating AdmWriter objects.\n See the constructor of TemplateWriter for description of\n arguments.\n '''"
] | [
{
"param": "config",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7c20a5a8e7822f382637b3fcfd363b612704cfc5 | sunlongbo/chromium | components/policy/tools/template_writers/writers/adm_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetPolicyExplanation | <not_specific> | def _GetPolicyExplanation(self, policy):
'''Returns the explanation for a given policy.
Includes a link to the relevant documentation on chromium.org.
'''
policy_desc = policy.get('desc')
reference_url = POLICY_LIST_URL + policy['name']
reference_link_text = self.GetLocalizedMessage('reference_l... | Returns the explanation for a given policy.
Includes a link to the relevant documentation on chromium.org.
| Returns the explanation for a given policy.
Includes a link to the relevant documentation on chromium.org. | [
"Returns",
"the",
"explanation",
"for",
"a",
"given",
"policy",
".",
"Includes",
"a",
"link",
"to",
"the",
"relevant",
"documentation",
"on",
"chromium",
".",
"org",
"."
] | def _GetPolicyExplanation(self, policy):
policy_desc = policy.get('desc')
reference_url = POLICY_LIST_URL + policy['name']
reference_link_text = self.GetLocalizedMessage('reference_link')
reference_link_text = reference_link_text.replace('$6', reference_url)
if policy_desc is not None:
policy_... | [
"def",
"_GetPolicyExplanation",
"(",
"self",
",",
"policy",
")",
":",
"policy_desc",
"=",
"policy",
".",
"get",
"(",
"'desc'",
")",
"reference_url",
"=",
"POLICY_LIST_URL",
"+",
"policy",
"[",
"'name'",
"]",
"reference_link_text",
"=",
"self",
".",
"GetLocaliz... | Returns the explanation for a given policy. | [
"Returns",
"the",
"explanation",
"for",
"a",
"given",
"policy",
"."
] | [
"'''Returns the explanation for a given policy.\n Includes a link to the relevant documentation on chromium.org.\n '''"
] | [
{
"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":... |
06051f53d5f0f2d43b94c0726c99bf708a3c77e4 | sunlongbo/chromium | tools/diagnose-me.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Check | <not_specific> | def Check(name):
"""Decorator that defines a diagnostic check."""
def wrap(func):
all_checks.append((name, func))
return func
return wrap | Decorator that defines a diagnostic check. | Decorator that defines a diagnostic check. | [
"Decorator",
"that",
"defines",
"a",
"diagnostic",
"check",
"."
] | def Check(name):
def wrap(func):
all_checks.append((name, func))
return func
return wrap | [
"def",
"Check",
"(",
"name",
")",
":",
"def",
"wrap",
"(",
"func",
")",
":",
"all_checks",
".",
"append",
"(",
"(",
"name",
",",
"func",
")",
")",
"return",
"func",
"return",
"wrap"
] | Decorator that defines a diagnostic check. | [
"Decorator",
"that",
"defines",
"a",
"diagnostic",
"check",
"."
] | [
"\"\"\"Decorator that defines a diagnostic check.\"\"\""
] | [
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0622a3f3244c622dbd5686b4ca2555b31ce95713 | sunlongbo/chromium | content/test/gpu/gpu_tests/pixel_integration_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RunSkiaGoldBasedPixelTest | null | def _RunSkiaGoldBasedPixelTest(self, page):
"""Captures and compares a test image using Skia Gold.
Raises an Exception if the comparison fails.
Args:
page: the GPU PixelTestPage object for the test.
"""
tab = self.tab
# Actually run the test and capture the screenshot.
if not tab.Eva... | Captures and compares a test image using Skia Gold.
Raises an Exception if the comparison fails.
Args:
page: the GPU PixelTestPage object for the test.
| Captures and compares a test image using Skia Gold.
Raises an Exception if the comparison fails. | [
"Captures",
"and",
"compares",
"a",
"test",
"image",
"using",
"Skia",
"Gold",
".",
"Raises",
"an",
"Exception",
"if",
"the",
"comparison",
"fails",
"."
] | def _RunSkiaGoldBasedPixelTest(self, page):
tab = self.tab
if not tab.EvaluateJavaScript('domAutomationController._succeeded'):
self.fail('page indicated test failure')
if (PixelIntegrationTest.browser.platform.GetOSName() == 'fuchsia'
and page.name in pixel_test_pages.PROBLEMATIC_FUCHSIA_TEST... | [
"def",
"_RunSkiaGoldBasedPixelTest",
"(",
"self",
",",
"page",
")",
":",
"tab",
"=",
"self",
".",
"tab",
"if",
"not",
"tab",
".",
"EvaluateJavaScript",
"(",
"'domAutomationController._succeeded'",
")",
":",
"self",
".",
"fail",
"(",
"'page indicated test failure'"... | Captures and compares a test image using Skia Gold. | [
"Captures",
"and",
"compares",
"a",
"test",
"image",
"using",
"Skia",
"Gold",
"."
] | [
"\"\"\"Captures and compares a test image using Skia Gold.\n\n Raises an Exception if the comparison fails.\n\n Args:\n page: the GPU PixelTestPage object for the test.\n \"\"\"",
"# Actually run the test and capture the screenshot.",
"# Special case some tests on Fuchsia that need to grab the ent... | [
{
"param": "self",
"type": null
},
{
"param": "page",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "page",
"type": null,
"docstring": "the GPU PixelTestPage object for... |
571ef8b0f130f094bd60eb4fc2d15f3e9f9c127e | sunlongbo/chromium | tools/traffic_annotation/scripts/extractor_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | remove_tracebacks | <not_specific> | def remove_tracebacks(body: str):
"""Removes python tracebacks from the string."""
regex = re.compile(
r'''
# A line that says "Traceback (...):"
^Traceback[^\n]*:\n
# Followed by lines that begin with whitespace.
((\s.*)?\n)*''',
re.MULTILINE | re.VERBOSE)
return re.sub(re... | Removes python tracebacks from the string. | Removes python tracebacks from the string. | [
"Removes",
"python",
"tracebacks",
"from",
"the",
"string",
"."
] | def remove_tracebacks(body: str):
regex = re.compile(
r'''
# A line that says "Traceback (...):"
^Traceback[^\n]*:\n
# Followed by lines that begin with whitespace.
((\s.*)?\n)*''',
re.MULTILINE | re.VERBOSE)
return re.sub(regex, '', body) | [
"def",
"remove_tracebacks",
"(",
"body",
":",
"str",
")",
":",
"regex",
"=",
"re",
".",
"compile",
"(",
"r'''\n # A line that says \"Traceback (...):\"\n ^Traceback[^\\n]*:\\n\n # Followed by lines that begin with whitespace.\n ((\\s.*)?\\n)*'''",
",",
"re",
... | Removes python tracebacks from the string. | [
"Removes",
"python",
"tracebacks",
"from",
"the",
"string",
"."
] | [
"\"\"\"Removes python tracebacks from the string.\"\"\""
] | [
{
"param": "body",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "body",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
feeb43051d3e3efae6727ebae985c5846720e81d | sunlongbo/chromium | ppapi/generators/idl_node.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Error | null | def Error(self, msg):
"""Log an error for this object."""
self.errors += 1
ErrOut.LogLine(self._filename, self.lineno, 0, ' %s %s' %
(str(self), msg))
filenode = self.GetProperty('FILE')
if filenode:
errcnt = filenode.GetProperty('ERRORS')
if not errcnt:
errcnt... | Log an error for this object. | Log an error for this object. | [
"Log",
"an",
"error",
"for",
"this",
"object",
"."
] | def Error(self, msg):
self.errors += 1
ErrOut.LogLine(self._filename, self.lineno, 0, ' %s %s' %
(str(self), msg))
filenode = self.GetProperty('FILE')
if filenode:
errcnt = filenode.GetProperty('ERRORS')
if not errcnt:
errcnt = 0
filenode.SetProperty('ERRORS'... | [
"def",
"Error",
"(",
"self",
",",
"msg",
")",
":",
"self",
".",
"errors",
"+=",
"1",
"ErrOut",
".",
"LogLine",
"(",
"self",
".",
"_filename",
",",
"self",
".",
"lineno",
",",
"0",
",",
"' %s %s'",
"%",
"(",
"str",
"(",
"self",
")",
",",
"msg",
... | Log an error for this object. | [
"Log",
"an",
"error",
"for",
"this",
"object",
"."
] | [
"\"\"\"Log an error for this object.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "msg",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "msg",
"type": null,
"docstring": null,
"docstring_tokens": []... |
feeb43051d3e3efae6727ebae985c5846720e81d | sunlongbo/chromium | ppapi/generators/idl_node.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Dump | <not_specific> | def Dump(self, depth=0, comments=False, out=sys.stdout):
"""Dump this object and its children"""
if self.cls in ['Comment', 'Copyright']:
is_comment = True
else:
is_comment = False
# Skip this node if it's a comment, and we are not printing comments
if not comments and is_comment:
... | Dump this object and its children | Dump this object and its children | [
"Dump",
"this",
"object",
"and",
"its",
"children"
] | def Dump(self, depth=0, comments=False, out=sys.stdout):
if self.cls in ['Comment', 'Copyright']:
is_comment = True
else:
is_comment = False
if not comments and is_comment:
return
tab = ''.rjust(depth * 2)
if is_comment:
out.write('%sComment\n' % tab)
for line in self.G... | [
"def",
"Dump",
"(",
"self",
",",
"depth",
"=",
"0",
",",
"comments",
"=",
"False",
",",
"out",
"=",
"sys",
".",
"stdout",
")",
":",
"if",
"self",
".",
"cls",
"in",
"[",
"'Comment'",
",",
"'Copyright'",
"]",
":",
"is_comment",
"=",
"True",
"else",
... | Dump this object and its children | [
"Dump",
"this",
"object",
"and",
"its",
"children"
] | [
"\"\"\"Dump this object and its children\"\"\"",
"# Skip this node if it's a comment, and we are not printing comments",
"# Skip printing the name for comments, since we printed above already"
] | [
{
"param": "self",
"type": null
},
{
"param": "depth",
"type": null
},
{
"param": "comments",
"type": null
},
{
"param": "out",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depth",
"type": null,
"docstring": null,
"docstring_tokens": ... |
feeb43051d3e3efae6727ebae985c5846720e81d | sunlongbo/chromium | ppapi/generators/idl_node.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetListOf | <not_specific> | def GetListOf(self, *keys):
"""Get a list of objects for the given key(s)."""
out = []
for child in self._children:
if child.cls in keys:
out.append(child)
return out | Get a list of objects for the given key(s). | Get a list of objects for the given key(s). | [
"Get",
"a",
"list",
"of",
"objects",
"for",
"the",
"given",
"key",
"(",
"s",
")",
"."
] | def GetListOf(self, *keys):
out = []
for child in self._children:
if child.cls in keys:
out.append(child)
return out | [
"def",
"GetListOf",
"(",
"self",
",",
"*",
"keys",
")",
":",
"out",
"=",
"[",
"]",
"for",
"child",
"in",
"self",
".",
"_children",
":",
"if",
"child",
".",
"cls",
"in",
"keys",
":",
"out",
".",
"append",
"(",
"child",
")",
"return",
"out"
] | Get a list of objects for the given key(s). | [
"Get",
"a",
"list",
"of",
"objects",
"for",
"the",
"given",
"key",
"(",
"s",
")",
"."
] | [
"\"\"\"Get a list of objects for the given key(s).\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
feeb43051d3e3efae6727ebae985c5846720e81d | sunlongbo/chromium | ppapi/generators/idl_node.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetUniqueReleases | <not_specific> | def GetUniqueReleases(self, releases):
"""Return the unique set of first releases corresponding to input
Since we are returning the corresponding 'first' version for a
release, we may return a release version prior to the one in the list."""
my_min, my_max = self.GetMinMax(releases)
if my_min > rel... | Return the unique set of first releases corresponding to input
Since we are returning the corresponding 'first' version for a
release, we may return a release version prior to the one in the list. | Return the unique set of first releases corresponding to input
Since we are returning the corresponding 'first' version for a
release, we may return a release version prior to the one in the list. | [
"Return",
"the",
"unique",
"set",
"of",
"first",
"releases",
"corresponding",
"to",
"input",
"Since",
"we",
"are",
"returning",
"the",
"corresponding",
"'",
"first",
"'",
"version",
"for",
"a",
"release",
"we",
"may",
"return",
"a",
"release",
"version",
"pr... | def GetUniqueReleases(self, releases):
my_min, my_max = self.GetMinMax(releases)
if my_min > releases[-1] or my_max < releases[0]:
return []
out = set()
for rel in releases:
remapped = self.first_release[rel]
if not remapped:
continue
out |= set([remapped])
self._uniq... | [
"def",
"GetUniqueReleases",
"(",
"self",
",",
"releases",
")",
":",
"my_min",
",",
"my_max",
"=",
"self",
".",
"GetMinMax",
"(",
"releases",
")",
"if",
"my_min",
">",
"releases",
"[",
"-",
"1",
"]",
"or",
"my_max",
"<",
"releases",
"[",
"0",
"]",
":"... | Return the unique set of first releases corresponding to input
Since we are returning the corresponding 'first' version for a
release, we may return a release version prior to the one in the list. | [
"Return",
"the",
"unique",
"set",
"of",
"first",
"releases",
"corresponding",
"to",
"input",
"Since",
"we",
"are",
"returning",
"the",
"corresponding",
"'",
"first",
"'",
"version",
"for",
"a",
"release",
"we",
"may",
"return",
"a",
"release",
"version",
"pr... | [
"\"\"\"Return the unique set of first releases corresponding to input\n\n Since we are returning the corresponding 'first' version for a\n release, we may return a release version prior to the one in the list.\"\"\"",
"# Cache the most recent set of unique_releases"
] | [
{
"param": "self",
"type": null
},
{
"param": "releases",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "releases",
"type": null,
"docstring": null,
"docstring_tokens... |
feeb43051d3e3efae6727ebae985c5846720e81d | sunlongbo/chromium | ppapi/generators/idl_node.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | DevInterfaceMatchesStable | <not_specific> | def DevInterfaceMatchesStable(self, release):
"""Returns true if an interface has an equivalent stable version."""
assert(self.IsA('Interface'))
for child in self.GetListOf('Member'):
unique = child.GetUniqueReleases([release])
if not unique or not child.InReleases([release]):
continue
... | Returns true if an interface has an equivalent stable version. | Returns true if an interface has an equivalent stable version. | [
"Returns",
"true",
"if",
"an",
"interface",
"has",
"an",
"equivalent",
"stable",
"version",
"."
] | def DevInterfaceMatchesStable(self, release):
assert(self.IsA('Interface'))
for child in self.GetListOf('Member'):
unique = child.GetUniqueReleases([release])
if not unique or not child.InReleases([release]):
continue
if child.NodeIsDevOnly():
return False
return True | [
"def",
"DevInterfaceMatchesStable",
"(",
"self",
",",
"release",
")",
":",
"assert",
"(",
"self",
".",
"IsA",
"(",
"'Interface'",
")",
")",
"for",
"child",
"in",
"self",
".",
"GetListOf",
"(",
"'Member'",
")",
":",
"unique",
"=",
"child",
".",
"GetUnique... | Returns true if an interface has an equivalent stable version. | [
"Returns",
"true",
"if",
"an",
"interface",
"has",
"an",
"equivalent",
"stable",
"version",
"."
] | [
"\"\"\"Returns true if an interface has an equivalent stable version.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "release",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "release",
"type": null,
"docstring": null,
"docstring_tokens"... |
a633912453ae2f100718cb499f58aa0d85ad86cc | sunlongbo/chromium | third_party/blink/tools/blinkpy/tool/commands/copy_existing_baselines.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _copy_existing_baseline | null | def _copy_existing_baseline(self, port_name, test_name, suffix):
"""Copies the baseline for the given builder to all "predecessor" directories."""
baseline_directory = self._tool.port_factory.get(
port_name).baseline_version_dir()
ports = [
self._port_for_primary_baseline... | Copies the baseline for the given builder to all "predecessor" directories. | Copies the baseline for the given builder to all "predecessor" directories. | [
"Copies",
"the",
"baseline",
"for",
"the",
"given",
"builder",
"to",
"all",
"\"",
"predecessor",
"\"",
"directories",
"."
] | def _copy_existing_baseline(self, port_name, test_name, suffix):
baseline_directory = self._tool.port_factory.get(
port_name).baseline_version_dir()
ports = [
self._port_for_primary_baseline(baseline) for baseline in self.
_immediate_predecessors_in_fallback(baseline_... | [
"def",
"_copy_existing_baseline",
"(",
"self",
",",
"port_name",
",",
"test_name",
",",
"suffix",
")",
":",
"baseline_directory",
"=",
"self",
".",
"_tool",
".",
"port_factory",
".",
"get",
"(",
"port_name",
")",
".",
"baseline_version_dir",
"(",
")",
"ports",... | Copies the baseline for the given builder to all "predecessor" directories. | [
"Copies",
"the",
"baseline",
"for",
"the",
"given",
"builder",
"to",
"all",
"\"",
"predecessor",
"\"",
"directories",
"."
] | [
"\"\"\"Copies the baseline for the given builder to all \"predecessor\" directories.\"\"\"",
"# Need to gather all the baseline paths before modifying the filesystem since",
"# the modifications can affect the results of port.expected_filename."
] | [
{
"param": "self",
"type": null
},
{
"param": "port_name",
"type": null
},
{
"param": "test_name",
"type": null
},
{
"param": "suffix",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "port_name",
"type": null,
"docstring": null,
"docstring_token... |
a633912453ae2f100718cb499f58aa0d85ad86cc | sunlongbo/chromium | third_party/blink/tools/blinkpy/tool/commands/copy_existing_baselines.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _port_for_primary_baseline | <not_specific> | def _port_for_primary_baseline(self, baseline):
"""Returns a Port object for the given baseline directory base name."""
for port in [
self._tool.port_factory.get(port_name)
for port_name in self._tool.port_factory.all_port_names()
]:
if self._tool.file... | Returns a Port object for the given baseline directory base name. | Returns a Port object for the given baseline directory base name. | [
"Returns",
"a",
"Port",
"object",
"for",
"the",
"given",
"baseline",
"directory",
"base",
"name",
"."
] | def _port_for_primary_baseline(self, baseline):
for port in [
self._tool.port_factory.get(port_name)
for port_name in self._tool.port_factory.all_port_names()
]:
if self._tool.filesystem.basename(
port.baseline_version_dir()) == baseline:
... | [
"def",
"_port_for_primary_baseline",
"(",
"self",
",",
"baseline",
")",
":",
"for",
"port",
"in",
"[",
"self",
".",
"_tool",
".",
"port_factory",
".",
"get",
"(",
"port_name",
")",
"for",
"port_name",
"in",
"self",
".",
"_tool",
".",
"port_factory",
".",
... | Returns a Port object for the given baseline directory base name. | [
"Returns",
"a",
"Port",
"object",
"for",
"the",
"given",
"baseline",
"directory",
"base",
"name",
"."
] | [
"\"\"\"Returns a Port object for the given baseline directory base name.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "baseline",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "baseline",
"type": null,
"docstring": null,
"docstring_tokens... |
a633912453ae2f100718cb499f58aa0d85ad86cc | sunlongbo/chromium | third_party/blink/tools/blinkpy/tool/commands/copy_existing_baselines.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _immediate_predecessors_in_fallback | <not_specific> | def _immediate_predecessors_in_fallback(self, path_to_rebaseline):
"""Returns the predecessor directories in the baseline fall-back graph.
The platform-specific fall-back baseline directories form a tree, where
when we search for baselines we normally fall back to parents nodes in
the t... | Returns the predecessor directories in the baseline fall-back graph.
The platform-specific fall-back baseline directories form a tree, where
when we search for baselines we normally fall back to parents nodes in
the tree. The "immediate predecessors" are the children nodes of the
given ... | Returns the predecessor directories in the baseline fall-back graph.
The platform-specific fall-back baseline directories form a tree, where
when we search for baselines we normally fall back to parents nodes in
the tree. The "immediate predecessors" are the children nodes of the
given node.
| [
"Returns",
"the",
"predecessor",
"directories",
"in",
"the",
"baseline",
"fall",
"-",
"back",
"graph",
".",
"The",
"platform",
"-",
"specific",
"fall",
"-",
"back",
"baseline",
"directories",
"form",
"a",
"tree",
"where",
"when",
"we",
"search",
"for",
"base... | def _immediate_predecessors_in_fallback(self, path_to_rebaseline):
port_names = self._tool.port_factory.all_port_names()
immediate_predecessors = []
for port_name in port_names:
port = self._tool.port_factory.get(port_name)
baseline_search_path = port.baseline_search_path... | [
"def",
"_immediate_predecessors_in_fallback",
"(",
"self",
",",
"path_to_rebaseline",
")",
":",
"port_names",
"=",
"self",
".",
"_tool",
".",
"port_factory",
".",
"all_port_names",
"(",
")",
"immediate_predecessors",
"=",
"[",
"]",
"for",
"port_name",
"in",
"port_... | Returns the predecessor directories in the baseline fall-back graph. | [
"Returns",
"the",
"predecessor",
"directories",
"in",
"the",
"baseline",
"fall",
"-",
"back",
"graph",
"."
] | [
"\"\"\"Returns the predecessor directories in the baseline fall-back graph.\n\n The platform-specific fall-back baseline directories form a tree, where\n when we search for baselines we normally fall back to parents nodes in\n the tree. The \"immediate predecessors\" are the children nodes of t... | [
{
"param": "self",
"type": null
},
{
"param": "path_to_rebaseline",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of directory names (not full paths) of directories that are\n\"immediate predecessors\" of the given baseline path.",
"docstring_tokens": [
"A",
"list",
"of",
"directory",
"names",
"(",
"not",
"full",... |
d3e79f995d9f72a29c84ec0a342cce26d9acb058 | sunlongbo/chromium | tools/binary_size/libsupersize/dir_metadata.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ComponentForDirectory | <not_specific> | def _ComponentForDirectory(self, directory):
"""Searches all parent directories for COMPONENT in OWNERS files.
Args:
directory: Path of directory to start searching from relative to
|source_directory|.
Returns:
COMPONENT belonging to |path|, or empty string if not found.
"""
as... | Searches all parent directories for COMPONENT in OWNERS files.
Args:
directory: Path of directory to start searching from relative to
|source_directory|.
Returns:
COMPONENT belonging to |path|, or empty string if not found.
| Searches all parent directories for COMPONENT in OWNERS files. | [
"Searches",
"all",
"parent",
"directories",
"for",
"COMPONENT",
"in",
"OWNERS",
"files",
"."
] | def _ComponentForDirectory(self, directory):
assert not os.path.isabs(directory)
component = self._dir_cache.get(directory)
if component is not None:
return component
metadata_path = os.path.join(self._source_directory, directory,
_METADATA_FILENAME)
result = s... | [
"def",
"_ComponentForDirectory",
"(",
"self",
",",
"directory",
")",
":",
"assert",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"directory",
")",
"component",
"=",
"self",
".",
"_dir_cache",
".",
"get",
"(",
"directory",
")",
"if",
"component",
"is",
"n... | Searches all parent directories for COMPONENT in OWNERS files. | [
"Searches",
"all",
"parent",
"directories",
"for",
"COMPONENT",
"in",
"OWNERS",
"files",
"."
] | [
"\"\"\"Searches all parent directories for COMPONENT in OWNERS files.\n\n Args:\n directory: Path of directory to start searching from relative to\n |source_directory|.\n\n Returns:\n COMPONENT belonging to |path|, or empty string if not found.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "directory",
"type": null
}
] | {
"returns": [
{
"docstring": "COMPONENT belonging to |path|, or empty string if not found.",
"docstring_tokens": [
"COMPONENT",
"belonging",
"to",
"|path|",
"or",
"empty",
"string",
"if",
"not",
"found",
"."
... |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetToolsParentDir | <not_specific> | def _GetToolsParentDir():
"""Returns an absolute path to the the tools directory's parent directory.
Example: 'C:\a\n\ff\' or '/opt/n/ff/'.
"""
return os.path.abspath(os.path.join(*expand_owners.DIR_ABOVE_TOOLS)) | Returns an absolute path to the the tools directory's parent directory.
Example: 'C:\a\n\ff\' or '/opt/n/ff/'.
| Returns an absolute path to the the tools directory's parent directory. | [
"Returns",
"an",
"absolute",
"path",
"to",
"the",
"the",
"tools",
"directory",
"'",
"s",
"parent",
"directory",
"."
] | def _GetToolsParentDir():
return os.path.abspath(os.path.join(*expand_owners.DIR_ABOVE_TOOLS)) | [
"def",
"_GetToolsParentDir",
"(",
")",
":",
"return",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"*",
"expand_owners",
".",
"DIR_ABOVE_TOOLS",
")",
")"
] | Returns an absolute path to the the tools directory's parent directory. | [
"Returns",
"an",
"absolute",
"path",
"to",
"the",
"the",
"tools",
"directory",
"'",
"s",
"parent",
"directory",
"."
] | [
"\"\"\"Returns an absolute path to the the tools directory's parent directory.\n\n Example: 'C:\\a\\n\\ff\\' or '/opt/n/ff/'.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetFileDirective | <not_specific> | def _GetFileDirective(path):
"""Returns a file directive line.
Args:
path: An absolute path, e.g. '/some/directory/subdirectory/tools/OWNERS'.
Returns:
A file directive that can be used in an OWNERS file, e.g.
file://tools/OWNERS.
"""
return ''.join(['file://', path[len(_GetToolsParentDir()) + 1... | Returns a file directive line.
Args:
path: An absolute path, e.g. '/some/directory/subdirectory/tools/OWNERS'.
Returns:
A file directive that can be used in an OWNERS file, e.g.
file://tools/OWNERS.
| Returns a file directive line. | [
"Returns",
"a",
"file",
"directive",
"line",
"."
] | def _GetFileDirective(path):
return ''.join(['file://', path[len(_GetToolsParentDir()) + 1:]]) | [
"def",
"_GetFileDirective",
"(",
"path",
")",
":",
"return",
"''",
".",
"join",
"(",
"[",
"'file://'",
",",
"path",
"[",
"len",
"(",
"_GetToolsParentDir",
"(",
")",
")",
"+",
"1",
":",
"]",
"]",
")"
] | Returns a file directive line. | [
"Returns",
"a",
"file",
"directive",
"line",
"."
] | [
"\"\"\"Returns a file directive line.\n\n Args:\n path: An absolute path, e.g. '/some/directory/subdirectory/tools/OWNERS'.\n\n Returns:\n A file directive that can be used in an OWNERS file, e.g.\n file://tools/OWNERS.\n \"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [
{
"docstring": "A file directive that can be used in an OWNERS file, e.g.",
"docstring_tokens": [
"A",
"file",
"directive",
"that",
"can",
"be",
"used",
"in",
"an",
"OWNERS",
"file",
"e",
... |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetSrcRelativePath | <not_specific> | def _GetSrcRelativePath(path):
"""Returns a(n) src-relative path for the given file path.
Args:
path: An absolute path, e.g. '/some/directory/subdirectory/tools/OWNERS'.
Returns:
A src-relative path, e.g.'src/tools/OWNERS'.
"""
assert path.startswith(_GetToolsParentDir())
return expand_owners.SRC ... | Returns a(n) src-relative path for the given file path.
Args:
path: An absolute path, e.g. '/some/directory/subdirectory/tools/OWNERS'.
Returns:
A src-relative path, e.g.'src/tools/OWNERS'.
| Returns a(n) src-relative path for the given file path. | [
"Returns",
"a",
"(",
"n",
")",
"src",
"-",
"relative",
"path",
"for",
"the",
"given",
"file",
"path",
"."
] | def _GetSrcRelativePath(path):
assert path.startswith(_GetToolsParentDir())
return expand_owners.SRC + path[len(_GetToolsParentDir()) + 1:] | [
"def",
"_GetSrcRelativePath",
"(",
"path",
")",
":",
"assert",
"path",
".",
"startswith",
"(",
"_GetToolsParentDir",
"(",
")",
")",
"return",
"expand_owners",
".",
"SRC",
"+",
"path",
"[",
"len",
"(",
"_GetToolsParentDir",
"(",
")",
")",
"+",
"1",
":",
"... | Returns a(n) src-relative path for the given file path. | [
"Returns",
"a",
"(",
"n",
")",
"src",
"-",
"relative",
"path",
"for",
"the",
"given",
"file",
"path",
"."
] | [
"\"\"\"Returns a(n) src-relative path for the given file path.\n\n Args:\n path: An absolute path, e.g. '/some/directory/subdirectory/tools/OWNERS'.\n\n Returns:\n A src-relative path, e.g.'src/tools/OWNERS'.\n \"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [
{
"docstring": "A src-relative path, e.g.'src/tools/OWNERS'.",
"docstring_tokens": [
"A",
"src",
"-",
"relative",
"path",
"e",
".",
"g",
".",
"'",
"src",
"/",
"tools",
"/",
... |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _MakeOwnersFile | <not_specific> | def _MakeOwnersFile(filename, directory):
"""Makes a temporary file in this directory and returns its absolute path.
Args:
filename: A string filename, e.g. 'OWNERS'.
directory: A string directory under which to make the new file.
Returns:
The temporary file's absolute path.
"""
if not directory... | Makes a temporary file in this directory and returns its absolute path.
Args:
filename: A string filename, e.g. 'OWNERS'.
directory: A string directory under which to make the new file.
Returns:
The temporary file's absolute path.
| Makes a temporary file in this directory and returns its absolute path. | [
"Makes",
"a",
"temporary",
"file",
"in",
"this",
"directory",
"and",
"returns",
"its",
"absolute",
"path",
"."
] | def _MakeOwnersFile(filename, directory):
if not directory:
directory = os.path.abspath(os.path.join(os.path.dirname(__file__)))
owners_file = tempfile.NamedTemporaryFile(suffix=filename, dir=directory)
return os.path.abspath(owners_file.name) | [
"def",
"_MakeOwnersFile",
"(",
"filename",
",",
"directory",
")",
":",
"if",
"not",
"directory",
":",
"directory",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
"... | Makes a temporary file in this directory and returns its absolute path. | [
"Makes",
"a",
"temporary",
"file",
"in",
"this",
"directory",
"and",
"returns",
"its",
"absolute",
"path",
"."
] | [
"\"\"\"Makes a temporary file in this directory and returns its absolute path.\n\n Args:\n filename: A string filename, e.g. 'OWNERS'.\n directory: A string directory under which to make the new file.\n\n Returns:\n The temporary file's absolute path.\n \"\"\""
] | [
{
"param": "filename",
"type": null
},
{
"param": "directory",
"type": null
}
] | {
"returns": [
{
"docstring": "The temporary file's absolute path.",
"docstring_tokens": [
"The",
"temporary",
"file",
"'",
"s",
"absolute",
"path",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"ide... |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExpandOwnersUsesMetadataOverOwners | null | def testExpandOwnersUsesMetadataOverOwners(self):
"""Checks that DIR_METADATA is used if available"""
with open(os.path.join(self.temp_dir, 'DIR_METADATA'), "w+") as md:
md.write("\n".join(['monorail {', 'component: "Bees"', '}']))
absolute_path = _MakeOwnersFile('simple_OWNERS', self.temp_dir)
wi... | Checks that DIR_METADATA is used if available | Checks that DIR_METADATA is used if available | [
"Checks",
"that",
"DIR_METADATA",
"is",
"used",
"if",
"available"
] | def testExpandOwnersUsesMetadataOverOwners(self):
with open(os.path.join(self.temp_dir, 'DIR_METADATA'), "w+") as md:
md.write("\n".join(['monorail {', 'component: "Bees"', '}']))
absolute_path = _MakeOwnersFile('simple_OWNERS', self.temp_dir)
with open(absolute_path, 'w') as owners_file:
owners... | [
"def",
"testExpandOwnersUsesMetadataOverOwners",
"(",
"self",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"temp_dir",
",",
"'DIR_METADATA'",
")",
",",
"\"w+\"",
")",
"as",
"md",
":",
"md",
".",
"write",
"(",
"\"\\n\""... | Checks that DIR_METADATA is used if available | [
"Checks",
"that",
"DIR_METADATA",
"is",
"used",
"if",
"available"
] | [
"\"\"\"Checks that DIR_METADATA is used if available\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExpandOwnersWithSimpleOWNERSFilePath | null | def testExpandOwnersWithSimpleOWNERSFilePath(self, mock_dirmd_extract):
"""Checks that OWNERS files are expanded."""
mock_dirmd_extract.return_value = None
absolute_path = _MakeOwnersFile('simple_OWNERS', self.temp_dir)
src_relative_path = _GetSrcRelativePath(absolute_path)
with open(absolute_path,... | Checks that OWNERS files are expanded. | Checks that OWNERS files are expanded. | [
"Checks",
"that",
"OWNERS",
"files",
"are",
"expanded",
"."
] | def testExpandOwnersWithSimpleOWNERSFilePath(self, mock_dirmd_extract):
mock_dirmd_extract.return_value = None
absolute_path = _MakeOwnersFile('simple_OWNERS', self.temp_dir)
src_relative_path = _GetSrcRelativePath(absolute_path)
with open(absolute_path, 'w') as owners_file:
owners_file.write('\n'... | [
"def",
"testExpandOwnersWithSimpleOWNERSFilePath",
"(",
"self",
",",
"mock_dirmd_extract",
")",
":",
"mock_dirmd_extract",
".",
"return_value",
"=",
"None",
"absolute_path",
"=",
"_MakeOwnersFile",
"(",
"'simple_OWNERS'",
",",
"self",
".",
"temp_dir",
")",
"src_relative... | Checks that OWNERS files are expanded. | [
"Checks",
"that",
"OWNERS",
"files",
"are",
"expanded",
"."
] | [
"\"\"\"Checks that OWNERS files are expanded.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "mock_dirmd_extract",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mock_dirmd_extract",
"type": null,
"docstring": null,
"docstr... |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExpandOwnersWithLongFilePath | null | def testExpandOwnersWithLongFilePath(self, mock_dirmd_extract):
"""Checks that long OWNERS file paths are supported.
Most OWNERS file paths appear between owners tags on the same line, e.g.
<owner>src/chrome/browser</owner>. However, especially long paths may appear
on their own line between the tags.
... | Checks that long OWNERS file paths are supported.
Most OWNERS file paths appear between owners tags on the same line, e.g.
<owner>src/chrome/browser</owner>. However, especially long paths may appear
on their own line between the tags.
| Checks that long OWNERS file paths are supported.
Most OWNERS file paths appear between owners tags on the same line, e.g.
src/chrome/browser. However, especially long paths may appear
on their own line between the tags. | [
"Checks",
"that",
"long",
"OWNERS",
"file",
"paths",
"are",
"supported",
".",
"Most",
"OWNERS",
"file",
"paths",
"appear",
"between",
"owners",
"tags",
"on",
"the",
"same",
"line",
"e",
".",
"g",
".",
"src",
"/",
"chrome",
"/",
"browser",
".",
"However",... | def testExpandOwnersWithLongFilePath(self, mock_dirmd_extract):
mock_dirmd_extract.return_value = None
absolute_path = _MakeOwnersFile('simple_OWNERS', self.temp_dir)
src_relative_path = _GetSrcRelativePath(absolute_path)
with open(absolute_path, 'w') as owners_file:
owners_file.write('\n'.join(['... | [
"def",
"testExpandOwnersWithLongFilePath",
"(",
"self",
",",
"mock_dirmd_extract",
")",
":",
"mock_dirmd_extract",
".",
"return_value",
"=",
"None",
"absolute_path",
"=",
"_MakeOwnersFile",
"(",
"'simple_OWNERS'",
",",
"self",
".",
"temp_dir",
")",
"src_relative_path",
... | Checks that long OWNERS file paths are supported. | [
"Checks",
"that",
"long",
"OWNERS",
"file",
"paths",
"are",
"supported",
"."
] | [
"\"\"\"Checks that long OWNERS file paths are supported.\n\n Most OWNERS file paths appear between owners tags on the same line, e.g.\n <owner>src/chrome/browser</owner>. However, especially long paths may appear\n on their own line between the tags.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "mock_dirmd_extract",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mock_dirmd_extract",
"type": null,
"docstring": null,
"docstr... |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExpandOwnersWithDuplicateOwners | null | def testExpandOwnersWithDuplicateOwners(self, mock_dirmd_extract):
"""Checks that owners are unique."""
mock_dirmd_extract.return_value = None
absolute_path = _MakeOwnersFile('simple_OWNERS', self.temp_dir)
src_relative_path = _GetSrcRelativePath(absolute_path)
with open(absolute_path, 'w') as owne... | Checks that owners are unique. | Checks that owners are unique. | [
"Checks",
"that",
"owners",
"are",
"unique",
"."
] | def testExpandOwnersWithDuplicateOwners(self, mock_dirmd_extract):
mock_dirmd_extract.return_value = None
absolute_path = _MakeOwnersFile('simple_OWNERS', self.temp_dir)
src_relative_path = _GetSrcRelativePath(absolute_path)
with open(absolute_path, 'w') as owners_file:
owners_file.write('\n'.join... | [
"def",
"testExpandOwnersWithDuplicateOwners",
"(",
"self",
",",
"mock_dirmd_extract",
")",
":",
"mock_dirmd_extract",
".",
"return_value",
"=",
"None",
"absolute_path",
"=",
"_MakeOwnersFile",
"(",
"'simple_OWNERS'",
",",
"self",
".",
"temp_dir",
")",
"src_relative_path... | Checks that owners are unique. | [
"Checks",
"that",
"owners",
"are",
"unique",
"."
] | [
"\"\"\"Checks that owners are unique.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "mock_dirmd_extract",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mock_dirmd_extract",
"type": null,
"docstring": null,
"docstr... |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExpandOwnersWithFileDirectiveOWNERSFilePath | null | def testExpandOwnersWithFileDirectiveOWNERSFilePath(self, mock_dirmd_extract):
"""Checks that OWNERS files with file directives are expanded."""
mock_dirmd_extract.return_value = None
simple_absolute_path = _MakeOwnersFile('simple_OWNERS', self.temp_dir)
with open(simple_absolute_path, 'w') as owners_f... | Checks that OWNERS files with file directives are expanded. | Checks that OWNERS files with file directives are expanded. | [
"Checks",
"that",
"OWNERS",
"files",
"with",
"file",
"directives",
"are",
"expanded",
"."
] | def testExpandOwnersWithFileDirectiveOWNERSFilePath(self, mock_dirmd_extract):
mock_dirmd_extract.return_value = None
simple_absolute_path = _MakeOwnersFile('simple_OWNERS', self.temp_dir)
with open(simple_absolute_path, 'w') as owners_file:
owners_file.write('naz@chromium.org')
file_directive_abs... | [
"def",
"testExpandOwnersWithFileDirectiveOWNERSFilePath",
"(",
"self",
",",
"mock_dirmd_extract",
")",
":",
"mock_dirmd_extract",
".",
"return_value",
"=",
"None",
"simple_absolute_path",
"=",
"_MakeOwnersFile",
"(",
"'simple_OWNERS'",
",",
"self",
".",
"temp_dir",
")",
... | Checks that OWNERS files with file directives are expanded. | [
"Checks",
"that",
"OWNERS",
"files",
"with",
"file",
"directives",
"are",
"expanded",
"."
] | [
"\"\"\"Checks that OWNERS files with file directives are expanded.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "mock_dirmd_extract",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mock_dirmd_extract",
"type": null,
"docstring": null,
"docstr... |
92a9580b4b58f215f8cc068cb6092e985724e822 | sunlongbo/chromium | tools/metrics/histograms/expand_owners_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testExpandOwnersForOWNERSFileWithDuplicateComponents | null | def testExpandOwnersForOWNERSFileWithDuplicateComponents(
self, mock_dirmd_extract):
"""Checks that only one component tag is added if there are duplicates."""
mock_dirmd_extract.return_value = None
absolute_path = _MakeOwnersFile('OWNERS', self.temp_dir)
src_relative_path = _GetSrcRelativePath(ab... | Checks that only one component tag is added if there are duplicates. | Checks that only one component tag is added if there are duplicates. | [
"Checks",
"that",
"only",
"one",
"component",
"tag",
"is",
"added",
"if",
"there",
"are",
"duplicates",
"."
] | def testExpandOwnersForOWNERSFileWithDuplicateComponents(
self, mock_dirmd_extract):
mock_dirmd_extract.return_value = None
absolute_path = _MakeOwnersFile('OWNERS', self.temp_dir)
src_relative_path = _GetSrcRelativePath(absolute_path)
with open(absolute_path, 'w') as owners_file:
owners_fil... | [
"def",
"testExpandOwnersForOWNERSFileWithDuplicateComponents",
"(",
"self",
",",
"mock_dirmd_extract",
")",
":",
"mock_dirmd_extract",
".",
"return_value",
"=",
"None",
"absolute_path",
"=",
"_MakeOwnersFile",
"(",
"'OWNERS'",
",",
"self",
".",
"temp_dir",
")",
"src_rel... | Checks that only one component tag is added if there are duplicates. | [
"Checks",
"that",
"only",
"one",
"component",
"tag",
"is",
"added",
"if",
"there",
"are",
"duplicates",
"."
] | [
"\"\"\"Checks that only one component tag is added if there are duplicates.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "mock_dirmd_extract",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mock_dirmd_extract",
"type": null,
"docstring": null,
"docstr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.