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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d14465b1d583952b03092345a96cc147d9cd97ca | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/extended_attribute.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | values | <not_specific> | def values(self):
"""
Returns a list of values for format Ident and IdentList. Returns an
empty list for format NorArgs. Otherwise, raises a ValueError.
"""
if self._format == self._FORM_NO_ARGS:
return ()
if self._format == self._FORM_IDENT:
ret... |
Returns a list of values for format Ident and IdentList. Returns an
empty list for format NorArgs. Otherwise, raises a ValueError.
| Returns a list of values for format Ident and IdentList. Returns an
empty list for format NorArgs. Otherwise, raises a ValueError. | [
"Returns",
"a",
"list",
"of",
"values",
"for",
"format",
"Ident",
"and",
"IdentList",
".",
"Returns",
"an",
"empty",
"list",
"for",
"format",
"NorArgs",
".",
"Otherwise",
"raises",
"a",
"ValueError",
"."
] | def values(self):
if self._format == self._FORM_NO_ARGS:
return ()
if self._format == self._FORM_IDENT:
return (self._values, )
if self._format == self._FORM_IDENT_LIST:
return self._values
raise ValueError('[{}] does not have a value.'.format(
... | [
"def",
"values",
"(",
"self",
")",
":",
"if",
"self",
".",
"_format",
"==",
"self",
".",
"_FORM_NO_ARGS",
":",
"return",
"(",
")",
"if",
"self",
".",
"_format",
"==",
"self",
".",
"_FORM_IDENT",
":",
"return",
"(",
"self",
".",
"_values",
",",
")",
... | Returns a list of values for format Ident and IdentList. | [
"Returns",
"a",
"list",
"of",
"values",
"for",
"format",
"Ident",
"and",
"IdentList",
"."
] | [
"\"\"\"\n Returns a list of values for format Ident and IdentList. Returns an\n empty list for format NorArgs. Otherwise, raises a ValueError.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d14465b1d583952b03092345a96cc147d9cd97ca | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/extended_attribute.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | arguments | <not_specific> | def arguments(self):
"""
Returns a list of value pairs for format ArgList and NamedArgList.
Otherwise, raises a ValueError.
"""
if self._format in (self._FORM_ARG_LIST, self._FORM_NAMED_ARG_LIST):
return self._arguments
raise ValueError('[{}] does not have an ... |
Returns a list of value pairs for format ArgList and NamedArgList.
Otherwise, raises a ValueError.
| Returns a list of value pairs for format ArgList and NamedArgList.
Otherwise, raises a ValueError. | [
"Returns",
"a",
"list",
"of",
"value",
"pairs",
"for",
"format",
"ArgList",
"and",
"NamedArgList",
".",
"Otherwise",
"raises",
"a",
"ValueError",
"."
] | def arguments(self):
if self._format in (self._FORM_ARG_LIST, self._FORM_NAMED_ARG_LIST):
return self._arguments
raise ValueError('[{}] does not have an argument.'.format(
self.syntactic_form)) | [
"def",
"arguments",
"(",
"self",
")",
":",
"if",
"self",
".",
"_format",
"in",
"(",
"self",
".",
"_FORM_ARG_LIST",
",",
"self",
".",
"_FORM_NAMED_ARG_LIST",
")",
":",
"return",
"self",
".",
"_arguments",
"raise",
"ValueError",
"(",
"'[{}] does not have an argu... | Returns a list of value pairs for format ArgList and NamedArgList. | [
"Returns",
"a",
"list",
"of",
"value",
"pairs",
"for",
"format",
"ArgList",
"and",
"NamedArgList",
"."
] | [
"\"\"\"\n Returns a list of value pairs for format ArgList and NamedArgList.\n Otherwise, raises a ValueError.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d14465b1d583952b03092345a96cc147d9cd97ca | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/extended_attribute.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | name | <not_specific> | def name(self):
"""
Returns |Name| for format NamedArgList. Otherwise, raises a ValueError.
"""
if self._format == self._FORM_NAMED_ARG_LIST:
return self._name
raise ValueError('[{}] does not have a name.'.format(
self.syntactic_form)) |
Returns |Name| for format NamedArgList. Otherwise, raises a ValueError.
| Returns |Name| for format NamedArgList. Otherwise, raises a ValueError. | [
"Returns",
"|Name|",
"for",
"format",
"NamedArgList",
".",
"Otherwise",
"raises",
"a",
"ValueError",
"."
] | def name(self):
if self._format == self._FORM_NAMED_ARG_LIST:
return self._name
raise ValueError('[{}] does not have a name.'.format(
self.syntactic_form)) | [
"def",
"name",
"(",
"self",
")",
":",
"if",
"self",
".",
"_format",
"==",
"self",
".",
"_FORM_NAMED_ARG_LIST",
":",
"return",
"self",
".",
"_name",
"raise",
"ValueError",
"(",
"'[{}] does not have a name.'",
".",
"format",
"(",
"self",
".",
"syntactic_form",
... | Returns |Name| for format NamedArgList. | [
"Returns",
"|Name|",
"for",
"format",
"NamedArgList",
"."
] | [
"\"\"\"\n Returns |Name| for format NamedArgList. Otherwise, raises a ValueError.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2a9a866420567068df46994cfa969f3be7a31f94 | sunlongbo/chromium | third_party/protobuf/python/google/protobuf/text_format.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MessageToString | <not_specific> | def MessageToString(
message,
as_utf8=False,
as_one_line=False,
use_short_repeated_primitives=False,
pointy_brackets=False,
use_index_order=False,
float_format=None,
double_format=None,
use_field_number=False,
descriptor_pool=None,
indent=0,
message_formatter=None,
pr... | Convert protobuf message to text format.
Double values can be formatted compactly with 15 digits of
precision (which is the most that IEEE 754 "double" can guarantee)
using double_format='.15g'. To ensure that converting to text and back to a
proto will result in an identical value, double_format='.17g' should... | Convert protobuf message to text format.
Double values can be formatted compactly with 15 digits of
precision (which is the most that IEEE 754 "double" can guarantee)
using double_format='.15g'. To ensure that converting to text and back to a
proto will result in an identical value, double_format='.17g' should be used. | [
"Convert",
"protobuf",
"message",
"to",
"text",
"format",
".",
"Double",
"values",
"can",
"be",
"formatted",
"compactly",
"with",
"15",
"digits",
"of",
"precision",
"(",
"which",
"is",
"the",
"most",
"that",
"IEEE",
"754",
"\"",
"double",
"\"",
"can",
"gua... | def MessageToString(
message,
as_utf8=False,
as_one_line=False,
use_short_repeated_primitives=False,
pointy_brackets=False,
use_index_order=False,
float_format=None,
double_format=None,
use_field_number=False,
descriptor_pool=None,
indent=0,
message_formatter=None,
pr... | [
"def",
"MessageToString",
"(",
"message",
",",
"as_utf8",
"=",
"False",
",",
"as_one_line",
"=",
"False",
",",
"use_short_repeated_primitives",
"=",
"False",
",",
"pointy_brackets",
"=",
"False",
",",
"use_index_order",
"=",
"False",
",",
"float_format",
"=",
"N... | Convert protobuf message to text format. | [
"Convert",
"protobuf",
"message",
"to",
"text",
"format",
"."
] | [
"# type: (...) -> str",
"\"\"\"Convert protobuf message to text format.\n\n Double values can be formatted compactly with 15 digits of\n precision (which is the most that IEEE 754 \"double\" can guarantee)\n using double_format='.15g'. To ensure that converting to text and back to a\n proto will result in an ... | [
{
"param": "message",
"type": null
},
{
"param": "as_utf8",
"type": null
},
{
"param": "as_one_line",
"type": null
},
{
"param": "use_short_repeated_primitives",
"type": null
},
{
"param": "pointy_brackets",
"type": null
},
{
"param": "use_index_order"... | {
"returns": [
{
"docstring": "A string of the text formatted protocol buffer message.",
"docstring_tokens": [
"A",
"string",
"of",
"the",
"text",
"formatted",
"protocol",
"buffer",
"message",
"."
],
"type": "s... |
2a9a866420567068df46994cfa969f3be7a31f94 | sunlongbo/chromium | third_party/protobuf/python/google/protobuf/text_format.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PrintField | null | def PrintField(field,
value,
out,
indent=0,
as_utf8=False,
as_one_line=False,
use_short_repeated_primitives=False,
pointy_brackets=False,
use_index_order=False,
float_format=None,
... | Print a single field name/value pair. | Print a single field name/value pair. | [
"Print",
"a",
"single",
"field",
"name",
"/",
"value",
"pair",
"."
] | def PrintField(field,
value,
out,
indent=0,
as_utf8=False,
as_one_line=False,
use_short_repeated_primitives=False,
pointy_brackets=False,
use_index_order=False,
float_format=None,
... | [
"def",
"PrintField",
"(",
"field",
",",
"value",
",",
"out",
",",
"indent",
"=",
"0",
",",
"as_utf8",
"=",
"False",
",",
"as_one_line",
"=",
"False",
",",
"use_short_repeated_primitives",
"=",
"False",
",",
"pointy_brackets",
"=",
"False",
",",
"use_index_or... | Print a single field name/value pair. | [
"Print",
"a",
"single",
"field",
"name",
"/",
"value",
"pair",
"."
] | [
"\"\"\"Print a single field name/value pair.\"\"\""
] | [
{
"param": "field",
"type": null
},
{
"param": "value",
"type": null
},
{
"param": "out",
"type": null
},
{
"param": "indent",
"type": null
},
{
"param": "as_utf8",
"type": null
},
{
"param": "as_one_line",
"type": null
},
{
"param": "use_s... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": null,
"docstring": null,
"docstring_tokens":... |
2a9a866420567068df46994cfa969f3be7a31f94 | sunlongbo/chromium | third_party/protobuf/python/google/protobuf/text_format.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PrintFieldValue | null | def PrintFieldValue(field,
value,
out,
indent=0,
as_utf8=False,
as_one_line=False,
use_short_repeated_primitives=False,
pointy_brackets=False,
use_index_order=F... | Print a single field value (not including name). | Print a single field value (not including name). | [
"Print",
"a",
"single",
"field",
"value",
"(",
"not",
"including",
"name",
")",
"."
] | def PrintFieldValue(field,
value,
out,
indent=0,
as_utf8=False,
as_one_line=False,
use_short_repeated_primitives=False,
pointy_brackets=False,
use_index_order=F... | [
"def",
"PrintFieldValue",
"(",
"field",
",",
"value",
",",
"out",
",",
"indent",
"=",
"0",
",",
"as_utf8",
"=",
"False",
",",
"as_one_line",
"=",
"False",
",",
"use_short_repeated_primitives",
"=",
"False",
",",
"pointy_brackets",
"=",
"False",
",",
"use_ind... | Print a single field value (not including name). | [
"Print",
"a",
"single",
"field",
"value",
"(",
"not",
"including",
"name",
")",
"."
] | [
"\"\"\"Print a single field value (not including name).\"\"\""
] | [
{
"param": "field",
"type": null
},
{
"param": "value",
"type": null
},
{
"param": "out",
"type": null
},
{
"param": "indent",
"type": null
},
{
"param": "as_utf8",
"type": null
},
{
"param": "as_one_line",
"type": null
},
{
"param": "use_s... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": null,
"docstring": null,
"docstring_tokens":... |
2a9a866420567068df46994cfa969f3be7a31f94 | sunlongbo/chromium | third_party/protobuf/python/google/protobuf/text_format.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _BuildMessageFromTypeName | <not_specific> | def _BuildMessageFromTypeName(type_name, descriptor_pool):
"""Returns a protobuf message instance.
Args:
type_name: Fully-qualified protobuf message type name string.
descriptor_pool: DescriptorPool instance.
Returns:
A Message instance of type matching type_name, or None if the a Descriptor
wa... | Returns a protobuf message instance.
Args:
type_name: Fully-qualified protobuf message type name string.
descriptor_pool: DescriptorPool instance.
Returns:
A Message instance of type matching type_name, or None if the a Descriptor
wasn't found matching type_name.
| Returns a protobuf message instance. | [
"Returns",
"a",
"protobuf",
"message",
"instance",
"."
] | def _BuildMessageFromTypeName(type_name, descriptor_pool):
if descriptor_pool is None:
from google.protobuf import descriptor_pool as pool_mod
descriptor_pool = pool_mod.Default()
from google.protobuf import symbol_database
database = symbol_database.Default()
try:
message_descriptor = descriptor_po... | [
"def",
"_BuildMessageFromTypeName",
"(",
"type_name",
",",
"descriptor_pool",
")",
":",
"if",
"descriptor_pool",
"is",
"None",
":",
"from",
"google",
".",
"protobuf",
"import",
"descriptor_pool",
"as",
"pool_mod",
"descriptor_pool",
"=",
"pool_mod",
".",
"Default",
... | Returns a protobuf message instance. | [
"Returns",
"a",
"protobuf",
"message",
"instance",
"."
] | [
"\"\"\"Returns a protobuf message instance.\n\n Args:\n type_name: Fully-qualified protobuf message type name string.\n descriptor_pool: DescriptorPool instance.\n\n Returns:\n A Message instance of type matching type_name, or None if the a Descriptor\n wasn't found matching type_name.\n \"\"\"",
... | [
{
"param": "type_name",
"type": null
},
{
"param": "descriptor_pool",
"type": null
}
] | {
"returns": [
{
"docstring": "A Message instance of type matching type_name, or None if the a Descriptor\nwasn't found matching type_name.",
"docstring_tokens": [
"A",
"Message",
"instance",
"of",
"type",
"matching",
"type_name",
"or",
... |
2a9a866420567068df46994cfa969f3be7a31f94 | sunlongbo/chromium | third_party/protobuf/python/google/protobuf/text_format.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _TryPrintAsAnyMessage | <not_specific> | def _TryPrintAsAnyMessage(self, message):
"""Serializes if message is a google.protobuf.Any field."""
if '/' not in message.type_url:
return False
packed_message = _BuildMessageFromTypeName(message.TypeName(),
self.descriptor_pool)
if packed_message:
... | Serializes if message is a google.protobuf.Any field. | Serializes if message is a google.protobuf.Any field. | [
"Serializes",
"if",
"message",
"is",
"a",
"google",
".",
"protobuf",
".",
"Any",
"field",
"."
] | def _TryPrintAsAnyMessage(self, message):
if '/' not in message.type_url:
return False
packed_message = _BuildMessageFromTypeName(message.TypeName(),
self.descriptor_pool)
if packed_message:
packed_message.MergeFromString(message.value)
colon ... | [
"def",
"_TryPrintAsAnyMessage",
"(",
"self",
",",
"message",
")",
":",
"if",
"'/'",
"not",
"in",
"message",
".",
"type_url",
":",
"return",
"False",
"packed_message",
"=",
"_BuildMessageFromTypeName",
"(",
"message",
".",
"TypeName",
"(",
")",
",",
"self",
"... | Serializes if message is a google.protobuf.Any field. | [
"Serializes",
"if",
"message",
"is",
"a",
"google",
".",
"protobuf",
".",
"Any",
"field",
"."
] | [
"\"\"\"Serializes if message is a google.protobuf.Any field.\"\"\""
] | [
{
"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": null,
"docstring_tokens"... |
2a9a866420567068df46994cfa969f3be7a31f94 | sunlongbo/chromium | third_party/protobuf/python/google/protobuf/text_format.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PrintMessage | <not_specific> | def PrintMessage(self, message):
"""Convert protobuf message to text format.
Args:
message: The protocol buffers message.
"""
if self.message_formatter and self._TryCustomFormatMessage(message):
return
if (message.DESCRIPTOR.full_name == _ANY_FULL_TYPE_NAME and
self._TryPrintAsA... | Convert protobuf message to text format.
Args:
message: The protocol buffers message.
| Convert protobuf message to text format. | [
"Convert",
"protobuf",
"message",
"to",
"text",
"format",
"."
] | def PrintMessage(self, message):
if self.message_formatter and self._TryCustomFormatMessage(message):
return
if (message.DESCRIPTOR.full_name == _ANY_FULL_TYPE_NAME and
self._TryPrintAsAnyMessage(message)):
return
fields = message.ListFields()
if self.use_index_order:
fields.so... | [
"def",
"PrintMessage",
"(",
"self",
",",
"message",
")",
":",
"if",
"self",
".",
"message_formatter",
"and",
"self",
".",
"_TryCustomFormatMessage",
"(",
"message",
")",
":",
"return",
"if",
"(",
"message",
".",
"DESCRIPTOR",
".",
"full_name",
"==",
"_ANY_FU... | Convert protobuf message to text format. | [
"Convert",
"protobuf",
"message",
"to",
"text",
"format",
"."
] | [
"\"\"\"Convert protobuf message to text format.\n\n Args:\n message: The protocol buffers message.\n \"\"\"",
"# This is slow for maps with submessage entries because it copies the",
"# entire tree. Unfortunately this would take significant refactoring",
"# of this file to work around.",
"#",
... | [
{
"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 protocol buffers message.... |
2a9a866420567068df46994cfa969f3be7a31f94 | sunlongbo/chromium | third_party/protobuf/python/google/protobuf/text_format.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _PrintShortRepeatedPrimitivesValue | null | def _PrintShortRepeatedPrimitivesValue(self, field, value):
""""Prints short repeated primitives value."""
# Note: this is called only when value has at least one element.
self._PrintFieldName(field)
self.out.write(' [')
for i in six.moves.range(len(value) - 1):
self.PrintFieldValue(field, val... | Prints short repeated primitives value. | Prints short repeated primitives value. | [
"Prints",
"short",
"repeated",
"primitives",
"value",
"."
] | def _PrintShortRepeatedPrimitivesValue(self, field, value):
self._PrintFieldName(field)
self.out.write(' [')
for i in six.moves.range(len(value) - 1):
self.PrintFieldValue(field, value[i])
self.out.write(', ')
self.PrintFieldValue(field, value[-1])
self.out.write(']')
if self.force_c... | [
"def",
"_PrintShortRepeatedPrimitivesValue",
"(",
"self",
",",
"field",
",",
"value",
")",
":",
"self",
".",
"_PrintFieldName",
"(",
"field",
")",
"self",
".",
"out",
".",
"write",
"(",
"' ['",
")",
"for",
"i",
"in",
"six",
".",
"moves",
".",
"range",
... | Prints short repeated primitives value. | [
"Prints",
"short",
"repeated",
"primitives",
"value",
"."
] | [
"\"\"\"\"Prints short repeated primitives value.\"\"\"",
"# Note: this is called only when value has at least one element."
] | [
{
"param": "self",
"type": null
},
{
"param": "field",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "field",
"type": null,
"docstring": null,
"docstring_tokens": ... |
2a9a866420567068df46994cfa969f3be7a31f94 | sunlongbo/chromium | third_party/protobuf/python/google/protobuf/text_format.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PrintFieldValue | null | def PrintFieldValue(self, field, value):
"""Print a single field value (not including name).
For repeated fields, the value should be a single element.
Args:
field: The descriptor of the field to be printed.
value: The value of the field.
"""
out = self.out
if field.cpp_type == des... | Print a single field value (not including name).
For repeated fields, the value should be a single element.
Args:
field: The descriptor of the field to be printed.
value: The value of the field.
| Print a single field value (not including name).
For repeated fields, the value should be a single element. | [
"Print",
"a",
"single",
"field",
"value",
"(",
"not",
"including",
"name",
")",
".",
"For",
"repeated",
"fields",
"the",
"value",
"should",
"be",
"a",
"single",
"element",
"."
] | def PrintFieldValue(self, field, value):
out = self.out
if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
self._PrintMessageFieldValue(value)
elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_ENUM:
enum_value = field.enum_type.values_by_number.get(value, None)
if enu... | [
"def",
"PrintFieldValue",
"(",
"self",
",",
"field",
",",
"value",
")",
":",
"out",
"=",
"self",
".",
"out",
"if",
"field",
".",
"cpp_type",
"==",
"descriptor",
".",
"FieldDescriptor",
".",
"CPPTYPE_MESSAGE",
":",
"self",
".",
"_PrintMessageFieldValue",
"(",... | Print a single field value (not including name). | [
"Print",
"a",
"single",
"field",
"value",
"(",
"not",
"including",
"name",
")",
"."
] | [
"\"\"\"Print a single field value (not including name).\n\n For repeated fields, the value should be a single element.\n\n Args:\n field: The descriptor of the field to be printed.\n value: The value of the field.\n \"\"\"",
"# We always need to escape all binary data in TYPE_BYTES fields."
] | [
{
"param": "self",
"type": null
},
{
"param": "field",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "field",
"type": null,
"docstring": "The descriptor of the field to ... |
2a9a866420567068df46994cfa969f3be7a31f94 | sunlongbo/chromium | third_party/protobuf/python/google/protobuf/text_format.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Merge | <not_specific> | def Merge(text,
message,
allow_unknown_extension=False,
allow_field_number=False,
descriptor_pool=None,
allow_unknown_field=False):
"""Parses a text representation of a protocol message into a message.
Like Parse(), but allows repeated values for a non-repeated fie... | Parses a text representation of a protocol message into a message.
Like Parse(), but allows repeated values for a non-repeated field, and uses
the last one. This means any non-repeated, top-level fields specified in text
replace those in the message.
Args:
text (str): Message text representation.
mess... | Parses a text representation of a protocol message into a message.
Like Parse(), but allows repeated values for a non-repeated field, and uses
the last one. This means any non-repeated, top-level fields specified in text
replace those in the message. | [
"Parses",
"a",
"text",
"representation",
"of",
"a",
"protocol",
"message",
"into",
"a",
"message",
".",
"Like",
"Parse",
"()",
"but",
"allows",
"repeated",
"values",
"for",
"a",
"non",
"-",
"repeated",
"field",
"and",
"uses",
"the",
"last",
"one",
".",
"... | def Merge(text,
message,
allow_unknown_extension=False,
allow_field_number=False,
descriptor_pool=None,
allow_unknown_field=False):
return MergeLines(
text.split(b'\n' if isinstance(text, bytes) else u'\n'),
message,
allow_unknown_extension,
al... | [
"def",
"Merge",
"(",
"text",
",",
"message",
",",
"allow_unknown_extension",
"=",
"False",
",",
"allow_field_number",
"=",
"False",
",",
"descriptor_pool",
"=",
"None",
",",
"allow_unknown_field",
"=",
"False",
")",
":",
"return",
"MergeLines",
"(",
"text",
".... | Parses a text representation of a protocol message into a message. | [
"Parses",
"a",
"text",
"representation",
"of",
"a",
"protocol",
"message",
"into",
"a",
"message",
"."
] | [
"\"\"\"Parses a text representation of a protocol message into a message.\n\n Like Parse(), but allows repeated values for a non-repeated field, and uses\n the last one. This means any non-repeated, top-level fields specified in text\n replace those in the message.\n\n Args:\n text (str): Message text repres... | [
{
"param": "text",
"type": null
},
{
"param": "message",
"type": null
},
{
"param": "allow_unknown_extension",
"type": null
},
{
"param": "allow_field_number",
"type": null
},
{
"param": "descriptor_pool",
"type": null
},
{
"param": "allow_unknown_fiel... | {
"returns": [
{
"docstring": "The same message passed as argument.",
"docstring_tokens": [
"The",
"same",
"message",
"passed",
"as",
"argument",
"."
],
"type": "Message"
}
],
"raises": [
{
"docstring": "On text pars... |
2a9a866420567068df46994cfa969f3be7a31f94 | sunlongbo/chromium | third_party/protobuf/python/google/protobuf/text_format.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParseLines | <not_specific> | def ParseLines(lines,
message,
allow_unknown_extension=False,
allow_field_number=False,
descriptor_pool=None,
allow_unknown_field=False):
"""Parses a text representation of a protocol message into a message.
See Parse() for caveats.
Args... | Parses a text representation of a protocol message into a message.
See Parse() for caveats.
Args:
lines: An iterable of lines of a message's text representation.
message: A protocol buffer message to merge into.
allow_unknown_extension: if True, skip over missing extensions and keep
parsing
... | Parses a text representation of a protocol message into a message.
See Parse() for caveats. | [
"Parses",
"a",
"text",
"representation",
"of",
"a",
"protocol",
"message",
"into",
"a",
"message",
".",
"See",
"Parse",
"()",
"for",
"caveats",
"."
] | def ParseLines(lines,
message,
allow_unknown_extension=False,
allow_field_number=False,
descriptor_pool=None,
allow_unknown_field=False):
parser = _Parser(allow_unknown_extension,
allow_field_number,
descr... | [
"def",
"ParseLines",
"(",
"lines",
",",
"message",
",",
"allow_unknown_extension",
"=",
"False",
",",
"allow_field_number",
"=",
"False",
",",
"descriptor_pool",
"=",
"None",
",",
"allow_unknown_field",
"=",
"False",
")",
":",
"parser",
"=",
"_Parser",
"(",
"a... | Parses a text representation of a protocol message into a message. | [
"Parses",
"a",
"text",
"representation",
"of",
"a",
"protocol",
"message",
"into",
"a",
"message",
"."
] | [
"\"\"\"Parses a text representation of a protocol message into a message.\n\n See Parse() for caveats.\n\n Args:\n lines: An iterable of lines of a message's text representation.\n message: A protocol buffer message to merge into.\n allow_unknown_extension: if True, skip over missing extensions and keep\... | [
{
"param": "lines",
"type": null
},
{
"param": "message",
"type": null
},
{
"param": "allow_unknown_extension",
"type": null
},
{
"param": "allow_field_number",
"type": null
},
{
"param": "descriptor_pool",
"type": null
},
{
"param": "allow_unknown_fie... | {
"returns": [
{
"docstring": "The same message passed as argument.",
"docstring_tokens": [
"The",
"same",
"message",
"passed",
"as",
"argument",
"."
],
"type": null
}
],
"raises": [
{
"docstring": "On text parsing p... |
2a9a866420567068df46994cfa969f3be7a31f94 | sunlongbo/chromium | third_party/protobuf/python/google/protobuf/text_format.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MergeLines | <not_specific> | def MergeLines(lines,
message,
allow_unknown_extension=False,
allow_field_number=False,
descriptor_pool=None,
allow_unknown_field=False):
"""Parses a text representation of a protocol message into a message.
See Merge() for more details.
... | Parses a text representation of a protocol message into a message.
See Merge() for more details.
Args:
lines: An iterable of lines of a message's text representation.
message: A protocol buffer message to merge into.
allow_unknown_extension: if True, skip over missing extensions and keep
parsing... | Parses a text representation of a protocol message into a message.
See Merge() for more details. | [
"Parses",
"a",
"text",
"representation",
"of",
"a",
"protocol",
"message",
"into",
"a",
"message",
".",
"See",
"Merge",
"()",
"for",
"more",
"details",
"."
] | def MergeLines(lines,
message,
allow_unknown_extension=False,
allow_field_number=False,
descriptor_pool=None,
allow_unknown_field=False):
parser = _Parser(allow_unknown_extension,
allow_field_number,
descr... | [
"def",
"MergeLines",
"(",
"lines",
",",
"message",
",",
"allow_unknown_extension",
"=",
"False",
",",
"allow_field_number",
"=",
"False",
",",
"descriptor_pool",
"=",
"None",
",",
"allow_unknown_field",
"=",
"False",
")",
":",
"parser",
"=",
"_Parser",
"(",
"a... | Parses a text representation of a protocol message into a message. | [
"Parses",
"a",
"text",
"representation",
"of",
"a",
"protocol",
"message",
"into",
"a",
"message",
"."
] | [
"\"\"\"Parses a text representation of a protocol message into a message.\n\n See Merge() for more details.\n\n Args:\n lines: An iterable of lines of a message's text representation.\n message: A protocol buffer message to merge into.\n allow_unknown_extension: if True, skip over missing extensions and ... | [
{
"param": "lines",
"type": null
},
{
"param": "message",
"type": null
},
{
"param": "allow_unknown_extension",
"type": null
},
{
"param": "allow_field_number",
"type": null
},
{
"param": "descriptor_pool",
"type": null
},
{
"param": "allow_unknown_fie... | {
"returns": [
{
"docstring": "The same message passed as argument.",
"docstring_tokens": [
"The",
"same",
"message",
"passed",
"as",
"argument",
"."
],
"type": null
}
],
"raises": [
{
"docstring": "On text parsing p... |
2a9a866420567068df46994cfa969f3be7a31f94 | sunlongbo/chromium | third_party/protobuf/python/google/protobuf/text_format.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _MergeField | <not_specific> | def _MergeField(self, tokenizer, message):
"""Merges a single protocol message field into a message.
Args:
tokenizer: A tokenizer to parse the field name and values.
message: A protocol message to record the data.
Raises:
ParseError: In case of text parsing problems.
"""
message_... | Merges a single protocol message field into a message.
Args:
tokenizer: A tokenizer to parse the field name and values.
message: A protocol message to record the data.
Raises:
ParseError: In case of text parsing problems.
| Merges a single protocol message field into a message. | [
"Merges",
"a",
"single",
"protocol",
"message",
"field",
"into",
"a",
"message",
"."
] | def _MergeField(self, tokenizer, message):
message_descriptor = message.DESCRIPTOR
if (message_descriptor.full_name == _ANY_FULL_TYPE_NAME and
tokenizer.TryConsume('[')):
type_url_prefix, packed_type_name = self._ConsumeAnyTypeUrl(tokenizer)
tokenizer.Consume(']')
tokenizer.TryConsume(... | [
"def",
"_MergeField",
"(",
"self",
",",
"tokenizer",
",",
"message",
")",
":",
"message_descriptor",
"=",
"message",
".",
"DESCRIPTOR",
"if",
"(",
"message_descriptor",
".",
"full_name",
"==",
"_ANY_FULL_TYPE_NAME",
"and",
"tokenizer",
".",
"TryConsume",
"(",
"'... | Merges a single protocol message field into a message. | [
"Merges",
"a",
"single",
"protocol",
"message",
"field",
"into",
"a",
"message",
"."
] | [
"\"\"\"Merges a single protocol message field into a message.\n\n Args:\n tokenizer: A tokenizer to parse the field name and values.\n message: A protocol message to record the data.\n\n Raises:\n ParseError: In case of text parsing problems.\n \"\"\"",
"# pylint: disable=protected-access"... | [
{
"param": "self",
"type": null
},
{
"param": "tokenizer",
"type": null
},
{
"param": "message",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "In case of text parsing problems.",
"docstring_tokens": [
"In",
"case",
"of",
"text",
"parsing",
"problems",
"."
],
"type": "ParseError"
}
],
"params": [
{
"identifier":... |
845369a2be627d0860d463b18da393b71ad9c8b9 | sunlongbo/chromium | tools/python/google/process_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | KillAll | <not_specific> | def KillAll(executables):
"""Tries to kill all copies of each process in the processes list. Returns
an error if any running processes couldn't be killed.
"""
result = 0
if os.path.exists(TASKKILL):
command = [TASKKILL, '/f', '/im']
process_not_found_err = TASKKILL_PROCESS_NOT_FOUND_ERR
else:
c... | Tries to kill all copies of each process in the processes list. Returns
an error if any running processes couldn't be killed.
| Tries to kill all copies of each process in the processes list. Returns
an error if any running processes couldn't be killed. | [
"Tries",
"to",
"kill",
"all",
"copies",
"of",
"each",
"process",
"in",
"the",
"processes",
"list",
".",
"Returns",
"an",
"error",
"if",
"any",
"running",
"processes",
"couldn",
"'",
"t",
"be",
"killed",
"."
] | def KillAll(executables):
result = 0
if os.path.exists(TASKKILL):
command = [TASKKILL, '/f', '/im']
process_not_found_err = TASKKILL_PROCESS_NOT_FOUND_ERR
else:
command = [PSKILL, '/t']
process_not_found_err = PSKILL_PROCESS_NOT_FOUND_ERR
for name in executables:
new_error = RunCommand(comma... | [
"def",
"KillAll",
"(",
"executables",
")",
":",
"result",
"=",
"0",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"TASKKILL",
")",
":",
"command",
"=",
"[",
"TASKKILL",
",",
"'/f'",
",",
"'/im'",
"]",
"process_not_found_err",
"=",
"TASKKILL_PROCESS_NOT_FOUN... | Tries to kill all copies of each process in the processes list. | [
"Tries",
"to",
"kill",
"all",
"copies",
"of",
"each",
"process",
"in",
"the",
"processes",
"list",
"."
] | [
"\"\"\"Tries to kill all copies of each process in the processes list. Returns\n an error if any running processes couldn't be killed.\n \"\"\"",
"# Ignore \"process not found\" error."
] | [
{
"param": "executables",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "executables",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
845369a2be627d0860d463b18da393b71ad9c8b9 | sunlongbo/chromium | tools/python/google/process_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunCommandFull | <not_specific> | def RunCommandFull(command, verbose=True, collect_output=False,
print_output=True):
"""Runs the command list.
Prints the given command (which should be a list of one or more strings).
If specified, prints its stderr (and optionally stdout) to stdout,
line-buffered, converting line endings to... | Runs the command list.
Prints the given command (which should be a list of one or more strings).
If specified, prints its stderr (and optionally stdout) to stdout,
line-buffered, converting line endings to CRLF (see note below). If
specified, collects the output as a list of lines and returns it. Waits
for... | Runs the command list.
Prints the given command (which should be a list of one or more strings).
If specified, prints its stderr (and optionally stdout) to stdout,
line-buffered, converting line endings to CRLF . If
specified, collects the output as a list of lines and returns it. Waits
for the command to terminate a... | [
"Runs",
"the",
"command",
"list",
".",
"Prints",
"the",
"given",
"command",
"(",
"which",
"should",
"be",
"a",
"list",
"of",
"one",
"or",
"more",
"strings",
")",
".",
"If",
"specified",
"prints",
"its",
"stderr",
"(",
"and",
"optionally",
"stdout",
")",
... | def RunCommandFull(command, verbose=True, collect_output=False,
print_output=True):
print(
'\n' + subprocess.list2cmdline(command).replace('\\', '/') + '\n',
end=' ')
if verbose:
out = subprocess.PIPE
err = subprocess.STDOUT
else:
out = file(os.devnull, 'w')
err = su... | [
"def",
"RunCommandFull",
"(",
"command",
",",
"verbose",
"=",
"True",
",",
"collect_output",
"=",
"False",
",",
"print_output",
"=",
"True",
")",
":",
"print",
"(",
"'\\n'",
"+",
"subprocess",
".",
"list2cmdline",
"(",
"command",
")",
".",
"replace",
"(",
... | Runs the command list. | [
"Runs",
"the",
"command",
"list",
"."
] | [
"\"\"\"Runs the command list.\n\n Prints the given command (which should be a list of one or more strings).\n If specified, prints its stderr (and optionally stdout) to stdout,\n line-buffered, converting line endings to CRLF (see note below). If\n specified, collects the output as a list of lines and returns ... | [
{
"param": "command",
"type": null
},
{
"param": "verbose",
"type": null
},
{
"param": "collect_output",
"type": null
},
{
"param": "print_output",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "command",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "verbose",
"type": null,
"docstring": null,
"docstring_toke... |
845369a2be627d0860d463b18da393b71ad9c8b9 | sunlongbo/chromium | tools/python/google/process_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunCommand | <not_specific> | def RunCommand(command, verbose=True):
"""Runs the command list, printing its output and returning its exit status.
Prints the given command (which should be a list of one or more strings),
then runs it and prints its stderr (and optionally stdout) to stdout,
line-buffered, converting line endings to CRLF. Wa... | Runs the command list, printing its output and returning its exit status.
Prints the given command (which should be a list of one or more strings),
then runs it and prints its stderr (and optionally stdout) to stdout,
line-buffered, converting line endings to CRLF. Waits for the command to
terminate and retur... | Runs the command list, printing its output and returning its exit status.
Prints the given command (which should be a list of one or more strings),
then runs it and prints its stderr (and optionally stdout) to stdout,
line-buffered, converting line endings to CRLF. Waits for the command to
terminate and returns its st... | [
"Runs",
"the",
"command",
"list",
"printing",
"its",
"output",
"and",
"returning",
"its",
"exit",
"status",
".",
"Prints",
"the",
"given",
"command",
"(",
"which",
"should",
"be",
"a",
"list",
"of",
"one",
"or",
"more",
"strings",
")",
"then",
"runs",
"i... | def RunCommand(command, verbose=True):
return RunCommandFull(command, verbose)[0] | [
"def",
"RunCommand",
"(",
"command",
",",
"verbose",
"=",
"True",
")",
":",
"return",
"RunCommandFull",
"(",
"command",
",",
"verbose",
")",
"[",
"0",
"]"
] | Runs the command list, printing its output and returning its exit status. | [
"Runs",
"the",
"command",
"list",
"printing",
"its",
"output",
"and",
"returning",
"its",
"exit",
"status",
"."
] | [
"\"\"\"Runs the command list, printing its output and returning its exit status.\n\n Prints the given command (which should be a list of one or more strings),\n then runs it and prints its stderr (and optionally stdout) to stdout,\n line-buffered, converting line endings to CRLF. Waits for the command to\n ter... | [
{
"param": "command",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "command",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "verbose",
"type": null,
"docstring": null,
"docstring_toke... |
845369a2be627d0860d463b18da393b71ad9c8b9 | sunlongbo/chromium | tools/python/google/process_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunCommandsInParallel | <not_specific> | def RunCommandsInParallel(commands, verbose=True, collect_output=False,
print_output=True):
"""Runs a list of commands in parallel, waits for all commands to terminate
and returns their status. If specified, the ouput of commands can be
returned and/or printed.
Args:
commands: the... | Runs a list of commands in parallel, waits for all commands to terminate
and returns their status. If specified, the ouput of commands can be
returned and/or printed.
Args:
commands: the list of commands to run, each as a list of one or more
strings.
verbose: if True, combines stdout and st... | Runs a list of commands in parallel, waits for all commands to terminate
and returns their status. If specified, the ouput of commands can be
returned and/or printed.
the list of commands to run, each as a list of one or more
strings.
verbose: if True, combines stdout and stderr into stdout.
Otherwise, prints only the... | [
"Runs",
"a",
"list",
"of",
"commands",
"in",
"parallel",
"waits",
"for",
"all",
"commands",
"to",
"terminate",
"and",
"returns",
"their",
"status",
".",
"If",
"specified",
"the",
"ouput",
"of",
"commands",
"can",
"be",
"returned",
"and",
"/",
"or",
"printe... | def RunCommandsInParallel(commands, verbose=True, collect_output=False,
print_output=True):
command_num = len(commands)
outputs = [[] for i in xrange(command_num)]
procs = [None for i in xrange(command_num)]
eofs = [False for i in xrange(command_num)]
for command in commands:
pri... | [
"def",
"RunCommandsInParallel",
"(",
"commands",
",",
"verbose",
"=",
"True",
",",
"collect_output",
"=",
"False",
",",
"print_output",
"=",
"True",
")",
":",
"command_num",
"=",
"len",
"(",
"commands",
")",
"outputs",
"=",
"[",
"[",
"]",
"for",
"i",
"in... | Runs a list of commands in parallel, waits for all commands to terminate
and returns their status. | [
"Runs",
"a",
"list",
"of",
"commands",
"in",
"parallel",
"waits",
"for",
"all",
"commands",
"to",
"terminate",
"and",
"returns",
"their",
"status",
"."
] | [
"\"\"\"Runs a list of commands in parallel, waits for all commands to terminate\n and returns their status. If specified, the ouput of commands can be\n returned and/or printed.\n\n Args:\n commands: the list of commands to run, each as a list of one or more\n strings.\n verbose: if True, comb... | [
{
"param": "commands",
"type": null
},
{
"param": "verbose",
"type": null
},
{
"param": "collect_output",
"type": null
},
{
"param": "print_output",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "commands",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "verbose",
"type": null,
"docstring": null,
"docstring_tok... |
846ac27c58fa6286319604c444983d6db5a412f8 | sunlongbo/chromium | chrome/installer/mac/signing/commands.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | lenient_run_command_output | <not_specific> | def lenient_run_command_output(args, **kwargs):
"""Runs a command, being fairly tolerant of errors.
Returns:
A tuple of (returncode, stdoutdata, stderrdata), or if an OSError was
raised, (None, None, None).
"""
logger.info('Running command: %s', args)
try:
process = subproc... | Runs a command, being fairly tolerant of errors.
Returns:
A tuple of (returncode, stdoutdata, stderrdata), or if an OSError was
raised, (None, None, None).
| Runs a command, being fairly tolerant of errors. | [
"Runs",
"a",
"command",
"being",
"fairly",
"tolerant",
"of",
"errors",
"."
] | def lenient_run_command_output(args, **kwargs):
logger.info('Running command: %s', args)
try:
process = subprocess.Popen(
args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs)
except OSError:
return (None, None, None)
(stdout, stderr) = process.communicate()
ret... | [
"def",
"lenient_run_command_output",
"(",
"args",
",",
"**",
"kwargs",
")",
":",
"logger",
".",
"info",
"(",
"'Running command: %s'",
",",
"args",
")",
"try",
":",
"process",
"=",
"subprocess",
".",
"Popen",
"(",
"args",
",",
"stdout",
"=",
"subprocess",
"... | Runs a command, being fairly tolerant of errors. | [
"Runs",
"a",
"command",
"being",
"fairly",
"tolerant",
"of",
"errors",
"."
] | [
"\"\"\"Runs a command, being fairly tolerant of errors.\n\n Returns:\n A tuple of (returncode, stdoutdata, stderrdata), or if an OSError was\n raised, (None, None, None).\n \"\"\""
] | [
{
"param": "args",
"type": null
}
] | {
"returns": [
{
"docstring": "A tuple of (returncode, stdoutdata, stderrdata), or if an OSError was\nraised, (None, None, None).",
"docstring_tokens": [
"A",
"tuple",
"of",
"(",
"returncode",
"stdoutdata",
"stderrdata",
")",
"or"... |
846ac27c58fa6286319604c444983d6db5a412f8 | sunlongbo/chromium | chrome/installer/mac/signing/commands.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | macos_version | <not_specific> | def macos_version():
"""Determines the macOS version of the running system.
Returns:
A list containing one element for each component of the version number,
such as [10, 15, 6] and [11, 0].
"""
return [int(x) for x in platform.mac_ver()[0].split('.')] | Determines the macOS version of the running system.
Returns:
A list containing one element for each component of the version number,
such as [10, 15, 6] and [11, 0].
| Determines the macOS version of the running system. | [
"Determines",
"the",
"macOS",
"version",
"of",
"the",
"running",
"system",
"."
] | def macos_version():
return [int(x) for x in platform.mac_ver()[0].split('.')] | [
"def",
"macos_version",
"(",
")",
":",
"return",
"[",
"int",
"(",
"x",
")",
"for",
"x",
"in",
"platform",
".",
"mac_ver",
"(",
")",
"[",
"0",
"]",
".",
"split",
"(",
"'.'",
")",
"]"
] | Determines the macOS version of the running system. | [
"Determines",
"the",
"macOS",
"version",
"of",
"the",
"running",
"system",
"."
] | [
"\"\"\"Determines the macOS version of the running system.\n\n Returns:\n A list containing one element for each component of the version number,\n such as [10, 15, 6] and [11, 0].\n \"\"\""
] | [] | {
"returns": [
{
"docstring": "A list containing one element for each component of the version number,\nsuch as [10, 15, 6] and [11, 0].",
"docstring_tokens": [
"A",
"list",
"containing",
"one",
"element",
"for",
"each",
"component",
... |
846ac27c58fa6286319604c444983d6db5a412f8 | sunlongbo/chromium | chrome/installer/mac/signing/commands.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | read_plist | <not_specific> | def read_plist(path):
"""Loads Plist at |path| and returns it as a dictionary."""
if sys.version_info.major == 2:
fd, name = tempfile.mkstemp()
try:
subprocess.check_call(
['plutil', '-convert', 'xml1', '-o', name, path])
with os.fdopen(fd, 'rb') as f:
... | Loads Plist at |path| and returns it as a dictionary. | Loads Plist at |path| and returns it as a dictionary. | [
"Loads",
"Plist",
"at",
"|path|",
"and",
"returns",
"it",
"as",
"a",
"dictionary",
"."
] | def read_plist(path):
if sys.version_info.major == 2:
fd, name = tempfile.mkstemp()
try:
subprocess.check_call(
['plutil', '-convert', 'xml1', '-o', name, path])
with os.fdopen(fd, 'rb') as f:
return plistlib.readPlist(f)
finally:
... | [
"def",
"read_plist",
"(",
"path",
")",
":",
"if",
"sys",
".",
"version_info",
".",
"major",
"==",
"2",
":",
"fd",
",",
"name",
"=",
"tempfile",
".",
"mkstemp",
"(",
")",
"try",
":",
"subprocess",
".",
"check_call",
"(",
"[",
"'plutil'",
",",
"'-conve... | Loads Plist at |path| and returns it as a dictionary. | [
"Loads",
"Plist",
"at",
"|path|",
"and",
"returns",
"it",
"as",
"a",
"dictionary",
"."
] | [
"\"\"\"Loads Plist at |path| and returns it as a dictionary.\"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8473059884c51b62216f679b9739bd495056ced9 | sunlongbo/chromium | tools/binary_size/libsupersize/bcanalyzer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ParseTag | <not_specific> | def ParseTag(line):
"""Heuristically parses a single-line tag from bcanalyzer dump.
Since input data are machine-generated, so we only need "good enough" parsing
logic that favors simplicity. For example, '</FOO/>' is accepted.
Args:
line: Stripped line that may have a single-line tag with trailing text.
... | Heuristically parses a single-line tag from bcanalyzer dump.
Since input data are machine-generated, so we only need "good enough" parsing
logic that favors simplicity. For example, '</FOO/>' is accepted.
Args:
line: Stripped line that may have a single-line tag with trailing text.
Returns:
(tag_type... | Heuristically parses a single-line tag from bcanalyzer dump.
Since input data are machine-generated, so we only need "good enough" parsing
logic that favors simplicity. For example, '' is accepted. | [
"Heuristically",
"parses",
"a",
"single",
"-",
"line",
"tag",
"from",
"bcanalyzer",
"dump",
".",
"Since",
"input",
"data",
"are",
"machine",
"-",
"generated",
"so",
"we",
"only",
"need",
"\"",
"good",
"enough",
"\"",
"parsing",
"logic",
"that",
"favors",
"... | def ParseTag(line):
if len(line) < 2 or line[0] != '<':
return (None, None, None)
tag_type, pos = (CLOSING_TAG, 2) if line[1] == '/' else (OPENING_TAG, 1)
for i in range(pos, len(line)):
if not line[i].isalnum() and line[i] != '_':
if i == pos or not line[i] in ' >/':
break
end = line.... | [
"def",
"ParseTag",
"(",
"line",
")",
":",
"if",
"len",
"(",
"line",
")",
"<",
"2",
"or",
"line",
"[",
"0",
"]",
"!=",
"'<'",
":",
"return",
"(",
"None",
",",
"None",
",",
"None",
")",
"tag_type",
",",
"pos",
"=",
"(",
"CLOSING_TAG",
",",
"2",
... | Heuristically parses a single-line tag from bcanalyzer dump. | [
"Heuristically",
"parses",
"a",
"single",
"-",
"line",
"tag",
"from",
"bcanalyzer",
"dump",
"."
] | [
"\"\"\"Heuristically parses a single-line tag from bcanalyzer dump.\n\n Since input data are machine-generated, so we only need \"good enough\" parsing\n logic that favors simplicity. For example, '</FOO/>' is accepted.\n\n Args:\n line: Stripped line that may have a single-line tag with trailing text.\n\n R... | [
{
"param": "line",
"type": null
}
] | {
"returns": [
{
"docstring": "(tag_type, tag, attrib_pos) if successful, else (None) * 3. Details:\ntag_type: One of {OPENING_TAG, CLOSING_TAG, SELF_CLOSING_TAG}.\ntag: The tag name.\nattrib_pos: Position in |line| to start parsing attributes.",
"docstring_tokens": [
"(",
"tag_type",
... |
8473059884c51b62216f679b9739bd495056ced9 | sunlongbo/chromium | tools/binary_size/libsupersize/bcanalyzer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Feed | <not_specific> | def Feed(self, line, tag, attrib_pos):
"""Parses a single-line tag and store integer and integer array types.
Args:
line: Stripped line of single-line tag with op0=# op1=# ... data.
tag: The tag type in |line| (child tag of <TYPE_BLOCK_ID>).
attrib_pos: Position in |line| where attribute list... | Parses a single-line tag and store integer and integer array types.
Args:
line: Stripped line of single-line tag with op0=# op1=# ... data.
tag: The tag type in |line| (child tag of <TYPE_BLOCK_ID>).
attrib_pos: Position in |line| where attribute list starts.
| Parses a single-line tag and store integer and integer array types. | [
"Parses",
"a",
"single",
"-",
"line",
"tag",
"and",
"store",
"integer",
"and",
"integer",
"array",
"types",
"."
] | def Feed(self, line, tag, attrib_pos):
if tag in _NON_TYPE_TAGS:
return
if tag == 'INTEGER':
num_bits = next(_ParseOpItems(line, attrib_pos))
self.int_types[self.cur_type_id] = num_bits
elif tag == 'ARRAY':
[size, item_type_id] = list(_ParseOpItems(line, attrib_pos))
bits =... | [
"def",
"Feed",
"(",
"self",
",",
"line",
",",
"tag",
",",
"attrib_pos",
")",
":",
"if",
"tag",
"in",
"_NON_TYPE_TAGS",
":",
"return",
"if",
"tag",
"==",
"'INTEGER'",
":",
"num_bits",
"=",
"next",
"(",
"_ParseOpItems",
"(",
"line",
",",
"attrib_pos",
")... | Parses a single-line tag and store integer and integer array types. | [
"Parses",
"a",
"single",
"-",
"line",
"tag",
"and",
"store",
"integer",
"and",
"integer",
"array",
"types",
"."
] | [
"\"\"\"Parses a single-line tag and store integer and integer array types.\n\n Args:\n line: Stripped line of single-line tag with op0=# op1=# ... data.\n tag: The tag type in |line| (child tag of <TYPE_BLOCK_ID>).\n attrib_pos: Position in |line| where attribute list starts.\n \"\"\"",
"# op... | [
{
"param": "self",
"type": null
},
{
"param": "line",
"type": null
},
{
"param": "tag",
"type": null
},
{
"param": "attrib_pos",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "line",
"type": null,
"docstring": "Stripped line of single-line tag... |
8473059884c51b62216f679b9739bd495056ced9 | sunlongbo/chromium | tools/binary_size/libsupersize/bcanalyzer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ParseBcAnalyzer | <not_specific> | def _ParseBcAnalyzer(lines):
"""A generator to extract bytes() from bcanalyzer dump of a BC file."""
# ...
# <TYPE_BLOCK_ID NumWords=103 BlockCodeSize=4>
# ... (See above; parsed by _BcTypeInfo)
# <TYPE_BLOCK_ID>
# ...
# <CONSTANTS_BLOCK NumWords=93 BlockCodeSize=4>
# <SETTYPE abbrevid=4 op0=1/> ... | A generator to extract bytes() from bcanalyzer dump of a BC file. | A generator to extract bytes() from bcanalyzer dump of a BC file. | [
"A",
"generator",
"to",
"extract",
"bytes",
"()",
"from",
"bcanalyzer",
"dump",
"of",
"a",
"BC",
"file",
"."
] | def _ParseBcAnalyzer(lines):
# - Character data are stored in op0=# op1=, one per character. These
STATE_VOID = 0
STATE_TYPE_BLOCK = 1
STATE_CONST_BLOCK = 2
state = STATE_VOID
type_info = None
consts_cur_type = None
for line in lines:
line = line.lstrip()
(tag_type, tag, attrib_pos) = ParseTag... | [
"def",
"_ParseBcAnalyzer",
"(",
"lines",
")",
":",
"STATE_VOID",
"=",
"0",
"STATE_TYPE_BLOCK",
"=",
"1",
"STATE_CONST_BLOCK",
"=",
"2",
"state",
"=",
"STATE_VOID",
"type_info",
"=",
"None",
"consts_cur_type",
"=",
"None",
"for",
"line",
"in",
"lines",
":",
"... | A generator to extract bytes() from bcanalyzer dump of a BC file. | [
"A",
"generator",
"to",
"extract",
"bytes",
"()",
"from",
"bcanalyzer",
"dump",
"of",
"a",
"BC",
"file",
"."
] | [
"\"\"\"A generator to extract bytes() from bcanalyzer dump of a BC file.\"\"\"",
"# ...",
"# <TYPE_BLOCK_ID NumWords=103 BlockCodeSize=4>",
"# ... (See above; parsed by _BcTypeInfo)",
"# <TYPE_BLOCK_ID>",
"# ...",
"# <CONSTANTS_BLOCK NumWords=93 BlockCodeSize=4>",
"# <SETTYPE abbrevid=4 op0=1/> ... | [
{
"param": "lines",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lines",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8473059884c51b62216f679b9739bd495056ced9 | sunlongbo/chromium | tools/binary_size/libsupersize/bcanalyzer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunBcAnalyzerOnIntermediates | <not_specific> | def RunBcAnalyzerOnIntermediates(target, tool_prefix, output_directory):
"""Calls bcanalyzer and returns encoded map from path to strings.
Args:
target: A list of BC file paths.
"""
assert isinstance(target, list)
runner = _BcAnalyzerRunner(tool_prefix, output_directory)
strings_by_path = {}
for t in... | Calls bcanalyzer and returns encoded map from path to strings.
Args:
target: A list of BC file paths.
| Calls bcanalyzer and returns encoded map from path to strings. | [
"Calls",
"bcanalyzer",
"and",
"returns",
"encoded",
"map",
"from",
"path",
"to",
"strings",
"."
] | def RunBcAnalyzerOnIntermediates(target, tool_prefix, output_directory):
assert isinstance(target, list)
runner = _BcAnalyzerRunner(tool_prefix, output_directory)
strings_by_path = {}
for t in target:
strings_by_path[t] = [s for _, s in _ParseBcAnalyzer(runner.RunOnFile(t))]
return parallel.EncodeDictOfLi... | [
"def",
"RunBcAnalyzerOnIntermediates",
"(",
"target",
",",
"tool_prefix",
",",
"output_directory",
")",
":",
"assert",
"isinstance",
"(",
"target",
",",
"list",
")",
"runner",
"=",
"_BcAnalyzerRunner",
"(",
"tool_prefix",
",",
"output_directory",
")",
"strings_by_pa... | Calls bcanalyzer and returns encoded map from path to strings. | [
"Calls",
"bcanalyzer",
"and",
"returns",
"encoded",
"map",
"from",
"path",
"to",
"strings",
"."
] | [
"\"\"\"Calls bcanalyzer and returns encoded map from path to strings.\n\n Args:\n target: A list of BC file paths.\n \"\"\"",
"# Escape strings by repr() so there will be no special characters to interfere",
"# parallel.EncodeDictOfLists() and decoding."
] | [
{
"param": "target",
"type": null
},
{
"param": "tool_prefix",
"type": null
},
{
"param": "output_directory",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "target",
"type": null,
"docstring": "A list of BC file paths.",
"docstring_tokens": [
"A",
"list",
"of",
"BC",
"file",
"paths",
"."
],
"default": null,
... |
44c46e5e2e8866953fc25392a2223e163d3dd8b2 | sunlongbo/chromium | tools/android/checkxmlstyle/checkxmlstyle.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckStyleOnUpload | <not_specific> | def CheckStyleOnUpload(input_api, output_api):
"""Returns result for all the presubmit upload checks for XML files."""
result = _CommonChecks(input_api, output_api)
result.extend(_CheckNewTextAppearance(input_api, output_api))
return result | Returns result for all the presubmit upload checks for XML files. | Returns result for all the presubmit upload checks for XML files. | [
"Returns",
"result",
"for",
"all",
"the",
"presubmit",
"upload",
"checks",
"for",
"XML",
"files",
"."
] | def CheckStyleOnUpload(input_api, output_api):
result = _CommonChecks(input_api, output_api)
result.extend(_CheckNewTextAppearance(input_api, output_api))
return result | [
"def",
"CheckStyleOnUpload",
"(",
"input_api",
",",
"output_api",
")",
":",
"result",
"=",
"_CommonChecks",
"(",
"input_api",
",",
"output_api",
")",
"result",
".",
"extend",
"(",
"_CheckNewTextAppearance",
"(",
"input_api",
",",
"output_api",
")",
")",
"return"... | Returns result for all the presubmit upload checks for XML files. | [
"Returns",
"result",
"for",
"all",
"the",
"presubmit",
"upload",
"checks",
"for",
"XML",
"files",
"."
] | [
"\"\"\"Returns result for all the presubmit upload checks for XML files.\"\"\""
] | [
{
"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... |
44c46e5e2e8866953fc25392a2223e163d3dd8b2 | sunlongbo/chromium | tools/android/checkxmlstyle/checkxmlstyle.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CommonChecks | <not_specific> | def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
result = []
result.extend(_CheckColorFormat(input_api, output_api))
result.extend(_CheckColorReferences(input_api, output_api))
result.extend(_CheckDuplicateColors(input_api, output_api))
result.extend(_CheckSemanticCol... | Checks common to both upload and commit. | Checks common to both upload and commit. | [
"Checks",
"common",
"to",
"both",
"upload",
"and",
"commit",
"."
] | def _CommonChecks(input_api, output_api):
result = []
result.extend(_CheckColorFormat(input_api, output_api))
result.extend(_CheckColorReferences(input_api, output_api))
result.extend(_CheckDuplicateColors(input_api, output_api))
result.extend(_CheckSemanticColorsReferences(input_api, output_api))
result.ex... | [
"def",
"_CommonChecks",
"(",
"input_api",
",",
"output_api",
")",
":",
"result",
"=",
"[",
"]",
"result",
".",
"extend",
"(",
"_CheckColorFormat",
"(",
"input_api",
",",
"output_api",
")",
")",
"result",
".",
"extend",
"(",
"_CheckColorReferences",
"(",
"inp... | Checks common to both upload and commit. | [
"Checks",
"common",
"to",
"both",
"upload",
"and",
"commit",
"."
] | [
"\"\"\"Checks common to both upload and commit.\"\"\"",
"# Add more checks here"
] | [
{
"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... |
44c46e5e2e8866953fc25392a2223e163d3dd8b2 | sunlongbo/chromium | tools/android/checkxmlstyle/checkxmlstyle.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckColorFormat | <not_specific> | def _CheckColorFormat(input_api, output_api):
"""Checks color (A)RGB values are of format either RRGGBB or AARRGGBB."""
errors = []
for f in IncludedFiles(input_api):
# Ignore vector drawable xmls
contents = input_api.ReadFile(f)
if '<vector' in contents:
continue
for line_number, line in f.... | Checks color (A)RGB values are of format either RRGGBB or AARRGGBB. | Checks color (A)RGB values are of format either RRGGBB or AARRGGBB. | [
"Checks",
"color",
"(",
"A",
")",
"RGB",
"values",
"are",
"of",
"format",
"either",
"RRGGBB",
"or",
"AARRGGBB",
"."
] | def _CheckColorFormat(input_api, output_api):
errors = []
for f in IncludedFiles(input_api):
contents = input_api.ReadFile(f)
if '<vector' in contents:
continue
for line_number, line in f.ChangedContents():
color = helpers.COLOR_PATTERN.search(line)
if color and not helpers.VALID_COLOR... | [
"def",
"_CheckColorFormat",
"(",
"input_api",
",",
"output_api",
")",
":",
"errors",
"=",
"[",
"]",
"for",
"f",
"in",
"IncludedFiles",
"(",
"input_api",
")",
":",
"contents",
"=",
"input_api",
".",
"ReadFile",
"(",
"f",
")",
"if",
"'<vector'",
"in",
"con... | Checks color (A)RGB values are of format either RRGGBB or AARRGGBB. | [
"Checks",
"color",
"(",
"A",
")",
"RGB",
"values",
"are",
"of",
"format",
"either",
"RRGGBB",
"or",
"AARRGGBB",
"."
] | [
"\"\"\"Checks color (A)RGB values are of format either RRGGBB or AARRGGBB.\"\"\"",
"# Ignore vector drawable xmls"
] | [
{
"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... |
44c46e5e2e8866953fc25392a2223e163d3dd8b2 | sunlongbo/chromium | tools/android/checkxmlstyle/checkxmlstyle.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckColorPaletteReferences | <not_specific> | def _CheckColorPaletteReferences(input_api, output_api):
"""
Checks colors defined in color_palette.xml are not references in colors.xml.
"""
warnings = []
color_palette = None
for f in IncludedFiles(input_api):
if not f.LocalPath().endswith('/colors.xml'):
continue
if color_palette is None:... |
Checks colors defined in color_palette.xml are not references in colors.xml.
| Checks colors defined in color_palette.xml are not references in colors.xml. | [
"Checks",
"colors",
"defined",
"in",
"color_palette",
".",
"xml",
"are",
"not",
"references",
"in",
"colors",
".",
"xml",
"."
] | def _CheckColorPaletteReferences(input_api, output_api):
warnings = []
color_palette = None
for f in IncludedFiles(input_api):
if not f.LocalPath().endswith('/colors.xml'):
continue
if color_palette is None:
color_palette = _colorXml2Dict(
input_api.ReadFile(helpers.COLOR_PALETTE_PAT... | [
"def",
"_CheckColorPaletteReferences",
"(",
"input_api",
",",
"output_api",
")",
":",
"warnings",
"=",
"[",
"]",
"color_palette",
"=",
"None",
"for",
"f",
"in",
"IncludedFiles",
"(",
"input_api",
")",
":",
"if",
"not",
"f",
".",
"LocalPath",
"(",
")",
".",... | Checks colors defined in color_palette.xml are not references in colors.xml. | [
"Checks",
"colors",
"defined",
"in",
"color_palette",
".",
"xml",
"are",
"not",
"references",
"in",
"colors",
".",
"xml",
"."
] | [
"\"\"\"\n Checks colors defined in color_palette.xml are not references in colors.xml.\n \"\"\""
] | [
{
"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... |
44c46e5e2e8866953fc25392a2223e163d3dd8b2 | sunlongbo/chromium | tools/android/checkxmlstyle/checkxmlstyle.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckSemanticColorsReferences | <not_specific> | def _CheckSemanticColorsReferences(input_api, output_api):
"""
Checks colors defined in semantic_colors_non_adaptive.xml only referencing
resources in color_palette.xml.
"""
errors = []
color_palette = None
for f in IncludedFiles(input_api):
if not f.LocalPath().endswith('/semantic_colors_non_adaptiv... |
Checks colors defined in semantic_colors_non_adaptive.xml only referencing
resources in color_palette.xml.
| Checks colors defined in semantic_colors_non_adaptive.xml only referencing
resources in color_palette.xml. | [
"Checks",
"colors",
"defined",
"in",
"semantic_colors_non_adaptive",
".",
"xml",
"only",
"referencing",
"resources",
"in",
"color_palette",
".",
"xml",
"."
] | def _CheckSemanticColorsReferences(input_api, output_api):
errors = []
color_palette = None
for f in IncludedFiles(input_api):
if not f.LocalPath().endswith('/semantic_colors_non_adaptive.xml'):
continue
if color_palette is None:
color_palette = _colorXml2Dict(
input_api.ReadFile(helpe... | [
"def",
"_CheckSemanticColorsReferences",
"(",
"input_api",
",",
"output_api",
")",
":",
"errors",
"=",
"[",
"]",
"color_palette",
"=",
"None",
"for",
"f",
"in",
"IncludedFiles",
"(",
"input_api",
")",
":",
"if",
"not",
"f",
".",
"LocalPath",
"(",
")",
".",... | Checks colors defined in semantic_colors_non_adaptive.xml only referencing
resources in color_palette.xml. | [
"Checks",
"colors",
"defined",
"in",
"semantic_colors_non_adaptive",
".",
"xml",
"only",
"referencing",
"resources",
"in",
"color_palette",
".",
"xml",
"."
] | [
"\"\"\"\n Checks colors defined in semantic_colors_non_adaptive.xml only referencing\n resources in color_palette.xml.\n \"\"\""
] | [
{
"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... |
44c46e5e2e8866953fc25392a2223e163d3dd8b2 | sunlongbo/chromium | tools/android/checkxmlstyle/checkxmlstyle.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckXmlNamespacePrefixes | <not_specific> | def _CheckXmlNamespacePrefixes(input_api, output_api):
"""Checks consistency of prefixes used for XML namespace names."""
errors = []
for f in IncludedFiles(input_api):
for line_number, line in f.ChangedContents():
xml_app_namespace = helpers.XML_APP_NAMESPACE_PATTERN.search(line)
if xml_app_names... | Checks consistency of prefixes used for XML namespace names. | Checks consistency of prefixes used for XML namespace names. | [
"Checks",
"consistency",
"of",
"prefixes",
"used",
"for",
"XML",
"namespace",
"names",
"."
] | def _CheckXmlNamespacePrefixes(input_api, output_api):
errors = []
for f in IncludedFiles(input_api):
for line_number, line in f.ChangedContents():
xml_app_namespace = helpers.XML_APP_NAMESPACE_PATTERN.search(line)
if xml_app_namespace and not xml_app_namespace.group(1) == 'app':
errors.appe... | [
"def",
"_CheckXmlNamespacePrefixes",
"(",
"input_api",
",",
"output_api",
")",
":",
"errors",
"=",
"[",
"]",
"for",
"f",
"in",
"IncludedFiles",
"(",
"input_api",
")",
":",
"for",
"line_number",
",",
"line",
"in",
"f",
".",
"ChangedContents",
"(",
")",
":",... | Checks consistency of prefixes used for XML namespace names. | [
"Checks",
"consistency",
"of",
"prefixes",
"used",
"for",
"XML",
"namespace",
"names",
"."
] | [
"\"\"\"Checks consistency of prefixes used for XML namespace names.\"\"\""
] | [
{
"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... |
44c46e5e2e8866953fc25392a2223e163d3dd8b2 | sunlongbo/chromium | tools/android/checkxmlstyle/checkxmlstyle.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckTextAppearance | <not_specific> | def _CheckTextAppearance(input_api, output_api):
"""Checks text attributes are only used for text appearance styles in XMLs."""
text_attributes = [
'android:textColor', 'android:textSize', 'android:textStyle',
'android:fontFamily', 'android:textAllCaps']
namespace = {'android': 'http://schemas.android... | Checks text attributes are only used for text appearance styles in XMLs. | Checks text attributes are only used for text appearance styles in XMLs. | [
"Checks",
"text",
"attributes",
"are",
"only",
"used",
"for",
"text",
"appearance",
"styles",
"in",
"XMLs",
"."
] | def _CheckTextAppearance(input_api, output_api):
text_attributes = [
'android:textColor', 'android:textSize', 'android:textStyle',
'android:fontFamily', 'android:textAllCaps']
namespace = {'android': 'http://schemas.android.com/apk/res/android'}
errors = []
for f in IncludedFiles(input_api):
roo... | [
"def",
"_CheckTextAppearance",
"(",
"input_api",
",",
"output_api",
")",
":",
"text_attributes",
"=",
"[",
"'android:textColor'",
",",
"'android:textSize'",
",",
"'android:textStyle'",
",",
"'android:fontFamily'",
",",
"'android:textAllCaps'",
"]",
"namespace",
"=",
"{"... | Checks text attributes are only used for text appearance styles in XMLs. | [
"Checks",
"text",
"attributes",
"are",
"only",
"used",
"for",
"text",
"appearance",
"styles",
"in",
"XMLs",
"."
] | [
"\"\"\"Checks text attributes are only used for text appearance styles in XMLs.\"\"\"",
"# Check if there are text attributes defined outside text appearances.",
"# Get style name that contains text attributes but is not text appearance.",
"# Append error messages.",
"# Error for text attributes in non-text... | [
{
"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... |
44c46e5e2e8866953fc25392a2223e163d3dd8b2 | sunlongbo/chromium | tools/android/checkxmlstyle/checkxmlstyle.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckNewTextAppearance | <not_specific> | def _CheckNewTextAppearance(input_api, output_api):
"""Checks whether a new text appearance style is defined."""
errors = []
for f in IncludedFiles(input_api):
for line_number, line in f.ChangedContents():
if '<style name="TextAppearance.' in line:
errors.append(
' %s:%d\n \t%s' ... | Checks whether a new text appearance style is defined. | Checks whether a new text appearance style is defined. | [
"Checks",
"whether",
"a",
"new",
"text",
"appearance",
"style",
"is",
"defined",
"."
] | def _CheckNewTextAppearance(input_api, output_api):
errors = []
for f in IncludedFiles(input_api):
for line_number, line in f.ChangedContents():
if '<style name="TextAppearance.' in line:
errors.append(
' %s:%d\n \t%s' % (f.LocalPath(), line_number, line.strip()))
if errors:
... | [
"def",
"_CheckNewTextAppearance",
"(",
"input_api",
",",
"output_api",
")",
":",
"errors",
"=",
"[",
"]",
"for",
"f",
"in",
"IncludedFiles",
"(",
"input_api",
")",
":",
"for",
"line_number",
",",
"line",
"in",
"f",
".",
"ChangedContents",
"(",
")",
":",
... | Checks whether a new text appearance style is defined. | [
"Checks",
"whether",
"a",
"new",
"text",
"appearance",
"style",
"is",
"defined",
"."
] | [
"\"\"\"Checks whether a new text appearance style is defined.\"\"\""
] | [
{
"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... |
44c46e5e2e8866953fc25392a2223e163d3dd8b2 | sunlongbo/chromium | tools/android/checkxmlstyle/checkxmlstyle.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckButtonCompatWidgetUsage | <not_specific> | def _CheckButtonCompatWidgetUsage(input_api, output_api):
"""Encourage using ButtonCompat rather than Button, AppButtonCompat"""
warnings = []
for f in IncludedFiles(input_api):
# layout resource files
for line_number, line in f.ChangedContents():
if (re.search(r'<Button$', line) or
re.se... | Encourage using ButtonCompat rather than Button, AppButtonCompat | Encourage using ButtonCompat rather than Button, AppButtonCompat | [
"Encourage",
"using",
"ButtonCompat",
"rather",
"than",
"Button",
"AppButtonCompat"
] | def _CheckButtonCompatWidgetUsage(input_api, output_api):
warnings = []
for f in IncludedFiles(input_api):
for line_number, line in f.ChangedContents():
if (re.search(r'<Button$', line) or
re.search(r'<android.support.v7.widget.AppCompatButton$', line)):
warnings.append(
' %... | [
"def",
"_CheckButtonCompatWidgetUsage",
"(",
"input_api",
",",
"output_api",
")",
":",
"warnings",
"=",
"[",
"]",
"for",
"f",
"in",
"IncludedFiles",
"(",
"input_api",
")",
":",
"for",
"line_number",
",",
"line",
"in",
"f",
".",
"ChangedContents",
"(",
")",
... | Encourage using ButtonCompat rather than Button, AppButtonCompat | [
"Encourage",
"using",
"ButtonCompat",
"rather",
"than",
"Button",
"AppButtonCompat"
] | [
"\"\"\"Encourage using ButtonCompat rather than Button, AppButtonCompat\"\"\"",
"# layout resource files"
] | [
{
"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... |
44c46e5e2e8866953fc25392a2223e163d3dd8b2 | sunlongbo/chromium | tools/android/checkxmlstyle/checkxmlstyle.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckStringResourceQuotesPunctuations | <not_specific> | def _CheckStringResourceQuotesPunctuations(input_api, output_api):
"""Check whether inappropriate quotes are used"""
warning = '''
Android String Resources Check failed:
Your new string is using one or more of generic quotes(\u0022 \\u0022, \u0027 \\u0027,
\u0060 \\u0060, \u00B4 \\u00B4), which is not enc... | Check whether inappropriate quotes are used | Check whether inappropriate quotes are used | [
"Check",
"whether",
"inappropriate",
"quotes",
"are",
"used"
] | def _CheckStringResourceQuotesPunctuations(input_api, output_api):
warning = '''
Android String Resources Check failed:
Your new string is using one or more of generic quotes(\u0022 \\u0022, \u0027 \\u0027,
\u0060 \\u0060, \u00B4 \\u00B4), which is not encouraged. Instead, quotations marks
(\u201C \\u20... | [
"def",
"_CheckStringResourceQuotesPunctuations",
"(",
"input_api",
",",
"output_api",
")",
":",
"warning",
"=",
"'''\n Android String Resources Check failed:\n Your new string is using one or more of generic quotes(\\u0022 \\\\u0022, \\u0027 \\\\u0027,\n \\u0060 \\\\u0060, \\u00B4 \\\\u00... | Check whether inappropriate quotes are used | [
"Check",
"whether",
"inappropriate",
"quotes",
"are",
"used"
] | [
"\"\"\"Check whether inappropriate quotes are used\"\"\""
] | [
{
"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... |
44c46e5e2e8866953fc25392a2223e163d3dd8b2 | sunlongbo/chromium | tools/android/checkxmlstyle/checkxmlstyle.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckStringResourceEllipsisPunctuations | <not_specific> | def _CheckStringResourceEllipsisPunctuations(input_api, output_api):
"""Check whether inappropriate ellipsis are used"""
warning = '''
Android String Resources Check failed:
Your new string appears to use three periods(\u002E \\u002E) to represent
an ellipsis, which is not encouraged. Instead, an ellipsis... | Check whether inappropriate ellipsis are used | Check whether inappropriate ellipsis are used | [
"Check",
"whether",
"inappropriate",
"ellipsis",
"are",
"used"
] | def _CheckStringResourceEllipsisPunctuations(input_api, output_api):
warning = '''
Android String Resources Check failed:
Your new string appears to use three periods(\u002E \\u002E) to represent
an ellipsis, which is not encouraged. Instead, an ellipsis mark
(\u2026 \\u2026) is usually preferred.
P... | [
"def",
"_CheckStringResourceEllipsisPunctuations",
"(",
"input_api",
",",
"output_api",
")",
":",
"warning",
"=",
"'''\n Android String Resources Check failed:\n Your new string appears to use three periods(\\u002E \\\\u002E) to represent\n an ellipsis, which is not encouraged. Instead, a... | Check whether inappropriate ellipsis are used | [
"Check",
"whether",
"inappropriate",
"ellipsis",
"are",
"used"
] | [
"\"\"\"Check whether inappropriate ellipsis are used\"\"\""
] | [
{
"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... |
44c46e5e2e8866953fc25392a2223e163d3dd8b2 | sunlongbo/chromium | tools/android/checkxmlstyle/checkxmlstyle.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _checkStringResourcePunctuations | <not_specific> | def _checkStringResourcePunctuations(regex, warning, input_api, output_api):
"""Check whether inappropriate punctuations are used"""
warnings = []
result = []
# Removing placeholders for parsing purpose:
# placeholders will be parsed as children of the parent node.
ph = re.compile(r'<ph>.*</ph>')
for f in... | Check whether inappropriate punctuations are used | Check whether inappropriate punctuations are used | [
"Check",
"whether",
"inappropriate",
"punctuations",
"are",
"used"
] | def _checkStringResourcePunctuations(regex, warning, input_api, output_api):
warnings = []
result = []
ph = re.compile(r'<ph>.*</ph>')
for f in IncludedFiles(input_api, helpers.INCLUDED_GRD_PATHS):
contents = input_api.ReadFile(f)
contents = re.sub(ph, '', contents)
tree = ET.fromstring(contents)
... | [
"def",
"_checkStringResourcePunctuations",
"(",
"regex",
",",
"warning",
",",
"input_api",
",",
"output_api",
")",
":",
"warnings",
"=",
"[",
"]",
"result",
"=",
"[",
"]",
"ph",
"=",
"re",
".",
"compile",
"(",
"r'<ph>.*</ph>'",
")",
"for",
"f",
"in",
"In... | Check whether inappropriate punctuations are used | [
"Check",
"whether",
"inappropriate",
"punctuations",
"are",
"used"
] | [
"\"\"\"Check whether inappropriate punctuations are used\"\"\"",
"# Removing placeholders for parsing purpose:",
"# placeholders will be parsed as children of the parent node.",
"# some grds don't contain release and messages tags",
"# Only report the lines in the changed contents of the current workspace"
... | [
{
"param": "regex",
"type": null
},
{
"param": "warning",
"type": null
},
{
"param": "input_api",
"type": null
},
{
"param": "output_api",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "regex",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "warning",
"type": null,
"docstring": null,
"docstring_tokens... |
44e46fae8cca129102dfd422a72dc0af704588ef | sunlongbo/chromium | tools/metrics/ukm/gen_builders.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ReadFilteredData | <not_specific> | def ReadFilteredData(path):
"""Reads data from path and filters out any obsolete metrics.
Parses data from given path and removes all nodes that contain an
<obsolete> tag. First iterates through <event> nodes, then <metric>
nodes within them.
Args:
path: The path of the XML data source.
Returns:
... | Reads data from path and filters out any obsolete metrics.
Parses data from given path and removes all nodes that contain an
<obsolete> tag. First iterates through <event> nodes, then <metric>
nodes within them.
Args:
path: The path of the XML data source.
Returns:
A dict of the data not including ... | Reads data from path and filters out any obsolete metrics.
Parses data from given path and removes all nodes that contain an
tag. First iterates through nodes, then
nodes within them. | [
"Reads",
"data",
"from",
"path",
"and",
"filters",
"out",
"any",
"obsolete",
"metrics",
".",
"Parses",
"data",
"from",
"given",
"path",
"and",
"removes",
"all",
"nodes",
"that",
"contain",
"an",
"tag",
".",
"First",
"iterates",
"through",
"nodes",
"then",
... | def ReadFilteredData(path):
with open(path) as ukm_file:
data = ukm_model.UKM_XML_TYPE.Parse(ukm_file.read())
event_tag = ukm_model._EVENT_TYPE.tag
metric_tag = ukm_model._METRIC_TYPE.tag
data[event_tag] = list(filter(ukm_model.IsNotObsolete, data[event_tag]))
for event in data[event_tag]:
e... | [
"def",
"ReadFilteredData",
"(",
"path",
")",
":",
"with",
"open",
"(",
"path",
")",
"as",
"ukm_file",
":",
"data",
"=",
"ukm_model",
".",
"UKM_XML_TYPE",
".",
"Parse",
"(",
"ukm_file",
".",
"read",
"(",
")",
")",
"event_tag",
"=",
"ukm_model",
".",
"_E... | Reads data from path and filters out any obsolete metrics. | [
"Reads",
"data",
"from",
"path",
"and",
"filters",
"out",
"any",
"obsolete",
"metrics",
"."
] | [
"\"\"\"Reads data from path and filters out any obsolete metrics.\n\n Parses data from given path and removes all nodes that contain an\n <obsolete> tag. First iterates through <event> nodes, then <metric>\n nodes within them.\n\n Args:\n path: The path of the XML data source.\n\n Returns:\n A dict of th... | [
{
"param": "path",
"type": null
}
] | {
"returns": [
{
"docstring": "A dict of the data not including any obsolete events or metrics.",
"docstring_tokens": [
"A",
"dict",
"of",
"the",
"data",
"not",
"including",
"any",
"obsolete",
"events",
"or",
... |
be65c5aa41cca7a3001cb9006efe2bd210c11d63 | sunlongbo/chromium | tools/perf/core/results_processor/formatters/csv_output.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ProcessHistogramDicts | <not_specific> | def ProcessHistogramDicts(histogram_dicts, options):
"""Convert histogram dicts to CSV and write output in output_dir."""
with tempfile_ext.NamedTemporaryFile(mode='w') as hist_file:
json.dump(histogram_dicts, hist_file)
hist_file.close()
vinn_result = histograms_to_csv.HistogramsToCsv(hist_file.name)
... | Convert histogram dicts to CSV and write output in output_dir. | Convert histogram dicts to CSV and write output in output_dir. | [
"Convert",
"histogram",
"dicts",
"to",
"CSV",
"and",
"write",
"output",
"in",
"output_dir",
"."
] | def ProcessHistogramDicts(histogram_dicts, options):
with tempfile_ext.NamedTemporaryFile(mode='w') as hist_file:
json.dump(histogram_dicts, hist_file)
hist_file.close()
vinn_result = histograms_to_csv.HistogramsToCsv(hist_file.name)
csv_dicts = _ReadCsv(vinn_result.stdout.decode('utf-8').splitlines()... | [
"def",
"ProcessHistogramDicts",
"(",
"histogram_dicts",
",",
"options",
")",
":",
"with",
"tempfile_ext",
".",
"NamedTemporaryFile",
"(",
"mode",
"=",
"'w'",
")",
"as",
"hist_file",
":",
"json",
".",
"dump",
"(",
"histogram_dicts",
",",
"hist_file",
")",
"hist... | Convert histogram dicts to CSV and write output in output_dir. | [
"Convert",
"histogram",
"dicts",
"to",
"CSV",
"and",
"write",
"output",
"in",
"output_dir",
"."
] | [
"\"\"\"Convert histogram dicts to CSV and write output in output_dir.\"\"\""
] | [
{
"param": "histogram_dicts",
"type": null
},
{
"param": "options",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "histogram_dicts",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "options",
"type": null,
"docstring": null,
"docstr... |
44a58fad9b24173294689905c1ceda4fc6ea21de | sunlongbo/chromium | ui/base/ime/generate_character_composer_data.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Where | <not_specific> | def Where(self):
"""Report the current input location, for error messages."""
if self._file:
return '{}:{}:{}'.format(self._filename, self._lineno, self._column)
if self._pending:
return '<before>'
return '<eof>' | Report the current input location, for error messages. | Report the current input location, for error messages. | [
"Report",
"the",
"current",
"input",
"location",
"for",
"error",
"messages",
"."
] | def Where(self):
if self._file:
return '{}:{}:{}'.format(self._filename, self._lineno, self._column)
if self._pending:
return '<before>'
return '<eof>' | [
"def",
"Where",
"(",
"self",
")",
":",
"if",
"self",
".",
"_file",
":",
"return",
"'{}:{}:{}'",
".",
"format",
"(",
"self",
".",
"_filename",
",",
"self",
".",
"_lineno",
",",
"self",
".",
"_column",
")",
"if",
"self",
".",
"_pending",
":",
"return",... | Report the current input location, for error messages. | [
"Report",
"the",
"current",
"input",
"location",
"for",
"error",
"messages",
"."
] | [
"\"\"\"Report the current input location, for error messages.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
44a58fad9b24173294689905c1ceda4fc6ea21de | sunlongbo/chromium | ui/base/ime/generate_character_composer_data.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Get | <not_specific> | def Get(self):
"""Return the next input character, or None when inputs are exhausted."""
if self._line is None:
if self._file is None:
if not self._pending:
return None
self._filename = self._pending[0]
self._pending = self._pending[1:]
self._file = codecs.open(se... | Return the next input character, or None when inputs are exhausted. | Return the next input character, or None when inputs are exhausted. | [
"Return",
"the",
"next",
"input",
"character",
"or",
"None",
"when",
"inputs",
"are",
"exhausted",
"."
] | def Get(self):
if self._line is None:
if self._file is None:
if not self._pending:
return None
self._filename = self._pending[0]
self._pending = self._pending[1:]
self._file = codecs.open(self._filename, mode='rb', encoding='utf-8')
self._lineno = 0
self... | [
"def",
"Get",
"(",
"self",
")",
":",
"if",
"self",
".",
"_line",
"is",
"None",
":",
"if",
"self",
".",
"_file",
"is",
"None",
":",
"if",
"not",
"self",
".",
"_pending",
":",
"return",
"None",
"self",
".",
"_filename",
"=",
"self",
".",
"_pending",
... | Return the next input character, or None when inputs are exhausted. | [
"Return",
"the",
"next",
"input",
"character",
"or",
"None",
"when",
"inputs",
"are",
"exhausted",
"."
] | [
"\"\"\"Return the next input character, or None when inputs are exhausted.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
44a58fad9b24173294689905c1ceda4fc6ea21de | sunlongbo/chromium | ui/base/ime/generate_character_composer_data.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SubTrees | <not_specific> | def SubTrees(self):
"""Returns a list of all sub-|GroupedTree|s of the current GroupTree."""
r = []
for k in self._key_kinds:
for key in sorted(self._tables[k]['internal']):
r.append(self._tables[k]['internal'][key])
return r | Returns a list of all sub-|GroupedTree|s of the current GroupTree. | Returns a list of all sub-|GroupedTree|s of the current GroupTree. | [
"Returns",
"a",
"list",
"of",
"all",
"sub",
"-",
"|GroupedTree|s",
"of",
"the",
"current",
"GroupTree",
"."
] | def SubTrees(self):
r = []
for k in self._key_kinds:
for key in sorted(self._tables[k]['internal']):
r.append(self._tables[k]['internal'][key])
return r | [
"def",
"SubTrees",
"(",
"self",
")",
":",
"r",
"=",
"[",
"]",
"for",
"k",
"in",
"self",
".",
"_key_kinds",
":",
"for",
"key",
"in",
"sorted",
"(",
"self",
".",
"_tables",
"[",
"k",
"]",
"[",
"'internal'",
"]",
")",
":",
"r",
".",
"append",
"(",... | Returns a list of all sub-|GroupedTree|s of the current GroupTree. | [
"Returns",
"a",
"list",
"of",
"all",
"sub",
"-",
"|GroupedTree|s",
"of",
"the",
"current",
"GroupTree",
"."
] | [
"\"\"\"Returns a list of all sub-|GroupedTree|s of the current GroupTree.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
44a9d50ce8fa4f25b733086be55f53ad2178767e | sunlongbo/chromium | tools/perf/contrib/cluster_telemetry/screenshot.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | IsScreenshotWithinDynamicContentThreshold | <not_specific> | def IsScreenshotWithinDynamicContentThreshold(base_screenshot, next_screenshot,
content_pixels, num_total_pixels, dynamic_content_threshold):
"""Compares two screenshot images and updates the bytearray of RGB values
that will be used to create the final output image if it finds an
inconsistency. Returns F... | Compares two screenshot images and updates the bytearray of RGB values
that will be used to create the final output image if it finds an
inconsistency. Returns False if the percentage of pixels with dynamic
content is greater than the given threshold, and True otherwise. | Compares two screenshot images and updates the bytearray of RGB values
that will be used to create the final output image if it finds an
inconsistency. Returns False if the percentage of pixels with dynamic
content is greater than the given threshold, and True otherwise. | [
"Compares",
"two",
"screenshot",
"images",
"and",
"updates",
"the",
"bytearray",
"of",
"RGB",
"values",
"that",
"will",
"be",
"used",
"to",
"create",
"the",
"final",
"output",
"image",
"if",
"it",
"finds",
"an",
"inconsistency",
".",
"Returns",
"False",
"if"... | def IsScreenshotWithinDynamicContentThreshold(base_screenshot, next_screenshot,
content_pixels, num_total_pixels, dynamic_content_threshold):
base_pixels = image_util.Pixels(base_screenshot)
next_pixels = image_util.Pixels(next_screenshot)
num_dynamic_pixels = 0.0
i = 0
while i < len(base_pixels):
if (b... | [
"def",
"IsScreenshotWithinDynamicContentThreshold",
"(",
"base_screenshot",
",",
"next_screenshot",
",",
"content_pixels",
",",
"num_total_pixels",
",",
"dynamic_content_threshold",
")",
":",
"base_pixels",
"=",
"image_util",
".",
"Pixels",
"(",
"base_screenshot",
")",
"n... | Compares two screenshot images and updates the bytearray of RGB values
that will be used to create the final output image if it finds an
inconsistency. | [
"Compares",
"two",
"screenshot",
"images",
"and",
"updates",
"the",
"bytearray",
"of",
"RGB",
"values",
"that",
"will",
"be",
"used",
"to",
"create",
"the",
"final",
"output",
"image",
"if",
"it",
"finds",
"an",
"inconsistency",
"."
] | [
"\"\"\"Compares two screenshot images and updates the bytearray of RGB values\n that will be used to create the final output image if it finds an\n inconsistency. Returns False if the percentage of pixels with dynamic\n content is greater than the given threshold, and True otherwise.\"\"\"",
"# If the... | [
{
"param": "base_screenshot",
"type": null
},
{
"param": "next_screenshot",
"type": null
},
{
"param": "content_pixels",
"type": null
},
{
"param": "num_total_pixels",
"type": null
},
{
"param": "dynamic_content_threshold",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "base_screenshot",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "next_screenshot",
"type": null,
"docstring": null,
... |
e8016e19f101020eab8d3fc84a714acf38595562 | sunlongbo/chromium | chrome/android/java/src/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CommonChecks | <not_specific> | def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
result = []
result.extend(_CheckNotificationConstructors(input_api, output_api))
result.extend(_CheckAlertDialogBuilder(input_api, output_api))
result.extend(_CheckCompatibleAlertDialogBuilder(input_api, output_api))
re... | Checks common to both upload and commit. | Checks common to both upload and commit. | [
"Checks",
"common",
"to",
"both",
"upload",
"and",
"commit",
"."
] | def _CommonChecks(input_api, output_api):
result = []
result.extend(_CheckNotificationConstructors(input_api, output_api))
result.extend(_CheckAlertDialogBuilder(input_api, output_api))
result.extend(_CheckCompatibleAlertDialogBuilder(input_api, output_api))
result.extend(_CheckSplitCompatUtilsIdentifierName(... | [
"def",
"_CommonChecks",
"(",
"input_api",
",",
"output_api",
")",
":",
"result",
"=",
"[",
"]",
"result",
".",
"extend",
"(",
"_CheckNotificationConstructors",
"(",
"input_api",
",",
"output_api",
")",
")",
"result",
".",
"extend",
"(",
"_CheckAlertDialogBuilder... | Checks common to both upload and commit. | [
"Checks",
"common",
"to",
"both",
"upload",
"and",
"commit",
"."
] | [
"\"\"\"Checks common to both upload and commit.\"\"\"",
"# Add more checks here"
] | [
{
"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... |
e8243367953ed413c8ffdcbbf18d6ffd1049d167 | sunlongbo/chromium | third_party/android_deps_autorolled/fetch_all_autorolled.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _write_cipd_yaml | null | def _write_cipd_yaml(libs_dir, cipd_yaml_path):
"""Writes cipd.yaml file at the passed-in path."""
lib_dirs = os.listdir(libs_dir)
if not lib_dirs:
raise Exception('No generated libraries in {}'.format(libs_dir))
data_files = ['BUILD.gn', 'additional_readme_paths.json']
for lib_dir in lib_... | Writes cipd.yaml file at the passed-in path. | Writes cipd.yaml file at the passed-in path. | [
"Writes",
"cipd",
".",
"yaml",
"file",
"at",
"the",
"passed",
"-",
"in",
"path",
"."
] | def _write_cipd_yaml(libs_dir, cipd_yaml_path):
lib_dirs = os.listdir(libs_dir)
if not lib_dirs:
raise Exception('No generated libraries in {}'.format(libs_dir))
data_files = ['BUILD.gn', 'additional_readme_paths.json']
for lib_dir in lib_dirs:
abs_lib_dir = os.path.join(libs_dir, lib_di... | [
"def",
"_write_cipd_yaml",
"(",
"libs_dir",
",",
"cipd_yaml_path",
")",
":",
"lib_dirs",
"=",
"os",
".",
"listdir",
"(",
"libs_dir",
")",
"if",
"not",
"lib_dirs",
":",
"raise",
"Exception",
"(",
"'No generated libraries in {}'",
".",
"format",
"(",
"libs_dir",
... | Writes cipd.yaml file at the passed-in path. | [
"Writes",
"cipd",
".",
"yaml",
"file",
"at",
"the",
"passed",
"-",
"in",
"path",
"."
] | [
"\"\"\"Writes cipd.yaml file at the passed-in path.\"\"\""
] | [
{
"param": "libs_dir",
"type": null
},
{
"param": "cipd_yaml_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "libs_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cipd_yaml_path",
"type": null,
"docstring": null,
"docstr... |
59c8e7f57b5146ef932450266e21183c30a582be | sunlongbo/chromium | media/test/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckTestDataReadmeUpdated | <not_specific> | def _CheckTestDataReadmeUpdated(input_api, output_api):
"""
Checks to make sure the README.md file is updated when changing test files.
"""
test_data_dir = input_api.os_path.join('media', 'test', 'data')
readme_path = input_api.os_path.join('media', 'test', 'data', 'README.md')
test_files = []
readme_upda... |
Checks to make sure the README.md file is updated when changing test files.
| Checks to make sure the README.md file is updated when changing test files. | [
"Checks",
"to",
"make",
"sure",
"the",
"README",
".",
"md",
"file",
"is",
"updated",
"when",
"changing",
"test",
"files",
"."
] | def _CheckTestDataReadmeUpdated(input_api, output_api):
test_data_dir = input_api.os_path.join('media', 'test', 'data')
readme_path = input_api.os_path.join('media', 'test', 'data', 'README.md')
test_files = []
readme_updated = False
errors = []
for f in input_api.AffectedFiles():
local_path = f.LocalPa... | [
"def",
"_CheckTestDataReadmeUpdated",
"(",
"input_api",
",",
"output_api",
")",
":",
"test_data_dir",
"=",
"input_api",
".",
"os_path",
".",
"join",
"(",
"'media'",
",",
"'test'",
",",
"'data'",
")",
"readme_path",
"=",
"input_api",
".",
"os_path",
".",
"join"... | Checks to make sure the README.md file is updated when changing test files. | [
"Checks",
"to",
"make",
"sure",
"the",
"README",
".",
"md",
"file",
"is",
"updated",
"when",
"changing",
"test",
"files",
"."
] | [
"\"\"\"\n Checks to make sure the README.md file is updated when changing test files.\n \"\"\""
] | [
{
"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... |
495e34ba9a40e62fd24af6d9028d69c0dd5f9b2b | sunlongbo/chromium | third_party/sqlite/scripts/generate_amalgamation.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _icu_ld_flags | <not_specific> | def _icu_ld_flags():
"""Return the libicu linker flags."""
cmd = ['icu-config', '--ldflags']
try:
return subprocess.check_output(cmd)
except Exception:
return '' | Return the libicu linker flags. | Return the libicu linker flags. | [
"Return",
"the",
"libicu",
"linker",
"flags",
"."
] | def _icu_ld_flags():
cmd = ['icu-config', '--ldflags']
try:
return subprocess.check_output(cmd)
except Exception:
return '' | [
"def",
"_icu_ld_flags",
"(",
")",
":",
"cmd",
"=",
"[",
"'icu-config'",
",",
"'--ldflags'",
"]",
"try",
":",
"return",
"subprocess",
".",
"check_output",
"(",
"cmd",
")",
"except",
"Exception",
":",
"return",
"''"
] | Return the libicu linker flags. | [
"Return",
"the",
"libicu",
"linker",
"flags",
"."
] | [
"\"\"\"Return the libicu linker flags.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
495e34ba9a40e62fd24af6d9028d69c0dd5f9b2b | sunlongbo/chromium | third_party/sqlite/scripts/generate_amalgamation.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _do_configure | null | def _do_configure(config_name):
"""Run the configure script for the SQLite source."""
configure = os.path.join(_SQLITE_SRC_DIR, 'configure')
build_flags = ' '.join(
['-D' + f for f in _read_configuration_values(config_name)])
cflags = '-Os {} {}'.format(build_flags, _icu_cpp_flags())
ldflags... | Run the configure script for the SQLite source. | Run the configure script for the SQLite source. | [
"Run",
"the",
"configure",
"script",
"for",
"the",
"SQLite",
"source",
"."
] | def _do_configure(config_name):
configure = os.path.join(_SQLITE_SRC_DIR, 'configure')
build_flags = ' '.join(
['-D' + f for f in _read_configuration_values(config_name)])
cflags = '-Os {} {}'.format(build_flags, _icu_cpp_flags())
ldflags = _icu_ld_flags()
cmd = [
configure,
... | [
"def",
"_do_configure",
"(",
"config_name",
")",
":",
"configure",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_SQLITE_SRC_DIR",
",",
"'configure'",
")",
"build_flags",
"=",
"' '",
".",
"join",
"(",
"[",
"'-D'",
"+",
"f",
"for",
"f",
"in",
"_read_configur... | Run the configure script for the SQLite source. | [
"Run",
"the",
"configure",
"script",
"for",
"the",
"SQLite",
"source",
"."
] | [
"\"\"\"Run the configure script for the SQLite source.\"\"\"",
"# Copy the files necessary for building/running tests back",
"#into the source directory."
] | [
{
"param": "config_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
495e34ba9a40e62fd24af6d9028d69c0dd5f9b2b | sunlongbo/chromium | third_party/sqlite/scripts/generate_amalgamation.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | make_aggregate | null | def make_aggregate(config_name):
"""Generate the aggregate source files."""
if not os.path.exists(_TEMP_CONFIG_DIR):
os.mkdir(_TEMP_CONFIG_DIR)
try:
os.chdir(_TEMP_CONFIG_DIR)
_do_configure(config_name)
cmd = ['make', 'shell.c', 'sqlite3.h', 'sqlite3.c']
subprocess.c... | Generate the aggregate source files. | Generate the aggregate source files. | [
"Generate",
"the",
"aggregate",
"source",
"files",
"."
] | def make_aggregate(config_name):
if not os.path.exists(_TEMP_CONFIG_DIR):
os.mkdir(_TEMP_CONFIG_DIR)
try:
os.chdir(_TEMP_CONFIG_DIR)
_do_configure(config_name)
cmd = ['make', 'shell.c', 'sqlite3.h', 'sqlite3.c']
subprocess.check_call(cmd)
amalgamation_dir = get_am... | [
"def",
"make_aggregate",
"(",
"config_name",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"_TEMP_CONFIG_DIR",
")",
":",
"os",
".",
"mkdir",
"(",
"_TEMP_CONFIG_DIR",
")",
"try",
":",
"os",
".",
"chdir",
"(",
"_TEMP_CONFIG_DIR",
")",
"_do_... | Generate the aggregate source files. | [
"Generate",
"the",
"aggregate",
"source",
"files",
"."
] | [
"\"\"\"Generate the aggregate source files.\"\"\"",
"# shell.c must be placed in a different directory from sqlite3.h,",
"# because it contains an '#include \"sqlite3.h\"' that we want to resolve",
"# to our custom //third_party/sqlite/sqlite3.h, not to the sqlite3.h",
"# produced here."
] | [
{
"param": "config_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f991dcaac2f1b58c26eb304bfaffbc3749226c40 | sunlongbo/chromium | third_party/blink/renderer/build/scripts/writer_test_util.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | compare_output_dir | <not_specific> | def compare_output_dir(reference_dir, output_dir):
"""
Compares output files in both reference_dir and output_dir.
Note: this function ignores subdirectory content in both reference
dir and output_dir.
Note: reference_dir should have all ref files ending with .ref suffix.
'.ref' suffix is adde... |
Compares output files in both reference_dir and output_dir.
Note: this function ignores subdirectory content in both reference
dir and output_dir.
Note: reference_dir should have all ref files ending with .ref suffix.
'.ref' suffix is added to bypass code formatter on reference files.
:retur... | Compares output files in both reference_dir and output_dir.
Note: this function ignores subdirectory content in both reference
dir and output_dir.
reference_dir should have all ref files ending with .ref suffix.
'.ref' suffix is added to bypass code formatter on reference files. | [
"Compares",
"output",
"files",
"in",
"both",
"reference_dir",
"and",
"output_dir",
".",
"Note",
":",
"this",
"function",
"ignores",
"subdirectory",
"content",
"in",
"both",
"reference",
"dir",
"and",
"output_dir",
".",
"reference_dir",
"should",
"have",
"all",
"... | def compare_output_dir(reference_dir, output_dir):
ref_content = {
f[:-4]
for f in os.listdir(reference_dir) if f.endswith('.ref')
}
output_content = set(os.listdir(output_dir))
if ref_content != output_content:
print 'Output files does not match.'
print 'Following files ... | [
"def",
"compare_output_dir",
"(",
"reference_dir",
",",
"output_dir",
")",
":",
"ref_content",
"=",
"{",
"f",
"[",
":",
"-",
"4",
"]",
"for",
"f",
"in",
"os",
".",
"listdir",
"(",
"reference_dir",
")",
"if",
"f",
".",
"endswith",
"(",
"'.ref'",
")",
... | Compares output files in both reference_dir and output_dir. | [
"Compares",
"output",
"files",
"in",
"both",
"reference_dir",
"and",
"output_dir",
"."
] | [
"\"\"\"\n Compares output files in both reference_dir and output_dir.\n\n Note: this function ignores subdirectory content in both reference\n dir and output_dir.\n\n Note: reference_dir should have all ref files ending with .ref suffix.\n '.ref' suffix is added to bypass code formatter on reference ... | [
{
"param": "reference_dir",
"type": null
},
{
"param": "output_dir",
"type": null
}
] | {
"returns": [
{
"docstring": "Whether files in output dir matches files in ref dir",
"docstring_tokens": [
"Whether",
"files",
"in",
"output",
"dir",
"matches",
"files",
"in",
"ref",
"dir"
],
"type": "{bool}"
... |
f99dee15d29a4f3b95095fdf0c34ce4960b1eba5 | sunlongbo/chromium | chrome/tools/history-viz.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PrettyPrint | <not_specific> | def PrettyPrint(self, include_host=True, include_path=True):
"""Pretty-print this URL in a form more suitable for the graph.
This will elide very long paths and potentially puts newlines between parts
of long components. include_host and include_path determine whether to
include the host and path in t... | Pretty-print this URL in a form more suitable for the graph.
This will elide very long paths and potentially puts newlines between parts
of long components. include_host and include_path determine whether to
include the host and path in the output.
Returns: the pretty-printed string. | Pretty-print this URL in a form more suitable for the graph.
This will elide very long paths and potentially puts newlines between parts
of long components. include_host and include_path determine whether to
include the host and path in the output.
the pretty-printed string. | [
"Pretty",
"-",
"print",
"this",
"URL",
"in",
"a",
"form",
"more",
"suitable",
"for",
"the",
"graph",
".",
"This",
"will",
"elide",
"very",
"long",
"paths",
"and",
"potentially",
"puts",
"newlines",
"between",
"parts",
"of",
"long",
"components",
".",
"incl... | def PrettyPrint(self, include_host=True, include_path=True):
MAX_LEN = 30
parts = []
if include_host:
parts.append(self.host)
if include_path:
parts.append(self.path)
parts.append(self.extra)
lines = []
line = ''
for part in parts:
if len(part) > MAX_LEN:
part... | [
"def",
"PrettyPrint",
"(",
"self",
",",
"include_host",
"=",
"True",
",",
"include_path",
"=",
"True",
")",
":",
"MAX_LEN",
"=",
"30",
"parts",
"=",
"[",
"]",
"if",
"include_host",
":",
"parts",
".",
"append",
"(",
"self",
".",
"host",
")",
"if",
"in... | Pretty-print this URL in a form more suitable for the graph. | [
"Pretty",
"-",
"print",
"this",
"URL",
"in",
"a",
"form",
"more",
"suitable",
"for",
"the",
"graph",
"."
] | [
"\"\"\"Pretty-print this URL in a form more suitable for the graph.\n\n This will elide very long paths and potentially puts newlines between parts\n of long components. include_host and include_path determine whether to\n include the host and path in the output.\n\n Returns: the pretty-printed string.... | [
{
"param": "self",
"type": null
},
{
"param": "include_host",
"type": null
},
{
"param": "include_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "include_host",
"type": null,
"docstring": null,
"docstring_to... |
f99dee15d29a4f3b95095fdf0c34ce4960b1eba5 | sunlongbo/chromium | chrome/tools/history-viz.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Transitions | <not_specific> | def Transitions(self):
"""Return a dictionary mapping transition type -> occurences."""
all = {}
for trans in self.transitions:
all[trans] = all.get(trans, 0) + 1
# We currently don't use the chain type.
# TODO(evanm): make this a command-line option.
# if trans & 0x30000000 != 0:
... | Return a dictionary mapping transition type -> occurences. | Return a dictionary mapping transition type -> occurences. | [
"Return",
"a",
"dictionary",
"mapping",
"transition",
"type",
"-",
">",
"occurences",
"."
] | def Transitions(self):
all = {}
for trans in self.transitions:
all[trans] = all.get(trans, 0) + 1
return all | [
"def",
"Transitions",
"(",
"self",
")",
":",
"all",
"=",
"{",
"}",
"for",
"trans",
"in",
"self",
".",
"transitions",
":",
"all",
"[",
"trans",
"]",
"=",
"all",
".",
"get",
"(",
"trans",
",",
"0",
")",
"+",
"1",
"return",
"all"
] | Return a dictionary mapping transition type -> occurences. | [
"Return",
"a",
"dictionary",
"mapping",
"transition",
"type",
"-",
">",
"occurences",
"."
] | [
"\"\"\"Return a dictionary mapping transition type -> occurences.\"\"\"",
"# We currently don't use the chain type.",
"# TODO(evanm): make this a command-line option.",
"# if trans & 0x30000000 != 0:",
"# chain = ''",
"# if trans & 0x10000000:",
"# chain = 'start'",
"# if trans & 0x20000000:... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f99dee15d29a4f3b95095fdf0c34ce4960b1eba5 | sunlongbo/chromium | chrome/tools/history-viz.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ClusterBy | <not_specific> | def ClusterBy(objs, pred):
"""Group a list of objects by a predicate.
Given a list of objects and a predicate over the objects, return a
dictionary mapping pred(obj) -> all objs with the same pred(obj)."""
clusters = {}
for obj in objs:
cluster = pred(obj)
clusters[cluster] = clusters.get(cluster, []... | Group a list of objects by a predicate.
Given a list of objects and a predicate over the objects, return a
dictionary mapping pred(obj) -> all objs with the same pred(obj). | Group a list of objects by a predicate.
Given a list of objects and a predicate over the objects, return a
dictionary mapping pred(obj) -> all objs with the same pred(obj). | [
"Group",
"a",
"list",
"of",
"objects",
"by",
"a",
"predicate",
".",
"Given",
"a",
"list",
"of",
"objects",
"and",
"a",
"predicate",
"over",
"the",
"objects",
"return",
"a",
"dictionary",
"mapping",
"pred",
"(",
"obj",
")",
"-",
">",
"all",
"objs",
"wit... | def ClusterBy(objs, pred):
clusters = {}
for obj in objs:
cluster = pred(obj)
clusters[cluster] = clusters.get(cluster, [])
clusters[cluster].append(obj)
return clusters | [
"def",
"ClusterBy",
"(",
"objs",
",",
"pred",
")",
":",
"clusters",
"=",
"{",
"}",
"for",
"obj",
"in",
"objs",
":",
"cluster",
"=",
"pred",
"(",
"obj",
")",
"clusters",
"[",
"cluster",
"]",
"=",
"clusters",
".",
"get",
"(",
"cluster",
",",
"[",
"... | Group a list of objects by a predicate. | [
"Group",
"a",
"list",
"of",
"objects",
"by",
"a",
"predicate",
"."
] | [
"\"\"\"Group a list of objects by a predicate.\n\n Given a list of objects and a predicate over the objects, return a\n dictionary mapping pred(obj) -> all objs with the same pred(obj).\"\"\""
] | [
{
"param": "objs",
"type": null
},
{
"param": "pred",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "objs",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pred",
"type": null,
"docstring": null,
"docstring_tokens": [... |
f99dee15d29a4f3b95095fdf0c34ce4960b1eba5 | sunlongbo/chromium | chrome/tools/history-viz.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Run | null | def Run(self, sql):
"""Execute |sql|, yielding each row of results as an array."""
subproc = subprocess.Popen(['sqlite', self.file],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
subproc.stdin.write('.mode tabs\n')
subproc.stdin.write(sql + ... | Execute |sql|, yielding each row of results as an array. | Execute |sql|, yielding each row of results as an array. | [
"Execute",
"|sql|",
"yielding",
"each",
"row",
"of",
"results",
"as",
"an",
"array",
"."
] | def Run(self, sql):
subproc = subprocess.Popen(['sqlite', self.file],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
subproc.stdin.write('.mode tabs\n')
subproc.stdin.write(sql + ';')
subproc.stdin.close()
for line in subproc.stdout:
... | [
"def",
"Run",
"(",
"self",
",",
"sql",
")",
":",
"subproc",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"'sqlite'",
",",
"self",
".",
"file",
"]",
",",
"stdin",
"=",
"subprocess",
".",
"PIPE",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
")",
"sub... | Execute |sql|, yielding each row of results as an array. | [
"Execute",
"|sql|",
"yielding",
"each",
"row",
"of",
"results",
"as",
"an",
"array",
"."
] | [
"\"\"\"Execute |sql|, yielding each row of results as an array.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "sql",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sql",
"type": null,
"docstring": null,
"docstring_tokens": []... |
c676a2434e4a6e53f89907792a11786861827077 | sunlongbo/chromium | tools/metrics/histograms/update_net_error_codes.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ReadNetErrorCodes | <not_specific> | def ReadNetErrorCodes(filename, error_regex):
"""Reads in values from net_error_list.h, returning a dictionary mapping
error code to error name.
"""
# Read the file as a list of lines
with open(path_util.GetInputFile(filename)) as f:
content = f.readlines()
# Parse out lines that are net errors.
erro... | Reads in values from net_error_list.h, returning a dictionary mapping
error code to error name.
| Reads in values from net_error_list.h, returning a dictionary mapping
error code to error name. | [
"Reads",
"in",
"values",
"from",
"net_error_list",
".",
"h",
"returning",
"a",
"dictionary",
"mapping",
"error",
"code",
"to",
"error",
"name",
"."
] | def ReadNetErrorCodes(filename, error_regex):
with open(path_util.GetInputFile(filename)) as f:
content = f.readlines()
errors = {}
for line in content:
m = error_regex.match(line)
if m:
name = m.group(1)
code = int(m.group(2))
if name == 'CERT_END':
continue
errors[cod... | [
"def",
"ReadNetErrorCodes",
"(",
"filename",
",",
"error_regex",
")",
":",
"with",
"open",
"(",
"path_util",
".",
"GetInputFile",
"(",
"filename",
")",
")",
"as",
"f",
":",
"content",
"=",
"f",
".",
"readlines",
"(",
")",
"errors",
"=",
"{",
"}",
"for"... | Reads in values from net_error_list.h, returning a dictionary mapping
error code to error name. | [
"Reads",
"in",
"values",
"from",
"net_error_list",
".",
"h",
"returning",
"a",
"dictionary",
"mapping",
"error",
"code",
"to",
"error",
"name",
"."
] | [
"\"\"\"Reads in values from net_error_list.h, returning a dictionary mapping\n error code to error name.\n \"\"\"",
"# Read the file as a list of lines",
"# Parse out lines that are net errors.",
"# CERT_END is not a real NET_ERROR and does not have a stable value.",
"# Don't include it."
] | [
{
"param": "filename",
"type": null
},
{
"param": "error_regex",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "error_regex",
"type": null,
"docstring": null,
"docstring... |
c6a9ddadc63d076ad005e2df1c73eb2f44d1c1ab | sunlongbo/chromium | chrome/test/enterprise/e2e/policy/restore_on_startup/restore_on_startup_webdriver_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _get_urls | <not_specific> | def _get_urls(driver):
"""Returns the list of URLs in tabs."""
urls = []
for w in driver.window_handles:
driver.switch_to.window(w)
urls.append(driver.current_url)
list.sort(urls)
return urls | Returns the list of URLs in tabs. | Returns the list of URLs in tabs. | [
"Returns",
"the",
"list",
"of",
"URLs",
"in",
"tabs",
"."
] | def _get_urls(driver):
urls = []
for w in driver.window_handles:
driver.switch_to.window(w)
urls.append(driver.current_url)
list.sort(urls)
return urls | [
"def",
"_get_urls",
"(",
"driver",
")",
":",
"urls",
"=",
"[",
"]",
"for",
"w",
"in",
"driver",
".",
"window_handles",
":",
"driver",
".",
"switch_to",
".",
"window",
"(",
"w",
")",
"urls",
".",
"append",
"(",
"driver",
".",
"current_url",
")",
"list... | Returns the list of URLs in tabs. | [
"Returns",
"the",
"list",
"of",
"URLs",
"in",
"tabs",
"."
] | [
"\"\"\"Returns the list of URLs in tabs.\"\"\""
] | [
{
"param": "driver",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "driver",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c6a9ddadc63d076ad005e2df1c73eb2f44d1c1ab | sunlongbo/chromium | chrome/test/enterprise/e2e/policy/restore_on_startup/restore_on_startup_webdriver_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | start_chrome | null | def start_chrome():
"""Start chrome.
Write the list of URLs in tabs to stdout.
"""
driver = _create_driver()
# give chrome some time to load everything. This is less than ideal, but
# currently there's no statisfactory solution.
time.sleep(10)
print(json.dumps(_get_urls(driver)))
test_util.shutdown... | Start chrome.
Write the list of URLs in tabs to stdout.
| Start chrome.
Write the list of URLs in tabs to stdout. | [
"Start",
"chrome",
".",
"Write",
"the",
"list",
"of",
"URLs",
"in",
"tabs",
"to",
"stdout",
"."
] | def start_chrome():
driver = _create_driver()
time.sleep(10)
print(json.dumps(_get_urls(driver)))
test_util.shutdown_chrome() | [
"def",
"start_chrome",
"(",
")",
":",
"driver",
"=",
"_create_driver",
"(",
")",
"time",
".",
"sleep",
"(",
"10",
")",
"print",
"(",
"json",
".",
"dumps",
"(",
"_get_urls",
"(",
"driver",
")",
")",
")",
"test_util",
".",
"shutdown_chrome",
"(",
")"
] | Start chrome. | [
"Start",
"chrome",
"."
] | [
"\"\"\"Start chrome.\n\n Write the list of URLs in tabs to stdout.\n \"\"\"",
"# give chrome some time to load everything. This is less than ideal, but",
"# currently there's no statisfactory solution."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
21564fd93ddd09a89baad3480b0206c0ab0f00c6 | sunlongbo/chromium | components/exo/wayland/fuzzer/wayland_templater.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetClangFormatPath | <not_specific> | def GetClangFormatPath():
"""Returns the path to clang-format, for formatting the output."""
if sys.platform.startswith('linux'):
platform, exe_suffix = 'linux64', ''
exe_suffix = ""
elif sys.platform == 'darwin':
platform, exe_suffix = 'mac', ''
elif sys.platform == 'win32':
pla... | Returns the path to clang-format, for formatting the output. | Returns the path to clang-format, for formatting the output. | [
"Returns",
"the",
"path",
"to",
"clang",
"-",
"format",
"for",
"formatting",
"the",
"output",
"."
] | def GetClangFormatPath():
if sys.platform.startswith('linux'):
platform, exe_suffix = 'linux64', ''
exe_suffix = ""
elif sys.platform == 'darwin':
platform, exe_suffix = 'mac', ''
elif sys.platform == 'win32':
platform, exe_suffix = 'win', '.exe'
else:
assert False, 'Unknow... | [
"def",
"GetClangFormatPath",
"(",
")",
":",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"'linux'",
")",
":",
"platform",
",",
"exe_suffix",
"=",
"'linux64'",
",",
"''",
"exe_suffix",
"=",
"\"\"",
"elif",
"sys",
".",
"platform",
"==",
"'darwin'",
... | Returns the path to clang-format, for formatting the output. | [
"Returns",
"the",
"path",
"to",
"clang",
"-",
"format",
"for",
"formatting",
"the",
"output",
"."
] | [
"\"\"\"Returns the path to clang-format, for formatting the output.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
21564fd93ddd09a89baad3480b0206c0ab0f00c6 | sunlongbo/chromium | components/exo/wayland/fuzzer/wayland_templater.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ClangFormat | <not_specific> | def ClangFormat(source, filename):
"""Runs clang-format on source and returns the result."""
# clang-format the output, for better readability and for
# -Wmisleading-indentation.
clang_format_cmd = [GetClangFormatPath(), '--assume-filename=' + filename]
proc = subprocess.Popen(
clang_format_cmd, stdin=s... | Runs clang-format on source and returns the result. | Runs clang-format on source and returns the result. | [
"Runs",
"clang",
"-",
"format",
"on",
"source",
"and",
"returns",
"the",
"result",
"."
] | def ClangFormat(source, filename):
clang_format_cmd = [GetClangFormatPath(), '--assume-filename=' + filename]
proc = subprocess.Popen(
clang_format_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
stdout_output, stderr_output = proc.communicate(input=source.encode('utf8'))
retcode = proc.wait()
if re... | [
"def",
"ClangFormat",
"(",
"source",
",",
"filename",
")",
":",
"clang_format_cmd",
"=",
"[",
"GetClangFormatPath",
"(",
")",
",",
"'--assume-filename='",
"+",
"filename",
"]",
"proc",
"=",
"subprocess",
".",
"Popen",
"(",
"clang_format_cmd",
",",
"stdin",
"="... | Runs clang-format on source and returns the result. | [
"Runs",
"clang",
"-",
"format",
"on",
"source",
"and",
"returns",
"the",
"result",
"."
] | [
"\"\"\"Runs clang-format on source and returns the result.\"\"\"",
"# clang-format the output, for better readability and for",
"# -Wmisleading-indentation."
] | [
{
"param": "source",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "source",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_toke... |
21564fd93ddd09a89baad3480b0206c0ab0f00c6 | sunlongbo/chromium | components/exo/wayland/fuzzer/wayland_templater.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteIfChanged | <not_specific> | def WriteIfChanged(contents, filename):
"""Writes contents to filename.
If filename already has the right contents, nothing is written so that
the mtime on filename doesn't change.
"""
if os.path.exists(filename):
with open(filename, 'r') as in_fi:
if in_fi.read() == contents:
return
with... | Writes contents to filename.
If filename already has the right contents, nothing is written so that
the mtime on filename doesn't change.
| Writes contents to filename.
If filename already has the right contents, nothing is written so that
the mtime on filename doesn't change. | [
"Writes",
"contents",
"to",
"filename",
".",
"If",
"filename",
"already",
"has",
"the",
"right",
"contents",
"nothing",
"is",
"written",
"so",
"that",
"the",
"mtime",
"on",
"filename",
"doesn",
"'",
"t",
"change",
"."
] | def WriteIfChanged(contents, filename):
if os.path.exists(filename):
with open(filename, 'r') as in_fi:
if in_fi.read() == contents:
return
with open(filename, 'w') as out_fi:
out_fi.write(contents) | [
"def",
"WriteIfChanged",
"(",
"contents",
",",
"filename",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"in_fi",
":",
"if",
"in_fi",
".",
"read",
"(",
")",
"=="... | Writes contents to filename. | [
"Writes",
"contents",
"to",
"filename",
"."
] | [
"\"\"\"Writes contents to filename.\n\n If filename already has the right contents, nothing is written so that\n the mtime on filename doesn't change.\n \"\"\""
] | [
{
"param": "contents",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "contents",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_to... |
21564fd93ddd09a89baad3480b0206c0ab0f00c6 | sunlongbo/chromium | components/exo/wayland/fuzzer/wayland_templater.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetCppPtrType | <not_specific> | def GetCppPtrType(interface_name):
"""Returns the c++ type associated with interfaces of the given name.
Args:
interface_name: the name of the interface you want the type for, or None.
Returns:
the c++ type which wayland will generate for this interface, or void* if
the interface_name is none. We us... | Returns the c++ type associated with interfaces of the given name.
Args:
interface_name: the name of the interface you want the type for, or None.
Returns:
the c++ type which wayland will generate for this interface, or void* if
the interface_name is none. We use "struct foo*" due to a collision betwe... | Returns the c++ type associated with interfaces of the given name. | [
"Returns",
"the",
"c",
"++",
"type",
"associated",
"with",
"interfaces",
"of",
"the",
"given",
"name",
"."
] | def GetCppPtrType(interface_name):
if not interface_name:
return 'void*'
return 'struct ' + interface_name + '*' | [
"def",
"GetCppPtrType",
"(",
"interface_name",
")",
":",
"if",
"not",
"interface_name",
":",
"return",
"'void*'",
"return",
"'struct '",
"+",
"interface_name",
"+",
"'*'"
] | Returns the c++ type associated with interfaces of the given name. | [
"Returns",
"the",
"c",
"++",
"type",
"associated",
"with",
"interfaces",
"of",
"the",
"given",
"name",
"."
] | [
"\"\"\"Returns the c++ type associated with interfaces of the given name.\n\n Args:\n interface_name: the name of the interface you want the type for, or None.\n\n Returns:\n the c++ type which wayland will generate for this interface, or void* if\n the interface_name is none. We use \"struct foo*\" due ... | [
{
"param": "interface_name",
"type": null
}
] | {
"returns": [
{
"docstring": "the c++ type which wayland will generate for this interface, or void* if\nthe interface_name is none. We use \"struct foo*\" due to a collision between\ntypenames and function names (specifically, wp_presentation has a feedback()\nmethod and there is also a wp_presentation_fee... |
21564fd93ddd09a89baad3480b0206c0ab0f00c6 | sunlongbo/chromium | components/exo/wayland/fuzzer/wayland_templater.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetAndIncrementCount | <not_specific> | def GetAndIncrementCount(self, counter):
"""Return the number of times the given key has been counted.
Args:
counter: the key used to identify this count value.
Returns:
An int which is the number of times this method has been called before
with this counter's key.
"""
self.count... | Return the number of times the given key has been counted.
Args:
counter: the key used to identify this count value.
Returns:
An int which is the number of times this method has been called before
with this counter's key.
| Return the number of times the given key has been counted. | [
"Return",
"the",
"number",
"of",
"times",
"the",
"given",
"key",
"has",
"been",
"counted",
"."
] | def GetAndIncrementCount(self, counter):
self.counts[counter] = self.counts.get(counter, 0) + 1
return self.counts[counter] - 1 | [
"def",
"GetAndIncrementCount",
"(",
"self",
",",
"counter",
")",
":",
"self",
".",
"counts",
"[",
"counter",
"]",
"=",
"self",
".",
"counts",
".",
"get",
"(",
"counter",
",",
"0",
")",
"+",
"1",
"return",
"self",
".",
"counts",
"[",
"counter",
"]",
... | Return the number of times the given key has been counted. | [
"Return",
"the",
"number",
"of",
"times",
"the",
"given",
"key",
"has",
"been",
"counted",
"."
] | [
"\"\"\"Return the number of times the given key has been counted.\n\n Args:\n counter: the key used to identify this count value.\n\n Returns:\n An int which is the number of times this method has been called before\n with this counter's key.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "counter",
"type": null
}
] | {
"returns": [
{
"docstring": "An int which is the number of times this method has been called before\nwith this counter's key.",
"docstring_tokens": [
"An",
"int",
"which",
"is",
"the",
"number",
"of",
"times",
"this",
"m... |
21564fd93ddd09a89baad3480b0206c0ab0f00c6 | sunlongbo/chromium | components/exo/wayland/fuzzer/wayland_templater.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | main | null | def main(argv):
"""Execute the templater, based on the user provided args.
Args:
argv: the command line arguments (including the script name)
"""
parsed_args = wlu.ParseOpts(argv)
InstantiateTemplate(parsed_args.input, GetTemplateData(parsed_args.spec),
parsed_args.output, parsed_ar... | Execute the templater, based on the user provided args.
Args:
argv: the command line arguments (including the script name)
| Execute the templater, based on the user provided args. | [
"Execute",
"the",
"templater",
"based",
"on",
"the",
"user",
"provided",
"args",
"."
] | def main(argv):
parsed_args = wlu.ParseOpts(argv)
InstantiateTemplate(parsed_args.input, GetTemplateData(parsed_args.spec),
parsed_args.output, parsed_args.directory) | [
"def",
"main",
"(",
"argv",
")",
":",
"parsed_args",
"=",
"wlu",
".",
"ParseOpts",
"(",
"argv",
")",
"InstantiateTemplate",
"(",
"parsed_args",
".",
"input",
",",
"GetTemplateData",
"(",
"parsed_args",
".",
"spec",
")",
",",
"parsed_args",
".",
"output",
"... | Execute the templater, based on the user provided args. | [
"Execute",
"the",
"templater",
"based",
"on",
"the",
"user",
"provided",
"args",
"."
] | [
"\"\"\"Execute the templater, based on the user provided args.\n\n Args:\n argv: the command line arguments (including the script name)\n \"\"\""
] | [
{
"param": "argv",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argv",
"type": null,
"docstring": "the command line arguments (including the script name)",
"docstring_tokens": [
"the",
"command",
"line",
"arguments",
"(",
"including",
... |
0cabf2d76eb137cdb34f80da16d9c424b4dd5fe3 | sunlongbo/chromium | third_party/xcbproto/src/xcbgen/xtypes.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | resolve | null | def resolve(self, module):
'''
Abstract method for resolving a type.
This should make sure any referenced types are already declared.
'''
raise Exception('abstract resolve method not overridden!') |
Abstract method for resolving a type.
This should make sure any referenced types are already declared.
| Abstract method for resolving a type.
This should make sure any referenced types are already declared. | [
"Abstract",
"method",
"for",
"resolving",
"a",
"type",
".",
"This",
"should",
"make",
"sure",
"any",
"referenced",
"types",
"are",
"already",
"declared",
"."
] | def resolve(self, module):
raise Exception('abstract resolve method not overridden!') | [
"def",
"resolve",
"(",
"self",
",",
"module",
")",
":",
"raise",
"Exception",
"(",
"'abstract resolve method not overridden!'",
")"
] | Abstract method for resolving a type. | [
"Abstract",
"method",
"for",
"resolving",
"a",
"type",
"."
] | [
"'''\n Abstract method for resolving a type.\n This should make sure any referenced types are already declared.\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "module",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "module",
"type": null,
"docstring": null,
"docstring_tokens":... |
0cabf2d76eb137cdb34f80da16d9c424b4dd5fe3 | sunlongbo/chromium | third_party/xcbproto/src/xcbgen/xtypes.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | out | null | def out(self, name):
'''
Abstract method for outputting code.
These are declared in the language-specific modules, and
there must be a dictionary containing them declared when this module is imported!
'''
raise Exception('abstract out method not overridden!') |
Abstract method for outputting code.
These are declared in the language-specific modules, and
there must be a dictionary containing them declared when this module is imported!
| Abstract method for outputting code.
These are declared in the language-specific modules, and
there must be a dictionary containing them declared when this module is imported! | [
"Abstract",
"method",
"for",
"outputting",
"code",
".",
"These",
"are",
"declared",
"in",
"the",
"language",
"-",
"specific",
"modules",
"and",
"there",
"must",
"be",
"a",
"dictionary",
"containing",
"them",
"declared",
"when",
"this",
"module",
"is",
"importe... | def out(self, name):
raise Exception('abstract out method not overridden!') | [
"def",
"out",
"(",
"self",
",",
"name",
")",
":",
"raise",
"Exception",
"(",
"'abstract out method not overridden!'",
")"
] | Abstract method for outputting code. | [
"Abstract",
"method",
"for",
"outputting",
"code",
"."
] | [
"'''\n Abstract method for outputting code.\n These are declared in the language-specific modules, and\n there must be a dictionary containing them declared when this module is imported!\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [... |
0cabf2d76eb137cdb34f80da16d9c424b4dd5fe3 | sunlongbo/chromium | third_party/xcbproto/src/xcbgen/xtypes.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | fixed_size | null | def fixed_size(self):
'''
Abstract method for determining if the data type is fixed-size.
'''
raise Exception('abstract fixed_size method not overridden!') |
Abstract method for determining if the data type is fixed-size.
| Abstract method for determining if the data type is fixed-size. | [
"Abstract",
"method",
"for",
"determining",
"if",
"the",
"data",
"type",
"is",
"fixed",
"-",
"size",
"."
] | def fixed_size(self):
raise Exception('abstract fixed_size method not overridden!') | [
"def",
"fixed_size",
"(",
"self",
")",
":",
"raise",
"Exception",
"(",
"'abstract fixed_size method not overridden!'",
")"
] | Abstract method for determining if the data type is fixed-size. | [
"Abstract",
"method",
"for",
"determining",
"if",
"the",
"data",
"type",
"is",
"fixed",
"-",
"size",
"."
] | [
"'''\n Abstract method for determining if the data type is fixed-size.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0cabf2d76eb137cdb34f80da16d9c424b4dd5fe3 | sunlongbo/chromium | third_party/xcbproto/src/xcbgen/xtypes.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | make_member_of | <not_specific> | def make_member_of(self, module, complex_type, field_type, field_name, visible, wire, auto, enum=None, is_fd=False):
'''
Default method for making a data type a member of a structure.
Extend this if the data type needs to add an additional length field or something.
module is the global... |
Default method for making a data type a member of a structure.
Extend this if the data type needs to add an additional length field or something.
module is the global module object.
complex_type is the structure object.
see Field for the meaning of the other parameters.
... | Default method for making a data type a member of a structure.
Extend this if the data type needs to add an additional length field or something.
module is the global module object.
complex_type is the structure object.
see Field for the meaning of the other parameters. | [
"Default",
"method",
"for",
"making",
"a",
"data",
"type",
"a",
"member",
"of",
"a",
"structure",
".",
"Extend",
"this",
"if",
"the",
"data",
"type",
"needs",
"to",
"add",
"an",
"additional",
"length",
"field",
"or",
"something",
".",
"module",
"is",
"th... | def make_member_of(self, module, complex_type, field_type, field_name, visible, wire, auto, enum=None, is_fd=False):
new_field = Field(self, field_type, field_name, visible, wire, auto, enum, is_fd)
for (idx, field) in enumerate(complex_type.fields):
if field == _placeholder_byte:
... | [
"def",
"make_member_of",
"(",
"self",
",",
"module",
",",
"complex_type",
",",
"field_type",
",",
"field_name",
",",
"visible",
",",
"wire",
",",
"auto",
",",
"enum",
"=",
"None",
",",
"is_fd",
"=",
"False",
")",
":",
"new_field",
"=",
"Field",
"(",
"s... | Default method for making a data type a member of a structure. | [
"Default",
"method",
"for",
"making",
"a",
"data",
"type",
"a",
"member",
"of",
"a",
"structure",
"."
] | [
"'''\n Default method for making a data type a member of a structure.\n Extend this if the data type needs to add an additional length field or something.\n\n module is the global module object.\n complex_type is the structure object.\n see Field for the meaning of the other param... | [
{
"param": "self",
"type": null
},
{
"param": "module",
"type": null
},
{
"param": "complex_type",
"type": null
},
{
"param": "field_type",
"type": null
},
{
"param": "field_name",
"type": null
},
{
"param": "visible",
"type": null
},
{
"pa... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "module",
"type": null,
"docstring": null,
"docstring_tokens":... |
0cabf2d76eb137cdb34f80da16d9c424b4dd5fe3 | sunlongbo/chromium | third_party/xcbproto/src/xcbgen/xtypes.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | make_fd_of | <not_specific> | def make_fd_of(self, module, complex_type, fd_name):
'''
Method for making a fd member of a structure.
'''
new_fd = Field(self, module.get_type_name('INT32'), fd_name, True, False, False, None, True)
# We dump the _placeholder_byte if any fields are added.
for (idx, field... |
Method for making a fd member of a structure.
| Method for making a fd member of a structure. | [
"Method",
"for",
"making",
"a",
"fd",
"member",
"of",
"a",
"structure",
"."
] | def make_fd_of(self, module, complex_type, fd_name):
new_fd = Field(self, module.get_type_name('INT32'), fd_name, True, False, False, None, True)
for (idx, field) in enumerate(complex_type.fields):
if field == _placeholder_byte:
complex_type.fields[idx] = new_fd
... | [
"def",
"make_fd_of",
"(",
"self",
",",
"module",
",",
"complex_type",
",",
"fd_name",
")",
":",
"new_fd",
"=",
"Field",
"(",
"self",
",",
"module",
".",
"get_type_name",
"(",
"'INT32'",
")",
",",
"fd_name",
",",
"True",
",",
"False",
",",
"False",
",",... | Method for making a fd member of a structure. | [
"Method",
"for",
"making",
"a",
"fd",
"member",
"of",
"a",
"structure",
"."
] | [
"'''\n Method for making a fd member of a structure.\n '''",
"# We dump the _placeholder_byte if any fields are added."
] | [
{
"param": "self",
"type": null
},
{
"param": "module",
"type": null
},
{
"param": "complex_type",
"type": null
},
{
"param": "fd_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "module",
"type": null,
"docstring": null,
"docstring_tokens":... |
0cabf2d76eb137cdb34f80da16d9c424b4dd5fe3 | sunlongbo/chromium | third_party/xcbproto/src/xcbgen/xtypes.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | unchecked_get_alignment_after | null | def unchecked_get_alignment_after(self, start_align, callstack, log):
'''
Abstract method for geting the alignment after this type
when the alignment at the start is given, and when this type
has variable size.
'''
raise Exception('abstract unchecked_get_alignment_after m... |
Abstract method for geting the alignment after this type
when the alignment at the start is given, and when this type
has variable size.
| Abstract method for geting the alignment after this type
when the alignment at the start is given, and when this type
has variable size. | [
"Abstract",
"method",
"for",
"geting",
"the",
"alignment",
"after",
"this",
"type",
"when",
"the",
"alignment",
"at",
"the",
"start",
"is",
"given",
"and",
"when",
"this",
"type",
"has",
"variable",
"size",
"."
] | def unchecked_get_alignment_after(self, start_align, callstack, log):
raise Exception('abstract unchecked_get_alignment_after method not overridden!') | [
"def",
"unchecked_get_alignment_after",
"(",
"self",
",",
"start_align",
",",
"callstack",
",",
"log",
")",
":",
"raise",
"Exception",
"(",
"'abstract unchecked_get_alignment_after method not overridden!'",
")"
] | Abstract method for geting the alignment after this type
when the alignment at the start is given, and when this type
has variable size. | [
"Abstract",
"method",
"for",
"geting",
"the",
"alignment",
"after",
"this",
"type",
"when",
"the",
"alignment",
"at",
"the",
"start",
"is",
"given",
"and",
"when",
"this",
"type",
"has",
"variable",
"size",
"."
] | [
"'''\n Abstract method for geting the alignment after this type\n when the alignment at the start is given, and when this type\n has variable size.\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "start_align",
"type": null
},
{
"param": "callstack",
"type": null
},
{
"param": "log",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "start_align",
"type": null,
"docstring": null,
"docstring_tok... |
0cabf2d76eb137cdb34f80da16d9c424b4dd5fe3 | sunlongbo/chromium | third_party/xcbproto/src/xcbgen/xtypes.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | make_member_of | <not_specific> | def make_member_of(self, module, switch_type, field_type, field_name, visible, wire, auto, enum=None):
'''
register BitcaseType with the corresponding SwitchType
module is the global module object.
complex_type is the structure object.
see Field for the meaning of the other para... |
register BitcaseType with the corresponding SwitchType
module is the global module object.
complex_type is the structure object.
see Field for the meaning of the other parameters.
| register BitcaseType with the corresponding SwitchType
module is the global module object.
complex_type is the structure object.
see Field for the meaning of the other parameters. | [
"register",
"BitcaseType",
"with",
"the",
"corresponding",
"SwitchType",
"module",
"is",
"the",
"global",
"module",
"object",
".",
"complex_type",
"is",
"the",
"structure",
"object",
".",
"see",
"Field",
"for",
"the",
"meaning",
"of",
"the",
"other",
"parameters... | def make_member_of(self, module, switch_type, field_type, field_name, visible, wire, auto, enum=None):
new_field = Field(self, field_type, field_name, visible, wire, auto, enum)
for (idx, field) in enumerate(switch_type.bitcases):
if field == _placeholder_byte:
switch_type.bi... | [
"def",
"make_member_of",
"(",
"self",
",",
"module",
",",
"switch_type",
",",
"field_type",
",",
"field_name",
",",
"visible",
",",
"wire",
",",
"auto",
",",
"enum",
"=",
"None",
")",
":",
"new_field",
"=",
"Field",
"(",
"self",
",",
"field_type",
",",
... | register BitcaseType with the corresponding SwitchType
module is the global module object. | [
"register",
"BitcaseType",
"with",
"the",
"corresponding",
"SwitchType",
"module",
"is",
"the",
"global",
"module",
"object",
"."
] | [
"'''\n register BitcaseType with the corresponding SwitchType\n\n module is the global module object.\n complex_type is the structure object.\n see Field for the meaning of the other parameters.\n '''",
"# We dump the _placeholder_byte if any bitcases are added."
] | [
{
"param": "self",
"type": null
},
{
"param": "module",
"type": null
},
{
"param": "switch_type",
"type": null
},
{
"param": "field_type",
"type": null
},
{
"param": "field_name",
"type": null
},
{
"param": "visible",
"type": null
},
{
"par... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "module",
"type": null,
"docstring": null,
"docstring_tokens":... |
adfbc6d279e979096f0fec981714bdda7fd52e45 | sunlongbo/chromium | components/policy/tools/template_writers/writers/plist_strings_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetWriter | <not_specific> | def GetWriter(config):
'''Factory method for creating PListStringsWriter objects.
See the constructor of TemplateWriter for description of
arguments.
'''
return PListStringsWriter(['mac'], config) | Factory method for creating PListStringsWriter objects.
See the constructor of TemplateWriter for description of
arguments.
| Factory method for creating PListStringsWriter objects.
See the constructor of TemplateWriter for description of
arguments. | [
"Factory",
"method",
"for",
"creating",
"PListStringsWriter",
"objects",
".",
"See",
"the",
"constructor",
"of",
"TemplateWriter",
"for",
"description",
"of",
"arguments",
"."
] | def GetWriter(config):
return PListStringsWriter(['mac'], config) | [
"def",
"GetWriter",
"(",
"config",
")",
":",
"return",
"PListStringsWriter",
"(",
"[",
"'mac'",
"]",
",",
"config",
")"
] | Factory method for creating PListStringsWriter objects. | [
"Factory",
"method",
"for",
"creating",
"PListStringsWriter",
"objects",
"."
] | [
"'''Factory method for creating PListStringsWriter objects.\n See the constructor of TemplateWriter for description of\n arguments.\n '''"
] | [
{
"param": "config",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
adfbc6d279e979096f0fec981714bdda7fd52e45 | sunlongbo/chromium | components/policy/tools/template_writers/writers/plist_strings_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddToStringTable | null | def _AddToStringTable(self, item_name, caption, desc):
'''Add a title and a description of an item to the string table.
Args:
item_name: The name of the item that will get the title and the
description.
title: The text of the title to add.
desc: The text of the description to add.
... | Add a title and a description of an item to the string table.
Args:
item_name: The name of the item that will get the title and the
description.
title: The text of the title to add.
desc: The text of the description to add.
| Add a title and a description of an item to the string table. | [
"Add",
"a",
"title",
"and",
"a",
"description",
"of",
"an",
"item",
"to",
"the",
"string",
"table",
"."
] | def _AddToStringTable(self, item_name, caption, desc):
caption = caption.replace('"', '\\"')
caption = caption.replace('\n', '\\n')
desc = desc.replace('"', '\\"')
desc = desc.replace('\n', '\\n')
self._out.append('%s.pfm_title = \"%s\";' % (item_name, caption))
self._out.append('%s.pfm_descript... | [
"def",
"_AddToStringTable",
"(",
"self",
",",
"item_name",
",",
"caption",
",",
"desc",
")",
":",
"caption",
"=",
"caption",
".",
"replace",
"(",
"'\"'",
",",
"'\\\\\"'",
")",
"caption",
"=",
"caption",
".",
"replace",
"(",
"'\\n'",
",",
"'\\\\n'",
")",
... | Add a title and a description of an item to the string table. | [
"Add",
"a",
"title",
"and",
"a",
"description",
"of",
"an",
"item",
"to",
"the",
"string",
"table",
"."
] | [
"'''Add a title and a description of an item to the string table.\n\n Args:\n item_name: The name of the item that will get the title and the\n description.\n title: The text of the title to add.\n desc: The text of the description to add.\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "item_name",
"type": null
},
{
"param": "caption",
"type": null
},
{
"param": "desc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "item_name",
"type": null,
"docstring": "The name of the item that w... |
adfbc6d279e979096f0fec981714bdda7fd52e45 | sunlongbo/chromium | components/policy/tools/template_writers/writers/plist_strings_writer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WritePolicy | null | def WritePolicy(self, policy):
'''Add strings to the stringtable corresponding a given policy.
Args:
policy: The policy for which the strings will be added to the
string table.
'''
desc = policy['desc']
if policy['type'] in ('int-enum', 'string-enum', 'string-enum-list'):
# Appe... | Add strings to the stringtable corresponding a given policy.
Args:
policy: The policy for which the strings will be added to the
string table.
| Add strings to the stringtable corresponding a given policy. | [
"Add",
"strings",
"to",
"the",
"stringtable",
"corresponding",
"a",
"given",
"policy",
"."
] | def WritePolicy(self, policy):
desc = policy['desc']
if policy['type'] in ('int-enum', 'string-enum', 'string-enum-list'):
item_descs = []
for item in policy['items']:
item_descs.append(str(item['value']) + ' - ' + item['caption'])
desc = '\n'.join(item_descs) + '\n' + desc
if self... | [
"def",
"WritePolicy",
"(",
"self",
",",
"policy",
")",
":",
"desc",
"=",
"policy",
"[",
"'desc'",
"]",
"if",
"policy",
"[",
"'type'",
"]",
"in",
"(",
"'int-enum'",
",",
"'string-enum'",
",",
"'string-enum-list'",
")",
":",
"item_descs",
"=",
"[",
"]",
... | Add strings to the stringtable corresponding a given policy. | [
"Add",
"strings",
"to",
"the",
"stringtable",
"corresponding",
"a",
"given",
"policy",
"."
] | [
"'''Add strings to the stringtable corresponding a given policy.\n\n Args:\n policy: The policy for which the strings will be added to the\n string table.\n '''",
"# Append the captions of enum items to the description string."
] | [
{
"param": "self",
"type": null
},
{
"param": "policy",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "policy",
"type": null,
"docstring": "The policy for which the strin... |
189f90c4744c4e0d04041798658d5ea97f8a7f4c | sunlongbo/chromium | tools/metrics/structured/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckChange | <not_specific> | def CheckChange(input_api, output_api):
""" Checks that structured.xml is pretty-printed and well-formatted. """
errors = []
for file in input_api.AffectedTextFiles():
path = file.AbsoluteLocalPath()
basename = input_api.basename(path)
if input_api.os_path.dirname(path) != input_api.PresubmitLocalPat... | Checks that structured.xml is pretty-printed and well-formatted. | Checks that structured.xml is pretty-printed and well-formatted. | [
"Checks",
"that",
"structured",
".",
"xml",
"is",
"pretty",
"-",
"printed",
"and",
"well",
"-",
"formatted",
"."
] | def CheckChange(input_api, output_api):
errors = []
for file in input_api.AffectedTextFiles():
path = file.AbsoluteLocalPath()
basename = input_api.basename(path)
if input_api.os_path.dirname(path) != input_api.PresubmitLocalPath():
continue
if basename == STRUCTURED_XML:
cwd = input_api... | [
"def",
"CheckChange",
"(",
"input_api",
",",
"output_api",
")",
":",
"errors",
"=",
"[",
"]",
"for",
"file",
"in",
"input_api",
".",
"AffectedTextFiles",
"(",
")",
":",
"path",
"=",
"file",
".",
"AbsoluteLocalPath",
"(",
")",
"basename",
"=",
"input_api",
... | Checks that structured.xml is pretty-printed and well-formatted. | [
"Checks",
"that",
"structured",
".",
"xml",
"is",
"pretty",
"-",
"printed",
"and",
"well",
"-",
"formatted",
"."
] | [
"\"\"\" Checks that structured.xml is pretty-printed and well-formatted. \"\"\""
] | [
{
"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... |
18c9d315b15ba41694f18aa38309eec737251f03 | sunlongbo/chromium | third_party/pffft/generate_seed_corpus.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteFloat32ArrayToFile | null | def WriteFloat32ArrayToFile(file_path, size, generator):
"""Generate an array of float32 values and writes to file."""
with open(file_path, 'wb') as f:
float_array = array('f', [generator() for _ in range(size)])
float_array.tofile(f) | Generate an array of float32 values and writes to file. | Generate an array of float32 values and writes to file. | [
"Generate",
"an",
"array",
"of",
"float32",
"values",
"and",
"writes",
"to",
"file",
"."
] | def WriteFloat32ArrayToFile(file_path, size, generator):
with open(file_path, 'wb') as f:
float_array = array('f', [generator() for _ in range(size)])
float_array.tofile(f) | [
"def",
"WriteFloat32ArrayToFile",
"(",
"file_path",
",",
"size",
",",
"generator",
")",
":",
"with",
"open",
"(",
"file_path",
",",
"'wb'",
")",
"as",
"f",
":",
"float_array",
"=",
"array",
"(",
"'f'",
",",
"[",
"generator",
"(",
")",
"for",
"_",
"in",... | Generate an array of float32 values and writes to file. | [
"Generate",
"an",
"array",
"of",
"float32",
"values",
"and",
"writes",
"to",
"file",
"."
] | [
"\"\"\"Generate an array of float32 values and writes to file.\"\"\""
] | [
{
"param": "file_path",
"type": null
},
{
"param": "size",
"type": null
},
{
"param": "generator",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "size",
"type": null,
"docstring": null,
"docstring_token... |
2dabce4e1300c70322c30e6b9656ce57e9ad9289 | sunlongbo/chromium | tools/mac/symbolicate_crash.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Symbolicate | null | def Symbolicate(self, symbol_path):
"""Symbolicates a crash report stack trace."""
# In order to be efficient, collect all the offsets that will be passed to
# atos by the image name.
offsets_by_image = self._CollectAddressesForImages(SYMBOL_IMAGE_MAP.keys())
# For each image, run atos with the lis... | Symbolicates a crash report stack trace. | Symbolicates a crash report stack trace. | [
"Symbolicates",
"a",
"crash",
"report",
"stack",
"trace",
"."
] | def Symbolicate(self, symbol_path):
offsets_by_image = self._CollectAddressesForImages(SYMBOL_IMAGE_MAP.keys())
for image_name, addresses in offsets_by_image.items():
if image_name not in self._binary_images or not len(addresses):
continue
dsym_file = self._GetDSymPath(symbol_path, image_nam... | [
"def",
"Symbolicate",
"(",
"self",
",",
"symbol_path",
")",
":",
"offsets_by_image",
"=",
"self",
".",
"_CollectAddressesForImages",
"(",
"SYMBOL_IMAGE_MAP",
".",
"keys",
"(",
")",
")",
"for",
"image_name",
",",
"addresses",
"in",
"offsets_by_image",
".",
"items... | Symbolicates a crash report stack trace. | [
"Symbolicates",
"a",
"crash",
"report",
"stack",
"trace",
"."
] | [
"\"\"\"Symbolicates a crash report stack trace.\"\"\"",
"# In order to be efficient, collect all the offsets that will be passed to",
"# atos by the image name.",
"# For each image, run atos with the list of addresses.",
"# If this image was not loaded or is in no stacks, skip.",
"# Combine the |image_nam... | [
{
"param": "self",
"type": null
},
{
"param": "symbol_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "symbol_path",
"type": null,
"docstring": null,
"docstring_tok... |
2dabce4e1300c70322c30e6b9656ce57e9ad9289 | sunlongbo/chromium | tools/mac/symbolicate_crash.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ParseHeader | null | def _ParseHeader(self, fd):
"""Parses the header section of a crash report, which contains the OS and
application version information."""
# The header is made up of different sections, depending on the type of
# report and the report version. Almost all have a format of a key and
# value separated b... | Parses the header section of a crash report, which contains the OS and
application version information. | Parses the header section of a crash report, which contains the OS and
application version information. | [
"Parses",
"the",
"header",
"section",
"of",
"a",
"crash",
"report",
"which",
"contains",
"the",
"OS",
"and",
"application",
"version",
"information",
"."
] | def _ParseHeader(self, fd):
thread_re = re.compile('^[ \t]*Thread ([a-f0-9]+)')
line = ''
while not thread_re.match(line):
line = line.strip()
if line:
parts = line.split(':', 1)
if len(parts) == 2:
self.report_info[parts[0]] = parts[1].lstrip()
line = fd.readline... | [
"def",
"_ParseHeader",
"(",
"self",
",",
"fd",
")",
":",
"thread_re",
"=",
"re",
".",
"compile",
"(",
"'^[ \\t]*Thread ([a-f0-9]+)'",
")",
"line",
"=",
"''",
"while",
"not",
"thread_re",
".",
"match",
"(",
"line",
")",
":",
"line",
"=",
"line",
".",
"s... | Parses the header section of a crash report, which contains the OS and
application version information. | [
"Parses",
"the",
"header",
"section",
"of",
"a",
"crash",
"report",
"which",
"contains",
"the",
"OS",
"and",
"application",
"version",
"information",
"."
] | [
"\"\"\"Parses the header section of a crash report, which contains the OS and\n application version information.\"\"\"",
"# The header is made up of different sections, depending on the type of",
"# report and the report version. Almost all have a format of a key and",
"# value separated by a colon. Accumu... | [
{
"param": "self",
"type": null
},
{
"param": "fd",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fd",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
2dabce4e1300c70322c30e6b9656ce57e9ad9289 | sunlongbo/chromium | tools/mac/symbolicate_crash.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ParseStack | null | def _ParseStack(self, fd):
"""Parses the stack dump of a crash report and creates a list of threads
and their stack traces."""
# Compile a regex that matches the start of a thread stack. Note that this
# must be specific to not include the thread state section, which comes
# right after all the stac... | Parses the stack dump of a crash report and creates a list of threads
and their stack traces. | Parses the stack dump of a crash report and creates a list of threads
and their stack traces. | [
"Parses",
"the",
"stack",
"dump",
"of",
"a",
"crash",
"report",
"and",
"creates",
"a",
"list",
"of",
"threads",
"and",
"their",
"stack",
"traces",
"."
] | def _ParseStack(self, fd):
line_re = re.compile('^Thread ([0-9]+)( Crashed)?:(.*)')
line = fd.readline().rstrip()
in_stack = False
thread = None
while line_re.match(line) or in_stack:
matches = line_re.match(line)
if not line.strip():
in_stack = False
elif matches:
... | [
"def",
"_ParseStack",
"(",
"self",
",",
"fd",
")",
":",
"line_re",
"=",
"re",
".",
"compile",
"(",
"'^Thread ([0-9]+)( Crashed)?:(.*)'",
")",
"line",
"=",
"fd",
".",
"readline",
"(",
")",
".",
"rstrip",
"(",
")",
"in_stack",
"=",
"False",
"thread",
"=",
... | Parses the stack dump of a crash report and creates a list of threads
and their stack traces. | [
"Parses",
"the",
"stack",
"dump",
"of",
"a",
"crash",
"report",
"and",
"creates",
"a",
"list",
"of",
"threads",
"and",
"their",
"stack",
"traces",
"."
] | [
"\"\"\"Parses the stack dump of a crash report and creates a list of threads\n and their stack traces.\"\"\"",
"# Compile a regex that matches the start of a thread stack. Note that this",
"# must be specific to not include the thread state section, which comes",
"# right after all the stack traces.",
"#... | [
{
"param": "self",
"type": null
},
{
"param": "fd",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fd",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
2dabce4e1300c70322c30e6b9656ce57e9ad9289 | sunlongbo/chromium | tools/mac/symbolicate_crash.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ParseStackFrame | <not_specific> | def _ParseStackFrame(self, line):
"""Takes in a single line of text and transforms it into a StackFrame."""
frame = StackFrame(line)
# A stack frame is in the format of:
# |<frame-number> <binary-image> 0x<address> <symbol> <offset>|.
regex = '^([0-9]+) +(.+)[ \t]+(0x[0-9a-f]+) (.*) \+ ([0-9]+)$'
... | Takes in a single line of text and transforms it into a StackFrame. | Takes in a single line of text and transforms it into a StackFrame. | [
"Takes",
"in",
"a",
"single",
"line",
"of",
"text",
"and",
"transforms",
"it",
"into",
"a",
"StackFrame",
"."
] | def _ParseStackFrame(self, line):
frame = StackFrame(line)
regex = '^([0-9]+) +(.+)[ \t]+(0x[0-9a-f]+) (.*) \+ ([0-9]+)$'
matches = re.match(regex, line)
if matches is None:
return frame
frame.frame_id = matches.group(1)
frame.image = matches.group(2)
frame.address = int(matches.group(... | [
"def",
"_ParseStackFrame",
"(",
"self",
",",
"line",
")",
":",
"frame",
"=",
"StackFrame",
"(",
"line",
")",
"regex",
"=",
"'^([0-9]+) +(.+)[ \\t]+(0x[0-9a-f]+) (.*) \\+ ([0-9]+)$'",
"matches",
"=",
"re",
".",
"match",
"(",
"regex",
",",
"line",
")",
"if",
"ma... | Takes in a single line of text and transforms it into a StackFrame. | [
"Takes",
"in",
"a",
"single",
"line",
"of",
"text",
"and",
"transforms",
"it",
"into",
"a",
"StackFrame",
"."
] | [
"\"\"\"Takes in a single line of text and transforms it into a StackFrame.\"\"\"",
"# A stack frame is in the format of:",
"# |<frame-number> <binary-image> 0x<address> <symbol> <offset>|.",
"# Create a stack frame with the information extracted from the regex.",
"# Convert HEX to an int."
] | [
{
"param": "self",
"type": null
},
{
"param": "line",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "line",
"type": null,
"docstring": null,
"docstring_tokens": [... |
2dabce4e1300c70322c30e6b9656ce57e9ad9289 | sunlongbo/chromium | tools/mac/symbolicate_crash.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ParseSpindumpStack | null | def _ParseSpindumpStack(self, fd):
"""Parses a spindump stack report. In this format, each thread stack has
both a user and kernel trace. Only the user traces are symbolicated."""
# The stack trace begins with the thread header, which is identified by a
# HEX number. The thread names appear to be incor... | Parses a spindump stack report. In this format, each thread stack has
both a user and kernel trace. Only the user traces are symbolicated. | Parses a spindump stack report. In this format, each thread stack has
both a user and kernel trace. Only the user traces are symbolicated. | [
"Parses",
"a",
"spindump",
"stack",
"report",
".",
"In",
"this",
"format",
"each",
"thread",
"stack",
"has",
"both",
"a",
"user",
"and",
"kernel",
"trace",
".",
"Only",
"the",
"user",
"traces",
"are",
"symbolicated",
"."
] | def _ParseSpindumpStack(self, fd):
user_thread_re = re.compile('^ Thread ([0-9a-fx]+)')
line = fd.readline()
in_user_stack = False
in_kernel_stack = False
thread = None
frame_id = 0
while user_thread_re.match(line) or in_user_stack or in_kernel_stack:
matches = user_thread_re.match(li... | [
"def",
"_ParseSpindumpStack",
"(",
"self",
",",
"fd",
")",
":",
"user_thread_re",
"=",
"re",
".",
"compile",
"(",
"'^ Thread ([0-9a-fx]+)'",
")",
"line",
"=",
"fd",
".",
"readline",
"(",
")",
"in_user_stack",
"=",
"False",
"in_kernel_stack",
"=",
"False",
"... | Parses a spindump stack report. | [
"Parses",
"a",
"spindump",
"stack",
"report",
"."
] | [
"\"\"\"Parses a spindump stack report. In this format, each thread stack has\n both a user and kernel trace. Only the user traces are symbolicated.\"\"\"",
"# The stack trace begins with the thread header, which is identified by a",
"# HEX number. The thread names appear to be incorrect in spindumps.",
"# ... | [
{
"param": "self",
"type": null
},
{
"param": "fd",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fd",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
2dabce4e1300c70322c30e6b9656ce57e9ad9289 | sunlongbo/chromium | tools/mac/symbolicate_crash.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ParseSpindumpStackFrame | <not_specific> | def _ParseSpindumpStackFrame(self, line):
"""Parses a spindump-style stackframe."""
frame = StackFrame(line)
# The format of the frame is either:
# A: |<space><steps> <symbol> + <offset> (in <image-name>) [<address>]|
# B: |<space><steps> ??? (in <image-name> + <offset>) [<address>]|
regex_a = ... | Parses a spindump-style stackframe. | Parses a spindump-style stackframe. | [
"Parses",
"a",
"spindump",
"-",
"style",
"stackframe",
"."
] | def _ParseSpindumpStackFrame(self, line):
frame = StackFrame(line)
regex_a = '^([ ]+[0-9]+) (.*) \+ ([0-9]+) \(in (.*)\) \[(0x[0-9a-f]+)\]'
regex_b = '^([ ]+[0-9]+) \?\?\?( \(in (.*) \+ ([0-9]+)\))? \[(0x[0-9a-f]+)\]'
matches = re.match(regex_a, line)
if matches:
frame.frame_id = matches.group... | [
"def",
"_ParseSpindumpStackFrame",
"(",
"self",
",",
"line",
")",
":",
"frame",
"=",
"StackFrame",
"(",
"line",
")",
"regex_a",
"=",
"'^([ ]+[0-9]+) (.*) \\+ ([0-9]+) \\(in (.*)\\) \\[(0x[0-9a-f]+)\\]'",
"regex_b",
"=",
"'^([ ]+[0-9]+) \\?\\?\\?( \\(in (.*) \\+ ([0-9]+)\\))? \\... | Parses a spindump-style stackframe. | [
"Parses",
"a",
"spindump",
"-",
"style",
"stackframe",
"."
] | [
"\"\"\"Parses a spindump-style stackframe.\"\"\"",
"# The format of the frame is either:",
"# A: |<space><steps> <symbol> + <offset> (in <image-name>) [<address>]|",
"# B: |<space><steps> ??? (in <image-name> + <offset>) [<address>]|",
"# Create the stack frame with the information extracted from the regex.... | [
{
"param": "self",
"type": null
},
{
"param": "line",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "line",
"type": null,
"docstring": null,
"docstring_tokens": [... |
2dabce4e1300c70322c30e6b9656ce57e9ad9289 | sunlongbo/chromium | tools/mac/symbolicate_crash.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ParseBinaryImages | <not_specific> | def _ParseBinaryImages(self, fd):
"""Parses out the binary images section in order to get the load offset."""
# The parser skips some sections, so advance until the "Binary Images"
# header is reached.
while not fd.readline().lstrip().startswith("Binary Images:"): pass
# Create a regex to match the... | Parses out the binary images section in order to get the load offset. | Parses out the binary images section in order to get the load offset. | [
"Parses",
"out",
"the",
"binary",
"images",
"section",
"in",
"order",
"to",
"get",
"the",
"load",
"offset",
"."
] | def _ParseBinaryImages(self, fd):
while not fd.readline().lstrip().startswith("Binary Images:"): pass
image_re = re.compile(
'[ ]*(0x[0-9a-f]+) -[ \t]+(0x[0-9a-f]+) [+ ]([a-zA-Z0-9._\-]+)')
while True:
line = fd.readline()
if not line.strip():
return
match = image_re.match(... | [
"def",
"_ParseBinaryImages",
"(",
"self",
",",
"fd",
")",
":",
"while",
"not",
"fd",
".",
"readline",
"(",
")",
".",
"lstrip",
"(",
")",
".",
"startswith",
"(",
"\"Binary Images:\"",
")",
":",
"pass",
"image_re",
"=",
"re",
".",
"compile",
"(",
"'[ ]*(... | Parses out the binary images section in order to get the load offset. | [
"Parses",
"out",
"the",
"binary",
"images",
"section",
"in",
"order",
"to",
"get",
"the",
"load",
"offset",
"."
] | [
"\"\"\"Parses out the binary images section in order to get the load offset.\"\"\"",
"# The parser skips some sections, so advance until the \"Binary Images\"",
"# header is reached.",
"# Create a regex to match the lines of format:",
"# |0x<start> - 0x<end> <binary-image> <version> (<version>) <<UUID>> <pa... | [
{
"param": "self",
"type": null
},
{
"param": "fd",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fd",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
2dabce4e1300c70322c30e6b9656ce57e9ad9289 | sunlongbo/chromium | tools/mac/symbolicate_crash.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CollectAddressesForImages | <not_specific> | def _CollectAddressesForImages(self, images):
"""Iterates all the threads and stack frames and all the stack frames that
are in a list of binary |images|. The result is a dictionary, keyed by the
image name that maps to a list of tuples. Each is a 2-Tuple of
(stack_frame, address)"""
# Create the co... | Iterates all the threads and stack frames and all the stack frames that
are in a list of binary |images|. The result is a dictionary, keyed by the
image name that maps to a list of tuples. Each is a 2-Tuple of
(stack_frame, address) | Iterates all the threads and stack frames and all the stack frames that
are in a list of binary |images|. The result is a dictionary, keyed by the
image name that maps to a list of tuples. Each is a 2-Tuple of
(stack_frame, address) | [
"Iterates",
"all",
"the",
"threads",
"and",
"stack",
"frames",
"and",
"all",
"the",
"stack",
"frames",
"that",
"are",
"in",
"a",
"list",
"of",
"binary",
"|images|",
".",
"The",
"result",
"is",
"a",
"dictionary",
"keyed",
"by",
"the",
"image",
"name",
"th... | def _CollectAddressesForImages(self, images):
collection = {}
for image in images:
collection[image] = []
for thread in self.threads:
for frame in thread.stack:
image_name = self._ImageForAddress(frame.address)
if image_name in images:
frame.image = image_name
... | [
"def",
"_CollectAddressesForImages",
"(",
"self",
",",
"images",
")",
":",
"collection",
"=",
"{",
"}",
"for",
"image",
"in",
"images",
":",
"collection",
"[",
"image",
"]",
"=",
"[",
"]",
"for",
"thread",
"in",
"self",
".",
"threads",
":",
"for",
"fra... | Iterates all the threads and stack frames and all the stack frames that
are in a list of binary |images|. | [
"Iterates",
"all",
"the",
"threads",
"and",
"stack",
"frames",
"and",
"all",
"the",
"stack",
"frames",
"that",
"are",
"in",
"a",
"list",
"of",
"binary",
"|images|",
"."
] | [
"\"\"\"Iterates all the threads and stack frames and all the stack frames that\n are in a list of binary |images|. The result is a dictionary, keyed by the\n image name that maps to a list of tuples. Each is a 2-Tuple of\n (stack_frame, address)\"\"\"",
"# Create the collection and initialize it with emp... | [
{
"param": "self",
"type": null
},
{
"param": "images",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "images",
"type": null,
"docstring": null,
"docstring_tokens":... |
2dabce4e1300c70322c30e6b9656ce57e9ad9289 | sunlongbo/chromium | tools/mac/symbolicate_crash.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ImageForAddress | <not_specific> | def _ImageForAddress(self, address):
"""Given a PC address, returns the bundle identifier of the image in which
the address resides."""
for image_name, address_range in self._binary_images.items():
if address >= address_range[0] and address <= address_range[1]:
return image_name
return Non... | Given a PC address, returns the bundle identifier of the image in which
the address resides. | Given a PC address, returns the bundle identifier of the image in which
the address resides. | [
"Given",
"a",
"PC",
"address",
"returns",
"the",
"bundle",
"identifier",
"of",
"the",
"image",
"in",
"which",
"the",
"address",
"resides",
"."
] | def _ImageForAddress(self, address):
for image_name, address_range in self._binary_images.items():
if address >= address_range[0] and address <= address_range[1]:
return image_name
return None | [
"def",
"_ImageForAddress",
"(",
"self",
",",
"address",
")",
":",
"for",
"image_name",
",",
"address_range",
"in",
"self",
".",
"_binary_images",
".",
"items",
"(",
")",
":",
"if",
"address",
">=",
"address_range",
"[",
"0",
"]",
"and",
"address",
"<=",
... | Given a PC address, returns the bundle identifier of the image in which
the address resides. | [
"Given",
"a",
"PC",
"address",
"returns",
"the",
"bundle",
"identifier",
"of",
"the",
"image",
"in",
"which",
"the",
"address",
"resides",
"."
] | [
"\"\"\"Given a PC address, returns the bundle identifier of the image in which\n the address resides.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "address",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "address",
"type": null,
"docstring": null,
"docstring_tokens"... |
2dabce4e1300c70322c30e6b9656ce57e9ad9289 | sunlongbo/chromium | tools/mac/symbolicate_crash.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetDSymPath | <not_specific> | def _GetDSymPath(self, base_path, image_name):
"""Takes a base path for the symbols and an image name. It looks the name up
in SYMBOL_IMAGE_MAP and creates a full path to the dSYM in the bundle."""
image_file = SYMBOL_IMAGE_MAP[image_name]
return os.path.join(base_path, image_file + '.dSYM', 'Contents',... | Takes a base path for the symbols and an image name. It looks the name up
in SYMBOL_IMAGE_MAP and creates a full path to the dSYM in the bundle. | Takes a base path for the symbols and an image name. It looks the name up
in SYMBOL_IMAGE_MAP and creates a full path to the dSYM in the bundle. | [
"Takes",
"a",
"base",
"path",
"for",
"the",
"symbols",
"and",
"an",
"image",
"name",
".",
"It",
"looks",
"the",
"name",
"up",
"in",
"SYMBOL_IMAGE_MAP",
"and",
"creates",
"a",
"full",
"path",
"to",
"the",
"dSYM",
"in",
"the",
"bundle",
"."
] | def _GetDSymPath(self, base_path, image_name):
image_file = SYMBOL_IMAGE_MAP[image_name]
return os.path.join(base_path, image_file + '.dSYM', 'Contents',
'Resources', 'DWARF',
os.path.splitext(image_file)[0]) | [
"def",
"_GetDSymPath",
"(",
"self",
",",
"base_path",
",",
"image_name",
")",
":",
"image_file",
"=",
"SYMBOL_IMAGE_MAP",
"[",
"image_name",
"]",
"return",
"os",
".",
"path",
".",
"join",
"(",
"base_path",
",",
"image_file",
"+",
"'.dSYM'",
",",
"'Contents'"... | Takes a base path for the symbols and an image name. | [
"Takes",
"a",
"base",
"path",
"for",
"the",
"symbols",
"and",
"an",
"image",
"name",
"."
] | [
"\"\"\"Takes a base path for the symbols and an image name. It looks the name up\n in SYMBOL_IMAGE_MAP and creates a full path to the dSYM in the bundle.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "base_path",
"type": null
},
{
"param": "image_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "base_path",
"type": null,
"docstring": null,
"docstring_token... |
2dabce4e1300c70322c30e6b9656ce57e9ad9289 | sunlongbo/chromium | tools/mac/symbolicate_crash.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RunAtos | <not_specific> | def _RunAtos(self, load_address, dsym_file, addresses):
"""Runs the atos with the provided arguments. |addresses| is used as stdin.
Returns a list of symbol information in the same order as |addresses|."""
args = ['atos', '-l', str(load_address), '-o', dsym_file]
# Get the arch type. This is of the for... | Runs the atos with the provided arguments. |addresses| is used as stdin.
Returns a list of symbol information in the same order as |addresses|. | Runs the atos with the provided arguments. |addresses| is used as stdin.
Returns a list of symbol information in the same order as |addresses|. | [
"Runs",
"the",
"atos",
"with",
"the",
"provided",
"arguments",
".",
"|addresses|",
"is",
"used",
"as",
"stdin",
".",
"Returns",
"a",
"list",
"of",
"symbol",
"information",
"in",
"the",
"same",
"order",
"as",
"|addresses|",
"."
] | def _RunAtos(self, load_address, dsym_file, addresses):
args = ['atos', '-l', str(load_address), '-o', dsym_file]
if 'Code Type' in self.report_info:
arch = self.report_info['Code Type'].lower().split(' ')
if len(arch) == 2:
arch = arch[0]
if arch == 'x86':
arch = 'i386'
... | [
"def",
"_RunAtos",
"(",
"self",
",",
"load_address",
",",
"dsym_file",
",",
"addresses",
")",
":",
"args",
"=",
"[",
"'atos'",
",",
"'-l'",
",",
"str",
"(",
"load_address",
")",
",",
"'-o'",
",",
"dsym_file",
"]",
"if",
"'Code Type'",
"in",
"self",
"."... | Runs the atos with the provided arguments. | [
"Runs",
"the",
"atos",
"with",
"the",
"provided",
"arguments",
"."
] | [
"\"\"\"Runs the atos with the provided arguments. |addresses| is used as stdin.\n Returns a list of symbol information in the same order as |addresses|.\"\"\"",
"# Get the arch type. This is of the format |X86 (Native)|.",
"# The crash report refers to i386 as x86, but atos doesn't know what",
"# that is."... | [
{
"param": "self",
"type": null
},
{
"param": "load_address",
"type": null
},
{
"param": "dsym_file",
"type": null
},
{
"param": "addresses",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "load_address",
"type": null,
"docstring": null,
"docstring_to... |
2dabce4e1300c70322c30e6b9656ce57e9ad9289 | sunlongbo/chromium | tools/mac/symbolicate_crash.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddSymbolsToFrames | null | def _AddSymbolsToFrames(self, symbols, address_tuples):
"""Takes a single value (the list) from _CollectAddressesForImages and does
a smart-zip with the data returned by atos in |symbols|. Note that the
indices must match for this to succeed."""
if len(symbols) != len(address_tuples):
print('symbo... | Takes a single value (the list) from _CollectAddressesForImages and does
a smart-zip with the data returned by atos in |symbols|. Note that the
indices must match for this to succeed. | Takes a single value (the list) from _CollectAddressesForImages and does
a smart-zip with the data returned by atos in |symbols|. Note that the
indices must match for this to succeed. | [
"Takes",
"a",
"single",
"value",
"(",
"the",
"list",
")",
"from",
"_CollectAddressesForImages",
"and",
"does",
"a",
"smart",
"-",
"zip",
"with",
"the",
"data",
"returned",
"by",
"atos",
"in",
"|symbols|",
".",
"Note",
"that",
"the",
"indices",
"must",
"mat... | def _AddSymbolsToFrames(self, symbols, address_tuples):
if len(symbols) != len(address_tuples):
print('symbols do not match')
line_regex = re.compile('(.+) \(in (.+)\) (\((.+):([0-9]+)\))?')
for i in range(len(symbols)):
symbol_parts = line_regex.match(symbols[i])
if not symbol_parts:
... | [
"def",
"_AddSymbolsToFrames",
"(",
"self",
",",
"symbols",
",",
"address_tuples",
")",
":",
"if",
"len",
"(",
"symbols",
")",
"!=",
"len",
"(",
"address_tuples",
")",
":",
"print",
"(",
"'symbols do not match'",
")",
"line_regex",
"=",
"re",
".",
"compile",
... | Takes a single value (the list) from _CollectAddressesForImages and does
a smart-zip with the data returned by atos in |symbols|. | [
"Takes",
"a",
"single",
"value",
"(",
"the",
"list",
")",
"from",
"_CollectAddressesForImages",
"and",
"does",
"a",
"smart",
"-",
"zip",
"with",
"the",
"data",
"returned",
"by",
"atos",
"in",
"|symbols|",
"."
] | [
"\"\"\"Takes a single value (the list) from _CollectAddressesForImages and does\n a smart-zip with the data returned by atos in |symbols|. Note that the\n indices must match for this to succeed.\"\"\"",
"# Each line of output from atos is in this format:",
"# |<symbol> (in <image>) (<file>:<line>)|.",
"... | [
{
"param": "self",
"type": null
},
{
"param": "symbols",
"type": null
},
{
"param": "address_tuples",
"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"... |
2dabce4e1300c70322c30e6b9656ce57e9ad9289 | sunlongbo/chromium | tools/mac/symbolicate_crash.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | PrettyPrintReport | null | def PrettyPrintReport(report):
"""Takes a crash report and prints it like the crash server would."""
print('Process : ' + report.report_info['Process'])
print('Version : ' + report.report_info['Version'])
print('Date : ' + report.report_info['Date/Time'])
print('OS Version : ' + report.report_info... | Takes a crash report and prints it like the crash server would. | Takes a crash report and prints it like the crash server would. | [
"Takes",
"a",
"crash",
"report",
"and",
"prints",
"it",
"like",
"the",
"crash",
"server",
"would",
"."
] | def PrettyPrintReport(report):
print('Process : ' + report.report_info['Process'])
print('Version : ' + report.report_info['Version'])
print('Date : ' + report.report_info['Date/Time'])
print('OS Version : ' + report.report_info['OS Version'])
print()
if 'Crashed Thread' in report.report_info:
... | [
"def",
"PrettyPrintReport",
"(",
"report",
")",
":",
"print",
"(",
"'Process : '",
"+",
"report",
".",
"report_info",
"[",
"'Process'",
"]",
")",
"print",
"(",
"'Version : '",
"+",
"report",
".",
"report_info",
"[",
"'Version'",
"]",
")",
"print",
"(",... | Takes a crash report and prints it like the crash server would. | [
"Takes",
"a",
"crash",
"report",
"and",
"prints",
"it",
"like",
"the",
"crash",
"server",
"would",
"."
] | [
"\"\"\"Takes a crash report and prints it like the crash server would.\"\"\"",
"# Version 7 reports have spindump-style output (with a stepped stack trace),",
"# so remove the first tab to get better alignment."
] | [
{
"param": "report",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "report",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b337c86d734614854c39bac671dab7c0b1cd3131 | sunlongbo/chromium | tools/android/native_lib_memory/extract_symbols.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetSymbolNameToFilename | <not_specific> | def _GetSymbolNameToFilename(build_directory):
"""Parses object files in a directory, and maps mangled symbol names to files.
Object files are assumed to actually be LLVM bitcode files, that is this
assumes clang as the compiler and the use of LTO.
Args:
build_directory: (str) Build directory.
Returns:... | Parses object files in a directory, and maps mangled symbol names to files.
Object files are assumed to actually be LLVM bitcode files, that is this
assumes clang as the compiler and the use of LTO.
Args:
build_directory: (str) Build directory.
Returns:
{symbol name (str): object filename (str)}. Fil... | Parses object files in a directory, and maps mangled symbol names to files.
Object files are assumed to actually be LLVM bitcode files, that is this
assumes clang as the compiler and the use of LTO. | [
"Parses",
"object",
"files",
"in",
"a",
"directory",
"and",
"maps",
"mangled",
"symbol",
"names",
"to",
"files",
".",
"Object",
"files",
"are",
"assumed",
"to",
"actually",
"be",
"LLVM",
"bitcode",
"files",
"that",
"is",
"this",
"assumes",
"clang",
"as",
"... | def _GetSymbolNameToFilename(build_directory):
symbol_extractor.CheckLlvmNmExists()
path = os.path.join(build_directory, 'obj')
object_filenames = cyglog_to_orderfile.GetObjectFilenames(path)
pool = multiprocessing.Pool()
symbol_names_filename = zip(
pool.map(symbol_extractor.SymbolNamesFromLlvmBitcodeF... | [
"def",
"_GetSymbolNameToFilename",
"(",
"build_directory",
")",
":",
"symbol_extractor",
".",
"CheckLlvmNmExists",
"(",
")",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"build_directory",
",",
"'obj'",
")",
"object_filenames",
"=",
"cyglog_to_orderfile",
"."... | Parses object files in a directory, and maps mangled symbol names to files. | [
"Parses",
"object",
"files",
"in",
"a",
"directory",
"and",
"maps",
"mangled",
"symbol",
"names",
"to",
"files",
"."
] | [
"\"\"\"Parses object files in a directory, and maps mangled symbol names to files.\n\n Object files are assumed to actually be LLVM bitcode files, that is this\n assumes clang as the compiler and the use of LTO.\n\n Args:\n build_directory: (str) Build directory.\n\n Returns:\n {symbol name (str): object ... | [
{
"param": "build_directory",
"type": null
}
] | {
"returns": [
{
"docstring": "{symbol name (str): object filename (str)}. Filenames are stripped of the\noutput_directory part.",
"docstring_tokens": [
"{",
"symbol",
"name",
"(",
"str",
")",
":",
"object",
"filename",
"(... |
b337c86d734614854c39bac671dab7c0b1cd3131 | sunlongbo/chromium | tools/android/native_lib_memory/extract_symbols.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CodePagesToObjectFiles | <not_specific> | def CodePagesToObjectFiles(symbols_to_object_files, code_pages_to_symbols):
"""From symbols in object files and symbols in pages, gives code page to
object files.
Args:
symbols_to_object_files: (dict) as returned by _GetSymbolNameToFilename()
code_pages_to_symbols: (dict) as returned by CodePagesToMangle... | From symbols in object files and symbols in pages, gives code page to
object files.
Args:
symbols_to_object_files: (dict) as returned by _GetSymbolNameToFilename()
code_pages_to_symbols: (dict) as returned by CodePagesToMangledSymbols()
Returns:
{page_offset: {object_filename: size_in_page}}
| From symbols in object files and symbols in pages, gives code page to
object files. | [
"From",
"symbols",
"in",
"object",
"files",
"and",
"symbols",
"in",
"pages",
"gives",
"code",
"page",
"to",
"object",
"files",
"."
] | def CodePagesToObjectFiles(symbols_to_object_files, code_pages_to_symbols):
result = {}
unmatched_symbols_count = 0
unmatched_symbols_size = 0
for page_address in code_pages_to_symbols:
result[page_address] = {}
for name, size_in_page in code_pages_to_symbols[page_address]:
if name not in symbols_... | [
"def",
"CodePagesToObjectFiles",
"(",
"symbols_to_object_files",
",",
"code_pages_to_symbols",
")",
":",
"result",
"=",
"{",
"}",
"unmatched_symbols_count",
"=",
"0",
"unmatched_symbols_size",
"=",
"0",
"for",
"page_address",
"in",
"code_pages_to_symbols",
":",
"result"... | From symbols in object files and symbols in pages, gives code page to
object files. | [
"From",
"symbols",
"in",
"object",
"files",
"and",
"symbols",
"in",
"pages",
"gives",
"code",
"page",
"to",
"object",
"files",
"."
] | [
"\"\"\"From symbols in object files and symbols in pages, gives code page to\n object files.\n\n Args:\n symbols_to_object_files: (dict) as returned by _GetSymbolNameToFilename()\n code_pages_to_symbols: (dict) as returned by CodePagesToMangledSymbols()\n\n Returns:\n {page_offset: {object_filename: siz... | [
{
"param": "symbols_to_object_files",
"type": null
},
{
"param": "code_pages_to_symbols",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "{page_offset"
}
],
"raises": [],
"params": [
{
"identifier": "symbols_to_object_files",
"type": null,
"docstring": "(dict) as returned by _GetSymbolNameToFilename()",
... |
b337c86d734614854c39bac671dab7c0b1cd3131 | sunlongbo/chromium | tools/android/native_lib_memory/extract_symbols.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreateArgumentParser | <not_specific> | def CreateArgumentParser():
"""Creates and returns the argument parser."""
parser = argparse.ArgumentParser(description='Map code pages to paths')
parser.add_argument('--native-library', type=str, default='libchrome.so',
help=('Native Library, e.g. libchrome.so or '
... | Creates and returns the argument parser. | Creates and returns the argument parser. | [
"Creates",
"and",
"returns",
"the",
"argument",
"parser",
"."
] | def CreateArgumentParser():
parser = argparse.ArgumentParser(description='Map code pages to paths')
parser.add_argument('--native-library', type=str, default='libchrome.so',
help=('Native Library, e.g. libchrome.so or '
'libmonochrome.so'))
parser.add_argument('--... | [
"def",
"CreateArgumentParser",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Map code pages to paths'",
")",
"parser",
".",
"add_argument",
"(",
"'--native-library'",
",",
"type",
"=",
"str",
",",
"default",
"=",
"'l... | Creates and returns the argument parser. | [
"Creates",
"and",
"returns",
"the",
"argument",
"parser",
"."
] | [
"\"\"\"Creates and returns the argument parser.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
c3347b07dfc926a0d1e944bcef23c85bb21ff0c9 | sunlongbo/chromium | tools/perf/page_sets/login_helpers/login_utils.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | InputWithSelector | null | def InputWithSelector(action_runner, input_text, input_selector):
"""Sets the text value of an input field in a form on the page.
Waits until the input element exists on the page. Then executes JS to populate
the value property of the element with |input_text|.
Args:
action_runner: ActionRunner instance t... | Sets the text value of an input field in a form on the page.
Waits until the input element exists on the page. Then executes JS to populate
the value property of the element with |input_text|.
Args:
action_runner: ActionRunner instance to execute JS to populate form fields.
input_text: Text string to po... | Sets the text value of an input field in a form on the page.
Waits until the input element exists on the page. Then executes JS to populate
the value property of the element with |input_text|. | [
"Sets",
"the",
"text",
"value",
"of",
"an",
"input",
"field",
"in",
"a",
"form",
"on",
"the",
"page",
".",
"Waits",
"until",
"the",
"input",
"element",
"exists",
"on",
"the",
"page",
".",
"Then",
"executes",
"JS",
"to",
"populate",
"the",
"value",
"pro... | def InputWithSelector(action_runner, input_text, input_selector):
action_runner.WaitForElement(selector=input_selector)
action_runner.Wait(0.5)
action_runner.ExecuteJavaScript(
'document.querySelector({{selector}}).focus()', selector=input_selector)
action_runner.Wait(0.5)
action_runner.EnterText(input_... | [
"def",
"InputWithSelector",
"(",
"action_runner",
",",
"input_text",
",",
"input_selector",
")",
":",
"action_runner",
".",
"WaitForElement",
"(",
"selector",
"=",
"input_selector",
")",
"action_runner",
".",
"Wait",
"(",
"0.5",
")",
"action_runner",
".",
"Execute... | Sets the text value of an input field in a form on the page. | [
"Sets",
"the",
"text",
"value",
"of",
"an",
"input",
"field",
"in",
"a",
"form",
"on",
"the",
"page",
"."
] | [
"\"\"\"Sets the text value of an input field in a form on the page.\n\n Waits until the input element exists on the page. Then executes JS to populate\n the value property of the element with |input_text|.\n\n Args:\n action_runner: ActionRunner instance to execute JS to populate form fields.\n input_text:... | [
{
"param": "action_runner",
"type": null
},
{
"param": "input_text",
"type": null
},
{
"param": "input_selector",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "If waiting to find the element times out.",
"docstring_tokens": [
"If",
"waiting",
"to",
"find",
"the",
"element",
"times",
"out",
"."
],
"type": "exceptions.TimeoutExcept... |
117ecce63b72ad36d67853e32666fc91a4d658f0 | sunlongbo/chromium | tools/translation/upload_screenshots.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | find_screenshots | <not_specific> | def find_screenshots(repo_root, translation_expectations):
"""Returns a list of translation related .png files in the repository."""
translatable_grds = translation_helper.get_translatable_grds(
repo_root, git_helper.list_grds_in_repository(repo_root),
translation_expectations)
# Add the paths of grd... | Returns a list of translation related .png files in the repository. | Returns a list of translation related .png files in the repository. | [
"Returns",
"a",
"list",
"of",
"translation",
"related",
".",
"png",
"files",
"in",
"the",
"repository",
"."
] | def find_screenshots(repo_root, translation_expectations):
translatable_grds = translation_helper.get_translatable_grds(
repo_root, git_helper.list_grds_in_repository(repo_root),
translation_expectations)
src_paths = []
for grd in translatable_grds:
src_paths.append(grd.path)
src_paths.extend(... | [
"def",
"find_screenshots",
"(",
"repo_root",
",",
"translation_expectations",
")",
":",
"translatable_grds",
"=",
"translation_helper",
".",
"get_translatable_grds",
"(",
"repo_root",
",",
"git_helper",
".",
"list_grds_in_repository",
"(",
"repo_root",
")",
",",
"transl... | Returns a list of translation related .png files in the repository. | [
"Returns",
"a",
"list",
"of",
"translation",
"related",
".",
"png",
"files",
"in",
"the",
"repository",
"."
] | [
"\"\"\"Returns a list of translation related .png files in the repository.\"\"\"",
"# Add the paths of grds and any files they include. This includes grdp files",
"# and files included via <structure> elements.",
"# Convert grd_path.grd to grd_path_grd/ directory.",
"# Grab all the .png files under the scre... | [
{
"param": "repo_root",
"type": null
},
{
"param": "translation_expectations",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "repo_root",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "translation_expectations",
"type": null,
"docstring": null,
... |
11a25a7169ec90e075b440aae98b1162abc9d84b | sunlongbo/chromium | tools/usb_gadget/linux_gadgetfs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Create | null | def Create(self, gadget):
"""Bind a gadget to the USB peripheral controller."""
self._gadget = gadget
self._fd = os.open(os.path.join(self._ep_dir, self._chip), os.O_RDWR)
buf = ''.join([struct.pack('=I', 0),
gadget.GetFullSpeedConfigurationDescriptor().Encode(),
ga... | Bind a gadget to the USB peripheral controller. | Bind a gadget to the USB peripheral controller. | [
"Bind",
"a",
"gadget",
"to",
"the",
"USB",
"peripheral",
"controller",
"."
] | def Create(self, gadget):
self._gadget = gadget
self._fd = os.open(os.path.join(self._ep_dir, self._chip), os.O_RDWR)
buf = ''.join([struct.pack('=I', 0),
gadget.GetFullSpeedConfigurationDescriptor().Encode(),
gadget.GetHighSpeedConfigurationDescriptor().Encode(),
... | [
"def",
"Create",
"(",
"self",
",",
"gadget",
")",
":",
"self",
".",
"_gadget",
"=",
"gadget",
"self",
".",
"_fd",
"=",
"os",
".",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_ep_dir",
",",
"self",
".",
"_chip",
")",
",",
"os... | Bind a gadget to the USB peripheral controller. | [
"Bind",
"a",
"gadget",
"to",
"the",
"USB",
"peripheral",
"controller",
"."
] | [
"\"\"\"Bind a gadget to the USB peripheral controller.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "gadget",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gadget",
"type": null,
"docstring": null,
"docstring_tokens":... |
11a25a7169ec90e075b440aae98b1162abc9d84b | sunlongbo/chromium | tools/usb_gadget/linux_gadgetfs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Destroy | null | def Destroy(self):
"""Unbind the gadget from the USB peripheral controller."""
self.Disconnected()
self._io_loop.remove_handler(self._fd)
os.close(self._fd)
self._gadget = None
self._fd = None | Unbind the gadget from the USB peripheral controller. | Unbind the gadget from the USB peripheral controller. | [
"Unbind",
"the",
"gadget",
"from",
"the",
"USB",
"peripheral",
"controller",
"."
] | def Destroy(self):
self.Disconnected()
self._io_loop.remove_handler(self._fd)
os.close(self._fd)
self._gadget = None
self._fd = None | [
"def",
"Destroy",
"(",
"self",
")",
":",
"self",
".",
"Disconnected",
"(",
")",
"self",
".",
"_io_loop",
".",
"remove_handler",
"(",
"self",
".",
"_fd",
")",
"os",
".",
"close",
"(",
"self",
".",
"_fd",
")",
"self",
".",
"_gadget",
"=",
"None",
"se... | Unbind the gadget from the USB peripheral controller. | [
"Unbind",
"the",
"gadget",
"from",
"the",
"USB",
"peripheral",
"controller",
"."
] | [
"\"\"\"Unbind the gadget from the USB peripheral controller.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
11a25a7169ec90e075b440aae98b1162abc9d84b | sunlongbo/chromium | tools/usb_gadget/linux_gadgetfs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | StartEndpoint | null | def StartEndpoint(self, endpoint_desc):
"""Activate an endpoint.
To enable a hardware endpoint the appropriate endpoint file must be opened
and the endpoint descriptors written to it. Linux requires both full- and
high-speed descriptors to be written for a high-speed device but since the
endpoint i... | Activate an endpoint.
To enable a hardware endpoint the appropriate endpoint file must be opened
and the endpoint descriptors written to it. Linux requires both full- and
high-speed descriptors to be written for a high-speed device but since the
endpoint is always reinitialized after disconnect only th... | Activate an endpoint.
To enable a hardware endpoint the appropriate endpoint file must be opened
and the endpoint descriptors written to it. Linux requires both full- and
high-speed descriptors to be written for a high-speed device but since the
endpoint is always reinitialized after disconnect only the high-speed
endp... | [
"Activate",
"an",
"endpoint",
".",
"To",
"enable",
"a",
"hardware",
"endpoint",
"the",
"appropriate",
"endpoint",
"file",
"must",
"be",
"opened",
"and",
"the",
"endpoint",
"descriptors",
"written",
"to",
"it",
".",
"Linux",
"requires",
"both",
"full",
"-",
"... | def StartEndpoint(self, endpoint_desc):
endpoint_addr = endpoint_desc.bEndpointAddress
name, hw_ep_type, hw_ep_size = self._hw_eps[endpoint_addr]
if name in self._ep_fds:
raise RuntimeError('Hardware endpoint {} already in use.'.format(name))
ep_type = USB_TRANSFER_TYPE_TO_MASK[
endpoint_d... | [
"def",
"StartEndpoint",
"(",
"self",
",",
"endpoint_desc",
")",
":",
"endpoint_addr",
"=",
"endpoint_desc",
".",
"bEndpointAddress",
"name",
",",
"hw_ep_type",
",",
"hw_ep_size",
"=",
"self",
".",
"_hw_eps",
"[",
"endpoint_addr",
"]",
"if",
"name",
"in",
"self... | Activate an endpoint. | [
"Activate",
"an",
"endpoint",
"."
] | [
"\"\"\"Activate an endpoint.\n\n To enable a hardware endpoint the appropriate endpoint file must be opened\n and the endpoint descriptors written to it. Linux requires both full- and\n high-speed descriptors to be written for a high-speed device but since the\n endpoint is always reinitialized after di... | [
{
"param": "self",
"type": null
},
{
"param": "endpoint_desc",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "If the hardware endpoint is in use or the configuration\nis not supported by the hardware.",
"docstring_tokens": [
"If",
"the",
"hardware",
"endpoint",
"is",
"in",
"use",
"or",
"the",... |
11a25a7169ec90e075b440aae98b1162abc9d84b | sunlongbo/chromium | tools/usb_gadget/linux_gadgetfs.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | HaltEndpoint | null | def HaltEndpoint(self, endpoint_addr):
"""Signal a stall condition on the given endpoint."""
fd, _ = self._ep_fds[endpoint_addr]
# Reverse I/O direction sets the halt condition on the pipe.
try:
if endpoint_addr & usb_constants.Dir.IN:
os.read(fd, 0)
else:
os.write(fd, '')
... | Signal a stall condition on the given endpoint. | Signal a stall condition on the given endpoint. | [
"Signal",
"a",
"stall",
"condition",
"on",
"the",
"given",
"endpoint",
"."
] | def HaltEndpoint(self, endpoint_addr):
fd, _ = self._ep_fds[endpoint_addr]
try:
if endpoint_addr & usb_constants.Dir.IN:
os.read(fd, 0)
else:
os.write(fd, '')
except OSError, e:
if e.errno != errno.EBADMSG:
raise | [
"def",
"HaltEndpoint",
"(",
"self",
",",
"endpoint_addr",
")",
":",
"fd",
",",
"_",
"=",
"self",
".",
"_ep_fds",
"[",
"endpoint_addr",
"]",
"try",
":",
"if",
"endpoint_addr",
"&",
"usb_constants",
".",
"Dir",
".",
"IN",
":",
"os",
".",
"read",
"(",
"... | Signal a stall condition on the given endpoint. | [
"Signal",
"a",
"stall",
"condition",
"on",
"the",
"given",
"endpoint",
"."
] | [
"\"\"\"Signal a stall condition on the given endpoint.\"\"\"",
"# Reverse I/O direction sets the halt condition on the pipe.",
"# gadgetfs always returns EBADMSG which we should ignore."
] | [
{
"param": "self",
"type": null
},
{
"param": "endpoint_addr",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "endpoint_addr",
"type": null,
"docstring": null,
"docstring_t... |
fb15c25288f8391cea8efacb3ddb3340661d2aff | sunlongbo/chromium | tools/android/elf_compression/compress_section.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AlignUp | <not_specific> | def AlignUp(addr, page_size=ADDRESS_ALIGN):
"""Rounds up given address to be aligned to page_size.
Args:
addr: int. Virtual address to be aligned.
page_size: int. Page size to be used for the alignment.
"""
if addr % page_size != 0:
addr += page_size - (addr % page_size)
return addr | Rounds up given address to be aligned to page_size.
Args:
addr: int. Virtual address to be aligned.
page_size: int. Page size to be used for the alignment.
| Rounds up given address to be aligned to page_size. | [
"Rounds",
"up",
"given",
"address",
"to",
"be",
"aligned",
"to",
"page_size",
"."
] | def AlignUp(addr, page_size=ADDRESS_ALIGN):
if addr % page_size != 0:
addr += page_size - (addr % page_size)
return addr | [
"def",
"AlignUp",
"(",
"addr",
",",
"page_size",
"=",
"ADDRESS_ALIGN",
")",
":",
"if",
"addr",
"%",
"page_size",
"!=",
"0",
":",
"addr",
"+=",
"page_size",
"-",
"(",
"addr",
"%",
"page_size",
")",
"return",
"addr"
] | Rounds up given address to be aligned to page_size. | [
"Rounds",
"up",
"given",
"address",
"to",
"be",
"aligned",
"to",
"page_size",
"."
] | [
"\"\"\"Rounds up given address to be aligned to page_size.\n\n Args:\n addr: int. Virtual address to be aligned.\n page_size: int. Page size to be used for the alignment.\n \"\"\""
] | [
{
"param": "addr",
"type": null
},
{
"param": "page_size",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "addr",
"type": null,
"docstring": "int. Virtual address to be aligned.",
"docstring_tokens": [
"int",
".",
"Virtual",
"address",
"to",
"be",
"aligned",
"."
... |
fb15c25288f8391cea8efacb3ddb3340661d2aff | sunlongbo/chromium | tools/android/elf_compression/compress_section.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AlignDown | <not_specific> | def AlignDown(addr, page_size=ADDRESS_ALIGN):
"""Round down given address to be aligned to page_size.
Args:
addr: int. Virtual address to be aligned.
page_size: int. Page size to be used for the alignment.
"""
return addr - addr % page_size | Round down given address to be aligned to page_size.
Args:
addr: int. Virtual address to be aligned.
page_size: int. Page size to be used for the alignment.
| Round down given address to be aligned to page_size. | [
"Round",
"down",
"given",
"address",
"to",
"be",
"aligned",
"to",
"page_size",
"."
] | def AlignDown(addr, page_size=ADDRESS_ALIGN):
return addr - addr % page_size | [
"def",
"AlignDown",
"(",
"addr",
",",
"page_size",
"=",
"ADDRESS_ALIGN",
")",
":",
"return",
"addr",
"-",
"addr",
"%",
"page_size"
] | Round down given address to be aligned to page_size. | [
"Round",
"down",
"given",
"address",
"to",
"be",
"aligned",
"to",
"page_size",
"."
] | [
"\"\"\"Round down given address to be aligned to page_size.\n\n Args:\n addr: int. Virtual address to be aligned.\n page_size: int. Page size to be used for the alignment.\n \"\"\""
] | [
{
"param": "addr",
"type": null
},
{
"param": "page_size",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "addr",
"type": null,
"docstring": "int. Virtual address to be aligned.",
"docstring_tokens": [
"int",
".",
"Virtual",
"address",
"to",
"be",
"aligned",
"."
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.