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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e1db078dab4c589c4edb4fb6629f74392b22377e | sunlongbo/chromium | tools/metrics/histograms/update_policies.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | UpdateAtomicGroupsHistogramDefinitions | null | def UpdateAtomicGroupsHistogramDefinitions(policy_templates, doc):
"""Sets the children of <enum name="PolicyAtomicGroups" ...> node in |doc| to
values generated from policy ids contained in |policy_templates|.
Args:
policy_templates: A list of dictionaries, defining policy atomic
group... | Sets the children of <enum name="PolicyAtomicGroups" ...> node in |doc| to
values generated from policy ids contained in |policy_templates|.
Args:
policy_templates: A list of dictionaries, defining policy atomic
groups. The format is exactly the same as in
policy_tem... | Sets the children of node in |doc| to
values generated from policy ids contained in |policy_templates|. | [
"Sets",
"the",
"children",
"of",
"node",
"in",
"|doc|",
"to",
"values",
"generated",
"from",
"policy",
"ids",
"contained",
"in",
"|policy_templates|",
"."
] | def UpdateAtomicGroupsHistogramDefinitions(policy_templates, doc):
for enum_node in doc.getElementsByTagName('enum'):
if enum_node.attributes['name'].value == POLICY_ATOMIC_GROUPS_ENUM_NAME:
atomic_group_enum_node = enum_node
break
else:
raise UserError('No policy atomic group enum node found')
... | [
"def",
"UpdateAtomicGroupsHistogramDefinitions",
"(",
"policy_templates",
",",
"doc",
")",
":",
"for",
"enum_node",
"in",
"doc",
".",
"getElementsByTagName",
"(",
"'enum'",
")",
":",
"if",
"enum_node",
".",
"attributes",
"[",
"'name'",
"]",
".",
"value",
"==",
... | Sets the children of <enum name="PolicyAtomicGroups" ...> node in |doc| to
values generated from policy ids contained in |policy_templates|. | [
"Sets",
"the",
"children",
"of",
"<enum",
"name",
"=",
"\"",
"PolicyAtomicGroups",
"\"",
"...",
">",
"node",
"in",
"|doc|",
"to",
"values",
"generated",
"from",
"policy",
"ids",
"contained",
"in",
"|policy_templates|",
"."
] | [
"\"\"\"Sets the children of <enum name=\"PolicyAtomicGroups\" ...> node in |doc| to\n values generated from policy ids contained in |policy_templates|.\n\n Args:\n policy_templates: A list of dictionaries, defining policy atomic\n groups. The format is exactly the same as in\n ... | [
{
"param": "policy_templates",
"type": null
},
{
"param": "doc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "policy_templates",
"type": null,
"docstring": "A list of dictionaries, defining policy atomic\ngroups. The format is exactly the same as in\npolicy_templates.json file.",
"docstring_tokens": [
"A",
"list",
... |
e1f885ff60010dc0d20cd82ff2872cab015704df | sunlongbo/chromium | components/policy/tools/template_writers/writers/google_admx_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetWriter | <not_specific> | def GetWriter(config):
'''Factory method for instanciating the GoogleADMXWriter. Every Writer needs a
GetWriter method because the TemplateFormatter uses this method to
instantiate a Writer.
'''
return GoogleADMXWriter(None, config) # platforms unused | Factory method for instanciating the GoogleADMXWriter. Every Writer needs a
GetWriter method because the TemplateFormatter uses this method to
instantiate a Writer.
| Factory method for instanciating the GoogleADMXWriter. Every Writer needs a
GetWriter method because the TemplateFormatter uses this method to
instantiate a Writer. | [
"Factory",
"method",
"for",
"instanciating",
"the",
"GoogleADMXWriter",
".",
"Every",
"Writer",
"needs",
"a",
"GetWriter",
"method",
"because",
"the",
"TemplateFormatter",
"uses",
"this",
"method",
"to",
"instantiate",
"a",
"Writer",
"."
] | def GetWriter(config):
return GoogleADMXWriter(None, config) | [
"def",
"GetWriter",
"(",
"config",
")",
":",
"return",
"GoogleADMXWriter",
"(",
"None",
",",
"config",
")"
] | Factory method for instanciating the GoogleADMXWriter. | [
"Factory",
"method",
"for",
"instanciating",
"the",
"GoogleADMXWriter",
"."
] | [
"'''Factory method for instanciating the GoogleADMXWriter. Every Writer needs a\n GetWriter method because the TemplateFormatter uses this method to\n instantiate a Writer.\n '''",
"# platforms unused"
] | [
{
"param": "config",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
723c4b03422f283f9da20915effc15af1d99dbea | sunlongbo/chromium | chrome/tools/build/win/resedit.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ExtractAllToDir | null | def ExtractAllToDir(self, extract_to):
"""Extracts all resources from our input file to a directory hierarchy
in the directory named extract_to.
The generated directory hierarchy is three-level, and looks like:
resource-type/
resource-name/
lang-id.
Args:
extract_to: path... | Extracts all resources from our input file to a directory hierarchy
in the directory named extract_to.
The generated directory hierarchy is three-level, and looks like:
resource-type/
resource-name/
lang-id.
Args:
extract_to: path to the folder to output to. This folder will ... | Extracts all resources from our input file to a directory hierarchy
in the directory named extract_to.
The generated directory hierarchy is three-level, and looks like:
resource-type
resource-name
lang-id. | [
"Extracts",
"all",
"resources",
"from",
"our",
"input",
"file",
"to",
"a",
"directory",
"hierarchy",
"in",
"the",
"directory",
"named",
"extract_to",
".",
"The",
"generated",
"directory",
"hierarchy",
"is",
"three",
"-",
"level",
"and",
"looks",
"like",
":",
... | def ExtractAllToDir(self, extract_to):
_LOGGER.info('Extracting all resources from "%s" to directory "%s".',
self.input_file, extract_to)
if os.path.exists(extract_to):
_LOGGER.info('Destination directory "%s" exists, deleting', extract_to)
shutil.rmtree(extract_to)
os.makedirs(extract_t... | [
"def",
"ExtractAllToDir",
"(",
"self",
",",
"extract_to",
")",
":",
"_LOGGER",
".",
"info",
"(",
"'Extracting all resources from \"%s\" to directory \"%s\".'",
",",
"self",
".",
"input_file",
",",
"extract_to",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"... | Extracts all resources from our input file to a directory hierarchy
in the directory named extract_to. | [
"Extracts",
"all",
"resources",
"from",
"our",
"input",
"file",
"to",
"a",
"directory",
"hierarchy",
"in",
"the",
"directory",
"named",
"extract_to",
"."
] | [
"\"\"\"Extracts all resources from our input file to a directory hierarchy\n in the directory named extract_to.\n\n The generated directory hierarchy is three-level, and looks like:\n resource-type/\n resource-name/\n lang-id.\n\n Args:\n extract_to: path to the folder to output t... | [
{
"param": "self",
"type": null
},
{
"param": "extract_to",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "extract_to",
"type": null,
"docstring": null,
"docstring_toke... |
723c4b03422f283f9da20915effc15af1d99dbea | sunlongbo/chromium | chrome/tools/build/win/resedit.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ExtractResource | null | def ExtractResource(self, res_type, res_lang, res_name, dest_file):
"""Extracts a given resource, specified by type, language id and name,
to a given file.
Args:
res_type: the type of the resource, e.g. "B7".
res_lang: the language id of the resource e.g. 1033.
res_name: the name of the r... | Extracts a given resource, specified by type, language id and name,
to a given file.
Args:
res_type: the type of the resource, e.g. "B7".
res_lang: the language id of the resource e.g. 1033.
res_name: the name of the resource, e.g. "SETUP.EXE".
dest_file: path to the file where the reso... | Extracts a given resource, specified by type, language id and name,
to a given file. | [
"Extracts",
"a",
"given",
"resource",
"specified",
"by",
"type",
"language",
"id",
"and",
"name",
"to",
"a",
"given",
"file",
"."
] | def ExtractResource(self, res_type, res_lang, res_name, dest_file):
_LOGGER.info('Extracting resource "%s", lang "%d" name "%s" '
'to file "%s".', res_type, res_lang, res_name, dest_file)
data = win32api.LoadResource(self.module, res_type, res_name, res_lang)
with open(dest_file, 'wb') as f... | [
"def",
"ExtractResource",
"(",
"self",
",",
"res_type",
",",
"res_lang",
",",
"res_name",
",",
"dest_file",
")",
":",
"_LOGGER",
".",
"info",
"(",
"'Extracting resource \"%s\", lang \"%d\" name \"%s\" '",
"'to file \"%s\".'",
",",
"res_type",
",",
"res_lang",
",",
"... | Extracts a given resource, specified by type, language id and name,
to a given file. | [
"Extracts",
"a",
"given",
"resource",
"specified",
"by",
"type",
"language",
"id",
"and",
"name",
"to",
"a",
"given",
"file",
"."
] | [
"\"\"\"Extracts a given resource, specified by type, language id and name,\n to a given file.\n\n Args:\n res_type: the type of the resource, e.g. \"B7\".\n res_lang: the language id of the resource e.g. 1033.\n res_name: the name of the resource, e.g. \"SETUP.EXE\".\n dest_file: path to t... | [
{
"param": "self",
"type": null
},
{
"param": "res_type",
"type": null
},
{
"param": "res_lang",
"type": null
},
{
"param": "res_name",
"type": null
},
{
"param": "dest_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "res_type",
"type": null,
"docstring": "the type of the resource, e.... |
723c4b03422f283f9da20915effc15af1d99dbea | sunlongbo/chromium | chrome/tools/build/win/resedit.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RemoveResource | null | def RemoveResource(self, res_type, res_lang, res_name):
"""Removes a given resource, specified by type, language id and name.
Args:
res_type: the type of the resource, e.g. "B7".
res_lang: the language id of the resource, e.g. 1033.
res_name: the name of the resource, e.g. "SETUP.EXE".
""... | Removes a given resource, specified by type, language id and name.
Args:
res_type: the type of the resource, e.g. "B7".
res_lang: the language id of the resource, e.g. 1033.
res_name: the name of the resource, e.g. "SETUP.EXE".
| Removes a given resource, specified by type, language id and name. | [
"Removes",
"a",
"given",
"resource",
"specified",
"by",
"type",
"language",
"id",
"and",
"name",
"."
] | def RemoveResource(self, res_type, res_lang, res_name):
_LOGGER.info('Removing resource "%s:%s".', res_type, res_name)
ret = UpdateResource(self.update_handle,
res_type,
res_name,
res_lang,
None,
... | [
"def",
"RemoveResource",
"(",
"self",
",",
"res_type",
",",
"res_lang",
",",
"res_name",
")",
":",
"_LOGGER",
".",
"info",
"(",
"'Removing resource \"%s:%s\".'",
",",
"res_type",
",",
"res_name",
")",
"ret",
"=",
"UpdateResource",
"(",
"self",
".",
"update_han... | Removes a given resource, specified by type, language id and name. | [
"Removes",
"a",
"given",
"resource",
"specified",
"by",
"type",
"language",
"id",
"and",
"name",
"."
] | [
"\"\"\"Removes a given resource, specified by type, language id and name.\n\n Args:\n res_type: the type of the resource, e.g. \"B7\".\n res_lang: the language id of the resource, e.g. 1033.\n res_name: the name of the resource, e.g. \"SETUP.EXE\".\n \"\"\"",
"# We have to go native to perfor... | [
{
"param": "self",
"type": null
},
{
"param": "res_type",
"type": null
},
{
"param": "res_lang",
"type": null
},
{
"param": "res_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "res_type",
"type": null,
"docstring": "the type of the resource, e.... |
723c4b03422f283f9da20915effc15af1d99dbea | sunlongbo/chromium | chrome/tools/build/win/resedit.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | UpdateResource | null | def UpdateResource(self, res_type, res_lang, res_name, file_path):
"""Inserts or updates a given resource with the contents of a file.
This is a legacy version of UpdateResourceData, where the data arg is read
from a file , rather than passed directly.
"""
_LOGGER.info('Writing resource from file %... | Inserts or updates a given resource with the contents of a file.
This is a legacy version of UpdateResourceData, where the data arg is read
from a file , rather than passed directly.
| Inserts or updates a given resource with the contents of a file.
This is a legacy version of UpdateResourceData, where the data arg is read
from a file , rather than passed directly. | [
"Inserts",
"or",
"updates",
"a",
"given",
"resource",
"with",
"the",
"contents",
"of",
"a",
"file",
".",
"This",
"is",
"a",
"legacy",
"version",
"of",
"UpdateResourceData",
"where",
"the",
"data",
"arg",
"is",
"read",
"from",
"a",
"file",
"rather",
"than",... | def UpdateResource(self, res_type, res_lang, res_name, file_path):
_LOGGER.info('Writing resource from file %s', file_path)
with open(file_path, 'rb') as f:
self.UpdateResourceData(res_type, res_lang, res_name, f.read()) | [
"def",
"UpdateResource",
"(",
"self",
",",
"res_type",
",",
"res_lang",
",",
"res_name",
",",
"file_path",
")",
":",
"_LOGGER",
".",
"info",
"(",
"'Writing resource from file %s'",
",",
"file_path",
")",
"with",
"open",
"(",
"file_path",
",",
"'rb'",
")",
"a... | Inserts or updates a given resource with the contents of a file. | [
"Inserts",
"or",
"updates",
"a",
"given",
"resource",
"with",
"the",
"contents",
"of",
"a",
"file",
"."
] | [
"\"\"\"Inserts or updates a given resource with the contents of a file.\n\n This is a legacy version of UpdateResourceData, where the data arg is read\n from a file , rather than passed directly.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "res_type",
"type": null
},
{
"param": "res_lang",
"type": null
},
{
"param": "res_name",
"type": null
},
{
"param": "file_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "res_type",
"type": null,
"docstring": null,
"docstring_tokens... |
723c4b03422f283f9da20915effc15af1d99dbea | sunlongbo/chromium | chrome/tools/build/win/resedit.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | UpdateResourceData | null | def UpdateResourceData(self, res_type, res_lang, res_name, data):
"""Inserts or updates a given resource with the given data.
Args:
res_type: the type of the resource, e.g. "B7".
res_lang: the language id of the resource, e.g. 1033.
res_name: the name of the resource, e.g. "SETUP.EXE".
... | Inserts or updates a given resource with the given data.
Args:
res_type: the type of the resource, e.g. "B7".
res_lang: the language id of the resource, e.g. 1033.
res_name: the name of the resource, e.g. "SETUP.EXE".
data: the new resource data.
| Inserts or updates a given resource with the given data. | [
"Inserts",
"or",
"updates",
"a",
"given",
"resource",
"with",
"the",
"given",
"data",
"."
] | def UpdateResourceData(self, res_type, res_lang, res_name, data):
_LOGGER.info('Writing resource "%s:%s"', res_type, res_name)
win32api.UpdateResource(self.update_handle,
res_type,
res_name,
data,
res... | [
"def",
"UpdateResourceData",
"(",
"self",
",",
"res_type",
",",
"res_lang",
",",
"res_name",
",",
"data",
")",
":",
"_LOGGER",
".",
"info",
"(",
"'Writing resource \"%s:%s\"'",
",",
"res_type",
",",
"res_name",
")",
"win32api",
".",
"UpdateResource",
"(",
"sel... | Inserts or updates a given resource with the given data. | [
"Inserts",
"or",
"updates",
"a",
"given",
"resource",
"with",
"the",
"given",
"data",
"."
] | [
"\"\"\"Inserts or updates a given resource with the given data.\n\n Args:\n res_type: the type of the resource, e.g. \"B7\".\n res_lang: the language id of the resource, e.g. 1033.\n res_name: the name of the resource, e.g. \"SETUP.EXE\".\n data: the new resource data.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "res_type",
"type": null
},
{
"param": "res_lang",
"type": null
},
{
"param": "res_name",
"type": null
},
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "res_type",
"type": null,
"docstring": "the type of the resource, e.... |
723c4b03422f283f9da20915effc15af1d99dbea | sunlongbo/chromium | chrome/tools/build/win/resedit.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Commit | null | def Commit(self):
"""Commit any successful resource edits this editor has performed.
This has the effect of writing the output file.
"""
if self._update_handle:
update_handle = self._update_handle
self._update_handle = None
win32api.EndUpdateResource(update_handle, False)
_LOGGE... | Commit any successful resource edits this editor has performed.
This has the effect of writing the output file.
| Commit any successful resource edits this editor has performed.
This has the effect of writing the output file. | [
"Commit",
"any",
"successful",
"resource",
"edits",
"this",
"editor",
"has",
"performed",
".",
"This",
"has",
"the",
"effect",
"of",
"writing",
"the",
"output",
"file",
"."
] | def Commit(self):
if self._update_handle:
update_handle = self._update_handle
self._update_handle = None
win32api.EndUpdateResource(update_handle, False)
_LOGGER.info('Writing edited file to "%s".', self._output_file)
shutil.copyfile(self._temp_file, self._output_file)
else:
... | [
"def",
"Commit",
"(",
"self",
")",
":",
"if",
"self",
".",
"_update_handle",
":",
"update_handle",
"=",
"self",
".",
"_update_handle",
"self",
".",
"_update_handle",
"=",
"None",
"win32api",
".",
"EndUpdateResource",
"(",
"update_handle",
",",
"False",
")",
... | Commit any successful resource edits this editor has performed. | [
"Commit",
"any",
"successful",
"resource",
"edits",
"this",
"editor",
"has",
"performed",
"."
] | [
"\"\"\"Commit any successful resource edits this editor has performed.\n\n This has the effect of writing the output file.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
723c4b03422f283f9da20915effc15af1d99dbea | sunlongbo/chromium | chrome/tools/build/win/resedit.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ConvertInts | <not_specific> | def _ConvertInts(*args):
"""Return args with any all-digit strings converted to ints."""
results = []
for arg in args:
if isinstance(arg, basestring) and arg.isdigit():
results.append(int(arg))
else:
results.append(arg)
return results | Return args with any all-digit strings converted to ints. | Return args with any all-digit strings converted to ints. | [
"Return",
"args",
"with",
"any",
"all",
"-",
"digit",
"strings",
"converted",
"to",
"ints",
"."
] | def _ConvertInts(*args):
results = []
for arg in args:
if isinstance(arg, basestring) and arg.isdigit():
results.append(int(arg))
else:
results.append(arg)
return results | [
"def",
"_ConvertInts",
"(",
"*",
"args",
")",
":",
"results",
"=",
"[",
"]",
"for",
"arg",
"in",
"args",
":",
"if",
"isinstance",
"(",
"arg",
",",
"basestring",
")",
"and",
"arg",
".",
"isdigit",
"(",
")",
":",
"results",
".",
"append",
"(",
"int",... | Return args with any all-digit strings converted to ints. | [
"Return",
"args",
"with",
"any",
"all",
"-",
"digit",
"strings",
"converted",
"to",
"ints",
"."
] | [
"\"\"\"Return args with any all-digit strings converted to ints.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
723c4b03422f283f9da20915effc15af1d99dbea | sunlongbo/chromium | chrome/tools/build/win/resedit.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | main | null | def main(options, args):
"""Main program for the script."""
if options.verbose:
logging.basicConfig(level=logging.INFO)
# Create the editor for our input file.
editor = ResourceEditor(args[0], options.output_file)
if options.extract_all:
editor.ExtractAllToDir(options.extract_all)
for res_type, r... | Main program for the script. | Main program for the script. | [
"Main",
"program",
"for",
"the",
"script",
"."
] | def main(options, args):
if options.verbose:
logging.basicConfig(level=logging.INFO)
editor = ResourceEditor(args[0], options.output_file)
if options.extract_all:
editor.ExtractAllToDir(options.extract_all)
for res_type, res_lang, res_name, dest_file in options.extract:
res_type, res_lang, res_name ... | [
"def",
"main",
"(",
"options",
",",
"args",
")",
":",
"if",
"options",
".",
"verbose",
":",
"logging",
".",
"basicConfig",
"(",
"level",
"=",
"logging",
".",
"INFO",
")",
"editor",
"=",
"ResourceEditor",
"(",
"args",
"[",
"0",
"]",
",",
"options",
".... | Main program for the script. | [
"Main",
"program",
"for",
"the",
"script",
"."
] | [
"\"\"\"Main program for the script.\"\"\"",
"# Create the editor for our input file."
] | [
{
"param": "options",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "options",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens"... |
726a2efe642c182bc4afb679be04820e5fb6155b | sunlongbo/chromium | tools/vim/tests/chromium.ycm_extra_conf_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreateFile | null | def CreateFile(path, copy_from=None, format_with=None, make_executable=False):
"""Creates a file.
If a file already exists at |path|, it will be overwritten.
Args:
path: (String) Absolute path for file to be created.
copy_from: (String or None) Absolute path to source file. If valid, the
... | Creates a file.
If a file already exists at |path|, it will be overwritten.
Args:
path: (String) Absolute path for file to be created.
copy_from: (String or None) Absolute path to source file. If valid, the
contents of this file will be written to |path|.
format_with: (Dictionary or Non... | Creates a file.
If a file already exists at |path|, it will be overwritten. | [
"Creates",
"a",
"file",
".",
"If",
"a",
"file",
"already",
"exists",
"at",
"|path|",
"it",
"will",
"be",
"overwritten",
"."
] | def CreateFile(path, copy_from=None, format_with=None, make_executable=False):
if not os.path.isabs(path):
raise Exception(
'Argument |path| needs to be an absolute path. Got: "{}"'.format(path))
with open(path, 'w') as f:
if copy_from:
with open(copy_from, 'r') as source:
contents = s... | [
"def",
"CreateFile",
"(",
"path",
",",
"copy_from",
"=",
"None",
",",
"format_with",
"=",
"None",
",",
"make_executable",
"=",
"False",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"raise",
"Exception",
"(",
"'Argument... | Creates a file. | [
"Creates",
"a",
"file",
"."
] | [
"\"\"\"Creates a file.\n\n If a file already exists at |path|, it will be overwritten.\n\n Args:\n path: (String) Absolute path for file to be created.\n copy_from: (String or None) Absolute path to source file. If valid, the\n contents of this file will be written to |path|.\n format_with:... | [
{
"param": "path",
"type": null
},
{
"param": "copy_from",
"type": null
},
{
"param": "format_with",
"type": null
},
{
"param": "make_executable",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": "(String) Absolute path for file to be created.",
"docstring_tokens": [
"(",
"String",
")",
"Absolute",
"path",
"for",
"file",
"... |
726a2efe642c182bc4afb679be04820e5fb6155b | sunlongbo/chromium | tools/vim/tests/chromium.ycm_extra_conf_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SetUpFakeChromeTreeBelowPath | null | def SetUpFakeChromeTreeBelowPath(self):
"""Create fake Chromium source tree under self.test_root.
The fake source tree has the following contents:
<self.test_root>
| .gclient
|
+-- src
| | DEPS
| | three.cc
| |
| +-- .git
|
+-- out
... | Create fake Chromium source tree under self.test_root.
The fake source tree has the following contents:
<self.test_root>
| .gclient
|
+-- src
| | DEPS
| | three.cc
| |
| +-- .git
|
+-- out
|
+-- gn
build.ninja... | Create fake Chromium source tree under self.test_root.
The fake source tree has the following contents.
| [
"Create",
"fake",
"Chromium",
"source",
"tree",
"under",
"self",
".",
"test_root",
".",
"The",
"fake",
"source",
"tree",
"has",
"the",
"following",
"contents",
"."
] | def SetUpFakeChromeTreeBelowPath(self):
self.chrome_root = os.path.abspath(
os.path.normpath(os.path.join(self.test_root, 'src')))
self.out_dir = os.path.join(self.chrome_root, 'out', 'gn')
os.makedirs(self.chrome_root)
os.makedirs(os.path.join(self.chrome_root, '.git'))
os.makedirs(self.out... | [
"def",
"SetUpFakeChromeTreeBelowPath",
"(",
"self",
")",
":",
"self",
".",
"chrome_root",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"test_root",
",",
"'src'",... | Create fake Chromium source tree under self.test_root. | [
"Create",
"fake",
"Chromium",
"source",
"tree",
"under",
"self",
".",
"test_root",
"."
] | [
"\"\"\"Create fake Chromium source tree under self.test_root.\n\n The fake source tree has the following contents:\n\n <self.test_root>\n | .gclient\n |\n +-- src\n | | DEPS\n | | three.cc\n | |\n | +-- .git\n |\n +-- out\n |\n +-- gn\n... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
170961f5e48875cfea5fc3418af4c910595aee0b | sunlongbo/chromium | tools/cygprofile/check_orderfile.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _VerifySymbolOrder | <not_specific> | def _VerifySymbolOrder(orderfile_symbols, symbol_infos, threshold):
"""Verify symbol ordering.
Checks that the non-section symbols in |orderfile_filename| are consistent
with the offsets |symbol_infos|.
Args:
orderfile_symbols: ([str]) list of symbols from orderfile.
symbol_infos: ([SymbolInfo]) symbo... | Verify symbol ordering.
Checks that the non-section symbols in |orderfile_filename| are consistent
with the offsets |symbol_infos|.
Args:
orderfile_symbols: ([str]) list of symbols from orderfile.
symbol_infos: ([SymbolInfo]) symbol infos from binary.
threshold: (int) The number of misordered symbol... | Verify symbol ordering.
Checks that the non-section symbols in |orderfile_filename| are consistent
with the offsets |symbol_infos|. | [
"Verify",
"symbol",
"ordering",
".",
"Checks",
"that",
"the",
"non",
"-",
"section",
"symbols",
"in",
"|orderfile_filename|",
"are",
"consistent",
"with",
"the",
"offsets",
"|symbol_infos|",
"."
] | def _VerifySymbolOrder(orderfile_symbols, symbol_infos, threshold):
last_offset = 0
name_to_offset = {si.name: si.offset for si in symbol_infos}
missing_count = 0
misorder_count = 0
misordered_syms = []
for sym in orderfile_symbols:
if '.' in sym:
continue
if sym not in name_to_offset:
... | [
"def",
"_VerifySymbolOrder",
"(",
"orderfile_symbols",
",",
"symbol_infos",
",",
"threshold",
")",
":",
"last_offset",
"=",
"0",
"name_to_offset",
"=",
"{",
"si",
".",
"name",
":",
"si",
".",
"offset",
"for",
"si",
"in",
"symbol_infos",
"}",
"missing_count",
... | Verify symbol ordering. | [
"Verify",
"symbol",
"ordering",
"."
] | [
"\"\"\"Verify symbol ordering.\n\n Checks that the non-section symbols in |orderfile_filename| are consistent\n with the offsets |symbol_infos|.\n\n Args:\n orderfile_symbols: ([str]) list of symbols from orderfile.\n symbol_infos: ([SymbolInfo]) symbol infos from binary.\n threshold: (int) The number o... | [
{
"param": "orderfile_symbols",
"type": null
},
{
"param": "symbol_infos",
"type": null
},
{
"param": "threshold",
"type": null
}
] | {
"returns": [
{
"docstring": "True iff the ordering is consistent within |threshold|.",
"docstring_tokens": [
"True",
"iff",
"the",
"ordering",
"is",
"consistent",
"within",
"|threshold|",
"."
],
"type": null
}
... |
c19c02680cf01c0c046fb8ce2a0f26ab298d8545 | sunlongbo/chromium | chrome/installer/mac/signing/parts.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | sign_chrome | null | def sign_chrome(paths, config, sign_framework=False):
"""Code signs the Chrome application bundle and all of its internal nested
code parts.
Args:
paths: A |model.Paths| object.
config: The |model.CodeSignConfig| object. The |app_product| binary and
nested binaries must exist in... | Code signs the Chrome application bundle and all of its internal nested
code parts.
Args:
paths: A |model.Paths| object.
config: The |model.CodeSignConfig| object. The |app_product| binary and
nested binaries must exist in |paths.work|.
sign_framework: True if the inner fram... | Code signs the Chrome application bundle and all of its internal nested
code parts. | [
"Code",
"signs",
"the",
"Chrome",
"application",
"bundle",
"and",
"all",
"of",
"its",
"internal",
"nested",
"code",
"parts",
"."
] | def sign_chrome(paths, config, sign_framework=False):
parts = get_parts(config)
_sanity_check_version_keys(paths, parts)
if sign_framework:
for name, part in parts.items():
if name in ('app', 'framework'):
continue
signing.sign_part(paths, config, part)
... | [
"def",
"sign_chrome",
"(",
"paths",
",",
"config",
",",
"sign_framework",
"=",
"False",
")",
":",
"parts",
"=",
"get_parts",
"(",
"config",
")",
"_sanity_check_version_keys",
"(",
"paths",
",",
"parts",
")",
"if",
"sign_framework",
":",
"for",
"name",
",",
... | Code signs the Chrome application bundle and all of its internal nested
code parts. | [
"Code",
"signs",
"the",
"Chrome",
"application",
"bundle",
"and",
"all",
"of",
"its",
"internal",
"nested",
"code",
"parts",
"."
] | [
"\"\"\"Code signs the Chrome application bundle and all of its internal nested\n code parts.\n\n Args:\n paths: A |model.Paths| object.\n config: The |model.CodeSignConfig| object. The |app_product| binary and\n nested binaries must exist in |paths.work|.\n sign_framework: True... | [
{
"param": "paths",
"type": null
},
{
"param": "config",
"type": null
},
{
"param": "sign_framework",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "paths",
"type": null,
"docstring": "A |model.Paths| object.",
"docstring_tokens": [
"A",
"|model",
".",
"Paths|",
"object",
"."
],
"default": null,
"is_optional... |
c19c02680cf01c0c046fb8ce2a0f26ab298d8545 | sunlongbo/chromium | chrome/installer/mac/signing/parts.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _sanity_check_version_keys | <not_specific> | def _sanity_check_version_keys(paths, parts):
"""Verifies that the various version keys in Info.plists match.
Args:
paths: A |model.Paths| object.
parts: The dictionary returned from get_parts().
"""
app_plist_path = os.path.join(paths.work, parts['app'].path, 'Contents',
... | Verifies that the various version keys in Info.plists match.
Args:
paths: A |model.Paths| object.
parts: The dictionary returned from get_parts().
| Verifies that the various version keys in Info.plists match. | [
"Verifies",
"that",
"the",
"various",
"version",
"keys",
"in",
"Info",
".",
"plists",
"match",
"."
] | def _sanity_check_version_keys(paths, parts):
app_plist_path = os.path.join(paths.work, parts['app'].path, 'Contents',
'Info.plist')
framework_plist_path = os.path.join(paths.work, parts['framework'].path,
'Resources', 'Info.plist')
w... | [
"def",
"_sanity_check_version_keys",
"(",
"paths",
",",
"parts",
")",
":",
"app_plist_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"paths",
".",
"work",
",",
"parts",
"[",
"'app'",
"]",
".",
"path",
",",
"'Contents'",
",",
"'Info.plist'",
")",
"frame... | Verifies that the various version keys in Info.plists match. | [
"Verifies",
"that",
"the",
"various",
"version",
"keys",
"in",
"Info",
".",
"plists",
"match",
"."
] | [
"\"\"\"Verifies that the various version keys in Info.plists match.\n\n Args:\n paths: A |model.Paths| object.\n parts: The dictionary returned from get_parts().\n \"\"\""
] | [
{
"param": "paths",
"type": null
},
{
"param": "parts",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "paths",
"type": null,
"docstring": "A |model.Paths| object.",
"docstring_tokens": [
"A",
"|model",
".",
"Paths|",
"object",
"."
],
"default": null,
"is_optional... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ValidatePath | <not_specific> | def ValidatePath(path):
"""An argparse validation method to make sure a file path is writable."""
if os.path.exists(path):
return path
elif os.access(os.path.dirname(path), os.W_OK):
return path
raise argparse.ArgumentTypeError("%s is an invalid file path" % path) | An argparse validation method to make sure a file path is writable. | An argparse validation method to make sure a file path is writable. | [
"An",
"argparse",
"validation",
"method",
"to",
"make",
"sure",
"a",
"file",
"path",
"is",
"writable",
"."
] | def ValidatePath(path):
if os.path.exists(path):
return path
elif os.access(os.path.dirname(path), os.W_OK):
return path
raise argparse.ArgumentTypeError("%s is an invalid file path" % path) | [
"def",
"ValidatePath",
"(",
"path",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"return",
"path",
"elif",
"os",
".",
"access",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
",",
"os",
".",
"W_OK",
")",
"... | An argparse validation method to make sure a file path is writable. | [
"An",
"argparse",
"validation",
"method",
"to",
"make",
"sure",
"a",
"file",
"path",
"is",
"writable",
"."
] | [
"\"\"\"An argparse validation method to make sure a file path is writable.\"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ValidatePdfPath | <not_specific> | def ValidatePdfPath(path):
"""An argparse validation method to make sure a pdf file path is writable.
Validates a file path to make sure it is writable and also appends '.pdf' if
necessary."""
if os.path.splitext(path)[-1].lower() != 'pdf':
path = path + '.pdf'
return Validator.ValidatePath(pa... | An argparse validation method to make sure a pdf file path is writable.
Validates a file path to make sure it is writable and also appends '.pdf' if
necessary. | An argparse validation method to make sure a pdf file path is writable.
Validates a file path to make sure it is writable and also appends '.pdf' if
necessary. | [
"An",
"argparse",
"validation",
"method",
"to",
"make",
"sure",
"a",
"pdf",
"file",
"path",
"is",
"writable",
".",
"Validates",
"a",
"file",
"path",
"to",
"make",
"sure",
"it",
"is",
"writable",
"and",
"also",
"appends",
"'",
".",
"pdf",
"'",
"if",
"ne... | def ValidatePdfPath(path):
if os.path.splitext(path)[-1].lower() != 'pdf':
path = path + '.pdf'
return Validator.ValidatePath(path) | [
"def",
"ValidatePdfPath",
"(",
"path",
")",
":",
"if",
"os",
".",
"path",
".",
"splitext",
"(",
"path",
")",
"[",
"-",
"1",
"]",
".",
"lower",
"(",
")",
"!=",
"'pdf'",
":",
"path",
"=",
"path",
"+",
"'.pdf'",
"return",
"Validator",
".",
"ValidatePa... | An argparse validation method to make sure a pdf file path is writable. | [
"An",
"argparse",
"validation",
"method",
"to",
"make",
"sure",
"a",
"pdf",
"file",
"path",
"is",
"writable",
"."
] | [
"\"\"\"An argparse validation method to make sure a pdf file path is writable.\n Validates a file path to make sure it is writable and also appends '.pdf' if\n necessary.\"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ValidateNonNegativeNumber | <not_specific> | def ValidateNonNegativeNumber(val):
"""An argparse validation method to make sure a number is not negative."""
ival = int(val)
if ival < 0:
raise argparse.ArgumentTypeError("%s is a negative integer" % val)
return ival | An argparse validation method to make sure a number is not negative. | An argparse validation method to make sure a number is not negative. | [
"An",
"argparse",
"validation",
"method",
"to",
"make",
"sure",
"a",
"number",
"is",
"not",
"negative",
"."
] | def ValidateNonNegativeNumber(val):
ival = int(val)
if ival < 0:
raise argparse.ArgumentTypeError("%s is a negative integer" % val)
return ival | [
"def",
"ValidateNonNegativeNumber",
"(",
"val",
")",
":",
"ival",
"=",
"int",
"(",
"val",
")",
"if",
"ival",
"<",
"0",
":",
"raise",
"argparse",
".",
"ArgumentTypeError",
"(",
"\"%s is a negative integer\"",
"%",
"val",
")",
"return",
"ival"
] | An argparse validation method to make sure a number is not negative. | [
"An",
"argparse",
"validation",
"method",
"to",
"make",
"sure",
"a",
"number",
"is",
"not",
"negative",
"."
] | [
"\"\"\"An argparse validation method to make sure a number is not negative.\"\"\""
] | [
{
"param": "val",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "val",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __GetUserIdForProcessName | <not_specific> | def __GetUserIdForProcessName(adb, process_name):
"""Returns the userId of the application associated by |pid| or None if
not found."""
try:
process_name = process_name.split(':')[0]
cmd = ['dumpsys', 'package', process_name]
user_id_lines = adb.RunShellCommand(
cmd, large_output... | Returns the userId of the application associated by |pid| or None if
not found. | Returns the userId of the application associated by |pid| or None if
not found. | [
"Returns",
"the",
"userId",
"of",
"the",
"application",
"associated",
"by",
"|pid|",
"or",
"None",
"if",
"not",
"found",
"."
] | def __GetUserIdForProcessName(adb, process_name):
try:
process_name = process_name.split(':')[0]
cmd = ['dumpsys', 'package', process_name]
user_id_lines = adb.RunShellCommand(
cmd, large_output=True, check_return=True)
user_id_lines = Utils.FindLines(user_id_lines, 'userId=')
... | [
"def",
"__GetUserIdForProcessName",
"(",
"adb",
",",
"process_name",
")",
":",
"try",
":",
"process_name",
"=",
"process_name",
".",
"split",
"(",
"':'",
")",
"[",
"0",
"]",
"cmd",
"=",
"[",
"'dumpsys'",
",",
"'package'",
",",
"process_name",
"]",
"user_id... | Returns the userId of the application associated by |pid| or None if
not found. | [
"Returns",
"the",
"userId",
"of",
"the",
"application",
"associated",
"by",
"|pid|",
"or",
"None",
"if",
"not",
"found",
"."
] | [
"\"\"\"Returns the userId of the application associated by |pid| or None if\n not found.\"\"\""
] | [
{
"param": "adb",
"type": null
},
{
"param": "process_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "adb",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "process_name",
"type": null,
"docstring": null,
"docstring_tok... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetDeviceToTrack | <not_specific> | def GetDeviceToTrack(preset=None):
"""Returns a device serial to connect to. If |preset| is specified it will
return |preset| if it is connected and |None| otherwise. If |preset| is not
specified it will return the first connected device."""
devices = [d.adb.GetDeviceSerial()
for d in d... | Returns a device serial to connect to. If |preset| is specified it will
return |preset| if it is connected and |None| otherwise. If |preset| is not
specified it will return the first connected device. | Returns a device serial to connect to. | [
"Returns",
"a",
"device",
"serial",
"to",
"connect",
"to",
"."
] | def GetDeviceToTrack(preset=None):
devices = [d.adb.GetDeviceSerial()
for d in device_utils.DeviceUtils.HealthyDevices()]
if not devices:
return None
if preset:
return preset if preset in devices else None
return devices[0] | [
"def",
"GetDeviceToTrack",
"(",
"preset",
"=",
"None",
")",
":",
"devices",
"=",
"[",
"d",
".",
"adb",
".",
"GetDeviceSerial",
"(",
")",
"for",
"d",
"in",
"device_utils",
".",
"DeviceUtils",
".",
"HealthyDevices",
"(",
")",
"]",
"if",
"not",
"devices",
... | Returns a device serial to connect to. | [
"Returns",
"a",
"device",
"serial",
"to",
"connect",
"to",
"."
] | [
"\"\"\"Returns a device serial to connect to. If |preset| is specified it will\n return |preset| if it is connected and |None| otherwise. If |preset| is not\n specified it will return the first connected device.\"\"\""
] | [
{
"param": "preset",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "preset",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetPidsToTrack | <not_specific> | def GetPidsToTrack(adb, default_pid=None, process_filter=None):
"""Returns a list of tuples of (userid, pids, process name) based on the
input arguments. If |default_pid| is specified it will return that pid if
it exists. If |process_filter| is specified it will return the pids of
processes with that ... | Returns a list of tuples of (userid, pids, process name) based on the
input arguments. If |default_pid| is specified it will return that pid if
it exists. If |process_filter| is specified it will return the pids of
processes with that string in the name. If both are specified it will
intersect the two... | Returns a list of tuples of (userid, pids, process name) based on the
input arguments. If |default_pid| is specified it will return that pid if
it exists. If |process_filter| is specified it will return the pids of
processes with that string in the name. If both are specified it will
intersect the two. The returned ... | [
"Returns",
"a",
"list",
"of",
"tuples",
"of",
"(",
"userid",
"pids",
"process",
"name",
")",
"based",
"on",
"the",
"input",
"arguments",
".",
"If",
"|default_pid|",
"is",
"specified",
"it",
"will",
"return",
"that",
"pid",
"if",
"it",
"exists",
".",
"If"... | def GetPidsToTrack(adb, default_pid=None, process_filter=None):
pids = []
try:
for process in adb.ListProcesses(process_filter):
if default_pid and process.pid != default_pid:
continue
userid = DeviceHelper.__GetUserIdForProcessName(adb, process.name)
pids.append((userid,... | [
"def",
"GetPidsToTrack",
"(",
"adb",
",",
"default_pid",
"=",
"None",
",",
"process_filter",
"=",
"None",
")",
":",
"pids",
"=",
"[",
"]",
"try",
":",
"for",
"process",
"in",
"adb",
".",
"ListProcesses",
"(",
"process_filter",
")",
":",
"if",
"default_pi... | Returns a list of tuples of (userid, pids, process name) based on the
input arguments. | [
"Returns",
"a",
"list",
"of",
"tuples",
"of",
"(",
"userid",
"pids",
"process",
"name",
")",
"based",
"on",
"the",
"input",
"arguments",
"."
] | [
"\"\"\"Returns a list of tuples of (userid, pids, process name) based on the\n input arguments. If |default_pid| is specified it will return that pid if\n it exists. If |process_filter| is specified it will return the pids of\n processes with that string in the name. If both are specified it will\n in... | [
{
"param": "adb",
"type": null
},
{
"param": "default_pid",
"type": null
},
{
"param": "process_filter",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "adb",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "default_pid",
"type": null,
"docstring": null,
"docstring_toke... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | QueryNetwork | <not_specific> | def QueryNetwork(adb, userid):
"""Queries the device for network information about the application with a
user id of |userid|. It will return a list of values:
[ Download Background, Upload Background, Download Foreground, Upload
Foreground ]. If the application is not found it will return
[ 0, 0,... | Queries the device for network information about the application with a
user id of |userid|. It will return a list of values:
[ Download Background, Upload Background, Download Foreground, Upload
Foreground ]. If the application is not found it will return
[ 0, 0, 0, 0 ]. | Queries the device for network information about the application with a
user id of |userid|. It will return a list of values:
[ Download Background, Upload Background, Download Foreground, Upload
Foreground ]. | [
"Queries",
"the",
"device",
"for",
"network",
"information",
"about",
"the",
"application",
"with",
"a",
"user",
"id",
"of",
"|userid|",
".",
"It",
"will",
"return",
"a",
"list",
"of",
"values",
":",
"[",
"Download",
"Background",
"Upload",
"Background",
"Do... | def QueryNetwork(adb, userid):
results = [0, 0, 0, 0]
if not userid:
return results
try:
userid_idx = 3
bg_or_fg_idx = 4
rx_idx = 5
tx_idx = 7
net_lines = adb.ReadFile('/proc/net/xt_qtaguid/stats').splitlines()
net_lines = Utils.FindLines(net_lines, userid)
fo... | [
"def",
"QueryNetwork",
"(",
"adb",
",",
"userid",
")",
":",
"results",
"=",
"[",
"0",
",",
"0",
",",
"0",
",",
"0",
"]",
"if",
"not",
"userid",
":",
"return",
"results",
"try",
":",
"userid_idx",
"=",
"3",
"bg_or_fg_idx",
"=",
"4",
"rx_idx",
"=",
... | Queries the device for network information about the application with a
user id of |userid|. | [
"Queries",
"the",
"device",
"for",
"network",
"information",
"about",
"the",
"application",
"with",
"a",
"user",
"id",
"of",
"|userid|",
"."
] | [
"\"\"\"Queries the device for network information about the application with a\n user id of |userid|. It will return a list of values:\n [ Download Background, Upload Background, Download Foreground, Upload\n Foreground ]. If the application is not found it will return\n [ 0, 0, 0, 0 ].\"\"\"",
"# P... | [
{
"param": "adb",
"type": null
},
{
"param": "userid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "adb",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "userid",
"type": null,
"docstring": null,
"docstring_tokens": ... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | QueryMemory | <not_specific> | def QueryMemory(adb, pid):
"""Queries the device for memory information about the process with a pid of
|pid|. It will query Native, Dalvik, and Pss memory of the process. It
returns a list of values: [ Native, Pss, Dalvik ]. If the process is not
found it will return [ 0, 0, 0 ]."""
results = [0... | Queries the device for memory information about the process with a pid of
|pid|. It will query Native, Dalvik, and Pss memory of the process. It
returns a list of values: [ Native, Pss, Dalvik ]. If the process is not
found it will return [ 0, 0, 0 ]. | Queries the device for memory information about the process with a pid of
|pid|. It will query Native, Dalvik, and Pss memory of the process. It
returns a list of values: [ Native, Pss, Dalvik ]. If the process is not
found it will return [ 0, 0, 0 ]. | [
"Queries",
"the",
"device",
"for",
"memory",
"information",
"about",
"the",
"process",
"with",
"a",
"pid",
"of",
"|pid|",
".",
"It",
"will",
"query",
"Native",
"Dalvik",
"and",
"Pss",
"memory",
"of",
"the",
"process",
".",
"It",
"returns",
"a",
"list",
"... | def QueryMemory(adb, pid):
results = [0, 0, 0]
mem_lines = adb.RunShellCommand(
['dumpsys', 'meminfo', pid], check_return=True)
for line in mem_lines:
match = re.split('\s+', line.strip())
if len(match) >= 2 and match[0] == 'App' and match[1] == 'Summary':
break
result_idx ... | [
"def",
"QueryMemory",
"(",
"adb",
",",
"pid",
")",
":",
"results",
"=",
"[",
"0",
",",
"0",
",",
"0",
"]",
"mem_lines",
"=",
"adb",
".",
"RunShellCommand",
"(",
"[",
"'dumpsys'",
",",
"'meminfo'",
",",
"pid",
"]",
",",
"check_return",
"=",
"True",
... | Queries the device for memory information about the process with a pid of
|pid|. | [
"Queries",
"the",
"device",
"for",
"memory",
"information",
"about",
"the",
"process",
"with",
"a",
"pid",
"of",
"|pid|",
"."
] | [
"\"\"\"Queries the device for memory information about the process with a pid of\n |pid|. It will query Native, Dalvik, and Pss memory of the process. It\n returns a list of values: [ Native, Pss, Dalvik ]. If the process is not\n found it will return [ 0, 0, 0 ].\"\"\"",
"# Skip data after the 'App S... | [
{
"param": "adb",
"type": null
},
{
"param": "pid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "adb",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pid",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __QueryShowmap | <not_specific> | def __QueryShowmap(adb, pid):
"""Attempts to query graphics memory via the 'showmap' command. It will
look for |self.__SHOWMAP_KEY_MATCHES| entries to try to find one that
represents the graphics memory usage. Will return this as a single entry
array of [ Graphics ]. If not found, will return [ 0 ]."... | Attempts to query graphics memory via the 'showmap' command. It will
look for |self.__SHOWMAP_KEY_MATCHES| entries to try to find one that
represents the graphics memory usage. Will return this as a single entry
array of [ Graphics ]. If not found, will return [ 0 ]. | Attempts to query graphics memory via the 'showmap' command. It will
look for |self.__SHOWMAP_KEY_MATCHES| entries to try to find one that
represents the graphics memory usage. Will return this as a single entry
array of [ Graphics ]. If not found, will return [ 0 ]. | [
"Attempts",
"to",
"query",
"graphics",
"memory",
"via",
"the",
"'",
"showmap",
"'",
"command",
".",
"It",
"will",
"look",
"for",
"|self",
".",
"__SHOWMAP_KEY_MATCHES|",
"entries",
"to",
"try",
"to",
"find",
"one",
"that",
"represents",
"the",
"graphics",
"me... | def __QueryShowmap(adb, pid):
try:
mem_lines = adb.RunShellCommand(['showmap', '-t', pid], check_return=True)
for line in mem_lines:
match = re.split('[ ]+', line.strip())
if match[-1] in GraphicsHelper.__SHOWMAP_KEY_MATCHES:
return [ round(float(match[2]) / 1000.0, 2) ]
ex... | [
"def",
"__QueryShowmap",
"(",
"adb",
",",
"pid",
")",
":",
"try",
":",
"mem_lines",
"=",
"adb",
".",
"RunShellCommand",
"(",
"[",
"'showmap'",
",",
"'-t'",
",",
"pid",
"]",
",",
"check_return",
"=",
"True",
")",
"for",
"line",
"in",
"mem_lines",
":",
... | Attempts to query graphics memory via the 'showmap' command. | [
"Attempts",
"to",
"query",
"graphics",
"memory",
"via",
"the",
"'",
"showmap",
"'",
"command",
"."
] | [
"\"\"\"Attempts to query graphics memory via the 'showmap' command. It will\n look for |self.__SHOWMAP_KEY_MATCHES| entries to try to find one that\n represents the graphics memory usage. Will return this as a single entry\n array of [ Graphics ]. If not found, will return [ 0 ].\"\"\""
] | [
{
"param": "adb",
"type": null
},
{
"param": "pid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "adb",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pid",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __QueryNvMap | <not_specific> | def __QueryNvMap(adb, pid):
"""Attempts to query graphics memory via the NV file map method. It will
find a possible NV Map file from |self.__NvMapPath| and try to parse the
graphics memory from it. Will return this as a single entry array of
[ Graphics ]. If not found, will return [ 0 ]."""
nv_f... | Attempts to query graphics memory via the NV file map method. It will
find a possible NV Map file from |self.__NvMapPath| and try to parse the
graphics memory from it. Will return this as a single entry array of
[ Graphics ]. If not found, will return [ 0 ]. | Attempts to query graphics memory via the NV file map method. It will
find a possible NV Map file from |self.__NvMapPath| and try to parse the
graphics memory from it. Will return this as a single entry array of
[ Graphics ]. If not found, will return [ 0 ]. | [
"Attempts",
"to",
"query",
"graphics",
"memory",
"via",
"the",
"NV",
"file",
"map",
"method",
".",
"It",
"will",
"find",
"a",
"possible",
"NV",
"Map",
"file",
"from",
"|self",
".",
"__NvMapPath|",
"and",
"try",
"to",
"parse",
"the",
"graphics",
"memory",
... | def __QueryNvMap(adb, pid):
nv_file = GraphicsHelper.__NvMapPath(adb)
if nv_file:
mem_lines = adb.ReadFile(nv_file).splitlines()
for line in mem_lines:
match = re.split(' +', line.strip())
if match[2] == pid:
return [ round(float(match[3]) / 1000000.0, 2) ]
return [ 0 ] | [
"def",
"__QueryNvMap",
"(",
"adb",
",",
"pid",
")",
":",
"nv_file",
"=",
"GraphicsHelper",
".",
"__NvMapPath",
"(",
"adb",
")",
"if",
"nv_file",
":",
"mem_lines",
"=",
"adb",
".",
"ReadFile",
"(",
"nv_file",
")",
".",
"splitlines",
"(",
")",
"for",
"li... | Attempts to query graphics memory via the NV file map method. | [
"Attempts",
"to",
"query",
"graphics",
"memory",
"via",
"the",
"NV",
"file",
"map",
"method",
"."
] | [
"\"\"\"Attempts to query graphics memory via the NV file map method. It will\n find a possible NV Map file from |self.__NvMapPath| and try to parse the\n graphics memory from it. Will return this as a single entry array of\n [ Graphics ]. If not found, will return [ 0 ].\"\"\""
] | [
{
"param": "adb",
"type": null
},
{
"param": "pid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "adb",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pid",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | QueryVideoMemory | <not_specific> | def QueryVideoMemory(adb, pid):
"""Queries the device for graphics memory information about the process with
a pid of |pid|. Not all devices are currently supported. If possible, this
will return a single entry array of [ Graphics ]. Otherwise it will return
[ 0 ].
Please see |self.__NV_MAP_MODE... | Queries the device for graphics memory information about the process with
a pid of |pid|. Not all devices are currently supported. If possible, this
will return a single entry array of [ Graphics ]. Otherwise it will return
[ 0 ].
Please see |self.__NV_MAP_MODELS| and |self.__SHOWMAP_MODELS|
to ... | Queries the device for graphics memory information about the process with
a pid of |pid|. Not all devices are currently supported. If possible, this
will return a single entry array of [ Graphics ]. Otherwise it will return
[ 0 ].
Please see |self.__NV_MAP_MODELS| and |self.__SHOWMAP_MODELS|
to see if the device is... | [
"Queries",
"the",
"device",
"for",
"graphics",
"memory",
"information",
"about",
"the",
"process",
"with",
"a",
"pid",
"of",
"|pid|",
".",
"Not",
"all",
"devices",
"are",
"currently",
"supported",
".",
"If",
"possible",
"this",
"will",
"return",
"a",
"single... | def QueryVideoMemory(adb, pid):
model = DeviceHelper.GetDeviceModel(adb)
if model in GraphicsHelper.__NV_MAP_MODELS:
return GraphicsHelper.__QueryNvMap(adb, pid)
elif model in GraphicsHelper.__SHOWMAP_MODELS:
return GraphicsHelper.__QueryShowmap(adb, pid)
return [ 0 ] | [
"def",
"QueryVideoMemory",
"(",
"adb",
",",
"pid",
")",
":",
"model",
"=",
"DeviceHelper",
".",
"GetDeviceModel",
"(",
"adb",
")",
"if",
"model",
"in",
"GraphicsHelper",
".",
"__NV_MAP_MODELS",
":",
"return",
"GraphicsHelper",
".",
"__QueryNvMap",
"(",
"adb",
... | Queries the device for graphics memory information about the process with
a pid of |pid|. | [
"Queries",
"the",
"device",
"for",
"graphics",
"memory",
"information",
"about",
"the",
"process",
"with",
"a",
"pid",
"of",
"|pid|",
"."
] | [
"\"\"\"Queries the device for graphics memory information about the process with\n a pid of |pid|. Not all devices are currently supported. If possible, this\n will return a single entry array of [ Graphics ]. Otherwise it will return\n [ 0 ].\n\n Please see |self.__NV_MAP_MODELS| and |self.__SHOWMAP... | [
{
"param": "adb",
"type": null
},
{
"param": "pid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "adb",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pid",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetNameForPid | <not_specific> | def GetNameForPid(self, search_pid):
"""Returns the process name of a tracked |search_pid|. This only works if
|search_pid| is tracked by this snapshot."""
for (userid, pid, name) in self.pids:
if pid == search_pid:
return name
return None | Returns the process name of a tracked |search_pid|. This only works if
|search_pid| is tracked by this snapshot. | Returns the process name of a tracked |search_pid|. This only works if
|search_pid| is tracked by this snapshot. | [
"Returns",
"the",
"process",
"name",
"of",
"a",
"tracked",
"|search_pid|",
".",
"This",
"only",
"works",
"if",
"|search_pid|",
"is",
"tracked",
"by",
"this",
"snapshot",
"."
] | def GetNameForPid(self, search_pid):
for (userid, pid, name) in self.pids:
if pid == search_pid:
return name
return None | [
"def",
"GetNameForPid",
"(",
"self",
",",
"search_pid",
")",
":",
"for",
"(",
"userid",
",",
"pid",
",",
"name",
")",
"in",
"self",
".",
"pids",
":",
"if",
"pid",
"==",
"search_pid",
":",
"return",
"name",
"return",
"None"
] | Returns the process name of a tracked |search_pid|. | [
"Returns",
"the",
"process",
"name",
"of",
"a",
"tracked",
"|search_pid|",
"."
] | [
"\"\"\"Returns the process name of a tracked |search_pid|. This only works if\n |search_pid| is tracked by this snapshot.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "search_pid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "search_pid",
"type": null,
"docstring": null,
"docstring_toke... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetUserIdForPid | <not_specific> | def GetUserIdForPid(self, search_pid):
"""Returns the application userId for an associated |pid|. This only works
if |search_pid| is tracked by this snapshot and the application userId is
queryable."""
for (userid, pid, name) in self.pids:
if pid == search_pid:
return userid
return No... | Returns the application userId for an associated |pid|. This only works
if |search_pid| is tracked by this snapshot and the application userId is
queryable. | Returns the application userId for an associated |pid|. This only works
if |search_pid| is tracked by this snapshot and the application userId is
queryable. | [
"Returns",
"the",
"application",
"userId",
"for",
"an",
"associated",
"|pid|",
".",
"This",
"only",
"works",
"if",
"|search_pid|",
"is",
"tracked",
"by",
"this",
"snapshot",
"and",
"the",
"application",
"userId",
"is",
"queryable",
"."
] | def GetUserIdForPid(self, search_pid):
for (userid, pid, name) in self.pids:
if pid == search_pid:
return userid
return None | [
"def",
"GetUserIdForPid",
"(",
"self",
",",
"search_pid",
")",
":",
"for",
"(",
"userid",
",",
"pid",
",",
"name",
")",
"in",
"self",
".",
"pids",
":",
"if",
"pid",
"==",
"search_pid",
":",
"return",
"userid",
"return",
"None"
] | Returns the application userId for an associated |pid|. | [
"Returns",
"the",
"application",
"userId",
"for",
"an",
"associated",
"|pid|",
"."
] | [
"\"\"\"Returns the application userId for an associated |pid|. This only works\n if |search_pid| is tracked by this snapshot and the application userId is\n queryable.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "search_pid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "search_pid",
"type": null,
"docstring": null,
"docstring_toke... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | IsFirstPidForUserId | <not_specific> | def IsFirstPidForUserId(self, search_pid):
"""Returns whether or not |search_pid| is the first pid in the |pids| with
the associated application userId. This is used to determine if network
statistics should be shown for this pid or if they have already been shown
for a pid associated with this applica... | Returns whether or not |search_pid| is the first pid in the |pids| with
the associated application userId. This is used to determine if network
statistics should be shown for this pid or if they have already been shown
for a pid associated with this application. | Returns whether or not |search_pid| is the first pid in the |pids| with
the associated application userId. This is used to determine if network
statistics should be shown for this pid or if they have already been shown
for a pid associated with this application. | [
"Returns",
"whether",
"or",
"not",
"|search_pid|",
"is",
"the",
"first",
"pid",
"in",
"the",
"|pids|",
"with",
"the",
"associated",
"application",
"userId",
".",
"This",
"is",
"used",
"to",
"determine",
"if",
"network",
"statistics",
"should",
"be",
"shown",
... | def IsFirstPidForUserId(self, search_pid):
prev_userid = None
for idx, (userid, pid, name) in enumerate(self.pids):
if pid == search_pid:
return prev_userid != userid
prev_userid = userid
return False | [
"def",
"IsFirstPidForUserId",
"(",
"self",
",",
"search_pid",
")",
":",
"prev_userid",
"=",
"None",
"for",
"idx",
",",
"(",
"userid",
",",
"pid",
",",
"name",
")",
"in",
"enumerate",
"(",
"self",
".",
"pids",
")",
":",
"if",
"pid",
"==",
"search_pid",
... | Returns whether or not |search_pid| is the first pid in the |pids| with
the associated application userId. | [
"Returns",
"whether",
"or",
"not",
"|search_pid|",
"is",
"the",
"first",
"pid",
"in",
"the",
"|pids|",
"with",
"the",
"associated",
"application",
"userId",
"."
] | [
"\"\"\"Returns whether or not |search_pid| is the first pid in the |pids| with\n the associated application userId. This is used to determine if network\n statistics should be shown for this pid or if they have already been shown\n for a pid associated with this application.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "search_pid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "search_pid",
"type": null,
"docstring": null,
"docstring_toke... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetMemoryResults | <not_specific> | def GetMemoryResults(self, pid):
"""Returns a list of entries about the memory usage of the process specified
by |pid|. This will be of the format [ Native, Pss, Dalvik, Graphics ]."""
if pid in self.memory:
return self.memory[pid]
return None | Returns a list of entries about the memory usage of the process specified
by |pid|. This will be of the format [ Native, Pss, Dalvik, Graphics ]. | Returns a list of entries about the memory usage of the process specified
by |pid|. This will be of the format [ Native, Pss, Dalvik, Graphics ]. | [
"Returns",
"a",
"list",
"of",
"entries",
"about",
"the",
"memory",
"usage",
"of",
"the",
"process",
"specified",
"by",
"|pid|",
".",
"This",
"will",
"be",
"of",
"the",
"format",
"[",
"Native",
"Pss",
"Dalvik",
"Graphics",
"]",
"."
] | def GetMemoryResults(self, pid):
if pid in self.memory:
return self.memory[pid]
return None | [
"def",
"GetMemoryResults",
"(",
"self",
",",
"pid",
")",
":",
"if",
"pid",
"in",
"self",
".",
"memory",
":",
"return",
"self",
".",
"memory",
"[",
"pid",
"]",
"return",
"None"
] | Returns a list of entries about the memory usage of the process specified
by |pid|. | [
"Returns",
"a",
"list",
"of",
"entries",
"about",
"the",
"memory",
"usage",
"of",
"the",
"process",
"specified",
"by",
"|pid|",
"."
] | [
"\"\"\"Returns a list of entries about the memory usage of the process specified\n by |pid|. This will be of the format [ Native, Pss, Dalvik, Graphics ].\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "pid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pid",
"type": null,
"docstring": null,
"docstring_tokens": []... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetNetworkResults | <not_specific> | def GetNetworkResults(self, userid):
"""Returns a list of entries about the network usage of the application
specified by |userid|. This will be of the format [ Download Background,
Upload Background, Download Foreground, Upload Foreground ]."""
if userid in self.network:
return self.network[user... | Returns a list of entries about the network usage of the application
specified by |userid|. This will be of the format [ Download Background,
Upload Background, Download Foreground, Upload Foreground ]. | Returns a list of entries about the network usage of the application
specified by |userid|. This will be of the format [ Download Background,
Upload Background, Download Foreground, Upload Foreground ]. | [
"Returns",
"a",
"list",
"of",
"entries",
"about",
"the",
"network",
"usage",
"of",
"the",
"application",
"specified",
"by",
"|userid|",
".",
"This",
"will",
"be",
"of",
"the",
"format",
"[",
"Download",
"Background",
"Upload",
"Background",
"Download",
"Foregr... | def GetNetworkResults(self, userid):
if userid in self.network:
return self.network[userid]
return None | [
"def",
"GetNetworkResults",
"(",
"self",
",",
"userid",
")",
":",
"if",
"userid",
"in",
"self",
".",
"network",
":",
"return",
"self",
".",
"network",
"[",
"userid",
"]",
"return",
"None"
] | Returns a list of entries about the network usage of the application
specified by |userid|. | [
"Returns",
"a",
"list",
"of",
"entries",
"about",
"the",
"network",
"usage",
"of",
"the",
"application",
"specified",
"by",
"|userid|",
"."
] | [
"\"\"\"Returns a list of entries about the network usage of the application\n specified by |userid|. This will be of the format [ Download Background,\n Upload Background, Download Foreground, Upload Foreground ].\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "userid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "userid",
"type": null,
"docstring": null,
"docstring_tokens":... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __FindPidsForSnapshotList | <not_specific> | def __FindPidsForSnapshotList(snapshots):
"""Find the set of unique pids across all every snapshot in |snapshots|."""
pids = set()
for snapshot in snapshots:
for (userid, pid, name) in snapshot.GetPidInfo():
pids.add((userid, pid, name))
return pids | Find the set of unique pids across all every snapshot in |snapshots|. | Find the set of unique pids across all every snapshot in |snapshots|. | [
"Find",
"the",
"set",
"of",
"unique",
"pids",
"across",
"all",
"every",
"snapshot",
"in",
"|snapshots|",
"."
] | def __FindPidsForSnapshotList(snapshots):
pids = set()
for snapshot in snapshots:
for (userid, pid, name) in snapshot.GetPidInfo():
pids.add((userid, pid, name))
return pids | [
"def",
"__FindPidsForSnapshotList",
"(",
"snapshots",
")",
":",
"pids",
"=",
"set",
"(",
")",
"for",
"snapshot",
"in",
"snapshots",
":",
"for",
"(",
"userid",
",",
"pid",
",",
"name",
")",
"in",
"snapshot",
".",
"GetPidInfo",
"(",
")",
":",
"pids",
"."... | Find the set of unique pids across all every snapshot in |snapshots|. | [
"Find",
"the",
"set",
"of",
"unique",
"pids",
"across",
"all",
"every",
"snapshot",
"in",
"|snapshots|",
"."
] | [
"\"\"\"Find the set of unique pids across all every snapshot in |snapshots|.\"\"\""
] | [
{
"param": "snapshots",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "snapshots",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __PadString | <not_specific> | def __PadString(string, length, left_align):
"""Pads |string| to at least |length| with spaces. Depending on
|left_align| the padding will appear at either the left or the right of the
original string."""
return (('%' if left_align else '%-') + str(length) + 's') % string | Pads |string| to at least |length| with spaces. Depending on
|left_align| the padding will appear at either the left or the right of the
original string. | Pads |string| to at least |length| with spaces. Depending on
|left_align| the padding will appear at either the left or the right of the
original string. | [
"Pads",
"|string|",
"to",
"at",
"least",
"|length|",
"with",
"spaces",
".",
"Depending",
"on",
"|left_align|",
"the",
"padding",
"will",
"appear",
"at",
"either",
"the",
"left",
"or",
"the",
"right",
"of",
"the",
"original",
"string",
"."
] | def __PadString(string, length, left_align):
return (('%' if left_align else '%-') + str(length) + 's') % string | [
"def",
"__PadString",
"(",
"string",
",",
"length",
",",
"left_align",
")",
":",
"return",
"(",
"(",
"'%'",
"if",
"left_align",
"else",
"'%-'",
")",
"+",
"str",
"(",
"length",
")",
"+",
"'s'",
")",
"%",
"string"
] | Pads |string| to at least |length| with spaces. | [
"Pads",
"|string|",
"to",
"at",
"least",
"|length|",
"with",
"spaces",
"."
] | [
"\"\"\"Pads |string| to at least |length| with spaces. Depending on\n |left_align| the padding will appear at either the left or the right of the\n original string.\"\"\""
] | [
{
"param": "string",
"type": null
},
{
"param": "length",
"type": null
},
{
"param": "left_align",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "string",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "length",
"type": null,
"docstring": null,
"docstring_tokens... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __GetDiffColor | <not_specific> | def __GetDiffColor(delta):
"""Returns a color based on |delta|. Used to color the deltas between
different snapshots."""
if not delta or delta == 0.0:
return 'GREY30'
elif delta < 0:
return 'GREEN'
elif delta > 0:
return 'RED' | Returns a color based on |delta|. Used to color the deltas between
different snapshots. | Returns a color based on |delta|. Used to color the deltas between
different snapshots. | [
"Returns",
"a",
"color",
"based",
"on",
"|delta|",
".",
"Used",
"to",
"color",
"the",
"deltas",
"between",
"different",
"snapshots",
"."
] | def __GetDiffColor(delta):
if not delta or delta == 0.0:
return 'GREY30'
elif delta < 0:
return 'GREEN'
elif delta > 0:
return 'RED' | [
"def",
"__GetDiffColor",
"(",
"delta",
")",
":",
"if",
"not",
"delta",
"or",
"delta",
"==",
"0.0",
":",
"return",
"'GREY30'",
"elif",
"delta",
"<",
"0",
":",
"return",
"'GREEN'",
"elif",
"delta",
">",
"0",
":",
"return",
"'RED'"
] | Returns a color based on |delta|. | [
"Returns",
"a",
"color",
"based",
"on",
"|delta|",
"."
] | [
"\"\"\"Returns a color based on |delta|. Used to color the deltas between\n different snapshots.\"\"\""
] | [
{
"param": "delta",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "delta",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __PadAndColor | <not_specific> | def __PadAndColor(self, string, length, left_align, color):
"""A helper method to both pad and color the string. See
|self.__ColorString| and |self.__PadString|."""
return self.__ColorString(
self.__PadString(string, length, left_align), color) | A helper method to both pad and color the string. See
|self.__ColorString| and |self.__PadString|. | A helper method to both pad and color the string. | [
"A",
"helper",
"method",
"to",
"both",
"pad",
"and",
"color",
"the",
"string",
"."
] | def __PadAndColor(self, string, length, left_align, color):
return self.__ColorString(
self.__PadString(string, length, left_align), color) | [
"def",
"__PadAndColor",
"(",
"self",
",",
"string",
",",
"length",
",",
"left_align",
",",
"color",
")",
":",
"return",
"self",
".",
"__ColorString",
"(",
"self",
".",
"__PadString",
"(",
"string",
",",
"length",
",",
"left_align",
")",
",",
"color",
")"... | A helper method to both pad and color the string. | [
"A",
"helper",
"method",
"to",
"both",
"pad",
"and",
"color",
"the",
"string",
"."
] | [
"\"\"\"A helper method to both pad and color the string. See\n |self.__ColorString| and |self.__PadString|.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "string",
"type": null
},
{
"param": "length",
"type": null
},
{
"param": "left_align",
"type": null
},
{
"param": "color",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "string",
"type": null,
"docstring": null,
"docstring_tokens":... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __OutputLine | null | def __OutputLine(self, line):
"""Writes a line to the screen. This also tracks how many times this method
was called so that the screen can be cleared properly if |self.overwrite| is
|True|."""
sys.stdout.write(line + '\n')
if self.overwrite:
self.lines_printed += 1 | Writes a line to the screen. This also tracks how many times this method
was called so that the screen can be cleared properly if |self.overwrite| is
|True|. | Writes a line to the screen. This also tracks how many times this method
was called so that the screen can be cleared properly if |self.overwrite| is
|True|. | [
"Writes",
"a",
"line",
"to",
"the",
"screen",
".",
"This",
"also",
"tracks",
"how",
"many",
"times",
"this",
"method",
"was",
"called",
"so",
"that",
"the",
"screen",
"can",
"be",
"cleared",
"properly",
"if",
"|self",
".",
"overwrite|",
"is",
"|True|",
"... | def __OutputLine(self, line):
sys.stdout.write(line + '\n')
if self.overwrite:
self.lines_printed += 1 | [
"def",
"__OutputLine",
"(",
"self",
",",
"line",
")",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"line",
"+",
"'\\n'",
")",
"if",
"self",
".",
"overwrite",
":",
"self",
".",
"lines_printed",
"+=",
"1"
] | Writes a line to the screen. | [
"Writes",
"a",
"line",
"to",
"the",
"screen",
"."
] | [
"\"\"\"Writes a line to the screen. This also tracks how many times this method\n was called so that the screen can be cleared properly if |self.overwrite| is\n |True|.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "line",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "line",
"type": null,
"docstring": null,
"docstring_tokens": [... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __PrintPidLabelHeader | <not_specific> | def __PrintPidLabelHeader(self, snapshot):
"""Returns a header string with columns Pid and Name."""
if not snapshot or not snapshot.HasResults():
return
name_length = max(8, snapshot.GetLongestNameLength())
header = self.__PadString('Pid', 8, True) + ' '
header += self.__PadString('Name', na... | Returns a header string with columns Pid and Name. | Returns a header string with columns Pid and Name. | [
"Returns",
"a",
"header",
"string",
"with",
"columns",
"Pid",
"and",
"Name",
"."
] | def __PrintPidLabelHeader(self, snapshot):
if not snapshot or not snapshot.HasResults():
return
name_length = max(8, snapshot.GetLongestNameLength())
header = self.__PadString('Pid', 8, True) + ' '
header += self.__PadString('Name', name_length, False)
header = self.__ColorString(header, 'BOLD... | [
"def",
"__PrintPidLabelHeader",
"(",
"self",
",",
"snapshot",
")",
":",
"if",
"not",
"snapshot",
"or",
"not",
"snapshot",
".",
"HasResults",
"(",
")",
":",
"return",
"name_length",
"=",
"max",
"(",
"8",
",",
"snapshot",
".",
"GetLongestNameLength",
"(",
")... | Returns a header string with columns Pid and Name. | [
"Returns",
"a",
"header",
"string",
"with",
"columns",
"Pid",
"and",
"Name",
"."
] | [
"\"\"\"Returns a header string with columns Pid and Name.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "snapshot",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "snapshot",
"type": null,
"docstring": null,
"docstring_tokens... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __PrintTimestampHeader | <not_specific> | def __PrintTimestampHeader(self):
"""Returns a header string with a Timestamp column."""
header = self.__PadString('Timestamp', 8, False)
header = self.__ColorString(header, 'BOLD')
return header | Returns a header string with a Timestamp column. | Returns a header string with a Timestamp column. | [
"Returns",
"a",
"header",
"string",
"with",
"a",
"Timestamp",
"column",
"."
] | def __PrintTimestampHeader(self):
header = self.__PadString('Timestamp', 8, False)
header = self.__ColorString(header, 'BOLD')
return header | [
"def",
"__PrintTimestampHeader",
"(",
"self",
")",
":",
"header",
"=",
"self",
".",
"__PadString",
"(",
"'Timestamp'",
",",
"8",
",",
"False",
")",
"header",
"=",
"self",
".",
"__ColorString",
"(",
"header",
",",
"'BOLD'",
")",
"return",
"header"
] | Returns a header string with a Timestamp column. | [
"Returns",
"a",
"header",
"string",
"with",
"a",
"Timestamp",
"column",
"."
] | [
"\"\"\"Returns a header string with a Timestamp column.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __PrintMemoryStatsHeader | <not_specific> | def __PrintMemoryStatsHeader(self):
"""Returns a header string for memory usage statistics."""
headers = ''
for header in self.__MEMORY_COLUMN_TITLES:
headers += self.__PadString(header, 8, True) + ' '
headers += self.__PadString('(mB)', 8, False)
return self.__ColorString(headers, 'BOLD') | Returns a header string for memory usage statistics. | Returns a header string for memory usage statistics. | [
"Returns",
"a",
"header",
"string",
"for",
"memory",
"usage",
"statistics",
"."
] | def __PrintMemoryStatsHeader(self):
headers = ''
for header in self.__MEMORY_COLUMN_TITLES:
headers += self.__PadString(header, 8, True) + ' '
headers += self.__PadString('(mB)', 8, False)
return self.__ColorString(headers, 'BOLD') | [
"def",
"__PrintMemoryStatsHeader",
"(",
"self",
")",
":",
"headers",
"=",
"''",
"for",
"header",
"in",
"self",
".",
"__MEMORY_COLUMN_TITLES",
":",
"headers",
"+=",
"self",
".",
"__PadString",
"(",
"header",
",",
"8",
",",
"True",
")",
"+",
"' '",
"headers"... | Returns a header string for memory usage statistics. | [
"Returns",
"a",
"header",
"string",
"for",
"memory",
"usage",
"statistics",
"."
] | [
"\"\"\"Returns a header string for memory usage statistics.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __PrintNetworkStatsHeader | <not_specific> | def __PrintNetworkStatsHeader(self):
"""Returns a header string for network usage statistics."""
headers = ''
for header in self.__NETWORK_COLUMN_TITLES:
headers += self.__PadString(header, 8, True) + ' '
headers += self.__PadString('(kB)', 8, False)
return self.__ColorString(headers, 'BOLD'... | Returns a header string for network usage statistics. | Returns a header string for network usage statistics. | [
"Returns",
"a",
"header",
"string",
"for",
"network",
"usage",
"statistics",
"."
] | def __PrintNetworkStatsHeader(self):
headers = ''
for header in self.__NETWORK_COLUMN_TITLES:
headers += self.__PadString(header, 8, True) + ' '
headers += self.__PadString('(kB)', 8, False)
return self.__ColorString(headers, 'BOLD') | [
"def",
"__PrintNetworkStatsHeader",
"(",
"self",
")",
":",
"headers",
"=",
"''",
"for",
"header",
"in",
"self",
".",
"__NETWORK_COLUMN_TITLES",
":",
"headers",
"+=",
"self",
".",
"__PadString",
"(",
"header",
",",
"8",
",",
"True",
")",
"+",
"' '",
"header... | Returns a header string for network usage statistics. | [
"Returns",
"a",
"header",
"string",
"for",
"network",
"usage",
"statistics",
"."
] | [
"\"\"\"Returns a header string for network usage statistics.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __PrintTrailingHeader | <not_specific> | def __PrintTrailingHeader(self, snapshot):
"""Returns a header string for the header trailer (includes timestamp)."""
if not snapshot or not snapshot.HasResults():
return
header = '(' + str(round(snapshot.GetTimestamp(), 2)) + 's)'
return self.__ColorString(header, 'BOLD') | Returns a header string for the header trailer (includes timestamp). | Returns a header string for the header trailer (includes timestamp). | [
"Returns",
"a",
"header",
"string",
"for",
"the",
"header",
"trailer",
"(",
"includes",
"timestamp",
")",
"."
] | def __PrintTrailingHeader(self, snapshot):
if not snapshot or not snapshot.HasResults():
return
header = '(' + str(round(snapshot.GetTimestamp(), 2)) + 's)'
return self.__ColorString(header, 'BOLD') | [
"def",
"__PrintTrailingHeader",
"(",
"self",
",",
"snapshot",
")",
":",
"if",
"not",
"snapshot",
"or",
"not",
"snapshot",
".",
"HasResults",
"(",
")",
":",
"return",
"header",
"=",
"'('",
"+",
"str",
"(",
"round",
"(",
"snapshot",
".",
"GetTimestamp",
"(... | Returns a header string for the header trailer (includes timestamp). | [
"Returns",
"a",
"header",
"string",
"for",
"the",
"header",
"trailer",
"(",
"includes",
"timestamp",
")",
"."
] | [
"\"\"\"Returns a header string for the header trailer (includes timestamp).\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "snapshot",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "snapshot",
"type": null,
"docstring": null,
"docstring_tokens... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __PrintArrayWithDeltas | <not_specific> | def __PrintArrayWithDeltas(self, results, old_results, precision=2):
"""Helper method to return a string of statistics with their deltas. This
takes two arrays and prints out "current (current - old)" for all entries in
the arrays."""
if not results:
return
deltas = [0] * len(results)
if ... | Helper method to return a string of statistics with their deltas. This
takes two arrays and prints out "current (current - old)" for all entries in
the arrays. | Helper method to return a string of statistics with their deltas. This
takes two arrays and prints out "current (current - old)" for all entries in
the arrays. | [
"Helper",
"method",
"to",
"return",
"a",
"string",
"of",
"statistics",
"with",
"their",
"deltas",
".",
"This",
"takes",
"two",
"arrays",
"and",
"prints",
"out",
"\"",
"current",
"(",
"current",
"-",
"old",
")",
"\"",
"for",
"all",
"entries",
"in",
"the",... | def __PrintArrayWithDeltas(self, results, old_results, precision=2):
if not results:
return
deltas = [0] * len(results)
if old_results:
assert len(old_results) == len(results)
deltas = list(map(sub, results, old_results))
output = ''
for idx, val in enumerate(results):
round_... | [
"def",
"__PrintArrayWithDeltas",
"(",
"self",
",",
"results",
",",
"old_results",
",",
"precision",
"=",
"2",
")",
":",
"if",
"not",
"results",
":",
"return",
"deltas",
"=",
"[",
"0",
"]",
"*",
"len",
"(",
"results",
")",
"if",
"old_results",
":",
"ass... | Helper method to return a string of statistics with their deltas. | [
"Helper",
"method",
"to",
"return",
"a",
"string",
"of",
"statistics",
"with",
"their",
"deltas",
"."
] | [
"\"\"\"Helper method to return a string of statistics with their deltas. This\n takes two arrays and prints out \"current (current - old)\" for all entries in\n the arrays.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "results",
"type": null
},
{
"param": "old_results",
"type": null
},
{
"param": "precision",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "results",
"type": null,
"docstring": null,
"docstring_tokens"... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __PrintPidLabelStats | <not_specific> | def __PrintPidLabelStats(self, pid, snapshot):
"""Returns a string that includes the columns pid and process name for
the specified |pid|. This lines up with the associated header."""
if not snapshot or not snapshot.HasResults():
return
name_length = max(8, snapshot.GetLongestNameLength())
n... | Returns a string that includes the columns pid and process name for
the specified |pid|. This lines up with the associated header. | Returns a string that includes the columns pid and process name for
the specified |pid|. This lines up with the associated header. | [
"Returns",
"a",
"string",
"that",
"includes",
"the",
"columns",
"pid",
"and",
"process",
"name",
"for",
"the",
"specified",
"|pid|",
".",
"This",
"lines",
"up",
"with",
"the",
"associated",
"header",
"."
] | def __PrintPidLabelStats(self, pid, snapshot):
if not snapshot or not snapshot.HasResults():
return
name_length = max(8, snapshot.GetLongestNameLength())
name = snapshot.GetNameForPid(pid)
output = self.__PadAndColor(pid, 8, True, 'DARK_YELLOW') + ' '
output += self.__PadAndColor(name, name_le... | [
"def",
"__PrintPidLabelStats",
"(",
"self",
",",
"pid",
",",
"snapshot",
")",
":",
"if",
"not",
"snapshot",
"or",
"not",
"snapshot",
".",
"HasResults",
"(",
")",
":",
"return",
"name_length",
"=",
"max",
"(",
"8",
",",
"snapshot",
".",
"GetLongestNameLengt... | Returns a string that includes the columns pid and process name for
the specified |pid|. | [
"Returns",
"a",
"string",
"that",
"includes",
"the",
"columns",
"pid",
"and",
"process",
"name",
"for",
"the",
"specified",
"|pid|",
"."
] | [
"\"\"\"Returns a string that includes the columns pid and process name for\n the specified |pid|. This lines up with the associated header.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "pid",
"type": null
},
{
"param": "snapshot",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pid",
"type": null,
"docstring": null,
"docstring_tokens": []... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __PrintTimestampStats | <not_specific> | def __PrintTimestampStats(self, snapshot):
"""Returns a string that includes the timestamp of the |snapshot|. This
lines up with the associated header."""
if not snapshot or not snapshot.HasResults():
return
timestamp_length = max(8, len("Timestamp"))
timestamp = round(snapshot.GetTimestamp(... | Returns a string that includes the timestamp of the |snapshot|. This
lines up with the associated header. | Returns a string that includes the timestamp of the |snapshot|. This
lines up with the associated header. | [
"Returns",
"a",
"string",
"that",
"includes",
"the",
"timestamp",
"of",
"the",
"|snapshot|",
".",
"This",
"lines",
"up",
"with",
"the",
"associated",
"header",
"."
] | def __PrintTimestampStats(self, snapshot):
if not snapshot or not snapshot.HasResults():
return
timestamp_length = max(8, len("Timestamp"))
timestamp = round(snapshot.GetTimestamp(), 2)
output = self.__PadString(str(timestamp), timestamp_length, True)
return output | [
"def",
"__PrintTimestampStats",
"(",
"self",
",",
"snapshot",
")",
":",
"if",
"not",
"snapshot",
"or",
"not",
"snapshot",
".",
"HasResults",
"(",
")",
":",
"return",
"timestamp_length",
"=",
"max",
"(",
"8",
",",
"len",
"(",
"\"Timestamp\"",
")",
")",
"t... | Returns a string that includes the timestamp of the |snapshot|. | [
"Returns",
"a",
"string",
"that",
"includes",
"the",
"timestamp",
"of",
"the",
"|snapshot|",
"."
] | [
"\"\"\"Returns a string that includes the timestamp of the |snapshot|. This\n lines up with the associated header.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "snapshot",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "snapshot",
"type": null,
"docstring": null,
"docstring_tokens... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __PrintMemoryStats | <not_specific> | def __PrintMemoryStats(self, pid, snapshot, prev_snapshot):
"""Returns a string that includes memory statistics of the |snapshot|. This
lines up with the associated header."""
if not snapshot or not snapshot.HasResults():
return
results = snapshot.GetMemoryResults(pid)
if not results:
... | Returns a string that includes memory statistics of the |snapshot|. This
lines up with the associated header. | Returns a string that includes memory statistics of the |snapshot|. This
lines up with the associated header. | [
"Returns",
"a",
"string",
"that",
"includes",
"memory",
"statistics",
"of",
"the",
"|snapshot|",
".",
"This",
"lines",
"up",
"with",
"the",
"associated",
"header",
"."
] | def __PrintMemoryStats(self, pid, snapshot, prev_snapshot):
if not snapshot or not snapshot.HasResults():
return
results = snapshot.GetMemoryResults(pid)
if not results:
return
old_results = prev_snapshot.GetMemoryResults(pid) if prev_snapshot else None
return self.__PrintArrayWithDeltas... | [
"def",
"__PrintMemoryStats",
"(",
"self",
",",
"pid",
",",
"snapshot",
",",
"prev_snapshot",
")",
":",
"if",
"not",
"snapshot",
"or",
"not",
"snapshot",
".",
"HasResults",
"(",
")",
":",
"return",
"results",
"=",
"snapshot",
".",
"GetMemoryResults",
"(",
"... | Returns a string that includes memory statistics of the |snapshot|. | [
"Returns",
"a",
"string",
"that",
"includes",
"memory",
"statistics",
"of",
"the",
"|snapshot|",
"."
] | [
"\"\"\"Returns a string that includes memory statistics of the |snapshot|. This\n lines up with the associated header.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "pid",
"type": null
},
{
"param": "snapshot",
"type": null
},
{
"param": "prev_snapshot",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pid",
"type": null,
"docstring": null,
"docstring_tokens": []... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __PrintNetworkStats | <not_specific> | def __PrintNetworkStats(self, userid, snapshot, prev_snapshot):
"""Returns a string that includes network statistics of the |snapshot|. This
lines up with the associated header."""
if not snapshot or not snapshot.HasResults():
return
results = snapshot.GetNetworkResults(userid)
if not results... | Returns a string that includes network statistics of the |snapshot|. This
lines up with the associated header. | Returns a string that includes network statistics of the |snapshot|. This
lines up with the associated header. | [
"Returns",
"a",
"string",
"that",
"includes",
"network",
"statistics",
"of",
"the",
"|snapshot|",
".",
"This",
"lines",
"up",
"with",
"the",
"associated",
"header",
"."
] | def __PrintNetworkStats(self, userid, snapshot, prev_snapshot):
if not snapshot or not snapshot.HasResults():
return
results = snapshot.GetNetworkResults(userid)
if not results:
return
old_results = None
if prev_snapshot:
old_results = prev_snapshot.GetNetworkResults(userid)
re... | [
"def",
"__PrintNetworkStats",
"(",
"self",
",",
"userid",
",",
"snapshot",
",",
"prev_snapshot",
")",
":",
"if",
"not",
"snapshot",
"or",
"not",
"snapshot",
".",
"HasResults",
"(",
")",
":",
"return",
"results",
"=",
"snapshot",
".",
"GetNetworkResults",
"("... | Returns a string that includes network statistics of the |snapshot|. | [
"Returns",
"a",
"string",
"that",
"includes",
"network",
"statistics",
"of",
"the",
"|snapshot|",
"."
] | [
"\"\"\"Returns a string that includes network statistics of the |snapshot|. This\n lines up with the associated header.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "userid",
"type": null
},
{
"param": "snapshot",
"type": null
},
{
"param": "prev_snapshot",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "userid",
"type": null,
"docstring": null,
"docstring_tokens":... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __PrintNulledNetworkStats | <not_specific> | def __PrintNulledNetworkStats(self):
"""Returns a string that includes empty network statistics. This lines up
with the associated header. This is used when showing statistics for pids
that share the same application userId. Network statistics should only be
shown once for each application userId."""... | Returns a string that includes empty network statistics. This lines up
with the associated header. This is used when showing statistics for pids
that share the same application userId. Network statistics should only be
shown once for each application userId. | Returns a string that includes empty network statistics. This lines up
with the associated header. This is used when showing statistics for pids
that share the same application userId. Network statistics should only be
shown once for each application userId. | [
"Returns",
"a",
"string",
"that",
"includes",
"empty",
"network",
"statistics",
".",
"This",
"lines",
"up",
"with",
"the",
"associated",
"header",
".",
"This",
"is",
"used",
"when",
"showing",
"statistics",
"for",
"pids",
"that",
"share",
"the",
"same",
"app... | def __PrintNulledNetworkStats(self):
stats = ''
for title in self.__NETWORK_COLUMN_TITLES:
stats += self.__PadString('-', 8, True) + ' '
stats += self.__PadString('', 8, True)
return stats | [
"def",
"__PrintNulledNetworkStats",
"(",
"self",
")",
":",
"stats",
"=",
"''",
"for",
"title",
"in",
"self",
".",
"__NETWORK_COLUMN_TITLES",
":",
"stats",
"+=",
"self",
".",
"__PadString",
"(",
"'-'",
",",
"8",
",",
"True",
")",
"+",
"' '",
"stats",
"+="... | Returns a string that includes empty network statistics. | [
"Returns",
"a",
"string",
"that",
"includes",
"empty",
"network",
"statistics",
"."
] | [
"\"\"\"Returns a string that includes empty network statistics. This lines up\n with the associated header. This is used when showing statistics for pids\n that share the same application userId. Network statistics should only be\n shown once for each application userId.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __PrintHeaderHelper | <not_specific> | def __PrintHeaderHelper(self,
snapshot,
show_labels,
show_timestamp,
show_mem,
show_net,
show_trailer):
"""Helper method to concat various header entries togeth... | Helper method to concat various header entries together into one header.
This will line up with a entry built by __PrintStatsHelper if the same
values are passed to it. | Helper method to concat various header entries together into one header.
This will line up with a entry built by __PrintStatsHelper if the same
values are passed to it. | [
"Helper",
"method",
"to",
"concat",
"various",
"header",
"entries",
"together",
"into",
"one",
"header",
".",
"This",
"will",
"line",
"up",
"with",
"a",
"entry",
"built",
"by",
"__PrintStatsHelper",
"if",
"the",
"same",
"values",
"are",
"passed",
"to",
"it",... | def __PrintHeaderHelper(self,
snapshot,
show_labels,
show_timestamp,
show_mem,
show_net,
show_trailer):
titles = []
if show_labels:
titles.append(self... | [
"def",
"__PrintHeaderHelper",
"(",
"self",
",",
"snapshot",
",",
"show_labels",
",",
"show_timestamp",
",",
"show_mem",
",",
"show_net",
",",
"show_trailer",
")",
":",
"titles",
"=",
"[",
"]",
"if",
"show_labels",
":",
"titles",
".",
"append",
"(",
"self",
... | Helper method to concat various header entries together into one header. | [
"Helper",
"method",
"to",
"concat",
"various",
"header",
"entries",
"together",
"into",
"one",
"header",
"."
] | [
"\"\"\"Helper method to concat various header entries together into one header.\n This will line up with a entry built by __PrintStatsHelper if the same\n values are passed to it.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "snapshot",
"type": null
},
{
"param": "show_labels",
"type": null
},
{
"param": "show_timestamp",
"type": null
},
{
"param": "show_mem",
"type": null
},
{
"param": "show_net",
"type": null
},
{
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "snapshot",
"type": null,
"docstring": null,
"docstring_tokens... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | __PrintStatsHelper | <not_specific> | def __PrintStatsHelper(self,
pid,
snapshot,
prev_snapshot,
show_labels,
show_timestamp,
show_mem,
show_net):
"""Helper method to concat vario... | Helper method to concat various stats entries together into one line.
This will line up with a header built by __PrintHeaderHelper if the same
values are passed to it. | Helper method to concat various stats entries together into one line.
This will line up with a header built by __PrintHeaderHelper if the same
values are passed to it. | [
"Helper",
"method",
"to",
"concat",
"various",
"stats",
"entries",
"together",
"into",
"one",
"line",
".",
"This",
"will",
"line",
"up",
"with",
"a",
"header",
"built",
"by",
"__PrintHeaderHelper",
"if",
"the",
"same",
"values",
"are",
"passed",
"to",
"it",
... | def __PrintStatsHelper(self,
pid,
snapshot,
prev_snapshot,
show_labels,
show_timestamp,
show_mem,
show_net):
stats = []
if show_labels:
... | [
"def",
"__PrintStatsHelper",
"(",
"self",
",",
"pid",
",",
"snapshot",
",",
"prev_snapshot",
",",
"show_labels",
",",
"show_timestamp",
",",
"show_mem",
",",
"show_net",
")",
":",
"stats",
"=",
"[",
"]",
"if",
"show_labels",
":",
"stats",
".",
"append",
"(... | Helper method to concat various stats entries together into one line. | [
"Helper",
"method",
"to",
"concat",
"various",
"stats",
"entries",
"together",
"into",
"one",
"line",
"."
] | [
"\"\"\"Helper method to concat various stats entries together into one line.\n This will line up with a header built by __PrintHeaderHelper if the same\n values are passed to it.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "pid",
"type": null
},
{
"param": "snapshot",
"type": null
},
{
"param": "prev_snapshot",
"type": null
},
{
"param": "show_labels",
"type": null
},
{
"param": "show_timestamp",
"type": null
},
{
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pid",
"type": null,
"docstring": null,
"docstring_tokens": []... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PrettyFile | <not_specific> | def PrettyFile(self,
file_path,
snapshots,
diff_against_start,
show_mem=True,
show_net=True):
"""Writes |snapshots| (a list of DeviceSnapshots) to |file_path|.
|diff_against_start| determines whether or not the snapshot deltas ... | Writes |snapshots| (a list of DeviceSnapshots) to |file_path|.
|diff_against_start| determines whether or not the snapshot deltas are
between the first entry and all entries or each previous entry. This output
will not follow |self.can_color| or |self.overwrite|. If |show_mem| is
True, this will attem... | Writes |snapshots| (a list of DeviceSnapshots) to |file_path|.
|diff_against_start| determines whether or not the snapshot deltas are
between the first entry and all entries or each previous entry. | [
"Writes",
"|snapshots|",
"(",
"a",
"list",
"of",
"DeviceSnapshots",
")",
"to",
"|file_path|",
".",
"|diff_against_start|",
"determines",
"whether",
"or",
"not",
"the",
"snapshot",
"deltas",
"are",
"between",
"the",
"first",
"entry",
"and",
"all",
"entries",
"or"... | def PrettyFile(self,
file_path,
snapshots,
diff_against_start,
show_mem=True,
show_net=True):
if not file_path or not snapshots:
return
show_label = False
show_timestamp = True
show_trailer = False
pids = self... | [
"def",
"PrettyFile",
"(",
"self",
",",
"file_path",
",",
"snapshots",
",",
"diff_against_start",
",",
"show_mem",
"=",
"True",
",",
"show_net",
"=",
"True",
")",
":",
"if",
"not",
"file_path",
"or",
"not",
"snapshots",
":",
"return",
"show_label",
"=",
"Fa... | Writes |snapshots| (a list of DeviceSnapshots) to |file_path|. | [
"Writes",
"|snapshots|",
"(",
"a",
"list",
"of",
"DeviceSnapshots",
")",
"to",
"|file_path|",
"."
] | [
"\"\"\"Writes |snapshots| (a list of DeviceSnapshots) to |file_path|.\n |diff_against_start| determines whether or not the snapshot deltas are\n between the first entry and all entries or each previous entry. This output\n will not follow |self.can_color| or |self.overwrite|. If |show_mem| is\n True, ... | [
{
"param": "self",
"type": null
},
{
"param": "file_path",
"type": null
},
{
"param": "snapshots",
"type": null
},
{
"param": "diff_against_start",
"type": null
},
{
"param": "show_mem",
"type": null
},
{
"param": "show_net",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file_path",
"type": null,
"docstring": null,
"docstring_token... |
c1ce6192ba90b058b6112918a59d75c18fdf1541 | sunlongbo/chromium | tools/android/appstats.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PrettyGraph | <not_specific> | def PrettyGraph(self, file_path, snapshots):
"""Creates a pdf graph of |snapshots| (a list of DeviceSnapshots) at
|file_path|. This currently only shows memory stats and no network
stats."""
# Import these here so the rest of the functionality doesn't rely on
# matplotlib
from matplotlib import... | Creates a pdf graph of |snapshots| (a list of DeviceSnapshots) at
|file_path|. This currently only shows memory stats and no network
stats. | Creates a pdf graph of |snapshots| (a list of DeviceSnapshots) at
|file_path|. This currently only shows memory stats and no network
stats. | [
"Creates",
"a",
"pdf",
"graph",
"of",
"|snapshots|",
"(",
"a",
"list",
"of",
"DeviceSnapshots",
")",
"at",
"|file_path|",
".",
"This",
"currently",
"only",
"shows",
"memory",
"stats",
"and",
"no",
"network",
"stats",
"."
] | def PrettyGraph(self, file_path, snapshots):
from matplotlib import pyplot
from matplotlib.backends.backend_pdf import PdfPages
if not file_path or not snapshots:
return
pids = self.__FindPidsForSnapshotList(snapshots)
pp = PdfPages(file_path)
for (userid, pid, name) in pids:
figure ... | [
"def",
"PrettyGraph",
"(",
"self",
",",
"file_path",
",",
"snapshots",
")",
":",
"from",
"matplotlib",
"import",
"pyplot",
"from",
"matplotlib",
".",
"backends",
".",
"backend_pdf",
"import",
"PdfPages",
"if",
"not",
"file_path",
"or",
"not",
"snapshots",
":",... | Creates a pdf graph of |snapshots| (a list of DeviceSnapshots) at
|file_path|. | [
"Creates",
"a",
"pdf",
"graph",
"of",
"|snapshots|",
"(",
"a",
"list",
"of",
"DeviceSnapshots",
")",
"at",
"|file_path|",
"."
] | [
"\"\"\"Creates a pdf graph of |snapshots| (a list of DeviceSnapshots) at\n |file_path|. This currently only shows memory stats and no network\n stats.\"\"\"",
"# Import these here so the rest of the functionality doesn't rely on",
"# matplotlib"
] | [
{
"param": "self",
"type": null
},
{
"param": "file_path",
"type": null
},
{
"param": "snapshots",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file_path",
"type": null,
"docstring": null,
"docstring_token... |
521512d73bd4ea98a79f96af8efe9f81272ec414 | sunlongbo/chromium | tools/perf/cli_tools/soundwave/tables/alerts.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RowFromJson | <not_specific> | def _RowFromJson(data):
"""Turn json data from an alert into a tuple with values for that record."""
data = data.copy() # Do not modify the original dict.
# Name fields using newer dashboard nomenclature.
data['test_suite'] = data.pop('testsuite')
raw_test = data.pop('test')
if '/' in raw_test:
data['... | Turn json data from an alert into a tuple with values for that record. | Turn json data from an alert into a tuple with values for that record. | [
"Turn",
"json",
"data",
"from",
"an",
"alert",
"into",
"a",
"tuple",
"with",
"values",
"for",
"that",
"record",
"."
] | def _RowFromJson(data):
data = data.copy()
data['test_suite'] = data.pop('testsuite')
raw_test = data.pop('test')
if '/' in raw_test:
data['measurement'], data['test_case'] = raw_test.split('/', 1)
else:
data['measurement'], data['test_case'] = raw_test, None
data['bot'] = '/'.join([data.pop('mast... | [
"def",
"_RowFromJson",
"(",
"data",
")",
":",
"data",
"=",
"data",
".",
"copy",
"(",
")",
"data",
"[",
"'test_suite'",
"]",
"=",
"data",
".",
"pop",
"(",
"'testsuite'",
")",
"raw_test",
"=",
"data",
".",
"pop",
"(",
"'test'",
")",
"if",
"'/'",
"in"... | Turn json data from an alert into a tuple with values for that record. | [
"Turn",
"json",
"data",
"from",
"an",
"alert",
"into",
"a",
"tuple",
"with",
"values",
"for",
"that",
"record",
"."
] | [
"\"\"\"Turn json data from an alert into a tuple with values for that record.\"\"\"",
"# Do not modify the original dict.",
"# Name fields using newer dashboard nomenclature.",
"# Alert was on a summary metric, i.e. a summary of the measurement across",
"# multiple test cases. Therefore, no test_case is ass... | [
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5219242e80727f2b7b0830dce58b64e881e41259 | sunlongbo/chromium | tools/metrics/histograms/find_unmapped_histograms.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | removeComments | <not_specific> | def removeComments(string):
"""Remove any comments from an expression, including leading and trailing
whitespace. This does not correctly ignore comments embedded in strings, but
that shouldn't matter for this script. Newlines in the removed text are
preserved so that line numbers don't change.
Args:
str... | Remove any comments from an expression, including leading and trailing
whitespace. This does not correctly ignore comments embedded in strings, but
that shouldn't matter for this script. Newlines in the removed text are
preserved so that line numbers don't change.
Args:
string: The string to remove comment... | Remove any comments from an expression, including leading and trailing
whitespace. This does not correctly ignore comments embedded in strings, but
that shouldn't matter for this script. Newlines in the removed text are
preserved so that line numbers don't change.
The string to remove comments from, e.g.
' // My hist... | [
"Remove",
"any",
"comments",
"from",
"an",
"expression",
"including",
"leading",
"and",
"trailing",
"whitespace",
".",
"This",
"does",
"not",
"correctly",
"ignore",
"comments",
"embedded",
"in",
"strings",
"but",
"that",
"shouldn",
"'",
"t",
"matter",
"for",
"... | def removeComments(string):
return CPP_COMMENT.sub(keepOnlyNewlines, string) | [
"def",
"removeComments",
"(",
"string",
")",
":",
"return",
"CPP_COMMENT",
".",
"sub",
"(",
"keepOnlyNewlines",
",",
"string",
")"
] | Remove any comments from an expression, including leading and trailing
whitespace. | [
"Remove",
"any",
"comments",
"from",
"an",
"expression",
"including",
"leading",
"and",
"trailing",
"whitespace",
"."
] | [
"\"\"\"Remove any comments from an expression, including leading and trailing\n whitespace. This does not correctly ignore comments embedded in strings, but\n that shouldn't matter for this script. Newlines in the removed text are\n preserved so that line numbers don't change.\n\n Args:\n string: The string ... | [
{
"param": "string",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "string",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5219242e80727f2b7b0830dce58b64e881e41259 | sunlongbo/chromium | tools/metrics/histograms/find_unmapped_histograms.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | logNonLiteralHistogram | <not_specific> | def logNonLiteralHistogram(filename, histogram):
"""Logs a statement warning about a non-literal histogram name found in the
Chromium source.
Filters out known acceptable exceptions.
Args:
filename: The filename for the file containing the histogram, e.g.
'chrome/browser/memory_details.cc'
... | Logs a statement warning about a non-literal histogram name found in the
Chromium source.
Filters out known acceptable exceptions.
Args:
filename: The filename for the file containing the histogram, e.g.
'chrome/browser/memory_details.cc'
histogram: The expression that evaluates to the nam... | Logs a statement warning about a non-literal histogram name found in the
Chromium source.
Filters out known acceptable exceptions. | [
"Logs",
"a",
"statement",
"warning",
"about",
"a",
"non",
"-",
"literal",
"histogram",
"name",
"found",
"in",
"the",
"Chromium",
"source",
".",
"Filters",
"out",
"known",
"acceptable",
"exceptions",
"."
] | def logNonLiteralHistogram(filename, histogram):
if '\\' in histogram:
return
if CONSTANT_REGEX.match(histogram):
return
if histogram == '':
return
if MACRO_STRING_CONCATENATION_REGEX.match(histogram):
return
logging.warning('%s contains non-literal histogram name <%s>', filename,
... | [
"def",
"logNonLiteralHistogram",
"(",
"filename",
",",
"histogram",
")",
":",
"if",
"'\\\\'",
"in",
"histogram",
":",
"return",
"if",
"CONSTANT_REGEX",
".",
"match",
"(",
"histogram",
")",
":",
"return",
"if",
"histogram",
"==",
"''",
":",
"return",
"if",
... | Logs a statement warning about a non-literal histogram name found in the
Chromium source. | [
"Logs",
"a",
"statement",
"warning",
"about",
"a",
"non",
"-",
"literal",
"histogram",
"name",
"found",
"in",
"the",
"Chromium",
"source",
"."
] | [
"\"\"\"Logs a statement warning about a non-literal histogram name found in the\n Chromium source.\n\n Filters out known acceptable exceptions.\n\n Args:\n filename: The filename for the file containing the histogram, e.g.\n 'chrome/browser/memory_details.cc'\n histogram: The expression that e... | [
{
"param": "filename",
"type": null
},
{
"param": "histogram",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": "The filename for the file containing the histogram, e.g.\n'chrome/browser/memory_d... |
5219242e80727f2b7b0830dce58b64e881e41259 | sunlongbo/chromium | tools/metrics/histograms/find_unmapped_histograms.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | readChromiumHistograms | <not_specific> | def readChromiumHistograms():
"""Searches the Chromium source for all histogram names.
Also prints warnings for any invocations of the UMA_HISTOGRAM_* macros with
names that might vary during a single run of the app.
Returns:
A tuple of
a set containing any found literal histogram names, and
a... | Searches the Chromium source for all histogram names.
Also prints warnings for any invocations of the UMA_HISTOGRAM_* macros with
names that might vary during a single run of the app.
Returns:
A tuple of
a set containing any found literal histogram names, and
a set mapping histogram name to firs... | Searches the Chromium source for all histogram names.
Also prints warnings for any invocations of the UMA_HISTOGRAM_* macros with
names that might vary during a single run of the app. | [
"Searches",
"the",
"Chromium",
"source",
"for",
"all",
"histogram",
"names",
".",
"Also",
"prints",
"warnings",
"for",
"any",
"invocations",
"of",
"the",
"UMA_HISTOGRAM_",
"*",
"macros",
"with",
"names",
"that",
"might",
"vary",
"during",
"a",
"single",
"run",... | def readChromiumHistograms():
logging.info('Scanning Chromium source for histograms...')
locations = RunGit(['gs', 'UMA_HISTOGRAM']).split('\n')
all_filenames = set(location.split(':')[0] for location in locations);
filenames = [f for f in all_filenames
if C_FILENAME.match(f) and not TEST_FILENAM... | [
"def",
"readChromiumHistograms",
"(",
")",
":",
"logging",
".",
"info",
"(",
"'Scanning Chromium source for histograms...'",
")",
"locations",
"=",
"RunGit",
"(",
"[",
"'gs'",
",",
"'UMA_HISTOGRAM'",
"]",
")",
".",
"split",
"(",
"'\\n'",
")",
"all_filenames",
"=... | Searches the Chromium source for all histogram names. | [
"Searches",
"the",
"Chromium",
"source",
"for",
"all",
"histogram",
"names",
"."
] | [
"\"\"\"Searches the Chromium source for all histogram names.\n\n Also prints warnings for any invocations of the UMA_HISTOGRAM_* macros with\n names that might vary during a single run of the app.\n\n Returns:\n A tuple of\n a set containing any found literal histogram names, and\n a set mapping his... | [] | {
"returns": [
{
"docstring": "A tuple of\na set containing any found literal histogram names, and\na set mapping histogram name to first filename:line where it was found",
"docstring_tokens": [
"A",
"tuple",
"of",
"a",
"set",
"containing",
"any"... |
9f51ea7751fb2de7ffb329f43f081d4aa701be2d | sunlongbo/chromium | mojo/public/tools/mojom/check_stable_mojom_compatibility_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testBasicCompatibility | null | def testBasicCompatibility(self):
"""Minimal smoke test to verify acceptance of a simple valid change."""
self.assertBackwardCompatible([
Change('foo/foo.mojom',
old='[Stable] struct S {};',
new='[Stable] struct S { [MinVersion=1] int32 x; };')
]) | Minimal smoke test to verify acceptance of a simple valid change. | Minimal smoke test to verify acceptance of a simple valid change. | [
"Minimal",
"smoke",
"test",
"to",
"verify",
"acceptance",
"of",
"a",
"simple",
"valid",
"change",
"."
] | def testBasicCompatibility(self):
self.assertBackwardCompatible([
Change('foo/foo.mojom',
old='[Stable] struct S {};',
new='[Stable] struct S { [MinVersion=1] int32 x; };')
]) | [
"def",
"testBasicCompatibility",
"(",
"self",
")",
":",
"self",
".",
"assertBackwardCompatible",
"(",
"[",
"Change",
"(",
"'foo/foo.mojom'",
",",
"old",
"=",
"'[Stable] struct S {};'",
",",
"new",
"=",
"'[Stable] struct S { [MinVersion=1] int32 x; };'",
")",
"]",
")"
... | Minimal smoke test to verify acceptance of a simple valid change. | [
"Minimal",
"smoke",
"test",
"to",
"verify",
"acceptance",
"of",
"a",
"simple",
"valid",
"change",
"."
] | [
"\"\"\"Minimal smoke test to verify acceptance of a simple valid change.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9f51ea7751fb2de7ffb329f43f081d4aa701be2d | sunlongbo/chromium | mojo/public/tools/mojom/check_stable_mojom_compatibility_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testBasicIncompatibility | null | def testBasicIncompatibility(self):
"""Minimal smoke test to verify rejection of a simple invalid change."""
self.assertNotBackwardCompatible([
Change('foo/foo.mojom',
old='[Stable] struct S {};',
new='[Stable] struct S { int32 x; };')
]) | Minimal smoke test to verify rejection of a simple invalid change. | Minimal smoke test to verify rejection of a simple invalid change. | [
"Minimal",
"smoke",
"test",
"to",
"verify",
"rejection",
"of",
"a",
"simple",
"invalid",
"change",
"."
] | def testBasicIncompatibility(self):
self.assertNotBackwardCompatible([
Change('foo/foo.mojom',
old='[Stable] struct S {};',
new='[Stable] struct S { int32 x; };')
]) | [
"def",
"testBasicIncompatibility",
"(",
"self",
")",
":",
"self",
".",
"assertNotBackwardCompatible",
"(",
"[",
"Change",
"(",
"'foo/foo.mojom'",
",",
"old",
"=",
"'[Stable] struct S {};'",
",",
"new",
"=",
"'[Stable] struct S { int32 x; };'",
")",
"]",
")"
] | Minimal smoke test to verify rejection of a simple invalid change. | [
"Minimal",
"smoke",
"test",
"to",
"verify",
"rejection",
"of",
"a",
"simple",
"invalid",
"change",
"."
] | [
"\"\"\"Minimal smoke test to verify rejection of a simple invalid change.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9f51ea7751fb2de7ffb329f43f081d4aa701be2d | sunlongbo/chromium | mojo/public/tools/mojom/check_stable_mojom_compatibility_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testIgnoreIfNotStable | null | def testIgnoreIfNotStable(self):
"""We don't care about types not marked [Stable]"""
self.assertBackwardCompatible([
Change('foo/foo.mojom',
old='struct S {};',
new='struct S { int32 x; };')
]) | We don't care about types not marked [Stable] | We don't care about types not marked [Stable] | [
"We",
"don",
"'",
"t",
"care",
"about",
"types",
"not",
"marked",
"[",
"Stable",
"]"
] | def testIgnoreIfNotStable(self):
self.assertBackwardCompatible([
Change('foo/foo.mojom',
old='struct S {};',
new='struct S { int32 x; };')
]) | [
"def",
"testIgnoreIfNotStable",
"(",
"self",
")",
":",
"self",
".",
"assertBackwardCompatible",
"(",
"[",
"Change",
"(",
"'foo/foo.mojom'",
",",
"old",
"=",
"'struct S {};'",
",",
"new",
"=",
"'struct S { int32 x; };'",
")",
"]",
")"
] | We don't care about types not marked [Stable] | [
"We",
"don",
"'",
"t",
"care",
"about",
"types",
"not",
"marked",
"[",
"Stable",
"]"
] | [
"\"\"\"We don't care about types not marked [Stable]\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9f51ea7751fb2de7ffb329f43f081d4aa701be2d | sunlongbo/chromium | mojo/public/tools/mojom/check_stable_mojom_compatibility_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testRename | null | def testRename(self):
"""We can do checks for renamed types."""
self.assertBackwardCompatible([
Change('foo/foo.mojom',
old='[Stable] struct S {};',
new='[Stable, RenamedFrom="S"] struct T {};')
])
self.assertNotBackwardCompatible([
Change('foo/foo.mojom',
... | We can do checks for renamed types. | We can do checks for renamed types. | [
"We",
"can",
"do",
"checks",
"for",
"renamed",
"types",
"."
] | def testRename(self):
self.assertBackwardCompatible([
Change('foo/foo.mojom',
old='[Stable] struct S {};',
new='[Stable, RenamedFrom="S"] struct T {};')
])
self.assertNotBackwardCompatible([
Change('foo/foo.mojom',
old='[Stable] struct S {};',
... | [
"def",
"testRename",
"(",
"self",
")",
":",
"self",
".",
"assertBackwardCompatible",
"(",
"[",
"Change",
"(",
"'foo/foo.mojom'",
",",
"old",
"=",
"'[Stable] struct S {};'",
",",
"new",
"=",
"'[Stable, RenamedFrom=\"S\"] struct T {};'",
")",
"]",
")",
"self",
".",
... | We can do checks for renamed types. | [
"We",
"can",
"do",
"checks",
"for",
"renamed",
"types",
"."
] | [
"\"\"\"We can do checks for renamed types.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9f51ea7751fb2de7ffb329f43f081d4aa701be2d | sunlongbo/chromium | mojo/public/tools/mojom/check_stable_mojom_compatibility_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testNewlyStable | null | def testNewlyStable(self):
"""We don't care about types newly marked as [Stable]."""
self.assertBackwardCompatible([
Change('foo/foo.mojom',
old='struct S {};',
new='[Stable] struct S { int32 x; };')
]) | We don't care about types newly marked as [Stable]. | We don't care about types newly marked as [Stable]. | [
"We",
"don",
"'",
"t",
"care",
"about",
"types",
"newly",
"marked",
"as",
"[",
"Stable",
"]",
"."
] | def testNewlyStable(self):
self.assertBackwardCompatible([
Change('foo/foo.mojom',
old='struct S {};',
new='[Stable] struct S { int32 x; };')
]) | [
"def",
"testNewlyStable",
"(",
"self",
")",
":",
"self",
".",
"assertBackwardCompatible",
"(",
"[",
"Change",
"(",
"'foo/foo.mojom'",
",",
"old",
"=",
"'struct S {};'",
",",
"new",
"=",
"'[Stable] struct S { int32 x; };'",
")",
"]",
")"
] | We don't care about types newly marked as [Stable]. | [
"We",
"don",
"'",
"t",
"care",
"about",
"types",
"newly",
"marked",
"as",
"[",
"Stable",
"]",
"."
] | [
"\"\"\"We don't care about types newly marked as [Stable].\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9f51ea7751fb2de7ffb329f43f081d4aa701be2d | sunlongbo/chromium | mojo/public/tools/mojom/check_stable_mojom_compatibility_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testFileRename | null | def testFileRename(self):
"""Make sure we can still do compatibility checks after a file rename."""
self.assertBackwardCompatible([
Change('foo/foo.mojom', old='[Stable] struct S {};', new=None),
Change('bar/bar.mojom',
old=None,
new='[Stable] struct S { [MinVersion... | Make sure we can still do compatibility checks after a file rename. | Make sure we can still do compatibility checks after a file rename. | [
"Make",
"sure",
"we",
"can",
"still",
"do",
"compatibility",
"checks",
"after",
"a",
"file",
"rename",
"."
] | def testFileRename(self):
self.assertBackwardCompatible([
Change('foo/foo.mojom', old='[Stable] struct S {};', new=None),
Change('bar/bar.mojom',
old=None,
new='[Stable] struct S { [MinVersion=1] int32 x; };')
])
self.assertNotBackwardCompatible([
Change... | [
"def",
"testFileRename",
"(",
"self",
")",
":",
"self",
".",
"assertBackwardCompatible",
"(",
"[",
"Change",
"(",
"'foo/foo.mojom'",
",",
"old",
"=",
"'[Stable] struct S {};'",
",",
"new",
"=",
"None",
")",
",",
"Change",
"(",
"'bar/bar.mojom'",
",",
"old",
... | Make sure we can still do compatibility checks after a file rename. | [
"Make",
"sure",
"we",
"can",
"still",
"do",
"compatibility",
"checks",
"after",
"a",
"file",
"rename",
"."
] | [
"\"\"\"Make sure we can still do compatibility checks after a file rename.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9f51ea7751fb2de7ffb329f43f081d4aa701be2d | sunlongbo/chromium | mojo/public/tools/mojom/check_stable_mojom_compatibility_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testWithImport | null | def testWithImport(self):
"""Ensure that cross-module dependencies do not break the compatibility
checking tool."""
self.assertBackwardCompatible([
Change('foo/foo.mojom',
old="""\
module foo;
[Stable] struct S {};
""",
new="... | Ensure that cross-module dependencies do not break the compatibility
checking tool. | Ensure that cross-module dependencies do not break the compatibility
checking tool. | [
"Ensure",
"that",
"cross",
"-",
"module",
"dependencies",
"do",
"not",
"break",
"the",
"compatibility",
"checking",
"tool",
"."
] | def testWithImport(self):
self.assertBackwardCompatible([
Change('foo/foo.mojom',
old="""\
module foo;
[Stable] struct S {};
""",
new="""\
module foo;
[Stable] struct S { [MinVersion=2] int32 x; };
... | [
"def",
"testWithImport",
"(",
"self",
")",
":",
"self",
".",
"assertBackwardCompatible",
"(",
"[",
"Change",
"(",
"'foo/foo.mojom'",
",",
"old",
"=",
"\"\"\"\\\n module foo;\n [Stable] struct S {};\n \"\"\"",
",",
"new",
"=",
"\"\"\... | Ensure that cross-module dependencies do not break the compatibility
checking tool. | [
"Ensure",
"that",
"cross",
"-",
"module",
"dependencies",
"do",
"not",
"break",
"the",
"compatibility",
"checking",
"tool",
"."
] | [
"\"\"\"Ensure that cross-module dependencies do not break the compatibility\n checking tool.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9f51ea7751fb2de7ffb329f43f081d4aa701be2d | sunlongbo/chromium | mojo/public/tools/mojom/check_stable_mojom_compatibility_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testWithMovedDefinition | null | def testWithMovedDefinition(self):
"""If a definition moves from one file to another, we should still be able
to check compatibility accurately."""
self.assertBackwardCompatible([
Change('foo/foo.mojom',
old="""\
module foo;
[Stable] struct S {};
... | If a definition moves from one file to another, we should still be able
to check compatibility accurately. | If a definition moves from one file to another, we should still be able
to check compatibility accurately. | [
"If",
"a",
"definition",
"moves",
"from",
"one",
"file",
"to",
"another",
"we",
"should",
"still",
"be",
"able",
"to",
"check",
"compatibility",
"accurately",
"."
] | def testWithMovedDefinition(self):
self.assertBackwardCompatible([
Change('foo/foo.mojom',
old="""\
module foo;
[Stable] struct S {};
""",
new="""\
module foo;
"""),
Change('bar/bar.mojom',
... | [
"def",
"testWithMovedDefinition",
"(",
"self",
")",
":",
"self",
".",
"assertBackwardCompatible",
"(",
"[",
"Change",
"(",
"'foo/foo.mojom'",
",",
"old",
"=",
"\"\"\"\\\n module foo;\n [Stable] struct S {};\n \"\"\"",
",",
"new",
"=",... | If a definition moves from one file to another, we should still be able
to check compatibility accurately. | [
"If",
"a",
"definition",
"moves",
"from",
"one",
"file",
"to",
"another",
"we",
"should",
"still",
"be",
"able",
"to",
"check",
"compatibility",
"accurately",
"."
] | [
"\"\"\"If a definition moves from one file to another, we should still be able\n to check compatibility accurately.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9f51ea7751fb2de7ffb329f43f081d4aa701be2d | sunlongbo/chromium | mojo/public/tools/mojom/check_stable_mojom_compatibility_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testWithUnmodifiedImport | null | def testWithUnmodifiedImport(self):
"""Unchanged files in the filesystem are still parsed by the compatibility
checking tool if they're imported by a changed file."""
self.assertBackwardCompatible([
UnchangedFile('foo/foo.mojom', 'module foo; [Stable] struct S {};'),
Change('bar/bar.mojom',
... | Unchanged files in the filesystem are still parsed by the compatibility
checking tool if they're imported by a changed file. | Unchanged files in the filesystem are still parsed by the compatibility
checking tool if they're imported by a changed file. | [
"Unchanged",
"files",
"in",
"the",
"filesystem",
"are",
"still",
"parsed",
"by",
"the",
"compatibility",
"checking",
"tool",
"if",
"they",
"'",
"re",
"imported",
"by",
"a",
"changed",
"file",
"."
] | def testWithUnmodifiedImport(self):
self.assertBackwardCompatible([
UnchangedFile('foo/foo.mojom', 'module foo; [Stable] struct S {};'),
Change('bar/bar.mojom',
old="""\
module bar;
import "foo/foo.mojom";
[Stable] struct T { foo.S s; };
... | [
"def",
"testWithUnmodifiedImport",
"(",
"self",
")",
":",
"self",
".",
"assertBackwardCompatible",
"(",
"[",
"UnchangedFile",
"(",
"'foo/foo.mojom'",
",",
"'module foo; [Stable] struct S {};'",
")",
",",
"Change",
"(",
"'bar/bar.mojom'",
",",
"old",
"=",
"\"\"\"\\\n ... | Unchanged files in the filesystem are still parsed by the compatibility
checking tool if they're imported by a changed file. | [
"Unchanged",
"files",
"in",
"the",
"filesystem",
"are",
"still",
"parsed",
"by",
"the",
"compatibility",
"checking",
"tool",
"if",
"they",
"'",
"re",
"imported",
"by",
"a",
"changed",
"file",
"."
] | [
"\"\"\"Unchanged files in the filesystem are still parsed by the compatibility\n checking tool if they're imported by a changed file.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
61c54db5b6dd3eba82abf4a3e306d482ce4491a7 | sunlongbo/chromium | tools/mac/power/generate_scripts.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | render | null | def render(file_prefix, template_file, process_name, extra_args):
"""Render a single scenario script."""
if file_prefix:
file_prefix = file_prefix.replace(" ", "_") + "_"
file_prefix = file_prefix.lower()
# Roughly the Alexa top 50 at the time of writing this.
background_sites_list = [
"https://... | Render a single scenario script. | Render a single scenario script. | [
"Render",
"a",
"single",
"scenario",
"script",
"."
] | def render(file_prefix, template_file, process_name, extra_args):
if file_prefix:
file_prefix = file_prefix.replace(" ", "_") + "_"
file_prefix = file_prefix.lower()
background_sites_list = [
"https://google.com", "https://youtube.com", "https://tmall.com",
"https://baidu.com", "https://qq.com",... | [
"def",
"render",
"(",
"file_prefix",
",",
"template_file",
",",
"process_name",
",",
"extra_args",
")",
":",
"if",
"file_prefix",
":",
"file_prefix",
"=",
"file_prefix",
".",
"replace",
"(",
"\" \"",
",",
"\"_\"",
")",
"+",
"\"_\"",
"file_prefix",
"=",
"file... | Render a single scenario script. | [
"Render",
"a",
"single",
"scenario",
"script",
"."
] | [
"\"\"\"Render a single scenario script.\"\"\"",
"# Roughly the Alexa top 50 at the time of writing this."
] | [
{
"param": "file_prefix",
"type": null
},
{
"param": "template_file",
"type": null
},
{
"param": "process_name",
"type": null
},
{
"param": "extra_args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_prefix",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "template_file",
"type": null,
"docstring": null,
"docs... |
61c54db5b6dd3eba82abf4a3e306d482ce4491a7 | sunlongbo/chromium | tools/mac/power/generate_scripts.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | render_runner_scripts | null | def render_runner_scripts(extra_args):
"""Render all scenario driver scripts for all browsers (if applicable)."""
# Generate all driver scripts from templates.
for _, _, files in os.walk("./driver_scripts_templates"):
for template_file in files:
if not template_file.endswith(".scpt") and not template_f... | Render all scenario driver scripts for all browsers (if applicable). | Render all scenario driver scripts for all browsers (if applicable). | [
"Render",
"all",
"scenario",
"driver",
"scripts",
"for",
"all",
"browsers",
"(",
"if",
"applicable",
")",
"."
] | def render_runner_scripts(extra_args):
for _, _, files in os.walk("./driver_scripts_templates"):
for template_file in files:
if not template_file.endswith(".scpt") and not template_file.endswith(
".swp"):
if template_file.startswith("safari"):
render("", template_file, "", extra_... | [
"def",
"render_runner_scripts",
"(",
"extra_args",
")",
":",
"for",
"_",
",",
"_",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"\"./driver_scripts_templates\"",
")",
":",
"for",
"template_file",
"in",
"files",
":",
"if",
"not",
"template_file",
".",
"endswit... | Render all scenario driver scripts for all browsers (if applicable). | [
"Render",
"all",
"scenario",
"driver",
"scripts",
"for",
"all",
"browsers",
"(",
"if",
"applicable",
")",
"."
] | [
"\"\"\"Render all scenario driver scripts for all browsers (if applicable).\"\"\"",
"# Generate all driver scripts from templates.",
"# Generate for Safari",
"# Generate for all Chromium based browsers"
] | [
{
"param": "extra_args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "extra_args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
61c54db5b6dd3eba82abf4a3e306d482ce4491a7 | sunlongbo/chromium | tools/mac/power/generate_scripts.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | generate_all | null | def generate_all(extra_args):
"""Delete all existing generated scripts. Scripts should not be
modified by hand.
"""
args = {"hash_bang": "#!/usr/bin/osascript"}
args = {**args, **extra_args}
shutil.rmtree("driver_scripts/", ignore_errors=True)
os.makedirs("driver_scripts", exist_ok=True)
# Generate s... | Delete all existing generated scripts. Scripts should not be
modified by hand.
| Delete all existing generated scripts. Scripts should not be
modified by hand. | [
"Delete",
"all",
"existing",
"generated",
"scripts",
".",
"Scripts",
"should",
"not",
"be",
"modified",
"by",
"hand",
"."
] | def generate_all(extra_args):
args = {"hash_bang": "#!/usr/bin/osascript"}
args = {**args, **extra_args}
shutil.rmtree("driver_scripts/", ignore_errors=True)
os.makedirs("driver_scripts", exist_ok=True)
render_runner_scripts(args)
for _, _, files in os.walk("./driver_scripts_templates"):
for script in f... | [
"def",
"generate_all",
"(",
"extra_args",
")",
":",
"args",
"=",
"{",
"\"hash_bang\"",
":",
"\"#!/usr/bin/osascript\"",
"}",
"args",
"=",
"{",
"**",
"args",
",",
"**",
"extra_args",
"}",
"shutil",
".",
"rmtree",
"(",
"\"driver_scripts/\"",
",",
"ignore_errors"... | Delete all existing generated scripts. | [
"Delete",
"all",
"existing",
"generated",
"scripts",
"."
] | [
"\"\"\"Delete all existing generated scripts. Scripts should not be\n modified by hand.\n \"\"\"",
"# Generate scripts for all scenarios.",
"# Copy the files that don't need any substitutions."
] | [
{
"param": "extra_args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "extra_args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
61c717e0072ebdb01bbef61af878b6df9f1f2f9a | sunlongbo/chromium | tools/android/sdk_updater/update_sdk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _FindPackageVersion | <not_specific> | def _FindPackageVersion(package, sdk_root):
"""Find sdk package version.
Two options for package version:
1) Use the version in name if package name contains ';version'
2) For simple name package, search its version from 'Installed packages'
via `sdkmanager --list`
Args:
package: The Android ... | Find sdk package version.
Two options for package version:
1) Use the version in name if package name contains ';version'
2) For simple name package, search its version from 'Installed packages'
via `sdkmanager --list`
Args:
package: The Android SDK package.
sdk_root: The Android SDK root p... | Find sdk package version.
Two options for package version:
1) Use the version in name if package name contains ';version'
2) For simple name package, search its version from 'Installed packages'
via `sdkmanager --list` | [
"Find",
"sdk",
"package",
"version",
".",
"Two",
"options",
"for",
"package",
"version",
":",
"1",
")",
"Use",
"the",
"version",
"in",
"name",
"if",
"package",
"name",
"contains",
"'",
";",
"version",
"'",
"2",
")",
"For",
"simple",
"name",
"package",
... | def _FindPackageVersion(package, sdk_root):
sdkmanager_list_cmd = [
_SDKMANAGER_PATH,
'--list',
'--sdk_root=%s' % sdk_root,
]
if package in _DEFAULT_PACKAGES_DICT:
package = _DEFAULT_PACKAGES_DICT[package]
return package.split(';')[1]
else:
Available Packages:
....
W... | [
"def",
"_FindPackageVersion",
"(",
"package",
",",
"sdk_root",
")",
":",
"sdkmanager_list_cmd",
"=",
"[",
"_SDKMANAGER_PATH",
",",
"'--list'",
",",
"'--sdk_root=%s'",
"%",
"sdk_root",
",",
"]",
"if",
"package",
"in",
"_DEFAULT_PACKAGES_DICT",
":",
"package",
"=",
... | Find sdk package version. | [
"Find",
"sdk",
"package",
"version",
"."
] | [
"\"\"\"Find sdk package version.\n\n Two options for package version:\n 1) Use the version in name if package name contains ';version'\n 2) For simple name package, search its version from 'Installed packages'\n via `sdkmanager --list`\n\n Args:\n package: The Android SDK package.\n sdk_root: Th... | [
{
"param": "package",
"type": null
},
{
"param": "sdk_root",
"type": null
}
] | {
"returns": [
{
"docstring": "The version of package.",
"docstring_tokens": [
"The",
"version",
"of",
"package",
"."
],
"type": null
}
],
"raises": [
{
"docstring": "cannot find the version of package.",
"docstring_tokens": [... |
61c717e0072ebdb01bbef61af878b6df9f1f2f9a | sunlongbo/chromium | tools/android/sdk_updater/update_sdk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ReplaceVersionInFile | null | def _ReplaceVersionInFile(file_path, pattern, version, dry_run=False):
"""Replace the version of sdk package argument in file.
Check whether the version in file is the same as the new version first.
Replace the version if not dry run.
Args:
file_path: Path to the file to update the version of sdk package ... | Replace the version of sdk package argument in file.
Check whether the version in file is the same as the new version first.
Replace the version if not dry run.
Args:
file_path: Path to the file to update the version of sdk package argument.
pattern: Pattern for the sdk package argument. Must capture at... | Replace the version of sdk package argument in file.
Check whether the version in file is the same as the new version first.
Replace the version if not dry run. | [
"Replace",
"the",
"version",
"of",
"sdk",
"package",
"argument",
"in",
"file",
".",
"Check",
"whether",
"the",
"version",
"in",
"file",
"is",
"the",
"same",
"as",
"the",
"new",
"version",
"first",
".",
"Replace",
"the",
"version",
"if",
"not",
"dry",
"ru... | def _ReplaceVersionInFile(file_path, pattern, version, dry_run=False):
with tempfile.NamedTemporaryFile() as temp_file:
with open(file_path) as f:
for line in f:
new_line = re.sub(pattern, r'\g<1>\g<2>%s\g<3>\n' % version, line)
if new_line != line:
print(' Note: file "%s" argum... | [
"def",
"_ReplaceVersionInFile",
"(",
"file_path",
",",
"pattern",
",",
"version",
",",
"dry_run",
"=",
"False",
")",
":",
"with",
"tempfile",
".",
"NamedTemporaryFile",
"(",
")",
"as",
"temp_file",
":",
"with",
"open",
"(",
"file_path",
")",
"as",
"f",
":"... | Replace the version of sdk package argument in file. | [
"Replace",
"the",
"version",
"of",
"sdk",
"package",
"argument",
"in",
"file",
"."
] | [
"\"\"\"Replace the version of sdk package argument in file.\n\n Check whether the version in file is the same as the new version first.\n Replace the version if not dry run.\n\n Args:\n file_path: Path to the file to update the version of sdk package argument.\n pattern: Pattern for the sdk package argumen... | [
{
"param": "file_path",
"type": null
},
{
"param": "pattern",
"type": null
},
{
"param": "version",
"type": null
},
{
"param": "dry_run",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_path",
"type": null,
"docstring": "Path to the file to update the version of sdk package argument.",
"docstring_tokens": [
"Path",
"to",
"the",
"file",
"to",
"update",
... |
61c717e0072ebdb01bbef61af878b6df9f1f2f9a | sunlongbo/chromium | tools/android/sdk_updater/update_sdk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetCipdPackagePath | <not_specific> | def GetCipdPackagePath(pkg_yaml_file):
"""Find CIPD package path in .yaml file.
There should one line in .yaml file, e.g.:
"package: chrome_internal/third_party/android_sdk/internal/q/add-ons" or
"package: chromium/third_party/android_sdk/public/platforms"
Args:
pkg_yaml_file: The yaml file to find CIPD... | Find CIPD package path in .yaml file.
There should one line in .yaml file, e.g.:
"package: chrome_internal/third_party/android_sdk/internal/q/add-ons" or
"package: chromium/third_party/android_sdk/public/platforms"
Args:
pkg_yaml_file: The yaml file to find CIPD package path.
Returns:
The CIPD pack... | Find CIPD package path in .yaml file. | [
"Find",
"CIPD",
"package",
"path",
"in",
".",
"yaml",
"file",
"."
] | def GetCipdPackagePath(pkg_yaml_file):
cipd_package_path = ''
with open(pkg_yaml_file) as f:
pattern = re.compile(
r'(^\s*package:\s*)'
r'([\w\/-]+)'
r'(\s*?$)')
for line in f:
found = re.match(pattern, line)
if found:
cipd_package_path = found.group(2)
br... | [
"def",
"GetCipdPackagePath",
"(",
"pkg_yaml_file",
")",
":",
"cipd_package_path",
"=",
"''",
"with",
"open",
"(",
"pkg_yaml_file",
")",
"as",
"f",
":",
"pattern",
"=",
"re",
".",
"compile",
"(",
"r'(^\\s*package:\\s*)'",
"r'([\\w\\/-]+)'",
"r'(\\s*?$)'",
")",
"f... | Find CIPD package path in .yaml file. | [
"Find",
"CIPD",
"package",
"path",
"in",
".",
"yaml",
"file",
"."
] | [
"\"\"\"Find CIPD package path in .yaml file.\n\n There should one line in .yaml file, e.g.:\n \"package: chrome_internal/third_party/android_sdk/internal/q/add-ons\" or\n \"package: chromium/third_party/android_sdk/public/platforms\"\n\n Args:\n pkg_yaml_file: The yaml file to find CIPD package path.\n\n Re... | [
{
"param": "pkg_yaml_file",
"type": null
}
] | {
"returns": [
{
"docstring": "The CIPD package path in yaml file.",
"docstring_tokens": [
"The",
"CIPD",
"package",
"path",
"in",
"yaml",
"file",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"ident... |
61c717e0072ebdb01bbef61af878b6df9f1f2f9a | sunlongbo/chromium | tools/android/sdk_updater/update_sdk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | UploadSdkPackage | <not_specific> | def UploadSdkPackage(sdk_root, dry_run, service_url, package, yaml_file,
verbose):
"""Build and upload a package instance file to CIPD.
This would also update gn and ensure files to the package version as
uploading to CIPD.
Args:
sdk_root: Root of the sdk packages.
dry_run: Bool. ... | Build and upload a package instance file to CIPD.
This would also update gn and ensure files to the package version as
uploading to CIPD.
Args:
sdk_root: Root of the sdk packages.
dry_run: Bool. To show what packages would be created and packages, without
actually doing either.
service_url: Th... | Build and upload a package instance file to CIPD.
This would also update gn and ensure files to the package version as
uploading to CIPD.
Root of the sdk packages.
New instance ID when CIPD package created.
cannot find .yaml file, CIPD package path or instance ID for
package.
CalledProcessError: cipd command failed ... | [
"Build",
"and",
"upload",
"a",
"package",
"instance",
"file",
"to",
"CIPD",
".",
"This",
"would",
"also",
"update",
"gn",
"and",
"ensure",
"files",
"to",
"the",
"package",
"version",
"as",
"uploading",
"to",
"CIPD",
".",
"Root",
"of",
"the",
"sdk",
"pack... | def UploadSdkPackage(sdk_root, dry_run, service_url, package, yaml_file,
verbose):
pkg_yaml_file = yaml_file or os.path.join(sdk_root, 'cipd_%s.yaml' % package)
if not os.path.exists(pkg_yaml_file):
raise IOError('Cannot find .yaml file for package %s' % package)
cipd_package_path = GetCi... | [
"def",
"UploadSdkPackage",
"(",
"sdk_root",
",",
"dry_run",
",",
"service_url",
",",
"package",
",",
"yaml_file",
",",
"verbose",
")",
":",
"pkg_yaml_file",
"=",
"yaml_file",
"or",
"os",
".",
"path",
".",
"join",
"(",
"sdk_root",
",",
"'cipd_%s.yaml'",
"%",
... | Build and upload a package instance file to CIPD. | [
"Build",
"and",
"upload",
"a",
"package",
"instance",
"file",
"to",
"CIPD",
"."
] | [
"\"\"\"Build and upload a package instance file to CIPD.\n\n This would also update gn and ensure files to the package version as\n uploading to CIPD.\n\n Args:\n sdk_root: Root of the sdk packages.\n dry_run: Bool. To show what packages would be created and packages, without\n actually doing either.\... | [
{
"param": "sdk_root",
"type": null
},
{
"param": "dry_run",
"type": null
},
{
"param": "service_url",
"type": null
},
{
"param": "package",
"type": null
},
{
"param": "yaml_file",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sdk_root",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dry_run",
"type": null,
"docstring": null,
"docstring_tok... |
61c717e0072ebdb01bbef61af878b6df9f1f2f9a | sunlongbo/chromium | tools/android/sdk_updater/update_sdk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | UpdateInstanceId | null | def UpdateInstanceId(package,
deps_path,
dry_run,
new_instance_id,
release_version=None):
"""Find the sdk pkg version in DEPS and modify it as cipd uploading version.
TODO(shenghuazhang): use DEPS edition operations after issue crb... | Find the sdk pkg version in DEPS and modify it as cipd uploading version.
TODO(shenghuazhang): use DEPS edition operations after issue crbug.com/760633
fixed.
DEPS file hooks sdk package with version with suffix -crX, e.g. '26.0.2-cr1'.
If pkg_version is the base number of the existing version in DEPS, e.g.
... | Find the sdk pkg version in DEPS and modify it as cipd uploading version.
DEPS file hooks sdk package with version with suffix -crX, e.g. | [
"Find",
"the",
"sdk",
"pkg",
"version",
"in",
"DEPS",
"and",
"modify",
"it",
"as",
"cipd",
"uploading",
"version",
".",
"DEPS",
"file",
"hooks",
"sdk",
"package",
"with",
"version",
"with",
"suffix",
"-",
"crX",
"e",
".",
"g",
"."
] | def UpdateInstanceId(package,
deps_path,
dry_run,
new_instance_id,
release_version=None):
var_package = package
if release_version:
var_package = release_version + '_' + var_package
package_var_pattern = re.compile(
r'(^... | [
"def",
"UpdateInstanceId",
"(",
"package",
",",
"deps_path",
",",
"dry_run",
",",
"new_instance_id",
",",
"release_version",
"=",
"None",
")",
":",
"var_package",
"=",
"package",
"if",
"release_version",
":",
"var_package",
"=",
"release_version",
"+",
"'_'",
"+... | Find the sdk pkg version in DEPS and modify it as cipd uploading version. | [
"Find",
"the",
"sdk",
"pkg",
"version",
"in",
"DEPS",
"and",
"modify",
"it",
"as",
"cipd",
"uploading",
"version",
"."
] | [
"\"\"\"Find the sdk pkg version in DEPS and modify it as cipd uploading version.\n\n TODO(shenghuazhang): use DEPS edition operations after issue crbug.com/760633\n fixed.\n\n DEPS file hooks sdk package with version with suffix -crX, e.g. '26.0.2-cr1'.\n If pkg_version is the base number of the existing versio... | [
{
"param": "package",
"type": null
},
{
"param": "deps_path",
"type": null
},
{
"param": "dry_run",
"type": null
},
{
"param": "new_instance_id",
"type": null
},
{
"param": "release_version",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "package",
"type": null,
"docstring": "The name of the package.",
"docstring_tokens": [
"The",
"name",
"of",
"the",
"package",
"."
],
"default": null,
"is_option... |
61c717e0072ebdb01bbef61af878b6df9f1f2f9a | sunlongbo/chromium | tools/android/sdk_updater/update_sdk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ChangeVersionInGNI | null | def ChangeVersionInGNI(package, arg_version, gn_args_dict, gni_file_path,
dry_run):
"""Change the sdk package version in config.gni file."""
if package in gn_args_dict:
version_config_name = gn_args_dict.get(package)
# Regex to parse the line of sdk package version gn argument, e.g.
... | Change the sdk package version in config.gni file. | Change the sdk package version in config.gni file. | [
"Change",
"the",
"sdk",
"package",
"version",
"in",
"config",
".",
"gni",
"file",
"."
] | def ChangeVersionInGNI(package, arg_version, gn_args_dict, gni_file_path,
dry_run):
if package in gn_args_dict:
version_config_name = gn_args_dict.get(package)
gn_arg_pattern = re.compile(
r'(^\s*%s\s*=\s*)' % version_config_name +
r'("?)' +
r'(?:[-\w\s.]+)' +
... | [
"def",
"ChangeVersionInGNI",
"(",
"package",
",",
"arg_version",
",",
"gn_args_dict",
",",
"gni_file_path",
",",
"dry_run",
")",
":",
"if",
"package",
"in",
"gn_args_dict",
":",
"version_config_name",
"=",
"gn_args_dict",
".",
"get",
"(",
"package",
")",
"gn_arg... | Change the sdk package version in config.gni file. | [
"Change",
"the",
"sdk",
"package",
"version",
"in",
"config",
".",
"gni",
"file",
"."
] | [
"\"\"\"Change the sdk package version in config.gni file.\"\"\"",
"# Regex to parse the line of sdk package version gn argument, e.g.",
"# ' default_android_sdk_version = \"27\"'. Capture a group for the line",
"# excluding the version.",
"# Match the argument with '=' and whitespaces. Capture a group for ... | [
{
"param": "package",
"type": null
},
{
"param": "arg_version",
"type": null
},
{
"param": "gn_args_dict",
"type": null
},
{
"param": "gni_file_path",
"type": null
},
{
"param": "dry_run",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "package",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg_version",
"type": null,
"docstring": null,
"docstring_... |
61c717e0072ebdb01bbef61af878b6df9f1f2f9a | sunlongbo/chromium | tools/android/sdk_updater/update_sdk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetToolsSuffix | <not_specific> | def GetToolsSuffix(tools_lib_path):
"""Get the gn config of package 'tools' suffix.
Check jar file name of 'common*.jar' in tools/lib, which could be
'common.jar', common-<version>-dev.jar' or 'common-<version>.jar'.
If suffix exists, return the suffix.
Args:
tools_lib_path: The path of tools/lib.
Re... | Get the gn config of package 'tools' suffix.
Check jar file name of 'common*.jar' in tools/lib, which could be
'common.jar', common-<version>-dev.jar' or 'common-<version>.jar'.
If suffix exists, return the suffix.
Args:
tools_lib_path: The path of tools/lib.
Returns:
The suffix of tools package.
... | Get the gn config of package 'tools' suffix. | [
"Get",
"the",
"gn",
"config",
"of",
"package",
"'",
"tools",
"'",
"suffix",
"."
] | def GetToolsSuffix(tools_lib_path):
tools_lib_jars_list = os.listdir(tools_lib_path)
for file_name in tools_lib_jars_list:
found = re.match(_COMMON_JAR_SUFFIX_PATTERN, file_name)
if found:
return found.group(1) | [
"def",
"GetToolsSuffix",
"(",
"tools_lib_path",
")",
":",
"tools_lib_jars_list",
"=",
"os",
".",
"listdir",
"(",
"tools_lib_path",
")",
"for",
"file_name",
"in",
"tools_lib_jars_list",
":",
"found",
"=",
"re",
".",
"match",
"(",
"_COMMON_JAR_SUFFIX_PATTERN",
",",
... | Get the gn config of package 'tools' suffix. | [
"Get",
"the",
"gn",
"config",
"of",
"package",
"'",
"tools",
"'",
"suffix",
"."
] | [
"\"\"\"Get the gn config of package 'tools' suffix.\n\n Check jar file name of 'common*.jar' in tools/lib, which could be\n 'common.jar', common-<version>-dev.jar' or 'common-<version>.jar'.\n If suffix exists, return the suffix.\n\n Args:\n tools_lib_path: The path of tools/lib.\n\n Returns:\n The suffi... | [
{
"param": "tools_lib_path",
"type": null
}
] | {
"returns": [
{
"docstring": "The suffix of tools package.",
"docstring_tokens": [
"The",
"suffix",
"of",
"tools",
"package",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "tools_lib_path",
"typ... |
61c717e0072ebdb01bbef61af878b6df9f1f2f9a | sunlongbo/chromium | tools/android/sdk_updater/update_sdk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _UploadSdkPackage | null | def _UploadSdkPackage(arguments):
"""Upload SDK packages to CIPD.
Args:
arguments: The arguments parsed by argparser.
Raises:
IOError: Don't use --version/--yaml-file for default packages.
"""
packages = arguments.package
if not packages:
packages = _DEFAULT_DOWNLOAD_PACKAGES
if arguments.... | Upload SDK packages to CIPD.
Args:
arguments: The arguments parsed by argparser.
Raises:
IOError: Don't use --version/--yaml-file for default packages.
| Upload SDK packages to CIPD. | [
"Upload",
"SDK",
"packages",
"to",
"CIPD",
"."
] | def _UploadSdkPackage(arguments):
packages = arguments.package
if not packages:
packages = _DEFAULT_DOWNLOAD_PACKAGES
if arguments.version or arguments.yaml_file:
raise IOError("Don't use --version/--yaml-file for default packages.")
for package in packages:
pkg_version = arguments.version
i... | [
"def",
"_UploadSdkPackage",
"(",
"arguments",
")",
":",
"packages",
"=",
"arguments",
".",
"package",
"if",
"not",
"packages",
":",
"packages",
"=",
"_DEFAULT_DOWNLOAD_PACKAGES",
"if",
"arguments",
".",
"version",
"or",
"arguments",
".",
"yaml_file",
":",
"raise... | Upload SDK packages to CIPD. | [
"Upload",
"SDK",
"packages",
"to",
"CIPD",
"."
] | [
"\"\"\"Upload SDK packages to CIPD.\n\n Args:\n arguments: The arguments parsed by argparser.\n\n Raises:\n IOError: Don't use --version/--yaml-file for default packages.\n \"\"\"",
"# Upload SDK package to CIPD, and update the package instance ID hooking",
"# in DEPS file.",
"# Update the package ve... | [
{
"param": "arguments",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "Don't use --version/--yaml-file for default packages.",
"docstring_tokens": [
"Don",
"'",
"t",
"use",
"--",
"version",
"/",
"--",
"yaml",
"-",
"file",
"for",
... |
18650b85725b04af94feab387db29b587b3a621b | sunlongbo/chromium | tools/cygprofile/process_profiles.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SymbolsSize | <not_specific> | def SymbolsSize(self, symbols):
"""Computes the total size of a set of symbol names.
Args:
offsets (str iterable) a set of symbols.
Returns
int The sum of the primary size of the offsets.
"""
name_map = self.NameToSymbolMap()
return sum(name_map[sym].size for sym in symbols) | Computes the total size of a set of symbol names.
Args:
offsets (str iterable) a set of symbols.
Returns
int The sum of the primary size of the offsets.
| Computes the total size of a set of symbol names.
Args:
offsets (str iterable) a set of symbols.
Returns
int The sum of the primary size of the offsets. | [
"Computes",
"the",
"total",
"size",
"of",
"a",
"set",
"of",
"symbol",
"names",
".",
"Args",
":",
"offsets",
"(",
"str",
"iterable",
")",
"a",
"set",
"of",
"symbols",
".",
"Returns",
"int",
"The",
"sum",
"of",
"the",
"primary",
"size",
"of",
"the",
"o... | def SymbolsSize(self, symbols):
name_map = self.NameToSymbolMap()
return sum(name_map[sym].size for sym in symbols) | [
"def",
"SymbolsSize",
"(",
"self",
",",
"symbols",
")",
":",
"name_map",
"=",
"self",
".",
"NameToSymbolMap",
"(",
")",
"return",
"sum",
"(",
"name_map",
"[",
"sym",
"]",
".",
"size",
"for",
"sym",
"in",
"symbols",
")"
] | Computes the total size of a set of symbol names. | [
"Computes",
"the",
"total",
"size",
"of",
"a",
"set",
"of",
"symbol",
"names",
"."
] | [
"\"\"\"Computes the total size of a set of symbol names.\n\n Args:\n offsets (str iterable) a set of symbols.\n\n Returns\n int The sum of the primary size of the offsets.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "symbols",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "symbols",
"type": null,
"docstring": null,
"docstring_tokens"... |
18650b85725b04af94feab387db29b587b3a621b | sunlongbo/chromium | tools/cygprofile/process_profiles.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetReachedOffsetsFromDump | <not_specific> | def GetReachedOffsetsFromDump(self, dump):
"""Find the symbol offsets from a list of binary offsets.
The dump is a list offsets into a .text section. This finds the symbols
which contain the dump offsets, and returns their offsets. Note that while
usually a symbol offset corresponds to a single symbol,... | Find the symbol offsets from a list of binary offsets.
The dump is a list offsets into a .text section. This finds the symbols
which contain the dump offsets, and returns their offsets. Note that while
usually a symbol offset corresponds to a single symbol, in some cases
several symbols will map to the... | Find the symbol offsets from a list of binary offsets.
The dump is a list offsets into a .text section. This finds the symbols
which contain the dump offsets, and returns their offsets. Note that while
usually a symbol offset corresponds to a single symbol, in some cases
several symbols will map to the same offset. For... | [
"Find",
"the",
"symbol",
"offsets",
"from",
"a",
"list",
"of",
"binary",
"offsets",
".",
"The",
"dump",
"is",
"a",
"list",
"offsets",
"into",
"a",
".",
"text",
"section",
".",
"This",
"finds",
"the",
"symbols",
"which",
"contain",
"the",
"dump",
"offsets... | def GetReachedOffsetsFromDump(self, dump):
reached_offsets = []
already_seen = set()
def update(_, symbol_offset):
if symbol_offset is None or symbol_offset in already_seen:
return
reached_offsets.append(symbol_offset)
already_seen.add(symbol_offset)
self._TranslateReachedOffse... | [
"def",
"GetReachedOffsetsFromDump",
"(",
"self",
",",
"dump",
")",
":",
"reached_offsets",
"=",
"[",
"]",
"already_seen",
"=",
"set",
"(",
")",
"def",
"update",
"(",
"_",
",",
"symbol_offset",
")",
":",
"if",
"symbol_offset",
"is",
"None",
"or",
"symbol_of... | Find the symbol offsets from a list of binary offsets. | [
"Find",
"the",
"symbol",
"offsets",
"from",
"a",
"list",
"of",
"binary",
"offsets",
"."
] | [
"\"\"\"Find the symbol offsets from a list of binary offsets.\n\n The dump is a list offsets into a .text section. This finds the symbols\n which contain the dump offsets, and returns their offsets. Note that while\n usually a symbol offset corresponds to a single symbol, in some cases\n several symbols... | [
{
"param": "self",
"type": null
},
{
"param": "dump",
"type": null
}
] | {
"returns": [
{
"docstring": "[int] Reached symbol offsets.",
"docstring_tokens": [
"[",
"int",
"]",
"Reached",
"symbol",
"offsets",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
... |
18650b85725b04af94feab387db29b587b3a621b | sunlongbo/chromium | tools/cygprofile/process_profiles.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MatchSymbolNames | <not_specific> | def MatchSymbolNames(self, symbol_names):
"""Find the symbols in this binary which match a list of symbols.
Args:
symbol_names (str iterable) List of symbol names.
Returns:
[symbol_extractor.SymbolInfo] Symbols in this binary matching the names.
"""
our_symbol_names = set(s.name for s ... | Find the symbols in this binary which match a list of symbols.
Args:
symbol_names (str iterable) List of symbol names.
Returns:
[symbol_extractor.SymbolInfo] Symbols in this binary matching the names.
| Find the symbols in this binary which match a list of symbols.
Args:
symbol_names (str iterable) List of symbol names.
[symbol_extractor.SymbolInfo] Symbols in this binary matching the names. | [
"Find",
"the",
"symbols",
"in",
"this",
"binary",
"which",
"match",
"a",
"list",
"of",
"symbols",
".",
"Args",
":",
"symbol_names",
"(",
"str",
"iterable",
")",
"List",
"of",
"symbol",
"names",
".",
"[",
"symbol_extractor",
".",
"SymbolInfo",
"]",
"Symbols... | def MatchSymbolNames(self, symbol_names):
our_symbol_names = set(s.name for s in self.SymbolInfos())
matched_names = our_symbol_names.intersection(set(symbol_names))
return sorted([self.NameToSymbolMap()[n] for n in matched_names]) | [
"def",
"MatchSymbolNames",
"(",
"self",
",",
"symbol_names",
")",
":",
"our_symbol_names",
"=",
"set",
"(",
"s",
".",
"name",
"for",
"s",
"in",
"self",
".",
"SymbolInfos",
"(",
")",
")",
"matched_names",
"=",
"our_symbol_names",
".",
"intersection",
"(",
"... | Find the symbols in this binary which match a list of symbols. | [
"Find",
"the",
"symbols",
"in",
"this",
"binary",
"which",
"match",
"a",
"list",
"of",
"symbols",
"."
] | [
"\"\"\"Find the symbols in this binary which match a list of symbols.\n\n Args:\n symbol_names (str iterable) List of symbol names.\n\n Returns:\n [symbol_extractor.SymbolInfo] Symbols in this binary matching the names.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "symbol_names",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "symbol_names",
"type": null,
"docstring": null,
"docstring_to... |
18650b85725b04af94feab387db29b587b3a621b | sunlongbo/chromium | tools/cygprofile/process_profiles.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | TranslateAnnotatedSymbolOffsets | null | def TranslateAnnotatedSymbolOffsets(self, annotated_offsets):
"""Merges offsets across run groups and translates to symbol offsets.
Like GetReachedOffsetsFromDump, but works with AnnotatedOffsets.
Args:
annotated_offsets (AnnotatedOffset iterable) List of annotated offsets,
eg from ProfileMa... | Merges offsets across run groups and translates to symbol offsets.
Like GetReachedOffsetsFromDump, but works with AnnotatedOffsets.
Args:
annotated_offsets (AnnotatedOffset iterable) List of annotated offsets,
eg from ProfileManager.GetAnnotatedOffsets(). This will be mutated to
translat... | Merges offsets across run groups and translates to symbol offsets.
| [
"Merges",
"offsets",
"across",
"run",
"groups",
"and",
"translates",
"to",
"symbol",
"offsets",
"."
] | def TranslateAnnotatedSymbolOffsets(self, annotated_offsets):
self._TranslateReachedOffsetsFromDump(
annotated_offsets,
lambda o: o.Offset(),
lambda o, symbol_offset: o.SetOffset(symbol_offset)) | [
"def",
"TranslateAnnotatedSymbolOffsets",
"(",
"self",
",",
"annotated_offsets",
")",
":",
"self",
".",
"_TranslateReachedOffsetsFromDump",
"(",
"annotated_offsets",
",",
"lambda",
"o",
":",
"o",
".",
"Offset",
"(",
")",
",",
"lambda",
"o",
",",
"symbol_offset",
... | Merges offsets across run groups and translates to symbol offsets. | [
"Merges",
"offsets",
"across",
"run",
"groups",
"and",
"translates",
"to",
"symbol",
"offsets",
"."
] | [
"\"\"\"Merges offsets across run groups and translates to symbol offsets.\n\n Like GetReachedOffsetsFromDump, but works with AnnotatedOffsets.\n\n Args:\n annotated_offsets (AnnotatedOffset iterable) List of annotated offsets,\n eg from ProfileManager.GetAnnotatedOffsets(). This will be mutated to... | [
{
"param": "self",
"type": null
},
{
"param": "annotated_offsets",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "annotated_offsets",
"type": null,
"docstring": null,
"docstri... |
18650b85725b04af94feab387db29b587b3a621b | sunlongbo/chromium | tools/cygprofile/process_profiles.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _TranslateReachedOffsetsFromDump | null | def _TranslateReachedOffsetsFromDump(self, items, get, update):
"""Translate raw binary offsets to symbol offsets.
See GetReachedOffsetsFromDump for details. This version calls
|get(i)| on each element |i| of |items|, then calls
|update(i, symbol_offset)| with the updated offset. If the offset is not
... | Translate raw binary offsets to symbol offsets.
See GetReachedOffsetsFromDump for details. This version calls
|get(i)| on each element |i| of |items|, then calls
|update(i, symbol_offset)| with the updated offset. If the offset is not
found, update will be called with None.
Args:
items: (ite... | Translate raw binary offsets to symbol offsets.
See GetReachedOffsetsFromDump for details. | [
"Translate",
"raw",
"binary",
"offsets",
"to",
"symbol",
"offsets",
".",
"See",
"GetReachedOffsetsFromDump",
"for",
"details",
"."
] | def _TranslateReachedOffsetsFromDump(self, items, get, update):
dump_offset_to_symbol_info = self.GetDumpOffsetToSymbolInfo()
for i in items:
dump_offset = get(i)
idx = dump_offset // 2
assert dump_offset >= 0 and idx < len(dump_offset_to_symbol_info), (
'Dump offset out of binary ra... | [
"def",
"_TranslateReachedOffsetsFromDump",
"(",
"self",
",",
"items",
",",
"get",
",",
"update",
")",
":",
"dump_offset_to_symbol_info",
"=",
"self",
".",
"GetDumpOffsetToSymbolInfo",
"(",
")",
"for",
"i",
"in",
"items",
":",
"dump_offset",
"=",
"get",
"(",
"i... | Translate raw binary offsets to symbol offsets. | [
"Translate",
"raw",
"binary",
"offsets",
"to",
"symbol",
"offsets",
"."
] | [
"\"\"\"Translate raw binary offsets to symbol offsets.\n\n See GetReachedOffsetsFromDump for details. This version calls\n |get(i)| on each element |i| of |items|, then calls\n |update(i, symbol_offset)| with the updated offset. If the offset is not\n found, update will be called with None.\n\n Args:... | [
{
"param": "self",
"type": null
},
{
"param": "items",
"type": null
},
{
"param": "get",
"type": null
},
{
"param": "update",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "items",
"type": null,
"docstring": "(iterable) Items containing off... |
18650b85725b04af94feab387db29b587b3a621b | sunlongbo/chromium | tools/cygprofile/process_profiles.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetWhitelistSymbols | <not_specific> | def GetWhitelistSymbols(self):
"""Returns list(string) containing names of the symbols whose size is zero.
"""
if self._whitelist is None:
self.GetDumpOffsetToSymboInfolIncludingWhitelist()
return self._whitelist | Returns list(string) containing names of the symbols whose size is zero.
| Returns list(string) containing names of the symbols whose size is zero. | [
"Returns",
"list",
"(",
"string",
")",
"containing",
"names",
"of",
"the",
"symbols",
"whose",
"size",
"is",
"zero",
"."
] | def GetWhitelistSymbols(self):
if self._whitelist is None:
self.GetDumpOffsetToSymboInfolIncludingWhitelist()
return self._whitelist | [
"def",
"GetWhitelistSymbols",
"(",
"self",
")",
":",
"if",
"self",
".",
"_whitelist",
"is",
"None",
":",
"self",
".",
"GetDumpOffsetToSymboInfolIncludingWhitelist",
"(",
")",
"return",
"self",
".",
"_whitelist"
] | Returns list(string) containing names of the symbols whose size is zero. | [
"Returns",
"list",
"(",
"string",
")",
"containing",
"names",
"of",
"the",
"symbols",
"whose",
"size",
"is",
"zero",
"."
] | [
"\"\"\"Returns list(string) containing names of the symbols whose size is zero.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18650b85725b04af94feab387db29b587b3a621b | sunlongbo/chromium | tools/cygprofile/process_profiles.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetDumpOffsetToSymboInfolIncludingWhitelist | <not_specific> | def GetDumpOffsetToSymboInfolIncludingWhitelist(self):
"""Computes an array mapping each word in .text to a symbol.
This list includes symbols with size 0. It considers all offsets till the
next symbol to map to the symbol of size 0.
Returns:
[symbol_extractor.SymbolInfo or None] For every 4 byt... | Computes an array mapping each word in .text to a symbol.
This list includes symbols with size 0. It considers all offsets till the
next symbol to map to the symbol of size 0.
Returns:
[symbol_extractor.SymbolInfo or None] For every 4 bytes of the .text
section, maps it to a symbol, or None.... | Computes an array mapping each word in .text to a symbol.
This list includes symbols with size 0. It considers all offsets till the
next symbol to map to the symbol of size 0. | [
"Computes",
"an",
"array",
"mapping",
"each",
"word",
"in",
".",
"text",
"to",
"a",
"symbol",
".",
"This",
"list",
"includes",
"symbols",
"with",
"size",
"0",
".",
"It",
"considers",
"all",
"offsets",
"till",
"the",
"next",
"symbol",
"to",
"map",
"to",
... | def GetDumpOffsetToSymboInfolIncludingWhitelist(self):
if self._whitelist is None:
self._whitelist = set()
symbols = self.SymbolInfos()
start_syms = [s for s in symbols
if s.name == symbol_extractor.START_OF_TEXT_SYMBOL]
assert len(start_syms) == 1, 'Can\'t find unique st... | [
"def",
"GetDumpOffsetToSymboInfolIncludingWhitelist",
"(",
"self",
")",
":",
"if",
"self",
".",
"_whitelist",
"is",
"None",
":",
"self",
".",
"_whitelist",
"=",
"set",
"(",
")",
"symbols",
"=",
"self",
".",
"SymbolInfos",
"(",
")",
"start_syms",
"=",
"[",
... | Computes an array mapping each word in .text to a symbol. | [
"Computes",
"an",
"array",
"mapping",
"each",
"word",
"in",
".",
"text",
"to",
"a",
"symbol",
"."
] | [
"\"\"\"Computes an array mapping each word in .text to a symbol.\n\n This list includes symbols with size 0. It considers all offsets till the\n next symbol to map to the symbol of size 0.\n\n Returns:\n [symbol_extractor.SymbolInfo or None] For every 4 bytes of the .text\n section, maps it to ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "[symbol_extractor.SymbolInfo or None] For every 4 bytes of the .text\nsection, maps it to a symbol, or None.",
"docstring_tokens": [
"[",
"symbol_extractor",
".",
"SymbolInfo",
"or",
"None",
"]",
"For",
... |
18650b85725b04af94feab387db29b587b3a621b | sunlongbo/chromium | tools/cygprofile/process_profiles.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetDumpOffsetToSymbolInfo | <not_specific> | def GetDumpOffsetToSymbolInfo(self):
"""Computes an array mapping each word in .text to a symbol.
Returns:
[symbol_extractor.SymbolInfo or None] For every 4 bytes of the .text
section, maps it to a symbol, or None.
"""
if self._offset_to_symbol_info is None:
start_syms = [s for s in... | Computes an array mapping each word in .text to a symbol.
Returns:
[symbol_extractor.SymbolInfo or None] For every 4 bytes of the .text
section, maps it to a symbol, or None.
| Computes an array mapping each word in .text to a symbol. | [
"Computes",
"an",
"array",
"mapping",
"each",
"word",
"in",
".",
"text",
"to",
"a",
"symbol",
"."
] | def GetDumpOffsetToSymbolInfo(self):
if self._offset_to_symbol_info is None:
start_syms = [s for s in self.SymbolInfos()
if s.name == symbol_extractor.START_OF_TEXT_SYMBOL]
assert len(start_syms) == 1, 'Can\'t find unique start of text symbol'
start_of_text = start_syms[0].offs... | [
"def",
"GetDumpOffsetToSymbolInfo",
"(",
"self",
")",
":",
"if",
"self",
".",
"_offset_to_symbol_info",
"is",
"None",
":",
"start_syms",
"=",
"[",
"s",
"for",
"s",
"in",
"self",
".",
"SymbolInfos",
"(",
")",
"if",
"s",
".",
"name",
"==",
"symbol_extractor"... | Computes an array mapping each word in .text to a symbol. | [
"Computes",
"an",
"array",
"mapping",
"each",
"word",
"in",
".",
"text",
"to",
"a",
"symbol",
"."
] | [
"\"\"\"Computes an array mapping each word in .text to a symbol.\n\n Returns:\n [symbol_extractor.SymbolInfo or None] For every 4 bytes of the .text\n section, maps it to a symbol, or None.\n \"\"\"",
"# The low bit of offset may be set to indicate a thumb instruction. The",
"# actual offset i... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "[symbol_extractor.SymbolInfo or None] For every 4 bytes of the .text\nsection, maps it to a symbol, or None.",
"docstring_tokens": [
"[",
"symbol_extractor",
".",
"SymbolInfo",
"or",
"None",
"]",
"For",
... |
18650b85725b04af94feab387db29b587b3a621b | sunlongbo/chromium | tools/cygprofile/process_profiles.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetAnnotatedOffsets | <not_specific> | def GetAnnotatedOffsets(self):
"""Merges offsets across run groups and annotates each one.
Returns:
[AnnotatedOffset]
"""
offset_map = {} # offset int -> AnnotatedOffset
for g in self._GetRunGroups():
for f in g:
phase = self._Phase(f)
process = self._ProcessName(f)
... | Merges offsets across run groups and annotates each one.
Returns:
[AnnotatedOffset]
| Merges offsets across run groups and annotates each one. | [
"Merges",
"offsets",
"across",
"run",
"groups",
"and",
"annotates",
"each",
"one",
"."
] | def GetAnnotatedOffsets(self):
offset_map = {}
for g in self._GetRunGroups():
for f in g:
phase = self._Phase(f)
process = self._ProcessName(f)
for offset in self._ReadOffsets(f):
offset_map.setdefault(offset, self.AnnotatedOffset(offset)).Increment(
phase... | [
"def",
"GetAnnotatedOffsets",
"(",
"self",
")",
":",
"offset_map",
"=",
"{",
"}",
"for",
"g",
"in",
"self",
".",
"_GetRunGroups",
"(",
")",
":",
"for",
"f",
"in",
"g",
":",
"phase",
"=",
"self",
".",
"_Phase",
"(",
"f",
")",
"process",
"=",
"self",... | Merges offsets across run groups and annotates each one. | [
"Merges",
"offsets",
"across",
"run",
"groups",
"and",
"annotates",
"each",
"one",
"."
] | [
"\"\"\"Merges offsets across run groups and annotates each one.\n\n Returns:\n [AnnotatedOffset]\n \"\"\"",
"# offset int -> AnnotatedOffset"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
18650b85725b04af94feab387db29b587b3a621b | sunlongbo/chromium | tools/cygprofile/process_profiles.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetProcessOffsetLists | <not_specific> | def GetProcessOffsetLists(self):
"""Returns all symbol offsets lists, grouped by process."""
offsets_by_process = collections.defaultdict(list)
for f in self._filenames:
offsets_by_process[self._ProcessName(f)].append(self._ReadOffsets(f))
return offsets_by_process | Returns all symbol offsets lists, grouped by process. | Returns all symbol offsets lists, grouped by process. | [
"Returns",
"all",
"symbol",
"offsets",
"lists",
"grouped",
"by",
"process",
"."
] | def GetProcessOffsetLists(self):
offsets_by_process = collections.defaultdict(list)
for f in self._filenames:
offsets_by_process[self._ProcessName(f)].append(self._ReadOffsets(f))
return offsets_by_process | [
"def",
"GetProcessOffsetLists",
"(",
"self",
")",
":",
"offsets_by_process",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"f",
"in",
"self",
".",
"_filenames",
":",
"offsets_by_process",
"[",
"self",
".",
"_ProcessName",
"(",
"f",
")",
"]... | Returns all symbol offsets lists, grouped by process. | [
"Returns",
"all",
"symbol",
"offsets",
"lists",
"grouped",
"by",
"process",
"."
] | [
"\"\"\"Returns all symbol offsets lists, grouped by process.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18650b85725b04af94feab387db29b587b3a621b | sunlongbo/chromium | tools/cygprofile/process_profiles.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetProcessOffsetGraph | <not_specific> | def GetProcessOffsetGraph(self):
"""Returns a dict that maps each process type to a list of processes's
call graph data.
Typical process type keys are 'gpu-process', 'renderer', 'browser'.
"""
graph_by_process = collections.defaultdict(list)
for f in self._filenames:
process_info = sel... | Returns a dict that maps each process type to a list of processes's
call graph data.
Typical process type keys are 'gpu-process', 'renderer', 'browser'.
| Returns a dict that maps each process type to a list of processes's
call graph data.
| [
"Returns",
"a",
"dict",
"that",
"maps",
"each",
"process",
"type",
"to",
"a",
"list",
"of",
"processes",
"'",
"s",
"call",
"graph",
"data",
"."
] | def GetProcessOffsetGraph(self):
graph_by_process = collections.defaultdict(list)
for f in self._filenames:
process_info = self._ReadJSON(f)
assert ('total_calls_count' in process_info
and 'call_graph' in process_info), ('Unexpected JSON format for '
... | [
"def",
"GetProcessOffsetGraph",
"(",
"self",
")",
":",
"graph_by_process",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"f",
"in",
"self",
".",
"_filenames",
":",
"process_info",
"=",
"self",
".",
"_ReadJSON",
"(",
"f",
")",
"assert",
"... | Returns a dict that maps each process type to a list of processes's
call graph data. | [
"Returns",
"a",
"dict",
"that",
"maps",
"each",
"process",
"type",
"to",
"a",
"list",
"of",
"processes",
"'",
"s",
"call",
"graph",
"data",
"."
] | [
"\"\"\"Returns a dict that maps each process type to a list of processes's\n call graph data.\n\n Typical process type keys are 'gpu-process', 'renderer', 'browser'.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
186d946cbc9d1e6aa8ab9c5923ac9006c51cb085 | sunlongbo/chromium | third_party/afl/update.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | update | null | def update(self, new_version):
"""
Update the readme to reflect the new version that has been downloaded.
"""
new_readme = self.readme_contents
subsitutions = [(VERSION_REGEX, new_version), # Update the version.
(r'Date: .*',
'Date: ' + datetime.date.today()... |
Update the readme to reflect the new version that has been downloaded.
| Update the readme to reflect the new version that has been downloaded. | [
"Update",
"the",
"readme",
"to",
"reflect",
"the",
"new",
"version",
"that",
"has",
"been",
"downloaded",
"."
] | def update(self, new_version):
new_readme = self.readme_contents
subsitutions = [(VERSION_REGEX, new_version),
(r'Date: .*',
'Date: ' + datetime.date.today().strftime("%B %d, %Y")),
(PATH_REGEX + r'/', 'afl-' + new_version + '/')]
for regex, rep... | [
"def",
"update",
"(",
"self",
",",
"new_version",
")",
":",
"new_readme",
"=",
"self",
".",
"readme_contents",
"subsitutions",
"=",
"[",
"(",
"VERSION_REGEX",
",",
"new_version",
")",
",",
"(",
"r'Date: .*'",
",",
"'Date: '",
"+",
"datetime",
".",
"date",
... | Update the readme to reflect the new version that has been downloaded. | [
"Update",
"the",
"readme",
"to",
"reflect",
"the",
"new",
"version",
"that",
"has",
"been",
"downloaded",
"."
] | [
"\"\"\"\n Update the readme to reflect the new version that has been downloaded.\n \"\"\"",
"# Update the version.",
"# Update the Local Modifications."
] | [
{
"param": "self",
"type": null
},
{
"param": "new_version",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "new_version",
"type": null,
"docstring": null,
"docstring_tok... |
186d946cbc9d1e6aa8ab9c5923ac9006c51cb085 | sunlongbo/chromium | third_party/afl/update.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | extract | null | def extract(self):
"""
Extract the files and folders from the tarball we have downloaded while
skipping unwanted ones.
"""
for member in self.tarball.getmembers():
member.path = re.sub(PATH_REGEX, self.AFL_SRC_DIR, member.path)
if re.match(self.UNWANTED_FILE_REGEX, member.path):
... |
Extract the files and folders from the tarball we have downloaded while
skipping unwanted ones.
| Extract the files and folders from the tarball we have downloaded while
skipping unwanted ones. | [
"Extract",
"the",
"files",
"and",
"folders",
"from",
"the",
"tarball",
"we",
"have",
"downloaded",
"while",
"skipping",
"unwanted",
"ones",
"."
] | def extract(self):
for member in self.tarball.getmembers():
member.path = re.sub(PATH_REGEX, self.AFL_SRC_DIR, member.path)
if re.match(self.UNWANTED_FILE_REGEX, member.path):
print 'skipping unwanted file: {0}'.format(member.path)
continue
self.tarball.extract(member) | [
"def",
"extract",
"(",
"self",
")",
":",
"for",
"member",
"in",
"self",
".",
"tarball",
".",
"getmembers",
"(",
")",
":",
"member",
".",
"path",
"=",
"re",
".",
"sub",
"(",
"PATH_REGEX",
",",
"self",
".",
"AFL_SRC_DIR",
",",
"member",
".",
"path",
... | Extract the files and folders from the tarball we have downloaded while
skipping unwanted ones. | [
"Extract",
"the",
"files",
"and",
"folders",
"from",
"the",
"tarball",
"we",
"have",
"downloaded",
"while",
"skipping",
"unwanted",
"ones",
"."
] | [
"\"\"\"\n Extract the files and folders from the tarball we have downloaded while\n skipping unwanted ones.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
186d946cbc9d1e6aa8ab9c5923ac9006c51cb085 | sunlongbo/chromium | third_party/afl/update.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | version_to_float | <not_specific> | def version_to_float(version):
"""
Convert version string to float.
"""
if version.endswith('b'):
return float(version[:-1])
return float(version) |
Convert version string to float.
| Convert version string to float. | [
"Convert",
"version",
"string",
"to",
"float",
"."
] | def version_to_float(version):
if version.endswith('b'):
return float(version[:-1])
return float(version) | [
"def",
"version_to_float",
"(",
"version",
")",
":",
"if",
"version",
".",
"endswith",
"(",
"'b'",
")",
":",
"return",
"float",
"(",
"version",
"[",
":",
"-",
"1",
"]",
")",
"return",
"float",
"(",
"version",
")"
] | Convert version string to float. | [
"Convert",
"version",
"string",
"to",
"float",
"."
] | [
"\"\"\"\n Convert version string to float.\n \"\"\""
] | [
{
"param": "version",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "version",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
186d946cbc9d1e6aa8ab9c5923ac9006c51cb085 | sunlongbo/chromium | third_party/afl/update.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | update_afl | null | def update_afl(new_version):
"""
Update this version of AFL to newer version, new_version.
"""
readme = ChromiumReadme()
old_version = readme.get_current_version()
if new_version != 'latest':
new_float = version_to_float(new_version)
assert version_to_float(old_version) < new_float, (
'Tryin... |
Update this version of AFL to newer version, new_version.
| Update this version of AFL to newer version, new_version. | [
"Update",
"this",
"version",
"of",
"AFL",
"to",
"newer",
"version",
"new_version",
"."
] | def update_afl(new_version):
readme = ChromiumReadme()
old_version = readme.get_current_version()
if new_version != 'latest':
new_float = version_to_float(new_version)
assert version_to_float(old_version) < new_float, (
'Trying to update from version {0} to {1}'.format(old_version,
... | [
"def",
"update_afl",
"(",
"new_version",
")",
":",
"readme",
"=",
"ChromiumReadme",
"(",
")",
"old_version",
"=",
"readme",
".",
"get_current_version",
"(",
")",
"if",
"new_version",
"!=",
"'latest'",
":",
"new_float",
"=",
"version_to_float",
"(",
"new_version"... | Update this version of AFL to newer version, new_version. | [
"Update",
"this",
"version",
"of",
"AFL",
"to",
"newer",
"version",
"new_version",
"."
] | [
"\"\"\"\n Update this version of AFL to newer version, new_version.\n \"\"\"",
"# Extract the tarball."
] | [
{
"param": "new_version",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "new_version",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
25acf2876a6d4aca86a4a580ab3febd89845822c | sunlongbo/chromium | remoting/tools/verify_resources.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | VerifyFile | <not_specific> | def VerifyFile(filename, messages, used_tags):
"""
Parse |filename|, looking for tags and report any that are not included in
|messages|. Return True if all tags are present and correct, or False if
any are missing.
"""
base_name, file_type = os.path.splitext(filename)
file_type = file_type[1:]
if file... |
Parse |filename|, looking for tags and report any that are not included in
|messages|. Return True if all tags are present and correct, or False if
any are missing.
| Parse |filename|, looking for tags and report any that are not included in
|messages|. Return True if all tags are present and correct, or False if
any are missing. | [
"Parse",
"|filename|",
"looking",
"for",
"tags",
"and",
"report",
"any",
"that",
"are",
"not",
"included",
"in",
"|messages|",
".",
"Return",
"True",
"if",
"all",
"tags",
"are",
"present",
"and",
"correct",
"or",
"False",
"if",
"any",
"are",
"missing",
"."... | def VerifyFile(filename, messages, used_tags):
base_name, file_type = os.path.splitext(filename)
file_type = file_type[1:]
if file_type == 'jinja2' and base_name.endswith('.json'):
file_type = 'json.jinja2'
if file_type not in ['js', 'cc', 'html', 'json.jinja2', 'jinja2', 'mm']:
raise Exception("Unknown... | [
"def",
"VerifyFile",
"(",
"filename",
",",
"messages",
",",
"used_tags",
")",
":",
"base_name",
",",
"file_type",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"file_type",
"=",
"file_type",
"[",
"1",
":",
"]",
"if",
"file_type",
"==",
... | Parse |filename|, looking for tags and report any that are not included in
|messages|. | [
"Parse",
"|filename|",
"looking",
"for",
"tags",
"and",
"report",
"any",
"that",
"are",
"not",
"included",
"in",
"|messages|",
"."
] | [
"\"\"\"\n Parse |filename|, looking for tags and report any that are not included in\n |messages|. Return True if all tags are present and correct, or False if\n any are missing.\n \"\"\""
] | [
{
"param": "filename",
"type": null
},
{
"param": "messages",
"type": null
},
{
"param": "used_tags",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "messages",
"type": null,
"docstring": null,
"docstring_to... |
c324c645b7145cf99a0db4715cdeba85995913af | sunlongbo/chromium | tools/unused-symbols-report.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Unyuck | <not_specific> | def Unyuck(sym):
"""Attempt to prettify a C++ symbol by some basic heuristics."""
sym = sym.replace('std::basic_string<char, std::char_traits<char>, '
'std::allocator<char> >', 'std::string')
sym = sym.replace('std::basic_string<wchar_t, std::char_traits<wchar_t>, '
'std::a... | Attempt to prettify a C++ symbol by some basic heuristics. | Attempt to prettify a C++ symbol by some basic heuristics. | [
"Attempt",
"to",
"prettify",
"a",
"C",
"++",
"symbol",
"by",
"some",
"basic",
"heuristics",
"."
] | def Unyuck(sym):
sym = sym.replace('std::basic_string<char, std::char_traits<char>, '
'std::allocator<char> >', 'std::string')
sym = sym.replace('std::basic_string<wchar_t, std::char_traits<wchar_t>, '
'std::allocator<wchar_t> >', 'std::wstring')
sym = sym.replace(
's... | [
"def",
"Unyuck",
"(",
"sym",
")",
":",
"sym",
"=",
"sym",
".",
"replace",
"(",
"'std::basic_string<char, std::char_traits<char>, '",
"'std::allocator<char> >'",
",",
"'std::string'",
")",
"sym",
"=",
"sym",
".",
"replace",
"(",
"'std::basic_string<wchar_t, std::char_tra... | Attempt to prettify a C++ symbol by some basic heuristics. | [
"Attempt",
"to",
"prettify",
"a",
"C",
"++",
"symbol",
"by",
"some",
"basic",
"heuristics",
"."
] | [
"\"\"\"Attempt to prettify a C++ symbol by some basic heuristics.\"\"\""
] | [
{
"param": "sym",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sym",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c324c645b7145cf99a0db4715cdeba85995913af | sunlongbo/chromium | tools/unused-symbols-report.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Output | null | def Output(iter):
"""Print HTML given an iterable of (target, path, symbol) tuples."""
targets = {}
for target, path, symbol in iter:
entries = targets.setdefault(target, [])
entries.append((symbol, path))
print(TEMPLATE_HEADER)
print("<p>jump to target:")
print("<select onchange='document.location... | Print HTML given an iterable of (target, path, symbol) tuples. | Print HTML given an iterable of (target, path, symbol) tuples. | [
"Print",
"HTML",
"given",
"an",
"iterable",
"of",
"(",
"target",
"path",
"symbol",
")",
"tuples",
"."
] | def Output(iter):
targets = {}
for target, path, symbol in iter:
entries = targets.setdefault(target, [])
entries.append((symbol, path))
print(TEMPLATE_HEADER)
print("<p>jump to target:")
print("<select onchange='document.location.hash = this.value'>")
for target in sorted(targets.keys()):
print... | [
"def",
"Output",
"(",
"iter",
")",
":",
"targets",
"=",
"{",
"}",
"for",
"target",
",",
"path",
",",
"symbol",
"in",
"iter",
":",
"entries",
"=",
"targets",
".",
"setdefault",
"(",
"target",
",",
"[",
"]",
")",
"entries",
".",
"append",
"(",
"(",
... | Print HTML given an iterable of (target, path, symbol) tuples. | [
"Print",
"HTML",
"given",
"an",
"iterable",
"of",
"(",
"target",
"path",
"symbol",
")",
"tuples",
"."
] | [
"\"\"\"Print HTML given an iterable of (target, path, symbol) tuples.\"\"\""
] | [
{
"param": "iter",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "iter",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ba96c1ad80db5aeb2b91c97f18bd268b473e400 | sunlongbo/chromium | chrome/test/chromedriver/test/unittest_util.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FilterTests | <not_specific> | def FilterTests(all_tests, gtest_filter):
"""Returns a filtered list of tests based on the given gtest filter.
See https://github.com/google/googletest/blob/master/docs/advanced.md
for gtest_filter specification.
"""
pattern_groups = gtest_filter.split('-')
positive_patterns = pattern_groups[0].split(':')
... | Returns a filtered list of tests based on the given gtest filter.
See https://github.com/google/googletest/blob/master/docs/advanced.md
for gtest_filter specification.
| Returns a filtered list of tests based on the given gtest filter. | [
"Returns",
"a",
"filtered",
"list",
"of",
"tests",
"based",
"on",
"the",
"given",
"gtest",
"filter",
"."
] | def FilterTests(all_tests, gtest_filter):
pattern_groups = gtest_filter.split('-')
positive_patterns = pattern_groups[0].split(':')
negative_patterns = None
if len(pattern_groups) > 1:
negative_patterns = pattern_groups[1].split(':')
tests = []
for test in all_tests:
test_name = GetTestName(test)
... | [
"def",
"FilterTests",
"(",
"all_tests",
",",
"gtest_filter",
")",
":",
"pattern_groups",
"=",
"gtest_filter",
".",
"split",
"(",
"'-'",
")",
"positive_patterns",
"=",
"pattern_groups",
"[",
"0",
"]",
".",
"split",
"(",
"':'",
")",
"negative_patterns",
"=",
"... | Returns a filtered list of tests based on the given gtest filter. | [
"Returns",
"a",
"filtered",
"list",
"of",
"tests",
"based",
"on",
"the",
"given",
"gtest",
"filter",
"."
] | [
"\"\"\"Returns a filtered list of tests based on the given gtest filter.\n\n See https://github.com/google/googletest/blob/master/docs/advanced.md\n for gtest_filter specification.\n \"\"\"",
"# Test name must by matched by one positive pattern.",
"# Test name must not be matched by any negative patterns."
] | [
{
"param": "all_tests",
"type": null
},
{
"param": "gtest_filter",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "all_tests",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gtest_filter",
"type": null,
"docstring": null,
"docstri... |
e8322ec9031e9959c9e3974e5cd38e54095effb1 | sunlongbo/chromium | tools/android/dependency_analysis/package_dependency.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | add_class | null | def add_class(self, java_class: class_dependency.JavaClass):
"""Adds a JavaClass to the package, if its key doesn't already exist.
Notably, this does /not/ automatically update the inbound/outbound
dependencies of the package with the dependencies of the class.
"""
if java_class... | Adds a JavaClass to the package, if its key doesn't already exist.
Notably, this does /not/ automatically update the inbound/outbound
dependencies of the package with the dependencies of the class.
| Adds a JavaClass to the package, if its key doesn't already exist.
Notably, this does /not/ automatically update the inbound/outbound
dependencies of the package with the dependencies of the class. | [
"Adds",
"a",
"JavaClass",
"to",
"the",
"package",
"if",
"its",
"key",
"doesn",
"'",
"t",
"already",
"exist",
".",
"Notably",
"this",
"does",
"/",
"not",
"/",
"automatically",
"update",
"the",
"inbound",
"/",
"outbound",
"dependencies",
"of",
"the",
"packag... | def add_class(self, java_class: class_dependency.JavaClass):
if java_class.name not in self._classes:
self._classes[java_class.name] = java_class | [
"def",
"add_class",
"(",
"self",
",",
"java_class",
":",
"class_dependency",
".",
"JavaClass",
")",
":",
"if",
"java_class",
".",
"name",
"not",
"in",
"self",
".",
"_classes",
":",
"self",
".",
"_classes",
"[",
"java_class",
".",
"name",
"]",
"=",
"java_... | Adds a JavaClass to the package, if its key doesn't already exist. | [
"Adds",
"a",
"JavaClass",
"to",
"the",
"package",
"if",
"its",
"key",
"doesn",
"'",
"t",
"already",
"exist",
"."
] | [
"\"\"\"Adds a JavaClass to the package, if its key doesn't already exist.\n\n Notably, this does /not/ automatically update the inbound/outbound\n dependencies of the package with the dependencies of the class.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "java_class",
"type": "class_dependency.JavaClass"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "java_class",
"type": "class_dependency.JavaClass",
"docstring": nul... |
e8322ec9031e9959c9e3974e5cd38e54095effb1 | sunlongbo/chromium | tools/android/dependency_analysis/package_dependency.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | add_class_dependency_edge | null | def add_class_dependency_edge(self, end_package: 'JavaPackage',
begin_class: class_dependency.JavaClass,
end_class: class_dependency.JavaClass):
"""Adds a class dependency edge as part of a package dependency.
Each package dependency i... | Adds a class dependency edge as part of a package dependency.
Each package dependency is comprised of one or more class dependencies,
we manually update the nodes with this info when parsing class graphs.
Args:
end_package: the end node of the package dependency edge
... | Adds a class dependency edge as part of a package dependency.
Each package dependency is comprised of one or more class dependencies,
we manually update the nodes with this info when parsing class graphs. | [
"Adds",
"a",
"class",
"dependency",
"edge",
"as",
"part",
"of",
"a",
"package",
"dependency",
".",
"Each",
"package",
"dependency",
"is",
"comprised",
"of",
"one",
"or",
"more",
"class",
"dependencies",
"we",
"manually",
"update",
"the",
"nodes",
"with",
"th... | def add_class_dependency_edge(self, end_package: 'JavaPackage',
begin_class: class_dependency.JavaClass,
end_class: class_dependency.JavaClass):
class_edge = (begin_class, end_class)
if class_edge not in self._class_dependency_edges[end... | [
"def",
"add_class_dependency_edge",
"(",
"self",
",",
"end_package",
":",
"'JavaPackage'",
",",
"begin_class",
":",
"class_dependency",
".",
"JavaClass",
",",
"end_class",
":",
"class_dependency",
".",
"JavaClass",
")",
":",
"class_edge",
"=",
"(",
"begin_class",
... | Adds a class dependency edge as part of a package dependency. | [
"Adds",
"a",
"class",
"dependency",
"edge",
"as",
"part",
"of",
"a",
"package",
"dependency",
"."
] | [
"\"\"\"Adds a class dependency edge as part of a package dependency.\n\n Each package dependency is comprised of one or more class dependencies,\n we manually update the nodes with this info when parsing class graphs.\n\n Args:\n end_package: the end node of the package dependency ed... | [
{
"param": "self",
"type": null
},
{
"param": "end_package",
"type": "'JavaPackage'"
},
{
"param": "begin_class",
"type": "class_dependency.JavaClass"
},
{
"param": "end_class",
"type": "class_dependency.JavaClass"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "end_package",
"type": "'JavaPackage'",
"docstring": "the end node o... |
e843bc5ebcdbbe6f87249defb7680fc9574024ea | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/models/test_expectations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _reset_lines | <not_specific> | def _reset_lines(self, path):
"""This method returns the Expectation instances for each line
in an expectations file. If there were any modifications made
through the remove_expectations or add_expectations member methods
then this method will update the in memory view of the expectation... | This method returns the Expectation instances for each line
in an expectations file. If there were any modifications made
through the remove_expectations or add_expectations member methods
then this method will update the in memory view of the expectations
file.
args:
... | This method returns the Expectation instances for each line
in an expectations file. If there were any modifications made
through the remove_expectations or add_expectations member methods
then this method will update the in memory view of the expectations
file.
Absolute path of expectations file. | [
"This",
"method",
"returns",
"the",
"Expectation",
"instances",
"for",
"each",
"line",
"in",
"an",
"expectations",
"file",
".",
"If",
"there",
"were",
"any",
"modifications",
"made",
"through",
"the",
"remove_expectations",
"or",
"add_expectations",
"member",
"met... | def _reset_lines(self, path):
content = self._expectations_dict[path]
idx = list(self._expectations_dict.keys()).index(path)
typ_expectations = self._expectations[idx]
lines = []
lineno_to_exps = defaultdict(list)
for pattern_to_exps in (typ_expectations.individual_exps,
... | [
"def",
"_reset_lines",
"(",
"self",
",",
"path",
")",
":",
"content",
"=",
"self",
".",
"_expectations_dict",
"[",
"path",
"]",
"idx",
"=",
"list",
"(",
"self",
".",
"_expectations_dict",
".",
"keys",
"(",
")",
")",
".",
"index",
"(",
"path",
")",
"t... | This method returns the Expectation instances for each line
in an expectations file. | [
"This",
"method",
"returns",
"the",
"Expectation",
"instances",
"for",
"each",
"line",
"in",
"an",
"expectations",
"file",
"."
] | [
"\"\"\"This method returns the Expectation instances for each line\n in an expectations file. If there were any modifications made\n through the remove_expectations or add_expectations member methods\n then this method will update the in memory view of the expectations\n file.\n\n ... | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [... |
e843bc5ebcdbbe6f87249defb7680fc9574024ea | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/models/test_expectations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | commit_changes | null | def commit_changes(self):
"""Writes to the expectations files any modifications made
through the remove_expectations or add_expectations member
methods"""
for path in self._expectations_dict:
exp_lines = self._reset_lines(path)
new_content = '\n'.join(
... | Writes to the expectations files any modifications made
through the remove_expectations or add_expectations member
methods | Writes to the expectations files any modifications made
through the remove_expectations or add_expectations member
methods | [
"Writes",
"to",
"the",
"expectations",
"files",
"any",
"modifications",
"made",
"through",
"the",
"remove_expectations",
"or",
"add_expectations",
"member",
"methods"
] | def commit_changes(self):
for path in self._expectations_dict:
exp_lines = self._reset_lines(path)
new_content = '\n'.join(
[e.to_string() for e in exp_lines]) + '\n'
self._expectations_dict[path] = new_content
self._expectation_file_linenos[path] ... | [
"def",
"commit_changes",
"(",
"self",
")",
":",
"for",
"path",
"in",
"self",
".",
"_expectations_dict",
":",
"exp_lines",
"=",
"self",
".",
"_reset_lines",
"(",
"path",
")",
"new_content",
"=",
"'\\n'",
".",
"join",
"(",
"[",
"e",
".",
"to_string",
"(",
... | Writes to the expectations files any modifications made
through the remove_expectations or add_expectations member
methods | [
"Writes",
"to",
"the",
"expectations",
"files",
"any",
"modifications",
"made",
"through",
"the",
"remove_expectations",
"or",
"add_expectations",
"member",
"methods"
] | [
"\"\"\"Writes to the expectations files any modifications made\n through the remove_expectations or add_expectations member\n methods\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e843bc5ebcdbbe6f87249defb7680fc9574024ea | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/models/test_expectations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | remove_expectations | null | def remove_expectations(self, path, exps):
"""This method removes Expectation instances from an expectations file.
It will delete the line in the expectations file associated with the
Expectation instance.
args:
path: Absolute path of file where the Expectation instances
... | This method removes Expectation instances from an expectations file.
It will delete the line in the expectations file associated with the
Expectation instance.
args:
path: Absolute path of file where the Expectation instances
came from.
exps: List of Ex... | This method removes Expectation instances from an expectations file.
It will delete the line in the expectations file associated with the
Expectation instance.
Absolute path of file where the Expectation instances
came from.
exps: List of Expectation instances to be deleted. | [
"This",
"method",
"removes",
"Expectation",
"instances",
"from",
"an",
"expectations",
"file",
".",
"It",
"will",
"delete",
"the",
"line",
"in",
"the",
"expectations",
"file",
"associated",
"with",
"the",
"Expectation",
"instance",
".",
"Absolute",
"path",
"of",... | def remove_expectations(self, path, exps):
idx = list(self._expectations_dict.keys()).index(path)
typ_expectations = self._expectations[idx]
for exp in exps:
if exp.is_glob:
pattern_to_exps = typ_expectations.glob_exps
else:
pattern_to_exps... | [
"def",
"remove_expectations",
"(",
"self",
",",
"path",
",",
"exps",
")",
":",
"idx",
"=",
"list",
"(",
"self",
".",
"_expectations_dict",
".",
"keys",
"(",
")",
")",
".",
"index",
"(",
"path",
")",
"typ_expectations",
"=",
"self",
".",
"_expectations",
... | This method removes Expectation instances from an expectations file. | [
"This",
"method",
"removes",
"Expectation",
"instances",
"from",
"an",
"expectations",
"file",
"."
] | [
"\"\"\"This method removes Expectation instances from an expectations file.\n It will delete the line in the expectations file associated with the\n Expectation instance.\n\n args:\n path: Absolute path of file where the Expectation instances\n came from.\n ... | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": null
},
{
"param": "exps",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [... |
e843bc5ebcdbbe6f87249defb7680fc9574024ea | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/models/test_expectations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | add_expectations | null | def add_expectations(self, path, exps, lineno=0, append_to_end_of_file=False):
"""This method adds Expectation instances to an expectations file. It will
add the new instances after the line number passed through the lineno parameter.
If the lineno is set to a value outside the range of line num... | This method adds Expectation instances to an expectations file. It will
add the new instances after the line number passed through the lineno parameter.
If the lineno is set to a value outside the range of line numbers in the file
then it will append the expectations to the end of the file
... | This method adds Expectation instances to an expectations file. It will
add the new instances after the line number passed through the lineno parameter.
If the lineno is set to a value outside the range of line numbers in the file
then it will append the expectations to the end of the file
Absolute path of file where ... | [
"This",
"method",
"adds",
"Expectation",
"instances",
"to",
"an",
"expectations",
"file",
".",
"It",
"will",
"add",
"the",
"new",
"instances",
"after",
"the",
"line",
"number",
"passed",
"through",
"the",
"lineno",
"parameter",
".",
"If",
"the",
"lineno",
"i... | def add_expectations(self, path, exps, lineno=0, append_to_end_of_file=False):
idx = list(self._expectations_dict.keys()).index(path)
typ_expectations = self._expectations[idx]
added_glob = False
if lineno < 0:
raise ValueError('lineno cannot be negative.')
if (append... | [
"def",
"add_expectations",
"(",
"self",
",",
"path",
",",
"exps",
",",
"lineno",
"=",
"0",
",",
"append_to_end_of_file",
"=",
"False",
")",
":",
"idx",
"=",
"list",
"(",
"self",
".",
"_expectations_dict",
".",
"keys",
"(",
")",
")",
".",
"index",
"(",
... | This method adds Expectation instances to an expectations file. | [
"This",
"method",
"adds",
"Expectation",
"instances",
"to",
"an",
"expectations",
"file",
"."
] | [
"\"\"\"This method adds Expectation instances to an expectations file. It will\n add the new instances after the line number passed through the lineno parameter.\n If the lineno is set to a value outside the range of line numbers in the file\n then it will append the expectations to the end of ... | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": null
},
{
"param": "exps",
"type": null
},
{
"param": "lineno",
"type": null
},
{
"param": "append_to_end_of_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.