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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6c76d51ea27f86c2097e048d24d2bb4771e18345 | sunlongbo/chromium | ios/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckARCCompilationGuard | <not_specific> | def _CheckARCCompilationGuard(input_api, output_api):
""" Checks whether new objc files have proper ARC compile guards."""
files_without_headers = []
for f in input_api.AffectedFiles():
if f.Action() != 'A':
continue
_, ext = os.path.splitext(f.LocalPath())
if ext not in ('.m', '.mm'):
co... | Checks whether new objc files have proper ARC compile guards. | Checks whether new objc files have proper ARC compile guards. | [
"Checks",
"whether",
"new",
"objc",
"files",
"have",
"proper",
"ARC",
"compile",
"guards",
"."
] | def _CheckARCCompilationGuard(input_api, output_api):
files_without_headers = []
for f in input_api.AffectedFiles():
if f.Action() != 'A':
continue
_, ext = os.path.splitext(f.LocalPath())
if ext not in ('.m', '.mm'):
continue
if not IsSubListOf(ARC_COMPILE_GUARD, f.NewContents()):
... | [
"def",
"_CheckARCCompilationGuard",
"(",
"input_api",
",",
"output_api",
")",
":",
"files_without_headers",
"=",
"[",
"]",
"for",
"f",
"in",
"input_api",
".",
"AffectedFiles",
"(",
")",
":",
"if",
"f",
".",
"Action",
"(",
")",
"!=",
"'A'",
":",
"continue",... | Checks whether new objc files have proper ARC compile guards. | [
"Checks",
"whether",
"new",
"objc",
"files",
"have",
"proper",
"ARC",
"compile",
"guards",
"."
] | [
"\"\"\" Checks whether new objc files have proper ARC compile guards.\"\"\""
] | [
{
"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... |
6c76d51ea27f86c2097e048d24d2bb4771e18345 | sunlongbo/chromium | ios/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckNullabilityAnnotations | <not_specific> | def _CheckNullabilityAnnotations(input_api, output_api):
""" Checks whether there are nullability annotations in ios code."""
nullability_regex = input_api.re.compile(NULLABILITY_PATTERN)
errors = []
for f in input_api.AffectedFiles():
for line_num, line in f.ChangedContents():
if nullability_regex.s... | Checks whether there are nullability annotations in ios code. | Checks whether there are nullability annotations in ios code. | [
"Checks",
"whether",
"there",
"are",
"nullability",
"annotations",
"in",
"ios",
"code",
"."
] | def _CheckNullabilityAnnotations(input_api, output_api):
nullability_regex = input_api.re.compile(NULLABILITY_PATTERN)
errors = []
for f in input_api.AffectedFiles():
for line_num, line in f.ChangedContents():
if nullability_regex.search(line):
errors.append('%s:%s' % (f.LocalPath(), line_num))
... | [
"def",
"_CheckNullabilityAnnotations",
"(",
"input_api",
",",
"output_api",
")",
":",
"nullability_regex",
"=",
"input_api",
".",
"re",
".",
"compile",
"(",
"NULLABILITY_PATTERN",
")",
"errors",
"=",
"[",
"]",
"for",
"f",
"in",
"input_api",
".",
"AffectedFiles",... | Checks whether there are nullability annotations in ios code. | [
"Checks",
"whether",
"there",
"are",
"nullability",
"annotations",
"in",
"ios",
"code",
"."
] | [
"\"\"\" Checks whether there are nullability annotations in ios code.\"\"\""
] | [
{
"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... |
6c76d51ea27f86c2097e048d24d2bb4771e18345 | sunlongbo/chromium | ios/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckBugInToDo | <not_specific> | def _CheckBugInToDo(input_api, output_api):
""" Checks whether TODOs in ios code are identified by a bug number."""
errors = []
for f in input_api.AffectedFiles():
for line_num, line in f.ChangedContents():
if _HasToDoWithNoBug(input_api, line):
errors.append('%s:%s' % (f.LocalPath(), line_num))... | Checks whether TODOs in ios code are identified by a bug number. | Checks whether TODOs in ios code are identified by a bug number. | [
"Checks",
"whether",
"TODOs",
"in",
"ios",
"code",
"are",
"identified",
"by",
"a",
"bug",
"number",
"."
] | def _CheckBugInToDo(input_api, output_api):
errors = []
for f in input_api.AffectedFiles():
for line_num, line in f.ChangedContents():
if _HasToDoWithNoBug(input_api, line):
errors.append('%s:%s' % (f.LocalPath(), line_num))
if not errors:
return []
plural_suffix = '' if len(errors) == 1 e... | [
"def",
"_CheckBugInToDo",
"(",
"input_api",
",",
"output_api",
")",
":",
"errors",
"=",
"[",
"]",
"for",
"f",
"in",
"input_api",
".",
"AffectedFiles",
"(",
")",
":",
"for",
"line_num",
",",
"line",
"in",
"f",
".",
"ChangedContents",
"(",
")",
":",
"if"... | Checks whether TODOs in ios code are identified by a bug number. | [
"Checks",
"whether",
"TODOs",
"in",
"ios",
"code",
"are",
"identified",
"by",
"a",
"bug",
"number",
"."
] | [
"\"\"\" Checks whether TODOs in ios code are identified by a bug number.\"\"\""
] | [
{
"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... |
6c76d51ea27f86c2097e048d24d2bb4771e18345 | sunlongbo/chromium | ios/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _HasToDoWithNoBug | <not_specific> | def _HasToDoWithNoBug(input_api, line):
""" Returns True if TODO is not identified by a bug number."""
todo_regex = input_api.re.compile(TODO_PATTERN)
crbug_regex = input_api.re.compile(CRBUG_PATTERN)
todo_match = todo_regex.search(line)
if not todo_match:
return False
crbug_match = crbug_regex.match(t... | Returns True if TODO is not identified by a bug number. | Returns True if TODO is not identified by a bug number. | [
"Returns",
"True",
"if",
"TODO",
"is",
"not",
"identified",
"by",
"a",
"bug",
"number",
"."
] | def _HasToDoWithNoBug(input_api, line):
todo_regex = input_api.re.compile(TODO_PATTERN)
crbug_regex = input_api.re.compile(CRBUG_PATTERN)
todo_match = todo_regex.search(line)
if not todo_match:
return False
crbug_match = crbug_regex.match(todo_match.group(1))
return not crbug_match | [
"def",
"_HasToDoWithNoBug",
"(",
"input_api",
",",
"line",
")",
":",
"todo_regex",
"=",
"input_api",
".",
"re",
".",
"compile",
"(",
"TODO_PATTERN",
")",
"crbug_regex",
"=",
"input_api",
".",
"re",
".",
"compile",
"(",
"CRBUG_PATTERN",
")",
"todo_match",
"="... | Returns True if TODO is not identified by a bug number. | [
"Returns",
"True",
"if",
"TODO",
"is",
"not",
"identified",
"by",
"a",
"bug",
"number",
"."
] | [
"\"\"\" Returns True if TODO is not identified by a bug number.\"\"\""
] | [
{
"param": "input_api",
"type": null
},
{
"param": "line",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_api",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "line",
"type": null,
"docstring": null,
"docstring_token... |
ae7a9965bdbbceb0c871764e3ba614b50e23a7b2 | sunlongbo/chromium | tools/perf/cli_tools/pinpoint_traces.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | LoadJsonFile | <not_specific> | def LoadJsonFile(json_file, compiled_re):
"""From the JSON file takes only the events that match.
Note: This function loads a typical JSON file very slowly, for several
seconds. Most time is spent in the Python json module.
Args:
json_file: (str) Path to the JSON file to load
compiled_re: A compiled r... | From the JSON file takes only the events that match.
Note: This function loads a typical JSON file very slowly, for several
seconds. Most time is spent in the Python json module.
Args:
json_file: (str) Path to the JSON file to load
compiled_re: A compiled regular expression that selects event by |name| ... | From the JSON file takes only the events that match.
Note: This function loads a typical JSON file very slowly, for several
seconds. Most time is spent in the Python json module. | [
"From",
"the",
"JSON",
"file",
"takes",
"only",
"the",
"events",
"that",
"match",
".",
"Note",
":",
"This",
"function",
"loads",
"a",
"typical",
"JSON",
"file",
"very",
"slowly",
"for",
"several",
"seconds",
".",
"Most",
"time",
"is",
"spent",
"in",
"the... | def LoadJsonFile(json_file, compiled_re):
with open(json_file) as f:
events = json.load(f)
tids = {}
tid_to_pid = {}
for event in events['traceEvents']:
assert 'ph' in event
assert 'ts' in event
phase = event['ph']
if not phase in SUPPORTED_PHASES:
continue
assert 'tid' in event
... | [
"def",
"LoadJsonFile",
"(",
"json_file",
",",
"compiled_re",
")",
":",
"with",
"open",
"(",
"json_file",
")",
"as",
"f",
":",
"events",
"=",
"json",
".",
"load",
"(",
"f",
")",
"tids",
"=",
"{",
"}",
"tid_to_pid",
"=",
"{",
"}",
"for",
"event",
"in... | From the JSON file takes only the events that match. | [
"From",
"the",
"JSON",
"file",
"takes",
"only",
"the",
"events",
"that",
"match",
"."
] | [
"\"\"\"From the JSON file takes only the events that match.\n\n Note: This function loads a typical JSON file very slowly, for several\n seconds. Most time is spent in the Python json module.\n\n Args:\n json_file: (str) Path to the JSON file to load\n compiled_re: A compiled regular expression that select... | [
{
"param": "json_file",
"type": null
},
{
"param": "compiled_re",
"type": null
}
] | {
"returns": [
{
"docstring": "A dict with this internal structure:\n{ tid: { (int) ts: [event, ...] } },\nwhere:\ntid: (int) Thread ID of all the events it maps to.\nts: (int) Trace timestamp (in microseconds) of the beginning of the event.\nevent: (LeanEvent) One extracted event only containing the fields... |
ae7a9965bdbbceb0c871764e3ba614b50e23a7b2 | sunlongbo/chromium | tools/perf/cli_tools/pinpoint_traces.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ExtractEvents | null | def ExtractEvents(regex, working_dir, csv_path):
"""Extracts all matching events and outputs them into a CSV file.
Finds the trace files by scanning the working directory.
Args:
regex: A regular expression. Selects an event if its name matches.
working_dir: (str) Path to a working directory with structu... | Extracts all matching events and outputs them into a CSV file.
Finds the trace files by scanning the working directory.
Args:
regex: A regular expression. Selects an event if its name matches.
working_dir: (str) Path to a working directory with structure as explained
in ExtractFromOneTraceThrowing... | Extracts all matching events and outputs them into a CSV file.
Finds the trace files by scanning the working directory. | [
"Extracts",
"all",
"matching",
"events",
"and",
"outputs",
"them",
"into",
"a",
"CSV",
"file",
".",
"Finds",
"the",
"trace",
"files",
"by",
"scanning",
"the",
"working",
"directory",
"."
] | def ExtractEvents(regex, working_dir, csv_path):
compiled_regex = re.compile(regex)
tasks = []
for run_label in os.listdir(working_dir):
full_dir = os.path.join(working_dir, run_label)
if not os.path.isdir(full_dir):
continue
trace_index = -1
for html in os.listdir(full_dir):
html_tr... | [
"def",
"ExtractEvents",
"(",
"regex",
",",
"working_dir",
",",
"csv_path",
")",
":",
"compiled_regex",
"=",
"re",
".",
"compile",
"(",
"regex",
")",
"tasks",
"=",
"[",
"]",
"for",
"run_label",
"in",
"os",
".",
"listdir",
"(",
"working_dir",
")",
":",
"... | Extracts all matching events and outputs them into a CSV file. | [
"Extracts",
"all",
"matching",
"events",
"and",
"outputs",
"them",
"into",
"a",
"CSV",
"file",
"."
] | [
"\"\"\"Extracts all matching events and outputs them into a CSV file.\n\n Finds the trace files by scanning the working directory.\n\n Args:\n regex: A regular expression. Selects an event if its name matches.\n working_dir: (str) Path to a working directory with structure as explained\n in ExtractFr... | [
{
"param": "regex",
"type": null
},
{
"param": "working_dir",
"type": null
},
{
"param": "csv_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "regex",
"type": null,
"docstring": "A regular expression. Selects an event if its name matches.",
"docstring_tokens": [
"A",
"regular",
"expression",
".",
"Selects",
"an",
... |
4716277af161e8da241f3dac92605e3e484acfc5 | sunlongbo/chromium | chrome/test/enterprise/e2e/infra/chrome_ent_test_case.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RemovePolicy | null | def RemovePolicy(self, instance_name, policy_name):
"""Removes a Google Chrome policy in registry.
Args:
policy_name: the policy name.
"""
segments = policy_name.split('\\')
policy_name = segments[-1]
keys = [
r'HKLM\Software\Policies\Google\Chrome',
r'HKLM\Software\Polici... | Removes a Google Chrome policy in registry.
Args:
policy_name: the policy name.
| Removes a Google Chrome policy in registry. | [
"Removes",
"a",
"Google",
"Chrome",
"policy",
"in",
"registry",
"."
] | def RemovePolicy(self, instance_name, policy_name):
segments = policy_name.split('\\')
policy_name = segments[-1]
keys = [
r'HKLM\Software\Policies\Google\Chrome',
r'HKLM\Software\Policies\Chromium'
]
for key in keys:
if len(segments) >= 2:
key += '\\' + '\\'.join(segme... | [
"def",
"RemovePolicy",
"(",
"self",
",",
"instance_name",
",",
"policy_name",
")",
":",
"segments",
"=",
"policy_name",
".",
"split",
"(",
"'\\\\'",
")",
"policy_name",
"=",
"segments",
"[",
"-",
"1",
"]",
"keys",
"=",
"[",
"r'HKLM\\Software\\Policies\\Google\... | Removes a Google Chrome policy in registry. | [
"Removes",
"a",
"Google",
"Chrome",
"policy",
"in",
"registry",
"."
] | [
"\"\"\"Removes a Google Chrome policy in registry.\n Args:\n policy_name: the policy name.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "instance_name",
"type": null
},
{
"param": "policy_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "instance_name",
"type": null,
"docstring": null,
"docstring_t... |
4716277af161e8da241f3dac92605e3e484acfc5 | sunlongbo/chromium | chrome/test/enterprise/e2e/infra/chrome_ent_test_case.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunWebDriverTest | <not_specific> | def RunWebDriverTest(self, instance_name, test_file, args=[]):
"""Runs a python webdriver test on an instance.
Args:
instance_name: name of the instance.
test_file: the path of the webdriver test file.
args: the list of arguments passed to the test.
Returns:
the output."""
self... | Runs a python webdriver test on an instance.
Args:
instance_name: name of the instance.
test_file: the path of the webdriver test file.
args: the list of arguments passed to the test.
Returns:
the output. | Runs a python webdriver test on an instance. | [
"Runs",
"a",
"python",
"webdriver",
"test",
"on",
"an",
"instance",
"."
] | def RunWebDriverTest(self, instance_name, test_file, args=[]):
self.EnsurePythonInstalled(instance_name)
file_name = self.UploadFile(instance_name, test_file, r'c:\temp')
args = subprocess.list2cmdline(args)
cmd = r'%s %s %s' % (self._pythonExecutablePath[instance_name], file_name,
... | [
"def",
"RunWebDriverTest",
"(",
"self",
",",
"instance_name",
",",
"test_file",
",",
"args",
"=",
"[",
"]",
")",
":",
"self",
".",
"EnsurePythonInstalled",
"(",
"instance_name",
")",
"file_name",
"=",
"self",
".",
"UploadFile",
"(",
"instance_name",
",",
"te... | Runs a python webdriver test on an instance. | [
"Runs",
"a",
"python",
"webdriver",
"test",
"on",
"an",
"instance",
"."
] | [
"\"\"\"Runs a python webdriver test on an instance.\n\n Args:\n instance_name: name of the instance.\n test_file: the path of the webdriver test file.\n args: the list of arguments passed to the test.\n\n Returns:\n the output.\"\"\"",
"# upload the test",
"# run the test"
] | [
{
"param": "self",
"type": null
},
{
"param": "instance_name",
"type": null
},
{
"param": "test_file",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
4716277af161e8da241f3dac92605e3e484acfc5 | sunlongbo/chromium | chrome/test/enterprise/e2e/infra/chrome_ent_test_case.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunUITest | <not_specific> | def RunUITest(self, instance_name, test_file, timeout=300, args=[]):
"""Runs a UI test on an instance.
Args:
instance_name: name of the instance.
test_file: the path of the UI test file.
timeout: the timeout in seconds. Default is 300,
i.e. 5 minutes.
args: the list of ar... | Runs a UI test on an instance.
Args:
instance_name: name of the instance.
test_file: the path of the UI test file.
timeout: the timeout in seconds. Default is 300,
i.e. 5 minutes.
args: the list of arguments passed to the test.
Returns:
the output. | Runs a UI test on an instance. | [
"Runs",
"a",
"UI",
"test",
"on",
"an",
"instance",
"."
] | def RunUITest(self, instance_name, test_file, timeout=300, args=[]):
self.EnsurePythonInstalled(instance_name)
file_name = self.UploadFile(instance_name, test_file, r'c:\temp')
args = subprocess.list2cmdline(args)
ui_test_cmd = r'%s -u %s %s' % (self._pythonExecutablePath[instance_name],
... | [
"def",
"RunUITest",
"(",
"self",
",",
"instance_name",
",",
"test_file",
",",
"timeout",
"=",
"300",
",",
"args",
"=",
"[",
"]",
")",
":",
"self",
".",
"EnsurePythonInstalled",
"(",
"instance_name",
")",
"file_name",
"=",
"self",
".",
"UploadFile",
"(",
... | Runs a UI test on an instance. | [
"Runs",
"a",
"UI",
"test",
"on",
"an",
"instance",
"."
] | [
"\"\"\"Runs a UI test on an instance.\n\n Args:\n instance_name: name of the instance.\n test_file: the path of the UI test file.\n timeout: the timeout in seconds. Default is 300,\n i.e. 5 minutes.\n args: the list of arguments passed to the test.\n\n Returns:\n the out... | [
{
"param": "self",
"type": null
},
{
"param": "instance_name",
"type": null
},
{
"param": "test_file",
"type": null
},
{
"param": "timeout",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
4716277af161e8da241f3dac92605e3e484acfc5 | sunlongbo/chromium | chrome/test/enterprise/e2e/infra/chrome_ent_test_case.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | EnableUITest | null | def EnableUITest(self, instance_name):
"""Configures the instance so that UI tests can be run on it."""
self.InstallWebDriver(instance_name)
self.InstallChocolateyPackage(instance_name, 'chocolatey_core_extension',
'1.3.3')
self.InstallChocolateyPackageLatest(instance_n... | Configures the instance so that UI tests can be run on it. | Configures the instance so that UI tests can be run on it. | [
"Configures",
"the",
"instance",
"so",
"that",
"UI",
"tests",
"can",
"be",
"run",
"on",
"it",
"."
] | def EnableUITest(self, instance_name):
self.InstallWebDriver(instance_name)
self.InstallChocolateyPackage(instance_name, 'chocolatey_core_extension',
'1.3.3')
self.InstallChocolateyPackageLatest(instance_name, 'sysinternals')
self.InstallPipPackagesLatest(instance_name,... | [
"def",
"EnableUITest",
"(",
"self",
",",
"instance_name",
")",
":",
"self",
".",
"InstallWebDriver",
"(",
"instance_name",
")",
"self",
".",
"InstallChocolateyPackage",
"(",
"instance_name",
",",
"'chocolatey_core_extension'",
",",
"'1.3.3'",
")",
"self",
".",
"In... | Configures the instance so that UI tests can be run on it. | [
"Configures",
"the",
"instance",
"so",
"that",
"UI",
"tests",
"can",
"be",
"run",
"on",
"it",
"."
] | [
"\"\"\"Configures the instance so that UI tests can be run on it.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "instance_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "instance_name",
"type": null,
"docstring": null,
"docstring_t... |
9fe564313ae1f0e2ed91279bb6388097e5239836 | sunlongbo/chromium | build/fuchsia/boot_data.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetAuthorizedKeysPath | <not_specific> | def _GetAuthorizedKeysPath():
"""Returns a path to the authorized keys which get copied to your Fuchsia
device during paving"""
return os.path.join(_SSH_DIR, 'fuchsia_authorized_keys') | Returns a path to the authorized keys which get copied to your Fuchsia
device during paving | Returns a path to the authorized keys which get copied to your Fuchsia
device during paving | [
"Returns",
"a",
"path",
"to",
"the",
"authorized",
"keys",
"which",
"get",
"copied",
"to",
"your",
"Fuchsia",
"device",
"during",
"paving"
] | def _GetAuthorizedKeysPath():
return os.path.join(_SSH_DIR, 'fuchsia_authorized_keys') | [
"def",
"_GetAuthorizedKeysPath",
"(",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"_SSH_DIR",
",",
"'fuchsia_authorized_keys'",
")"
] | Returns a path to the authorized keys which get copied to your Fuchsia
device during paving | [
"Returns",
"a",
"path",
"to",
"the",
"authorized",
"keys",
"which",
"get",
"copied",
"to",
"your",
"Fuchsia",
"device",
"during",
"paving"
] | [
"\"\"\"Returns a path to the authorized keys which get copied to your Fuchsia\n device during paving\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
9fe564313ae1f0e2ed91279bb6388097e5239836 | sunlongbo/chromium | build/fuchsia/boot_data.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ProvisionSSH | null | def ProvisionSSH():
"""Generates a key pair and config file for SSH using the GN SDK."""
returncode, out, err = common.RunGnSdkFunction('fuchsia-common.sh',
'check-fuchsia-ssh-config')
if returncode != 0:
logging.error('Command exited with error code %d' % (re... | Generates a key pair and config file for SSH using the GN SDK. | Generates a key pair and config file for SSH using the GN SDK. | [
"Generates",
"a",
"key",
"pair",
"and",
"config",
"file",
"for",
"SSH",
"using",
"the",
"GN",
"SDK",
"."
] | def ProvisionSSH():
returncode, out, err = common.RunGnSdkFunction('fuchsia-common.sh',
'check-fuchsia-ssh-config')
if returncode != 0:
logging.error('Command exited with error code %d' % (returncode))
logging.error('Stdout: %s' % out)
logging.error('Stde... | [
"def",
"ProvisionSSH",
"(",
")",
":",
"returncode",
",",
"out",
",",
"err",
"=",
"common",
".",
"RunGnSdkFunction",
"(",
"'fuchsia-common.sh'",
",",
"'check-fuchsia-ssh-config'",
")",
"if",
"returncode",
"!=",
"0",
":",
"logging",
".",
"error",
"(",
"'Command ... | Generates a key pair and config file for SSH using the GN SDK. | [
"Generates",
"a",
"key",
"pair",
"and",
"config",
"file",
"for",
"SSH",
"using",
"the",
"GN",
"SDK",
"."
] | [
"\"\"\"Generates a key pair and config file for SSH using the GN SDK.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
9fe564313ae1f0e2ed91279bb6388097e5239836 | sunlongbo/chromium | build/fuchsia/boot_data.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetBootImage | <not_specific> | def GetBootImage(output_dir, target_arch, target_type):
""""Gets a path to the Zircon boot image, with the SSH client public key
added."""
ProvisionSSH()
authkeys_path = _GetAuthorizedKeysPath()
zbi_tool = common.GetHostToolPathFromPlatform('zbi')
image_source_path = GetTargetFile('zircon-a.zbi', target_arc... | Gets a path to the Zircon boot image, with the SSH client public key
added. | Gets a path to the Zircon boot image, with the SSH client public key
added. | [
"Gets",
"a",
"path",
"to",
"the",
"Zircon",
"boot",
"image",
"with",
"the",
"SSH",
"client",
"public",
"key",
"added",
"."
] | def GetBootImage(output_dir, target_arch, target_type):
ProvisionSSH()
authkeys_path = _GetAuthorizedKeysPath()
zbi_tool = common.GetHostToolPathFromPlatform('zbi')
image_source_path = GetTargetFile('zircon-a.zbi', target_arch, target_type)
image_dest_path = os.path.join(output_dir, 'gen', 'fuchsia-with-keys.... | [
"def",
"GetBootImage",
"(",
"output_dir",
",",
"target_arch",
",",
"target_type",
")",
":",
"ProvisionSSH",
"(",
")",
"authkeys_path",
"=",
"_GetAuthorizedKeysPath",
"(",
")",
"zbi_tool",
"=",
"common",
".",
"GetHostToolPathFromPlatform",
"(",
"'zbi'",
")",
"image... | Gets a path to the Zircon boot image, with the SSH client public key
added. | [
"Gets",
"a",
"path",
"to",
"the",
"Zircon",
"boot",
"image",
"with",
"the",
"SSH",
"client",
"public",
"key",
"added",
"."
] | [
"\"\"\"\"Gets a path to the Zircon boot image, with the SSH client public key\n added.\"\"\""
] | [
{
"param": "output_dir",
"type": null
},
{
"param": "target_arch",
"type": null
},
{
"param": "target_type",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "output_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target_arch",
"type": null,
"docstring": null,
"docstri... |
9fe564313ae1f0e2ed91279bb6388097e5239836 | sunlongbo/chromium | build/fuchsia/boot_data.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetKernelArgs | <not_specific> | def GetKernelArgs():
"""Returns a list of Zircon commandline arguments to use when booting a
system."""
return [
'devmgr.epoch=%d' % time.time(),
'blobfs.write-compression-algorithm=UNCOMPRESSED'
] | Returns a list of Zircon commandline arguments to use when booting a
system. | Returns a list of Zircon commandline arguments to use when booting a
system. | [
"Returns",
"a",
"list",
"of",
"Zircon",
"commandline",
"arguments",
"to",
"use",
"when",
"booting",
"a",
"system",
"."
] | def GetKernelArgs():
return [
'devmgr.epoch=%d' % time.time(),
'blobfs.write-compression-algorithm=UNCOMPRESSED'
] | [
"def",
"GetKernelArgs",
"(",
")",
":",
"return",
"[",
"'devmgr.epoch=%d'",
"%",
"time",
".",
"time",
"(",
")",
",",
"'blobfs.write-compression-algorithm=UNCOMPRESSED'",
"]"
] | Returns a list of Zircon commandline arguments to use when booting a
system. | [
"Returns",
"a",
"list",
"of",
"Zircon",
"commandline",
"arguments",
"to",
"use",
"when",
"booting",
"a",
"system",
"."
] | [
"\"\"\"Returns a list of Zircon commandline arguments to use when booting a\n system.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
5b1b78eac1acf28a87596a891229e53637490ff8 | sunlongbo/chromium | tools/metrics/histograms/update_use_counter_css.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | EnumToCssProperty | <not_specific> | def EnumToCssProperty(enum_name):
"""Converts a camel cased enum name to the lower case CSS property."""
# The first group also searches for uppercase letters to account for single
# uppercase letters, such as in "ZIndex" that need to convert to "z-index".
# Special case total page measured for backward compat... | Converts a camel cased enum name to the lower case CSS property. | Converts a camel cased enum name to the lower case CSS property. | [
"Converts",
"a",
"camel",
"cased",
"enum",
"name",
"to",
"the",
"lower",
"case",
"CSS",
"property",
"."
] | def EnumToCssProperty(enum_name):
if enum_name == "TotalPagesMeasured":
return "Total Pages Measured"
return re.sub(r'([a-zA-Z])([A-Z])', r'\1-\2', enum_name).lower() | [
"def",
"EnumToCssProperty",
"(",
"enum_name",
")",
":",
"if",
"enum_name",
"==",
"\"TotalPagesMeasured\"",
":",
"return",
"\"Total Pages Measured\"",
"return",
"re",
".",
"sub",
"(",
"r'([a-zA-Z])([A-Z])'",
",",
"r'\\1-\\2'",
",",
"enum_name",
")",
".",
"lower",
"... | Converts a camel cased enum name to the lower case CSS property. | [
"Converts",
"a",
"camel",
"cased",
"enum",
"name",
"to",
"the",
"lower",
"case",
"CSS",
"property",
"."
] | [
"\"\"\"Converts a camel cased enum name to the lower case CSS property.\"\"\"",
"# The first group also searches for uppercase letters to account for single",
"# uppercase letters, such as in \"ZIndex\" that need to convert to \"z-index\".",
"# Special case total page measured for backward compat."
] | [
{
"param": "enum_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "enum_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f236c3c45fe0504a5cc84c5d6180e61ba9e11676 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/message_pool.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | run | null | def run(self, shards):
"""Posts a list of messages to the pool and waits for them to complete."""
for message in shards:
self._messages_to_worker.put(
_Message(
self._name,
message[0],
message[1:],
... | Posts a list of messages to the pool and waits for them to complete. | Posts a list of messages to the pool and waits for them to complete. | [
"Posts",
"a",
"list",
"of",
"messages",
"to",
"the",
"pool",
"and",
"waits",
"for",
"them",
"to",
"complete",
"."
] | def run(self, shards):
for message in shards:
self._messages_to_worker.put(
_Message(
self._name,
message[0],
message[1:],
from_user=True,
logs=()))
for _ in range(self._num_wo... | [
"def",
"run",
"(",
"self",
",",
"shards",
")",
":",
"for",
"message",
"in",
"shards",
":",
"self",
".",
"_messages_to_worker",
".",
"put",
"(",
"_Message",
"(",
"self",
".",
"_name",
",",
"message",
"[",
"0",
"]",
",",
"message",
"[",
"1",
":",
"]"... | Posts a list of messages to the pool and waits for them to complete. | [
"Posts",
"a",
"list",
"of",
"messages",
"to",
"the",
"pool",
"and",
"waits",
"for",
"them",
"to",
"complete",
"."
] | [
"\"\"\"Posts a list of messages to the pool and waits for them to complete.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "shards",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "shards",
"type": null,
"docstring": null,
"docstring_tokens":... |
59162de55f8bea6cf23bcb060519214dbf1044d3 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/breakpad/dump_reader_multipart.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _binaries_to_symbolize | null | def _binaries_to_symbolize(self):
"""This routine must be implemented by subclasses.
Returns an array of binaries that need to be symbolized.
"""
raise NotImplementedError() | This routine must be implemented by subclasses.
Returns an array of binaries that need to be symbolized.
| This routine must be implemented by subclasses.
Returns an array of binaries that need to be symbolized. | [
"This",
"routine",
"must",
"be",
"implemented",
"by",
"subclasses",
".",
"Returns",
"an",
"array",
"of",
"binaries",
"that",
"need",
"to",
"be",
"symbolized",
"."
] | def _binaries_to_symbolize(self):
raise NotImplementedError() | [
"def",
"_binaries_to_symbolize",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | This routine must be implemented by subclasses. | [
"This",
"routine",
"must",
"be",
"implemented",
"by",
"subclasses",
"."
] | [
"\"\"\"This routine must be implemented by subclasses.\n\n Returns an array of binaries that need to be symbolized.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
59239484296bcb3ad07b5757fd008a96cb35060c | sunlongbo/chromium | tools/android/dependency_analysis/print_class_dependencies.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | categorize_dependency | str | def categorize_dependency(from_class: class_dependency.JavaClass,
to_class: class_dependency.JavaClass,
ignore_modularized: bool, print_mode: PrintMode,
audited_classes: Set[str]) -> str:
"""Decides if a class dependency should be printed... | Decides if a class dependency should be printed, cleared, or ignored. | Decides if a class dependency should be printed, cleared, or ignored. | [
"Decides",
"if",
"a",
"class",
"dependency",
"should",
"be",
"printed",
"cleared",
"or",
"ignored",
"."
] | def categorize_dependency(from_class: class_dependency.JavaClass,
to_class: class_dependency.JavaClass,
ignore_modularized: bool, print_mode: PrintMode,
audited_classes: Set[str]) -> str:
if is_ignored_class_dependency(to_class.name):
... | [
"def",
"categorize_dependency",
"(",
"from_class",
":",
"class_dependency",
".",
"JavaClass",
",",
"to_class",
":",
"class_dependency",
".",
"JavaClass",
",",
"ignore_modularized",
":",
"bool",
",",
"print_mode",
":",
"PrintMode",
",",
"audited_classes",
":",
"Set",... | Decides if a class dependency should be printed, cleared, or ignored. | [
"Decides",
"if",
"a",
"class",
"dependency",
"should",
"be",
"printed",
"cleared",
"or",
"ignored",
"."
] | [
"\"\"\"Decides if a class dependency should be printed, cleared, or ignored.\"\"\""
] | [
{
"param": "from_class",
"type": "class_dependency.JavaClass"
},
{
"param": "to_class",
"type": "class_dependency.JavaClass"
},
{
"param": "ignore_modularized",
"type": "bool"
},
{
"param": "print_mode",
"type": "PrintMode"
},
{
"param": "audited_classes",
"ty... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "from_class",
"type": "class_dependency.JavaClass",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "to_class",
"type": "class_dependency.JavaCl... |
59239484296bcb3ad07b5757fd008a96cb35060c | sunlongbo/chromium | tools/android/dependency_analysis/print_class_dependencies.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | print_class_dependencies | TargetDependencies | def print_class_dependencies(to_classes: List[class_dependency.JavaClass],
print_mode: PrintMode,
from_class: class_dependency.JavaClass,
direction: str,
audited_classes: Set[str]) -> TargetDependencies:
... | Prints the class dependencies to or from a class, grouped by target.
If direction is OUTBOUND and print_mode.ignore_modularized is True, omits
modularized outbound dependencies and returns the build targets that need
to be added for those dependencies. In other cases, returns an empty
TargetDependencie... | Prints the class dependencies to or from a class, grouped by target.
If direction is OUTBOUND and print_mode.ignore_modularized is True, omits
modularized outbound dependencies and returns the build targets that need
to be added for those dependencies. In other cases, returns an empty
TargetDependencies.
If print_mode... | [
"Prints",
"the",
"class",
"dependencies",
"to",
"or",
"from",
"a",
"class",
"grouped",
"by",
"target",
".",
"If",
"direction",
"is",
"OUTBOUND",
"and",
"print_mode",
".",
"ignore_modularized",
"is",
"True",
"omits",
"modularized",
"outbound",
"dependencies",
"an... | def print_class_dependencies(to_classes: List[class_dependency.JavaClass],
print_mode: PrintMode,
from_class: class_dependency.JavaClass,
direction: str,
audited_classes: Set[str]) -> TargetDependencies:
... | [
"def",
"print_class_dependencies",
"(",
"to_classes",
":",
"List",
"[",
"class_dependency",
".",
"JavaClass",
"]",
",",
"print_mode",
":",
"PrintMode",
",",
"from_class",
":",
"class_dependency",
".",
"JavaClass",
",",
"direction",
":",
"str",
",",
"audited_classe... | Prints the class dependencies to or from a class, grouped by target. | [
"Prints",
"the",
"class",
"dependencies",
"to",
"or",
"from",
"a",
"class",
"grouped",
"by",
"target",
"."
] | [
"\"\"\"Prints the class dependencies to or from a class, grouped by target.\n\n If direction is OUTBOUND and print_mode.ignore_modularized is True, omits\n modularized outbound dependencies and returns the build targets that need\n to be added for those dependencies. In other cases, returns an empty\n T... | [
{
"param": "to_classes",
"type": "List[class_dependency.JavaClass]"
},
{
"param": "print_mode",
"type": "PrintMode"
},
{
"param": "from_class",
"type": "class_dependency.JavaClass"
},
{
"param": "direction",
"type": "str"
},
{
"param": "audited_classes",
"type... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "to_classes",
"type": "List[class_dependency.JavaClass]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "print_mode",
"type": "PrintMode",
... |
59239484296bcb3ad07b5757fd008a96cb35060c | sunlongbo/chromium | tools/android/dependency_analysis/print_class_dependencies.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | print_class_dependencies_for_key | TargetDependencies | def print_class_dependencies_for_key(
class_graph: class_dependency.JavaClassDependencyGraph, key: str,
print_mode: PrintMode,
audited_classes: Set[str]) -> TargetDependencies:
"""Prints dependencies for a valid key into the class graph."""
target_dependencies = TargetDependencies()
... | Prints dependencies for a valid key into the class graph. | Prints dependencies for a valid key into the class graph. | [
"Prints",
"dependencies",
"for",
"a",
"valid",
"key",
"into",
"the",
"class",
"graph",
"."
] | def print_class_dependencies_for_key(
class_graph: class_dependency.JavaClassDependencyGraph, key: str,
print_mode: PrintMode,
audited_classes: Set[str]) -> TargetDependencies:
target_dependencies = TargetDependencies()
node: class_dependency.JavaClass = class_graph.get_node_by_key(key)
... | [
"def",
"print_class_dependencies_for_key",
"(",
"class_graph",
":",
"class_dependency",
".",
"JavaClassDependencyGraph",
",",
"key",
":",
"str",
",",
"print_mode",
":",
"PrintMode",
",",
"audited_classes",
":",
"Set",
"[",
"str",
"]",
")",
"->",
"TargetDependencies"... | Prints dependencies for a valid key into the class graph. | [
"Prints",
"dependencies",
"for",
"a",
"valid",
"key",
"into",
"the",
"class",
"graph",
"."
] | [
"\"\"\"Prints dependencies for a valid key into the class graph.\"\"\""
] | [
{
"param": "class_graph",
"type": "class_dependency.JavaClassDependencyGraph"
},
{
"param": "key",
"type": "str"
},
{
"param": "print_mode",
"type": "PrintMode"
},
{
"param": "audited_classes",
"type": "Set[str]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "class_graph",
"type": "class_dependency.JavaClassDependencyGraph",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "key",
"type": "str",
... |
59239484296bcb3ad07b5757fd008a96cb35060c | sunlongbo/chromium | tools/android/dependency_analysis/print_class_dependencies.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | main | null | def main():
"""Prints class-level dependencies for one or more input classes."""
arg_parser = argparse.ArgumentParser(
description='Given a JSON dependency graph, output '
'the class-level dependencies for a given list of classes.')
required_arg_group = arg_parser.add_argument_group('require... | Prints class-level dependencies for one or more input classes. | Prints class-level dependencies for one or more input classes. | [
"Prints",
"class",
"-",
"level",
"dependencies",
"for",
"one",
"or",
"more",
"input",
"classes",
"."
] | def main():
arg_parser = argparse.ArgumentParser(
description='Given a JSON dependency graph, output '
'the class-level dependencies for a given list of classes.')
required_arg_group = arg_parser.add_argument_group('required arguments')
required_arg_group.add_argument(
'-f',
... | [
"def",
"main",
"(",
")",
":",
"arg_parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Given a JSON dependency graph, output '",
"'the class-level dependencies for a given list of classes.'",
")",
"required_arg_group",
"=",
"arg_parser",
".",
"add_argu... | Prints class-level dependencies for one or more input classes. | [
"Prints",
"class",
"-",
"level",
"dependencies",
"for",
"one",
"or",
"more",
"input",
"classes",
"."
] | [
"\"\"\"Prints class-level dependencies for one or more input classes.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | iteratively_replace_matches_with_char | <not_specific> | def iteratively_replace_matches_with_char(pattern, char_replacement, s):
"""Returns the string with replacement done.
Every character in the match is replaced with char.
Due to the iterative nature, pattern should not match char or
there will be an infinite loop.
Example:
pattern = r'<[^>]>'... | Returns the string with replacement done.
Every character in the match is replaced with char.
Due to the iterative nature, pattern should not match char or
there will be an infinite loop.
Example:
pattern = r'<[^>]>' # template parameters
char_replacement = '_'
s = 'A<B<C, D>>'
... | Returns the string with replacement done.
Every character in the match is replaced with char.
Due to the iterative nature, pattern should not match char or
there will be an infinite loop. | [
"Returns",
"the",
"string",
"with",
"replacement",
"done",
".",
"Every",
"character",
"in",
"the",
"match",
"is",
"replaced",
"with",
"char",
".",
"Due",
"to",
"the",
"iterative",
"nature",
"pattern",
"should",
"not",
"match",
"char",
"or",
"there",
"will",
... | def iteratively_replace_matches_with_char(pattern, char_replacement, s):
while True:
matched = search(pattern, s)
if not matched:
return s
start_match_index = matched.start(0)
end_match_index = matched.end(0)
match_length = end_match_index - start_match_index
... | [
"def",
"iteratively_replace_matches_with_char",
"(",
"pattern",
",",
"char_replacement",
",",
"s",
")",
":",
"while",
"True",
":",
"matched",
"=",
"search",
"(",
"pattern",
",",
"s",
")",
"if",
"not",
"matched",
":",
"return",
"s",
"start_match_index",
"=",
... | Returns the string with replacement done. | [
"Returns",
"the",
"string",
"with",
"replacement",
"done",
"."
] | [
"\"\"\"Returns the string with replacement done.\n\n Every character in the match is replaced with char.\n Due to the iterative nature, pattern should not match char or\n there will be an infinite loop.\n\n Example:\n pattern = r'<[^>]>' # template parameters\n char_replacement = '_'\n s... | [
{
"param": "pattern",
"type": null
},
{
"param": "char_replacement",
"type": null
},
{
"param": "s",
"type": null
}
] | {
"returns": [
{
"docstring": "True, if the given line is blank.",
"docstring_tokens": [
"True",
"if",
"the",
"given",
"line",
"is",
"blank",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check | null | def check(self, error, line_number):
"""Report if too many lines in function body.
Args:
error: The function to call with any errors found.
line_number: The number of the line to check.
"""
if match(r'T(EST|est)', self.current_function):
base_trigger = se... | Report if too many lines in function body.
Args:
error: The function to call with any errors found.
line_number: The number of the line to check.
| Report if too many lines in function body. | [
"Report",
"if",
"too",
"many",
"lines",
"in",
"function",
"body",
"."
] | def check(self, error, line_number):
if match(r'T(EST|est)', self.current_function):
base_trigger = self._TEST_TRIGGER
else:
base_trigger = self._NORMAL_TRIGGER
trigger = base_trigger * 2**self.min_confidence
if self.lines_in_function > trigger:
error_... | [
"def",
"check",
"(",
"self",
",",
"error",
",",
"line_number",
")",
":",
"if",
"match",
"(",
"r'T(EST|est)'",
",",
"self",
".",
"current_function",
")",
":",
"base_trigger",
"=",
"self",
".",
"_TEST_TRIGGER",
"else",
":",
"base_trigger",
"=",
"self",
".",
... | Report if too many lines in function body. | [
"Report",
"if",
"too",
"many",
"lines",
"in",
"function",
"body",
"."
] | [
"\"\"\"Report if too many lines in function body.\n\n Args:\n error: The function to call with any errors found.\n line_number: The number of the line to check.\n \"\"\"",
"# 50 => 0, 100 => 1, 200 => 2, 400 => 3, 800 => 4, 1600 => 5, ..."
] | [
{
"param": "self",
"type": null
},
{
"param": "error",
"type": null
},
{
"param": "line_number",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "error",
"type": null,
"docstring": "The function to call with any e... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | repository_name | <not_specific> | def repository_name(self):
"""Full name after removing the local path to the repository.
If we have a real absolute path name here we can try to do something smart:
detecting the root of the checkout and truncating /path/to/checkout from
the name so that we get header guards that don't ... | Full name after removing the local path to the repository.
If we have a real absolute path name here we can try to do something smart:
detecting the root of the checkout and truncating /path/to/checkout from
the name so that we get header guards that don't include things like
"C:\Docume... | Full name after removing the local path to the repository. | [
"Full",
"name",
"after",
"removing",
"the",
"local",
"path",
"to",
"the",
"repository",
"."
] | def repository_name(self):
fullname = self.full_name()
if os.path.exists(fullname):
project_dir = os.path.dirname(fullname)
root_dir = os.path.dirname(fullname)
while (root_dir != os.path.dirname(root_dir)
and not os.path.exists(os.path.join(root_di... | [
"def",
"repository_name",
"(",
"self",
")",
":",
"fullname",
"=",
"self",
".",
"full_name",
"(",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"fullname",
")",
":",
"project_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"fullname",
")",
"roo... | Full name after removing the local path to the repository. | [
"Full",
"name",
"after",
"removing",
"the",
"local",
"path",
"to",
"the",
"repository",
"."
] | [
"\"\"\"Full name after removing the local path to the repository.\n\n If we have a real absolute path name here we can try to do something smart:\n detecting the root of the checkout and truncating /path/to/checkout from\n the name so that we get header guards that don't include things like\n ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | split | <not_specific> | def split(self):
"""Splits the file into the directory, basename, and extension.
For 'chrome/browser/browser.cpp', Split() would
return ('chrome/browser', 'browser', '.cpp')
Returns:
A tuple of (directory, basename, extension).
"""
googlename = self.repositor... | Splits the file into the directory, basename, and extension.
For 'chrome/browser/browser.cpp', Split() would
return ('chrome/browser', 'browser', '.cpp')
Returns:
A tuple of (directory, basename, extension).
| Splits the file into the directory, basename, and extension. | [
"Splits",
"the",
"file",
"into",
"the",
"directory",
"basename",
"and",
"extension",
"."
] | def split(self):
googlename = self.repository_name()
project, rest = os.path.split(googlename)
return (project, ) + os.path.splitext(rest) | [
"def",
"split",
"(",
"self",
")",
":",
"googlename",
"=",
"self",
".",
"repository_name",
"(",
")",
"project",
",",
"rest",
"=",
"os",
".",
"path",
".",
"split",
"(",
"googlename",
")",
"return",
"(",
"project",
",",
")",
"+",
"os",
".",
"path",
".... | Splits the file into the directory, basename, and extension. | [
"Splits",
"the",
"file",
"into",
"the",
"directory",
"basename",
"and",
"extension",
"."
] | [
"\"\"\"Splits the file into the directory, basename, and extension.\n\n For 'chrome/browser/browser.cpp', Split() would\n return ('chrome/browser', 'browser', '.cpp')\n\n Returns:\n A tuple of (directory, basename, extension).\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "A tuple of (directory, basename, extension).",
"docstring_tokens": [
"A",
"tuple",
"of",
"(",
"directory",
"basename",
"extension",
")",
"."
],
"type": null
}
],
"raises": [],
"... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | is_cpp_string | <not_specific> | def is_cpp_string(line):
"""Does line terminate so, that the next symbol is in string constant.
This function does not consider single-line nor multi-line comments.
Args:
line: is a partial line of code starting from the 0..n.
Returns:
True, if next character appended to 'line' is inside ... | Does line terminate so, that the next symbol is in string constant.
This function does not consider single-line nor multi-line comments.
Args:
line: is a partial line of code starting from the 0..n.
Returns:
True, if next character appended to 'line' is inside a
string constant.
| Does line terminate so, that the next symbol is in string constant.
This function does not consider single-line nor multi-line comments. | [
"Does",
"line",
"terminate",
"so",
"that",
"the",
"next",
"symbol",
"is",
"in",
"string",
"constant",
".",
"This",
"function",
"does",
"not",
"consider",
"single",
"-",
"line",
"nor",
"multi",
"-",
"line",
"comments",
"."
] | def is_cpp_string(line):
line = line.replace(r'\\', 'XX')
return (
(line.count('"') - line.count(r'\"') - line.count("'\"'")) & 1) == 1 | [
"def",
"is_cpp_string",
"(",
"line",
")",
":",
"line",
"=",
"line",
".",
"replace",
"(",
"r'\\\\'",
",",
"'XX'",
")",
"return",
"(",
"(",
"line",
".",
"count",
"(",
"'\"'",
")",
"-",
"line",
".",
"count",
"(",
"r'\\\"'",
")",
"-",
"line",
".",
"c... | Does line terminate so, that the next symbol is in string constant. | [
"Does",
"line",
"terminate",
"so",
"that",
"the",
"next",
"symbol",
"is",
"in",
"string",
"constant",
"."
] | [
"\"\"\"Does line terminate so, that the next symbol is in string constant.\n\n This function does not consider single-line nor multi-line comments.\n\n Args:\n line: is a partial line of code starting from the 0..n.\n\n Returns:\n True, if next character appended to 'line' is inside a\n stri... | [
{
"param": "line",
"type": null
}
] | {
"returns": [
{
"docstring": "True, if next character appended to 'line' is inside a\nstring constant.",
"docstring_tokens": [
"True",
"if",
"next",
"character",
"appended",
"to",
"'",
"line",
"'",
"is",
"inside",... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | remove_multi_line_comments | <not_specific> | def remove_multi_line_comments(lines, error):
"""Removes multiline (c-style) comments from lines."""
line_index = 0
while line_index < len(lines):
line_index_begin = find_next_multi_line_comment_start(
lines, line_index)
if line_index_begin >= len(lines):
return
... | Removes multiline (c-style) comments from lines. | Removes multiline (c-style) comments from lines. | [
"Removes",
"multiline",
"(",
"c",
"-",
"style",
")",
"comments",
"from",
"lines",
"."
] | def remove_multi_line_comments(lines, error):
line_index = 0
while line_index < len(lines):
line_index_begin = find_next_multi_line_comment_start(
lines, line_index)
if line_index_begin >= len(lines):
return
line_index_end = find_next_multi_line_comment_end(
... | [
"def",
"remove_multi_line_comments",
"(",
"lines",
",",
"error",
")",
":",
"line_index",
"=",
"0",
"while",
"line_index",
"<",
"len",
"(",
"lines",
")",
":",
"line_index_begin",
"=",
"find_next_multi_line_comment_start",
"(",
"lines",
",",
"line_index",
")",
"if... | Removes multiline (c-style) comments from lines. | [
"Removes",
"multiline",
"(",
"c",
"-",
"style",
")",
"comments",
"from",
"lines",
"."
] | [
"\"\"\"Removes multiline (c-style) comments from lines.\"\"\""
] | [
{
"param": "lines",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lines",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "error",
"type": null,
"docstring": null,
"docstring_tokens":... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_for_copyright | null | def check_for_copyright(lines, error):
"""Logs an error if no Copyright message appears at the top of the file."""
# We'll say it should occur by line 10. Don't forget there's a
# dummy line at the front.
for line in xrange(1, min(len(lines), 11)):
if re.search(r'Copyright', lines[line], re.I):... | Logs an error if no Copyright message appears at the top of the file. | Logs an error if no Copyright message appears at the top of the file. | [
"Logs",
"an",
"error",
"if",
"no",
"Copyright",
"message",
"appears",
"at",
"the",
"top",
"of",
"the",
"file",
"."
] | def check_for_copyright(lines, error):
for line in xrange(1, min(len(lines), 11)):
if re.search(r'Copyright', lines[line], re.I):
break
else:
error(
0, 'legal/copyright', 5, 'No copyright message found. '
'You should have a line: "Copyright [year] <Copyrigh... | [
"def",
"check_for_copyright",
"(",
"lines",
",",
"error",
")",
":",
"for",
"line",
"in",
"xrange",
"(",
"1",
",",
"min",
"(",
"len",
"(",
"lines",
")",
",",
"11",
")",
")",
":",
"if",
"re",
".",
"search",
"(",
"r'Copyright'",
",",
"lines",
"[",
"... | Logs an error if no Copyright message appears at the top of the file. | [
"Logs",
"an",
"error",
"if",
"no",
"Copyright",
"message",
"appears",
"at",
"the",
"top",
"of",
"the",
"file",
"."
] | [
"\"\"\"Logs an error if no Copyright message appears at the top of the file.\"\"\"",
"# We'll say it should occur by line 10. Don't forget there's a",
"# dummy line at the front.",
"# means no copyright line was found"
] | [
{
"param": "lines",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lines",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "error",
"type": null,
"docstring": null,
"docstring_tokens":... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_for_header_guard | <not_specific> | def check_for_header_guard(filename, clean_lines, error):
"""Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used.
Args:
filename: The name of the C++ header file.
lines: An array of str... | Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used.
Args:
filename: The name of the C++ header file.
lines: An array of strings, each representing a line of the file.
error: The func... | Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used. | [
"Checks",
"that",
"the",
"file",
"contains",
"a",
"header",
"guard",
".",
"Logs",
"an",
"error",
"if",
"no",
"#ifndef",
"header",
"guard",
"is",
"present",
".",
"For",
"other",
"headers",
"checks",
"that",
"the",
"full",
"pathname",
"is",
"used",
"."
] | def check_for_header_guard(filename, clean_lines, error):
raw_lines = clean_lines.lines_without_raw_strings
cpp_var = get_header_guard_cpp_variable(filename)
ifndef = None
ifndef_line_number = 0
define = None
for line_number, line in enumerate(raw_lines):
line_split = line.split()
... | [
"def",
"check_for_header_guard",
"(",
"filename",
",",
"clean_lines",
",",
"error",
")",
":",
"raw_lines",
"=",
"clean_lines",
".",
"lines_without_raw_strings",
"cpp_var",
"=",
"get_header_guard_cpp_variable",
"(",
"filename",
")",
"ifndef",
"=",
"None",
"ifndef_line_... | Checks that the file contains a header guard. | [
"Checks",
"that",
"the",
"file",
"contains",
"a",
"header",
"guard",
"."
] | [
"\"\"\"Checks that the file contains a header guard.\n\n Logs an error if no #ifndef header guard is present. For other\n headers, checks that the full pathname is used.\n\n Args:\n filename: The name of the C++ header file.\n lines: An array of strings, each representing a line of the file.\n ... | [
{
"param": "filename",
"type": null
},
{
"param": "clean_lines",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": "The name of the C++ header file.",
"docstring_tokens": [
"The",
"name",
"of",
"the",
"C",
"++",
"header",
"file",
"... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_for_unicode_replacement_characters | null | def check_for_unicode_replacement_characters(lines, error):
"""Logs an error for each line containing Unicode replacement characters.
These indicate that either the file contained invalid UTF-8 (likely)
or Unicode replacement characters (which it shouldn't). Note that
it's possible for this to throw o... | Logs an error for each line containing Unicode replacement characters.
These indicate that either the file contained invalid UTF-8 (likely)
or Unicode replacement characters (which it shouldn't). Note that
it's possible for this to throw off line numbering if the invalid
UTF-8 occurred adjacent to a n... | Logs an error for each line containing Unicode replacement characters.
These indicate that either the file contained invalid UTF-8 (likely)
or Unicode replacement characters (which it shouldn't). Note that
it's possible for this to throw off line numbering if the invalid
UTF-8 occurred adjacent to a newline. | [
"Logs",
"an",
"error",
"for",
"each",
"line",
"containing",
"Unicode",
"replacement",
"characters",
".",
"These",
"indicate",
"that",
"either",
"the",
"file",
"contained",
"invalid",
"UTF",
"-",
"8",
"(",
"likely",
")",
"or",
"Unicode",
"replacement",
"charact... | def check_for_unicode_replacement_characters(lines, error):
for line_number, line in enumerate(lines):
if u'\ufffd' in line:
error(
line_number, 'readability/utf8', 5,
'Line contains invalid UTF-8 (or Unicode replacement character).'
) | [
"def",
"check_for_unicode_replacement_characters",
"(",
"lines",
",",
"error",
")",
":",
"for",
"line_number",
",",
"line",
"in",
"enumerate",
"(",
"lines",
")",
":",
"if",
"u'\\ufffd'",
"in",
"line",
":",
"error",
"(",
"line_number",
",",
"'readability/utf8'",
... | Logs an error for each line containing Unicode replacement characters. | [
"Logs",
"an",
"error",
"for",
"each",
"line",
"containing",
"Unicode",
"replacement",
"characters",
"."
] | [
"\"\"\"Logs an error for each line containing Unicode replacement characters.\n\n These indicate that either the file contained invalid UTF-8 (likely)\n or Unicode replacement characters (which it shouldn't). Note that\n it's possible for this to throw off line numbering if the invalid\n UTF-8 occurred... | [
{
"param": "lines",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lines",
"type": null,
"docstring": "An array of strings, each representing a line of the file.",
"docstring_tokens": [
"An",
"array",
"of",
"strings",
"each",
"representing",
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_for_new_line_at_eof | null | def check_for_new_line_at_eof(lines, error):
"""Logs an error if there is no newline char at the end of the file.
Args:
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found.
"""
# The array lines() was created by adding two new... | Logs an error if there is no newline char at the end of the file.
Args:
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found.
| Logs an error if there is no newline char at the end of the file. | [
"Logs",
"an",
"error",
"if",
"there",
"is",
"no",
"newline",
"char",
"at",
"the",
"end",
"of",
"the",
"file",
"."
] | def check_for_new_line_at_eof(lines, error):
if len(lines) < 3 or lines[-2]:
error(
len(lines) - 2, 'whitespace/ending_newline', 5,
'Could not find a newline character at the end of the file.') | [
"def",
"check_for_new_line_at_eof",
"(",
"lines",
",",
"error",
")",
":",
"if",
"len",
"(",
"lines",
")",
"<",
"3",
"or",
"lines",
"[",
"-",
"2",
"]",
":",
"error",
"(",
"len",
"(",
"lines",
")",
"-",
"2",
",",
"'whitespace/ending_newline'",
",",
"5"... | Logs an error if there is no newline char at the end of the file. | [
"Logs",
"an",
"error",
"if",
"there",
"is",
"no",
"newline",
"char",
"at",
"the",
"end",
"of",
"the",
"file",
"."
] | [
"\"\"\"Logs an error if there is no newline char at the end of the file.\n\n Args:\n lines: An array of strings, each representing a line of the file.\n error: The function to call with any errors found.\n \"\"\"",
"# The array lines() was created by adding two newlines to the",
"# original file... | [
{
"param": "lines",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lines",
"type": null,
"docstring": "An array of strings, each representing a line of the file.",
"docstring_tokens": [
"An",
"array",
"of",
"strings",
"each",
"representing",
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_posix_threading | null | def check_posix_threading(clean_lines, line_number, error):
"""Checks for calls to thread-unsafe functions.
Much code has been originally written without consideration of
multi-threading. Also, engineers are relying on their old experience;
they have learned posix before threading extensions were added... | Checks for calls to thread-unsafe functions.
Much code has been originally written without consideration of
multi-threading. Also, engineers are relying on their old experience;
they have learned posix before threading extensions were added. These
tests guide the engineers to use thread-safe functions ... | Checks for calls to thread-unsafe functions.
Much code has been originally written without consideration of
multi-threading. Also, engineers are relying on their old experience;
they have learned posix before threading extensions were added. These
tests guide the engineers to use thread-safe functions (when using
posix... | [
"Checks",
"for",
"calls",
"to",
"thread",
"-",
"unsafe",
"functions",
".",
"Much",
"code",
"has",
"been",
"originally",
"written",
"without",
"consideration",
"of",
"multi",
"-",
"threading",
".",
"Also",
"engineers",
"are",
"relying",
"on",
"their",
"old",
... | def check_posix_threading(clean_lines, line_number, error):
line = clean_lines.elided[line_number]
for single_thread_function, multithread_safe_function in _THREADING_LIST:
index = line.find(single_thread_function)
if index >= 0 and (index == 0 or
(not line[index - 1].... | [
"def",
"check_posix_threading",
"(",
"clean_lines",
",",
"line_number",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"line_number",
"]",
"for",
"single_thread_function",
",",
"multithread_safe_function",
"in",
"_THREADING_LIST",
":",
"inde... | Checks for calls to thread-unsafe functions. | [
"Checks",
"for",
"calls",
"to",
"thread",
"-",
"unsafe",
"functions",
"."
] | [
"\"\"\"Checks for calls to thread-unsafe functions.\n\n Much code has been originally written without consideration of\n multi-threading. Also, engineers are relying on their old experience;\n they have learned posix before threading extensions were added. These\n tests guide the engineers to use thread... | [
{
"param": "clean_lines",
"type": null
},
{
"param": "line_number",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clean_lines",
"type": null,
"docstring": "A CleansedLines instance containing the file.",
"docstring_tokens": [
"A",
"CleansedLines",
"instance",
"containing",
"the",
"file",
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_for_non_standard_constructs | <not_specific> | def check_for_non_standard_constructs(clean_lines, line_number, class_state,
error):
"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
Complain about several constructs which gcc-2 accepts, but which are
not standard C++. Warning about these in ... | Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
Complain about several constructs which gcc-2 accepts, but which are
not standard C++. Warning about these in lint is one way to ease the
transition to new compilers.
- put storage class first (e.g. "static const" instead of "const ... | Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
Complain about several constructs which gcc-2 accepts, but which are
not standard C++. Warning about these in lint is one way to ease the
transition to new compilers.
put storage class first .
"%lld" instead of %qd" in printf-type functions.
"%1$d" ... | [
"Logs",
"an",
"error",
"if",
"we",
"see",
"certain",
"non",
"-",
"ANSI",
"constructs",
"ignored",
"by",
"gcc",
"-",
"2",
".",
"Complain",
"about",
"several",
"constructs",
"which",
"gcc",
"-",
"2",
"accepts",
"but",
"which",
"are",
"not",
"standard",
"C"... | def check_for_non_standard_constructs(clean_lines, line_number, class_state,
error):
line = clean_lines.elided[line_number]
classinfo_stack = class_state.classinfo_stack
class_decl_match = match(
r'\s*(template\s*<[\w\s<>,:]*>\s*)?(class|struct)\s+(\w+(::\w+)*)'... | [
"def",
"check_for_non_standard_constructs",
"(",
"clean_lines",
",",
"line_number",
",",
"class_state",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"line_number",
"]",
"classinfo_stack",
"=",
"class_state",
".",
"classinfo_stack",
"class_... | Logs an error if we see certain non-ANSI constructs ignored by gcc-2. | [
"Logs",
"an",
"error",
"if",
"we",
"see",
"certain",
"non",
"-",
"ANSI",
"constructs",
"ignored",
"by",
"gcc",
"-",
"2",
"."
] | [
"\"\"\"Logs an error if we see certain non-ANSI constructs ignored by gcc-2.\n\n Complain about several constructs which gcc-2 accepts, but which are\n not standard C++. Warning about these in lint is one way to ease the\n transition to new compilers.\n - put storage class first (e.g. \"static const\" ... | [
{
"param": "clean_lines",
"type": null
},
{
"param": "line_number",
"type": null
},
{
"param": "class_state",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clean_lines",
"type": null,
"docstring": "A CleansedLines instance containing the file.",
"docstring_tokens": [
"A",
"CleansedLines",
"instance",
"containing",
"the",
"file",
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | detect_functions | <not_specific> | def detect_functions(clean_lines, line_number, function_state, error):
"""Finds where functions start and end.
Uses a simplistic algorithm assuming other style guidelines
(especially spacing) are followed.
Trivial bodies are unchecked, so constructors with huge initializer lists
may be missed.
... | Finds where functions start and end.
Uses a simplistic algorithm assuming other style guidelines
(especially spacing) are followed.
Trivial bodies are unchecked, so constructors with huge initializer lists
may be missed.
Args:
clean_lines: A CleansedLines instance containing the file.
... | Finds where functions start and end.
Uses a simplistic algorithm assuming other style guidelines
(especially spacing) are followed.
Trivial bodies are unchecked, so constructors with huge initializer lists
may be missed. | [
"Finds",
"where",
"functions",
"start",
"and",
"end",
".",
"Uses",
"a",
"simplistic",
"algorithm",
"assuming",
"other",
"style",
"guidelines",
"(",
"especially",
"spacing",
")",
"are",
"followed",
".",
"Trivial",
"bodies",
"are",
"unchecked",
"so",
"constructors... | def detect_functions(clean_lines, line_number, function_state, error):
if function_state.end_position.row + 1 == line_number:
function_state.end()
if function_state.in_a_function:
return
lines = clean_lines.lines
line = lines[line_number]
raw = clean_lines.raw_lines
raw_line = ra... | [
"def",
"detect_functions",
"(",
"clean_lines",
",",
"line_number",
",",
"function_state",
",",
"error",
")",
":",
"if",
"function_state",
".",
"end_position",
".",
"row",
"+",
"1",
"==",
"line_number",
":",
"function_state",
".",
"end",
"(",
")",
"if",
"func... | Finds where functions start and end. | [
"Finds",
"where",
"functions",
"start",
"and",
"end",
"."
] | [
"\"\"\"Finds where functions start and end.\n\n Uses a simplistic algorithm assuming other style guidelines\n (especially spacing) are followed.\n Trivial bodies are unchecked, so constructors with huge initializer lists\n may be missed.\n\n Args:\n clean_lines: A CleansedLines instance containi... | [
{
"param": "clean_lines",
"type": null
},
{
"param": "line_number",
"type": null
},
{
"param": "function_state",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clean_lines",
"type": null,
"docstring": "A CleansedLines instance containing the file.",
"docstring_tokens": [
"A",
"CleansedLines",
"instance",
"containing",
"the",
"file",
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_for_function_lengths | null | def check_for_function_lengths(clean_lines, line_number, function_state,
error):
"""Reports for long function bodies.
For an overview why this is done, see:
https://google.github.io/styleguide/cppguide.html#Write_Short_Functions
Blank/comment lines are not counted so as ... | Reports for long function bodies.
For an overview why this is done, see:
https://google.github.io/styleguide/cppguide.html#Write_Short_Functions
Blank/comment lines are not counted so as to avoid encouraging the removal
of vertical space and comments just to get through a lint check.
NOLINT *on th... | Reports for long function bodies.
Blank/comment lines are not counted so as to avoid encouraging the removal
of vertical space and comments just to get through a lint check.
NOLINT *on the last line of a function* disables this check. | [
"Reports",
"for",
"long",
"function",
"bodies",
".",
"Blank",
"/",
"comment",
"lines",
"are",
"not",
"counted",
"so",
"as",
"to",
"avoid",
"encouraging",
"the",
"removal",
"of",
"vertical",
"space",
"and",
"comments",
"just",
"to",
"get",
"through",
"a",
"... | def check_for_function_lengths(clean_lines, line_number, function_state,
error):
lines = clean_lines.lines
line = lines[line_number]
raw = clean_lines.raw_lines
raw_line = raw[line_number]
if function_state.end_position.row == line_number:
if not search(r'\bN... | [
"def",
"check_for_function_lengths",
"(",
"clean_lines",
",",
"line_number",
",",
"function_state",
",",
"error",
")",
":",
"lines",
"=",
"clean_lines",
".",
"lines",
"line",
"=",
"lines",
"[",
"line_number",
"]",
"raw",
"=",
"clean_lines",
".",
"raw_lines",
"... | Reports for long function bodies. | [
"Reports",
"for",
"long",
"function",
"bodies",
"."
] | [
"\"\"\"Reports for long function bodies.\n\n For an overview why this is done, see:\n https://google.github.io/styleguide/cppguide.html#Write_Short_Functions\n\n Blank/comment lines are not counted so as to avoid encouraging the removal\n of vertical space and comments just to get through a lint check.\... | [
{
"param": "clean_lines",
"type": null
},
{
"param": "line_number",
"type": null
},
{
"param": "function_state",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clean_lines",
"type": null,
"docstring": "A CleansedLines instance containing the file.",
"docstring_tokens": [
"A",
"CleansedLines",
"instance",
"containing",
"the",
"file",
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_pass_ptr_usage | <not_specific> | def check_pass_ptr_usage(clean_lines, line_number, function_state, error):
"""Check for proper usage of Pass*Ptr.
Currently this is limited to detecting declarations of Pass*Ptr
variables inside of functions.
Args:
clean_lines: A CleansedLines instance containing the file.
line_number: The... | Check for proper usage of Pass*Ptr.
Currently this is limited to detecting declarations of Pass*Ptr
variables inside of functions.
Args:
clean_lines: A CleansedLines instance containing the file.
line_number: The number of the line to check.
function_state: Current function name and line... | Check for proper usage of Pass*Ptr.
Currently this is limited to detecting declarations of Pass*Ptr
variables inside of functions. | [
"Check",
"for",
"proper",
"usage",
"of",
"Pass",
"*",
"Ptr",
".",
"Currently",
"this",
"is",
"limited",
"to",
"detecting",
"declarations",
"of",
"Pass",
"*",
"Ptr",
"variables",
"inside",
"of",
"functions",
"."
] | def check_pass_ptr_usage(clean_lines, line_number, function_state, error):
if not function_state.in_a_function:
return
lines = clean_lines.lines
line = lines[line_number]
if line_number > function_state.body_start_position.row:
matched_pass_ptr = match(r'^\s*Pass([A-Z][A-Za-z]*)Ptr<', li... | [
"def",
"check_pass_ptr_usage",
"(",
"clean_lines",
",",
"line_number",
",",
"function_state",
",",
"error",
")",
":",
"if",
"not",
"function_state",
".",
"in_a_function",
":",
"return",
"lines",
"=",
"clean_lines",
".",
"lines",
"line",
"=",
"lines",
"[",
"lin... | Check for proper usage of Pass*Ptr. | [
"Check",
"for",
"proper",
"usage",
"of",
"Pass",
"*",
"Ptr",
"."
] | [
"\"\"\"Check for proper usage of Pass*Ptr.\n\n Currently this is limited to detecting declarations of Pass*Ptr\n variables inside of functions.\n\n Args:\n clean_lines: A CleansedLines instance containing the file.\n line_number: The number of the line to check.\n function_state: Current fun... | [
{
"param": "clean_lines",
"type": null
},
{
"param": "line_number",
"type": null
},
{
"param": "function_state",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clean_lines",
"type": null,
"docstring": "A CleansedLines instance containing the file.",
"docstring_tokens": [
"A",
"CleansedLines",
"instance",
"containing",
"the",
"file",
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_ctype_functions | <not_specific> | def check_ctype_functions(clean_lines, line_number, file_state, error):
"""Looks for use of the standard functions in ctype.h and suggest they be replaced
by use of equivalent ones in "wtf/text/ascii_ctype.h"?.
Args:
clean_lines: A CleansedLines instance containing the file.
line_number: The... | Looks for use of the standard functions in ctype.h and suggest they be replaced
by use of equivalent ones in "wtf/text/ascii_ctype.h"?.
Args:
clean_lines: A CleansedLines instance containing the file.
line_number: The number of the line to check.
file_state: A _FileState instance which mai... | Looks for use of the standard functions in ctype.h and suggest they be replaced
by use of equivalent ones in "wtf/text/ascii_ctype.h"?. | [
"Looks",
"for",
"use",
"of",
"the",
"standard",
"functions",
"in",
"ctype",
".",
"h",
"and",
"suggest",
"they",
"be",
"replaced",
"by",
"use",
"of",
"equivalent",
"ones",
"in",
"\"",
"wtf",
"/",
"text",
"/",
"ascii_ctype",
".",
"h",
"\"",
"?",
"."
] | def check_ctype_functions(clean_lines, line_number, file_state, error):
line = clean_lines.elided[line_number]
ctype_function_search = search((
r'\b(?P<ctype_function>(isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|'
r'islower|isprint|ispunct|isspace|isupper|isxdigit|toascii|tolower|t... | [
"def",
"check_ctype_functions",
"(",
"clean_lines",
",",
"line_number",
",",
"file_state",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"line_number",
"]",
"ctype_function_search",
"=",
"search",
"(",
"(",
"r'\\b(?P<ctype_function>(isalnum... | Looks for use of the standard functions in ctype.h and suggest they be replaced
by use of equivalent ones in "wtf/text/ascii_ctype.h"?. | [
"Looks",
"for",
"use",
"of",
"the",
"standard",
"functions",
"in",
"ctype",
".",
"h",
"and",
"suggest",
"they",
"be",
"replaced",
"by",
"use",
"of",
"equivalent",
"ones",
"in",
"\"",
"wtf",
"/",
"text",
"/",
"ascii_ctype",
".",
"h",
"\"",
"?",
"."
] | [
"\"\"\"Looks for use of the standard functions in ctype.h and suggest they be replaced\n by use of equivalent ones in \"wtf/text/ascii_ctype.h\"?.\n\n Args:\n clean_lines: A CleansedLines instance containing the file.\n line_number: The number of the line to check.\n file_state: A _FileState... | [
{
"param": "clean_lines",
"type": null
},
{
"param": "line_number",
"type": null
},
{
"param": "file_state",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clean_lines",
"type": null,
"docstring": "A CleansedLines instance containing the file.",
"docstring_tokens": [
"A",
"CleansedLines",
"instance",
"containing",
"the",
"file",
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | replaceable_check | <not_specific> | def replaceable_check(operator, macro, line):
"""Determine whether a basic CHECK can be replaced with a more specific one.
For example suggest using CHECK_EQ instead of CHECK(a == b) and
similarly for CHECK_GE, CHECK_GT, CHECK_LE, CHECK_LT, CHECK_NE.
Args:
operator: The C++ operator used in the ... | Determine whether a basic CHECK can be replaced with a more specific one.
For example suggest using CHECK_EQ instead of CHECK(a == b) and
similarly for CHECK_GE, CHECK_GT, CHECK_LE, CHECK_LT, CHECK_NE.
Args:
operator: The C++ operator used in the CHECK.
macro: The CHECK or EXPECT macro being c... | Determine whether a basic CHECK can be replaced with a more specific one. | [
"Determine",
"whether",
"a",
"basic",
"CHECK",
"can",
"be",
"replaced",
"with",
"a",
"more",
"specific",
"one",
"."
] | def replaceable_check(operator, macro, line):
match_constant = r'([-+]?(\d+|0[xX][0-9a-fA-F]+)[lLuU]{0,3}|".*"|\'.*\')'
match_this = (r'\s*' + macro + r'\((\s*' + match_constant + r'\s*' +
operator + r'[^<>].*|'
r'.*[^<>]' + operator + r'\s*' + match_constant + r'\s*\))')
... | [
"def",
"replaceable_check",
"(",
"operator",
",",
"macro",
",",
"line",
")",
":",
"match_constant",
"=",
"r'([-+]?(\\d+|0[xX][0-9a-fA-F]+)[lLuU]{0,3}|\".*\"|\\'.*\\')'",
"match_this",
"=",
"(",
"r'\\s*'",
"+",
"macro",
"+",
"r'\\((\\s*'",
"+",
"match_constant",
"+",
"... | Determine whether a basic CHECK can be replaced with a more specific one. | [
"Determine",
"whether",
"a",
"basic",
"CHECK",
"can",
"be",
"replaced",
"with",
"a",
"more",
"specific",
"one",
"."
] | [
"\"\"\"Determine whether a basic CHECK can be replaced with a more specific one.\n\n For example suggest using CHECK_EQ instead of CHECK(a == b) and\n similarly for CHECK_GE, CHECK_GT, CHECK_LE, CHECK_LT, CHECK_NE.\n\n Args:\n operator: The C++ operator used in the CHECK.\n macro: The CHECK or EX... | [
{
"param": "operator",
"type": null
},
{
"param": "macro",
"type": null
},
{
"param": "line",
"type": null
}
] | {
"returns": [
{
"docstring": "True if the CHECK can be replaced with a more specific one.",
"docstring_tokens": [
"True",
"if",
"the",
"CHECK",
"can",
"be",
"replaced",
"with",
"a",
"more",
"specific",
"on... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_check | <not_specific> | def check_check(clean_lines, line_number, error):
"""Checks the use of CHECK and EXPECT macros.
Args:
clean_lines: A CleansedLines instance containing the file.
line_number: The number of the line to check.
error: The function to call with any errors found.
"""
# Decide the set of re... | Checks the use of CHECK and EXPECT macros.
Args:
clean_lines: A CleansedLines instance containing the file.
line_number: The number of the line to check.
error: The function to call with any errors found.
| Checks the use of CHECK and EXPECT macros. | [
"Checks",
"the",
"use",
"of",
"CHECK",
"and",
"EXPECT",
"macros",
"."
] | def check_check(clean_lines, line_number, error):
raw_lines = clean_lines.raw_lines
current_macro = ''
for macro in _CHECK_MACROS:
if raw_lines[line_number].find(macro) >= 0:
current_macro = macro
break
if not current_macro:
return
line = clean_lines.elided[li... | [
"def",
"check_check",
"(",
"clean_lines",
",",
"line_number",
",",
"error",
")",
":",
"raw_lines",
"=",
"clean_lines",
".",
"raw_lines",
"current_macro",
"=",
"''",
"for",
"macro",
"in",
"_CHECK_MACROS",
":",
"if",
"raw_lines",
"[",
"line_number",
"]",
".",
... | Checks the use of CHECK and EXPECT macros. | [
"Checks",
"the",
"use",
"of",
"CHECK",
"and",
"EXPECT",
"macros",
"."
] | [
"\"\"\"Checks the use of CHECK and EXPECT macros.\n\n Args:\n clean_lines: A CleansedLines instance containing the file.\n line_number: The number of the line to check.\n error: The function to call with any errors found.\n \"\"\"",
"# Decide the set of replacement macros that should be sugge... | [
{
"param": "clean_lines",
"type": null
},
{
"param": "line_number",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clean_lines",
"type": null,
"docstring": "A CleansedLines instance containing the file.",
"docstring_tokens": [
"A",
"CleansedLines",
"instance",
"containing",
"the",
"file",
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_conditional_and_loop_bodies_for_brace_violations | <not_specific> | def check_conditional_and_loop_bodies_for_brace_violations(
clean_lines, line_number, error):
"""Scans the bodies of conditionals and loops, and in particular
all the arms of conditionals, for violations in the use of braces.
Specifically:
(1) If an arm omits braces, then the following stateme... | Scans the bodies of conditionals and loops, and in particular
all the arms of conditionals, for violations in the use of braces.
Specifically:
(1) If an arm omits braces, then the following statement must be on one
physical line.
(2) If any arm uses braces, all arms must use them.
These check... | Scans the bodies of conditionals and loops, and in particular
all the arms of conditionals, for violations in the use of braces.
(1) If an arm omits braces, then the following statement must be on one
physical line.
(2) If any arm uses braces, all arms must use them.
These checks are only done here if we find the s... | [
"Scans",
"the",
"bodies",
"of",
"conditionals",
"and",
"loops",
"and",
"in",
"particular",
"all",
"the",
"arms",
"of",
"conditionals",
"for",
"violations",
"in",
"the",
"use",
"of",
"braces",
".",
"(",
"1",
")",
"If",
"an",
"arm",
"omits",
"braces",
"the... | def check_conditional_and_loop_bodies_for_brace_violations(
clean_lines, line_number, error):
lines = clean_lines.elided
line = lines[line_number]
control_match = match(r'\s*(if|foreach|for|while)\s*\(', line)
if not control_match:
return
expect_conditional_expression = True
know... | [
"def",
"check_conditional_and_loop_bodies_for_brace_violations",
"(",
"clean_lines",
",",
"line_number",
",",
"error",
")",
":",
"lines",
"=",
"clean_lines",
".",
"elided",
"line",
"=",
"lines",
"[",
"line_number",
"]",
"control_match",
"=",
"match",
"(",
"r'\\s*(if... | Scans the bodies of conditionals and loops, and in particular
all the arms of conditionals, for violations in the use of braces. | [
"Scans",
"the",
"bodies",
"of",
"conditionals",
"and",
"loops",
"and",
"in",
"particular",
"all",
"the",
"arms",
"of",
"conditionals",
"for",
"violations",
"in",
"the",
"use",
"of",
"braces",
"."
] | [
"\"\"\"Scans the bodies of conditionals and loops, and in particular\n all the arms of conditionals, for violations in the use of braces.\n\n Specifically:\n\n (1) If an arm omits braces, then the following statement must be on one\n physical line.\n (2) If any arm uses braces, all arms must use them... | [
{
"param": "clean_lines",
"type": null
},
{
"param": "line_number",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clean_lines",
"type": null,
"docstring": "A CleansedLines instance containing the file.",
"docstring_tokens": [
"A",
"CleansedLines",
"instance",
"containing",
"the",
"file",
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_redundant_virtual | <not_specific> | def check_redundant_virtual(clean_lines, linenum, error):
"""Checks if line contains a redundant "virtual" function-specifier.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found.
"""
... | Checks if line contains a redundant "virtual" function-specifier.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found.
| Checks if line contains a redundant "virtual" function-specifier. | [
"Checks",
"if",
"line",
"contains",
"a",
"redundant",
"\"",
"virtual",
"\"",
"function",
"-",
"specifier",
"."
] | def check_redundant_virtual(clean_lines, linenum, error):
line = clean_lines.elided[linenum]
virtual = match(r'^(.*)(\bvirtual\b)(.*)$', line)
if not virtual:
return
if (search(r'\b(public|protected|private)\s+$', virtual.group(1))
or match(r'^\s+(public|protected|private)\b', virtua... | [
"def",
"check_redundant_virtual",
"(",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"virtual",
"=",
"match",
"(",
"r'^(.*)(\\bvirtual\\b)(.*)$'",
",",
"line",
")",
"if",
"not",
"virtual"... | Checks if line contains a redundant "virtual" function-specifier. | [
"Checks",
"if",
"line",
"contains",
"a",
"redundant",
"\"",
"virtual",
"\"",
"function",
"-",
"specifier",
"."
] | [
"\"\"\"Checks if line contains a redundant \"virtual\" function-specifier.\n\n Args:\n clean_lines: A CleansedLines instance containing the file.\n linenum: The number of the line to check.\n error: The function to call with any errors found.\n \"\"\"",
"# Look for \"virtual\" on current line... | [
{
"param": "clean_lines",
"type": null
},
{
"param": "linenum",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clean_lines",
"type": null,
"docstring": "A CleansedLines instance containing the file.",
"docstring_tokens": [
"A",
"CleansedLines",
"instance",
"containing",
"the",
"file",
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_style | null | def check_style(clean_lines, line_number, file_state, error):
"""Checks rules from the 'C++ style rules' section of cppguide.html.
Most of these rules are hard to test (naming, comment style), but we
do what we can. In particular we check for 4-space indents, line lengths,
tab usage, spaces inside cod... | Checks rules from the 'C++ style rules' section of cppguide.html.
Most of these rules are hard to test (naming, comment style), but we
do what we can. In particular we check for 4-space indents, line lengths,
tab usage, spaces inside code, etc.
Args:
clean_lines: A CleansedLines instance contai... | Checks rules from the 'C++ style rules' section of cppguide.html.
Most of these rules are hard to test (naming, comment style), but we
do what we can. In particular we check for 4-space indents, line lengths,
tab usage, spaces inside code, etc. | [
"Checks",
"rules",
"from",
"the",
"'",
"C",
"++",
"style",
"rules",
"'",
"section",
"of",
"cppguide",
".",
"html",
".",
"Most",
"of",
"these",
"rules",
"are",
"hard",
"to",
"test",
"(",
"naming",
"comment",
"style",
")",
"but",
"we",
"do",
"what",
"w... | def check_style(clean_lines, line_number, file_state, error):
raw_lines = clean_lines.lines_without_raw_strings
line = raw_lines[line_number]
check_ctype_functions(clean_lines, line_number, file_state, error)
check_check(clean_lines, line_number, error) | [
"def",
"check_style",
"(",
"clean_lines",
",",
"line_number",
",",
"file_state",
",",
"error",
")",
":",
"raw_lines",
"=",
"clean_lines",
".",
"lines_without_raw_strings",
"line",
"=",
"raw_lines",
"[",
"line_number",
"]",
"check_ctype_functions",
"(",
"clean_lines"... | Checks rules from the 'C++ style rules' section of cppguide.html. | [
"Checks",
"rules",
"from",
"the",
"'",
"C",
"++",
"style",
"rules",
"'",
"section",
"of",
"cppguide",
".",
"html",
"."
] | [
"\"\"\"Checks rules from the 'C++ style rules' section of cppguide.html.\n\n Most of these rules are hard to test (naming, comment style), but we\n do what we can. In particular we check for 4-space indents, line lengths,\n tab usage, spaces inside code, etc.\n\n Args:\n clean_lines: A CleansedLin... | [
{
"param": "clean_lines",
"type": null
},
{
"param": "line_number",
"type": null
},
{
"param": "file_state",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clean_lines",
"type": null,
"docstring": "A CleansedLines instance containing the file.",
"docstring_tokens": [
"A",
"CleansedLines",
"instance",
"containing",
"the",
"file",
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_include_line | <not_specific> | def check_include_line(filename, file_extension, clean_lines, line_number,
include_state, error):
"""Check rules that are applicable to #include lines.
Strings on #include lines are NOT removed from elided line, to make
certain tasks easier. However, to prevent false positives, check... | Check rules that are applicable to #include lines.
Strings on #include lines are NOT removed from elided line, to make
certain tasks easier. However, to prevent false positives, checks
applicable to #include lines in CheckLanguage must be put here.
Args:
filename: The name of the current file.
... | Check rules that are applicable to #include lines.
Strings on #include lines are NOT removed from elided line, to make
certain tasks easier. However, to prevent false positives, checks
applicable to #include lines in CheckLanguage must be put here. | [
"Check",
"rules",
"that",
"are",
"applicable",
"to",
"#include",
"lines",
".",
"Strings",
"on",
"#include",
"lines",
"are",
"NOT",
"removed",
"from",
"elided",
"line",
"to",
"make",
"certain",
"tasks",
"easier",
".",
"However",
"to",
"prevent",
"false",
"pos... | def check_include_line(filename, file_extension, clean_lines, line_number,
include_state, error):
line = clean_lines.lines[line_number]
matched = _RE_PATTERN_INCLUDE.search(line)
if not matched:
return
include = matched.group(2)
is_system = (matched.group(1) == '<')
... | [
"def",
"check_include_line",
"(",
"filename",
",",
"file_extension",
",",
"clean_lines",
",",
"line_number",
",",
"include_state",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"lines",
"[",
"line_number",
"]",
"matched",
"=",
"_RE_PATTERN_INCLUDE",
"... | Check rules that are applicable to #include lines. | [
"Check",
"rules",
"that",
"are",
"applicable",
"to",
"#include",
"lines",
"."
] | [
"\"\"\"Check rules that are applicable to #include lines.\n\n Strings on #include lines are NOT removed from elided line, to make\n certain tasks easier. However, to prevent false positives, checks\n applicable to #include lines in CheckLanguage must be put here.\n\n Args:\n filename: The name of t... | [
{
"param": "filename",
"type": null
},
{
"param": "file_extension",
"type": null
},
{
"param": "clean_lines",
"type": null
},
{
"param": "line_number",
"type": null
},
{
"param": "include_state",
"type": null
},
{
"param": "error",
"type": null
}... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": "The name of the current file.",
"docstring_tokens": [
"The",
"name",
"of",
"the",
"current",
"file",
"."
],
"default": ... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_language | <not_specific> | def check_language(filename, clean_lines, line_number, file_extension,
include_state, file_state, error):
"""Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best ... | Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
... | Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can. | [
"Checks",
"rules",
"from",
"the",
"'",
"C",
"++",
"language",
"rules",
"'",
"section",
"of",
"cppguide",
".",
"html",
".",
"Some",
"of",
"these",
"rules",
"are",
"hard",
"to",
"test",
"(",
"function",
"overloading",
"using",
"uint32",
"inappropriately",
")... | def check_language(filename, clean_lines, line_number, file_extension,
include_state, file_state, error):
line = clean_lines.elided[line_number]
if not line:
return
matched = _RE_PATTERN_INCLUDE.search(line)
if matched:
check_include_line(filename, file_extension, clea... | [
"def",
"check_language",
"(",
"filename",
",",
"clean_lines",
",",
"line_number",
",",
"file_extension",
",",
"include_state",
",",
"file_state",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"line_number",
"]",
"if",
"not",
"line",
... | Checks rules from the 'C++ language rules' section of cppguide.html. | [
"Checks",
"rules",
"from",
"the",
"'",
"C",
"++",
"language",
"rules",
"'",
"section",
"of",
"cppguide",
".",
"html",
"."
] | [
"\"\"\"Checks rules from the 'C++ language rules' section of cppguide.html.\n\n Some of these rules are hard to test (function overloading, using\n uint32 inappropriately), but we do the best we can.\n\n Args:\n filename: The name of the current file.\n clean_lines: A CleansedLines instance conta... | [
{
"param": "filename",
"type": null
},
{
"param": "clean_lines",
"type": null
},
{
"param": "line_number",
"type": null
},
{
"param": "file_extension",
"type": null
},
{
"param": "include_state",
"type": null
},
{
"param": "file_state",
"type": nul... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": "The name of the current file.",
"docstring_tokens": [
"The",
"name",
"of",
"the",
"current",
"file",
"."
],
"default": ... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_identifier_name_in_declaration | <not_specific> | def check_identifier_name_in_declaration(filename, line_number, line,
file_state, error):
"""Checks if identifier names contain any underscores.
As identifiers in libraries we are using have a bunch of
underscores, we only warn about the declarations of identifiers
... | Checks if identifier names contain any underscores.
As identifiers in libraries we are using have a bunch of
underscores, we only warn about the declarations of identifiers
and don't check use of identifiers.
Args:
filename: The name of the current file.
line_number: The number of the line... | Checks if identifier names contain any underscores.
As identifiers in libraries we are using have a bunch of
underscores, we only warn about the declarations of identifiers
and don't check use of identifiers. | [
"Checks",
"if",
"identifier",
"names",
"contain",
"any",
"underscores",
".",
"As",
"identifiers",
"in",
"libraries",
"we",
"are",
"using",
"have",
"a",
"bunch",
"of",
"underscores",
"we",
"only",
"warn",
"about",
"the",
"declarations",
"of",
"identifiers",
"an... | def check_identifier_name_in_declaration(filename, line_number, line,
file_state, error):
if match(r'\s*(return|delete|operator)\b', line):
return
line = sub(r'long (long )?(?=long|double|int)', '', line)
line = sub(r'(unsigned|signed) (?=char|short|int|long)... | [
"def",
"check_identifier_name_in_declaration",
"(",
"filename",
",",
"line_number",
",",
"line",
",",
"file_state",
",",
"error",
")",
":",
"if",
"match",
"(",
"r'\\s*(return|delete|operator)\\b'",
",",
"line",
")",
":",
"return",
"line",
"=",
"sub",
"(",
"r'lon... | Checks if identifier names contain any underscores. | [
"Checks",
"if",
"identifier",
"names",
"contain",
"any",
"underscores",
"."
] | [
"\"\"\"Checks if identifier names contain any underscores.\n\n As identifiers in libraries we are using have a bunch of\n underscores, we only warn about the declarations of identifiers\n and don't check use of identifiers.\n\n Args:\n filename: The name of the current file.\n line_number: The... | [
{
"param": "filename",
"type": null
},
{
"param": "line_number",
"type": null
},
{
"param": "line",
"type": null
},
{
"param": "file_state",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": "The name of the current file.",
"docstring_tokens": [
"The",
"name",
"of",
"the",
"current",
"file",
"."
],
"default": ... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_for_toFoo_definition | <not_specific> | def check_for_toFoo_definition(filename, pattern, error):
"""Reports for using static_cast instead of toFoo convenience function.
This function will output warnings to make sure you are actually using
the added toFoo conversion functions rather than directly hard coding
the static_cast<Classname*> call... | Reports for using static_cast instead of toFoo convenience function.
This function will output warnings to make sure you are actually using
the added toFoo conversion functions rather than directly hard coding
the static_cast<Classname*> call. For example, you should toHTMLELement(Node*)
to convert Nod... | Reports for using static_cast instead of toFoo convenience function.
This function will output warnings to make sure you are actually using
the added toFoo conversion functions rather than directly hard coding
the static_cast call. For example, you should toHTMLELement(Node*)
to convert Node* to HTMLElement*, instead o... | [
"Reports",
"for",
"using",
"static_cast",
"instead",
"of",
"toFoo",
"convenience",
"function",
".",
"This",
"function",
"will",
"output",
"warnings",
"to",
"make",
"sure",
"you",
"are",
"actually",
"using",
"the",
"added",
"toFoo",
"conversion",
"functions",
"ra... | def check_for_toFoo_definition(filename, pattern, error):
def get_abs_filepath(filename):
fileSystem = FileSystem()
base_dir = fileSystem.path_to_module(FileSystem.__module__).split(
'WebKit', 1)[0]
base_dir = ''.join((base_dir, 'WebKit/Source'))
for root, _, names in os.... | [
"def",
"check_for_toFoo_definition",
"(",
"filename",
",",
"pattern",
",",
"error",
")",
":",
"def",
"get_abs_filepath",
"(",
"filename",
")",
":",
"fileSystem",
"=",
"FileSystem",
"(",
")",
"base_dir",
"=",
"fileSystem",
".",
"path_to_module",
"(",
"FileSystem"... | Reports for using static_cast instead of toFoo convenience function. | [
"Reports",
"for",
"using",
"static_cast",
"instead",
"of",
"toFoo",
"convenience",
"function",
"."
] | [
"\"\"\"Reports for using static_cast instead of toFoo convenience function.\n\n This function will output warnings to make sure you are actually using\n the added toFoo conversion functions rather than directly hard coding\n the static_cast<Classname*> call. For example, you should toHTMLELement(Node*)\n ... | [
{
"param": "filename",
"type": null
},
{
"param": "pattern",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": "The name of the header file in which to check for toFoo definition.",
"docstring_tokens": [
"The",
"name",
"of",
"the",
"header",
"file",
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_for_object_static_cast | <not_specific> | def check_for_object_static_cast(processing_file, line_number, line, error):
"""Checks for a Cpp-style static cast on objects by looking for the pattern.
Args:
processing_file: The name of the processing file.
line_number: The number of the line to check.
line: The line of code to check.
... | Checks for a Cpp-style static cast on objects by looking for the pattern.
Args:
processing_file: The name of the processing file.
line_number: The number of the line to check.
line: The line of code to check.
error: The function to call with any errors found.
| Checks for a Cpp-style static cast on objects by looking for the pattern. | [
"Checks",
"for",
"a",
"Cpp",
"-",
"style",
"static",
"cast",
"on",
"objects",
"by",
"looking",
"for",
"the",
"pattern",
"."
] | def check_for_object_static_cast(processing_file, line_number, line, error):
matched = search(r'\bstatic_cast<(\s*\w*:?:?\w+\s*\*+\s*)>', line)
if not matched:
return
class_name = re.sub(r'[\*]', '', matched.group(1))
class_name = class_name.strip()
if class_name == 'void':
return
... | [
"def",
"check_for_object_static_cast",
"(",
"processing_file",
",",
"line_number",
",",
"line",
",",
"error",
")",
":",
"matched",
"=",
"search",
"(",
"r'\\bstatic_cast<(\\s*\\w*:?:?\\w+\\s*\\*+\\s*)>'",
",",
"line",
")",
"if",
"not",
"matched",
":",
"return",
"clas... | Checks for a Cpp-style static cast on objects by looking for the pattern. | [
"Checks",
"for",
"a",
"Cpp",
"-",
"style",
"static",
"cast",
"on",
"objects",
"by",
"looking",
"for",
"the",
"pattern",
"."
] | [
"\"\"\"Checks for a Cpp-style static cast on objects by looking for the pattern.\n\n Args:\n processing_file: The name of the processing file.\n line_number: The number of the line to check.\n line: The line of code to check.\n error: The function to call with any errors found.\n \"\"\"",
... | [
{
"param": "processing_file",
"type": null
},
{
"param": "line_number",
"type": null
},
{
"param": "line",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "processing_file",
"type": null,
"docstring": "The name of the processing file.",
"docstring_tokens": [
"The",
"name",
"of",
"the",
"processing",
"file",
"."
],
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_c_style_cast | <not_specific> | def check_c_style_cast(line_number, line, raw_line, cast_type, pattern, error):
"""Checks for a C-style cast by looking for the pattern.
This also handles sizeof(type) warnings, due to similarity of content.
Args:
line_number: The number of the line to check.
line: The line of code to check.
... | Checks for a C-style cast by looking for the pattern.
This also handles sizeof(type) warnings, due to similarity of content.
Args:
line_number: The number of the line to check.
line: The line of code to check.
raw_line: The raw line of code to check, with comments.
cast_type: The strin... | Checks for a C-style cast by looking for the pattern.
This also handles sizeof(type) warnings, due to similarity of content. | [
"Checks",
"for",
"a",
"C",
"-",
"style",
"cast",
"by",
"looking",
"for",
"the",
"pattern",
".",
"This",
"also",
"handles",
"sizeof",
"(",
"type",
")",
"warnings",
"due",
"to",
"similarity",
"of",
"content",
"."
] | def check_c_style_cast(line_number, line, raw_line, cast_type, pattern, error):
matched = search(pattern, line)
if not matched:
return
sizeof_match = match(r'.*sizeof\s*$', line[0:matched.start(1) - 1])
if sizeof_match:
error(line_number, 'runtime/sizeof', 1,
'Using sizeof(... | [
"def",
"check_c_style_cast",
"(",
"line_number",
",",
"line",
",",
"raw_line",
",",
"cast_type",
",",
"pattern",
",",
"error",
")",
":",
"matched",
"=",
"search",
"(",
"pattern",
",",
"line",
")",
"if",
"not",
"matched",
":",
"return",
"sizeof_match",
"=",... | Checks for a C-style cast by looking for the pattern. | [
"Checks",
"for",
"a",
"C",
"-",
"style",
"cast",
"by",
"looking",
"for",
"the",
"pattern",
"."
] | [
"\"\"\"Checks for a C-style cast by looking for the pattern.\n\n This also handles sizeof(type) warnings, due to similarity of content.\n\n Args:\n line_number: The number of the line to check.\n line: The line of code to check.\n raw_line: The raw line of code to check, with comments.\n c... | [
{
"param": "line_number",
"type": null
},
{
"param": "line",
"type": null
},
{
"param": "raw_line",
"type": null
},
{
"param": "cast_type",
"type": null
},
{
"param": "pattern",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "line_number",
"type": null,
"docstring": "The number of the line to check.",
"docstring_tokens": [
"The",
"number",
"of",
"the",
"line",
"to",
"check",
"."
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | update_include_state | <not_specific> | def update_include_state(filename, include_state):
"""Fill up the include_state with new includes found from the file.
Args:
filename: the name of the header to read.
include_state: an _IncludeState instance in which the headers are inserted.
io: The io factory to use to read the file. Provid... | Fill up the include_state with new includes found from the file.
Args:
filename: the name of the header to read.
include_state: an _IncludeState instance in which the headers are inserted.
io: The io factory to use to read the file. Provided for testability.
Returns:
True if a header w... | Fill up the include_state with new includes found from the file. | [
"Fill",
"up",
"the",
"include_state",
"with",
"new",
"includes",
"found",
"from",
"the",
"file",
"."
] | def update_include_state(filename, include_state):
header_file = None
try:
header_file = CppChecker.fs.read_text_file(filename)
except IOError:
return False
line_number = 0
for line in header_file:
line_number += 1
clean_line = cleanse_comments(line)
matched =... | [
"def",
"update_include_state",
"(",
"filename",
",",
"include_state",
")",
":",
"header_file",
"=",
"None",
"try",
":",
"header_file",
"=",
"CppChecker",
".",
"fs",
".",
"read_text_file",
"(",
"filename",
")",
"except",
"IOError",
":",
"return",
"False",
"line... | Fill up the include_state with new includes found from the file. | [
"Fill",
"up",
"the",
"include_state",
"with",
"new",
"includes",
"found",
"from",
"the",
"file",
"."
] | [
"\"\"\"Fill up the include_state with new includes found from the file.\n\n Args:\n filename: the name of the header to read.\n include_state: an _IncludeState instance in which the headers are inserted.\n io: The io factory to use to read the file. Provided for testability.\n\n Returns:\n ... | [
{
"param": "filename",
"type": null
},
{
"param": "include_state",
"type": null
}
] | {
"returns": [
{
"docstring": "True if a header was succesfully added. False otherwise.",
"docstring_tokens": [
"True",
"if",
"a",
"header",
"was",
"succesfully",
"added",
".",
"False",
"otherwise",
"."
],
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_for_include_what_you_use | <not_specific> | def check_for_include_what_you_use(filename, clean_lines, include_state,
error):
"""Reports for missing stl includes.
This function will output warnings to make sure you are including the headers
necessary for the stl containers and functions that you use. We only give on... | Reports for missing stl includes.
This function will output warnings to make sure you are including the headers
necessary for the stl containers and functions that you use. We only give one
reason to include a header. For example, if you use both equal_to<> and
less<> in a .h file, only one (the latter... | Reports for missing stl includes.
This function will output warnings to make sure you are including the headers
necessary for the stl containers and functions that you use. We only give one
reason to include a header. For example, if you use both equal_to<> and
less<> in a .h file, only one (the latter in the file) of ... | [
"Reports",
"for",
"missing",
"stl",
"includes",
".",
"This",
"function",
"will",
"output",
"warnings",
"to",
"make",
"sure",
"you",
"are",
"including",
"the",
"headers",
"necessary",
"for",
"the",
"stl",
"containers",
"and",
"functions",
"that",
"you",
"use",
... | def check_for_include_what_you_use(filename, clean_lines, include_state,
error):
required = {}
for line_number in xrange(clean_lines.num_lines()):
line = clean_lines.elided[line_number]
if not line or line[0] == '#':
continue
if _RE_PATTERN_... | [
"def",
"check_for_include_what_you_use",
"(",
"filename",
",",
"clean_lines",
",",
"include_state",
",",
"error",
")",
":",
"required",
"=",
"{",
"}",
"for",
"line_number",
"in",
"xrange",
"(",
"clean_lines",
".",
"num_lines",
"(",
")",
")",
":",
"line",
"="... | Reports for missing stl includes. | [
"Reports",
"for",
"missing",
"stl",
"includes",
"."
] | [
"\"\"\"Reports for missing stl includes.\n\n This function will output warnings to make sure you are including the headers\n necessary for the stl containers and functions that you use. We only give one\n reason to include a header. For example, if you use both equal_to<> and\n less<> in a .h file, only... | [
{
"param": "filename",
"type": null
},
{
"param": "clean_lines",
"type": null
},
{
"param": "include_state",
"type": null
},
{
"param": "error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": "The name of the current file.",
"docstring_tokens": [
"The",
"name",
"of",
"the",
"current",
"file",
"."
],
"default": ... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | process_line | <not_specific> | def process_line(filename, file_extension, clean_lines, line, include_state,
function_state, class_state, file_state, error):
"""Processes a single line in the file.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of th... | Processes a single line in the file.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
clean_lines: An array of strings, each representing a line of the file,
with comments stripped.
line: Number of... | Processes a single line in the file. | [
"Processes",
"a",
"single",
"line",
"in",
"the",
"file",
"."
] | def process_line(filename, file_extension, clean_lines, line, include_state,
function_state, class_state, file_state, error):
raw_lines = clean_lines.raw_lines
detect_functions(clean_lines, line, function_state, error)
check_for_function_lengths(clean_lines, line, function_state, error)
... | [
"def",
"process_line",
"(",
"filename",
",",
"file_extension",
",",
"clean_lines",
",",
"line",
",",
"include_state",
",",
"function_state",
",",
"class_state",
",",
"file_state",
",",
"error",
")",
":",
"raw_lines",
"=",
"clean_lines",
".",
"raw_lines",
"detect... | Processes a single line in the file. | [
"Processes",
"a",
"single",
"line",
"in",
"the",
"file",
"."
] | [
"\"\"\"Processes a single line in the file.\n\n Args:\n filename: Filename of the file that is being processed.\n file_extension: The extension (dot not included) of the file.\n clean_lines: An array of strings, each representing a line of the file,\n with comments stripped.\n ... | [
{
"param": "filename",
"type": null
},
{
"param": "file_extension",
"type": null
},
{
"param": "clean_lines",
"type": null
},
{
"param": "line",
"type": null
},
{
"param": "include_state",
"type": null
},
{
"param": "function_state",
"type": null
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": "Filename of the file that is being processed.",
"docstring_tokens": [
"Filename",
"of",
"the",
"file",
"that",
"is",
"being",
... |
e5711f52ee4c11faa27216c321c33441b0cba6ed | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checkers/cpp.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _process_lines | null | def _process_lines(filename, file_extension, lines, error, min_confidence):
"""Performs lint checks and reports any errors to the given error function.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
lines: An array o... | Performs lint checks and reports any errors to the given error function.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
lines: An array of strings, each representing a line of the file, with the
last element... | Performs lint checks and reports any errors to the given error function. | [
"Performs",
"lint",
"checks",
"and",
"reports",
"any",
"errors",
"to",
"the",
"given",
"error",
"function",
"."
] | def _process_lines(filename, file_extension, lines, error, min_confidence):
lines = (['// marker so line numbers and indices both start at 1'] + lines
+ ['// marker so line numbers end in a known way'])
include_state = _IncludeState()
function_state = _FunctionState(min_confidence)
class_st... | [
"def",
"_process_lines",
"(",
"filename",
",",
"file_extension",
",",
"lines",
",",
"error",
",",
"min_confidence",
")",
":",
"lines",
"=",
"(",
"[",
"'// marker so line numbers and indices both start at 1'",
"]",
"+",
"lines",
"+",
"[",
"'// marker so line numbers en... | Performs lint checks and reports any errors to the given error function. | [
"Performs",
"lint",
"checks",
"and",
"reports",
"any",
"errors",
"to",
"the",
"given",
"error",
"function",
"."
] | [
"\"\"\"Performs lint checks and reports any errors to the given error function.\n\n Args:\n filename: Filename of the file that is being processed.\n file_extension: The extension (dot not included) of the file.\n lines: An array of strings, each representing a line of the file, with the\n ... | [
{
"param": "filename",
"type": null
},
{
"param": "file_extension",
"type": null
},
{
"param": "lines",
"type": null
},
{
"param": "error",
"type": null
},
{
"param": "min_confidence",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": "Filename of the file that is being processed.",
"docstring_tokens": [
"Filename",
"of",
"the",
"file",
"that",
"is",
"being",
... |
8bedda39bfb13e90e7e1bf1d380a1ae55488ef8d | sunlongbo/chromium | tools/cr/cr/visitor.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | VisitNode | <not_specific> | def VisitNode(self, node):
"""Called for every node in the tree."""
if not node.enabled:
return self
try:
try:
self.stack.append(node)
self.StartNode()
# Visit all the values first
for key in self.KeysOf(node.values):
self.Visit(key, node.values[key])
... | Called for every node in the tree. | Called for every node in the tree. | [
"Called",
"for",
"every",
"node",
"in",
"the",
"tree",
"."
] | def VisitNode(self, node):
if not node.enabled:
return self
try:
try:
self.stack.append(node)
self.StartNode()
for key in self.KeysOf(node.values):
self.Visit(key, node.values[key])
for child in node.children:
self.VisitNode(child)
finally:
... | [
"def",
"VisitNode",
"(",
"self",
",",
"node",
")",
":",
"if",
"not",
"node",
".",
"enabled",
":",
"return",
"self",
"try",
":",
"try",
":",
"self",
".",
"stack",
".",
"append",
"(",
"node",
")",
"self",
".",
"StartNode",
"(",
")",
"for",
"key",
"... | Called for every node in the tree. | [
"Called",
"for",
"every",
"node",
"in",
"the",
"tree",
"."
] | [
"\"\"\"Called for every node in the tree.\"\"\"",
"# Visit all the values first",
"# And now recurse into all the children",
"# propagate back up the stack"
] | [
{
"param": "self",
"type": null
},
{
"param": "node",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node",
"type": null,
"docstring": null,
"docstring_tokens": [... |
8bedda39bfb13e90e7e1bf1d380a1ae55488ef8d | sunlongbo/chromium | tools/cr/cr/visitor.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Resolve | <not_specific> | def Resolve(self, key, value):
"""Returns a fully substituted value.
This asks the root node to do the actual work.
Args:
key: The key being visited.
value: The unresolved value associated with the key.
Returns:
the fully resolved value.
"""
return self.root_node.Resolve(self,... | Returns a fully substituted value.
This asks the root node to do the actual work.
Args:
key: The key being visited.
value: The unresolved value associated with the key.
Returns:
the fully resolved value.
| Returns a fully substituted value.
This asks the root node to do the actual work. | [
"Returns",
"a",
"fully",
"substituted",
"value",
".",
"This",
"asks",
"the",
"root",
"node",
"to",
"do",
"the",
"actual",
"work",
"."
] | def Resolve(self, key, value):
return self.root_node.Resolve(self, key, value) | [
"def",
"Resolve",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"return",
"self",
".",
"root_node",
".",
"Resolve",
"(",
"self",
",",
"key",
",",
"value",
")"
] | Returns a fully substituted value. | [
"Returns",
"a",
"fully",
"substituted",
"value",
"."
] | [
"\"\"\"Returns a fully substituted value.\n\n This asks the root node to do the actual work.\n Args:\n key: The key being visited.\n value: The unresolved value associated with the key.\n Returns:\n the fully resolved value.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "key",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [
{
"docstring": "the fully resolved value.",
"docstring_tokens": [
"the",
"fully",
"resolved",
"value",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring"... |
8bf838a9484bb6da426074adf18f54b89e7dfdee | sunlongbo/chromium | tools/resources/find_unused_resources.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetBaseResourceId | <not_specific> | def GetBaseResourceId(resource_id):
"""Removes common suffixes from a resource ID.
Removes suffixies that may be added by macros like IMAGE_GRID or IMAGE_BORDER.
For example, converts IDR_FOO_LEFT and IDR_FOO_RIGHT to just IDR_FOO.
Args:
resource_id: String resource ID.
Returns:
A string with the b... | Removes common suffixes from a resource ID.
Removes suffixies that may be added by macros like IMAGE_GRID or IMAGE_BORDER.
For example, converts IDR_FOO_LEFT and IDR_FOO_RIGHT to just IDR_FOO.
Args:
resource_id: String resource ID.
Returns:
A string with the base part of the resource ID.
| Removes common suffixes from a resource ID.
Removes suffixies that may be added by macros like IMAGE_GRID or IMAGE_BORDER. | [
"Removes",
"common",
"suffixes",
"from",
"a",
"resource",
"ID",
".",
"Removes",
"suffixies",
"that",
"may",
"be",
"added",
"by",
"macros",
"like",
"IMAGE_GRID",
"or",
"IMAGE_BORDER",
"."
] | def GetBaseResourceId(resource_id):
suffixes = [
'_TOP_LEFT', '_TOP', '_TOP_RIGHT',
'_LEFT', '_CENTER', '_RIGHT',
'_BOTTOM_LEFT', '_BOTTOM', '_BOTTOM_RIGHT',
'_TL', '_T', '_TR',
'_L', '_M', '_R',
'_BL', '_B', '_BR']
for suffix in suffixes:
if resource_id.endswith(suffix):
... | [
"def",
"GetBaseResourceId",
"(",
"resource_id",
")",
":",
"suffixes",
"=",
"[",
"'_TOP_LEFT'",
",",
"'_TOP'",
",",
"'_TOP_RIGHT'",
",",
"'_LEFT'",
",",
"'_CENTER'",
",",
"'_RIGHT'",
",",
"'_BOTTOM_LEFT'",
",",
"'_BOTTOM'",
",",
"'_BOTTOM_RIGHT'",
",",
"'_TL'",
... | Removes common suffixes from a resource ID. | [
"Removes",
"common",
"suffixes",
"from",
"a",
"resource",
"ID",
"."
] | [
"\"\"\"Removes common suffixes from a resource ID.\n\n Removes suffixies that may be added by macros like IMAGE_GRID or IMAGE_BORDER.\n For example, converts IDR_FOO_LEFT and IDR_FOO_RIGHT to just IDR_FOO.\n\n Args:\n resource_id: String resource ID.\n\n Returns:\n A string with the base part of the resou... | [
{
"param": "resource_id",
"type": null
}
] | {
"returns": [
{
"docstring": "A string with the base part of the resource ID.",
"docstring_tokens": [
"A",
"string",
"with",
"the",
"base",
"part",
"of",
"the",
"resource",
"ID",
"."
],
"type": null
... |
8bf838a9484bb6da426074adf18f54b89e7dfdee | sunlongbo/chromium | tools/resources/find_unused_resources.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FindFilesWithContents | <not_specific> | def FindFilesWithContents(string_a, string_b):
"""Returns list of paths of files that contain |string_a| or |string_b|.
Uses --name-only to print the file paths. The default behavior of git grep
is to OR together multiple patterns.
Args:
string_a: A string to search for (not a regular expression).
str... | Returns list of paths of files that contain |string_a| or |string_b|.
Uses --name-only to print the file paths. The default behavior of git grep
is to OR together multiple patterns.
Args:
string_a: A string to search for (not a regular expression).
string_b: As above.
Returns:
A list of file path... | Returns list of paths of files that contain |string_a| or |string_b|.
Uses --name-only to print the file paths. The default behavior of git grep
is to OR together multiple patterns. | [
"Returns",
"list",
"of",
"paths",
"of",
"files",
"that",
"contain",
"|string_a|",
"or",
"|string_b|",
".",
"Uses",
"--",
"name",
"-",
"only",
"to",
"print",
"the",
"file",
"paths",
".",
"The",
"default",
"behavior",
"of",
"git",
"grep",
"is",
"to",
"OR",... | def FindFilesWithContents(string_a, string_b):
matching_files = subprocess.check_output([
'git', 'grep', '--name-only', '--fixed-strings', '-e', string_a,
'-e', string_b])
files_list = matching_files.split('\n')
files_list = files_list[:-1]
return files_list | [
"def",
"FindFilesWithContents",
"(",
"string_a",
",",
"string_b",
")",
":",
"matching_files",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'git'",
",",
"'grep'",
",",
"'--name-only'",
",",
"'--fixed-strings'",
",",
"'-e'",
",",
"string_a",
",",
"'-e'",
"... | Returns list of paths of files that contain |string_a| or |string_b|. | [
"Returns",
"list",
"of",
"paths",
"of",
"files",
"that",
"contain",
"|string_a|",
"or",
"|string_b|",
"."
] | [
"\"\"\"Returns list of paths of files that contain |string_a| or |string_b|.\n\n Uses --name-only to print the file paths. The default behavior of git grep\n is to OR together multiple patterns.\n\n Args:\n string_a: A string to search for (not a regular expression).\n string_b: As above.\n\n Returns:\n ... | [
{
"param": "string_a",
"type": null
},
{
"param": "string_b",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of file paths as strings.",
"docstring_tokens": [
"A",
"list",
"of",
"file",
"paths",
"as",
"strings",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier"... |
8bf838a9484bb6da426074adf18f54b89e7dfdee | sunlongbo/chromium | tools/resources/find_unused_resources.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetUnusedResources | <not_specific> | def GetUnusedResources(grd_filepath):
"""Returns a list of resources that are unused in the code.
Prints status lines to the console because this function is quite slow.
Args:
grd_filepath: Path to a .grd file listing resources.
Returns:
A list of pairs of [resource_id, filepath] for the unused resou... | Returns a list of resources that are unused in the code.
Prints status lines to the console because this function is quite slow.
Args:
grd_filepath: Path to a .grd file listing resources.
Returns:
A list of pairs of [resource_id, filepath] for the unused resources.
| Returns a list of resources that are unused in the code.
Prints status lines to the console because this function is quite slow. | [
"Returns",
"a",
"list",
"of",
"resources",
"that",
"are",
"unused",
"in",
"the",
"code",
".",
"Prints",
"status",
"lines",
"to",
"the",
"console",
"because",
"this",
"function",
"is",
"quite",
"slow",
"."
] | def GetUnusedResources(grd_filepath):
unused_resources = []
grd_file = open(grd_filepath, 'r')
grd_data = grd_file.read()
print('Checking:')
pattern = re.compile(
r"""name="([^"]*)" # Match resource ID between quotes.
\s* # Run of whitespace, including newlines.
file="([^"]*... | [
"def",
"GetUnusedResources",
"(",
"grd_filepath",
")",
":",
"unused_resources",
"=",
"[",
"]",
"grd_file",
"=",
"open",
"(",
"grd_filepath",
",",
"'r'",
")",
"grd_data",
"=",
"grd_file",
".",
"read",
"(",
")",
"print",
"(",
"'Checking:'",
")",
"pattern",
"... | Returns a list of resources that are unused in the code. | [
"Returns",
"a",
"list",
"of",
"resources",
"that",
"are",
"unused",
"in",
"the",
"code",
"."
] | [
"\"\"\"Returns a list of resources that are unused in the code.\n\n Prints status lines to the console because this function is quite slow.\n\n Args:\n grd_filepath: Path to a .grd file listing resources.\n\n Returns:\n A list of pairs of [resource_id, filepath] for the unused resources.\n \"\"\"",
"# M... | [
{
"param": "grd_filepath",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of pairs of [resource_id, filepath] for the unused resources.",
"docstring_tokens": [
"A",
"list",
"of",
"pairs",
"of",
"[",
"resource_id",
"filepath",
"]",
"for",
"the",
... |
8bf838a9484bb6da426074adf18f54b89e7dfdee | sunlongbo/chromium | tools/resources/find_unused_resources.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetScaleDirectories | <not_specific> | def GetScaleDirectories(resources_path):
"""Returns a list of paths to per-scale-factor resource directories.
Assumes the directory names end in '_percent', for example,
ash/resources/default_200_percent or
chrome/app/theme/resources/touch_140_percent
Args:
resources_path: The base path of interest.
... | Returns a list of paths to per-scale-factor resource directories.
Assumes the directory names end in '_percent', for example,
ash/resources/default_200_percent or
chrome/app/theme/resources/touch_140_percent
Args:
resources_path: The base path of interest.
Returns:
A list of paths relative to the '... | Returns a list of paths to per-scale-factor resource directories. | [
"Returns",
"a",
"list",
"of",
"paths",
"to",
"per",
"-",
"scale",
"-",
"factor",
"resource",
"directories",
"."
] | def GetScaleDirectories(resources_path):
file_list = os.listdir(resources_path)
scale_directories = []
for file_entry in file_list:
file_path = os.path.join(resources_path, file_entry)
if os.path.isdir(file_path) and file_path.endswith('_percent'):
scale_directories.append(file_path)
scale_directo... | [
"def",
"GetScaleDirectories",
"(",
"resources_path",
")",
":",
"file_list",
"=",
"os",
".",
"listdir",
"(",
"resources_path",
")",
"scale_directories",
"=",
"[",
"]",
"for",
"file_entry",
"in",
"file_list",
":",
"file_path",
"=",
"os",
".",
"path",
".",
"joi... | Returns a list of paths to per-scale-factor resource directories. | [
"Returns",
"a",
"list",
"of",
"paths",
"to",
"per",
"-",
"scale",
"-",
"factor",
"resource",
"directories",
"."
] | [
"\"\"\"Returns a list of paths to per-scale-factor resource directories.\n\n Assumes the directory names end in '_percent', for example,\n ash/resources/default_200_percent or\n chrome/app/theme/resources/touch_140_percent\n\n Args:\n resources_path: The base path of interest.\n\n Returns:\n A list of pa... | [
{
"param": "resources_path",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of paths relative to the 'src' directory.",
"docstring_tokens": [
"A",
"list",
"of",
"paths",
"relative",
"to",
"the",
"'",
"src",
"'",
"directory",
"."
],
... |
4ef6bceedf30a869c3ea715ebdf95b0da599d0ce | sunlongbo/chromium | printing/backend/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckForStringViewFromNullableIppApi | <not_specific> | def _CheckForStringViewFromNullableIppApi(input_api, output_api):
"""
Looks for all affected lines in CL where one constructs either
base::StringPiece or std::string_view from any ipp*() CUPS API call.
Assumes over-broadly that all ipp*() calls can return NULL.
Returns affected lines as a list of presubmit er... |
Looks for all affected lines in CL where one constructs either
base::StringPiece or std::string_view from any ipp*() CUPS API call.
Assumes over-broadly that all ipp*() calls can return NULL.
Returns affected lines as a list of presubmit errors.
| Looks for all affected lines in CL where one constructs either
base::StringPiece or std::string_view from any ipp*() CUPS API call.
Assumes over-broadly that all ipp*() calls can return NULL.
Returns affected lines as a list of presubmit errors. | [
"Looks",
"for",
"all",
"affected",
"lines",
"in",
"CL",
"where",
"one",
"constructs",
"either",
"base",
"::",
"StringPiece",
"or",
"std",
"::",
"string_view",
"from",
"any",
"ipp",
"*",
"()",
"CUPS",
"API",
"call",
".",
"Assumes",
"over",
"-",
"broadly",
... | def _CheckForStringViewFromNullableIppApi(input_api, output_api):
string_view_re = input_api.re.compile(
r"^.+(base::StringPiece|std::string_view)\s+\w+( = |\()ipp[A-Z].+$")
violations = input_api.canned_checks._FindNewViolationsOfRule(
lambda extension, line:
not (extension in ("cc", "h") and s... | [
"def",
"_CheckForStringViewFromNullableIppApi",
"(",
"input_api",
",",
"output_api",
")",
":",
"string_view_re",
"=",
"input_api",
".",
"re",
".",
"compile",
"(",
"r\"^.+(base::StringPiece|std::string_view)\\s+\\w+( = |\\()ipp[A-Z].+$\"",
")",
"violations",
"=",
"input_api",
... | Looks for all affected lines in CL where one constructs either
base::StringPiece or std::string_view from any ipp*() CUPS API call. | [
"Looks",
"for",
"all",
"affected",
"lines",
"in",
"CL",
"where",
"one",
"constructs",
"either",
"base",
"::",
"StringPiece",
"or",
"std",
"::",
"string_view",
"from",
"any",
"ipp",
"*",
"()",
"CUPS",
"API",
"call",
"."
] | [
"\"\"\"\n Looks for all affected lines in CL where one constructs either\n base::StringPiece or std::string_view from any ipp*() CUPS API call.\n Assumes over-broadly that all ipp*() calls can return NULL.\n Returns affected lines as a list of presubmit errors.\n \"\"\"",
"# Attempts to detect source lines l... | [
{
"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... |
4eff5da1d6f527b84e7cefe27921c79c96ac8842 | sunlongbo/chromium | components/cronet/tools/android_rndis_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _SetDns | <not_specific> | def _SetDns(self, iface, dns1, dns2):
"""Overrides device's DNS configuration.
Args:
iface: name of the network interface to make default
dns1, dns2: nameserver IP addresses
"""
if not iface:
return # If there is no route, then nobody cares about DNS.
# DNS proxy in older version... | Overrides device's DNS configuration.
Args:
iface: name of the network interface to make default
dns1, dns2: nameserver IP addresses
| Overrides device's DNS configuration. | [
"Overrides",
"device",
"'",
"s",
"DNS",
"configuration",
"."
] | def _SetDns(self, iface, dns1, dns2):
if not iface:
return
self._device.SetProp('net.dns1', dns1)
self._device.SetProp('net.dns2', dns2)
dnschange = self._device.GetProp('net.dnschange')
if dnschange:
self._device.SetProp('net.dnschange', str(int(dnschange) + 1))
self._device.RunSh... | [
"def",
"_SetDns",
"(",
"self",
",",
"iface",
",",
"dns1",
",",
"dns2",
")",
":",
"if",
"not",
"iface",
":",
"return",
"self",
".",
"_device",
".",
"SetProp",
"(",
"'net.dns1'",
",",
"dns1",
")",
"self",
".",
"_device",
".",
"SetProp",
"(",
"'net.dns2... | Overrides device's DNS configuration. | [
"Overrides",
"device",
"'",
"s",
"DNS",
"configuration",
"."
] | [
"\"\"\"Overrides device's DNS configuration.\n\n Args:\n iface: name of the network interface to make default\n dns1, dns2: nameserver IP addresses\n \"\"\"",
"# If there is no route, then nobody cares about DNS.",
"# DNS proxy in older versions of Android is configured via properties.",
"# TO... | [
{
"param": "self",
"type": null
},
{
"param": "iface",
"type": null
},
{
"param": "dns1",
"type": null
},
{
"param": "dns2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iface",
"type": null,
"docstring": "name of the network interface t... |
4eff5da1d6f527b84e7cefe27921c79c96ac8842 | sunlongbo/chromium | components/cronet/tools/android_rndis_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetCurrentDns | <not_specific> | def _GetCurrentDns(self):
"""Returns current gateway, dns1, and dns2."""
routes = self._device.RunShellCommand(
['cat', '/proc/net/route'], check_return=True)[1:]
routes = [route.split() for route in routes]
default_routes = [route[0] for route in routes if route[1] == '00000000']
return (
... | Returns current gateway, dns1, and dns2. | Returns current gateway, dns1, and dns2. | [
"Returns",
"current",
"gateway",
"dns1",
"and",
"dns2",
"."
] | def _GetCurrentDns(self):
routes = self._device.RunShellCommand(
['cat', '/proc/net/route'], check_return=True)[1:]
routes = [route.split() for route in routes]
default_routes = [route[0] for route in routes if route[1] == '00000000']
return (
default_routes[0] if default_routes else None,... | [
"def",
"_GetCurrentDns",
"(",
"self",
")",
":",
"routes",
"=",
"self",
".",
"_device",
".",
"RunShellCommand",
"(",
"[",
"'cat'",
",",
"'/proc/net/route'",
"]",
",",
"check_return",
"=",
"True",
")",
"[",
"1",
":",
"]",
"routes",
"=",
"[",
"route",
"."... | Returns current gateway, dns1, and dns2. | [
"Returns",
"current",
"gateway",
"dns1",
"and",
"dns2",
"."
] | [
"\"\"\"Returns current gateway, dns1, and dns2.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4eff5da1d6f527b84e7cefe27921c79c96ac8842 | sunlongbo/chromium | components/cronet/tools/android_rndis_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _OverrideDefaultGateway | null | def _OverrideDefaultGateway(self):
"""Force traffic to go through RNDIS interface.
Override any default gateway route. Without this traffic may go through
the wrong interface.
This introduces the risk that _RestoreDefaultGateway() is not called
(e.g. Telemetry crashes). A power cycle or "adb reboo... | Force traffic to go through RNDIS interface.
Override any default gateway route. Without this traffic may go through
the wrong interface.
This introduces the risk that _RestoreDefaultGateway() is not called
(e.g. Telemetry crashes). A power cycle or "adb reboot" is a simple
workaround around in th... | Force traffic to go through RNDIS interface.
Override any default gateway route. Without this traffic may go through
the wrong interface.
This introduces the risk that _RestoreDefaultGateway() is not called
. A power cycle or "adb reboot" is a simple
workaround around in that case. | [
"Force",
"traffic",
"to",
"go",
"through",
"RNDIS",
"interface",
".",
"Override",
"any",
"default",
"gateway",
"route",
".",
"Without",
"this",
"traffic",
"may",
"go",
"through",
"the",
"wrong",
"interface",
".",
"This",
"introduces",
"the",
"risk",
"that",
... | def _OverrideDefaultGateway(self):
self._device.RunShellCommand(
['route', 'add', 'default', 'gw', self.host_ip,
'dev', self._device_iface]) | [
"def",
"_OverrideDefaultGateway",
"(",
"self",
")",
":",
"self",
".",
"_device",
".",
"RunShellCommand",
"(",
"[",
"'route'",
",",
"'add'",
",",
"'default'",
",",
"'gw'",
",",
"self",
".",
"host_ip",
",",
"'dev'",
",",
"self",
".",
"_device_iface",
"]",
... | Force traffic to go through RNDIS interface. | [
"Force",
"traffic",
"to",
"go",
"through",
"RNDIS",
"interface",
"."
] | [
"\"\"\"Force traffic to go through RNDIS interface.\n\n Override any default gateway route. Without this traffic may go through\n the wrong interface.\n\n This introduces the risk that _RestoreDefaultGateway() is not called\n (e.g. Telemetry crashes). A power cycle or \"adb reboot\" is a simple\n wor... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4eff5da1d6f527b84e7cefe27921c79c96ac8842 | sunlongbo/chromium | components/cronet/tools/android_rndis_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _FindDeviceRndisInterface | <not_specific> | def _FindDeviceRndisInterface(self):
"""Returns the name of the RNDIS network interface if present."""
config = self._device.RunShellCommand(
['ip', '-o', 'link', 'show'], check_return=True)
interfaces = [line.split(':')[1].strip() for line in config]
candidates = [iface for iface in interfaces ... | Returns the name of the RNDIS network interface if present. | Returns the name of the RNDIS network interface if present. | [
"Returns",
"the",
"name",
"of",
"the",
"RNDIS",
"network",
"interface",
"if",
"present",
"."
] | def _FindDeviceRndisInterface(self):
config = self._device.RunShellCommand(
['ip', '-o', 'link', 'show'], check_return=True)
interfaces = [line.split(':')[1].strip() for line in config]
candidates = [iface for iface in interfaces if re.match('rndis|usb', iface)]
if candidates:
candidates.s... | [
"def",
"_FindDeviceRndisInterface",
"(",
"self",
")",
":",
"config",
"=",
"self",
".",
"_device",
".",
"RunShellCommand",
"(",
"[",
"'ip'",
",",
"'-o'",
",",
"'link'",
",",
"'show'",
"]",
",",
"check_return",
"=",
"True",
")",
"interfaces",
"=",
"[",
"li... | Returns the name of the RNDIS network interface if present. | [
"Returns",
"the",
"name",
"of",
"the",
"RNDIS",
"network",
"interface",
"if",
"present",
"."
] | [
"\"\"\"Returns the name of the RNDIS network interface if present.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4eff5da1d6f527b84e7cefe27921c79c96ac8842 | sunlongbo/chromium | components/cronet/tools/android_rndis_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _FindDeviceRndisMacAddress | <not_specific> | def _FindDeviceRndisMacAddress(self, interface):
"""Returns the MAC address of the RNDIS network interface if present."""
config = self._device.RunShellCommand(
['ip', '-o', 'link', 'show', interface], check_return=True)[0]
return config.split('link/ether ')[1][:17] | Returns the MAC address of the RNDIS network interface if present. | Returns the MAC address of the RNDIS network interface if present. | [
"Returns",
"the",
"MAC",
"address",
"of",
"the",
"RNDIS",
"network",
"interface",
"if",
"present",
"."
] | def _FindDeviceRndisMacAddress(self, interface):
config = self._device.RunShellCommand(
['ip', '-o', 'link', 'show', interface], check_return=True)[0]
return config.split('link/ether ')[1][:17] | [
"def",
"_FindDeviceRndisMacAddress",
"(",
"self",
",",
"interface",
")",
":",
"config",
"=",
"self",
".",
"_device",
".",
"RunShellCommand",
"(",
"[",
"'ip'",
",",
"'-o'",
",",
"'link'",
",",
"'show'",
",",
"interface",
"]",
",",
"check_return",
"=",
"True... | Returns the MAC address of the RNDIS network interface if present. | [
"Returns",
"the",
"MAC",
"address",
"of",
"the",
"RNDIS",
"network",
"interface",
"if",
"present",
"."
] | [
"\"\"\"Returns the MAC address of the RNDIS network interface if present.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "interface",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "interface",
"type": null,
"docstring": null,
"docstring_token... |
4eff5da1d6f527b84e7cefe27921c79c96ac8842 | sunlongbo/chromium | components/cronet/tools/android_rndis_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _FindHostRndisInterface | <not_specific> | def _FindHostRndisInterface(self, device_mac_address):
"""Returns the name of the host-side network interface."""
interface_list = self._EnumerateHostInterfaces()
ether_address = self._device.ReadFile(
'%s/f_rndis/ethaddr' % self._RNDIS_DEVICE,
as_root=True, force_pull=True).strip()
inte... | Returns the name of the host-side network interface. | Returns the name of the host-side network interface. | [
"Returns",
"the",
"name",
"of",
"the",
"host",
"-",
"side",
"network",
"interface",
"."
] | def _FindHostRndisInterface(self, device_mac_address):
interface_list = self._EnumerateHostInterfaces()
ether_address = self._device.ReadFile(
'%s/f_rndis/ethaddr' % self._RNDIS_DEVICE,
as_root=True, force_pull=True).strip()
interface_name = None
for line in interface_list:
if not ... | [
"def",
"_FindHostRndisInterface",
"(",
"self",
",",
"device_mac_address",
")",
":",
"interface_list",
"=",
"self",
".",
"_EnumerateHostInterfaces",
"(",
")",
"ether_address",
"=",
"self",
".",
"_device",
".",
"ReadFile",
"(",
"'%s/f_rndis/ethaddr'",
"%",
"self",
"... | Returns the name of the host-side network interface. | [
"Returns",
"the",
"name",
"of",
"the",
"host",
"-",
"side",
"network",
"interface",
"."
] | [
"\"\"\"Returns the name of the host-side network interface.\"\"\"",
"# Attempt to ping device to trigger ARP for device.",
"# Check if ARP cache now has device in it.",
"# NOTE(pauljensen): |ether_address| seems incorrect on Nougat devices,",
"# but just going by the host interface name seems safe enough."
... | [
{
"param": "self",
"type": null
},
{
"param": "device_mac_address",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "device_mac_address",
"type": null,
"docstring": null,
"docstr... |
4eff5da1d6f527b84e7cefe27921c79c96ac8842 | sunlongbo/chromium | components/cronet/tools/android_rndis_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _LoadInstalledHoRNDIS | <not_specific> | def _LoadInstalledHoRNDIS(self):
"""Attempt to load HoRNDIS if installed.
If kext could not be loaded or if HoRNDIS is not installed, return False.
"""
if not os.path.isdir('/System/Library/Extensions/HoRNDIS.kext'):
logging.info('HoRNDIS not present on system.')
return False
def HoRNDI... | Attempt to load HoRNDIS if installed.
If kext could not be loaded or if HoRNDIS is not installed, return False.
| Attempt to load HoRNDIS if installed.
If kext could not be loaded or if HoRNDIS is not installed, return False. | [
"Attempt",
"to",
"load",
"HoRNDIS",
"if",
"installed",
".",
"If",
"kext",
"could",
"not",
"be",
"loaded",
"or",
"if",
"HoRNDIS",
"is",
"not",
"installed",
"return",
"False",
"."
] | def _LoadInstalledHoRNDIS(self):
if not os.path.isdir('/System/Library/Extensions/HoRNDIS.kext'):
logging.info('HoRNDIS not present on system.')
return False
def HoRNDISLoaded():
return 'HoRNDIS' in subprocess.check_output(['kextstat'])
if HoRNDISLoaded():
return True
logging.inf... | [
"def",
"_LoadInstalledHoRNDIS",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"'/System/Library/Extensions/HoRNDIS.kext'",
")",
":",
"logging",
".",
"info",
"(",
"'HoRNDIS not present on system.'",
")",
"return",
"False",
"def",
"HoRNDI... | Attempt to load HoRNDIS if installed. | [
"Attempt",
"to",
"load",
"HoRNDIS",
"if",
"installed",
"."
] | [
"\"\"\"Attempt to load HoRNDIS if installed.\n If kext could not be loaded or if HoRNDIS is not installed, return False.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4eff5da1d6f527b84e7cefe27921c79c96ac8842 | sunlongbo/chromium | components/cronet/tools/android_rndis_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _EnableRndis | null | def _EnableRndis(self):
"""Enables the RNDIS network interface."""
script_prefix = '/data/local/tmp/rndis'
# This could be accomplished via "svc usb setFunction rndis" but only on
# devices which have the "USB tethering" feature.
# Also, on some devices, it's necessary to go through "none" function.... | Enables the RNDIS network interface. | Enables the RNDIS network interface. | [
"Enables",
"the",
"RNDIS",
"network",
"interface",
"."
] | def _EnableRndis(self):
script_prefix = '/data/local/tmp/rndis'
script = """
trap '' HUP
trap '' TERM
trap '' PIPE
function manual_config() {
echo %(functions)s > %(dev)s/functions
echo 224 > %(dev)s/bDeviceClass
echo 1 > %(dev)s/enable
start adbd
setprop sys.usb.state %(functions)s
}
# This function ... | [
"def",
"_EnableRndis",
"(",
"self",
")",
":",
"script_prefix",
"=",
"'/data/local/tmp/rndis'",
"script",
"=",
"\"\"\"\ntrap '' HUP\ntrap '' TERM\ntrap '' PIPE\n\nfunction manual_config() {\n echo %(functions)s > %(dev)s/functions\n echo 224 > %(dev)s/bDeviceClass\n echo 1 > %(dev)s/enable\n... | Enables the RNDIS network interface. | [
"Enables",
"the",
"RNDIS",
"network",
"interface",
"."
] | [
"\"\"\"Enables the RNDIS network interface.\"\"\"",
"# This could be accomplished via \"svc usb setFunction rndis\" but only on",
"# devices which have the \"USB tethering\" feature.",
"# Also, on some devices, it's necessary to go through \"none\" function.",
"# TODO(szym): run via su -c if necessary."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4eff5da1d6f527b84e7cefe27921c79c96ac8842 | sunlongbo/chromium | components/cronet/tools/android_rndis_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckEnableRndis | <not_specific> | def _CheckEnableRndis(self, force):
"""Enables the RNDIS network interface, retrying if necessary.
Args:
force: Disable RNDIS first, even if it appears already enabled.
Returns:
device_iface: RNDIS interface name on the device
host_iface: corresponding interface name on the host
"""
... | Enables the RNDIS network interface, retrying if necessary.
Args:
force: Disable RNDIS first, even if it appears already enabled.
Returns:
device_iface: RNDIS interface name on the device
host_iface: corresponding interface name on the host
| Enables the RNDIS network interface, retrying if necessary. | [
"Enables",
"the",
"RNDIS",
"network",
"interface",
"retrying",
"if",
"necessary",
"."
] | def _CheckEnableRndis(self, force):
for _ in range(3):
if not force:
device_iface = self._FindDeviceRndisInterface()
if device_iface:
device_mac_address = self._FindDeviceRndisMacAddress(device_iface)
host_iface = self._FindHostRndisInterface(device_mac_address)
i... | [
"def",
"_CheckEnableRndis",
"(",
"self",
",",
"force",
")",
":",
"for",
"_",
"in",
"range",
"(",
"3",
")",
":",
"if",
"not",
"force",
":",
"device_iface",
"=",
"self",
".",
"_FindDeviceRndisInterface",
"(",
")",
"if",
"device_iface",
":",
"device_mac_addre... | Enables the RNDIS network interface, retrying if necessary. | [
"Enables",
"the",
"RNDIS",
"network",
"interface",
"retrying",
"if",
"necessary",
"."
] | [
"\"\"\"Enables the RNDIS network interface, retrying if necessary.\n Args:\n force: Disable RNDIS first, even if it appears already enabled.\n Returns:\n device_iface: RNDIS interface name on the device\n host_iface: corresponding interface name on the host\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "force",
"type": null
}
] | {
"returns": [
{
"docstring": "RNDIS interface name on the device\nhost_iface: corresponding interface name on the host",
"docstring_tokens": [
"RNDIS",
"interface",
"name",
"on",
"the",
"device",
"host_iface",
":",
"corresponding... |
4eff5da1d6f527b84e7cefe27921c79c96ac8842 | sunlongbo/chromium | components/cronet/tools/android_rndis_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetHostAddresses | <not_specific> | def _GetHostAddresses(self, iface):
"""Returns the IP addresses on host's interfaces, breaking out |iface|."""
interface_list = self._EnumerateHostInterfaces()
addresses = []
iface_address = None
found_iface = False
for line in interface_list:
if not line.startswith((' ', '\t')):
f... | Returns the IP addresses on host's interfaces, breaking out |iface|. | Returns the IP addresses on host's interfaces, breaking out |iface|. | [
"Returns",
"the",
"IP",
"addresses",
"on",
"host",
"'",
"s",
"interfaces",
"breaking",
"out",
"|iface|",
"."
] | def _GetHostAddresses(self, iface):
interface_list = self._EnumerateHostInterfaces()
addresses = []
iface_address = None
found_iface = False
for line in interface_list:
if not line.startswith((' ', '\t')):
found_iface = iface in line
match = re.search(r'(?<=inet )\S+', line)
... | [
"def",
"_GetHostAddresses",
"(",
"self",
",",
"iface",
")",
":",
"interface_list",
"=",
"self",
".",
"_EnumerateHostInterfaces",
"(",
")",
"addresses",
"=",
"[",
"]",
"iface_address",
"=",
"None",
"found_iface",
"=",
"False",
"for",
"line",
"in",
"interface_li... | Returns the IP addresses on host's interfaces, breaking out |iface|. | [
"Returns",
"the",
"IP",
"addresses",
"on",
"host",
"'",
"s",
"interfaces",
"breaking",
"out",
"|iface|",
"."
] | [
"\"\"\"Returns the IP addresses on host's interfaces, breaking out |iface|.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "iface",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iface",
"type": null,
"docstring": null,
"docstring_tokens": ... |
4eff5da1d6f527b84e7cefe27921c79c96ac8842 | sunlongbo/chromium | components/cronet/tools/android_rndis_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetDeviceAddresses | <not_specific> | def _GetDeviceAddresses(self, excluded_iface):
"""Returns the IP addresses on all connected devices.
Excludes interface |excluded_iface| on the selected device.
"""
my_device = str(self._device)
addresses = []
for device_serial in android_device.GetDeviceSerials(None):
try:
device ... | Returns the IP addresses on all connected devices.
Excludes interface |excluded_iface| on the selected device.
| Returns the IP addresses on all connected devices.
Excludes interface |excluded_iface| on the selected device. | [
"Returns",
"the",
"IP",
"addresses",
"on",
"all",
"connected",
"devices",
".",
"Excludes",
"interface",
"|excluded_iface|",
"on",
"the",
"selected",
"device",
"."
] | def _GetDeviceAddresses(self, excluded_iface):
my_device = str(self._device)
addresses = []
for device_serial in android_device.GetDeviceSerials(None):
try:
device = device_utils.DeviceUtils(device_serial)
if device_serial == my_device:
excluded = excluded_iface
else:... | [
"def",
"_GetDeviceAddresses",
"(",
"self",
",",
"excluded_iface",
")",
":",
"my_device",
"=",
"str",
"(",
"self",
".",
"_device",
")",
"addresses",
"=",
"[",
"]",
"for",
"device_serial",
"in",
"android_device",
".",
"GetDeviceSerials",
"(",
"None",
")",
":",... | Returns the IP addresses on all connected devices. | [
"Returns",
"the",
"IP",
"addresses",
"on",
"all",
"connected",
"devices",
"."
] | [
"\"\"\"Returns the IP addresses on all connected devices.\n Excludes interface |excluded_iface| on the selected device.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "excluded_iface",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "excluded_iface",
"type": null,
"docstring": null,
"docstring_... |
4eff5da1d6f527b84e7cefe27921c79c96ac8842 | sunlongbo/chromium | components/cronet/tools/android_rndis_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | OverrideRoutingPolicy | null | def OverrideRoutingPolicy(self):
"""Override any routing policy that could prevent
packets from reaching the rndis interface
"""
policies = self._device.RunShellCommand(['ip', 'rule'], check_return=True)
if len(policies) > 1 and not 'lookup main' in policies[1]:
self._device.RunShellCommand(
... | Override any routing policy that could prevent
packets from reaching the rndis interface
| Override any routing policy that could prevent
packets from reaching the rndis interface | [
"Override",
"any",
"routing",
"policy",
"that",
"could",
"prevent",
"packets",
"from",
"reaching",
"the",
"rndis",
"interface"
] | def OverrideRoutingPolicy(self):
policies = self._device.RunShellCommand(['ip', 'rule'], check_return=True)
if len(policies) > 1 and not 'lookup main' in policies[1]:
self._device.RunShellCommand(
['ip', 'rule', 'add', 'prio', '1', 'from', 'all', 'table', 'main'],
check_return=True)
... | [
"def",
"OverrideRoutingPolicy",
"(",
"self",
")",
":",
"policies",
"=",
"self",
".",
"_device",
".",
"RunShellCommand",
"(",
"[",
"'ip'",
",",
"'rule'",
"]",
",",
"check_return",
"=",
"True",
")",
"if",
"len",
"(",
"policies",
")",
">",
"1",
"and",
"no... | Override any routing policy that could prevent
packets from reaching the rndis interface | [
"Override",
"any",
"routing",
"policy",
"that",
"could",
"prevent",
"packets",
"from",
"reaching",
"the",
"rndis",
"interface"
] | [
"\"\"\"Override any routing policy that could prevent\n packets from reaching the rndis interface\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4eff5da1d6f527b84e7cefe27921c79c96ac8842 | sunlongbo/chromium | components/cronet/tools/android_rndis_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckConfigureNetwork | <not_specific> | def _CheckConfigureNetwork(self):
"""Enables RNDIS and configures it, retrying until we have connectivity."""
force = False
for _ in range(3):
device_iface, host_iface = self._CheckEnableRndis(force)
self._ConfigureNetwork(device_iface, host_iface)
self.OverrideRoutingPolicy()
# Some... | Enables RNDIS and configures it, retrying until we have connectivity. | Enables RNDIS and configures it, retrying until we have connectivity. | [
"Enables",
"RNDIS",
"and",
"configures",
"it",
"retrying",
"until",
"we",
"have",
"connectivity",
"."
] | def _CheckConfigureNetwork(self):
force = False
for _ in range(3):
device_iface, host_iface = self._CheckEnableRndis(force)
self._ConfigureNetwork(device_iface, host_iface)
self.OverrideRoutingPolicy()
for _ in range(3):
if self._TestConnectivity():
return
force =... | [
"def",
"_CheckConfigureNetwork",
"(",
"self",
")",
":",
"force",
"=",
"False",
"for",
"_",
"in",
"range",
"(",
"3",
")",
":",
"device_iface",
",",
"host_iface",
"=",
"self",
".",
"_CheckEnableRndis",
"(",
"force",
")",
"self",
".",
"_ConfigureNetwork",
"("... | Enables RNDIS and configures it, retrying until we have connectivity. | [
"Enables",
"RNDIS",
"and",
"configures",
"it",
"retrying",
"until",
"we",
"have",
"connectivity",
"."
] | [
"\"\"\"Enables RNDIS and configures it, retrying until we have connectivity.\"\"\"",
"# Sometimes the first packet will wake up the connection."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18229e23783ae2e29c4b4330336585b87d0efd32 | sunlongbo/chromium | tools/l10n/generate_locales_list.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | gen_locales | <not_specific> | def gen_locales(locales): # type: (list) -> str
"""Returns the generated code for the locale list.
The list is guaranteed to be in sorted order without duplicates.
>>> locales = ['en-GB', 'en', 'de', 'en']
>>> generated = gen_locales(locales)
>>> locales.pop() # remove the duplicate
'en'
... | Returns the generated code for the locale list.
The list is guaranteed to be in sorted order without duplicates.
>>> locales = ['en-GB', 'en', 'de', 'en']
>>> generated = gen_locales(locales)
>>> locales.pop() # remove the duplicate
'en'
>>> locales.sort()
>>> index_in_generated = lambda ... | Returns the generated code for the locale list.
The list is guaranteed to be in sorted order without duplicates.
| [
"Returns",
"the",
"generated",
"code",
"for",
"the",
"locale",
"list",
".",
"The",
"list",
"is",
"guaranteed",
"to",
"be",
"in",
"sorted",
"order",
"without",
"duplicates",
"."
] | def gen_locales(locales):
return '\n'.join(gen_locale(locale) for locale in sorted(set(locales))) | [
"def",
"gen_locales",
"(",
"locales",
")",
":",
"return",
"'\\n'",
".",
"join",
"(",
"gen_locale",
"(",
"locale",
")",
"for",
"locale",
"in",
"sorted",
"(",
"set",
"(",
"locales",
")",
")",
")"
] | Returns the generated code for the locale list. | [
"Returns",
"the",
"generated",
"code",
"for",
"the",
"locale",
"list",
"."
] | [
"# type: (list) -> str",
"\"\"\"Returns the generated code for the locale list.\n\n The list is guaranteed to be in sorted order without duplicates.\n\n >>> locales = ['en-GB', 'en', 'de', 'en']\n >>> generated = gen_locales(locales)\n >>> locales.pop() # remove the duplicate\n 'en'\n >>> local... | [
{
"param": "locales",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "locales",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1834a49dbb1fb63b4792b6970688ac5076b304c1 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/breakpad/dump_reader.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_is_functional | null | def check_is_functional(self):
"""This routine must be implemented by subclasses.
Returns True if this reader is functional.
"""
raise NotImplementedError() | This routine must be implemented by subclasses.
Returns True if this reader is functional.
| This routine must be implemented by subclasses.
Returns True if this reader is functional. | [
"This",
"routine",
"must",
"be",
"implemented",
"by",
"subclasses",
".",
"Returns",
"True",
"if",
"this",
"reader",
"is",
"functional",
"."
] | def check_is_functional(self):
raise NotImplementedError() | [
"def",
"check_is_functional",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | This routine must be implemented by subclasses. | [
"This",
"routine",
"must",
"be",
"implemented",
"by",
"subclasses",
"."
] | [
"\"\"\"This routine must be implemented by subclasses.\n\n Returns True if this reader is functional.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1834a49dbb1fb63b4792b6970688ac5076b304c1 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/breakpad/dump_reader.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _get_pid_from_dump | null | def _get_pid_from_dump(self, dump_file):
"""This routine must be implemented by subclasses.
This routine returns the PID of the crashed process that produced the given dump_file.
"""
raise NotImplementedError() | This routine must be implemented by subclasses.
This routine returns the PID of the crashed process that produced the given dump_file.
| This routine must be implemented by subclasses.
This routine returns the PID of the crashed process that produced the given dump_file. | [
"This",
"routine",
"must",
"be",
"implemented",
"by",
"subclasses",
".",
"This",
"routine",
"returns",
"the",
"PID",
"of",
"the",
"crashed",
"process",
"that",
"produced",
"the",
"given",
"dump_file",
"."
] | def _get_pid_from_dump(self, dump_file):
raise NotImplementedError() | [
"def",
"_get_pid_from_dump",
"(",
"self",
",",
"dump_file",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | This routine must be implemented by subclasses. | [
"This",
"routine",
"must",
"be",
"implemented",
"by",
"subclasses",
"."
] | [
"\"\"\"This routine must be implemented by subclasses.\n\n This routine returns the PID of the crashed process that produced the given dump_file.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "dump_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dump_file",
"type": null,
"docstring": null,
"docstring_token... |
1834a49dbb1fb63b4792b6970688ac5076b304c1 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/breakpad/dump_reader.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _get_stack_from_dump | null | def _get_stack_from_dump(self, dump_file):
"""This routine must be implemented by subclasses.
Returns the stack stored in the given breakpad dump_file.
"""
raise NotImplementedError() | This routine must be implemented by subclasses.
Returns the stack stored in the given breakpad dump_file.
| This routine must be implemented by subclasses.
Returns the stack stored in the given breakpad dump_file. | [
"This",
"routine",
"must",
"be",
"implemented",
"by",
"subclasses",
".",
"Returns",
"the",
"stack",
"stored",
"in",
"the",
"given",
"breakpad",
"dump_file",
"."
] | def _get_stack_from_dump(self, dump_file):
raise NotImplementedError() | [
"def",
"_get_stack_from_dump",
"(",
"self",
",",
"dump_file",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | This routine must be implemented by subclasses. | [
"This",
"routine",
"must",
"be",
"implemented",
"by",
"subclasses",
"."
] | [
"\"\"\"This routine must be implemented by subclasses.\n\n Returns the stack stored in the given breakpad dump_file.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "dump_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dump_file",
"type": null,
"docstring": null,
"docstring_token... |
1834a49dbb1fb63b4792b6970688ac5076b304c1 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/breakpad/dump_reader.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _file_extension | null | def _file_extension(self):
"""This routine must be implemented by subclasses.
Returns the file extension of crash dumps written by breakpad.
"""
raise NotImplementedError() | This routine must be implemented by subclasses.
Returns the file extension of crash dumps written by breakpad.
| This routine must be implemented by subclasses.
Returns the file extension of crash dumps written by breakpad. | [
"This",
"routine",
"must",
"be",
"implemented",
"by",
"subclasses",
".",
"Returns",
"the",
"file",
"extension",
"of",
"crash",
"dumps",
"written",
"by",
"breakpad",
"."
] | def _file_extension(self):
raise NotImplementedError() | [
"def",
"_file_extension",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | This routine must be implemented by subclasses. | [
"This",
"routine",
"must",
"be",
"implemented",
"by",
"subclasses",
"."
] | [
"\"\"\"This routine must be implemented by subclasses.\n\n Returns the file extension of crash dumps written by breakpad.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cf727e95665cdbb13cf20bb8e3a4137a4c6c86b3 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/utilities.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | is_non_legacy_callback_interface_from_idl | <not_specific> | def is_non_legacy_callback_interface_from_idl(file_contents):
"""Returns True if the specified IDL is a non-legacy callback interface."""
match = re.search(r'callback\s+interface\s+\w+\s*{', file_contents)
# Having constants means it's a legacy callback interface.
# https://webidl.spec.whatwg.org/#legac... | Returns True if the specified IDL is a non-legacy callback interface. | Returns True if the specified IDL is a non-legacy callback interface. | [
"Returns",
"True",
"if",
"the",
"specified",
"IDL",
"is",
"a",
"non",
"-",
"legacy",
"callback",
"interface",
"."
] | def is_non_legacy_callback_interface_from_idl(file_contents):
match = re.search(r'callback\s+interface\s+\w+\s*{', file_contents)
return bool(match) and not re.search(r'\s+const\b', file_contents) | [
"def",
"is_non_legacy_callback_interface_from_idl",
"(",
"file_contents",
")",
":",
"match",
"=",
"re",
".",
"search",
"(",
"r'callback\\s+interface\\s+\\w+\\s*{'",
",",
"file_contents",
")",
"return",
"bool",
"(",
"match",
")",
"and",
"not",
"re",
".",
"search",
... | Returns True if the specified IDL is a non-legacy callback interface. | [
"Returns",
"True",
"if",
"the",
"specified",
"IDL",
"is",
"a",
"non",
"-",
"legacy",
"callback",
"interface",
"."
] | [
"\"\"\"Returns True if the specified IDL is a non-legacy callback interface.\"\"\"",
"# Having constants means it's a legacy callback interface.",
"# https://webidl.spec.whatwg.org/#legacy-callback-interface-object"
] | [
{
"param": "file_contents",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_contents",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cf727e95665cdbb13cf20bb8e3a4137a4c6c86b3 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/utilities.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | should_generate_impl_file_from_idl | <not_specific> | def should_generate_impl_file_from_idl(file_contents):
"""True when a given IDL file contents could generate .h/.cpp files."""
# FIXME: This would be error-prone and we should use AST rather than
# improving the regexp pattern.
match = re.search(r'(interface|dictionary)\s+\w+', file_contents)
return... | True when a given IDL file contents could generate .h/.cpp files. | True when a given IDL file contents could generate .h/.cpp files. | [
"True",
"when",
"a",
"given",
"IDL",
"file",
"contents",
"could",
"generate",
".",
"h",
"/",
".",
"cpp",
"files",
"."
] | def should_generate_impl_file_from_idl(file_contents):
match = re.search(r'(interface|dictionary)\s+\w+', file_contents)
return bool(match) | [
"def",
"should_generate_impl_file_from_idl",
"(",
"file_contents",
")",
":",
"match",
"=",
"re",
".",
"search",
"(",
"r'(interface|dictionary)\\s+\\w+'",
",",
"file_contents",
")",
"return",
"bool",
"(",
"match",
")"
] | True when a given IDL file contents could generate .h/.cpp files. | [
"True",
"when",
"a",
"given",
"IDL",
"file",
"contents",
"could",
"generate",
".",
"h",
"/",
".",
"cpp",
"files",
"."
] | [
"\"\"\"True when a given IDL file contents could generate .h/.cpp files.\"\"\"",
"# FIXME: This would be error-prone and we should use AST rather than",
"# improving the regexp pattern."
] | [
{
"param": "file_contents",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_contents",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cf727e95665cdbb13cf20bb8e3a4137a4c6c86b3 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/utilities.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | format_remove_duplicates | <not_specific> | def format_remove_duplicates(text, patterns):
"""Removes duplicated line-basis patterns.
Based on simple pattern matching, removes duplicated lines in a block
of lines. Lines that match with a same pattern are considered as
duplicates.
Designed to be used as a filter function for Jinja2.
Arg... | Removes duplicated line-basis patterns.
Based on simple pattern matching, removes duplicated lines in a block
of lines. Lines that match with a same pattern are considered as
duplicates.
Designed to be used as a filter function for Jinja2.
Args:
text: A str of multi-line text.
pa... | Removes duplicated line-basis patterns.
Based on simple pattern matching, removes duplicated lines in a block
of lines. Lines that match with a same pattern are considered as
duplicates.
Designed to be used as a filter function for Jinja2. | [
"Removes",
"duplicated",
"line",
"-",
"basis",
"patterns",
".",
"Based",
"on",
"simple",
"pattern",
"matching",
"removes",
"duplicated",
"lines",
"in",
"a",
"block",
"of",
"lines",
".",
"Lines",
"that",
"match",
"with",
"a",
"same",
"pattern",
"are",
"consid... | def format_remove_duplicates(text, patterns):
pattern_founds = [False] * len(patterns)
output = []
for line in text.split('\n'):
to_be_removed = False
for i, pattern in enumerate(patterns):
if pattern not in line:
continue
if pattern_founds[i]:
... | [
"def",
"format_remove_duplicates",
"(",
"text",
",",
"patterns",
")",
":",
"pattern_founds",
"=",
"[",
"False",
"]",
"*",
"len",
"(",
"patterns",
")",
"output",
"=",
"[",
"]",
"for",
"line",
"in",
"text",
".",
"split",
"(",
"'\\n'",
")",
":",
"to_be_re... | Removes duplicated line-basis patterns. | [
"Removes",
"duplicated",
"line",
"-",
"basis",
"patterns",
"."
] | [
"\"\"\"Removes duplicated line-basis patterns.\n\n Based on simple pattern matching, removes duplicated lines in a block\n of lines. Lines that match with a same pattern are considered as\n duplicates.\n\n Designed to be used as a filter function for Jinja2.\n\n Args:\n text: A str of multi-l... | [
{
"param": "text",
"type": null
},
{
"param": "patterns",
"type": null
}
] | {
"returns": [
{
"docstring": "A formatted str with duplicates removed.",
"docstring_tokens": [
"A",
"formatted",
"str",
"with",
"duplicates",
"removed",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identi... |
cf727e95665cdbb13cf20bb8e3a4137a4c6c86b3 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/utilities.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | format_blink_cpp_source_code | <not_specific> | def format_blink_cpp_source_code(text):
"""Formats C++ source code.
Supported modifications are:
- Reduces successive empty lines into a single empty line.
- Removes empty lines just after an open brace or before closing brace.
This rule does not apply to namespaces.
Designed to be used as a... | Formats C++ source code.
Supported modifications are:
- Reduces successive empty lines into a single empty line.
- Removes empty lines just after an open brace or before closing brace.
This rule does not apply to namespaces.
Designed to be used as a filter function for Jinja2.
Args:
... | Formats C++ source code.
Supported modifications are:
Reduces successive empty lines into a single empty line.
Removes empty lines just after an open brace or before closing brace.
This rule does not apply to namespaces.
Designed to be used as a filter function for Jinja2. | [
"Formats",
"C",
"++",
"source",
"code",
".",
"Supported",
"modifications",
"are",
":",
"Reduces",
"successive",
"empty",
"lines",
"into",
"a",
"single",
"empty",
"line",
".",
"Removes",
"empty",
"lines",
"just",
"after",
"an",
"open",
"brace",
"or",
"before"... | def format_blink_cpp_source_code(text):
re_empty_line = re.compile(r'^\s*$')
re_first_brace = re.compile(r'(?P<first>[{}])')
re_last_brace = re.compile(r'.*(?P<last>[{}]).*?$')
was_open_brace = True
was_empty_line = False
output = []
for line in text.split('\n'):
if line == '' or r... | [
"def",
"format_blink_cpp_source_code",
"(",
"text",
")",
":",
"re_empty_line",
"=",
"re",
".",
"compile",
"(",
"r'^\\s*$'",
")",
"re_first_brace",
"=",
"re",
".",
"compile",
"(",
"r'(?P<first>[{}])'",
")",
"re_last_brace",
"=",
"re",
".",
"compile",
"(",
"r'.*... | Formats C++ source code. | [
"Formats",
"C",
"++",
"source",
"code",
"."
] | [
"\"\"\"Formats C++ source code.\n\n Supported modifications are:\n - Reduces successive empty lines into a single empty line.\n - Removes empty lines just after an open brace or before closing brace.\n This rule does not apply to namespaces.\n\n Designed to be used as a filter function for Jinja2.\... | [
{
"param": "text",
"type": null
}
] | {
"returns": [
{
"docstring": "A formatted str of the source code.",
"docstring_tokens": [
"A",
"formatted",
"str",
"of",
"the",
"source",
"code",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"ident... |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetDownloadURL | <not_specific> | def GetDownloadURL(self, revision):
"""Gets the download URL for a build archive of a specific revision."""
if self.is_asan:
return '%s/%s-%s/%s-%d.zip' % (
ASAN_BASE_URL, self.GetASANPlatformDir(), self.build_type,
self.GetASANBaseName(), revision)
if str(revision) in self.githash... | Gets the download URL for a build archive of a specific revision. | Gets the download URL for a build archive of a specific revision. | [
"Gets",
"the",
"download",
"URL",
"for",
"a",
"build",
"archive",
"of",
"a",
"specific",
"revision",
"."
] | def GetDownloadURL(self, revision):
if self.is_asan:
return '%s/%s-%s/%s-%d.zip' % (
ASAN_BASE_URL, self.GetASANPlatformDir(), self.build_type,
self.GetASANBaseName(), revision)
if str(revision) in self.githash_svn_dict:
revision = self.githash_svn_dict[str(revision)]
archive... | [
"def",
"GetDownloadURL",
"(",
"self",
",",
"revision",
")",
":",
"if",
"self",
".",
"is_asan",
":",
"return",
"'%s/%s-%s/%s-%d.zip'",
"%",
"(",
"ASAN_BASE_URL",
",",
"self",
".",
"GetASANPlatformDir",
"(",
")",
",",
"self",
".",
"build_type",
",",
"self",
... | Gets the download URL for a build archive of a specific revision. | [
"Gets",
"the",
"download",
"URL",
"for",
"a",
"build",
"archive",
"of",
"a",
"specific",
"revision",
"."
] | [
"\"\"\"Gets the download URL for a build archive of a specific revision.\"\"\"",
"# At revision 591483, the names of two of the archives changed",
"# due to: https://chromium-review.googlesource.com/#/q/1226086",
"# See: http://crbug.com/789612"
] | [
{
"param": "self",
"type": null
},
{
"param": "revision",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "revision",
"type": null,
"docstring": null,
"docstring_tokens... |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetLaunchPath | <not_specific> | def GetLaunchPath(self, revision):
"""Returns a relative path (presumably from the archive extraction location)
that is used to run the executable."""
if self.is_asan:
extract_dir = '%s-%d' % (self.GetASANBaseName(), revision)
else:
extract_dir = self._archive_extract_dir
# At revision ... | Returns a relative path (presumably from the archive extraction location)
that is used to run the executable. | Returns a relative path (presumably from the archive extraction location)
that is used to run the executable. | [
"Returns",
"a",
"relative",
"path",
"(",
"presumably",
"from",
"the",
"archive",
"extraction",
"location",
")",
"that",
"is",
"used",
"to",
"run",
"the",
"executable",
"."
] | def GetLaunchPath(self, revision):
if self.is_asan:
extract_dir = '%s-%d' % (self.GetASANBaseName(), revision)
else:
extract_dir = self._archive_extract_dir
if revision >= 591483:
if self.platform == 'chromeos':
extract_dir = 'chrome-chromeos'
elif self.platform in ('win', 'w... | [
"def",
"GetLaunchPath",
"(",
"self",
",",
"revision",
")",
":",
"if",
"self",
".",
"is_asan",
":",
"extract_dir",
"=",
"'%s-%d'",
"%",
"(",
"self",
".",
"GetASANBaseName",
"(",
")",
",",
"revision",
")",
"else",
":",
"extract_dir",
"=",
"self",
".",
"_... | Returns a relative path (presumably from the archive extraction location)
that is used to run the executable. | [
"Returns",
"a",
"relative",
"path",
"(",
"presumably",
"from",
"the",
"archive",
"extraction",
"location",
")",
"that",
"is",
"used",
"to",
"run",
"the",
"executable",
"."
] | [
"\"\"\"Returns a relative path (presumably from the archive extraction location)\n that is used to run the executable.\"\"\"",
"# At revision 591483, the names of two of the archives changed",
"# due to: https://chromium-review.googlesource.com/#/q/1226086",
"# See: http://crbug.com/789612"
] | [
{
"param": "self",
"type": null
},
{
"param": "revision",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "revision",
"type": null,
"docstring": null,
"docstring_tokens... |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParseDirectoryIndex | <not_specific> | def ParseDirectoryIndex(self, last_known_rev):
"""Parses the Google Storage directory listing into a list of revision
numbers."""
def _GetMarkerForRev(revision):
if self.is_asan:
return '%s-%s/%s-%d.zip' % (
self.GetASANPlatformDir(), self.build_type,
self.GetASANBaseN... | Parses the Google Storage directory listing into a list of revision
numbers. | Parses the Google Storage directory listing into a list of revision
numbers. | [
"Parses",
"the",
"Google",
"Storage",
"directory",
"listing",
"into",
"a",
"list",
"of",
"revision",
"numbers",
"."
] | def ParseDirectoryIndex(self, last_known_rev):
def _GetMarkerForRev(revision):
if self.is_asan:
return '%s-%s/%s-%d.zip' % (
self.GetASANPlatformDir(), self.build_type,
self.GetASANBaseName(), revision)
return '%s%d' % (self._listing_platform_dir, revision)
def _Fetch... | [
"def",
"ParseDirectoryIndex",
"(",
"self",
",",
"last_known_rev",
")",
":",
"def",
"_GetMarkerForRev",
"(",
"revision",
")",
":",
"if",
"self",
".",
"is_asan",
":",
"return",
"'%s-%s/%s-%d.zip'",
"%",
"(",
"self",
".",
"GetASANPlatformDir",
"(",
")",
",",
"s... | Parses the Google Storage directory listing into a list of revision
numbers. | [
"Parses",
"the",
"Google",
"Storage",
"directory",
"listing",
"into",
"a",
"list",
"of",
"revision",
"numbers",
"."
] | [
"\"\"\"Parses the Google Storage directory listing into a list of revision\n numbers.\"\"\"",
"\"\"\"Fetches a URL and returns a 2-Tuple of ([revisions], next-marker). If\n next-marker is not None, then the listing is a partial listing and another\n fetch should be performed with next-marker being th... | [
{
"param": "self",
"type": null
},
{
"param": "last_known_rev",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "last_known_rev",
"type": null,
"docstring": null,
"docstring_... |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _FetchAndParse | <not_specific> | def _FetchAndParse(url):
"""Fetches a URL and returns a 2-Tuple of ([revisions], next-marker). If
next-marker is not None, then the listing is a partial listing and another
fetch should be performed with next-marker being the marker= GET
parameter."""
handle = urllib.urlopen(url)
doc... | Fetches a URL and returns a 2-Tuple of ([revisions], next-marker). If
next-marker is not None, then the listing is a partial listing and another
fetch should be performed with next-marker being the marker= GET
parameter. | Fetches a URL and returns a 2-Tuple of ([revisions], next-marker). If
next-marker is not None, then the listing is a partial listing and another
fetch should be performed with next-marker being the marker= GET
parameter. | [
"Fetches",
"a",
"URL",
"and",
"returns",
"a",
"2",
"-",
"Tuple",
"of",
"(",
"[",
"revisions",
"]",
"next",
"-",
"marker",
")",
".",
"If",
"next",
"-",
"marker",
"is",
"not",
"None",
"then",
"the",
"listing",
"is",
"a",
"partial",
"listing",
"and",
... | def _FetchAndParse(url):
handle = urllib.urlopen(url)
document = ElementTree.parse(handle)
root_tag = document.getroot().tag
end_ns_pos = root_tag.find('}')
if end_ns_pos == -1:
raise Exception('Could not locate end namespace for directory index')
namespace = root_tag[:end_ns... | [
"def",
"_FetchAndParse",
"(",
"url",
")",
":",
"handle",
"=",
"urllib",
".",
"urlopen",
"(",
"url",
")",
"document",
"=",
"ElementTree",
".",
"parse",
"(",
"handle",
")",
"root_tag",
"=",
"document",
".",
"getroot",
"(",
")",
".",
"tag",
"end_ns_pos",
... | Fetches a URL and returns a 2-Tuple of ([revisions], next-marker). | [
"Fetches",
"a",
"URL",
"and",
"returns",
"a",
"2",
"-",
"Tuple",
"of",
"(",
"[",
"revisions",
"]",
"next",
"-",
"marker",
")",
"."
] | [
"\"\"\"Fetches a URL and returns a 2-Tuple of ([revisions], next-marker). If\n next-marker is not None, then the listing is a partial listing and another\n fetch should be performed with next-marker being the marker= GET\n parameter.\"\"\"",
"# All nodes in the tree are namespaced. Get the root's t... | [
{
"param": "url",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetRevList | <not_specific> | def GetRevList(self, archive):
"""Gets the list of revision numbers between self.good_revision and
self.bad_revision."""
cache = {}
# The cache is stored in the same directory as bisect-builds.py
cache_filename = os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'.bisect-bui... | Gets the list of revision numbers between self.good_revision and
self.bad_revision. | Gets the list of revision numbers between self.good_revision and
self.bad_revision. | [
"Gets",
"the",
"list",
"of",
"revision",
"numbers",
"between",
"self",
".",
"good_revision",
"and",
"self",
".",
"bad_revision",
"."
] | def GetRevList(self, archive):
cache = {}
cache_filename = os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'.bisect-builds-cache.json')
cache_dict_key = self.GetListingURL()
def _LoadBucketFromCache():
if self.use_local_cache:
try:
with open(cache_filena... | [
"def",
"GetRevList",
"(",
"self",
",",
"archive",
")",
":",
"cache",
"=",
"{",
"}",
"cache_filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
")",
... | Gets the list of revision numbers between self.good_revision and
self.bad_revision. | [
"Gets",
"the",
"list",
"of",
"revision",
"numbers",
"between",
"self",
".",
"good_revision",
"and",
"self",
".",
"bad_revision",
"."
] | [
"\"\"\"Gets the list of revision numbers between self.good_revision and\n self.bad_revision.\"\"\"",
"# The cache is stored in the same directory as bisect-builds.py",
"\"\"\"Save the list of revisions and the git-svn mappings to a file.\n The list of revisions is assumed to be sorted.\"\"\"",
"# Down... | [
{
"param": "self",
"type": null
},
{
"param": "archive",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "archive",
"type": null,
"docstring": null,
"docstring_tokens"... |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _SaveBucketToCache | null | def _SaveBucketToCache():
"""Save the list of revisions and the git-svn mappings to a file.
The list of revisions is assumed to be sorted."""
if self.use_local_cache:
cache[cache_dict_key] = revlist_all
cache['githash_svn_dict'] = self.githash_svn_dict
try:
with open(... | Save the list of revisions and the git-svn mappings to a file.
The list of revisions is assumed to be sorted. | Save the list of revisions and the git-svn mappings to a file.
The list of revisions is assumed to be sorted. | [
"Save",
"the",
"list",
"of",
"revisions",
"and",
"the",
"git",
"-",
"svn",
"mappings",
"to",
"a",
"file",
".",
"The",
"list",
"of",
"revisions",
"is",
"assumed",
"to",
"be",
"sorted",
"."
] | def _SaveBucketToCache():
if self.use_local_cache:
cache[cache_dict_key] = revlist_all
cache['githash_svn_dict'] = self.githash_svn_dict
try:
with open(cache_filename, 'w') as cache_file:
json.dump(cache, cache_file)
print('Saved revisions %d-%d to %s' %
... | [
"def",
"_SaveBucketToCache",
"(",
")",
":",
"if",
"self",
".",
"use_local_cache",
":",
"cache",
"[",
"cache_dict_key",
"]",
"=",
"revlist_all",
"cache",
"[",
"'githash_svn_dict'",
"]",
"=",
"self",
".",
"githash_svn_dict",
"try",
":",
"with",
"open",
"(",
"c... | Save the list of revisions and the git-svn mappings to a file. | [
"Save",
"the",
"list",
"of",
"revisions",
"and",
"the",
"git",
"-",
"svn",
"mappings",
"to",
"a",
"file",
"."
] | [
"\"\"\"Save the list of revisions and the git-svn mappings to a file.\n The list of revisions is assumed to be sorted.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FetchRevision | null | def FetchRevision(context, rev, filename, quit_event=None, progress_event=None):
"""Downloads and unzips revision |rev|.
@param context A PathContext instance.
@param rev The Chromium revision number/tag to download.
@param filename The destination for the downloaded file.
@param quit_event A threading.Event ... | Downloads and unzips revision |rev|.
@param context A PathContext instance.
@param rev The Chromium revision number/tag to download.
@param filename The destination for the downloaded file.
@param quit_event A threading.Event which will be set by the master thread to
indicate that the downlo... | Downloads and unzips revision |rev|.
@param context A PathContext instance.
@param rev The Chromium revision number/tag to download.
@param filename The destination for the downloaded file.
@param quit_event A threading.Event which will be set by the master thread to
indicate that the download should be aborted.
@param... | [
"Downloads",
"and",
"unzips",
"revision",
"|rev|",
".",
"@param",
"context",
"A",
"PathContext",
"instance",
".",
"@param",
"rev",
"The",
"Chromium",
"revision",
"number",
"/",
"tag",
"to",
"download",
".",
"@param",
"filename",
"The",
"destination",
"for",
"t... | def FetchRevision(context, rev, filename, quit_event=None, progress_event=None):
def ReportHook(blocknum, blocksize, totalsize):
if quit_event and quit_event.isSet():
raise RuntimeError('Aborting download of revision %s' % str(rev))
if progress_event and progress_event.isSet():
size = blocknum * b... | [
"def",
"FetchRevision",
"(",
"context",
",",
"rev",
",",
"filename",
",",
"quit_event",
"=",
"None",
",",
"progress_event",
"=",
"None",
")",
":",
"def",
"ReportHook",
"(",
"blocknum",
",",
"blocksize",
",",
"totalsize",
")",
":",
"if",
"quit_event",
"and"... | Downloads and unzips revision |rev|. | [
"Downloads",
"and",
"unzips",
"revision",
"|rev|",
"."
] | [
"\"\"\"Downloads and unzips revision |rev|.\n @param context A PathContext instance.\n @param rev The Chromium revision number/tag to download.\n @param filename The destination for the downloaded file.\n @param quit_event A threading.Event which will be set by the master thread to\n indicate... | [
{
"param": "context",
"type": null
},
{
"param": "rev",
"type": null
},
{
"param": "filename",
"type": null
},
{
"param": "quit_event",
"type": null
},
{
"param": "progress_event",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rev",
"type": null,
"docstring": null,
"docstring_tokens":... |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CopyMissingFileFromCurrentSource | null | def CopyMissingFileFromCurrentSource(src_glob, dst):
"""Work around missing files in archives.
This happens when archives of Chrome don't contain all of the files
needed to build it. In many cases we can work around this using
files from the current checkout. The source is in the form of a glob
so that it can... | Work around missing files in archives.
This happens when archives of Chrome don't contain all of the files
needed to build it. In many cases we can work around this using
files from the current checkout. The source is in the form of a glob
so that it can try to look for possible sources of the file in
multipl... | Work around missing files in archives.
This happens when archives of Chrome don't contain all of the files
needed to build it. In many cases we can work around this using
files from the current checkout. The source is in the form of a glob
so that it can try to look for possible sources of the file in
multiple location... | [
"Work",
"around",
"missing",
"files",
"in",
"archives",
".",
"This",
"happens",
"when",
"archives",
"of",
"Chrome",
"don",
"'",
"t",
"contain",
"all",
"of",
"the",
"files",
"needed",
"to",
"build",
"it",
".",
"In",
"many",
"cases",
"we",
"can",
"work",
... | def CopyMissingFileFromCurrentSource(src_glob, dst):
if not os.path.exists(dst):
matches = glob.glob(src_glob)
if matches:
shutil.copy2(matches[0], dst) | [
"def",
"CopyMissingFileFromCurrentSource",
"(",
"src_glob",
",",
"dst",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dst",
")",
":",
"matches",
"=",
"glob",
".",
"glob",
"(",
"src_glob",
")",
"if",
"matches",
":",
"shutil",
".",
"copy... | Work around missing files in archives. | [
"Work",
"around",
"missing",
"files",
"in",
"archives",
"."
] | [
"\"\"\"Work around missing files in archives.\n This happens when archives of Chrome don't contain all of the files\n needed to build it. In many cases we can work around this using\n files from the current checkout. The source is in the form of a glob\n so that it can try to look for possible sources of the fi... | [
{
"param": "src_glob",
"type": null
},
{
"param": "dst",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "src_glob",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": null,
"docstring": null,
"docstring_tokens"... |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunRevision | <not_specific> | def RunRevision(context, revision, zip_file, profile, num_runs, command, args):
"""Given a zipped revision, unzip it and run the test."""
print('Trying revision %s...' % str(revision))
# Create a temp directory and unzip the revision into it.
cwd = os.getcwd()
tempdir = tempfile.mkdtemp(prefix='bisect_tmp')
... | Given a zipped revision, unzip it and run the test. | Given a zipped revision, unzip it and run the test. | [
"Given",
"a",
"zipped",
"revision",
"unzip",
"it",
"and",
"run",
"the",
"test",
"."
] | def RunRevision(context, revision, zip_file, profile, num_runs, command, args):
print('Trying revision %s...' % str(revision))
cwd = os.getcwd()
tempdir = tempfile.mkdtemp(prefix='bisect_tmp')
UnzipFilenameToDir(zip_file, tempdir)
if context.platform == 'chromeos' and revision < 591483:
CopyMissingFileFro... | [
"def",
"RunRevision",
"(",
"context",
",",
"revision",
",",
"zip_file",
",",
"profile",
",",
"num_runs",
",",
"command",
",",
"args",
")",
":",
"print",
"(",
"'Trying revision %s...'",
"%",
"str",
"(",
"revision",
")",
")",
"cwd",
"=",
"os",
".",
"getcwd... | Given a zipped revision, unzip it and run the test. | [
"Given",
"a",
"zipped",
"revision",
"unzip",
"it",
"and",
"run",
"the",
"test",
"."
] | [
"\"\"\"Given a zipped revision, unzip it and run the test.\"\"\"",
"# Create a temp directory and unzip the revision into it.",
"# Hack: Some Chrome OS archives are missing some files; try to copy them",
"# from the local directory.",
"# Run the build as many times as specified.",
"# The sandbox must be r... | [
{
"param": "context",
"type": null
},
{
"param": "revision",
"type": null
},
{
"param": "zip_file",
"type": null
},
{
"param": "profile",
"type": null
},
{
"param": "num_runs",
"type": null
},
{
"param": "command",
"type": null
},
{
"param"... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "revision",
"type": null,
"docstring": null,
"docstring_tok... |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AskIsGoodBuild | <not_specific> | def AskIsGoodBuild(rev, exit_status, stdout, stderr):
"""Asks the user whether build |rev| is good or bad."""
if exit_status:
print('Chrome exit_status: %d. Use s to see output' % exit_status)
# Loop until we get a response that we can parse.
while True:
prompt = ('Revision %s is '
'[(g)oo... | Asks the user whether build |rev| is good or bad. | Asks the user whether build |rev| is good or bad. | [
"Asks",
"the",
"user",
"whether",
"build",
"|rev|",
"is",
"good",
"or",
"bad",
"."
] | def AskIsGoodBuild(rev, exit_status, stdout, stderr):
if exit_status:
print('Chrome exit_status: %d. Use s to see output' % exit_status)
while True:
prompt = ('Revision %s is '
'[(g)ood/(b)ad/(r)etry/(u)nknown/(s)tdout/(q)uit]: ' % str(rev))
if sys.version_info[0] == 3:
response = in... | [
"def",
"AskIsGoodBuild",
"(",
"rev",
",",
"exit_status",
",",
"stdout",
",",
"stderr",
")",
":",
"if",
"exit_status",
":",
"print",
"(",
"'Chrome exit_status: %d. Use s to see output'",
"%",
"exit_status",
")",
"while",
"True",
":",
"prompt",
"=",
"(",
"'Revisio... | Asks the user whether build |rev| is good or bad. | [
"Asks",
"the",
"user",
"whether",
"build",
"|rev|",
"is",
"good",
"or",
"bad",
"."
] | [
"\"\"\"Asks the user whether build |rev| is good or bad.\"\"\"",
"# Loop until we get a response that we can parse."
] | [
{
"param": "rev",
"type": null
},
{
"param": "exit_status",
"type": null
},
{
"param": "stdout",
"type": null
},
{
"param": "stderr",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rev",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "exit_status",
"type": null,
"docstring": null,
"docstring_toke... |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | IsGoodASANBuild | <not_specific> | def IsGoodASANBuild(rev, exit_status, stdout, stderr):
"""Determine if an ASAN build |rev| is good or bad
Will examine stderr looking for the error message emitted by ASAN. If not
found then will fallback to asking the user."""
if stderr:
bad_count = 0
for line in stderr.splitlines():
print(line)... | Determine if an ASAN build |rev| is good or bad
Will examine stderr looking for the error message emitted by ASAN. If not
found then will fallback to asking the user. | Determine if an ASAN build |rev| is good or bad
Will examine stderr looking for the error message emitted by ASAN. If not
found then will fallback to asking the user. | [
"Determine",
"if",
"an",
"ASAN",
"build",
"|rev|",
"is",
"good",
"or",
"bad",
"Will",
"examine",
"stderr",
"looking",
"for",
"the",
"error",
"message",
"emitted",
"by",
"ASAN",
".",
"If",
"not",
"found",
"then",
"will",
"fallback",
"to",
"asking",
"the",
... | def IsGoodASANBuild(rev, exit_status, stdout, stderr):
if stderr:
bad_count = 0
for line in stderr.splitlines():
print(line)
if line.find('ERROR: AddressSanitizer:') != -1:
bad_count += 1
if bad_count > 0:
print('Revision %d determined to be bad.' % rev)
return 'b'
return... | [
"def",
"IsGoodASANBuild",
"(",
"rev",
",",
"exit_status",
",",
"stdout",
",",
"stderr",
")",
":",
"if",
"stderr",
":",
"bad_count",
"=",
"0",
"for",
"line",
"in",
"stderr",
".",
"splitlines",
"(",
")",
":",
"print",
"(",
"line",
")",
"if",
"line",
".... | Determine if an ASAN build |rev| is good or bad
Will examine stderr looking for the error message emitted by ASAN. | [
"Determine",
"if",
"an",
"ASAN",
"build",
"|rev|",
"is",
"good",
"or",
"bad",
"Will",
"examine",
"stderr",
"looking",
"for",
"the",
"error",
"message",
"emitted",
"by",
"ASAN",
"."
] | [
"\"\"\"Determine if an ASAN build |rev| is good or bad\n\n Will examine stderr looking for the error message emitted by ASAN. If not\n found then will fallback to asking the user.\"\"\""
] | [
{
"param": "rev",
"type": null
},
{
"param": "exit_status",
"type": null
},
{
"param": "stdout",
"type": null
},
{
"param": "stderr",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rev",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "exit_status",
"type": null,
"docstring": null,
"docstring_toke... |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WaitFor | null | def WaitFor(self):
"""Prints a message and waits for the download to complete. The download
must have been started previously."""
assert self.thread, 'DownloadJob must be started before WaitFor is called.'
print('Downloading revision %s...' % str(self.rev))
self.progress_event.set() # Display progr... | Prints a message and waits for the download to complete. The download
must have been started previously. | Prints a message and waits for the download to complete. The download
must have been started previously. | [
"Prints",
"a",
"message",
"and",
"waits",
"for",
"the",
"download",
"to",
"complete",
".",
"The",
"download",
"must",
"have",
"been",
"started",
"previously",
"."
] | def WaitFor(self):
assert self.thread, 'DownloadJob must be started before WaitFor is called.'
print('Downloading revision %s...' % str(self.rev))
self.progress_event.set()
try:
while self.thread.is_alive():
self.thread.join(1)
except (KeyboardInterrupt, SystemExit):
self.Stop(... | [
"def",
"WaitFor",
"(",
"self",
")",
":",
"assert",
"self",
".",
"thread",
",",
"'DownloadJob must be started before WaitFor is called.'",
"print",
"(",
"'Downloading revision %s...'",
"%",
"str",
"(",
"self",
".",
"rev",
")",
")",
"self",
".",
"progress_event",
".... | Prints a message and waits for the download to complete. | [
"Prints",
"a",
"message",
"and",
"waits",
"for",
"the",
"download",
"to",
"complete",
"."
] | [
"\"\"\"Prints a message and waits for the download to complete. The download\n must have been started previously.\"\"\"",
"# Display progress of download.",
"# The parameter to join is needed to keep the main thread responsive to",
"# signals. Without it, the program will not respond to interruptions."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Bisect | <not_specific> | def Bisect(context,
num_runs=1,
command='%p %a',
try_args=(),
profile=None,
evaluate=AskIsGoodBuild,
verify_range=False,
archive=None):
"""Given known good and known bad revisions, run a binary search on all
archived revisions to determine... | Given known good and known bad revisions, run a binary search on all
archived revisions to determine the last known good revision.
@param context PathContext object initialized with user provided parameters.
@param num_runs Number of times to run each build for asking good/bad.
@param try_args A tuple of argum... | Given known good and known bad revisions, run a binary search on all
archived revisions to determine the last known good revision.
@param context PathContext object initialized with user provided parameters.
@param num_runs Number of times to run each build for asking good/bad.
@param try_args A tuple of arguments to ... | [
"Given",
"known",
"good",
"and",
"known",
"bad",
"revisions",
"run",
"a",
"binary",
"search",
"on",
"all",
"archived",
"revisions",
"to",
"determine",
"the",
"last",
"known",
"good",
"revision",
".",
"@param",
"context",
"PathContext",
"object",
"initialized",
... | def Bisect(context,
num_runs=1,
command='%p %a',
try_args=(),
profile=None,
evaluate=AskIsGoodBuild,
verify_range=False,
archive=None):
if not profile:
profile = 'profile'
good_rev = context.good_revision
bad_rev = context.bad_revisi... | [
"def",
"Bisect",
"(",
"context",
",",
"num_runs",
"=",
"1",
",",
"command",
"=",
"'%p %a'",
",",
"try_args",
"=",
"(",
")",
",",
"profile",
"=",
"None",
",",
"evaluate",
"=",
"AskIsGoodBuild",
",",
"verify_range",
"=",
"False",
",",
"archive",
"=",
"No... | Given known good and known bad revisions, run a binary search on all
archived revisions to determine the last known good revision. | [
"Given",
"known",
"good",
"and",
"known",
"bad",
"revisions",
"run",
"a",
"binary",
"search",
"on",
"all",
"archived",
"revisions",
"to",
"determine",
"the",
"last",
"known",
"good",
"revision",
"."
] | [
"\"\"\"Given known good and known bad revisions, run a binary search on all\n archived revisions to determine the last known good revision.\n\n @param context PathContext object initialized with user provided parameters.\n @param num_runs Number of times to run each build for asking good/bad.\n @param try_args ... | [
{
"param": "context",
"type": null
},
{
"param": "num_runs",
"type": null
},
{
"param": "command",
"type": null
},
{
"param": "try_args",
"type": null
},
{
"param": "profile",
"type": null
},
{
"param": "evaluate",
"type": null
},
{
"param"... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num_runs",
"type": null,
"docstring": null,
"docstring_tok... |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetBlinkDEPSRevisionForChromiumRevision | <not_specific> | def GetBlinkDEPSRevisionForChromiumRevision(self, rev):
"""Returns the blink revision that was in REVISIONS file at
chromium revision |rev|."""
def _GetBlinkRev(url, blink_re):
m = blink_re.search(url.read())
url.close()
if m:
return m.group(1)
url = urllib.urlopen(DEPS_FILE % GetGitHashFrom... | Returns the blink revision that was in REVISIONS file at
chromium revision |rev|. | Returns the blink revision that was in REVISIONS file at
chromium revision |rev|. | [
"Returns",
"the",
"blink",
"revision",
"that",
"was",
"in",
"REVISIONS",
"file",
"at",
"chromium",
"revision",
"|rev|",
"."
] | def GetBlinkDEPSRevisionForChromiumRevision(self, rev):
def _GetBlinkRev(url, blink_re):
m = blink_re.search(url.read())
url.close()
if m:
return m.group(1)
url = urllib.urlopen(DEPS_FILE % GetGitHashFromSVNRevision(rev))
if url.getcode() == 200:
blink_re = re.compile(r'webkit_revision\D*\d+... | [
"def",
"GetBlinkDEPSRevisionForChromiumRevision",
"(",
"self",
",",
"rev",
")",
":",
"def",
"_GetBlinkRev",
"(",
"url",
",",
"blink_re",
")",
":",
"m",
"=",
"blink_re",
".",
"search",
"(",
"url",
".",
"read",
"(",
")",
")",
"url",
".",
"close",
"(",
")... | Returns the blink revision that was in REVISIONS file at
chromium revision |rev|. | [
"Returns",
"the",
"blink",
"revision",
"that",
"was",
"in",
"REVISIONS",
"file",
"at",
"chromium",
"revision",
"|rev|",
"."
] | [
"\"\"\"Returns the blink revision that was in REVISIONS file at\n chromium revision |rev|.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "rev",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rev",
"type": null,
"docstring": null,
"docstring_tokens": []... |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetBlinkRevisionForChromiumRevision | <not_specific> | def GetBlinkRevisionForChromiumRevision(context, rev):
"""Returns the blink revision that was in REVISIONS file at
chromium revision |rev|."""
def _IsRevisionNumber(revision):
if isinstance(revision, int):
return True
else:
return revision.isdigit()
if str(rev) in context.githash_svn_dict:
... | Returns the blink revision that was in REVISIONS file at
chromium revision |rev|. | Returns the blink revision that was in REVISIONS file at
chromium revision |rev|. | [
"Returns",
"the",
"blink",
"revision",
"that",
"was",
"in",
"REVISIONS",
"file",
"at",
"chromium",
"revision",
"|rev|",
"."
] | def GetBlinkRevisionForChromiumRevision(context, rev):
def _IsRevisionNumber(revision):
if isinstance(revision, int):
return True
else:
return revision.isdigit()
if str(rev) in context.githash_svn_dict:
rev = context.githash_svn_dict[str(rev)]
file_url = '%s/%s%s/REVISIONS' % (context.base... | [
"def",
"GetBlinkRevisionForChromiumRevision",
"(",
"context",
",",
"rev",
")",
":",
"def",
"_IsRevisionNumber",
"(",
"revision",
")",
":",
"if",
"isinstance",
"(",
"revision",
",",
"int",
")",
":",
"return",
"True",
"else",
":",
"return",
"revision",
".",
"i... | Returns the blink revision that was in REVISIONS file at
chromium revision |rev|. | [
"Returns",
"the",
"blink",
"revision",
"that",
"was",
"in",
"REVISIONS",
"file",
"at",
"chromium",
"revision",
"|rev|",
"."
] | [
"\"\"\"Returns the blink revision that was in REVISIONS file at\n chromium revision |rev|.\"\"\""
] | [
{
"param": "context",
"type": null
},
{
"param": "rev",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rev",
"type": null,
"docstring": null,
"docstring_tokens":... |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetChromiumRevision | <not_specific> | def GetChromiumRevision(context, url):
"""Returns the chromium revision read from given URL."""
try:
# Location of the latest build revision number
latest_revision = urllib.urlopen(url).read()
if latest_revision.isdigit():
return int(latest_revision)
return context.GetSVNRevisionFromGitHash(la... | Returns the chromium revision read from given URL. | Returns the chromium revision read from given URL. | [
"Returns",
"the",
"chromium",
"revision",
"read",
"from",
"given",
"URL",
"."
] | def GetChromiumRevision(context, url):
try:
latest_revision = urllib.urlopen(url).read()
if latest_revision.isdigit():
return int(latest_revision)
return context.GetSVNRevisionFromGitHash(latest_revision)
except Exception:
print('Could not determine latest revision. This could be bad...')
... | [
"def",
"GetChromiumRevision",
"(",
"context",
",",
"url",
")",
":",
"try",
":",
"latest_revision",
"=",
"urllib",
".",
"urlopen",
"(",
"url",
")",
".",
"read",
"(",
")",
"if",
"latest_revision",
".",
"isdigit",
"(",
")",
":",
"return",
"int",
"(",
"lat... | Returns the chromium revision read from given URL. | [
"Returns",
"the",
"chromium",
"revision",
"read",
"from",
"given",
"URL",
"."
] | [
"\"\"\"Returns the chromium revision read from given URL.\"\"\"",
"# Location of the latest build revision number"
] | [
{
"param": "context",
"type": null
},
{
"param": "url",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens":... |
3727afde3284376763501e19a35ef33a4997eab8 | sunlongbo/chromium | tools/bisect-builds.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetRevision | <not_specific> | def GetRevision(revision_text):
"""Translates from a text description of a revision to an integral revision
number. Currently supported formats are a number (i.e.; '782793') or a
milestone specifier (i.e.; 'M85') or a full version string
(i.e. '85.0.4183.121')."""
# Check if we already have a revision number... | Translates from a text description of a revision to an integral revision
number. Currently supported formats are a number (i.e.; '782793') or a
milestone specifier (i.e.; 'M85') or a full version string
(i.e. '85.0.4183.121'). | Translates from a text description of a revision to an integral revision
number. Currently supported formats are a number or a
milestone specifier or a full version string
. | [
"Translates",
"from",
"a",
"text",
"description",
"of",
"a",
"revision",
"to",
"an",
"integral",
"revision",
"number",
".",
"Currently",
"supported",
"formats",
"are",
"a",
"number",
"or",
"a",
"milestone",
"specifier",
"or",
"a",
"full",
"version",
"string",
... | def GetRevision(revision_text):
if type(revision_text) == type(0):
return revision_text
if revision_text[:1].upper() == 'M':
milestone = revision_text[1:]
response = urllib.urlopen(VERSION_HISTORY_URL)
version_history = json.loads(response.read())
version_matcher = re.compile(
'.*version... | [
"def",
"GetRevision",
"(",
"revision_text",
")",
":",
"if",
"type",
"(",
"revision_text",
")",
"==",
"type",
"(",
"0",
")",
":",
"return",
"revision_text",
"if",
"revision_text",
"[",
":",
"1",
"]",
".",
"upper",
"(",
")",
"==",
"'M'",
":",
"milestone"... | Translates from a text description of a revision to an integral revision
number. | [
"Translates",
"from",
"a",
"text",
"description",
"of",
"a",
"revision",
"to",
"an",
"integral",
"revision",
"number",
"."
] | [
"\"\"\"Translates from a text description of a revision to an integral revision\n number. Currently supported formats are a number (i.e.; '782793') or a\n milestone specifier (i.e.; 'M85') or a full version string\n (i.e. '85.0.4183.121').\"\"\"",
"# Check if we already have a revision number, such as when -g ... | [
{
"param": "revision_text",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "revision_text",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
373c244a152e474cacb18a86fb99ca17bde6b17e | sunlongbo/chromium | printing/cups_config_helper.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | run_cups_config | <not_specific> | def run_cups_config(cups_config, mode):
"""Run cups-config with all --cflags etc modes, parse out the mode we want,
and return those flags as a list."""
cups = subprocess.Popen([cups_config, '--cflags', '--ldflags', '--libs'],
stdout=subprocess.PIPE, universal_newlines=True)
flags = c... | Run cups-config with all --cflags etc modes, parse out the mode we want,
and return those flags as a list. | Run cups-config with all --cflags etc modes, parse out the mode we want,
and return those flags as a list. | [
"Run",
"cups",
"-",
"config",
"with",
"all",
"--",
"cflags",
"etc",
"modes",
"parse",
"out",
"the",
"mode",
"we",
"want",
"and",
"return",
"those",
"flags",
"as",
"a",
"list",
"."
] | def run_cups_config(cups_config, mode):
cups = subprocess.Popen([cups_config, '--cflags', '--ldflags', '--libs'],
stdout=subprocess.PIPE, universal_newlines=True)
flags = cups.communicate()[0].strip()
flags_subset = []
for flag in flags.split():
flag_mode = None
if flag.startsw... | [
"def",
"run_cups_config",
"(",
"cups_config",
",",
"mode",
")",
":",
"cups",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"cups_config",
",",
"'--cflags'",
",",
"'--ldflags'",
",",
"'--libs'",
"]",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"univers... | Run cups-config with all --cflags etc modes, parse out the mode we want,
and return those flags as a list. | [
"Run",
"cups",
"-",
"config",
"with",
"all",
"--",
"cflags",
"etc",
"modes",
"parse",
"out",
"the",
"mode",
"we",
"want",
"and",
"return",
"those",
"flags",
"as",
"a",
"list",
"."
] | [
"\"\"\"Run cups-config with all --cflags etc modes, parse out the mode we want,\n and return those flags as a list.\"\"\"",
"# Be conservative: for flags where we don't know which mode they",
"# belong in, always include them.",
"# Note: cross build is confused by the option, and may trigger linker",
"# wa... | [
{
"param": "cups_config",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cups_config",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mode",
"type": null,
"docstring": null,
"docstring_tok... |
ef85940ce2bcb64a8f90850d6271a3dde1a1b87c | sunlongbo/chromium | tools/json_schema_compiler/features_compiler.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateSchema | <not_specific> | def _GenerateSchema(filename, root, destdir, namespace):
"""Generates C++ features files from the json file |filename|.
"""
# Load in the feature permissions from the JSON file.
schema = os.path.normpath(filename)
schema_loader = SchemaLoader(os.path.dirname(os.path.relpath(schema, root)),
... | Generates C++ features files from the json file |filename|.
| Generates C++ features files from the json file |filename|. | [
"Generates",
"C",
"++",
"features",
"files",
"from",
"the",
"json",
"file",
"|filename|",
"."
] | def _GenerateSchema(filename, root, destdir, namespace):
schema = os.path.normpath(filename)
schema_loader = SchemaLoader(os.path.dirname(os.path.relpath(schema, root)),
os.path.dirname(schema),
[],
None)
schema_filename ... | [
"def",
"_GenerateSchema",
"(",
"filename",
",",
"root",
",",
"destdir",
",",
"namespace",
")",
":",
"schema",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"filename",
")",
"schema_loader",
"=",
"SchemaLoader",
"(",
"os",
".",
"path",
".",
"dirname",
"("... | Generates C++ features files from the json file |filename|. | [
"Generates",
"C",
"++",
"features",
"files",
"from",
"the",
"json",
"file",
"|filename|",
"."
] | [
"\"\"\"Generates C++ features files from the json file |filename|.\n \"\"\"",
"# Load in the feature permissions from the JSON file.",
"# Generate a list of the features defined and a list of their models.",
"# Generate and output the code for all features."
] | [
{
"param": "filename",
"type": null
},
{
"param": "root",
"type": null
},
{
"param": "destdir",
"type": null
},
{
"param": "namespace",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "root",
"type": null,
"docstring": null,
"docstring_tokens... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.