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
0fe5ee501ea17f1ab4a2b4af2bec51920438d548
sunlongbo/chromium
mojo/public/tools/mojom/check_stable_mojom_compatibility.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_ValidateDelta
<not_specific>
def _ValidateDelta(root, delta): """Parses all modified mojoms (including all transitive mojom dependencies, even if unmodified) to perform backward-compatibility checks on any types marked with the [Stable] attribute. Note that unlike the normal build-time parser in mojom_parser.py, this does not produce or...
Parses all modified mojoms (including all transitive mojom dependencies, even if unmodified) to perform backward-compatibility checks on any types marked with the [Stable] attribute. Note that unlike the normal build-time parser in mojom_parser.py, this does not produce or rely on cached module translations, b...
Parses all modified mojoms (including all transitive mojom dependencies, even if unmodified) to perform backward-compatibility checks on any types marked with the [Stable] attribute. Note that unlike the normal build-time parser in mojom_parser.py, this does not produce or rely on cached module translations, but inste...
[ "Parses", "all", "modified", "mojoms", "(", "including", "all", "transitive", "mojom", "dependencies", "even", "if", "unmodified", ")", "to", "perform", "backward", "-", "compatibility", "checks", "on", "any", "types", "marked", "with", "the", "[", "Stable", "...
def _ValidateDelta(root, delta): affected_files = set() old_files = {} new_files = {} for change in delta: filename = change['filename'].replace('\\', '/') affected_files.add(filename) if change['old']: old_files[filename] = change['old'] if change['new']: new_files[filename] = chang...
[ "def", "_ValidateDelta", "(", "root", ",", "delta", ")", ":", "affected_files", "=", "set", "(", ")", "old_files", "=", "{", "}", "new_files", "=", "{", "}", "for", "change", "in", "delta", ":", "filename", "=", "change", "[", "'filename'", "]", ".", ...
Parses all modified mojoms (including all transitive mojom dependencies, even if unmodified) to perform backward-compatibility checks on any types marked with the [Stable] attribute.
[ "Parses", "all", "modified", "mojoms", "(", "including", "all", "transitive", "mojom", "dependencies", "even", "if", "unmodified", ")", "to", "perform", "backward", "-", "compatibility", "checks", "on", "any", "types", "marked", "with", "the", "[", "Stable", "...
[ "\"\"\"Parses all modified mojoms (including all transitive mojom dependencies,\n even if unmodified) to perform backward-compatibility checks on any types\n marked with the [Stable] attribute.\n\n Note that unlike the normal build-time parser in mojom_parser.py, this does\n not produce or rely on cached module...
[ { "param": "root", "type": null }, { "param": "delta", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "root", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "delta", "type": null, "docstring": null, "docstring_tokens": ...
0fe5ee501ea17f1ab4a2b4af2bec51920438d548
sunlongbo/chromium
mojo/public/tools/mojom/check_stable_mojom_compatibility.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Run
null
def Run(command_line, delta=None): """Runs the tool with the given command_line. Normally this will read the change description from stdin as a JSON-encoded list, but tests may pass a delta directly for convenience.""" arg_parser = argparse.ArgumentParser( description='Verifies backward-compatibility of m...
Runs the tool with the given command_line. Normally this will read the change description from stdin as a JSON-encoded list, but tests may pass a delta directly for convenience.
Runs the tool with the given command_line. Normally this will read the change description from stdin as a JSON-encoded list, but tests may pass a delta directly for convenience.
[ "Runs", "the", "tool", "with", "the", "given", "command_line", ".", "Normally", "this", "will", "read", "the", "change", "description", "from", "stdin", "as", "a", "JSON", "-", "encoded", "list", "but", "tests", "may", "pass", "a", "delta", "directly", "fo...
def Run(command_line, delta=None): arg_parser = argparse.ArgumentParser( description='Verifies backward-compatibility of mojom type changes.', epilog=""" This tool reads a change description from stdin and verifies that all modified [Stable] mojom types will retain backward-compatibility. The change descr...
[ "def", "Run", "(", "command_line", ",", "delta", "=", "None", ")", ":", "arg_parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Verifies backward-compatibility of mojom type changes.'", ",", "epilog", "=", "\"\"\"\nThis tool reads a change descrip...
Runs the tool with the given command_line.
[ "Runs", "the", "tool", "with", "the", "given", "command_line", "." ]
[ "\"\"\"Runs the tool with the given command_line. Normally this will read the\n change description from stdin as a JSON-encoded list, but tests may pass a\n delta directly for convenience.\"\"\"" ]
[ { "param": "command_line", "type": null }, { "param": "delta", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "command_line", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "delta", "type": null, "docstring": null, "docstring_t...
bdf3ee8bcf7292709edfc9690213be549a4356aa
sunlongbo/chromium
testing/trigger_scripts/base_test_triggerer.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
strip_unicode
<not_specific>
def strip_unicode(obj): """Recursively re-encodes strings as utf-8 inside |obj|. Returns the result. """ if isinstance(obj, six.text_type): return obj.encode('utf-8', 'replace') if isinstance(obj, list): return list(map(strip_unicode, obj)) if isinstance(obj, dict): new_obj = ...
Recursively re-encodes strings as utf-8 inside |obj|. Returns the result.
Recursively re-encodes strings as utf-8 inside |obj|. Returns the result.
[ "Recursively", "re", "-", "encodes", "strings", "as", "utf", "-", "8", "inside", "|obj|", ".", "Returns", "the", "result", "." ]
def strip_unicode(obj): if isinstance(obj, six.text_type): return obj.encode('utf-8', 'replace') if isinstance(obj, list): return list(map(strip_unicode, obj)) if isinstance(obj, dict): new_obj = type(obj)( (strip_unicode(k), strip_unicode(v)) for k, v in obj.items()) ...
[ "def", "strip_unicode", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "six", ".", "text_type", ")", ":", "return", "obj", ".", "encode", "(", "'utf-8'", ",", "'replace'", ")", "if", "isinstance", "(", "obj", ",", "list", ")", ":", "retur...
Recursively re-encodes strings as utf-8 inside |obj|.
[ "Recursively", "re", "-", "encodes", "strings", "as", "utf", "-", "8", "inside", "|obj|", "." ]
[ "\"\"\"Recursively re-encodes strings as utf-8 inside |obj|. Returns the result.\n \"\"\"" ]
[ { "param": "obj", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "obj", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bdf3ee8bcf7292709edfc9690213be549a4356aa
sunlongbo/chromium
testing/trigger_scripts/base_test_triggerer.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
modify_args
<not_specific>
def modify_args(self, all_args, bot_index, shard_index, total_shards, temp_file, shard_map=None): """Modifies the given argument list. Specifically, it does the following: * Adds a ...
Modifies the given argument list. Specifically, it does the following: * Adds a --dump_json argument, to read in the results of the individual trigger command. * Adds the dimensions associated with the bot config at the given index. * If the number of shards is greater than one, adds --en...
Modifies the given argument list. Specifically, it does the following: Adds a --dump_json argument, to read in the results of the individual trigger command. Adds the dimensions associated with the bot config at the given index. If the number of shards is greater than one, adds --env arguments to set the GTEST_SHARD_IN...
[ "Modifies", "the", "given", "argument", "list", ".", "Specifically", "it", "does", "the", "following", ":", "Adds", "a", "--", "dump_json", "argument", "to", "read", "in", "the", "results", "of", "the", "individual", "trigger", "command", ".", "Adds", "the",...
def modify_args(self, all_args, bot_index, shard_index, total_shards, temp_file, shard_map=None): bot_args = ['--dump-json', temp_file] if total_shards > 1: bot_args.append...
[ "def", "modify_args", "(", "self", ",", "all_args", ",", "bot_index", ",", "shard_index", ",", "total_shards", ",", "temp_file", ",", "shard_map", "=", "None", ")", ":", "bot_args", "=", "[", "'--dump-json'", ",", "temp_file", "]", "if", "total_shards", ">",...
Modifies the given argument list.
[ "Modifies", "the", "given", "argument", "list", "." ]
[ "\"\"\"Modifies the given argument list.\n\n Specifically, it does the following:\n * Adds a --dump_json argument, to read in the results of the\n individual trigger command.\n * Adds the dimensions associated with the bot config at the given index.\n * If the number of shards is greater th...
[ { "param": "self", "type": null }, { "param": "all_args", "type": null }, { "param": "bot_index", "type": null }, { "param": "shard_index", "type": null }, { "param": "total_shards", "type": null }, { "param": "temp_file", "type": null }, { ...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "all_args", "type": null, "docstring": null, "docstring_tokens...
bdf3ee8bcf7292709edfc9690213be549a4356aa
sunlongbo/chromium
testing/trigger_scripts/base_test_triggerer.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
append_additional_args
<not_specific>
def append_additional_args(self, args, shard_index): """ Gives subclasses ability to append additional args if necessary Base class just returns given args.""" del shard_index # unused return args
Gives subclasses ability to append additional args if necessary Base class just returns given args.
Gives subclasses ability to append additional args if necessary Base class just returns given args.
[ "Gives", "subclasses", "ability", "to", "append", "additional", "args", "if", "necessary", "Base", "class", "just", "returns", "given", "args", "." ]
def append_additional_args(self, args, shard_index): del shard_index return args
[ "def", "append_additional_args", "(", "self", ",", "args", ",", "shard_index", ")", ":", "del", "shard_index", "return", "args" ]
Gives subclasses ability to append additional args if necessary Base class just returns given args.
[ "Gives", "subclasses", "ability", "to", "append", "additional", "args", "if", "necessary", "Base", "class", "just", "returns", "given", "args", "." ]
[ "\"\"\" Gives subclasses ability to append additional args if necessary\n\n Base class just returns given args.\"\"\"", "# unused" ]
[ { "param": "self", "type": null }, { "param": "args", "type": null }, { "param": "shard_index", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": [...
bdf3ee8bcf7292709edfc9690213be549a4356aa
sunlongbo/chromium
testing/trigger_scripts/base_test_triggerer.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
list_bots
<not_specific>
def list_bots(self, dimensions, server='chromium-swarm.appspot.com'): """List bots having specified bot dimensions. Type of returned value is list of https://source.chromium.org/search?q=%22class%20BotInfo(messages.Message)%22%20f:luci%2Fappengine%2Fswarming&...
List bots having specified bot dimensions. Type of returned value is list of https://source.chromium.org/search?q=%22class%20BotInfo(messages.Message)%22%20f:luci%2Fappengine%2Fswarming&ssfr=1
List bots having specified bot dimensions.
[ "List", "bots", "having", "specified", "bot", "dimensions", "." ]
def list_bots(self, dimensions, server='chromium-swarm.appspot.com'): args = [SWARMING_GO, 'bots', '-server', server] for key in sorted(dimensions): args.extend(['-dimension', '%s=%s' % (key, dimensions[key])]) logging.info('Running Go `swarming` w...
[ "def", "list_bots", "(", "self", ",", "dimensions", ",", "server", "=", "'chromium-swarm.appspot.com'", ")", ":", "args", "=", "[", "SWARMING_GO", ",", "'bots'", ",", "'-server'", ",", "server", "]", "for", "key", "in", "sorted", "(", "dimensions", ")", ":...
List bots having specified bot dimensions.
[ "List", "bots", "having", "specified", "bot", "dimensions", "." ]
[ "\"\"\"List bots having specified bot dimensions.\n\n Type of returned value is list of\n https://source.chromium.org/search?q=%22class%20BotInfo(messages.Message)%22%20f:luci%2Fappengine%2Fswarming&ssfr=1\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "dimensions", "type": null }, { "param": "server", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dimensions", "type": null, "docstring": null, "docstring_toke...
bdf3ee8bcf7292709edfc9690213be549a4356aa
sunlongbo/chromium
testing/trigger_scripts/base_test_triggerer.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
list_tasks
<not_specific>
def list_tasks(self, tags, limit=None, server='chromium-swarm.appspot.com'): """List bots having specified task tags. Type of returned value is list of https://source.chromium.org/search?q=%22class%20TaskResult(messages.Message):%22%20f:luci%2Fappengine%2Fswarming&ssfr=1 ...
List bots having specified task tags. Type of returned value is list of https://source.chromium.org/search?q=%22class%20TaskResult(messages.Message):%22%20f:luci%2Fappengine%2Fswarming&ssfr=1
List bots having specified task tags.
[ "List", "bots", "having", "specified", "task", "tags", "." ]
def list_tasks(self, tags, limit=None, server='chromium-swarm.appspot.com'): args = [SWARMING_GO, 'tasks', '-server', server] for tag in sorted(tags): args.extend(['-tag', tag]) if limit is not None: args.extend(['-limit', str(limit)]) logging.i...
[ "def", "list_tasks", "(", "self", ",", "tags", ",", "limit", "=", "None", ",", "server", "=", "'chromium-swarm.appspot.com'", ")", ":", "args", "=", "[", "SWARMING_GO", ",", "'tasks'", ",", "'-server'", ",", "server", "]", "for", "tag", "in", "sorted", "...
List bots having specified task tags.
[ "List", "bots", "having", "specified", "task", "tags", "." ]
[ "\"\"\"List bots having specified task tags.\n\n Type of returned value is list of\n https://source.chromium.org/search?q=%22class%20TaskResult(messages.Message):%22%20f:luci%2Fappengine%2Fswarming&ssfr=1\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "tags", "type": null }, { "param": "limit", "type": null }, { "param": "server", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tags", "type": null, "docstring": null, "docstring_tokens": [...
bdf3ee8bcf7292709edfc9690213be549a4356aa
sunlongbo/chromium
testing/trigger_scripts/base_test_triggerer.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
indices_to_trigger
<not_specific>
def indices_to_trigger(self, args): """Returns the indices of the swarming shards that should be triggered.""" if args.shard_index is None: return list(range(args.shards)) else: return [args.shard_index]
Returns the indices of the swarming shards that should be triggered.
Returns the indices of the swarming shards that should be triggered.
[ "Returns", "the", "indices", "of", "the", "swarming", "shards", "that", "should", "be", "triggered", "." ]
def indices_to_trigger(self, args): if args.shard_index is None: return list(range(args.shards)) else: return [args.shard_index]
[ "def", "indices_to_trigger", "(", "self", ",", "args", ")", ":", "if", "args", ".", "shard_index", "is", "None", ":", "return", "list", "(", "range", "(", "args", ".", "shards", ")", ")", "else", ":", "return", "[", "args", ".", "shard_index", "]" ]
Returns the indices of the swarming shards that should be triggered.
[ "Returns", "the", "indices", "of", "the", "swarming", "shards", "that", "should", "be", "triggered", "." ]
[ "\"\"\"Returns the indices of the swarming shards that should be\n triggered.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": [...
bdf3ee8bcf7292709edfc9690213be549a4356aa
sunlongbo/chromium
testing/trigger_scripts/base_test_triggerer.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
trigger_tasks
<not_specific>
def trigger_tasks(self, args, remaining): """Triggers tasks for each bot. Args: args: Parsed arguments which we need to use. remaining: The remainder of the arguments, which should be passed to swarming.py calls. Returns: Exit code for the scri...
Triggers tasks for each bot. Args: args: Parsed arguments which we need to use. remaining: The remainder of the arguments, which should be passed to swarming.py calls. Returns: Exit code for the script.
Triggers tasks for each bot.
[ "Triggers", "tasks", "for", "each", "bot", "." ]
def trigger_tasks(self, args, remaining): if args.multiple_dimension_script_verbose: logging.basicConfig(level=logging.DEBUG) logging.info('DEBUG: init: %s', remaining) self.parse_bot_configs(args) self.prune_test_specific_configs(args) filtered_remaining_args = copy....
[ "def", "trigger_tasks", "(", "self", ",", "args", ",", "remaining", ")", ":", "if", "args", ".", "multiple_dimension_script_verbose", ":", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "DEBUG", ")", "logging", ".", "info", "(", "'DEBUG: i...
Triggers tasks for each bot.
[ "Triggers", "tasks", "for", "each", "bot", "." ]
[ "\"\"\"Triggers tasks for each bot.\n\n Args:\n args: Parsed arguments which we need to use.\n remaining: The remainder of the arguments, which should be passed to\n swarming.py calls.\n\n Returns:\n Exit code for the script.\n \"\"\"", "# crbug/1...
[ { "param": "self", "type": null }, { "param": "args", "type": null }, { "param": "remaining", "type": null } ]
{ "returns": [ { "docstring": "Exit code for the script.", "docstring_tokens": [ "Exit", "code", "for", "the", "script", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, ...
45159000fa499e06b8794107378f45f3fbbc6837
sunlongbo/chromium
third_party/tlslite/tlslite/utils/p256.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
generatePublicPrivate
<not_specific>
def generatePublicPrivate(): """generatePublicPrivate returns a tuple of (X9.62 encoded public point, private value), where the private value is generated from os.urandom.""" private = _decodeBigEndian(os.urandom(40)) % order return _encodePoint(_scalarBaseMult(private)), private
generatePublicPrivate returns a tuple of (X9.62 encoded public point, private value), where the private value is generated from os.urandom.
generatePublicPrivate returns a tuple of (X9.62 encoded public point, private value), where the private value is generated from os.urandom.
[ "generatePublicPrivate", "returns", "a", "tuple", "of", "(", "X9", ".", "62", "encoded", "public", "point", "private", "value", ")", "where", "the", "private", "value", "is", "generated", "from", "os", ".", "urandom", "." ]
def generatePublicPrivate(): private = _decodeBigEndian(os.urandom(40)) % order return _encodePoint(_scalarBaseMult(private)), private
[ "def", "generatePublicPrivate", "(", ")", ":", "private", "=", "_decodeBigEndian", "(", "os", ".", "urandom", "(", "40", ")", ")", "%", "order", "return", "_encodePoint", "(", "_scalarBaseMult", "(", "private", ")", ")", ",", "private" ]
generatePublicPrivate returns a tuple of (X9.62 encoded public point, private value), where the private value is generated from os.urandom.
[ "generatePublicPrivate", "returns", "a", "tuple", "of", "(", "X9", ".", "62", "encoded", "public", "point", "private", "value", ")", "where", "the", "private", "value", "is", "generated", "from", "os", ".", "urandom", "." ]
[ "\"\"\"generatePublicPrivate returns a tuple of (X9.62 encoded public point,\n private value), where the private value is generated from os.urandom.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
45159000fa499e06b8794107378f45f3fbbc6837
sunlongbo/chromium
third_party/tlslite/tlslite/utils/p256.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
generateSharedValue
<not_specific>
def generateSharedValue(theirPublic, private): """generateSharedValue returns the encoded x-coordinate of the multiplication of a peer's X9.62 encoded point and a private value.""" return _zeroPad( _encodeBigEndian(_scalarMult(private, _decodePoint(theirPublic))[0]), 32)
generateSharedValue returns the encoded x-coordinate of the multiplication of a peer's X9.62 encoded point and a private value.
generateSharedValue returns the encoded x-coordinate of the multiplication of a peer's X9.62 encoded point and a private value.
[ "generateSharedValue", "returns", "the", "encoded", "x", "-", "coordinate", "of", "the", "multiplication", "of", "a", "peer", "'", "s", "X9", ".", "62", "encoded", "point", "and", "a", "private", "value", "." ]
def generateSharedValue(theirPublic, private): return _zeroPad( _encodeBigEndian(_scalarMult(private, _decodePoint(theirPublic))[0]), 32)
[ "def", "generateSharedValue", "(", "theirPublic", ",", "private", ")", ":", "return", "_zeroPad", "(", "_encodeBigEndian", "(", "_scalarMult", "(", "private", ",", "_decodePoint", "(", "theirPublic", ")", ")", "[", "0", "]", ")", ",", "32", ")" ]
generateSharedValue returns the encoded x-coordinate of the multiplication of a peer's X9.62 encoded point and a private value.
[ "generateSharedValue", "returns", "the", "encoded", "x", "-", "coordinate", "of", "the", "multiplication", "of", "a", "peer", "'", "s", "X9", ".", "62", "encoded", "point", "and", "a", "private", "value", "." ]
[ "\"\"\"generateSharedValue returns the encoded x-coordinate of the\n multiplication of a peer's X9.62 encoded point and a private value.\"\"\"" ]
[ { "param": "theirPublic", "type": null }, { "param": "private", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "theirPublic", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "private", "type": null, "docstring": null, "docstring_...
59438c8886708f6fe203768e683e4fb123b9b2b5
sunlongbo/chromium
tools/binary_size/find_large_commits.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_FindBigDeltas
<not_specific>
def _FindBigDeltas(revs_and_sizes, increase_threshold, decrease_threshold): """Filters revs_and_sizes for entries that grow/shrink too much.""" big_jumps = [] prev_size = revs_and_sizes[0][1] for rev, size in revs_and_sizes: delta = size - prev_size prev_size = size if delta > increase_threshold or ...
Filters revs_and_sizes for entries that grow/shrink too much.
Filters revs_and_sizes for entries that grow/shrink too much.
[ "Filters", "revs_and_sizes", "for", "entries", "that", "grow", "/", "shrink", "too", "much", "." ]
def _FindBigDeltas(revs_and_sizes, increase_threshold, decrease_threshold): big_jumps = [] prev_size = revs_and_sizes[0][1] for rev, size in revs_and_sizes: delta = size - prev_size prev_size = size if delta > increase_threshold or -delta > decrease_threshold: big_jumps.append((rev, delta)) re...
[ "def", "_FindBigDeltas", "(", "revs_and_sizes", ",", "increase_threshold", ",", "decrease_threshold", ")", ":", "big_jumps", "=", "[", "]", "prev_size", "=", "revs_and_sizes", "[", "0", "]", "[", "1", "]", "for", "rev", ",", "size", "in", "revs_and_sizes", "...
Filters revs_and_sizes for entries that grow/shrink too much.
[ "Filters", "revs_and_sizes", "for", "entries", "that", "grow", "/", "shrink", "too", "much", "." ]
[ "\"\"\"Filters revs_and_sizes for entries that grow/shrink too much.\"\"\"" ]
[ { "param": "revs_and_sizes", "type": null }, { "param": "increase_threshold", "type": null }, { "param": "decrease_threshold", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "revs_and_sizes", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "increase_threshold", "type": null, "docstring": null, ...
b55379421dd767531a41d7e1f0393e4926ea8e75
sunlongbo/chromium
gpu/khronos_glcts_support/generate_khronos_glcts_tests.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ReadFileAsLines
null
def ReadFileAsLines(filename): """ Reads a file, yielding each non-blank line and lines that don't begin with # """ with open(filename, "r") as in_file: lines = in_file.readlines() for line in lines: line = line.strip() if len(line) > 0 and not line.startswith("#"): yield line
Reads a file, yielding each non-blank line and lines that don't begin with #
Reads a file, yielding each non-blank line and lines that don't begin with
[ "Reads", "a", "file", "yielding", "each", "non", "-", "blank", "line", "and", "lines", "that", "don", "'", "t", "begin", "with" ]
def ReadFileAsLines(filename): with open(filename, "r") as in_file: lines = in_file.readlines() for line in lines: line = line.strip() if len(line) > 0 and not line.startswith("#"): yield line
[ "def", "ReadFileAsLines", "(", "filename", ")", ":", "with", "open", "(", "filename", ",", "\"r\"", ")", "as", "in_file", ":", "lines", "=", "in_file", ".", "readlines", "(", ")", "for", "line", "in", "lines", ":", "line", "=", "line", ".", "strip", ...
Reads a file, yielding each non-blank line and lines that don't begin with
[ "Reads", "a", "file", "yielding", "each", "non", "-", "blank", "line", "and", "lines", "that", "don", "'", "t", "begin", "with" ]
[ "\"\"\"\n Reads a file, yielding each non-blank line\n and lines that don't begin with #\n \"\"\"" ]
[ { "param": "filename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b55379421dd767531a41d7e1f0393e4926ea8e75
sunlongbo/chromium
gpu/khronos_glcts_support/generate_khronos_glcts_tests.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ReadRunFile
<not_specific>
def ReadRunFile(run_file): """ Find all .test tests in a .run file and return their paths. If the .run file contains another .run file, then that is inspected too. """ tests = list() base_dir = os.path.dirname(run_file) for line in ReadFileAsLines(run_file): _, ext = os.path.splitext(line) ...
Find all .test tests in a .run file and return their paths. If the .run file contains another .run file, then that is inspected too.
Find all .test tests in a .run file and return their paths. If the .run file contains another .run file, then that is inspected too.
[ "Find", "all", ".", "test", "tests", "in", "a", ".", "run", "file", "and", "return", "their", "paths", ".", "If", "the", ".", "run", "file", "contains", "another", ".", "run", "file", "then", "that", "is", "inspected", "too", "." ]
def ReadRunFile(run_file): tests = list() base_dir = os.path.dirname(run_file) for line in ReadFileAsLines(run_file): _, ext = os.path.splitext(line) if ext == ".test": tests.append(os.path.join(base_dir, line)) elif ext == ".run": tests += ReadRunFile(os.path.join(base_dir, line)) els...
[ "def", "ReadRunFile", "(", "run_file", ")", ":", "tests", "=", "list", "(", ")", "base_dir", "=", "os", ".", "path", ".", "dirname", "(", "run_file", ")", "for", "line", "in", "ReadFileAsLines", "(", "run_file", ")", ":", "_", ",", "ext", "=", "os", ...
Find all .test tests in a .run file and return their paths.
[ "Find", "all", ".", "test", "tests", "in", "a", ".", "run", "file", "and", "return", "their", "paths", "." ]
[ "\"\"\"\n Find all .test tests in a .run file and return their paths.\n If the .run file contains another .run file, then that is inspected\n too.\n \"\"\"" ]
[ { "param": "run_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "run_file", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b55379421dd767531a41d7e1f0393e4926ea8e75
sunlongbo/chromium
gpu/khronos_glcts_support/generate_khronos_glcts_tests.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GenerateTests
null
def GenerateTests(run_files, output): """ Generates code for khronos_glcts_test test-cases that are listed in the run_files. """ output.write('#include "gpu/khronos_glcts_support/khronos_glcts_test.h"\n') output.write('#include "testing/gtest/include/gtest/gtest.h"\n\n') for run_file in run_files: ...
Generates code for khronos_glcts_test test-cases that are listed in the run_files.
Generates code for khronos_glcts_test test-cases that are listed in the run_files.
[ "Generates", "code", "for", "khronos_glcts_test", "test", "-", "cases", "that", "are", "listed", "in", "the", "run_files", "." ]
def GenerateTests(run_files, output): output.write('#include "gpu/khronos_glcts_support/khronos_glcts_test.h"\n') output.write('#include "testing/gtest/include/gtest/gtest.h"\n\n') for run_file in run_files: run_file_name = os.path.basename(run_file) run_file_dir = os.path.dirname(run_file) suite_pref...
[ "def", "GenerateTests", "(", "run_files", ",", "output", ")", ":", "output", ".", "write", "(", "'#include \"gpu/khronos_glcts_support/khronos_glcts_test.h\"\\n'", ")", "output", ".", "write", "(", "'#include \"testing/gtest/include/gtest/gtest.h\"\\n\\n'", ")", "for", "run...
Generates code for khronos_glcts_test test-cases that are listed in the run_files.
[ "Generates", "code", "for", "khronos_glcts_test", "test", "-", "cases", "that", "are", "listed", "in", "the", "run_files", "." ]
[ "\"\"\"\n Generates code for khronos_glcts_test test-cases that are\n listed in the run_files.\n \"\"\"" ]
[ { "param": "run_files", "type": null }, { "param": "output", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "run_files", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "output", "type": null, "docstring": null, "docstring_tok...
b55379421dd767531a41d7e1f0393e4926ea8e75
sunlongbo/chromium
gpu/khronos_glcts_support/generate_khronos_glcts_tests.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
main
<not_specific>
def main(): """This is the main function.""" parser = argparse.ArgumentParser() parser.add_argument("--outdir", default = ".") parser.add_argument("run_files", nargs = "+") args = parser.parse_args() output = open( os.path.join(args.outdir, "khronos_glcts_test_autogen.cc"), "wb") try: GenerateT...
This is the main function.
This is the main function.
[ "This", "is", "the", "main", "function", "." ]
def main(): parser = argparse.ArgumentParser() parser.add_argument("--outdir", default = ".") parser.add_argument("run_files", nargs = "+") args = parser.parse_args() output = open( os.path.join(args.outdir, "khronos_glcts_test_autogen.cc"), "wb") try: GenerateTests(args.run_files, output) finally...
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "\"--outdir\"", ",", "default", "=", "\".\"", ")", "parser", ".", "add_argument", "(", "\"run_files\"", ",", "nargs", "=", "\"+\""...
This is the main function.
[ "This", "is", "the", "main", "function", "." ]
[ "\"\"\"This is the main function.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
b5541bca5b7950b62e2b5a456a02fcd5d4b2b1a6
sunlongbo/chromium
native_client_sdk/src/tools/oshelpers.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
IncludeFiles
<not_specific>
def IncludeFiles(filters, files): """Filter files based on inclusion lists Return a list of files which match and of the Unix shell-style wildcards provided, or return all the files if no filter is provided. """ if not filters: return files match = set() for file_filter in filters: match |= set(f...
Filter files based on inclusion lists Return a list of files which match and of the Unix shell-style wildcards provided, or return all the files if no filter is provided.
Filter files based on inclusion lists Return a list of files which match and of the Unix shell-style wildcards provided, or return all the files if no filter is provided.
[ "Filter", "files", "based", "on", "inclusion", "lists", "Return", "a", "list", "of", "files", "which", "match", "and", "of", "the", "Unix", "shell", "-", "style", "wildcards", "provided", "or", "return", "all", "the", "files", "if", "no", "filter", "is", ...
def IncludeFiles(filters, files): if not filters: return files match = set() for file_filter in filters: match |= set(fnmatch.filter(files, file_filter)) return [name for name in files if name in match]
[ "def", "IncludeFiles", "(", "filters", ",", "files", ")", ":", "if", "not", "filters", ":", "return", "files", "match", "=", "set", "(", ")", "for", "file_filter", "in", "filters", ":", "match", "|=", "set", "(", "fnmatch", ".", "filter", "(", "files",...
Filter files based on inclusion lists Return a list of files which match and of the Unix shell-style wildcards provided, or return all the files if no filter is provided.
[ "Filter", "files", "based", "on", "inclusion", "lists", "Return", "a", "list", "of", "files", "which", "match", "and", "of", "the", "Unix", "shell", "-", "style", "wildcards", "provided", "or", "return", "all", "the", "files", "if", "no", "filter", "is", ...
[ "\"\"\"Filter files based on inclusion lists\n\n Return a list of files which match and of the Unix shell-style wildcards\n provided, or return all the files if no filter is provided.\n \"\"\"" ]
[ { "param": "filters", "type": null }, { "param": "files", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filters", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "files", "type": null, "docstring": null, "docstring_tokens...
b5541bca5b7950b62e2b5a456a02fcd5d4b2b1a6
sunlongbo/chromium
native_client_sdk/src/tools/oshelpers.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ExcludeFiles
<not_specific>
def ExcludeFiles(filters, files): """Filter files based on exclusions lists Return a list of files which do not match any of the Unix shell-style wildcards provided, or return all the files if no filter is provided. """ if not filters: return files match = set() for file_filter in filters: exclud...
Filter files based on exclusions lists Return a list of files which do not match any of the Unix shell-style wildcards provided, or return all the files if no filter is provided.
Filter files based on exclusions lists Return a list of files which do not match any of the Unix shell-style wildcards provided, or return all the files if no filter is provided.
[ "Filter", "files", "based", "on", "exclusions", "lists", "Return", "a", "list", "of", "files", "which", "do", "not", "match", "any", "of", "the", "Unix", "shell", "-", "style", "wildcards", "provided", "or", "return", "all", "the", "files", "if", "no", "...
def ExcludeFiles(filters, files): if not filters: return files match = set() for file_filter in filters: excludes = set(fnmatch.filter(files, file_filter)) match |= excludes return [name for name in files if name not in match]
[ "def", "ExcludeFiles", "(", "filters", ",", "files", ")", ":", "if", "not", "filters", ":", "return", "files", "match", "=", "set", "(", ")", "for", "file_filter", "in", "filters", ":", "excludes", "=", "set", "(", "fnmatch", ".", "filter", "(", "files...
Filter files based on exclusions lists Return a list of files which do not match any of the Unix shell-style wildcards provided, or return all the files if no filter is provided.
[ "Filter", "files", "based", "on", "exclusions", "lists", "Return", "a", "list", "of", "files", "which", "do", "not", "match", "any", "of", "the", "Unix", "shell", "-", "style", "wildcards", "provided", "or", "return", "all", "the", "files", "if", "no", "...
[ "\"\"\"Filter files based on exclusions lists\n\n Return a list of files which do not match any of the Unix shell-style\n wildcards provided, or return all the files if no filter is provided.\n \"\"\"" ]
[ { "param": "filters", "type": null }, { "param": "files", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filters", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "files", "type": null, "docstring": null, "docstring_tokens...
b5541bca5b7950b62e2b5a456a02fcd5d4b2b1a6
sunlongbo/chromium
native_client_sdk/src/tools/oshelpers.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CopyPath
<not_specific>
def CopyPath(options, src, dst): """CopyPath from src to dst Copy a fully specified src to a fully specified dst. If src and dst are both files, the dst file is removed first to prevent error. If and include or exclude list are provided, the destination is first matched against that filter. """ if opti...
CopyPath from src to dst Copy a fully specified src to a fully specified dst. If src and dst are both files, the dst file is removed first to prevent error. If and include or exclude list are provided, the destination is first matched against that filter.
CopyPath from src to dst Copy a fully specified src to a fully specified dst. If src and dst are both files, the dst file is removed first to prevent error. If and include or exclude list are provided, the destination is first matched against that filter.
[ "CopyPath", "from", "src", "to", "dst", "Copy", "a", "fully", "specified", "src", "to", "a", "fully", "specified", "dst", ".", "If", "src", "and", "dst", "are", "both", "files", "the", "dst", "file", "is", "removed", "first", "to", "prevent", "error", ...
def CopyPath(options, src, dst): if options.includes: if not IncludeFiles(options.includes, [src]): return if options.excludes: if not ExcludeFiles(options.excludes, [src]): return if options.verbose: print('cp %s %s' % (src, dst)) if os.path.isfile(src): if os.path.exists(dst): ...
[ "def", "CopyPath", "(", "options", ",", "src", ",", "dst", ")", ":", "if", "options", ".", "includes", ":", "if", "not", "IncludeFiles", "(", "options", ".", "includes", ",", "[", "src", "]", ")", ":", "return", "if", "options", ".", "excludes", ":",...
CopyPath from src to dst Copy a fully specified src to a fully specified dst.
[ "CopyPath", "from", "src", "to", "dst", "Copy", "a", "fully", "specified", "src", "to", "a", "fully", "specified", "dst", "." ]
[ "\"\"\"CopyPath from src to dst\n\n Copy a fully specified src to a fully specified dst. If src and dst are\n both files, the dst file is removed first to prevent error. If and include\n or exclude list are provided, the destination is first matched against that\n filter.\n \"\"\"", "# If the source is a s...
[ { "param": "options", "type": null }, { "param": "src", "type": null }, { "param": "dst", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "options", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "src", "type": null, "docstring": null, "docstring_tokens":...
b5541bca5b7950b62e2b5a456a02fcd5d4b2b1a6
sunlongbo/chromium
native_client_sdk/src/tools/oshelpers.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Copy
null
def Copy(args): """A Unix cp style copy. Copies multiple sources to a single destination using the normal cp semantics. In addition, it support inclusion and exclusion filters which allows the copy to skip certain types of files. """ parser = argparse.ArgumentParser(usage='cp [Options] sources... dest', ...
A Unix cp style copy. Copies multiple sources to a single destination using the normal cp semantics. In addition, it support inclusion and exclusion filters which allows the copy to skip certain types of files.
A Unix cp style copy. Copies multiple sources to a single destination using the normal cp semantics. In addition, it support inclusion and exclusion filters which allows the copy to skip certain types of files.
[ "A", "Unix", "cp", "style", "copy", ".", "Copies", "multiple", "sources", "to", "a", "single", "destination", "using", "the", "normal", "cp", "semantics", ".", "In", "addition", "it", "support", "inclusion", "and", "exclusion", "filters", "which", "allows", ...
def Copy(args): parser = argparse.ArgumentParser(usage='cp [Options] sources... dest', description=Copy.__doc__) parser.add_argument( '-R', '-r', '--recursive', dest='recursive', action='store_true', default=False, help='copy directories recursively.') parser.a...
[ "def", "Copy", "(", "args", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "usage", "=", "'cp [Options] sources... dest'", ",", "description", "=", "Copy", ".", "__doc__", ")", "parser", ".", "add_argument", "(", "'-R'", ",", "'-r'", ",", ...
A Unix cp style copy.
[ "A", "Unix", "cp", "style", "copy", "." ]
[ "\"\"\"A Unix cp style copy.\n\n Copies multiple sources to a single destination using the normal cp\n semantics. In addition, it support inclusion and exclusion filters which\n allows the copy to skip certain types of files.\n \"\"\"", "# If the destination is a directory, then append the basename of the sr...
[ { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b5541bca5b7950b62e2b5a456a02fcd5d4b2b1a6
sunlongbo/chromium
native_client_sdk/src/tools/oshelpers.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
MovePath
null
def MovePath(options, src, dst): """MovePath from src to dst. Moves the src to the dst much like the Unix style mv command, except it only handles one source at a time. Because of possible temporary failures do to locks (such as anti-virus software on Windows), the function will retry up to five times. ""...
MovePath from src to dst. Moves the src to the dst much like the Unix style mv command, except it only handles one source at a time. Because of possible temporary failures do to locks (such as anti-virus software on Windows), the function will retry up to five times.
MovePath from src to dst. Moves the src to the dst much like the Unix style mv command, except it only handles one source at a time. Because of possible temporary failures do to locks (such as anti-virus software on Windows), the function will retry up to five times.
[ "MovePath", "from", "src", "to", "dst", ".", "Moves", "the", "src", "to", "the", "dst", "much", "like", "the", "Unix", "style", "mv", "command", "except", "it", "only", "handles", "one", "source", "at", "a", "time", ".", "Because", "of", "possible", "t...
def MovePath(options, src, dst): if os.path.isdir(dst): dst = os.path.join(dst, os.path.basename(src)) if os.path.exists(dst): if options.force: Remove(['-vfr', dst]) if os.path.exists(dst): raise OSError('mv: FAILED TO REMOVE ' + dst) else: raise OSError('mv: already exists ' ...
[ "def", "MovePath", "(", "options", ",", "src", ",", "dst", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "dst", ")", ":", "dst", "=", "os", ".", "path", ".", "join", "(", "dst", ",", "os", ".", "path", ".", "basename", "(", "src", ")"...
MovePath from src to dst.
[ "MovePath", "from", "src", "to", "dst", "." ]
[ "\"\"\"MovePath from src to dst.\n\n Moves the src to the dst much like the Unix style mv command, except it\n only handles one source at a time. Because of possible temporary failures\n do to locks (such as anti-virus software on Windows), the function will retry\n up to five times.\n \"\"\"", "# if the de...
[ { "param": "options", "type": null }, { "param": "src", "type": null }, { "param": "dst", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "options", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "src", "type": null, "docstring": null, "docstring_tokens":...
b5541bca5b7950b62e2b5a456a02fcd5d4b2b1a6
sunlongbo/chromium
native_client_sdk/src/tools/oshelpers.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Remove
<not_specific>
def Remove(args): """A Unix style rm. Removes the list of paths. Because of possible temporary failures do to locks (such as anti-virus software on Windows), the function will retry up to five times. """ parser = argparse.ArgumentParser(usage='rm [Options] PATHS...', des...
A Unix style rm. Removes the list of paths. Because of possible temporary failures do to locks (such as anti-virus software on Windows), the function will retry up to five times.
A Unix style rm. Removes the list of paths. Because of possible temporary failures do to locks (such as anti-virus software on Windows), the function will retry up to five times.
[ "A", "Unix", "style", "rm", ".", "Removes", "the", "list", "of", "paths", ".", "Because", "of", "possible", "temporary", "failures", "do", "to", "locks", "(", "such", "as", "anti", "-", "virus", "software", "on", "Windows", ")", "the", "function", "will"...
def Remove(args): parser = argparse.ArgumentParser(usage='rm [Options] PATHS...', description=Remove.__doc__) parser.add_argument( '-R', '-r', '--recursive', dest='recursive', action='store_true', default=False, help='remove directories recursively.') parser.ad...
[ "def", "Remove", "(", "args", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "usage", "=", "'rm [Options] PATHS...'", ",", "description", "=", "Remove", ".", "__doc__", ")", "parser", ".", "add_argument", "(", "'-R'", ",", "'-r'", ",", "'...
A Unix style rm.
[ "A", "Unix", "style", "rm", "." ]
[ "\"\"\"A Unix style rm.\n\n Removes the list of paths. Because of possible temporary failures do to locks\n (such as anti-virus software on Windows), the function will retry up to five\n times.\n \"\"\"", "# Ignore non existing files when using force", "# Check every time, since it may have been deleted af...
[ { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b5541bca5b7950b62e2b5a456a02fcd5d4b2b1a6
sunlongbo/chromium
native_client_sdk/src/tools/oshelpers.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Zip
<not_specific>
def Zip(args): """A Unix style zip. Compresses the listed files. """ parser = argparse.ArgumentParser(description=Zip.__doc__) parser.add_argument( '-r', dest='recursive', action='store_true', default=False, help='recurse into directories') parser.add_argument( '-q', dest='quiet', a...
A Unix style zip. Compresses the listed files.
A Unix style zip. Compresses the listed files.
[ "A", "Unix", "style", "zip", ".", "Compresses", "the", "listed", "files", "." ]
def Zip(args): parser = argparse.ArgumentParser(description=Zip.__doc__) parser.add_argument( '-r', dest='recursive', action='store_true', default=False, help='recurse into directories') parser.add_argument( '-q', dest='quiet', action='store_true', default=False, help='quiet op...
[ "def", "Zip", "(", "args", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "Zip", ".", "__doc__", ")", "parser", ".", "add_argument", "(", "'-r'", ",", "dest", "=", "'recursive'", ",", "action", "=", "'store_true'", "...
A Unix style zip.
[ "A", "Unix", "style", "zip", "." ]
[ "\"\"\"A Unix style zip.\n\n Compresses the listed files.\n \"\"\"", "# zip_data represents a list of the data to be written or appended to the", "# zip_stream. It is a list of tuples:", "# (OS file path, zip path/zip file info, and file data)", "# In all cases one of the |os path| or the |file data| wi...
[ { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b5541bca5b7950b62e2b5a456a02fcd5d4b2b1a6
sunlongbo/chromium
native_client_sdk/src/tools/oshelpers.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Which
<not_specific>
def Which(args): """A Unix style which. Looks for all arguments in the PATH environment variable, and prints their path if they are executable files. Note: If you pass an argument with a path to which, it will just test if it is executable, not if it is in the path. """ parser = argparse.ArgumentParser(...
A Unix style which. Looks for all arguments in the PATH environment variable, and prints their path if they are executable files. Note: If you pass an argument with a path to which, it will just test if it is executable, not if it is in the path.
A Unix style which. Looks for all arguments in the PATH environment variable, and prints their path if they are executable files. If you pass an argument with a path to which, it will just test if it is executable, not if it is in the path.
[ "A", "Unix", "style", "which", ".", "Looks", "for", "all", "arguments", "in", "the", "PATH", "environment", "variable", "and", "prints", "their", "path", "if", "they", "are", "executable", "files", ".", "If", "you", "pass", "an", "argument", "with", "a", ...
def Which(args): parser = argparse.ArgumentParser(description=Which.__doc__) parser.add_argument('files', nargs='+') options = parser.parse_args(args) retval = 0 for filename in options.files: fullname = FindExeInPath(filename) if fullname: print(fullname) else: retval = 1 return ret...
[ "def", "Which", "(", "args", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "Which", ".", "__doc__", ")", "parser", ".", "add_argument", "(", "'files'", ",", "nargs", "=", "'+'", ")", "options", "=", "parser", ".", ...
A Unix style which.
[ "A", "Unix", "style", "which", "." ]
[ "\"\"\"A Unix style which.\n\n Looks for all arguments in the PATH environment variable, and prints their\n path if they are executable files.\n\n Note: If you pass an argument with a path to which, it will just test if it\n is executable, not if it is in the path.\n \"\"\"" ]
[ { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
61f06a9d09b9a3fd028f833251d9d26f2d162e1e
sunlongbo/chromium
tools/metrics/histograms/update_histogram_enum.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ReadHistogramValues
<not_specific>
def ReadHistogramValues(filename, start_marker, end_marker, strip_k_prefix): """Creates a dictionary of enum values, read from a C++ file. Args: filename: The unix-style path (relative to src/) of the file to open. start_marker: A regex that signifies the start of the enum values. end_marker: A r...
Creates a dictionary of enum values, read from a C++ file. Args: filename: The unix-style path (relative to src/) of the file to open. start_marker: A regex that signifies the start of the enum values. end_marker: A regex that signifies the end of the enum values. strip_k_prefix: Set to True ...
Creates a dictionary of enum values, read from a C++ file.
[ "Creates", "a", "dictionary", "of", "enum", "values", "read", "from", "a", "C", "++", "file", "." ]
def ReadHistogramValues(filename, start_marker, end_marker, strip_k_prefix): with io.open(path_util.GetInputFile(filename)) as f: content = f.readlines() START_REGEX = re.compile(start_marker) ITEM_REGEX = re.compile(r'^(\w+)') ITEM_REGEX_WITH_INIT = re.compile(r'(\w+)\s*=\s*(\d*)') WRAPPED_INIT = re.comp...
[ "def", "ReadHistogramValues", "(", "filename", ",", "start_marker", ",", "end_marker", ",", "strip_k_prefix", ")", ":", "with", "io", ".", "open", "(", "path_util", ".", "GetInputFile", "(", "filename", ")", ")", "as", "f", ":", "content", "=", "f", ".", ...
Creates a dictionary of enum values, read from a C++ file.
[ "Creates", "a", "dictionary", "of", "enum", "values", "read", "from", "a", "C", "++", "file", "." ]
[ "\"\"\"Creates a dictionary of enum values, read from a C++ file.\n\n Args:\n filename: The unix-style path (relative to src/) of the file to open.\n start_marker: A regex that signifies the start of the enum values.\n end_marker: A regex that signifies the end of the enum values.\n strip_k_pre...
[ { "param": "filename", "type": null }, { "param": "start_marker", "type": null }, { "param": "end_marker", "type": null }, { "param": "strip_k_prefix", "type": null } ]
{ "returns": [ { "docstring": "A dictionary from enum value to enum label.", "docstring_tokens": [ "A", "dictionary", "from", "enum", "value", "to", "enum", "label", "." ], "type": null } ], "raises": [ { ...
61f06a9d09b9a3fd028f833251d9d26f2d162e1e
sunlongbo/chromium
tools/metrics/histograms/update_histogram_enum.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ReadHistogramValuesFromXML
<not_specific>
def ReadHistogramValuesFromXML(filename, element_name, value_attribute, label_attribute): """Creates a dictionary of enum values, read from an XML file. Args: filename: The unix-style path (relative to src/) of the file to open. element_name: Name of elements in the given...
Creates a dictionary of enum values, read from an XML file. Args: filename: The unix-style path (relative to src/) of the file to open. element_name: Name of elements in the given XML that would be used to extract enums. value_attribute: The attribute name in source XML that would be mapp...
Creates a dictionary of enum values, read from an XML file.
[ "Creates", "a", "dictionary", "of", "enum", "values", "read", "from", "an", "XML", "file", "." ]
def ReadHistogramValuesFromXML(filename, element_name, value_attribute, label_attribute): source_xml = minidom.parse(path_util.GetInputFile(filename)) result = {} for row in source_xml.getElementsByTagName(element_name): enum_value = int(row.getAttribute(value_attribute)) la...
[ "def", "ReadHistogramValuesFromXML", "(", "filename", ",", "element_name", ",", "value_attribute", ",", "label_attribute", ")", ":", "source_xml", "=", "minidom", ".", "parse", "(", "path_util", ".", "GetInputFile", "(", "filename", ")", ")", "result", "=", "{",...
Creates a dictionary of enum values, read from an XML file.
[ "Creates", "a", "dictionary", "of", "enum", "values", "read", "from", "an", "XML", "file", "." ]
[ "\"\"\"Creates a dictionary of enum values, read from an XML file.\n\n Args:\n filename: The unix-style path (relative to src/) of the file to open.\n element_name: Name of elements in the given XML that would be used to\n extract enums.\n value_attribute: The attribute name in source XML t...
[ { "param": "filename", "type": null }, { "param": "element_name", "type": null }, { "param": "value_attribute", "type": null }, { "param": "label_attribute", "type": null } ]
{ "returns": [ { "docstring": "A boolean indicating wheather the histograms.xml file would be changed.", "docstring_tokens": [ "A", "boolean", "indicating", "wheather", "the", "histograms", ".", "xml", "file", "would", ...
61f06a9d09b9a3fd028f833251d9d26f2d162e1e
sunlongbo/chromium
tools/metrics/histograms/update_histogram_enum.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CheckPresubmitErrors
<not_specific>
def CheckPresubmitErrors(histogram_enum_name, update_script_name, source_enum_path, start_marker, end_marker, strip_k_prefix=False, histogram_value_reader=ReadHistogramVa...
Extracts histogram enum values from a source file and checks for violations. Enum values are extracted from |source_enum_path| using |histogram_value_reader| function. The following presubmit violations are then checked: 1. Failure to update histograms.xml to match 2. Introduction of duplicate values ...
Extracts histogram enum values from a source file and checks for violations. Enum values are extracted from |source_enum_path| using |histogram_value_reader| function. The following presubmit violations are then checked: 1. Failure to update histograms.xml to match 2. Introduction of duplicate values
[ "Extracts", "histogram", "enum", "values", "from", "a", "source", "file", "and", "checks", "for", "violations", ".", "Enum", "values", "are", "extracted", "from", "|source_enum_path|", "using", "|histogram_value_reader|", "function", ".", "The", "following", "presub...
def CheckPresubmitErrors(histogram_enum_name, update_script_name, source_enum_path, start_marker, end_marker, strip_k_prefix=False, histogram_value_reader=ReadHistogramVa...
[ "def", "CheckPresubmitErrors", "(", "histogram_enum_name", ",", "update_script_name", ",", "source_enum_path", ",", "start_marker", ",", "end_marker", ",", "strip_k_prefix", "=", "False", ",", "histogram_value_reader", "=", "ReadHistogramValues", ")", ":", "Log", "(", ...
Extracts histogram enum values from a source file and checks for violations.
[ "Extracts", "histogram", "enum", "values", "from", "a", "source", "file", "and", "checks", "for", "violations", "." ]
[ "\"\"\"Extracts histogram enum values from a source file and checks for\n violations.\n\n Enum values are extracted from |source_enum_path| using\n |histogram_value_reader| function. The following presubmit violations are then\n checked:\n 1. Failure to update histograms.xml to match\n 2. Introduction of ...
[ { "param": "histogram_enum_name", "type": null }, { "param": "update_script_name", "type": null }, { "param": "source_enum_path", "type": null }, { "param": "start_marker", "type": null }, { "param": "end_marker", "type": null }, { "param": "strip_k_pr...
{ "returns": [ { "docstring": "A string with presubmit failure description, or None (if no failures).", "docstring_tokens": [ "A", "string", "with", "presubmit", "failure", "description", "or", "None", "(", "if", "...
61f06a9d09b9a3fd028f833251d9d26f2d162e1e
sunlongbo/chromium
tools/metrics/histograms/update_histogram_enum.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
UpdateHistogramEnum
null
def UpdateHistogramEnum(histogram_enum_name, source_enum_path, start_marker, end_marker, strip_k_prefix=False, calling_script=None): """Reads a C++ enum from a .h file and updates histograms.xml to ...
Reads a C++ enum from a .h file and updates histograms.xml to match. Args: histogram_enum_name: The name of the XML <enum> attribute to update. source_enum_path: A unix-style path, relative to src/, giving the C++ header file from which to read the enum. start_marker: A regular expression...
Reads a C++ enum from a .h file and updates histograms.xml to match.
[ "Reads", "a", "C", "++", "enum", "from", "a", ".", "h", "file", "and", "updates", "histograms", ".", "xml", "to", "match", "." ]
def UpdateHistogramEnum(histogram_enum_name, source_enum_path, start_marker, end_marker, strip_k_prefix=False, calling_script=None): Log('Reading histogram enum definition from "{0}".'.format(source...
[ "def", "UpdateHistogramEnum", "(", "histogram_enum_name", ",", "source_enum_path", ",", "start_marker", ",", "end_marker", ",", "strip_k_prefix", "=", "False", ",", "calling_script", "=", "None", ")", ":", "Log", "(", "'Reading histogram enum definition from \"{0}\".'", ...
Reads a C++ enum from a .h file and updates histograms.xml to match.
[ "Reads", "a", "C", "++", "enum", "from", "a", ".", "h", "file", "and", "updates", "histograms", ".", "xml", "to", "match", "." ]
[ "\"\"\"Reads a C++ enum from a .h file and updates histograms.xml to match.\n\n Args:\n histogram_enum_name: The name of the XML <enum> attribute to update.\n source_enum_path: A unix-style path, relative to src/, giving\n the C++ header file from which to read the enum.\n start_marker: A r...
[ { "param": "histogram_enum_name", "type": null }, { "param": "source_enum_path", "type": null }, { "param": "start_marker", "type": null }, { "param": "end_marker", "type": null }, { "param": "strip_k_prefix", "type": null }, { "param": "calling_script...
{ "returns": [], "raises": [], "params": [ { "identifier": "histogram_enum_name", "type": null, "docstring": "The name of the XML attribute to update.", "docstring_tokens": [ "The", "name", "of", "the", "XML", "attribute", "to", ...
61f06a9d09b9a3fd028f833251d9d26f2d162e1e
sunlongbo/chromium
tools/metrics/histograms/update_histogram_enum.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
UpdateHistogramEnumFromXML
null
def UpdateHistogramEnumFromXML(histogram_enum_name, source_enum_path, caller_script_name, element_name, value_attribute, label_attribute): """Reads a .xml file and updates histograms.xml to match. Args: histogram_enum_name: The name of the XML <en...
Reads a .xml file and updates histograms.xml to match. Args: histogram_enum_name: The name of the XML <enum> attribute to update. source_enum_path: A unix-style path, relative to src/, giving the XML file from which to read the enum. caller_script_name: Name of the script calling this fun...
Reads a .xml file and updates histograms.xml to match.
[ "Reads", "a", ".", "xml", "file", "and", "updates", "histograms", ".", "xml", "to", "match", "." ]
def UpdateHistogramEnumFromXML(histogram_enum_name, source_enum_path, caller_script_name, element_name, value_attribute, label_attribute): Log('Reading histogram enum definition from "{0}".'.format(source_enum_path)) source_enum_values = ReadHistogramVal...
[ "def", "UpdateHistogramEnumFromXML", "(", "histogram_enum_name", ",", "source_enum_path", ",", "caller_script_name", ",", "element_name", ",", "value_attribute", ",", "label_attribute", ")", ":", "Log", "(", "'Reading histogram enum definition from \"{0}\".'", ".", "format", ...
Reads a .xml file and updates histograms.xml to match.
[ "Reads", "a", ".", "xml", "file", "and", "updates", "histograms", ".", "xml", "to", "match", "." ]
[ "\"\"\"Reads a .xml file and updates histograms.xml to match.\n\n Args:\n histogram_enum_name: The name of the XML <enum> attribute to update.\n source_enum_path: A unix-style path, relative to src/, giving\n the XML file from which to read the enum.\n caller_script_name: Name of the script...
[ { "param": "histogram_enum_name", "type": null }, { "param": "source_enum_path", "type": null }, { "param": "caller_script_name", "type": null }, { "param": "element_name", "type": null }, { "param": "value_attribute", "type": null }, { "param": "label...
{ "returns": [], "raises": [], "params": [ { "identifier": "histogram_enum_name", "type": null, "docstring": "The name of the XML attribute to update.", "docstring_tokens": [ "The", "name", "of", "the", "XML", "attribute", "to", ...
8e59700f3ed1ca80c356f3ef75ac43f52d6d9073
sunlongbo/chromium
chrome/browser/resources/PRESUBMIT.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CheckUserActionUpdate
<not_specific>
def CheckUserActionUpdate(input_api, output_api, action_xml_path): """Checks if any new user action has been added.""" if any('actions.xml' == input_api.os_path.basename(f) for f in input_api.change.LocalPaths()): # If actions.xml is already included in the changelist, the PRESUBMIT # for actions.x...
Checks if any new user action has been added.
Checks if any new user action has been added.
[ "Checks", "if", "any", "new", "user", "action", "has", "been", "added", "." ]
def CheckUserActionUpdate(input_api, output_api, action_xml_path): if any('actions.xml' == input_api.os_path.basename(f) for f in input_api.change.LocalPaths()): return [] file_filter = lambda f: f.LocalPath().endswith('.html') action_re = r'(^|\s+)metric\s*=\s*"([^ ]*)"' current_actions = None f...
[ "def", "CheckUserActionUpdate", "(", "input_api", ",", "output_api", ",", "action_xml_path", ")", ":", "if", "any", "(", "'actions.xml'", "==", "input_api", ".", "os_path", ".", "basename", "(", "f", ")", "for", "f", "in", "input_api", ".", "change", ".", ...
Checks if any new user action has been added.
[ "Checks", "if", "any", "new", "user", "action", "has", "been", "added", "." ]
[ "\"\"\"Checks if any new user action has been added.\"\"\"", "# If actions.xml is already included in the changelist, the PRESUBMIT", "# for actions.xml will do a more complete presubmit check.", "# Loads contents in tools/metrics/actions/actions.xml to memory. It's", "# loaded only once.", "# Search for ...
[ { "param": "input_api", "type": null }, { "param": "output_api", "type": null }, { "param": "action_xml_path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_api", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "output_api", "type": null, "docstring": null, "docstring...
8e59700f3ed1ca80c356f3ef75ac43f52d6d9073
sunlongbo/chromium
chrome/browser/resources/PRESUBMIT.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
IsActionPresent
<not_specific>
def IsActionPresent(current_actions, metric_name, is_boolean): """Checks if metric_name is defined in the actions file. Checks whether there's matching entries in an actions.xml file for the given |metric_name|, depending on whether it is a boolean action. Args: current_actions: The content of the actions...
Checks if metric_name is defined in the actions file. Checks whether there's matching entries in an actions.xml file for the given |metric_name|, depending on whether it is a boolean action. Args: current_actions: The content of the actions.xml file. metric_name: The name for which the check should be d...
Checks if metric_name is defined in the actions file. Checks whether there's matching entries in an actions.xml file for the given |metric_name|, depending on whether it is a boolean action.
[ "Checks", "if", "metric_name", "is", "defined", "in", "the", "actions", "file", ".", "Checks", "whether", "there", "'", "s", "matching", "entries", "in", "an", "actions", ".", "xml", "file", "for", "the", "given", "|metric_name|", "depending", "on", "whether...
def IsActionPresent(current_actions, metric_name, is_boolean): if not is_boolean: action = 'name="{0}"'.format(metric_name) return action in current_actions action_disabled = 'name="{0}_Disable"'.format(metric_name) action_enabled = 'name="{0}_Enable"'.format(metric_name) return (action_disabled in curr...
[ "def", "IsActionPresent", "(", "current_actions", ",", "metric_name", ",", "is_boolean", ")", ":", "if", "not", "is_boolean", ":", "action", "=", "'name=\"{0}\"'", ".", "format", "(", "metric_name", ")", "return", "action", "in", "current_actions", "action_disable...
Checks if metric_name is defined in the actions file.
[ "Checks", "if", "metric_name", "is", "defined", "in", "the", "actions", "file", "." ]
[ "\"\"\"Checks if metric_name is defined in the actions file.\n\n Checks whether there's matching entries in an actions.xml file for the given\n |metric_name|, depending on whether it is a boolean action.\n\n Args:\n current_actions: The content of the actions.xml file.\n metric_name: The name for which the...
[ { "param": "current_actions", "type": null }, { "param": "metric_name", "type": null }, { "param": "is_boolean", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "current_actions", "type": null, "docstring": "The content of the actions.xml file.", "docstring_tokens": [ "The", "content", "of", "the", "actions", ".", "xml", "...
8e59700f3ed1ca80c356f3ef75ac43f52d6d9073
sunlongbo/chromium
chrome/browser/resources/PRESUBMIT.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
IsBoolean
<not_specific>
def IsBoolean(new_content_lines, metric_name, input_api): """Check whether action defined in the changed code is boolean or not. Checks whether the action comes from boolean control based on the HTML elements attributes. Args: new_content_lines: List of changed lines. metric_name: The name for which ...
Check whether action defined in the changed code is boolean or not. Checks whether the action comes from boolean control based on the HTML elements attributes. Args: new_content_lines: List of changed lines. metric_name: The name for which the check should be done.
Check whether action defined in the changed code is boolean or not. Checks whether the action comes from boolean control based on the HTML elements attributes.
[ "Check", "whether", "action", "defined", "in", "the", "changed", "code", "is", "boolean", "or", "not", ".", "Checks", "whether", "the", "action", "comes", "from", "boolean", "control", "based", "on", "the", "HTML", "elements", "attributes", "." ]
def IsBoolean(new_content_lines, metric_name, input_api): new_content = '\n'.join(new_content_lines) html_element_re = r'<(.*?)(^|\s+)metric\s*=\s*"%s"(.*?)>' % (metric_name) type_re = (r'datatype\s*=\s*"boolean"|type\s*=\s*"checkbox"|' 'type\s*=\s*"radio".*?value\s*=\s*("true"|"false")') match = input_ap...
[ "def", "IsBoolean", "(", "new_content_lines", ",", "metric_name", ",", "input_api", ")", ":", "new_content", "=", "'\\n'", ".", "join", "(", "new_content_lines", ")", "html_element_re", "=", "r'<(.*?)(^|\\s+)metric\\s*=\\s*\"%s\"(.*?)>'", "%", "(", "metric_name", ")",...
Check whether action defined in the changed code is boolean or not.
[ "Check", "whether", "action", "defined", "in", "the", "changed", "code", "is", "boolean", "or", "not", "." ]
[ "\"\"\"Check whether action defined in the changed code is boolean or not.\n\n Checks whether the action comes from boolean control based on the HTML\n elements attributes.\n\n Args:\n new_content_lines: List of changed lines.\n metric_name: The name for which the check should be done.\n \"\"\"" ]
[ { "param": "new_content_lines", "type": null }, { "param": "metric_name", "type": null }, { "param": "input_api", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "new_content_lines", "type": null, "docstring": "List of changed lines.", "docstring_tokens": [ "List", "of", "changed", "lines", "." ], "default": null, "is_optional": ...
8e6bb14714848844b142c9e80794d23684ee3677
sunlongbo/chromium
third_party/blink/renderer/modules/bluetooth/testing/clusterfuzz/test_case_fuzzer.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GenerateSequenceOfRandomTokens
<not_specific>
def _GenerateSequenceOfRandomTokens(): """Generates a sequence of calls to the Web Bluetooth API. Uses the arrays of strings in TOKENS and randomly picks a number between [1, 100] to generate a random sequence of calls to the Web Bluetooth API, calls to reload the page, and calls to perform garbage co...
Generates a sequence of calls to the Web Bluetooth API. Uses the arrays of strings in TOKENS and randomly picks a number between [1, 100] to generate a random sequence of calls to the Web Bluetooth API, calls to reload the page, and calls to perform garbage collection. Returns: A string contain...
Generates a sequence of calls to the Web Bluetooth API. Uses the arrays of strings in TOKENS and randomly picks a number between [1, 100] to generate a random sequence of calls to the Web Bluetooth API, calls to reload the page, and calls to perform garbage collection.
[ "Generates", "a", "sequence", "of", "calls", "to", "the", "Web", "Bluetooth", "API", ".", "Uses", "the", "arrays", "of", "strings", "in", "TOKENS", "and", "randomly", "picks", "a", "number", "between", "[", "1", "100", "]", "to", "generate", "a", "random...
def _GenerateSequenceOfRandomTokens(): result = random.choice(BASE_TOKENS) for _ in xrange(random.randint(1, MAX_NUM_OF_TOKENS)): token = random.choice(TOKENS) for line in token: result += INDENT + line + BREAK result += INDENT + END_TOKEN return result
[ "def", "_GenerateSequenceOfRandomTokens", "(", ")", ":", "result", "=", "random", ".", "choice", "(", "BASE_TOKENS", ")", "for", "_", "in", "xrange", "(", "random", ".", "randint", "(", "1", ",", "MAX_NUM_OF_TOKENS", ")", ")", ":", "token", "=", "random", ...
Generates a sequence of calls to the Web Bluetooth API.
[ "Generates", "a", "sequence", "of", "calls", "to", "the", "Web", "Bluetooth", "API", "." ]
[ "\"\"\"Generates a sequence of calls to the Web Bluetooth API.\n\n Uses the arrays of strings in TOKENS and randomly picks a number between\n [1, 100] to generate a random sequence of calls to the Web Bluetooth API,\n calls to reload the page, and calls to perform garbage collection.\n\n Returns:\n ...
[]
{ "returns": [ { "docstring": "A string containing a sequence of calls to the Web Bluetooth API.", "docstring_tokens": [ "A", "string", "containing", "a", "sequence", "of", "calls", "to", "the", "Web", "Bluetooth",...
097bba44a4ed50aae2d1f2282acaffbd37e201d9
sunlongbo/chromium
chrome/tools/build/mac/verify_order.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
parse_order_file
<not_specific>
def parse_order_file(filename): """Parses a file containing symbols like passed to ld64's -order_file. Doesn't support arch or object file prefixes. """ strip_comments = re.compile('#.*$') symbols = [strip_comments.sub('', line).strip() for line in open(filename)] symbols = list(filter(None, symbols)) if...
Parses a file containing symbols like passed to ld64's -order_file. Doesn't support arch or object file prefixes.
Parses a file containing symbols like passed to ld64's -order_file. Doesn't support arch or object file prefixes.
[ "Parses", "a", "file", "containing", "symbols", "like", "passed", "to", "ld64", "'", "s", "-", "order_file", ".", "Doesn", "'", "t", "support", "arch", "or", "object", "file", "prefixes", "." ]
def parse_order_file(filename): strip_comments = re.compile('#.*$') symbols = [strip_comments.sub('', line).strip() for line in open(filename)] symbols = list(filter(None, symbols)) if has_duplicates(symbols): print('order file "%s" contains duplicate symbols' % filename, file=sys.stderr) sys....
[ "def", "parse_order_file", "(", "filename", ")", ":", "strip_comments", "=", "re", ".", "compile", "(", "'#.*$'", ")", "symbols", "=", "[", "strip_comments", ".", "sub", "(", "''", ",", "line", ")", ".", "strip", "(", ")", "for", "line", "in", "open", ...
Parses a file containing symbols like passed to ld64's -order_file.
[ "Parses", "a", "file", "containing", "symbols", "like", "passed", "to", "ld64", "'", "s", "-", "order_file", "." ]
[ "\"\"\"Parses a file containing symbols like passed to ld64's -order_file.\n\n Doesn't support arch or object file prefixes.\n \"\"\"" ]
[ { "param": "filename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
09a4d5a1de14b7d9a00ae46561ed0a2f5d88c438
sunlongbo/chromium
third_party/blink/tools/blinkpy/web_tests/run_web_tests_unittest.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
assert_baselines
null
def assert_baselines(self, written_files, log_stream, expected_file_base, expected_extensions): """Asserts that the written_files contains baselines for one test. Args: written_files: from FileSystem.written_files. log_stream: The log stream from the run...
Asserts that the written_files contains baselines for one test. Args: written_files: from FileSystem.written_files. log_stream: The log stream from the run. expected_file_base: Relative path to the baseline, without the extension, from the web test directory....
Asserts that the written_files contains baselines for one test.
[ "Asserts", "that", "the", "written_files", "contains", "baselines", "for", "one", "test", "." ]
def assert_baselines(self, written_files, log_stream, expected_file_base, expected_extensions): for ext in expected_extensions: baseline = '%s-expected%s' % (expected_file_base, ext) baseline_full_path = '%s/%s' % (test.WEB_TEST_DIR, baseline) self.as...
[ "def", "assert_baselines", "(", "self", ",", "written_files", ",", "log_stream", ",", "expected_file_base", ",", "expected_extensions", ")", ":", "for", "ext", "in", "expected_extensions", ":", "baseline", "=", "'%s-expected%s'", "%", "(", "expected_file_base", ",",...
Asserts that the written_files contains baselines for one test.
[ "Asserts", "that", "the", "written_files", "contains", "baselines", "for", "one", "test", "." ]
[ "\"\"\"Asserts that the written_files contains baselines for one test.\n\n Args:\n written_files: from FileSystem.written_files.\n log_stream: The log stream from the run.\n expected_file_base: Relative path to the baseline,\n without the extension, from the we...
[ { "param": "self", "type": null }, { "param": "written_files", "type": null }, { "param": "log_stream", "type": null }, { "param": "expected_file_base", "type": null }, { "param": "expected_extensions", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "written_files", "type": null, "docstring": null, "docstring_t...
8889e230b5e8fb53f81b09b07a30f83da0b22067
sunlongbo/chromium
tools/perf/page_sets/system_health/system_health_stories.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
IterAllSystemHealthStoryClasses
null
def IterAllSystemHealthStoryClasses(): """Generator for system health stories. Yields: All appropriate SystemHealthStory subclasses defining stories. """ start_dir = os.path.dirname(os.path.abspath(__file__)) # Sort the classes by their names so that their order is stable and # deterministic. for unu...
Generator for system health stories. Yields: All appropriate SystemHealthStory subclasses defining stories.
Generator for system health stories.
[ "Generator", "for", "system", "health", "stories", "." ]
def IterAllSystemHealthStoryClasses(): start_dir = os.path.dirname(os.path.abspath(__file__)) for unused_cls_name, cls in sorted(discover.DiscoverClasses( start_dir=start_dir, top_level_dir=os.path.dirname(start_dir), base_class=system_health_story.SystemHealthStory).items()): yield cls
[ "def", "IterAllSystemHealthStoryClasses", "(", ")", ":", "start_dir", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "__file__", ")", ")", "for", "unused_cls_name", ",", "cls", "in", "sorted", "(", "discover", ".", "...
Generator for system health stories.
[ "Generator", "for", "system", "health", "stories", "." ]
[ "\"\"\"Generator for system health stories.\n\n Yields:\n All appropriate SystemHealthStory subclasses defining stories.\n \"\"\"", "# Sort the classes by their names so that their order is stable and", "# deterministic." ]
[]
{ "returns": [ { "docstring": "All appropriate SystemHealthStory subclasses defining stories.", "docstring_tokens": [ "All", "appropriate", "SystemHealthStory", "subclasses", "defining", "stories", "." ], "type": null } ], "ra...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GenerateHash
<not_specific>
def _GenerateHash(file_path): """Calculates and returns the hash of the file at file_path.""" sha1 = hashlib.sha1() with open(file_path, 'rb') as f: while True: # Read in 1mb chunks, so it doesn't all have to be loaded into memory. chunk = f.read(1024 * 1024) if not chunk: break ...
Calculates and returns the hash of the file at file_path.
Calculates and returns the hash of the file at file_path.
[ "Calculates", "and", "returns", "the", "hash", "of", "the", "file", "at", "file_path", "." ]
def _GenerateHash(file_path): sha1 = hashlib.sha1() with open(file_path, 'rb') as f: while True: chunk = f.read(1024 * 1024) if not chunk: break sha1.update(chunk) return sha1.hexdigest()
[ "def", "_GenerateHash", "(", "file_path", ")", ":", "sha1", "=", "hashlib", ".", "sha1", "(", ")", "with", "open", "(", "file_path", ",", "'rb'", ")", "as", "f", ":", "while", "True", ":", "chunk", "=", "f", ".", "read", "(", "1024", "*", "1024", ...
Calculates and returns the hash of the file at file_path.
[ "Calculates", "and", "returns", "the", "hash", "of", "the", "file", "at", "file_path", "." ]
[ "\"\"\"Calculates and returns the hash of the file at file_path.\"\"\"", "# Read in 1mb chunks, so it doesn't all have to be loaded into memory." ]
[ { "param": "file_path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "file_path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GetFileExtension
<not_specific>
def _GetFileExtension(file_name): """Calculates the file extension from a file name. Args: file_name: The source file name. Returns: The part of file_name after the dot (.) or None if the file has no extension. Examples: /home/user/foo.bar -> bar /home/user.name/foo -> None ...
Calculates the file extension from a file name. Args: file_name: The source file name. Returns: The part of file_name after the dot (.) or None if the file has no extension. Examples: /home/user/foo.bar -> bar /home/user.name/foo -> None /home/user/.foo -> ...
Calculates the file extension from a file name.
[ "Calculates", "the", "file", "extension", "from", "a", "file", "name", "." ]
def _GetFileExtension(file_name): file_name_parts = os.path.basename(file_name).split('.') if len(file_name_parts) > 1: return file_name_parts[-1] else: return None
[ "def", "_GetFileExtension", "(", "file_name", ")", ":", "file_name_parts", "=", "os", ".", "path", ".", "basename", "(", "file_name", ")", ".", "split", "(", "'.'", ")", "if", "len", "(", "file_name_parts", ")", ">", "1", ":", "return", "file_name_parts", ...
Calculates the file extension from a file name.
[ "Calculates", "the", "file", "extension", "from", "a", "file", "name", "." ]
[ "\"\"\"Calculates the file extension from a file name.\n\n Args:\n file_name: The source file name.\n Returns:\n The part of file_name after the dot (.) or None if the file has no\n extension.\n Examples: /home/user/foo.bar -> bar\n /home/user.name/foo -> None\n /home/...
[ { "param": "file_name", "type": null } ]
{ "returns": [ { "docstring": "The part of file_name after the dot (.) or None if the file has no\nextension.\nExamples: /home/user/foo.bar -> bar\nhome/user.name/foo -> None\nhome/user/.foo -> None\nhome/user/foo.bar.baz -> baz", "docstring_tokens": [ "The", "part", ...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_StashOutputDirectory
<not_specific>
def _StashOutputDirectory(buildpath): """Takes the output directory and stashes it in the default output directory. This allows it to be used for incremental builds next time (after unstashing) by keeping it in a place that isn't deleted normally, while also ensuring that it is properly clobbered when appropri...
Takes the output directory and stashes it in the default output directory. This allows it to be used for incremental builds next time (after unstashing) by keeping it in a place that isn't deleted normally, while also ensuring that it is properly clobbered when appropriate. This is a dirty hack to deal with t...
Takes the output directory and stashes it in the default output directory. This allows it to be used for incremental builds next time (after unstashing) by keeping it in a place that isn't deleted normally, while also ensuring that it is properly clobbered when appropriate. This is a dirty hack to deal with the needs ...
[ "Takes", "the", "output", "directory", "and", "stashes", "it", "in", "the", "default", "output", "directory", ".", "This", "allows", "it", "to", "be", "used", "for", "incremental", "builds", "next", "time", "(", "after", "unstashing", ")", "by", "keeping", ...
def _StashOutputDirectory(buildpath): if os.path.abspath(buildpath) == os.path.abspath(os.path.dirname( constants.GetOutDirectory())): return name = os.path.basename(buildpath) stashpath = os.path.join(constants.GetOutDirectory(), name) if not os.path.exists(buildpath): return if os.path.exists(...
[ "def", "_StashOutputDirectory", "(", "buildpath", ")", ":", "if", "os", ".", "path", ".", "abspath", "(", "buildpath", ")", "==", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "constants", ".", "GetOutDirectory", "(", ...
Takes the output directory and stashes it in the default output directory.
[ "Takes", "the", "output", "directory", "and", "stashes", "it", "in", "the", "default", "output", "directory", "." ]
[ "\"\"\"Takes the output directory and stashes it in the default output directory.\n\n This allows it to be used for incremental builds next time (after unstashing)\n by keeping it in a place that isn't deleted normally, while also ensuring\n that it is properly clobbered when appropriate.\n\n This is a dirty ha...
[ { "param": "buildpath", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "buildpath", "type": null, "docstring": "The path where the building happens. If this corresponds to the\ndefault output directory, no action is taken.", "docstring_tokens": [ "The", "path", "where", ...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_UnstashOutputDirectory
<not_specific>
def _UnstashOutputDirectory(buildpath): """Inverse of _StashOutputDirectory. Moves the output directory stashed within the default output directory (out/Release) to the position where the builds can actually happen. This is a dirty hack to deal with the needs of clobbering while also handling incremental bu...
Inverse of _StashOutputDirectory. Moves the output directory stashed within the default output directory (out/Release) to the position where the builds can actually happen. This is a dirty hack to deal with the needs of clobbering while also handling incremental builds and the hardcoded relative paths used in...
This is a dirty hack to deal with the needs of clobbering while also handling incremental builds and the hardcoded relative paths used in some of the project files.
[ "This", "is", "a", "dirty", "hack", "to", "deal", "with", "the", "needs", "of", "clobbering", "while", "also", "handling", "incremental", "builds", "and", "the", "hardcoded", "relative", "paths", "used", "in", "some", "of", "the", "project", "files", "." ]
def _UnstashOutputDirectory(buildpath): if os.path.abspath(buildpath) == os.path.abspath(os.path.dirname( constants.GetOutDirectory())): return name = os.path.basename(buildpath) stashpath = os.path.join(constants.GetOutDirectory(), name) if not os.path.exists(stashpath): return if os.path.exist...
[ "def", "_UnstashOutputDirectory", "(", "buildpath", ")", ":", "if", "os", ".", "path", ".", "abspath", "(", "buildpath", ")", "==", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "constants", ".", "GetOutDirectory", "(", ...
Inverse of _StashOutputDirectory.
[ "Inverse", "of", "_StashOutputDirectory", "." ]
[ "\"\"\"Inverse of _StashOutputDirectory.\n\n Moves the output directory stashed within the default output directory\n (out/Release) to the position where the builds can actually happen.\n\n This is a dirty hack to deal with the needs of clobbering while also handling\n incremental builds and the hardcoded relat...
[ { "param": "buildpath", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "buildpath", "type": null, "docstring": "The path where the building happens. If this corresponds to the\ndefault output directory, no action is taken.", "docstring_tokens": [ "The", "path", "where", ...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
BeginStep
null
def BeginStep(self, name): """Marks a beginning of the next step in the script. On buildbot, this prints a specially formatted name that will show up in the waterfall. Otherwise, just prints the step name. Args: name: The name of the step. """ self.EndStep() self._previous_step = (na...
Marks a beginning of the next step in the script. On buildbot, this prints a specially formatted name that will show up in the waterfall. Otherwise, just prints the step name. Args: name: The name of the step.
Marks a beginning of the next step in the script. On buildbot, this prints a specially formatted name that will show up in the waterfall. Otherwise, just prints the step name.
[ "Marks", "a", "beginning", "of", "the", "next", "step", "in", "the", "script", ".", "On", "buildbot", "this", "prints", "a", "specially", "formatted", "name", "that", "will", "show", "up", "in", "the", "waterfall", ".", "Otherwise", "just", "prints", "the"...
def BeginStep(self, name): self.EndStep() self._previous_step = (name, time.time()) print('Running step: ', name)
[ "def", "BeginStep", "(", "self", ",", "name", ")", ":", "self", ".", "EndStep", "(", ")", "self", ".", "_previous_step", "=", "(", "name", ",", "time", ".", "time", "(", ")", ")", "print", "(", "'Running step: '", ",", "name", ")" ]
Marks a beginning of the next step in the script.
[ "Marks", "a", "beginning", "of", "the", "next", "step", "in", "the", "script", "." ]
[ "\"\"\"Marks a beginning of the next step in the script.\n\n On buildbot, this prints a specially formatted name that will show up\n in the waterfall. Otherwise, just prints the step name.\n\n Args:\n name: The name of the step.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": "The name of the step.", "d...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
EndStep
null
def EndStep(self): """Records successful completion of the current step. This is optional if the step is immediately followed by another BeginStep. """ if self._previous_step[0]: elapsed = time.time() - self._previous_step[1] print('Step %s took %f seconds' % (self._previous_step[0], elapse...
Records successful completion of the current step. This is optional if the step is immediately followed by another BeginStep.
Records successful completion of the current step. This is optional if the step is immediately followed by another BeginStep.
[ "Records", "successful", "completion", "of", "the", "current", "step", ".", "This", "is", "optional", "if", "the", "step", "is", "immediately", "followed", "by", "another", "BeginStep", "." ]
def EndStep(self): if self._previous_step[0]: elapsed = time.time() - self._previous_step[1] print('Step %s took %f seconds' % (self._previous_step[0], elapsed)) self.timings.append((self._previous_step[0], elapsed)) self._previous_step = ('', 0.0)
[ "def", "EndStep", "(", "self", ")", ":", "if", "self", ".", "_previous_step", "[", "0", "]", ":", "elapsed", "=", "time", ".", "time", "(", ")", "-", "self", ".", "_previous_step", "[", "1", "]", "print", "(", "'Step %s took %f seconds'", "%", "(", "...
Records successful completion of the current step.
[ "Records", "successful", "completion", "of", "the", "current", "step", "." ]
[ "\"\"\"Records successful completion of the current step.\n\n This is optional if the step is immediately followed by another BeginStep.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
FailStep
null
def FailStep(self, message=None): """Marks that a particular step has failed. On buildbot, this will mark the current step as failed on the waterfall. Otherwise we will just print an optional failure message. Args: message: An optional explanation as to why the step failed. """ print('ST...
Marks that a particular step has failed. On buildbot, this will mark the current step as failed on the waterfall. Otherwise we will just print an optional failure message. Args: message: An optional explanation as to why the step failed.
Marks that a particular step has failed. On buildbot, this will mark the current step as failed on the waterfall. Otherwise we will just print an optional failure message.
[ "Marks", "that", "a", "particular", "step", "has", "failed", ".", "On", "buildbot", "this", "will", "mark", "the", "current", "step", "as", "failed", "on", "the", "waterfall", ".", "Otherwise", "we", "will", "just", "print", "an", "optional", "failure", "m...
def FailStep(self, message=None): print('STEP FAILED!!') if message: print(message) self._error_recorded = True self.EndStep()
[ "def", "FailStep", "(", "self", ",", "message", "=", "None", ")", ":", "print", "(", "'STEP FAILED!!'", ")", "if", "message", ":", "print", "(", "message", ")", "self", ".", "_error_recorded", "=", "True", "self", ".", "EndStep", "(", ")" ]
Marks that a particular step has failed.
[ "Marks", "that", "a", "particular", "step", "has", "failed", "." ]
[ "\"\"\"Marks that a particular step has failed.\n\n On buildbot, this will mark the current step as failed on the waterfall.\n Otherwise we will just print an optional failure message.\n\n Args:\n message: An optional explanation as to why the step failed.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "message", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "message", "type": null, "docstring": "An optional explanation as to...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Build
null
def Build(self, instrumented, use_call_graph, target): """Builds the provided ninja target with or without order_profiling on. Args: instrumented: (bool) Whether we want to build an instrumented binary. use_call_graph: (bool) Whether to use the call graph instrumentation. target: (str) The na...
Builds the provided ninja target with or without order_profiling on. Args: instrumented: (bool) Whether we want to build an instrumented binary. use_call_graph: (bool) Whether to use the call graph instrumentation. target: (str) The name of the ninja target to build.
Builds the provided ninja target with or without order_profiling on.
[ "Builds", "the", "provided", "ninja", "target", "with", "or", "without", "order_profiling", "on", "." ]
def Build(self, instrumented, use_call_graph, target): self._step_recorder.BeginStep('Compile %s' % target) assert not use_call_graph or instrumented, ('You can not enable call graph ' 'without instrumentation!') args = [ 'enable_resource_allowlist_gen...
[ "def", "Build", "(", "self", ",", "instrumented", ",", "use_call_graph", ",", "target", ")", ":", "self", ".", "_step_recorder", ".", "BeginStep", "(", "'Compile %s'", "%", "target", ")", "assert", "not", "use_call_graph", "or", "instrumented", ",", "(", "'Y...
Builds the provided ninja target with or without order_profiling on.
[ "Builds", "the", "provided", "ninja", "target", "with", "or", "without", "order_profiling", "on", "." ]
[ "\"\"\"Builds the provided ninja target with or without order_profiling on.\n\n Args:\n instrumented: (bool) Whether we want to build an instrumented binary.\n use_call_graph: (bool) Whether to use the call graph instrumentation.\n target: (str) The name of the ninja target to build.\n \"\"\"",...
[ { "param": "self", "type": null }, { "param": "instrumented", "type": null }, { "param": "use_call_graph", "type": null }, { "param": "target", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "instrumented", "type": null, "docstring": "(bool) Whether we want t...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CompileChromeApk
null
def CompileChromeApk(self, instrumented, use_call_graph, force_relink=False): """Builds a Chrome.apk either with or without order_profiling on. Args: instrumented: (bool) Whether to build an instrumented apk. use_call_graph: (bool) Whether to use the call graph instrumentation. force_relink: ...
Builds a Chrome.apk either with or without order_profiling on. Args: instrumented: (bool) Whether to build an instrumented apk. use_call_graph: (bool) Whether to use the call graph instrumentation. force_relink: Whether libchromeview.so should be re-created.
Builds a Chrome.apk either with or without order_profiling on.
[ "Builds", "a", "Chrome", ".", "apk", "either", "with", "or", "without", "order_profiling", "on", "." ]
def CompileChromeApk(self, instrumented, use_call_graph, force_relink=False): if force_relink: self.ForceRelink() self.Build(instrumented, use_call_graph, self._apk_target)
[ "def", "CompileChromeApk", "(", "self", ",", "instrumented", ",", "use_call_graph", ",", "force_relink", "=", "False", ")", ":", "if", "force_relink", ":", "self", ".", "ForceRelink", "(", ")", "self", ".", "Build", "(", "instrumented", ",", "use_call_graph", ...
Builds a Chrome.apk either with or without order_profiling on.
[ "Builds", "a", "Chrome", ".", "apk", "either", "with", "or", "without", "order_profiling", "on", "." ]
[ "\"\"\"Builds a Chrome.apk either with or without order_profiling on.\n\n Args:\n instrumented: (bool) Whether to build an instrumented apk.\n use_call_graph: (bool) Whether to use the call graph instrumentation.\n force_relink: Whether libchromeview.so should be re-created.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "instrumented", "type": null }, { "param": "use_call_graph", "type": null }, { "param": "force_relink", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "instrumented", "type": null, "docstring": "(bool) Whether to build ...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CompileLibchrome
null
def CompileLibchrome(self, instrumented, use_call_graph, force_relink=False): """Builds a libchrome.so either with or without order_profiling on. Args: instrumented: (bool) Whether to build an instrumented apk. use_call_graph: (bool) Whether to use the call graph instrumentation. force_relink...
Builds a libchrome.so either with or without order_profiling on. Args: instrumented: (bool) Whether to build an instrumented apk. use_call_graph: (bool) Whether to use the call graph instrumentation. force_relink: (bool) Whether libchrome.so should be re-created.
Builds a libchrome.so either with or without order_profiling on.
[ "Builds", "a", "libchrome", ".", "so", "either", "with", "or", "without", "order_profiling", "on", "." ]
def CompileLibchrome(self, instrumented, use_call_graph, force_relink=False): if force_relink: self.ForceRelink() self.Build(instrumented, use_call_graph, self._libchrome_target)
[ "def", "CompileLibchrome", "(", "self", ",", "instrumented", ",", "use_call_graph", ",", "force_relink", "=", "False", ")", ":", "if", "force_relink", ":", "self", ".", "ForceRelink", "(", ")", "self", ".", "Build", "(", "instrumented", ",", "use_call_graph", ...
Builds a libchrome.so either with or without order_profiling on.
[ "Builds", "a", "libchrome", ".", "so", "either", "with", "or", "without", "order_profiling", "on", "." ]
[ "\"\"\"Builds a libchrome.so either with or without order_profiling on.\n\n Args:\n instrumented: (bool) Whether to build an instrumented apk.\n use_call_graph: (bool) Whether to use the call graph instrumentation.\n force_relink: (bool) Whether libchrome.so should be re-created.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "instrumented", "type": null }, { "param": "use_call_graph", "type": null }, { "param": "force_relink", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "instrumented", "type": null, "docstring": "(bool) Whether to build ...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CommitStashedFileHashes
null
def CommitStashedFileHashes(self, files): """Commits unpatched and patched orderfiles hashes if changed. The files are committed only if their associated sha1 hash files match, and are modified in git. In normal operations the hash files are changed only when a file is uploaded to cloud storage. If the...
Commits unpatched and patched orderfiles hashes if changed. The files are committed only if their associated sha1 hash files match, and are modified in git. In normal operations the hash files are changed only when a file is uploaded to cloud storage. If the hash file is not modified in git, the file i...
Commits unpatched and patched orderfiles hashes if changed. The files are committed only if their associated sha1 hash files match, and are modified in git. In normal operations the hash files are changed only when a file is uploaded to cloud storage. If the hash file is not modified in git, the file is skipped. [str ...
[ "Commits", "unpatched", "and", "patched", "orderfiles", "hashes", "if", "changed", ".", "The", "files", "are", "committed", "only", "if", "their", "associated", "sha1", "hash", "files", "match", "and", "are", "modified", "in", "git", ".", "In", "normal", "op...
def CommitStashedFileHashes(self, files): files_to_commit = [_f for _f in files if _f] if files_to_commit: self._CommitStashedFiles(files_to_commit)
[ "def", "CommitStashedFileHashes", "(", "self", ",", "files", ")", ":", "files_to_commit", "=", "[", "_f", "for", "_f", "in", "files", "if", "_f", "]", "if", "files_to_commit", ":", "self", ".", "_CommitStashedFiles", "(", "files_to_commit", ")" ]
Commits unpatched and patched orderfiles hashes if changed.
[ "Commits", "unpatched", "and", "patched", "orderfiles", "hashes", "if", "changed", "." ]
[ "\"\"\"Commits unpatched and patched orderfiles hashes if changed.\n\n The files are committed only if their associated sha1 hash files match, and\n are modified in git. In normal operations the hash files are changed only\n when a file is uploaded to cloud storage. If the hash file is not modified\n in...
[ { "param": "self", "type": null }, { "param": "files", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "files", "type": null, "docstring": null, "docstring_tokens": ...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
UploadToCloudStorage
null
def UploadToCloudStorage(self, filename, use_debug_location): """Uploads a file to cloud storage. Args: filename: (str) File to upload. use_debug_location: (bool) Whether to use the debug location. """ bucket = (self._CLOUD_STORAGE_BUCKET_FOR_DEBUG if use_debug_location else s...
Uploads a file to cloud storage. Args: filename: (str) File to upload. use_debug_location: (bool) Whether to use the debug location.
Uploads a file to cloud storage.
[ "Uploads", "a", "file", "to", "cloud", "storage", "." ]
def UploadToCloudStorage(self, filename, use_debug_location): bucket = (self._CLOUD_STORAGE_BUCKET_FOR_DEBUG if use_debug_location else self._CLOUD_STORAGE_BUCKET) extension = _GetFileExtension(filename) cmd = [self._UPLOAD_TO_CLOUD_COMMAND, '--bucket', bucket] if extension: cmd.exte...
[ "def", "UploadToCloudStorage", "(", "self", ",", "filename", ",", "use_debug_location", ")", ":", "bucket", "=", "(", "self", ".", "_CLOUD_STORAGE_BUCKET_FOR_DEBUG", "if", "use_debug_location", "else", "self", ".", "_CLOUD_STORAGE_BUCKET", ")", "extension", "=", "_G...
Uploads a file to cloud storage.
[ "Uploads", "a", "file", "to", "cloud", "storage", "." ]
[ "\"\"\"Uploads a file to cloud storage.\n\n Args:\n filename: (str) File to upload.\n use_debug_location: (bool) Whether to use the debug location.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "filename", "type": null }, { "param": "use_debug_location", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filename", "type": null, "docstring": "(str) File to upload.", ...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GetHashFilePathAndContents
<not_specific>
def _GetHashFilePathAndContents(self, filename): """Gets the name and content of the hash file created from uploading the given file. Args: filename: (str) The file that was uploaded to cloud storage. Returns: A tuple of the hash file name, relative to the reository root, and the con...
Gets the name and content of the hash file created from uploading the given file. Args: filename: (str) The file that was uploaded to cloud storage. Returns: A tuple of the hash file name, relative to the reository root, and the content, which should be the sha1 hash of the file ('...
Gets the name and content of the hash file created from uploading the given file.
[ "Gets", "the", "name", "and", "content", "of", "the", "hash", "file", "created", "from", "uploading", "the", "given", "file", "." ]
def _GetHashFilePathAndContents(self, filename): abs_hash_filename = filename + '.sha1' rel_hash_filename = os.path.relpath( abs_hash_filename, self._repository_root) with open(abs_hash_filename, 'r') as f: return (rel_hash_filename, f.read())
[ "def", "_GetHashFilePathAndContents", "(", "self", ",", "filename", ")", ":", "abs_hash_filename", "=", "filename", "+", "'.sha1'", "rel_hash_filename", "=", "os", ".", "path", ".", "relpath", "(", "abs_hash_filename", ",", "self", ".", "_repository_root", ")", ...
Gets the name and content of the hash file created from uploading the given file.
[ "Gets", "the", "name", "and", "content", "of", "the", "hash", "file", "created", "from", "uploading", "the", "given", "file", "." ]
[ "\"\"\"Gets the name and content of the hash file created from uploading the\n given file.\n\n Args:\n filename: (str) The file that was uploaded to cloud storage.\n\n Returns:\n A tuple of the hash file name, relative to the reository root, and the\n content, which should be the sha1 hash o...
[ { "param": "self", "type": null }, { "param": "filename", "type": null } ]
{ "returns": [ { "docstring": "A tuple of the hash file name, relative to the reository root, and the\ncontent, which should be the sha1 hash of the file\n('base_file.sha1', hash)", "docstring_tokens": [ "A", "tuple", "of", "the", "hash", "file", ...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GitStash
null
def _GitStash(self): """Git stash the current clank tree. Raises: NotImplementedError when the stash logic hasn't been overridden. """ raise NotImplementedError
Git stash the current clank tree. Raises: NotImplementedError when the stash logic hasn't been overridden.
Git stash the current clank tree. Raises: NotImplementedError when the stash logic hasn't been overridden.
[ "Git", "stash", "the", "current", "clank", "tree", ".", "Raises", ":", "NotImplementedError", "when", "the", "stash", "logic", "hasn", "'", "t", "been", "overridden", "." ]
def _GitStash(self): raise NotImplementedError
[ "def", "_GitStash", "(", "self", ")", ":", "raise", "NotImplementedError" ]
Git stash the current clank tree.
[ "Git", "stash", "the", "current", "clank", "tree", "." ]
[ "\"\"\"Git stash the current clank tree.\n\n Raises:\n NotImplementedError when the stash logic hasn't been overridden.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_CommitStashedFiles
null
def _CommitStashedFiles(self, expected_files_in_stash): """Commits stashed files. The local repository is updated and then the files to commit are taken from modified files from the git stash. The modified files should be a subset of |expected_files_in_stash|. If there are unexpected modified files, th...
Commits stashed files. The local repository is updated and then the files to commit are taken from modified files from the git stash. The modified files should be a subset of |expected_files_in_stash|. If there are unexpected modified files, this function may raise. This is meant to be paired with _Git...
Commits stashed files. The local repository is updated and then the files to commit are taken from modified files from the git stash. The modified files should be a subset of |expected_files_in_stash|. If there are unexpected modified files, this function may raise. This is meant to be paired with _GitStash(). [str] p...
[ "Commits", "stashed", "files", ".", "The", "local", "repository", "is", "updated", "and", "then", "the", "files", "to", "commit", "are", "taken", "from", "modified", "files", "from", "the", "git", "stash", ".", "The", "modified", "files", "should", "be", "...
def _CommitStashedFiles(self, expected_files_in_stash): raise NotImplementedError
[ "def", "_CommitStashedFiles", "(", "self", ",", "expected_files_in_stash", ")", ":", "raise", "NotImplementedError" ]
Commits stashed files.
[ "Commits", "stashed", "files", "." ]
[ "\"\"\"Commits stashed files.\n\n The local repository is updated and then the files to commit are taken from\n modified files from the git stash. The modified files should be a subset of\n |expected_files_in_stash|. If there are unexpected modified files, this\n function may raise. This is meant to be ...
[ { "param": "self", "type": null }, { "param": "expected_files_in_stash", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "expected_files_in_stash", "type": null, "docstring": null, "d...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GetPathToOrderfile
<not_specific>
def _GetPathToOrderfile(self): """Gets the path to the architecture-specific orderfile.""" # Build GN files use the ".arm" orderfile irrespective of the actual # architecture. Fake it, otherwise the orderfile we generate here is not # going to be picked up by builds. orderfile_fake_arch = 'arm' ...
Gets the path to the architecture-specific orderfile.
Gets the path to the architecture-specific orderfile.
[ "Gets", "the", "path", "to", "the", "architecture", "-", "specific", "orderfile", "." ]
def _GetPathToOrderfile(self): orderfile_fake_arch = 'arm' return self._path_to_orderfile % orderfile_fake_arch
[ "def", "_GetPathToOrderfile", "(", "self", ")", ":", "orderfile_fake_arch", "=", "'arm'", "return", "self", ".", "_path_to_orderfile", "%", "orderfile_fake_arch" ]
Gets the path to the architecture-specific orderfile.
[ "Gets", "the", "path", "to", "the", "architecture", "-", "specific", "orderfile", "." ]
[ "\"\"\"Gets the path to the architecture-specific orderfile.\"\"\"", "# Build GN files use the \".arm\" orderfile irrespective of the actual", "# architecture. Fake it, otherwise the orderfile we generate here is not", "# going to be picked up by builds." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_SetDevice
<not_specific>
def _SetDevice(self): """ Selects the device to be used by the script. Returns: (Device with given serial ID) : if the --device flag is set. (Device running Android[K,L]) : if --use-legacy-chrome-apk flag is set or no device running Android N+ was found. ...
Selects the device to be used by the script. Returns: (Device with given serial ID) : if the --device flag is set. (Device running Android[K,L]) : if --use-legacy-chrome-apk flag is set or no device running Android N+ was found. (Device running Android N+) :...
Selects the device to be used by the script.
[ "Selects", "the", "device", "to", "be", "used", "by", "the", "script", "." ]
def _SetDevice(self): devices = None if self._options.device: devices = [device_utils.DeviceUtils(self._options.device)] else: devices = device_utils.DeviceUtils.HealthyDevices() assert devices, 'Expected at least one connected device' if self._options.use_legacy_chrome_apk: self._...
[ "def", "_SetDevice", "(", "self", ")", ":", "devices", "=", "None", "if", "self", ".", "_options", ".", "device", ":", "devices", "=", "[", "device_utils", ".", "DeviceUtils", "(", "self", ".", "_options", ".", "device", ")", "]", "else", ":", "devices...
Selects the device to be used by the script.
[ "Selects", "the", "device", "to", "be", "used", "by", "the", "script", "." ]
[ "\"\"\" Selects the device to be used by the script.\n\n Returns:\n (Device with given serial ID) : if the --device flag is set.\n (Device running Android[K,L]) : if --use-legacy-chrome-apk flag is set or\n no device running Android N+ was found.\n (Device runn...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "(Device with given serial ID) : if the --device flag is set.\n(Device running Android[K,L]) : if --use-legacy-chrome-apk flag is set or\nno device running Android N+ was found.\n(Device running Android N+) : Otherwise.", "docstring_tokens": [ "(", "Device...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_RemoveBlanks
null
def _RemoveBlanks(src_file, dest_file): """A utility to remove blank lines from a file. Args: src_file: The name of the file to remove the blanks from. dest_file: The name of the file to write the output without blanks. """ assert src_file != dest_file, 'Source and destination need to be di...
A utility to remove blank lines from a file. Args: src_file: The name of the file to remove the blanks from. dest_file: The name of the file to write the output without blanks.
A utility to remove blank lines from a file.
[ "A", "utility", "to", "remove", "blank", "lines", "from", "a", "file", "." ]
def _RemoveBlanks(src_file, dest_file): assert src_file != dest_file, 'Source and destination need to be distinct' try: src = open(src_file, 'r') dest = open(dest_file, 'w') for line in src: if line and not line.isspace(): dest.write(line) finally: src.close() ...
[ "def", "_RemoveBlanks", "(", "src_file", ",", "dest_file", ")", ":", "assert", "src_file", "!=", "dest_file", ",", "'Source and destination need to be distinct'", "try", ":", "src", "=", "open", "(", "src_file", ",", "'r'", ")", "dest", "=", "open", "(", "dest...
A utility to remove blank lines from a file.
[ "A", "utility", "to", "remove", "blank", "lines", "from", "a", "file", "." ]
[ "\"\"\"A utility to remove blank lines from a file.\n\n Args:\n src_file: The name of the file to remove the blanks from.\n dest_file: The name of the file to write the output without blanks.\n \"\"\"" ]
[ { "param": "src_file", "type": null }, { "param": "dest_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "src_file", "type": null, "docstring": "The name of the file to remove the blanks from.", "docstring_tokens": [ "The", "name", "of", "the", "file", "to", "remove", ...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GenerateAndProcessProfile
null
def _GenerateAndProcessProfile(self): """Invokes a script to merge the per-thread traces into one file. The produced list of offsets is saved in self._GetUnpatchedOrderfileFilename(). """ self._step_recorder.BeginStep('Generate Profile Data') files = [] logging.getLogger().setLevel(logging....
Invokes a script to merge the per-thread traces into one file. The produced list of offsets is saved in self._GetUnpatchedOrderfileFilename().
Invokes a script to merge the per-thread traces into one file. The produced list of offsets is saved in self._GetUnpatchedOrderfileFilename().
[ "Invokes", "a", "script", "to", "merge", "the", "per", "-", "thread", "traces", "into", "one", "file", ".", "The", "produced", "list", "of", "offsets", "is", "saved", "in", "self", ".", "_GetUnpatchedOrderfileFilename", "()", "." ]
def _GenerateAndProcessProfile(self): self._step_recorder.BeginStep('Generate Profile Data') files = [] logging.getLogger().setLevel(logging.DEBUG) if self._options.profile_save_dir: if os.path.exists(self._options.profile_save_dir): raise Exception('Profile save directory must not pre-exi...
[ "def", "_GenerateAndProcessProfile", "(", "self", ")", ":", "self", ".", "_step_recorder", ".", "BeginStep", "(", "'Generate Profile Data'", ")", "files", "=", "[", "]", "logging", ".", "getLogger", "(", ")", ".", "setLevel", "(", "logging", ".", "DEBUG", ")...
Invokes a script to merge the per-thread traces into one file.
[ "Invokes", "a", "script", "to", "merge", "the", "per", "-", "thread", "traces", "into", "one", "file", "." ]
[ "\"\"\"Invokes a script to merge the per-thread traces into one file.\n\n The produced list of offsets is saved in\n self._GetUnpatchedOrderfileFilename().\n \"\"\"", "# The directory must not preexist, to ensure purity of data. Check", "# before profiling to save time." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_ProcessPhasedOrderfile
null
def _ProcessPhasedOrderfile(self, files): """Process the phased orderfiles produced by system health benchmarks. The offsets will be placed in _GetUnpatchedOrderfileFilename(). Args: file: Profile files pulled locally. """ self._step_recorder.BeginStep('Process Phased Orderfile') profile...
Process the phased orderfiles produced by system health benchmarks. The offsets will be placed in _GetUnpatchedOrderfileFilename(). Args: file: Profile files pulled locally.
Process the phased orderfiles produced by system health benchmarks. The offsets will be placed in _GetUnpatchedOrderfileFilename().
[ "Process", "the", "phased", "orderfiles", "produced", "by", "system", "health", "benchmarks", ".", "The", "offsets", "will", "be", "placed", "in", "_GetUnpatchedOrderfileFilename", "()", "." ]
def _ProcessPhasedOrderfile(self, files): self._step_recorder.BeginStep('Process Phased Orderfile') profiles = process_profiles.ProfileManager(files) processor = process_profiles.SymbolOffsetProcessor( self._compiler.lib_chrome_so) ordered_symbols = cluster.ClusterOffsets(profiles, processor, ...
[ "def", "_ProcessPhasedOrderfile", "(", "self", ",", "files", ")", ":", "self", ".", "_step_recorder", ".", "BeginStep", "(", "'Process Phased Orderfile'", ")", "profiles", "=", "process_profiles", ".", "ProfileManager", "(", "files", ")", "processor", "=", "proces...
Process the phased orderfiles produced by system health benchmarks.
[ "Process", "the", "phased", "orderfiles", "produced", "by", "system", "health", "benchmarks", "." ]
[ "\"\"\"Process the phased orderfiles produced by system health benchmarks.\n\n The offsets will be placed in _GetUnpatchedOrderfileFilename().\n\n Args:\n file: Profile files pulled locally.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "files", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "files", "type": null, "docstring": null, "docstring_tokens": ...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_PatchOrderfile
null
def _PatchOrderfile(self): """Patches the orderfile using clean version of libchrome.so.""" self._step_recorder.BeginStep('Patch Orderfile') patch_orderfile.GeneratePatchedOrderfile( self._GetUnpatchedOrderfileFilename(), self._compiler.lib_chrome_so, self._GetPathToOrderfile(), self._order_...
Patches the orderfile using clean version of libchrome.so.
Patches the orderfile using clean version of libchrome.so.
[ "Patches", "the", "orderfile", "using", "clean", "version", "of", "libchrome", ".", "so", "." ]
def _PatchOrderfile(self): self._step_recorder.BeginStep('Patch Orderfile') patch_orderfile.GeneratePatchedOrderfile( self._GetUnpatchedOrderfileFilename(), self._compiler.lib_chrome_so, self._GetPathToOrderfile(), self._order_outlined_functions)
[ "def", "_PatchOrderfile", "(", "self", ")", ":", "self", ".", "_step_recorder", ".", "BeginStep", "(", "'Patch Orderfile'", ")", "patch_orderfile", ".", "GeneratePatchedOrderfile", "(", "self", ".", "_GetUnpatchedOrderfileFilename", "(", ")", ",", "self", ".", "_c...
Patches the orderfile using clean version of libchrome.so.
[ "Patches", "the", "orderfile", "using", "clean", "version", "of", "libchrome", ".", "so", "." ]
[ "\"\"\"Patches the orderfile using clean version of libchrome.so.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_SaveFileLocally
null
def _SaveFileLocally(self, file_name, file_sha1): """Saves the file to a temporary location and prints the sha1sum.""" if not os.path.exists(self._DIRECTORY_FOR_DEBUG_FILES): os.makedirs(self._DIRECTORY_FOR_DEBUG_FILES) shutil.copy(file_name, self._DIRECTORY_FOR_DEBUG_FILES) print('File: %s, saved...
Saves the file to a temporary location and prints the sha1sum.
Saves the file to a temporary location and prints the sha1sum.
[ "Saves", "the", "file", "to", "a", "temporary", "location", "and", "prints", "the", "sha1sum", "." ]
def _SaveFileLocally(self, file_name, file_sha1): if not os.path.exists(self._DIRECTORY_FOR_DEBUG_FILES): os.makedirs(self._DIRECTORY_FOR_DEBUG_FILES) shutil.copy(file_name, self._DIRECTORY_FOR_DEBUG_FILES) print('File: %s, saved in: %s, sha1sum: %s' % (file_name, self._DIRECTORY_FOR_DEBUG_F...
[ "def", "_SaveFileLocally", "(", "self", ",", "file_name", ",", "file_sha1", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "_DIRECTORY_FOR_DEBUG_FILES", ")", ":", "os", ".", "makedirs", "(", "self", ".", "_DIRECTORY_FOR_DEBUG_FILE...
Saves the file to a temporary location and prints the sha1sum.
[ "Saves", "the", "file", "to", "a", "temporary", "location", "and", "prints", "the", "sha1sum", "." ]
[ "\"\"\"Saves the file to a temporary location and prints the sha1sum.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "file_name", "type": null }, { "param": "file_sha1", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "file_name", "type": null, "docstring": null, "docstring_token...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_SaveForDebugging
null
def _SaveForDebugging(self, filename): """Uploads the file to cloud storage or saves to a temporary location.""" file_sha1 = _GenerateHash(filename) if not self._options.buildbot: self._SaveFileLocally(filename, file_sha1) else: print('Uploading file for debugging: ' + filename) self._...
Uploads the file to cloud storage or saves to a temporary location.
Uploads the file to cloud storage or saves to a temporary location.
[ "Uploads", "the", "file", "to", "cloud", "storage", "or", "saves", "to", "a", "temporary", "location", "." ]
def _SaveForDebugging(self, filename): file_sha1 = _GenerateHash(filename) if not self._options.buildbot: self._SaveFileLocally(filename, file_sha1) else: print('Uploading file for debugging: ' + filename) self._orderfile_updater.UploadToCloudStorage( filename, use_debug_location...
[ "def", "_SaveForDebugging", "(", "self", ",", "filename", ")", ":", "file_sha1", "=", "_GenerateHash", "(", "filename", ")", "if", "not", "self", ".", "_options", ".", "buildbot", ":", "self", ".", "_SaveFileLocally", "(", "filename", ",", "file_sha1", ")", ...
Uploads the file to cloud storage or saves to a temporary location.
[ "Uploads", "the", "file", "to", "cloud", "storage", "or", "saves", "to", "a", "temporary", "location", "." ]
[ "\"\"\"Uploads the file to cloud storage or saves to a temporary location.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "filename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filename", "type": null, "docstring": null, "docstring_tokens...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_SaveForDebuggingWithOverwrite
null
def _SaveForDebuggingWithOverwrite(self, file_name): """Uploads and overwrites the file in cloud storage or copies locally. Should be used for large binaries like lib_chrome_so. Args: file_name: (str) File to upload. """ file_sha1 = _GenerateHash(file_name) if not self._options.buildbot:...
Uploads and overwrites the file in cloud storage or copies locally. Should be used for large binaries like lib_chrome_so. Args: file_name: (str) File to upload.
Uploads and overwrites the file in cloud storage or copies locally. Should be used for large binaries like lib_chrome_so.
[ "Uploads", "and", "overwrites", "the", "file", "in", "cloud", "storage", "or", "copies", "locally", ".", "Should", "be", "used", "for", "large", "binaries", "like", "lib_chrome_so", "." ]
def _SaveForDebuggingWithOverwrite(self, file_name): file_sha1 = _GenerateHash(file_name) if not self._options.buildbot: self._SaveFileLocally(file_name, file_sha1) else: print('Uploading file for debugging: %s, sha1sum: %s' % (file_name, ...
[ "def", "_SaveForDebuggingWithOverwrite", "(", "self", ",", "file_name", ")", ":", "file_sha1", "=", "_GenerateHash", "(", "file_name", ")", "if", "not", "self", ".", "_options", ".", "buildbot", ":", "self", ".", "_SaveFileLocally", "(", "file_name", ",", "fil...
Uploads and overwrites the file in cloud storage or copies locally.
[ "Uploads", "and", "overwrites", "the", "file", "in", "cloud", "storage", "or", "copies", "locally", "." ]
[ "\"\"\"Uploads and overwrites the file in cloud storage or copies locally.\n\n Should be used for large binaries like lib_chrome_so.\n\n Args:\n file_name: (str) File to upload.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "file_name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "file_name", "type": null, "docstring": "(str) File to upload.", ...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_MaybeArchiveOrderfile
null
def _MaybeArchiveOrderfile(self, filename): """In buildbot configuration, uploads the generated orderfile to Google Cloud Storage. Args: filename: (str) Orderfile to upload. """ # First compute hashes so that we can download them later if we need to. self._step_recorder.BeginStep('Compute...
In buildbot configuration, uploads the generated orderfile to Google Cloud Storage. Args: filename: (str) Orderfile to upload.
In buildbot configuration, uploads the generated orderfile to Google Cloud Storage.
[ "In", "buildbot", "configuration", "uploads", "the", "generated", "orderfile", "to", "Google", "Cloud", "Storage", "." ]
def _MaybeArchiveOrderfile(self, filename): self._step_recorder.BeginStep('Compute hash for ' + filename) self._RecordHash(filename) if self._options.buildbot: self._step_recorder.BeginStep('Archive ' + filename) self._orderfile_updater.UploadToCloudStorage( filename, use_debug_locatio...
[ "def", "_MaybeArchiveOrderfile", "(", "self", ",", "filename", ")", ":", "self", ".", "_step_recorder", ".", "BeginStep", "(", "'Compute hash for '", "+", "filename", ")", "self", ".", "_RecordHash", "(", "filename", ")", "if", "self", ".", "_options", ".", ...
In buildbot configuration, uploads the generated orderfile to Google Cloud Storage.
[ "In", "buildbot", "configuration", "uploads", "the", "generated", "orderfile", "to", "Google", "Cloud", "Storage", "." ]
[ "\"\"\"In buildbot configuration, uploads the generated orderfile to\n Google Cloud Storage.\n\n Args:\n filename: (str) Orderfile to upload.\n \"\"\"", "# First compute hashes so that we can download them later if we need to." ]
[ { "param": "self", "type": null }, { "param": "filename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filename", "type": null, "docstring": "(str) Orderfile to upload.",...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_NativeCodeMemoryBenchmark
<not_specific>
def _NativeCodeMemoryBenchmark(self, apk): """Runs system_health.memory_mobile to assess native code memory footprint. Args: apk: (str) Path to the apk. Returns: results: ([int]) Values of native code memory footprint in bytes from the benchmark results. """ self...
Runs system_health.memory_mobile to assess native code memory footprint. Args: apk: (str) Path to the apk. Returns: results: ([int]) Values of native code memory footprint in bytes from the benchmark results.
Runs system_health.memory_mobile to assess native code memory footprint.
[ "Runs", "system_health", ".", "memory_mobile", "to", "assess", "native", "code", "memory", "footprint", "." ]
def _NativeCodeMemoryBenchmark(self, apk): self._step_recorder.BeginStep("Running orderfile.memory_mobile") try: out_dir = tempfile.mkdtemp() self._profiler._RunCommand(['tools/perf/run_benchmark', '--device={}'.format( self._pr...
[ "def", "_NativeCodeMemoryBenchmark", "(", "self", ",", "apk", ")", ":", "self", ".", "_step_recorder", ".", "BeginStep", "(", "\"Running orderfile.memory_mobile\"", ")", "try", ":", "out_dir", "=", "tempfile", ".", "mkdtemp", "(", ")", "self", ".", "_profiler", ...
Runs system_health.memory_mobile to assess native code memory footprint.
[ "Runs", "system_health", ".", "memory_mobile", "to", "assess", "native", "code", "memory", "footprint", "." ]
[ "\"\"\"Runs system_health.memory_mobile to assess native code memory footprint.\n\n Args:\n apk: (str) Path to the apk.\n\n Returns:\n results: ([int]) Values of native code memory footprint in bytes from the\n benchmark results.\n \"\"\"", "# Note: NativeCodeResidentMemor...
[ { "param": "self", "type": null }, { "param": "apk", "type": null } ]
{ "returns": [ { "docstring": "([int]) Values of native code memory footprint in bytes from the\nbenchmark results.", "docstring_tokens": [ "(", "[", "int", "]", ")", "Values", "of", "native", "code", "memory", "fo...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_PerformanceBenchmark
<not_specific>
def _PerformanceBenchmark(self, apk): """Runs Speedometer2.0 to assess performance. Args: apk: (str) Path to the apk. Returns: results: ([float]) Speedometer2.0 results samples in milliseconds. """ self._step_recorder.BeginStep("Running Speedometer2.0.") try: out_dir = tempfi...
Runs Speedometer2.0 to assess performance. Args: apk: (str) Path to the apk. Returns: results: ([float]) Speedometer2.0 results samples in milliseconds.
Runs Speedometer2.0 to assess performance.
[ "Runs", "Speedometer2", ".", "0", "to", "assess", "performance", "." ]
def _PerformanceBenchmark(self, apk): self._step_recorder.BeginStep("Running Speedometer2.0.") try: out_dir = tempfile.mkdtemp() self._profiler._RunCommand(['tools/perf/run_benchmark', '--device={}'.format( self._profiler._devic...
[ "def", "_PerformanceBenchmark", "(", "self", ",", "apk", ")", ":", "self", ".", "_step_recorder", ".", "BeginStep", "(", "\"Running Speedometer2.0.\"", ")", "try", ":", "out_dir", "=", "tempfile", ".", "mkdtemp", "(", ")", "self", ".", "_profiler", ".", "_Ru...
Runs Speedometer2.0 to assess performance.
[ "Runs", "Speedometer2", ".", "0", "to", "assess", "performance", "." ]
[ "\"\"\"Runs Speedometer2.0 to assess performance.\n\n Args:\n apk: (str) Path to the apk.\n\n Returns:\n results: ([float]) Speedometer2.0 results samples in milliseconds.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "apk", "type": null } ]
{ "returns": [ { "docstring": "([float]) Speedometer2.0 results samples in milliseconds.", "docstring_tokens": [ "(", "[", "float", "]", ")", "Speedometer2", ".", "0", "results", "samples", "in", "milliseco...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
RunBenchmark
<not_specific>
def RunBenchmark(self, out_directory, no_orderfile=False): """Builds chrome apk and runs performance and memory benchmarks. Builds a non-instrumented version of chrome. Installs chrome apk on the device. Runs Speedometer2.0 benchmark to assess performance. Runs system_health.memory_mobile to evalua...
Builds chrome apk and runs performance and memory benchmarks. Builds a non-instrumented version of chrome. Installs chrome apk on the device. Runs Speedometer2.0 benchmark to assess performance. Runs system_health.memory_mobile to evaluate memory footprint. Args: out_directory: (str) Path to...
Builds chrome apk and runs performance and memory benchmarks. Builds a non-instrumented version of chrome. Installs chrome apk on the device. Runs Speedometer2.0 benchmark to assess performance.
[ "Builds", "chrome", "apk", "and", "runs", "performance", "and", "memory", "benchmarks", ".", "Builds", "a", "non", "-", "instrumented", "version", "of", "chrome", ".", "Installs", "chrome", "apk", "on", "the", "device", ".", "Runs", "Speedometer2", ".", "0",...
def RunBenchmark(self, out_directory, no_orderfile=False): benchmark_results = {} try: _UnstashOutputDirectory(out_directory) self._compiler = ClankCompiler(out_directory, self._step_recorder, self._options.arch, self._options.use_goma, ...
[ "def", "RunBenchmark", "(", "self", ",", "out_directory", ",", "no_orderfile", "=", "False", ")", ":", "benchmark_results", "=", "{", "}", "try", ":", "_UnstashOutputDirectory", "(", "out_directory", ")", "self", ".", "_compiler", "=", "ClankCompiler", "(", "o...
Builds chrome apk and runs performance and memory benchmarks.
[ "Builds", "chrome", "apk", "and", "runs", "performance", "and", "memory", "benchmarks", "." ]
[ "\"\"\"Builds chrome apk and runs performance and memory benchmarks.\n\n Builds a non-instrumented version of chrome.\n Installs chrome apk on the device.\n Runs Speedometer2.0 benchmark to assess performance.\n Runs system_health.memory_mobile to evaluate memory footprint.\n\n Args:\n out_direc...
[ { "param": "self", "type": null }, { "param": "out_directory", "type": null }, { "param": "no_orderfile", "type": null } ]
{ "returns": [ { "docstring": "(dict) Results extracted from benchmarks.", "docstring_tokens": [ "(", "dict", ")", "Results", "extracted", "from", "benchmarks", "." ], "type": "benchmark_results" } ], "raises": [], "...
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Generate
<not_specific>
def Generate(self): """Generates and maybe upload an order.""" assert (bool(self._options.profile) ^ bool(self._options.manual_symbol_offsets)) if self._options.system_health_orderfile and not self._options.profile: raise AssertionError('--system_health_orderfile must be not be used ' ...
Generates and maybe upload an order.
Generates and maybe upload an order.
[ "Generates", "and", "maybe", "upload", "an", "order", "." ]
def Generate(self): assert (bool(self._options.profile) ^ bool(self._options.manual_symbol_offsets)) if self._options.system_health_orderfile and not self._options.profile: raise AssertionError('--system_health_orderfile must be not be used ' 'with --skip-profile') ...
[ "def", "Generate", "(", "self", ")", ":", "assert", "(", "bool", "(", "self", ".", "_options", ".", "profile", ")", "^", "bool", "(", "self", ".", "_options", ".", "manual_symbol_offsets", ")", ")", "if", "self", ".", "_options", ".", "system_health_orde...
Generates and maybe upload an order.
[ "Generates", "and", "maybe", "upload", "an", "order", "." ]
[ "\"\"\"Generates and maybe upload an order.\"\"\"", "# If there are pregenerated profiles, the instrumented build should", "# not be changed to avoid invalidating the pregenerated profile", "# offsets.", "# Either None or empty is a problem.", "# Because identical code folding is a bit different with and ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CommitStashedOrderfileHashes
<not_specific>
def CommitStashedOrderfileHashes(self): """Commit any orderfile hash files in the current checkout. Only possible if running on the buildbot. Returns: true on success. """ if not self._options.buildbot: logging.error('Trying to commit when not running on the buildbot') return False ...
Commit any orderfile hash files in the current checkout. Only possible if running on the buildbot. Returns: true on success.
Commit any orderfile hash files in the current checkout. Only possible if running on the buildbot. true on success.
[ "Commit", "any", "orderfile", "hash", "files", "in", "the", "current", "checkout", ".", "Only", "possible", "if", "running", "on", "the", "buildbot", ".", "true", "on", "success", "." ]
def CommitStashedOrderfileHashes(self): if not self._options.buildbot: logging.error('Trying to commit when not running on the buildbot') return False self._orderfile_updater._CommitStashedFiles([ filename + '.sha1' for filename in (self._GetUnpatchedOrderfileFilename(), ...
[ "def", "CommitStashedOrderfileHashes", "(", "self", ")", ":", "if", "not", "self", ".", "_options", ".", "buildbot", ":", "logging", ".", "error", "(", "'Trying to commit when not running on the buildbot'", ")", "return", "False", "self", ".", "_orderfile_updater", ...
Commit any orderfile hash files in the current checkout.
[ "Commit", "any", "orderfile", "hash", "files", "in", "the", "current", "checkout", "." ]
[ "\"\"\"Commit any orderfile hash files in the current checkout.\n\n Only possible if running on the buildbot.\n\n Returns: true on success.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f03621e72cc5bea50efd074eb04fc585b78e430c
sunlongbo/chromium
tools/cygprofile/orderfile_generator_backend.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CreateArgumentParser
<not_specific>
def CreateArgumentParser(): """Creates and returns the argument parser.""" parser = argparse.ArgumentParser() parser.add_argument('--no-benchmark', action='store_false', dest='benchmark', default=True, help='Disables running benchmarks.') parser.add_argument( '--buildbot', action='st...
Creates and returns the argument parser.
Creates and returns the argument parser.
[ "Creates", "and", "returns", "the", "argument", "parser", "." ]
def CreateArgumentParser(): parser = argparse.ArgumentParser() parser.add_argument('--no-benchmark', action='store_false', dest='benchmark', default=True, help='Disables running benchmarks.') parser.add_argument( '--buildbot', action='store_true', help='If true, the script expect...
[ "def", "CreateArgumentParser", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "'--no-benchmark'", ",", "action", "=", "'store_false'", ",", "dest", "=", "'benchmark'", ",", "default", "=", "True",...
Creates and returns the argument parser.
[ "Creates", "and", "returns", "the", "argument", "parser", "." ]
[ "\"\"\"Creates and returns the argument parser.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
4c094d9285b628b6b5044c45f4cef3c6c4eb7772
sunlongbo/chromium
chrome/test/chromedriver/cpp_source.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
WriteSource
<not_specific>
def WriteSource(base_name, dir_from_src, output_dir, global_string_map): """Writes C++ header/cc source files for the given map of string variables. Args: base_name: The basename of the file, without the extension. dir_from_src: Path from src to the direc...
Writes C++ header/cc source files for the given map of string variables. Args: base_name: The basename of the file, without the extension. dir_from_src: Path from src to the directory that will contain the file, using forward slashes. output_dir: Directory to output the sources to. ...
Writes C++ header/cc source files for the given map of string variables.
[ "Writes", "C", "++", "header", "/", "cc", "source", "files", "for", "the", "given", "map", "of", "string", "variables", "." ]
def WriteSource(base_name, dir_from_src, output_dir, global_string_map): copyright_header_template = ( '// Copyright 2018 The Chromium Authors. All rights reserved.\n' '// Use of this source code is governed by a BSD-style license ' 'that can be\n' ...
[ "def", "WriteSource", "(", "base_name", ",", "dir_from_src", ",", "output_dir", ",", "global_string_map", ")", ":", "copyright_header_template", "=", "(", "'// Copyright 2018 The Chromium Authors. All rights reserved.\\n'", "'// Use of this source code is governed by a BSD-style lice...
Writes C++ header/cc source files for the given map of string variables.
[ "Writes", "C", "++", "header", "/", "cc", "source", "files", "for", "the", "given", "map", "of", "string", "variables", "." ]
[ "\"\"\"Writes C++ header/cc source files for the given map of string variables.\n\n Args:\n base_name: The basename of the file, without the extension.\n dir_from_src: Path from src to the directory that will contain the file,\n using forward slashes.\n output_dir: Directory to output the s...
[ { "param": "base_name", "type": null }, { "param": "dir_from_src", "type": null }, { "param": "output_dir", "type": null }, { "param": "global_string_map", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "base_name", "type": null, "docstring": "The basename of the file, without the extension.", "docstring_tokens": [ "The", "basename", "of", "the", "file", "without", "the",...
67cf3ecca59278bdd9289966559ec48099e90b62
sunlongbo/chromium
ash/app_list/PRESUBMIT.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CheckChangeLintsClean
<not_specific>
def CheckChangeLintsClean(input_api, output_api): """Makes sure that the code is cpplint clean.""" files_to_skip = input_api.DEFAULT_FILES_TO_SKIP sources = lambda x: input_api.FilterSourceFile( x, files_to_check=INCLUDE_CPP_FILES_ONLY, files_to_skip=files_to_skip) return input_api.canned_checks.CheckChange...
Makes sure that the code is cpplint clean.
Makes sure that the code is cpplint clean.
[ "Makes", "sure", "that", "the", "code", "is", "cpplint", "clean", "." ]
def CheckChangeLintsClean(input_api, output_api): files_to_skip = input_api.DEFAULT_FILES_TO_SKIP sources = lambda x: input_api.FilterSourceFile( x, files_to_check=INCLUDE_CPP_FILES_ONLY, files_to_skip=files_to_skip) return input_api.canned_checks.CheckChangeLintsClean( input_api, output_api, sources, l...
[ "def", "CheckChangeLintsClean", "(", "input_api", ",", "output_api", ")", ":", "files_to_skip", "=", "input_api", ".", "DEFAULT_FILES_TO_SKIP", "sources", "=", "lambda", "x", ":", "input_api", ".", "FilterSourceFile", "(", "x", ",", "files_to_check", "=", "INCLUDE...
Makes sure that the code is cpplint clean.
[ "Makes", "sure", "that", "the", "code", "is", "cpplint", "clean", "." ]
[ "\"\"\"Makes sure that the code is cpplint clean.\"\"\"" ]
[ { "param": "input_api", "type": null }, { "param": "output_api", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_api", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "output_api", "type": null, "docstring": null, "docstring...
eecc81c932f51cc073d26f135c7b53bb8d8ddbc2
sunlongbo/chromium
third_party/blink/renderer/build/scripts/make_policy_helper.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
to_devtools_enum_format
<not_specific>
def to_devtools_enum_format(permissions_policy_name): """ Convert '-' separated permissions_policy_name to cammel case devtool enum name """ return ''.join([ name.capitalize() for name in permissions_policy_name.split('-') ])
Convert '-' separated permissions_policy_name to cammel case devtool enum name
Convert '-' separated permissions_policy_name to cammel case devtool enum name
[ "Convert", "'", "-", "'", "separated", "permissions_policy_name", "to", "cammel", "case", "devtool", "enum", "name" ]
def to_devtools_enum_format(permissions_policy_name): return ''.join([ name.capitalize() for name in permissions_policy_name.split('-') ])
[ "def", "to_devtools_enum_format", "(", "permissions_policy_name", ")", ":", "return", "''", ".", "join", "(", "[", "name", ".", "capitalize", "(", ")", "for", "name", "in", "permissions_policy_name", ".", "split", "(", "'-'", ")", "]", ")" ]
Convert '-' separated permissions_policy_name to cammel case devtool enum name
[ "Convert", "'", "-", "'", "separated", "permissions_policy_name", "to", "cammel", "case", "devtool", "enum", "name" ]
[ "\"\"\" Convert '-' separated permissions_policy_name to cammel case devtool enum name \"\"\"" ]
[ { "param": "permissions_policy_name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "permissions_policy_name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b0f3ad58e839464665d9f860ee4cb9a06acde646
sunlongbo/chromium
testing/variations/PRESUBMIT.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
PrettyPrint
<not_specific>
def PrettyPrint(contents): """Pretty prints a fieldtrial configuration. Args: contents: File contents as a string. Returns: Pretty printed file contents. """ # We have a preferred ordering of the fields (e.g. platforms on top). This # code loads everything into OrderedDicts and then tells json to...
Pretty prints a fieldtrial configuration. Args: contents: File contents as a string. Returns: Pretty printed file contents.
Pretty prints a fieldtrial configuration.
[ "Pretty", "prints", "a", "fieldtrial", "configuration", "." ]
def PrettyPrint(contents): The ordering is as follows: { 'StudyName Alphabetical': [ { 'platforms': [sorted platforms] 'groups': [ { name: ... forcing_flag: "forcing flag string" ...
[ "def", "PrettyPrint", "(", "contents", ")", ":", "config", "=", "json", ".", "loads", "(", "contents", ")", "ordered_config", "=", "OrderedDict", "(", ")", "for", "key", "in", "sorted", "(", "config", ".", "keys", "(", ")", ")", ":", "study", "=", "c...
Pretty prints a fieldtrial configuration.
[ "Pretty", "prints", "a", "fieldtrial", "configuration", "." ]
[ "\"\"\"Pretty prints a fieldtrial configuration.\n\n Args:\n contents: File contents as a string.\n\n Returns:\n Pretty printed file contents.\n \"\"\"", "# We have a preferred ordering of the fields (e.g. platforms on top). This", "# code loads everything into OrderedDicts and then tells json to dump ...
[ { "param": "contents", "type": null } ]
{ "returns": [ { "docstring": "Pretty printed file contents.", "docstring_tokens": [ "Pretty", "printed", "file", "contents", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "contents", "type": null, ...
b0f3ad58e839464665d9f860ee4cb9a06acde646
sunlongbo/chromium
testing/variations/PRESUBMIT.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ValidateData
<not_specific>
def ValidateData(input_api, json_data, file_path, message_type): """Validates the format of a fieldtrial configuration. Args: input_api: An instance passed to presubmit scripts telling info about the changes. json_data: Parsed JSON object representing the fieldtrial config. file_path: String repr...
Validates the format of a fieldtrial configuration. Args: input_api: An instance passed to presubmit scripts telling info about the changes. json_data: Parsed JSON object representing the fieldtrial config. file_path: String representing the path to the JSON file. message_type: Type of message ...
Validates the format of a fieldtrial configuration.
[ "Validates", "the", "format", "of", "a", "fieldtrial", "configuration", "." ]
def ValidateData(input_api, json_data, file_path, message_type): def _CreateMessage(message_format, *args): return _CreateMalformedConfigMessage(message_type, file_path, message_format, *args) if not _IsFieldTrialSizeBelowLimitOnWindows(input_api, file_path): return ...
[ "def", "ValidateData", "(", "input_api", ",", "json_data", ",", "file_path", ",", "message_type", ")", ":", "def", "_CreateMessage", "(", "message_format", ",", "*", "args", ")", ":", "return", "_CreateMalformedConfigMessage", "(", "message_type", ",", "file_path"...
Validates the format of a fieldtrial configuration.
[ "Validates", "the", "format", "of", "a", "fieldtrial", "configuration", "." ]
[ "\"\"\"Validates the format of a fieldtrial configuration.\n\n Args:\n input_api: An instance passed to presubmit scripts telling info about the\n changes.\n json_data: Parsed JSON object representing the fieldtrial config.\n file_path: String representing the path to the JSON file.\n message_type...
[ { "param": "input_api", "type": null }, { "param": "json_data", "type": null }, { "param": "file_path", "type": null }, { "param": "message_type", "type": null } ]
{ "returns": [ { "docstring": "A list of |message_type| messages. In the case of all tests passing with no\nwarnings/errors, this will return [].", "docstring_tokens": [ "A", "list", "of", "|message_type|", "messages", ".", "In", "the", ...
b0f3ad58e839464665d9f860ee4cb9a06acde646
sunlongbo/chromium
testing/variations/PRESUBMIT.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_ValidateEntry
<not_specific>
def _ValidateEntry(study, experiment_configs, create_message_fn): """Validates one entry of the field trial configuration.""" if not isinstance(study, str): return create_message_fn('Expecting keys to be string, got %s', type(study)) if not isinstance(experiment_configs, list): return create_message_fn('E...
Validates one entry of the field trial configuration.
Validates one entry of the field trial configuration.
[ "Validates", "one", "entry", "of", "the", "field", "trial", "configuration", "." ]
def _ValidateEntry(study, experiment_configs, create_message_fn): if not isinstance(study, str): return create_message_fn('Expecting keys to be string, got %s', type(study)) if not isinstance(experiment_configs, list): return create_message_fn('Expecting list for study %s', study) def _CreateStudyMessage(...
[ "def", "_ValidateEntry", "(", "study", ",", "experiment_configs", ",", "create_message_fn", ")", ":", "if", "not", "isinstance", "(", "study", ",", "str", ")", ":", "return", "create_message_fn", "(", "'Expecting keys to be string, got %s'", ",", "type", "(", "stu...
Validates one entry of the field trial configuration.
[ "Validates", "one", "entry", "of", "the", "field", "trial", "configuration", "." ]
[ "\"\"\"Validates one entry of the field trial configuration.\"\"\"", "# Add context to other messages." ]
[ { "param": "study", "type": null }, { "param": "experiment_configs", "type": null }, { "param": "create_message_fn", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "study", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "experiment_configs", "type": null, "docstring": null, "docst...
b0f3ad58e839464665d9f860ee4cb9a06acde646
sunlongbo/chromium
testing/variations/PRESUBMIT.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_ValidateExperimentConfig
<not_specific>
def _ValidateExperimentConfig(experiment_config, create_message_fn): """Validates one config in a configuration entry.""" if not isinstance(experiment_config, dict): return create_message_fn('Expecting dict for experiment config') if not 'experiments' in experiment_config: return create_message_fn('Missin...
Validates one config in a configuration entry.
Validates one config in a configuration entry.
[ "Validates", "one", "config", "in", "a", "configuration", "entry", "." ]
def _ValidateExperimentConfig(experiment_config, create_message_fn): if not isinstance(experiment_config, dict): return create_message_fn('Expecting dict for experiment config') if not 'experiments' in experiment_config: return create_message_fn('Missing valid experiments for experiment config') if not is...
[ "def", "_ValidateExperimentConfig", "(", "experiment_config", ",", "create_message_fn", ")", ":", "if", "not", "isinstance", "(", "experiment_config", ",", "dict", ")", ":", "return", "create_message_fn", "(", "'Expecting dict for experiment config'", ")", "if", "not", ...
Validates one config in a configuration entry.
[ "Validates", "one", "config", "in", "a", "configuration", "entry", "." ]
[ "\"\"\"Validates one config in a configuration entry.\"\"\"" ]
[ { "param": "experiment_config", "type": null }, { "param": "create_message_fn", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "experiment_config", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "create_message_fn", "type": null, "docstring": null, ...
b0f3ad58e839464665d9f860ee4cb9a06acde646
sunlongbo/chromium
testing/variations/PRESUBMIT.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_ValidateExperimentGroup
<not_specific>
def _ValidateExperimentGroup(experiment_group, create_message_fn): """Validates one group of one config in a configuration entry.""" name = experiment_group.get('name', '') if not name or not isinstance(name, str): return create_message_fn('Missing valid name for experiment') # Add context to other message...
Validates one group of one config in a configuration entry.
Validates one group of one config in a configuration entry.
[ "Validates", "one", "group", "of", "one", "config", "in", "a", "configuration", "entry", "." ]
def _ValidateExperimentGroup(experiment_group, create_message_fn): name = experiment_group.get('name', '') if not name or not isinstance(name, str): return create_message_fn('Missing valid name for experiment') def _CreateGroupMessage(message_format, *args): suffix = ' in Group[%s]' % name return crea...
[ "def", "_ValidateExperimentGroup", "(", "experiment_group", ",", "create_message_fn", ")", ":", "name", "=", "experiment_group", ".", "get", "(", "'name'", ",", "''", ")", "if", "not", "name", "or", "not", "isinstance", "(", "name", ",", "str", ")", ":", "...
Validates one group of one config in a configuration entry.
[ "Validates", "one", "group", "of", "one", "config", "in", "a", "configuration", "entry", "." ]
[ "\"\"\"Validates one group of one config in a configuration entry.\"\"\"", "# Add context to other messages." ]
[ { "param": "experiment_group", "type": null }, { "param": "create_message_fn", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "experiment_group", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "create_message_fn", "type": null, "docstring": null, ...
b0f3ad58e839464665d9f860ee4cb9a06acde646
sunlongbo/chromium
testing/variations/PRESUBMIT.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_CreateMalformedConfigMessage
<not_specific>
def _CreateMalformedConfigMessage(message_type, file_path, message_format, *args): """Returns a list containing one |message_type| with the error message. Args: message_type: Type of message from |output_api| to return in the case of errors/warnings. message_format: ...
Returns a list containing one |message_type| with the error message. Args: message_type: Type of message from |output_api| to return in the case of errors/warnings. message_format: The error message format string. file_path: The path to the config file. *args: The args for message_format. Re...
Returns a list containing one |message_type| with the error message.
[ "Returns", "a", "list", "containing", "one", "|message_type|", "with", "the", "error", "message", "." ]
def _CreateMalformedConfigMessage(message_type, file_path, message_format, *args): error_message_format = 'Malformed config file %s: ' + message_format format_args = (file_path,) + args return [message_type(error_message_format % format_args)]
[ "def", "_CreateMalformedConfigMessage", "(", "message_type", ",", "file_path", ",", "message_format", ",", "*", "args", ")", ":", "error_message_format", "=", "'Malformed config file %s: '", "+", "message_format", "format_args", "=", "(", "file_path", ",", ")", "+", ...
Returns a list containing one |message_type| with the error message.
[ "Returns", "a", "list", "containing", "one", "|message_type|", "with", "the", "error", "message", "." ]
[ "\"\"\"Returns a list containing one |message_type| with the error message.\n\n Args:\n message_type: Type of message from |output_api| to return in the case of\n errors/warnings.\n message_format: The error message format string.\n file_path: The path to the config file.\n *args: The args for mes...
[ { "param": "message_type", "type": null }, { "param": "file_path", "type": null }, { "param": "message_format", "type": null } ]
{ "returns": [ { "docstring": "' prepended to it.", "docstring_tokens": [ "'", "prepended", "to", "it", "." ], "type": "A list containing a message_type with a formatted error message and\n'Malformed config file [file]" } ], "raises": [], "...
b0f3ad58e839464665d9f860ee4cb9a06acde646
sunlongbo/chromium
testing/variations/PRESUBMIT.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CheckPretty
<not_specific>
def CheckPretty(contents, file_path, message_type): """Validates the pretty printing of fieldtrial configuration. Args: contents: File contents as a string. file_path: String representing the path to the JSON file. message_type: Type of message from |output_api| to return in the case of errors/wa...
Validates the pretty printing of fieldtrial configuration. Args: contents: File contents as a string. file_path: String representing the path to the JSON file. message_type: Type of message from |output_api| to return in the case of errors/warnings. Returns: A list of |message_type| messages...
Validates the pretty printing of fieldtrial configuration.
[ "Validates", "the", "pretty", "printing", "of", "fieldtrial", "configuration", "." ]
def CheckPretty(contents, file_path, message_type): pretty = PrettyPrint(contents) if contents != pretty: return [ message_type('Pretty printing error: Run ' 'python3 testing/variations/PRESUBMIT.py %s' % file_path) ] return []
[ "def", "CheckPretty", "(", "contents", ",", "file_path", ",", "message_type", ")", ":", "pretty", "=", "PrettyPrint", "(", "contents", ")", "if", "contents", "!=", "pretty", ":", "return", "[", "message_type", "(", "'Pretty printing error: Run '", "'python3 testin...
Validates the pretty printing of fieldtrial configuration.
[ "Validates", "the", "pretty", "printing", "of", "fieldtrial", "configuration", "." ]
[ "\"\"\"Validates the pretty printing of fieldtrial configuration.\n\n Args:\n contents: File contents as a string.\n file_path: String representing the path to the JSON file.\n message_type: Type of message from |output_api| to return in the case of\n errors/warnings.\n\n Returns:\n A list of |me...
[ { "param": "contents", "type": null }, { "param": "file_path", "type": null }, { "param": "message_type", "type": null } ]
{ "returns": [ { "docstring": "A list of |message_type| messages. In the case of all tests passing with no\nwarnings/errors, this will return [].", "docstring_tokens": [ "A", "list", "of", "|message_type|", "messages", ".", "In", "the", ...
b0f3ad58e839464665d9f860ee4cb9a06acde646
sunlongbo/chromium
testing/variations/PRESUBMIT.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_IsFieldTrialSizeBelowLimitOnWindows
<not_specific>
def _IsFieldTrialSizeBelowLimitOnWindows(input_api, file_path): """Checks whether the fieldtrial parameters exceeded the Windows cmd limit. When launching chrome, the fieldtrial related parameters take more than 30,000 characters. Windows has a limit of 32767 characters on command line and thus it raises param...
Checks whether the fieldtrial parameters exceeded the Windows cmd limit. When launching chrome, the fieldtrial related parameters take more than 30,000 characters. Windows has a limit of 32767 characters on command line and thus it raises parameter error when the parameters are too long. Before we have a valid...
Checks whether the fieldtrial parameters exceeded the Windows cmd limit. When launching chrome, the fieldtrial related parameters take more than 30,000 characters. Windows has a limit of 32767 characters on command line and thus it raises parameter error when the parameters are too long. Before we have a valid fix, we ...
[ "Checks", "whether", "the", "fieldtrial", "parameters", "exceeded", "the", "Windows", "cmd", "limit", ".", "When", "launching", "chrome", "the", "fieldtrial", "related", "parameters", "take", "more", "than", "30", "000", "characters", ".", "Windows", "has", "a",...
def _IsFieldTrialSizeBelowLimitOnWindows(input_api, file_path): sys.path.append(input_api.os_path.join( input_api.PresubmitLocalPath(), '..', '..', 'tools', 'variations')) import fieldtrial_util args = fieldtrial_util.GenerateArgs(file_path, 'windows') total_length = 0 for arg in args: total_length ...
[ "def", "_IsFieldTrialSizeBelowLimitOnWindows", "(", "input_api", ",", "file_path", ")", ":", "sys", ".", "path", ".", "append", "(", "input_api", ".", "os_path", ".", "join", "(", "input_api", ".", "PresubmitLocalPath", "(", ")", ",", "'..'", ",", "'..'", ",...
Checks whether the fieldtrial parameters exceeded the Windows cmd limit.
[ "Checks", "whether", "the", "fieldtrial", "parameters", "exceeded", "the", "Windows", "cmd", "limit", "." ]
[ "\"\"\"Checks whether the fieldtrial parameters exceeded the Windows cmd limit.\n\n When launching chrome, the fieldtrial related parameters take more than\n 30,000 characters. Windows has a limit of 32767 characters on command\n line and thus it raises parameter error when the parameters are too long.\n Before...
[ { "param": "input_api", "type": null }, { "param": "file_path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_api", "type": null, "docstring": "An instance passed to presubmit scripts telling info about the\nchanges.", "docstring_tokens": [ "An", "instance", "passed", "to", "presubmit", ...
ee0bd0c45707bb23967cf8493be0f0b17ef7045f
sunlongbo/chromium
chrome/updater/test/service/win/ui.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
SetForegroundWindow
<not_specific>
def SetForegroundWindow(hwnd): """Brings the given window to foreground. Args: hwnd: Handle of the window to bring to the foreground. """ with _MessageQueueAttacher(): return bool(win32gui.SetForegroundWindow(hwnd))
Brings the given window to foreground. Args: hwnd: Handle of the window to bring to the foreground.
Brings the given window to foreground.
[ "Brings", "the", "given", "window", "to", "foreground", "." ]
def SetForegroundWindow(hwnd): with _MessageQueueAttacher(): return bool(win32gui.SetForegroundWindow(hwnd))
[ "def", "SetForegroundWindow", "(", "hwnd", ")", ":", "with", "_MessageQueueAttacher", "(", ")", ":", "return", "bool", "(", "win32gui", ".", "SetForegroundWindow", "(", "hwnd", ")", ")" ]
Brings the given window to foreground.
[ "Brings", "the", "given", "window", "to", "foreground", "." ]
[ "\"\"\"Brings the given window to foreground.\n\n Args:\n hwnd: Handle of the window to bring to the foreground.\n \"\"\"" ]
[ { "param": "hwnd", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "hwnd", "type": null, "docstring": "Handle of the window to bring to the foreground.", "docstring_tokens": [ "Handle", "of", "the", "window", "to", "bring", "to", ...
ee0bd0c45707bb23967cf8493be0f0b17ef7045f
sunlongbo/chromium
chrome/updater/test/service/win/ui.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
FindWindowsWithText
<not_specific>
def FindWindowsWithText(parent, text_to_search): """Finds windows with given text. Args: parent: Handle to the parent window whose child windows are to be searched. text_to_search: Substring to search within Windows text, case-insensitive. Returns: A list of HWND that match the search condition. "...
Finds windows with given text. Args: parent: Handle to the parent window whose child windows are to be searched. text_to_search: Substring to search within Windows text, case-insensitive. Returns: A list of HWND that match the search condition.
Finds windows with given text.
[ "Finds", "windows", "with", "given", "text", "." ]
def FindWindowsWithText(parent, text_to_search): class WindowFoundHandler(object): def __init__(self, text_to_search): self.result = [] self._text_to_search = text_to_search def Process(self, handle): text = win32gui.GetWindowText(handle).lower() text_to_search = self._text_to_search.l...
[ "def", "FindWindowsWithText", "(", "parent", ",", "text_to_search", ")", ":", "class", "WindowFoundHandler", "(", "object", ")", ":", "\"\"\"Callback class for window enumeration.\"\"\"", "def", "__init__", "(", "self", ",", "text_to_search", ")", ":", "self", ".", ...
Finds windows with given text.
[ "Finds", "windows", "with", "given", "text", "." ]
[ "\"\"\"Finds windows with given text.\n\n Args:\n parent: Handle to the parent window whose child windows are to be searched.\n text_to_search: Substring to search within Windows text, case-insensitive.\n\n Returns:\n A list of HWND that match the search condition.\n \"\"\"", "\"\"\"Callback class for...
[ { "param": "parent", "type": null }, { "param": "text_to_search", "type": null } ]
{ "returns": [ { "docstring": "A list of HWND that match the search condition.", "docstring_tokens": [ "A", "list", "of", "HWND", "that", "match", "the", "search", "condition", "." ], "type": null } ], ...
ee0bd0c45707bb23967cf8493be0f0b17ef7045f
sunlongbo/chromium
chrome/updater/test/service/win/ui.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Process
null
def Process(self, handle): """Callback function when enumerating a window. Args: handle: HWND to the enumerated window. """ text = win32gui.GetWindowText(handle).lower() text_to_search = self._text_to_search.lower() if text_to_search in text: self.result.append(hand...
Callback function when enumerating a window. Args: handle: HWND to the enumerated window.
Callback function when enumerating a window.
[ "Callback", "function", "when", "enumerating", "a", "window", "." ]
def Process(self, handle): text = win32gui.GetWindowText(handle).lower() text_to_search = self._text_to_search.lower() if text_to_search in text: self.result.append(handle)
[ "def", "Process", "(", "self", ",", "handle", ")", ":", "text", "=", "win32gui", ".", "GetWindowText", "(", "handle", ")", ".", "lower", "(", ")", "text_to_search", "=", "self", ".", "_text_to_search", ".", "lower", "(", ")", "if", "text_to_search", "in"...
Callback function when enumerating a window.
[ "Callback", "function", "when", "enumerating", "a", "window", "." ]
[ "\"\"\"Callback function when enumerating a window.\n\n Args:\n handle: HWND to the enumerated window.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "handle", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "handle", "type": null, "docstring": "HWND to the enumerated window....
ee0bd0c45707bb23967cf8493be0f0b17ef7045f
sunlongbo/chromium
chrome/updater/test/service/win/ui.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
FindWindowsWithTitle
<not_specific>
def FindWindowsWithTitle(title_to_search): """Finds windows with given title. Args: title_to_search: Window title substring to search, case-insensitive. Returns: A list of HWND that match the search condition. """ desktop_handle = None return FindWindowsWithText(desktop_handle, title_to_search)
Finds windows with given title. Args: title_to_search: Window title substring to search, case-insensitive. Returns: A list of HWND that match the search condition.
Finds windows with given title.
[ "Finds", "windows", "with", "given", "title", "." ]
def FindWindowsWithTitle(title_to_search): desktop_handle = None return FindWindowsWithText(desktop_handle, title_to_search)
[ "def", "FindWindowsWithTitle", "(", "title_to_search", ")", ":", "desktop_handle", "=", "None", "return", "FindWindowsWithText", "(", "desktop_handle", ",", "title_to_search", ")" ]
Finds windows with given title.
[ "Finds", "windows", "with", "given", "title", "." ]
[ "\"\"\"Finds windows with given title.\n\n Args:\n title_to_search: Window title substring to search, case-insensitive.\n\n Returns:\n A list of HWND that match the search condition.\n \"\"\"" ]
[ { "param": "title_to_search", "type": null } ]
{ "returns": [ { "docstring": "A list of HWND that match the search condition.", "docstring_tokens": [ "A", "list", "of", "HWND", "that", "match", "the", "search", "condition", "." ], "type": null } ], ...
ee0bd0c45707bb23967cf8493be0f0b17ef7045f
sunlongbo/chromium
chrome/updater/test/service/win/ui.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
FindWindow
<not_specific>
def FindWindow(title, class_name, parent=0, child_after=0): """Finds a window of a given title and class. Args: title: Title of the window to search. class_name: Class name of the window to search. parent: Handle to the parent window whose child windows are to be searched. child_after: HWND to a ch...
Finds a window of a given title and class. Args: title: Title of the window to search. class_name: Class name of the window to search. parent: Handle to the parent window whose child windows are to be searched. child_after: HWND to a child window. Search begins with the next child window in the...
Finds a window of a given title and class.
[ "Finds", "a", "window", "of", "a", "given", "title", "and", "class", "." ]
def FindWindow(title, class_name, parent=0, child_after=0): hwnd = 0 try: hwnd = win32gui.FindWindowEx( int(parent), int(child_after), class_name, title) except win32gui.error as err: if err[0] == winrror.ERROR_INVALID_WINDOW_HANDLE: pass elif err[0] != winrror.ERROR_FILE_NOT_FOUND: ...
[ "def", "FindWindow", "(", "title", ",", "class_name", ",", "parent", "=", "0", ",", "child_after", "=", "0", ")", ":", "hwnd", "=", "0", "try", ":", "hwnd", "=", "win32gui", ".", "FindWindowEx", "(", "int", "(", "parent", ")", ",", "int", "(", "chi...
Finds a window of a given title and class.
[ "Finds", "a", "window", "of", "a", "given", "title", "and", "class", "." ]
[ "\"\"\"Finds a window of a given title and class.\n\n Args:\n title: Title of the window to search.\n class_name: Class name of the window to search.\n parent: Handle to the parent window whose child windows are to be searched.\n child_after: HWND to a child window. Search begins with the next child\n ...
[ { "param": "title", "type": null }, { "param": "class_name", "type": null }, { "param": "parent", "type": null }, { "param": "child_after", "type": null } ]
{ "returns": [ { "docstring": "Handle of the found window, or 0 if not found.", "docstring_tokens": [ "Handle", "of", "the", "found", "window", "or", "0", "if", "not", "found", "." ], "type": null }...
ee0bd0c45707bb23967cf8493be0f0b17ef7045f
sunlongbo/chromium
chrome/updater/test/service/win/ui.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
FindWindowWithTitleAndText
<not_specific>
def FindWindowWithTitleAndText(title, text): """Checks if the any window has given title, and child window has the text. Args: title: Expected window title. text: Expected window text substring(in any child window), case-insensitive. Returns: A list how HWND that meets the search condition. """ ...
Checks if the any window has given title, and child window has the text. Args: title: Expected window title. text: Expected window text substring(in any child window), case-insensitive. Returns: A list how HWND that meets the search condition.
Checks if the any window has given title, and child window has the text.
[ "Checks", "if", "the", "any", "window", "has", "given", "title", "and", "child", "window", "has", "the", "text", "." ]
def FindWindowWithTitleAndText(title, text): hwnds_title_matched = FindWindowsWithTitle(title) if not hwnds_title_matched: logging.info('No window has title: [%s].', title) hwnds = [] for hwnd in hwnds_title_matched: if FindWindowsWithText(hwnd, text): hwnds.append(hwnd) return hwnds
[ "def", "FindWindowWithTitleAndText", "(", "title", ",", "text", ")", ":", "hwnds_title_matched", "=", "FindWindowsWithTitle", "(", "title", ")", "if", "not", "hwnds_title_matched", ":", "logging", ".", "info", "(", "'No window has title: [%s].'", ",", "title", ")", ...
Checks if the any window has given title, and child window has the text.
[ "Checks", "if", "the", "any", "window", "has", "given", "title", "and", "child", "window", "has", "the", "text", "." ]
[ "\"\"\"Checks if the any window has given title, and child window has the text.\n\n Args:\n title: Expected window title.\n text: Expected window text substring(in any child window), case-insensitive.\n\n Returns:\n A list how HWND that meets the search condition.\n \"\"\"" ]
[ { "param": "title", "type": null }, { "param": "text", "type": null } ]
{ "returns": [ { "docstring": "A list how HWND that meets the search condition.", "docstring_tokens": [ "A", "list", "how", "HWND", "that", "meets", "the", "search", "condition", "." ], "type": null } ], ...
ee0bd0c45707bb23967cf8493be0f0b17ef7045f
sunlongbo/chromium
chrome/updater/test/service/win/ui.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
WaitForWindow
<not_specific>
def WaitForWindow(title, class_name, timeout=30): """Waits for window with given title and class to appear. Args: title: Windows title to search. class_name: Class name of the window to search. timeout: How long should wait before give up. Returns: A tuple of (HWND, title) of the found window, o...
Waits for window with given title and class to appear. Args: title: Windows title to search. class_name: Class name of the window to search. timeout: How long should wait before give up. Returns: A tuple of (HWND, title) of the found window, or (None, None) otherwise.
Waits for window with given title and class to appear.
[ "Waits", "for", "window", "with", "given", "title", "and", "class", "to", "appear", "." ]
def WaitForWindow(title, class_name, timeout=30): logging.info('ui.WaitForWindow("%s", "%s") for %s seconds', title, class_name, timeout) hwnd = None start = time.perf_counter() stop = start + int(timeout) while time.perf_counter() < stop: hwnd = FindWindow(title, class_name) if hwnd: ...
[ "def", "WaitForWindow", "(", "title", ",", "class_name", ",", "timeout", "=", "30", ")", ":", "logging", ".", "info", "(", "'ui.WaitForWindow(\"%s\", \"%s\") for %s seconds'", ",", "title", ",", "class_name", ",", "timeout", ")", "hwnd", "=", "None", "start", ...
Waits for window with given title and class to appear.
[ "Waits", "for", "window", "with", "given", "title", "and", "class", "to", "appear", "." ]
[ "\"\"\"Waits for window with given title and class to appear.\n\n Args:\n title: Windows title to search.\n class_name: Class name of the window to search.\n timeout: How long should wait before give up.\n\n Returns:\n A tuple of (HWND, title) of the found window, or (None, None) otherwise.\n \"\"\""...
[ { "param": "title", "type": null }, { "param": "class_name", "type": null }, { "param": "timeout", "type": null } ]
{ "returns": [ { "docstring": "A tuple of (HWND, title) of the found window, or (None, None) otherwise.", "docstring_tokens": [ "A", "tuple", "of", "(", "HWND", "title", ")", "of", "the", "found", "window", ...
ee0bd0c45707bb23967cf8493be0f0b17ef7045f
sunlongbo/chromium
chrome/updater/test/service/win/ui.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ClickButton
null
def ClickButton(button_hwnd): """Clicks a button window by sending a BM_CLICK message. Per http://msdn2.microsoft.com/en-us/library/bb775985.aspx "If the button is in a dialog box and the dialog box is not active, the BM_CLICK message might fail. To ensure success in this situation, call the SetActiveWindow ...
Clicks a button window by sending a BM_CLICK message. Per http://msdn2.microsoft.com/en-us/library/bb775985.aspx "If the button is in a dialog box and the dialog box is not active, the BM_CLICK message might fail. To ensure success in this situation, call the SetActiveWindow function to activate the dialog box...
Clicks a button window by sending a BM_CLICK message.
[ "Clicks", "a", "button", "window", "by", "sending", "a", "BM_CLICK", "message", "." ]
def ClickButton(button_hwnd): previous_active_window = win32gui.SetActiveWindow(button_hwnd) win32gui.PostMessage(button_hwnd, win32con.BM_CLICK, 0, 0) if previous_active_window: win32gui.SetActiveWindow(previous_active_window)
[ "def", "ClickButton", "(", "button_hwnd", ")", ":", "previous_active_window", "=", "win32gui", ".", "SetActiveWindow", "(", "button_hwnd", ")", "win32gui", ".", "PostMessage", "(", "button_hwnd", ",", "win32con", ".", "BM_CLICK", ",", "0", ",", "0", ")", "if",...
Clicks a button window by sending a BM_CLICK message.
[ "Clicks", "a", "button", "window", "by", "sending", "a", "BM_CLICK", "message", "." ]
[ "\"\"\"Clicks a button window by sending a BM_CLICK message.\n\n Per http://msdn2.microsoft.com/en-us/library/bb775985.aspx\n \"If the button is in a dialog box and the dialog box is not active, the\n BM_CLICK message might fail. To ensure success in this situation, call\n the SetActiveWindow function to activa...
[ { "param": "button_hwnd", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "button_hwnd", "type": null, "docstring": "HWND to the button to be clicked.", "docstring_tokens": [ "HWND", "to", "the", "button", "to", "be", "clicked", "." ...
ee0bd0c45707bb23967cf8493be0f0b17ef7045f
sunlongbo/chromium
chrome/updater/test/service/win/ui.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ClickChildButtonWithText
<not_specific>
def ClickChildButtonWithText(parent_hwnd, button_text): """Clicks a child button window with given text. Args: parent_hwnd: HWND of the button parent. button_text: Button windows title. Returns: Whether button is clicked. """ button_hwnd = FindWindow(button_text, 'Button', parent_hwnd) if butt...
Clicks a child button window with given text. Args: parent_hwnd: HWND of the button parent. button_text: Button windows title. Returns: Whether button is clicked.
Clicks a child button window with given text.
[ "Clicks", "a", "child", "button", "window", "with", "given", "text", "." ]
def ClickChildButtonWithText(parent_hwnd, button_text): button_hwnd = FindWindow(button_text, 'Button', parent_hwnd) if button_hwnd: logging.debug('Found child button with: %s', button_text) ClickButton(button_hwnd) return True logging.debug('No button with [%s] found.', button_text) return False
[ "def", "ClickChildButtonWithText", "(", "parent_hwnd", ",", "button_text", ")", ":", "button_hwnd", "=", "FindWindow", "(", "button_text", ",", "'Button'", ",", "parent_hwnd", ")", "if", "button_hwnd", ":", "logging", ".", "debug", "(", "'Found child button with: %s...
Clicks a child button window with given text.
[ "Clicks", "a", "child", "button", "window", "with", "given", "text", "." ]
[ "\"\"\"Clicks a child button window with given text.\n\n Args:\n parent_hwnd: HWND of the button parent.\n button_text: Button windows title.\n\n Returns:\n Whether button is clicked.\n \"\"\"" ]
[ { "param": "parent_hwnd", "type": null }, { "param": "button_text", "type": null } ]
{ "returns": [ { "docstring": "Whether button is clicked.", "docstring_tokens": [ "Whether", "button", "is", "clicked", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "parent_hwnd", "type": null, "d...
ee0bd0c45707bb23967cf8493be0f0b17ef7045f
sunlongbo/chromium
chrome/updater/test/service/win/ui.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
SendKeyToWindow
null
def SendKeyToWindow(hwnd, key_to_press): """Sends a key press to the window. This is a blocking call until all keys are pressed. Args: hwnd: handle of the window to press key. key_to_press: Actual key to send to window. eg.'{Enter}'. See `window_shell` documentation for key definitions. """ ...
Sends a key press to the window. This is a blocking call until all keys are pressed. Args: hwnd: handle of the window to press key. key_to_press: Actual key to send to window. eg.'{Enter}'. See `window_shell` documentation for key definitions.
Sends a key press to the window. This is a blocking call until all keys are pressed.
[ "Sends", "a", "key", "press", "to", "the", "window", ".", "This", "is", "a", "blocking", "call", "until", "all", "keys", "are", "pressed", "." ]
def SendKeyToWindow(hwnd, key_to_press): try: window_shell = win32com.client.Dispatch('WScript.Shell') SetForegroundWindow(hwnd) window_shell.AppActivate(str(win32gui.GetForegroundWindow())) window_shell.SendKeys(key_to_press) logging.info('Sent %s to window %x.', key_to_press, hwnd) except pywi...
[ "def", "SendKeyToWindow", "(", "hwnd", ",", "key_to_press", ")", ":", "try", ":", "window_shell", "=", "win32com", ".", "client", ".", "Dispatch", "(", "'WScript.Shell'", ")", "SetForegroundWindow", "(", "hwnd", ")", "window_shell", ".", "AppActivate", "(", "s...
Sends a key press to the window.
[ "Sends", "a", "key", "press", "to", "the", "window", "." ]
[ "\"\"\"Sends a key press to the window.\n\n This is a blocking call until all keys are pressed.\n\n Args:\n hwnd: handle of the window to press key.\n key_to_press: Actual key to send to window. eg.'{Enter}'. See `window_shell`\n documentation for key definitions.\n \"\"\"" ]
[ { "param": "hwnd", "type": null }, { "param": "key_to_press", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "hwnd", "type": null, "docstring": "handle of the window to press key.", "docstring_tokens": [ "handle", "of", "the", "window", "to", "press", "key", "." ],...
b4e49b985ef3ecabf95deb90f29f55efa7ca589a
sunlongbo/chromium
testing/merge_scripts/standard_isolated_script_merge.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
StandardIsolatedScriptMerge
<not_specific>
def StandardIsolatedScriptMerge(output_json, summary_json, jsons_to_merge): """Merge the contents of one or more results JSONs into a single JSON. Args: output_json: A path to a JSON file to which the merged results should be written. jsons_to_merge: A list of paths to JSON files that should be merge...
Merge the contents of one or more results JSONs into a single JSON. Args: output_json: A path to a JSON file to which the merged results should be written. jsons_to_merge: A list of paths to JSON files that should be merged.
Merge the contents of one or more results JSONs into a single JSON.
[ "Merge", "the", "contents", "of", "one", "or", "more", "results", "JSONs", "into", "a", "single", "JSON", "." ]
def StandardIsolatedScriptMerge(output_json, summary_json, jsons_to_merge): try: with open(summary_json) as f: summary = json.load(f) except (IOError, ValueError): print(( 'summary.json is missing or can not be read', 'Something is seriously wrong with swarming client or the bot.'), ...
[ "def", "StandardIsolatedScriptMerge", "(", "output_json", ",", "summary_json", ",", "jsons_to_merge", ")", ":", "try", ":", "with", "open", "(", "summary_json", ")", "as", "f", ":", "summary", "=", "json", ".", "load", "(", "f", ")", "except", "(", "IOErro...
Merge the contents of one or more results JSONs into a single JSON.
[ "Merge", "the", "contents", "of", "one", "or", "more", "results", "JSONs", "into", "a", "single", "JSON", "." ]
[ "\"\"\"Merge the contents of one or more results JSONs into a single JSON.\n\n Args:\n output_json: A path to a JSON file to which the merged results should be\n written.\n jsons_to_merge: A list of paths to JSON files that should be merged.\n \"\"\"", "# summary.json is produced by swarming client i...
[ { "param": "output_json", "type": null }, { "param": "summary_json", "type": null }, { "param": "jsons_to_merge", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "output_json", "type": null, "docstring": "A path to a JSON file to which the merged results should be\nwritten.", "docstring_tokens": [ "A", "path", "to", "a", "JSON", "file", ...
b4e49b985ef3ecabf95deb90f29f55efa7ca589a
sunlongbo/chromium
testing/merge_scripts/standard_isolated_script_merge.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
find_shard_output_path
<not_specific>
def find_shard_output_path(index, task_id, jsons_to_merge): """Finds the shard matching the index/task-id. Args: index: The index of the shard to load data for, this is for old api. task_id: The directory of the shard to load data for, this is for new api. jsons_to_merge: A container of file paths for ...
Finds the shard matching the index/task-id. Args: index: The index of the shard to load data for, this is for old api. task_id: The directory of the shard to load data for, this is for new api. jsons_to_merge: A container of file paths for shards that emitted output. Returns: * The matching path, ...
Finds the shard matching the index/task-id.
[ "Finds", "the", "shard", "matching", "the", "index", "/", "task", "-", "id", "." ]
def find_shard_output_path(index, task_id, jsons_to_merge): matching_json_files = [ j for j in jsons_to_merge if (os.path.basename(j) == 'output.json' and (os.path.basename(os.path.dirname(j)) == str(index) or os.path.basename(os.path.dirname(j)) == task_id))] if not matching_json_f...
[ "def", "find_shard_output_path", "(", "index", ",", "task_id", ",", "jsons_to_merge", ")", ":", "matching_json_files", "=", "[", "j", "for", "j", "in", "jsons_to_merge", "if", "(", "os", ".", "path", ".", "basename", "(", "j", ")", "==", "'output.json'", "...
Finds the shard matching the index/task-id.
[ "Finds", "the", "shard", "matching", "the", "index", "/", "task", "-", "id", "." ]
[ "\"\"\"Finds the shard matching the index/task-id.\n\n Args:\n index: The index of the shard to load data for, this is for old api.\n task_id: The directory of the shard to load data for, this is for new api.\n jsons_to_merge: A container of file paths for shards that emitted output.\n\n Returns:\n * ...
[ { "param": "index", "type": null }, { "param": "task_id", "type": null }, { "param": "jsons_to_merge", "type": null } ]
{ "returns": [ { "docstring": "The matching path, or None", "docstring_tokens": [ "The", "matching", "path", "or", "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "index", "type": null, "docstring...
dbb32d931b0dd889922f91bb8f1f7dbb0535a2a6
sunlongbo/chromium
chrome/test/mini_installer/quit_chrome.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CloseWindows
<not_specific>
def CloseWindows(process_path): """Closes all windows owned by processes whose exe path is |process_path|. Args: process_path: The path to the executable whose processes will have their windows closed. Returns: A boolean indicating whether the processes successfully terminated ...
Closes all windows owned by processes whose exe path is |process_path|. Args: process_path: The path to the executable whose processes will have their windows closed. Returns: A boolean indicating whether the processes successfully terminated within 25 seconds.
Closes all windows owned by processes whose exe path is |process_path|.
[ "Closes", "all", "windows", "owned", "by", "processes", "whose", "exe", "path", "is", "|process_path|", "." ]
def CloseWindows(process_path): start_time = time.time() while time.time() - start_time < 25: process_ids = chrome_helper.GetProcessIDs(process_path) if not process_ids: return True for hwnd in chrome_helper.GetWindowHandles(process_ids): try: win3...
[ "def", "CloseWindows", "(", "process_path", ")", ":", "start_time", "=", "time", ".", "time", "(", ")", "while", "time", ".", "time", "(", ")", "-", "start_time", "<", "25", ":", "process_ids", "=", "chrome_helper", ".", "GetProcessIDs", "(", "process_path...
Closes all windows owned by processes whose exe path is |process_path|.
[ "Closes", "all", "windows", "owned", "by", "processes", "whose", "exe", "path", "is", "|process_path|", "." ]
[ "\"\"\"Closes all windows owned by processes whose exe path is |process_path|.\n\n Args:\n process_path: The path to the executable whose processes will have their\n windows closed.\n\n Returns:\n A boolean indicating whether the processes successfully terminated\n within 25 se...
[ { "param": "process_path", "type": null } ]
{ "returns": [ { "docstring": "A boolean indicating whether the processes successfully terminated\nwithin 25 seconds.", "docstring_tokens": [ "A", "boolean", "indicating", "whether", "the", "processes", "successfully", "terminated", ...
dbb32d931b0dd889922f91bb8f1f7dbb0535a2a6
sunlongbo/chromium
chrome/test/mini_installer/quit_chrome.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
KillNamedProcess
<not_specific>
def KillNamedProcess(process_path): """ Kills all running exes with the same name as the exe at |process_path|. Args: process_path: The path to an executable. Returns: True if running executables were successfully killed. False otherwise. """ return os.system('taskkill /f /im %s' %...
Kills all running exes with the same name as the exe at |process_path|. Args: process_path: The path to an executable. Returns: True if running executables were successfully killed. False otherwise.
Kills all running exes with the same name as the exe at |process_path|.
[ "Kills", "all", "running", "exes", "with", "the", "same", "name", "as", "the", "exe", "at", "|process_path|", "." ]
def KillNamedProcess(process_path): return os.system('taskkill /f /im %s' % os.path.basename(process_path)) == 0
[ "def", "KillNamedProcess", "(", "process_path", ")", ":", "return", "os", ".", "system", "(", "'taskkill /f /im %s'", "%", "os", ".", "path", ".", "basename", "(", "process_path", ")", ")", "==", "0" ]
Kills all running exes with the same name as the exe at |process_path|.
[ "Kills", "all", "running", "exes", "with", "the", "same", "name", "as", "the", "exe", "at", "|process_path|", "." ]
[ "\"\"\" Kills all running exes with the same name as the exe at |process_path|.\n\n Args:\n process_path: The path to an executable.\n\n Returns:\n True if running executables were successfully killed. False otherwise.\n \"\"\"" ]
[ { "param": "process_path", "type": null } ]
{ "returns": [ { "docstring": "True if running executables were successfully killed. False otherwise.", "docstring_tokens": [ "True", "if", "running", "executables", "were", "successfully", "killed", ".", "False", "otherwi...
dbb32d931b0dd889922f91bb8f1f7dbb0535a2a6
sunlongbo/chromium
chrome/test/mini_installer/quit_chrome.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
QuitChrome
null
def QuitChrome(chrome_path): """ Tries to quit chrome in a safe way. If there is still an open instance after a timeout delay, the process is killed the hard way. Args: chrome_path: The path to chrome.exe. """ if not CloseWindows(chrome_path): # TODO(robertshield): Investigate w...
Tries to quit chrome in a safe way. If there is still an open instance after a timeout delay, the process is killed the hard way. Args: chrome_path: The path to chrome.exe.
Tries to quit chrome in a safe way. If there is still an open instance after a timeout delay, the process is killed the hard way.
[ "Tries", "to", "quit", "chrome", "in", "a", "safe", "way", ".", "If", "there", "is", "still", "an", "open", "instance", "after", "a", "timeout", "delay", "the", "process", "is", "killed", "the", "hard", "way", "." ]
def QuitChrome(chrome_path): if not CloseWindows(chrome_path): sys.stderr.write('Warning: Chrome not responding to window closure. ' 'Killing all processes belonging to %s\n' % chrome_path) KillNamedProcess(chrome_path)
[ "def", "QuitChrome", "(", "chrome_path", ")", ":", "if", "not", "CloseWindows", "(", "chrome_path", ")", ":", "sys", ".", "stderr", ".", "write", "(", "'Warning: Chrome not responding to window closure. '", "'Killing all processes belonging to %s\\n'", "%", "chrome_path",...
Tries to quit chrome in a safe way.
[ "Tries", "to", "quit", "chrome", "in", "a", "safe", "way", "." ]
[ "\"\"\" Tries to quit chrome in a safe way. If there is still an open instance\n after a timeout delay, the process is killed the hard way.\n\n Args:\n chrome_path: The path to chrome.exe.\n \"\"\"", "# TODO(robertshield): Investigate why Chrome occasionally doesn't shut", "# down." ]
[ { "param": "chrome_path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "chrome_path", "type": null, "docstring": "The path to chrome.exe.", "docstring_tokens": [ "The", "path", "to", "chrome", ".", "exe", "." ], "default": null, ...
c42fdd3689f7d3446e83044306ca5c2c708ac630
sunlongbo/chromium
components/variations/service/generate_ui_string_overrider.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
HashName
<not_specific>
def HashName(name): """Returns the hash id for a name. Args: name: The name to hash. Returns: An int that is at most 32 bits. """ md5hash = hashlib.md5() md5hash.update(name.encode('utf-8')) return int(md5hash.hexdigest()[:8], 16)
Returns the hash id for a name. Args: name: The name to hash. Returns: An int that is at most 32 bits.
Returns the hash id for a name.
[ "Returns", "the", "hash", "id", "for", "a", "name", "." ]
def HashName(name): md5hash = hashlib.md5() md5hash.update(name.encode('utf-8')) return int(md5hash.hexdigest()[:8], 16)
[ "def", "HashName", "(", "name", ")", ":", "md5hash", "=", "hashlib", ".", "md5", "(", ")", "md5hash", ".", "update", "(", "name", ".", "encode", "(", "'utf-8'", ")", ")", "return", "int", "(", "md5hash", ".", "hexdigest", "(", ")", "[", ":", "8", ...
Returns the hash id for a name.
[ "Returns", "the", "hash", "id", "for", "a", "name", "." ]
[ "\"\"\"Returns the hash id for a name.\n\n Args:\n name: The name to hash.\n\n Returns:\n An int that is at most 32 bits.\n \"\"\"" ]
[ { "param": "name", "type": null } ]
{ "returns": [ { "docstring": "An int that is at most 32 bits.", "docstring_tokens": [ "An", "int", "that", "is", "at", "most", "32", "bits", "." ], "type": null } ], "raises": [], "params": [ { "id...
c42fdd3689f7d3446e83044306ca5c2c708ac630
sunlongbo/chromium
components/variations/service/generate_ui_string_overrider.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GetNameIndexPairsIter
null
def _GetNameIndexPairsIter(string_to_scan): """Gets an iterator of the resource name and index pairs of the given string. Scans the input string for lines of the form "#define NAME INDEX" and returns an iterator over all matching (NAME, INDEX) pairs. Args: string_to_scan: The input string to scan. Yiel...
Gets an iterator of the resource name and index pairs of the given string. Scans the input string for lines of the form "#define NAME INDEX" and returns an iterator over all matching (NAME, INDEX) pairs. Args: string_to_scan: The input string to scan. Yields: A tuple of name and index.
Gets an iterator of the resource name and index pairs of the given string. Scans the input string for lines of the form "#define NAME INDEX" and returns an iterator over all matching (NAME, INDEX) pairs.
[ "Gets", "an", "iterator", "of", "the", "resource", "name", "and", "index", "pairs", "of", "the", "given", "string", ".", "Scans", "the", "input", "string", "for", "lines", "of", "the", "form", "\"", "#define", "NAME", "INDEX", "\"", "and", "returns", "an...
def _GetNameIndexPairsIter(string_to_scan): for match in RESOURCE_EXTRACT_REGEX.finditer(string_to_scan): yield match.group(1, 2)
[ "def", "_GetNameIndexPairsIter", "(", "string_to_scan", ")", ":", "for", "match", "in", "RESOURCE_EXTRACT_REGEX", ".", "finditer", "(", "string_to_scan", ")", ":", "yield", "match", ".", "group", "(", "1", ",", "2", ")" ]
Gets an iterator of the resource name and index pairs of the given string.
[ "Gets", "an", "iterator", "of", "the", "resource", "name", "and", "index", "pairs", "of", "the", "given", "string", "." ]
[ "\"\"\"Gets an iterator of the resource name and index pairs of the given string.\n\n Scans the input string for lines of the form \"#define NAME INDEX\" and returns\n an iterator over all matching (NAME, INDEX) pairs.\n\n Args:\n string_to_scan: The input string to scan.\n\n Yields:\n A tuple of name and...
[ { "param": "string_to_scan", "type": null } ]
{ "returns": [ { "docstring": "A tuple of name and index.", "docstring_tokens": [ "A", "tuple", "of", "name", "and", "index", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "string_to_scan", ...
c42fdd3689f7d3446e83044306ca5c2c708ac630
sunlongbo/chromium
components/variations/service/generate_ui_string_overrider.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GetResourceListFromString
<not_specific>
def _GetResourceListFromString(resources_content): """Produces a list of |Resource| objects from a string. The input string contains lines of the form "#define NAME INDEX". The returned list is sorted primarily by hash, then name, and then index. Args: resources_content: The input string to process, conta...
Produces a list of |Resource| objects from a string. The input string contains lines of the form "#define NAME INDEX". The returned list is sorted primarily by hash, then name, and then index. Args: resources_content: The input string to process, contains lines of the form "#define NAME INDEX". R...
Produces a list of |Resource| objects from a string. The input string contains lines of the form "#define NAME INDEX". The returned list is sorted primarily by hash, then name, and then index.
[ "Produces", "a", "list", "of", "|Resource|", "objects", "from", "a", "string", ".", "The", "input", "string", "contains", "lines", "of", "the", "form", "\"", "#define", "NAME", "INDEX", "\"", ".", "The", "returned", "list", "is", "sorted", "primarily", "by...
def _GetResourceListFromString(resources_content): resources = [Resource(HashName(name), name, index) for name, index in _GetNameIndexPairsIter(resources_content)] resources = list(set(resources)) resources.sort() return resources
[ "def", "_GetResourceListFromString", "(", "resources_content", ")", ":", "resources", "=", "[", "Resource", "(", "HashName", "(", "name", ")", ",", "name", ",", "index", ")", "for", "name", ",", "index", "in", "_GetNameIndexPairsIter", "(", "resources_content", ...
Produces a list of |Resource| objects from a string.
[ "Produces", "a", "list", "of", "|Resource|", "objects", "from", "a", "string", "." ]
[ "\"\"\"Produces a list of |Resource| objects from a string.\n\n The input string contains lines of the form \"#define NAME INDEX\". The returned\n list is sorted primarily by hash, then name, and then index.\n\n Args:\n resources_content: The input string to process, contains lines of the form\n \"#def...
[ { "param": "resources_content", "type": null } ]
{ "returns": [ { "docstring": "A sorted list of |Resource| objects.", "docstring_tokens": [ "A", "sorted", "list", "of", "|Resource|", "objects", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "...
c42fdd3689f7d3446e83044306ca5c2c708ac630
sunlongbo/chromium
components/variations/service/generate_ui_string_overrider.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_CheckForHashCollisions
<not_specific>
def _CheckForHashCollisions(sorted_resource_list): """Checks a sorted list of |Resource| objects for hash collisions. Args: sorted_resource_list: A sorted list of |Resource| objects. Returns: A set of all |Resource| objects with collisions. """ collisions = set() for i in range(len(sorted_resource...
Checks a sorted list of |Resource| objects for hash collisions. Args: sorted_resource_list: A sorted list of |Resource| objects. Returns: A set of all |Resource| objects with collisions.
Checks a sorted list of |Resource| objects for hash collisions.
[ "Checks", "a", "sorted", "list", "of", "|Resource|", "objects", "for", "hash", "collisions", "." ]
def _CheckForHashCollisions(sorted_resource_list): collisions = set() for i in range(len(sorted_resource_list) - 1): resource = sorted_resource_list[i] next_resource = sorted_resource_list[i+1] if resource.hash == next_resource.hash: collisions.add(resource) collisions.add(next_resource) r...
[ "def", "_CheckForHashCollisions", "(", "sorted_resource_list", ")", ":", "collisions", "=", "set", "(", ")", "for", "i", "in", "range", "(", "len", "(", "sorted_resource_list", ")", "-", "1", ")", ":", "resource", "=", "sorted_resource_list", "[", "i", "]", ...
Checks a sorted list of |Resource| objects for hash collisions.
[ "Checks", "a", "sorted", "list", "of", "|Resource|", "objects", "for", "hash", "collisions", "." ]
[ "\"\"\"Checks a sorted list of |Resource| objects for hash collisions.\n\n Args:\n sorted_resource_list: A sorted list of |Resource| objects.\n\n Returns:\n A set of all |Resource| objects with collisions.\n \"\"\"" ]
[ { "param": "sorted_resource_list", "type": null } ]
{ "returns": [ { "docstring": "A set of all |Resource| objects with collisions.", "docstring_tokens": [ "A", "set", "of", "all", "|Resource|", "objects", "with", "collisions", "." ], "type": null } ], "raises":...
c42fdd3689f7d3446e83044306ca5c2c708ac630
sunlongbo/chromium
components/variations/service/generate_ui_string_overrider.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GenDataArray
<not_specific>
def _GenDataArray( resources, entry_pattern, array_name, array_type, data_getter): """Generates a C++ statement defining a literal array containing the hashes. Args: resources: A sorted list of |Resource| objects. entry_pattern: A pattern to be used to generate each entry in the array. The patt...
Generates a C++ statement defining a literal array containing the hashes. Args: resources: A sorted list of |Resource| objects. entry_pattern: A pattern to be used to generate each entry in the array. The pattern is expected to have a place for data and one for a comment, in that order. a...
Generates a C++ statement defining a literal array containing the hashes.
[ "Generates", "a", "C", "++", "statement", "defining", "a", "literal", "array", "containing", "the", "hashes", "." ]
def _GenDataArray( resources, entry_pattern, array_name, array_type, data_getter): lines = [entry_pattern % (data_getter(r), r.name) for r in resources] pattern = """const %(type)s %(name)s[] = { %(content)s }; """ return pattern % {'type': array_type, 'name': array_name, ...
[ "def", "_GenDataArray", "(", "resources", ",", "entry_pattern", ",", "array_name", ",", "array_type", ",", "data_getter", ")", ":", "lines", "=", "[", "entry_pattern", "%", "(", "data_getter", "(", "r", ")", ",", "r", ".", "name", ")", "for", "r", "in", ...
Generates a C++ statement defining a literal array containing the hashes.
[ "Generates", "a", "C", "++", "statement", "defining", "a", "literal", "array", "containing", "the", "hashes", "." ]
[ "\"\"\"Generates a C++ statement defining a literal array containing the hashes.\n\n Args:\n resources: A sorted list of |Resource| objects.\n entry_pattern: A pattern to be used to generate each entry in the array. The\n pattern is expected to have a place for data and one for a comment, in\n ...
[ { "param": "resources", "type": null }, { "param": "entry_pattern", "type": null }, { "param": "array_name", "type": null }, { "param": "array_type", "type": null }, { "param": "data_getter", "type": null } ]
{ "returns": [ { "docstring": "A string containing a C++ statement defining the an array.", "docstring_tokens": [ "A", "string", "containing", "a", "C", "++", "statement", "defining", "the", "an", "array", ...
c42fdd3689f7d3446e83044306ca5c2c708ac630
sunlongbo/chromium
components/variations/service/generate_ui_string_overrider.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GenerateNamespacePrefixAndSuffix
<not_specific>
def _GenerateNamespacePrefixAndSuffix(namespace): """Generates the namespace prefix and suffix for |namespace|. Args: namespace: A string corresponding to the namespace name. May be empty. Returns: A tuple of strings corresponding to the namespace prefix and suffix for putting the code in the corres...
Generates the namespace prefix and suffix for |namespace|. Args: namespace: A string corresponding to the namespace name. May be empty. Returns: A tuple of strings corresponding to the namespace prefix and suffix for putting the code in the corresponding namespace in C++. If namespace is the empty...
Generates the namespace prefix and suffix for |namespace|.
[ "Generates", "the", "namespace", "prefix", "and", "suffix", "for", "|namespace|", "." ]
def _GenerateNamespacePrefixAndSuffix(namespace): if not namespace: return "", "" return "namespace %s {\n\n" % namespace, "\n} // namespace %s\n" % namespace
[ "def", "_GenerateNamespacePrefixAndSuffix", "(", "namespace", ")", ":", "if", "not", "namespace", ":", "return", "\"\"", ",", "\"\"", "return", "\"namespace %s {\\n\\n\"", "%", "namespace", ",", "\"\\n} // namespace %s\\n\"", "%", "namespace" ]
Generates the namespace prefix and suffix for |namespace|.
[ "Generates", "the", "namespace", "prefix", "and", "suffix", "for", "|namespace|", "." ]
[ "\"\"\"Generates the namespace prefix and suffix for |namespace|.\n\n Args:\n namespace: A string corresponding to the namespace name. May be empty.\n\n Returns:\n A tuple of strings corresponding to the namespace prefix and suffix for\n putting the code in the corresponding namespace in C++. If namespac...
[ { "param": "namespace", "type": null } ]
{ "returns": [ { "docstring": "A tuple of strings corresponding to the namespace prefix and suffix for\nputting the code in the corresponding namespace in C++. If namespace is\nthe empty string, both returned strings are empty too.", "docstring_tokens": [ "A", "tuple", "of", ...
c42fdd3689f7d3446e83044306ca5c2c708ac630
sunlongbo/chromium
components/variations/service/generate_ui_string_overrider.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GenerateSourceFileContent
<not_specific>
def _GenerateSourceFileContent(resources_content, namespace, header_filename): """Generates the .cc content from the given generated grit headers content. Args: resources_content: The input string to process, contains lines of the form "#define NAME INDEX". namespace: The namespace in which the ge...
Generates the .cc content from the given generated grit headers content. Args: resources_content: The input string to process, contains lines of the form "#define NAME INDEX". namespace: The namespace in which the generated code should be scoped. If not defined, then the code will be in the ...
Generates the .cc content from the given generated grit headers content.
[ "Generates", "the", ".", "cc", "content", "from", "the", "given", "generated", "grit", "headers", "content", "." ]
def _GenerateSourceFileContent(resources_content, namespace, header_filename): hashed_tuples = _GetResourceListFromString(resources_content) collisions = _CheckForHashCollisions(hashed_tuples) if collisions: error_message = "\n".join( ["hash: %i, name: %s" % (i.hash, i.name) for i in sorted(collisions...
[ "def", "_GenerateSourceFileContent", "(", "resources_content", ",", "namespace", ",", "header_filename", ")", ":", "hashed_tuples", "=", "_GetResourceListFromString", "(", "resources_content", ")", "collisions", "=", "_CheckForHashCollisions", "(", "hashed_tuples", ")", "...
Generates the .cc content from the given generated grit headers content.
[ "Generates", "the", ".", "cc", "content", "from", "the", "given", "generated", "grit", "headers", "content", "." ]
[ "\"\"\"Generates the .cc content from the given generated grit headers content.\n\n Args:\n resources_content: The input string to process, contains lines of the form\n \"#define NAME INDEX\".\n\n namespace: The namespace in which the generated code should be scoped. If\n not defined, then the ...
[ { "param": "resources_content", "type": null }, { "param": "namespace", "type": null }, { "param": "header_filename", "type": null } ]
{ "returns": [ { "docstring": ".cc file content implementing the CreateUIStringOverrider() factory.", "docstring_tokens": [ ".", "cc", "file", "content", "implementing", "the", "CreateUIStringOverrider", "()", "factory", "...