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
04eaf349eb69d0a29ac726f89401a5ea15786691
sunlongbo/chromium
chromeos/ime/gen_input_methods.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CreateEngineHeader
<not_specific>
def CreateEngineHeader(login_xkb_layout_ids): """Create the header file from a list of login XKB layout IDs. Arguments: login_xkb_layout_ids: list of login XKB layout IDs Returns: The text of a C++ header file containing the login XKB layout IDs. """ output = [] output.append(OUTPUT_HEADER) for l...
Create the header file from a list of login XKB layout IDs. Arguments: login_xkb_layout_ids: list of login XKB layout IDs Returns: The text of a C++ header file containing the login XKB layout IDs.
Create the header file from a list of login XKB layout IDs.
[ "Create", "the", "header", "file", "from", "a", "list", "of", "login", "XKB", "layout", "IDs", "." ]
def CreateEngineHeader(login_xkb_layout_ids): output = [] output.append(OUTPUT_HEADER) for login_xkb_layout_id in login_xkb_layout_ids: output.append(ENGINE_FORMAT % login_xkb_layout_id) output.append(OUTPUT_FOOTER) return "".join(output)
[ "def", "CreateEngineHeader", "(", "login_xkb_layout_ids", ")", ":", "output", "=", "[", "]", "output", ".", "append", "(", "OUTPUT_HEADER", ")", "for", "login_xkb_layout_id", "in", "login_xkb_layout_ids", ":", "output", ".", "append", "(", "ENGINE_FORMAT", "%", ...
Create the header file from a list of login XKB layout IDs.
[ "Create", "the", "header", "file", "from", "a", "list", "of", "login", "XKB", "layout", "IDs", "." ]
[ "\"\"\"Create the header file from a list of login XKB layout IDs.\n\n Arguments:\n login_xkb_layout_ids: list of login XKB layout IDs\n Returns:\n The text of a C++ header file containing the login XKB layout IDs.\n \"\"\"" ]
[ { "param": "login_xkb_layout_ids", "type": null } ]
{ "returns": [ { "docstring": "The text of a C++ header file containing the login XKB layout IDs.", "docstring_tokens": [ "The", "text", "of", "a", "C", "++", "header", "file", "containing", "the", "login", ...
04fa18e93dfdbd2a0eed0fded336fc0385dc400c
sunlongbo/chromium
ui/ozone/generate_constructor_list.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetTypedefName
<not_specific>
def GetTypedefName(typename): """Determine typedef name of constructor for typename. This is just typename + "Constructor". """ return typename + 'Constructor'
Determine typedef name of constructor for typename. This is just typename + "Constructor".
Determine typedef name of constructor for typename. This is just typename + "Constructor".
[ "Determine", "typedef", "name", "of", "constructor", "for", "typename", ".", "This", "is", "just", "typename", "+", "\"", "Constructor", "\"", "." ]
def GetTypedefName(typename): return typename + 'Constructor'
[ "def", "GetTypedefName", "(", "typename", ")", ":", "return", "typename", "+", "'Constructor'" ]
Determine typedef name of constructor for typename.
[ "Determine", "typedef", "name", "of", "constructor", "for", "typename", "." ]
[ "\"\"\"Determine typedef name of constructor for typename.\n\n This is just typename + \"Constructor\".\n \"\"\"" ]
[ { "param": "typename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "typename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0b2245c26946bb67ea88be7acdb34e6b5b843fec
sunlongbo/chromium
tools/ipc_fuzzer/scripts/utils.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
create_flags_file
null
def create_flags_file(ipcdump_testcase_path): """Create a flags file to add launch prefix to application command line.""" prefixes = (UNCOMMON_LAUNCH_PREFIXES if random.randint(1, UNCOMMON_PREFIX_CHANCE) == 1 else COMMON_LAUNCH_PREFIXES) random_launch_prefix = random.choice(prefixes) ...
Create a flags file to add launch prefix to application command line.
Create a flags file to add launch prefix to application command line.
[ "Create", "a", "flags", "file", "to", "add", "launch", "prefix", "to", "application", "command", "line", "." ]
def create_flags_file(ipcdump_testcase_path): prefixes = (UNCOMMON_LAUNCH_PREFIXES if random.randint(1, UNCOMMON_PREFIX_CHANCE) == 1 else COMMON_LAUNCH_PREFIXES) random_launch_prefix = random.choice(prefixes) application_name = application_name_for_platform(IPC_REPLAY_APPLICATION) fi...
[ "def", "create_flags_file", "(", "ipcdump_testcase_path", ")", ":", "prefixes", "=", "(", "UNCOMMON_LAUNCH_PREFIXES", "if", "random", ".", "randint", "(", "1", ",", "UNCOMMON_PREFIX_CHANCE", ")", "==", "1", "else", "COMMON_LAUNCH_PREFIXES", ")", "random_launch_prefix"...
Create a flags file to add launch prefix to application command line.
[ "Create", "a", "flags", "file", "to", "add", "launch", "prefix", "to", "application", "command", "line", "." ]
[ "\"\"\"Create a flags file to add launch prefix to application command line.\"\"\"" ]
[ { "param": "ipcdump_testcase_path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ipcdump_testcase_path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ec1edf36e0dd9aada5b0547312510b8c37367440
sunlongbo/chromium
tools/binary_size/libsupersize/readelf.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
BuildIdFromElf
<not_specific>
def BuildIdFromElf(elf_path, tool_prefix): """Returns the Build ID for the given binary.""" args = [path_util.GetReadElfPath(tool_prefix), '-n', elf_path] stdout = subprocess.check_output(args, encoding='ascii') match = re.search(r'Build ID: (\w+)', stdout) assert match, 'Build ID not found from running: ' + ...
Returns the Build ID for the given binary.
Returns the Build ID for the given binary.
[ "Returns", "the", "Build", "ID", "for", "the", "given", "binary", "." ]
def BuildIdFromElf(elf_path, tool_prefix): args = [path_util.GetReadElfPath(tool_prefix), '-n', elf_path] stdout = subprocess.check_output(args, encoding='ascii') match = re.search(r'Build ID: (\w+)', stdout) assert match, 'Build ID not found from running: ' + ' '.join(args) return match.group(1)
[ "def", "BuildIdFromElf", "(", "elf_path", ",", "tool_prefix", ")", ":", "args", "=", "[", "path_util", ".", "GetReadElfPath", "(", "tool_prefix", ")", ",", "'-n'", ",", "elf_path", "]", "stdout", "=", "subprocess", ".", "check_output", "(", "args", ",", "e...
Returns the Build ID for the given binary.
[ "Returns", "the", "Build", "ID", "for", "the", "given", "binary", "." ]
[ "\"\"\"Returns the Build ID for the given binary.\"\"\"" ]
[ { "param": "elf_path", "type": null }, { "param": "tool_prefix", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "elf_path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tool_prefix", "type": null, "docstring": null, "docstring...
ec1edf36e0dd9aada5b0547312510b8c37367440
sunlongbo/chromium
tools/binary_size/libsupersize/readelf.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ArchFromElf
<not_specific>
def ArchFromElf(elf_path, tool_prefix): """Returns the GN architecture for the given binary.""" args = [path_util.GetReadElfPath(tool_prefix), '-h', elf_path] stdout = subprocess.check_output(args, encoding='ascii') machine = re.search('Machine:\s*(.+)', stdout).group(1) if machine == 'Intel 80386': retur...
Returns the GN architecture for the given binary.
Returns the GN architecture for the given binary.
[ "Returns", "the", "GN", "architecture", "for", "the", "given", "binary", "." ]
def ArchFromElf(elf_path, tool_prefix): args = [path_util.GetReadElfPath(tool_prefix), '-h', elf_path] stdout = subprocess.check_output(args, encoding='ascii') machine = re.search('Machine:\s*(.+)', stdout).group(1) if machine == 'Intel 80386': return 'x86' if machine == 'Advanced Micro Devices X86-64': ...
[ "def", "ArchFromElf", "(", "elf_path", ",", "tool_prefix", ")", ":", "args", "=", "[", "path_util", ".", "GetReadElfPath", "(", "tool_prefix", ")", ",", "'-h'", ",", "elf_path", "]", "stdout", "=", "subprocess", ".", "check_output", "(", "args", ",", "enco...
Returns the GN architecture for the given binary.
[ "Returns", "the", "GN", "architecture", "for", "the", "given", "binary", "." ]
[ "\"\"\"Returns the GN architecture for the given binary.\"\"\"" ]
[ { "param": "elf_path", "type": null }, { "param": "tool_prefix", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "elf_path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tool_prefix", "type": null, "docstring": null, "docstring...
ec1edf36e0dd9aada5b0547312510b8c37367440
sunlongbo/chromium
tools/binary_size/libsupersize/readelf.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
SectionInfoFromElf
<not_specific>
def SectionInfoFromElf(elf_path, tool_prefix): """Finds the address and size of all ELF sections Returns: A dict of section_name->(start_address, size). """ args = [path_util.GetReadElfPath(tool_prefix), '-S', '--wide', elf_path] stdout = subprocess.check_output(args, encoding='ascii') section_ranges =...
Finds the address and size of all ELF sections Returns: A dict of section_name->(start_address, size).
Finds the address and size of all ELF sections
[ "Finds", "the", "address", "and", "size", "of", "all", "ELF", "sections" ]
def SectionInfoFromElf(elf_path, tool_prefix): args = [path_util.GetReadElfPath(tool_prefix), '-S', '--wide', elf_path] stdout = subprocess.check_output(args, encoding='ascii') section_ranges = {} for match in re.finditer(r'\[[\s\d]+\] (\..*)$', stdout, re.MULTILINE): items = match.group(1).split() sect...
[ "def", "SectionInfoFromElf", "(", "elf_path", ",", "tool_prefix", ")", ":", "args", "=", "[", "path_util", ".", "GetReadElfPath", "(", "tool_prefix", ")", ",", "'-S'", ",", "'--wide'", ",", "elf_path", "]", "stdout", "=", "subprocess", ".", "check_output", "...
Finds the address and size of all ELF sections
[ "Finds", "the", "address", "and", "size", "of", "all", "ELF", "sections" ]
[ "\"\"\"Finds the address and size of all ELF sections\n\n Returns:\n A dict of section_name->(start_address, size).\n \"\"\"", "# Matches [ 2] .hash HASH 00000000006681f0 0001f0 003154 04 A 3 0 8" ]
[ { "param": "elf_path", "type": null }, { "param": "tool_prefix", "type": null } ]
{ "returns": [ { "docstring": "A dict of section_name->(start_address, size).", "docstring_tokens": [ "A", "dict", "of", "section_name", "-", ">", "(", "start_address", "size", ")", "." ], "type": null ...
ec1edf36e0dd9aada5b0547312510b8c37367440
sunlongbo/chromium
tools/binary_size/libsupersize/readelf.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CollectRelocationAddresses
<not_specific>
def CollectRelocationAddresses(elf_path, tool_prefix): """Returns the list of addresses that are targets for relative relocations.""" cmd = [path_util.GetReadElfPath(tool_prefix), '--relocs', elf_path] ret = subprocess.check_output(cmd, encoding='ascii').splitlines() # Grab first column from (sample output) '02...
Returns the list of addresses that are targets for relative relocations.
Returns the list of addresses that are targets for relative relocations.
[ "Returns", "the", "list", "of", "addresses", "that", "are", "targets", "for", "relative", "relocations", "." ]
def CollectRelocationAddresses(elf_path, tool_prefix): cmd = [path_util.GetReadElfPath(tool_prefix), '--relocs', elf_path] ret = subprocess.check_output(cmd, encoding='ascii').splitlines() return [int(l.split(maxsplit=1)[0], 16) for l in ret if 'R_ARM_RELATIVE' in l]
[ "def", "CollectRelocationAddresses", "(", "elf_path", ",", "tool_prefix", ")", ":", "cmd", "=", "[", "path_util", ".", "GetReadElfPath", "(", "tool_prefix", ")", ",", "'--relocs'", ",", "elf_path", "]", "ret", "=", "subprocess", ".", "check_output", "(", "cmd"...
Returns the list of addresses that are targets for relative relocations.
[ "Returns", "the", "list", "of", "addresses", "that", "are", "targets", "for", "relative", "relocations", "." ]
[ "\"\"\"Returns the list of addresses that are targets for relative relocations.\"\"\"", "# Grab first column from (sample output) '02de6d5c 00000017 R_ARM_RELATIVE'" ]
[ { "param": "elf_path", "type": null }, { "param": "tool_prefix", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "elf_path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tool_prefix", "type": null, "docstring": null, "docstring...
ec2ff8daeb3b2280bf2f43ec383b4c337449e280
sunlongbo/chromium
tools/perf/contrib/vr_benchmarks/shared_vr_page_state.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_ConfigureVrCore
null
def _ConfigureVrCore(self, filepath): """Configures VrCore using the provided settings file.""" settings = shared_preference_utils.ExtractSettingsFromJson(filepath) for setting in settings: shared_pref = self.platform.GetSharedPrefs( setting['package'], setting['filename'], use_enc...
Configures VrCore using the provided settings file.
Configures VrCore using the provided settings file.
[ "Configures", "VrCore", "using", "the", "provided", "settings", "file", "." ]
def _ConfigureVrCore(self, filepath): settings = shared_preference_utils.ExtractSettingsFromJson(filepath) for setting in settings: shared_pref = self.platform.GetSharedPrefs( setting['package'], setting['filename'], use_encrypted_path=setting.get('supports_encrypted_path', False)) ...
[ "def", "_ConfigureVrCore", "(", "self", ",", "filepath", ")", ":", "settings", "=", "shared_preference_utils", ".", "ExtractSettingsFromJson", "(", "filepath", ")", "for", "setting", "in", "settings", ":", "shared_pref", "=", "self", ".", "platform", ".", "GetSh...
Configures VrCore using the provided settings file.
[ "Configures", "VrCore", "using", "the", "provided", "settings", "file", "." ]
[ "\"\"\"Configures VrCore using the provided settings file.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "filepath", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filepath", "type": null, "docstring": null, "docstring_tokens...
ec2ff8daeb3b2280bf2f43ec383b4c337449e280
sunlongbo/chromium
tools/perf/contrib/vr_benchmarks/shared_vr_page_state.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_InstallNfcApk
null
def _InstallNfcApk(self): """Installs the APK that allows VR tests to simulate a headset NFC scan.""" chromium_root = path_util.GetChromiumSrcDir() # Find the most recently build APK candidate_apks = [] for build_path in util.GetBuildDirectories(chromium_root): apk_path = os.path.join(build_pa...
Installs the APK that allows VR tests to simulate a headset NFC scan.
Installs the APK that allows VR tests to simulate a headset NFC scan.
[ "Installs", "the", "APK", "that", "allows", "VR", "tests", "to", "simulate", "a", "headset", "NFC", "scan", "." ]
def _InstallNfcApk(self): chromium_root = path_util.GetChromiumSrcDir() candidate_apks = [] for build_path in util.GetBuildDirectories(chromium_root): apk_path = os.path.join(build_path, 'apks', 'VrNfcSimulator.apk') if os.path.exists(apk_path): last_changed = os.path.getmtime(apk_path) ...
[ "def", "_InstallNfcApk", "(", "self", ")", ":", "chromium_root", "=", "path_util", ".", "GetChromiumSrcDir", "(", ")", "candidate_apks", "=", "[", "]", "for", "build_path", "in", "util", ".", "GetBuildDirectories", "(", "chromium_root", ")", ":", "apk_path", "...
Installs the APK that allows VR tests to simulate a headset NFC scan.
[ "Installs", "the", "APK", "that", "allows", "VR", "tests", "to", "simulate", "a", "headset", "NFC", "scan", "." ]
[ "\"\"\"Installs the APK that allows VR tests to simulate a headset NFC scan.\"\"\"", "# Find the most recently build APK" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ec2ff8daeb3b2280bf2f43ec383b4c337449e280
sunlongbo/chromium
tools/perf/contrib/vr_benchmarks/shared_vr_page_state.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_InstallKeyboardApk
null
def _InstallKeyboardApk(self): """Installs the VR Keyboard APK.""" self.platform.InstallApplication( os.path.join(path_util.GetChromiumSrcDir(), 'third_party', 'gvr-android-sdk', 'test-apks', 'vr_keyboard', 'vr_keyboard_current.apk'))
Installs the VR Keyboard APK.
Installs the VR Keyboard APK.
[ "Installs", "the", "VR", "Keyboard", "APK", "." ]
def _InstallKeyboardApk(self): self.platform.InstallApplication( os.path.join(path_util.GetChromiumSrcDir(), 'third_party', 'gvr-android-sdk', 'test-apks', 'vr_keyboard', 'vr_keyboard_current.apk'))
[ "def", "_InstallKeyboardApk", "(", "self", ")", ":", "self", ".", "platform", ".", "InstallApplication", "(", "os", ".", "path", ".", "join", "(", "path_util", ".", "GetChromiumSrcDir", "(", ")", ",", "'third_party'", ",", "'gvr-android-sdk'", ",", "'test-apks...
Installs the VR Keyboard APK.
[ "Installs", "the", "VR", "Keyboard", "APK", "." ]
[ "\"\"\"Installs the VR Keyboard APK.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
788123fb793045f585e944584c746155e2090381
sunlongbo/chromium
third_party/tensorflow-text/src/tensorflow_text/python/ops/unicode_char_tokenizer.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
tokenize_with_offsets
<not_specific>
def tokenize_with_offsets(self, input): # pylint: disable=redefined-builtin """Tokenizes a tensor of UTF-8 strings to Unicode characters. Returned token tensors are of integer type. Args: input: A `RaggedTensor`or `Tensor` of UTF-8 strings with any shape. Returns: A tuple `(tokens, start...
Tokenizes a tensor of UTF-8 strings to Unicode characters. Returned token tensors are of integer type. Args: input: A `RaggedTensor`or `Tensor` of UTF-8 strings with any shape. Returns: A tuple `(tokens, start_offsets, end_offsets)` where: * `tokens`: A `RaggedTensor` of codepoints (...
Tokenizes a tensor of UTF-8 strings to Unicode characters. Returned token tensors are of integer type.
[ "Tokenizes", "a", "tensor", "of", "UTF", "-", "8", "strings", "to", "Unicode", "characters", ".", "Returned", "token", "tensors", "are", "of", "integer", "type", "." ]
def tokenize_with_offsets(self, input): name = None with ops.name_scope(name, "UnicodeCharTokenize", [input]): input_tensor = ragged_tensor.convert_to_tensor_or_ragged_tensor(input) (codepoints, byte_start_offsets) = ( ragged_string_ops.unicode_decode_with_offsets(input_tensor, "UTF-8"))...
[ "def", "tokenize_with_offsets", "(", "self", ",", "input", ")", ":", "name", "=", "None", "with", "ops", ".", "name_scope", "(", "name", ",", "\"UnicodeCharTokenize\"", ",", "[", "input", "]", ")", ":", "input_tensor", "=", "ragged_tensor", ".", "convert_to_...
Tokenizes a tensor of UTF-8 strings to Unicode characters.
[ "Tokenizes", "a", "tensor", "of", "UTF", "-", "8", "strings", "to", "Unicode", "characters", "." ]
[ "# pylint: disable=redefined-builtin", "\"\"\"Tokenizes a tensor of UTF-8 strings to Unicode characters.\n\n Returned token tensors are of integer type.\n\n Args:\n input: A `RaggedTensor`or `Tensor` of UTF-8 strings with any shape.\n\n Returns:\n A tuple `(tokens, start_offsets, end_offsets)` ...
[ { "param": "self", "type": null }, { "param": "input", "type": null } ]
{ "returns": [ { "docstring": "A tuple `(tokens, start_offsets, end_offsets)` where.\n\n`tokens`: A `RaggedTensor` of codepoints (integer type).\n`start_offsets`: A `RaggedTensor` of the tokens' starting byte offset.\n`end_offsets`: A `RaggedTensor` of the tokens' ending byte offset.", "docstring_toke...
788123fb793045f585e944584c746155e2090381
sunlongbo/chromium
third_party/tensorflow-text/src/tensorflow_text/python/ops/unicode_char_tokenizer.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
detokenize
<not_specific>
def detokenize(self, input, name=None): # pylint: disable=redefined-builtin """Detokenizes input codepoints (integers) to UTF-8 strings. Args: input: A `RaggedTensor` or `Tensor` of codepoints (ints) with a rank of at least 1. name: The name argument that is passed to the op function. ...
Detokenizes input codepoints (integers) to UTF-8 strings. Args: input: A `RaggedTensor` or `Tensor` of codepoints (ints) with a rank of at least 1. name: The name argument that is passed to the op function. Returns: A N-1 dimensional string tensor of the detokenized text.
Detokenizes input codepoints (integers) to UTF-8 strings.
[ "Detokenizes", "input", "codepoints", "(", "integers", ")", "to", "UTF", "-", "8", "strings", "." ]
def detokenize(self, input, name=None): name = None with ops.name_scope(name, "UnicodeCharTokenize", [input, self]): input_tensor = ragged_tensor.convert_to_tensor_or_ragged_tensor(input) return ragged_string_ops.unicode_encode(input_tensor, "UTF-8")
[ "def", "detokenize", "(", "self", ",", "input", ",", "name", "=", "None", ")", ":", "name", "=", "None", "with", "ops", ".", "name_scope", "(", "name", ",", "\"UnicodeCharTokenize\"", ",", "[", "input", ",", "self", "]", ")", ":", "input_tensor", "=", ...
Detokenizes input codepoints (integers) to UTF-8 strings.
[ "Detokenizes", "input", "codepoints", "(", "integers", ")", "to", "UTF", "-", "8", "strings", "." ]
[ "# pylint: disable=redefined-builtin", "\"\"\"Detokenizes input codepoints (integers) to UTF-8 strings.\n\n Args:\n input: A `RaggedTensor` or `Tensor` of codepoints (ints) with a rank of at\n least 1.\n name: The name argument that is passed to the op function.\n\n Returns:\n A N-1 di...
[ { "param": "self", "type": null }, { "param": "input", "type": null }, { "param": "name", "type": null } ]
{ "returns": [ { "docstring": "A N-1 dimensional string tensor of the detokenized text.", "docstring_tokens": [ "A", "N", "-", "1", "dimensional", "string", "tensor", "of", "the", "detokenized", "text", "."...
ed06a4709041a0454b40cb09810e66bd71dde8a5
sunlongbo/chromium
tools/perf/cli_tools/soundwave/tables/bugs.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Get
<not_specific>
def Get(con, bug_id): """Find the record for a bug_id in the given database connection. Returns: A pandas.Series with the record if found, or None otherwise. """ df = pandas.read_sql( 'SELECT * FROM %s WHERE id=?' % TABLE_NAME, con, params=(bug_id,), index_col=INDEX, parse_dates=DATE_COLUMNS) ...
Find the record for a bug_id in the given database connection. Returns: A pandas.Series with the record if found, or None otherwise.
Find the record for a bug_id in the given database connection.
[ "Find", "the", "record", "for", "a", "bug_id", "in", "the", "given", "database", "connection", "." ]
def Get(con, bug_id): df = pandas.read_sql( 'SELECT * FROM %s WHERE id=?' % TABLE_NAME, con, params=(bug_id,), index_col=INDEX, parse_dates=DATE_COLUMNS) return df.loc[bug_id] if len(df) else None
[ "def", "Get", "(", "con", ",", "bug_id", ")", ":", "df", "=", "pandas", ".", "read_sql", "(", "'SELECT * FROM %s WHERE id=?'", "%", "TABLE_NAME", ",", "con", ",", "params", "=", "(", "bug_id", ",", ")", ",", "index_col", "=", "INDEX", ",", "parse_dates",...
Find the record for a bug_id in the given database connection.
[ "Find", "the", "record", "for", "a", "bug_id", "in", "the", "given", "database", "connection", "." ]
[ "\"\"\"Find the record for a bug_id in the given database connection.\n\n Returns:\n A pandas.Series with the record if found, or None otherwise.\n \"\"\"" ]
[ { "param": "con", "type": null }, { "param": "bug_id", "type": null } ]
{ "returns": [ { "docstring": "A pandas.Series with the record if found, or None otherwise.", "docstring_tokens": [ "A", "pandas", ".", "Series", "with", "the", "record", "if", "found", "or", "None", "other...
66abbd85f1a6d499b60d0b08999824f4f301a8cb
sunlongbo/chromium
testing/unexpected_passes_common/argument_parsing.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
AddCommonArguments
null
def AddCommonArguments(parser): """Adds arguments that are common to all unexpected pass finders. Args: parser: An argparse.ArgumentParser instance to add arguments to. """ parser.add_argument('--project', required=True, help='The billing project to use for BigQu...
Adds arguments that are common to all unexpected pass finders. Args: parser: An argparse.ArgumentParser instance to add arguments to.
Adds arguments that are common to all unexpected pass finders.
[ "Adds", "arguments", "that", "are", "common", "to", "all", "unexpected", "pass", "finders", "." ]
def AddCommonArguments(parser): parser.add_argument('--project', required=True, help='The billing project to use for BigQuery queries. ' 'Must have access to the ResultDB BQ tables, e.g. ' '"chrome-luci-data.chromium.gpu_ci_test_r...
[ "def", "AddCommonArguments", "(", "parser", ")", ":", "parser", ".", "add_argument", "(", "'--project'", ",", "required", "=", "True", ",", "help", "=", "'The billing project to use for BigQuery queries. '", "'Must have access to the ResultDB BQ tables, e.g. '", "'\"chrome-lu...
Adds arguments that are common to all unexpected pass finders.
[ "Adds", "arguments", "that", "are", "common", "to", "all", "unexpected", "pass", "finders", "." ]
[ "\"\"\"Adds arguments that are common to all unexpected pass finders.\n\n Args:\n parser: An argparse.ArgumentParser instance to add arguments to.\n \"\"\"" ]
[ { "param": "parser", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parser", "type": null, "docstring": "An argparse.ArgumentParser instance to add arguments to.", "docstring_tokens": [ "An", "argparse", ".", "ArgumentParser", "instance", "to", ...
66abbd85f1a6d499b60d0b08999824f4f301a8cb
sunlongbo/chromium
testing/unexpected_passes_common/argument_parsing.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
SetLoggingVerbosity
null
def SetLoggingVerbosity(args): """Sets logging verbosity based on parsed arguments. Args: args: Parsed arguments from an argparse.ArgumentParser. """ if args.quiet: args.verbose = -1 verbosity_level = args.verbose if verbosity_level == -1: level = logging.ERROR elif verbosity_level == 0: ...
Sets logging verbosity based on parsed arguments. Args: args: Parsed arguments from an argparse.ArgumentParser.
Sets logging verbosity based on parsed arguments.
[ "Sets", "logging", "verbosity", "based", "on", "parsed", "arguments", "." ]
def SetLoggingVerbosity(args): if args.quiet: args.verbose = -1 verbosity_level = args.verbose if verbosity_level == -1: level = logging.ERROR elif verbosity_level == 0: level = logging.WARNING elif verbosity_level == 1: level = logging.INFO else: level = logging.DEBUG logging.getLogge...
[ "def", "SetLoggingVerbosity", "(", "args", ")", ":", "if", "args", ".", "quiet", ":", "args", ".", "verbose", "=", "-", "1", "verbosity_level", "=", "args", ".", "verbose", "if", "verbosity_level", "==", "-", "1", ":", "level", "=", "logging", ".", "ER...
Sets logging verbosity based on parsed arguments.
[ "Sets", "logging", "verbosity", "based", "on", "parsed", "arguments", "." ]
[ "\"\"\"Sets logging verbosity based on parsed arguments.\n\n Args:\n args: Parsed arguments from an argparse.ArgumentParser.\n \"\"\"" ]
[ { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": null, "docstring": "Parsed arguments from an argparse.ArgumentParser.", "docstring_tokens": [ "Parsed", "arguments", "from", "an", "argparse", ".", "Argume...
b2af28e3c5e91ca54714d4ce04d9397dec5ea618
sunlongbo/chromium
tools/symsrc/source_index.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
FindSrcSrvFile
<not_specific>
def FindSrcSrvFile(filename, toolchain_dir): """Return the absolute path for a file in the srcsrv directory. If |toolchain_dir| is null then this will assume that the file is in this script's directory. """ bin_dir = os.path.join(toolchain_dir, 'Windows Kits', '10', 'Debuggers', 'x64...
Return the absolute path for a file in the srcsrv directory. If |toolchain_dir| is null then this will assume that the file is in this script's directory.
Return the absolute path for a file in the srcsrv directory. If |toolchain_dir| is null then this will assume that the file is in this script's directory.
[ "Return", "the", "absolute", "path", "for", "a", "file", "in", "the", "srcsrv", "directory", ".", "If", "|toolchain_dir|", "is", "null", "then", "this", "will", "assume", "that", "the", "file", "is", "in", "this", "script", "'", "s", "directory", "." ]
def FindSrcSrvFile(filename, toolchain_dir): bin_dir = os.path.join(toolchain_dir, 'Windows Kits', '10', 'Debuggers', 'x64', 'srcsrv') if not os.path.exists(bin_dir): bin_dir = os.path.join(toolchain_dir, 'win_sdk', 'Debuggers', 'x64', 'srcsrv') assert(os.pa...
[ "def", "FindSrcSrvFile", "(", "filename", ",", "toolchain_dir", ")", ":", "bin_dir", "=", "os", ".", "path", ".", "join", "(", "toolchain_dir", ",", "'Windows Kits'", ",", "'10'", ",", "'Debuggers'", ",", "'x64'", ",", "'srcsrv'", ")", "if", "not", "os", ...
Return the absolute path for a file in the srcsrv directory.
[ "Return", "the", "absolute", "path", "for", "a", "file", "in", "the", "srcsrv", "directory", "." ]
[ "\"\"\"Return the absolute path for a file in the srcsrv directory.\n\n If |toolchain_dir| is null then this will assume that the file is in this\n script's directory.\n \"\"\"" ]
[ { "param": "filename", "type": null }, { "param": "toolchain_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "toolchain_dir", "type": null, "docstring": null, "docstri...
b2af28e3c5e91ca54714d4ce04d9397dec5ea618
sunlongbo/chromium
tools/symsrc/source_index.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
RunCommand
<not_specific>
def RunCommand(*cmd, **kwargs): """Runs a command. Returns what have been printed to stdout by this command. kwargs: raise_on_failure: Indicates if an exception should be raised on failure, if set to false then the function will return None. """ kwargs.setdefault('stdin', subprocess.PIPE) kwar...
Runs a command. Returns what have been printed to stdout by this command. kwargs: raise_on_failure: Indicates if an exception should be raised on failure, if set to false then the function will return None.
Runs a command. Returns what have been printed to stdout by this command. Indicates if an exception should be raised on failure, if set to false then the function will return None.
[ "Runs", "a", "command", ".", "Returns", "what", "have", "been", "printed", "to", "stdout", "by", "this", "command", ".", "Indicates", "if", "an", "exception", "should", "be", "raised", "on", "failure", "if", "set", "to", "false", "then", "the", "function",...
def RunCommand(*cmd, **kwargs): kwargs.setdefault('stdin', subprocess.PIPE) kwargs.setdefault('stdout', subprocess.PIPE) kwargs.setdefault('stderr', subprocess.PIPE) kwargs.setdefault('universal_newlines', True) raise_on_failure = kwargs.pop('raise_on_failure', True) proc = subprocess.Popen(cmd, **kwargs) ...
[ "def", "RunCommand", "(", "*", "cmd", ",", "**", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'stdin'", ",", "subprocess", ".", "PIPE", ")", "kwargs", ".", "setdefault", "(", "'stdout'", ",", "subprocess", ".", "PIPE", ")", "kwargs", ".", "se...
Runs a command.
[ "Runs", "a", "command", "." ]
[ "\"\"\"Runs a command.\n\n Returns what have been printed to stdout by this command.\n\n kwargs:\n raise_on_failure: Indicates if an exception should be raised on failure, if\n set to false then the function will return None.\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
b2af28e3c5e91ca54714d4ce04d9397dec5ea618
sunlongbo/chromium
tools/symsrc/source_index.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ExtractSourceFiles
<not_specific>
def ExtractSourceFiles(pdb_filename, toolchain_dir): """Extract a list of local paths of the source files from a PDB.""" # Don't use |RunCommand| as it expect the return code to be 0 on success but # srctool returns the number of files instead. srctool = subprocess.Popen([FindSrcSrvFile('srctool.exe', toolchai...
Extract a list of local paths of the source files from a PDB.
Extract a list of local paths of the source files from a PDB.
[ "Extract", "a", "list", "of", "local", "paths", "of", "the", "source", "files", "from", "a", "PDB", "." ]
def ExtractSourceFiles(pdb_filename, toolchain_dir): srctool = subprocess.Popen([FindSrcSrvFile('srctool.exe', toolchain_dir), '-r', pdb_filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) src_fil...
[ "def", "ExtractSourceFiles", "(", "pdb_filename", ",", "toolchain_dir", ")", ":", "srctool", "=", "subprocess", ".", "Popen", "(", "[", "FindSrcSrvFile", "(", "'srctool.exe'", ",", "toolchain_dir", ")", ",", "'-r'", ",", "pdb_filename", "]", ",", "stdout", "="...
Extract a list of local paths of the source files from a PDB.
[ "Extract", "a", "list", "of", "local", "paths", "of", "the", "source", "files", "from", "a", "PDB", "." ]
[ "\"\"\"Extract a list of local paths of the source files from a PDB.\"\"\"", "# Don't use |RunCommand| as it expect the return code to be 0 on success but", "# srctool returns the number of files instead." ]
[ { "param": "pdb_filename", "type": null }, { "param": "toolchain_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pdb_filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "toolchain_dir", "type": null, "docstring": null, "doc...
b2af28e3c5e91ca54714d4ce04d9397dec5ea618
sunlongbo/chromium
tools/symsrc/source_index.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ReadSourceStream
<not_specific>
def ReadSourceStream(pdb_filename, toolchain_dir): """Read the contents of the source information stream from a PDB.""" pdbstr = subprocess.Popen([FindSrcSrvFile('pdbstr.exe', toolchain_dir), '-r', '-s:srcsrv', '-p:%s' % pdb_filename], ...
Read the contents of the source information stream from a PDB.
Read the contents of the source information stream from a PDB.
[ "Read", "the", "contents", "of", "the", "source", "information", "stream", "from", "a", "PDB", "." ]
def ReadSourceStream(pdb_filename, toolchain_dir): pdbstr = subprocess.Popen([FindSrcSrvFile('pdbstr.exe', toolchain_dir), '-r', '-s:srcsrv', '-p:%s' % pdb_filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE) data, _ = pd...
[ "def", "ReadSourceStream", "(", "pdb_filename", ",", "toolchain_dir", ")", ":", "pdbstr", "=", "subprocess", ".", "Popen", "(", "[", "FindSrcSrvFile", "(", "'pdbstr.exe'", ",", "toolchain_dir", ")", ",", "'-r'", ",", "'-s:srcsrv'", ",", "'-p:%s'", "%", "pdb_fi...
Read the contents of the source information stream from a PDB.
[ "Read", "the", "contents", "of", "the", "source", "information", "stream", "from", "a", "PDB", "." ]
[ "\"\"\"Read the contents of the source information stream from a PDB.\"\"\"", "# Old version of pdbstr.exe return -1 when the source requested stream is", "# missing, while more recent ones return 1, use |abs| to workaround this." ]
[ { "param": "pdb_filename", "type": null }, { "param": "toolchain_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pdb_filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "toolchain_dir", "type": null, "docstring": null, "doc...
b2af28e3c5e91ca54714d4ce04d9397dec5ea618
sunlongbo/chromium
tools/symsrc/source_index.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
WriteSourceStream
null
def WriteSourceStream(pdb_filename, data, toolchain_dir): """Write the contents of the source information stream to a PDB.""" # Write out the data to a temporary filename that we can pass to pdbstr. (f, fname) = tempfile.mkstemp() f = os.fdopen(f, "wb") f.write(data.encode('utf-8')) f.close() srctool = s...
Write the contents of the source information stream to a PDB.
Write the contents of the source information stream to a PDB.
[ "Write", "the", "contents", "of", "the", "source", "information", "stream", "to", "a", "PDB", "." ]
def WriteSourceStream(pdb_filename, data, toolchain_dir): (f, fname) = tempfile.mkstemp() f = os.fdopen(f, "wb") f.write(data.encode('utf-8')) f.close() srctool = subprocess.Popen([FindSrcSrvFile('pdbstr.exe', toolchain_dir), '-w', '-s:srcsrv', '-i:%...
[ "def", "WriteSourceStream", "(", "pdb_filename", ",", "data", ",", "toolchain_dir", ")", ":", "(", "f", ",", "fname", ")", "=", "tempfile", ".", "mkstemp", "(", ")", "f", "=", "os", ".", "fdopen", "(", "f", ",", "\"wb\"", ")", "f", ".", "write", "(...
Write the contents of the source information stream to a PDB.
[ "Write", "the", "contents", "of", "the", "source", "information", "stream", "to", "a", "PDB", "." ]
[ "\"\"\"Write the contents of the source information stream to a PDB.\"\"\"", "# Write out the data to a temporary filename that we can pass to pdbstr." ]
[ { "param": "pdb_filename", "type": null }, { "param": "data", "type": null }, { "param": "toolchain_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pdb_filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": null, "docstring_to...
b2af28e3c5e91ca54714d4ce04d9397dec5ea618
sunlongbo/chromium
tools/symsrc/source_index.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ExtractGitInfo
<not_specific>
def ExtractGitInfo(local_filename): """Checks if a file is coming from a git repository and if so returns some information about it. Args: local_filename: The name of the file that we want to check. Returns: None if the file doesn't come from a git repository, otherwise it returns a RevisionInfo t...
Checks if a file is coming from a git repository and if so returns some information about it. Args: local_filename: The name of the file that we want to check. Returns: None if the file doesn't come from a git repository, otherwise it returns a RevisionInfo tuple.
Checks if a file is coming from a git repository and if so returns some information about it.
[ "Checks", "if", "a", "file", "is", "coming", "from", "a", "git", "repository", "and", "if", "so", "returns", "some", "information", "about", "it", "." ]
def ExtractGitInfo(local_filename): local_filename = GetCasedFilePath(local_filename) local_file_basename = os.path.basename(local_filename) local_file_dir = os.path.dirname(local_filename) file_info = RunCommand('git.bat', 'log', '-n', '1', local_file_basename, cwd=local_file_dir, rai...
[ "def", "ExtractGitInfo", "(", "local_filename", ")", ":", "local_filename", "=", "GetCasedFilePath", "(", "local_filename", ")", "local_file_basename", "=", "os", ".", "path", ".", "basename", "(", "local_filename", ")", "local_file_dir", "=", "os", ".", "path", ...
Checks if a file is coming from a git repository and if so returns some information about it.
[ "Checks", "if", "a", "file", "is", "coming", "from", "a", "git", "repository", "and", "if", "so", "returns", "some", "information", "about", "it", "." ]
[ "\"\"\"Checks if a file is coming from a git repository and if so returns some\n information about it.\n\n Args:\n local_filename: The name of the file that we want to check.\n\n Returns:\n None if the file doesn't come from a git repository, otherwise it returns a\n RevisionInfo tuple.\n \"\"\"", "#...
[ { "param": "local_filename", "type": null } ]
{ "returns": [ { "docstring": "None if the file doesn't come from a git repository, otherwise it returns a\nRevisionInfo tuple.", "docstring_tokens": [ "None", "if", "the", "file", "doesn", "'", "t", "come", "from", "a", ...
b2af28e3c5e91ca54714d4ce04d9397dec5ea618
sunlongbo/chromium
tools/symsrc/source_index.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CheckForJunction
<not_specific>
def CheckForJunction(filename): """Check if a directory containing a file is a junction to another directory. If so return 3 values: - The real path to this file. - The root directory of this checkout relative to |filename| (i.e. not relative to the real path). - The sub directory of the ...
Check if a directory containing a file is a junction to another directory. If so return 3 values: - The real path to this file. - The root directory of this checkout relative to |filename| (i.e. not relative to the real path). - The sub directory of the repository that has been checked out....
Check if a directory containing a file is a junction to another directory. If so return 3 values: The real path to this file. The root directory of this checkout relative to |filename| . The sub directory of the repository that has been checked out.
[ "Check", "if", "a", "directory", "containing", "a", "file", "is", "a", "junction", "to", "another", "directory", ".", "If", "so", "return", "3", "values", ":", "The", "real", "path", "to", "this", "file", ".", "The", "root", "directory", "of", "this", ...
def CheckForJunction(filename): Here's an example of what this does, for this example |filename| = 'C:/a/b/c/d.h' and 'C:/a' is a junction to 'C:/real_a/'. - We remove the filename part (we're only looking at directory junctions here), that left us with 'C:/a/b/c'. - During the first iteration we take ...
[ "def", "CheckForJunction", "(", "filename", ")", ":", "cur_root", ",", "cur_leaf", "=", "os", ".", "path", ".", "split", "(", "os", ".", "path", ".", "dirname", "(", "filename", ")", ")", "while", "cur_leaf", ":", "dir_cmd", "=", "RunCommand", "(", "'c...
Check if a directory containing a file is a junction to another directory.
[ "Check", "if", "a", "directory", "containing", "a", "file", "is", "a", "junction", "to", "another", "directory", "." ]
[ "\"\"\"Check if a directory containing a file is a junction to another directory.\n\n If so return 3 values:\n - The real path to this file.\n - The root directory of this checkout relative to |filename| (i.e. not\n relative to the real path).\n - The sub directory of the repository that has ...
[ { "param": "filename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b2af28e3c5e91ca54714d4ce04d9397dec5ea618
sunlongbo/chromium
tools/symsrc/source_index.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
IndexFilesFromRepo
<not_specific>
def IndexFilesFromRepo( local_filename, file_list, output_lines, follow_junctions): """Checks if a given file is a part of a Git repository and index all the files from this repository if it's the case. Args: local_filename: The filename of the current file. file_list: The list of files that should ...
Checks if a given file is a part of a Git repository and index all the files from this repository if it's the case. Args: local_filename: The filename of the current file. file_list: The list of files that should be indexed. output_lines: The source indexing lines that will be appended to the PDB. ...
Checks if a given file is a part of a Git repository and index all the files from this repository if it's the case.
[ "Checks", "if", "a", "given", "file", "is", "a", "part", "of", "a", "Git", "repository", "and", "index", "all", "the", "files", "from", "this", "repository", "if", "it", "'", "s", "the", "case", "." ]
def IndexFilesFromRepo( local_filename, file_list, output_lines, follow_junctions): indexed_files = 0 patch_root = None info = ExtractGitInfo(local_filename) if not info and follow_junctions: real_filename, patch_root, patch_leaf = CheckForJunction(local_filename) if real_filename: info = Extr...
[ "def", "IndexFilesFromRepo", "(", "local_filename", ",", "file_list", ",", "output_lines", ",", "follow_junctions", ")", ":", "indexed_files", "=", "0", "patch_root", "=", "None", "info", "=", "ExtractGitInfo", "(", "local_filename", ")", "if", "not", "info", "a...
Checks if a given file is a part of a Git repository and index all the files from this repository if it's the case.
[ "Checks", "if", "a", "given", "file", "is", "a", "part", "of", "a", "Git", "repository", "and", "index", "all", "the", "files", "from", "this", "repository", "if", "it", "'", "s", "the", "case", "." ]
[ "\"\"\"Checks if a given file is a part of a Git repository and index all the\n files from this repository if it's the case.\n\n Args:\n local_filename: The filename of the current file.\n file_list: The list of files that should be indexed.\n output_lines: The source indexing lines that will be appende...
[ { "param": "local_filename", "type": null }, { "param": "file_list", "type": null }, { "param": "output_lines", "type": null }, { "param": "follow_junctions", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "local_filename", "type": null, "docstring": "The filename of the current file.", "docstring_tokens": [ "The", "filename", "of", "the", "current", "file", "." ], ...
b2af28e3c5e91ca54714d4ce04d9397dec5ea618
sunlongbo/chromium
tools/symsrc/source_index.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
UpdatePDB
null
def UpdatePDB(pdb_filename, verbose=True, build_dir=None, toolchain_dir=None, follow_junctions=False): """Update a pdb file with source information.""" dir_exclusion_list = { } if build_dir: # Excluding the build directory allows skipping the generated files, for # Chromium this makes the i...
Update a pdb file with source information.
Update a pdb file with source information.
[ "Update", "a", "pdb", "file", "with", "source", "information", "." ]
def UpdatePDB(pdb_filename, verbose=True, build_dir=None, toolchain_dir=None, follow_junctions=False): dir_exclusion_list = { } if build_dir: build_dir = (os.path.normpath(build_dir)).lower() for directory, _, _ in os.walk(build_dir): dir_exclusion_list[directory.lower()] = True dir_...
[ "def", "UpdatePDB", "(", "pdb_filename", ",", "verbose", "=", "True", ",", "build_dir", "=", "None", ",", "toolchain_dir", "=", "None", ",", "follow_junctions", "=", "False", ")", ":", "dir_exclusion_list", "=", "{", "}", "if", "build_dir", ":", "build_dir",...
Update a pdb file with source information.
[ "Update", "a", "pdb", "file", "with", "source", "information", "." ]
[ "\"\"\"Update a pdb file with source information.\"\"\"", "# Excluding the build directory allows skipping the generated files, for", "# Chromium this makes the indexing ~10x faster.", "# Exclude the directories from the toolchain as we don't have revision info", "# for them.", "# Writes the header of the...
[ { "param": "pdb_filename", "type": null }, { "param": "verbose", "type": null }, { "param": "build_dir", "type": null }, { "param": "toolchain_dir", "type": null }, { "param": "follow_junctions", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pdb_filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "verbose", "type": null, "docstring": null, "docstring...
c9ab2fd566cc0b43fc621ee0155bf57b014e6e67
sunlongbo/chromium
components/policy/tools/make_policy_zip.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
main
null
def main(): """Pack a list of files into a zip archive. Args: output: The file path of the zip archive. base_dir: Base path of input files. languages: Comma-separated list of languages, e.g. en-US,de. add: List of files to include in the archive. The language placeholder ${lang} is expande...
Pack a list of files into a zip archive. Args: output: The file path of the zip archive. base_dir: Base path of input files. languages: Comma-separated list of languages, e.g. en-US,de. add: List of files to include in the archive. The language placeholder ${lang} is expanded into one file f...
Pack a list of files into a zip archive.
[ "Pack", "a", "list", "of", "files", "into", "a", "zip", "archive", "." ]
def main(): parser = argparse.ArgumentParser() parser.add_argument("--output", dest="output") parser.add_argument("--timestamp", type=int, metavar="TIME", help="Unix timestamp to use for files in the archive") parser.add_argument("--base_dir", de...
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "\"--output\"", ",", "dest", "=", "\"output\"", ")", "parser", ".", "add_argument", "(", "\"--timestamp\"", ",", "type", "=", "int...
Pack a list of files into a zip archive.
[ "Pack", "a", "list", "of", "files", "into", "a", "zip", "archive", "." ]
[ "\"\"\"Pack a list of files into a zip archive.\n\n Args:\n output: The file path of the zip archive.\n base_dir: Base path of input files.\n languages: Comma-separated list of languages, e.g. en-US,de.\n add: List of files to include in the archive. The language placeholder\n ${lang} is expand...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [ { "identifier": "output", "type": null, "docstring": "The file path of the zip archive.", "docstring_tokens": [ "The", "file", "path", "of", "the", "zip", "archive...
c9bee9433b7db32307767d8917822be9f1145eb9
sunlongbo/chromium
tools/usb_gadget/gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
AddDeviceCapabilityDescriptor
null
def AddDeviceCapabilityDescriptor(self, device_capability): """Add a device capability descriptor to this device. Args: device_capability: The Descriptor object. """ if self._bos_descriptor is None: self._bos_descriptor = usb_descriptors.BosDescriptor() self._bos_descriptor.AddDeviceCap...
Add a device capability descriptor to this device. Args: device_capability: The Descriptor object.
Add a device capability descriptor to this device.
[ "Add", "a", "device", "capability", "descriptor", "to", "this", "device", "." ]
def AddDeviceCapabilityDescriptor(self, device_capability): if self._bos_descriptor is None: self._bos_descriptor = usb_descriptors.BosDescriptor() self._bos_descriptor.AddDeviceCapability(device_capability)
[ "def", "AddDeviceCapabilityDescriptor", "(", "self", ",", "device_capability", ")", ":", "if", "self", ".", "_bos_descriptor", "is", "None", ":", "self", ".", "_bos_descriptor", "=", "usb_descriptors", ".", "BosDescriptor", "(", ")", "self", ".", "_bos_descriptor"...
Add a device capability descriptor to this device.
[ "Add", "a", "device", "capability", "descriptor", "to", "this", "device", "." ]
[ "\"\"\"Add a device capability descriptor to this device.\n\n Args:\n device_capability: The Descriptor object.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "device_capability", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "device_capability", "type": null, "docstring": "The Descriptor obje...
c9bee9433b7db32307767d8917822be9f1145eb9
sunlongbo/chromium
tools/usb_gadget/gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Disconnected
null
def Disconnected(self): """The device has been disconnected from the USB host.""" self._speed = usb_constants.Speed.UNKNOWN self._chip = None self._active_endpoints.clear() self._endpoint_interface_map.clear()
The device has been disconnected from the USB host.
The device has been disconnected from the USB host.
[ "The", "device", "has", "been", "disconnected", "from", "the", "USB", "host", "." ]
def Disconnected(self): self._speed = usb_constants.Speed.UNKNOWN self._chip = None self._active_endpoints.clear() self._endpoint_interface_map.clear()
[ "def", "Disconnected", "(", "self", ")", ":", "self", ".", "_speed", "=", "usb_constants", ".", "Speed", ".", "UNKNOWN", "self", ".", "_chip", "=", "None", "self", ".", "_active_endpoints", ".", "clear", "(", ")", "self", ".", "_endpoint_interface_map", "....
The device has been disconnected from the USB host.
[ "The", "device", "has", "been", "disconnected", "from", "the", "USB", "host", "." ]
[ "\"\"\"The device has been disconnected from the USB host.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c9bee9433b7db32307767d8917822be9f1145eb9
sunlongbo/chromium
tools/usb_gadget/gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetDescriptor
<not_specific>
def GetDescriptor(self, recipient, typ, index, lang, length): """Handle a standard GET_DESCRIPTOR request. See Universal Serial Bus Specification Revision 2.0 section 9.4.3. Args: recipient: Request recipient (device, interface, endpoint, etc.) typ: Descriptor type. index: Descriptor ind...
Handle a standard GET_DESCRIPTOR request. See Universal Serial Bus Specification Revision 2.0 section 9.4.3. Args: recipient: Request recipient (device, interface, endpoint, etc.) typ: Descriptor type. index: Descriptor index. lang: Descriptor language code. length: Maximum amoun...
Handle a standard GET_DESCRIPTOR request.
[ "Handle", "a", "standard", "GET_DESCRIPTOR", "request", "." ]
def GetDescriptor(self, recipient, typ, index, lang, length): if typ == usb_constants.DescriptorType.STRING: return self.GetStringDescriptor(index, lang, length) elif typ == usb_constants.DescriptorType.BOS: return self.GetBosDescriptor(length)
[ "def", "GetDescriptor", "(", "self", ",", "recipient", ",", "typ", ",", "index", ",", "lang", ",", "length", ")", ":", "if", "typ", "==", "usb_constants", ".", "DescriptorType", ".", "STRING", ":", "return", "self", ".", "GetStringDescriptor", "(", "index"...
Handle a standard GET_DESCRIPTOR request.
[ "Handle", "a", "standard", "GET_DESCRIPTOR", "request", "." ]
[ "\"\"\"Handle a standard GET_DESCRIPTOR request.\n\n See Universal Serial Bus Specification Revision 2.0 section 9.4.3.\n\n Args:\n recipient: Request recipient (device, interface, endpoint, etc.)\n typ: Descriptor type.\n index: Descriptor index.\n lang: Descriptor language code.\n l...
[ { "param": "self", "type": null }, { "param": "recipient", "type": null }, { "param": "typ", "type": null }, { "param": "index", "type": null }, { "param": "lang", "type": null }, { "param": "length", "type": null } ]
{ "returns": [ { "docstring": "The value of the descriptor or None to stall the pipe.", "docstring_tokens": [ "The", "value", "of", "the", "descriptor", "or", "None", "to", "stall", "the", "pipe", "." ...
c9bee9433b7db32307767d8917822be9f1145eb9
sunlongbo/chromium
tools/usb_gadget/gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
VendorControlRead
<not_specific>
def VendorControlRead(self, recipient, request, value, index, length): """Handle vendor-specific control transfers. This function should be overridden by a subclass if implementing a device that responds to vendor-specific requests. Args: recipient: Request recipient (device, interface, endpoint...
Handle vendor-specific control transfers. This function should be overridden by a subclass if implementing a device that responds to vendor-specific requests. Args: recipient: Request recipient (device, interface, endpoint, etc.) request: bRequest field of the setup packet. value: wValue...
Handle vendor-specific control transfers. This function should be overridden by a subclass if implementing a device that responds to vendor-specific requests.
[ "Handle", "vendor", "-", "specific", "control", "transfers", ".", "This", "function", "should", "be", "overridden", "by", "a", "subclass", "if", "implementing", "a", "device", "that", "responds", "to", "vendor", "-", "specific", "requests", "." ]
def VendorControlRead(self, recipient, request, value, index, length): if (self._ms_vendor_code_v1 is not None and request == self._ms_vendor_code_v1 and (recipient == usb_constants.Recipient.DEVICE or recipient == usb_constants.Recipient.INTERFACE)): return self.GetMicrosoftOSDescrip...
[ "def", "VendorControlRead", "(", "self", ",", "recipient", ",", "request", ",", "value", ",", "index", ",", "length", ")", ":", "if", "(", "self", ".", "_ms_vendor_code_v1", "is", "not", "None", "and", "request", "==", "self", ".", "_ms_vendor_code_v1", "a...
Handle vendor-specific control transfers.
[ "Handle", "vendor", "-", "specific", "control", "transfers", "." ]
[ "\"\"\"Handle vendor-specific control transfers.\n\n This function should be overridden by a subclass if implementing a device\n that responds to vendor-specific requests.\n\n Args:\n recipient: Request recipient (device, interface, endpoint, etc.)\n request: bRequest field of the setup packet.\n...
[ { "param": "self", "type": null }, { "param": "recipient", "type": null }, { "param": "request", "type": null }, { "param": "value", "type": null }, { "param": "index", "type": null }, { "param": "length", "type": null } ]
{ "returns": [ { "docstring": "A buffer to return to the USB host with len <= length on success or\nNone to stall the pipe.", "docstring_tokens": [ "A", "buffer", "to", "return", "to", "the", "USB", "host", "with", "len", ...
c9bee9433b7db32307767d8917822be9f1145eb9
sunlongbo/chromium
tools/usb_gadget/gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetStringDescriptor
<not_specific>
def GetStringDescriptor(self, index, lang, length): """Handle a GET_DESCRIPTOR(String) request from the host. Descriptor index 0 returns the set of languages supported by the device. All other indices return the string descriptors registered with those indices. See Universal Serial Bus Specificati...
Handle a GET_DESCRIPTOR(String) request from the host. Descriptor index 0 returns the set of languages supported by the device. All other indices return the string descriptors registered with those indices. See Universal Serial Bus Specification Revision 2.0 section 9.6.7. Args: index: Desc...
Handle a GET_DESCRIPTOR(String) request from the host. Descriptor index 0 returns the set of languages supported by the device. All other indices return the string descriptors registered with those indices.
[ "Handle", "a", "GET_DESCRIPTOR", "(", "String", ")", "request", "from", "the", "host", ".", "Descriptor", "index", "0", "returns", "the", "set", "of", "languages", "supported", "by", "the", "device", ".", "All", "other", "indices", "return", "the", "string",...
def GetStringDescriptor(self, index, lang, length): if index == 0: length = 2 + len(self._strings) * 2 header = struct.pack('<BB', length, usb_constants.DescriptorType.STRING) lang_codes = [struct.pack('<H', lang) for lang in self._strings.iterkeys()] buf = header + ''.jo...
[ "def", "GetStringDescriptor", "(", "self", ",", "index", ",", "lang", ",", "length", ")", ":", "if", "index", "==", "0", ":", "length", "=", "2", "+", "len", "(", "self", ".", "_strings", ")", "*", "2", "header", "=", "struct", ".", "pack", "(", ...
Handle a GET_DESCRIPTOR(String) request from the host.
[ "Handle", "a", "GET_DESCRIPTOR", "(", "String", ")", "request", "from", "the", "host", "." ]
[ "\"\"\"Handle a GET_DESCRIPTOR(String) request from the host.\n\n Descriptor index 0 returns the set of languages supported by the device.\n All other indices return the string descriptors registered with those\n indices.\n\n See Universal Serial Bus Specification Revision 2.0 section 9.6.7.\n\n Args...
[ { "param": "self", "type": null }, { "param": "index", "type": null }, { "param": "lang", "type": null }, { "param": "length", "type": null } ]
{ "returns": [ { "docstring": "The string descriptor or None to stall the pipe if the descriptor is not\nfound.", "docstring_tokens": [ "The", "string", "descriptor", "or", "None", "to", "stall", "the", "pipe", "if", ...
c9bee9433b7db32307767d8917822be9f1145eb9
sunlongbo/chromium
tools/usb_gadget/gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetMicrosoftOSDescriptorV1
<not_specific>
def GetMicrosoftOSDescriptorV1(self, recipient, value, index, length): """Handle a the Microsoft OS 1.0 Descriptor request from the host. See https://msdn.microsoft.com/en-us/windows/hardware/gg463179 for the format of these descriptors. Args: recipient: Request recipient (device or interface) ...
Handle a the Microsoft OS 1.0 Descriptor request from the host. See https://msdn.microsoft.com/en-us/windows/hardware/gg463179 for the format of these descriptors. Args: recipient: Request recipient (device or interface) value: wValue field of the setup packet. index: wIndex field of the...
Handle a the Microsoft OS 1.0 Descriptor request from the host.
[ "Handle", "a", "the", "Microsoft", "OS", "1", ".", "0", "Descriptor", "request", "from", "the", "host", "." ]
def GetMicrosoftOSDescriptorV1(self, recipient, value, index, length): _ = recipient, value if index == 0x0004: return self.GetMicrosoftCompatIds(length)
[ "def", "GetMicrosoftOSDescriptorV1", "(", "self", ",", "recipient", ",", "value", ",", "index", ",", "length", ")", ":", "_", "=", "recipient", ",", "value", "if", "index", "==", "0x0004", ":", "return", "self", ".", "GetMicrosoftCompatIds", "(", "length", ...
Handle a the Microsoft OS 1.0 Descriptor request from the host.
[ "Handle", "a", "the", "Microsoft", "OS", "1", ".", "0", "Descriptor", "request", "from", "the", "host", "." ]
[ "\"\"\"Handle a the Microsoft OS 1.0 Descriptor request from the host.\n\n See https://msdn.microsoft.com/en-us/windows/hardware/gg463179 for the\n format of these descriptors.\n\n Args:\n recipient: Request recipient (device or interface)\n value: wValue field of the setup packet.\n index: ...
[ { "param": "self", "type": null }, { "param": "recipient", "type": null }, { "param": "value", "type": null }, { "param": "index", "type": null }, { "param": "length", "type": null } ]
{ "returns": [ { "docstring": "The descriptor or None to stall the pipe if the descriptor is not\nsupported.", "docstring_tokens": [ "The", "descriptor", "or", "None", "to", "stall", "the", "pipe", "if", "the", "de...
c9bee9433b7db32307767d8917822be9f1145eb9
sunlongbo/chromium
tools/usb_gadget/gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetBosDescriptor
<not_specific>
def GetBosDescriptor(self, length): """Handle a GET_DESCRIPTOR(BOS) request from the host. Device capability descriptors can be added to the Binary Device Object Store returned by this method by calling AddDeviceCapabilityDescriptor. See Universal Serial Bus 3.1 Specification, Revision 1.0 section 9.6...
Handle a GET_DESCRIPTOR(BOS) request from the host. Device capability descriptors can be added to the Binary Device Object Store returned by this method by calling AddDeviceCapabilityDescriptor. See Universal Serial Bus 3.1 Specification, Revision 1.0 section 9.6.2. Args: length: Maximum amount...
Handle a GET_DESCRIPTOR(BOS) request from the host. Device capability descriptors can be added to the Binary Device Object Store returned by this method by calling AddDeviceCapabilityDescriptor.
[ "Handle", "a", "GET_DESCRIPTOR", "(", "BOS", ")", "request", "from", "the", "host", ".", "Device", "capability", "descriptors", "can", "be", "added", "to", "the", "Binary", "Device", "Object", "Store", "returned", "by", "this", "method", "by", "calling", "Ad...
def GetBosDescriptor(self, length): if self._bos_descriptor is None: return None return self._bos_descriptor.Encode()[:length]
[ "def", "GetBosDescriptor", "(", "self", ",", "length", ")", ":", "if", "self", ".", "_bos_descriptor", "is", "None", ":", "return", "None", "return", "self", ".", "_bos_descriptor", ".", "Encode", "(", ")", "[", ":", "length", "]" ]
Handle a GET_DESCRIPTOR(BOS) request from the host.
[ "Handle", "a", "GET_DESCRIPTOR", "(", "BOS", ")", "request", "from", "the", "host", "." ]
[ "\"\"\"Handle a GET_DESCRIPTOR(BOS) request from the host.\n\n Device capability descriptors can be added to the Binary Device Object Store\n returned by this method by calling AddDeviceCapabilityDescriptor.\n\n See Universal Serial Bus 3.1 Specification, Revision 1.0 section 9.6.2.\n\n Args:\n len...
[ { "param": "self", "type": null }, { "param": "length", "type": null } ]
{ "returns": [ { "docstring": "The device's binary object store descriptor or None to stall the pipe if\nno device capability descriptors have been configured.", "docstring_tokens": [ "The", "device", "'", "s", "binary", "object", "store", ...
c9bee9433b7db32307767d8917822be9f1145eb9
sunlongbo/chromium
tools/usb_gadget/gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
SetConfiguration
<not_specific>
def SetConfiguration(self, index): """Handle a SET_CONFIGURATION request from the host. See Universal Serial Bus Specification Revision 2.0 section 9.4.7. Args: index: Configuration index selected. Returns: True on success, None on error to stall the pipe. """ print('SetConfigurat...
Handle a SET_CONFIGURATION request from the host. See Universal Serial Bus Specification Revision 2.0 section 9.4.7. Args: index: Configuration index selected. Returns: True on success, None on error to stall the pipe.
Handle a SET_CONFIGURATION request from the host.
[ "Handle", "a", "SET_CONFIGURATION", "request", "from", "the", "host", "." ]
def SetConfiguration(self, index): print('SetConfiguration({})'.format(index)) for endpoint_addrs in self._active_endpoints.values(): for endpoint_addr in endpoint_addrs: self._chip.StopEndpoint(endpoint_addr) endpoint_addrs.clear() self._endpoint_interface_map.clear(); if index == 0...
[ "def", "SetConfiguration", "(", "self", ",", "index", ")", ":", "print", "(", "'SetConfiguration({})'", ".", "format", "(", "index", ")", ")", "for", "endpoint_addrs", "in", "self", ".", "_active_endpoints", ".", "values", "(", ")", ":", "for", "endpoint_add...
Handle a SET_CONFIGURATION request from the host.
[ "Handle", "a", "SET_CONFIGURATION", "request", "from", "the", "host", "." ]
[ "\"\"\"Handle a SET_CONFIGURATION request from the host.\n\n See Universal Serial Bus Specification Revision 2.0 section 9.4.7.\n\n Args:\n index: Configuration index selected.\n\n Returns:\n True on success, None on error to stall the pipe.\n \"\"\"", "# SET_CONFIGRATION(0) puts the device ...
[ { "param": "self", "type": null }, { "param": "index", "type": null } ]
{ "returns": [ { "docstring": "True on success, None on error to stall the pipe.", "docstring_tokens": [ "True", "on", "success", "None", "on", "error", "to", "stall", "the", "pipe", "." ], "type": null...
c9bee9433b7db32307767d8917822be9f1145eb9
sunlongbo/chromium
tools/usb_gadget/gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
SetInterface
<not_specific>
def SetInterface(self, interface, alt_setting): """Handle a SET_INTERFACE request from the host. See Universal Serial Bus Specification Revision 2.0 section 9.4.10. Args: interface: Interface number to configure. alt_setting: Alternate setting to select. Returns: True on success, No...
Handle a SET_INTERFACE request from the host. See Universal Serial Bus Specification Revision 2.0 section 9.4.10. Args: interface: Interface number to configure. alt_setting: Alternate setting to select. Returns: True on success, None on error to stall the pipe.
Handle a SET_INTERFACE request from the host.
[ "Handle", "a", "SET_INTERFACE", "request", "from", "the", "host", "." ]
def SetInterface(self, interface, alt_setting): print('SetInterface({}, {})'.format(interface, alt_setting)) config_desc = self.GetConfigurationDescriptor() interface_desc = None for interface_option in config_desc.GetInterfaces(): if (interface_option.bInterfaceNumber == interface and i...
[ "def", "SetInterface", "(", "self", ",", "interface", ",", "alt_setting", ")", ":", "print", "(", "'SetInterface({}, {})'", ".", "format", "(", "interface", ",", "alt_setting", ")", ")", "config_desc", "=", "self", ".", "GetConfigurationDescriptor", "(", ")", ...
Handle a SET_INTERFACE request from the host.
[ "Handle", "a", "SET_INTERFACE", "request", "from", "the", "host", "." ]
[ "\"\"\"Handle a SET_INTERFACE request from the host.\n\n See Universal Serial Bus Specification Revision 2.0 section 9.4.10.\n\n Args:\n interface: Interface number to configure.\n alt_setting: Alternate setting to select.\n\n Returns:\n True on success, None on error to stall the pipe.\n ...
[ { "param": "self", "type": null }, { "param": "interface", "type": null }, { "param": "alt_setting", "type": null } ]
{ "returns": [ { "docstring": "True on success, None on error to stall the pipe.", "docstring_tokens": [ "True", "on", "success", "None", "on", "error", "to", "stall", "the", "pipe", "." ], "type": null...
5136d6eed09be9115ed32a15964fa0668cf15a24
sunlongbo/chromium
tools/perf/benchmarks/benchmark_unittest.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
testBenchmarkOptions
null
def testBenchmarkOptions(self): """Tests whether benchmark options can be constructed without errors.""" try: options_for_unittests.GetRunOptions(benchmark_cls=benchmark) except benchmark_module.InvalidOptionsError as exc: self.fail(str(exc))
Tests whether benchmark options can be constructed without errors.
Tests whether benchmark options can be constructed without errors.
[ "Tests", "whether", "benchmark", "options", "can", "be", "constructed", "without", "errors", "." ]
def testBenchmarkOptions(self): try: options_for_unittests.GetRunOptions(benchmark_cls=benchmark) except benchmark_module.InvalidOptionsError as exc: self.fail(str(exc))
[ "def", "testBenchmarkOptions", "(", "self", ")", ":", "try", ":", "options_for_unittests", ".", "GetRunOptions", "(", "benchmark_cls", "=", "benchmark", ")", "except", "benchmark_module", ".", "InvalidOptionsError", "as", "exc", ":", "self", ".", "fail", "(", "s...
Tests whether benchmark options can be constructed without errors.
[ "Tests", "whether", "benchmark", "options", "can", "be", "constructed", "without", "errors", "." ]
[ "\"\"\"Tests whether benchmark options can be constructed without errors.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
513a015d1429c5496689ed00298e63bfd14c7732
sunlongbo/chromium
tools/perf/core/results_processor/util.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ApplyInParallel
<not_specific>
def ApplyInParallel(function, work_list, on_failure=None): """Apply a function to all values in work_list in parallel. Args: function: A function with one argument. work_list: Any iterable with arguments for the function. on_failure: A function to run in case of a failure. """ if not work_list: ...
Apply a function to all values in work_list in parallel. Args: function: A function with one argument. work_list: Any iterable with arguments for the function. on_failure: A function to run in case of a failure.
Apply a function to all values in work_list in parallel.
[ "Apply", "a", "function", "to", "all", "values", "in", "work_list", "in", "parallel", "." ]
def ApplyInParallel(function, work_list, on_failure=None): if not work_list: return try: cpu_count = multiprocessing.cpu_count() // 2 if sys.platform == 'win32': cpu_count = min(cpu_count, 56) except NotImplementedError: logging.warning('cpu_count() not implemented.') cpu_count = 4 poo...
[ "def", "ApplyInParallel", "(", "function", ",", "work_list", ",", "on_failure", "=", "None", ")", ":", "if", "not", "work_list", ":", "return", "try", ":", "cpu_count", "=", "multiprocessing", ".", "cpu_count", "(", ")", "//", "2", "if", "sys", ".", "pla...
Apply a function to all values in work_list in parallel.
[ "Apply", "a", "function", "to", "all", "values", "in", "work_list", "in", "parallel", "." ]
[ "\"\"\"Apply a function to all values in work_list in parallel.\n\n Args:\n function: A function with one argument.\n work_list: Any iterable with arguments for the function.\n on_failure: A function to run in case of a failure.\n \"\"\"", "# Note that this is speculatively halved as an attempt to fix"...
[ { "param": "function", "type": null }, { "param": "work_list", "type": null }, { "param": "on_failure", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "function", "type": null, "docstring": "A function with one argument.", "docstring_tokens": [ "A", "function", "with", "one", "argument", "." ], "default": null, ...
5151d3093327a62ffd2830c45ede716c88b24faa
sunlongbo/chromium
components/policy/tools/schema_validator.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ValidateSchema
<not_specific>
def ValidateSchema(self, schema): """Checks if |schema| is a valid schema and only uses valid $ref links. See _ValidateSchemaInternal() for a detailed description of the schema validation. This method also checks if all used $ref links are known and valid. Args: schema (dict): The JSON schema...
Checks if |schema| is a valid schema and only uses valid $ref links. See _ValidateSchemaInternal() for a detailed description of the schema validation. This method also checks if all used $ref links are known and valid. Args: schema (dict): The JSON schema. Returns: bool: Whether the sc...
Checks if |schema| is a valid schema and only uses valid $ref links. See _ValidateSchemaInternal() for a detailed description of the schema validation. This method also checks if all used $ref links are known and valid.
[ "Checks", "if", "|schema|", "is", "a", "valid", "schema", "and", "only", "uses", "valid", "$ref", "links", ".", "See", "_ValidateSchemaInternal", "()", "for", "a", "detailed", "description", "of", "the", "schema", "validation", ".", "This", "method", "also", ...
def ValidateSchema(self, schema): self.found_ref_ids.clear() self.num_errors = 0 self._ValidateSchemaInternal(schema) unknown_ref_ids = self.found_ref_ids.difference(self.schemas_by_id.keys()) for unknown_ref_id in unknown_ref_ids: if unknown_ref_id in self.invalid_ref_ids: self._Error...
[ "def", "ValidateSchema", "(", "self", ",", "schema", ")", ":", "self", ".", "found_ref_ids", ".", "clear", "(", ")", "self", ".", "num_errors", "=", "0", "self", ".", "_ValidateSchemaInternal", "(", "schema", ")", "unknown_ref_ids", "=", "self", ".", "foun...
Checks if |schema| is a valid schema and only uses valid $ref links.
[ "Checks", "if", "|schema|", "is", "a", "valid", "schema", "and", "only", "uses", "valid", "$ref", "links", "." ]
[ "\"\"\"Checks if |schema| is a valid schema and only uses valid $ref links.\n\n See _ValidateSchemaInternal() for a detailed description of the schema\n validation. This method also checks if all used $ref links are known and\n valid.\n Args:\n schema (dict): The JSON schema.\n Returns:\n b...
[ { "param": "self", "type": null }, { "param": "schema", "type": null } ]
{ "returns": [ { "docstring": "Whether the schema is valid or not.", "docstring_tokens": [ "Whether", "the", "schema", "is", "valid", "or", "not", "." ], "type": "bool" } ], "raises": [], "params": [ { "ide...
5151d3093327a62ffd2830c45ede716c88b24faa
sunlongbo/chromium
components/policy/tools/schema_validator.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_ValidateIntegerSchema
null
def _ValidateIntegerSchema(self, schema): """Validates a |schema| with type 'integer'. Validates the 'enum' property (see _ValidateEnum()) if existing. This method also ensures that the specified minimum value is smaller or equal to the specified maximum value, if both exist. Args: schema (di...
Validates a |schema| with type 'integer'. Validates the 'enum' property (see _ValidateEnum()) if existing. This method also ensures that the specified minimum value is smaller or equal to the specified maximum value, if both exist. Args: schema (dict): The JSON schema.
Validates a |schema| with type 'integer'. Validates the 'enum' property ) if existing. This method also ensures that the specified minimum value is smaller or equal to the specified maximum value, if both exist.
[ "Validates", "a", "|schema|", "with", "type", "'", "integer", "'", ".", "Validates", "the", "'", "enum", "'", "property", ")", "if", "existing", ".", "This", "method", "also", "ensures", "that", "the", "specified", "minimum", "value", "is", "smaller", "or"...
def _ValidateIntegerSchema(self, schema): if 'enum' in schema: self._ValidateEnum(schema['enum'], 'integer') if ('minimum' in schema and 'maximum' in schema and schema['minimum'] > schema['maximum']): self._Error("Invalid range specified: [%s; %s]" % (schema['minimum'], ...
[ "def", "_ValidateIntegerSchema", "(", "self", ",", "schema", ")", ":", "if", "'enum'", "in", "schema", ":", "self", ".", "_ValidateEnum", "(", "schema", "[", "'enum'", "]", ",", "'integer'", ")", "if", "(", "'minimum'", "in", "schema", "and", "'maximum'", ...
Validates a |schema| with type 'integer'.
[ "Validates", "a", "|schema|", "with", "type", "'", "integer", "'", "." ]
[ "\"\"\"Validates a |schema| with type 'integer'.\n\n Validates the 'enum' property (see _ValidateEnum()) if existing. This\n method also ensures that the specified minimum value is smaller or equal to\n the specified maximum value, if both exist.\n Args:\n schema (dict): The JSON schema.\n \"\"\...
[ { "param": "self", "type": null }, { "param": "schema", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "schema", "type": null, "docstring": "The JSON schema.", "docs...
5151d3093327a62ffd2830c45ede716c88b24faa
sunlongbo/chromium
components/policy/tools/schema_validator.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_ValidateArraySchema
null
def _ValidateArraySchema(self, schema): """Validates a |schema| with type 'array'. Validates that the 'items' attribute exists and its value is a valid schema. Args: schema (dict): The JSON schema. """ if 'items' in schema: self._ValidateSchemaInternal(schema['items']) else: s...
Validates a |schema| with type 'array'. Validates that the 'items' attribute exists and its value is a valid schema. Args: schema (dict): The JSON schema.
Validates a |schema| with type 'array'. Validates that the 'items' attribute exists and its value is a valid schema.
[ "Validates", "a", "|schema|", "with", "type", "'", "array", "'", ".", "Validates", "that", "the", "'", "items", "'", "attribute", "exists", "and", "its", "value", "is", "a", "valid", "schema", "." ]
def _ValidateArraySchema(self, schema): if 'items' in schema: self._ValidateSchemaInternal(schema['items']) else: self._Error("Schema of type 'array' must have an 'items' attribute.")
[ "def", "_ValidateArraySchema", "(", "self", ",", "schema", ")", ":", "if", "'items'", "in", "schema", ":", "self", ".", "_ValidateSchemaInternal", "(", "schema", "[", "'items'", "]", ")", "else", ":", "self", ".", "_Error", "(", "\"Schema of type 'array' must ...
Validates a |schema| with type 'array'.
[ "Validates", "a", "|schema|", "with", "type", "'", "array", "'", "." ]
[ "\"\"\"Validates a |schema| with type 'array'.\n\n Validates that the 'items' attribute exists and its value is a valid schema.\n Args:\n schema (dict): The JSON schema.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "schema", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "schema", "type": null, "docstring": "The JSON schema.", "docs...
5151d3093327a62ffd2830c45ede716c88b24faa
sunlongbo/chromium
components/policy/tools/schema_validator.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_ValidateObjectSchema
null
def _ValidateObjectSchema(self, schema): """Validates a schema of type 'object'. If |schema| has a 'required' attribute, this method validates that it is not empty, only contains strings and only contains property names of properties defined in the 'properties' attribute. This method also ensures t...
Validates a schema of type 'object'. If |schema| has a 'required' attribute, this method validates that it is not empty, only contains strings and only contains property names of properties defined in the 'properties' attribute. This method also ensures that at least one of 'properties', 'patternPr...
Validates a schema of type 'object'. If |schema| has a 'required' attribute, this method validates that it is not empty, only contains strings and only contains property names of properties defined in the 'properties' attribute.
[ "Validates", "a", "schema", "of", "type", "'", "object", "'", ".", "If", "|schema|", "has", "a", "'", "required", "'", "attribute", "this", "method", "validates", "that", "it", "is", "not", "empty", "only", "contains", "strings", "and", "only", "contains",...
def _ValidateObjectSchema(self, schema): if 'required' in schema: required_properties = schema['required'] if not required_properties: self._Error("Attribute 'required' may not be empty (omit it if empty).") if not all( isinstance(required_property, str) for required_pr...
[ "def", "_ValidateObjectSchema", "(", "self", ",", "schema", ")", ":", "if", "'required'", "in", "schema", ":", "required_properties", "=", "schema", "[", "'required'", "]", "if", "not", "required_properties", ":", "self", ".", "_Error", "(", "\"Attribute 'requir...
Validates a schema of type 'object'.
[ "Validates", "a", "schema", "of", "type", "'", "object", "'", "." ]
[ "\"\"\"Validates a schema of type 'object'.\n\n If |schema| has a 'required' attribute, this method validates that it is not\n empty, only contains strings and only contains property names of properties\n defined in the 'properties' attribute.\n This method also ensures that at least one of 'properties'...
[ { "param": "self", "type": null }, { "param": "schema", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "schema", "type": null, "docstring": "The JSON schema.", "docs...
5151d3093327a62ffd2830c45ede716c88b24faa
sunlongbo/chromium
components/policy/tools/schema_validator.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_ValidatePattern
null
def _ValidatePattern(self, pattern): """Validates a regex |pattern|. Validates that |pattern| is a string and can be used as regex pattern. Args: pattern (str): The regex pattern. """ if not isinstance(pattern, str): self._Error("Pattern must be a string: %s" % pattern) try: r...
Validates a regex |pattern|. Validates that |pattern| is a string and can be used as regex pattern. Args: pattern (str): The regex pattern.
Validates a regex |pattern|. Validates that |pattern| is a string and can be used as regex pattern.
[ "Validates", "a", "regex", "|pattern|", ".", "Validates", "that", "|pattern|", "is", "a", "string", "and", "can", "be", "used", "as", "regex", "pattern", "." ]
def _ValidatePattern(self, pattern): if not isinstance(pattern, str): self._Error("Pattern must be a string: %s" % pattern) try: re.compile(pattern) except re.error: self._Error("Pattern is not a valid regex: %s" % pattern)
[ "def", "_ValidatePattern", "(", "self", ",", "pattern", ")", ":", "if", "not", "isinstance", "(", "pattern", ",", "str", ")", ":", "self", ".", "_Error", "(", "\"Pattern must be a string: %s\"", "%", "pattern", ")", "try", ":", "re", ".", "compile", "(", ...
Validates a regex |pattern|.
[ "Validates", "a", "regex", "|pattern|", "." ]
[ "\"\"\"Validates a regex |pattern|.\n\n Validates that |pattern| is a string and can be used as regex pattern.\n Args:\n pattern (str): The regex pattern.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "pattern", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pattern", "type": null, "docstring": "The regex pattern.", "d...
5151d3093327a62ffd2830c45ede716c88b24faa
sunlongbo/chromium
components/policy/tools/schema_validator.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ValidateValue
<not_specific>
def ValidateValue(self, schema, value, enforce_use_entire_schema=False): """Validates that |value| complies to |schema|. See _ValidateValueInternal(schema, value) for a detailed description of the value validation. If |enforce_use_entire_schema| is enabled, each value and its sub-values have to use eve...
Validates that |value| complies to |schema|. See _ValidateValueInternal(schema, value) for a detailed description of the value validation. If |enforce_use_entire_schema| is enabled, each value and its sub-values have to use every property of each used schema at least once and values with schema type 'a...
Validates that |value| complies to |schema|. See _ValidateValueInternal(schema, value) for a detailed description of the value validation. If |enforce_use_entire_schema| is enabled, each value and its sub-values have to use every property of each used schema at least once and values with schema type 'array' may not be ...
[ "Validates", "that", "|value|", "complies", "to", "|schema|", ".", "See", "_ValidateValueInternal", "(", "schema", "value", ")", "for", "a", "detailed", "description", "of", "the", "value", "validation", ".", "If", "|enforce_use_entire_schema|", "is", "enabled", "...
def ValidateValue(self, schema, value, enforce_use_entire_schema=False): self.enforce_use_entire_schema = enforce_use_entire_schema self.expected_properties = {} self.expected_pattern_properties = {} self.expected_additional_properties = {} self.used_properties = {} self.used_pattern_properties ...
[ "def", "ValidateValue", "(", "self", ",", "schema", ",", "value", ",", "enforce_use_entire_schema", "=", "False", ")", ":", "self", ".", "enforce_use_entire_schema", "=", "enforce_use_entire_schema", "self", ".", "expected_properties", "=", "{", "}", "self", ".", ...
Validates that |value| complies to |schema|.
[ "Validates", "that", "|value|", "complies", "to", "|schema|", "." ]
[ "\"\"\"Validates that |value| complies to |schema|.\n\n See _ValidateValueInternal(schema, value) for a detailed description of the\n value validation. If |enforce_use_entire_schema| is enabled, each value and\n its sub-values have to use every property of each used schema at least once\n and values wit...
[ { "param": "self", "type": null }, { "param": "schema", "type": null }, { "param": "value", "type": null }, { "param": "enforce_use_entire_schema", "type": null } ]
{ "returns": [ { "docstring": "Whether the value is valid or not.", "docstring_tokens": [ "Whether", "the", "value", "is", "valid", "or", "not", "." ], "type": "bool" } ], "raises": [], "params": [ { "ident...
5151d3093327a62ffd2830c45ede716c88b24faa
sunlongbo/chromium
components/policy/tools/schema_validator.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_Error
null
def _Error(self, message): """Captures an error. Logs the error |message| and increases the error count |num_errors| by one. Args: message (str): The error message.""" self.num_errors += 1 print(message)
Captures an error. Logs the error |message| and increases the error count |num_errors| by one. Args: message (str): The error message.
Captures an error. Logs the error |message| and increases the error count |num_errors| by one.
[ "Captures", "an", "error", ".", "Logs", "the", "error", "|message|", "and", "increases", "the", "error", "count", "|num_errors|", "by", "one", "." ]
def _Error(self, message): self.num_errors += 1 print(message)
[ "def", "_Error", "(", "self", ",", "message", ")", ":", "self", ".", "num_errors", "+=", "1", "print", "(", "message", ")" ]
Captures an error.
[ "Captures", "an", "error", "." ]
[ "\"\"\"Captures an error.\n\n Logs the error |message| and increases the error count |num_errors| by one.\n Args:\n message (str): The error message.\"\"\"" ]
[ { "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": "The error message.", "d...
a8815370472555e1803614469fac94c8ab7ddb57
sunlongbo/chromium
components/policy/tools/template_writers/writers/xml_formatted_writer.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
AddElement
<not_specific>
def AddElement(self, parent, name, attrs=None, text=None): ''' Adds a new XML Element as a child to an existing element or the Document. Args: parent: An XML element or the document, where the new element will be added. name: The name of the new element. attrs: A dictionary of the...
Adds a new XML Element as a child to an existing element or the Document. Args: parent: An XML element or the document, where the new element will be added. name: The name of the new element. attrs: A dictionary of the attributes' names and values for the new element. t...
Adds a new XML Element as a child to an existing element or the Document.
[ "Adds", "a", "new", "XML", "Element", "as", "a", "child", "to", "an", "existing", "element", "or", "the", "Document", "." ]
def AddElement(self, parent, name, attrs=None, text=None): if attrs == None: attrs = {} doc = parent.ownerDocument element = doc.createElement(name) for key, value in sorted(attrs.items()): element.setAttribute(key, value) if text: element.appendChild(doc.createTextNode(text)) ...
[ "def", "AddElement", "(", "self", ",", "parent", ",", "name", ",", "attrs", "=", "None", ",", "text", "=", "None", ")", ":", "if", "attrs", "==", "None", ":", "attrs", "=", "{", "}", "doc", "=", "parent", ".", "ownerDocument", "element", "=", "doc"...
Adds a new XML Element as a child to an existing element or the Document.
[ "Adds", "a", "new", "XML", "Element", "as", "a", "child", "to", "an", "existing", "element", "or", "the", "Document", "." ]
[ "'''\n Adds a new XML Element as a child to an existing element or the Document.\n\n Args:\n parent: An XML element or the document, where the new element will be\n added.\n name: The name of the new element.\n attrs: A dictionary of the attributes' names and values for the new\n ...
[ { "param": "self", "type": null }, { "param": "parent", "type": null }, { "param": "name", "type": null }, { "param": "attrs", "type": null }, { "param": "text", "type": null } ]
{ "returns": [ { "docstring": "The created new element.", "docstring_tokens": [ "The", "created", "new", "element", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": ...
a8815370472555e1803614469fac94c8ab7ddb57
sunlongbo/chromium
components/policy/tools/template_writers/writers/xml_formatted_writer.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
AddText
null
def AddText(self, parent, text): '''Adds text to a parent node. ''' doc = parent.ownerDocument parent.appendChild(doc.createTextNode(text))
Adds text to a parent node.
Adds text to a parent node.
[ "Adds", "text", "to", "a", "parent", "node", "." ]
def AddText(self, parent, text): doc = parent.ownerDocument parent.appendChild(doc.createTextNode(text))
[ "def", "AddText", "(", "self", ",", "parent", ",", "text", ")", ":", "doc", "=", "parent", ".", "ownerDocument", "parent", ".", "appendChild", "(", "doc", ".", "createTextNode", "(", "text", ")", ")" ]
Adds text to a parent node.
[ "Adds", "text", "to", "a", "parent", "node", "." ]
[ "'''Adds text to a parent node.\n '''" ]
[ { "param": "self", "type": null }, { "param": "parent", "type": null }, { "param": "text", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parent", "type": null, "docstring": null, "docstring_tokens":...
a8815370472555e1803614469fac94c8ab7ddb57
sunlongbo/chromium
components/policy/tools/template_writers/writers/xml_formatted_writer.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
AddAttribute
null
def AddAttribute(self, parent, name, value): '''Adds a new attribute to the parent Element. If an attribute with the given name already exists then it will be replaced. ''' doc = parent.ownerDocument attribute = doc.createAttribute(name) attribute.value = value parent.setAttributeNode(attrib...
Adds a new attribute to the parent Element. If an attribute with the given name already exists then it will be replaced.
Adds a new attribute to the parent Element. If an attribute with the given name already exists then it will be replaced.
[ "Adds", "a", "new", "attribute", "to", "the", "parent", "Element", ".", "If", "an", "attribute", "with", "the", "given", "name", "already", "exists", "then", "it", "will", "be", "replaced", "." ]
def AddAttribute(self, parent, name, value): doc = parent.ownerDocument attribute = doc.createAttribute(name) attribute.value = value parent.setAttributeNode(attribute)
[ "def", "AddAttribute", "(", "self", ",", "parent", ",", "name", ",", "value", ")", ":", "doc", "=", "parent", ".", "ownerDocument", "attribute", "=", "doc", ".", "createAttribute", "(", "name", ")", "attribute", ".", "value", "=", "value", "parent", ".",...
Adds a new attribute to the parent Element.
[ "Adds", "a", "new", "attribute", "to", "the", "parent", "Element", "." ]
[ "'''Adds a new attribute to the parent Element. If an attribute with the\n given name already exists then it will be replaced.\n '''" ]
[ { "param": "self", "type": null }, { "param": "parent", "type": null }, { "param": "name", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parent", "type": null, "docstring": null, "docstring_tokens":...
2277728e0389d0a674bac885c1c635cbff771248
sunlongbo/chromium
tools/lldb/lldb_chrome_symbols.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_get_channel
<not_specific>
def _get_channel(outer_bundle, version): """Looks up the Chrome release channel by reading the Info.plist key. The target's Chrome `version` will be checked against the `outer_bundle`'s.""" info_plist = os.path.join(outer_bundle, 'Contents', 'Info.plist') # Reading the Info.plist may fail if this is a c...
Looks up the Chrome release channel by reading the Info.plist key. The target's Chrome `version` will be checked against the `outer_bundle`'s.
Looks up the Chrome release channel by reading the Info.plist key. The target's Chrome `version` will be checked against the `outer_bundle`'s.
[ "Looks", "up", "the", "Chrome", "release", "channel", "by", "reading", "the", "Info", ".", "plist", "key", ".", "The", "target", "'", "s", "Chrome", "`", "version", "`", "will", "be", "checked", "against", "the", "`", "outer_bundle", "`", "'", "s", "."...
def _get_channel(outer_bundle, version): info_plist = os.path.join(outer_bundle, 'Contents', 'Info.plist') try: with open(info_plist, 'rb') as f: plist = plistlib.load(f) if plist['KSVersion'] != version: return None kschannel = plist['KSChannelID'] ...
[ "def", "_get_channel", "(", "outer_bundle", ",", "version", ")", ":", "info_plist", "=", "os", ".", "path", ".", "join", "(", "outer_bundle", ",", "'Contents'", ",", "'Info.plist'", ")", "try", ":", "with", "open", "(", "info_plist", ",", "'rb'", ")", "a...
Looks up the Chrome release channel by reading the Info.plist key.
[ "Looks", "up", "the", "Chrome", "release", "channel", "by", "reading", "the", "Info", ".", "plist", "key", "." ]
[ "\"\"\"Looks up the Chrome release channel by reading the Info.plist key. The\n target's Chrome `version` will be checked against the `outer_bundle`'s.\"\"\"", "# Reading the Info.plist may fail if this is a core or minidump, but", "# there is no way to test in the lldb API if the target is one.", "# The o...
[ { "param": "outer_bundle", "type": null }, { "param": "version", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "outer_bundle", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "version", "type": null, "docstring": null, "docstring...
2277728e0389d0a674bac885c1c635cbff771248
sunlongbo/chromium
tools/lldb/lldb_chrome_symbols.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_add_symbols
null
def _add_symbols(debugger, dsym_dir): """Adds the dSYMs in `dsym_dir` to the `debugger`. This filters the symbols to just the relevant modules that are loaded in the process because lldb prints an error when adding symbols that are not used. """ dsyms = glob.glob(os.path.join(dsym_dir, '*.dSYM')) ...
Adds the dSYMs in `dsym_dir` to the `debugger`. This filters the symbols to just the relevant modules that are loaded in the process because lldb prints an error when adding symbols that are not used.
Adds the dSYMs in `dsym_dir` to the `debugger`. This filters the symbols to just the relevant modules that are loaded in the process because lldb prints an error when adding symbols that are not used.
[ "Adds", "the", "dSYMs", "in", "`", "dsym_dir", "`", "to", "the", "`", "debugger", "`", ".", "This", "filters", "the", "symbols", "to", "just", "the", "relevant", "modules", "that", "are", "loaded", "in", "the", "process", "because", "lldb", "prints", "an...
def _add_symbols(debugger, dsym_dir): dsyms = glob.glob(os.path.join(dsym_dir, '*.dSYM')) wanted_dsyms = set([ m.GetFileSpec().GetFilename() + '.dSYM' for m in debugger.GetSelectedTarget().module_iter() ]) for dsym in dsyms: if os.path.basename(dsym) in wanted_dsyms: ...
[ "def", "_add_symbols", "(", "debugger", ",", "dsym_dir", ")", ":", "dsyms", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "dsym_dir", ",", "'*.dSYM'", ")", ")", "wanted_dsyms", "=", "set", "(", "[", "m", ".", "GetFileSpec", "(",...
Adds the dSYMs in `dsym_dir` to the `debugger`.
[ "Adds", "the", "dSYMs", "in", "`", "dsym_dir", "`", "to", "the", "`", "debugger", "`", "." ]
[ "\"\"\"Adds the dSYMs in `dsym_dir` to the `debugger`. This filters the symbols\n to just the relevant modules that are loaded in the process because lldb\n prints an error when adding symbols that are not used.\n \"\"\"" ]
[ { "param": "debugger", "type": null }, { "param": "dsym_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "debugger", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dsym_dir", "type": null, "docstring": null, "docstring_to...
227905207dc00bdf36063daa7cf41f3d25377f01
sunlongbo/chromium
tools/traffic_annotation/scripts/update_annotations_doc.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
update_doc
null
def update_doc(self, placeholders): """Updates the chrome version of the destination document and includes all the annotations within the grouping.xml file. Args: placeholders: Contains the order of the placeholders to construct template """ self._docs_service = self._initialize_s...
Updates the chrome version of the destination document and includes all the annotations within the grouping.xml file. Args: placeholders: Contains the order of the placeholders to construct template
Updates the chrome version of the destination document and includes all the annotations within the grouping.xml file.
[ "Updates", "the", "chrome", "version", "of", "the", "destination", "document", "and", "includes", "all", "the", "annotations", "within", "the", "grouping", ".", "xml", "file", "." ]
def update_doc(self, placeholders): self._docs_service = self._initialize_service( self._get_credentials( self._credentials_file_path, self._client_token_file_path)) doc = self._get_doc_contents(self.destination_id) self._update_chrome_version(doc) self.index = self._clear_destination_cont...
[ "def", "update_doc", "(", "self", ",", "placeholders", ")", ":", "self", ".", "_docs_service", "=", "self", ".", "_initialize_service", "(", "self", ".", "_get_credentials", "(", "self", ".", "_credentials_file_path", ",", "self", ".", "_client_token_file_path", ...
Updates the chrome version of the destination document and includes all the annotations within the grouping.xml file.
[ "Updates", "the", "chrome", "version", "of", "the", "destination", "document", "and", "includes", "all", "the", "annotations", "within", "the", "grouping", ".", "xml", "file", "." ]
[ "\"\"\"Updates the chrome version of the destination document and includes all\n the annotations within the grouping.xml file.\n\n Args:\n placeholders:\n Contains the order of the placeholders to construct template\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "placeholders", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "placeholders", "type": null, "docstring": "Contains the order of th...
227905207dc00bdf36063daa7cf41f3d25377f01
sunlongbo/chromium
tools/traffic_annotation/scripts/update_annotations_doc.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_initialize_service
<not_specific>
def _initialize_service(self, credentials): """Initializes the Google Docs API services. Args: credentials: OAuth2Credentials user credentials. The path to the user's credentials. Returns: googleapiclient.discovery.Resource Doc API service, v1. """ http = credentials.authorize(...
Initializes the Google Docs API services. Args: credentials: OAuth2Credentials user credentials. The path to the user's credentials. Returns: googleapiclient.discovery.Resource Doc API service, v1.
Initializes the Google Docs API services.
[ "Initializes", "the", "Google", "Docs", "API", "services", "." ]
def _initialize_service(self, credentials): http = credentials.authorize(httplib2.Http()) return discovery.build("docs", "v1", http=http)
[ "def", "_initialize_service", "(", "self", ",", "credentials", ")", ":", "http", "=", "credentials", ".", "authorize", "(", "httplib2", ".", "Http", "(", ")", ")", "return", "discovery", ".", "build", "(", "\"docs\"", ",", "\"v1\"", ",", "http", "=", "ht...
Initializes the Google Docs API services.
[ "Initializes", "the", "Google", "Docs", "API", "services", "." ]
[ "\"\"\"Initializes the Google Docs API services.\n\n Args:\n credentials: OAuth2Credentials user credentials.\n The path to the user's credentials.\n\n Returns:\n googleapiclient.discovery.Resource Doc API service, v1.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "credentials", "type": null } ]
{ "returns": [ { "docstring": "googleapiclient.discovery.Resource Doc API service, v1.", "docstring_tokens": [ "googleapiclient", ".", "discovery", ".", "Resource", "Doc", "API", "service", "v1", "." ], "type":...
227905207dc00bdf36063daa7cf41f3d25377f01
sunlongbo/chromium
tools/traffic_annotation/scripts/update_annotations_doc.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_get_credentials
<not_specific>
def _get_credentials(self, credentials_file_path, client_token_file_path): """ Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to obtain the new credentials. When running in the buildbot, uses LUCI credentials ...
Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to obtain the new credentials. When running in the buildbot, uses LUCI credentials instead. Args: credentials_file_path: str Absolute path to read...
Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to obtain the new credentials. When running in the buildbot, uses LUCI credentials instead.
[ "Gets", "valid", "user", "credentials", "from", "storage", ".", "If", "nothing", "has", "been", "stored", "or", "if", "the", "stored", "credentials", "are", "invalid", "the", "OAuth2", "flow", "is", "completed", "to", "obtain", "the", "new", "credentials", "...
def _get_credentials(self, credentials_file_path, client_token_file_path): if luci_auth.available(): return luci_auth.LUCICredentials(scopes=[self.SCOPES]) store = Storage(os.path.join(SRC_DIR, client_token_file_path)) credentials = store.get() if not credentials or credentials.invalid: flow...
[ "def", "_get_credentials", "(", "self", ",", "credentials_file_path", ",", "client_token_file_path", ")", ":", "if", "luci_auth", ".", "available", "(", ")", ":", "return", "luci_auth", ".", "LUCICredentials", "(", "scopes", "=", "[", "self", ".", "SCOPES", "]...
Gets valid user credentials from storage.
[ "Gets", "valid", "user", "credentials", "from", "storage", "." ]
[ "\"\"\" Gets valid user credentials from storage. If nothing has been stored, or\n if the stored credentials are invalid, the OAuth2 flow is completed to\n obtain the new credentials.\n\n When running in the buildbot, uses LUCI credentials instead.\n\n Args:\n credentials_file_path: str\n Ab...
[ { "param": "self", "type": null }, { "param": "credentials_file_path", "type": null }, { "param": "client_token_file_path", "type": null } ]
{ "returns": [ { "docstring": "OAuth2Credentials The obtained user credentials.", "docstring_tokens": [ "OAuth2Credentials", "The", "obtained", "user", "credentials", "." ], "type": null } ], "raises": [], "params": [ { "i...
227905207dc00bdf36063daa7cf41f3d25377f01
sunlongbo/chromium
tools/traffic_annotation/scripts/update_annotations_doc.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_update_chrome_version
<not_specific>
def _update_chrome_version(self, doc): """Gets the chrome version (MAJOR.MINOR.BUILD.PATCH) from src/chrome/VERSION and updates the doc to reflect the correct version. """ version = "" with open(os.path.join(SRC_DIR, "chrome/VERSION"), "r") as version_file: version = ".".join(line.strip().spli...
Gets the chrome version (MAJOR.MINOR.BUILD.PATCH) from src/chrome/VERSION and updates the doc to reflect the correct version.
Gets the chrome version (MAJOR.MINOR.BUILD.PATCH) from src/chrome/VERSION and updates the doc to reflect the correct version.
[ "Gets", "the", "chrome", "version", "(", "MAJOR", ".", "MINOR", ".", "BUILD", ".", "PATCH", ")", "from", "src", "/", "chrome", "/", "VERSION", "and", "updates", "the", "doc", "to", "reflect", "the", "correct", "version", "." ]
def _update_chrome_version(self, doc): version = "" with open(os.path.join(SRC_DIR, "chrome/VERSION"), "r") as version_file: version = ".".join(line.strip().split("=")[1] for line in version_file.readlines()) current_version = generator_utils.find_chrome_browser_version(doc) ...
[ "def", "_update_chrome_version", "(", "self", ",", "doc", ")", ":", "version", "=", "\"\"", "with", "open", "(", "os", ".", "path", ".", "join", "(", "SRC_DIR", ",", "\"chrome/VERSION\"", ")", ",", "\"r\"", ")", "as", "version_file", ":", "version", "=",...
Gets the chrome version (MAJOR.MINOR.BUILD.PATCH) from src/chrome/VERSION and updates the doc to reflect the correct version.
[ "Gets", "the", "chrome", "version", "(", "MAJOR", ".", "MINOR", ".", "BUILD", ".", "PATCH", ")", "from", "src", "/", "chrome", "/", "VERSION", "and", "updates", "the", "doc", "to", "reflect", "the", "correct", "version", "." ]
[ "\"\"\"Gets the chrome version (MAJOR.MINOR.BUILD.PATCH) from src/chrome/VERSION\n and updates the doc to reflect the correct version.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "doc", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "doc", "type": null, "docstring": null, "docstring_tokens": []...
227905207dc00bdf36063daa7cf41f3d25377f01
sunlongbo/chromium
tools/traffic_annotation/scripts/update_annotations_doc.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_clear_destination_contents
<not_specific>
def _clear_destination_contents(self, doc): """Will clear the contents of the destination document from the end of the "Introduction" section onwards. Return: Integer of where to start writing, i.e. the index. """ print("Overwriting the destination document.") first_index = generator_utils.find...
Will clear the contents of the destination document from the end of the "Introduction" section onwards. Return: Integer of where to start writing, i.e. the index.
Will clear the contents of the destination document from the end of the "Introduction" section onwards. Integer of where to start writing, i.e. the index.
[ "Will", "clear", "the", "contents", "of", "the", "destination", "document", "from", "the", "end", "of", "the", "\"", "Introduction", "\"", "section", "onwards", ".", "Integer", "of", "where", "to", "start", "writing", "i", ".", "e", ".", "the", "index", ...
def _clear_destination_contents(self, doc): print("Overwriting the destination document.") first_index = generator_utils.find_first_index(doc) last_index = generator_utils.find_last_index(doc) if self.verbose: print("First index, last index", first_index, last_index) if first_index >= last_ind...
[ "def", "_clear_destination_contents", "(", "self", ",", "doc", ")", ":", "print", "(", "\"Overwriting the destination document.\"", ")", "first_index", "=", "generator_utils", ".", "find_first_index", "(", "doc", ")", "last_index", "=", "generator_utils", ".", "find_l...
Will clear the contents of the destination document from the end of the "Introduction" section onwards.
[ "Will", "clear", "the", "contents", "of", "the", "destination", "document", "from", "the", "end", "of", "the", "\"", "Introduction", "\"", "section", "onwards", "." ]
[ "\"\"\"Will clear the contents of the destination document from the end of the\n \"Introduction\" section onwards.\n\n Return: Integer of where to start writing, i.e. the index.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "doc", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "doc", "type": null, "docstring": null, "docstring_tokens": []...
227905207dc00bdf36063daa7cf41f3d25377f01
sunlongbo/chromium
tools/traffic_annotation/scripts/update_annotations_doc.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_perform_requests
<not_specific>
def _perform_requests(self, reqs): """Performs the requests |reqs| using batch update. """ if not reqs: print("Warning, no requests provided. Returning.") return status = self._docs_service.documents().batchUpdate( body={ "requests": reqs }, documentId=self.desti...
Performs the requests |reqs| using batch update.
Performs the requests |reqs| using batch update.
[ "Performs", "the", "requests", "|reqs|", "using", "batch", "update", "." ]
def _perform_requests(self, reqs): if not reqs: print("Warning, no requests provided. Returning.") return status = self._docs_service.documents().batchUpdate( body={ "requests": reqs }, documentId=self.destination_id, fields="").execute() if self.verbose: print(...
[ "def", "_perform_requests", "(", "self", ",", "reqs", ")", ":", "if", "not", "reqs", ":", "print", "(", "\"Warning, no requests provided. Returning.\"", ")", "return", "status", "=", "self", ".", "_docs_service", ".", "documents", "(", ")", ".", "batchUpdate", ...
Performs the requests |reqs| using batch update.
[ "Performs", "the", "requests", "|reqs|", "using", "batch", "update", "." ]
[ "\"\"\"Performs the requests |reqs| using batch update.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "reqs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "reqs", "type": null, "docstring": null, "docstring_tokens": [...
227905207dc00bdf36063daa7cf41f3d25377f01
sunlongbo/chromium
tools/traffic_annotation/scripts/update_annotations_doc.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_insert_placeholders
null
def _insert_placeholders(self, placeholders): """Placeholders (e.g. groups, senders, traffic annotations) are inserted in the document in their order of appearance. Increment the self.index value to ensure that placeholders are inserted at the correct locations. Because placeholders are sorted in order...
Placeholders (e.g. groups, senders, traffic annotations) are inserted in the document in their order of appearance. Increment the self.index value to ensure that placeholders are inserted at the correct locations. Because placeholders are sorted in order of appearance, self.index is strictly increasing...
Placeholders are inserted in the document in their order of appearance. Increment the self.index value to ensure that placeholders are inserted at the correct locations. Because placeholders are sorted in order of appearance, self.index is strictly increasing.
[ "Placeholders", "are", "inserted", "in", "the", "document", "in", "their", "order", "of", "appearance", ".", "Increment", "the", "self", ".", "index", "value", "to", "ensure", "that", "placeholders", "are", "inserted", "at", "the", "correct", "locations", ".",...
def _insert_placeholders(self, placeholders): reqs = [] for placeholder in placeholders: placeholder_type = placeholder["type"] if placeholder_type == Placeholder.ANNOTATION: req, index = self._create_annotation_request( placeholder["traffic_annotation"], self.index, ...
[ "def", "_insert_placeholders", "(", "self", ",", "placeholders", ")", ":", "reqs", "=", "[", "]", "for", "placeholder", "in", "placeholders", ":", "placeholder_type", "=", "placeholder", "[", "\"type\"", "]", "if", "placeholder_type", "==", "Placeholder", ".", ...
Placeholders (e.g.
[ "Placeholders", "(", "e", ".", "g", "." ]
[ "\"\"\"Placeholders (e.g. groups, senders, traffic annotations) are inserted in\n the document in their order of appearance.\n\n Increment the self.index value to ensure that placeholders are inserted at\n the correct locations. Because placeholders are sorted in order of\n appearance, self.index is str...
[ { "param": "self", "type": null }, { "param": "placeholders", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "placeholders", "type": null, "docstring": null, "docstring_to...
227905207dc00bdf36063daa7cf41f3d25377f01
sunlongbo/chromium
tools/traffic_annotation/scripts/update_annotations_doc.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_create_group_or_sender_request
<not_specific>
def _create_group_or_sender_request(self, text, index, placeholder_type): """Returns the request for inserting the group or sender placeholders using the styling of |generator_utils.PLACEHOLDER_STYLES|. """ assert placeholder_type in [Placeholder.GROUP, Placeholder.SENDER] text += "\n" req, idx ...
Returns the request for inserting the group or sender placeholders using the styling of |generator_utils.PLACEHOLDER_STYLES|.
Returns the request for inserting the group or sender placeholders using the styling of |generator_utils.PLACEHOLDER_STYLES|.
[ "Returns", "the", "request", "for", "inserting", "the", "group", "or", "sender", "placeholders", "using", "the", "styling", "of", "|generator_utils", ".", "PLACEHOLDER_STYLES|", "." ]
def _create_group_or_sender_request(self, text, index, placeholder_type): assert placeholder_type in [Placeholder.GROUP, Placeholder.SENDER] text += "\n" req, idx = self._create_text_request(text, index) reqs = [req] reqs.append({ "updateParagraphStyle": { "range": { ...
[ "def", "_create_group_or_sender_request", "(", "self", ",", "text", ",", "index", ",", "placeholder_type", ")", ":", "assert", "placeholder_type", "in", "[", "Placeholder", ".", "GROUP", ",", "Placeholder", ".", "SENDER", "]", "text", "+=", "\"\\n\"", "req", "...
Returns the request for inserting the group or sender placeholders using the styling of |generator_utils.PLACEHOLDER_STYLES|.
[ "Returns", "the", "request", "for", "inserting", "the", "group", "or", "sender", "placeholders", "using", "the", "styling", "of", "|generator_utils", ".", "PLACEHOLDER_STYLES|", "." ]
[ "\"\"\"Returns the request for inserting the group or sender placeholders using\n the styling of |generator_utils.PLACEHOLDER_STYLES|.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "text", "type": null }, { "param": "index", "type": null }, { "param": "placeholder_type", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "text", "type": null, "docstring": null, "docstring_tokens": [...
227905207dc00bdf36063daa7cf41f3d25377f01
sunlongbo/chromium
tools/traffic_annotation/scripts/update_annotations_doc.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_create_annotation_request
<not_specific>
def _create_annotation_request(self, traffic_annotation, index, color=False): """Returns the request (dict) for inserting the annotations table. Refer to the template document for a visual. Args: traffic_annotation: generator_utils.TrafficAnnotation The TrafficAnnotation object with all the r...
Returns the request (dict) for inserting the annotations table. Refer to the template document for a visual. Args: traffic_annotation: generator_utils.TrafficAnnotation The TrafficAnnotation object with all the relevant information, e.g. unique_id, description, etc. index: int ...
Returns the request (dict) for inserting the annotations table. Refer to the template document for a visual.
[ "Returns", "the", "request", "(", "dict", ")", "for", "inserting", "the", "annotations", "table", ".", "Refer", "to", "the", "template", "document", "for", "a", "visual", "." ]
def _create_annotation_request(self, traffic_annotation, index, color=False): idx = 8 offset = 2 padding_req, _ = self._create_text_request("\n", index) reqs = [padding_req] reqs.append({ "insertTable": { "rows": 1, "columns": 2, "location": {"index": inde...
[ "def", "_create_annotation_request", "(", "self", ",", "traffic_annotation", ",", "index", ",", "color", "=", "False", ")", ":", "idx", "=", "8", "offset", "=", "2", "padding_req", ",", "_", "=", "self", ".", "_create_text_request", "(", "\"\\n\"", ",", "i...
Returns the request (dict) for inserting the annotations table.
[ "Returns", "the", "request", "(", "dict", ")", "for", "inserting", "the", "annotations", "table", "." ]
[ "\"\"\"Returns the request (dict) for inserting the annotations table. Refer to\n the template document for a visual.\n\n Args:\n traffic_annotation: generator_utils.TrafficAnnotation\n The TrafficAnnotation object with all the relevant information, e.g.\n unique_id, description, etc.\n ...
[ { "param": "self", "type": null }, { "param": "traffic_annotation", "type": null }, { "param": "index", "type": null }, { "param": "color", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "traffic_annotation", "type": null, "docstring": "generator_utils.Tr...
227905207dc00bdf36063daa7cf41f3d25377f01
sunlongbo/chromium
tools/traffic_annotation/scripts/update_annotations_doc.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_to_bold
<not_specific>
def _to_bold(self, start_index, end_index): """Bold the text between start_index and end_index. Uses the same formatting as the annotation bold.""" return self._format_text(start_index, end_index, Placeholder.ANNOTATION_BOLD)
Bold the text between start_index and end_index. Uses the same formatting as the annotation bold.
Bold the text between start_index and end_index. Uses the same formatting as the annotation bold.
[ "Bold", "the", "text", "between", "start_index", "and", "end_index", ".", "Uses", "the", "same", "formatting", "as", "the", "annotation", "bold", "." ]
def _to_bold(self, start_index, end_index): return self._format_text(start_index, end_index, Placeholder.ANNOTATION_BOLD)
[ "def", "_to_bold", "(", "self", ",", "start_index", ",", "end_index", ")", ":", "return", "self", ".", "_format_text", "(", "start_index", ",", "end_index", ",", "Placeholder", ".", "ANNOTATION_BOLD", ")" ]
Bold the text between start_index and end_index.
[ "Bold", "the", "text", "between", "start_index", "and", "end_index", "." ]
[ "\"\"\"Bold the text between start_index and end_index. Uses the same formatting\n as the annotation bold.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "start_index", "type": null }, { "param": "end_index", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "start_index", "type": null, "docstring": null, "docstring_tok...
227905207dc00bdf36063daa7cf41f3d25377f01
sunlongbo/chromium
tools/traffic_annotation/scripts/update_annotations_doc.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_to_all_bold
null
def _to_all_bold(self): """Bold the unique_id, description, trigger, etc. in the tables to correspond exactly to the template.""" # Get recent doc after all the substitutions with the annotations. At this # point, document has all the content. print("Finding everything to bold...") doc = self._g...
Bold the unique_id, description, trigger, etc. in the tables to correspond exactly to the template.
Bold the unique_id, description, trigger, etc. in the tables to correspond exactly to the template.
[ "Bold", "the", "unique_id", "description", "trigger", "etc", ".", "in", "the", "tables", "to", "correspond", "exactly", "to", "the", "template", "." ]
def _to_all_bold(self): print("Finding everything to bold...") doc = self._get_doc_contents(self.destination_id) bold_ranges = generator_utils.find_bold_ranges(doc) reqs = [] for i, (start_index, end_index) in enumerate(bold_ranges): if end_index > start_index: reqs.append(self._to_bol...
[ "def", "_to_all_bold", "(", "self", ")", ":", "print", "(", "\"Finding everything to bold...\"", ")", "doc", "=", "self", ".", "_get_doc_contents", "(", "self", ".", "destination_id", ")", "bold_ranges", "=", "generator_utils", ".", "find_bold_ranges", "(", "doc",...
Bold the unique_id, description, trigger, etc.
[ "Bold", "the", "unique_id", "description", "trigger", "etc", "." ]
[ "\"\"\"Bold the unique_id, description, trigger, etc. in the tables to\n correspond exactly to the template.\"\"\"", "# Get recent doc after all the substitutions with the annotations. At this", "# point, document has all the content.", "# the ranges to bold using the updateTextStyle request" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2297e5d71b22d4874e8db6458bf19b4c85898fe1
sunlongbo/chromium
tools/binary_size/libsupersize/diff.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_DiffContainerLists
<not_specific>
def _DiffContainerLists(before_containers, after_containers): """Computes diff of Containers lists, matching names.""" # Find ordered unique names, preferring order of |container_after|. pairs = collections.OrderedDict() for c in after_containers: pairs[c.name] = [models.Container.Empty(), c] for c in bef...
Computes diff of Containers lists, matching names.
Computes diff of Containers lists, matching names.
[ "Computes", "diff", "of", "Containers", "lists", "matching", "names", "." ]
def _DiffContainerLists(before_containers, after_containers): pairs = collections.OrderedDict() for c in after_containers: pairs[c.name] = [models.Container.Empty(), c] for c in before_containers: if c.name in pairs: pairs[c.name][0] = c else: pairs[c.name] = [c, models.Container.Empty()] ...
[ "def", "_DiffContainerLists", "(", "before_containers", ",", "after_containers", ")", ":", "pairs", "=", "collections", ".", "OrderedDict", "(", ")", "for", "c", "in", "after_containers", ":", "pairs", "[", "c", ".", "name", "]", "=", "[", "models", ".", "...
Computes diff of Containers lists, matching names.
[ "Computes", "diff", "of", "Containers", "lists", "matching", "names", "." ]
[ "\"\"\"Computes diff of Containers lists, matching names.\"\"\"", "# Find ordered unique names, preferring order of |container_after|.", "# This update newly created diff Containers, not existing ones or EMPTY." ]
[ { "param": "before_containers", "type": null }, { "param": "after_containers", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "before_containers", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "after_containers", "type": null, "docstring": null, ...
92054a1653379ae77a50b3ab1817c8e7524b1580
sunlongbo/chromium
third_party/blink/tools/blinkpy/w3c/wpt_metadata_builder.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
run
<not_specific>
def run(self, args=None): """Main entry point to parse flags and execute the script.""" parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( "--metadata-output-dir", help="The directory to output the metadata files into.") parser.add_argument...
Main entry point to parse flags and execute the script.
Main entry point to parse flags and execute the script.
[ "Main", "entry", "point", "to", "parse", "flags", "and", "execute", "the", "script", "." ]
def run(self, args=None): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( "--metadata-output-dir", help="The directory to output the metadata files into.") parser.add_argument( "--checked-in-metadata-dir", help="Root dire...
[ "def", "run", "(", "self", ",", "args", "=", "None", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "__doc__", ")", "parser", ".", "add_argument", "(", "\"--metadata-output-dir\"", ",", "help", "=", "\"The directory to out...
Main entry point to parse flags and execute the script.
[ "Main", "entry", "point", "to", "parse", "flags", "and", "execute", "the", "script", "." ]
[ "\"\"\"Main entry point to parse flags and execute the script.\"\"\"" ]
[ { "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": [...
92054a1653379ae77a50b3ab1817c8e7524b1580
sunlongbo/chromium
third_party/blink/tools/blinkpy/w3c/wpt_metadata_builder.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_build_metadata_and_write
null
def _build_metadata_and_write(self): """Build the metadata files and write them to disk.""" if self.fs.exists(self.metadata_output_dir): _log.debug("Output dir exists, deleting: %s", self.metadata_output_dir) self.fs.rmtree(self.metadata_output_dir) ...
Build the metadata files and write them to disk.
Build the metadata files and write them to disk.
[ "Build", "the", "metadata", "files", "and", "write", "them", "to", "disk", "." ]
def _build_metadata_and_write(self): if self.fs.exists(self.metadata_output_dir): _log.debug("Output dir exists, deleting: %s", self.metadata_output_dir) self.fs.rmtree(self.metadata_output_dir) if self.checked_in_metadata_dir and self.fs.exists( ...
[ "def", "_build_metadata_and_write", "(", "self", ")", ":", "if", "self", ".", "fs", ".", "exists", "(", "self", ".", "metadata_output_dir", ")", ":", "_log", ".", "debug", "(", "\"Output dir exists, deleting: %s\"", ",", "self", ".", "metadata_output_dir", ")", ...
Build the metadata files and write them to disk.
[ "Build", "the", "metadata", "files", "and", "write", "them", "to", "disk", "." ]
[ "\"\"\"Build the metadata files and write them to disk.\"\"\"", "# Start by populating any metadata that is checked into the source tree.", "# We will later determine, for each test, whether some other status", "# should overwrite this.", "# Finally, output a stamp file with the same name as the output", ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
92054a1653379ae77a50b3ab1817c8e7524b1580
sunlongbo/chromium
third_party/blink/tools/blinkpy/w3c/wpt_metadata_builder.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_copy_checked_in_metadata
null
def _copy_checked_in_metadata(self): """Copies checked-in metadata files to the metadata output directory.""" for filename in self.fs.files_under(self.checked_in_metadata_dir): # We match any .ini files in the path. This will find .ini files # other than just metadata (such as to...
Copies checked-in metadata files to the metadata output directory.
Copies checked-in metadata files to the metadata output directory.
[ "Copies", "checked", "-", "in", "metadata", "files", "to", "the", "metadata", "output", "directory", "." ]
def _copy_checked_in_metadata(self): for filename in self.fs.files_under(self.checked_in_metadata_dir): if not fnmatch.fnmatch(filename, "*.ini"): continue output_path = filename.replace(self.checked_in_metadata_dir, self.metadat...
[ "def", "_copy_checked_in_metadata", "(", "self", ")", ":", "for", "filename", "in", "self", ".", "fs", ".", "files_under", "(", "self", ".", "checked_in_metadata_dir", ")", ":", "if", "not", "fnmatch", ".", "fnmatch", "(", "filename", ",", "\"*.ini\"", ")", ...
Copies checked-in metadata files to the metadata output directory.
[ "Copies", "checked", "-", "in", "metadata", "files", "to", "the", "metadata", "output", "directory", "." ]
[ "\"\"\"Copies checked-in metadata files to the metadata output directory.\"\"\"", "# We match any .ini files in the path. This will find .ini files", "# other than just metadata (such as tox.ini), but that is ok", "# since wptrunner will just ignore those.", "# Found a checked-in .ini file. Copy it to the m...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
92233c95d9060d8c272f75bc6e625095416d878e
sunlongbo/chromium
mojo/public/tools/mojom/mojom/generate/translate.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_ProcessElements
null
def _ProcessElements(scope, elements, operations_by_type): """Iterates over the given elements, running a function from operations_by_type for any element that matches a key in that dict. The scope is the name of the surrounding scope, such as a filename or struct name, used only in error messages.""" names_i...
Iterates over the given elements, running a function from operations_by_type for any element that matches a key in that dict. The scope is the name of the surrounding scope, such as a filename or struct name, used only in error messages.
Iterates over the given elements, running a function from operations_by_type for any element that matches a key in that dict. The scope is the name of the surrounding scope, such as a filename or struct name, used only in error messages.
[ "Iterates", "over", "the", "given", "elements", "running", "a", "function", "from", "operations_by_type", "for", "any", "element", "that", "matches", "a", "key", "in", "that", "dict", ".", "The", "scope", "is", "the", "name", "of", "the", "surrounding", "sco...
def _ProcessElements(scope, elements, operations_by_type): names_in_this_scope = set() for element in elements: element_type = type(element) if element_type in operations_by_type: if element.mojom_name in names_in_this_scope: raise Exception('Names must be unique within a scope. The name "%s" ...
[ "def", "_ProcessElements", "(", "scope", ",", "elements", ",", "operations_by_type", ")", ":", "names_in_this_scope", "=", "set", "(", ")", "for", "element", "in", "elements", ":", "element_type", "=", "type", "(", "element", ")", "if", "element_type", "in", ...
Iterates over the given elements, running a function from operations_by_type for any element that matches a key in that dict.
[ "Iterates", "over", "the", "given", "elements", "running", "a", "function", "from", "operations_by_type", "for", "any", "element", "that", "matches", "a", "key", "in", "that", "dict", "." ]
[ "\"\"\"Iterates over the given elements, running a function from\n operations_by_type for any element that matches a key in that dict. The scope\n is the name of the surrounding scope, such as a filename or struct name, used\n only in error messages.\"\"\"", "# pylint: disable=unidiomatic-typecheck" ]
[ { "param": "scope", "type": null }, { "param": "elements", "type": null }, { "param": "operations_by_type", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "scope", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "elements", "type": null, "docstring": null, "docstring_token...
92233c95d9060d8c272f75bc6e625095416d878e
sunlongbo/chromium
mojo/public/tools/mojom/mojom/generate/translate.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GetScopeForKind
<not_specific>
def _GetScopeForKind(module, kind): """For a given kind, returns a tuple of progressively more specific names used to qualify the kind. For example if kind is an enum named Bar nested in a struct Foo within module 'foo', this would return ('foo', 'Foo', 'Bar')""" if isinstance(kind, mojom.Enum) and kind.parent_...
For a given kind, returns a tuple of progressively more specific names used to qualify the kind. For example if kind is an enum named Bar nested in a struct Foo within module 'foo', this would return ('foo', 'Foo', 'Bar')
For a given kind, returns a tuple of progressively more specific names used to qualify the kind.
[ "For", "a", "given", "kind", "returns", "a", "tuple", "of", "progressively", "more", "specific", "names", "used", "to", "qualify", "the", "kind", "." ]
def _GetScopeForKind(module, kind): if isinstance(kind, mojom.Enum) and kind.parent_kind: return _GetScopeForKind(module, kind.parent_kind) + (kind.mojom_name, ) module_fragment = (module.mojom_namespace, ) if module.mojom_namespace else () kind_fragment = (kind.mojom_name, ) if kind else () return module_f...
[ "def", "_GetScopeForKind", "(", "module", ",", "kind", ")", ":", "if", "isinstance", "(", "kind", ",", "mojom", ".", "Enum", ")", "and", "kind", ".", "parent_kind", ":", "return", "_GetScopeForKind", "(", "module", ",", "kind", ".", "parent_kind", ")", "...
For a given kind, returns a tuple of progressively more specific names used to qualify the kind.
[ "For", "a", "given", "kind", "returns", "a", "tuple", "of", "progressively", "more", "specific", "names", "used", "to", "qualify", "the", "kind", "." ]
[ "\"\"\"For a given kind, returns a tuple of progressively more specific names\n used to qualify the kind. For example if kind is an enum named Bar nested in a\n struct Foo within module 'foo', this would return ('foo', 'Foo', 'Bar')\"\"\"", "# Enums may be nested in other kinds." ]
[ { "param": "module", "type": null }, { "param": "kind", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "module", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "kind", "type": null, "docstring": null, "docstring_tokens":...
92233c95d9060d8c272f75bc6e625095416d878e
sunlongbo/chromium
mojo/public/tools/mojom/mojom/generate/translate.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_LookupValueInScope
<not_specific>
def _LookupValueInScope(module, kind, identifier): """Given a kind and an identifier, this attempts to resolve the given identifier to a concrete NamedValue within the scope of the given kind.""" scope = _GetScopeForKind(module, kind) for i in reversed(range(len(scope) + 1)): qualified_name = '.'.join(scope...
Given a kind and an identifier, this attempts to resolve the given identifier to a concrete NamedValue within the scope of the given kind.
Given a kind and an identifier, this attempts to resolve the given identifier to a concrete NamedValue within the scope of the given kind.
[ "Given", "a", "kind", "and", "an", "identifier", "this", "attempts", "to", "resolve", "the", "given", "identifier", "to", "a", "concrete", "NamedValue", "within", "the", "scope", "of", "the", "given", "kind", "." ]
def _LookupValueInScope(module, kind, identifier): scope = _GetScopeForKind(module, kind) for i in reversed(range(len(scope) + 1)): qualified_name = '.'.join(scope[:i] + (identifier, )) value = module.values.get(qualified_name) if value: return value return None
[ "def", "_LookupValueInScope", "(", "module", ",", "kind", ",", "identifier", ")", ":", "scope", "=", "_GetScopeForKind", "(", "module", ",", "kind", ")", "for", "i", "in", "reversed", "(", "range", "(", "len", "(", "scope", ")", "+", "1", ")", ")", "...
Given a kind and an identifier, this attempts to resolve the given identifier to a concrete NamedValue within the scope of the given kind.
[ "Given", "a", "kind", "and", "an", "identifier", "this", "attempts", "to", "resolve", "the", "given", "identifier", "to", "a", "concrete", "NamedValue", "within", "the", "scope", "of", "the", "given", "kind", "." ]
[ "\"\"\"Given a kind and an identifier, this attempts to resolve the given\n identifier to a concrete NamedValue within the scope of the given kind.\"\"\"" ]
[ { "param": "module", "type": null }, { "param": "kind", "type": null }, { "param": "identifier", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "module", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "kind", "type": null, "docstring": null, "docstring_tokens":...
92233c95d9060d8c272f75bc6e625095416d878e
sunlongbo/chromium
mojo/public/tools/mojom/mojom/generate/translate.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_LookupValue
<not_specific>
def _LookupValue(module, parent_kind, implied_kind, ast_leaf_node): """Resolves a leaf node in the form ('IDENTIFIER', 'x') to a constant value identified by 'x' in some mojom definition. parent_kind is used as context when resolving the identifier. If the given leaf node is not an IDENTIFIER (e.g. already a co...
Resolves a leaf node in the form ('IDENTIFIER', 'x') to a constant value identified by 'x' in some mojom definition. parent_kind is used as context when resolving the identifier. If the given leaf node is not an IDENTIFIER (e.g. already a constant value), it is returned as-is. If implied_kind is provided, the ...
If implied_kind is provided, the parsed identifier may also be resolved within its scope as fallback. This can be useful for more concise value references when assigning enum-typed constants or field values.
[ "If", "implied_kind", "is", "provided", "the", "parsed", "identifier", "may", "also", "be", "resolved", "within", "its", "scope", "as", "fallback", ".", "This", "can", "be", "useful", "for", "more", "concise", "value", "references", "when", "assigning", "enum"...
def _LookupValue(module, parent_kind, implied_kind, ast_leaf_node): if not isinstance(ast_leaf_node, tuple) or ast_leaf_node[0] != 'IDENTIFIER': return ast_leaf_node identifier = ast_leaf_node[1] value = _LookupValueInScope(module, parent_kind, identifier) if value: return value value = (implied_kind ...
[ "def", "_LookupValue", "(", "module", ",", "parent_kind", ",", "implied_kind", ",", "ast_leaf_node", ")", ":", "if", "not", "isinstance", "(", "ast_leaf_node", ",", "tuple", ")", "or", "ast_leaf_node", "[", "0", "]", "!=", "'IDENTIFIER'", ":", "return", "ast...
Resolves a leaf node in the form ('IDENTIFIER', 'x') to a constant value identified by 'x' in some mojom definition.
[ "Resolves", "a", "leaf", "node", "in", "the", "form", "(", "'", "IDENTIFIER", "'", "'", "x", "'", ")", "to", "a", "constant", "value", "identified", "by", "'", "x", "'", "in", "some", "mojom", "definition", "." ]
[ "\"\"\"Resolves a leaf node in the form ('IDENTIFIER', 'x') to a constant value\n identified by 'x' in some mojom definition. parent_kind is used as context\n when resolving the identifier. If the given leaf node is not an IDENTIFIER\n (e.g. already a constant value), it is returned as-is.\n\n If implied_kind i...
[ { "param": "module", "type": null }, { "param": "parent_kind", "type": null }, { "param": "implied_kind", "type": null }, { "param": "ast_leaf_node", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "module", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parent_kind", "type": null, "docstring": null, "docstring_t...
92233c95d9060d8c272f75bc6e625095416d878e
sunlongbo/chromium
mojo/public/tools/mojom/mojom/generate/translate.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_Kind
<not_specific>
def _Kind(kinds, spec, scope): """Convert a type name into a mojom.Kind object. As a side-effect this function adds the result to 'kinds'. Args: kinds: {Dict[str, mojom.Kind]} All known kinds up to this point, indexed by their names. spec: {str} A name uniquely identifying a type. scope: {Tu...
Convert a type name into a mojom.Kind object. As a side-effect this function adds the result to 'kinds'. Args: kinds: {Dict[str, mojom.Kind]} All known kinds up to this point, indexed by their names. spec: {str} A name uniquely identifying a type. scope: {Tuple[str, str]} A tuple that looks li...
Convert a type name into a mojom.Kind object. As a side-effect this function adds the result to 'kinds'.
[ "Convert", "a", "type", "name", "into", "a", "mojom", ".", "Kind", "object", ".", "As", "a", "side", "-", "effect", "this", "function", "adds", "the", "result", "to", "'", "kinds", "'", "." ]
def _Kind(kinds, spec, scope): kind = _LookupKind(kinds, spec, scope) if kind: return kind if spec.startswith('?'): kind = _Kind(kinds, spec[1:], scope).MakeNullableKind() elif spec.startswith('a:'): kind = mojom.Array(_Kind(kinds, spec[2:], scope)) elif spec.startswith('asso:'): inner_kind = ...
[ "def", "_Kind", "(", "kinds", ",", "spec", ",", "scope", ")", ":", "kind", "=", "_LookupKind", "(", "kinds", ",", "spec", ",", "scope", ")", "if", "kind", ":", "return", "kind", "if", "spec", ".", "startswith", "(", "'?'", ")", ":", "kind", "=", ...
Convert a type name into a mojom.Kind object.
[ "Convert", "a", "type", "name", "into", "a", "mojom", ".", "Kind", "object", "." ]
[ "\"\"\"Convert a type name into a mojom.Kind object.\n\n As a side-effect this function adds the result to 'kinds'.\n\n Args:\n kinds: {Dict[str, mojom.Kind]} All known kinds up to this point, indexed by\n their names.\n spec: {str} A name uniquely identifying a type.\n scope: {Tuple[str, str]} A ...
[ { "param": "kinds", "type": null }, { "param": "spec", "type": null }, { "param": "scope", "type": null } ]
{ "returns": [ { "docstring": "{mojom.Kind} The type corresponding to 'spec'.", "docstring_tokens": [ "{", "mojom", ".", "Kind", "}", "The", "type", "corresponding", "to", "'", "spec", "'", "." ...
92233c95d9060d8c272f75bc6e625095416d878e
sunlongbo/chromium
mojo/public/tools/mojom/mojom/generate/translate.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_ResolveNumericEnumValues
null
def _ResolveNumericEnumValues(enum): """ Given a reference to a mojom.Enum, resolves and assigns the numeric value of each field, and also computes the min_value and max_value of the enum. """ # map of <mojom_name> -> integral value prev_value = -1 min_value = None max_value = None for field in enum....
Given a reference to a mojom.Enum, resolves and assigns the numeric value of each field, and also computes the min_value and max_value of the enum.
Given a reference to a mojom.Enum, resolves and assigns the numeric value of each field, and also computes the min_value and max_value of the enum.
[ "Given", "a", "reference", "to", "a", "mojom", ".", "Enum", "resolves", "and", "assigns", "the", "numeric", "value", "of", "each", "field", "and", "also", "computes", "the", "min_value", "and", "max_value", "of", "the", "enum", "." ]
def _ResolveNumericEnumValues(enum): prev_value = -1 min_value = None max_value = None for field in enum.fields: if field.value is None: prev_value += 1 elif _IsStrOrUnicode(field.value): prev_value = int(field.value, 0) elif isinstance(field.value, mojom.EnumValue): prev_value = f...
[ "def", "_ResolveNumericEnumValues", "(", "enum", ")", ":", "prev_value", "=", "-", "1", "min_value", "=", "None", "max_value", "=", "None", "for", "field", "in", "enum", ".", "fields", ":", "if", "field", ".", "value", "is", "None", ":", "prev_value", "+...
Given a reference to a mojom.Enum, resolves and assigns the numeric value of each field, and also computes the min_value and max_value of the enum.
[ "Given", "a", "reference", "to", "a", "mojom", ".", "Enum", "resolves", "and", "assigns", "the", "numeric", "value", "of", "each", "field", "and", "also", "computes", "the", "min_value", "and", "max_value", "of", "the", "enum", "." ]
[ "\"\"\"\n Given a reference to a mojom.Enum, resolves and assigns the numeric value of\n each field, and also computes the min_value and max_value of the enum.\n \"\"\"", "# map of <mojom_name> -> integral value", "# This enum value is +1 the previous enum value (e.g: BEGIN).", "# Integral value (e.g: BEGI...
[ { "param": "enum", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "enum", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
92233c95d9060d8c272f75bc6e625095416d878e
sunlongbo/chromium
mojo/public/tools/mojom/mojom/generate/translate.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_CollectReferencedKinds
<not_specific>
def _CollectReferencedKinds(module, all_defined_kinds): """ Takes a {mojom.Module} object and a list of all defined kinds within that module, and enumerates the complete dict of user-defined mojom types (as {mojom.Kind} objects) referenced by the module's own defined kinds (i.e. as types of struct or union or...
Takes a {mojom.Module} object and a list of all defined kinds within that module, and enumerates the complete dict of user-defined mojom types (as {mojom.Kind} objects) referenced by the module's own defined kinds (i.e. as types of struct or union or interface parameters. The returned dict is keyed by kind s...
Takes a {mojom.Module} object and a list of all defined kinds within that module, and enumerates the complete dict of user-defined mojom types (as {mojom.Kind} objects) referenced by the module's own defined kinds (i.e. as types of struct or union or interface parameters. The returned dict is keyed by kind spec.
[ "Takes", "a", "{", "mojom", ".", "Module", "}", "object", "and", "a", "list", "of", "all", "defined", "kinds", "within", "that", "module", "and", "enumerates", "the", "complete", "dict", "of", "user", "-", "defined", "mojom", "types", "(", "as", "{", "...
def _CollectReferencedKinds(module, all_defined_kinds): def extract_referenced_user_kinds(kind): if mojom.IsArrayKind(kind): return extract_referenced_user_kinds(kind.kind) if mojom.IsMapKind(kind): return (extract_referenced_user_kinds(kind.key_kind) + extract_referenced_user_kinds(...
[ "def", "_CollectReferencedKinds", "(", "module", ",", "all_defined_kinds", ")", ":", "def", "extract_referenced_user_kinds", "(", "kind", ")", ":", "if", "mojom", ".", "IsArrayKind", "(", "kind", ")", ":", "return", "extract_referenced_user_kinds", "(", "kind", "....
Takes a {mojom.Module} object and a list of all defined kinds within that module, and enumerates the complete dict of user-defined mojom types (as {mojom.Kind} objects) referenced by the module's own defined kinds (i.e.
[ "Takes", "a", "{", "mojom", ".", "Module", "}", "object", "and", "a", "list", "of", "all", "defined", "kinds", "within", "that", "module", "and", "enumerates", "the", "complete", "dict", "of", "user", "-", "defined", "mojom", "types", "(", "as", "{", "...
[ "\"\"\"\n Takes a {mojom.Module} object and a list of all defined kinds within that\n module, and enumerates the complete dict of user-defined mojom types\n (as {mojom.Kind} objects) referenced by the module's own defined kinds (i.e.\n as types of struct or union or interface parameters. The returned dict is\n ...
[ { "param": "module", "type": null }, { "param": "all_defined_kinds", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "module", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "all_defined_kinds", "type": null, "docstring": null, "docst...
92233c95d9060d8c272f75bc6e625095416d878e
sunlongbo/chromium
mojo/public/tools/mojom/mojom/generate/translate.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_AssignDefaultOrdinals
null
def _AssignDefaultOrdinals(items): """Assigns default ordinal values to a sequence of items if necessary.""" next_ordinal = 0 for item in items: if item.ordinal is not None: next_ordinal = item.ordinal + 1 else: item.ordinal = next_ordinal next_ordinal += 1
Assigns default ordinal values to a sequence of items if necessary.
Assigns default ordinal values to a sequence of items if necessary.
[ "Assigns", "default", "ordinal", "values", "to", "a", "sequence", "of", "items", "if", "necessary", "." ]
def _AssignDefaultOrdinals(items): next_ordinal = 0 for item in items: if item.ordinal is not None: next_ordinal = item.ordinal + 1 else: item.ordinal = next_ordinal next_ordinal += 1
[ "def", "_AssignDefaultOrdinals", "(", "items", ")", ":", "next_ordinal", "=", "0", "for", "item", "in", "items", ":", "if", "item", ".", "ordinal", "is", "not", "None", ":", "next_ordinal", "=", "item", ".", "ordinal", "+", "1", "else", ":", "item", "....
Assigns default ordinal values to a sequence of items if necessary.
[ "Assigns", "default", "ordinal", "values", "to", "a", "sequence", "of", "items", "if", "necessary", "." ]
[ "\"\"\"Assigns default ordinal values to a sequence of items if necessary.\"\"\"" ]
[ { "param": "items", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "items", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
92233c95d9060d8c272f75bc6e625095416d878e
sunlongbo/chromium
mojo/public/tools/mojom/mojom/generate/translate.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_AssertTypeIsStable
null
def _AssertTypeIsStable(kind): """Raises an error if a type is not stable, meaning it is composed of at least one type that is not marked [Stable].""" def assertDependencyIsStable(dependency): if (mojom.IsEnumKind(dependency) or mojom.IsStructKind(dependency) or mojom.IsUnionKind(dependency) or mojom...
Raises an error if a type is not stable, meaning it is composed of at least one type that is not marked [Stable].
Raises an error if a type is not stable, meaning it is composed of at least one type that is not marked [Stable].
[ "Raises", "an", "error", "if", "a", "type", "is", "not", "stable", "meaning", "it", "is", "composed", "of", "at", "least", "one", "type", "that", "is", "not", "marked", "[", "Stable", "]", "." ]
def _AssertTypeIsStable(kind): def assertDependencyIsStable(dependency): if (mojom.IsEnumKind(dependency) or mojom.IsStructKind(dependency) or mojom.IsUnionKind(dependency) or mojom.IsInterfaceKind(dependency)): if not dependency.stable: raise Exception( '%s is marked [Stable] bu...
[ "def", "_AssertTypeIsStable", "(", "kind", ")", ":", "def", "assertDependencyIsStable", "(", "dependency", ")", ":", "if", "(", "mojom", ".", "IsEnumKind", "(", "dependency", ")", "or", "mojom", ".", "IsStructKind", "(", "dependency", ")", "or", "mojom", "."...
Raises an error if a type is not stable, meaning it is composed of at least one type that is not marked [Stable].
[ "Raises", "an", "error", "if", "a", "type", "is", "not", "stable", "meaning", "it", "is", "composed", "of", "at", "least", "one", "type", "that", "is", "not", "marked", "[", "Stable", "]", "." ]
[ "\"\"\"Raises an error if a type is not stable, meaning it is composed of at least\n one type that is not marked [Stable].\"\"\"" ]
[ { "param": "kind", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "kind", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f5ab78fffdc31a58767d0689d83f9c99cee55fc0
sunlongbo/chromium
remoting/tools/build/remoting_copy_locales.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
calc_output
<not_specific>
def calc_output(locale): """Determine the file that will be generated for the given locale.""" #e.g. '<(INTERMEDIATE_DIR)/remoting_locales/da.pak', if OS == 'mac' or OS == 'ios': # For Cocoa to find the locale at runtime, it needs to use '_' instead # of '-' (http://crbug.com/20441). return os.path.jo...
Determine the file that will be generated for the given locale.
Determine the file that will be generated for the given locale.
[ "Determine", "the", "file", "that", "will", "be", "generated", "for", "the", "given", "locale", "." ]
def calc_output(locale): if OS == 'mac' or OS == 'ios': return os.path.join(INT_DIR, 'remoting', 'resources', '%s.lproj' % locale.replace('-', '_'), 'locale.pak') else: return os.path.join(INT_DIR, 'remoting_locales', locale + '.pak')
[ "def", "calc_output", "(", "locale", ")", ":", "if", "OS", "==", "'mac'", "or", "OS", "==", "'ios'", ":", "return", "os", ".", "path", ".", "join", "(", "INT_DIR", ",", "'remoting'", ",", "'resources'", ",", "'%s.lproj'", "%", "locale", ".", "replace",...
Determine the file that will be generated for the given locale.
[ "Determine", "the", "file", "that", "will", "be", "generated", "for", "the", "given", "locale", "." ]
[ "\"\"\"Determine the file that will be generated for the given locale.\"\"\"", "#e.g. '<(INTERMEDIATE_DIR)/remoting_locales/da.pak',", "# For Cocoa to find the locale at runtime, it needs to use '_' instead", "# of '-' (http://crbug.com/20441)." ]
[ { "param": "locale", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "locale", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f5ab78fffdc31a58767d0689d83f9c99cee55fc0
sunlongbo/chromium
remoting/tools/build/remoting_copy_locales.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
calc_inputs
<not_specific>
def calc_inputs(locale): """Determine the files that need processing for the given locale.""" inputs = [] #e.g. '<(grit_out_dir)/remoting/resources/da.pak' inputs.append(os.path.join(GRIT_DIR, 'remoting/resources/%s.pak' % locale)) # Add any extra input files. for extra_file in EXTRA_INPUT_FILES: inpu...
Determine the files that need processing for the given locale.
Determine the files that need processing for the given locale.
[ "Determine", "the", "files", "that", "need", "processing", "for", "the", "given", "locale", "." ]
def calc_inputs(locale): inputs = [] inputs.append(os.path.join(GRIT_DIR, 'remoting/resources/%s.pak' % locale)) for extra_file in EXTRA_INPUT_FILES: inputs.append('%s_%s.pak' % (extra_file, locale)) return inputs
[ "def", "calc_inputs", "(", "locale", ")", ":", "inputs", "=", "[", "]", "inputs", ".", "append", "(", "os", ".", "path", ".", "join", "(", "GRIT_DIR", ",", "'remoting/resources/%s.pak'", "%", "locale", ")", ")", "for", "extra_file", "in", "EXTRA_INPUT_FILE...
Determine the files that need processing for the given locale.
[ "Determine", "the", "files", "that", "need", "processing", "for", "the", "given", "locale", "." ]
[ "\"\"\"Determine the files that need processing for the given locale.\"\"\"", "#e.g. '<(grit_out_dir)/remoting/resources/da.pak'", "# Add any extra input files." ]
[ { "param": "locale", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "locale", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f5ab78fffdc31a58767d0689d83f9c99cee55fc0
sunlongbo/chromium
remoting/tools/build/remoting_copy_locales.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
repack_locales
null
def repack_locales(locales): """ Loop over and repack the given locales.""" for locale in locales: inputs = calc_inputs(locale) output = calc_output(locale) data_pack.RePack(output, inputs)
Loop over and repack the given locales.
Loop over and repack the given locales.
[ "Loop", "over", "and", "repack", "the", "given", "locales", "." ]
def repack_locales(locales): for locale in locales: inputs = calc_inputs(locale) output = calc_output(locale) data_pack.RePack(output, inputs)
[ "def", "repack_locales", "(", "locales", ")", ":", "for", "locale", "in", "locales", ":", "inputs", "=", "calc_inputs", "(", "locale", ")", "output", "=", "calc_output", "(", "locale", ")", "data_pack", ".", "RePack", "(", "output", ",", "inputs", ")" ]
Loop over and repack the given locales.
[ "Loop", "over", "and", "repack", "the", "given", "locales", "." ]
[ "\"\"\" Loop over and repack the given locales.\"\"\"" ]
[ { "param": "locales", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "locales", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b402622f12a1b6fbb5243cbe76cddb890117c4dc
sunlongbo/chromium
chrome/updater/win/installer/create_installer_archive.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CopyAllFilesToStagingDir
null
def CopyAllFilesToStagingDir(config, staging_dir, build_dir, timestamp): """Copies the files required for installer archive. """ CopySectionFilesToStagingDir(config, 'GENERAL', staging_dir, build_dir, timestamp)
Copies the files required for installer archive.
Copies the files required for installer archive.
[ "Copies", "the", "files", "required", "for", "installer", "archive", "." ]
def CopyAllFilesToStagingDir(config, staging_dir, build_dir, timestamp): CopySectionFilesToStagingDir(config, 'GENERAL', staging_dir, build_dir, timestamp)
[ "def", "CopyAllFilesToStagingDir", "(", "config", ",", "staging_dir", ",", "build_dir", ",", "timestamp", ")", ":", "CopySectionFilesToStagingDir", "(", "config", ",", "'GENERAL'", ",", "staging_dir", ",", "build_dir", ",", "timestamp", ")" ]
Copies the files required for installer archive.
[ "Copies", "the", "files", "required", "for", "installer", "archive", "." ]
[ "\"\"\"Copies the files required for installer archive.\n \"\"\"" ]
[ { "param": "config", "type": null }, { "param": "staging_dir", "type": null }, { "param": "build_dir", "type": null }, { "param": "timestamp", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "config", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "staging_dir", "type": null, "docstring": null, "docstring_t...
b402622f12a1b6fbb5243cbe76cddb890117c4dc
sunlongbo/chromium
chrome/updater/win/installer/create_installer_archive.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CopySectionFilesToStagingDir
null
def CopySectionFilesToStagingDir(config, section, staging_dir, src_dir, timestamp): """Copies installer archive files specified in section from src_dir to staging_dir. This method reads section from config and copies all the files specified from src_dir to staging dir. """ for...
Copies installer archive files specified in section from src_dir to staging_dir. This method reads section from config and copies all the files specified from src_dir to staging dir.
Copies installer archive files specified in section from src_dir to staging_dir. This method reads section from config and copies all the files specified from src_dir to staging dir.
[ "Copies", "installer", "archive", "files", "specified", "in", "section", "from", "src_dir", "to", "staging_dir", ".", "This", "method", "reads", "section", "from", "config", "and", "copies", "all", "the", "files", "specified", "from", "src_dir", "to", "staging",...
def CopySectionFilesToStagingDir(config, section, staging_dir, src_dir, timestamp): for option in config.options(section): src_subdir = option.replace('\\', os.sep) dst_dir = os.path.join(staging_dir, config.get(section, option)) dst_dir = dst_dir.replace('\\', os.sep) ...
[ "def", "CopySectionFilesToStagingDir", "(", "config", ",", "section", ",", "staging_dir", ",", "src_dir", ",", "timestamp", ")", ":", "for", "option", "in", "config", ".", "options", "(", "section", ")", ":", "src_subdir", "=", "option", ".", "replace", "(",...
Copies installer archive files specified in section from src_dir to staging_dir.
[ "Copies", "installer", "archive", "files", "specified", "in", "section", "from", "src_dir", "to", "staging_dir", "." ]
[ "\"\"\"Copies installer archive files specified in section from src_dir to\n staging_dir. This method reads section from config and copies all the\n files specified from src_dir to staging dir.\n \"\"\"" ]
[ { "param": "config", "type": null }, { "param": "section", "type": null }, { "param": "staging_dir", "type": null }, { "param": "src_dir", "type": null }, { "param": "timestamp", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "config", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "section", "type": null, "docstring": null, "docstring_token...
b402622f12a1b6fbb5243cbe76cddb890117c4dc
sunlongbo/chromium
chrome/updater/win/installer/create_installer_archive.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Readconfig
<not_specific>
def Readconfig(input_file): """Reads config information from input file after setting default value of global variables. """ variables = {} variables['UpdaterDir'] = UPDATER_DIR config = configparser.ConfigParser(variables) config.read(input_file) return config
Reads config information from input file after setting default value of global variables.
Reads config information from input file after setting default value of global variables.
[ "Reads", "config", "information", "from", "input", "file", "after", "setting", "default", "value", "of", "global", "variables", "." ]
def Readconfig(input_file): variables = {} variables['UpdaterDir'] = UPDATER_DIR config = configparser.ConfigParser(variables) config.read(input_file) return config
[ "def", "Readconfig", "(", "input_file", ")", ":", "variables", "=", "{", "}", "variables", "[", "'UpdaterDir'", "]", "=", "UPDATER_DIR", "config", "=", "configparser", ".", "ConfigParser", "(", "variables", ")", "config", ".", "read", "(", "input_file", ")",...
Reads config information from input file after setting default value of global variables.
[ "Reads", "config", "information", "from", "input", "file", "after", "setting", "default", "value", "of", "global", "variables", "." ]
[ "\"\"\"Reads config information from input file after setting default value of\n global variables.\n \"\"\"" ]
[ { "param": "input_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_file", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b402622f12a1b6fbb5243cbe76cddb890117c4dc
sunlongbo/chromium
chrome/updater/win/installer/create_installer_archive.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CreateArchiveFile
<not_specific>
def CreateArchiveFile(options, staging_dir, timestamp): """Creates a new installer archive file after deleting any existing old file. """ # First create an uncompressed archive file for the current build (updater.7z) lzma_exec = GetLZMAExec(options.build_dir) archive_file = os.path.join(options.output_dir, ...
Creates a new installer archive file after deleting any existing old file.
Creates a new installer archive file after deleting any existing old file.
[ "Creates", "a", "new", "installer", "archive", "file", "after", "deleting", "any", "existing", "old", "file", "." ]
def CreateArchiveFile(options, staging_dir, timestamp): lzma_exec = GetLZMAExec(options.build_dir) archive_file = os.path.join(options.output_dir, options.output_name + ARCHIVE_SUFFIX) if options.depfile: def PathFixup(path): return path.replace('\\', '/').replace(' ', '\\ ...
[ "def", "CreateArchiveFile", "(", "options", ",", "staging_dir", ",", "timestamp", ")", ":", "lzma_exec", "=", "GetLZMAExec", "(", "options", ".", "build_dir", ")", "archive_file", "=", "os", ".", "path", ".", "join", "(", "options", ".", "output_dir", ",", ...
Creates a new installer archive file after deleting any existing old file.
[ "Creates", "a", "new", "installer", "archive", "file", "after", "deleting", "any", "existing", "old", "file", "." ]
[ "\"\"\"Creates a new installer archive file after deleting any existing old file.\n \"\"\"", "# First create an uncompressed archive file for the current build (updater.7z)", "# If a depfile was requested, do the glob of the staging dir and generate", "# a list of dependencies in .d format. We list the files...
[ { "param": "options", "type": null }, { "param": "staging_dir", "type": null }, { "param": "timestamp", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "options", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "staging_dir", "type": null, "docstring": null, "docstring_...
b402622f12a1b6fbb5243cbe76cddb890117c4dc
sunlongbo/chromium
chrome/updater/win/installer/create_installer_archive.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CreateResourceInputFile
null
def CreateResourceInputFile( output_dir, archive_file, resource_file_path, component_build, staging_dir): """Creates resource input file for installer target.""" # An array of (file, type, path) tuples of the files to be included. resources = [(archive_file, 'B7', os.path.join(output_...
Creates resource input file for installer target.
Creates resource input file for installer target.
[ "Creates", "resource", "input", "file", "for", "installer", "target", "." ]
def CreateResourceInputFile( output_dir, archive_file, resource_file_path, component_build, staging_dir): resources = [(archive_file, 'B7', os.path.join(output_dir, archive_file))] with open(resource_file_path, 'w') as f: f.write(_RESOURCE_FILE_HEADER) for (file, type, path) in r...
[ "def", "CreateResourceInputFile", "(", "output_dir", ",", "archive_file", ",", "resource_file_path", ",", "component_build", ",", "staging_dir", ")", ":", "resources", "=", "[", "(", "archive_file", ",", "'B7'", ",", "os", ".", "path", ".", "join", "(", "outpu...
Creates resource input file for installer target.
[ "Creates", "resource", "input", "file", "for", "installer", "target", "." ]
[ "\"\"\"Creates resource input file for installer target.\"\"\"", "# An array of (file, type, path) tuples of the files to be included." ]
[ { "param": "output_dir", "type": null }, { "param": "archive_file", "type": null }, { "param": "resource_file_path", "type": null }, { "param": "component_build", "type": null }, { "param": "staging_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "output_dir", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "archive_file", "type": null, "docstring": null, "docstr...
b402622f12a1b6fbb5243cbe76cddb890117c4dc
sunlongbo/chromium
chrome/updater/win/installer/create_installer_archive.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
main
null
def main(options): """Main method that reads input file, creates archive file and writes resource input file. """ config = Readconfig(options.input_file) staging_dir = MakeStagingDirectory(options.staging_dir) # Copy the files from the build dir. CopyAllFilesToStagingDir(config, staging_dir, options.bui...
Main method that reads input file, creates archive file and writes resource input file.
Main method that reads input file, creates archive file and writes resource input file.
[ "Main", "method", "that", "reads", "input", "file", "creates", "archive", "file", "and", "writes", "resource", "input", "file", "." ]
def main(options): config = Readconfig(options.input_file) staging_dir = MakeStagingDirectory(options.staging_dir) CopyAllFilesToStagingDir(config, staging_dir, options.build_dir, options.timestamp) if options.component_build == '1': DoComponentBuildTasks(staging_dir, options.buil...
[ "def", "main", "(", "options", ")", ":", "config", "=", "Readconfig", "(", "options", ".", "input_file", ")", "staging_dir", "=", "MakeStagingDirectory", "(", "options", ".", "staging_dir", ")", "CopyAllFilesToStagingDir", "(", "config", ",", "staging_dir", ",",...
Main method that reads input file, creates archive file and writes resource input file.
[ "Main", "method", "that", "reads", "input", "file", "creates", "archive", "file", "and", "writes", "resource", "input", "file", "." ]
[ "\"\"\"Main method that reads input file, creates archive file and writes\n resource input file.\n \"\"\"", "# Copy the files from the build dir.", "# Name of the archive file built (for example - updater.7z)" ]
[ { "param": "options", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "options", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b406fe0fa296734650fa5dd35497b942c4de9cda
sunlongbo/chromium
tools/binary_size/libsupersize/archive.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CreateMetadata
<not_specific>
def CreateMetadata(args, linker_name, build_config): """Creates metadata dict while updating |build_config|. Args: args: Resolved command-line args. linker_name: A coded linker name (see linker_map_parser.py). build_config: Common build configurations to update or to undergo consistency checks....
Creates metadata dict while updating |build_config|. Args: args: Resolved command-line args. linker_name: A coded linker name (see linker_map_parser.py). build_config: Common build configurations to update or to undergo consistency checks. Returns: A dict of models.METADATA_* -> values. Pe...
Creates metadata dict while updating |build_config|.
[ "Creates", "metadata", "dict", "while", "updating", "|build_config|", "." ]
def CreateMetadata(args, linker_name, build_config): logging.debug('Constructing metadata') def update_build_config(key, value): if key in build_config: old_value = build_config[key] if value != old_value: raise ValueError('Inconsistent {}: {} (was {})'.format( key, value, old_va...
[ "def", "CreateMetadata", "(", "args", ",", "linker_name", ",", "build_config", ")", ":", "logging", ".", "debug", "(", "'Constructing metadata'", ")", "def", "update_build_config", "(", "key", ",", "value", ")", ":", "if", "key", "in", "build_config", ":", "...
Creates metadata dict while updating |build_config|.
[ "Creates", "metadata", "dict", "while", "updating", "|build_config|", "." ]
[ "\"\"\"Creates metadata dict while updating |build_config|.\n\n Args:\n args: Resolved command-line args.\n linker_name: A coded linker name (see linker_map_parser.py).\n build_config: Common build configurations to update or to undergo\n consistency checks.\n\n Returns:\n A dict of models.META...
[ { "param": "args", "type": null }, { "param": "linker_name", "type": null }, { "param": "build_config", "type": null } ]
{ "returns": [ { "docstring": "A dict of models.METADATA_* -> values. Performs \"best effort\" extraction\nusing available data.", "docstring_tokens": [ "A", "dict", "of", "models", ".", "METADATA_", "*", "-", ">", "values...
b406fe0fa296734650fa5dd35497b942c4de9cda
sunlongbo/chromium
tools/binary_size/libsupersize/archive.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_ParseElfInfo
<not_specific>
def _ParseElfInfo(map_path, elf_path, tool_prefix, track_string_literals, outdir_context=None, linker_name=None): """Adds ELF section ranges and symbols.""" assert map_path or elf_path, 'Need a linker map or an ELF file.' assert map_path or not track_string_literals, ( 'track_string_litera...
Adds ELF section ranges and symbols.
Adds ELF section ranges and symbols.
[ "Adds", "ELF", "section", "ranges", "and", "symbols", "." ]
def _ParseElfInfo(map_path, elf_path, tool_prefix, track_string_literals, outdir_context=None, linker_name=None): assert map_path or elf_path, 'Need a linker map or an ELF file.' assert map_path or not track_string_literals, ( 'track_string_literals not yet implemented without map file') i...
[ "def", "_ParseElfInfo", "(", "map_path", ",", "elf_path", ",", "tool_prefix", ",", "track_string_literals", ",", "outdir_context", "=", "None", ",", "linker_name", "=", "None", ")", ":", "assert", "map_path", "or", "elf_path", ",", "'Need a linker map or an ELF file...
Adds ELF section ranges and symbols.
[ "Adds", "ELF", "section", "ranges", "and", "symbols", "." ]
[ "\"\"\"Adds ELF section ranges and symbols.\"\"\"", "# Run nm on the elf file to retrieve the list of symbol names per-address.", "# This list is required because the .map file contains only a single name", "# for each address, yet multiple symbols are often coalesced when they are", "# identical. This coal...
[ { "param": "map_path", "type": null }, { "param": "elf_path", "type": null }, { "param": "tool_prefix", "type": null }, { "param": "track_string_literals", "type": null }, { "param": "outdir_context", "type": null }, { "param": "linker_name", "type...
{ "returns": [], "raises": [], "params": [ { "identifier": "map_path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "elf_path", "type": null, "docstring": null, "docstring_to...
b406fe0fa296734650fa5dd35497b942c4de9cda
sunlongbo/chromium
tools/binary_size/libsupersize/archive.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CreateContainerAndSymbols
<not_specific>
def CreateContainerAndSymbols(knobs=None, opts=None, container_name=None, metadata=None, map_path=None, tool_prefix=None, output_directory=N...
Creates a Container (with sections sizes) and symbols for a SizeInfo. Args: knobs: Instance of SectionSizeKnobs. opts: Instance of ContainerArchiveOptions. container_name: Name for the created Container. May be '' if only one Container exists. metadata: Metadata dict from CreateMetadata(). ...
Creates a Container (with sections sizes) and symbols for a SizeInfo.
[ "Creates", "a", "Container", "(", "with", "sections", "sizes", ")", "and", "symbols", "for", "a", "SizeInfo", "." ]
def CreateContainerAndSymbols(knobs=None, opts=None, container_name=None, metadata=None, map_path=None, tool_prefix=None, output_directory=N...
[ "def", "CreateContainerAndSymbols", "(", "knobs", "=", "None", ",", "opts", "=", "None", ",", "container_name", "=", "None", ",", "metadata", "=", "None", ",", "map_path", "=", "None", ",", "tool_prefix", "=", "None", ",", "output_directory", "=", "None", ...
Creates a Container (with sections sizes) and symbols for a SizeInfo.
[ "Creates", "a", "Container", "(", "with", "sections", "sizes", ")", "and", "symbols", "for", "a", "SizeInfo", "." ]
[ "\"\"\"Creates a Container (with sections sizes) and symbols for a SizeInfo.\n\n Args:\n knobs: Instance of SectionSizeKnobs.\n opts: Instance of ContainerArchiveOptions.\n container_name: Name for the created Container. May be '' if only one\n Container exists.\n metadata: Metadata dict from Cr...
[ { "param": "knobs", "type": null }, { "param": "opts", "type": null }, { "param": "container_name", "type": null }, { "param": "metadata", "type": null }, { "param": "map_path", "type": null }, { "param": "tool_prefix", "type": null }, { "p...
{ "returns": [ { "docstring": "A tuple of (container, raw_symbols).\ncontainers is a Container instance that stores metadata and section_sizes\n(section_sizes maps section names to respective sizes).\nraw_symbols is a list of Symbol objects.", "docstring_tokens": [ "A", "tuple", ...
b406fe0fa296734650fa5dd35497b942c4de9cda
sunlongbo/chromium
tools/binary_size/libsupersize/archive.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_AddContainerArguments
null
def _AddContainerArguments(parser): """Add arguments applicable to a single container.""" # Special: Use _IdentifyInputFile() to detect main file argument. parser.add_argument('-f', metavar='FILE', help='Auto-identify input file type.') # Main file argument: Exactly one should be specifi...
Add arguments applicable to a single container.
Add arguments applicable to a single container.
[ "Add", "arguments", "applicable", "to", "a", "single", "container", "." ]
def _AddContainerArguments(parser): parser.add_argument('-f', metavar='FILE', help='Auto-identify input file type.') parser.add_argument('--apk-file', help='.apk file to measure. Other flags can generally be ' 'derived when this is used.') parser.a...
[ "def", "_AddContainerArguments", "(", "parser", ")", ":", "parser", ".", "add_argument", "(", "'-f'", ",", "metavar", "=", "'FILE'", ",", "help", "=", "'Auto-identify input file type.'", ")", "parser", ".", "add_argument", "(", "'--apk-file'", ",", "help", "=", ...
Add arguments applicable to a single container.
[ "Add", "arguments", "applicable", "to", "a", "single", "container", "." ]
[ "\"\"\"Add arguments applicable to a single container.\"\"\"", "# Special: Use _IdentifyInputFile() to detect main file argument.", "# Main file argument: Exactly one should be specified (perhaps via -f), with", "# the exception that --map-file can be specified in addition.", "# _IdentifyInputFile() should ...
[ { "param": "parser", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parser", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4ddd6372bb850795b3e9bc4e1583249b40fdd368
sunlongbo/chromium
third_party/blink/tools/blinkpy/web_tests/breakpad/dump_reader_win.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_find_depot_tools_path
<not_specific>
def _find_depot_tools_path(self): """Attempt to find depot_tools location in PATH.""" for i in self._host.environ.get('PATH').split(os.pathsep): if os.path.isfile(os.path.join(i, 'gclient')): return i
Attempt to find depot_tools location in PATH.
Attempt to find depot_tools location in PATH.
[ "Attempt", "to", "find", "depot_tools", "location", "in", "PATH", "." ]
def _find_depot_tools_path(self): for i in self._host.environ.get('PATH').split(os.pathsep): if os.path.isfile(os.path.join(i, 'gclient')): return i
[ "def", "_find_depot_tools_path", "(", "self", ")", ":", "for", "i", "in", "self", ".", "_host", ".", "environ", ".", "get", "(", "'PATH'", ")", ".", "split", "(", "os", ".", "pathsep", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "os", ...
Attempt to find depot_tools location in PATH.
[ "Attempt", "to", "find", "depot_tools", "location", "in", "PATH", "." ]
[ "\"\"\"Attempt to find depot_tools location in PATH.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4ddd6372bb850795b3e9bc4e1583249b40fdd368
sunlongbo/chromium
third_party/blink/tools/blinkpy/web_tests/breakpad/dump_reader_win.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_check_cdb_available
<not_specific>
def _check_cdb_available(self): """Checks whether we can use cdb to symbolize minidumps.""" if self._cdb_available is not None: return self._cdb_available cdb = self._host.filesystem.join(self._build_dir, 'cdb', 'cdb.exe') try: _ = self._host.executive.run_comman...
Checks whether we can use cdb to symbolize minidumps.
Checks whether we can use cdb to symbolize minidumps.
[ "Checks", "whether", "we", "can", "use", "cdb", "to", "symbolize", "minidumps", "." ]
def _check_cdb_available(self): if self._cdb_available is not None: return self._cdb_available cdb = self._host.filesystem.join(self._build_dir, 'cdb', 'cdb.exe') try: _ = self._host.executive.run_command([cdb, '-version']) except: pass else: ...
[ "def", "_check_cdb_available", "(", "self", ")", ":", "if", "self", ".", "_cdb_available", "is", "not", "None", ":", "return", "self", ".", "_cdb_available", "cdb", "=", "self", ".", "_host", ".", "filesystem", ".", "join", "(", "self", ".", "_build_dir", ...
Checks whether we can use cdb to symbolize minidumps.
[ "Checks", "whether", "we", "can", "use", "cdb", "to", "symbolize", "minidumps", "." ]
[ "\"\"\"Checks whether we can use cdb to symbolize minidumps.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
459aa68f5c90c9b6680c15056f4ba917432f4591
sunlongbo/chromium
tools/binary_size/libsupersize/canned_queries.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
TemplatesByName
<not_specific>
def TemplatesByName(self, symbols=None, depth=0): """Lists C++ templates grouped by name.""" symbols = self._SymbolsArg(symbols, native_only=True) # Call Sorted() twice so that subgroups will be sorted. # TODO(agrieve): Might be nice to recursively GroupedByName() on these. return symbols.WhereIsTem...
Lists C++ templates grouped by name.
Lists C++ templates grouped by name.
[ "Lists", "C", "++", "templates", "grouped", "by", "name", "." ]
def TemplatesByName(self, symbols=None, depth=0): symbols = self._SymbolsArg(symbols, native_only=True) return symbols.WhereIsTemplate().Sorted().GroupedByName(depth).Sorted()
[ "def", "TemplatesByName", "(", "self", ",", "symbols", "=", "None", ",", "depth", "=", "0", ")", ":", "symbols", "=", "self", ".", "_SymbolsArg", "(", "symbols", ",", "native_only", "=", "True", ")", "return", "symbols", ".", "WhereIsTemplate", "(", ")",...
Lists C++ templates grouped by name.
[ "Lists", "C", "++", "templates", "grouped", "by", "name", "." ]
[ "\"\"\"Lists C++ templates grouped by name.\"\"\"", "# Call Sorted() twice so that subgroups will be sorted.", "# TODO(agrieve): Might be nice to recursively GroupedByName() on these." ]
[ { "param": "self", "type": null }, { "param": "symbols", "type": null }, { "param": "depth", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "symbols", "type": null, "docstring": null, "docstring_tokens"...
459aa68f5c90c9b6680c15056f4ba917432f4591
sunlongbo/chromium
tools/binary_size/libsupersize/canned_queries.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
LargeFiles
<not_specific>
def LargeFiles(self, symbols=None, min_size=50 * 1024): """Lists source files that are larger than a certain size (default 50kb).""" symbols = self._SymbolsArg(symbols) return symbols.GroupedByPath(fallback=None).WherePssBiggerThan( min_size).Sorted()
Lists source files that are larger than a certain size (default 50kb).
Lists source files that are larger than a certain size (default 50kb).
[ "Lists", "source", "files", "that", "are", "larger", "than", "a", "certain", "size", "(", "default", "50kb", ")", "." ]
def LargeFiles(self, symbols=None, min_size=50 * 1024): symbols = self._SymbolsArg(symbols) return symbols.GroupedByPath(fallback=None).WherePssBiggerThan( min_size).Sorted()
[ "def", "LargeFiles", "(", "self", ",", "symbols", "=", "None", ",", "min_size", "=", "50", "*", "1024", ")", ":", "symbols", "=", "self", ".", "_SymbolsArg", "(", "symbols", ")", "return", "symbols", ".", "GroupedByPath", "(", "fallback", "=", "None", ...
Lists source files that are larger than a certain size (default 50kb).
[ "Lists", "source", "files", "that", "are", "larger", "than", "a", "certain", "size", "(", "default", "50kb", ")", "." ]
[ "\"\"\"Lists source files that are larger than a certain size (default 50kb).\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "symbols", "type": null }, { "param": "min_size", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "symbols", "type": null, "docstring": null, "docstring_tokens"...
24d97cd5ff42fccb0fdce9a1145c81f568a4a928
sunlongbo/chromium
tools/android/customtabs_benchmark/scripts/run_benchmark.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_ParseConfiguration
<not_specific>
def _ParseConfiguration(filename): """Reads a JSON file and returns a list of configurations. Each valid value in the JSON file can be either a scalar or a list of values. This function expands the scalar values to be lists. All list must have the same length. Sample configuration: { "url": "https://w...
Reads a JSON file and returns a list of configurations. Each valid value in the JSON file can be either a scalar or a list of values. This function expands the scalar values to be lists. All list must have the same length. Sample configuration: { "url": "https://www.android.com", "warmup": [false, t...
Reads a JSON file and returns a list of configurations. Each valid value in the JSON file can be either a scalar or a list of values. This function expands the scalar values to be lists. All list must have the same length.
[ "Reads", "a", "JSON", "file", "and", "returns", "a", "list", "of", "configurations", ".", "Each", "valid", "value", "in", "the", "JSON", "file", "can", "be", "either", "a", "scalar", "or", "a", "list", "of", "values", ".", "This", "function", "expands", ...
def _ParseConfiguration(filename): config = json.load(open(filename, 'r')) config.setdefault('pinning_benchmark', False) config.setdefault('pin_filename', '') config.setdefault('pin_offset', -1) config.setdefault('pin_length', -1) config.setdefault('extra_brief_memory_mb', 0) has_all_values = all(k in con...
[ "def", "_ParseConfiguration", "(", "filename", ")", ":", "config", "=", "json", ".", "load", "(", "open", "(", "filename", ",", "'r'", ")", ")", "config", ".", "setdefault", "(", "'pinning_benchmark'", ",", "False", ")", "config", ".", "setdefault", "(", ...
Reads a JSON file and returns a list of configurations.
[ "Reads", "a", "JSON", "file", "and", "returns", "a", "list", "of", "configurations", "." ]
[ "\"\"\"Reads a JSON file and returns a list of configurations.\n\n Each valid value in the JSON file can be either a scalar or a list of\n values. This function expands the scalar values to be lists. All list must\n have the same length.\n\n Sample configuration:\n {\n \"url\": \"https://www.android.com\",\...
[ { "param": "filename", "type": null } ]
{ "returns": [ { "docstring": "A list of configurations, where each value is specified.", "docstring_tokens": [ "A", "list", "of", "configurations", "where", "each", "value", "is", "specified", "." ], "type": n...
24d97cd5ff42fccb0fdce9a1145c81f568a4a928
sunlongbo/chromium
tools/android/customtabs_benchmark/scripts/run_benchmark.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_Run
null
def _Run(output_file_prefix, configs): """Loops the tests described by the configs on connected devices. Args: output_file_prefix: (str) Prefix for the output file name. configs: ([dict]) List of configurations. """ devices = device_utils.DeviceUtils.HealthyDevices() stop_event = threading.Event() ...
Loops the tests described by the configs on connected devices. Args: output_file_prefix: (str) Prefix for the output file name. configs: ([dict]) List of configurations.
Loops the tests described by the configs on connected devices.
[ "Loops", "the", "tests", "described", "by", "the", "configs", "on", "connected", "devices", "." ]
def _Run(output_file_prefix, configs): devices = device_utils.DeviceUtils.HealthyDevices() stop_event = threading.Event() threads = [] for device in devices: output_filename = '%s_%s.csv' % (output_file_prefix, str(device)) thread = threading.Thread( target=customtabs_benchmark.LoopOnDevice, ...
[ "def", "_Run", "(", "output_file_prefix", ",", "configs", ")", ":", "devices", "=", "device_utils", ".", "DeviceUtils", ".", "HealthyDevices", "(", ")", "stop_event", "=", "threading", ".", "Event", "(", ")", "threads", "=", "[", "]", "for", "device", "in"...
Loops the tests described by the configs on connected devices.
[ "Loops", "the", "tests", "described", "by", "the", "configs", "on", "connected", "devices", "." ]
[ "\"\"\"Loops the tests described by the configs on connected devices.\n\n Args:\n output_file_prefix: (str) Prefix for the output file name.\n configs: ([dict]) List of configurations.\n \"\"\"" ]
[ { "param": "output_file_prefix", "type": null }, { "param": "configs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "output_file_prefix", "type": null, "docstring": "(str) Prefix for the output file name.", "docstring_tokens": [ "(", "str", ")", "Prefix", "for", "the", "output", ...
24f758385700904cd60403de67694196b3d9c4e2
sunlongbo/chromium
tools/json_to_struct/element_generator.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_JSONToCString16
<not_specific>
def _JSONToCString16(json_string_literal): """Converts a JSON string literal to a C++ UTF-16 string literal. This is done by converting \\u#### to \\x####. """ c_string_literal = json_string_literal escape_index = c_string_literal.find('\\') while escape_index > 0: if c_string_literal[escape_index + 1] ...
Converts a JSON string literal to a C++ UTF-16 string literal. This is done by converting \\u#### to \\x####.
Converts a JSON string literal to a C++ UTF-16 string literal.
[ "Converts", "a", "JSON", "string", "literal", "to", "a", "C", "++", "UTF", "-", "16", "string", "literal", "." ]
def _JSONToCString16(json_string_literal): c_string_literal = json_string_literal escape_index = c_string_literal.find('\\') while escape_index > 0: if c_string_literal[escape_index + 1] == 'u': c_string_literal = (c_string_literal[0:escape_index + 1] + 'x' + c_string_literal[escape_index + 2:...
[ "def", "_JSONToCString16", "(", "json_string_literal", ")", ":", "c_string_literal", "=", "json_string_literal", "escape_index", "=", "c_string_literal", ".", "find", "(", "'\\\\'", ")", "while", "escape_index", ">", "0", ":", "if", "c_string_literal", "[", "escape_...
Converts a JSON string literal to a C++ UTF-16 string literal.
[ "Converts", "a", "JSON", "string", "literal", "to", "a", "C", "++", "UTF", "-", "16", "string", "literal", "." ]
[ "\"\"\"Converts a JSON string literal to a C++ UTF-16 string literal. This is\n done by converting \\\\u#### to \\\\x####.\n \"\"\"", "# We close the C string literal after the 4 hex digits and reopen it right", "# after, otherwise the Windows compiler will sometimes try to get more", "# than 4 characters i...
[ { "param": "json_string_literal", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "json_string_literal", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
24f758385700904cd60403de67694196b3d9c4e2
sunlongbo/chromium
tools/json_to_struct/element_generator.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GenerateString
null
def _GenerateString(content, lines, indent=' '): """Generates an UTF-8 string to be included in a static structure initializer. If content is not specified, uses NULL. """ if content is None: lines.append(indent + 'NULL,') else: # json.dumps quotes the string and escape characters as required. li...
Generates an UTF-8 string to be included in a static structure initializer. If content is not specified, uses NULL.
Generates an UTF-8 string to be included in a static structure initializer. If content is not specified, uses NULL.
[ "Generates", "an", "UTF", "-", "8", "string", "to", "be", "included", "in", "a", "static", "structure", "initializer", ".", "If", "content", "is", "not", "specified", "uses", "NULL", "." ]
def _GenerateString(content, lines, indent=' '): if content is None: lines.append(indent + 'NULL,') else: lines.append(indent + '%s,' % json.dumps(content))
[ "def", "_GenerateString", "(", "content", ",", "lines", ",", "indent", "=", "' '", ")", ":", "if", "content", "is", "None", ":", "lines", ".", "append", "(", "indent", "+", "'NULL,'", ")", "else", ":", "lines", ".", "append", "(", "indent", "+", "'%...
Generates an UTF-8 string to be included in a static structure initializer.
[ "Generates", "an", "UTF", "-", "8", "string", "to", "be", "included", "in", "a", "static", "structure", "initializer", "." ]
[ "\"\"\"Generates an UTF-8 string to be included in a static structure initializer.\n If content is not specified, uses NULL.\n \"\"\"", "# json.dumps quotes the string and escape characters as required." ]
[ { "param": "content", "type": null }, { "param": "lines", "type": null }, { "param": "indent", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "content", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lines", "type": null, "docstring": null, "docstring_tokens...
24f758385700904cd60403de67694196b3d9c4e2
sunlongbo/chromium
tools/json_to_struct/element_generator.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GenerateString16
null
def _GenerateString16(content, lines, indent=' '): """Generates an UTF-16 string to be included in a static structure initializer. If content is not specified, uses NULL. """ if content is None: lines.append(indent + 'NULL,') else: # json.dumps quotes the string and escape characters as required. ...
Generates an UTF-16 string to be included in a static structure initializer. If content is not specified, uses NULL.
Generates an UTF-16 string to be included in a static structure initializer. If content is not specified, uses NULL.
[ "Generates", "an", "UTF", "-", "16", "string", "to", "be", "included", "in", "a", "static", "structure", "initializer", ".", "If", "content", "is", "not", "specified", "uses", "NULL", "." ]
def _GenerateString16(content, lines, indent=' '): if content is None: lines.append(indent + 'NULL,') else: lines.append(indent + 'L%s,' % _JSONToCString16(json.dumps(content)))
[ "def", "_GenerateString16", "(", "content", ",", "lines", ",", "indent", "=", "' '", ")", ":", "if", "content", "is", "None", ":", "lines", ".", "append", "(", "indent", "+", "'NULL,'", ")", "else", ":", "lines", ".", "append", "(", "indent", "+", "...
Generates an UTF-16 string to be included in a static structure initializer.
[ "Generates", "an", "UTF", "-", "16", "string", "to", "be", "included", "in", "a", "static", "structure", "initializer", "." ]
[ "\"\"\"Generates an UTF-16 string to be included in a static structure\n initializer. If content is not specified, uses NULL.\n \"\"\"", "# json.dumps quotes the string and escape characters as required." ]
[ { "param": "content", "type": null }, { "param": "lines", "type": null }, { "param": "indent", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "content", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lines", "type": null, "docstring": null, "docstring_tokens...
24f758385700904cd60403de67694196b3d9c4e2
sunlongbo/chromium
tools/json_to_struct/element_generator.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GenerateArray
<not_specific>
def _GenerateArray(element_name, field_info, content, lines, indent, field_name_count): """Generates an array to be included in a static structure initializer. If content is not specified, uses NULL. The array is assigned to a temporary variable which is initialized before the structure. """ ...
Generates an array to be included in a static structure initializer. If content is not specified, uses NULL. The array is assigned to a temporary variable which is initialized before the structure.
Generates an array to be included in a static structure initializer. If content is not specified, uses NULL. The array is assigned to a temporary variable which is initialized before the structure.
[ "Generates", "an", "array", "to", "be", "included", "in", "a", "static", "structure", "initializer", ".", "If", "content", "is", "not", "specified", "uses", "NULL", ".", "The", "array", "is", "assigned", "to", "a", "temporary", "variable", "which", "is", "...
def _GenerateArray(element_name, field_info, content, lines, indent, field_name_count): if content is None: lines.append(indent + 'NULL,') lines.append(indent + '0,') return var = _GenerateArrayVariableName(element_name, field_info['field'], field_...
[ "def", "_GenerateArray", "(", "element_name", ",", "field_info", ",", "content", ",", "lines", ",", "indent", ",", "field_name_count", ")", ":", "if", "content", "is", "None", ":", "lines", ".", "append", "(", "indent", "+", "'NULL,'", ")", "lines", ".", ...
Generates an array to be included in a static structure initializer.
[ "Generates", "an", "array", "to", "be", "included", "in", "a", "static", "structure", "initializer", "." ]
[ "\"\"\"Generates an array to be included in a static structure initializer. If\n content is not specified, uses NULL. The array is assigned to a temporary\n variable which is initialized before the structure.\n \"\"\"", "# Size of the array.", "# Create a new array variable and use it in the structure initia...
[ { "param": "element_name", "type": null }, { "param": "field_info", "type": null }, { "param": "content", "type": null }, { "param": "lines", "type": null }, { "param": "indent", "type": null }, { "param": "field_name_count", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "element_name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "field_info", "type": null, "docstring": null, "docstr...
24f758385700904cd60403de67694196b3d9c4e2
sunlongbo/chromium
tools/json_to_struct/element_generator.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GenerateStruct
<not_specific>
def _GenerateStruct(element_name, field_info, content, lines, indent, field_name_count): """Generates a struct to be included in a static structure initializer. If content is not specified, uses {0}. """ if content is None: lines.append(indent + '{0},') return fields = field_info[...
Generates a struct to be included in a static structure initializer. If content is not specified, uses {0}.
Generates a struct to be included in a static structure initializer. If content is not specified, uses {0}.
[ "Generates", "a", "struct", "to", "be", "included", "in", "a", "static", "structure", "initializer", ".", "If", "content", "is", "not", "specified", "uses", "{", "0", "}", "." ]
def _GenerateStruct(element_name, field_info, content, lines, indent, field_name_count): if content is None: lines.append(indent + '{0},') return fields = field_info['fields'] lines.append(indent + '{') for field in fields: subcontent = content.get(field['field']) GenerateFie...
[ "def", "_GenerateStruct", "(", "element_name", ",", "field_info", ",", "content", ",", "lines", ",", "indent", ",", "field_name_count", ")", ":", "if", "content", "is", "None", ":", "lines", ".", "append", "(", "indent", "+", "'{0},'", ")", "return", "fiel...
Generates a struct to be included in a static structure initializer.
[ "Generates", "a", "struct", "to", "be", "included", "in", "a", "static", "structure", "initializer", "." ]
[ "\"\"\"Generates a struct to be included in a static structure initializer. If\n content is not specified, uses {0}.\n \"\"\"" ]
[ { "param": "element_name", "type": null }, { "param": "field_info", "type": null }, { "param": "content", "type": null }, { "param": "lines", "type": null }, { "param": "indent", "type": null }, { "param": "field_name_count", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "element_name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "field_info", "type": null, "docstring": null, "docstr...
24f758385700904cd60403de67694196b3d9c4e2
sunlongbo/chromium
tools/json_to_struct/element_generator.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GenerateFieldContent
null
def GenerateFieldContent(element_name, field_info, content, lines, indent, field_name_count): """Generate the content of a field to be included in the static structure initializer. If the field's content is not specified, uses the default value if one exists. """ if content is None: ...
Generate the content of a field to be included in the static structure initializer. If the field's content is not specified, uses the default value if one exists.
Generate the content of a field to be included in the static structure initializer. If the field's content is not specified, uses the default value if one exists.
[ "Generate", "the", "content", "of", "a", "field", "to", "be", "included", "in", "the", "static", "structure", "initializer", ".", "If", "the", "field", "'", "s", "content", "is", "not", "specified", "uses", "the", "default", "value", "if", "one", "exists",...
def GenerateFieldContent(element_name, field_info, content, lines, indent, field_name_count): if content is None: content = field_info.get('default', None) type = field_info['type'] if type in ('int', 'enum', 'class'): lines.append('%s%s,' % (indent, content)) elif type == 'stri...
[ "def", "GenerateFieldContent", "(", "element_name", ",", "field_info", ",", "content", ",", "lines", ",", "indent", ",", "field_name_count", ")", ":", "if", "content", "is", "None", ":", "content", "=", "field_info", ".", "get", "(", "'default'", ",", "None"...
Generate the content of a field to be included in the static structure initializer.
[ "Generate", "the", "content", "of", "a", "field", "to", "be", "included", "in", "the", "static", "structure", "initializer", "." ]
[ "\"\"\"Generate the content of a field to be included in the static structure\n initializer. If the field's content is not specified, uses the default value\n if one exists.\n \"\"\"" ]
[ { "param": "element_name", "type": null }, { "param": "field_info", "type": null }, { "param": "content", "type": null }, { "param": "lines", "type": null }, { "param": "indent", "type": null }, { "param": "field_name_count", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "element_name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "field_info", "type": null, "docstring": null, "docstr...
24f758385700904cd60403de67694196b3d9c4e2
sunlongbo/chromium
tools/json_to_struct/element_generator.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GenerateElement
<not_specific>
def GenerateElement(type_name, schema, element_name, element, field_name_count): """Generate the static structure initializer for one element. """ lines = []; lines.append('const %s %s = {' % (type_name, element_name)); for field_info in schema: content = element.get(field_info['field'], None) if (con...
Generate the static structure initializer for one element.
Generate the static structure initializer for one element.
[ "Generate", "the", "static", "structure", "initializer", "for", "one", "element", "." ]
def GenerateElement(type_name, schema, element_name, element, field_name_count): lines = []; lines.append('const %s %s = {' % (type_name, element_name)); for field_info in schema: content = element.get(field_info['field'], None) if (content == None and not field_info.get('optional', False)): raise R...
[ "def", "GenerateElement", "(", "type_name", ",", "schema", ",", "element_name", ",", "element", ",", "field_name_count", ")", ":", "lines", "=", "[", "]", ";", "lines", ".", "append", "(", "'const %s %s = {'", "%", "(", "type_name", ",", "element_name", ")",...
Generate the static structure initializer for one element.
[ "Generate", "the", "static", "structure", "initializer", "for", "one", "element", "." ]
[ "\"\"\"Generate the static structure initializer for one element.\n \"\"\"" ]
[ { "param": "type_name", "type": null }, { "param": "schema", "type": null }, { "param": "element_name", "type": null }, { "param": "element", "type": null }, { "param": "field_name_count", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "type_name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "schema", "type": null, "docstring": null, "docstring_tok...
24f758385700904cd60403de67694196b3d9c4e2
sunlongbo/chromium
tools/json_to_struct/element_generator.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GenerateElements
<not_specific>
def GenerateElements(type_name, schema, description, field_name_count={}): """Generate the static structure initializer for all the elements in the description['elements'] dictionary, as well as for any variables in description['int_variables']. """ result = []; for var_name, value in description.get('int_v...
Generate the static structure initializer for all the elements in the description['elements'] dictionary, as well as for any variables in description['int_variables'].
Generate the static structure initializer for all the elements in the description['elements'] dictionary, as well as for any variables in description['int_variables'].
[ "Generate", "the", "static", "structure", "initializer", "for", "all", "the", "elements", "in", "the", "description", "[", "'", "elements", "'", "]", "dictionary", "as", "well", "as", "for", "any", "variables", "in", "description", "[", "'", "int_variables", ...
def GenerateElements(type_name, schema, description, field_name_count={}): result = []; for var_name, value in description.get('int_variables', {}).items(): result.append('const int %s = %s;' % (var_name, value)) result.append('') for element_name, element in description.get('elements', {}).items(): res...
[ "def", "GenerateElements", "(", "type_name", ",", "schema", ",", "description", ",", "field_name_count", "=", "{", "}", ")", ":", "result", "=", "[", "]", ";", "for", "var_name", ",", "value", "in", "description", ".", "get", "(", "'int_variables'", ",", ...
Generate the static structure initializer for all the elements in the description['elements'] dictionary, as well as for any variables in description['int_variables'].
[ "Generate", "the", "static", "structure", "initializer", "for", "all", "the", "elements", "in", "the", "description", "[", "'", "elements", "'", "]", "dictionary", "as", "well", "as", "for", "any", "variables", "in", "description", "[", "'", "int_variables", ...
[ "\"\"\"Generate the static structure initializer for all the elements in the\n description['elements'] dictionary, as well as for any variables in\n description['int_variables'].\n \"\"\"" ]
[ { "param": "type_name", "type": null }, { "param": "schema", "type": null }, { "param": "description", "type": null }, { "param": "field_name_count", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "type_name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "schema", "type": null, "docstring": null, "docstring_tok...
7e211823dd6c658e76a3af564c38d283d4dd3e72
sunlongbo/chromium
components/url_pattern_index/PRESUBMIT.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CheckUrlPatternIndexFormatVersion
<not_specific>
def CheckUrlPatternIndexFormatVersion(input_api, output_api): """ Checks the kUrlPatternIndexFormatVersion is modified when necessary. Whenever any of the following files is changed: - components/url_pattern_index/flat/url_pattern_index.fbs - components/url_pattern_index/url_pattern_index.cc and kUrlPatt...
Checks the kUrlPatternIndexFormatVersion is modified when necessary. Whenever any of the following files is changed: - components/url_pattern_index/flat/url_pattern_index.fbs - components/url_pattern_index/url_pattern_index.cc and kUrlPatternIndexFormatVersion stays intact, this check returns a presubmi...
Checks the kUrlPatternIndexFormatVersion is modified when necessary.
[ "Checks", "the", "kUrlPatternIndexFormatVersion", "is", "modified", "when", "necessary", "." ]
def CheckUrlPatternIndexFormatVersion(input_api, output_api): url_pattern_index_files_changed = False url_pattern_index_version_changed = False for affected_file in input_api.AffectedFiles(): basename = input_api.basename(affected_file.LocalPath()) if (basename == 'url_pattern_index.fbs' or basena...
[ "def", "CheckUrlPatternIndexFormatVersion", "(", "input_api", ",", "output_api", ")", ":", "url_pattern_index_files_changed", "=", "False", "url_pattern_index_version_changed", "=", "False", "for", "affected_file", "in", "input_api", ".", "AffectedFiles", "(", ")", ":", ...
Checks the kUrlPatternIndexFormatVersion is modified when necessary.
[ "Checks", "the", "kUrlPatternIndexFormatVersion", "is", "modified", "when", "necessary", "." ]
[ "\"\"\" Checks the kUrlPatternIndexFormatVersion is modified when necessary.\n\n Whenever any of the following files is changed:\n - components/url_pattern_index/flat/url_pattern_index.fbs\n - components/url_pattern_index/url_pattern_index.cc\n and kUrlPatternIndexFormatVersion stays intact, this check retu...
[ { "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...