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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3bba7dd2858128342b2f0b26ddccf6e3ed07c883 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/module.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | IsBackwardCompatible | <not_specific> | def IsBackwardCompatible(self, older_interface, checker):
"""This interface is backward-compatible with older_interface if and only
if all of the following conditions hold:
- All defined methods in older_interface (when identified by ordinal) have
backward-compatible definitions in this interface.... | This interface is backward-compatible with older_interface if and only
if all of the following conditions hold:
- All defined methods in older_interface (when identified by ordinal) have
backward-compatible definitions in this interface. For each method this
means:
- The parameter li... | This interface is backward-compatible with older_interface if and only
if all of the following conditions hold:
All defined methods in older_interface (when identified by ordinal) have
backward-compatible definitions in this interface. For each method this
means:
The parameter list is backward-compatible, according to ... | [
"This",
"interface",
"is",
"backward",
"-",
"compatible",
"with",
"older_interface",
"if",
"and",
"only",
"if",
"all",
"of",
"the",
"following",
"conditions",
"hold",
":",
"All",
"defined",
"methods",
"in",
"older_interface",
"(",
"when",
"identified",
"by",
"... | def IsBackwardCompatible(self, older_interface, checker):
def buildOrdinalMethodMap(interface):
methods_by_ordinal = {}
for method in interface.methods:
if method.ordinal in methods_by_ordinal:
raise Exception('Multiple methods with ordinal %s in interface %s.' %
... | [
"def",
"IsBackwardCompatible",
"(",
"self",
",",
"older_interface",
",",
"checker",
")",
":",
"def",
"buildOrdinalMethodMap",
"(",
"interface",
")",
":",
"methods_by_ordinal",
"=",
"{",
"}",
"for",
"method",
"in",
"interface",
".",
"methods",
":",
"if",
"metho... | This interface is backward-compatible with older_interface if and only
if all of the following conditions hold:
All defined methods in older_interface (when identified by ordinal) have
backward-compatible definitions in this interface. | [
"This",
"interface",
"is",
"backward",
"-",
"compatible",
"with",
"older_interface",
"if",
"and",
"only",
"if",
"all",
"of",
"the",
"following",
"conditions",
"hold",
":",
"All",
"defined",
"methods",
"in",
"older_interface",
"(",
"when",
"identified",
"by",
"... | [
"\"\"\"This interface is backward-compatible with older_interface if and only\n if all of the following conditions hold:\n - All defined methods in older_interface (when identified by ordinal) have\n backward-compatible definitions in this interface. For each method this\n means:\n - ... | [
{
"param": "self",
"type": null
},
{
"param": "older_interface",
"type": null
},
{
"param": "checker",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "older_interface",
"type": null,
"docstring": null,
"docstring... |
3bba7dd2858128342b2f0b26ddccf6e3ed07c883 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/module.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | IsBackwardCompatible | <not_specific> | def IsBackwardCompatible(self, older_enum, checker):
"""This enum is backward-compatible with older_enum if and only if one of
the following conditions holds:
- Neither enum is [Extensible] and both have the exact same set of valid
numeric values. Field names and aliases for the same numeric v... | This enum is backward-compatible with older_enum if and only if one of
the following conditions holds:
- Neither enum is [Extensible] and both have the exact same set of valid
numeric values. Field names and aliases for the same numeric value do
not affect compatibility.
- older_... | This enum is backward-compatible with older_enum if and only if one of
the following conditions holds:
Neither enum is [Extensible] and both have the exact same set of valid
numeric values. Field names and aliases for the same numeric value do
not affect compatibility.
older_enum is [Extensible], and for every version ... | [
"This",
"enum",
"is",
"backward",
"-",
"compatible",
"with",
"older_enum",
"if",
"and",
"only",
"if",
"one",
"of",
"the",
"following",
"conditions",
"holds",
":",
"Neither",
"enum",
"is",
"[",
"Extensible",
"]",
"and",
"both",
"have",
"the",
"exact",
"same... | def IsBackwardCompatible(self, older_enum, checker):
def buildVersionFieldMap(enum):
fields_by_min_version = {}
for field in enum.fields:
if field.min_version not in fields_by_min_version:
fields_by_min_version[field.min_version] = set()
fields_by_min_version[field.min_version]... | [
"def",
"IsBackwardCompatible",
"(",
"self",
",",
"older_enum",
",",
"checker",
")",
":",
"def",
"buildVersionFieldMap",
"(",
"enum",
")",
":",
"fields_by_min_version",
"=",
"{",
"}",
"for",
"field",
"in",
"enum",
".",
"fields",
":",
"if",
"field",
".",
"mi... | This enum is backward-compatible with older_enum if and only if one of
the following conditions holds:
Neither enum is [Extensible] and both have the exact same set of valid
numeric values. | [
"This",
"enum",
"is",
"backward",
"-",
"compatible",
"with",
"older_enum",
"if",
"and",
"only",
"if",
"one",
"of",
"the",
"following",
"conditions",
"holds",
":",
"Neither",
"enum",
"is",
"[",
"Extensible",
"]",
"and",
"both",
"have",
"the",
"exact",
"same... | [
"\"\"\"This enum is backward-compatible with older_enum if and only if one of\n the following conditions holds:\n - Neither enum is [Extensible] and both have the exact same set of valid\n numeric values. Field names and aliases for the same numeric value do\n not affect compatibility.\n... | [
{
"param": "self",
"type": null
},
{
"param": "older_enum",
"type": null
},
{
"param": "checker",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "older_enum",
"type": null,
"docstring": null,
"docstring_toke... |
3bba7dd2858128342b2f0b26ddccf6e3ed07c883 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/module.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ContainsNativeTypes | <not_specific> | def ContainsNativeTypes(kind):
"""Check if the kind contains any native type (struct or enum).
This check is recursive so it checks all struct fields, scoped interface
enums, etc.
Args:
struct: {Kind} The kind to check.
Returns:
{bool}: True if the kind contains native types.
"""
# We remember ... | Check if the kind contains any native type (struct or enum).
This check is recursive so it checks all struct fields, scoped interface
enums, etc.
Args:
struct: {Kind} The kind to check.
Returns:
{bool}: True if the kind contains native types.
| Check if the kind contains any native type (struct or enum).
This check is recursive so it checks all struct fields, scoped interface
enums, etc. | [
"Check",
"if",
"the",
"kind",
"contains",
"any",
"native",
"type",
"(",
"struct",
"or",
"enum",
")",
".",
"This",
"check",
"is",
"recursive",
"so",
"it",
"checks",
"all",
"struct",
"fields",
"scoped",
"interface",
"enums",
"etc",
"."
] | def ContainsNativeTypes(kind):
checked = set()
def Check(kind):
if kind.spec in checked:
return False
checked.add(kind.spec)
if IsEnumKind(kind):
return kind.native_only
elif IsStructKind(kind):
if kind.native_only:
return True
if any(enum.native_only for enum in kind... | [
"def",
"ContainsNativeTypes",
"(",
"kind",
")",
":",
"checked",
"=",
"set",
"(",
")",
"def",
"Check",
"(",
"kind",
")",
":",
"if",
"kind",
".",
"spec",
"in",
"checked",
":",
"return",
"False",
"checked",
".",
"add",
"(",
"kind",
".",
"spec",
")",
"... | Check if the kind contains any native type (struct or enum). | [
"Check",
"if",
"the",
"kind",
"contains",
"any",
"native",
"type",
"(",
"struct",
"or",
"enum",
")",
"."
] | [
"\"\"\"Check if the kind contains any native type (struct or enum).\n\n This check is recursive so it checks all struct fields, scoped interface\n enums, etc.\n\n Args:\n struct: {Kind} The kind to check.\n\n Returns:\n {bool}: True if the kind contains native types.\n \"\"\"",
"# We remember the types... | [
{
"param": "kind",
"type": null
}
] | {
"returns": [
{
"docstring": "True if the kind contains native types.",
"docstring_tokens": [
"True",
"if",
"the",
"kind",
"contains",
"native",
"types",
"."
],
"type": "{bool}"
}
],
"raises": [],
"params": [
{
... |
06672573bd4e8d9959abb7fdb2560859b0c855ce | sunlongbo/chromium | tools/perf/cli_tools/pinpoint_cli/commands.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | StartJobFromConfig | null | def StartJobFromConfig(config_path):
"""Start a pinpoint job based on a config file."""
src = sys.stdin if config_path == '-' else open(config_path)
with src as f:
config = json.load(f)
if not isinstance(config, dict):
raise ValueError('Invalid job config')
# An absent comparison_mode denotes a tryj... | Start a pinpoint job based on a config file. | Start a pinpoint job based on a config file. | [
"Start",
"a",
"pinpoint",
"job",
"based",
"on",
"a",
"config",
"file",
"."
] | def StartJobFromConfig(config_path):
src = sys.stdin if config_path == '-' else open(config_path)
with src as f:
config = json.load(f)
if not isinstance(config, dict):
raise ValueError('Invalid job config')
if 'comparison_mode' not in config:
config['comparison_mode'] = 'try'
if config['comparison... | [
"def",
"StartJobFromConfig",
"(",
"config_path",
")",
":",
"src",
"=",
"sys",
".",
"stdin",
"if",
"config_path",
"==",
"'-'",
"else",
"open",
"(",
"config_path",
")",
"with",
"src",
"as",
"f",
":",
"config",
"=",
"json",
".",
"load",
"(",
"f",
")",
"... | Start a pinpoint job based on a config file. | [
"Start",
"a",
"pinpoint",
"job",
"based",
"on",
"a",
"config",
"file",
"."
] | [
"\"\"\"Start a pinpoint job based on a config file.\"\"\"",
"# An absent comparison_mode denotes a tryjob configuration.",
"# As of crrev.com/c/1965875 try jobs must specify a base git hash."
] | [
{
"param": "config_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
06672573bd4e8d9959abb7fdb2560859b0c855ce | sunlongbo/chromium | tools/perf/cli_tools/pinpoint_cli/commands.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | DownloadJobResultsAsCsv | null | def DownloadJobResultsAsCsv(job_ids, only_differences, output_file):
"""Download the perf results of a job as a csv file."""
with open(output_file, 'wb') as f:
writer = csv.writer(f)
writer.writerow(('job_id', 'change', 'isolate') + histograms_df.COLUMNS)
num_rows = 0
for job_id in job_ids:
jo... | Download the perf results of a job as a csv file. | Download the perf results of a job as a csv file. | [
"Download",
"the",
"perf",
"results",
"of",
"a",
"job",
"as",
"a",
"csv",
"file",
"."
] | def DownloadJobResultsAsCsv(job_ids, only_differences, output_file):
with open(output_file, 'wb') as f:
writer = csv.writer(f)
writer.writerow(('job_id', 'change', 'isolate') + histograms_df.COLUMNS)
num_rows = 0
for job_id in job_ids:
job = pinpoint_service.Job(job_id, with_state=True)
os... | [
"def",
"DownloadJobResultsAsCsv",
"(",
"job_ids",
",",
"only_differences",
",",
"output_file",
")",
":",
"with",
"open",
"(",
"output_file",
",",
"'wb'",
")",
"as",
"f",
":",
"writer",
"=",
"csv",
".",
"writer",
"(",
"f",
")",
"writer",
".",
"writerow",
... | Download the perf results of a job as a csv file. | [
"Download",
"the",
"perf",
"results",
"of",
"a",
"job",
"as",
"a",
"csv",
"file",
"."
] | [
"\"\"\"Download the perf results of a job as a csv file.\"\"\""
] | [
{
"param": "job_ids",
"type": null
},
{
"param": "only_differences",
"type": null
},
{
"param": "output_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "job_ids",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "only_differences",
"type": null,
"docstring": null,
"docst... |
f214166e3192a6e97b5c877eb7bc4d576c23eb72 | sunlongbo/chromium | chrome/test/mini_installer/test_chrome_with_chromedriver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreateChromedriver | <not_specific> | def CreateChromedriver(args):
"""Create a webdriver object and close it after."""
def DeleteWithRetry(path, func):
# There seems to be a race condition on the bots that causes the paths
# to not delete because they are being used. This allows up to 4 seconds
# to delete
for _ in... | Create a webdriver object and close it after. | Create a webdriver object and close it after. | [
"Create",
"a",
"webdriver",
"object",
"and",
"close",
"it",
"after",
"."
] | def CreateChromedriver(args):
def DeleteWithRetry(path, func):
for _ in xrange(8):
try:
return func(path)
except WindowsError:
time.sleep(0.5)
raise
def CollectCrashReports(user_data_dir, output_dir):
report_dir = os.path.join(user_... | [
"def",
"CreateChromedriver",
"(",
"args",
")",
":",
"def",
"DeleteWithRetry",
"(",
"path",
",",
"func",
")",
":",
"for",
"_",
"in",
"xrange",
"(",
"8",
")",
":",
"try",
":",
"return",
"func",
"(",
"path",
")",
"except",
"WindowsError",
":",
"time",
"... | Create a webdriver object and close it after. | [
"Create",
"a",
"webdriver",
"object",
"and",
"close",
"it",
"after",
"."
] | [
"\"\"\"Create a webdriver object and close it after.\"\"\"",
"# There seems to be a race condition on the bots that causes the paths",
"# to not delete because they are being used. This allows up to 4 seconds",
"# to delete",
"\"\"\"Searches for Chrome crash reports, collecting them for analysis.\n\n ... | [
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f214166e3192a6e97b5c877eb7bc4d576c23eb72 | sunlongbo/chromium | chrome/test/mini_installer/test_chrome_with_chromedriver.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CollectCrashReports | <not_specific> | def CollectCrashReports(user_data_dir, output_dir):
"""Searches for Chrome crash reports, collecting them for analysis.
Args:
user_data_dir: The full path of the User Data dir.
output_dir: If not None, a path to which collected crash reports are
to be moved.
... | Searches for Chrome crash reports, collecting them for analysis.
Args:
user_data_dir: The full path of the User Data dir.
output_dir: If not None, a path to which collected crash reports are
to be moved.
Returns:
The number of crash reports found.
... | Searches for Chrome crash reports, collecting them for analysis. | [
"Searches",
"for",
"Chrome",
"crash",
"reports",
"collecting",
"them",
"for",
"analysis",
"."
] | def CollectCrashReports(user_data_dir, output_dir):
report_dir = os.path.join(user_data_dir, 'Crashpad', 'reports')
dumps = []
try:
dumps = os.listdir(report_dir)
except OSError:
return 0
for dump in dumps:
dump_path = os.path.join(report_dir, ... | [
"def",
"CollectCrashReports",
"(",
"user_data_dir",
",",
"output_dir",
")",
":",
"report_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"user_data_dir",
",",
"'Crashpad'",
",",
"'reports'",
")",
"dumps",
"=",
"[",
"]",
"try",
":",
"dumps",
"=",
"os",
".... | Searches for Chrome crash reports, collecting them for analysis. | [
"Searches",
"for",
"Chrome",
"crash",
"reports",
"collecting",
"them",
"for",
"analysis",
"."
] | [
"\"\"\"Searches for Chrome crash reports, collecting them for analysis.\n\n Args:\n user_data_dir: The full path of the User Data dir.\n output_dir: If not None, a path to which collected crash reports are\n to be moved.\n\n Returns:\n The number of cras... | [
{
"param": "user_data_dir",
"type": null
},
{
"param": "output_dir",
"type": null
}
] | {
"returns": [
{
"docstring": "The number of crash reports found.",
"docstring_tokens": [
"The",
"number",
"of",
"crash",
"reports",
"found",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "user... |
0721aeb9fe40f2808dc480296cc041384ebb44fa | sunlongbo/chromium | testing/scripts/run_rendering_benchmark_with_gated_performance.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | parse_csv_results | <not_specific> | def parse_csv_results(self, csv_obj):
""" Parses the raw CSV data
Convers the csv_obj into an array of valid values for averages and
confidence intervals based on the described upper_limits.
Args:
csv_obj: An array of rows (dict) describing the CSV results
Raturns:
A dictionary which h... | Parses the raw CSV data
Convers the csv_obj into an array of valid values for averages and
confidence intervals based on the described upper_limits.
Args:
csv_obj: An array of rows (dict) describing the CSV results
Raturns:
A dictionary which has the stories as keys and an array of confid... | Parses the raw CSV data
Convers the csv_obj into an array of valid values for averages and
confidence intervals based on the described upper_limits. | [
"Parses",
"the",
"raw",
"CSV",
"data",
"Convers",
"the",
"csv_obj",
"into",
"an",
"array",
"of",
"valid",
"values",
"for",
"averages",
"and",
"confidence",
"intervals",
"based",
"on",
"the",
"described",
"upper_limits",
"."
] | def parse_csv_results(self, csv_obj):
values_per_story = {}
for row in csv_obj:
if row['name'] != METRIC_NAME and row['name'] != 'cpu_wall_time_ratio':
continue
story_name = row['stories']
if (story_name not in self.upper_limit_data):
continue
if story_name not in values_... | [
"def",
"parse_csv_results",
"(",
"self",
",",
"csv_obj",
")",
":",
"values_per_story",
"=",
"{",
"}",
"for",
"row",
"in",
"csv_obj",
":",
"if",
"row",
"[",
"'name'",
"]",
"!=",
"METRIC_NAME",
"and",
"row",
"[",
"'name'",
"]",
"!=",
"'cpu_wall_time_ratio'",... | Parses the raw CSV data
Convers the csv_obj into an array of valid values for averages and
confidence intervals based on the described upper_limits. | [
"Parses",
"the",
"raw",
"CSV",
"data",
"Convers",
"the",
"csv_obj",
"into",
"an",
"array",
"of",
"valid",
"values",
"for",
"averages",
"and",
"confidence",
"intervals",
"based",
"on",
"the",
"described",
"upper_limits",
"."
] | [
"\"\"\" Parses the raw CSV data\n Convers the csv_obj into an array of valid values for averages and\n confidence intervals based on the described upper_limits.\n\n Args:\n csv_obj: An array of rows (dict) describing the CSV results\n\n Raturns:\n A dictionary which has the stories as keys and... | [
{
"param": "self",
"type": null
},
{
"param": "csv_obj",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "csv_obj",
"type": null,
"docstring": "An array of rows (dict) descr... |
0721aeb9fe40f2808dc480296cc041384ebb44fa | sunlongbo/chromium | testing/scripts/run_rendering_benchmark_with_gated_performance.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | compare_values | null | def compare_values(self, values_per_story, rerun=False):
""" Parses the raw CSV data
Compares the values in values_per_story with the upper_limit_data and
determines if the story passes or fails and updates the ResultRecorder.
Args:
values_per_story: An array of rows (dict) descriving the CSV res... | Parses the raw CSV data
Compares the values in values_per_story with the upper_limit_data and
determines if the story passes or fails and updates the ResultRecorder.
Args:
values_per_story: An array of rows (dict) descriving the CSV results
rerun: Is this a rerun or initial run
| Parses the raw CSV data
Compares the values in values_per_story with the upper_limit_data and
determines if the story passes or fails and updates the ResultRecorder. | [
"Parses",
"the",
"raw",
"CSV",
"data",
"Compares",
"the",
"values",
"in",
"values_per_story",
"with",
"the",
"upper_limit_data",
"and",
"determines",
"if",
"the",
"story",
"passes",
"or",
"fails",
"and",
"updates",
"the",
"ResultRecorder",
"."
] | def compare_values(self, values_per_story, rerun=False):
for story_name in values_per_story:
if (self.is_experimental_story(story_name)):
continue
if len(values_per_story[story_name]['ci_095']) == 0:
print(('[ FAILED ] {}/{} has no valid values for {}. Check ' +
'run_benchmar... | [
"def",
"compare_values",
"(",
"self",
",",
"values_per_story",
",",
"rerun",
"=",
"False",
")",
":",
"for",
"story_name",
"in",
"values_per_story",
":",
"if",
"(",
"self",
".",
"is_experimental_story",
"(",
"story_name",
")",
")",
":",
"continue",
"if",
"len... | Parses the raw CSV data
Compares the values in values_per_story with the upper_limit_data and
determines if the story passes or fails and updates the ResultRecorder. | [
"Parses",
"the",
"raw",
"CSV",
"data",
"Compares",
"the",
"values",
"in",
"values_per_story",
"with",
"the",
"upper_limit_data",
"and",
"determines",
"if",
"the",
"story",
"passes",
"or",
"fails",
"and",
"updates",
"the",
"ResultRecorder",
"."
] | [
"\"\"\" Parses the raw CSV data\n Compares the values in values_per_story with the upper_limit_data and\n determines if the story passes or fails and updates the ResultRecorder.\n\n Args:\n values_per_story: An array of rows (dict) descriving the CSV results\n rerun: Is this a rerun or initial ru... | [
{
"param": "self",
"type": null
},
{
"param": "values_per_story",
"type": null
},
{
"param": "rerun",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "values_per_story",
"type": null,
"docstring": "An array of rows (di... |
0726a8839b8228652fc4f4244686553c4e682232 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/function_like.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | num_of_required_arguments | <not_specific> | def num_of_required_arguments(self):
"""Returns the number of required arguments."""
return len(
list(
filter(lambda arg: not (arg.is_optional or arg.is_variadic),
self.arguments))) | Returns the number of required arguments. | Returns the number of required arguments. | [
"Returns",
"the",
"number",
"of",
"required",
"arguments",
"."
] | def num_of_required_arguments(self):
return len(
list(
filter(lambda arg: not (arg.is_optional or arg.is_variadic),
self.arguments))) | [
"def",
"num_of_required_arguments",
"(",
"self",
")",
":",
"return",
"len",
"(",
"list",
"(",
"filter",
"(",
"lambda",
"arg",
":",
"not",
"(",
"arg",
".",
"is_optional",
"or",
"arg",
".",
"is_variadic",
")",
",",
"self",
".",
"arguments",
")",
")",
")"... | Returns the number of required arguments. | [
"Returns",
"the",
"number",
"of",
"required",
"arguments",
"."
] | [
"\"\"\"Returns the number of required arguments.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0726a8839b8228652fc4f4244686553c4e682232 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/function_like.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | min_num_of_required_arguments | <not_specific> | def min_num_of_required_arguments(self):
"""
Returns the minimum number of required arguments of overloaded
functions.
"""
return min(map(lambda func: func.num_of_required_arguments, self)) |
Returns the minimum number of required arguments of overloaded
functions.
| Returns the minimum number of required arguments of overloaded
functions. | [
"Returns",
"the",
"minimum",
"number",
"of",
"required",
"arguments",
"of",
"overloaded",
"functions",
"."
] | def min_num_of_required_arguments(self):
return min(map(lambda func: func.num_of_required_arguments, self)) | [
"def",
"min_num_of_required_arguments",
"(",
"self",
")",
":",
"return",
"min",
"(",
"map",
"(",
"lambda",
"func",
":",
"func",
".",
"num_of_required_arguments",
",",
"self",
")",
")"
] | Returns the minimum number of required arguments of overloaded
functions. | [
"Returns",
"the",
"minimum",
"number",
"of",
"required",
"arguments",
"of",
"overloaded",
"functions",
"."
] | [
"\"\"\"\n Returns the minimum number of required arguments of overloaded\n functions.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0726a8839b8228652fc4f4244686553c4e682232 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/function_like.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | effective_overload_set | <not_specific> | def effective_overload_set(self, argument_count=None):
"""
Returns the effective overload set.
https://webidl.spec.whatwg.org/#compute-the-effective-overload-set
"""
assert argument_count is None or isinstance(argument_count, int)
N = argument_count
S = []
... |
Returns the effective overload set.
https://webidl.spec.whatwg.org/#compute-the-effective-overload-set
| Returns the effective overload set. | [
"Returns",
"the",
"effective",
"overload",
"set",
"."
] | def effective_overload_set(self, argument_count=None):
assert argument_count is None or isinstance(argument_count, int)
N = argument_count
S = []
F = self
maxarg = max(map(lambda X: len(X.arguments), F))
if N is None:
arg_sizes = [len(X.arguments) for X in F i... | [
"def",
"effective_overload_set",
"(",
"self",
",",
"argument_count",
"=",
"None",
")",
":",
"assert",
"argument_count",
"is",
"None",
"or",
"isinstance",
"(",
"argument_count",
",",
"int",
")",
"N",
"=",
"argument_count",
"S",
"=",
"[",
"]",
"F",
"=",
"sel... | Returns the effective overload set. | [
"Returns",
"the",
"effective",
"overload",
"set",
"."
] | [
"\"\"\"\n Returns the effective overload set.\n https://webidl.spec.whatwg.org/#compute-the-effective-overload-set\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "argument_count",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argument_count",
"type": null,
"docstring": null,
"docstring_... |
0726a8839b8228652fc4f4244686553c4e682232 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/function_like.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | distinguishing_argument_index | <not_specific> | def distinguishing_argument_index(items_of_effective_overload_set):
"""
Returns the distinguishing argument index.
https://webidl.spec.whatwg.org/#dfn-distinguishing-argument-index
"""
items = items_of_effective_overload_set
assert isinstance(items, (list, tuple))
... |
Returns the distinguishing argument index.
https://webidl.spec.whatwg.org/#dfn-distinguishing-argument-index
| Returns the distinguishing argument index. | [
"Returns",
"the",
"distinguishing",
"argument",
"index",
"."
] | def distinguishing_argument_index(items_of_effective_overload_set):
items = items_of_effective_overload_set
assert isinstance(items, (list, tuple))
assert all(
isinstance(item, OverloadGroup.EffectiveOverloadItem)
for item in items)
assert len(items) > 1
f... | [
"def",
"distinguishing_argument_index",
"(",
"items_of_effective_overload_set",
")",
":",
"items",
"=",
"items_of_effective_overload_set",
"assert",
"isinstance",
"(",
"items",
",",
"(",
"list",
",",
"tuple",
")",
")",
"assert",
"all",
"(",
"isinstance",
"(",
"item"... | Returns the distinguishing argument index. | [
"Returns",
"the",
"distinguishing",
"argument",
"index",
"."
] | [
"\"\"\"\n Returns the distinguishing argument index.\n https://webidl.spec.whatwg.org/#dfn-distinguishing-argument-index\n \"\"\"",
"# Assume that the given items are valid, and we only need to test",
"# the two types."
] | [
{
"param": "items_of_effective_overload_set",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "items_of_effective_overload_set",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0726a8839b8228652fc4f4244686553c4e682232 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/function_like.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | are_distinguishable_types | <not_specific> | def are_distinguishable_types(idl_type1, idl_type2):
"""
Returns True if the two given types are distinguishable.
https://webidl.spec.whatwg.org/#dfn-distinguishable
"""
assert isinstance(idl_type1, IdlType)
assert isinstance(idl_type2, IdlType)
# step 1. If one ... |
Returns True if the two given types are distinguishable.
https://webidl.spec.whatwg.org/#dfn-distinguishable
| Returns True if the two given types are distinguishable. | [
"Returns",
"True",
"if",
"the",
"two",
"given",
"types",
"are",
"distinguishable",
"."
] | def are_distinguishable_types(idl_type1, idl_type2):
assert isinstance(idl_type1, IdlType)
assert isinstance(idl_type2, IdlType)
if ((idl_type1.does_include_nullable_type
and idl_type2.does_include_nullable_or_dict)
or (idl_type2.does_include_nullable_type
... | [
"def",
"are_distinguishable_types",
"(",
"idl_type1",
",",
"idl_type2",
")",
":",
"assert",
"isinstance",
"(",
"idl_type1",
",",
"IdlType",
")",
"assert",
"isinstance",
"(",
"idl_type2",
",",
"IdlType",
")",
"if",
"(",
"(",
"idl_type1",
".",
"does_include_nullab... | Returns True if the two given types are distinguishable. | [
"Returns",
"True",
"if",
"the",
"two",
"given",
"types",
"are",
"distinguishable",
"."
] | [
"\"\"\"\n Returns True if the two given types are distinguishable.\n https://webidl.spec.whatwg.org/#dfn-distinguishable\n \"\"\"",
"# step 1. If one type includes a nullable type and the other type either",
"# includes a nullable type, is a union type with flattened member",
"# types... | [
{
"param": "idl_type1",
"type": null
},
{
"param": "idl_type2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "idl_type1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "idl_type2",
"type": null,
"docstring": null,
"docstring_... |
65a683dd8bb3c618a4c8e79f256ff6c5da4c93f0 | sunlongbo/chromium | content/test/gpu/gpu_tests/skia_gold_integration_test_base.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GenerateBrowserArgs | <not_specific> | def GenerateBrowserArgs(cls, additional_args):
"""Adds default arguments to |additional_args|.
See the parent class' method documentation for additional information.
"""
default_args = super(SkiaGoldIntegrationTestBase,
cls).GenerateBrowserArgs(additional_args)
default_args... | Adds default arguments to |additional_args|.
See the parent class' method documentation for additional information.
| Adds default arguments to |additional_args|.
See the parent class' method documentation for additional information. | [
"Adds",
"default",
"arguments",
"to",
"|additional_args|",
".",
"See",
"the",
"parent",
"class",
"'",
"method",
"documentation",
"for",
"additional",
"information",
"."
] | def GenerateBrowserArgs(cls, additional_args):
default_args = super(SkiaGoldIntegrationTestBase,
cls).GenerateBrowserArgs(additional_args)
default_args.extend([cba.ENABLE_GPU_BENCHMARKING, cba.TEST_TYPE_GPU])
force_color_profile_arg = [
arg for arg in default_args if arg.sta... | [
"def",
"GenerateBrowserArgs",
"(",
"cls",
",",
"additional_args",
")",
":",
"default_args",
"=",
"super",
"(",
"SkiaGoldIntegrationTestBase",
",",
"cls",
")",
".",
"GenerateBrowserArgs",
"(",
"additional_args",
")",
"default_args",
".",
"extend",
"(",
"[",
"cba",
... | Adds default arguments to |additional_args|. | [
"Adds",
"default",
"arguments",
"to",
"|additional_args|",
"."
] | [
"\"\"\"Adds default arguments to |additional_args|.\n\n See the parent class' method documentation for additional information.\n \"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "additional_args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "additional_args",
"type": null,
"docstring": null,
"docstring_... |
65a683dd8bb3c618a4c8e79f256ff6c5da4c93f0 | sunlongbo/chromium | content/test/gpu/gpu_tests/skia_gold_integration_test_base.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetGoldJsonKeys | <not_specific> | def GetGoldJsonKeys(self, page):
"""Get all the JSON metadata that will be passed to golctl."""
img_params = self.GetImageParameters(page)
# The frequently changing last part of the ANGLE driver version (revision of
# some sort?) messes a bit with inexact matching since each revision will
# be treat... | Get all the JSON metadata that will be passed to golctl. | Get all the JSON metadata that will be passed to golctl. | [
"Get",
"all",
"the",
"JSON",
"metadata",
"that",
"will",
"be",
"passed",
"to",
"golctl",
"."
] | def GetGoldJsonKeys(self, page):
img_params = self.GetImageParameters(page)
_StripAngleRevisionFromDriver(img_params)
gpu_keys = {
'vendor_id':
_ToHexOrNone(img_params.vendor_id),
'device_id':
_ToHexOrNone(img_params.device_id),
'vendor_string':
_ToNonEmptyStr... | [
"def",
"GetGoldJsonKeys",
"(",
"self",
",",
"page",
")",
":",
"img_params",
"=",
"self",
".",
"GetImageParameters",
"(",
"page",
")",
"_StripAngleRevisionFromDriver",
"(",
"img_params",
")",
"gpu_keys",
"=",
"{",
"'vendor_id'",
":",
"_ToHexOrNone",
"(",
"img_par... | Get all the JSON metadata that will be passed to golctl. | [
"Get",
"all",
"the",
"JSON",
"metadata",
"that",
"will",
"be",
"passed",
"to",
"golctl",
"."
] | [
"\"\"\"Get all the JSON metadata that will be passed to golctl.\"\"\"",
"# The frequently changing last part of the ANGLE driver version (revision of",
"# some sort?) messes a bit with inexact matching since each revision will",
"# be treated as a separate trace, so strip it off.",
"# All values need to be ... | [
{
"param": "self",
"type": null
},
{
"param": "page",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "page",
"type": null,
"docstring": null,
"docstring_tokens": [... |
65a683dd8bb3c618a4c8e79f256ff6c5da4c93f0 | sunlongbo/chromium | content/test/gpu/gpu_tests/skia_gold_integration_test_base.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _UploadTestResultToSkiaGold | <not_specific> | def _UploadTestResultToSkiaGold(self, image_name, screenshot, page):
"""Compares the given image using Skia Gold and uploads the result.
No uploading is done if the test is being run in local run mode. Compares
the given screenshot to baselines provided by Gold, raising an Exception if
a match is not f... | Compares the given image using Skia Gold and uploads the result.
No uploading is done if the test is being run in local run mode. Compares
the given screenshot to baselines provided by Gold, raising an Exception if
a match is not found.
Args:
image_name: the name of the image being checked.
... | Compares the given image using Skia Gold and uploads the result.
No uploading is done if the test is being run in local run mode. Compares
the given screenshot to baselines provided by Gold, raising an Exception if
a match is not found. | [
"Compares",
"the",
"given",
"image",
"using",
"Skia",
"Gold",
"and",
"uploads",
"the",
"result",
".",
"No",
"uploading",
"is",
"done",
"if",
"the",
"test",
"is",
"being",
"run",
"in",
"local",
"run",
"mode",
".",
"Compares",
"the",
"given",
"screenshot",
... | def _UploadTestResultToSkiaGold(self, image_name, screenshot, page):
png_temp_file = tempfile.NamedTemporaryFile(
suffix='.png', dir=self._skia_gold_temp_dir).name
image_util.WritePngFile(screenshot, png_temp_file)
gpu_keys = self.GetGoldJsonKeys(page)
gold_session = self.GetSkiaGoldSessionManag... | [
"def",
"_UploadTestResultToSkiaGold",
"(",
"self",
",",
"image_name",
",",
"screenshot",
",",
"page",
")",
":",
"png_temp_file",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"suffix",
"=",
"'.png'",
",",
"dir",
"=",
"self",
".",
"_skia_gold_temp_dir",
")",
... | Compares the given image using Skia Gold and uploads the result. | [
"Compares",
"the",
"given",
"image",
"using",
"Skia",
"Gold",
"and",
"uploads",
"the",
"result",
"."
] | [
"\"\"\"Compares the given image using Skia Gold and uploads the result.\n\n No uploading is done if the test is being run in local run mode. Compares\n the given screenshot to baselines provided by Gold, raising an Exception if\n a match is not found.\n\n Args:\n image_name: the name of the image b... | [
{
"param": "self",
"type": null
},
{
"param": "image_name",
"type": null
},
{
"param": "screenshot",
"type": null
},
{
"param": "page",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "image_name",
"type": null,
"docstring": "the name of the image bein... |
65a683dd8bb3c618a4c8e79f256ff6c5da4c93f0 | sunlongbo/chromium | content/test/gpu/gpu_tests/skia_gold_integration_test_base.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ShouldReportGoldFailure | <not_specific> | def _ShouldReportGoldFailure(self, page):
"""Determines if a Gold failure should actually be surfaced.
Args:
page: The GPU PixelTestPage object for the test.
Returns:
True if the failure should be surfaced, i.e. the test should fail,
otherwise False.
"""
parsed_options = self.Get... | Determines if a Gold failure should actually be surfaced.
Args:
page: The GPU PixelTestPage object for the test.
Returns:
True if the failure should be surfaced, i.e. the test should fail,
otherwise False.
| Determines if a Gold failure should actually be surfaced. | [
"Determines",
"if",
"a",
"Gold",
"failure",
"should",
"actually",
"be",
"surfaced",
"."
] | def _ShouldReportGoldFailure(self, page):
parsed_options = self.GetParsedCommandLineOptions()
if parsed_options.no_skia_gold_failure:
return False
if _GracePeriodActive(page):
return False
return True | [
"def",
"_ShouldReportGoldFailure",
"(",
"self",
",",
"page",
")",
":",
"parsed_options",
"=",
"self",
".",
"GetParsedCommandLineOptions",
"(",
")",
"if",
"parsed_options",
".",
"no_skia_gold_failure",
":",
"return",
"False",
"if",
"_GracePeriodActive",
"(",
"page",
... | Determines if a Gold failure should actually be surfaced. | [
"Determines",
"if",
"a",
"Gold",
"failure",
"should",
"actually",
"be",
"surfaced",
"."
] | [
"\"\"\"Determines if a Gold failure should actually be surfaced.\n\n Args:\n page: The GPU PixelTestPage object for the test.\n\n Returns:\n True if the failure should be surfaced, i.e. the test should fail,\n otherwise False.\n \"\"\"",
"# Don't surface if we're explicitly told not to.",
... | [
{
"param": "self",
"type": null
},
{
"param": "page",
"type": null
}
] | {
"returns": [
{
"docstring": "True if the failure should be surfaced, i.e. the test should fail,\notherwise False.",
"docstring_tokens": [
"True",
"if",
"the",
"failure",
"should",
"be",
"surfaced",
"i",
".",
"e",
... |
65a683dd8bb3c618a4c8e79f256ff6c5da4c93f0 | sunlongbo/chromium | content/test/gpu/gpu_tests/skia_gold_integration_test_base.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GracePeriodActive | <not_specific> | def _GracePeriodActive(page):
"""Returns whether a grace period is currently active for a test.
Args:
page: The GPU PixelTestPage object for the test in question.
Returns:
True if a grace period is defined for |page| and has not yet expired.
Otherwise, False.
"""
return page.grace_period_end and... | Returns whether a grace period is currently active for a test.
Args:
page: The GPU PixelTestPage object for the test in question.
Returns:
True if a grace period is defined for |page| and has not yet expired.
Otherwise, False.
| Returns whether a grace period is currently active for a test. | [
"Returns",
"whether",
"a",
"grace",
"period",
"is",
"currently",
"active",
"for",
"a",
"test",
"."
] | def _GracePeriodActive(page):
return page.grace_period_end and date.today() <= page.grace_period_end | [
"def",
"_GracePeriodActive",
"(",
"page",
")",
":",
"return",
"page",
".",
"grace_period_end",
"and",
"date",
".",
"today",
"(",
")",
"<=",
"page",
".",
"grace_period_end"
] | Returns whether a grace period is currently active for a test. | [
"Returns",
"whether",
"a",
"grace",
"period",
"is",
"currently",
"active",
"for",
"a",
"test",
"."
] | [
"\"\"\"Returns whether a grace period is currently active for a test.\n\n Args:\n page: The GPU PixelTestPage object for the test in question.\n\n Returns:\n True if a grace period is defined for |page| and has not yet expired.\n Otherwise, False.\n \"\"\""
] | [
{
"param": "page",
"type": null
}
] | {
"returns": [
{
"docstring": "True if a grace period is defined for |page| and has not yet expired.\nOtherwise, False.",
"docstring_tokens": [
"True",
"if",
"a",
"grace",
"period",
"is",
"defined",
"for",
"|page|",
"and",... |
65a683dd8bb3c618a4c8e79f256ff6c5da4c93f0 | sunlongbo/chromium | content/test/gpu/gpu_tests/skia_gold_integration_test_base.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _StripAngleRevisionFromDriver | <not_specific> | def _StripAngleRevisionFromDriver(img_params):
"""Strips the revision off the end of an ANGLE driver version.
E.g. 2.1.0.b50541b2d6c4 -> 2.1.0
Modifies the string in place. No-ops if the driver vendor is not ANGLE.
Args:
img_params: An _ImageParameters instance to modify.
"""
if 'ANGLE' not in img_pa... | Strips the revision off the end of an ANGLE driver version.
E.g. 2.1.0.b50541b2d6c4 -> 2.1.0
Modifies the string in place. No-ops if the driver vendor is not ANGLE.
Args:
img_params: An _ImageParameters instance to modify.
| Strips the revision off the end of an ANGLE driver version.
Modifies the string in place. No-ops if the driver vendor is not ANGLE. | [
"Strips",
"the",
"revision",
"off",
"the",
"end",
"of",
"an",
"ANGLE",
"driver",
"version",
".",
"Modifies",
"the",
"string",
"in",
"place",
".",
"No",
"-",
"ops",
"if",
"the",
"driver",
"vendor",
"is",
"not",
"ANGLE",
"."
] | def _StripAngleRevisionFromDriver(img_params):
if 'ANGLE' not in img_params.driver_vendor or not img_params.driver_version:
return
driver_parts = img_params.driver_version.split('.')
kept_parts = []
for part in driver_parts:
if len(part) > 8:
break
kept_parts.append(part)
img_params.driver_v... | [
"def",
"_StripAngleRevisionFromDriver",
"(",
"img_params",
")",
":",
"if",
"'ANGLE'",
"not",
"in",
"img_params",
".",
"driver_vendor",
"or",
"not",
"img_params",
".",
"driver_version",
":",
"return",
"driver_parts",
"=",
"img_params",
".",
"driver_version",
".",
"... | Strips the revision off the end of an ANGLE driver version. | [
"Strips",
"the",
"revision",
"off",
"the",
"end",
"of",
"an",
"ANGLE",
"driver",
"version",
"."
] | [
"\"\"\"Strips the revision off the end of an ANGLE driver version.\n\n E.g. 2.1.0.b50541b2d6c4 -> 2.1.0\n\n Modifies the string in place. No-ops if the driver vendor is not ANGLE.\n\n Args:\n img_params: An _ImageParameters instance to modify.\n \"\"\"",
"# Assume that we're never going to have portions of... | [
{
"param": "img_params",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "img_params",
"type": null,
"docstring": "An _ImageParameters instance to modify.",
"docstring_tokens": [
"An",
"_ImageParameters",
"instance",
"to",
"modify",
"."
],
... |
65a683dd8bb3c618a4c8e79f256ff6c5da4c93f0 | sunlongbo/chromium | content/test/gpu/gpu_tests/skia_gold_integration_test_base.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetCombinedHardwareIdentifier | <not_specific> | def _GetCombinedHardwareIdentifier(img_params):
"""Combine all relevant hardware identifiers into a single key.
This makes Gold forwarding more precise by allowing us to forward explicit
configurations instead of individual components.
"""
vendor_id = _ToHexOrNone(img_params.vendor_id)
device_id = _ToHexOr... | Combine all relevant hardware identifiers into a single key.
This makes Gold forwarding more precise by allowing us to forward explicit
configurations instead of individual components.
| Combine all relevant hardware identifiers into a single key.
This makes Gold forwarding more precise by allowing us to forward explicit
configurations instead of individual components. | [
"Combine",
"all",
"relevant",
"hardware",
"identifiers",
"into",
"a",
"single",
"key",
".",
"This",
"makes",
"Gold",
"forwarding",
"more",
"precise",
"by",
"allowing",
"us",
"to",
"forward",
"explicit",
"configurations",
"instead",
"of",
"individual",
"components"... | def _GetCombinedHardwareIdentifier(img_params):
vendor_id = _ToHexOrNone(img_params.vendor_id)
device_id = _ToHexOrNone(img_params.device_id)
device_string = _ToNonEmptyStrOrNone(img_params.device_string)
combined_hw_identifiers = ('vendor_id:{vendor_id}, '
'device_id:{device_id}, '... | [
"def",
"_GetCombinedHardwareIdentifier",
"(",
"img_params",
")",
":",
"vendor_id",
"=",
"_ToHexOrNone",
"(",
"img_params",
".",
"vendor_id",
")",
"device_id",
"=",
"_ToHexOrNone",
"(",
"img_params",
".",
"device_id",
")",
"device_string",
"=",
"_ToNonEmptyStrOrNone",
... | Combine all relevant hardware identifiers into a single key. | [
"Combine",
"all",
"relevant",
"hardware",
"identifiers",
"into",
"a",
"single",
"key",
"."
] | [
"\"\"\"Combine all relevant hardware identifiers into a single key.\n\n This makes Gold forwarding more precise by allowing us to forward explicit\n configurations instead of individual components.\n \"\"\""
] | [
{
"param": "img_params",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "img_params",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
65a683dd8bb3c618a4c8e79f256ff6c5da4c93f0 | sunlongbo/chromium | content/test/gpu/gpu_tests/skia_gold_integration_test_base.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _OutputLocalDiffFiles | null | def _OutputLocalDiffFiles(gold_session, image_name):
"""Logs the local diff image files from the given SkiaGoldSession.
Args:
gold_session: A skia_gold_session.SkiaGoldSession instance to pull files
from.
image_name: A string containing the name of the image/test that was
compared.
"""
... | Logs the local diff image files from the given SkiaGoldSession.
Args:
gold_session: A skia_gold_session.SkiaGoldSession instance to pull files
from.
image_name: A string containing the name of the image/test that was
compared.
| Logs the local diff image files from the given SkiaGoldSession. | [
"Logs",
"the",
"local",
"diff",
"image",
"files",
"from",
"the",
"given",
"SkiaGoldSession",
"."
] | def _OutputLocalDiffFiles(gold_session, image_name):
given_file = gold_session.GetGivenImageLink(image_name)
closest_file = gold_session.GetClosestImageLink(image_name)
diff_file = gold_session.GetDiffImageLink(image_name)
failure_message = 'Unable to retrieve link'
logging.error('Generated image: %s', given_... | [
"def",
"_OutputLocalDiffFiles",
"(",
"gold_session",
",",
"image_name",
")",
":",
"given_file",
"=",
"gold_session",
".",
"GetGivenImageLink",
"(",
"image_name",
")",
"closest_file",
"=",
"gold_session",
".",
"GetClosestImageLink",
"(",
"image_name",
")",
"diff_file",... | Logs the local diff image files from the given SkiaGoldSession. | [
"Logs",
"the",
"local",
"diff",
"image",
"files",
"from",
"the",
"given",
"SkiaGoldSession",
"."
] | [
"\"\"\"Logs the local diff image files from the given SkiaGoldSession.\n\n Args:\n gold_session: A skia_gold_session.SkiaGoldSession instance to pull files\n from.\n image_name: A string containing the name of the image/test that was\n compared.\n \"\"\""
] | [
{
"param": "gold_session",
"type": null
},
{
"param": "image_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gold_session",
"type": null,
"docstring": "A skia_gold_session.SkiaGoldSession instance to pull files\nfrom.",
"docstring_tokens": [
"A",
"skia_gold_session",
".",
"SkiaGoldSession",
"in... |
80ac53c869d5c189a937f18d997f29e7e8766848 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/main.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | change_directory | <not_specific> | def change_directory(filesystem, checkout_root, paths):
"""Change the working directory to the checkout root, if possible.
If every path in the paths parameter is below the checkout root (or if
the paths parameter is empty or None), this method changes the current
working directory to the checkout root... | Change the working directory to the checkout root, if possible.
If every path in the paths parameter is below the checkout root (or if
the paths parameter is empty or None), this method changes the current
working directory to the checkout root and converts the paths parameter
as described below.
... | Change the working directory to the checkout root, if possible.
If every path in the paths parameter is below the checkout root (or if
the paths parameter is empty or None), this method changes the current
working directory to the checkout root and converts the paths parameter
as described below.
This allows the paths... | [
"Change",
"the",
"working",
"directory",
"to",
"the",
"checkout",
"root",
"if",
"possible",
".",
"If",
"every",
"path",
"in",
"the",
"paths",
"parameter",
"is",
"below",
"the",
"checkout",
"root",
"(",
"or",
"if",
"the",
"paths",
"parameter",
"is",
"empty"... | def change_directory(filesystem, checkout_root, paths):
if paths is not None:
paths = list(paths)
if paths:
rel_paths = []
for path in paths:
rel_path = filesystem.relpath(path, checkout_root)
if rel_path.startswith(filesystem.pardir):
_log.warning... | [
"def",
"change_directory",
"(",
"filesystem",
",",
"checkout_root",
",",
"paths",
")",
":",
"if",
"paths",
"is",
"not",
"None",
":",
"paths",
"=",
"list",
"(",
"paths",
")",
"if",
"paths",
":",
"rel_paths",
"=",
"[",
"]",
"for",
"path",
"in",
"paths",
... | Change the working directory to the checkout root, if possible. | [
"Change",
"the",
"working",
"directory",
"to",
"the",
"checkout",
"root",
"if",
"possible",
"."
] | [
"\"\"\"Change the working directory to the checkout root, if possible.\n\n If every path in the paths parameter is below the checkout root (or if\n the paths parameter is empty or None), this method changes the current\n working directory to the checkout root and converts the paths parameter\n as descri... | [
{
"param": "filesystem",
"type": null
},
{
"param": "checkout_root",
"type": null
},
{
"param": "paths",
"type": null
}
] | {
"returns": [
{
"docstring": "A copy of the paths parameter -- possibly converted, as follows.\nIf this method changed the current working directory to the\ncheckout root, then the list is the paths parameter converted to\nnormalized paths relative to the checkout root.",
"docstring_tokens": [
... |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testSourceWithCrLfs | null | def testSourceWithCrLfs(self):
"""Tests a .mojom source with CR-LFs instead of LFs."""
source = "// This is a comment.\r\n\r\nmodule my_module;\r\n"
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [])
self.assertEquals(parser.Parse(source, "my_file.mojom")... | Tests a .mojom source with CR-LFs instead of LFs. | Tests a .mojom source with CR-LFs instead of LFs. | [
"Tests",
"a",
".",
"mojom",
"source",
"with",
"CR",
"-",
"LFs",
"instead",
"of",
"LFs",
"."
] | def testSourceWithCrLfs(self):
source = "// This is a comment.\r\n\r\nmodule my_module;\r\n"
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [])
self.assertEquals(parser.Parse(source, "my_file.mojom"), expected) | [
"def",
"testSourceWithCrLfs",
"(",
"self",
")",
":",
"source",
"=",
"\"// This is a comment.\\r\\n\\r\\nmodule my_module;\\r\\n\"",
"expected",
"=",
"ast",
".",
"Mojom",
"(",
"ast",
".",
"Module",
"(",
"(",
"'IDENTIFIER'",
",",
"'my_module'",
")",
",",
"None",
")"... | Tests a .mojom source with CR-LFs instead of LFs. | [
"Tests",
"a",
".",
"mojom",
"source",
"with",
"CR",
"-",
"LFs",
"instead",
"of",
"LFs",
"."
] | [
"\"\"\"Tests a .mojom source with CR-LFs instead of LFs.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testCommentLineNumbers | null | def testCommentLineNumbers(self):
"""Tests that line numbers are correctly tracked when comments are
present."""
source1 = """\
// Isolated C++-style comments.
// Foo.
asdf1
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^my_file\.mojom:4: Error:... | Tests that line numbers are correctly tracked when comments are
present. | Tests that line numbers are correctly tracked when comments are
present. | [
"Tests",
"that",
"line",
"numbers",
"are",
"correctly",
"tracked",
"when",
"comments",
"are",
"present",
"."
] | def testCommentLineNumbers(self):
source1 = """\
// Isolated C++-style comments.
// Foo.
asdf1
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^my_file\.mojom:4: Error: Unexpected 'asdf1':\n *asdf1$"):
parser.Parse(source1, "my_file.mojom")
source... | [
"def",
"testCommentLineNumbers",
"(",
"self",
")",
":",
"source1",
"=",
"\"\"\"\\\n // Isolated C++-style comments.\n\n // Foo.\n asdf1\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
".",
"ParseError",
",",
"r\"^my_file\\.mojom:4:... | Tests that line numbers are correctly tracked when comments are
present. | [
"Tests",
"that",
"line",
"numbers",
"are",
"correctly",
"tracked",
"when",
"comments",
"are",
"present",
"."
] | [
"\"\"\"Tests that line numbers are correctly tracked when comments are\n present.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testSimpleStruct | null | def testSimpleStruct(self):
"""Tests a simple .mojom source that just defines a struct."""
source = """\
module my_module;
struct MyStruct {
int32 a;
double b;
};
"""
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my_module'), None), ast.Import... | Tests a simple .mojom source that just defines a struct. | Tests a simple .mojom source that just defines a struct. | [
"Tests",
"a",
"simple",
".",
"mojom",
"source",
"that",
"just",
"defines",
"a",
"struct",
"."
] | def testSimpleStruct(self):
source = """\
module my_module;
struct MyStruct {
int32 a;
double b;
};
"""
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [
ast.Struct(
'MyStruct', None,
... | [
"def",
"testSimpleStruct",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n module my_module;\n\n struct MyStruct {\n int32 a;\n double b;\n };\n \"\"\"",
"expected",
"=",
"ast",
".",
"Mojom",
"(",
"ast",
".",
"Module",
"(",
"(",
... | Tests a simple .mojom source that just defines a struct. | [
"Tests",
"a",
"simple",
".",
"mojom",
"source",
"that",
"just",
"defines",
"a",
"struct",
"."
] | [
"\"\"\"Tests a simple .mojom source that just defines a struct.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testSimpleStructWithoutModule | null | def testSimpleStructWithoutModule(self):
"""Tests a simple struct without an explict module statement."""
source = """\
struct MyStruct {
int32 a;
double b;
};
"""
expected = ast.Mojom(None, ast.ImportList(), [
ast.Struct(
'MyStruct', None,
... | Tests a simple struct without an explict module statement. | Tests a simple struct without an explict module statement. | [
"Tests",
"a",
"simple",
"struct",
"without",
"an",
"explict",
"module",
"statement",
"."
] | def testSimpleStructWithoutModule(self):
source = """\
struct MyStruct {
int32 a;
double b;
};
"""
expected = ast.Mojom(None, ast.ImportList(), [
ast.Struct(
'MyStruct', None,
ast.StructBody([
ast.StructField('a', None, ... | [
"def",
"testSimpleStructWithoutModule",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n struct MyStruct {\n int32 a;\n double b;\n };\n \"\"\"",
"expected",
"=",
"ast",
".",
"Mojom",
"(",
"None",
",",
"ast",
".",
"ImportList",
"(",
"... | Tests a simple struct without an explict module statement. | [
"Tests",
"a",
"simple",
"struct",
"without",
"an",
"explict",
"module",
"statement",
"."
] | [
"\"\"\"Tests a simple struct without an explict module statement.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testValidStructDefinitions | null | def testValidStructDefinitions(self):
"""Tests all types of definitions that can occur in a struct."""
source = """\
struct MyStruct {
enum MyEnum { VALUE };
const double kMyConst = 1.23;
int32 a;
SomeOtherStruct b; // Invalidity detected at another stage.
... | Tests all types of definitions that can occur in a struct. | Tests all types of definitions that can occur in a struct. | [
"Tests",
"all",
"types",
"of",
"definitions",
"that",
"can",
"occur",
"in",
"a",
"struct",
"."
] | def testValidStructDefinitions(self):
source = """\
struct MyStruct {
enum MyEnum { VALUE };
const double kMyConst = 1.23;
int32 a;
SomeOtherStruct b; // Invalidity detected at another stage.
};
"""
expected = ast.Mojom(None, ast.ImportList(), [
... | [
"def",
"testValidStructDefinitions",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n struct MyStruct {\n enum MyEnum { VALUE };\n const double kMyConst = 1.23;\n int32 a;\n SomeOtherStruct b; // Invalidity detected at another stage.\n };\n ... | Tests all types of definitions that can occur in a struct. | [
"Tests",
"all",
"types",
"of",
"definitions",
"that",
"can",
"occur",
"in",
"a",
"struct",
"."
] | [
"\"\"\"Tests all types of definitions that can occur in a struct.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testInvalidStructDefinitions | null | def testInvalidStructDefinitions(self):
"""Tests that definitions that aren't allowed in a struct are correctly
detected."""
source1 = """\
struct MyStruct {
MyMethod(int32 a);
};
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:2: Error: ... | Tests that definitions that aren't allowed in a struct are correctly
detected. | Tests that definitions that aren't allowed in a struct are correctly
detected. | [
"Tests",
"that",
"definitions",
"that",
"aren",
"'",
"t",
"allowed",
"in",
"a",
"struct",
"are",
"correctly",
"detected",
"."
] | def testInvalidStructDefinitions(self):
source1 = """\
struct MyStruct {
MyMethod(int32 a);
};
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected '\(':\n"
r" *MyMethod\(int32 a\);$"):
parser.Parse(source1, "my_file.... | [
"def",
"testInvalidStructDefinitions",
"(",
"self",
")",
":",
"source1",
"=",
"\"\"\"\\\n struct MyStruct {\n MyMethod(int32 a);\n };\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
".",
"ParseError",
",",
"r\"^my_file\\.mojom:2:... | Tests that definitions that aren't allowed in a struct are correctly
detected. | [
"Tests",
"that",
"definitions",
"that",
"aren",
"'",
"t",
"allowed",
"in",
"a",
"struct",
"are",
"correctly",
"detected",
"."
] | [
"\"\"\"Tests that definitions that aren't allowed in a struct are correctly\n detected.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testMissingModuleName | null | def testMissingModuleName(self):
"""Tests an (invalid) .mojom with a missing module name."""
source1 = """\
// Missing module name.
module ;
struct MyStruct {
int32 a;
};
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^my_file\.mojom... | Tests an (invalid) .mojom with a missing module name. | Tests an (invalid) .mojom with a missing module name. | [
"Tests",
"an",
"(",
"invalid",
")",
".",
"mojom",
"with",
"a",
"missing",
"module",
"name",
"."
] | def testMissingModuleName(self):
source1 = """\
// Missing module name.
module ;
struct MyStruct {
int32 a;
};
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^my_file\.mojom:2: Error: Unexpected ';':\n *module ;$"):
parser.Parse(sou... | [
"def",
"testMissingModuleName",
"(",
"self",
")",
":",
"source1",
"=",
"\"\"\"\\\n // Missing module name.\n module ;\n struct MyStruct {\n int32 a;\n };\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
".",
"ParseError"... | Tests an (invalid) .mojom with a missing module name. | [
"Tests",
"an",
"(",
"invalid",
")",
".",
"mojom",
"with",
"a",
"missing",
"module",
"name",
"."
] | [
"\"\"\"Tests an (invalid) .mojom with a missing module name.\"\"\"",
"# Another similar case, but make sure that line-number tracking/reporting",
"# is correct."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testMultipleModuleStatements | null | def testMultipleModuleStatements(self):
"""Tests an (invalid) .mojom with multiple module statements."""
source = """\
module foo;
module bar;
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^my_file\.mojom:2: Error: Multiple \"module\" statements not "
... | Tests an (invalid) .mojom with multiple module statements. | Tests an (invalid) .mojom with multiple module statements. | [
"Tests",
"an",
"(",
"invalid",
")",
".",
"mojom",
"with",
"multiple",
"module",
"statements",
"."
] | def testMultipleModuleStatements(self):
source = """\
module foo;
module bar;
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^my_file\.mojom:2: Error: Multiple \"module\" statements not "
r"allowed:\n *module bar;$"):
parser.Parse(source, "my_file.mo... | [
"def",
"testMultipleModuleStatements",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n module foo;\n module bar;\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
".",
"ParseError",
",",
"r\"^my_file\\.mojom:2: Error: Multiple \\\"module\... | Tests an (invalid) .mojom with multiple module statements. | [
"Tests",
"an",
"(",
"invalid",
")",
".",
"mojom",
"with",
"multiple",
"module",
"statements",
"."
] | [
"\"\"\"Tests an (invalid) .mojom with multiple module statements.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testModuleStatementAfterImport | null | def testModuleStatementAfterImport(self):
"""Tests an (invalid) .mojom with a module statement after an import."""
source = """\
import "foo.mojom";
module foo;
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^my_file\.mojom:2: Error: \"module\" statements mus... | Tests an (invalid) .mojom with a module statement after an import. | Tests an (invalid) .mojom with a module statement after an import. | [
"Tests",
"an",
"(",
"invalid",
")",
".",
"mojom",
"with",
"a",
"module",
"statement",
"after",
"an",
"import",
"."
] | def testModuleStatementAfterImport(self):
source = """\
import "foo.mojom";
module foo;
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^my_file\.mojom:2: Error: \"module\" statements must precede imports "
r"and definitions:\n *module foo;$"):
parser... | [
"def",
"testModuleStatementAfterImport",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n import \"foo.mojom\";\n module foo;\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
".",
"ParseError",
",",
"r\"^my_file\\.mojom:2: Error: \\\"modu... | Tests an (invalid) .mojom with a module statement after an import. | [
"Tests",
"an",
"(",
"invalid",
")",
".",
"mojom",
"with",
"a",
"module",
"statement",
"after",
"an",
"import",
"."
] | [
"\"\"\"Tests an (invalid) .mojom with a module statement after an import.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testModuleStatementAfterDefinition | null | def testModuleStatementAfterDefinition(self):
"""Tests an (invalid) .mojom with a module statement after a definition."""
source = """\
struct MyStruct {
int32 a;
};
module foo;
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^my_file\.mojom:... | Tests an (invalid) .mojom with a module statement after a definition. | Tests an (invalid) .mojom with a module statement after a definition. | [
"Tests",
"an",
"(",
"invalid",
")",
".",
"mojom",
"with",
"a",
"module",
"statement",
"after",
"a",
"definition",
"."
] | def testModuleStatementAfterDefinition(self):
source = """\
struct MyStruct {
int32 a;
};
module foo;
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^my_file\.mojom:4: Error: \"module\" statements must precede imports "
r"and definitions:... | [
"def",
"testModuleStatementAfterDefinition",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n struct MyStruct {\n int32 a;\n };\n module foo;\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
".",
"ParseError",
",",
"r\"^my... | Tests an (invalid) .mojom with a module statement after a definition. | [
"Tests",
"an",
"(",
"invalid",
")",
".",
"mojom",
"with",
"a",
"module",
"statement",
"after",
"a",
"definition",
"."
] | [
"\"\"\"Tests an (invalid) .mojom with a module statement after a definition.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testImportStatementAfterDefinition | null | def testImportStatementAfterDefinition(self):
"""Tests an (invalid) .mojom with an import statement after a definition."""
source = """\
struct MyStruct {
int32 a;
};
import "foo.mojom";
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^my_fil... | Tests an (invalid) .mojom with an import statement after a definition. | Tests an (invalid) .mojom with an import statement after a definition. | [
"Tests",
"an",
"(",
"invalid",
")",
".",
"mojom",
"with",
"an",
"import",
"statement",
"after",
"a",
"definition",
"."
] | def testImportStatementAfterDefinition(self):
source = """\
struct MyStruct {
int32 a;
};
import "foo.mojom";
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^my_file\.mojom:4: Error: \"import\" statements must precede "
r"definitions:\n *... | [
"def",
"testImportStatementAfterDefinition",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n struct MyStruct {\n int32 a;\n };\n import \"foo.mojom\";\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
".",
"ParseError",
",",... | Tests an (invalid) .mojom with an import statement after a definition. | [
"Tests",
"an",
"(",
"invalid",
")",
".",
"mojom",
"with",
"an",
"import",
"statement",
"after",
"a",
"definition",
"."
] | [
"\"\"\"Tests an (invalid) .mojom with an import statement after a definition.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testEnums | null | def testEnums(self):
"""Tests that enum statements are correctly parsed."""
source = """\
module my_module;
enum MyEnum1 { VALUE1, VALUE2 }; // No trailing comma.
enum MyEnum2 {
VALUE1 = -1,
VALUE2 = 0,
VALUE3 = + 987, // Check that space is allowed.
... | Tests that enum statements are correctly parsed. | Tests that enum statements are correctly parsed. | [
"Tests",
"that",
"enum",
"statements",
"are",
"correctly",
"parsed",
"."
] | def testEnums(self):
source = """\
module my_module;
enum MyEnum1 { VALUE1, VALUE2 }; // No trailing comma.
enum MyEnum2 {
VALUE1 = -1,
VALUE2 = 0,
VALUE3 = + 987, // Check that space is allowed.
VALUE4 = 0xAF12,
VALUE5 = -0x09bcd,
... | [
"def",
"testEnums",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n module my_module;\n enum MyEnum1 { VALUE1, VALUE2 }; // No trailing comma.\n enum MyEnum2 {\n VALUE1 = -1,\n VALUE2 = 0,\n VALUE3 = + 987, // Check that space is allowed.\n ... | Tests that enum statements are correctly parsed. | [
"Tests",
"that",
"enum",
"statements",
"are",
"correctly",
"parsed",
"."
] | [
"\"\"\"Tests that enum statements are correctly parsed.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testInvalidEnumInitializers | null | def testInvalidEnumInitializers(self):
"""Tests that invalid enum initializers are correctly detected."""
# Floating point value.
source2 = "enum MyEnum { VALUE = 0.123 };"
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:1: Error: Unexpected '0\.123':\n"
r"enum MyEnum... | Tests that invalid enum initializers are correctly detected. | Tests that invalid enum initializers are correctly detected. | [
"Tests",
"that",
"invalid",
"enum",
"initializers",
"are",
"correctly",
"detected",
"."
] | def testInvalidEnumInitializers(self):
source2 = "enum MyEnum { VALUE = 0.123 };"
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:1: Error: Unexpected '0\.123':\n"
r"enum MyEnum { VALUE = 0\.123 };$"):
parser.Parse(source2, "my_file.mojom")
source2 = "enum MyEnum { V... | [
"def",
"testInvalidEnumInitializers",
"(",
"self",
")",
":",
"source2",
"=",
"\"enum MyEnum { VALUE = 0.123 };\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
".",
"ParseError",
",",
"r\"^my_file\\.mojom:1: Error: Unexpected '0\\.123':\\n\"",
"r\"enum MyEnum { VAL... | Tests that invalid enum initializers are correctly detected. | [
"Tests",
"that",
"invalid",
"enum",
"initializers",
"are",
"correctly",
"detected",
"."
] | [
"\"\"\"Tests that invalid enum initializers are correctly detected.\"\"\"",
"# Floating point value.",
"# Boolean value."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testConsts | null | def testConsts(self):
"""Tests some constants and struct members initialized with them."""
source = """\
module my_module;
struct MyStruct {
const int8 kNumber = -1;
int8 number@0 = kNumber;
};
"""
expected = ast.Mojom(
ast.Module(('IDENTIFIER', ... | Tests some constants and struct members initialized with them. | Tests some constants and struct members initialized with them. | [
"Tests",
"some",
"constants",
"and",
"struct",
"members",
"initialized",
"with",
"them",
"."
] | def testConsts(self):
source = """\
module my_module;
struct MyStruct {
const int8 kNumber = -1;
int8 number@0 = kNumber;
};
"""
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [
ast.Struct(
... | [
"def",
"testConsts",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n module my_module;\n\n struct MyStruct {\n const int8 kNumber = -1;\n int8 number@0 = kNumber;\n };\n \"\"\"",
"expected",
"=",
"ast",
".",
"Mojom",
"(",
"ast",
".",
... | Tests some constants and struct members initialized with them. | [
"Tests",
"some",
"constants",
"and",
"struct",
"members",
"initialized",
"with",
"them",
"."
] | [
"\"\"\"Tests some constants and struct members initialized with them.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testSimpleOrdinals | null | def testSimpleOrdinals(self):
"""Tests that (valid) ordinal values are scanned correctly."""
source = """\
module my_module;
// This isn't actually valid .mojom, but the problem (missing ordinals)
// should be handled at a different level.
struct MyStruct {
int32 a0@0... | Tests that (valid) ordinal values are scanned correctly. | Tests that (valid) ordinal values are scanned correctly. | [
"Tests",
"that",
"(",
"valid",
")",
"ordinal",
"values",
"are",
"scanned",
"correctly",
"."
] | def testSimpleOrdinals(self):
source = """\
module my_module;
// This isn't actually valid .mojom, but the problem (missing ordinals)
// should be handled at a different level.
struct MyStruct {
int32 a0@0;
int32 a1@1;
int32 a2@2;
int32 a9@9;
... | [
"def",
"testSimpleOrdinals",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n module my_module;\n\n // This isn't actually valid .mojom, but the problem (missing ordinals)\n // should be handled at a different level.\n struct MyStruct {\n int32 a0@0;\n ... | Tests that (valid) ordinal values are scanned correctly. | [
"Tests",
"that",
"(",
"valid",
")",
"ordinal",
"values",
"are",
"scanned",
"correctly",
"."
] | [
"\"\"\"Tests that (valid) ordinal values are scanned correctly.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testInvalidOrdinals | null | def testInvalidOrdinals(self):
"""Tests that (lexically) invalid ordinals are correctly detected."""
source1 = """\
module my_module;
struct MyStruct {
int32 a_missing@;
};
"""
with self.assertRaisesRegexp(
lexer.LexError, r"^my_file\.mojom:4: Error: Missi... | Tests that (lexically) invalid ordinals are correctly detected. | Tests that (lexically) invalid ordinals are correctly detected. | [
"Tests",
"that",
"(",
"lexically",
")",
"invalid",
"ordinals",
"are",
"correctly",
"detected",
"."
] | def testInvalidOrdinals(self):
source1 = """\
module my_module;
struct MyStruct {
int32 a_missing@;
};
"""
with self.assertRaisesRegexp(
lexer.LexError, r"^my_file\.mojom:4: Error: Missing ordinal value$"):
parser.Parse(source1, "my_file.mojom")
source... | [
"def",
"testInvalidOrdinals",
"(",
"self",
")",
":",
"source1",
"=",
"\"\"\"\\\n module my_module;\n\n struct MyStruct {\n int32 a_missing@;\n };\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"lexer",
".",
"LexError",
",",
"r\"^my... | Tests that (lexically) invalid ordinals are correctly detected. | [
"Tests",
"that",
"(",
"lexically",
")",
"invalid",
"ordinals",
"are",
"correctly",
"detected",
"."
] | [
"\"\"\"Tests that (lexically) invalid ordinals are correctly detected.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testNestedNamespace | null | def testNestedNamespace(self):
"""Tests that "nested" namespaces work."""
source = """\
module my.mod;
struct MyStruct {
int32 a;
};
"""
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my.mod'), None), ast.ImportList(), [
ast.Struct(
... | Tests that "nested" namespaces work. | Tests that "nested" namespaces work. | [
"Tests",
"that",
"\"",
"nested",
"\"",
"namespaces",
"work",
"."
] | def testNestedNamespace(self):
source = """\
module my.mod;
struct MyStruct {
int32 a;
};
"""
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my.mod'), None), ast.ImportList(), [
ast.Struct(
'MyStruct', None,
ast.Stru... | [
"def",
"testNestedNamespace",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n module my.mod;\n\n struct MyStruct {\n int32 a;\n };\n \"\"\"",
"expected",
"=",
"ast",
".",
"Mojom",
"(",
"ast",
".",
"Module",
"(",
"(",
"'IDENTIFIER'",
",... | Tests that "nested" namespaces work. | [
"Tests",
"that",
"\"",
"nested",
"\"",
"namespaces",
"work",
"."
] | [
"\"\"\"Tests that \"nested\" namespaces work.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testInvalidHandleType | null | def testInvalidHandleType(self):
"""Tests an invalid (unknown) handle type."""
source = """\
struct MyStruct {
handle<wtf_is_this> foo;
};
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:2: Error: "
r"Invalid handle type 'wtf_is_this'... | Tests an invalid (unknown) handle type. | Tests an invalid (unknown) handle type. | [
"Tests",
"an",
"invalid",
"(",
"unknown",
")",
"handle",
"type",
"."
] | def testInvalidHandleType(self):
source = """\
struct MyStruct {
handle<wtf_is_this> foo;
};
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:2: Error: "
r"Invalid handle type 'wtf_is_this':\n"
r" *handle<wtf_is_this> foo;$"):
... | [
"def",
"testInvalidHandleType",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n struct MyStruct {\n handle<wtf_is_this> foo;\n };\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
".",
"ParseError",
",",
"r\"^my_file\\.mojom:2: E... | Tests an invalid (unknown) handle type. | [
"Tests",
"an",
"invalid",
"(",
"unknown",
")",
"handle",
"type",
"."
] | [
"\"\"\"Tests an invalid (unknown) handle type.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testValidDefaultValues | null | def testValidDefaultValues(self):
"""Tests default values that are valid (to the parser)."""
source = """\
struct MyStruct {
int16 a0 = 0;
uint16 a1 = 0x0;
uint16 a2 = 0x00;
uint16 a3 = 0x01;
uint16 a4 = 0xcd;
int32 a5 = 12345;
int64... | Tests default values that are valid (to the parser). | Tests default values that are valid (to the parser). | [
"Tests",
"default",
"values",
"that",
"are",
"valid",
"(",
"to",
"the",
"parser",
")",
"."
] | def testValidDefaultValues(self):
source = """\
struct MyStruct {
int16 a0 = 0;
uint16 a1 = 0x0;
uint16 a2 = 0x00;
uint16 a3 = 0x01;
uint16 a4 = 0xcd;
int32 a5 = 12345;
int64 a6 = -12345;
int64 a7 = +12345;
uint32 a8 =... | [
"def",
"testValidDefaultValues",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n struct MyStruct {\n int16 a0 = 0;\n uint16 a1 = 0x0;\n uint16 a2 = 0x00;\n uint16 a3 = 0x01;\n uint16 a4 = 0xcd;\n int32 a5 = 12345;\n int64 a6 = -... | Tests default values that are valid (to the parser). | [
"Tests",
"default",
"values",
"that",
"are",
"valid",
"(",
"to",
"the",
"parser",
")",
"."
] | [
"\"\"\"Tests default values that are valid (to the parser).\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testValidFixedSizeArray | null | def testValidFixedSizeArray(self):
"""Tests parsing a fixed size array."""
source = """\
struct MyStruct {
array<int32> normal_array;
array<int32, 1> fixed_size_array_one_entry;
array<int32, 10> fixed_size_array_ten_entries;
array<array<array<int32, 1>>, 2> neste... | Tests parsing a fixed size array. | Tests parsing a fixed size array. | [
"Tests",
"parsing",
"a",
"fixed",
"size",
"array",
"."
] | def testValidFixedSizeArray(self):
source = """\
struct MyStruct {
array<int32> normal_array;
array<int32, 1> fixed_size_array_one_entry;
array<int32, 10> fixed_size_array_ten_entries;
array<array<array<int32, 1>>, 2> nested_arrays;
};
"""
expected... | [
"def",
"testValidFixedSizeArray",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n struct MyStruct {\n array<int32> normal_array;\n array<int32, 1> fixed_size_array_one_entry;\n array<int32, 10> fixed_size_array_ten_entries;\n array<array<array<int32, 1>>,... | Tests parsing a fixed size array. | [
"Tests",
"parsing",
"a",
"fixed",
"size",
"array",
"."
] | [
"\"\"\"Tests parsing a fixed size array.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testValidNestedArray | null | def testValidNestedArray(self):
"""Tests parsing a nested array."""
source = "struct MyStruct { array<array<int32>> nested_array; };"
expected = ast.Mojom(None, ast.ImportList(), [
ast.Struct(
'MyStruct', None,
ast.StructBody(
ast.StructField('nested_array', ... | Tests parsing a nested array. | Tests parsing a nested array. | [
"Tests",
"parsing",
"a",
"nested",
"array",
"."
] | def testValidNestedArray(self):
source = "struct MyStruct { array<array<int32>> nested_array; };"
expected = ast.Mojom(None, ast.ImportList(), [
ast.Struct(
'MyStruct', None,
ast.StructBody(
ast.StructField('nested_array', None, None, 'int32[][]', None)))
])
... | [
"def",
"testValidNestedArray",
"(",
"self",
")",
":",
"source",
"=",
"\"struct MyStruct { array<array<int32>> nested_array; };\"",
"expected",
"=",
"ast",
".",
"Mojom",
"(",
"None",
",",
"ast",
".",
"ImportList",
"(",
")",
",",
"[",
"ast",
".",
"Struct",
"(",
... | Tests parsing a nested array. | [
"Tests",
"parsing",
"a",
"nested",
"array",
"."
] | [
"\"\"\"Tests parsing a nested array.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testInvalidFixedArraySize | null | def testInvalidFixedArraySize(self):
"""Tests that invalid fixed array bounds are correctly detected."""
source1 = """\
struct MyStruct {
array<int32, 0> zero_size_array;
};
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^my_file\.mojom:2: Error: Fi... | Tests that invalid fixed array bounds are correctly detected. | Tests that invalid fixed array bounds are correctly detected. | [
"Tests",
"that",
"invalid",
"fixed",
"array",
"bounds",
"are",
"correctly",
"detected",
"."
] | def testInvalidFixedArraySize(self):
source1 = """\
struct MyStruct {
array<int32, 0> zero_size_array;
};
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^my_file\.mojom:2: Error: Fixed array size 0 invalid:\n"
r" *array<int32, 0> zero_size_array;... | [
"def",
"testInvalidFixedArraySize",
"(",
"self",
")",
":",
"source1",
"=",
"\"\"\"\\\n struct MyStruct {\n array<int32, 0> zero_size_array;\n };\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
".",
"ParseError",
",",
"r\"^my_file... | Tests that invalid fixed array bounds are correctly detected. | [
"Tests",
"that",
"invalid",
"fixed",
"array",
"bounds",
"are",
"correctly",
"detected",
"."
] | [
"\"\"\"Tests that invalid fixed array bounds are correctly detected.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testValidAssociativeArrays | null | def testValidAssociativeArrays(self):
"""Tests that we can parse valid associative array structures."""
source1 = "struct MyStruct { map<string, uint8> data; };"
expected1 = ast.Mojom(None, ast.ImportList(), [
ast.Struct(
'MyStruct', None,
ast.StructBody(
[as... | Tests that we can parse valid associative array structures. | Tests that we can parse valid associative array structures. | [
"Tests",
"that",
"we",
"can",
"parse",
"valid",
"associative",
"array",
"structures",
"."
] | def testValidAssociativeArrays(self):
source1 = "struct MyStruct { map<string, uint8> data; };"
expected1 = ast.Mojom(None, ast.ImportList(), [
ast.Struct(
'MyStruct', None,
ast.StructBody(
[ast.StructField('data', None, None, 'uint8{string}', None)]))
])
... | [
"def",
"testValidAssociativeArrays",
"(",
"self",
")",
":",
"source1",
"=",
"\"struct MyStruct { map<string, uint8> data; };\"",
"expected1",
"=",
"ast",
".",
"Mojom",
"(",
"None",
",",
"ast",
".",
"ImportList",
"(",
")",
",",
"[",
"ast",
".",
"Struct",
"(",
"... | Tests that we can parse valid associative array structures. | [
"Tests",
"that",
"we",
"can",
"parse",
"valid",
"associative",
"array",
"structures",
"."
] | [
"\"\"\"Tests that we can parse valid associative array structures.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testInvalidMethods | null | def testInvalidMethods(self):
"""Tests that invalid method declarations are correctly detected."""
# No trailing commas.
source1 = """\
interface MyInterface {
MyMethod(string a,);
};
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:2: Err... | Tests that invalid method declarations are correctly detected. | Tests that invalid method declarations are correctly detected. | [
"Tests",
"that",
"invalid",
"method",
"declarations",
"are",
"correctly",
"detected",
"."
] | def testInvalidMethods(self):
source1 = """\
interface MyInterface {
MyMethod(string a,);
};
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected '\)':\n"
r" *MyMethod\(string a,\);$"):
parser.Parse(source1, "my_file.... | [
"def",
"testInvalidMethods",
"(",
"self",
")",
":",
"source1",
"=",
"\"\"\"\\\n interface MyInterface {\n MyMethod(string a,);\n };\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
".",
"ParseError",
",",
"r\"^my_file\\.mojom:2: E... | Tests that invalid method declarations are correctly detected. | [
"Tests",
"that",
"invalid",
"method",
"declarations",
"are",
"correctly",
"detected",
"."
] | [
"\"\"\"Tests that invalid method declarations are correctly detected.\"\"\"",
"# No trailing commas.",
"# No leading commas."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testValidInterfaceDefinitions | null | def testValidInterfaceDefinitions(self):
"""Tests all types of definitions that can occur in an interface."""
source = """\
interface MyInterface {
enum MyEnum { VALUE };
const int32 kMyConst = 123;
MyMethod(int32 x) => (MyEnum y);
};
"""
expected = ast... | Tests all types of definitions that can occur in an interface. | Tests all types of definitions that can occur in an interface. | [
"Tests",
"all",
"types",
"of",
"definitions",
"that",
"can",
"occur",
"in",
"an",
"interface",
"."
] | def testValidInterfaceDefinitions(self):
source = """\
interface MyInterface {
enum MyEnum { VALUE };
const int32 kMyConst = 123;
MyMethod(int32 x) => (MyEnum y);
};
"""
expected = ast.Mojom(None, ast.ImportList(), [
ast.Interface(
'MyInt... | [
"def",
"testValidInterfaceDefinitions",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n interface MyInterface {\n enum MyEnum { VALUE };\n const int32 kMyConst = 123;\n MyMethod(int32 x) => (MyEnum y);\n };\n \"\"\"",
"expected",
"=",
"ast",
... | Tests all types of definitions that can occur in an interface. | [
"Tests",
"all",
"types",
"of",
"definitions",
"that",
"can",
"occur",
"in",
"an",
"interface",
"."
] | [
"\"\"\"Tests all types of definitions that can occur in an interface.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testInvalidInterfaceDefinitions | null | def testInvalidInterfaceDefinitions(self):
"""Tests that definitions that aren't allowed in an interface are correctly
detected."""
source1 = """\
interface MyInterface {
struct MyStruct {
int32 a;
};
};
"""
with self.assertRaisesRegexp(
p... | Tests that definitions that aren't allowed in an interface are correctly
detected. | Tests that definitions that aren't allowed in an interface are correctly
detected. | [
"Tests",
"that",
"definitions",
"that",
"aren",
"'",
"t",
"allowed",
"in",
"an",
"interface",
"are",
"correctly",
"detected",
"."
] | def testInvalidInterfaceDefinitions(self):
source1 = """\
interface MyInterface {
struct MyStruct {
int32 a;
};
};
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected 'struct':\n"
r" *struct MyStruct ... | [
"def",
"testInvalidInterfaceDefinitions",
"(",
"self",
")",
":",
"source1",
"=",
"\"\"\"\\\n interface MyInterface {\n struct MyStruct {\n int32 a;\n };\n };\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
".",
"P... | Tests that definitions that aren't allowed in an interface are correctly
detected. | [
"Tests",
"that",
"definitions",
"that",
"aren",
"'",
"t",
"allowed",
"in",
"an",
"interface",
"are",
"correctly",
"detected",
"."
] | [
"\"\"\"Tests that definitions that aren't allowed in an interface are correctly\n detected.\"\"\"",
"# The parser thinks that \"int32\" is a plausible name for a method, so it's",
"# \"my_field\" that gives it away."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testValidAttributes | null | def testValidAttributes(self):
"""Tests parsing attributes (and attribute lists)."""
# Note: We use structs because they have (optional) attribute lists.
# Empty attribute list.
source1 = "[] struct MyStruct {};"
expected1 = ast.Mojom(
None, ast.ImportList(),
[ast.Struct('MyStruct'... | Tests parsing attributes (and attribute lists). | Tests parsing attributes (and attribute lists). | [
"Tests",
"parsing",
"attributes",
"(",
"and",
"attribute",
"lists",
")",
"."
] | def testValidAttributes(self):
source1 = "[] struct MyStruct {};"
expected1 = ast.Mojom(
None, ast.ImportList(),
[ast.Struct('MyStruct', ast.AttributeList(), ast.StructBody())])
self.assertEquals(parser.Parse(source1, "my_file.mojom"), expected1)
source2 = "[MyAttribute=MyName] struct My... | [
"def",
"testValidAttributes",
"(",
"self",
")",
":",
"source1",
"=",
"\"[] struct MyStruct {};\"",
"expected1",
"=",
"ast",
".",
"Mojom",
"(",
"None",
",",
"ast",
".",
"ImportList",
"(",
")",
",",
"[",
"ast",
".",
"Struct",
"(",
"'MyStruct'",
",",
"ast",
... | Tests parsing attributes (and attribute lists). | [
"Tests",
"parsing",
"attributes",
"(",
"and",
"attribute",
"lists",
")",
"."
] | [
"\"\"\"Tests parsing attributes (and attribute lists).\"\"\"",
"# Note: We use structs because they have (optional) attribute lists.",
"# Empty attribute list.",
"# One-element attribute list, with name value.",
"# Two-element attribute list, with one string value and one integer value.",
"# Various place... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testInvalidAttributes | null | def testInvalidAttributes(self):
"""Tests that invalid attributes and attribute lists are correctly
detected."""
# Trailing commas not allowed.
source1 = "[MyAttribute=MyName,] struct MyStruct {};"
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:1: Error: Unexpected '\]':... | Tests that invalid attributes and attribute lists are correctly
detected. | Tests that invalid attributes and attribute lists are correctly
detected. | [
"Tests",
"that",
"invalid",
"attributes",
"and",
"attribute",
"lists",
"are",
"correctly",
"detected",
"."
] | def testInvalidAttributes(self):
source1 = "[MyAttribute=MyName,] struct MyStruct {};"
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:1: Error: Unexpected '\]':\n"
r"\[MyAttribute=MyName,\] struct MyStruct {};$"):
parser.Parse(source1, "my_file.mojom")
source2 = "[M... | [
"def",
"testInvalidAttributes",
"(",
"self",
")",
":",
"source1",
"=",
"\"[MyAttribute=MyName,] struct MyStruct {};\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
".",
"ParseError",
",",
"r\"^my_file\\.mojom:1: Error: Unexpected '\\]':\\n\"",
"r\"\\[MyAttribute=M... | Tests that invalid attributes and attribute lists are correctly
detected. | [
"Tests",
"that",
"invalid",
"attributes",
"and",
"attribute",
"lists",
"are",
"correctly",
"detected",
"."
] | [
"\"\"\"Tests that invalid attributes and attribute lists are correctly\n detected.\"\"\"",
"# Trailing commas not allowed.",
"# Missing value.",
"# Missing key."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testInvalidImports | null | def testInvalidImports(self):
"""Tests that invalid import statements are correctly detected."""
source1 = """\
// Make the error occur on line 2.
import invalid
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected 'invalid':\n"
... | Tests that invalid import statements are correctly detected. | Tests that invalid import statements are correctly detected. | [
"Tests",
"that",
"invalid",
"import",
"statements",
"are",
"correctly",
"detected",
"."
] | def testInvalidImports(self):
source1 = """\
// Make the error occur on line 2.
import invalid
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected 'invalid':\n"
r" *import invalid$"):
parser.Parse(source1, "my_file.mojom")
... | [
"def",
"testInvalidImports",
"(",
"self",
")",
":",
"source1",
"=",
"\"\"\"\\\n // Make the error occur on line 2.\n import invalid\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
".",
"ParseError",
",",
"r\"^my_file\\.mojom:2: Error: Une... | Tests that invalid import statements are correctly detected. | [
"Tests",
"that",
"invalid",
"import",
"statements",
"are",
"correctly",
"detected",
"."
] | [
"\"\"\"Tests that invalid import statements are correctly detected.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testInvalidNullableTypes | null | def testInvalidNullableTypes(self):
"""Tests that invalid nullable types are correctly detected."""
source1 = """\
struct MyStruct {
string?? a;
};
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected '\?':\n"
r" *strin... | Tests that invalid nullable types are correctly detected. | Tests that invalid nullable types are correctly detected. | [
"Tests",
"that",
"invalid",
"nullable",
"types",
"are",
"correctly",
"detected",
"."
] | def testInvalidNullableTypes(self):
source1 = """\
struct MyStruct {
string?? a;
};
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected '\?':\n"
r" *string\?\? a;$"):
parser.Parse(source1, "my_file.mojom")
source... | [
"def",
"testInvalidNullableTypes",
"(",
"self",
")",
":",
"source1",
"=",
"\"\"\"\\\n struct MyStruct {\n string?? a;\n };\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
".",
"ParseError",
",",
"r\"^my_file\\.mojom:2: Error: Une... | Tests that invalid nullable types are correctly detected. | [
"Tests",
"that",
"invalid",
"nullable",
"types",
"are",
"correctly",
"detected",
"."
] | [
"\"\"\"Tests that invalid nullable types are correctly detected.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testSimpleUnion | null | def testSimpleUnion(self):
"""Tests a simple .mojom source that just defines a union."""
source = """\
module my_module;
union MyUnion {
int32 a;
double b;
};
"""
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(... | Tests a simple .mojom source that just defines a union. | Tests a simple .mojom source that just defines a union. | [
"Tests",
"a",
"simple",
".",
"mojom",
"source",
"that",
"just",
"defines",
"a",
"union",
"."
] | def testSimpleUnion(self):
source = """\
module my_module;
union MyUnion {
int32 a;
double b;
};
"""
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [
ast.Union(
'MyUnion', None,
... | [
"def",
"testSimpleUnion",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n module my_module;\n\n union MyUnion {\n int32 a;\n double b;\n };\n \"\"\"",
"expected",
"=",
"ast",
".",
"Mojom",
"(",
"ast",
".",
"Module",
"(",
"(",
"'... | Tests a simple .mojom source that just defines a union. | [
"Tests",
"a",
"simple",
".",
"mojom",
"source",
"that",
"just",
"defines",
"a",
"union",
"."
] | [
"\"\"\"Tests a simple .mojom source that just defines a union.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testUnionWithOrdinals | null | def testUnionWithOrdinals(self):
"""Test that ordinals are assigned to fields."""
source = """\
module my_module;
union MyUnion {
int32 a @10;
double b @30;
};
"""
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList... | Test that ordinals are assigned to fields. | Test that ordinals are assigned to fields. | [
"Test",
"that",
"ordinals",
"are",
"assigned",
"to",
"fields",
"."
] | def testUnionWithOrdinals(self):
source = """\
module my_module;
union MyUnion {
int32 a @10;
double b @30;
};
"""
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [
ast.Union(
'MyUnion'... | [
"def",
"testUnionWithOrdinals",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n module my_module;\n\n union MyUnion {\n int32 a @10;\n double b @30;\n };\n \"\"\"",
"expected",
"=",
"ast",
".",
"Mojom",
"(",
"ast",
".",
"Module",
"(... | Test that ordinals are assigned to fields. | [
"Test",
"that",
"ordinals",
"are",
"assigned",
"to",
"fields",
"."
] | [
"\"\"\"Test that ordinals are assigned to fields.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testUnionWithStructMembers | null | def testUnionWithStructMembers(self):
"""Test that struct members are accepted."""
source = """\
module my_module;
union MyUnion {
SomeStruct s;
};
"""
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [
ast.... | Test that struct members are accepted. | Test that struct members are accepted. | [
"Test",
"that",
"struct",
"members",
"are",
"accepted",
"."
] | def testUnionWithStructMembers(self):
source = """\
module my_module;
union MyUnion {
SomeStruct s;
};
"""
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [
ast.Union(
'MyUnion', None,
... | [
"def",
"testUnionWithStructMembers",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n module my_module;\n\n union MyUnion {\n SomeStruct s;\n };\n \"\"\"",
"expected",
"=",
"ast",
".",
"Mojom",
"(",
"ast",
".",
"Module",
"(",
"(",
"'IDENT... | Test that struct members are accepted. | [
"Test",
"that",
"struct",
"members",
"are",
"accepted",
"."
] | [
"\"\"\"Test that struct members are accepted.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testUnionWithArrayMember | null | def testUnionWithArrayMember(self):
"""Test that array members are accepted."""
source = """\
module my_module;
union MyUnion {
array<int32> a;
};
"""
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [
ast.U... | Test that array members are accepted. | Test that array members are accepted. | [
"Test",
"that",
"array",
"members",
"are",
"accepted",
"."
] | def testUnionWithArrayMember(self):
source = """\
module my_module;
union MyUnion {
array<int32> a;
};
"""
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [
ast.Union(
'MyUnion', None,
... | [
"def",
"testUnionWithArrayMember",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n module my_module;\n\n union MyUnion {\n array<int32> a;\n };\n \"\"\"",
"expected",
"=",
"ast",
".",
"Mojom",
"(",
"ast",
".",
"Module",
"(",
"(",
"'IDENT... | Test that array members are accepted. | [
"Test",
"that",
"array",
"members",
"are",
"accepted",
"."
] | [
"\"\"\"Test that array members are accepted.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testUnionWithMapMember | null | def testUnionWithMapMember(self):
"""Test that map members are accepted."""
source = """\
module my_module;
union MyUnion {
map<int32, string> m;
};
"""
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [
ast... | Test that map members are accepted. | Test that map members are accepted. | [
"Test",
"that",
"map",
"members",
"are",
"accepted",
"."
] | def testUnionWithMapMember(self):
source = """\
module my_module;
union MyUnion {
map<int32, string> m;
};
"""
expected = ast.Mojom(
ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [
ast.Union(
'MyUnion', None,
... | [
"def",
"testUnionWithMapMember",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n module my_module;\n\n union MyUnion {\n map<int32, string> m;\n };\n \"\"\"",
"expected",
"=",
"ast",
".",
"Mojom",
"(",
"ast",
".",
"Module",
"(",
"(",
"'I... | Test that map members are accepted. | [
"Test",
"that",
"map",
"members",
"are",
"accepted",
"."
] | [
"\"\"\"Test that map members are accepted.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testUnionDisallowNestedStruct | null | def testUnionDisallowNestedStruct(self):
"""Tests that structs cannot be nested in unions."""
source = """\
module my_module;
union MyUnion {
struct MyStruct {
int32 a;
};
};
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_f... | Tests that structs cannot be nested in unions. | Tests that structs cannot be nested in unions. | [
"Tests",
"that",
"structs",
"cannot",
"be",
"nested",
"in",
"unions",
"."
] | def testUnionDisallowNestedStruct(self):
source = """\
module my_module;
union MyUnion {
struct MyStruct {
int32 a;
};
};
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:4: Error: Unexpected 'struct':\n"
r" *s... | [
"def",
"testUnionDisallowNestedStruct",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n module my_module;\n\n union MyUnion {\n struct MyStruct {\n int32 a;\n };\n };\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"pa... | Tests that structs cannot be nested in unions. | [
"Tests",
"that",
"structs",
"cannot",
"be",
"nested",
"in",
"unions",
"."
] | [
"\"\"\"Tests that structs cannot be nested in unions.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testUnionDisallowNestedInterfaces | null | def testUnionDisallowNestedInterfaces(self):
"""Tests that interfaces cannot be nested in unions."""
source = """\
module my_module;
union MyUnion {
interface MyInterface {
MyMethod(int32 a);
};
};
"""
with self.assertRaisesRegexp(
par... | Tests that interfaces cannot be nested in unions. | Tests that interfaces cannot be nested in unions. | [
"Tests",
"that",
"interfaces",
"cannot",
"be",
"nested",
"in",
"unions",
"."
] | def testUnionDisallowNestedInterfaces(self):
source = """\
module my_module;
union MyUnion {
interface MyInterface {
MyMethod(int32 a);
};
};
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^my_file\.mojom:4: Error: Unexpecte... | [
"def",
"testUnionDisallowNestedInterfaces",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n module my_module;\n\n union MyUnion {\n interface MyInterface {\n MyMethod(int32 a);\n };\n };\n \"\"\"",
"with",
"self",
".",
"assertRaisesR... | Tests that interfaces cannot be nested in unions. | [
"Tests",
"that",
"interfaces",
"cannot",
"be",
"nested",
"in",
"unions",
"."
] | [
"\"\"\"Tests that interfaces cannot be nested in unions.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testUnionDisallowNestedUnion | null | def testUnionDisallowNestedUnion(self):
"""Tests that unions cannot be nested in unions."""
source = """\
module my_module;
union MyUnion {
union MyOtherUnion {
int32 a;
};
};
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_... | Tests that unions cannot be nested in unions. | Tests that unions cannot be nested in unions. | [
"Tests",
"that",
"unions",
"cannot",
"be",
"nested",
"in",
"unions",
"."
] | def testUnionDisallowNestedUnion(self):
source = """\
module my_module;
union MyUnion {
union MyOtherUnion {
int32 a;
};
};
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:4: Error: Unexpected 'union':\n"
r" *... | [
"def",
"testUnionDisallowNestedUnion",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n module my_module;\n\n union MyUnion {\n union MyOtherUnion {\n int32 a;\n };\n };\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"... | Tests that unions cannot be nested in unions. | [
"Tests",
"that",
"unions",
"cannot",
"be",
"nested",
"in",
"unions",
"."
] | [
"\"\"\"Tests that unions cannot be nested in unions.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testUnionDisallowNestedEnum | null | def testUnionDisallowNestedEnum(self):
"""Tests that enums cannot be nested in unions."""
source = """\
module my_module;
union MyUnion {
enum MyEnum {
A,
};
};
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:4: ... | Tests that enums cannot be nested in unions. | Tests that enums cannot be nested in unions. | [
"Tests",
"that",
"enums",
"cannot",
"be",
"nested",
"in",
"unions",
"."
] | def testUnionDisallowNestedEnum(self):
source = """\
module my_module;
union MyUnion {
enum MyEnum {
A,
};
};
"""
with self.assertRaisesRegexp(
parser.ParseError, r"^my_file\.mojom:4: Error: Unexpected 'enum':\n"
r" *enum MyEnum {$"... | [
"def",
"testUnionDisallowNestedEnum",
"(",
"self",
")",
":",
"source",
"=",
"\"\"\"\\\n module my_module;\n\n union MyUnion {\n enum MyEnum {\n A,\n };\n };\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
"."... | Tests that enums cannot be nested in unions. | [
"Tests",
"that",
"enums",
"cannot",
"be",
"nested",
"in",
"unions",
"."
] | [
"\"\"\"Tests that enums cannot be nested in unions.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testValidAssociatedKinds | null | def testValidAssociatedKinds(self):
"""Tests parsing associated interfaces and requests."""
source1 = """\
struct MyStruct {
associated MyInterface a;
associated MyInterface& b;
associated MyInterface? c;
associated MyInterface&? d;
};
"""
expe... | Tests parsing associated interfaces and requests. | Tests parsing associated interfaces and requests. | [
"Tests",
"parsing",
"associated",
"interfaces",
"and",
"requests",
"."
] | def testValidAssociatedKinds(self):
source1 = """\
struct MyStruct {
associated MyInterface a;
associated MyInterface& b;
associated MyInterface? c;
associated MyInterface&? d;
};
"""
expected1 = ast.Mojom(None, ast.ImportList(), [
ast.Stru... | [
"def",
"testValidAssociatedKinds",
"(",
"self",
")",
":",
"source1",
"=",
"\"\"\"\\\n struct MyStruct {\n associated MyInterface a;\n associated MyInterface& b;\n associated MyInterface? c;\n associated MyInterface&? d;\n };\n \"\"\"",
"expe... | Tests parsing associated interfaces and requests. | [
"Tests",
"parsing",
"associated",
"interfaces",
"and",
"requests",
"."
] | [
"\"\"\"Tests parsing associated interfaces and requests.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d6b71532410bd3d133113e07fe0d5242970d963 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/parser_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testInvalidAssociatedKinds | null | def testInvalidAssociatedKinds(self):
"""Tests that invalid associated interfaces and requests are correctly
detected."""
source1 = """\
struct MyStruct {
associated associated SomeInterface a;
};
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^m... | Tests that invalid associated interfaces and requests are correctly
detected. | Tests that invalid associated interfaces and requests are correctly
detected. | [
"Tests",
"that",
"invalid",
"associated",
"interfaces",
"and",
"requests",
"are",
"correctly",
"detected",
"."
] | def testInvalidAssociatedKinds(self):
source1 = """\
struct MyStruct {
associated associated SomeInterface a;
};
"""
with self.assertRaisesRegexp(
parser.ParseError,
r"^my_file\.mojom:2: Error: Unexpected 'associated':\n"
r" *associated associated SomeIn... | [
"def",
"testInvalidAssociatedKinds",
"(",
"self",
")",
":",
"source1",
"=",
"\"\"\"\\\n struct MyStruct {\n associated associated SomeInterface a;\n };\n \"\"\"",
"with",
"self",
".",
"assertRaisesRegexp",
"(",
"parser",
".",
"ParseError",
",",
"r\"^... | Tests that invalid associated interfaces and requests are correctly
detected. | [
"Tests",
"that",
"invalid",
"associated",
"interfaces",
"and",
"requests",
"are",
"correctly",
"detected",
"."
] | [
"\"\"\"Tests that invalid associated interfaces and requests are correctly\n detected.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
15f0e3bac1f763ab15c3ed264006e8cb9a8578fa | sunlongbo/chromium | mojo/public/tools/bindings/mojom_types_downgrader.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ReplaceFunction | <not_specific> | def ReplaceFunction(match_object):
"""Returns the right replacement for the string matched against the regexp."""
for index, (match, repl) in enumerate(_MOJO_REPLACEMENTS.items(), 1):
if match_object.group(0).startswith(match):
return repl.format(match_object.group(index)) | Returns the right replacement for the string matched against the regexp. | Returns the right replacement for the string matched against the regexp. | [
"Returns",
"the",
"right",
"replacement",
"for",
"the",
"string",
"matched",
"against",
"the",
"regexp",
"."
] | def ReplaceFunction(match_object):
for index, (match, repl) in enumerate(_MOJO_REPLACEMENTS.items(), 1):
if match_object.group(0).startswith(match):
return repl.format(match_object.group(index)) | [
"def",
"ReplaceFunction",
"(",
"match_object",
")",
":",
"for",
"index",
",",
"(",
"match",
",",
"repl",
")",
"in",
"enumerate",
"(",
"_MOJO_REPLACEMENTS",
".",
"items",
"(",
")",
",",
"1",
")",
":",
"if",
"match_object",
".",
"group",
"(",
"0",
")",
... | Returns the right replacement for the string matched against the regexp. | [
"Returns",
"the",
"right",
"replacement",
"for",
"the",
"string",
"matched",
"against",
"the",
"regexp",
"."
] | [
"\"\"\"Returns the right replacement for the string matched against the regexp.\"\"\""
] | [
{
"param": "match_object",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "match_object",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
15f0e3bac1f763ab15c3ed264006e8cb9a8578fa | sunlongbo/chromium | mojo/public/tools/bindings/mojom_types_downgrader.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | DowngradeFile | null | def DowngradeFile(path, output_dir=None):
"""Downgrades the mojom file specified by |path| to the old mojo types.
Optionally pass |output_dir| to place the result under a separate output
directory, preserving the relative path to the file included in |path|.
"""
# Use a temporary file to dump the new content... | Downgrades the mojom file specified by |path| to the old mojo types.
Optionally pass |output_dir| to place the result under a separate output
directory, preserving the relative path to the file included in |path|.
| Downgrades the mojom file specified by |path| to the old mojo types.
Optionally pass |output_dir| to place the result under a separate output
directory, preserving the relative path to the file included in |path|. | [
"Downgrades",
"the",
"mojom",
"file",
"specified",
"by",
"|path|",
"to",
"the",
"old",
"mojo",
"types",
".",
"Optionally",
"pass",
"|output_dir|",
"to",
"place",
"the",
"result",
"under",
"a",
"separate",
"output",
"directory",
"preserving",
"the",
"relative",
... | def DowngradeFile(path, output_dir=None):
with open(path) as src_mojo_file:
with tempfile.NamedTemporaryFile(mode='w', delete=False) as tmp_mojo_file:
tmp_contents = _REGEXP_PATTERN.sub(ReplaceFunction, src_mojo_file.read())
tmp_mojo_file.write(tmp_contents)
if output_dir:
output_filepath = os.p... | [
"def",
"DowngradeFile",
"(",
"path",
",",
"output_dir",
"=",
"None",
")",
":",
"with",
"open",
"(",
"path",
")",
"as",
"src_mojo_file",
":",
"with",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"mode",
"=",
"'w'",
",",
"delete",
"=",
"False",
")",
"as",
... | Downgrades the mojom file specified by |path| to the old mojo types. | [
"Downgrades",
"the",
"mojom",
"file",
"specified",
"by",
"|path|",
"to",
"the",
"old",
"mojo",
"types",
"."
] | [
"\"\"\"Downgrades the mojom file specified by |path| to the old mojo types.\n\n Optionally pass |output_dir| to place the result under a separate output\n directory, preserving the relative path to the file included in |path|.\n \"\"\"",
"# Use a temporary file to dump the new contents after replacing the patt... | [
{
"param": "path",
"type": null
},
{
"param": "output_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output_dir",
"type": null,
"docstring": null,
"docstring_toke... |
15f0e3bac1f763ab15c3ed264006e8cb9a8578fa | sunlongbo/chromium | mojo/public/tools/bindings/mojom_types_downgrader.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | DowngradeDirectory | null | def DowngradeDirectory(path, output_dir=None):
"""Downgrades mojom files inside directory |path| to the old mojo types.
Optionally pass |output_dir| to place the result under a separate output
directory, preserving the relative path to the file included in |path|.
"""
# We don't have recursive glob.glob() no... | Downgrades mojom files inside directory |path| to the old mojo types.
Optionally pass |output_dir| to place the result under a separate output
directory, preserving the relative path to the file included in |path|.
| Downgrades mojom files inside directory |path| to the old mojo types.
Optionally pass |output_dir| to place the result under a separate output
directory, preserving the relative path to the file included in |path|. | [
"Downgrades",
"mojom",
"files",
"inside",
"directory",
"|path|",
"to",
"the",
"old",
"mojo",
"types",
".",
"Optionally",
"pass",
"|output_dir|",
"to",
"place",
"the",
"result",
"under",
"a",
"separate",
"output",
"directory",
"preserving",
"the",
"relative",
"pa... | def DowngradeDirectory(path, output_dir=None):
mojom_filepaths = []
for dir_path, _, filenames in os.walk(path):
for filename in fnmatch.filter(filenames, "*mojom"):
mojom_filepaths.append(os.path.join(dir_path, filename))
for path in mojom_filepaths:
absolute_dirpath = os.path.dirname(os.path.abspa... | [
"def",
"DowngradeDirectory",
"(",
"path",
",",
"output_dir",
"=",
"None",
")",
":",
"mojom_filepaths",
"=",
"[",
"]",
"for",
"dir_path",
",",
"_",
",",
"filenames",
"in",
"os",
".",
"walk",
"(",
"path",
")",
":",
"for",
"filename",
"in",
"fnmatch",
"."... | Downgrades mojom files inside directory |path| to the old mojo types. | [
"Downgrades",
"mojom",
"files",
"inside",
"directory",
"|path|",
"to",
"the",
"old",
"mojo",
"types",
"."
] | [
"\"\"\"Downgrades mojom files inside directory |path| to the old mojo types.\n\n Optionally pass |output_dir| to place the result under a separate output\n directory, preserving the relative path to the file included in |path|.\n \"\"\"",
"# We don't have recursive glob.glob() nor pathlib.Path.rglob() in Pytho... | [
{
"param": "path",
"type": null
},
{
"param": "output_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output_dir",
"type": null,
"docstring": null,
"docstring_toke... |
15f0e3bac1f763ab15c3ed264006e8cb9a8578fa | sunlongbo/chromium | mojo/public/tools/bindings/mojom_types_downgrader.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | DowngradePath | null | def DowngradePath(src_path, output_dir=None):
"""Downgrades the mojom files pointed by |src_path| to the old mojo types.
Optionally pass |output_dir| to place the result under a separate output
directory, preserving the relative path to the file included in |path|.
"""
if os.path.isdir(src_path):
Downgra... | Downgrades the mojom files pointed by |src_path| to the old mojo types.
Optionally pass |output_dir| to place the result under a separate output
directory, preserving the relative path to the file included in |path|.
| Downgrades the mojom files pointed by |src_path| to the old mojo types.
Optionally pass |output_dir| to place the result under a separate output
directory, preserving the relative path to the file included in |path|. | [
"Downgrades",
"the",
"mojom",
"files",
"pointed",
"by",
"|src_path|",
"to",
"the",
"old",
"mojo",
"types",
".",
"Optionally",
"pass",
"|output_dir|",
"to",
"place",
"the",
"result",
"under",
"a",
"separate",
"output",
"directory",
"preserving",
"the",
"relative"... | def DowngradePath(src_path, output_dir=None):
if os.path.isdir(src_path):
DowngradeDirectory(src_path, output_dir)
elif os.path.isfile(src_path):
DowngradeFile(src_path, output_dir)
else:
print(">>> {} not pointing to a valid file or directory".format(src_path))
sys.exit(1) | [
"def",
"DowngradePath",
"(",
"src_path",
",",
"output_dir",
"=",
"None",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"src_path",
")",
":",
"DowngradeDirectory",
"(",
"src_path",
",",
"output_dir",
")",
"elif",
"os",
".",
"path",
".",
"isfile",
... | Downgrades the mojom files pointed by |src_path| to the old mojo types. | [
"Downgrades",
"the",
"mojom",
"files",
"pointed",
"by",
"|src_path|",
"to",
"the",
"old",
"mojo",
"types",
"."
] | [
"\"\"\"Downgrades the mojom files pointed by |src_path| to the old mojo types.\n\n Optionally pass |output_dir| to place the result under a separate output\n directory, preserving the relative path to the file included in |path|.\n \"\"\""
] | [
{
"param": "src_path",
"type": null
},
{
"param": "output_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "src_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output_dir",
"type": null,
"docstring": null,
"docstring_... |
10063076ec2703c287b0826a02f86ec8dd5e133a | sunlongbo/chromium | tools/run-swarmed.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _Spawn | <not_specific> | def _Spawn(args):
"""Triggers a swarming job. The arguments passed are:
- The index of the job;
- The command line arguments object;
- The digest of test files.
The return value is passed to a collect-style map() and consists of:
- The index of the job;
- The json file created by triggering and used to c... | Triggers a swarming job. The arguments passed are:
- The index of the job;
- The command line arguments object;
- The digest of test files.
The return value is passed to a collect-style map() and consists of:
- The index of the job;
- The json file created by triggering and used to collect results;
- The... | Triggers a swarming job. The arguments passed are:
The index of the job;
The command line arguments object;
The digest of test files.
The return value is passed to a collect-style map() and consists of:
The index of the job;
The json file created by triggering and used to collect results;
The command line arguments ob... | [
"Triggers",
"a",
"swarming",
"job",
".",
"The",
"arguments",
"passed",
"are",
":",
"The",
"index",
"of",
"the",
"job",
";",
"The",
"command",
"line",
"arguments",
"object",
";",
"The",
"digest",
"of",
"test",
"files",
".",
"The",
"return",
"value",
"is",... | def _Spawn(args):
try:
return _DoSpawn(args)
except Exception as e:
traceback.print_exc()
return None | [
"def",
"_Spawn",
"(",
"args",
")",
":",
"try",
":",
"return",
"_DoSpawn",
"(",
"args",
")",
"except",
"Exception",
"as",
"e",
":",
"traceback",
".",
"print_exc",
"(",
")",
"return",
"None"
] | Triggers a swarming job. | [
"Triggers",
"a",
"swarming",
"job",
"."
] | [
"\"\"\"Triggers a swarming job. The arguments passed are:\n - The index of the job;\n - The command line arguments object;\n - The digest of test files.\n\n The return value is passed to a collect-style map() and consists of:\n - The index of the job;\n - The json file created by triggering and used to collec... | [
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5ed1aaf293a690395bf1ccb7cedca1cbd50c0832 | sunlongbo/chromium | third_party/tensorflow-text/src/tensorflow_text/python/ops/splitter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | split | null | def split(self, input): # pylint: disable=redefined-builtin
"""Splits the strings from the input tensor.
Args:
input: An N-dimensional UTF-8 string (or optionally integer) `Tensor` or
`RaggedTensor`.
Returns:
An N+1-dimensional UTF-8 string or integer `Tensor` or `RaggedTensor`.
... | Splits the strings from the input tensor.
Args:
input: An N-dimensional UTF-8 string (or optionally integer) `Tensor` or
`RaggedTensor`.
Returns:
An N+1-dimensional UTF-8 string or integer `Tensor` or `RaggedTensor`.
For each string from the input tensor, the final, extra dimension c... | Splits the strings from the input tensor. | [
"Splits",
"the",
"strings",
"from",
"the",
"input",
"tensor",
"."
] | def split(self, input):
raise NotImplementedError("Abstract method") | [
"def",
"split",
"(",
"self",
",",
"input",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"Abstract method\"",
")"
] | Splits the strings from the input tensor. | [
"Splits",
"the",
"strings",
"from",
"the",
"input",
"tensor",
"."
] | [
"# pylint: disable=redefined-builtin",
"\"\"\"Splits the strings from the input tensor.\n\n Args:\n input: An N-dimensional UTF-8 string (or optionally integer) `Tensor` or\n `RaggedTensor`.\n\n Returns:\n An N+1-dimensional UTF-8 string or integer `Tensor` or `RaggedTensor`.\n For eac... | [
{
"param": "self",
"type": null
},
{
"param": "input",
"type": null
}
] | {
"returns": [
{
"docstring": "An N+1-dimensional UTF-8 string or integer `Tensor` or `RaggedTensor`.\nFor each string from the input tensor, the final, extra dimension contains\nthe pieces that string was split into.",
"docstring_tokens": [
"An",
"N",
"+",
"1",
... |
5ed1aaf293a690395bf1ccb7cedca1cbd50c0832 | sunlongbo/chromium | third_party/tensorflow-text/src/tensorflow_text/python/ops/splitter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | split_with_offsets | null | def split_with_offsets(self, input): # pylint: disable=redefined-builtin
"""Splits the input tensor, returns the resulting pieces with offsets.
Args:
input: An N-dimensional UTF-8 string (or optionally integer) `Tensor` or
`RaggedTensor`.
Returns:
A tuple `(pieces, start_offsets, end_... | Splits the input tensor, returns the resulting pieces with offsets.
Args:
input: An N-dimensional UTF-8 string (or optionally integer) `Tensor` or
`RaggedTensor`.
Returns:
A tuple `(pieces, start_offsets, end_offsets)` where:
* `pieces` is an N+1-dimensional UTF-8 string or intege... | Splits the input tensor, returns the resulting pieces with offsets. | [
"Splits",
"the",
"input",
"tensor",
"returns",
"the",
"resulting",
"pieces",
"with",
"offsets",
"."
] | def split_with_offsets(self, input):
raise NotImplementedError("Abstract method") | [
"def",
"split_with_offsets",
"(",
"self",
",",
"input",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"Abstract method\"",
")"
] | Splits the input tensor, returns the resulting pieces with offsets. | [
"Splits",
"the",
"input",
"tensor",
"returns",
"the",
"resulting",
"pieces",
"with",
"offsets",
"."
] | [
"# pylint: disable=redefined-builtin",
"\"\"\"Splits the input tensor, returns the resulting pieces with offsets.\n\n Args:\n input: An N-dimensional UTF-8 string (or optionally integer) `Tensor` or\n `RaggedTensor`.\n\n Returns:\n A tuple `(pieces, start_offsets, end_offsets)` where:\n\n ... | [
{
"param": "self",
"type": null
},
{
"param": "input",
"type": null
}
] | {
"returns": [
{
"docstring": "A tuple `(pieces, start_offsets, end_offsets)` where.\n\n`pieces` is an N+1-dimensional UTF-8 string or integer `Tensor` or\n`RaggedTensor`.\n`start_offsets` is an N+1-dimensional integer `Tensor` or\n`RaggedTensor` containing the starting indices of each piece (byte\nindices ... |
d5ef68c00238389230901a964915643cfaf003cc | sunlongbo/chromium | tools/dump_process_memory/analyze_dumps.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ReadPage | <not_specific> | def _ReadPage(f):
"""Reads a page of data from a file.
Args:
f: (file) An opened file to read from.
Returns:
An array.array() of unsigned int with the page content.
"""
result = array.array('I')
result.fromfile(f, PAGE_SIZE / result.itemsize)
return result | Reads a page of data from a file.
Args:
f: (file) An opened file to read from.
Returns:
An array.array() of unsigned int with the page content.
| Reads a page of data from a file. | [
"Reads",
"a",
"page",
"of",
"data",
"from",
"a",
"file",
"."
] | def _ReadPage(f):
result = array.array('I')
result.fromfile(f, PAGE_SIZE / result.itemsize)
return result | [
"def",
"_ReadPage",
"(",
"f",
")",
":",
"result",
"=",
"array",
".",
"array",
"(",
"'I'",
")",
"result",
".",
"fromfile",
"(",
"f",
",",
"PAGE_SIZE",
"/",
"result",
".",
"itemsize",
")",
"return",
"result"
] | Reads a page of data from a file. | [
"Reads",
"a",
"page",
"of",
"data",
"from",
"a",
"file",
"."
] | [
"\"\"\"Reads a page of data from a file.\n\n Args:\n f: (file) An opened file to read from.\n\n Returns:\n An array.array() of unsigned int with the page content.\n \"\"\""
] | [
{
"param": "f",
"type": null
}
] | {
"returns": [
{
"docstring": "An array.array() of unsigned int with the page content.",
"docstring_tokens": [
"An",
"array",
".",
"array",
"()",
"of",
"unsigned",
"int",
"with",
"the",
"page",
"content",
... |
d5ef68c00238389230901a964915643cfaf003cc | sunlongbo/chromium | tools/dump_process_memory/analyze_dumps.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetStatsFromFileDump | <not_specific> | def _GetStatsFromFileDump(filename):
"""Computes per-dump statistics.
Args:
filename: (str) Path to the dump.
Returns:
MappingStats for the mapping.
"""
# Dump integrity checks.
metadata_filename = filename + '.metadata'
pid_start_end = os.path.basename(filename)[:-len('.dump')]
(_, start, end... | Computes per-dump statistics.
Args:
filename: (str) Path to the dump.
Returns:
MappingStats for the mapping.
| Computes per-dump statistics. | [
"Computes",
"per",
"-",
"dump",
"statistics",
"."
] | def _GetStatsFromFileDump(filename):
metadata_filename = filename + '.metadata'
pid_start_end = os.path.basename(filename)[:-len('.dump')]
(_, start, end) = [int(x, 10) for x in pid_start_end.split('-')]
file_stat = os.stat(filename)
assert start % PAGE_SIZE == 0
assert end % PAGE_SIZE == 0
assert file_st... | [
"def",
"_GetStatsFromFileDump",
"(",
"filename",
")",
":",
"metadata_filename",
"=",
"filename",
"+",
"'.metadata'",
"pid_start_end",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"[",
":",
"-",
"len",
"(",
"'.dump'",
")",
"]",
"(",
"_",
... | Computes per-dump statistics. | [
"Computes",
"per",
"-",
"dump",
"statistics",
"."
] | [
"\"\"\"Computes per-dump statistics.\n\n Args:\n filename: (str) Path to the dump.\n\n Returns:\n MappingStats for the mapping.\n \"\"\"",
"# Dump integrity checks.",
"# each line is [01]{2}\\n, eg '10\\n', 1 line per page.",
"# Not present, not swapped private anonymous == lazily initialized zero",
... | [
{
"param": "filename",
"type": null
}
] | {
"returns": [
{
"docstring": "MappingStats for the mapping.",
"docstring_tokens": [
"MappingStats",
"for",
"the",
"mapping",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
... |
d5ef68c00238389230901a964915643cfaf003cc | sunlongbo/chromium | tools/dump_process_memory/analyze_dumps.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _FindPageFromHash | <not_specific> | def _FindPageFromHash(mappings, page_hash):
"""Returns a page with a given hash from a list of mappings.
Args:
mappings: ([MappingStats]) List of mappings.
page_hash: (str) Page hash to look for,
Returns:
array.array(uint32_t) with the page content
"""
for mapping in mappings:
for i in range... | Returns a page with a given hash from a list of mappings.
Args:
mappings: ([MappingStats]) List of mappings.
page_hash: (str) Page hash to look for,
Returns:
array.array(uint32_t) with the page content
| Returns a page with a given hash from a list of mappings. | [
"Returns",
"a",
"page",
"with",
"a",
"given",
"hash",
"from",
"a",
"list",
"of",
"mappings",
"."
] | def _FindPageFromHash(mappings, page_hash):
for mapping in mappings:
for i in range(mapping.pages):
if mapping.hashes[i] == page_hash:
with open(mapping.filename, 'r') as f:
f.seek(i * PAGE_SIZE)
page = _ReadPage(f)
sha1 = hashlib.sha1()
sha1.update(page)
... | [
"def",
"_FindPageFromHash",
"(",
"mappings",
",",
"page_hash",
")",
":",
"for",
"mapping",
"in",
"mappings",
":",
"for",
"i",
"in",
"range",
"(",
"mapping",
".",
"pages",
")",
":",
"if",
"mapping",
".",
"hashes",
"[",
"i",
"]",
"==",
"page_hash",
":",
... | Returns a page with a given hash from a list of mappings. | [
"Returns",
"a",
"page",
"with",
"a",
"given",
"hash",
"from",
"a",
"list",
"of",
"mappings",
"."
] | [
"\"\"\"Returns a page with a given hash from a list of mappings.\n\n Args:\n mappings: ([MappingStats]) List of mappings.\n page_hash: (str) Page hash to look for,\n\n Returns:\n array.array(uint32_t) with the page content\n \"\"\""
] | [
{
"param": "mappings",
"type": null
},
{
"param": "page_hash",
"type": null
}
] | {
"returns": [
{
"docstring": "array.array(uint32_t) with the page content",
"docstring_tokens": [
"array",
".",
"array",
"(",
"uint32_t",
")",
"with",
"the",
"page",
"content"
],
"type": null
}
],
"rai... |
d5ef68c00238389230901a964915643cfaf003cc | sunlongbo/chromium | tools/dump_process_memory/analyze_dumps.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _PrintPage | null | def _PrintPage(page):
"""Prints the content of a page."""
for i, x in enumerate(page):
print('{:08x}'.format(x), end=' ')
if i % 16 == 15:
print() | Prints the content of a page. | Prints the content of a page. | [
"Prints",
"the",
"content",
"of",
"a",
"page",
"."
] | def _PrintPage(page):
for i, x in enumerate(page):
print('{:08x}'.format(x), end=' ')
if i % 16 == 15:
print() | [
"def",
"_PrintPage",
"(",
"page",
")",
":",
"for",
"i",
",",
"x",
"in",
"enumerate",
"(",
"page",
")",
":",
"print",
"(",
"'{:08x}'",
".",
"format",
"(",
"x",
")",
",",
"end",
"=",
"' '",
")",
"if",
"i",
"%",
"16",
"==",
"15",
":",
"print",
"... | Prints the content of a page. | [
"Prints",
"the",
"content",
"of",
"a",
"page",
"."
] | [
"\"\"\"Prints the content of a page.\"\"\""
] | [
{
"param": "page",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "page",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d5ef68c00238389230901a964915643cfaf003cc | sunlongbo/chromium | tools/dump_process_memory/analyze_dumps.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PrintStats | null | def PrintStats(dumps, verbose):
"""Logs statistics about a process mappings dump.
Args:
dumps: ([str]) List of dumps.
verbose: (bool) Verbose output.
"""
dump_stats = [_GetStatsFromFileDump(filename) for filename in dumps]
total = _AggregateStats(dump_stats)
duplicated_pages = sum(x - 1 for x in to... | Logs statistics about a process mappings dump.
Args:
dumps: ([str]) List of dumps.
verbose: (bool) Verbose output.
| Logs statistics about a process mappings dump. | [
"Logs",
"statistics",
"about",
"a",
"process",
"mappings",
"dump",
"."
] | def PrintStats(dumps, verbose):
dump_stats = [_GetStatsFromFileDump(filename) for filename in dumps]
total = _AggregateStats(dump_stats)
duplicated_pages = sum(x - 1 for x in total.content_to_count.values())
count_and_hashes = sorted(((v, k) for k, v in total.content_to_count.items()),
... | [
"def",
"PrintStats",
"(",
"dumps",
",",
"verbose",
")",
":",
"dump_stats",
"=",
"[",
"_GetStatsFromFileDump",
"(",
"filename",
")",
"for",
"filename",
"in",
"dumps",
"]",
"total",
"=",
"_AggregateStats",
"(",
"dump_stats",
")",
"duplicated_pages",
"=",
"sum",
... | Logs statistics about a process mappings dump. | [
"Logs",
"statistics",
"about",
"a",
"process",
"mappings",
"dump",
"."
] | [
"\"\"\"Logs statistics about a process mappings dump.\n\n Args:\n dumps: ([str]) List of dumps.\n verbose: (bool) Verbose output.\n \"\"\""
] | [
{
"param": "dumps",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dumps",
"type": null,
"docstring": "([str]) List of dumps.",
"docstring_tokens": [
"(",
"[",
"str",
"]",
")",
"List",
"of",
"dumps",
"."
],
"d... |
2f1afd145020c9ff89e75d879d59e31658ba2c6b | sunlongbo/chromium | components/policy/tools/template_writers/writers/adml_writer_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _InitWriterForAddingPolicies | null | def _InitWriterForAddingPolicies(self, writer, policy):
'''Initialize the writer for adding policies. This method must be
called before the method "WritePolicy" can be called. It initializes
attributes of the writer.
'''
self._InitWriterForAddingPolicyGroups(writer)
policy_group = {
'nam... | Initialize the writer for adding policies. This method must be
called before the method "WritePolicy" can be called. It initializes
attributes of the writer.
| Initialize the writer for adding policies. This method must be
called before the method "WritePolicy" can be called. It initializes
attributes of the writer. | [
"Initialize",
"the",
"writer",
"for",
"adding",
"policies",
".",
"This",
"method",
"must",
"be",
"called",
"before",
"the",
"method",
"\"",
"WritePolicy",
"\"",
"can",
"be",
"called",
".",
"It",
"initializes",
"attributes",
"of",
"the",
"writer",
"."
] | def _InitWriterForAddingPolicies(self, writer, policy):
self._InitWriterForAddingPolicyGroups(writer)
policy_group = {
'name': 'PolicyGroup',
'caption': 'Test Caption',
'desc': 'This is the test description of the test policy group.',
'policies': policy,
}
writer.BeginPol... | [
"def",
"_InitWriterForAddingPolicies",
"(",
"self",
",",
"writer",
",",
"policy",
")",
":",
"self",
".",
"_InitWriterForAddingPolicyGroups",
"(",
"writer",
")",
"policy_group",
"=",
"{",
"'name'",
":",
"'PolicyGroup'",
",",
"'caption'",
":",
"'Test Caption'",
",",... | Initialize the writer for adding policies. | [
"Initialize",
"the",
"writer",
"for",
"adding",
"policies",
"."
] | [
"'''Initialize the writer for adding policies. This method must be\n called before the method \"WritePolicy\" can be called. It initializes\n attributes of the writer.\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "writer",
"type": null
},
{
"param": "policy",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "writer",
"type": null,
"docstring": null,
"docstring_tokens":... |
12f3bba5f0d184366ba7718adb117f5c69d12b8c | sunlongbo/chromium | tools/cr/cr/base/client.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ReadGClient | <not_specific> | def ReadGClient():
"""Loads the .gclient configuration for the current client.
This will load from CR_CLIENT_PATH.
Returns:
The dict of values set in the .gclient file.
"""
# Now attempt to load and parse the .gclient file
result = {}
try:
gclient_file = cr.context.Substitute(
os.path.j... | Loads the .gclient configuration for the current client.
This will load from CR_CLIENT_PATH.
Returns:
The dict of values set in the .gclient file.
| Loads the .gclient configuration for the current client.
This will load from CR_CLIENT_PATH. | [
"Loads",
"the",
".",
"gclient",
"configuration",
"for",
"the",
"current",
"client",
".",
"This",
"will",
"load",
"from",
"CR_CLIENT_PATH",
"."
] | def ReadGClient():
result = {}
try:
gclient_file = cr.context.Substitute(
os.path.join('{CR_CLIENT_PATH}', GCLIENT_FILENAME))
with open(gclient_file, 'r') as spec_file:
exec(spec_file.read(), {}, result)
except IOError:
pass
return result | [
"def",
"ReadGClient",
"(",
")",
":",
"result",
"=",
"{",
"}",
"try",
":",
"gclient_file",
"=",
"cr",
".",
"context",
".",
"Substitute",
"(",
"os",
".",
"path",
".",
"join",
"(",
"'{CR_CLIENT_PATH}'",
",",
"GCLIENT_FILENAME",
")",
")",
"with",
"open",
"... | Loads the .gclient configuration for the current client. | [
"Loads",
"the",
".",
"gclient",
"configuration",
"for",
"the",
"current",
"client",
"."
] | [
"\"\"\"Loads the .gclient configuration for the current client.\n\n This will load from CR_CLIENT_PATH.\n\n Returns:\n The dict of values set in the .gclient file.\n\n \"\"\"",
"# Now attempt to load and parse the .gclient file",
"# matching the behaviour of gclient, so pylint: disable=exec-used",
"# no... | [] | {
"returns": [
{
"docstring": "The dict of values set in the .gclient file.",
"docstring_tokens": [
"The",
"dict",
"of",
"values",
"set",
"in",
"the",
".",
"gclient",
"file",
"."
],
"type": null
}
... |
12f3bba5f0d184366ba7718adb117f5c69d12b8c | sunlongbo/chromium | tools/cr/cr/base/client.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteGClient | null | def WriteGClient():
"""Writes the .gclient configuration for the current client.
This will write to CR_CLIENT_PATH.
"""
gclient_file = cr.context.Substitute(
os.path.join('{CR_CLIENT_PATH}', GCLIENT_FILENAME))
spec = '\n'.join('%s = %s' % (key, pprint.pformat(value))
for key,value in cr.context.... | Writes the .gclient configuration for the current client.
This will write to CR_CLIENT_PATH.
| Writes the .gclient configuration for the current client.
This will write to CR_CLIENT_PATH. | [
"Writes",
"the",
".",
"gclient",
"configuration",
"for",
"the",
"current",
"client",
".",
"This",
"will",
"write",
"to",
"CR_CLIENT_PATH",
"."
] | def WriteGClient():
gclient_file = cr.context.Substitute(
os.path.join('{CR_CLIENT_PATH}', GCLIENT_FILENAME))
spec = '\n'.join('%s = %s' % (key, pprint.pformat(value))
for key,value in cr.context.gclient.items())
if cr.context.dry_run:
print('Write the following spec to', gclient_file)
print(s... | [
"def",
"WriteGClient",
"(",
")",
":",
"gclient_file",
"=",
"cr",
".",
"context",
".",
"Substitute",
"(",
"os",
".",
"path",
".",
"join",
"(",
"'{CR_CLIENT_PATH}'",
",",
"GCLIENT_FILENAME",
")",
")",
"spec",
"=",
"'\\n'",
".",
"join",
"(",
"'%s = %s'",
"%... | Writes the .gclient configuration for the current client. | [
"Writes",
"the",
".",
"gclient",
"configuration",
"for",
"the",
"current",
"client",
"."
] | [
"\"\"\"Writes the .gclient configuration for the current client.\n\n This will write to CR_CLIENT_PATH.\n\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
12f3bba5f0d184366ba7718adb117f5c69d12b8c | sunlongbo/chromium | tools/cr/cr/base/client.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | LoadConfig | <not_specific> | def LoadConfig():
"""Loads the client configuration for the given context.
This will load configuration if present from CR_CLIENT_PATH and then
CR_BUILD_DIR.
Returns:
True if configuration was fully loaded.
"""
# Load the root config, will help set default build dir
client_config_dir = _MigrateAndG... | Loads the client configuration for the given context.
This will load configuration if present from CR_CLIENT_PATH and then
CR_BUILD_DIR.
Returns:
True if configuration was fully loaded.
| Loads the client configuration for the given context.
This will load configuration if present from CR_CLIENT_PATH and then
CR_BUILD_DIR. | [
"Loads",
"the",
"client",
"configuration",
"for",
"the",
"given",
"context",
".",
"This",
"will",
"load",
"configuration",
"if",
"present",
"from",
"CR_CLIENT_PATH",
"and",
"then",
"CR_BUILD_DIR",
"."
] | def LoadConfig():
client_config_dir = _MigrateAndGetConfigDir(use_build_dir=False)
cr.auto.client.__path__.append(client_config_dir)
cr.loader.Scan()
build_config_dir = _MigrateAndGetConfigDir(use_build_dir=True)
cr.auto.build.__path__.append(build_config_dir)
cr.loader.Scan()
if not hasattr(cr.auto.build... | [
"def",
"LoadConfig",
"(",
")",
":",
"client_config_dir",
"=",
"_MigrateAndGetConfigDir",
"(",
"use_build_dir",
"=",
"False",
")",
"cr",
".",
"auto",
".",
"client",
".",
"__path__",
".",
"append",
"(",
"client_config_dir",
")",
"cr",
".",
"loader",
".",
"Scan... | Loads the client configuration for the given context. | [
"Loads",
"the",
"client",
"configuration",
"for",
"the",
"given",
"context",
"."
] | [
"\"\"\"Loads the client configuration for the given context.\n\n This will load configuration if present from CR_CLIENT_PATH and then\n CR_BUILD_DIR.\n\n Returns:\n True if configuration was fully loaded.\n\n \"\"\"",
"# Load the root config, will help set default build dir",
"# Now load build dir config... | [] | {
"returns": [
{
"docstring": "True if configuration was fully loaded.",
"docstring_tokens": [
"True",
"if",
"configuration",
"was",
"fully",
"loaded",
"."
],
"type": null
}
],
"raises": [],
"params": [],
"outlier_params":... |
12f3bba5f0d184366ba7718adb117f5c69d12b8c | sunlongbo/chromium | tools/cr/cr/base/client.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteConfig | null | def WriteConfig(use_build_dir, data):
"""Writes a configuration out to a file.
This writes all the key value pairs in data out to a config file.
Args:
use_build_dir: True if the config file should be written to the build
directory. Otherwise it will be written to the root config directory.
data:... | Writes a configuration out to a file.
This writes all the key value pairs in data out to a config file.
Args:
use_build_dir: True if the config file should be written to the build
directory. Otherwise it will be written to the root config directory.
data: The key value pairs to write.
| Writes a configuration out to a file.
This writes all the key value pairs in data out to a config file. | [
"Writes",
"a",
"configuration",
"out",
"to",
"a",
"file",
".",
"This",
"writes",
"all",
"the",
"key",
"value",
"pairs",
"in",
"data",
"out",
"to",
"a",
"config",
"file",
"."
] | def WriteConfig(use_build_dir, data):
config_dir = _GetConfigDir(use_build_dir)
filename = _GetConfigFile(config_dir)
if cr.context.dry_run:
print('makedirs', config_dir)
print('Write config to', filename)
_WriteConfig(sys.stdout, data)
else:
try:
os.makedirs(config_dir)
except OSError... | [
"def",
"WriteConfig",
"(",
"use_build_dir",
",",
"data",
")",
":",
"config_dir",
"=",
"_GetConfigDir",
"(",
"use_build_dir",
")",
"filename",
"=",
"_GetConfigFile",
"(",
"config_dir",
")",
"if",
"cr",
".",
"context",
".",
"dry_run",
":",
"print",
"(",
"'make... | Writes a configuration out to a file. | [
"Writes",
"a",
"configuration",
"out",
"to",
"a",
"file",
"."
] | [
"\"\"\"Writes a configuration out to a file.\n\n This writes all the key value pairs in data out to a config file.\n\n Args:\n use_build_dir: True if the config file should be written to the build\n directory. Otherwise it will be written to the root config directory.\n data: The key value pairs to w... | [
{
"param": "use_build_dir",
"type": null
},
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "use_build_dir",
"type": null,
"docstring": "True if the config file should be written to the build\ndirectory. Otherwise it will be written to the root config directory.",
"docstring_tokens": [
"True",
"if",
... |
12f3bba5f0d184366ba7718adb117f5c69d12b8c | sunlongbo/chromium | tools/cr/cr/base/client.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Run | null | def Run(self, old_version, config):
"""Run the initialization hook.
This is invoked once per init invocation.
Args:
old_version: The old version,
0.0 if the old version was bad or missing,
None if building a new output direcory.
config: The mutable config that will be writte... | Run the initialization hook.
This is invoked once per init invocation.
Args:
old_version: The old version,
0.0 if the old version was bad or missing,
None if building a new output direcory.
config: The mutable config that will be written.
| Run the initialization hook.
This is invoked once per init invocation. | [
"Run",
"the",
"initialization",
"hook",
".",
"This",
"is",
"invoked",
"once",
"per",
"init",
"invocation",
"."
] | def Run(self, old_version, config):
raise NotImplementedError('Must be overridden.') | [
"def",
"Run",
"(",
"self",
",",
"old_version",
",",
"config",
")",
":",
"raise",
"NotImplementedError",
"(",
"'Must be overridden.'",
")"
] | Run the initialization hook. | [
"Run",
"the",
"initialization",
"hook",
"."
] | [
"\"\"\"Run the initialization hook.\n\n This is invoked once per init invocation.\n Args:\n old_version: The old version,\n 0.0 if the old version was bad or missing,\n None if building a new output direcory.\n config: The mutable config that will be written.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "old_version",
"type": null
},
{
"param": "config",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "old_version",
"type": null,
"docstring": "The old version,\n0.0 if ... |
6b316cb8148fbf9b4473a1eed62995f8bae7bd9a | sunlongbo/chromium | tools/metrics/histograms/validate_prefix.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ValidatePrefixInFile | <not_specific> | def ValidatePrefixInFile(xml_path):
"""Validates that all <histogram> and <variants> are put in the correct file.
Args:
xml_path: The path to the histograms.xml file.
Returns:
A boolean that is True if at least a histogram has incorrect prefix, False
otherwise.
"""
prefix = os.path.basename(... | Validates that all <histogram> and <variants> are put in the correct file.
Args:
xml_path: The path to the histograms.xml file.
Returns:
A boolean that is True if at least a histogram has incorrect prefix, False
otherwise.
| Validates that all and are put in the correct file. | [
"Validates",
"that",
"all",
"and",
"are",
"put",
"in",
"the",
"correct",
"file",
"."
] | def ValidatePrefixInFile(xml_path):
prefix = os.path.basename(os.path.dirname(xml_path))
has_prefix_error = False
tree = xml.dom.minidom.parse(xml_path)
for node in extract_histograms.IterElementsWithTag(tree, 'variants', 3):
correct_dir = split_xml.GetDirForNode(node)
if correct_dir != prefix:
va... | [
"def",
"ValidatePrefixInFile",
"(",
"xml_path",
")",
":",
"prefix",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"xml_path",
")",
")",
"has_prefix_error",
"=",
"False",
"tree",
"=",
"xml",
".",
"dom",
".",
"mini... | Validates that all <histogram> and <variants> are put in the correct file. | [
"Validates",
"that",
"all",
"<histogram",
">",
"and",
"<variants",
">",
"are",
"put",
"in",
"the",
"correct",
"file",
"."
] | [
"\"\"\"Validates that all <histogram> and <variants> are put in the correct file.\n\n Args:\n xml_path: The path to the histograms.xml file.\n\n Returns:\n A boolean that is True if at least a histogram has incorrect prefix, False\n otherwise.\n \"\"\""
] | [
{
"param": "xml_path",
"type": null
}
] | {
"returns": [
{
"docstring": "A boolean that is True if at least a histogram has incorrect prefix, False\notherwise.",
"docstring_tokens": [
"A",
"boolean",
"that",
"is",
"True",
"if",
"at",
"least",
"a",
"histogram",
... |
88b77c9887c508ce9110166a9536129cc85c7681 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/pack.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetFieldOffset | <not_specific> | def GetFieldOffset(field, last_field):
"""Returns a 2-tuple of the field offset and bit (for BOOLs)."""
if (field.field.kind == mojom.BOOL and last_field.field.kind == mojom.BOOL
and last_field.bit < 7):
return (last_field.offset, last_field.bit + 1)
offset = last_field.offset + last_field.size
pad =... | Returns a 2-tuple of the field offset and bit (for BOOLs). | Returns a 2-tuple of the field offset and bit (for BOOLs). | [
"Returns",
"a",
"2",
"-",
"tuple",
"of",
"the",
"field",
"offset",
"and",
"bit",
"(",
"for",
"BOOLs",
")",
"."
] | def GetFieldOffset(field, last_field):
if (field.field.kind == mojom.BOOL and last_field.field.kind == mojom.BOOL
and last_field.bit < 7):
return (last_field.offset, last_field.bit + 1)
offset = last_field.offset + last_field.size
pad = GetPad(offset, field.alignment)
return (offset + pad, 0) | [
"def",
"GetFieldOffset",
"(",
"field",
",",
"last_field",
")",
":",
"if",
"(",
"field",
".",
"field",
".",
"kind",
"==",
"mojom",
".",
"BOOL",
"and",
"last_field",
".",
"field",
".",
"kind",
"==",
"mojom",
".",
"BOOL",
"and",
"last_field",
".",
"bit",
... | Returns a 2-tuple of the field offset and bit (for BOOLs). | [
"Returns",
"a",
"2",
"-",
"tuple",
"of",
"the",
"field",
"offset",
"and",
"bit",
"(",
"for",
"BOOLs",
")",
"."
] | [
"\"\"\"Returns a 2-tuple of the field offset and bit (for BOOLs).\"\"\""
] | [
{
"param": "field",
"type": null
},
{
"param": "last_field",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "last_field",
"type": null,
"docstring": null,
"docstring_tok... |
88b77c9887c508ce9110166a9536129cc85c7681 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/pack.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetPayloadSizeUpToField | <not_specific> | def GetPayloadSizeUpToField(field):
"""Returns the payload size (not including struct header) if |field| is the
last field.
"""
if not field:
return 0
offset = field.offset + field.size
pad = GetPad(offset, 8)
return offset + pad | Returns the payload size (not including struct header) if |field| is the
last field.
| Returns the payload size (not including struct header) if |field| is the
last field. | [
"Returns",
"the",
"payload",
"size",
"(",
"not",
"including",
"struct",
"header",
")",
"if",
"|field|",
"is",
"the",
"last",
"field",
"."
] | def GetPayloadSizeUpToField(field):
if not field:
return 0
offset = field.offset + field.size
pad = GetPad(offset, 8)
return offset + pad | [
"def",
"GetPayloadSizeUpToField",
"(",
"field",
")",
":",
"if",
"not",
"field",
":",
"return",
"0",
"offset",
"=",
"field",
".",
"offset",
"+",
"field",
".",
"size",
"pad",
"=",
"GetPad",
"(",
"offset",
",",
"8",
")",
"return",
"offset",
"+",
"pad"
] | Returns the payload size (not including struct header) if |field| is the
last field. | [
"Returns",
"the",
"payload",
"size",
"(",
"not",
"including",
"struct",
"header",
")",
"if",
"|field|",
"is",
"the",
"last",
"field",
"."
] | [
"\"\"\"Returns the payload size (not including struct header) if |field| is the\n last field.\n \"\"\""
] | [
{
"param": "field",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
88b77c9887c508ce9110166a9536129cc85c7681 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/generate/pack.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetVersionInfo | <not_specific> | def GetVersionInfo(packed_struct):
"""Get version information for a struct.
Args:
packed_struct: A PackedStruct instance.
Returns:
A non-empty list of VersionInfo instances, sorted by version in increasing
order.
Note: The version numbers may not be consecutive.
"""
versions = []
last_vers... | Get version information for a struct.
Args:
packed_struct: A PackedStruct instance.
Returns:
A non-empty list of VersionInfo instances, sorted by version in increasing
order.
Note: The version numbers may not be consecutive.
| Get version information for a struct. | [
"Get",
"version",
"information",
"for",
"a",
"struct",
"."
] | def GetVersionInfo(packed_struct):
versions = []
last_version = 0
last_num_fields = 0
last_payload_size = 0
for packed_field in packed_struct.packed_fields_in_ordinal_order:
if packed_field.min_version != last_version:
versions.append(
VersionInfo(last_version, last_num_fields,
... | [
"def",
"GetVersionInfo",
"(",
"packed_struct",
")",
":",
"versions",
"=",
"[",
"]",
"last_version",
"=",
"0",
"last_num_fields",
"=",
"0",
"last_payload_size",
"=",
"0",
"for",
"packed_field",
"in",
"packed_struct",
".",
"packed_fields_in_ordinal_order",
":",
"if"... | Get version information for a struct. | [
"Get",
"version",
"information",
"for",
"a",
"struct",
"."
] | [
"\"\"\"Get version information for a struct.\n\n Args:\n packed_struct: A PackedStruct instance.\n\n Returns:\n A non-empty list of VersionInfo instances, sorted by version in increasing\n order.\n Note: The version numbers may not be consecutive.\n \"\"\"",
"# The fields are iterated in ordinal or... | [
{
"param": "packed_struct",
"type": null
}
] | {
"returns": [
{
"docstring": "A non-empty list of VersionInfo instances, sorted by version in increasing\norder.\nNote: The version numbers may not be consecutive.",
"docstring_tokens": [
"A",
"non",
"-",
"empty",
"list",
"of",
"VersionInfo",
... |
60d8f91bf5c792af72473232a6ed26c961a594cd | sunlongbo/chromium | third_party/tensorflow-text/src/tensorflow_text/python/ops/trimmer_ops.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | generate_masks | null | def generate_masks(self, segments):
"""Generates a boolean mask specifying which portions of `segments` to drop.
Users should be able to use the results of generate_masks() to drop items
in segments using `tf.ragged.boolean_mask(seg, mask)`.
Args:
segments: A list of `RaggedTensor` each w/ a sha... | Generates a boolean mask specifying which portions of `segments` to drop.
Users should be able to use the results of generate_masks() to drop items
in segments using `tf.ragged.boolean_mask(seg, mask)`.
Args:
segments: A list of `RaggedTensor` each w/ a shape of [num_batch,
(num_items)].
... | Generates a boolean mask specifying which portions of `segments` to drop.
Users should be able to use the results of generate_masks() to drop items
in segments using `tf.ragged.boolean_mask(seg, mask)`. | [
"Generates",
"a",
"boolean",
"mask",
"specifying",
"which",
"portions",
"of",
"`",
"segments",
"`",
"to",
"drop",
".",
"Users",
"should",
"be",
"able",
"to",
"use",
"the",
"results",
"of",
"generate_masks",
"()",
"to",
"drop",
"items",
"in",
"segments",
"u... | def generate_masks(self, segments):
raise NotImplementedError() | [
"def",
"generate_masks",
"(",
"self",
",",
"segments",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | Generates a boolean mask specifying which portions of `segments` to drop. | [
"Generates",
"a",
"boolean",
"mask",
"specifying",
"which",
"portions",
"of",
"`",
"segments",
"`",
"to",
"drop",
"."
] | [
"\"\"\"Generates a boolean mask specifying which portions of `segments` to drop.\n\n Users should be able to use the results of generate_masks() to drop items\n in segments using `tf.ragged.boolean_mask(seg, mask)`.\n\n Args:\n segments: A list of `RaggedTensor` each w/ a shape of [num_batch,\n ... | [
{
"param": "self",
"type": null
},
{
"param": "segments",
"type": null
}
] | {
"returns": [
{
"docstring": "a list with len(segments) number of items and where each item is a\n`RaggedTensor` with the same shape as its counterpart in `segments` and\nwith a boolean dtype where each value is True if the corresponding\nvalue in `segments` should be kept and False if it should be dropped... |
60d8f91bf5c792af72473232a6ed26c961a594cd | sunlongbo/chromium | third_party/tensorflow-text/src/tensorflow_text/python/ops/trimmer_ops.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | generate_mask | <not_specific> | def generate_mask(self, segments):
"""Calculates a truncation mask given a per-batch budget.
Calculate a truncation mask given a budget of the max number of items for
each or all batch row. The allocation of the budget is done using a
'waterfall' algorithm. This algorithm allocates quota in a left-to-r... | Calculates a truncation mask given a per-batch budget.
Calculate a truncation mask given a budget of the max number of items for
each or all batch row. The allocation of the budget is done using a
'waterfall' algorithm. This algorithm allocates quota in a left-to-right
manner and fill up the buckets un... | Calculates a truncation mask given a per-batch budget.
Calculate a truncation mask given a budget of the max number of items for
each or all batch row. The allocation of the budget is done using a
'waterfall' algorithm. This algorithm allocates quota in a left-to-right
manner and fill up the buckets until we run out of... | [
"Calculates",
"a",
"truncation",
"mask",
"given",
"a",
"per",
"-",
"batch",
"budget",
".",
"Calculate",
"a",
"truncation",
"mask",
"given",
"a",
"budget",
"of",
"the",
"max",
"number",
"of",
"items",
"for",
"each",
"or",
"all",
"batch",
"row",
".",
"The"... | def generate_mask(self, segments):
with ops.name_scope("WaterfallTrimmer/generate_mask"):
segment_row_lengths = [_get_row_lengths(s, self._axis) for s in segments]
segment_row_lengths = array_ops.stack(segment_row_lengths, axis=-1)
budget = ops.convert_to_tensor(self._max_seq_length)
for _ i... | [
"def",
"generate_mask",
"(",
"self",
",",
"segments",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"\"WaterfallTrimmer/generate_mask\"",
")",
":",
"segment_row_lengths",
"=",
"[",
"_get_row_lengths",
"(",
"s",
",",
"self",
".",
"_axis",
")",
"for",
"s",
... | Calculates a truncation mask given a per-batch budget. | [
"Calculates",
"a",
"truncation",
"mask",
"given",
"a",
"per",
"-",
"batch",
"budget",
"."
] | [
"\"\"\"Calculates a truncation mask given a per-batch budget.\n\n Calculate a truncation mask given a budget of the max number of items for\n each or all batch row. The allocation of the budget is done using a\n 'waterfall' algorithm. This algorithm allocates quota in a left-to-right\n manner and fill u... | [
{
"param": "self",
"type": null
},
{
"param": "segments",
"type": null
}
] | {
"returns": [
{
"docstring": "a list with len(segments) of `RaggedTensor`s, see superclass for details.",
"docstring_tokens": [
"a",
"list",
"with",
"len",
"(",
"segments",
")",
"of",
"`",
"RaggedTensor",
"`",
... |
c8fdb41855cc6d54436f480a8a1e4edd60ce9c8b | sunlongbo/chromium | content/test/gpu/gpu_tests/screenshot_sync_integration_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GenerateBrowserArgs | <not_specific> | def GenerateBrowserArgs(cls, additional_args):
"""Adds default arguments to |additional_args|.
See the parent class' method documentation for additional information.
"""
default_args = super(ScreenshotSyncIntegrationTest,
cls).GenerateBrowserArgs(additional_args)
default_ar... | Adds default arguments to |additional_args|.
See the parent class' method documentation for additional information.
| Adds default arguments to |additional_args|.
See the parent class' method documentation for additional information. | [
"Adds",
"default",
"arguments",
"to",
"|additional_args|",
".",
"See",
"the",
"parent",
"class",
"'",
"method",
"documentation",
"for",
"additional",
"information",
"."
] | def GenerateBrowserArgs(cls, additional_args):
default_args = super(ScreenshotSyncIntegrationTest,
cls).GenerateBrowserArgs(additional_args)
default_args.extend([
cba.FORCE_COLOR_PROFILE_SRGB,
cba.ENSURE_FORCED_COLOR_PROFILE,
cba.TEST_TYPE_GPU,
])
return ... | [
"def",
"GenerateBrowserArgs",
"(",
"cls",
",",
"additional_args",
")",
":",
"default_args",
"=",
"super",
"(",
"ScreenshotSyncIntegrationTest",
",",
"cls",
")",
".",
"GenerateBrowserArgs",
"(",
"additional_args",
")",
"default_args",
".",
"extend",
"(",
"[",
"cba"... | Adds default arguments to |additional_args|. | [
"Adds",
"default",
"arguments",
"to",
"|additional_args|",
"."
] | [
"\"\"\"Adds default arguments to |additional_args|.\n\n See the parent class' method documentation for additional information.\n \"\"\"",
"# --test-type=gpu is used to suppress the \"Google API Keys are",
"# missing\" infobar, which causes flakiness in tests."
] | [
{
"param": "cls",
"type": null
},
{
"param": "additional_args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "additional_args",
"type": null,
"docstring": null,
"docstring_... |
7616cdb4e52669a1660aff8714077789b9f04ed8 | sunlongbo/chromium | tools/metrics/histograms/expand_owners.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddTextNodeWithNewLineAndIndent | null | def _AddTextNodeWithNewLineAndIndent(histogram, node_to_insert_before):
"""Creates and adds a DOM Text Node before the given node in the histogram.
Args:
histogram: The histogram node in which to insert a text node.
node_to_insert_before: A node before which to add the text node.
"""
histogram.insertBe... | Creates and adds a DOM Text Node before the given node in the histogram.
Args:
histogram: The histogram node in which to insert a text node.
node_to_insert_before: A node before which to add the text node.
| Creates and adds a DOM Text Node before the given node in the histogram. | [
"Creates",
"and",
"adds",
"a",
"DOM",
"Text",
"Node",
"before",
"the",
"given",
"node",
"in",
"the",
"histogram",
"."
] | def _AddTextNodeWithNewLineAndIndent(histogram, node_to_insert_before):
histogram.insertBefore(
histogram.ownerDocument.createTextNode('\n '),
node_to_insert_before) | [
"def",
"_AddTextNodeWithNewLineAndIndent",
"(",
"histogram",
",",
"node_to_insert_before",
")",
":",
"histogram",
".",
"insertBefore",
"(",
"histogram",
".",
"ownerDocument",
".",
"createTextNode",
"(",
"'\\n '",
")",
",",
"node_to_insert_before",
")"
] | Creates and adds a DOM Text Node before the given node in the histogram. | [
"Creates",
"and",
"adds",
"a",
"DOM",
"Text",
"Node",
"before",
"the",
"given",
"node",
"in",
"the",
"histogram",
"."
] | [
"\"\"\"Creates and adds a DOM Text Node before the given node in the histogram.\n\n Args:\n histogram: The histogram node in which to insert a text node.\n node_to_insert_before: A node before which to add the text node.\n \"\"\""
] | [
{
"param": "histogram",
"type": null
},
{
"param": "node_to_insert_before",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "histogram",
"type": null,
"docstring": "The histogram node in which to insert a text node.",
"docstring_tokens": [
"The",
"histogram",
"node",
"in",
"which",
"to",
"inser... |
7616cdb4e52669a1660aff8714077789b9f04ed8 | sunlongbo/chromium | tools/metrics/histograms/expand_owners.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _IsValidPrimaryOwnerEmail | <not_specific> | def _IsValidPrimaryOwnerEmail(owner_tag_text):
"""Returns true if |owner_tag_text| is a valid primary owner.
A valid primary owner is an individual (not a team) with a Chromium or Google
email address.
Args:
owner_tag_text: The text in an owner tag
"""
if '-' in owner_tag_text: # Check whether it's a... | Returns true if |owner_tag_text| is a valid primary owner.
A valid primary owner is an individual (not a team) with a Chromium or Google
email address.
Args:
owner_tag_text: The text in an owner tag
| Returns true if |owner_tag_text| is a valid primary owner.
A valid primary owner is an individual (not a team) with a Chromium or Google
email address. | [
"Returns",
"true",
"if",
"|owner_tag_text|",
"is",
"a",
"valid",
"primary",
"owner",
".",
"A",
"valid",
"primary",
"owner",
"is",
"an",
"individual",
"(",
"not",
"a",
"team",
")",
"with",
"a",
"Chromium",
"or",
"Google",
"email",
"address",
"."
] | def _IsValidPrimaryOwnerEmail(owner_tag_text):
if '-' in owner_tag_text:
return False
return (owner_tag_text.endswith('@chromium.org')
or owner_tag_text.endswith('@google.com')) | [
"def",
"_IsValidPrimaryOwnerEmail",
"(",
"owner_tag_text",
")",
":",
"if",
"'-'",
"in",
"owner_tag_text",
":",
"return",
"False",
"return",
"(",
"owner_tag_text",
".",
"endswith",
"(",
"'@chromium.org'",
")",
"or",
"owner_tag_text",
".",
"endswith",
"(",
"'@google... | Returns true if |owner_tag_text| is a valid primary owner. | [
"Returns",
"true",
"if",
"|owner_tag_text|",
"is",
"a",
"valid",
"primary",
"owner",
"."
] | [
"\"\"\"Returns true if |owner_tag_text| is a valid primary owner.\n\n A valid primary owner is an individual (not a team) with a Chromium or Google\n email address.\n\n Args:\n owner_tag_text: The text in an owner tag\n \"\"\"",
"# Check whether it's a team email address."
] | [
{
"param": "owner_tag_text",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "owner_tag_text",
"type": null,
"docstring": "The text in an owner tag",
"docstring_tokens": [
"The",
"text",
"in",
"an",
"owner",
"tag"
],
"default": null,
"is_... |
7616cdb4e52669a1660aff8714077789b9f04ed8 | sunlongbo/chromium | tools/metrics/histograms/expand_owners.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _IsEmailOrPlaceholder | <not_specific> | def _IsEmailOrPlaceholder(is_first_owner, owner_tag_text, histogram_name,
is_obsolete):
"""Returns true if owner_tag_text is an email or the placeholder text.
Also, for histograms that are not obsolete, verifies that a histogram's first
owner tag contains a valid primary owner.
Args:... | Returns true if owner_tag_text is an email or the placeholder text.
Also, for histograms that are not obsolete, verifies that a histogram's first
owner tag contains a valid primary owner.
Args:
is_first_owner: True if a histogram's first owner tag is being checked.
owner_tag_text: The text of the owner ... | Returns true if owner_tag_text is an email or the placeholder text.
Also, for histograms that are not obsolete, verifies that a histogram's first
owner tag contains a valid primary owner.
True if a histogram's first owner tag is being checked.
owner_tag_text: The text of the owner tag being checked, e.g.
Raised if (A... | [
"Returns",
"true",
"if",
"owner_tag_text",
"is",
"an",
"email",
"or",
"the",
"placeholder",
"text",
".",
"Also",
"for",
"histograms",
"that",
"are",
"not",
"obsolete",
"verifies",
"that",
"a",
"histogram",
"'",
"s",
"first",
"owner",
"tag",
"contains",
"a",
... | def _IsEmailOrPlaceholder(is_first_owner, owner_tag_text, histogram_name,
is_obsolete):
is_email = re.match(_EMAIL_PATTERN, owner_tag_text)
is_placeholder = owner_tag_text == extract_histograms.OWNER_PLACEHOLDER
should_check_owner_email = (is_first_owner and not is_obsolete
... | [
"def",
"_IsEmailOrPlaceholder",
"(",
"is_first_owner",
",",
"owner_tag_text",
",",
"histogram_name",
",",
"is_obsolete",
")",
":",
"is_email",
"=",
"re",
".",
"match",
"(",
"_EMAIL_PATTERN",
",",
"owner_tag_text",
")",
"is_placeholder",
"=",
"owner_tag_text",
"==",
... | Returns true if owner_tag_text is an email or the placeholder text. | [
"Returns",
"true",
"if",
"owner_tag_text",
"is",
"an",
"email",
"or",
"the",
"placeholder",
"text",
"."
] | [
"\"\"\"Returns true if owner_tag_text is an email or the placeholder text.\n\n Also, for histograms that are not obsolete, verifies that a histogram's first\n owner tag contains a valid primary owner.\n\n Args:\n is_first_owner: True if a histogram's first owner tag is being checked.\n owner_tag_text: The ... | [
{
"param": "is_first_owner",
"type": null
},
{
"param": "owner_tag_text",
"type": null
},
{
"param": "histogram_name",
"type": null
},
{
"param": "is_obsolete",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "is_first_owner",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "owner_tag_text",
"type": null,
"docstring": null,
"... |
7616cdb4e52669a1660aff8714077789b9f04ed8 | sunlongbo/chromium | tools/metrics/histograms/expand_owners.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _IsWellFormattedFilePath | <not_specific> | def _IsWellFormattedFilePath(path):
"""Returns True if the given path begins with 'src/' and ends with 'OWNERS'.
Args:
path: The path to an OWNERS file, e.g. 'src/gin/OWNERS'.
"""
return path.startswith(SRC) and path.endswith(_OWNERS) | Returns True if the given path begins with 'src/' and ends with 'OWNERS'.
Args:
path: The path to an OWNERS file, e.g. 'src/gin/OWNERS'.
| Returns True if the given path begins with 'src/' and ends with 'OWNERS'. | [
"Returns",
"True",
"if",
"the",
"given",
"path",
"begins",
"with",
"'",
"src",
"/",
"'",
"and",
"ends",
"with",
"'",
"OWNERS",
"'",
"."
] | def _IsWellFormattedFilePath(path):
return path.startswith(SRC) and path.endswith(_OWNERS) | [
"def",
"_IsWellFormattedFilePath",
"(",
"path",
")",
":",
"return",
"path",
".",
"startswith",
"(",
"SRC",
")",
"and",
"path",
".",
"endswith",
"(",
"_OWNERS",
")"
] | Returns True if the given path begins with 'src/' and ends with 'OWNERS'. | [
"Returns",
"True",
"if",
"the",
"given",
"path",
"begins",
"with",
"'",
"src",
"/",
"'",
"and",
"ends",
"with",
"'",
"OWNERS",
"'",
"."
] | [
"\"\"\"Returns True if the given path begins with 'src/' and ends with 'OWNERS'.\n\n Args:\n path: The path to an OWNERS file, e.g. 'src/gin/OWNERS'.\n \"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": "The path to an OWNERS file, e.g. 'src/gin/OWNERS'.",
"docstring_tokens": [
"The",
"path",
"to",
"an",
"OWNERS",
"file",
"e",
".... |
7616cdb4e52669a1660aff8714077789b9f04ed8 | sunlongbo/chromium | tools/metrics/histograms/expand_owners.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetHigherLevelOwnersFilePath | <not_specific> | def _GetHigherLevelOwnersFilePath(path):
"""Returns a path to an OWNERS file at a higher level than the given path.
Returns an empty string if an OWNERS file path in a higher level directory
cannot be found.
Suppose the given path is //stuff/chromium/src/jam/tea/milk/OWNERS. The
path //stuff/chromium/src/ja... | Returns a path to an OWNERS file at a higher level than the given path.
Returns an empty string if an OWNERS file path in a higher level directory
cannot be found.
Suppose the given path is //stuff/chromium/src/jam/tea/milk/OWNERS. The
path //stuff/chromium/src/jam/tea/OWNERS will then be generated, and if it... | Returns a path to an OWNERS file at a higher level than the given path.
Returns an empty string if an OWNERS file path in a higher level directory
cannot be found.
| [
"Returns",
"a",
"path",
"to",
"an",
"OWNERS",
"file",
"at",
"a",
"higher",
"level",
"than",
"the",
"given",
"path",
".",
"Returns",
"an",
"empty",
"string",
"if",
"an",
"OWNERS",
"file",
"path",
"in",
"a",
"higher",
"level",
"directory",
"cannot",
"be",
... | def _GetHigherLevelOwnersFilePath(path):
path_to_limiting_dir = os.path.abspath(os.path.join(*DIR_ABOVE_TOOLS))
limiting_dir = path_to_limiting_dir.split(os.sep)[-1]
owners_file_limit = (os.sep).join([limiting_dir, _OWNERS])
if path.endswith(owners_file_limit):
return ''
parent_directory = os.path.dirname... | [
"def",
"_GetHigherLevelOwnersFilePath",
"(",
"path",
")",
":",
"path_to_limiting_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"*",
"DIR_ABOVE_TOOLS",
")",
")",
"limiting_dir",
"=",
"path_to_limiting_dir",
".",
"split"... | Returns a path to an OWNERS file at a higher level than the given path. | [
"Returns",
"a",
"path",
"to",
"an",
"OWNERS",
"file",
"at",
"a",
"higher",
"level",
"than",
"the",
"given",
"path",
"."
] | [
"\"\"\"Returns a path to an OWNERS file at a higher level than the given path.\n\n Returns an empty string if an OWNERS file path in a higher level directory\n cannot be found.\n\n Suppose the given path is //stuff/chromium/src/jam/tea/milk/OWNERS. The\n path //stuff/chromium/src/jam/tea/OWNERS will then be gen... | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": "The path to an OWNERS file.",
"docstring_tokens": [
"The",
"path",
"to",
"an",
"OWNERS",
"file",
"."
],
"default": null,
... |
7616cdb4e52669a1660aff8714077789b9f04ed8 | sunlongbo/chromium | tools/metrics/histograms/expand_owners.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetOwnersFilePath | <not_specific> | def _GetOwnersFilePath(path):
"""Returns an absolute path that can be opened.
Args:
path: A well-formatted path to an OWNERS file, e.g. 'src/courgette/OWNERS'.
Raises:
Error: Raised if the given path is not well-formatted.
"""
if _IsWellFormattedFilePath(path):
# _SRC is removed because the file... | Returns an absolute path that can be opened.
Args:
path: A well-formatted path to an OWNERS file, e.g. 'src/courgette/OWNERS'.
Raises:
Error: Raised if the given path is not well-formatted.
| Returns an absolute path that can be opened. | [
"Returns",
"an",
"absolute",
"path",
"that",
"can",
"be",
"opened",
"."
] | def _GetOwnersFilePath(path):
if _IsWellFormattedFilePath(path):
path_without_src = path[len(SRC):]
return os.path.abspath(
os.path.join(*(DIR_ABOVE_TOOLS + path_without_src.split(os.sep))))
raise Error(
'The given path {} is not well-formatted. Well-formatted paths begin '
'with "src/" ... | [
"def",
"_GetOwnersFilePath",
"(",
"path",
")",
":",
"if",
"_IsWellFormattedFilePath",
"(",
"path",
")",
":",
"path_without_src",
"=",
"path",
"[",
"len",
"(",
"SRC",
")",
":",
"]",
"return",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".... | Returns an absolute path that can be opened. | [
"Returns",
"an",
"absolute",
"path",
"that",
"can",
"be",
"opened",
"."
] | [
"\"\"\"Returns an absolute path that can be opened.\n\n Args:\n path: A well-formatted path to an OWNERS file, e.g. 'src/courgette/OWNERS'.\n\n Raises:\n Error: Raised if the given path is not well-formatted.\n \"\"\"",
"# _SRC is removed because the file system on the machine running the code",
"# may... | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "Raised if the given path is not well-formatted.",
"docstring_tokens": [
"Raised",
"if",
"the",
"given",
"path",
"is",
"not",
"well",
"-",
"formatted",
"."
],
... |
7616cdb4e52669a1660aff8714077789b9f04ed8 | sunlongbo/chromium | tools/metrics/histograms/expand_owners.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ExtractEmailAddressesFromOWNERS | <not_specific> | def _ExtractEmailAddressesFromOWNERS(path, depth=0):
"""Returns a list of email addresses in the given file.
Args:
path: The path to an OWNERS file.
depth: The depth of the recursion, which is used to fail fast in the rare
case that the OWNERS file path results in a loop.
Raises:
Error: Raised... | Returns a list of email addresses in the given file.
Args:
path: The path to an OWNERS file.
depth: The depth of the recursion, which is used to fail fast in the rare
case that the OWNERS file path results in a loop.
Raises:
Error: Raised in two situations. First, raised if (A) the OWNERS file w... | Returns a list of email addresses in the given file. | [
"Returns",
"a",
"list",
"of",
"email",
"addresses",
"in",
"the",
"given",
"file",
"."
] | def _ExtractEmailAddressesFromOWNERS(path, depth=0):
limit = 10
if (depth > limit):
raise Error('_ExtractEmailAddressesFromOWNERS has been called {} times. The'
' path {} may be part of an OWNERS loop.'.format(limit, path))
directive = 'file://'
email_pattern = re.compile(_EMAIL_PATTERN)
e... | [
"def",
"_ExtractEmailAddressesFromOWNERS",
"(",
"path",
",",
"depth",
"=",
"0",
")",
":",
"limit",
"=",
"10",
"if",
"(",
"depth",
">",
"limit",
")",
":",
"raise",
"Error",
"(",
"'_ExtractEmailAddressesFromOWNERS has been called {} times. The'",
"' path {} may be part ... | Returns a list of email addresses in the given file. | [
"Returns",
"a",
"list",
"of",
"email",
"addresses",
"in",
"the",
"given",
"file",
"."
] | [
"\"\"\"Returns a list of email addresses in the given file.\n\n Args:\n path: The path to an OWNERS file.\n depth: The depth of the recursion, which is used to fail fast in the rare\n case that the OWNERS file path results in a loop.\n\n Raises:\n Error: Raised in two situations. First, raised if (A... | [
{
"param": "path",
"type": null
},
{
"param": "depth",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "Raised in two situations. First, raised if (A) the OWNERS file with\nthe given path has a file directive and (B) the OWNERS file indicated by\nthe directive does not exist. Second, raised if the depth reaches a\ncertain limit.",
"docstring_tokens": [
... |
7616cdb4e52669a1660aff8714077789b9f04ed8 | sunlongbo/chromium | tools/metrics/histograms/expand_owners.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ComponentFromDirmd | <not_specific> | def _ComponentFromDirmd(json_data, subpath):
"""Returns the component for a subpath based on dirmd output.
Returns an empty string if no component can be extracted
Args:
json_data: json object output from dirmd.
subpath: The subpath for the directory being queried, e.g. src/storage'.
"""
# If no com... | Returns the component for a subpath based on dirmd output.
Returns an empty string if no component can be extracted
Args:
json_data: json object output from dirmd.
subpath: The subpath for the directory being queried, e.g. src/storage'.
| Returns the component for a subpath based on dirmd output.
Returns an empty string if no component can be extracted | [
"Returns",
"the",
"component",
"for",
"a",
"subpath",
"based",
"on",
"dirmd",
"output",
".",
"Returns",
"an",
"empty",
"string",
"if",
"no",
"component",
"can",
"be",
"extracted"
] | def _ComponentFromDirmd(json_data, subpath):
return json_data.get('dirs', {}).get(subpath,
{}).get('monorail',
{}).get('component', '') | [
"def",
"_ComponentFromDirmd",
"(",
"json_data",
",",
"subpath",
")",
":",
"return",
"json_data",
".",
"get",
"(",
"'dirs'",
",",
"{",
"}",
")",
".",
"get",
"(",
"subpath",
",",
"{",
"}",
")",
".",
"get",
"(",
"'monorail'",
",",
"{",
"}",
")",
".",
... | Returns the component for a subpath based on dirmd output. | [
"Returns",
"the",
"component",
"for",
"a",
"subpath",
"based",
"on",
"dirmd",
"output",
"."
] | [
"\"\"\"Returns the component for a subpath based on dirmd output.\n\n Returns an empty string if no component can be extracted\n\n Args:\n json_data: json object output from dirmd.\n subpath: The subpath for the directory being queried, e.g. src/storage'.\n \"\"\"",
"# If no component exists for the dire... | [
{
"param": "json_data",
"type": null
},
{
"param": "subpath",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "json_data",
"type": null,
"docstring": "json object output from dirmd.",
"docstring_tokens": [
"json",
"object",
"output",
"from",
"dirmd",
"."
],
"default": null,
... |
7616cdb4e52669a1660aff8714077789b9f04ed8 | sunlongbo/chromium | tools/metrics/histograms/expand_owners.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ExtractComponentViaDirmd | <not_specific> | def _ExtractComponentViaDirmd(path):
"""Returns the component for monorail issues at the given path.
Examples are 'Blink>Storage>FileAPI' and 'UI'.
Uses dirmd in third_party/depot_tools to parse metadata and walk parent
directories up to the top level of the repo.
Returns an empty string if no component ca... | Returns the component for monorail issues at the given path.
Examples are 'Blink>Storage>FileAPI' and 'UI'.
Uses dirmd in third_party/depot_tools to parse metadata and walk parent
directories up to the top level of the repo.
Returns an empty string if no component can be extracted.
Args:
path: The pat... | Returns the component for monorail issues at the given path.
Examples are 'Blink>Storage>FileAPI' and 'UI'.
Uses dirmd in third_party/depot_tools to parse metadata and walk parent
directories up to the top level of the repo.
Returns an empty string if no component can be extracted. | [
"Returns",
"the",
"component",
"for",
"monorail",
"issues",
"at",
"the",
"given",
"path",
".",
"Examples",
"are",
"'",
"Blink",
">",
"Storage",
">",
"FileAPI",
"'",
"and",
"'",
"UI",
"'",
".",
"Uses",
"dirmd",
"in",
"third_party",
"/",
"depot_tools",
"to... | def _ExtractComponentViaDirmd(path):
root_path = os.path.abspath(os.path.join(*DIR_ABOVE_TOOLS))
path = os.path.abspath(path)
if not path.startswith(root_path):
raise Error('Path {} is not a subpath of the root path {}.'.format(
path, root_path))
subpath = path[len(root_path) + 1:] or '.'
dirmd_... | [
"def",
"_ExtractComponentViaDirmd",
"(",
"path",
")",
":",
"root_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"*",
"DIR_ABOVE_TOOLS",
")",
")",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
"... | Returns the component for monorail issues at the given path. | [
"Returns",
"the",
"component",
"for",
"monorail",
"issues",
"at",
"the",
"given",
"path",
"."
] | [
"\"\"\"Returns the component for monorail issues at the given path.\n\n Examples are 'Blink>Storage>FileAPI' and 'UI'.\n\n Uses dirmd in third_party/depot_tools to parse metadata and walk parent\n directories up to the top level of the repo.\n\n Returns an empty string if no component can be extracted.\n\n Arg... | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": "The path to a directory to query, e.g. 'src/storage'.",
"docstring_tokens": [
"The",
"path",
"to",
"a",
"directory",
"to",
"query",
... |
7616cdb4e52669a1660aff8714077789b9f04ed8 | sunlongbo/chromium | tools/metrics/histograms/expand_owners.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _MakeOwners | <not_specific> | def _MakeOwners(document, path, emails_with_dom_elements):
"""Makes DOM Elements for owners and returns the elements.
The owners are extracted from the OWNERS file with the given path and
deduped using the given set emails_with_dom_elements. This set has email
addresses that were explicitly listed as histogram... | Makes DOM Elements for owners and returns the elements.
The owners are extracted from the OWNERS file with the given path and
deduped using the given set emails_with_dom_elements. This set has email
addresses that were explicitly listed as histogram owners, e.g.
<owner>liz@chromium.org</owner>. If a histogram ... | Makes DOM Elements for owners and returns the elements.
The owners are extracted from the OWNERS file with the given path and
deduped using the given set emails_with_dom_elements. This set has email
addresses that were explicitly listed as histogram owners, e.g.
New owners that are extracted from the given file are al... | [
"Makes",
"DOM",
"Elements",
"for",
"owners",
"and",
"returns",
"the",
"elements",
".",
"The",
"owners",
"are",
"extracted",
"from",
"the",
"OWNERS",
"file",
"with",
"the",
"given",
"path",
"and",
"deduped",
"using",
"the",
"given",
"set",
"emails_with_dom_elem... | def _MakeOwners(document, path, emails_with_dom_elements):
owner_elements = []
emails_from_owners_file = _ExtractEmailAddressesFromOWNERS(path)
if not emails_from_owners_file:
raise Error('No emails could be derived from {}.'.format(path))
deduped_emails_from_owners_file = []
for email in emails_from_owne... | [
"def",
"_MakeOwners",
"(",
"document",
",",
"path",
",",
"emails_with_dom_elements",
")",
":",
"owner_elements",
"=",
"[",
"]",
"emails_from_owners_file",
"=",
"_ExtractEmailAddressesFromOWNERS",
"(",
"path",
")",
"if",
"not",
"emails_from_owners_file",
":",
"raise",
... | Makes DOM Elements for owners and returns the elements. | [
"Makes",
"DOM",
"Elements",
"for",
"owners",
"and",
"returns",
"the",
"elements",
"."
] | [
"\"\"\"Makes DOM Elements for owners and returns the elements.\n\n The owners are extracted from the OWNERS file with the given path and\n deduped using the given set emails_with_dom_elements. This set has email\n addresses that were explicitly listed as histogram owners, e.g.\n <owner>liz@chromium.org</owner>.... | [
{
"param": "document",
"type": null
},
{
"param": "path",
"type": null
},
{
"param": "emails_with_dom_elements",
"type": null
}
] | {
"returns": [
{
"docstring": "A collection of DOM Elements made from owners in the given OWNERS file.",
"docstring_tokens": [
"A",
"collection",
"of",
"DOM",
"Elements",
"made",
"from",
"owners",
"in",
"the",
"giv... |
7616cdb4e52669a1660aff8714077789b9f04ed8 | sunlongbo/chromium | tools/metrics/histograms/expand_owners.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddHistogramComponent | null | def _AddHistogramComponent(histogram, component):
"""Makes a DOM Element for the component and adds it to the given histogram.
Args:
histogram: The DOM Element to update.
component: A string component to add, e.g. 'Internals>Network' or 'Build'.
"""
node_to_insert_before = histogram.lastChild
_AddTex... | Makes a DOM Element for the component and adds it to the given histogram.
Args:
histogram: The DOM Element to update.
component: A string component to add, e.g. 'Internals>Network' or 'Build'.
| Makes a DOM Element for the component and adds it to the given histogram. | [
"Makes",
"a",
"DOM",
"Element",
"for",
"the",
"component",
"and",
"adds",
"it",
"to",
"the",
"given",
"histogram",
"."
] | def _AddHistogramComponent(histogram, component):
node_to_insert_before = histogram.lastChild
_AddTextNodeWithNewLineAndIndent(histogram, node_to_insert_before)
document = histogram.ownerDocument
component_element = document.createElement('component')
component_element.appendChild(document.createTextNode(comp... | [
"def",
"_AddHistogramComponent",
"(",
"histogram",
",",
"component",
")",
":",
"node_to_insert_before",
"=",
"histogram",
".",
"lastChild",
"_AddTextNodeWithNewLineAndIndent",
"(",
"histogram",
",",
"node_to_insert_before",
")",
"document",
"=",
"histogram",
".",
"owner... | Makes a DOM Element for the component and adds it to the given histogram. | [
"Makes",
"a",
"DOM",
"Element",
"for",
"the",
"component",
"and",
"adds",
"it",
"to",
"the",
"given",
"histogram",
"."
] | [
"\"\"\"Makes a DOM Element for the component and adds it to the given histogram.\n\n Args:\n histogram: The DOM Element to update.\n component: A string component to add, e.g. 'Internals>Network' or 'Build'.\n \"\"\""
] | [
{
"param": "histogram",
"type": null
},
{
"param": "component",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "histogram",
"type": null,
"docstring": "The DOM Element to update.",
"docstring_tokens": [
"The",
"DOM",
"Element",
"to",
"update",
"."
],
"default": null,
"is_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.