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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4cae3c1130109a9756882e5d89db4ea38bd933a0 | sunlongbo/chromium | tools/json_schema_compiler/cpp_type_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetEnumNoneValue | <not_specific> | def GetEnumNoneValue(self, type_):
"""Gets the enum value in the given model.Property indicating no value has
been set.
"""
return '%s_NONE' % self.FollowRef(type_).unix_name.upper() | Gets the enum value in the given model.Property indicating no value has
been set.
| Gets the enum value in the given model.Property indicating no value has
been set. | [
"Gets",
"the",
"enum",
"value",
"in",
"the",
"given",
"model",
".",
"Property",
"indicating",
"no",
"value",
"has",
"been",
"set",
"."
] | def GetEnumNoneValue(self, type_):
return '%s_NONE' % self.FollowRef(type_).unix_name.upper() | [
"def",
"GetEnumNoneValue",
"(",
"self",
",",
"type_",
")",
":",
"return",
"'%s_NONE'",
"%",
"self",
".",
"FollowRef",
"(",
"type_",
")",
".",
"unix_name",
".",
"upper",
"(",
")"
] | Gets the enum value in the given model.Property indicating no value has
been set. | [
"Gets",
"the",
"enum",
"value",
"in",
"the",
"given",
"model",
".",
"Property",
"indicating",
"no",
"value",
"has",
"been",
"set",
"."
] | [
"\"\"\"Gets the enum value in the given model.Property indicating no value has\n been set.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "type_",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type_",
"type": null,
"docstring": null,
"docstring_tokens": ... |
4cae3c1130109a9756882e5d89db4ea38bd933a0 | sunlongbo/chromium | tools/json_schema_compiler/cpp_type_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetEnumLastValue | <not_specific> | def GetEnumLastValue(self, type_):
"""Gets the enum value in the given model.Property indicating the last value
for the type.
"""
return '%s_LAST' % self.FollowRef(type_).unix_name.upper() | Gets the enum value in the given model.Property indicating the last value
for the type.
| Gets the enum value in the given model.Property indicating the last value
for the type. | [
"Gets",
"the",
"enum",
"value",
"in",
"the",
"given",
"model",
".",
"Property",
"indicating",
"the",
"last",
"value",
"for",
"the",
"type",
"."
] | def GetEnumLastValue(self, type_):
return '%s_LAST' % self.FollowRef(type_).unix_name.upper() | [
"def",
"GetEnumLastValue",
"(",
"self",
",",
"type_",
")",
":",
"return",
"'%s_LAST'",
"%",
"self",
".",
"FollowRef",
"(",
"type_",
")",
".",
"unix_name",
".",
"upper",
"(",
")"
] | Gets the enum value in the given model.Property indicating the last value
for the type. | [
"Gets",
"the",
"enum",
"value",
"in",
"the",
"given",
"model",
".",
"Property",
"indicating",
"the",
"last",
"value",
"for",
"the",
"type",
"."
] | [
"\"\"\"Gets the enum value in the given model.Property indicating the last value\n for the type.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "type_",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type_",
"type": null,
"docstring": null,
"docstring_tokens": ... |
4cae3c1130109a9756882e5d89db4ea38bd933a0 | sunlongbo/chromium | tools/json_schema_compiler/cpp_type_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetEnumValue | <not_specific> | def GetEnumValue(self, type_, enum_value):
"""Gets the enum value of the given model.Property of the given type.
e.g VAR_STRING
"""
value = cpp_util.Classname(enum_value.name.upper())
prefix = (type_.cpp_enum_prefix_override or
self.FollowRef(type_).unix_name)
value = '%s_%s' % (p... | Gets the enum value of the given model.Property of the given type.
e.g VAR_STRING
| Gets the enum value of the given model.Property of the given type. | [
"Gets",
"the",
"enum",
"value",
"of",
"the",
"given",
"model",
".",
"Property",
"of",
"the",
"given",
"type",
"."
] | def GetEnumValue(self, type_, enum_value):
value = cpp_util.Classname(enum_value.name.upper())
prefix = (type_.cpp_enum_prefix_override or
self.FollowRef(type_).unix_name)
value = '%s_%s' % (prefix.upper(), value)
if value.startswith("OS_"):
value += "_"
return value | [
"def",
"GetEnumValue",
"(",
"self",
",",
"type_",
",",
"enum_value",
")",
":",
"value",
"=",
"cpp_util",
".",
"Classname",
"(",
"enum_value",
".",
"name",
".",
"upper",
"(",
")",
")",
"prefix",
"=",
"(",
"type_",
".",
"cpp_enum_prefix_override",
"or",
"s... | Gets the enum value of the given model.Property of the given type. | [
"Gets",
"the",
"enum",
"value",
"of",
"the",
"given",
"model",
".",
"Property",
"of",
"the",
"given",
"type",
"."
] | [
"\"\"\"Gets the enum value of the given model.Property of the given type.\n\n e.g VAR_STRING\n \"\"\"",
"# To avoid collisions with built-in OS_* preprocessor definitions, we add a",
"# trailing slash to enum names that start with OS_."
] | [
{
"param": "self",
"type": null
},
{
"param": "type_",
"type": null
},
{
"param": "enum_value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type_",
"type": null,
"docstring": null,
"docstring_tokens": ... |
4cae3c1130109a9756882e5d89db4ea38bd933a0 | sunlongbo/chromium | tools/json_schema_compiler/cpp_type_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GenerateForwardDeclarations | <not_specific> | def GenerateForwardDeclarations(self):
"""Returns the forward declarations for self._default_namespace.
"""
c = Code()
for namespace, deps in self._NamespaceTypeDependencies().items():
filtered_deps = [
dep for dep in deps
# Add more ways to forward declare things as necessary.
... | Returns the forward declarations for self._default_namespace.
| Returns the forward declarations for self._default_namespace. | [
"Returns",
"the",
"forward",
"declarations",
"for",
"self",
".",
"_default_namespace",
"."
] | def GenerateForwardDeclarations(self):
c = Code()
for namespace, deps in self._NamespaceTypeDependencies().items():
filtered_deps = [
dep for dep in deps
if (not dep.hard and
dep.type_.property_type in (PropertyType.CHOICES,
PropertyType.... | [
"def",
"GenerateForwardDeclarations",
"(",
"self",
")",
":",
"c",
"=",
"Code",
"(",
")",
"for",
"namespace",
",",
"deps",
"in",
"self",
".",
"_NamespaceTypeDependencies",
"(",
")",
".",
"items",
"(",
")",
":",
"filtered_deps",
"=",
"[",
"dep",
"for",
"de... | Returns the forward declarations for self._default_namespace. | [
"Returns",
"the",
"forward",
"declarations",
"for",
"self",
".",
"_default_namespace",
"."
] | [
"\"\"\"Returns the forward declarations for self._default_namespace.\n \"\"\"",
"# Add more ways to forward declare things as necessary."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4cae3c1130109a9756882e5d89db4ea38bd933a0 | sunlongbo/chromium | tools/json_schema_compiler/cpp_type_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FollowRef | <not_specific> | def FollowRef(self, type_):
"""Follows $ref link of types to resolve the concrete type a ref refers to.
If the property passed in is not of type PropertyType.REF, it will be
returned unchanged.
"""
if type_.property_type != PropertyType.REF:
return type_
return self.FollowRef(self._FindTy... | Follows $ref link of types to resolve the concrete type a ref refers to.
If the property passed in is not of type PropertyType.REF, it will be
returned unchanged.
| Follows $ref link of types to resolve the concrete type a ref refers to.
If the property passed in is not of type PropertyType.REF, it will be
returned unchanged. | [
"Follows",
"$ref",
"link",
"of",
"types",
"to",
"resolve",
"the",
"concrete",
"type",
"a",
"ref",
"refers",
"to",
".",
"If",
"the",
"property",
"passed",
"in",
"is",
"not",
"of",
"type",
"PropertyType",
".",
"REF",
"it",
"will",
"be",
"returned",
"unchan... | def FollowRef(self, type_):
if type_.property_type != PropertyType.REF:
return type_
return self.FollowRef(self._FindType(type_.ref_type)) | [
"def",
"FollowRef",
"(",
"self",
",",
"type_",
")",
":",
"if",
"type_",
".",
"property_type",
"!=",
"PropertyType",
".",
"REF",
":",
"return",
"type_",
"return",
"self",
".",
"FollowRef",
"(",
"self",
".",
"_FindType",
"(",
"type_",
".",
"ref_type",
")",... | Follows $ref link of types to resolve the concrete type a ref refers to. | [
"Follows",
"$ref",
"link",
"of",
"types",
"to",
"resolve",
"the",
"concrete",
"type",
"a",
"ref",
"refers",
"to",
"."
] | [
"\"\"\"Follows $ref link of types to resolve the concrete type a ref refers to.\n\n If the property passed in is not of type PropertyType.REF, it will be\n returned unchanged.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "type_",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type_",
"type": null,
"docstring": null,
"docstring_tokens": ... |
4cae3c1130109a9756882e5d89db4ea38bd933a0 | sunlongbo/chromium | tools/json_schema_compiler/cpp_type_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _NamespaceTypeDependencies | <not_specific> | def _NamespaceTypeDependencies(self):
"""Returns a dict ordered by namespace name containing a mapping of
model.Namespace to every _TypeDependency for |self._default_namespace|,
sorted by the type's name.
"""
dependencies = set()
for function in self._default_namespace.functions.values():
... | Returns a dict ordered by namespace name containing a mapping of
model.Namespace to every _TypeDependency for |self._default_namespace|,
sorted by the type's name.
| Returns a dict ordered by namespace name containing a mapping of
model.Namespace to every _TypeDependency for |self._default_namespace|,
sorted by the type's name. | [
"Returns",
"a",
"dict",
"ordered",
"by",
"namespace",
"name",
"containing",
"a",
"mapping",
"of",
"model",
".",
"Namespace",
"to",
"every",
"_TypeDependency",
"for",
"|self",
".",
"_default_namespace|",
"sorted",
"by",
"the",
"type",
"'",
"s",
"name",
"."
] | def _NamespaceTypeDependencies(self):
dependencies = set()
for function in self._default_namespace.functions.values():
for param in function.params:
dependencies |= self._TypeDependencies(param.type_,
hard=not param.optional)
if function.returns... | [
"def",
"_NamespaceTypeDependencies",
"(",
"self",
")",
":",
"dependencies",
"=",
"set",
"(",
")",
"for",
"function",
"in",
"self",
".",
"_default_namespace",
".",
"functions",
".",
"values",
"(",
")",
":",
"for",
"param",
"in",
"function",
".",
"params",
"... | Returns a dict ordered by namespace name containing a mapping of
model.Namespace to every _TypeDependency for |self._default_namespace|,
sorted by the type's name. | [
"Returns",
"a",
"dict",
"ordered",
"by",
"namespace",
"name",
"containing",
"a",
"mapping",
"of",
"model",
".",
"Namespace",
"to",
"every",
"_TypeDependency",
"for",
"|self",
".",
"_default_namespace|",
"sorted",
"by",
"the",
"type",
"'",
"s",
"name",
"."
] | [
"\"\"\"Returns a dict ordered by namespace name containing a mapping of\n model.Namespace to every _TypeDependency for |self._default_namespace|,\n sorted by the type's name.\n \"\"\"",
"# Make sure that the dependencies are returned in alphabetical order."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4cae3c1130109a9756882e5d89db4ea38bd933a0 | sunlongbo/chromium | tools/json_schema_compiler/cpp_type_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _TypeDependencies | <not_specific> | def _TypeDependencies(self, type_, hard=False):
"""Gets all the type dependencies of a property.
"""
deps = set()
if type_.property_type == PropertyType.REF:
underlying_type = self._FindType(type_.ref_type)
# Enums from other namespaces are always hard dependencies, since
# optional en... | Gets all the type dependencies of a property.
| Gets all the type dependencies of a property. | [
"Gets",
"all",
"the",
"type",
"dependencies",
"of",
"a",
"property",
"."
] | def _TypeDependencies(self, type_, hard=False):
deps = set()
if type_.property_type == PropertyType.REF:
underlying_type = self._FindType(type_.ref_type)
dep_is_hard = (True if underlying_type.property_type == PropertyType.ENUM
else hard)
deps.add(_TypeDependency(underlyin... | [
"def",
"_TypeDependencies",
"(",
"self",
",",
"type_",
",",
"hard",
"=",
"False",
")",
":",
"deps",
"=",
"set",
"(",
")",
"if",
"type_",
".",
"property_type",
"==",
"PropertyType",
".",
"REF",
":",
"underlying_type",
"=",
"self",
".",
"_FindType",
"(",
... | Gets all the type dependencies of a property. | [
"Gets",
"all",
"the",
"type",
"dependencies",
"of",
"a",
"property",
"."
] | [
"\"\"\"Gets all the type dependencies of a property.\n \"\"\"",
"# Enums from other namespaces are always hard dependencies, since",
"# optional enums are represented via the _NONE value instead of a",
"# pointer.",
"# Types in containers are hard dependencies because they are stored",
"# directly and ... | [
{
"param": "self",
"type": null
},
{
"param": "type_",
"type": null
},
{
"param": "hard",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type_",
"type": null,
"docstring": null,
"docstring_tokens": ... |
4cae3c1130109a9756882e5d89db4ea38bd933a0 | sunlongbo/chromium | tools/json_schema_compiler/cpp_type_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GeneratePropertyValues | <not_specific> | def GeneratePropertyValues(self, prop, line, nodoc=False):
"""Generates the Code to display all value-containing properties.
"""
c = Code()
if not nodoc:
c.Comment(prop.description)
if prop.value is not None:
cpp_type = self.GetCppType(prop.type_)
cpp_value = prop.value
cpp_... | Generates the Code to display all value-containing properties.
| Generates the Code to display all value-containing properties. | [
"Generates",
"the",
"Code",
"to",
"display",
"all",
"value",
"-",
"containing",
"properties",
"."
] | def GeneratePropertyValues(self, prop, line, nodoc=False):
c = Code()
if not nodoc:
c.Comment(prop.description)
if prop.value is not None:
cpp_type = self.GetCppType(prop.type_)
cpp_value = prop.value
cpp_name = prop.name
if cpp_type == 'std::string':
cpp_value = '"%s"'... | [
"def",
"GeneratePropertyValues",
"(",
"self",
",",
"prop",
",",
"line",
",",
"nodoc",
"=",
"False",
")",
":",
"c",
"=",
"Code",
"(",
")",
"if",
"not",
"nodoc",
":",
"c",
".",
"Comment",
"(",
"prop",
".",
"description",
")",
"if",
"prop",
".",
"valu... | Generates the Code to display all value-containing properties. | [
"Generates",
"the",
"Code",
"to",
"display",
"all",
"value",
"-",
"containing",
"properties",
"."
] | [
"\"\"\"Generates the Code to display all value-containing properties.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "prop",
"type": null
},
{
"param": "line",
"type": null
},
{
"param": "nodoc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "prop",
"type": null,
"docstring": null,
"docstring_tokens": [... |
91806523243ce818e22c6ae67347ce086f0ffbc0 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/ir_map.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | does_support_multiple_defs | <not_specific> | def does_support_multiple_defs(self):
"""
Returns True if multiple IRs may have a same identifier.
For most kinds, an identifier points to a single IR. However, it's
reasonable and convenient to allow multiple IRs to have the same
identifier for some kinds, ... |
Returns True if multiple IRs may have a same identifier.
For most kinds, an identifier points to a single IR. However, it's
reasonable and convenient to allow multiple IRs to have the same
identifier for some kinds, e.g. partial interface and includes.
This... | Returns True if multiple IRs may have a same identifier.
For most kinds, an identifier points to a single IR. However, it's
reasonable and convenient to allow multiple IRs to have the same
identifier for some kinds, e.g. partial interface and includes.
This function returns True for such kinds. | [
"Returns",
"True",
"if",
"multiple",
"IRs",
"may",
"have",
"a",
"same",
"identifier",
".",
"For",
"most",
"kinds",
"an",
"identifier",
"points",
"to",
"a",
"single",
"IR",
".",
"However",
"it",
"'",
"s",
"reasonable",
"and",
"convenient",
"to",
"allow",
... | def does_support_multiple_defs(self):
return IRMap.IR.Kind.does_support_multiple_defs(self.kind) | [
"def",
"does_support_multiple_defs",
"(",
"self",
")",
":",
"return",
"IRMap",
".",
"IR",
".",
"Kind",
".",
"does_support_multiple_defs",
"(",
"self",
".",
"kind",
")"
] | Returns True if multiple IRs may have a same identifier. | [
"Returns",
"True",
"if",
"multiple",
"IRs",
"may",
"have",
"a",
"same",
"identifier",
"."
] | [
"\"\"\"\n Returns True if multiple IRs may have a same identifier.\n\n For most kinds, an identifier points to a single IR. However, it's\n reasonable and convenient to allow multiple IRs to have the same\n identifier for some kinds, e.g. partial interface and includes.\... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
91806523243ce818e22c6ae67347ce086f0ffbc0 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/ir_map.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | register | null | def register(self, ir):
"""
Registers the given IR to this map.
Duplicated registration is not allowed. The registration must be for
the first time.
"""
assert isinstance(ir, IRMap.IR), ir
# Assert |ir| doesn't yet exist in this map.
try:
if ... |
Registers the given IR to this map.
Duplicated registration is not allowed. The registration must be for
the first time.
| Registers the given IR to this map.
Duplicated registration is not allowed. The registration must be for
the first time. | [
"Registers",
"the",
"given",
"IR",
"to",
"this",
"map",
".",
"Duplicated",
"registration",
"is",
"not",
"allowed",
".",
"The",
"registration",
"must",
"be",
"for",
"the",
"first",
"time",
"."
] | def register(self, ir):
assert isinstance(ir, IRMap.IR), ir
try:
if ir.does_support_multiple_defs:
irs = self.find_by_kind(ir.kind)
assert ir not in irs[ir.identifier]
else:
duplicated_ir = self.find_by_identifier(ir.identifier)
... | [
"def",
"register",
"(",
"self",
",",
"ir",
")",
":",
"assert",
"isinstance",
"(",
"ir",
",",
"IRMap",
".",
"IR",
")",
",",
"ir",
"try",
":",
"if",
"ir",
".",
"does_support_multiple_defs",
":",
"irs",
"=",
"self",
".",
"find_by_kind",
"(",
"ir",
".",
... | Registers the given IR to this map. | [
"Registers",
"the",
"given",
"IR",
"to",
"this",
"map",
"."
] | [
"\"\"\"\n Registers the given IR to this map.\n\n Duplicated registration is not allowed. The registration must be for\n the first time.\n \"\"\"",
"# Assert |ir| doesn't yet exist in this map.",
"# We don't allow to declare a definition of an IDL definition in",
"# multiple place... | [
{
"param": "self",
"type": null
},
{
"param": "ir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ir",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
91806523243ce818e22c6ae67347ce086f0ffbc0 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/ir_map.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | find_by_identifier | <not_specific> | def find_by_identifier(self, identifier):
"""
Returns the latest IR whose identifier is |identifier| and
|does_support_multiple_defs| is False. Raises KeyError if not found.
"""
assert isinstance(identifier, Identifier)
for irs_per_phase in self._single_value_irs[self._c... |
Returns the latest IR whose identifier is |identifier| and
|does_support_multiple_defs| is False. Raises KeyError if not found.
| Returns the latest IR whose identifier is |identifier| and
|does_support_multiple_defs| is False. Raises KeyError if not found. | [
"Returns",
"the",
"latest",
"IR",
"whose",
"identifier",
"is",
"|identifier|",
"and",
"|does_support_multiple_defs|",
"is",
"False",
".",
"Raises",
"KeyError",
"if",
"not",
"found",
"."
] | def find_by_identifier(self, identifier):
assert isinstance(identifier, Identifier)
for irs_per_phase in self._single_value_irs[self._current_phase::-1]:
for irs_per_kind in irs_per_phase.values():
if identifier in irs_per_kind:
return irs_per_kind[identif... | [
"def",
"find_by_identifier",
"(",
"self",
",",
"identifier",
")",
":",
"assert",
"isinstance",
"(",
"identifier",
",",
"Identifier",
")",
"for",
"irs_per_phase",
"in",
"self",
".",
"_single_value_irs",
"[",
"self",
".",
"_current_phase",
":",
":",
"-",
"1",
... | Returns the latest IR whose identifier is |identifier| and
|does_support_multiple_defs| is False. | [
"Returns",
"the",
"latest",
"IR",
"whose",
"identifier",
"is",
"|identifier|",
"and",
"|does_support_multiple_defs|",
"is",
"False",
"."
] | [
"\"\"\"\n Returns the latest IR whose identifier is |identifier| and\n |does_support_multiple_defs| is False. Raises KeyError if not found.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "identifier",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "identifier",
"type": null,
"docstring": null,
"docstring_toke... |
91806523243ce818e22c6ae67347ce086f0ffbc0 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/ir_map.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | find_by_kind | <not_specific> | def find_by_kind(self, kind):
"""
Returns a map from identifiers to the latest IRs of |kind|. Returns an
empty map if not found.
"""
ir_map = (self._multiple_value_irs
if IRMap.IR.Kind.does_support_multiple_defs(kind) else
self._single_value_i... |
Returns a map from identifiers to the latest IRs of |kind|. Returns an
empty map if not found.
| Returns a map from identifiers to the latest IRs of |kind|. Returns an
empty map if not found. | [
"Returns",
"a",
"map",
"from",
"identifiers",
"to",
"the",
"latest",
"IRs",
"of",
"|kind|",
".",
"Returns",
"an",
"empty",
"map",
"if",
"not",
"found",
"."
] | def find_by_kind(self, kind):
ir_map = (self._multiple_value_irs
if IRMap.IR.Kind.does_support_multiple_defs(kind) else
self._single_value_irs)
for irs_per_phase in ir_map[self._current_phase::-1]:
if kind in irs_per_phase:
return irs_per_p... | [
"def",
"find_by_kind",
"(",
"self",
",",
"kind",
")",
":",
"ir_map",
"=",
"(",
"self",
".",
"_multiple_value_irs",
"if",
"IRMap",
".",
"IR",
".",
"Kind",
".",
"does_support_multiple_defs",
"(",
"kind",
")",
"else",
"self",
".",
"_single_value_irs",
")",
"f... | Returns a map from identifiers to the latest IRs of |kind|. | [
"Returns",
"a",
"map",
"from",
"identifiers",
"to",
"the",
"latest",
"IRs",
"of",
"|kind|",
"."
] | [
"\"\"\"\n Returns a map from identifiers to the latest IRs of |kind|. Returns an\n empty map if not found.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "kind",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "kind",
"type": null,
"docstring": null,
"docstring_tokens": [... |
91806523243ce818e22c6ae67347ce086f0ffbc0 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/ir_map.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | irs_of_kind | <not_specific> | def irs_of_kind(self, kind):
"""Returns a flattened list of IRs of the given kind."""
if IRMap.IR.Kind.does_support_multiple_defs(kind):
accumulated = []
for irs in self.find_by_kind(kind).values():
accumulated.extend(irs)
return accumulated
el... | Returns a flattened list of IRs of the given kind. | Returns a flattened list of IRs of the given kind. | [
"Returns",
"a",
"flattened",
"list",
"of",
"IRs",
"of",
"the",
"given",
"kind",
"."
] | def irs_of_kind(self, kind):
if IRMap.IR.Kind.does_support_multiple_defs(kind):
accumulated = []
for irs in self.find_by_kind(kind).values():
accumulated.extend(irs)
return accumulated
else:
return list(self.find_by_kind(kind).values()) | [
"def",
"irs_of_kind",
"(",
"self",
",",
"kind",
")",
":",
"if",
"IRMap",
".",
"IR",
".",
"Kind",
".",
"does_support_multiple_defs",
"(",
"kind",
")",
":",
"accumulated",
"=",
"[",
"]",
"for",
"irs",
"in",
"self",
".",
"find_by_kind",
"(",
"kind",
")",
... | Returns a flattened list of IRs of the given kind. | [
"Returns",
"a",
"flattened",
"list",
"of",
"IRs",
"of",
"the",
"given",
"kind",
"."
] | [
"\"\"\"Returns a flattened list of IRs of the given kind.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "kind",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "kind",
"type": null,
"docstring": null,
"docstring_tokens": [... |
91806523243ce818e22c6ae67347ce086f0ffbc0 | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/ir_map.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | irs_of_kinds | <not_specific> | def irs_of_kinds(self, *kinds):
"""
Returns a flattened and concatenated list of IRs of all given kinds.
"""
accumulated = []
for kind in kinds:
accumulated.extend(self.irs_of_kind(kind))
return accumulated |
Returns a flattened and concatenated list of IRs of all given kinds.
| Returns a flattened and concatenated list of IRs of all given kinds. | [
"Returns",
"a",
"flattened",
"and",
"concatenated",
"list",
"of",
"IRs",
"of",
"all",
"given",
"kinds",
"."
] | def irs_of_kinds(self, *kinds):
accumulated = []
for kind in kinds:
accumulated.extend(self.irs_of_kind(kind))
return accumulated | [
"def",
"irs_of_kinds",
"(",
"self",
",",
"*",
"kinds",
")",
":",
"accumulated",
"=",
"[",
"]",
"for",
"kind",
"in",
"kinds",
":",
"accumulated",
".",
"extend",
"(",
"self",
".",
"irs_of_kind",
"(",
"kind",
")",
")",
"return",
"accumulated"
] | Returns a flattened and concatenated list of IRs of all given kinds. | [
"Returns",
"a",
"flattened",
"and",
"concatenated",
"list",
"of",
"IRs",
"of",
"all",
"given",
"kinds",
"."
] | [
"\"\"\"\n Returns a flattened and concatenated list of IRs of all given kinds.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
91b55808b1c4a8552f25afdc9efc120729a3d3b2 | sunlongbo/chromium | third_party/blink/tools/blinkpy/common/html_diff.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | html_diff | <not_specific> | def html_diff(a_text, b_text):
"""Returns a diff between two strings as HTML."""
# Diffs can be between multiple text files of different encodings
# so we always want to deal with them as byte arrays, not unicode strings.
assert isinstance(a_text, str)
assert isinstance(b_text, str)
a_lines = a_... | Returns a diff between two strings as HTML. | Returns a diff between two strings as HTML. | [
"Returns",
"a",
"diff",
"between",
"two",
"strings",
"as",
"HTML",
"."
] | def html_diff(a_text, b_text):
assert isinstance(a_text, str)
assert isinstance(b_text, str)
a_lines = a_text.splitlines(True)
b_lines = b_text.splitlines(True)
return _TEMPLATE % HtmlDiffGenerator().generate_tbody(a_lines, b_lines) | [
"def",
"html_diff",
"(",
"a_text",
",",
"b_text",
")",
":",
"assert",
"isinstance",
"(",
"a_text",
",",
"str",
")",
"assert",
"isinstance",
"(",
"b_text",
",",
"str",
")",
"a_lines",
"=",
"a_text",
".",
"splitlines",
"(",
"True",
")",
"b_lines",
"=",
"... | Returns a diff between two strings as HTML. | [
"Returns",
"a",
"diff",
"between",
"two",
"strings",
"as",
"HTML",
"."
] | [
"\"\"\"Returns a diff between two strings as HTML.\"\"\"",
"# Diffs can be between multiple text files of different encodings",
"# so we always want to deal with them as byte arrays, not unicode strings."
] | [
{
"param": "a_text",
"type": null
},
{
"param": "b_text",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "a_text",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "b_text",
"type": null,
"docstring": null,
"docstring_tokens... |
7278f76b007da5597b74605d7ca58d853ae5ead6 | sunlongbo/chromium | components/policy/tools/template_writers/writers/reg_writer_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CompareOutputs | null | def CompareOutputs(self, output, expected_output):
'''Compares the output of the reg_writer with its expected output.
Args:
output: The output of the reg writer.
expected_output: The expected output.
Raises:
AssertionError: if the two strings are not equivalent.
'''
self.assertEq... | Compares the output of the reg_writer with its expected output.
Args:
output: The output of the reg writer.
expected_output: The expected output.
Raises:
AssertionError: if the two strings are not equivalent.
| Compares the output of the reg_writer with its expected output. | [
"Compares",
"the",
"output",
"of",
"the",
"reg_writer",
"with",
"its",
"expected",
"output",
"."
] | def CompareOutputs(self, output, expected_output):
self.assertEquals(output.strip(), expected_output.strip()) | [
"def",
"CompareOutputs",
"(",
"self",
",",
"output",
",",
"expected_output",
")",
":",
"self",
".",
"assertEquals",
"(",
"output",
".",
"strip",
"(",
")",
",",
"expected_output",
".",
"strip",
"(",
")",
")"
] | Compares the output of the reg_writer with its expected output. | [
"Compares",
"the",
"output",
"of",
"the",
"reg_writer",
"with",
"its",
"expected",
"output",
"."
] | [
"'''Compares the output of the reg_writer with its expected output.\n\n Args:\n output: The output of the reg writer.\n expected_output: The expected output.\n\n Raises:\n AssertionError: if the two strings are not equivalent.\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "output",
"type": null
},
{
"param": "expected_output",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "if the two strings are not equivalent.",
"docstring_tokens": [
"if",
"the",
"two",
"strings",
"are",
"not",
"equivalent",
"."
],
"type": "AssertionError"
}
],
"params": [
... |
5fff9b2ec989da81e366b2411c8748a7bc753bf7 | sunlongbo/chromium | third_party/google-closure-library/closure/bin/build/depswriter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MakeDepsFile | <not_specific> | def MakeDepsFile(source_map):
"""Make a generated deps file.
Args:
source_map: A dict map of the source path to source.Source object.
Returns:
str, A generated deps file source.
"""
# Write in path alphabetical order
paths = sorted(source_map.keys())
lines = []
for path in paths:
js_sou... | Make a generated deps file.
Args:
source_map: A dict map of the source path to source.Source object.
Returns:
str, A generated deps file source.
| Make a generated deps file. | [
"Make",
"a",
"generated",
"deps",
"file",
"."
] | def MakeDepsFile(source_map):
paths = sorted(source_map.keys())
lines = []
for path in paths:
js_source = source_map[path]
if js_source.provides:
lines.append(_GetDepsLine(path, js_source))
return ''.join(lines) | [
"def",
"MakeDepsFile",
"(",
"source_map",
")",
":",
"paths",
"=",
"sorted",
"(",
"source_map",
".",
"keys",
"(",
")",
")",
"lines",
"=",
"[",
"]",
"for",
"path",
"in",
"paths",
":",
"js_source",
"=",
"source_map",
"[",
"path",
"]",
"if",
"js_source",
... | Make a generated deps file. | [
"Make",
"a",
"generated",
"deps",
"file",
"."
] | [
"\"\"\"Make a generated deps file.\n\n Args:\n source_map: A dict map of the source path to source.Source object.\n\n Returns:\n str, A generated deps file source.\n \"\"\"",
"# Write in path alphabetical order",
"# We don't need to add entries that don't provide anything."
] | [
{
"param": "source_map",
"type": null
}
] | {
"returns": [
{
"docstring": "str, A generated deps file source.",
"docstring_tokens": [
"str",
"A",
"generated",
"deps",
"file",
"source",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "sourc... |
5fff9b2ec989da81e366b2411c8748a7bc753bf7 | sunlongbo/chromium | third_party/google-closure-library/closure/bin/build/depswriter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetDepsLine | <not_specific> | def _GetDepsLine(path, js_source):
"""Get a deps.js file string for a source."""
provides = _ToJsSrc(sorted(js_source.provides))
requires = _ToJsSrc(sorted(js_source.requires))
module = "{'module': 'goog'}" if js_source.is_goog_module else '{}'
return 'goog.addDependency(\'%s\', %s, %s, %s);\n' % (
pa... | Get a deps.js file string for a source. | Get a deps.js file string for a source. | [
"Get",
"a",
"deps",
".",
"js",
"file",
"string",
"for",
"a",
"source",
"."
] | def _GetDepsLine(path, js_source):
provides = _ToJsSrc(sorted(js_source.provides))
requires = _ToJsSrc(sorted(js_source.requires))
module = "{'module': 'goog'}" if js_source.is_goog_module else '{}'
return 'goog.addDependency(\'%s\', %s, %s, %s);\n' % (
path, provides, requires, module) | [
"def",
"_GetDepsLine",
"(",
"path",
",",
"js_source",
")",
":",
"provides",
"=",
"_ToJsSrc",
"(",
"sorted",
"(",
"js_source",
".",
"provides",
")",
")",
"requires",
"=",
"_ToJsSrc",
"(",
"sorted",
"(",
"js_source",
".",
"requires",
")",
")",
"module",
"=... | Get a deps.js file string for a source. | [
"Get",
"a",
"deps",
".",
"js",
"file",
"string",
"for",
"a",
"source",
"."
] | [
"\"\"\"Get a deps.js file string for a source.\"\"\""
] | [
{
"param": "path",
"type": null
},
{
"param": "js_source",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "js_source",
"type": null,
"docstring": null,
"docstring_token... |
5fff9b2ec989da81e366b2411c8748a7bc753bf7 | sunlongbo/chromium | third_party/google-closure-library/closure/bin/build/depswriter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _NormalizePathSeparators | <not_specific> | def _NormalizePathSeparators(path):
"""Replaces OS-specific path separators with POSIX-style slashes.
Args:
path: str, A file path.
Returns:
str, The path with any OS-specific path separators (such as backslash on
Windows) replaced with URL-compatible forward slashes. A no-op on systems
that... | Replaces OS-specific path separators with POSIX-style slashes.
Args:
path: str, A file path.
Returns:
str, The path with any OS-specific path separators (such as backslash on
Windows) replaced with URL-compatible forward slashes. A no-op on systems
that use POSIX paths.
| Replaces OS-specific path separators with POSIX-style slashes. | [
"Replaces",
"OS",
"-",
"specific",
"path",
"separators",
"with",
"POSIX",
"-",
"style",
"slashes",
"."
] | def _NormalizePathSeparators(path):
return path.replace(os.sep, posixpath.sep) | [
"def",
"_NormalizePathSeparators",
"(",
"path",
")",
":",
"return",
"path",
".",
"replace",
"(",
"os",
".",
"sep",
",",
"posixpath",
".",
"sep",
")"
] | Replaces OS-specific path separators with POSIX-style slashes. | [
"Replaces",
"OS",
"-",
"specific",
"path",
"separators",
"with",
"POSIX",
"-",
"style",
"slashes",
"."
] | [
"\"\"\"Replaces OS-specific path separators with POSIX-style slashes.\n\n Args:\n path: str, A file path.\n\n Returns:\n str, The path with any OS-specific path separators (such as backslash on\n Windows) replaced with URL-compatible forward slashes. A no-op on systems\n that use POSIX paths.\n \... | [
{
"param": "path",
"type": null
}
] | {
"returns": [
{
"docstring": "str, The path with any OS-specific path separators (such as backslash on\nWindows) replaced with URL-compatible forward slashes. A no-op on systems\nthat use POSIX paths.",
"docstring_tokens": [
"str",
"The",
"path",
"with",
"any",... |
5fff9b2ec989da81e366b2411c8748a7bc753bf7 | sunlongbo/chromium | third_party/google-closure-library/closure/bin/build/depswriter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetRelativePathToSourceDict | <not_specific> | def _GetRelativePathToSourceDict(root, prefix=''):
"""Scans a top root directory for .js sources.
Args:
root: str, Root directory.
prefix: str, Prefix for returned paths.
Returns:
dict, A map of relative paths (with prefix, if given), to source.Source
objects.
"""
# Remember and restore th... | Scans a top root directory for .js sources.
Args:
root: str, Root directory.
prefix: str, Prefix for returned paths.
Returns:
dict, A map of relative paths (with prefix, if given), to source.Source
objects.
| Scans a top root directory for .js sources. | [
"Scans",
"a",
"top",
"root",
"directory",
"for",
".",
"js",
"sources",
"."
] | def _GetRelativePathToSourceDict(root, prefix=''):
start_wd = os.getcwd()
os.chdir(root)
path_to_source = {}
for path in treescan.ScanTreeForJsFiles('.'):
prefixed_path = _NormalizePathSeparators(os.path.join(prefix, path))
path_to_source[prefixed_path] = source.Source(source.GetFileContents(path))
os... | [
"def",
"_GetRelativePathToSourceDict",
"(",
"root",
",",
"prefix",
"=",
"''",
")",
":",
"start_wd",
"=",
"os",
".",
"getcwd",
"(",
")",
"os",
".",
"chdir",
"(",
"root",
")",
"path_to_source",
"=",
"{",
"}",
"for",
"path",
"in",
"treescan",
".",
"ScanTr... | Scans a top root directory for .js sources. | [
"Scans",
"a",
"top",
"root",
"directory",
"for",
".",
"js",
"sources",
"."
] | [
"\"\"\"Scans a top root directory for .js sources.\n\n Args:\n root: str, Root directory.\n prefix: str, Prefix for returned paths.\n\n Returns:\n dict, A map of relative paths (with prefix, if given), to source.Source\n objects.\n \"\"\"",
"# Remember and restore the cwd when we're done. We work... | [
{
"param": "root",
"type": null
},
{
"param": "prefix",
"type": null
}
] | {
"returns": [
{
"docstring": "dict, A map of relative paths (with prefix, if given), to source.Source\nobjects.",
"docstring_tokens": [
"dict",
"A",
"map",
"of",
"relative",
"paths",
"(",
"with",
"prefix",
"if",
"... |
5fff9b2ec989da81e366b2411c8748a7bc753bf7 | sunlongbo/chromium | third_party/google-closure-library/closure/bin/build/depswriter.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetPair | <not_specific> | def _GetPair(s):
"""Return a string as a shell-parsed tuple. Two values expected."""
try:
# shlex uses '\' as an escape character, so they must be escaped.
s = s.replace('\\', '\\\\')
first, second = shlex.split(s)
return (first, second)
except:
raise Exception('Unable to parse input line as ... | Return a string as a shell-parsed tuple. Two values expected. | Return a string as a shell-parsed tuple. Two values expected. | [
"Return",
"a",
"string",
"as",
"a",
"shell",
"-",
"parsed",
"tuple",
".",
"Two",
"values",
"expected",
"."
] | def _GetPair(s):
try:
s = s.replace('\\', '\\\\')
first, second = shlex.split(s)
return (first, second)
except:
raise Exception('Unable to parse input line as a pair: %s' % s) | [
"def",
"_GetPair",
"(",
"s",
")",
":",
"try",
":",
"s",
"=",
"s",
".",
"replace",
"(",
"'\\\\'",
",",
"'\\\\\\\\'",
")",
"first",
",",
"second",
"=",
"shlex",
".",
"split",
"(",
"s",
")",
"return",
"(",
"first",
",",
"second",
")",
"except",
":",... | Return a string as a shell-parsed tuple. | [
"Return",
"a",
"string",
"as",
"a",
"shell",
"-",
"parsed",
"tuple",
"."
] | [
"\"\"\"Return a string as a shell-parsed tuple. Two values expected.\"\"\"",
"# shlex uses '\\' as an escape character, so they must be escaped."
] | [
{
"param": "s",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "s",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9032c7307d04558592224005765e443adc447fd1 | sunlongbo/chromium | components/resources/ssl/ssl_error_assistant/gen_ssl_error_assistant_proto.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | MakeSubDirs | null | def MakeSubDirs(outfile):
""" Make the subdirectories needed to create file |outfile| """
dirname = os.path.dirname(outfile)
if not os.path.exists(dirname):
os.makedirs(dirname) | Make the subdirectories needed to create file |outfile| | Make the subdirectories needed to create file |outfile| | [
"Make",
"the",
"subdirectories",
"needed",
"to",
"create",
"file",
"|outfile|"
] | def MakeSubDirs(outfile):
dirname = os.path.dirname(outfile)
if not os.path.exists(dirname):
os.makedirs(dirname) | [
"def",
"MakeSubDirs",
"(",
"outfile",
")",
":",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"outfile",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dirname",
")",
":",
"os",
".",
"makedirs",
"(",
"dirname",
")"
] | Make the subdirectories needed to create file |outfile| | [
"Make",
"the",
"subdirectories",
"needed",
"to",
"create",
"file",
"|outfile|"
] | [
"\"\"\" Make the subdirectories needed to create file |outfile| \"\"\""
] | [
{
"param": "outfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "outfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
998169dcac5bcf5baedb875a7649fb0f04853c68 | sunlongbo/chromium | tools/style_variable_generator/proto_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ProtoColor | <not_specific> | def _ProtoColor(self, c):
'''Returns the proto color representation of |c|'''
assert (isinstance(c, Color))
def AlphaToInt(alpha):
return int(alpha * 255)
return '0x%X%02X%02X%02X' % (AlphaToInt(c.opacity.a), c.r, c.g, c.b) | Returns the proto color representation of |c| | Returns the proto color representation of |c| | [
"Returns",
"the",
"proto",
"color",
"representation",
"of",
"|c|"
] | def _ProtoColor(self, c):
assert (isinstance(c, Color))
def AlphaToInt(alpha):
return int(alpha * 255)
return '0x%X%02X%02X%02X' % (AlphaToInt(c.opacity.a), c.r, c.g, c.b) | [
"def",
"_ProtoColor",
"(",
"self",
",",
"c",
")",
":",
"assert",
"(",
"isinstance",
"(",
"c",
",",
"Color",
")",
")",
"def",
"AlphaToInt",
"(",
"alpha",
")",
":",
"return",
"int",
"(",
"alpha",
"*",
"255",
")",
"return",
"'0x%X%02X%02X%02X'",
"%",
"(... | Returns the proto color representation of |c| | [
"Returns",
"the",
"proto",
"color",
"representation",
"of",
"|c|"
] | [
"'''Returns the proto color representation of |c|'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
99a9e03c89f97e7ff69cd5f6a76ff720553d2cbf | sunlongbo/chromium | components/policy/tools/template_writers/policy_template_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _IterateLeadingSpaces | null | def _IterateLeadingSpaces(self, lines):
'''Yields the number of leading spaces on each line, skipping lines which
have no leading spaces.'''
for line in lines:
match = re.search('^[ ]+', line)
if match:
yield len(match.group(0)) | Yields the number of leading spaces on each line, skipping lines which
have no leading spaces. | Yields the number of leading spaces on each line, skipping lines which
have no leading spaces. | [
"Yields",
"the",
"number",
"of",
"leading",
"spaces",
"on",
"each",
"line",
"skipping",
"lines",
"which",
"have",
"no",
"leading",
"spaces",
"."
] | def _IterateLeadingSpaces(self, lines):
for line in lines:
match = re.search('^[ ]+', line)
if match:
yield len(match.group(0)) | [
"def",
"_IterateLeadingSpaces",
"(",
"self",
",",
"lines",
")",
":",
"for",
"line",
"in",
"lines",
":",
"match",
"=",
"re",
".",
"search",
"(",
"'^[ ]+'",
",",
"line",
")",
"if",
"match",
":",
"yield",
"len",
"(",
"match",
".",
"group",
"(",
"0",
"... | Yields the number of leading spaces on each line, skipping lines which
have no leading spaces. | [
"Yields",
"the",
"number",
"of",
"leading",
"spaces",
"on",
"each",
"line",
"skipping",
"lines",
"which",
"have",
"no",
"leading",
"spaces",
"."
] | [
"'''Yields the number of leading spaces on each line, skipping lines which\n have no leading spaces.'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "lines",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lines",
"type": null,
"docstring": null,
"docstring_tokens": ... |
99a9e03c89f97e7ff69cd5f6a76ff720553d2cbf | sunlongbo/chromium | components/policy/tools/template_writers/policy_template_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ProcessProductPlatformString | <not_specific> | def _ProcessProductPlatformString(self, product_platform_string):
'''Splits the |product_platform_string| string to product and a list of
platforms.'''
if '.' in product_platform_string:
product, platform = product_platform_string.split('.')
if platform == '*':
# e.g.: 'chrome.*:8-10'
... | Splits the |product_platform_string| string to product and a list of
platforms. | Splits the |product_platform_string| string to product and a list of
platforms. | [
"Splits",
"the",
"|product_platform_string|",
"string",
"to",
"product",
"and",
"a",
"list",
"of",
"platforms",
"."
] | def _ProcessProductPlatformString(self, product_platform_string):
if '.' in product_platform_string:
product, platform = product_platform_string.split('.')
if platform == '*':
platforms = ['linux', 'mac', 'win']
else:
platforms = [platform]
else:
product, platform = {
... | [
"def",
"_ProcessProductPlatformString",
"(",
"self",
",",
"product_platform_string",
")",
":",
"if",
"'.'",
"in",
"product_platform_string",
":",
"product",
",",
"platform",
"=",
"product_platform_string",
".",
"split",
"(",
"'.'",
")",
"if",
"platform",
"==",
"'*... | Splits the |product_platform_string| string to product and a list of
platforms. | [
"Splits",
"the",
"|product_platform_string|",
"string",
"to",
"product",
"and",
"a",
"list",
"of",
"platforms",
"."
] | [
"'''Splits the |product_platform_string| string to product and a list of\n platforms.'''",
"# e.g.: 'chrome.*:8-10'",
"# e.g.: 'chrome.win:-10'",
"# e.g.: 'chrome_frame:7-'"
] | [
{
"param": "self",
"type": null
},
{
"param": "product_platform_string",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "product_platform_string",
"type": null,
"docstring": null,
"d... |
99a9e03c89f97e7ff69cd5f6a76ff720553d2cbf | sunlongbo/chromium | components/policy/tools/template_writers/policy_template_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ProcessSupportedOn | <not_specific> | def _ProcessSupportedOn(self, supported_on):
'''Parses and converts the string items of the list of supported platforms
into dictionaries.
Args:
supported_on: The list of supported platforms. E.g.:
['chrome.win:8-10', 'chrome_frame:10-']
Returns:
supported_on: The list with its ite... | Parses and converts the string items of the list of supported platforms
into dictionaries.
Args:
supported_on: The list of supported platforms. E.g.:
['chrome.win:8-10', 'chrome_frame:10-']
Returns:
supported_on: The list with its items converted to dictionaries. E.g.:
[{
... | Parses and converts the string items of the list of supported platforms
into dictionaries. | [
"Parses",
"and",
"converts",
"the",
"string",
"items",
"of",
"the",
"list",
"of",
"supported",
"platforms",
"into",
"dictionaries",
"."
] | def _ProcessSupportedOn(self, supported_on):
result = []
for supported_on_item in supported_on:
product_platform_part, version_part = supported_on_item.split(':')
product, platforms = self._ProcessProductPlatformString(
product_platform_part)
since_version, until_version = version_pa... | [
"def",
"_ProcessSupportedOn",
"(",
"self",
",",
"supported_on",
")",
":",
"result",
"=",
"[",
"]",
"for",
"supported_on_item",
"in",
"supported_on",
":",
"product_platform_part",
",",
"version_part",
"=",
"supported_on_item",
".",
"split",
"(",
"':'",
")",
"prod... | Parses and converts the string items of the list of supported platforms
into dictionaries. | [
"Parses",
"and",
"converts",
"the",
"string",
"items",
"of",
"the",
"list",
"of",
"supported",
"platforms",
"into",
"dictionaries",
"."
] | [
"'''Parses and converts the string items of the list of supported platforms\n into dictionaries.\n\n Args:\n supported_on: The list of supported platforms. E.g.:\n ['chrome.win:8-10', 'chrome_frame:10-']\n\n Returns:\n supported_on: The list with its items converted to dictionaries. E.g.:\... | [
{
"param": "self",
"type": null
},
{
"param": "supported_on",
"type": null
}
] | {
"returns": [
{
"docstring": "The list with its items converted to dictionaries.",
"docstring_tokens": [
"The",
"list",
"with",
"its",
"items",
"converted",
"to",
"dictionaries",
"."
],
"type": "supported_on"
}
... |
99a9e03c89f97e7ff69cd5f6a76ff720553d2cbf | sunlongbo/chromium | components/policy/tools/template_writers/policy_template_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ProcessFutureOn | <not_specific> | def _ProcessFutureOn(self, future_on):
'''Parses and converts the |future_on| strings into a list of dictionaries
contain product and platform string pair.
Args:
future_on: A list of platform strings. E.g.:
['chrome.win', 'chromeos']
Returns:
future_on: A list of dictionaries. E.g.:
... | Parses and converts the |future_on| strings into a list of dictionaries
contain product and platform string pair.
Args:
future_on: A list of platform strings. E.g.:
['chrome.win', 'chromeos']
Returns:
future_on: A list of dictionaries. E.g.:
[{
'product': 'chrome',
'... | Parses and converts the |future_on| strings into a list of dictionaries
contain product and platform string pair.
A list of platform strings. | [
"Parses",
"and",
"converts",
"the",
"|future_on|",
"strings",
"into",
"a",
"list",
"of",
"dictionaries",
"contain",
"product",
"and",
"platform",
"string",
"pair",
".",
"A",
"list",
"of",
"platform",
"strings",
"."
] | def _ProcessFutureOn(self, future_on):
result = []
for future in future_on:
product, platforms = self._ProcessProductPlatformString(future)
for platform in platforms:
result.append({
'product': product,
'platform': platform,
})
return result | [
"def",
"_ProcessFutureOn",
"(",
"self",
",",
"future_on",
")",
":",
"result",
"=",
"[",
"]",
"for",
"future",
"in",
"future_on",
":",
"product",
",",
"platforms",
"=",
"self",
".",
"_ProcessProductPlatformString",
"(",
"future",
")",
"for",
"platform",
"in",... | Parses and converts the |future_on| strings into a list of dictionaries
contain product and platform string pair. | [
"Parses",
"and",
"converts",
"the",
"|future_on|",
"strings",
"into",
"a",
"list",
"of",
"dictionaries",
"contain",
"product",
"and",
"platform",
"string",
"pair",
"."
] | [
"'''Parses and converts the |future_on| strings into a list of dictionaries\n contain product and platform string pair.\n\n Args:\n future_on: A list of platform strings. E.g.:\n ['chrome.win', 'chromeos']\n Returns:\n future_on: A list of dictionaries. E.g.:\n [{\n 'product': 'c... | [
{
"param": "self",
"type": null
},
{
"param": "future_on",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "future_on",
"type": null,
"docstring": null,
"docstring_token... |
99a9e03c89f97e7ff69cd5f6a76ff720553d2cbf | sunlongbo/chromium | components/policy/tools/template_writers/policy_template_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ProcessPolicy | null | def _ProcessPolicy(self, policy):
'''Processes localized message strings in a policy or a group.
Also breaks up the content of 'supported_on' attribute into a list.
Args:
policy: The data structure of the policy or group, that will get message
strings here.
'''
if policy['type'] != '... | Processes localized message strings in a policy or a group.
Also breaks up the content of 'supported_on' attribute into a list.
Args:
policy: The data structure of the policy or group, that will get message
strings here.
| Processes localized message strings in a policy or a group.
Also breaks up the content of 'supported_on' attribute into a list. | [
"Processes",
"localized",
"message",
"strings",
"in",
"a",
"policy",
"or",
"a",
"group",
".",
"Also",
"breaks",
"up",
"the",
"content",
"of",
"'",
"supported_on",
"'",
"attribute",
"into",
"a",
"list",
"."
] | def _ProcessPolicy(self, policy):
if policy['type'] != 'atomic_group':
policy['desc'] = self._ImportMessage(policy['desc'])
policy['caption'] = self._ImportMessage(policy['caption'])
if 'label' in policy:
policy['label'] = self._ImportMessage(policy['label'])
if 'arc_support' in policy:
... | [
"def",
"_ProcessPolicy",
"(",
"self",
",",
"policy",
")",
":",
"if",
"policy",
"[",
"'type'",
"]",
"!=",
"'atomic_group'",
":",
"policy",
"[",
"'desc'",
"]",
"=",
"self",
".",
"_ImportMessage",
"(",
"policy",
"[",
"'desc'",
"]",
")",
"policy",
"[",
"'c... | Processes localized message strings in a policy or a group. | [
"Processes",
"localized",
"message",
"strings",
"in",
"a",
"policy",
"or",
"a",
"group",
"."
] | [
"'''Processes localized message strings in a policy or a group.\n Also breaks up the content of 'supported_on' attribute into a list.\n\n Args:\n policy: The data structure of the policy or group, that will get message\n strings here.\n '''",
"# Iterate through all the items of an enum-type ... | [
{
"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 data structure of the poli... |
99a9e03c89f97e7ff69cd5f6a76ff720553d2cbf | sunlongbo/chromium | components/policy/tools/template_writers/policy_template_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ProcessPolicyList | null | def _ProcessPolicyList(self, policy_list):
'''Adds localized message strings to each item in a list of policies and
groups. Also breaks up the content of 'supported_on' attributes into lists
of dictionaries.
Args:
policy_list: A list of policies and groups. Message strings will be added
f... | Adds localized message strings to each item in a list of policies and
groups. Also breaks up the content of 'supported_on' attributes into lists
of dictionaries.
Args:
policy_list: A list of policies and groups. Message strings will be added
for each item and to their child items, recursively... | Adds localized message strings to each item in a list of policies and
groups. Also breaks up the content of 'supported_on' attributes into lists
of dictionaries. | [
"Adds",
"localized",
"message",
"strings",
"to",
"each",
"item",
"in",
"a",
"list",
"of",
"policies",
"and",
"groups",
".",
"Also",
"breaks",
"up",
"the",
"content",
"of",
"'",
"supported_on",
"'",
"attributes",
"into",
"lists",
"of",
"dictionaries",
"."
] | def _ProcessPolicyList(self, policy_list):
for policy in policy_list:
self._ProcessPolicy(policy) | [
"def",
"_ProcessPolicyList",
"(",
"self",
",",
"policy_list",
")",
":",
"for",
"policy",
"in",
"policy_list",
":",
"self",
".",
"_ProcessPolicy",
"(",
"policy",
")"
] | Adds localized message strings to each item in a list of policies and
groups. | [
"Adds",
"localized",
"message",
"strings",
"to",
"each",
"item",
"in",
"a",
"list",
"of",
"policies",
"and",
"groups",
"."
] | [
"'''Adds localized message strings to each item in a list of policies and\n groups. Also breaks up the content of 'supported_on' attributes into lists\n of dictionaries.\n\n Args:\n policy_list: A list of policies and groups. Message strings will be added\n for each item and to their child item... | [
{
"param": "self",
"type": null
},
{
"param": "policy_list",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "policy_list",
"type": null,
"docstring": "A list of policies and gr... |
99a9e03c89f97e7ff69cd5f6a76ff720553d2cbf | sunlongbo/chromium | components/policy/tools/template_writers/policy_template_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetTemplateText | <not_specific> | def GetTemplateText(self, template_writer):
'''Generates the text of the template from the arguments given
to the constructor, using a given TemplateWriter.
Args:
template_writer: An object implementing TemplateWriter. Its methods
are called here for each item of self._policy_data.
Retur... | Generates the text of the template from the arguments given
to the constructor, using a given TemplateWriter.
Args:
template_writer: An object implementing TemplateWriter. Its methods
are called here for each item of self._policy_data.
Returns:
The text of the generated template.
| Generates the text of the template from the arguments given
to the constructor, using a given TemplateWriter. | [
"Generates",
"the",
"text",
"of",
"the",
"template",
"from",
"the",
"arguments",
"given",
"to",
"the",
"constructor",
"using",
"a",
"given",
"TemplateWriter",
"."
] | def GetTemplateText(self, template_writer):
policy_data_copy = copy.deepcopy(self._policy_data)
return template_writer.WriteTemplate(policy_data_copy) | [
"def",
"GetTemplateText",
"(",
"self",
",",
"template_writer",
")",
":",
"policy_data_copy",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
".",
"_policy_data",
")",
"return",
"template_writer",
".",
"WriteTemplate",
"(",
"policy_data_copy",
")"
] | Generates the text of the template from the arguments given
to the constructor, using a given TemplateWriter. | [
"Generates",
"the",
"text",
"of",
"the",
"template",
"from",
"the",
"arguments",
"given",
"to",
"the",
"constructor",
"using",
"a",
"given",
"TemplateWriter",
"."
] | [
"'''Generates the text of the template from the arguments given\n to the constructor, using a given TemplateWriter.\n\n Args:\n template_writer: An object implementing TemplateWriter. Its methods\n are called here for each item of self._policy_data.\n\n Returns:\n The text of the generated... | [
{
"param": "self",
"type": null
},
{
"param": "template_writer",
"type": null
}
] | {
"returns": [
{
"docstring": "The text of the generated template.",
"docstring_tokens": [
"The",
"text",
"of",
"the",
"generated",
"template",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "se... |
99a9e03c89f97e7ff69cd5f6a76ff720553d2cbf | sunlongbo/chromium | components/policy/tools/template_writers/policy_template_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddGroups | null | def _AddGroups(self, policy_list):
'''Adds a 'group' field, which is set to be the group's name, to the
policies that are part of a group.
Args:
policy_list: A list of policies and groups whose policies will have a
'group' field added.
'''
groups = [policy for policy in policy_list i... | Adds a 'group' field, which is set to be the group's name, to the
policies that are part of a group.
Args:
policy_list: A list of policies and groups whose policies will have a
'group' field added.
| Adds a 'group' field, which is set to be the group's name, to the
policies that are part of a group.
A list of policies and groups whose policies will have a
'group' field added. | [
"Adds",
"a",
"'",
"group",
"'",
"field",
"which",
"is",
"set",
"to",
"be",
"the",
"group",
"'",
"s",
"name",
"to",
"the",
"policies",
"that",
"are",
"part",
"of",
"a",
"group",
".",
"A",
"list",
"of",
"policies",
"and",
"groups",
"whose",
"policies",... | def _AddGroups(self, policy_list):
groups = [policy for policy in policy_list if policy['type'] == 'group']
policy_lookup = {
policy['name']: policy
for policy in policy_list
if not IsGroupOrAtomicGroup(policy)
}
for group in groups:
for policy_name in group['policies']:
... | [
"def",
"_AddGroups",
"(",
"self",
",",
"policy_list",
")",
":",
"groups",
"=",
"[",
"policy",
"for",
"policy",
"in",
"policy_list",
"if",
"policy",
"[",
"'type'",
"]",
"==",
"'group'",
"]",
"policy_lookup",
"=",
"{",
"policy",
"[",
"'name'",
"]",
":",
... | Adds a 'group' field, which is set to be the group's name, to the
policies that are part of a group. | [
"Adds",
"a",
"'",
"group",
"'",
"field",
"which",
"is",
"set",
"to",
"be",
"the",
"group",
"'",
"s",
"name",
"to",
"the",
"policies",
"that",
"are",
"part",
"of",
"a",
"group",
"."
] | [
"'''Adds a 'group' field, which is set to be the group's name, to the\n policies that are part of a group.\n\n Args:\n policy_list: A list of policies and groups whose policies will have a\n 'group' field added.\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "policy_list",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "policy_list",
"type": null,
"docstring": null,
"docstring_tok... |
99a9e03c89f97e7ff69cd5f6a76ff720553d2cbf | sunlongbo/chromium | components/policy/tools/template_writers/policy_template_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _AddAtomicGroups | null | def _AddAtomicGroups(self, policy_list, policy_atomic_groups):
'''Adds an 'atomic_group' field to the policies that are part of an atomic
group.
Args:
policy_list: A list of policies and groups.
policy_atomic_groups: A list of policy atomic groups
'''
policy_lookup = {
policy['n... | Adds an 'atomic_group' field to the policies that are part of an atomic
group.
Args:
policy_list: A list of policies and groups.
policy_atomic_groups: A list of policy atomic groups
| Adds an 'atomic_group' field to the policies that are part of an atomic
group. | [
"Adds",
"an",
"'",
"atomic_group",
"'",
"field",
"to",
"the",
"policies",
"that",
"are",
"part",
"of",
"an",
"atomic",
"group",
"."
] | def _AddAtomicGroups(self, policy_list, policy_atomic_groups):
policy_lookup = {
policy['name']: policy
for policy in policy_list
if not IsGroupOrAtomicGroup(policy)
}
for group in policy_atomic_groups:
for policy_name in group['policies']:
policy_lookup[policy_name]['a... | [
"def",
"_AddAtomicGroups",
"(",
"self",
",",
"policy_list",
",",
"policy_atomic_groups",
")",
":",
"policy_lookup",
"=",
"{",
"policy",
"[",
"'name'",
"]",
":",
"policy",
"for",
"policy",
"in",
"policy_list",
"if",
"not",
"IsGroupOrAtomicGroup",
"(",
"policy",
... | Adds an 'atomic_group' field to the policies that are part of an atomic
group. | [
"Adds",
"an",
"'",
"atomic_group",
"'",
"field",
"to",
"the",
"policies",
"that",
"are",
"part",
"of",
"an",
"atomic",
"group",
"."
] | [
"'''Adds an 'atomic_group' field to the policies that are part of an atomic\n group.\n\n Args:\n policy_list: A list of policies and groups.\n policy_atomic_groups: A list of policy atomic groups\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "policy_list",
"type": null
},
{
"param": "policy_atomic_groups",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "policy_list",
"type": null,
"docstring": "A list of policies and gr... |
99a9e03c89f97e7ff69cd5f6a76ff720553d2cbf | sunlongbo/chromium | components/policy/tools/template_writers/policy_template_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ExpandAtomicGroups | <not_specific> | def _ExpandAtomicGroups(self, policy_list, policy_atomic_groups):
'''Replaces policies names inside atomic group definitions for actual
policies definitions.
Args:
policy_list: A list of policies and groups.
Returns:
Modified policy_list
'''
policies = [
policy for policy i... | Replaces policies names inside atomic group definitions for actual
policies definitions.
Args:
policy_list: A list of policies and groups.
Returns:
Modified policy_list
| Replaces policies names inside atomic group definitions for actual
policies definitions. | [
"Replaces",
"policies",
"names",
"inside",
"atomic",
"group",
"definitions",
"for",
"actual",
"policies",
"definitions",
"."
] | def _ExpandAtomicGroups(self, policy_list, policy_atomic_groups):
policies = [
policy for policy in policy_list if not IsGroupOrAtomicGroup(policy)
]
for group in policy_atomic_groups:
group['type'] = 'atomic_group'
expanded = self._ExpandGroups(policies + policy_atomic_groups)
expande... | [
"def",
"_ExpandAtomicGroups",
"(",
"self",
",",
"policy_list",
",",
"policy_atomic_groups",
")",
":",
"policies",
"=",
"[",
"policy",
"for",
"policy",
"in",
"policy_list",
"if",
"not",
"IsGroupOrAtomicGroup",
"(",
"policy",
")",
"]",
"for",
"group",
"in",
"pol... | Replaces policies names inside atomic group definitions for actual
policies definitions. | [
"Replaces",
"policies",
"names",
"inside",
"atomic",
"group",
"definitions",
"for",
"actual",
"policies",
"definitions",
"."
] | [
"'''Replaces policies names inside atomic group definitions for actual\n policies definitions.\n\n Args:\n policy_list: A list of policies and groups.\n\n Returns:\n Modified policy_list\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "policy_list",
"type": null
},
{
"param": "policy_atomic_groups",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
99a9e03c89f97e7ff69cd5f6a76ff720553d2cbf | sunlongbo/chromium | components/policy/tools/template_writers/policy_template_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ExpandGroups | <not_specific> | def _ExpandGroups(self, policy_list):
'''Replaces policies names inside group definitions for actual policies
definitions. If policy does not belong to any group, leave it as is.
Args:
policy_list: A list of policies and groups.
Returns:
Modified policy_list
'''
groups = [policy fo... | Replaces policies names inside group definitions for actual policies
definitions. If policy does not belong to any group, leave it as is.
Args:
policy_list: A list of policies and groups.
Returns:
Modified policy_list
| Replaces policies names inside group definitions for actual policies
definitions. If policy does not belong to any group, leave it as is. | [
"Replaces",
"policies",
"names",
"inside",
"group",
"definitions",
"for",
"actual",
"policies",
"definitions",
".",
"If",
"policy",
"does",
"not",
"belong",
"to",
"any",
"group",
"leave",
"it",
"as",
"is",
"."
] | def _ExpandGroups(self, policy_list):
groups = [policy for policy in policy_list if IsGroupOrAtomicGroup(policy)]
policies = {
policy['name']: policy
for policy in policy_list
if not IsGroupOrAtomicGroup(policy)
}
policies_in_groups = set()
result_policies = []
for group ... | [
"def",
"_ExpandGroups",
"(",
"self",
",",
"policy_list",
")",
":",
"groups",
"=",
"[",
"policy",
"for",
"policy",
"in",
"policy_list",
"if",
"IsGroupOrAtomicGroup",
"(",
"policy",
")",
"]",
"policies",
"=",
"{",
"policy",
"[",
"'name'",
"]",
":",
"policy",... | Replaces policies names inside group definitions for actual policies
definitions. | [
"Replaces",
"policies",
"names",
"inside",
"group",
"definitions",
"for",
"actual",
"policies",
"definitions",
"."
] | [
"'''Replaces policies names inside group definitions for actual policies\n definitions. If policy does not belong to any group, leave it as is.\n\n Args:\n policy_list: A list of policies and groups.\n\n Returns:\n Modified policy_list\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "policy_list",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
c4b629304a02d49c7b1118cd707fcd590028fa45 | sunlongbo/chromium | tools/cr/cr/commands/prepare.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | UpdateContext | null | def UpdateContext(self):
"""Update the context if needed.
This is also used by commands that want the environment setup correctly, but
are not going to call Prepare directly (such as sync).""" | Update the context if needed.
This is also used by commands that want the environment setup correctly, but
are not going to call Prepare directly (such as sync). | Update the context if needed.
This is also used by commands that want the environment setup correctly, but
are not going to call Prepare directly (such as sync). | [
"Update",
"the",
"context",
"if",
"needed",
".",
"This",
"is",
"also",
"used",
"by",
"commands",
"that",
"want",
"the",
"environment",
"setup",
"correctly",
"but",
"are",
"not",
"going",
"to",
"call",
"Prepare",
"directly",
"(",
"such",
"as",
"sync",
")",
... | def UpdateContext(self): | [
"def",
"UpdateContext",
"(",
"self",
")",
":"
] | Update the context if needed. | [
"Update",
"the",
"context",
"if",
"needed",
"."
] | [
"\"\"\"Update the context if needed.\n\n This is also used by commands that want the environment setup correctly, but\n are not going to call Prepare directly (such as sync).\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c4d5de8239c68094ae65ba5a6b24fd81e8163043 | sunlongbo/chromium | third_party/sqlite/scripts/sqlite_cherry_picker.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _print_command | null | def _print_command(cmd):
"""Print the command to be executed to the console.
Use a different color so that it can be easily seen amongst the output
commands.
"""
if (isinstance(cmd, list)):
cmd = ' '.join(cmd)
print('{}{}{}'.format(bcolors.OKBLUE, cmd, bcolors.ENDC)) | Print the command to be executed to the console.
Use a different color so that it can be easily seen amongst the output
commands.
| Print the command to be executed to the console.
Use a different color so that it can be easily seen amongst the output
commands. | [
"Print",
"the",
"command",
"to",
"be",
"executed",
"to",
"the",
"console",
".",
"Use",
"a",
"different",
"color",
"so",
"that",
"it",
"can",
"be",
"easily",
"seen",
"amongst",
"the",
"output",
"commands",
"."
] | def _print_command(cmd):
if (isinstance(cmd, list)):
cmd = ' '.join(cmd)
print('{}{}{}'.format(bcolors.OKBLUE, cmd, bcolors.ENDC)) | [
"def",
"_print_command",
"(",
"cmd",
")",
":",
"if",
"(",
"isinstance",
"(",
"cmd",
",",
"list",
")",
")",
":",
"cmd",
"=",
"' '",
".",
"join",
"(",
"cmd",
")",
"print",
"(",
"'{}{}{}'",
".",
"format",
"(",
"bcolors",
".",
"OKBLUE",
",",
"cmd",
"... | Print the command to be executed to the console. | [
"Print",
"the",
"command",
"to",
"be",
"executed",
"to",
"the",
"console",
"."
] | [
"\"\"\"Print the command to be executed to the console.\n\n Use a different color so that it can be easily seen amongst the output\n commands.\n \"\"\""
] | [
{
"param": "cmd",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cmd",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c4d5de8239c68094ae65ba5a6b24fd81e8163043 | sunlongbo/chromium | third_party/sqlite/scripts/sqlite_cherry_picker.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | calc_hash | <not_specific> | def calc_hash(data, method):
"""Return the string sha1 or sha3 hash digest for the given data."""
if method == 'sha3':
h = hashlib.sha3_256()
elif method == 'sha1':
h = hashlib.sha1()
else:
assert False
h.update(data)
return h.hexdigest... | Return the string sha1 or sha3 hash digest for the given data. | Return the string sha1 or sha3 hash digest for the given data. | [
"Return",
"the",
"string",
"sha1",
"or",
"sha3",
"hash",
"digest",
"for",
"the",
"given",
"data",
"."
] | def calc_hash(data, method):
if method == 'sha3':
h = hashlib.sha3_256()
elif method == 'sha1':
h = hashlib.sha1()
else:
assert False
h.update(data)
return h.hexdigest() | [
"def",
"calc_hash",
"(",
"data",
",",
"method",
")",
":",
"if",
"method",
"==",
"'sha3'",
":",
"h",
"=",
"hashlib",
".",
"sha3_256",
"(",
")",
"elif",
"method",
"==",
"'sha1'",
":",
"h",
"=",
"hashlib",
".",
"sha1",
"(",
")",
"else",
":",
"assert",... | Return the string sha1 or sha3 hash digest for the given data. | [
"Return",
"the",
"string",
"sha1",
"or",
"sha3",
"hash",
"digest",
"for",
"the",
"given",
"data",
"."
] | [
"\"\"\"Return the string sha1 or sha3 hash digest for the given data.\"\"\""
] | [
{
"param": "data",
"type": null
},
{
"param": "method",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "method",
"type": null,
"docstring": null,
"docstring_tokens":... |
c4d5de8239c68094ae65ba5a6b24fd81e8163043 | sunlongbo/chromium | third_party/sqlite/scripts/sqlite_cherry_picker.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | find_file_entry | <not_specific> | def find_file_entry(self, fname):
"""Given a file path return the entry. Returns None if none found."""
for entry in self.entries:
if entry.entry_type == 'F' and entry.items[0] == fname:
return entry
return None | Given a file path return the entry. Returns None if none found. | Given a file path return the entry. Returns None if none found. | [
"Given",
"a",
"file",
"path",
"return",
"the",
"entry",
".",
"Returns",
"None",
"if",
"none",
"found",
"."
] | def find_file_entry(self, fname):
for entry in self.entries:
if entry.entry_type == 'F' and entry.items[0] == fname:
return entry
return None | [
"def",
"find_file_entry",
"(",
"self",
",",
"fname",
")",
":",
"for",
"entry",
"in",
"self",
".",
"entries",
":",
"if",
"entry",
".",
"entry_type",
"==",
"'F'",
"and",
"entry",
".",
"items",
"[",
"0",
"]",
"==",
"fname",
":",
"return",
"entry",
"retu... | Given a file path return the entry. | [
"Given",
"a",
"file",
"path",
"return",
"the",
"entry",
"."
] | [
"\"\"\"Given a file path return the entry. Returns None if none found.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "fname",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fname",
"type": null,
"docstring": null,
"docstring_tokens": ... |
c4d5de8239c68094ae65ba5a6b24fd81e8163043 | sunlongbo/chromium | third_party/sqlite/scripts/sqlite_cherry_picker.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | read_stream | <not_specific> | def read_stream(input_stream):
"""Deserialize a manifest from an input stream and return a Manifest
object."""
_manifest = Manifest()
for line in input_stream.readlines():
items = line.split()
if not items:
continue
_manifest.entries.ap... | Deserialize a manifest from an input stream and return a Manifest
object. | Deserialize a manifest from an input stream and return a Manifest
object. | [
"Deserialize",
"a",
"manifest",
"from",
"an",
"input",
"stream",
"and",
"return",
"a",
"Manifest",
"object",
"."
] | def read_stream(input_stream):
_manifest = Manifest()
for line in input_stream.readlines():
items = line.split()
if not items:
continue
_manifest.entries.append(ManifestEntry(items[0], items[1:]))
return _manifest | [
"def",
"read_stream",
"(",
"input_stream",
")",
":",
"_manifest",
"=",
"Manifest",
"(",
")",
"for",
"line",
"in",
"input_stream",
".",
"readlines",
"(",
")",
":",
"items",
"=",
"line",
".",
"split",
"(",
")",
"if",
"not",
"items",
":",
"continue",
"_ma... | Deserialize a manifest from an input stream and return a Manifest
object. | [
"Deserialize",
"a",
"manifest",
"from",
"an",
"input",
"stream",
"and",
"return",
"a",
"Manifest",
"object",
"."
] | [
"\"\"\"Deserialize a manifest from an input stream and return a Manifest\n object.\"\"\""
] | [
{
"param": "input_stream",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_stream",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c4d5de8239c68094ae65ba5a6b24fd81e8163043 | sunlongbo/chromium | third_party/sqlite/scripts/sqlite_cherry_picker.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _cherry_pick_git_commit | null | def _cherry_pick_git_commit(self, commit_id):
"""Cherry-pick a given Git commit into the current branch."""
cmd = ['git', 'cherry-pick', '-x', commit_id]
if self._print_cmds:
_print_command(' '.join(cmd))
returncode = subprocess.call(cmd)
# The manifest and manifest.u... | Cherry-pick a given Git commit into the current branch. | Cherry-pick a given Git commit into the current branch. | [
"Cherry",
"-",
"pick",
"a",
"given",
"Git",
"commit",
"into",
"the",
"current",
"branch",
"."
] | def _cherry_pick_git_commit(self, commit_id):
cmd = ['git', 'cherry-pick', '-x', commit_id]
if self._print_cmds:
_print_command(' '.join(cmd))
returncode = subprocess.call(cmd)
comments = None
self._take_head_version('manifest')
self._take_head_version('manife... | [
"def",
"_cherry_pick_git_commit",
"(",
"self",
",",
"commit_id",
")",
":",
"cmd",
"=",
"[",
"'git'",
",",
"'cherry-pick'",
",",
"'-x'",
",",
"commit_id",
"]",
"if",
"self",
".",
"_print_cmds",
":",
"_print_command",
"(",
"' '",
".",
"join",
"(",
"cmd",
"... | Cherry-pick a given Git commit into the current branch. | [
"Cherry",
"-",
"pick",
"a",
"given",
"Git",
"commit",
"into",
"the",
"current",
"branch",
"."
] | [
"\"\"\"Cherry-pick a given Git commit into the current branch.\"\"\"",
"# The manifest and manifest.uuid contain Fossil hashes. Restore to",
"# HEAD version and update only when all conflicts have been resolved."
] | [
{
"param": "self",
"type": null
},
{
"param": "commit_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "commit_id",
"type": null,
"docstring": null,
"docstring_token... |
c4d5de8239c68094ae65ba5a6b24fd81e8163043 | sunlongbo/chromium | third_party/sqlite/scripts/sqlite_cherry_picker.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | cherry_pick | null | def cherry_pick(self, commit_id):
"""Cherry-pick a given commit into the current branch.
Can cherry-pick a given Git or a Fossil commit.
"""
if not CherryPicker._is_git_commit_id(commit_id):
commit_id = self._find_git_commit_id(commit_id)
self._cherry_pick_git_commit... | Cherry-pick a given commit into the current branch.
Can cherry-pick a given Git or a Fossil commit.
| Cherry-pick a given commit into the current branch.
Can cherry-pick a given Git or a Fossil commit. | [
"Cherry",
"-",
"pick",
"a",
"given",
"commit",
"into",
"the",
"current",
"branch",
".",
"Can",
"cherry",
"-",
"pick",
"a",
"given",
"Git",
"or",
"a",
"Fossil",
"commit",
"."
] | def cherry_pick(self, commit_id):
if not CherryPicker._is_git_commit_id(commit_id):
commit_id = self._find_git_commit_id(commit_id)
self._cherry_pick_git_commit(commit_id) | [
"def",
"cherry_pick",
"(",
"self",
",",
"commit_id",
")",
":",
"if",
"not",
"CherryPicker",
".",
"_is_git_commit_id",
"(",
"commit_id",
")",
":",
"commit_id",
"=",
"self",
".",
"_find_git_commit_id",
"(",
"commit_id",
")",
"self",
".",
"_cherry_pick_git_commit",... | Cherry-pick a given commit into the current branch. | [
"Cherry",
"-",
"pick",
"a",
"given",
"commit",
"into",
"the",
"current",
"branch",
"."
] | [
"\"\"\"Cherry-pick a given commit into the current branch.\n\n Can cherry-pick a given Git or a Fossil commit.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "commit_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "commit_id",
"type": null,
"docstring": null,
"docstring_token... |
c4d5de8239c68094ae65ba5a6b24fd81e8163043 | sunlongbo/chromium | third_party/sqlite/scripts/sqlite_cherry_picker.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _update_manifests | null | def _update_manifests(self):
"""Update the SQLite's Fossil manifest files.
This isn't strictly necessary as the manifest isn't used during
any build, and manifest.uuid is the Fossil commit ID (which
has no meaning in a Git repo). However, keeping these updated
helps make it more... | Update the SQLite's Fossil manifest files.
This isn't strictly necessary as the manifest isn't used during
any build, and manifest.uuid is the Fossil commit ID (which
has no meaning in a Git repo). However, keeping these updated
helps make it more obvious that a commit originated in
... | Update the SQLite's Fossil manifest files.
This isn't strictly necessary as the manifest isn't used during
any build, and manifest.uuid is the Fossil commit ID (which
has no meaning in a Git repo). However, keeping these updated
helps make it more obvious that a commit originated in
Git and not Fossil. | [
"Update",
"the",
"SQLite",
"'",
"s",
"Fossil",
"manifest",
"files",
".",
"This",
"isn",
"'",
"t",
"strictly",
"necessary",
"as",
"the",
"manifest",
"isn",
"'",
"t",
"used",
"during",
"any",
"build",
"and",
"manifest",
".",
"uuid",
"is",
"the",
"Fossil",
... | def _update_manifests(self):
manifest = ManifestSerializer.read_file('manifest')
files_not_in_manifest = ('manifest', 'manifest.uuid')
for fname in Git.get_staged_changes():
if fname in files_not_in_manifest:
continue
entry = manifest.find_file_entry(fname... | [
"def",
"_update_manifests",
"(",
"self",
")",
":",
"manifest",
"=",
"ManifestSerializer",
".",
"read_file",
"(",
"'manifest'",
")",
"files_not_in_manifest",
"=",
"(",
"'manifest'",
",",
"'manifest.uuid'",
")",
"for",
"fname",
"in",
"Git",
".",
"get_staged_changes"... | Update the SQLite's Fossil manifest files. | [
"Update",
"the",
"SQLite",
"'",
"s",
"Fossil",
"manifest",
"files",
"."
] | [
"\"\"\"Update the SQLite's Fossil manifest files.\n\n This isn't strictly necessary as the manifest isn't used during\n any build, and manifest.uuid is the Fossil commit ID (which\n has no meaning in a Git repo). However, keeping these updated\n helps make it more obvious that a commit o... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
91c98fde346c502320f394669c70abdc4ce5a2ac | sunlongbo/chromium | third_party/blink/web_tests/wpt_internal/bluetooth/generate.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetGeneratedTests | null | def GetGeneratedTests():
"""Yields a GeneratedTest for each call in templates in script-tests."""
bluetooth_tests_dir = os.path.dirname(os.path.realpath(__file__))
# Read Base Test Template.
base_template_file_handle = open(
os.path.join(bluetooth_tests_dir, TEMPLATES_DIR,
... | Yields a GeneratedTest for each call in templates in script-tests. | Yields a GeneratedTest for each call in templates in script-tests. | [
"Yields",
"a",
"GeneratedTest",
"for",
"each",
"call",
"in",
"templates",
"in",
"script",
"-",
"tests",
"."
] | def GetGeneratedTests():
bluetooth_tests_dir = os.path.dirname(os.path.realpath(__file__))
base_template_file_handle = open(
os.path.join(bluetooth_tests_dir, TEMPLATES_DIR,
'base_test.html.template'))
base_template_file_data = base_template_file_handle.read().decode('utf-8')
... | [
"def",
"GetGeneratedTests",
"(",
")",
":",
"bluetooth_tests_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"realpath",
"(",
"__file__",
")",
")",
"base_template_file_handle",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"... | Yields a GeneratedTest for each call in templates in script-tests. | [
"Yields",
"a",
"GeneratedTest",
"for",
"each",
"call",
"in",
"templates",
"in",
"script",
"-",
"tests",
"."
] | [
"\"\"\"Yields a GeneratedTest for each call in templates in script-tests.\"\"\"",
"# Read Base Test Template.",
"# Get Templates.",
"# Generate Test Files",
"# Read template",
"# Find function names in multiline pattern: CALLS( [ function_name,function_name2[UUID] ])",
"# CALLS(",
"# Any characters no... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
20031aacf4993d898d43ed0b56bce7676146e020 | sunlongbo/chromium | third_party/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CheckThirdPartyReadmesUpdated | <not_specific> | def _CheckThirdPartyReadmesUpdated(input_api, output_api):
"""
Checks to make sure that README.chromium files are properly updated
when dependencies in third_party are modified.
"""
readmes = []
files = []
errors = []
for f in input_api.AffectedFiles():
local_path = f.LocalPath()
if input_api.os... |
Checks to make sure that README.chromium files are properly updated
when dependencies in third_party are modified.
| Checks to make sure that README.chromium files are properly updated
when dependencies in third_party are modified. | [
"Checks",
"to",
"make",
"sure",
"that",
"README",
".",
"chromium",
"files",
"are",
"properly",
"updated",
"when",
"dependencies",
"in",
"third_party",
"are",
"modified",
"."
] | def _CheckThirdPartyReadmesUpdated(input_api, output_api):
readmes = []
files = []
errors = []
for f in input_api.AffectedFiles():
local_path = f.LocalPath()
if input_api.os_path.dirname(local_path) == 'third_party':
continue
if (local_path.startswith('third_party' + input_api.os_path.sep) and... | [
"def",
"_CheckThirdPartyReadmesUpdated",
"(",
"input_api",
",",
"output_api",
")",
":",
"readmes",
"=",
"[",
"]",
"files",
"=",
"[",
"]",
"errors",
"=",
"[",
"]",
"for",
"f",
"in",
"input_api",
".",
"AffectedFiles",
"(",
")",
":",
"local_path",
"=",
"f",... | Checks to make sure that README.chromium files are properly updated
when dependencies in third_party are modified. | [
"Checks",
"to",
"make",
"sure",
"that",
"README",
".",
"chromium",
"files",
"are",
"properly",
"updated",
"when",
"dependencies",
"in",
"third_party",
"are",
"modified",
"."
] | [
"\"\"\"\n Checks to make sure that README.chromium files are properly updated\n when dependencies in third_party are modified.\n \"\"\"",
"# TODO(danakj): We should look for the README.chromium file in",
"# third_party/rust/CRATE_NAME/vVERSION/."
] | [
{
"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... |
e4a4628eccf853d6f4d57f22917965167c523436 | sunlongbo/chromium | third_party/android_crazy_linker/src/tests/generate_test_gnu_hash_tables.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GnuHash | <not_specific> | def GnuHash(name):
"""Compute the GNU hash of a given input string."""
h = 5381
for c in name:
h = (h * 33 + ord(c)) & 0xffffffff
return h | Compute the GNU hash of a given input string. | Compute the GNU hash of a given input string. | [
"Compute",
"the",
"GNU",
"hash",
"of",
"a",
"given",
"input",
"string",
"."
] | def GnuHash(name):
h = 5381
for c in name:
h = (h * 33 + ord(c)) & 0xffffffff
return h | [
"def",
"GnuHash",
"(",
"name",
")",
":",
"h",
"=",
"5381",
"for",
"c",
"in",
"name",
":",
"h",
"=",
"(",
"h",
"*",
"33",
"+",
"ord",
"(",
"c",
")",
")",
"&",
"0xffffffff",
"return",
"h"
] | Compute the GNU hash of a given input string. | [
"Compute",
"the",
"GNU",
"hash",
"of",
"a",
"given",
"input",
"string",
"."
] | [
"\"\"\"Compute the GNU hash of a given input string.\"\"\""
] | [
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e4a4628eccf853d6f4d57f22917965167c523436 | sunlongbo/chromium | third_party/android_crazy_linker/src/tests/generate_test_gnu_hash_tables.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetBits | <not_specific> | def GetBits(self, gnu_hash):
"""Return (index, bit0, bit1) tuple corresponding to a given hash."""
bloom_index = (gnu_hash / self.bloom_bits_) % self.bloom_size_
bloom_bit0 = (gnu_hash % self.bloom_bits_)
bloom_bit1 = ((gnu_hash >> self.bloom_shift_) % self.bloom_bits_)
return bloom_index, bloom_bit... | Return (index, bit0, bit1) tuple corresponding to a given hash. | Return (index, bit0, bit1) tuple corresponding to a given hash. | [
"Return",
"(",
"index",
"bit0",
"bit1",
")",
"tuple",
"corresponding",
"to",
"a",
"given",
"hash",
"."
] | def GetBits(self, gnu_hash):
bloom_index = (gnu_hash / self.bloom_bits_) % self.bloom_size_
bloom_bit0 = (gnu_hash % self.bloom_bits_)
bloom_bit1 = ((gnu_hash >> self.bloom_shift_) % self.bloom_bits_)
return bloom_index, bloom_bit0, bloom_bit1 | [
"def",
"GetBits",
"(",
"self",
",",
"gnu_hash",
")",
":",
"bloom_index",
"=",
"(",
"gnu_hash",
"/",
"self",
".",
"bloom_bits_",
")",
"%",
"self",
".",
"bloom_size_",
"bloom_bit0",
"=",
"(",
"gnu_hash",
"%",
"self",
".",
"bloom_bits_",
")",
"bloom_bit1",
... | Return (index, bit0, bit1) tuple corresponding to a given hash. | [
"Return",
"(",
"index",
"bit0",
"bit1",
")",
"tuple",
"corresponding",
"to",
"a",
"given",
"hash",
"."
] | [
"\"\"\"Return (index, bit0, bit1) tuple corresponding to a given hash.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "gnu_hash",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gnu_hash",
"type": null,
"docstring": null,
"docstring_tokens... |
e4a4628eccf853d6f4d57f22917965167c523436 | sunlongbo/chromium | third_party/android_crazy_linker/src/tests/generate_test_gnu_hash_tables.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AsCSourceUint32Array | <not_specific> | def AsCSourceUint32Array(self):
"""Generate C source fragment for 32-bit uint array data."""
if self.bloom_bits_ == 64:
# Convert to array of 32-bit values first. Assume little-endianess.
values = []
for bloom in self.bloom_filter_:
values += [bloom & 0xffffffff, (bloom >> 32) % 0xffff... | Generate C source fragment for 32-bit uint array data. | Generate C source fragment for 32-bit uint array data. | [
"Generate",
"C",
"source",
"fragment",
"for",
"32",
"-",
"bit",
"uint",
"array",
"data",
"."
] | def AsCSourceUint32Array(self):
if self.bloom_bits_ == 64:
values = []
for bloom in self.bloom_filter_:
values += [bloom & 0xffffffff, (bloom >> 32) % 0xffffffff]
else:
values = self.bloom_filter_
return source_utils.CSourceForIntegerHexArray(values, 32) | [
"def",
"AsCSourceUint32Array",
"(",
"self",
")",
":",
"if",
"self",
".",
"bloom_bits_",
"==",
"64",
":",
"values",
"=",
"[",
"]",
"for",
"bloom",
"in",
"self",
".",
"bloom_filter_",
":",
"values",
"+=",
"[",
"bloom",
"&",
"0xffffffff",
",",
"(",
"bloom... | Generate C source fragment for 32-bit uint array data. | [
"Generate",
"C",
"source",
"fragment",
"for",
"32",
"-",
"bit",
"uint",
"array",
"data",
"."
] | [
"\"\"\"Generate C source fragment for 32-bit uint array data.\"\"\"",
"# Convert to array of 32-bit values first. Assume little-endianess."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e4a4628eccf853d6f4d57f22917965167c523436 | sunlongbo/chromium | third_party/android_crazy_linker/src/tests/generate_test_gnu_hash_tables.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateBloomFilter | <not_specific> | def _GenerateBloomFilter(self, bloom_bits):
"""Generate bloom filter array for a specific bitness."""
bloom = BloomFilter(self.bloom_size_, self.bloom_shift_, bloom_bits)
for gnu_hash in self.hashes_:
bloom.Add(gnu_hash)
return bloom | Generate bloom filter array for a specific bitness. | Generate bloom filter array for a specific bitness. | [
"Generate",
"bloom",
"filter",
"array",
"for",
"a",
"specific",
"bitness",
"."
] | def _GenerateBloomFilter(self, bloom_bits):
bloom = BloomFilter(self.bloom_size_, self.bloom_shift_, bloom_bits)
for gnu_hash in self.hashes_:
bloom.Add(gnu_hash)
return bloom | [
"def",
"_GenerateBloomFilter",
"(",
"self",
",",
"bloom_bits",
")",
":",
"bloom",
"=",
"BloomFilter",
"(",
"self",
".",
"bloom_size_",
",",
"self",
".",
"bloom_shift_",
",",
"bloom_bits",
")",
"for",
"gnu_hash",
"in",
"self",
".",
"hashes_",
":",
"bloom",
... | Generate bloom filter array for a specific bitness. | [
"Generate",
"bloom",
"filter",
"array",
"for",
"a",
"specific",
"bitness",
"."
] | [
"\"\"\"Generate bloom filter array for a specific bitness.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "bloom_bits",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bloom_bits",
"type": null,
"docstring": null,
"docstring_toke... |
e4ae1340e903c01b4c81db8596865e6f759efa1b | sunlongbo/chromium | android_webview/tools/run_simpleperf.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetWebViewLibraryNameAndPath | <not_specific> | def GetWebViewLibraryNameAndPath(self, package_name):
"""Get WebView library name and path on the device."""
apk_path = self._GetWebViewApkPath(package_name)
logging.debug('WebView APK path:' + apk_path)
# TODO(changwan): check if we need support for bundle.
tmp_apk_path = os.path.join(self.tmp_dir,... | Get WebView library name and path on the device. | Get WebView library name and path on the device. | [
"Get",
"WebView",
"library",
"name",
"and",
"path",
"on",
"the",
"device",
"."
] | def GetWebViewLibraryNameAndPath(self, package_name):
apk_path = self._GetWebViewApkPath(package_name)
logging.debug('WebView APK path:' + apk_path)
tmp_apk_path = os.path.join(self.tmp_dir, 'base.apk')
self.device.adb.Pull(apk_path, tmp_apk_path)
self.apk_helper = apk_helper.ToHelper(tmp_apk_path)
... | [
"def",
"GetWebViewLibraryNameAndPath",
"(",
"self",
",",
"package_name",
")",
":",
"apk_path",
"=",
"self",
".",
"_GetWebViewApkPath",
"(",
"package_name",
")",
"logging",
".",
"debug",
"(",
"'WebView APK path:'",
"+",
"apk_path",
")",
"tmp_apk_path",
"=",
"os",
... | Get WebView library name and path on the device. | [
"Get",
"WebView",
"library",
"name",
"and",
"path",
"on",
"the",
"device",
"."
] | [
"\"\"\"Get WebView library name and path on the device.\"\"\"",
"# TODO(changwan): check if we need support for bundle."
] | [
{
"param": "self",
"type": null
},
{
"param": "package_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "package_name",
"type": null,
"docstring": null,
"docstring_to... |
e4ae1340e903c01b4c81db8596865e6f759efa1b | sunlongbo/chromium | android_webview/tools/run_simpleperf.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Run | null | def Run(self):
"""Run the simpleperf and do the post processing."""
package_name = self.GetCurrentWebViewProvider()
SimplePerfRunner.RunPackageCompile(package_name)
perf_data_path = os.path.join(self.tmp_dir, 'perf.data')
SimplePerfRunner.RunSimplePerf(perf_data_path, self.args)
lines = SimplePe... | Run the simpleperf and do the post processing. | Run the simpleperf and do the post processing. | [
"Run",
"the",
"simpleperf",
"and",
"do",
"the",
"post",
"processing",
"."
] | def Run(self):
package_name = self.GetCurrentWebViewProvider()
SimplePerfRunner.RunPackageCompile(package_name)
perf_data_path = os.path.join(self.tmp_dir, 'perf.data')
SimplePerfRunner.RunSimplePerf(perf_data_path, self.args)
lines = SimplePerfRunner.GetOriginalReportHtml(
perf_data_path,
... | [
"def",
"Run",
"(",
"self",
")",
":",
"package_name",
"=",
"self",
".",
"GetCurrentWebViewProvider",
"(",
")",
"SimplePerfRunner",
".",
"RunPackageCompile",
"(",
"package_name",
")",
"perf_data_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"tm... | Run the simpleperf and do the post processing. | [
"Run",
"the",
"simpleperf",
"and",
"do",
"the",
"post",
"processing",
"."
] | [
"\"\"\"Run the simpleperf and do the post processing.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e4ae1340e903c01b4c81db8596865e6f759efa1b | sunlongbo/chromium | android_webview/tools/run_simpleperf.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunSimplePerf | null | def RunSimplePerf(perf_data_path, args):
"""Runs the simple perf commandline."""
cmd = ['third_party/android_ndk/simpleperf/app_profiler.py',
'--perf_data_path', perf_data_path,
'--skip_collect_binaries']
if args.system_wide:
cmd.append('--system_wide')
else:
cmd.extend... | Runs the simple perf commandline. | Runs the simple perf commandline. | [
"Runs",
"the",
"simple",
"perf",
"commandline",
"."
] | def RunSimplePerf(perf_data_path, args):
cmd = ['third_party/android_ndk/simpleperf/app_profiler.py',
'--perf_data_path', perf_data_path,
'--skip_collect_binaries']
if args.system_wide:
cmd.append('--system_wide')
else:
cmd.extend([
'--app', 'org.chromium.webview_... | [
"def",
"RunSimplePerf",
"(",
"perf_data_path",
",",
"args",
")",
":",
"cmd",
"=",
"[",
"'third_party/android_ndk/simpleperf/app_profiler.py'",
",",
"'--perf_data_path'",
",",
"perf_data_path",
",",
"'--skip_collect_binaries'",
"]",
"if",
"args",
".",
"system_wide",
":",... | Runs the simple perf commandline. | [
"Runs",
"the",
"simple",
"perf",
"commandline",
"."
] | [
"\"\"\"Runs the simple perf commandline.\"\"\""
] | [
{
"param": "perf_data_path",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "perf_data_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_... |
e4ae1340e903c01b4c81db8596865e6f759efa1b | sunlongbo/chromium | android_webview/tools/run_simpleperf.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunPackageCompile | null | def RunPackageCompile(package_name):
"""Compile the package (dex optimization)."""
cmd = [
'adb', 'shell', 'cmd', 'package', 'compile', '-m', 'speed', '-f',
package_name
]
subprocess.check_call(cmd) | Compile the package (dex optimization). | Compile the package (dex optimization). | [
"Compile",
"the",
"package",
"(",
"dex",
"optimization",
")",
"."
] | def RunPackageCompile(package_name):
cmd = [
'adb', 'shell', 'cmd', 'package', 'compile', '-m', 'speed', '-f',
package_name
]
subprocess.check_call(cmd) | [
"def",
"RunPackageCompile",
"(",
"package_name",
")",
":",
"cmd",
"=",
"[",
"'adb'",
",",
"'shell'",
",",
"'cmd'",
",",
"'package'",
",",
"'compile'",
",",
"'-m'",
",",
"'speed'",
",",
"'-f'",
",",
"package_name",
"]",
"subprocess",
".",
"check_call",
"(",... | Compile the package (dex optimization). | [
"Compile",
"the",
"package",
"(",
"dex",
"optimization",
")",
"."
] | [
"\"\"\"Compile the package (dex optimization).\"\"\""
] | [
{
"param": "package_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "package_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e4ae1340e903c01b4c81db8596865e6f759efa1b | sunlongbo/chromium | android_webview/tools/run_simpleperf.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetOriginalReportHtml | <not_specific> | def GetOriginalReportHtml(perf_data_path, report_html_path):
"""Gets the original report.html from running simpleperf."""
cmd = ['third_party/android_ndk/simpleperf/report_html.py',
'--record_file', perf_data_path,
'--report_path', report_html_path,
'--no_browser']
subproces... | Gets the original report.html from running simpleperf. | Gets the original report.html from running simpleperf. | [
"Gets",
"the",
"original",
"report",
".",
"html",
"from",
"running",
"simpleperf",
"."
] | def GetOriginalReportHtml(perf_data_path, report_html_path):
cmd = ['third_party/android_ndk/simpleperf/report_html.py',
'--record_file', perf_data_path,
'--report_path', report_html_path,
'--no_browser']
subprocess.check_call(cmd)
lines = []
with open(report_html_path, ... | [
"def",
"GetOriginalReportHtml",
"(",
"perf_data_path",
",",
"report_html_path",
")",
":",
"cmd",
"=",
"[",
"'third_party/android_ndk/simpleperf/report_html.py'",
",",
"'--record_file'",
",",
"perf_data_path",
",",
"'--report_path'",
",",
"report_html_path",
",",
"'--no_brow... | Gets the original report.html from running simpleperf. | [
"Gets",
"the",
"original",
"report",
".",
"html",
"from",
"running",
"simpleperf",
"."
] | [
"\"\"\"Gets the original report.html from running simpleperf.\"\"\""
] | [
{
"param": "perf_data_path",
"type": null
},
{
"param": "report_html_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "perf_data_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "report_html_path",
"type": null,
"docstring": null,
... |
e4ae1340e903c01b4c81db8596865e6f759efa1b | sunlongbo/chromium | android_webview/tools/run_simpleperf.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CollectAddresses | <not_specific> | def CollectAddresses(lines, lib_name):
"""Collect address-looking texts from lines.
Args:
lines: A list of strings that may contain addresses.
lib_name: The name of the WebView library.
Returns:
A set containing the addresses that were found in the lines.
"""
addresses = set()
... | Collect address-looking texts from lines.
Args:
lines: A list of strings that may contain addresses.
lib_name: The name of the WebView library.
Returns:
A set containing the addresses that were found in the lines.
| Collect address-looking texts from lines. | [
"Collect",
"address",
"-",
"looking",
"texts",
"from",
"lines",
"."
] | def CollectAddresses(lines, lib_name):
addresses = set()
for line in lines:
for address in re.findall(lib_name + r'\[\+([0-9a-f]+)\]', line):
addresses.add(address)
return addresses | [
"def",
"CollectAddresses",
"(",
"lines",
",",
"lib_name",
")",
":",
"addresses",
"=",
"set",
"(",
")",
"for",
"line",
"in",
"lines",
":",
"for",
"address",
"in",
"re",
".",
"findall",
"(",
"lib_name",
"+",
"r'\\[\\+([0-9a-f]+)\\]'",
",",
"line",
")",
":"... | Collect address-looking texts from lines. | [
"Collect",
"address",
"-",
"looking",
"texts",
"from",
"lines",
"."
] | [
"\"\"\"Collect address-looking texts from lines.\n\n Args:\n lines: A list of strings that may contain addresses.\n lib_name: The name of the WebView library.\n\n Returns:\n A set containing the addresses that were found in the lines.\n \"\"\""
] | [
{
"param": "lines",
"type": null
},
{
"param": "lib_name",
"type": null
}
] | {
"returns": [
{
"docstring": "A set containing the addresses that were found in the lines.",
"docstring_tokens": [
"A",
"set",
"containing",
"the",
"addresses",
"that",
"were",
"found",
"in",
"the",
"lines",
... |
e4ae1340e903c01b4c81db8596865e6f759efa1b | sunlongbo/chromium | android_webview/tools/run_simpleperf.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ReplaceAddressesWithFunctionInfos | <not_specific> | def ReplaceAddressesWithFunctionInfos(lines, address_function_pairs,
lib_name):
"""Replaces the addresses with function names.
Args:
lines: A list of strings that may contain addresses.
address_function_pairs: A list of pairs of (address, function_name).
... | Replaces the addresses with function names.
Args:
lines: A list of strings that may contain addresses.
address_function_pairs: A list of pairs of (address, function_name).
lib_name: The name of the WebView library.
Returns:
A list of strings with addresses replaced by function names.
... | Replaces the addresses with function names. | [
"Replaces",
"the",
"addresses",
"with",
"function",
"names",
"."
] | def ReplaceAddressesWithFunctionInfos(lines, address_function_pairs,
lib_name):
logging.info('Replacing the HTML content with new function names...')
address_function_dict = {
'+' + k: html.escape(v, quote=False)
for k, v in address_function_pairs
}
... | [
"def",
"ReplaceAddressesWithFunctionInfos",
"(",
"lines",
",",
"address_function_pairs",
",",
"lib_name",
")",
":",
"logging",
".",
"info",
"(",
"'Replacing the HTML content with new function names...'",
")",
"address_function_dict",
"=",
"{",
"'+'",
"+",
"k",
":",
"htm... | Replaces the addresses with function names. | [
"Replaces",
"the",
"addresses",
"with",
"function",
"names",
"."
] | [
"\"\"\"Replaces the addresses with function names.\n\n Args:\n lines: A list of strings that may contain addresses.\n address_function_pairs: A list of pairs of (address, function_name).\n lib_name: The name of the WebView library.\n\n Returns:\n A list of strings with addresses replaced b... | [
{
"param": "lines",
"type": null
},
{
"param": "address_function_pairs",
"type": null
},
{
"param": "lib_name",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of strings with addresses replaced by function names.",
"docstring_tokens": [
"A",
"list",
"of",
"strings",
"with",
"addresses",
"replaced",
"by",
"function",
"names",
"."
... |
e4bf80a34d635f024e1d276089041bdfba95a365 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/update_expectations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _can_delete_line | <not_specific> | def _can_delete_line(self, expectation):
"""Returns whether a given line in the expectations can be removed.
Uses results from builder bots to determine if a given line is stale and
can safely be removed from the TestExpectations file. (i.e. remove if
the bots show that it's not flaky.)... | Returns whether a given line in the expectations can be removed.
Uses results from builder bots to determine if a given line is stale and
can safely be removed from the TestExpectations file. (i.e. remove if
the bots show that it's not flaky.) There are also some rules about when
not to... | Returns whether a given line in the expectations can be removed.
Uses results from builder bots to determine if a given line is stale and
can safely be removed from the TestExpectations file. There are also some rules about when
not to remove lines | [
"Returns",
"whether",
"a",
"given",
"line",
"in",
"the",
"expectations",
"can",
"be",
"removed",
".",
"Uses",
"results",
"from",
"builder",
"bots",
"to",
"determine",
"if",
"a",
"given",
"line",
"is",
"stale",
"and",
"can",
"safely",
"be",
"removed",
"from... | def _can_delete_line(self, expectation):
expected_results = expectation.results
if not expected_results:
return False
if ResultType.Skip in expected_results or expectation.is_slow_test:
return False
if len(expected_results) == 1 and ResultType.Pass in expected_res... | [
"def",
"_can_delete_line",
"(",
"self",
",",
"expectation",
")",
":",
"expected_results",
"=",
"expectation",
".",
"results",
"if",
"not",
"expected_results",
":",
"return",
"False",
"if",
"ResultType",
".",
"Skip",
"in",
"expected_results",
"or",
"expectation",
... | Returns whether a given line in the expectations can be removed. | [
"Returns",
"whether",
"a",
"given",
"line",
"in",
"the",
"expectations",
"can",
"be",
"removed",
"."
] | [
"\"\"\"Returns whether a given line in the expectations can be removed.\n\n Uses results from builder bots to determine if a given line is stale and\n can safely be removed from the TestExpectations file. (i.e. remove if\n the bots show that it's not flaky.) There are also some rules about when... | [
{
"param": "self",
"type": null
},
{
"param": "expectation",
"type": null
}
] | {
"returns": [
{
"docstring": "True if the line can be removed, False otherwise.",
"docstring_tokens": [
"True",
"if",
"the",
"line",
"can",
"be",
"removed",
"False",
"otherwise",
"."
],
"type": null
}
],... |
e4bf80a34d635f024e1d276089041bdfba95a365 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/update_expectations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _get_builder_results_by_path | <not_specific> | def _get_builder_results_by_path(self):
"""Returns a dictionary of results for each builder.
Returns a dictionary where each key is a builder and value is a dictionary containing
the distinct results for each test. E.g.
{
'WebKit Linux Precise': {
'test1.h... | Returns a dictionary of results for each builder.
Returns a dictionary where each key is a builder and value is a dictionary containing
the distinct results for each test. E.g.
{
'WebKit Linux Precise': {
'test1.html': ['PASS', 'IMAGE'],
'test2.h... | Returns a dictionary of results for each builder.
Returns a dictionary where each key is a builder and value is a dictionary containing
the distinct results for each test.
| [
"Returns",
"a",
"dictionary",
"of",
"results",
"for",
"each",
"builder",
".",
"Returns",
"a",
"dictionary",
"where",
"each",
"key",
"is",
"a",
"builder",
"and",
"value",
"is",
"a",
"dictionary",
"containing",
"the",
"distinct",
"results",
"for",
"each",
"tes... | def _get_builder_results_by_path(self):
builder_results_by_path = {}
builders = []
if self._include_cq_results:
builders = self._host.builders.all_builder_names()
else:
builders = self._host.builders.all_continuous_builder_names()
for builder_name in build... | [
"def",
"_get_builder_results_by_path",
"(",
"self",
")",
":",
"builder_results_by_path",
"=",
"{",
"}",
"builders",
"=",
"[",
"]",
"if",
"self",
".",
"_include_cq_results",
":",
"builders",
"=",
"self",
".",
"_host",
".",
"builders",
".",
"all_builder_names",
... | Returns a dictionary of results for each builder. | [
"Returns",
"a",
"dictionary",
"of",
"results",
"for",
"each",
"builder",
"."
] | [
"\"\"\"Returns a dictionary of results for each builder.\n\n Returns a dictionary where each key is a builder and value is a dictionary containing\n the distinct results for each test. E.g.\n\n {\n 'WebKit Linux Precise': {\n 'test1.html': ['PASS', 'IMAGE'],\n ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e4bf80a34d635f024e1d276089041bdfba95a365 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/update_expectations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | show_removed_results | null | def show_removed_results(self):
"""Opens a browser showing the removed lines in the results dashboard.
Opens the results dashboard in the browser, showing all the tests for
lines removed from the TestExpectations file, allowing the user to
manually confirm the results.
"""
... | Opens a browser showing the removed lines in the results dashboard.
Opens the results dashboard in the browser, showing all the tests for
lines removed from the TestExpectations file, allowing the user to
manually confirm the results.
| Opens a browser showing the removed lines in the results dashboard.
Opens the results dashboard in the browser, showing all the tests for
lines removed from the TestExpectations file, allowing the user to
manually confirm the results. | [
"Opens",
"a",
"browser",
"showing",
"the",
"removed",
"lines",
"in",
"the",
"results",
"dashboard",
".",
"Opens",
"the",
"results",
"dashboard",
"in",
"the",
"browser",
"showing",
"all",
"the",
"tests",
"for",
"lines",
"removed",
"from",
"the",
"TestExpectatio... | def show_removed_results(self):
url = self._flakiness_dashboard_url()
_log.info('Opening results dashboard: ' + url)
self._browser.open(url) | [
"def",
"show_removed_results",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_flakiness_dashboard_url",
"(",
")",
"_log",
".",
"info",
"(",
"'Opening results dashboard: '",
"+",
"url",
")",
"self",
".",
"_browser",
".",
"open",
"(",
"url",
")"
] | Opens a browser showing the removed lines in the results dashboard. | [
"Opens",
"a",
"browser",
"showing",
"the",
"removed",
"lines",
"in",
"the",
"results",
"dashboard",
"."
] | [
"\"\"\"Opens a browser showing the removed lines in the results dashboard.\n\n Opens the results dashboard in the browser, showing all the tests for\n lines removed from the TestExpectations file, allowing the user to\n manually confirm the results.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e4bf80a34d635f024e1d276089041bdfba95a365 | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/update_expectations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | print_suggested_commit_description | null | def print_suggested_commit_description(self):
"""Prints the body of a suggested CL description after removing some lines."""
expectation_type = ''
if self._type != 'all':
expectation_type = self._type + ' '
dashboard_url = self._flakiness_dashboard_url()
bugs = ', '.... | Prints the body of a suggested CL description after removing some lines. | Prints the body of a suggested CL description after removing some lines. | [
"Prints",
"the",
"body",
"of",
"a",
"suggested",
"CL",
"description",
"after",
"removing",
"some",
"lines",
"."
] | def print_suggested_commit_description(self):
expectation_type = ''
if self._type != 'all':
expectation_type = self._type + ' '
dashboard_url = self._flakiness_dashboard_url()
bugs = ', '.join(sorted(self._bug_numbers))
message = (
'Remove %sTestExpectatio... | [
"def",
"print_suggested_commit_description",
"(",
"self",
")",
":",
"expectation_type",
"=",
"''",
"if",
"self",
".",
"_type",
"!=",
"'all'",
":",
"expectation_type",
"=",
"self",
".",
"_type",
"+",
"' '",
"dashboard_url",
"=",
"self",
".",
"_flakiness_dashboard... | Prints the body of a suggested CL description after removing some lines. | [
"Prints",
"the",
"body",
"of",
"a",
"suggested",
"CL",
"description",
"after",
"removing",
"some",
"lines",
"."
] | [
"\"\"\"Prints the body of a suggested CL description after removing some lines.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f77278bf956004fb5322392ec35ee12a9c0afe1e | sunlongbo/chromium | tools/flags/list_flags.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | keep_expired_by | <not_specific> | def keep_expired_by(flags, mstone):
"""Filter flags to contain only flags that expire by mstone.
Only flags that either never expire or have an expiration milestone <= mstone
are in the returned list.
>>> keep_expired_by([{'expiry_milestone': 3}], 2)
[]
>>> keep_expired_by([{'expiry_milestone': 3}], 3)
... | Filter flags to contain only flags that expire by mstone.
Only flags that either never expire or have an expiration milestone <= mstone
are in the returned list.
>>> keep_expired_by([{'expiry_milestone': 3}], 2)
[]
>>> keep_expired_by([{'expiry_milestone': 3}], 3)
[{'expiry_milestone': 3}]
>>> keep_expi... | Filter flags to contain only flags that expire by mstone.
Only flags that either never expire or have an expiration milestone <= mstone
are in the returned list.
| [
"Filter",
"flags",
"to",
"contain",
"only",
"flags",
"that",
"expire",
"by",
"mstone",
".",
"Only",
"flags",
"that",
"either",
"never",
"expire",
"or",
"have",
"an",
"expiration",
"milestone",
"<",
"=",
"mstone",
"are",
"in",
"the",
"returned",
"list",
"."... | def keep_expired_by(flags, mstone):
return [f for f in flags if -1 != f['expiry_milestone'] <= mstone] | [
"def",
"keep_expired_by",
"(",
"flags",
",",
"mstone",
")",
":",
"return",
"[",
"f",
"for",
"f",
"in",
"flags",
"if",
"-",
"1",
"!=",
"f",
"[",
"'expiry_milestone'",
"]",
"<=",
"mstone",
"]"
] | Filter flags to contain only flags that expire by mstone. | [
"Filter",
"flags",
"to",
"contain",
"only",
"flags",
"that",
"expire",
"by",
"mstone",
"."
] | [
"\"\"\"Filter flags to contain only flags that expire by mstone.\n\n Only flags that either never expire or have an expiration milestone <= mstone\n are in the returned list.\n\n >>> keep_expired_by([{'expiry_milestone': 3}], 2)\n []\n >>> keep_expired_by([{'expiry_milestone': 3}], 3)\n [{'expiry_milestone': ... | [
{
"param": "flags",
"type": null
},
{
"param": "mstone",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "flags",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mstone",
"type": null,
"docstring": null,
"docstring_tokens"... |
f77278bf956004fb5322392ec35ee12a9c0afe1e | sunlongbo/chromium | tools/flags/list_flags.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | keep_never_expires | <not_specific> | def keep_never_expires(flags):
"""Filter flags to contain only flags that never expire.
>>> keep_never_expires([{'expiry_milestone': -1}, {'expiry_milestone': 2}])
[{'expiry_milestone': -1}]
"""
return [f for f in flags if f['expiry_milestone'] == -1] | Filter flags to contain only flags that never expire.
>>> keep_never_expires([{'expiry_milestone': -1}, {'expiry_milestone': 2}])
[{'expiry_milestone': -1}]
| Filter flags to contain only flags that never expire. | [
"Filter",
"flags",
"to",
"contain",
"only",
"flags",
"that",
"never",
"expire",
"."
] | def keep_never_expires(flags):
return [f for f in flags if f['expiry_milestone'] == -1] | [
"def",
"keep_never_expires",
"(",
"flags",
")",
":",
"return",
"[",
"f",
"for",
"f",
"in",
"flags",
"if",
"f",
"[",
"'expiry_milestone'",
"]",
"==",
"-",
"1",
"]"
] | Filter flags to contain only flags that never expire. | [
"Filter",
"flags",
"to",
"contain",
"only",
"flags",
"that",
"never",
"expire",
"."
] | [
"\"\"\"Filter flags to contain only flags that never expire.\n\n >>> keep_never_expires([{'expiry_milestone': -1}, {'expiry_milestone': 2}])\n [{'expiry_milestone': -1}]\n \"\"\""
] | [
{
"param": "flags",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "flags",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f77278bf956004fb5322392ec35ee12a9c0afe1e | sunlongbo/chromium | tools/flags/list_flags.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | resolve_owners | <not_specific> | def resolve_owners(flags):
"""Resolves sets of owners for every flag in the provided list.
Given a list of flags, for each flag, resolves owners for that flag. Resolving
owners means, for each entry in a flag's owners list:
* Turning owners files references into the transitive set of owners listed in
those... | Resolves sets of owners for every flag in the provided list.
Given a list of flags, for each flag, resolves owners for that flag. Resolving
owners means, for each entry in a flag's owners list:
* Turning owners files references into the transitive set of owners listed in
those files
* Turning bare username... | Resolves sets of owners for every flag in the provided list.
Given a list of flags, for each flag, resolves owners for that flag. Resolving
owners means, for each entry in a flag's owners list:
Turning owners files references into the transitive set of owners listed in
those files
Turning bare usernames into @chromium.... | [
"Resolves",
"sets",
"of",
"owners",
"for",
"every",
"flag",
"in",
"the",
"provided",
"list",
".",
"Given",
"a",
"list",
"of",
"flags",
"for",
"each",
"flag",
"resolves",
"owners",
"for",
"that",
"flag",
".",
"Resolving",
"owners",
"means",
"for",
"each",
... | def resolve_owners(flags):
owners_db = owners.Database(ROOT_PATH, open, os.path)
new_flags = []
for f in flags:
new_flag = f.copy()
new_owners = []
for o in f['owners']:
if o.startswith('//') or '/' in o:
new_owners += owners_db.owners_rooted_at_file(re.sub('//', '', o))
elif '@' n... | [
"def",
"resolve_owners",
"(",
"flags",
")",
":",
"owners_db",
"=",
"owners",
".",
"Database",
"(",
"ROOT_PATH",
",",
"open",
",",
"os",
".",
"path",
")",
"new_flags",
"=",
"[",
"]",
"for",
"f",
"in",
"flags",
":",
"new_flag",
"=",
"f",
".",
"copy",
... | Resolves sets of owners for every flag in the provided list. | [
"Resolves",
"sets",
"of",
"owners",
"for",
"every",
"flag",
"in",
"the",
"provided",
"list",
"."
] | [
"\"\"\"Resolves sets of owners for every flag in the provided list.\n\n Given a list of flags, for each flag, resolves owners for that flag. Resolving\n owners means, for each entry in a flag's owners list:\n * Turning owners files references into the transitive set of owners listed in\n those files\n * Turn... | [
{
"param": "flags",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "flags",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f7992ae21681d28f0e2021f1c5f37ae10f8cbdce | sunlongbo/chromium | tools/android/native_lib_memory/java_code_pages_pss.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetPssInKb | <not_specific> | def _GetPssInKb(mappings, app_package, verbose):
"""Returns the total PSS from mappings.
Args:
mappings: ([parse_smaps.Mapping]) List of mappings.
app_package: (str) App package to look for.
verbose: (bool) Verbose output or not.
Returns:
(executable_pss (int), other_pss (int)) Executable mappin... | Returns the total PSS from mappings.
Args:
mappings: ([parse_smaps.Mapping]) List of mappings.
app_package: (str) App package to look for.
verbose: (bool) Verbose output or not.
Returns:
(executable_pss (int), other_pss (int)) Executable mappings and others,
... | Returns the total PSS from mappings. | [
"Returns",
"the",
"total",
"PSS",
"from",
"mappings",
"."
] | def _GetPssInKb(mappings, app_package, verbose):
executable_pss, other_pss = (0, 0)
for mapping in mappings:
if app_package in mapping.pathname:
if mapping.permissions == 'r-xp':
executable_pss += mapping.fields['Pss']
else:
other_pss += mapping.fields['Pss']
if verbose:
... | [
"def",
"_GetPssInKb",
"(",
"mappings",
",",
"app_package",
",",
"verbose",
")",
":",
"executable_pss",
",",
"other_pss",
"=",
"(",
"0",
",",
"0",
")",
"for",
"mapping",
"in",
"mappings",
":",
"if",
"app_package",
"in",
"mapping",
".",
"pathname",
":",
"i... | Returns the total PSS from mappings. | [
"Returns",
"the",
"total",
"PSS",
"from",
"mappings",
"."
] | [
"\"\"\"Returns the total PSS from mappings.\n\n Args:\n mappings: ([parse_smaps.Mapping]) List of mappings.\n app_package: (str) App package to look for.\n verbose: (bool) Verbose output or not.\n\n Returns:\n (executable_pss (int), other_pss (int)) Executable mappings and others,\n ... | [
{
"param": "mappings",
"type": null
},
{
"param": "app_package",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [
{
"docstring": "(executable_pss (int), other_pss (int)) Executable mappings and others,\nin kB.",
"docstring_tokens": [
"(",
"executable_pss",
"(",
"int",
")",
"other_pss",
"(",
"int",
"))",
"Executable",
... |
7d07f46a7e8d0ee2047a10071a2e2d83feeecd8e | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/interface.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | inclusive_inherited_interfaces | <not_specific> | def inclusive_inherited_interfaces(self):
"""
Returns the list of inclusive inherited interfaces.
https://webidl.spec.whatwg.org/#interface-inclusive-inherited-interfaces
"""
result = []
interface = self
while interface is not None:
result.append(inte... |
Returns the list of inclusive inherited interfaces.
https://webidl.spec.whatwg.org/#interface-inclusive-inherited-interfaces
| Returns the list of inclusive inherited interfaces. | [
"Returns",
"the",
"list",
"of",
"inclusive",
"inherited",
"interfaces",
"."
] | def inclusive_inherited_interfaces(self):
result = []
interface = self
while interface is not None:
result.append(interface)
interface = interface.inherited
return result | [
"def",
"inclusive_inherited_interfaces",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"interface",
"=",
"self",
"while",
"interface",
"is",
"not",
"None",
":",
"result",
".",
"append",
"(",
"interface",
")",
"interface",
"=",
"interface",
".",
"inherited"... | Returns the list of inclusive inherited interfaces. | [
"Returns",
"the",
"list",
"of",
"inclusive",
"inherited",
"interfaces",
"."
] | [
"\"\"\"\n Returns the list of inclusive inherited interfaces.\n\n https://webidl.spec.whatwg.org/#interface-inclusive-inherited-interfaces\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7d07f46a7e8d0ee2047a10071a2e2d83feeecd8e | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/interface.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | does_implement | <not_specific> | def does_implement(self, identifier):
"""
Returns True if this is or inherits from the given interface.
"""
assert isinstance(identifier, str)
for interface in self.inclusive_inherited_interfaces:
if interface.identifier == identifier:
return True
... |
Returns True if this is or inherits from the given interface.
| Returns True if this is or inherits from the given interface. | [
"Returns",
"True",
"if",
"this",
"is",
"or",
"inherits",
"from",
"the",
"given",
"interface",
"."
] | def does_implement(self, identifier):
assert isinstance(identifier, str)
for interface in self.inclusive_inherited_interfaces:
if interface.identifier == identifier:
return True
return False | [
"def",
"does_implement",
"(",
"self",
",",
"identifier",
")",
":",
"assert",
"isinstance",
"(",
"identifier",
",",
"str",
")",
"for",
"interface",
"in",
"self",
".",
"inclusive_inherited_interfaces",
":",
"if",
"interface",
".",
"identifier",
"==",
"identifier",... | Returns True if this is or inherits from the given interface. | [
"Returns",
"True",
"if",
"this",
"is",
"or",
"inherits",
"from",
"the",
"given",
"interface",
"."
] | [
"\"\"\"\n Returns True if this is or inherits from the given interface.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "identifier",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "identifier",
"type": null,
"docstring": null,
"docstring_toke... |
7d07f46a7e8d0ee2047a10071a2e2d83feeecd8e | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/interface.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | operation_groups | <not_specific> | def operation_groups(self):
"""
Returns groups of overloaded operations, including [LegacyUnforgeable]
operations in ancestors.
All operations that have an identifier are grouped by identifier, thus
it's possible that there is a single operation in a certain operation
gr... |
Returns groups of overloaded operations, including [LegacyUnforgeable]
operations in ancestors.
All operations that have an identifier are grouped by identifier, thus
it's possible that there is a single operation in a certain operation
group. If an operation doesn't have an i... | Returns groups of overloaded operations, including [LegacyUnforgeable]
operations in ancestors.
All operations that have an identifier are grouped by identifier, thus
it's possible that there is a single operation in a certain operation
group. If an operation doesn't have an identifier, i.e. if it's a
merely special ... | [
"Returns",
"groups",
"of",
"overloaded",
"operations",
"including",
"[",
"LegacyUnforgeable",
"]",
"operations",
"in",
"ancestors",
".",
"All",
"operations",
"that",
"have",
"an",
"identifier",
"are",
"grouped",
"by",
"identifier",
"thus",
"it",
"'",
"s",
"possi... | def operation_groups(self):
return self._operation_groups | [
"def",
"operation_groups",
"(",
"self",
")",
":",
"return",
"self",
".",
"_operation_groups"
] | Returns groups of overloaded operations, including [LegacyUnforgeable]
operations in ancestors. | [
"Returns",
"groups",
"of",
"overloaded",
"operations",
"including",
"[",
"LegacyUnforgeable",
"]",
"operations",
"in",
"ancestors",
"."
] | [
"\"\"\"\n Returns groups of overloaded operations, including [LegacyUnforgeable]\n operations in ancestors.\n\n All operations that have an identifier are grouped by identifier, thus\n it's possible that there is a single operation in a certain operation\n group. If an operation ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7d07f46a7e8d0ee2047a10071a2e2d83feeecd8e | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/interface.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | exposed_constructs | <not_specific> | def exposed_constructs(self):
"""
Returns a list of the constructs that are exposed on this global object.
"""
return tuple(
map(lambda ref: ref.target_object, self._exposed_constructs)) |
Returns a list of the constructs that are exposed on this global object.
| Returns a list of the constructs that are exposed on this global object. | [
"Returns",
"a",
"list",
"of",
"the",
"constructs",
"that",
"are",
"exposed",
"on",
"this",
"global",
"object",
"."
] | def exposed_constructs(self):
return tuple(
map(lambda ref: ref.target_object, self._exposed_constructs)) | [
"def",
"exposed_constructs",
"(",
"self",
")",
":",
"return",
"tuple",
"(",
"map",
"(",
"lambda",
"ref",
":",
"ref",
".",
"target_object",
",",
"self",
".",
"_exposed_constructs",
")",
")"
] | Returns a list of the constructs that are exposed on this global object. | [
"Returns",
"a",
"list",
"of",
"the",
"constructs",
"that",
"are",
"exposed",
"on",
"this",
"global",
"object",
"."
] | [
"\"\"\"\n Returns a list of the constructs that are exposed on this global object.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7d0fb24993d2202a67e6b06bff840a411fccc56d | sunlongbo/chromium | tools/python/google/gethash_timer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | IssueGetHash | <not_specific> | def IssueGetHash(prefix):
'''Issue one GetHash request to the safebrowsing servers.
Args:
prefix: A 4 byte value to look up on the server.
Returns:
The HTTP response code for the GetHash request.
'''
body = '4:4\n' + prefix
h = httplib.HTTPConnection(_GETHASH_HOST)
h.putrequest('POST', _GETHASH_RE... | Issue one GetHash request to the safebrowsing servers.
Args:
prefix: A 4 byte value to look up on the server.
Returns:
The HTTP response code for the GetHash request.
| Issue one GetHash request to the safebrowsing servers. | [
"Issue",
"one",
"GetHash",
"request",
"to",
"the",
"safebrowsing",
"servers",
"."
] | def IssueGetHash(prefix):
body = '4:4\n' + prefix
h = httplib.HTTPConnection(_GETHASH_HOST)
h.putrequest('POST', _GETHASH_REQUEST)
h.putheader('content-length', str(len(body)))
h.endheaders()
h.send(body)
response_code = h.getresponse().status
h.close()
return response_code | [
"def",
"IssueGetHash",
"(",
"prefix",
")",
":",
"body",
"=",
"'4:4\\n'",
"+",
"prefix",
"h",
"=",
"httplib",
".",
"HTTPConnection",
"(",
"_GETHASH_HOST",
")",
"h",
".",
"putrequest",
"(",
"'POST'",
",",
"_GETHASH_REQUEST",
")",
"h",
".",
"putheader",
"(",
... | Issue one GetHash request to the safebrowsing servers. | [
"Issue",
"one",
"GetHash",
"request",
"to",
"the",
"safebrowsing",
"servers",
"."
] | [
"'''Issue one GetHash request to the safebrowsing servers.\n Args:\n prefix: A 4 byte value to look up on the server.\n Returns:\n The HTTP response code for the GetHash request.\n '''"
] | [
{
"param": "prefix",
"type": null
}
] | {
"returns": [
{
"docstring": "The HTTP response code for the GetHash request.",
"docstring_tokens": [
"The",
"HTTP",
"response",
"code",
"for",
"the",
"GetHash",
"request",
"."
],
"type": null
}
],
"raises": [... |
7d0fb24993d2202a67e6b06bff840a411fccc56d | sunlongbo/chromium | tools/python/google/gethash_timer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | TimedGetHash | <not_specific> | def TimedGetHash(prefix):
'''Measure the amount of time it takes to receive a GetHash response.
Args:
prefix: A 4 byte value to look up on the the server.
Returns:
A tuple of HTTP resonse code and the response time (in milliseconds).
'''
start = time.time()
response_code = IssueGetHash(prefix)
ret... | Measure the amount of time it takes to receive a GetHash response.
Args:
prefix: A 4 byte value to look up on the the server.
Returns:
A tuple of HTTP resonse code and the response time (in milliseconds).
| Measure the amount of time it takes to receive a GetHash response. | [
"Measure",
"the",
"amount",
"of",
"time",
"it",
"takes",
"to",
"receive",
"a",
"GetHash",
"response",
"."
] | def TimedGetHash(prefix):
start = time.time()
response_code = IssueGetHash(prefix)
return response_code, (time.time() - start) * 1000 | [
"def",
"TimedGetHash",
"(",
"prefix",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"response_code",
"=",
"IssueGetHash",
"(",
"prefix",
")",
"return",
"response_code",
",",
"(",
"time",
".",
"time",
"(",
")",
"-",
"start",
")",
"*",
"1000"
] | Measure the amount of time it takes to receive a GetHash response. | [
"Measure",
"the",
"amount",
"of",
"time",
"it",
"takes",
"to",
"receive",
"a",
"GetHash",
"response",
"."
] | [
"'''Measure the amount of time it takes to receive a GetHash response.\n Args:\n prefix: A 4 byte value to look up on the the server.\n Returns:\n A tuple of HTTP resonse code and the response time (in milliseconds).\n '''"
] | [
{
"param": "prefix",
"type": null
}
] | {
"returns": [
{
"docstring": "A tuple of HTTP resonse code and the response time (in milliseconds).",
"docstring_tokens": [
"A",
"tuple",
"of",
"HTTP",
"resonse",
"code",
"and",
"the",
"response",
"time",
"(",
... |
7d0fb24993d2202a67e6b06bff840a411fccc56d | sunlongbo/chromium | tools/python/google/gethash_timer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunTimedGetHash | null | def RunTimedGetHash(period, samples=None):
'''Runs an experiment to measure the amount of time it takes to receive
multiple responses from the GetHash servers.
Args:
period: A floating point value that indicates (in seconds) the delay
between requests.
samples: An integer value indicating t... | Runs an experiment to measure the amount of time it takes to receive
multiple responses from the GetHash servers.
Args:
period: A floating point value that indicates (in seconds) the delay
between requests.
samples: An integer value indicating the number of requests to make.
If '... | Runs an experiment to measure the amount of time it takes to receive
multiple responses from the GetHash servers. | [
"Runs",
"an",
"experiment",
"to",
"measure",
"the",
"amount",
"of",
"time",
"it",
"takes",
"to",
"receive",
"multiple",
"responses",
"from",
"the",
"GetHash",
"servers",
"."
] | def RunTimedGetHash(period, samples=None):
global g_file_handle
prefix = '\x50\x61\x75\x6c'
sample_count = 1
while True:
response_code, elapsed_time = TimedGetHash(prefix)
LogResponse(sample_count, response_code, elapsed_time)
sample_count += 1
if samples is not None and sample_count == samples:... | [
"def",
"RunTimedGetHash",
"(",
"period",
",",
"samples",
"=",
"None",
")",
":",
"global",
"g_file_handle",
"prefix",
"=",
"'\\x50\\x61\\x75\\x6c'",
"sample_count",
"=",
"1",
"while",
"True",
":",
"response_code",
",",
"elapsed_time",
"=",
"TimedGetHash",
"(",
"p... | Runs an experiment to measure the amount of time it takes to receive
multiple responses from the GetHash servers. | [
"Runs",
"an",
"experiment",
"to",
"measure",
"the",
"amount",
"of",
"time",
"it",
"takes",
"to",
"receive",
"multiple",
"responses",
"from",
"the",
"GetHash",
"servers",
"."
] | [
"'''Runs an experiment to measure the amount of time it takes to receive\n multiple responses from the GetHash servers.\n\n Args:\n period: A floating point value that indicates (in seconds) the delay\n between requests.\n samples: An integer value indicating the number of requests to make.\n ... | [
{
"param": "period",
"type": null
},
{
"param": "samples",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "period",
"type": null,
"docstring": "A floating point value that indicates (in seconds) the delay\nbetween requests.",
... |
7d0fb24993d2202a67e6b06bff840a411fccc56d | sunlongbo/chromium | tools/python/google/gethash_timer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | LogResponse | null | def LogResponse(sample_count, response_code, elapsed_time):
'''Output the response for one GetHash query.
Args:
sample_count: The current sample number.
response_code: The HTTP response code for the GetHash request.
elapsed_time: The round-trip time (in milliseconds) for the
GetHash... | Output the response for one GetHash query.
Args:
sample_count: The current sample number.
response_code: The HTTP response code for the GetHash request.
elapsed_time: The round-trip time (in milliseconds) for the
GetHash request.
Returns:
None.
| Output the response for one GetHash query. | [
"Output",
"the",
"response",
"for",
"one",
"GetHash",
"query",
"."
] | def LogResponse(sample_count, response_code, elapsed_time):
global g_file_handle
output_list = (sample_count, response_code, elapsed_time)
print('Request: %d, status: %d, elapsed time: %f ms' % output_list)
if g_file_handle is not None:
g_file_handle.write(('%d,%d,%f' % output_list) + '\n')
g_file_handl... | [
"def",
"LogResponse",
"(",
"sample_count",
",",
"response_code",
",",
"elapsed_time",
")",
":",
"global",
"g_file_handle",
"output_list",
"=",
"(",
"sample_count",
",",
"response_code",
",",
"elapsed_time",
")",
"print",
"(",
"'Request: %d, status: %d, elapsed time: %f ... | Output the response for one GetHash query. | [
"Output",
"the",
"response",
"for",
"one",
"GetHash",
"query",
"."
] | [
"'''Output the response for one GetHash query.\n Args:\n sample_count: The current sample number.\n response_code: The HTTP response code for the GetHash request.\n elapsed_time: The round-trip time (in milliseconds) for the\n GetHash request.\n Returns:\n None.\n '''"
] | [
{
"param": "sample_count",
"type": null
},
{
"param": "response_code",
"type": null
},
{
"param": "elapsed_time",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "sample_count",
"type": null,
"docstring": "The current sample number.",
"docstring_tokens": [
"The",
... |
7d0fb24993d2202a67e6b06bff840a411fccc56d | sunlongbo/chromium | tools/python/google/gethash_timer.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SetupOutputFile | null | def SetupOutputFile(file_name):
'''Open a file for logging results.
Args:
file_name: A path to a file to store the output.
Returns:
None.
'''
global g_file_handle
g_file_handle = open(file_name, 'w') | Open a file for logging results.
Args:
file_name: A path to a file to store the output.
Returns:
None.
| Open a file for logging results. | [
"Open",
"a",
"file",
"for",
"logging",
"results",
"."
] | def SetupOutputFile(file_name):
global g_file_handle
g_file_handle = open(file_name, 'w') | [
"def",
"SetupOutputFile",
"(",
"file_name",
")",
":",
"global",
"g_file_handle",
"g_file_handle",
"=",
"open",
"(",
"file_name",
",",
"'w'",
")"
] | Open a file for logging results. | [
"Open",
"a",
"file",
"for",
"logging",
"results",
"."
] | [
"'''Open a file for logging results.\n Args:\n file_name: A path to a file to store the output.\n Returns:\n None.\n '''"
] | [
{
"param": "file_name",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "file_name",
"type": null,
"docstring": "A path to a file to store the output.",
"docstring_tokens": [
"A",
... |
616dc19eb1cb51bd8342f85b262c27ff22f633b1 | sunlongbo/chromium | tools/disable_tests/conditions.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | parse | Condition | def parse(condition_strs: List[str]) -> Condition:
"""Parse a list of condition strings, as passed on the command line.
Each element of condition_strs is a set of Terminal names joined with '&'s.
The list is implicitly 'or'ed together.
"""
# When no conditions are given, this is taken to mean "always".
if... | Parse a list of condition strings, as passed on the command line.
Each element of condition_strs is a set of Terminal names joined with '&'s.
The list is implicitly 'or'ed together.
| Parse a list of condition strings, as passed on the command line.
Each element of condition_strs is a set of Terminal names joined with '&'s.
The list is implicitly 'or'ed together. | [
"Parse",
"a",
"list",
"of",
"condition",
"strings",
"as",
"passed",
"on",
"the",
"command",
"line",
".",
"Each",
"element",
"of",
"condition_strs",
"is",
"a",
"set",
"of",
"Terminal",
"names",
"joined",
"with",
"'",
"&",
"'",
"s",
".",
"The",
"list",
"... | def parse(condition_strs: List[str]) -> Condition:
if not condition_strs:
return ALWAYS
try:
return op_of('or', [
op_of('and', [get_term(x.strip()) for x in cond.split('&')])
for cond in condition_strs
])
except ValueError as e:
valid_conds = '\n'.join(sorted(f'\t{term.name}' for t... | [
"def",
"parse",
"(",
"condition_strs",
":",
"List",
"[",
"str",
"]",
")",
"->",
"Condition",
":",
"if",
"not",
"condition_strs",
":",
"return",
"ALWAYS",
"try",
":",
"return",
"op_of",
"(",
"'or'",
",",
"[",
"op_of",
"(",
"'and'",
",",
"[",
"get_term",... | Parse a list of condition strings, as passed on the command line. | [
"Parse",
"a",
"list",
"of",
"condition",
"strings",
"as",
"passed",
"on",
"the",
"command",
"line",
"."
] | [
"\"\"\"Parse a list of condition strings, as passed on the command line.\n\n Each element of condition_strs is a set of Terminal names joined with '&'s.\n The list is implicitly 'or'ed together.\n \"\"\"",
"# When no conditions are given, this is taken to mean \"always\".",
"# Catching the exception raised b... | [
{
"param": "condition_strs",
"type": "List[str]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "condition_strs",
"type": "List[str]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
616dc19eb1cb51bd8342f85b262c27ff22f633b1 | sunlongbo/chromium | tools/disable_tests/conditions.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | op_of | Condition | def op_of(op: str, args: List[Condition]) -> Condition:
"""Make an operator, simplifying the single-argument case."""
if len(args) == 1:
return args[0]
return (op, args) | Make an operator, simplifying the single-argument case. | Make an operator, simplifying the single-argument case. | [
"Make",
"an",
"operator",
"simplifying",
"the",
"single",
"-",
"argument",
"case",
"."
] | def op_of(op: str, args: List[Condition]) -> Condition:
if len(args) == 1:
return args[0]
return (op, args) | [
"def",
"op_of",
"(",
"op",
":",
"str",
",",
"args",
":",
"List",
"[",
"Condition",
"]",
")",
"->",
"Condition",
":",
"if",
"len",
"(",
"args",
")",
"==",
"1",
":",
"return",
"args",
"[",
"0",
"]",
"return",
"(",
"op",
",",
"args",
")"
] | Make an operator, simplifying the single-argument case. | [
"Make",
"an",
"operator",
"simplifying",
"the",
"single",
"-",
"argument",
"case",
"."
] | [
"\"\"\"Make an operator, simplifying the single-argument case.\"\"\""
] | [
{
"param": "op",
"type": "str"
},
{
"param": "args",
"type": "List[Condition]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "op",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": "List[Condition]",
"docstring": null,
"docstrin... |
616dc19eb1cb51bd8342f85b262c27ff22f633b1 | sunlongbo/chromium | tools/disable_tests/conditions.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | merge | Condition | def merge(existing_cond: Condition, new_cond: Condition) -> Condition:
"""Merge two conditions together.
Given an existing condition, parsed from a file, and a new condition to be
added, combine the two to produce a merged condition.
"""
# If currently ALWAYS, merging would only ever produce ALWAYS too. In ... | Merge two conditions together.
Given an existing condition, parsed from a file, and a new condition to be
added, combine the two to produce a merged condition.
| Merge two conditions together.
Given an existing condition, parsed from a file, and a new condition to be
added, combine the two to produce a merged condition. | [
"Merge",
"two",
"conditions",
"together",
".",
"Given",
"an",
"existing",
"condition",
"parsed",
"from",
"a",
"file",
"and",
"a",
"new",
"condition",
"to",
"be",
"added",
"combine",
"the",
"two",
"to",
"produce",
"a",
"merged",
"condition",
"."
] | def merge(existing_cond: Condition, new_cond: Condition) -> Condition:
if existing_cond == ALWAYS:
return new_cond
if existing_cond == NEVER:
return new_cond
if new_cond == ALWAYS:
return ALWAYS
if new_cond == NEVER:
return NEVER
cond = ('or', [existing_cond, new_cond])
return simplify(cond) | [
"def",
"merge",
"(",
"existing_cond",
":",
"Condition",
",",
"new_cond",
":",
"Condition",
")",
"->",
"Condition",
":",
"if",
"existing_cond",
"==",
"ALWAYS",
":",
"return",
"new_cond",
"if",
"existing_cond",
"==",
"NEVER",
":",
"return",
"new_cond",
"if",
"... | Merge two conditions together. | [
"Merge",
"two",
"conditions",
"together",
"."
] | [
"\"\"\"Merge two conditions together.\n\n Given an existing condition, parsed from a file, and a new condition to be\n added, combine the two to produce a merged condition.\n \"\"\"",
"# If currently ALWAYS, merging would only ever produce ALWAYS too. In this",
"# case the user likely want to change the cond... | [
{
"param": "existing_cond",
"type": "Condition"
},
{
"param": "new_cond",
"type": "Condition"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "existing_cond",
"type": "Condition",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "new_cond",
"type": "Condition",
"docstring": null,
... |
616dc19eb1cb51bd8342f85b262c27ff22f633b1 | sunlongbo/chromium | tools/disable_tests/conditions.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | generate_condition_groups | List[Set[Terminal]] | def generate_condition_groups(terms: List[Terminal]) -> List[Set[Terminal]]:
"""Partition a list of Terminals by their 'group' attribute."""
by_group = collections.defaultdict(set)
ungrouped = []
for term in terms:
if term.group is not None:
by_group[term.group].add(term)
else:
# Every Term... | Partition a list of Terminals by their 'group' attribute. | Partition a list of Terminals by their 'group' attribute. | [
"Partition",
"a",
"list",
"of",
"Terminals",
"by",
"their",
"'",
"group",
"'",
"attribute",
"."
] | def generate_condition_groups(terms: List[Terminal]) -> List[Set[Terminal]]:
by_group = collections.defaultdict(set)
ungrouped = []
for term in terms:
if term.group is not None:
by_group[term.group].add(term)
else:
ungrouped.append({term})
groups = list(by_group.values())
groups += ungroup... | [
"def",
"generate_condition_groups",
"(",
"terms",
":",
"List",
"[",
"Terminal",
"]",
")",
"->",
"List",
"[",
"Set",
"[",
"Terminal",
"]",
"]",
":",
"by_group",
"=",
"collections",
".",
"defaultdict",
"(",
"set",
")",
"ungrouped",
"=",
"[",
"]",
"for",
... | Partition a list of Terminals by their 'group' attribute. | [
"Partition",
"a",
"list",
"of",
"Terminals",
"by",
"their",
"'",
"group",
"'",
"attribute",
"."
] | [
"\"\"\"Partition a list of Terminals by their 'group' attribute.\"\"\"",
"# Every Terminal without a 'group' attribute gets its own group, as",
"# they're not mutually exclusive with anything."
] | [
{
"param": "terms",
"type": "List[Terminal]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "terms",
"type": "List[Terminal]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
616dc19eb1cb51bd8342f85b262c27ff22f633b1 | sunlongbo/chromium | tools/disable_tests/conditions.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | simplify | Condition | def simplify(cond: Condition) -> Condition:
"""Given a Condition, produce an equivalent but simpler Condition.
This function uses the Quine-McCluskey algorithm. It's not implemented very
efficiently, but it works and is fast enough for now.
"""
if isinstance(cond, BaseCondition):
return cond
# Quine-... | Given a Condition, produce an equivalent but simpler Condition.
This function uses the Quine-McCluskey algorithm. It's not implemented very
efficiently, but it works and is fast enough for now.
| Given a Condition, produce an equivalent but simpler Condition.
This function uses the Quine-McCluskey algorithm. It's not implemented very
efficiently, but it works and is fast enough for now. | [
"Given",
"a",
"Condition",
"produce",
"an",
"equivalent",
"but",
"simpler",
"Condition",
".",
"This",
"function",
"uses",
"the",
"Quine",
"-",
"McCluskey",
"algorithm",
".",
"It",
"'",
"s",
"not",
"implemented",
"very",
"efficiently",
"but",
"it",
"works",
"... | def simplify(cond: Condition) -> Condition:
if isinstance(cond, BaseCondition):
return cond
DONT_CARE = 2
Both of these are represented via tuples of {0, 1} values, which the value
at index 'i' corresponds to variables[i].
TODO: This could use a more efficient representation. Some packed integer
usi... | [
"def",
"simplify",
"(",
"cond",
":",
"Condition",
")",
"->",
"Condition",
":",
"if",
"isinstance",
"(",
"cond",
",",
"BaseCondition",
")",
":",
"return",
"cond",
"DONT_CARE",
"=",
"2",
"variables",
"=",
"list",
"(",
"sorted",
"(",
"find_terminals",
"(",
... | Given a Condition, produce an equivalent but simpler Condition. | [
"Given",
"a",
"Condition",
"produce",
"an",
"equivalent",
"but",
"simpler",
"Condition",
"."
] | [
"\"\"\"Given a Condition, produce an equivalent but simpler Condition.\n\n This function uses the Quine-McCluskey algorithm. It's not implemented very\n efficiently, but it works and is fast enough for now.\n \"\"\"",
"# Quine-McCluskey uses three values - true, false, and \"don't care\". The",
"# latter rep... | [
{
"param": "cond",
"type": "Condition"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cond",
"type": "Condition",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
616dc19eb1cb51bd8342f85b262c27ff22f633b1 | sunlongbo/chromium | tools/disable_tests/conditions.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | find_terminals | Set[Terminal] | def find_terminals(cond: Condition) -> Set[Terminal]:
"""Find all leaf Terminal nodes of this Condition."""
if isinstance(cond, BaseCondition):
return set()
if isinstance(cond, Terminal):
return {cond}
assert isinstance(cond, tuple)
op, args = cond
if op == 'not':
return find_terminals(args)
... | Find all leaf Terminal nodes of this Condition. | Find all leaf Terminal nodes of this Condition. | [
"Find",
"all",
"leaf",
"Terminal",
"nodes",
"of",
"this",
"Condition",
"."
] | def find_terminals(cond: Condition) -> Set[Terminal]:
if isinstance(cond, BaseCondition):
return set()
if isinstance(cond, Terminal):
return {cond}
assert isinstance(cond, tuple)
op, args = cond
if op == 'not':
return find_terminals(args)
return {var for arg in args for var in find_terminals(arg... | [
"def",
"find_terminals",
"(",
"cond",
":",
"Condition",
")",
"->",
"Set",
"[",
"Terminal",
"]",
":",
"if",
"isinstance",
"(",
"cond",
",",
"BaseCondition",
")",
":",
"return",
"set",
"(",
")",
"if",
"isinstance",
"(",
"cond",
",",
"Terminal",
")",
":",... | Find all leaf Terminal nodes of this Condition. | [
"Find",
"all",
"leaf",
"Terminal",
"nodes",
"of",
"this",
"Condition",
"."
] | [
"\"\"\"Find all leaf Terminal nodes of this Condition.\"\"\""
] | [
{
"param": "cond",
"type": "Condition"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cond",
"type": "Condition",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
616dc19eb1cb51bd8342f85b262c27ff22f633b1 | sunlongbo/chromium | tools/disable_tests/conditions.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | evaluate | bool | def evaluate(cond: Condition, true_vars: Set[Terminal]) -> bool:
"""Evaluate a condition with a given set of true variables."""
if isinstance(cond, BaseCondition):
return cond is ALWAYS
if isinstance(cond, Terminal):
return cond in true_vars
# => must be a tuple
op, args = cond
if op == 'not':
... | Evaluate a condition with a given set of true variables. | Evaluate a condition with a given set of true variables. | [
"Evaluate",
"a",
"condition",
"with",
"a",
"given",
"set",
"of",
"true",
"variables",
"."
] | def evaluate(cond: Condition, true_vars: Set[Terminal]) -> bool:
if isinstance(cond, BaseCondition):
return cond is ALWAYS
if isinstance(cond, Terminal):
return cond in true_vars
op, args = cond
if op == 'not':
return not evaluate(args, true_vars)
return {'or': any, 'and': all}[op](evaluate(arg, t... | [
"def",
"evaluate",
"(",
"cond",
":",
"Condition",
",",
"true_vars",
":",
"Set",
"[",
"Terminal",
"]",
")",
"->",
"bool",
":",
"if",
"isinstance",
"(",
"cond",
",",
"BaseCondition",
")",
":",
"return",
"cond",
"is",
"ALWAYS",
"if",
"isinstance",
"(",
"c... | Evaluate a condition with a given set of true variables. | [
"Evaluate",
"a",
"condition",
"with",
"a",
"given",
"set",
"of",
"true",
"variables",
"."
] | [
"\"\"\"Evaluate a condition with a given set of true variables.\"\"\"",
"# => must be a tuple"
] | [
{
"param": "cond",
"type": "Condition"
},
{
"param": "true_vars",
"type": "Set[Terminal]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cond",
"type": "Condition",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "true_vars",
"type": "Set[Terminal]",
"docstring": null,
... |
616f77c981b25f674abcd5b6f6f592b619a0b1d4 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checker_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | assert_no_check | null | def assert_no_check(path, category):
"""Assert that the given category should not be checked."""
message = ('Should not check category "%s" for path "%s".' %
(category, path))
self.assertFalse(config.should_check(category, path), message) | Assert that the given category should not be checked. | Assert that the given category should not be checked. | [
"Assert",
"that",
"the",
"given",
"category",
"should",
"not",
"be",
"checked",
"."
] | def assert_no_check(path, category):
message = ('Should not check category "%s" for path "%s".' %
(category, path))
self.assertFalse(config.should_check(category, path), message) | [
"def",
"assert_no_check",
"(",
"path",
",",
"category",
")",
":",
"message",
"=",
"(",
"'Should not check category \"%s\" for path \"%s\".'",
"%",
"(",
"category",
",",
"path",
")",
")",
"self",
".",
"assertFalse",
"(",
"config",
".",
"should_check",
"(",
"categ... | Assert that the given category should not be checked. | [
"Assert",
"that",
"the",
"given",
"category",
"should",
"not",
"be",
"checked",
"."
] | [
"\"\"\"Assert that the given category should not be checked.\"\"\""
] | [
{
"param": "path",
"type": null
},
{
"param": "category",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "category",
"type": null,
"docstring": null,
"docstring_tokens... |
616f77c981b25f674abcd5b6f6f592b619a0b1d4 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checker_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | dispatch | <not_specific> | def dispatch(self, file_path):
"""Call dispatch() with the given file path."""
dispatcher = CheckerDispatcher()
self.mock_handle_style_error = DefaultStyleErrorHandler(
'', None, None, [])
checker = dispatcher.dispatch(
file_path, self.mock_handle_style_error, min... | Call dispatch() with the given file path. | Call dispatch() with the given file path. | [
"Call",
"dispatch",
"()",
"with",
"the",
"given",
"file",
"path",
"."
] | def dispatch(self, file_path):
dispatcher = CheckerDispatcher()
self.mock_handle_style_error = DefaultStyleErrorHandler(
'', None, None, [])
checker = dispatcher.dispatch(
file_path, self.mock_handle_style_error, min_confidence=3)
return checker | [
"def",
"dispatch",
"(",
"self",
",",
"file_path",
")",
":",
"dispatcher",
"=",
"CheckerDispatcher",
"(",
")",
"self",
".",
"mock_handle_style_error",
"=",
"DefaultStyleErrorHandler",
"(",
"''",
",",
"None",
",",
"None",
",",
"[",
"]",
")",
"checker",
"=",
... | Call dispatch() with the given file path. | [
"Call",
"dispatch",
"()",
"with",
"the",
"given",
"file",
"path",
"."
] | [
"\"\"\"Call dispatch() with the given file path.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "file_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file_path",
"type": null,
"docstring": null,
"docstring_token... |
616f77c981b25f674abcd5b6f6f592b619a0b1d4 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checker_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | assert_checker | null | def assert_checker(self, file_path, expected_class):
"""Assert the type of the dispatched checker."""
checker = self.dispatch(file_path)
got_class = checker.__class__
self.assertEqual(
got_class, expected_class,
'For path "%(file_path)s" got %(got_class)s when '
... | Assert the type of the dispatched checker. | Assert the type of the dispatched checker. | [
"Assert",
"the",
"type",
"of",
"the",
"dispatched",
"checker",
"."
] | def assert_checker(self, file_path, expected_class):
checker = self.dispatch(file_path)
got_class = checker.__class__
self.assertEqual(
got_class, expected_class,
'For path "%(file_path)s" got %(got_class)s when '
"expecting %(expected_class)s." % {
... | [
"def",
"assert_checker",
"(",
"self",
",",
"file_path",
",",
"expected_class",
")",
":",
"checker",
"=",
"self",
".",
"dispatch",
"(",
"file_path",
")",
"got_class",
"=",
"checker",
".",
"__class__",
"self",
".",
"assertEqual",
"(",
"got_class",
",",
"expect... | Assert the type of the dispatched checker. | [
"Assert",
"the",
"type",
"of",
"the",
"dispatched",
"checker",
"."
] | [
"\"\"\"Assert the type of the dispatched checker.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "file_path",
"type": null
},
{
"param": "expected_class",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file_path",
"type": null,
"docstring": null,
"docstring_token... |
616f77c981b25f674abcd5b6f6f592b619a0b1d4 | sunlongbo/chromium | third_party/blink/tools/blinkpy/style/checker_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _style_checker_configuration | <not_specific> | def _style_checker_configuration(self, output_format="vs7"):
"""Return a StyleProcessorConfiguration instance for testing."""
base_rules = ["-whitespace", "+whitespace/tab"]
filter_configuration = FilterConfiguration(base_rules=base_rules)
return StyleProcessorConfiguration(
... | Return a StyleProcessorConfiguration instance for testing. | Return a StyleProcessorConfiguration instance for testing. | [
"Return",
"a",
"StyleProcessorConfiguration",
"instance",
"for",
"testing",
"."
] | def _style_checker_configuration(self, output_format="vs7"):
base_rules = ["-whitespace", "+whitespace/tab"]
filter_configuration = FilterConfiguration(base_rules=base_rules)
return StyleProcessorConfiguration(
filter_configuration=filter_configuration,
max_reports_per_ca... | [
"def",
"_style_checker_configuration",
"(",
"self",
",",
"output_format",
"=",
"\"vs7\"",
")",
":",
"base_rules",
"=",
"[",
"\"-whitespace\"",
",",
"\"+whitespace/tab\"",
"]",
"filter_configuration",
"=",
"FilterConfiguration",
"(",
"base_rules",
"=",
"base_rules",
")... | Return a StyleProcessorConfiguration instance for testing. | [
"Return",
"a",
"StyleProcessorConfiguration",
"instance",
"for",
"testing",
"."
] | [
"\"\"\"Return a StyleProcessorConfiguration instance for testing.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "output_format",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output_format",
"type": null,
"docstring": null,
"docstring_t... |
ea253c31e35bb6bb41acbf17d96ac8b1bbcacbd3 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/conditional_features.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _IsEnabled | <not_specific> | def _IsEnabled(definition, enabled_features):
"""Returns true if a definition is enabled.
A definition is enabled if it has no EnableIf/EnableIfNot attribute.
It is retained if it has an EnableIf attribute and the attribute is in
enabled_features. It is retained if it has an EnableIfNot attribute and the
att... | Returns true if a definition is enabled.
A definition is enabled if it has no EnableIf/EnableIfNot attribute.
It is retained if it has an EnableIf attribute and the attribute is in
enabled_features. It is retained if it has an EnableIfNot attribute and the
attribute is not in enabled features.
| Returns true if a definition is enabled.
A definition is enabled if it has no EnableIf/EnableIfNot attribute.
It is retained if it has an EnableIf attribute and the attribute is in
enabled_features. It is retained if it has an EnableIfNot attribute and the
attribute is not in enabled features. | [
"Returns",
"true",
"if",
"a",
"definition",
"is",
"enabled",
".",
"A",
"definition",
"is",
"enabled",
"if",
"it",
"has",
"no",
"EnableIf",
"/",
"EnableIfNot",
"attribute",
".",
"It",
"is",
"retained",
"if",
"it",
"has",
"an",
"EnableIf",
"attribute",
"and"... | def _IsEnabled(definition, enabled_features):
if not hasattr(definition, "attribute_list"):
return True
if not definition.attribute_list:
return True
already_defined = False
for a in definition.attribute_list:
if a.key == 'EnableIf' or a.key == 'EnableIfNot':
if already_defined:
raise ... | [
"def",
"_IsEnabled",
"(",
"definition",
",",
"enabled_features",
")",
":",
"if",
"not",
"hasattr",
"(",
"definition",
",",
"\"attribute_list\"",
")",
":",
"return",
"True",
"if",
"not",
"definition",
".",
"attribute_list",
":",
"return",
"True",
"already_defined... | Returns true if a definition is enabled. | [
"Returns",
"true",
"if",
"a",
"definition",
"is",
"enabled",
"."
] | [
"\"\"\"Returns true if a definition is enabled.\n\n A definition is enabled if it has no EnableIf/EnableIfNot attribute.\n It is retained if it has an EnableIf attribute and the attribute is in\n enabled_features. It is retained if it has an EnableIfNot attribute and the\n attribute is not in enabled features.\... | [
{
"param": "definition",
"type": null
},
{
"param": "enabled_features",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "definition",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "enabled_features",
"type": null,
"docstring": null,
"do... |
ea253c31e35bb6bb41acbf17d96ac8b1bbcacbd3 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/conditional_features.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _FilterDefinition | null | def _FilterDefinition(definition, enabled_features):
"""Filters definitions with a body."""
if isinstance(definition, ast.Enum):
_FilterDisabledFromNodeList(definition.enum_value_list, enabled_features)
elif isinstance(definition, ast.Interface):
_FilterDisabledFromNodeList(definition.body, enabled_featur... | Filters definitions with a body. | Filters definitions with a body. | [
"Filters",
"definitions",
"with",
"a",
"body",
"."
] | def _FilterDefinition(definition, enabled_features):
if isinstance(definition, ast.Enum):
_FilterDisabledFromNodeList(definition.enum_value_list, enabled_features)
elif isinstance(definition, ast.Interface):
_FilterDisabledFromNodeList(definition.body, enabled_features)
elif isinstance(definition, ast.Met... | [
"def",
"_FilterDefinition",
"(",
"definition",
",",
"enabled_features",
")",
":",
"if",
"isinstance",
"(",
"definition",
",",
"ast",
".",
"Enum",
")",
":",
"_FilterDisabledFromNodeList",
"(",
"definition",
".",
"enum_value_list",
",",
"enabled_features",
")",
"eli... | Filters definitions with a body. | [
"Filters",
"definitions",
"with",
"a",
"body",
"."
] | [
"\"\"\"Filters definitions with a body.\"\"\""
] | [
{
"param": "definition",
"type": null
},
{
"param": "enabled_features",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "definition",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "enabled_features",
"type": null,
"docstring": null,
"do... |
ea253c31e35bb6bb41acbf17d96ac8b1bbcacbd3 | sunlongbo/chromium | mojo/public/tools/mojom/mojom/parse/conditional_features.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RemoveDisabledDefinitions | null | def RemoveDisabledDefinitions(mojom, enabled_features):
"""Removes conditionally disabled definitions from a Mojom node."""
mojom.import_list = ast.ImportList([
imported_file for imported_file in mojom.import_list
if _IsEnabled(imported_file, enabled_features)
])
mojom.definition_list = [
defi... | Removes conditionally disabled definitions from a Mojom node. | Removes conditionally disabled definitions from a Mojom node. | [
"Removes",
"conditionally",
"disabled",
"definitions",
"from",
"a",
"Mojom",
"node",
"."
] | def RemoveDisabledDefinitions(mojom, enabled_features):
mojom.import_list = ast.ImportList([
imported_file for imported_file in mojom.import_list
if _IsEnabled(imported_file, enabled_features)
])
mojom.definition_list = [
definition for definition in mojom.definition_list
if _IsEnabled(def... | [
"def",
"RemoveDisabledDefinitions",
"(",
"mojom",
",",
"enabled_features",
")",
":",
"mojom",
".",
"import_list",
"=",
"ast",
".",
"ImportList",
"(",
"[",
"imported_file",
"for",
"imported_file",
"in",
"mojom",
".",
"import_list",
"if",
"_IsEnabled",
"(",
"impor... | Removes conditionally disabled definitions from a Mojom node. | [
"Removes",
"conditionally",
"disabled",
"definitions",
"from",
"a",
"Mojom",
"node",
"."
] | [
"\"\"\"Removes conditionally disabled definitions from a Mojom node.\"\"\""
] | [
{
"param": "mojom",
"type": null
},
{
"param": "enabled_features",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mojom",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "enabled_features",
"type": null,
"docstring": null,
"docstri... |
b0cf22f42df0c57ee1965bd823cd1ca6d181025a | sunlongbo/chromium | ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_component_crx_gen.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | BuildArchForInstaller | null | def BuildArchForInstaller(version_quad, arch, lib_overrides):
""" Build an architecture specific version for the chrome installer.
"""
target_dir = PnaclDirs.OutputDir()
StepBanner('BUILD INSTALLER',
'Packaging for arch %s in %s' % (arch, target_dir))
# Copy llc.nexe and ld.nexe, but with some ... | Build an architecture specific version for the chrome installer.
| Build an architecture specific version for the chrome installer. | [
"Build",
"an",
"architecture",
"specific",
"version",
"for",
"the",
"chrome",
"installer",
"."
] | def BuildArchForInstaller(version_quad, arch, lib_overrides):
target_dir = PnaclDirs.OutputDir()
StepBanner('BUILD INSTALLER',
'Packaging for arch %s in %s' % (arch, target_dir))
CopyFlattenDirsAndPrefix(PnaclDirs.SandboxedCompilerDir(arch),
arch,
... | [
"def",
"BuildArchForInstaller",
"(",
"version_quad",
",",
"arch",
",",
"lib_overrides",
")",
":",
"target_dir",
"=",
"PnaclDirs",
".",
"OutputDir",
"(",
")",
"StepBanner",
"(",
"'BUILD INSTALLER'",
",",
"'Packaging for arch %s in %s'",
"%",
"(",
"arch",
",",
"targ... | Build an architecture specific version for the chrome installer. | [
"Build",
"an",
"architecture",
"specific",
"version",
"for",
"the",
"chrome",
"installer",
"."
] | [
"\"\"\" Build an architecture specific version for the chrome installer.\n \"\"\"",
"# Copy llc.nexe and ld.nexe, but with some renaming and directory flattening.",
"# Copy native libraries, also with renaming and directory flattening.",
"# Also copy files from the list of overrides.",
"# This needs the ar... | [
{
"param": "version_quad",
"type": null
},
{
"param": "arch",
"type": null
},
{
"param": "lib_overrides",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "version_quad",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arch",
"type": null,
"docstring": null,
"docstring_to... |
b0cf22f42df0c57ee1965bd823cd1ca6d181025a | sunlongbo/chromium | ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_component_crx_gen.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | BuildInstallerStyle | null | def BuildInstallerStyle(version_quad, lib_overrides, arches):
""" Package the pnacl component for use within the chrome installer
infrastructure. These files need to be named in a special way
so that white-listing of files is easy.
"""
StepBanner("BUILD_ALL", "Packaging installer for version: %s" % version_q... | Package the pnacl component for use within the chrome installer
infrastructure. These files need to be named in a special way
so that white-listing of files is easy.
| Package the pnacl component for use within the chrome installer
infrastructure. These files need to be named in a special way
so that white-listing of files is easy. | [
"Package",
"the",
"pnacl",
"component",
"for",
"use",
"within",
"the",
"chrome",
"installer",
"infrastructure",
".",
"These",
"files",
"need",
"to",
"be",
"named",
"in",
"a",
"special",
"way",
"so",
"that",
"white",
"-",
"listing",
"of",
"files",
"is",
"ea... | def BuildInstallerStyle(version_quad, lib_overrides, arches):
StepBanner("BUILD_ALL", "Packaging installer for version: %s" % version_quad)
for arch in arches:
BuildArchForInstaller(version_quad, arch, lib_overrides)
if len(arches) == 1:
arches = arches[0]
PnaclPackaging.GeneratePnaclInfo(PnaclDirs.Outp... | [
"def",
"BuildInstallerStyle",
"(",
"version_quad",
",",
"lib_overrides",
",",
"arches",
")",
":",
"StepBanner",
"(",
"\"BUILD_ALL\"",
",",
"\"Packaging installer for version: %s\"",
"%",
"version_quad",
")",
"for",
"arch",
"in",
"arches",
":",
"BuildArchForInstaller",
... | Package the pnacl component for use within the chrome installer
infrastructure. | [
"Package",
"the",
"pnacl",
"component",
"for",
"use",
"within",
"the",
"chrome",
"installer",
"infrastructure",
"."
] | [
"\"\"\" Package the pnacl component for use within the chrome installer\n infrastructure. These files need to be named in a special way\n so that white-listing of files is easy.\n \"\"\"",
"# Generate pnacl info manifest.",
"# Hack around the fact that there may be more than one arch, on Windows."
] | [
{
"param": "version_quad",
"type": null
},
{
"param": "lib_overrides",
"type": null
},
{
"param": "arches",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "version_quad",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lib_overrides",
"type": null,
"docstring": null,
"doc... |
d0c969f7b4a8d932a0b49281e5413f116f488709 | sunlongbo/chromium | tools/json_schema_compiler/model.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _IsTypeFromManifestKeys | <not_specific> | def _IsTypeFromManifestKeys(namespace, typename, fallback):
# type(Namespace, str, bool) -> bool
"""Computes whether 'from_manifest_keys' is true for the given type.
"""
if typename in namespace._manifest_referenced_types:
return True
return fallback | Computes whether 'from_manifest_keys' is true for the given type.
| Computes whether 'from_manifest_keys' is true for the given type. | [
"Computes",
"whether",
"'",
"from_manifest_keys",
"'",
"is",
"true",
"for",
"the",
"given",
"type",
"."
] | def _IsTypeFromManifestKeys(namespace, typename, fallback):
if typename in namespace._manifest_referenced_types:
return True
return fallback | [
"def",
"_IsTypeFromManifestKeys",
"(",
"namespace",
",",
"typename",
",",
"fallback",
")",
":",
"if",
"typename",
"in",
"namespace",
".",
"_manifest_referenced_types",
":",
"return",
"True",
"return",
"fallback"
] | Computes whether 'from_manifest_keys' is true for the given type. | [
"Computes",
"whether",
"'",
"from_manifest_keys",
"'",
"is",
"true",
"for",
"the",
"given",
"type",
"."
] | [
"# type(Namespace, str, bool) -> bool",
"\"\"\"Computes whether 'from_manifest_keys' is true for the given type.\n \"\"\""
] | [
{
"param": "namespace",
"type": null
},
{
"param": "typename",
"type": null
},
{
"param": "fallback",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "namespace",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "typename",
"type": null,
"docstring": null,
"docstring_t... |
d0c969f7b4a8d932a0b49281e5413f116f488709 | sunlongbo/chromium | tools/json_schema_compiler/model.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AddNamespace | <not_specific> | def AddNamespace(self,
json,
source_file,
include_compiler_options=False,
environment=None):
"""Add a namespace's json to the model and returns the namespace.
"""
namespace = Namespace(json,
source_file,
... | Add a namespace's json to the model and returns the namespace.
| Add a namespace's json to the model and returns the namespace. | [
"Add",
"a",
"namespace",
"'",
"s",
"json",
"to",
"the",
"model",
"and",
"returns",
"the",
"namespace",
"."
] | def AddNamespace(self,
json,
source_file,
include_compiler_options=False,
environment=None):
namespace = Namespace(json,
source_file,
include_compiler_options=include_compiler_options,
... | [
"def",
"AddNamespace",
"(",
"self",
",",
"json",
",",
"source_file",
",",
"include_compiler_options",
"=",
"False",
",",
"environment",
"=",
"None",
")",
":",
"namespace",
"=",
"Namespace",
"(",
"json",
",",
"source_file",
",",
"include_compiler_options",
"=",
... | Add a namespace's json to the model and returns the namespace. | [
"Add",
"a",
"namespace",
"'",
"s",
"json",
"to",
"the",
"model",
"and",
"returns",
"the",
"namespace",
"."
] | [
"\"\"\"Add a namespace's json to the model and returns the namespace.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "json",
"type": null
},
{
"param": "source_file",
"type": null
},
{
"param": "include_compiler_options",
"type": null
},
{
"param": "environment",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "json",
"type": null,
"docstring": null,
"docstring_tokens": [... |
d0c969f7b4a8d932a0b49281e5413f116f488709 | sunlongbo/chromium | tools/json_schema_compiler/model.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | IsRootManifestKeyType | <not_specific> | def IsRootManifestKeyType(self):
# type: () -> boolean
''' Returns true if this type corresponds to the top level ManifestKeys
type.
'''
return self.name == 'ManifestKeys' | Returns true if this type corresponds to the top level ManifestKeys
type.
| Returns true if this type corresponds to the top level ManifestKeys
type. | [
"Returns",
"true",
"if",
"this",
"type",
"corresponds",
"to",
"the",
"top",
"level",
"ManifestKeys",
"type",
"."
] | def IsRootManifestKeyType(self):
return self.name == 'ManifestKeys' | [
"def",
"IsRootManifestKeyType",
"(",
"self",
")",
":",
"return",
"self",
".",
"name",
"==",
"'ManifestKeys'"
] | Returns true if this type corresponds to the top level ManifestKeys
type. | [
"Returns",
"true",
"if",
"this",
"type",
"corresponds",
"to",
"the",
"top",
"level",
"ManifestKeys",
"type",
"."
] | [
"# type: () -> boolean",
"''' Returns true if this type corresponds to the top level ManifestKeys\n type.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d0c969f7b4a8d932a0b49281e5413f116f488709 | sunlongbo/chromium | tools/json_schema_compiler/model.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetUnixName | <not_specific> | def GetUnixName(self):
"""Gets the property's unix_name. Raises AttributeError if not set.
"""
if not self._unix_name:
raise AttributeError('No unix_name set on %s' % self.name)
self._unix_name_used = True
return self._unix_name | Gets the property's unix_name. Raises AttributeError if not set.
| Gets the property's unix_name. Raises AttributeError if not set. | [
"Gets",
"the",
"property",
"'",
"s",
"unix_name",
".",
"Raises",
"AttributeError",
"if",
"not",
"set",
"."
] | def GetUnixName(self):
if not self._unix_name:
raise AttributeError('No unix_name set on %s' % self.name)
self._unix_name_used = True
return self._unix_name | [
"def",
"GetUnixName",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_unix_name",
":",
"raise",
"AttributeError",
"(",
"'No unix_name set on %s'",
"%",
"self",
".",
"name",
")",
"self",
".",
"_unix_name_used",
"=",
"True",
"return",
"self",
".",
"_unix_na... | Gets the property's unix_name. | [
"Gets",
"the",
"property",
"'",
"s",
"unix_name",
"."
] | [
"\"\"\"Gets the property's unix_name. Raises AttributeError if not set.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d0c969f7b4a8d932a0b49281e5413f116f488709 | sunlongbo/chromium | tools/json_schema_compiler/model.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SetUnixName | <not_specific> | def SetUnixName(self, unix_name):
"""Set the property's unix_name. Raises AttributeError if the unix_name has
already been used (GetUnixName has been called).
"""
if unix_name == self._unix_name:
return
if self._unix_name_used:
raise AttributeError(
'Cannot set the unix_name on... | Set the property's unix_name. Raises AttributeError if the unix_name has
already been used (GetUnixName has been called).
| Set the property's unix_name. Raises AttributeError if the unix_name has
already been used (GetUnixName has been called). | [
"Set",
"the",
"property",
"'",
"s",
"unix_name",
".",
"Raises",
"AttributeError",
"if",
"the",
"unix_name",
"has",
"already",
"been",
"used",
"(",
"GetUnixName",
"has",
"been",
"called",
")",
"."
] | def SetUnixName(self, unix_name):
if unix_name == self._unix_name:
return
if self._unix_name_used:
raise AttributeError(
'Cannot set the unix_name on %s; '
'it is already used elsewhere as %s' %
(self.name, self._unix_name))
self._unix_name = unix_name | [
"def",
"SetUnixName",
"(",
"self",
",",
"unix_name",
")",
":",
"if",
"unix_name",
"==",
"self",
".",
"_unix_name",
":",
"return",
"if",
"self",
".",
"_unix_name_used",
":",
"raise",
"AttributeError",
"(",
"'Cannot set the unix_name on %s; '",
"'it is already used el... | Set the property's unix_name. | [
"Set",
"the",
"property",
"'",
"s",
"unix_name",
"."
] | [
"\"\"\"Set the property's unix_name. Raises AttributeError if the unix_name has\n already been used (GetUnixName has been called).\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "unix_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "unix_name",
"type": null,
"docstring": null,
"docstring_token... |
d0c969f7b4a8d932a0b49281e5413f116f488709 | sunlongbo/chromium | tools/json_schema_compiler/model.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | UnixName | <not_specific> | def UnixName(name):
'''Returns the unix_style name for a given lowerCamelCase string.
'''
# Append an extra underscore to the |name|'s end if it's a reserved C++
# keyword in order to avoid compilation errors in generated code.
# Note: In some cases, this is overly greedy, because the unix name is
# appende... | Returns the unix_style name for a given lowerCamelCase string.
| Returns the unix_style name for a given lowerCamelCase string. | [
"Returns",
"the",
"unix_style",
"name",
"for",
"a",
"given",
"lowerCamelCase",
"string",
"."
] | def UnixName(name):
if IsCPlusPlusKeyword(name):
name = name + '_'
assert(name)
if name[0].isdigit():
name = '_' + name
unix_name = []
for i, c in enumerate(name):
if c.isupper() and i > 0 and name[i - 1] != '_':
if name[i - 1].islower():
unix_name.append('_')
elif i + 1 < len(... | [
"def",
"UnixName",
"(",
"name",
")",
":",
"if",
"IsCPlusPlusKeyword",
"(",
"name",
")",
":",
"name",
"=",
"name",
"+",
"'_'",
"assert",
"(",
"name",
")",
"if",
"name",
"[",
"0",
"]",
".",
"isdigit",
"(",
")",
":",
"name",
"=",
"'_'",
"+",
"name",... | Returns the unix_style name for a given lowerCamelCase string. | [
"Returns",
"the",
"unix_style",
"name",
"for",
"a",
"given",
"lowerCamelCase",
"string",
"."
] | [
"'''Returns the unix_style name for a given lowerCamelCase string.\n '''",
"# Append an extra underscore to the |name|'s end if it's a reserved C++",
"# keyword in order to avoid compilation errors in generated code.",
"# Note: In some cases, this is overly greedy, because the unix name is",
"# appended to... | [
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d0c969f7b4a8d932a0b49281e5413f116f488709 | sunlongbo/chromium | tools/json_schema_compiler/model.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetModelHierarchy | <not_specific> | def _GetModelHierarchy(entity):
"""Returns the hierarchy of the given model entity."""
hierarchy = []
while entity is not None:
hierarchy.append(getattr(entity, 'name', repr(entity)))
if isinstance(entity, Namespace):
hierarchy.insert(0, ' in %s' % entity.source_file)
entity = getattr(entity, '... | Returns the hierarchy of the given model entity. | Returns the hierarchy of the given model entity. | [
"Returns",
"the",
"hierarchy",
"of",
"the",
"given",
"model",
"entity",
"."
] | def _GetModelHierarchy(entity):
hierarchy = []
while entity is not None:
hierarchy.append(getattr(entity, 'name', repr(entity)))
if isinstance(entity, Namespace):
hierarchy.insert(0, ' in %s' % entity.source_file)
entity = getattr(entity, 'parent', None)
hierarchy.reverse()
return hierarchy | [
"def",
"_GetModelHierarchy",
"(",
"entity",
")",
":",
"hierarchy",
"=",
"[",
"]",
"while",
"entity",
"is",
"not",
"None",
":",
"hierarchy",
".",
"append",
"(",
"getattr",
"(",
"entity",
",",
"'name'",
",",
"repr",
"(",
"entity",
")",
")",
")",
"if",
... | Returns the hierarchy of the given model entity. | [
"Returns",
"the",
"hierarchy",
"of",
"the",
"given",
"model",
"entity",
"."
] | [
"\"\"\"Returns the hierarchy of the given model entity.\"\"\""
] | [
{
"param": "entity",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "entity",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d0c969f7b4a8d932a0b49281e5413f116f488709 | sunlongbo/chromium | tools/json_schema_compiler/model.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetTypes | <not_specific> | def _GetTypes(parent, json, namespace, origin):
"""Creates Type objects extracted from |json|.
"""
assert hasattr(namespace, 'manifest_keys'), \
'Types should be parsed after parsing manifest keys.'
types = OrderedDict()
for type_json in json.get('types', []):
type_ = Type(parent, type_json['id'], ty... | Creates Type objects extracted from |json|.
| Creates Type objects extracted from |json|. | [
"Creates",
"Type",
"objects",
"extracted",
"from",
"|json|",
"."
] | def _GetTypes(parent, json, namespace, origin):
assert hasattr(namespace, 'manifest_keys'), \
'Types should be parsed after parsing manifest keys.'
types = OrderedDict()
for type_json in json.get('types', []):
type_ = Type(parent, type_json['id'], type_json, namespace, origin)
types[type_.name] = type... | [
"def",
"_GetTypes",
"(",
"parent",
",",
"json",
",",
"namespace",
",",
"origin",
")",
":",
"assert",
"hasattr",
"(",
"namespace",
",",
"'manifest_keys'",
")",
",",
"'Types should be parsed after parsing manifest keys.'",
"types",
"=",
"OrderedDict",
"(",
")",
"for... | Creates Type objects extracted from |json|. | [
"Creates",
"Type",
"objects",
"extracted",
"from",
"|json|",
"."
] | [
"\"\"\"Creates Type objects extracted from |json|.\n \"\"\""
] | [
{
"param": "parent",
"type": null
},
{
"param": "json",
"type": null
},
{
"param": "namespace",
"type": null
},
{
"param": "origin",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "parent",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "json",
"type": null,
"docstring": null,
"docstring_tokens":... |
d0c969f7b4a8d932a0b49281e5413f116f488709 | sunlongbo/chromium | tools/json_schema_compiler/model.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetFunctions | <not_specific> | def _GetFunctions(parent, json, namespace):
"""Creates Function objects extracted from |json|.
"""
functions = OrderedDict()
for function_json in json.get('functions', []):
function = Function(parent,
function_json['name'],
function_json,
... | Creates Function objects extracted from |json|.
| Creates Function objects extracted from |json|. | [
"Creates",
"Function",
"objects",
"extracted",
"from",
"|json|",
"."
] | def _GetFunctions(parent, json, namespace):
functions = OrderedDict()
for function_json in json.get('functions', []):
function = Function(parent,
function_json['name'],
function_json,
namespace,
Origin(from_json=True... | [
"def",
"_GetFunctions",
"(",
"parent",
",",
"json",
",",
"namespace",
")",
":",
"functions",
"=",
"OrderedDict",
"(",
")",
"for",
"function_json",
"in",
"json",
".",
"get",
"(",
"'functions'",
",",
"[",
"]",
")",
":",
"function",
"=",
"Function",
"(",
... | Creates Function objects extracted from |json|. | [
"Creates",
"Function",
"objects",
"extracted",
"from",
"|json|",
"."
] | [
"\"\"\"Creates Function objects extracted from |json|.\n \"\"\""
] | [
{
"param": "parent",
"type": null
},
{
"param": "json",
"type": null
},
{
"param": "namespace",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "parent",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "json",
"type": null,
"docstring": null,
"docstring_tokens":... |
d0c969f7b4a8d932a0b49281e5413f116f488709 | sunlongbo/chromium | tools/json_schema_compiler/model.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetEvents | <not_specific> | def _GetEvents(parent, json, namespace):
"""Creates Function objects generated from the events in |json|.
"""
events = OrderedDict()
for event_json in json.get('events', []):
event = Function(parent,
event_json['name'],
event_json,
namespace,
... | Creates Function objects generated from the events in |json|.
| Creates Function objects generated from the events in |json|. | [
"Creates",
"Function",
"objects",
"generated",
"from",
"the",
"events",
"in",
"|json|",
"."
] | def _GetEvents(parent, json, namespace):
events = OrderedDict()
for event_json in json.get('events', []):
event = Function(parent,
event_json['name'],
event_json,
namespace,
Origin(from_client=True))
events[event.name] = eve... | [
"def",
"_GetEvents",
"(",
"parent",
",",
"json",
",",
"namespace",
")",
":",
"events",
"=",
"OrderedDict",
"(",
")",
"for",
"event_json",
"in",
"json",
".",
"get",
"(",
"'events'",
",",
"[",
"]",
")",
":",
"event",
"=",
"Function",
"(",
"parent",
","... | Creates Function objects generated from the events in |json|. | [
"Creates",
"Function",
"objects",
"generated",
"from",
"the",
"events",
"in",
"|json|",
"."
] | [
"\"\"\"Creates Function objects generated from the events in |json|.\n \"\"\""
] | [
{
"param": "parent",
"type": null
},
{
"param": "json",
"type": null
},
{
"param": "namespace",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "parent",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "json",
"type": null,
"docstring": null,
"docstring_tokens":... |
d0c969f7b4a8d932a0b49281e5413f116f488709 | sunlongbo/chromium | tools/json_schema_compiler/model.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetProperties | <not_specific> | def _GetProperties(parent, json, namespace, origin):
"""Generates Property objects extracted from |json|.
"""
properties = OrderedDict()
for name, property_json in json.get('properties', {}).items():
properties[name] = Property(parent, name, property_json, namespace, origin)
return properties | Generates Property objects extracted from |json|.
| Generates Property objects extracted from |json|. | [
"Generates",
"Property",
"objects",
"extracted",
"from",
"|json|",
"."
] | def _GetProperties(parent, json, namespace, origin):
properties = OrderedDict()
for name, property_json in json.get('properties', {}).items():
properties[name] = Property(parent, name, property_json, namespace, origin)
return properties | [
"def",
"_GetProperties",
"(",
"parent",
",",
"json",
",",
"namespace",
",",
"origin",
")",
":",
"properties",
"=",
"OrderedDict",
"(",
")",
"for",
"name",
",",
"property_json",
"in",
"json",
".",
"get",
"(",
"'properties'",
",",
"{",
"}",
")",
".",
"it... | Generates Property objects extracted from |json|. | [
"Generates",
"Property",
"objects",
"extracted",
"from",
"|json|",
"."
] | [
"\"\"\"Generates Property objects extracted from |json|.\n \"\"\""
] | [
{
"param": "parent",
"type": null
},
{
"param": "json",
"type": null
},
{
"param": "namespace",
"type": null
},
{
"param": "origin",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "parent",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "json",
"type": null,
"docstring": null,
"docstring_tokens":... |
d0c969f7b4a8d932a0b49281e5413f116f488709 | sunlongbo/chromium | tools/json_schema_compiler/model.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetManifestKeysType | <not_specific> | def _GetManifestKeysType(self, json):
# type: (OrderedDict) -> Type
"""Returns the Type for manifest keys parsing, or None if there are no
manifest keys in this namespace.
"""
if not json.get('manifest_keys'):
return None
# Create a dummy object to parse "manifest_keys" as a type.
manifest_keys_type ... | Returns the Type for manifest keys parsing, or None if there are no
manifest keys in this namespace.
| Returns the Type for manifest keys parsing, or None if there are no
manifest keys in this namespace. | [
"Returns",
"the",
"Type",
"for",
"manifest",
"keys",
"parsing",
"or",
"None",
"if",
"there",
"are",
"no",
"manifest",
"keys",
"in",
"this",
"namespace",
"."
] | def _GetManifestKeysType(self, json):
if not json.get('manifest_keys'):
return None
manifest_keys_type = {
'type': 'object',
'properties': json['manifest_keys'],
}
return Type(self, 'ManifestKeys', manifest_keys_type, self,
Origin(from_manifest_keys=True)) | [
"def",
"_GetManifestKeysType",
"(",
"self",
",",
"json",
")",
":",
"if",
"not",
"json",
".",
"get",
"(",
"'manifest_keys'",
")",
":",
"return",
"None",
"manifest_keys_type",
"=",
"{",
"'type'",
":",
"'object'",
",",
"'properties'",
":",
"json",
"[",
"'mani... | Returns the Type for manifest keys parsing, or None if there are no
manifest keys in this namespace. | [
"Returns",
"the",
"Type",
"for",
"manifest",
"keys",
"parsing",
"or",
"None",
"if",
"there",
"are",
"no",
"manifest",
"keys",
"in",
"this",
"namespace",
"."
] | [
"# type: (OrderedDict) -> Type",
"\"\"\"Returns the Type for manifest keys parsing, or None if there are no\n manifest keys in this namespace.\n \"\"\"",
"# Create a dummy object to parse \"manifest_keys\" as a type."
] | [
{
"param": "self",
"type": null
},
{
"param": "json",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "json",
"type": null,
"docstring": null,
"docstring_tokens": [... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.