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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b3f285f7b84beac3c459bce9f2d58f2ff26b251e | sunlongbo/chromium | gpu/command_buffer/build_cmd_buffer_lib.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteGLES2InterfaceStubImpl | null | def WriteGLES2InterfaceStubImpl(self, filename):
"""Writes the GLES2 interface header."""
comment = "// This file is included by gles2_interface_stub.cc.\n"
with CHeaderWriter(filename, self.year, comment) as f:
for func in self.original_functions:
func.WriteGLES2InterfaceStubImpl(f)
self.... | Writes the GLES2 interface header. | Writes the GLES2 interface header. | [
"Writes",
"the",
"GLES2",
"interface",
"header",
"."
] | def WriteGLES2InterfaceStubImpl(self, filename):
comment = "// This file is included by gles2_interface_stub.cc.\n"
with CHeaderWriter(filename, self.year, comment) as f:
for func in self.original_functions:
func.WriteGLES2InterfaceStubImpl(f)
self.generated_cpp_filenames.append(filename) | [
"def",
"WriteGLES2InterfaceStubImpl",
"(",
"self",
",",
"filename",
")",
":",
"comment",
"=",
"\"// This file is included by gles2_interface_stub.cc.\\n\"",
"with",
"CHeaderWriter",
"(",
"filename",
",",
"self",
".",
"year",
",",
"comment",
")",
"as",
"f",
":",
"for... | Writes the GLES2 interface header. | [
"Writes",
"the",
"GLES2",
"interface",
"header",
"."
] | [
"\"\"\"Writes the GLES2 interface header.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
b3f285f7b84beac3c459bce9f2d58f2ff26b251e | sunlongbo/chromium | gpu/command_buffer/build_cmd_buffer_lib.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteGLES2ImplementationHeader | null | def WriteGLES2ImplementationHeader(self, filename):
"""Writes the GLES2 Implementation header."""
comment = \
("// This file is included by %s_implementation.h to declare the\n"
"// GL api functions.\n" % _lower_prefix)
with CHeaderWriter(filename, self.year, comment) as f:
for func in se... | Writes the GLES2 Implementation header. | Writes the GLES2 Implementation header. | [
"Writes",
"the",
"GLES2",
"Implementation",
"header",
"."
] | def WriteGLES2ImplementationHeader(self, filename):
comment = \
("// This file is included by %s_implementation.h to declare the\n"
"// GL api functions.\n" % _lower_prefix)
with CHeaderWriter(filename, self.year, comment) as f:
for func in self.original_functions:
func.WriteGLES2Impl... | [
"def",
"WriteGLES2ImplementationHeader",
"(",
"self",
",",
"filename",
")",
":",
"comment",
"=",
"(",
"\"// This file is included by %s_implementation.h to declare the\\n\"",
"\"// GL api functions.\\n\"",
"%",
"_lower_prefix",
")",
"with",
"CHeaderWriter",
"(",
"filename",
"... | Writes the GLES2 Implementation header. | [
"Writes",
"the",
"GLES2",
"Implementation",
"header",
"."
] | [
"\"\"\"Writes the GLES2 Implementation header.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
b3f285f7b84beac3c459bce9f2d58f2ff26b251e | sunlongbo/chromium | gpu/command_buffer/build_cmd_buffer_lib.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteGLES2TraceImplementationHeader | null | def WriteGLES2TraceImplementationHeader(self, filename):
"""Writes the GLES2 Trace Implementation header."""
comment = "// This file is included by gles2_trace_implementation.h\n"
with CHeaderWriter(filename, self.year, comment) as f:
for func in self.original_functions:
func.WriteGLES2TraceIm... | Writes the GLES2 Trace Implementation header. | Writes the GLES2 Trace Implementation header. | [
"Writes",
"the",
"GLES2",
"Trace",
"Implementation",
"header",
"."
] | def WriteGLES2TraceImplementationHeader(self, filename):
comment = "// This file is included by gles2_trace_implementation.h\n"
with CHeaderWriter(filename, self.year, comment) as f:
for func in self.original_functions:
func.WriteGLES2TraceImplementationHeader(f)
self.generated_cpp_filenames.a... | [
"def",
"WriteGLES2TraceImplementationHeader",
"(",
"self",
",",
"filename",
")",
":",
"comment",
"=",
"\"// This file is included by gles2_trace_implementation.h\\n\"",
"with",
"CHeaderWriter",
"(",
"filename",
",",
"self",
".",
"year",
",",
"comment",
")",
"as",
"f",
... | Writes the GLES2 Trace Implementation header. | [
"Writes",
"the",
"GLES2",
"Trace",
"Implementation",
"header",
"."
] | [
"\"\"\"Writes the GLES2 Trace Implementation header.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
b3f285f7b84beac3c459bce9f2d58f2ff26b251e | sunlongbo/chromium | gpu/command_buffer/build_cmd_buffer_lib.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteGLES2TraceImplementation | null | def WriteGLES2TraceImplementation(self, filename):
"""Writes the GLES2 Trace Implementation."""
comment = "// This file is included by gles2_trace_implementation.cc\n"
with CHeaderWriter(filename, self.year, comment) as f:
for func in self.original_functions:
func.WriteGLES2TraceImplementation... | Writes the GLES2 Trace Implementation. | Writes the GLES2 Trace Implementation. | [
"Writes",
"the",
"GLES2",
"Trace",
"Implementation",
"."
] | def WriteGLES2TraceImplementation(self, filename):
comment = "// This file is included by gles2_trace_implementation.cc\n"
with CHeaderWriter(filename, self.year, comment) as f:
for func in self.original_functions:
func.WriteGLES2TraceImplementation(f)
self.generated_cpp_filenames.append(filen... | [
"def",
"WriteGLES2TraceImplementation",
"(",
"self",
",",
"filename",
")",
":",
"comment",
"=",
"\"// This file is included by gles2_trace_implementation.cc\\n\"",
"with",
"CHeaderWriter",
"(",
"filename",
",",
"self",
".",
"year",
",",
"comment",
")",
"as",
"f",
":",... | Writes the GLES2 Trace Implementation. | [
"Writes",
"the",
"GLES2",
"Trace",
"Implementation",
"."
] | [
"\"\"\"Writes the GLES2 Trace Implementation.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
b3f285f7b84beac3c459bce9f2d58f2ff26b251e | sunlongbo/chromium | gpu/command_buffer/build_cmd_buffer_lib.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteGLES2ImplementationUnitTests | null | def WriteGLES2ImplementationUnitTests(self, filename):
"""Writes the GLES2 helper header."""
comment = \
("// This file is included by %s_implementation.h to declare the\n"
"// GL api functions.\n" % _lower_prefix)
with CHeaderWriter(filename, self.year, comment) as f:
for func in self.or... | Writes the GLES2 helper header. | Writes the GLES2 helper header. | [
"Writes",
"the",
"GLES2",
"helper",
"header",
"."
] | def WriteGLES2ImplementationUnitTests(self, filename):
comment = \
("// This file is included by %s_implementation.h to declare the\n"
"// GL api functions.\n" % _lower_prefix)
with CHeaderWriter(filename, self.year, comment) as f:
for func in self.original_functions:
func.WriteGLES2I... | [
"def",
"WriteGLES2ImplementationUnitTests",
"(",
"self",
",",
"filename",
")",
":",
"comment",
"=",
"(",
"\"// This file is included by %s_implementation.h to declare the\\n\"",
"\"// GL api functions.\\n\"",
"%",
"_lower_prefix",
")",
"with",
"CHeaderWriter",
"(",
"filename",
... | Writes the GLES2 helper header. | [
"Writes",
"the",
"GLES2",
"helper",
"header",
"."
] | [
"\"\"\"Writes the GLES2 helper header.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
b3f285f7b84beac3c459bce9f2d58f2ff26b251e | sunlongbo/chromium | gpu/command_buffer/build_cmd_buffer_lib.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteServiceUtilsHeader | null | def WriteServiceUtilsHeader(self, filename):
"""Writes the gles2 auto generated utility header."""
with CHeaderWriter(filename, self.year) as f:
for name in sorted(self.named_type_info.keys()):
named_type = NamedType(self.named_type_info[name])
if not named_type.CreateValidator():
... | Writes the gles2 auto generated utility header. | Writes the gles2 auto generated utility header. | [
"Writes",
"the",
"gles2",
"auto",
"generated",
"utility",
"header",
"."
] | def WriteServiceUtilsHeader(self, filename):
with CHeaderWriter(filename, self.year) as f:
for name in sorted(self.named_type_info.keys()):
named_type = NamedType(self.named_type_info[name])
if not named_type.CreateValidator():
continue
class_name = ValidatorClassName(name)
... | [
"def",
"WriteServiceUtilsHeader",
"(",
"self",
",",
"filename",
")",
":",
"with",
"CHeaderWriter",
"(",
"filename",
",",
"self",
".",
"year",
")",
"as",
"f",
":",
"for",
"name",
"in",
"sorted",
"(",
"self",
".",
"named_type_info",
".",
"keys",
"(",
")",
... | Writes the gles2 auto generated utility header. | [
"Writes",
"the",
"gles2",
"auto",
"generated",
"utility",
"header",
"."
] | [
"\"\"\"Writes the gles2 auto generated utility header.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
b3f285f7b84beac3c459bce9f2d58f2ff26b251e | sunlongbo/chromium | gpu/command_buffer/build_cmd_buffer_lib.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteServiceUtilsImplementation | null | def WriteServiceUtilsImplementation(self, filename):
"""Writes the gles2 auto generated utility implementation."""
with CHeaderWriter(filename, self.year) as f:
names = sorted(self.named_type_info.keys())
for name in names:
named_type = NamedType(self.named_type_info[name])
class_nam... | Writes the gles2 auto generated utility implementation. | Writes the gles2 auto generated utility implementation. | [
"Writes",
"the",
"gles2",
"auto",
"generated",
"utility",
"implementation",
"."
] | def WriteServiceUtilsImplementation(self, filename):
with CHeaderWriter(filename, self.year) as f:
names = sorted(self.named_type_info.keys())
for name in names:
named_type = NamedType(self.named_type_info[name])
class_name = ValidatorClassName(name)
if not named_type.CreateValid... | [
"def",
"WriteServiceUtilsImplementation",
"(",
"self",
",",
"filename",
")",
":",
"with",
"CHeaderWriter",
"(",
"filename",
",",
"self",
".",
"year",
")",
"as",
"f",
":",
"names",
"=",
"sorted",
"(",
"self",
".",
"named_type_info",
".",
"keys",
"(",
")",
... | Writes the gles2 auto generated utility implementation. | [
"Writes",
"the",
"gles2",
"auto",
"generated",
"utility",
"implementation",
"."
] | [
"\"\"\"Writes the gles2 auto generated utility implementation.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
b3f285f7b84beac3c459bce9f2d58f2ff26b251e | sunlongbo/chromium | gpu/command_buffer/build_cmd_buffer_lib.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteCommonUtilsHeader | null | def WriteCommonUtilsHeader(self, filename):
"""Writes the gles2 common utility header."""
with CHeaderWriter(filename, self.year) as f:
type_infos = sorted(self.named_type_info.keys())
for type_info in type_infos:
if self.named_type_info[type_info]['type'] == 'GLenum':
f.write("sta... | Writes the gles2 common utility header. | Writes the gles2 common utility header. | [
"Writes",
"the",
"gles2",
"common",
"utility",
"header",
"."
] | def WriteCommonUtilsHeader(self, filename):
with CHeaderWriter(filename, self.year) as f:
type_infos = sorted(self.named_type_info.keys())
for type_info in type_infos:
if self.named_type_info[type_info]['type'] == 'GLenum':
f.write("static std::string GetString%s(uint32_t value);\n" %
... | [
"def",
"WriteCommonUtilsHeader",
"(",
"self",
",",
"filename",
")",
":",
"with",
"CHeaderWriter",
"(",
"filename",
",",
"self",
".",
"year",
")",
"as",
"f",
":",
"type_infos",
"=",
"sorted",
"(",
"self",
".",
"named_type_info",
".",
"keys",
"(",
")",
")"... | Writes the gles2 common utility header. | [
"Writes",
"the",
"gles2",
"common",
"utility",
"header",
"."
] | [
"\"\"\"Writes the gles2 common utility header.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
b3f285f7b84beac3c459bce9f2d58f2ff26b251e | sunlongbo/chromium | gpu/command_buffer/build_cmd_buffer_lib.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteCommonUtilsImpl | null | def WriteCommonUtilsImpl(self, filename):
"""Writes the gles2 common utility header."""
enum_re = re.compile(r'\#define\s+(GL_[a-zA-Z0-9_]+)\s+([0-9A-Fa-fx]+)')
define_dict = {}
for fname in ['third_party/khronos/GLES2/gl2.h',
'third_party/khronos/GLES2/gl2ext.h',
'th... | Writes the gles2 common utility header. | Writes the gles2 common utility header. | [
"Writes",
"the",
"gles2",
"common",
"utility",
"header",
"."
] | def WriteCommonUtilsImpl(self, filename):
enum_re = re.compile(r'\#define\s+(GL_[a-zA-Z0-9_]+)\s+([0-9A-Fa-fx]+)')
define_dict = {}
for fname in ['third_party/khronos/GLES2/gl2.h',
'third_party/khronos/GLES2/gl2ext.h',
'third_party/khronos/GLES3/gl3.h',
... | [
"def",
"WriteCommonUtilsImpl",
"(",
"self",
",",
"filename",
")",
":",
"enum_re",
"=",
"re",
".",
"compile",
"(",
"r'\\#define\\s+(GL_[a-zA-Z0-9_]+)\\s+([0-9A-Fa-fx]+)'",
")",
"define_dict",
"=",
"{",
"}",
"for",
"fname",
"in",
"[",
"'third_party/khronos/GLES2/gl2.h'"... | Writes the gles2 common utility header. | [
"Writes",
"the",
"gles2",
"common",
"utility",
"header",
"."
] | [
"\"\"\"Writes the gles2 common utility header.\"\"\"",
"# check our own _CHROMIUM macro conflicts with khronos GL headers."
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
b3f285f7b84beac3c459bce9f2d58f2ff26b251e | sunlongbo/chromium | gpu/command_buffer/build_cmd_buffer_lib.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WritePepperGLES2Interface | null | def WritePepperGLES2Interface(self, filename, dev):
"""Writes the Pepper OpenGLES interface definition."""
with CWriter(filename, self.year) as f:
f.write("label Chrome {\n")
f.write(" M39 = 1.0\n")
f.write("};\n\n")
if not dev:
# Declare GL types.
f.write("[version=1.0... | Writes the Pepper OpenGLES interface definition. | Writes the Pepper OpenGLES interface definition. | [
"Writes",
"the",
"Pepper",
"OpenGLES",
"interface",
"definition",
"."
] | def WritePepperGLES2Interface(self, filename, dev):
with CWriter(filename, self.year) as f:
f.write("label Chrome {\n")
f.write(" M39 = 1.0\n")
f.write("};\n\n")
if not dev:
f.write("[version=1.0]\n")
f.write("describe {\n")
for gltype in ['GLbitfield', 'GLboolean', ... | [
"def",
"WritePepperGLES2Interface",
"(",
"self",
",",
"filename",
",",
"dev",
")",
":",
"with",
"CWriter",
"(",
"filename",
",",
"self",
".",
"year",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"\"label Chrome {\\n\"",
")",
"f",
".",
"write",
"(",
"\"... | Writes the Pepper OpenGLES interface definition. | [
"Writes",
"the",
"Pepper",
"OpenGLES",
"interface",
"definition",
"."
] | [
"\"\"\"Writes the Pepper OpenGLES interface definition.\"\"\"",
"# Declare GL types.",
"# C level typedefs.",
"# Historically, we provide OpenGLES2 interfaces with struct",
"# namespace. Not to break code which uses the interface as",
"# \"struct OpenGLES2\", we put it in struct namespace."
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
},
{
"param": "dev",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
b3f285f7b84beac3c459bce9f2d58f2ff26b251e | sunlongbo/chromium | gpu/command_buffer/build_cmd_buffer_lib.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WritePepperGLES2Implementation | null | def WritePepperGLES2Implementation(self, filename):
"""Writes the Pepper OpenGLES interface implementation."""
with CWriter(filename, self.year) as f:
f.write("#include \"ppapi/shared_impl/ppb_opengles2_shared.h\"\n\n")
f.write("#include \"base/logging.h\"\n")
f.write("#include \"gpu/command_b... | Writes the Pepper OpenGLES interface implementation. | Writes the Pepper OpenGLES interface implementation. | [
"Writes",
"the",
"Pepper",
"OpenGLES",
"interface",
"implementation",
"."
] | def WritePepperGLES2Implementation(self, filename):
with CWriter(filename, self.year) as f:
f.write("#include \"ppapi/shared_impl/ppb_opengles2_shared.h\"\n\n")
f.write("#include \"base/logging.h\"\n")
f.write("#include \"gpu/command_buffer/client/gles2_implementation.h\"\n")
f.write("#inclu... | [
"def",
"WritePepperGLES2Implementation",
"(",
"self",
",",
"filename",
")",
":",
"with",
"CWriter",
"(",
"filename",
",",
"self",
".",
"year",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"\"#include \\\"ppapi/shared_impl/ppb_opengles2_shared.h\\\"\\n\\n\"",
")",
... | Writes the Pepper OpenGLES interface implementation. | [
"Writes",
"the",
"Pepper",
"OpenGLES",
"interface",
"implementation",
"."
] | [
"\"\"\"Writes the Pepper OpenGLES interface implementation.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
b3f285f7b84beac3c459bce9f2d58f2ff26b251e | sunlongbo/chromium | gpu/command_buffer/build_cmd_buffer_lib.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WriteGLES2ToPPAPIBridge | null | def WriteGLES2ToPPAPIBridge(self, filename):
"""Connects GLES2 helper library to PPB_OpenGLES2 interface"""
with CWriter(filename, self.year) as f:
f.write("#ifndef GL_GLEXT_PROTOTYPES\n")
f.write("#define GL_GLEXT_PROTOTYPES\n")
f.write("#endif\n")
f.write("#include <GLES2/gl2.h>\n")
... | Connects GLES2 helper library to PPB_OpenGLES2 interface | Connects GLES2 helper library to PPB_OpenGLES2 interface | [
"Connects",
"GLES2",
"helper",
"library",
"to",
"PPB_OpenGLES2",
"interface"
] | def WriteGLES2ToPPAPIBridge(self, filename):
with CWriter(filename, self.year) as f:
f.write("#ifndef GL_GLEXT_PROTOTYPES\n")
f.write("#define GL_GLEXT_PROTOTYPES\n")
f.write("#endif\n")
f.write("#include <GLES2/gl2.h>\n")
f.write("#include <GLES2/gl2ext.h>\n")
f.write("#include ... | [
"def",
"WriteGLES2ToPPAPIBridge",
"(",
"self",
",",
"filename",
")",
":",
"with",
"CWriter",
"(",
"filename",
",",
"self",
".",
"year",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"\"#ifndef GL_GLEXT_PROTOTYPES\\n\"",
")",
"f",
".",
"write",
"(",
"\"#defi... | Connects GLES2 helper library to PPB_OpenGLES2 interface | [
"Connects",
"GLES2",
"helper",
"library",
"to",
"PPB_OpenGLES2",
"interface"
] | [
"\"\"\"Connects GLES2 helper library to PPB_OpenGLES2 interface\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
b3f285f7b84beac3c459bce9f2d58f2ff26b251e | sunlongbo/chromium | gpu/command_buffer/build_cmd_buffer_lib.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | Format | null | def Format(generated_files, output_dir, chromium_root_dir):
"""Format generated_files relative to output_dir using clang-format."""
formatter = "third_party/depot_tools/clang-format"
if platform.system() == "Windows":
formatter = "third_party\\depot_tools\\clang-format.bat"
formatter = os.path.join(chromium... | Format generated_files relative to output_dir using clang-format. | Format generated_files relative to output_dir using clang-format. | [
"Format",
"generated_files",
"relative",
"to",
"output_dir",
"using",
"clang",
"-",
"format",
"."
] | def Format(generated_files, output_dir, chromium_root_dir):
formatter = "third_party/depot_tools/clang-format"
if platform.system() == "Windows":
formatter = "third_party\\depot_tools\\clang-format.bat"
formatter = os.path.join(chromium_root_dir, formatter)
generated_files = map(lambda filename: os.path.joi... | [
"def",
"Format",
"(",
"generated_files",
",",
"output_dir",
",",
"chromium_root_dir",
")",
":",
"formatter",
"=",
"\"third_party/depot_tools/clang-format\"",
"if",
"platform",
".",
"system",
"(",
")",
"==",
"\"Windows\"",
":",
"formatter",
"=",
"\"third_party\\\\depot... | Format generated_files relative to output_dir using clang-format. | [
"Format",
"generated_files",
"relative",
"to",
"output_dir",
"using",
"clang",
"-",
"format",
"."
] | [
"\"\"\"Format generated_files relative to output_dir using clang-format.\"\"\""
] | [
{
"param": "generated_files",
"type": null
},
{
"param": "output_dir",
"type": null
},
{
"param": "chromium_root_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "generated_files",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output_dir",
"type": null,
"docstring": null,
"doc... |
044d94a5a3ebf02e635a2c40d2d4ed5d8c93fc60 | sunlongbo/chromium | testing/chromoting/chromoting_test_driver_launcher.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | LaunchCTDCommand | <not_specific> | def LaunchCTDCommand(args, command):
"""Launches the specified chromoting test driver command.
Args:
args: Command line args, used for test-case startup tasks.
command: Chromoting Test Driver command line.
Returns:
command, host_log_file_names: Tuple of:
"command" if there was a test-environment ... | Launches the specified chromoting test driver command.
Args:
args: Command line args, used for test-case startup tasks.
command: Chromoting Test Driver command line.
Returns:
command, host_log_file_names: Tuple of:
"command" if there was a test-environment failure, or any failing test, and
list... | Launches the specified chromoting test driver command. | [
"Launches",
"the",
"specified",
"chromoting",
"test",
"driver",
"command",
"."
] | def LaunchCTDCommand(args, command):
host_log_file_names = []
host_log_file_names.append(TestCaseSetup(args))
host_jid = GetJidFromHostLog(host_log_file_names[-1])
if not host_jid:
print('Host-JID not found in log %s.' % host_log_file_names[-1])
return '[Command failed]: %s, %s' % (command, host_log_fil... | [
"def",
"LaunchCTDCommand",
"(",
"args",
",",
"command",
")",
":",
"host_log_file_names",
"=",
"[",
"]",
"host_log_file_names",
".",
"append",
"(",
"TestCaseSetup",
"(",
"args",
")",
")",
"host_jid",
"=",
"GetJidFromHostLog",
"(",
"host_log_file_names",
"[",
"-",... | Launches the specified chromoting test driver command. | [
"Launches",
"the",
"specified",
"chromoting",
"test",
"driver",
"command",
"."
] | [
"\"\"\"Launches the specified chromoting test driver command.\n\n Args:\n args: Command line args, used for test-case startup tasks.\n command: Chromoting Test Driver command line.\n Returns:\n command, host_log_file_names: Tuple of:\n \"command\" if there was a test-environment failure, or any failin... | [
{
"param": "args",
"type": null
},
{
"param": "command",
"type": null
}
] | {
"returns": [
{
"docstring": "command, host_log_file_names: Tuple of:\n\"command\" if there was a test-environment failure, or any failing test, and\nlist of host-log file-names.",
"docstring_tokens": [
"command",
"host_log_file_names",
":",
"Tuple",
"of",
... |
ff4ad496fce32919d2a95b932c6c7d160b7ce2ed | sunlongbo/chromium | third_party/tensorflow-text/src/tensorflow_text/python/ops/wordshape_ops.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _emoji_regex | <not_specific> | def _emoji_regex():
"""Returns regexp to detect emoji characters.
Generated from https://unicode.org/emoji/charts/full-emoji-list.html,
https://unicode.org/Public/emoji/13.0/emoji-sequences.txt.
"""
char_class = "".join([
"[",
u"\u203c", u"\u2049", u"\u2139",
u"\u2194", "-", u"\u2199",
... | Returns regexp to detect emoji characters.
Generated from https://unicode.org/emoji/charts/full-emoji-list.html,
https://unicode.org/Public/emoji/13.0/emoji-sequences.txt.
| Returns regexp to detect emoji characters. | [
"Returns",
"regexp",
"to",
"detect",
"emoji",
"characters",
"."
] | def _emoji_regex():
char_class = "".join([
"[",
u"\u203c", u"\u2049", u"\u2139",
u"\u2194", "-", u"\u2199",
u"\u21a9", u"\u21aa",
u"\u231a", u"\u231b",
u"\u2328", u"\u23cf",
u"\u23e9", "-", u"\u23f3",
u"\u23f8", "-", u"\u23fa",
u"\u24c2", u"\u25aa", u"\u25ab"
... | [
"def",
"_emoji_regex",
"(",
")",
":",
"char_class",
"=",
"\"\"",
".",
"join",
"(",
"[",
"\"[\"",
",",
"u\"\\u203c\"",
",",
"u\"\\u2049\"",
",",
"u\"\\u2139\"",
",",
"u\"\\u2194\"",
",",
"\"-\"",
",",
"u\"\\u2199\"",
",",
"u\"\\u21a9\"",
",",
"u\"\\u21aa\"",
... | Returns regexp to detect emoji characters. | [
"Returns",
"regexp",
"to",
"detect",
"emoji",
"characters",
"."
] | [
"\"\"\"Returns regexp to detect emoji characters.\n\n Generated from https://unicode.org/emoji/charts/full-emoji-list.html,\n https://unicode.org/Public/emoji/13.0/emoji-sequences.txt.\n \"\"\"",
"# pyformat:disable"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
ff4ad496fce32919d2a95b932c6c7d160b7ce2ed | sunlongbo/chromium | third_party/tensorflow-text/src/tensorflow_text/python/ops/wordshape_ops.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | wordshape | <not_specific> | def wordshape(input_tensor, pattern, name=None):
"""Determine wordshape features for each input string.
Args:
input_tensor: string `Tensor` with any shape.
pattern: A `tftext.WordShape` or a list of WordShapes.
name: A name for the operation (optional).
Returns:
`<bool>[input_tensor.shape + patt... | Determine wordshape features for each input string.
Args:
input_tensor: string `Tensor` with any shape.
pattern: A `tftext.WordShape` or a list of WordShapes.
name: A name for the operation (optional).
Returns:
`<bool>[input_tensor.shape + pattern.shape]`: A tensor where
`result[i1...iN, j]`... | Determine wordshape features for each input string. | [
"Determine",
"wordshape",
"features",
"for",
"each",
"input",
"string",
"."
] | def wordshape(input_tensor, pattern, name=None):
if isinstance(pattern, WordShape):
return string_ops.regex_full_match(input_tensor, pattern.value, name)
elif (isinstance(pattern, (list, tuple)) and
all(isinstance(s, WordShape) for s in pattern)):
with ops.name_scope(name, "Wordshape", input_tensor)... | [
"def",
"wordshape",
"(",
"input_tensor",
",",
"pattern",
",",
"name",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"pattern",
",",
"WordShape",
")",
":",
"return",
"string_ops",
".",
"regex_full_match",
"(",
"input_tensor",
",",
"pattern",
".",
"value",
... | Determine wordshape features for each input string. | [
"Determine",
"wordshape",
"features",
"for",
"each",
"input",
"string",
"."
] | [
"\"\"\"Determine wordshape features for each input string.\n\n Args:\n input_tensor: string `Tensor` with any shape.\n pattern: A `tftext.WordShape` or a list of WordShapes.\n name: A name for the operation (optional).\n\n Returns:\n `<bool>[input_tensor.shape + pattern.shape]`: A tensor where\n ... | [
{
"param": "input_tensor",
"type": null
},
{
"param": "pattern",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [
{
"docstring": "`[input_tensor.shape + pattern.shape]`: A tensor where\n`result[i1...iN, j]` is true if `input_tensor[i1...iN]` has the wordshape\nspecified by `pattern[j]`.",
"docstring_tokens": [
"`",
"[",
"input_tensor",
".",
"shape",
"... |
ff5753a2911439f4c7f54274845b431e789d000f | sunlongbo/chromium | mojo/public/tools/mojom/mojom/fileutil_unittest.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testEnsureDirectoryExists | null | def testEnsureDirectoryExists(self):
"""Test that EnsureDirectoryExists fuctions correctly."""
temp_dir = tempfile.mkdtemp()
try:
self.assertTrue(os.path.exists(temp_dir))
# Directory does not exist, yet.
full = os.path.join(temp_dir, "foo", "bar")
self.assertFalse(os.path.exists(f... | Test that EnsureDirectoryExists fuctions correctly. | Test that EnsureDirectoryExists fuctions correctly. | [
"Test",
"that",
"EnsureDirectoryExists",
"fuctions",
"correctly",
"."
] | def testEnsureDirectoryExists(self):
temp_dir = tempfile.mkdtemp()
try:
self.assertTrue(os.path.exists(temp_dir))
full = os.path.join(temp_dir, "foo", "bar")
self.assertFalse(os.path.exists(full))
fileutil.EnsureDirectoryExists(full)
self.assertTrue(os.path.exists(full))
file... | [
"def",
"testEnsureDirectoryExists",
"(",
"self",
")",
":",
"temp_dir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"try",
":",
"self",
".",
"assertTrue",
"(",
"os",
".",
"path",
".",
"exists",
"(",
"temp_dir",
")",
")",
"full",
"=",
"os",
".",
"path",
... | Test that EnsureDirectoryExists fuctions correctly. | [
"Test",
"that",
"EnsureDirectoryExists",
"fuctions",
"correctly",
"."
] | [
"\"\"\"Test that EnsureDirectoryExists fuctions correctly.\"\"\"",
"# Directory does not exist, yet.",
"# Create the directory.",
"# Trying to create it again does not cause an error.",
"# Bypass check for directory existence to tickle error handling that",
"# occurs in response to a race."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ff7bdfd167017c6ae5bfee46d106b4bea14c5bf8 | sunlongbo/chromium | ppapi/generators/idl_thunk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _StripFileName | <not_specific> | def _StripFileName(filenode):
"""Strips path and dev, trusted, and private suffixes from the file name."""
api_basename = _GetBaseFileName(filenode)
if api_basename.endswith('_dev'):
api_basename = api_basename[:-len('_dev')]
if api_basename.endswith('_trusted'):
api_basename = api_basename[:-len('_tru... | Strips path and dev, trusted, and private suffixes from the file name. | Strips path and dev, trusted, and private suffixes from the file name. | [
"Strips",
"path",
"and",
"dev",
"trusted",
"and",
"private",
"suffixes",
"from",
"the",
"file",
"name",
"."
] | def _StripFileName(filenode):
api_basename = _GetBaseFileName(filenode)
if api_basename.endswith('_dev'):
api_basename = api_basename[:-len('_dev')]
if api_basename.endswith('_trusted'):
api_basename = api_basename[:-len('_trusted')]
if api_basename.endswith('_private'):
api_basename = api_basename[... | [
"def",
"_StripFileName",
"(",
"filenode",
")",
":",
"api_basename",
"=",
"_GetBaseFileName",
"(",
"filenode",
")",
"if",
"api_basename",
".",
"endswith",
"(",
"'_dev'",
")",
":",
"api_basename",
"=",
"api_basename",
"[",
":",
"-",
"len",
"(",
"'_dev'",
")",
... | Strips path and dev, trusted, and private suffixes from the file name. | [
"Strips",
"path",
"and",
"dev",
"trusted",
"and",
"private",
"suffixes",
"from",
"the",
"file",
"name",
"."
] | [
"\"\"\"Strips path and dev, trusted, and private suffixes from the file name.\"\"\""
] | [
{
"param": "filenode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filenode",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ff7bdfd167017c6ae5bfee46d106b4bea14c5bf8 | sunlongbo/chromium | ppapi/generators/idl_thunk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _StripApiName | <not_specific> | def _StripApiName(api_name):
"""Strips Dev, Private, and Trusted suffixes from the API name."""
if api_name.endswith('Trusted'):
api_name = api_name[:-len('Trusted')]
if api_name.endswith('_Dev'):
api_name = api_name[:-len('_Dev')]
if api_name.endswith('_Private'):
api_name = api_name[:-len('_Privat... | Strips Dev, Private, and Trusted suffixes from the API name. | Strips Dev, Private, and Trusted suffixes from the API name. | [
"Strips",
"Dev",
"Private",
"and",
"Trusted",
"suffixes",
"from",
"the",
"API",
"name",
"."
] | def _StripApiName(api_name):
if api_name.endswith('Trusted'):
api_name = api_name[:-len('Trusted')]
if api_name.endswith('_Dev'):
api_name = api_name[:-len('_Dev')]
if api_name.endswith('_Private'):
api_name = api_name[:-len('_Private')]
return api_name | [
"def",
"_StripApiName",
"(",
"api_name",
")",
":",
"if",
"api_name",
".",
"endswith",
"(",
"'Trusted'",
")",
":",
"api_name",
"=",
"api_name",
"[",
":",
"-",
"len",
"(",
"'Trusted'",
")",
"]",
"if",
"api_name",
".",
"endswith",
"(",
"'_Dev'",
")",
":",... | Strips Dev, Private, and Trusted suffixes from the API name. | [
"Strips",
"Dev",
"Private",
"and",
"Trusted",
"suffixes",
"from",
"the",
"API",
"name",
"."
] | [
"\"\"\"Strips Dev, Private, and Trusted suffixes from the API name.\"\"\""
] | [
{
"param": "api_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "api_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ff7bdfd167017c6ae5bfee46d106b4bea14c5bf8 | sunlongbo/chromium | ppapi/generators/idl_thunk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _MakeEnterLine | <not_specific> | def _MakeEnterLine(filenode, interface, member, arg, handle_errors, callback,
meta):
"""Returns an EnterInstance/EnterResource string for a function."""
api_name = _StripApiName(interface.GetName()) + '_API'
if member.GetProperty('api'): # Override API name.
manually_provided_api = True
... | Returns an EnterInstance/EnterResource string for a function. | Returns an EnterInstance/EnterResource string for a function. | [
"Returns",
"an",
"EnterInstance",
"/",
"EnterResource",
"string",
"for",
"a",
"function",
"."
] | def _MakeEnterLine(filenode, interface, member, arg, handle_errors, callback,
meta):
api_name = _StripApiName(interface.GetName()) + '_API'
if member.GetProperty('api'):
manually_provided_api = True
api_name = member.GetProperty('api')
else:
manually_provided_api = False
if arg[... | [
"def",
"_MakeEnterLine",
"(",
"filenode",
",",
"interface",
",",
"member",
",",
"arg",
",",
"handle_errors",
",",
"callback",
",",
"meta",
")",
":",
"api_name",
"=",
"_StripApiName",
"(",
"interface",
".",
"GetName",
"(",
")",
")",
"+",
"'_API'",
"if",
"... | Returns an EnterInstance/EnterResource string for a function. | [
"Returns",
"an",
"EnterInstance",
"/",
"EnterResource",
"string",
"for",
"a",
"function",
"."
] | [
"\"\"\"Returns an EnterInstance/EnterResource string for a function.\"\"\"",
"# Override API name.",
"# TODO(teravest): Automatically guess the API header file."
] | [
{
"param": "filenode",
"type": null
},
{
"param": "interface",
"type": null
},
{
"param": "member",
"type": null
},
{
"param": "arg",
"type": null
},
{
"param": "handle_errors",
"type": null
},
{
"param": "callback",
"type": null
},
{
"para... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filenode",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "interface",
"type": null,
"docstring": null,
"docstring_t... |
ff7bdfd167017c6ae5bfee46d106b4bea14c5bf8 | sunlongbo/chromium | ppapi/generators/idl_thunk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _IsTypeCheck | <not_specific> | def _IsTypeCheck(interface, node, args):
"""Returns true if node represents a type-checking function."""
if len(args) == 0 or args[0][0] != 'PP_Resource':
return False
return node.GetName() == 'Is%s' % _GetShortName(interface, ['Dev', 'Private']) | Returns true if node represents a type-checking function. | Returns true if node represents a type-checking function. | [
"Returns",
"true",
"if",
"node",
"represents",
"a",
"type",
"-",
"checking",
"function",
"."
] | def _IsTypeCheck(interface, node, args):
if len(args) == 0 or args[0][0] != 'PP_Resource':
return False
return node.GetName() == 'Is%s' % _GetShortName(interface, ['Dev', 'Private']) | [
"def",
"_IsTypeCheck",
"(",
"interface",
",",
"node",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
"or",
"args",
"[",
"0",
"]",
"[",
"0",
"]",
"!=",
"'PP_Resource'",
":",
"return",
"False",
"return",
"node",
".",
"GetName",
"(",... | Returns true if node represents a type-checking function. | [
"Returns",
"true",
"if",
"node",
"represents",
"a",
"type",
"-",
"checking",
"function",
"."
] | [
"\"\"\"Returns true if node represents a type-checking function.\"\"\""
] | [
{
"param": "interface",
"type": null
},
{
"param": "node",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "interface",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node",
"type": null,
"docstring": null,
"docstring_token... |
ff7bdfd167017c6ae5bfee46d106b4bea14c5bf8 | sunlongbo/chromium | ppapi/generators/idl_thunk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetDefaultFailureValue | <not_specific> | def _GetDefaultFailureValue(t):
"""Returns the default failure value for a given type.
Returns None if no default failure value exists for the type.
"""
values = {
'PP_Bool': 'PP_FALSE',
'PP_Resource': '0',
'struct PP_Var': 'PP_MakeUndefined()',
'float': '0.0f',
'int32_t': 'enter.... | Returns the default failure value for a given type.
Returns None if no default failure value exists for the type.
| Returns the default failure value for a given type.
Returns None if no default failure value exists for the type. | [
"Returns",
"the",
"default",
"failure",
"value",
"for",
"a",
"given",
"type",
".",
"Returns",
"None",
"if",
"no",
"default",
"failure",
"value",
"exists",
"for",
"the",
"type",
"."
] | def _GetDefaultFailureValue(t):
values = {
'PP_Bool': 'PP_FALSE',
'PP_Resource': '0',
'struct PP_Var': 'PP_MakeUndefined()',
'float': '0.0f',
'int32_t': 'enter.retval()',
'uint16_t': '0',
'uint32_t': '0',
'uint64_t': '0',
'void*': 'NULL'
}
if t in values:
... | [
"def",
"_GetDefaultFailureValue",
"(",
"t",
")",
":",
"values",
"=",
"{",
"'PP_Bool'",
":",
"'PP_FALSE'",
",",
"'PP_Resource'",
":",
"'0'",
",",
"'struct PP_Var'",
":",
"'PP_MakeUndefined()'",
",",
"'float'",
":",
"'0.0f'",
",",
"'int32_t'",
":",
"'enter.retval(... | Returns the default failure value for a given type. | [
"Returns",
"the",
"default",
"failure",
"value",
"for",
"a",
"given",
"type",
"."
] | [
"\"\"\"Returns the default failure value for a given type.\n\n Returns None if no default failure value exists for the type.\n \"\"\""
] | [
{
"param": "t",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ff7bdfd167017c6ae5bfee46d106b4bea14c5bf8 | sunlongbo/chromium | ppapi/generators/idl_thunk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetOutputParams | <not_specific> | def _GetOutputParams(member, release):
"""Returns output parameters (and their types) for a member function.
Args:
member - IDLNode for the member function
release - Release to get output parameters for
Returns:
A list of name strings for all output parameters of the member
function.
"""
out_... | Returns output parameters (and their types) for a member function.
Args:
member - IDLNode for the member function
release - Release to get output parameters for
Returns:
A list of name strings for all output parameters of the member
function.
| Returns output parameters (and their types) for a member function.
Args:
member - IDLNode for the member function
release - Release to get output parameters for
Returns:
A list of name strings for all output parameters of the member
function. | [
"Returns",
"output",
"parameters",
"(",
"and",
"their",
"types",
")",
"for",
"a",
"member",
"function",
".",
"Args",
":",
"member",
"-",
"IDLNode",
"for",
"the",
"member",
"function",
"release",
"-",
"Release",
"to",
"get",
"output",
"parameters",
"for",
"... | def _GetOutputParams(member, release):
out_params = []
callnode = member.GetOneOf('Callspec')
if callnode:
cgen = CGen()
for param in callnode.GetListOf('Param'):
mode = cgen.GetParamMode(param)
if mode == 'out':
_, pname, _, _ = cgen.GetComponents(param, release, 'store')
out_... | [
"def",
"_GetOutputParams",
"(",
"member",
",",
"release",
")",
":",
"out_params",
"=",
"[",
"]",
"callnode",
"=",
"member",
".",
"GetOneOf",
"(",
"'Callspec'",
")",
"if",
"callnode",
":",
"cgen",
"=",
"CGen",
"(",
")",
"for",
"param",
"in",
"callnode",
... | Returns output parameters (and their types) for a member function. | [
"Returns",
"output",
"parameters",
"(",
"and",
"their",
"types",
")",
"for",
"a",
"member",
"function",
"."
] | [
"\"\"\"Returns output parameters (and their types) for a member function.\n\n Args:\n member - IDLNode for the member function\n release - Release to get output parameters for\n Returns:\n A list of name strings for all output parameters of the member\n function.\n \"\"\"",
"# We use the 'store' mo... | [
{
"param": "member",
"type": null
},
{
"param": "release",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "member",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "release",
"type": null,
"docstring": null,
"docstring_token... |
ff7bdfd167017c6ae5bfee46d106b4bea14c5bf8 | sunlongbo/chromium | ppapi/generators/idl_thunk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _MakeNormalMemberBody | <not_specific> | def _MakeNormalMemberBody(filenode, release, node, member, rtype, args,
include_version, meta):
"""Returns the body of a typical function.
Args:
filenode - IDLNode for the file
release - release to generate body for
node - IDLNode for the interface
member - IDLNode for the... | Returns the body of a typical function.
Args:
filenode - IDLNode for the file
release - release to generate body for
node - IDLNode for the interface
member - IDLNode for the member function
rtype - Return type for the member function
args - List of 4-tuple arguments for the member function
... | Returns the body of a typical function. | [
"Returns",
"the",
"body",
"of",
"a",
"typical",
"function",
"."
] | def _MakeNormalMemberBody(filenode, release, node, member, rtype, args,
include_version, meta):
if len(args) == 0:
meta.AddApi('ppapi/shared_impl/%s_shared.h' % _StripFileName(filenode))
return 'return %s::%s();' % (_StripApiName(node.GetName()) + '_Shared',
... | [
"def",
"_MakeNormalMemberBody",
"(",
"filenode",
",",
"release",
",",
"node",
",",
"member",
",",
"rtype",
",",
"args",
",",
"include_version",
",",
"meta",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"meta",
".",
"AddApi",
"(",
"'ppapi/sh... | Returns the body of a typical function. | [
"Returns",
"the",
"body",
"of",
"a",
"typical",
"function",
"."
] | [
"\"\"\"Returns the body of a typical function.\n\n Args:\n filenode - IDLNode for the file\n release - release to generate body for\n node - IDLNode for the interface\n member - IDLNode for the member function\n rtype - Return type for the member function\n args - List of 4-tuple arguments for th... | [
{
"param": "filenode",
"type": null
},
{
"param": "release",
"type": null
},
{
"param": "node",
"type": null
},
{
"param": "member",
"type": null
},
{
"param": "rtype",
"type": null
},
{
"param": "args",
"type": null
},
{
"param": "include_... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filenode",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "release",
"type": null,
"docstring": null,
"docstring_tok... |
ff7bdfd167017c6ae5bfee46d106b4bea14c5bf8 | sunlongbo/chromium | ppapi/generators/idl_thunk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | DefineMember | <not_specific> | def DefineMember(filenode, node, member, release, include_version, meta):
"""Returns a definition for a member function of an interface.
Args:
filenode - IDLNode for the file
node - IDLNode for the interface
member - IDLNode for the member function
release - release to generate
include_version ... | Returns a definition for a member function of an interface.
Args:
filenode - IDLNode for the file
node - IDLNode for the interface
member - IDLNode for the member function
release - release to generate
include_version - include the version in emitted function name.
meta - ThunkMetadata for he... | Returns a definition for a member function of an interface. | [
"Returns",
"a",
"definition",
"for",
"a",
"member",
"function",
"of",
"an",
"interface",
"."
] | def DefineMember(filenode, node, member, release, include_version, meta):
cgen = CGen()
rtype, name, arrays, args = cgen.GetComponents(member, release, 'return')
log_body = '\"%s::%s()\";' % (node.GetName(),
cgen.GetStructName(member, release,
... | [
"def",
"DefineMember",
"(",
"filenode",
",",
"node",
",",
"member",
",",
"release",
",",
"include_version",
",",
"meta",
")",
":",
"cgen",
"=",
"CGen",
"(",
")",
"rtype",
",",
"name",
",",
"arrays",
",",
"args",
"=",
"cgen",
".",
"GetComponents",
"(",
... | Returns a definition for a member function of an interface. | [
"Returns",
"a",
"definition",
"for",
"a",
"member",
"function",
"of",
"an",
"interface",
"."
] | [
"\"\"\"Returns a definition for a member function of an interface.\n\n Args:\n filenode - IDLNode for the file\n node - IDLNode for the interface\n member - IDLNode for the member function\n release - release to generate\n include_version - include the version in emitted function name.\n meta - T... | [
{
"param": "filenode",
"type": null
},
{
"param": "node",
"type": null
},
{
"param": "member",
"type": null
},
{
"param": "release",
"type": null
},
{
"param": "include_version",
"type": null
},
{
"param": "meta",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filenode",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node",
"type": null,
"docstring": null,
"docstring_tokens... |
ff7bdfd167017c6ae5bfee46d106b4bea14c5bf8 | sunlongbo/chromium | ppapi/generators/idl_thunk.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GenerateBody | <not_specific> | def GenerateBody(self, out, filenode, releases, options):
"""Generates a member function lines to be written and metadata.
Returns a tuple of (body, meta) where:
body - a list of lines with member function bodies
meta - a ThunkMetadata instance for hinting which headers are needed.
"""
__py... | Generates a member function lines to be written and metadata.
Returns a tuple of (body, meta) where:
body - a list of lines with member function bodies
meta - a ThunkMetadata instance for hinting which headers are needed.
| Generates a member function lines to be written and metadata.
Returns a tuple of (body, meta) where:
body - a list of lines with member function bodies
meta - a ThunkMetadata instance for hinting which headers are needed. | [
"Generates",
"a",
"member",
"function",
"lines",
"to",
"be",
"written",
"and",
"metadata",
".",
"Returns",
"a",
"tuple",
"of",
"(",
"body",
"meta",
")",
"where",
":",
"body",
"-",
"a",
"list",
"of",
"lines",
"with",
"member",
"function",
"bodies",
"meta"... | def GenerateBody(self, out, filenode, releases, options):
__pychecker__ = 'unusednames=options'
out_members = []
meta = ThunkBodyMetadata()
for node in filenode.GetListOf('Interface'):
if not node.InReleases(releases):
print("Skipping %s" % node)
continue
if node.IsA('Interfa... | [
"def",
"GenerateBody",
"(",
"self",
",",
"out",
",",
"filenode",
",",
"releases",
",",
"options",
")",
":",
"__pychecker__",
"=",
"'unusednames=options'",
"out_members",
"=",
"[",
"]",
"meta",
"=",
"ThunkBodyMetadata",
"(",
")",
"for",
"node",
"in",
"filenod... | Generates a member function lines to be written and metadata. | [
"Generates",
"a",
"member",
"function",
"lines",
"to",
"be",
"written",
"and",
"metadata",
"."
] | [
"\"\"\"Generates a member function lines to be written and metadata.\n\n Returns a tuple of (body, meta) where:\n body - a list of lines with member function bodies\n meta - a ThunkMetadata instance for hinting which headers are needed.\n \"\"\"",
"# Skip if this node is not in this release",
"#... | [
{
"param": "self",
"type": null
},
{
"param": "out",
"type": null
},
{
"param": "filenode",
"type": null
},
{
"param": "releases",
"type": null
},
{
"param": "options",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "out",
"type": null,
"docstring": null,
"docstring_tokens": []... |
d95b77811570829470f7bf3d25ed26446bd5fe90 | sunlongbo/chromium | chrome/test/webapps/file_reading.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | human_friendly_name_to_canonical_action_name | <not_specific> | def human_friendly_name_to_canonical_action_name(
human_friendly_action_name: str,
action_base_name_to_default_mode: Dict[str, str]):
"""
Converts a human-friendly action name (used in the spreadsheet) and turns
into the format compatible with this testing framework. This does two
things... |
Converts a human-friendly action name (used in the spreadsheet) and turns
into the format compatible with this testing framework. This does two
things:
1) Resolving specified modes, from "()" format into a "_". For example,
"action(with_mode)" turns into "action_with_mode".
2) Resolving mode... | Converts a human-friendly action name (used in the spreadsheet) and turns
into the format compatible with this testing framework. This does two
things:
1) Resolving specified modes, from "()" format into a "_". | [
"Converts",
"a",
"human",
"-",
"friendly",
"action",
"name",
"(",
"used",
"in",
"the",
"spreadsheet",
")",
"and",
"turns",
"into",
"the",
"format",
"compatible",
"with",
"this",
"testing",
"framework",
".",
"This",
"does",
"two",
"things",
":",
"1",
")",
... | def human_friendly_name_to_canonical_action_name(
human_friendly_action_name: str,
action_base_name_to_default_mode: Dict[str, str]):
human_friendly_action_name = human_friendly_action_name.strip()
if human_friendly_action_name in action_base_name_to_default_mode:
human_friendly_action_n... | [
"def",
"human_friendly_name_to_canonical_action_name",
"(",
"human_friendly_action_name",
":",
"str",
",",
"action_base_name_to_default_mode",
":",
"Dict",
"[",
"str",
",",
"str",
"]",
")",
":",
"human_friendly_action_name",
"=",
"human_friendly_action_name",
".",
"strip",
... | Converts a human-friendly action name (used in the spreadsheet) and turns
into the format compatible with this testing framework. | [
"Converts",
"a",
"human",
"-",
"friendly",
"action",
"name",
"(",
"used",
"in",
"the",
"spreadsheet",
")",
"and",
"turns",
"into",
"the",
"format",
"compatible",
"with",
"this",
"testing",
"framework",
"."
] | [
"\"\"\"\n Converts a human-friendly action name (used in the spreadsheet) and turns\n into the format compatible with this testing framework. This does two\n things:\n 1) Resolving specified modes, from \"()\" format into a \"_\". For example,\n \"action(with_mode)\" turns into \"action_with_mode\... | [
{
"param": "human_friendly_action_name",
"type": "str"
},
{
"param": "action_base_name_to_default_mode",
"type": "Dict[str, str]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "human_friendly_action_name",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "action_base_name_to_default_mode",
"type": "Dict[s... |
d95b77811570829470f7bf3d25ed26446bd5fe90 | sunlongbo/chromium | chrome/test/webapps/file_reading.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | read_platform_supported_actions | PartialAndFullCoverageByBaseName | def read_platform_supported_actions(csv_file
) -> PartialAndFullCoverageByBaseName:
"""Reads the action base names and coverage from the given csv file.
Args:
csv_file: The comma-separated-values file which lists action base names
and whether it is ... | Reads the action base names and coverage from the given csv file.
Args:
csv_file: The comma-separated-values file which lists action base names
and whether it is fully or partially supported.
Returns:
A dictionary of action base name to a set of partially supported
an... | Reads the action base names and coverage from the given csv file. | [
"Reads",
"the",
"action",
"base",
"names",
"and",
"coverage",
"from",
"the",
"given",
"csv",
"file",
"."
] | def read_platform_supported_actions(csv_file
) -> PartialAndFullCoverageByBaseName:
actions_base_name_to_coverage: PartialAndFullCoverageByBaseName = {}
column_offset_to_platform = {
0: TestPlatform.MAC,
1: TestPlatform.WINDOWS,
2: TestPlatform.LINUX,
... | [
"def",
"read_platform_supported_actions",
"(",
"csv_file",
")",
"->",
"PartialAndFullCoverageByBaseName",
":",
"actions_base_name_to_coverage",
":",
"PartialAndFullCoverageByBaseName",
"=",
"{",
"}",
"column_offset_to_platform",
"=",
"{",
"0",
":",
"TestPlatform",
".",
"MAC... | Reads the action base names and coverage from the given csv file. | [
"Reads",
"the",
"action",
"base",
"names",
"and",
"coverage",
"from",
"the",
"given",
"csv",
"file",
"."
] | [
"\"\"\"Reads the action base names and coverage from the given csv file.\n\n Args:\n csv_file: The comma-separated-values file which lists action base names\n and whether it is fully or partially supported.\n\n Returns:\n A dictionary of action base name to a set of partially su... | [
{
"param": "csv_file",
"type": null
}
] | {
"returns": [
{
"docstring": "A dictionary of action base name to a set of partially supported\nand fully supported platforms.",
"docstring_tokens": [
"A",
"dictionary",
"of",
"action",
"base",
"name",
"to",
"a",
"set",
"... |
d95b77811570829470f7bf3d25ed26446bd5fe90 | sunlongbo/chromium | chrome/test/webapps/file_reading.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | read_actions_file | Tuple[ActionsByName, Dict[str, str]] | def read_actions_file(
actions_csv_file,
supported_platform_actions: PartialAndFullCoverageByBaseName
) -> Tuple[ActionsByName, Dict[str, str]]:
"""Reads the actions comma-separated-values file.
If modes are specified for an action in the file, then one action is
added to the results dictio... | Reads the actions comma-separated-values file.
If modes are specified for an action in the file, then one action is
added to the results dictionary per action_base_name + mode
parameterized. A mode marked with a "*" is considered the default
mode for that action.
If output actions are specified fo... | Reads the actions comma-separated-values file.
If modes are specified for an action in the file, then one action is
added to the results dictionary per action_base_name + mode
parameterized. A mode marked with a "*" is considered the default
mode for that action.
If output actions are specified for an action, then it ... | [
"Reads",
"the",
"actions",
"comma",
"-",
"separated",
"-",
"values",
"file",
".",
"If",
"modes",
"are",
"specified",
"for",
"an",
"action",
"in",
"the",
"file",
"then",
"one",
"action",
"is",
"added",
"to",
"the",
"results",
"dictionary",
"per",
"action_ba... | def read_actions_file(
actions_csv_file,
supported_platform_actions: PartialAndFullCoverageByBaseName
) -> Tuple[ActionsByName, Dict[str, str]]:
actions_by_name: Dict[str, Action] = {}
action_base_name_to_default_mode: Dict[str, str] = {}
action_base_names: Set[str] = set()
all_output_ac... | [
"def",
"read_actions_file",
"(",
"actions_csv_file",
",",
"supported_platform_actions",
":",
"PartialAndFullCoverageByBaseName",
")",
"->",
"Tuple",
"[",
"ActionsByName",
",",
"Dict",
"[",
"str",
",",
"str",
"]",
"]",
":",
"actions_by_name",
":",
"Dict",
"[",
"str... | Reads the actions comma-separated-values file. | [
"Reads",
"the",
"actions",
"comma",
"-",
"separated",
"-",
"values",
"file",
"."
] | [
"\"\"\"Reads the actions comma-separated-values file.\n\n If modes are specified for an action in the file, then one action is\n added to the results dictionary per action_base_name + mode\n parameterized. A mode marked with a \"*\" is considered the default\n mode for that action.\n\n If output acti... | [
{
"param": "actions_csv_file",
"type": null
},
{
"param": "supported_platform_actions",
"type": "PartialAndFullCoverageByBaseName"
}
] | {
"returns": [],
"raises": [
{
"docstring": "The input file is invalid.",
"docstring_tokens": [
"The",
"input",
"file",
"is",
"invalid",
"."
],
"type": "ValueError"
}
],
"params": [
{
"identifier": "actions_csv_file",
... |
d96bb7986d2328366ff54657bfc22203faca0541 | sunlongbo/chromium | components/policy/tools/template_writers/writers/writer_unittest_common.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetOutput | <not_specific> | def GetOutput(self, policy_json, definitions, writer_type):
'''Generates an output of a writer.
Args:
policy_json: Raw policy JSON string.
definitions: Definitions to create writer configurations.
writer_type: Writer type (e.g. 'admx'), see template_formatter.py.
Returns:
The strin... | Generates an output of a writer.
Args:
policy_json: Raw policy JSON string.
definitions: Definitions to create writer configurations.
writer_type: Writer type (e.g. 'admx'), see template_formatter.py.
Returns:
The string of the template created by the writer.
| Generates an output of a writer. | [
"Generates",
"an",
"output",
"of",
"a",
"writer",
"."
] | def GetOutput(self, policy_json, definitions, writer_type):
start_idx = 1 if policy_json[0] == '\n' else 0
policy_data = eval(textwrap.dedent(policy_json[start_idx:]))
config = writer_configuration.GetConfigurationForBuild(definitions)
policy_generator = \
policy_template_generator.PolicyTemplat... | [
"def",
"GetOutput",
"(",
"self",
",",
"policy_json",
",",
"definitions",
",",
"writer_type",
")",
":",
"start_idx",
"=",
"1",
"if",
"policy_json",
"[",
"0",
"]",
"==",
"'\\n'",
"else",
"0",
"policy_data",
"=",
"eval",
"(",
"textwrap",
".",
"dedent",
"(",... | Generates an output of a writer. | [
"Generates",
"an",
"output",
"of",
"a",
"writer",
"."
] | [
"'''Generates an output of a writer.\n\n Args:\n policy_json: Raw policy JSON string.\n definitions: Definitions to create writer configurations.\n writer_type: Writer type (e.g. 'admx'), see template_formatter.py.\n\n Returns:\n The string of the template created by the writer.\n '''",... | [
{
"param": "self",
"type": null
},
{
"param": "policy_json",
"type": null
},
{
"param": "definitions",
"type": null
},
{
"param": "writer_type",
"type": null
}
] | {
"returns": [
{
"docstring": "The string of the template created by the writer.",
"docstring_tokens": [
"The",
"string",
"of",
"the",
"template",
"created",
"by",
"the",
"writer",
"."
],
"type": null
}
]... |
d98437c045989fb79f0c813f3c886af0e33ee2d0 | sunlongbo/chromium | chrome/test/mini_installer/launch_chrome.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | WaitForWindow | <not_specific> | def WaitForWindow(process_id, class_pattern):
"""Waits until a window specified by |process_id| and class name shows up.
Args:
process_id: The ID of the process that owns the window.
class_pattern: The regular expression pattern of the window class name.
Returns:
A boolean value in... | Waits until a window specified by |process_id| and class name shows up.
Args:
process_id: The ID of the process that owns the window.
class_pattern: The regular expression pattern of the window class name.
Returns:
A boolean value indicating whether the specified window shows up within... | Waits until a window specified by |process_id| and class name shows up. | [
"Waits",
"until",
"a",
"window",
"specified",
"by",
"|process_id|",
"and",
"class",
"name",
"shows",
"up",
"."
] | def WaitForWindow(process_id, class_pattern):
start_time = time.time()
while time.time() - start_time < 30:
if chrome_helper.WindowExists([process_id], class_pattern):
return True
time.sleep(0.1)
return False | [
"def",
"WaitForWindow",
"(",
"process_id",
",",
"class_pattern",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"while",
"time",
".",
"time",
"(",
")",
"-",
"start_time",
"<",
"30",
":",
"if",
"chrome_helper",
".",
"WindowExists",
"(",
"[",
... | Waits until a window specified by |process_id| and class name shows up. | [
"Waits",
"until",
"a",
"window",
"specified",
"by",
"|process_id|",
"and",
"class",
"name",
"shows",
"up",
"."
] | [
"\"\"\"Waits until a window specified by |process_id| and class name shows up.\n\n Args:\n process_id: The ID of the process that owns the window.\n class_pattern: The regular expression pattern of the window class name.\n\n Returns:\n A boolean value indicating whether the specified wind... | [
{
"param": "process_id",
"type": null
},
{
"param": "class_pattern",
"type": null
}
] | {
"returns": [
{
"docstring": "A boolean value indicating whether the specified window shows up within\n30 seconds.",
"docstring_tokens": [
"A",
"boolean",
"value",
"indicating",
"whether",
"the",
"specified",
"window",
"shows",
... |
1e2f13372ce5d4e5695399fea4010e8a5e6b40cb | sunlongbo/chromium | third_party/webxr_test_pages/update_bucket.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | binary_name | <not_specific> | def binary_name(cmd):
"""Finds the platform-appropriate name for an executable command."""
# On Windows, the "subprocess" execution requires a name with extension.
# Since we just need a couple of commands, use a simple replacement that
# work for Chromium build environments. This isn't a general solution.
i... | Finds the platform-appropriate name for an executable command. | Finds the platform-appropriate name for an executable command. | [
"Finds",
"the",
"platform",
"-",
"appropriate",
"name",
"for",
"an",
"executable",
"command",
"."
] | def binary_name(cmd):
if sys.platform != 'win32':
return cmd
if cmd in WINDOWS_EXES:
return WINDOWS_EXES[cmd]
raise Exeption('No known Windows executable for command "%s"' % cmd) | [
"def",
"binary_name",
"(",
"cmd",
")",
":",
"if",
"sys",
".",
"platform",
"!=",
"'win32'",
":",
"return",
"cmd",
"if",
"cmd",
"in",
"WINDOWS_EXES",
":",
"return",
"WINDOWS_EXES",
"[",
"cmd",
"]",
"raise",
"Exeption",
"(",
"'No known Windows executable for comm... | Finds the platform-appropriate name for an executable command. | [
"Finds",
"the",
"platform",
"-",
"appropriate",
"name",
"for",
"an",
"executable",
"command",
"."
] | [
"\"\"\"Finds the platform-appropriate name for an executable command.\"\"\"",
"# On Windows, the \"subprocess\" execution requires a name with extension.",
"# Since we just need a couple of commands, use a simple replacement that",
"# work for Chromium build environments. This isn't a general solution."
] | [
{
"param": "cmd",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cmd",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e2f13372ce5d4e5695399fea4010e8a5e6b40cb | sunlongbo/chromium | third_party/webxr_test_pages/update_bucket.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | run_command | <not_specific> | def run_command(*args):
"""Runs a shell command and returns output."""
platform_args = list(args)
platform_args[0] = binary_name(platform_args[0])
logging.debug('Executing: %s', platform_args)
return subprocess.check_output(platform_args) | Runs a shell command and returns output. | Runs a shell command and returns output. | [
"Runs",
"a",
"shell",
"command",
"and",
"returns",
"output",
"."
] | def run_command(*args):
platform_args = list(args)
platform_args[0] = binary_name(platform_args[0])
logging.debug('Executing: %s', platform_args)
return subprocess.check_output(platform_args) | [
"def",
"run_command",
"(",
"*",
"args",
")",
":",
"platform_args",
"=",
"list",
"(",
"args",
")",
"platform_args",
"[",
"0",
"]",
"=",
"binary_name",
"(",
"platform_args",
"[",
"0",
"]",
")",
"logging",
".",
"debug",
"(",
"'Executing: %s'",
",",
"platfor... | Runs a shell command and returns output. | [
"Runs",
"a",
"shell",
"command",
"and",
"returns",
"output",
"."
] | [
"\"\"\"Runs a shell command and returns output.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
1e2f13372ce5d4e5695399fea4010e8a5e6b40cb | sunlongbo/chromium | third_party/webxr_test_pages/update_bucket.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | run_modify | <not_specific> | def run_modify(*args):
"""Runs command with side effects, skipped for dry runs."""
if g_flags.dry_run:
print('Dry-Run:', *args)
return
return run_command(*args) | Runs command with side effects, skipped for dry runs. | Runs command with side effects, skipped for dry runs. | [
"Runs",
"command",
"with",
"side",
"effects",
"skipped",
"for",
"dry",
"runs",
"."
] | def run_modify(*args):
if g_flags.dry_run:
print('Dry-Run:', *args)
return
return run_command(*args) | [
"def",
"run_modify",
"(",
"*",
"args",
")",
":",
"if",
"g_flags",
".",
"dry_run",
":",
"print",
"(",
"'Dry-Run:'",
",",
"*",
"args",
")",
"return",
"return",
"run_command",
"(",
"*",
"args",
")"
] | Runs command with side effects, skipped for dry runs. | [
"Runs",
"command",
"with",
"side",
"effects",
"skipped",
"for",
"dry",
"runs",
"."
] | [
"\"\"\"Runs command with side effects, skipped for dry runs.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
1e2f13372ce5d4e5695399fea4010e8a5e6b40cb | sunlongbo/chromium | third_party/webxr_test_pages/update_bucket.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | write_to_bucket | null | def write_to_bucket(cr_position):
"""Copies the test directory to Cloud Storage"""
destination = BUCKET + '/r' + cr_position
run_modify('gsutil.py', '-m', 'rsync', '-x', 'media', '-r', './' + TEST_SUBDIR,
destination)
# The copy used mime types based on system-local mappings which may be
# misconfi... | Copies the test directory to Cloud Storage | Copies the test directory to Cloud Storage | [
"Copies",
"the",
"test",
"directory",
"to",
"Cloud",
"Storage"
] | def write_to_bucket(cr_position):
destination = BUCKET + '/r' + cr_position
run_modify('gsutil.py', '-m', 'rsync', '-x', 'media', '-r', './' + TEST_SUBDIR,
destination)
check_and_fix_content_types(destination) | [
"def",
"write_to_bucket",
"(",
"cr_position",
")",
":",
"destination",
"=",
"BUCKET",
"+",
"'/r'",
"+",
"cr_position",
"run_modify",
"(",
"'gsutil.py'",
",",
"'-m'",
",",
"'rsync'",
",",
"'-x'",
",",
"'media'",
",",
"'-r'",
",",
"'./'",
"+",
"TEST_SUBDIR",
... | Copies the test directory to Cloud Storage | [
"Copies",
"the",
"test",
"directory",
"to",
"Cloud",
"Storage"
] | [
"\"\"\"Copies the test directory to Cloud Storage\"\"\"",
"# The copy used mime types based on system-local mappings which may be",
"# misconfigured. Sanity check and fix if needed."
] | [
{
"param": "cr_position",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cr_position",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e2f13372ce5d4e5695399fea4010e8a5e6b40cb | sunlongbo/chromium | third_party/webxr_test_pages/update_bucket.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | write_index | null | def write_index():
"""Updates Cloud Storage index.html based on available test copies"""
cr_positions = get_bucket_copies()
cr_positions.sort(key=int, reverse=True)
logging.debug('Index: %s', cr_positions)
items = []
for pos in cr_positions:
rev = 'r' + pos
links = []
links.append({'href': '%s... | Updates Cloud Storage index.html based on available test copies | Updates Cloud Storage index.html based on available test copies | [
"Updates",
"Cloud",
"Storage",
"index",
".",
"html",
"based",
"on",
"available",
"test",
"copies"
] | def write_index():
cr_positions = get_bucket_copies()
cr_positions.sort(key=int, reverse=True)
logging.debug('Index: %s', cr_positions)
items = []
for pos in cr_positions:
rev = 'r' + pos
links = []
links.append({'href': '%s/index.html' % rev,
'anchor': 'index.html'})
links.a... | [
"def",
"write_index",
"(",
")",
":",
"cr_positions",
"=",
"get_bucket_copies",
"(",
")",
"cr_positions",
".",
"sort",
"(",
"key",
"=",
"int",
",",
"reverse",
"=",
"True",
")",
"logging",
".",
"debug",
"(",
"'Index: %s'",
",",
"cr_positions",
")",
"items",
... | Updates Cloud Storage index.html based on available test copies | [
"Updates",
"Cloud",
"Storage",
"index",
".",
"html",
"based",
"on",
"available",
"test",
"copies"
] | [
"\"\"\"Updates Cloud Storage index.html based on available test copies\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
1e2f13372ce5d4e5695399fea4010e8a5e6b40cb | sunlongbo/chromium | third_party/webxr_test_pages/update_bucket.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | write_latest | <not_specific> | def write_latest():
"""Updates Cloud Storage latest.html based on available test copies, pointing
to the latest copy."""
cr_positions = get_bucket_copies()
cr_positions.sort(key=int, reverse=True)
logging.debug('Index: %s', cr_positions)
if not cr_positions:
logging.debug('No cr_positions found, skippi... | Updates Cloud Storage latest.html based on available test copies, pointing
to the latest copy. | Updates Cloud Storage latest.html based on available test copies, pointing
to the latest copy. | [
"Updates",
"Cloud",
"Storage",
"latest",
".",
"html",
"based",
"on",
"available",
"test",
"copies",
"pointing",
"to",
"the",
"latest",
"copy",
"."
] | def write_latest():
cr_positions = get_bucket_copies()
cr_positions.sort(key=int, reverse=True)
logging.debug('Index: %s', cr_positions)
if not cr_positions:
logging.debug('No cr_positions found, skipping generation of latest.html')
return
logging.debug('Latest cr position: %s', cr_positions[0])
tem... | [
"def",
"write_latest",
"(",
")",
":",
"cr_positions",
"=",
"get_bucket_copies",
"(",
")",
"cr_positions",
".",
"sort",
"(",
"key",
"=",
"int",
",",
"reverse",
"=",
"True",
")",
"logging",
".",
"debug",
"(",
"'Index: %s'",
",",
"cr_positions",
")",
"if",
... | Updates Cloud Storage latest.html based on available test copies, pointing
to the latest copy. | [
"Updates",
"Cloud",
"Storage",
"latest",
".",
"html",
"based",
"on",
"available",
"test",
"copies",
"pointing",
"to",
"the",
"latest",
"copy",
"."
] | [
"\"\"\"Updates Cloud Storage latest.html based on available test copies, pointing\n to the latest copy.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
1e47bee5c9a7fa6510cc90be52872d8f43ae1138 | sunlongbo/chromium | tools/android/elf_compression/test/compression_script_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testLibraryPatching | null | def testLibraryPatching(self):
"""Runs the script on a test library and validates that it still works."""
library_path = self._BuildLibrary()
opener_path = self._BuildOpener()
patched_library_path = self._RunScript(library_path)
for _ in range(10):
opener_output = self._RunOpener(opener_path,... | Runs the script on a test library and validates that it still works. | Runs the script on a test library and validates that it still works. | [
"Runs",
"the",
"script",
"on",
"a",
"test",
"library",
"and",
"validates",
"that",
"it",
"still",
"works",
"."
] | def testLibraryPatching(self):
library_path = self._BuildLibrary()
opener_path = self._BuildOpener()
patched_library_path = self._RunScript(library_path)
for _ in range(10):
opener_output = self._RunOpener(opener_path, patched_library_path)
self.assertEqual(opener_output, '1046543\n') | [
"def",
"testLibraryPatching",
"(",
"self",
")",
":",
"library_path",
"=",
"self",
".",
"_BuildLibrary",
"(",
")",
"opener_path",
"=",
"self",
".",
"_BuildOpener",
"(",
")",
"patched_library_path",
"=",
"self",
".",
"_RunScript",
"(",
"library_path",
")",
"for"... | Runs the script on a test library and validates that it still works. | [
"Runs",
"the",
"script",
"on",
"a",
"test",
"library",
"and",
"validates",
"that",
"it",
"still",
"works",
"."
] | [
"\"\"\"Runs the script on a test library and validates that it still works.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e47bee5c9a7fa6510cc90be52872d8f43ae1138 | sunlongbo/chromium | tools/android/elf_compression/test/compression_script_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testAlignUp | null | def testAlignUp(self):
"""Tests for AlignUp method of the script."""
self.assertEqual(compress_section.AlignUp(1024, 1024), 1024)
self.assertEqual(compress_section.AlignUp(1023, 1024), 1024)
self.assertEqual(compress_section.AlignUp(1025, 1024), 2048)
self.assertEqual(compress_section.AlignUp(5555, ... | Tests for AlignUp method of the script. | Tests for AlignUp method of the script. | [
"Tests",
"for",
"AlignUp",
"method",
"of",
"the",
"script",
"."
] | def testAlignUp(self):
self.assertEqual(compress_section.AlignUp(1024, 1024), 1024)
self.assertEqual(compress_section.AlignUp(1023, 1024), 1024)
self.assertEqual(compress_section.AlignUp(1025, 1024), 2048)
self.assertEqual(compress_section.AlignUp(5555, 4096), 8192) | [
"def",
"testAlignUp",
"(",
"self",
")",
":",
"self",
".",
"assertEqual",
"(",
"compress_section",
".",
"AlignUp",
"(",
"1024",
",",
"1024",
")",
",",
"1024",
")",
"self",
".",
"assertEqual",
"(",
"compress_section",
".",
"AlignUp",
"(",
"1023",
",",
"102... | Tests for AlignUp method of the script. | [
"Tests",
"for",
"AlignUp",
"method",
"of",
"the",
"script",
"."
] | [
"\"\"\"Tests for AlignUp method of the script.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e47bee5c9a7fa6510cc90be52872d8f43ae1138 | sunlongbo/chromium | tools/android/elf_compression/test/compression_script_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testAlignDown | null | def testAlignDown(self):
"""Tests for AlignDown method of the script."""
self.assertEqual(compress_section.AlignDown(1024, 1024), 1024)
self.assertEqual(compress_section.AlignDown(1023, 1024), 0)
self.assertEqual(compress_section.AlignDown(1025, 1024), 1024)
self.assertEqual(compress_section.AlignDo... | Tests for AlignDown method of the script. | Tests for AlignDown method of the script. | [
"Tests",
"for",
"AlignDown",
"method",
"of",
"the",
"script",
"."
] | def testAlignDown(self):
self.assertEqual(compress_section.AlignDown(1024, 1024), 1024)
self.assertEqual(compress_section.AlignDown(1023, 1024), 0)
self.assertEqual(compress_section.AlignDown(1025, 1024), 1024)
self.assertEqual(compress_section.AlignDown(5555, 4096), 4096) | [
"def",
"testAlignDown",
"(",
"self",
")",
":",
"self",
".",
"assertEqual",
"(",
"compress_section",
".",
"AlignDown",
"(",
"1024",
",",
"1024",
")",
",",
"1024",
")",
"self",
".",
"assertEqual",
"(",
"compress_section",
".",
"AlignDown",
"(",
"1023",
",",
... | Tests for AlignDown method of the script. | [
"Tests",
"for",
"AlignDown",
"method",
"of",
"the",
"script",
"."
] | [
"\"\"\"Tests for AlignDown method of the script.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e47bee5c9a7fa6510cc90be52872d8f43ae1138 | sunlongbo/chromium | tools/android/elf_compression/test/compression_script_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testMatchVaddrAlignment | null | def testMatchVaddrAlignment(self):
"""Tests for MatchVaddrAlignment method of the script."""
self.assertEqual(compress_section.MatchVaddrAlignment(100, 100, 1024), 100)
self.assertEqual(compress_section.MatchVaddrAlignment(99, 100, 1024), 100)
self.assertEqual(compress_section.MatchVaddrAlignment(101, 1... | Tests for MatchVaddrAlignment method of the script. | Tests for MatchVaddrAlignment method of the script. | [
"Tests",
"for",
"MatchVaddrAlignment",
"method",
"of",
"the",
"script",
"."
] | def testMatchVaddrAlignment(self):
self.assertEqual(compress_section.MatchVaddrAlignment(100, 100, 1024), 100)
self.assertEqual(compress_section.MatchVaddrAlignment(99, 100, 1024), 100)
self.assertEqual(compress_section.MatchVaddrAlignment(101, 100, 1024), 1124)
self.assertEqual(
compress_sectio... | [
"def",
"testMatchVaddrAlignment",
"(",
"self",
")",
":",
"self",
".",
"assertEqual",
"(",
"compress_section",
".",
"MatchVaddrAlignment",
"(",
"100",
",",
"100",
",",
"1024",
")",
",",
"100",
")",
"self",
".",
"assertEqual",
"(",
"compress_section",
".",
"Ma... | Tests for MatchVaddrAlignment method of the script. | [
"Tests",
"for",
"MatchVaddrAlignment",
"method",
"of",
"the",
"script",
"."
] | [
"\"\"\"Tests for MatchVaddrAlignment method of the script.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e47bee5c9a7fa6510cc90be52872d8f43ae1138 | sunlongbo/chromium | tools/android/elf_compression/test/compression_script_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testSegmentContains | null | def testSegmentContains(self):
"""Tests for SegmentContains method of the script."""
self.assertTrue(compress_section.SegmentContains(0, 3, 0, 1))
self.assertTrue(compress_section.SegmentContains(0, 3, 0, 2))
self.assertTrue(compress_section.SegmentContains(0, 3, 0, 3))
self.assertTrue(compress_sect... | Tests for SegmentContains method of the script. | Tests for SegmentContains method of the script. | [
"Tests",
"for",
"SegmentContains",
"method",
"of",
"the",
"script",
"."
] | def testSegmentContains(self):
self.assertTrue(compress_section.SegmentContains(0, 3, 0, 1))
self.assertTrue(compress_section.SegmentContains(0, 3, 0, 2))
self.assertTrue(compress_section.SegmentContains(0, 3, 0, 3))
self.assertTrue(compress_section.SegmentContains(0, 3, 1, 2))
self.assertTrue(compr... | [
"def",
"testSegmentContains",
"(",
"self",
")",
":",
"self",
".",
"assertTrue",
"(",
"compress_section",
".",
"SegmentContains",
"(",
"0",
",",
"3",
",",
"0",
",",
"1",
")",
")",
"self",
".",
"assertTrue",
"(",
"compress_section",
".",
"SegmentContains",
"... | Tests for SegmentContains method of the script. | [
"Tests",
"for",
"SegmentContains",
"method",
"of",
"the",
"script",
"."
] | [
"\"\"\"Tests for SegmentContains method of the script.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e47bee5c9a7fa6510cc90be52872d8f43ae1138 | sunlongbo/chromium | tools/android/elf_compression/test/compression_script_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testSegmentsIntersect | null | def testSegmentsIntersect(self):
"""Tests for SegmentIntersect method of the script."""
self.assertTrue(compress_section.SegmentsIntersect(0, 3, 0, 3))
self.assertTrue(compress_section.SegmentsIntersect(0, 3, -1, 1))
self.assertTrue(compress_section.SegmentsIntersect(0, 3, 2, 4))
self.assertTrue(com... | Tests for SegmentIntersect method of the script. | Tests for SegmentIntersect method of the script. | [
"Tests",
"for",
"SegmentIntersect",
"method",
"of",
"the",
"script",
"."
] | def testSegmentsIntersect(self):
self.assertTrue(compress_section.SegmentsIntersect(0, 3, 0, 3))
self.assertTrue(compress_section.SegmentsIntersect(0, 3, -1, 1))
self.assertTrue(compress_section.SegmentsIntersect(0, 3, 2, 4))
self.assertTrue(compress_section.SegmentsIntersect(0, 3, 1, 2))
self.asser... | [
"def",
"testSegmentsIntersect",
"(",
"self",
")",
":",
"self",
".",
"assertTrue",
"(",
"compress_section",
".",
"SegmentsIntersect",
"(",
"0",
",",
"3",
",",
"0",
",",
"3",
")",
")",
"self",
".",
"assertTrue",
"(",
"compress_section",
".",
"SegmentsIntersect... | Tests for SegmentIntersect method of the script. | [
"Tests",
"for",
"SegmentIntersect",
"method",
"of",
"the",
"script",
"."
] | [
"\"\"\"Tests for SegmentIntersect method of the script.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
351ea94b87382ea535795908f550a9384dde417a | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/models/test_configuration.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | to_config_set | <not_specific> | def to_config_set(self, specifier_set, error_list=None):
"""Convert a list of specifiers into a set of TestConfiguration instances."""
if len(specifier_set) == 0:
return copy.copy(self._all_test_configurations)
matching_sets = {}
for specifier in specifier_set:
... | Convert a list of specifiers into a set of TestConfiguration instances. | Convert a list of specifiers into a set of TestConfiguration instances. | [
"Convert",
"a",
"list",
"of",
"specifiers",
"into",
"a",
"set",
"of",
"TestConfiguration",
"instances",
"."
] | def to_config_set(self, specifier_set, error_list=None):
if len(specifier_set) == 0:
return copy.copy(self._all_test_configurations)
matching_sets = {}
for specifier in specifier_set:
for expanded_specifier in self._expand_macros(specifier):
configurations... | [
"def",
"to_config_set",
"(",
"self",
",",
"specifier_set",
",",
"error_list",
"=",
"None",
")",
":",
"if",
"len",
"(",
"specifier_set",
")",
"==",
"0",
":",
"return",
"copy",
".",
"copy",
"(",
"self",
".",
"_all_test_configurations",
")",
"matching_sets",
... | Convert a list of specifiers into a set of TestConfiguration instances. | [
"Convert",
"a",
"list",
"of",
"specifiers",
"into",
"a",
"set",
"of",
"TestConfiguration",
"instances",
"."
] | [
"\"\"\"Convert a list of specifiers into a set of TestConfiguration instances.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "specifier_set",
"type": null
},
{
"param": "error_list",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "specifier_set",
"type": null,
"docstring": null,
"docstring_t... |
351ea94b87382ea535795908f550a9384dde417a | sunlongbo/chromium | third_party/blink/tools/blinkpy/web_tests/models/test_configuration.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | to_specifiers_list | <not_specific> | def to_specifiers_list(self, test_configuration_set):
"""Convert a set of TestConfiguration instances into one or more list of specifiers."""
# Easy out: if the set is all configurations, the specifier is empty.
if len(test_configuration_set) == len(self._all_test_configurations):
re... | Convert a set of TestConfiguration instances into one or more list of specifiers. | Convert a set of TestConfiguration instances into one or more list of specifiers. | [
"Convert",
"a",
"set",
"of",
"TestConfiguration",
"instances",
"into",
"one",
"or",
"more",
"list",
"of",
"specifiers",
"."
] | def to_specifiers_list(self, test_configuration_set):
if len(test_configuration_set) == len(self._all_test_configurations):
return [[]]
specifiers_list = []
for config in test_configuration_set:
values = set(config.values())
for specifier, junk_specifier_set i... | [
"def",
"to_specifiers_list",
"(",
"self",
",",
"test_configuration_set",
")",
":",
"if",
"len",
"(",
"test_configuration_set",
")",
"==",
"len",
"(",
"self",
".",
"_all_test_configurations",
")",
":",
"return",
"[",
"[",
"]",
"]",
"specifiers_list",
"=",
"[",
... | Convert a set of TestConfiguration instances into one or more list of specifiers. | [
"Convert",
"a",
"set",
"of",
"TestConfiguration",
"instances",
"into",
"one",
"or",
"more",
"list",
"of",
"specifiers",
"."
] | [
"\"\"\"Convert a set of TestConfiguration instances into one or more list of specifiers.\"\"\"",
"# Easy out: if the set is all configurations, the specifier is empty.",
"# 1) Build a list of specifier sets, discarding specifiers that don't add value.",
"# 2) Collapse specifier sets with common specifiers:",
... | [
{
"param": "self",
"type": null
},
{
"param": "test_configuration_set",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "test_configuration_set",
"type": null,
"docstring": null,
"do... |
353b87e800a3ce908d61a408abeb115a83028ece | sunlongbo/chromium | tools/metrics/structured/model_util.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | error | null | def error(elem, msg):
"""Raise a nicely formatted error with some context."""
name = elem.attrib.get('name', None)
name = name + ' ' if name else ''
msg = 'Structured metrics error, {} node {}: {}.'.format(elem.tag, name, msg)
raise ValueError(msg) | Raise a nicely formatted error with some context. | Raise a nicely formatted error with some context. | [
"Raise",
"a",
"nicely",
"formatted",
"error",
"with",
"some",
"context",
"."
] | def error(elem, msg):
name = elem.attrib.get('name', None)
name = name + ' ' if name else ''
msg = 'Structured metrics error, {} node {}: {}.'.format(elem.tag, name, msg)
raise ValueError(msg) | [
"def",
"error",
"(",
"elem",
",",
"msg",
")",
":",
"name",
"=",
"elem",
".",
"attrib",
".",
"get",
"(",
"'name'",
",",
"None",
")",
"name",
"=",
"name",
"+",
"' '",
"if",
"name",
"else",
"''",
"msg",
"=",
"'Structured metrics error, {} node {}: {}.'",
... | Raise a nicely formatted error with some context. | [
"Raise",
"a",
"nicely",
"formatted",
"error",
"with",
"some",
"context",
"."
] | [
"\"\"\"Raise a nicely formatted error with some context.\"\"\""
] | [
{
"param": "elem",
"type": null
},
{
"param": "msg",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "elem",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "msg",
"type": null,
"docstring": null,
"docstring_tokens": []... |
3556c016dcff8673c3adb092b6f35f4fb6dca527 | sunlongbo/chromium | tools/style_variable_generator/css_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _CSSColor | <not_specific> | def _CSSColor(self, c):
'''Returns the CSS color representation of |c|'''
assert (isinstance(c, Color))
if c.var:
return 'var(%s)' % self.ToCSSVarName(c.var)
if c.rgb_var:
if c.opacity.a != 1:
return 'rgba(var(%s-rgb), %g)' % (self.ToCSSVarName(
... | Returns the CSS color representation of |c| | Returns the CSS color representation of |c| | [
"Returns",
"the",
"CSS",
"color",
"representation",
"of",
"|c|"
] | def _CSSColor(self, c):
assert (isinstance(c, Color))
if c.var:
return 'var(%s)' % self.ToCSSVarName(c.var)
if c.rgb_var:
if c.opacity.a != 1:
return 'rgba(var(%s-rgb), %g)' % (self.ToCSSVarName(
c.RGBVarToVar()), self._CSSOpacity(c.opa... | [
"def",
"_CSSColor",
"(",
"self",
",",
"c",
")",
":",
"assert",
"(",
"isinstance",
"(",
"c",
",",
"Color",
")",
")",
"if",
"c",
".",
"var",
":",
"return",
"'var(%s)'",
"%",
"self",
".",
"ToCSSVarName",
"(",
"c",
".",
"var",
")",
"if",
"c",
".",
... | Returns the CSS color representation of |c| | [
"Returns",
"the",
"CSS",
"color",
"representation",
"of",
"|c|"
] | [
"'''Returns the CSS 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": [],
... |
3556c016dcff8673c3adb092b6f35f4fb6dca527 | sunlongbo/chromium | tools/style_variable_generator/css_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CSSColorRGB | <not_specific> | def CSSColorRGB(self, c):
'''Returns the CSS rgb representation of |c|'''
if c.var:
return 'var(%s-rgb)' % self.ToCSSVarName(c.var)
if c.rgb_var:
return 'var(%s-rgb)' % self.ToCSSVarName(c.RGBVarToVar())
return '%d, %d, %d' % (c.r, c.g, c.b) | Returns the CSS rgb representation of |c| | Returns the CSS rgb representation of |c| | [
"Returns",
"the",
"CSS",
"rgb",
"representation",
"of",
"|c|"
] | def CSSColorRGB(self, c):
if c.var:
return 'var(%s-rgb)' % self.ToCSSVarName(c.var)
if c.rgb_var:
return 'var(%s-rgb)' % self.ToCSSVarName(c.RGBVarToVar())
return '%d, %d, %d' % (c.r, c.g, c.b) | [
"def",
"CSSColorRGB",
"(",
"self",
",",
"c",
")",
":",
"if",
"c",
".",
"var",
":",
"return",
"'var(%s-rgb)'",
"%",
"self",
".",
"ToCSSVarName",
"(",
"c",
".",
"var",
")",
"if",
"c",
".",
"rgb_var",
":",
"return",
"'var(%s-rgb)'",
"%",
"self",
".",
... | Returns the CSS rgb representation of |c| | [
"Returns",
"the",
"CSS",
"rgb",
"representation",
"of",
"|c|"
] | [
"'''Returns the CSS rgb 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": [],
... |
3556c016dcff8673c3adb092b6f35f4fb6dca527 | sunlongbo/chromium | tools/style_variable_generator/css_generator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CSSColorVar | <not_specific> | def CSSColorVar(self, model_name, color):
'''Returns the CSS color representation given a color name and color'''
if color.var:
return 'var(%s)' % self.ToCSSVarName(color.var)
if color.opacity and color.opacity.a != 1:
return 'rgba(var(%s-rgb), %s)' % (self.ToCSSVarName(m... | Returns the CSS color representation given a color name and color | Returns the CSS color representation given a color name and color | [
"Returns",
"the",
"CSS",
"color",
"representation",
"given",
"a",
"color",
"name",
"and",
"color"
] | def CSSColorVar(self, model_name, color):
if color.var:
return 'var(%s)' % self.ToCSSVarName(color.var)
if color.opacity and color.opacity.a != 1:
return 'rgba(var(%s-rgb), %s)' % (self.ToCSSVarName(model_name),
self._CSSOpacity(color... | [
"def",
"CSSColorVar",
"(",
"self",
",",
"model_name",
",",
"color",
")",
":",
"if",
"color",
".",
"var",
":",
"return",
"'var(%s)'",
"%",
"self",
".",
"ToCSSVarName",
"(",
"color",
".",
"var",
")",
"if",
"color",
".",
"opacity",
"and",
"color",
".",
... | Returns the CSS color representation given a color name and color | [
"Returns",
"the",
"CSS",
"color",
"representation",
"given",
"a",
"color",
"name",
"and",
"color"
] | [
"'''Returns the CSS color representation given a color name and color'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "model_name",
"type": null
},
{
"param": "color",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "model_name",
"type": null,
"docstring": null,
"docstring_toke... |
3b32e347999a5542a0c95266853eb2d434ae8af0 | sunlongbo/chromium | tools/metrics/histograms/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetPrettyPrintErrors | null | def GetPrettyPrintErrors(input_api, output_api, cwd, rel_path, results):
"""Runs pretty-print command for specified file."""
exit_code = input_api.subprocess.call(
[input_api.python_executable, 'pretty_print.py', rel_path, '--presubmit',
'--non-interactive'], cwd=cwd)
if exit_code != 0:
error_ms... | Runs pretty-print command for specified file. | Runs pretty-print command for specified file. | [
"Runs",
"pretty",
"-",
"print",
"command",
"for",
"specified",
"file",
"."
] | def GetPrettyPrintErrors(input_api, output_api, cwd, rel_path, results):
exit_code = input_api.subprocess.call(
[input_api.python_executable, 'pretty_print.py', rel_path, '--presubmit',
'--non-interactive'], cwd=cwd)
if exit_code != 0:
error_msg = (
'%s is not formatted correctly; run git c... | [
"def",
"GetPrettyPrintErrors",
"(",
"input_api",
",",
"output_api",
",",
"cwd",
",",
"rel_path",
",",
"results",
")",
":",
"exit_code",
"=",
"input_api",
".",
"subprocess",
".",
"call",
"(",
"[",
"input_api",
".",
"python_executable",
",",
"'pretty_print.py'",
... | Runs pretty-print command for specified file. | [
"Runs",
"pretty",
"-",
"print",
"command",
"for",
"specified",
"file",
"."
] | [
"\"\"\"Runs pretty-print command for specified file.\"\"\""
] | [
{
"param": "input_api",
"type": null
},
{
"param": "output_api",
"type": null
},
{
"param": "cwd",
"type": null
},
{
"param": "rel_path",
"type": null
},
{
"param": "results",
"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... |
3b32e347999a5542a0c95266853eb2d434ae8af0 | sunlongbo/chromium | tools/metrics/histograms/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetPrefixErrors | null | def GetPrefixErrors(input_api, output_api, cwd, rel_path, results):
"""Validates histogram prefixes in specified file."""
exit_code = input_api.subprocess.call(
[input_api.python_executable, 'validate_prefix.py', rel_path], cwd=cwd)
if exit_code != 0:
error_msg = ('%s contains histogram(s) with disallo... | Validates histogram prefixes in specified file. | Validates histogram prefixes in specified file. | [
"Validates",
"histogram",
"prefixes",
"in",
"specified",
"file",
"."
] | def GetPrefixErrors(input_api, output_api, cwd, rel_path, results):
exit_code = input_api.subprocess.call(
[input_api.python_executable, 'validate_prefix.py', rel_path], cwd=cwd)
if exit_code != 0:
error_msg = ('%s contains histogram(s) with disallowed prefix, please run '
'validate_prefi... | [
"def",
"GetPrefixErrors",
"(",
"input_api",
",",
"output_api",
",",
"cwd",
",",
"rel_path",
",",
"results",
")",
":",
"exit_code",
"=",
"input_api",
".",
"subprocess",
".",
"call",
"(",
"[",
"input_api",
".",
"python_executable",
",",
"'validate_prefix.py'",
"... | Validates histogram prefixes in specified file. | [
"Validates",
"histogram",
"prefixes",
"in",
"specified",
"file",
"."
] | [
"\"\"\"Validates histogram prefixes in specified file.\"\"\""
] | [
{
"param": "input_api",
"type": null
},
{
"param": "output_api",
"type": null
},
{
"param": "cwd",
"type": null
},
{
"param": "rel_path",
"type": null
},
{
"param": "results",
"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... |
3b32e347999a5542a0c95266853eb2d434ae8af0 | sunlongbo/chromium | tools/metrics/histograms/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetObsoleteXmlErrors | null | def GetObsoleteXmlErrors(input_api, output_api, cwd, results):
"""Validates all histograms in the file are obsolete."""
exit_code = input_api.subprocess.call(
[input_api.python_executable, 'validate_obsolete_histograms.py'], cwd=cwd)
if exit_code != 0:
error_msg = (
'metadata/obsolete_histogram... | Validates all histograms in the file are obsolete. | Validates all histograms in the file are obsolete. | [
"Validates",
"all",
"histograms",
"in",
"the",
"file",
"are",
"obsolete",
"."
] | def GetObsoleteXmlErrors(input_api, output_api, cwd, results):
exit_code = input_api.subprocess.call(
[input_api.python_executable, 'validate_obsolete_histograms.py'], cwd=cwd)
if exit_code != 0:
error_msg = (
'metadata/obsolete_histograms.xml contains non-obsolete '
'histograms, please ru... | [
"def",
"GetObsoleteXmlErrors",
"(",
"input_api",
",",
"output_api",
",",
"cwd",
",",
"results",
")",
":",
"exit_code",
"=",
"input_api",
".",
"subprocess",
".",
"call",
"(",
"[",
"input_api",
".",
"python_executable",
",",
"'validate_obsolete_histograms.py'",
"]",... | Validates all histograms in the file are obsolete. | [
"Validates",
"all",
"histograms",
"in",
"the",
"file",
"are",
"obsolete",
"."
] | [
"\"\"\"Validates all histograms in the file are obsolete.\"\"\""
] | [
{
"param": "input_api",
"type": null
},
{
"param": "output_api",
"type": null
},
{
"param": "cwd",
"type": null
},
{
"param": "results",
"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... |
3b32e347999a5542a0c95266853eb2d434ae8af0 | sunlongbo/chromium | tools/metrics/histograms/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetValidateHistogramsError | null | def GetValidateHistogramsError(input_api, output_api, cwd, results):
"""Validates histograms format and index file."""
exit_code = input_api.subprocess.call(
[input_api.python_executable, 'validate_format.py'], cwd=cwd)
if exit_code != 0:
error_msg = (
'Histograms are not well-formatted; please... | Validates histograms format and index file. | Validates histograms format and index file. | [
"Validates",
"histograms",
"format",
"and",
"index",
"file",
"."
] | def GetValidateHistogramsError(input_api, output_api, cwd, results):
exit_code = input_api.subprocess.call(
[input_api.python_executable, 'validate_format.py'], cwd=cwd)
if exit_code != 0:
error_msg = (
'Histograms are not well-formatted; please run %s/validate_format.py '
'and fix the rep... | [
"def",
"GetValidateHistogramsError",
"(",
"input_api",
",",
"output_api",
",",
"cwd",
",",
"results",
")",
":",
"exit_code",
"=",
"input_api",
".",
"subprocess",
".",
"call",
"(",
"[",
"input_api",
".",
"python_executable",
",",
"'validate_format.py'",
"]",
",",... | Validates histograms format and index file. | [
"Validates",
"histograms",
"format",
"and",
"index",
"file",
"."
] | [
"\"\"\"Validates histograms format and index file.\"\"\""
] | [
{
"param": "input_api",
"type": null
},
{
"param": "output_api",
"type": null
},
{
"param": "cwd",
"type": null
},
{
"param": "results",
"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... |
3b32e347999a5542a0c95266853eb2d434ae8af0 | sunlongbo/chromium | tools/metrics/histograms/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckChange | <not_specific> | def CheckChange(input_api, output_api):
"""Checks that histograms.xml is pretty-printed and well-formatted."""
results = []
cwd = input_api.PresubmitLocalPath()
xml_changed = False
# Only for changed files, do corresponding checks if the file is
# histograms.xml, enums.xml or obsolete_histograms.xml.
for... | Checks that histograms.xml is pretty-printed and well-formatted. | Checks that histograms.xml is pretty-printed and well-formatted. | [
"Checks",
"that",
"histograms",
".",
"xml",
"is",
"pretty",
"-",
"printed",
"and",
"well",
"-",
"formatted",
"."
] | def CheckChange(input_api, output_api):
results = []
cwd = input_api.PresubmitLocalPath()
xml_changed = False
for file_obj in input_api.AffectedTextFiles():
is_changed = ValidateSingleFile(
input_api, output_api, file_obj, cwd, results)
xml_changed = xml_changed or is_changed
if xml_changed:
... | [
"def",
"CheckChange",
"(",
"input_api",
",",
"output_api",
")",
":",
"results",
"=",
"[",
"]",
"cwd",
"=",
"input_api",
".",
"PresubmitLocalPath",
"(",
")",
"xml_changed",
"=",
"False",
"for",
"file_obj",
"in",
"input_api",
".",
"AffectedTextFiles",
"(",
")"... | Checks that histograms.xml is pretty-printed and well-formatted. | [
"Checks",
"that",
"histograms",
".",
"xml",
"is",
"pretty",
"-",
"printed",
"and",
"well",
"-",
"formatted",
"."
] | [
"\"\"\"Checks that histograms.xml is pretty-printed and well-formatted.\"\"\"",
"# Only for changed files, do corresponding checks if the file is",
"# histograms.xml, enums.xml or obsolete_histograms.xml.",
"# Run validate_format.py and validate_histograms_index.py, if changed files",
"# contain histograms.... | [
{
"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... |
a3ac54e368df520be5418b3ce0a91e7e838da435 | sunlongbo/chromium | media/tools/constrained_network_server/cns_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testServerLatencyConstraint | null | def testServerLatencyConstraint(self):
"""Tests serving a file with a latency network constraint."""
# Abort if does not have root access.
self.assertEqual(os.geteuid(), 0, 'You need root access to run this test.')
now = time.time()
base_url = '%sf=%s' % (self._SERVER_URL, self._relative_fn)
ur... | Tests serving a file with a latency network constraint. | Tests serving a file with a latency network constraint. | [
"Tests",
"serving",
"a",
"file",
"with",
"a",
"latency",
"network",
"constraint",
"."
] | def testServerLatencyConstraint(self):
self.assertEqual(os.geteuid(), 0, 'You need root access to run this test.')
now = time.time()
base_url = '%sf=%s' % (self._SERVER_URL, self._relative_fn)
url = '%s&latency=%d' % (base_url, self._LATENCY_TEST_SECS * 1000)
f = urllib2.urlopen(url)
self.assert... | [
"def",
"testServerLatencyConstraint",
"(",
"self",
")",
":",
"self",
".",
"assertEqual",
"(",
"os",
".",
"geteuid",
"(",
")",
",",
"0",
",",
"'You need root access to run this test.'",
")",
"now",
"=",
"time",
".",
"time",
"(",
")",
"base_url",
"=",
"'%sf=%s... | Tests serving a file with a latency network constraint. | [
"Tests",
"serving",
"a",
"file",
"with",
"a",
"latency",
"network",
"constraint",
"."
] | [
"\"\"\"Tests serving a file with a latency network constraint.\"\"\"",
"# Abort if does not have root access.",
"# Verify file data is served correctly.",
"# Verify the request took longer than the requested latency.",
"# Verify the server properly redirected the URL."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a3ac54e368df520be5418b3ce0a91e7e838da435 | sunlongbo/chromium | media/tools/constrained_network_server/cns_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testGetServerURL | null | def testGetServerURL(self):
"""Test server URL is correct when using Cherrypy port."""
cns_obj = cns.ConstrainedNetworkServer(self.DummyOptions(), None)
self.assertEqual(cns_obj._GetServerURL('ab/xz.webm', port=1234, t=1),
'http://127.0.0.1:1234/ServeConstrained?f=ab/xz.webm&t=1') | Test server URL is correct when using Cherrypy port. | Test server URL is correct when using Cherrypy port. | [
"Test",
"server",
"URL",
"is",
"correct",
"when",
"using",
"Cherrypy",
"port",
"."
] | def testGetServerURL(self):
cns_obj = cns.ConstrainedNetworkServer(self.DummyOptions(), None)
self.assertEqual(cns_obj._GetServerURL('ab/xz.webm', port=1234, t=1),
'http://127.0.0.1:1234/ServeConstrained?f=ab/xz.webm&t=1') | [
"def",
"testGetServerURL",
"(",
"self",
")",
":",
"cns_obj",
"=",
"cns",
".",
"ConstrainedNetworkServer",
"(",
"self",
".",
"DummyOptions",
"(",
")",
",",
"None",
")",
"self",
".",
"assertEqual",
"(",
"cns_obj",
".",
"_GetServerURL",
"(",
"'ab/xz.webm'",
","... | Test server URL is correct when using Cherrypy port. | [
"Test",
"server",
"URL",
"is",
"correct",
"when",
"using",
"Cherrypy",
"port",
"."
] | [
"\"\"\"Test server URL is correct when using Cherrypy port.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a3ac54e368df520be5418b3ce0a91e7e838da435 | sunlongbo/chromium | media/tools/constrained_network_server/cns_test.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | testGetServerURLWithLocalServer | null | def testGetServerURLWithLocalServer(self):
"""Test server URL is correct when using --local-server-port port."""
cns_obj = cns.ConstrainedNetworkServer(self.DummyOptionsWithServer(), None)
self.assertEqual(cns_obj._GetServerURL('ab/xz.webm', port=1234, t=1),
'http://127.0.0.1:1234/medi... | Test server URL is correct when using --local-server-port port. | Test server URL is correct when using --local-server-port port. | [
"Test",
"server",
"URL",
"is",
"correct",
"when",
"using",
"--",
"local",
"-",
"server",
"-",
"port",
"port",
"."
] | def testGetServerURLWithLocalServer(self):
cns_obj = cns.ConstrainedNetworkServer(self.DummyOptionsWithServer(), None)
self.assertEqual(cns_obj._GetServerURL('ab/xz.webm', port=1234, t=1),
'http://127.0.0.1:1234/media/ab/xz.webm?t=1') | [
"def",
"testGetServerURLWithLocalServer",
"(",
"self",
")",
":",
"cns_obj",
"=",
"cns",
".",
"ConstrainedNetworkServer",
"(",
"self",
".",
"DummyOptionsWithServer",
"(",
")",
",",
"None",
")",
"self",
".",
"assertEqual",
"(",
"cns_obj",
".",
"_GetServerURL",
"("... | Test server URL is correct when using --local-server-port port. | [
"Test",
"server",
"URL",
"is",
"correct",
"when",
"using",
"--",
"local",
"-",
"server",
"-",
"port",
"port",
"."
] | [
"\"\"\"Test server URL is correct when using --local-server-port port.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a3d347f137775d4f070735207e746368c85028ff | sunlongbo/chromium | tools/git/for-all-touched-files.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GitShell | <not_specific> | def GitShell(args, ignore_return=False):
"""A shell invocation suitable for communicating with git. Returns
output as list of lines, raises exception on error.
"""
job = subprocess.Popen(args,
shell=True,
stdout=subprocess.PIPE,
stderr=s... | A shell invocation suitable for communicating with git. Returns
output as list of lines, raises exception on error.
| A shell invocation suitable for communicating with git. Returns
output as list of lines, raises exception on error. | [
"A",
"shell",
"invocation",
"suitable",
"for",
"communicating",
"with",
"git",
".",
"Returns",
"output",
"as",
"list",
"of",
"lines",
"raises",
"exception",
"on",
"error",
"."
] | def GitShell(args, ignore_return=False):
job = subprocess.Popen(args,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
(out, err) = job.communicate()
if job.returncode != 0 and not ignore_return:
print(out)
raise Excep... | [
"def",
"GitShell",
"(",
"args",
",",
"ignore_return",
"=",
"False",
")",
":",
"job",
"=",
"subprocess",
".",
"Popen",
"(",
"args",
",",
"shell",
"=",
"True",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"subprocess",
".",
"STDOUT"... | A shell invocation suitable for communicating with git. | [
"A",
"shell",
"invocation",
"suitable",
"for",
"communicating",
"with",
"git",
"."
] | [
"\"\"\"A shell invocation suitable for communicating with git. Returns\n output as list of lines, raises exception on error.\n \"\"\""
] | [
{
"param": "args",
"type": null
},
{
"param": "ignore_return",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ignore_return",
"type": null,
"docstring": null,
"docstring_t... |
a3d347f137775d4f070735207e746368c85028ff | sunlongbo/chromium | tools/git/for-all-touched-files.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FilenamesFromGit | <not_specific> | def FilenamesFromGit(branch_name, extensions):
"""Provides a list of all new and modified files listed by [git diff
branch_name] where branch_name can be blank to get a diff of the
workspace.
Excludes deleted files.
If extensions is not an empty list, include only files with one of
the extensions on the l... | Provides a list of all new and modified files listed by [git diff
branch_name] where branch_name can be blank to get a diff of the
workspace.
Excludes deleted files.
If extensions is not an empty list, include only files with one of
the extensions on the list.
| Provides a list of all new and modified files listed by [git diff
branch_name] where branch_name can be blank to get a diff of the
workspace.
Excludes deleted files.
If extensions is not an empty list, include only files with one of
the extensions on the list. | [
"Provides",
"a",
"list",
"of",
"all",
"new",
"and",
"modified",
"files",
"listed",
"by",
"[",
"git",
"diff",
"branch_name",
"]",
"where",
"branch_name",
"can",
"be",
"blank",
"to",
"get",
"a",
"diff",
"of",
"the",
"workspace",
".",
"Excludes",
"deleted",
... | def FilenamesFromGit(branch_name, extensions):
lines = GitShell('git diff --stat=600,500 %s' % branch_name)
filenames = []
for line in lines:
line = line.lstrip()
if line.find('|') != -1 and line.find('+') != -1:
filename = line.split()[0]
if filename:
filename = filename.rstrip()
... | [
"def",
"FilenamesFromGit",
"(",
"branch_name",
",",
"extensions",
")",
":",
"lines",
"=",
"GitShell",
"(",
"'git diff --stat=600,500 %s'",
"%",
"branch_name",
")",
"filenames",
"=",
"[",
"]",
"for",
"line",
"in",
"lines",
":",
"line",
"=",
"line",
".",
"lstr... | Provides a list of all new and modified files listed by [git diff
branch_name] where branch_name can be blank to get a diff of the
workspace. | [
"Provides",
"a",
"list",
"of",
"all",
"new",
"and",
"modified",
"files",
"listed",
"by",
"[",
"git",
"diff",
"branch_name",
"]",
"where",
"branch_name",
"can",
"be",
"blank",
"to",
"get",
"a",
"diff",
"of",
"the",
"workspace",
"."
] | [
"\"\"\"Provides a list of all new and modified files listed by [git diff\n branch_name] where branch_name can be blank to get a diff of the\n workspace.\n\n Excludes deleted files.\n\n If extensions is not an empty list, include only files with one of\n the extensions on the list.\n \"\"\"",
"# Avoid summar... | [
{
"param": "branch_name",
"type": null
},
{
"param": "extensions",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "branch_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "extensions",
"type": null,
"docstring": null,
"docstri... |
a3d347f137775d4f070735207e746368c85028ff | sunlongbo/chromium | tools/git/for-all-touched-files.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | ForAllTouchedFiles | null | def ForAllTouchedFiles(branch_name, extensions, token, command):
"""For each new or modified file output by [git diff branch_name],
run command with token replaced with the filename. If extensions is
not empty, do this only for files with one of the extensions in that
list.
"""
filenames = FilenamesFromGit(... | For each new or modified file output by [git diff branch_name],
run command with token replaced with the filename. If extensions is
not empty, do this only for files with one of the extensions in that
list.
| For each new or modified file output by [git diff branch_name],
run command with token replaced with the filename. If extensions is
not empty, do this only for files with one of the extensions in that
list. | [
"For",
"each",
"new",
"or",
"modified",
"file",
"output",
"by",
"[",
"git",
"diff",
"branch_name",
"]",
"run",
"command",
"with",
"token",
"replaced",
"with",
"the",
"filename",
".",
"If",
"extensions",
"is",
"not",
"empty",
"do",
"this",
"only",
"for",
... | def ForAllTouchedFiles(branch_name, extensions, token, command):
filenames = FilenamesFromGit(branch_name, extensions)
for filename in filenames:
os.system(command.replace(token, filename)) | [
"def",
"ForAllTouchedFiles",
"(",
"branch_name",
",",
"extensions",
",",
"token",
",",
"command",
")",
":",
"filenames",
"=",
"FilenamesFromGit",
"(",
"branch_name",
",",
"extensions",
")",
"for",
"filename",
"in",
"filenames",
":",
"os",
".",
"system",
"(",
... | For each new or modified file output by [git diff branch_name],
run command with token replaced with the filename. | [
"For",
"each",
"new",
"or",
"modified",
"file",
"output",
"by",
"[",
"git",
"diff",
"branch_name",
"]",
"run",
"command",
"with",
"token",
"replaced",
"with",
"the",
"filename",
"."
] | [
"\"\"\"For each new or modified file output by [git diff branch_name],\n run command with token replaced with the filename. If extensions is\n not empty, do this only for files with one of the extensions in that\n list.\n \"\"\""
] | [
{
"param": "branch_name",
"type": null
},
{
"param": "extensions",
"type": null
},
{
"param": "token",
"type": null
},
{
"param": "command",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "branch_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "extensions",
"type": null,
"docstring": null,
"docstri... |
86c32277ff6e8abf4cae9a743c471aeccba3f957 | sunlongbo/chromium | components/subresource_filter/core/common/PRESUBMIT.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CheckIndexedRulesetVersion | <not_specific> | def CheckIndexedRulesetVersion(input_api, output_api):
""" Checks that IndexedRuleset format version is modified when necessary.
Whenever any of the following files is changed:
- components/subresource_filter/core/common/indexed_ruleset.cc
- components/subresource_filter/core/common/flat/indexed_ruleset.fbs
... | Checks that IndexedRuleset format version is modified when necessary.
Whenever any of the following files is changed:
- components/subresource_filter/core/common/indexed_ruleset.cc
- components/subresource_filter/core/common/flat/indexed_ruleset.fbs
and kIndexedFormatVersion constant stays intact, this chec... | Checks that IndexedRuleset format version is modified when necessary. | [
"Checks",
"that",
"IndexedRuleset",
"format",
"version",
"is",
"modified",
"when",
"necessary",
"."
] | def CheckIndexedRulesetVersion(input_api, output_api):
indexed_ruleset_changed = False
indexed_ruleset_version_changed = False
for affected_file in input_api.AffectedFiles():
path = affected_file.LocalPath()
basename = input_api.basename(path)
if basename == 'indexed_ruleset.cc' or basename == 'indexe... | [
"def",
"CheckIndexedRulesetVersion",
"(",
"input_api",
",",
"output_api",
")",
":",
"indexed_ruleset_changed",
"=",
"False",
"indexed_ruleset_version_changed",
"=",
"False",
"for",
"affected_file",
"in",
"input_api",
".",
"AffectedFiles",
"(",
")",
":",
"path",
"=",
... | Checks that IndexedRuleset format version is modified when necessary. | [
"Checks",
"that",
"IndexedRuleset",
"format",
"version",
"is",
"modified",
"when",
"necessary",
"."
] | [
"\"\"\" Checks that IndexedRuleset format version is modified when necessary.\n\n Whenever any of the following files is changed:\n - components/subresource_filter/core/common/indexed_ruleset.cc\n - components/subresource_filter/core/common/flat/indexed_ruleset.fbs\n and kIndexedFormatVersion constant stays i... | [
{
"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... |
86d1772b0633d0cd40db27519ba9519d5746a2ca | sunlongbo/chromium | tools/json_to_struct/json_to_struct.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateHeaderGuard | <not_specific> | def _GenerateHeaderGuard(h_filename):
"""Generates the string used in #ifndef guarding the header file.
"""
result = re.sub(u'[%s\\\\.]' % os.sep, u'_', h_filename.upper())
return re.sub(u'^_*', '', result) + u'_' # Remove leading underscores. | Generates the string used in #ifndef guarding the header file.
| Generates the string used in #ifndef guarding the header file. | [
"Generates",
"the",
"string",
"used",
"in",
"#ifndef",
"guarding",
"the",
"header",
"file",
"."
] | def _GenerateHeaderGuard(h_filename):
result = re.sub(u'[%s\\\\.]' % os.sep, u'_', h_filename.upper())
return re.sub(u'^_*', '', result) + u'_' | [
"def",
"_GenerateHeaderGuard",
"(",
"h_filename",
")",
":",
"result",
"=",
"re",
".",
"sub",
"(",
"u'[%s\\\\\\\\.]'",
"%",
"os",
".",
"sep",
",",
"u'_'",
",",
"h_filename",
".",
"upper",
"(",
")",
")",
"return",
"re",
".",
"sub",
"(",
"u'^_*'",
",",
... | Generates the string used in #ifndef guarding the header file. | [
"Generates",
"the",
"string",
"used",
"in",
"#ifndef",
"guarding",
"the",
"header",
"file",
"."
] | [
"\"\"\"Generates the string used in #ifndef guarding the header file.\n \"\"\"",
"# Remove leading underscores."
] | [
{
"param": "h_filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "h_filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
86d1772b0633d0cd40db27519ba9519d5746a2ca | sunlongbo/chromium | tools/json_to_struct/json_to_struct.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateH | null | def _GenerateH(basepath, fileroot, head, namespace, schema, description):
"""Generates the .h file containing the definition of the structure specified
by the schema.
Args:
basepath: The base directory in which files are generated.
fileroot: The filename and path, relative to basepath, of the file to
... | Generates the .h file containing the definition of the structure specified
by the schema.
Args:
basepath: The base directory in which files are generated.
fileroot: The filename and path, relative to basepath, of the file to
create, without an extension.
head: The string to output as the header... | Generates the .h file containing the definition of the structure specified
by the schema. | [
"Generates",
"the",
".",
"h",
"file",
"containing",
"the",
"definition",
"of",
"the",
"structure",
"specified",
"by",
"the",
"schema",
"."
] | def _GenerateH(basepath, fileroot, head, namespace, schema, description):
h_filename = fileroot + u'.h'
with io.open(os.path.join(basepath, h_filename), 'w', encoding='utf-8') as f:
f.write(head)
header_guard = _GenerateHeaderGuard(h_filename)
f.write(u'#ifndef %s\n' % header_guard)
f.write(u'#defin... | [
"def",
"_GenerateH",
"(",
"basepath",
",",
"fileroot",
",",
"head",
",",
"namespace",
",",
"schema",
",",
"description",
")",
":",
"h_filename",
"=",
"fileroot",
"+",
"u'.h'",
"with",
"io",
".",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"basepa... | Generates the .h file containing the definition of the structure specified
by the schema. | [
"Generates",
"the",
".",
"h",
"file",
"containing",
"the",
"definition",
"of",
"the",
"structure",
"specified",
"by",
"the",
"schema",
"."
] | [
"\"\"\"Generates the .h file containing the definition of the structure specified\n by the schema.\n\n Args:\n basepath: The base directory in which files are generated.\n fileroot: The filename and path, relative to basepath, of the file to\n create, without an extension.\n head: The string to ou... | [
{
"param": "basepath",
"type": null
},
{
"param": "fileroot",
"type": null
},
{
"param": "head",
"type": null
},
{
"param": "namespace",
"type": null
},
{
"param": "schema",
"type": null
},
{
"param": "description",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "basepath",
"type": null,
"docstring": "The base directory in which files are generated.",
"docstring_tokens": [
"The",
"base",
"directory",
"in",
"which",
"files",
"are",... |
86d1772b0633d0cd40db27519ba9519d5746a2ca | sunlongbo/chromium | tools/json_to_struct/json_to_struct.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GenerateCC | null | def _GenerateCC(basepath, fileroot, head, namespace, schema, description):
"""Generates the .cc file containing the static initializers for the
of the elements specified in the description.
Args:
basepath: The base directory in which files are generated.
fileroot: The filename and path, relative to basep... | Generates the .cc file containing the static initializers for the
of the elements specified in the description.
Args:
basepath: The base directory in which files are generated.
fileroot: The filename and path, relative to basepath, of the file to
create, without an extension.
head: The string t... | Generates the .cc file containing the static initializers for the
of the elements specified in the description. | [
"Generates",
"the",
".",
"cc",
"file",
"containing",
"the",
"static",
"initializers",
"for",
"the",
"of",
"the",
"elements",
"specified",
"in",
"the",
"description",
"."
] | def _GenerateCC(basepath, fileroot, head, namespace, schema, description):
with io.open(os.path.join(basepath, fileroot + '.cc'), 'w',
encoding='utf-8') as f:
f.write(head)
f.write(u'#include "%s"\n' % (fileroot + u'.h'))
f.write(u'\n')
if namespace:
f.write(u'namespace %s {\n' % ... | [
"def",
"_GenerateCC",
"(",
"basepath",
",",
"fileroot",
",",
"head",
",",
"namespace",
",",
"schema",
",",
"description",
")",
":",
"with",
"io",
".",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"basepath",
",",
"fileroot",
"+",
"'.cc'",
")",
"... | Generates the .cc file containing the static initializers for the
of the elements specified in the description. | [
"Generates",
"the",
".",
"cc",
"file",
"containing",
"the",
"static",
"initializers",
"for",
"the",
"of",
"the",
"elements",
"specified",
"in",
"the",
"description",
"."
] | [
"\"\"\"Generates the .cc file containing the static initializers for the\n of the elements specified in the description.\n\n Args:\n basepath: The base directory in which files are generated.\n fileroot: The filename and path, relative to basepath, of the file to\n create, without an extension.\n ... | [
{
"param": "basepath",
"type": null
},
{
"param": "fileroot",
"type": null
},
{
"param": "head",
"type": null
},
{
"param": "namespace",
"type": null
},
{
"param": "schema",
"type": null
},
{
"param": "description",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "basepath",
"type": null,
"docstring": "The base directory in which files are generated.",
"docstring_tokens": [
"The",
"base",
"directory",
"in",
"which",
"files",
"are",... |
86d1772b0633d0cd40db27519ba9519d5746a2ca | sunlongbo/chromium | tools/json_to_struct/json_to_struct.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _Load | <not_specific> | def _Load(filename):
"""Loads a JSON file int a Python object and return this object.
"""
# TODO(beaudoin): When moving to Python 2.7 use object_pairs_hook=OrderedDict.
with io.open(filename, 'r', encoding='utf-8') as handle:
result = json.loads(json_comment_eater.Nom(handle.read()))
return result | Loads a JSON file int a Python object and return this object.
| Loads a JSON file int a Python object and return this object. | [
"Loads",
"a",
"JSON",
"file",
"int",
"a",
"Python",
"object",
"and",
"return",
"this",
"object",
"."
] | def _Load(filename):
with io.open(filename, 'r', encoding='utf-8') as handle:
result = json.loads(json_comment_eater.Nom(handle.read()))
return result | [
"def",
"_Load",
"(",
"filename",
")",
":",
"with",
"io",
".",
"open",
"(",
"filename",
",",
"'r'",
",",
"encoding",
"=",
"'utf-8'",
")",
"as",
"handle",
":",
"result",
"=",
"json",
".",
"loads",
"(",
"json_comment_eater",
".",
"Nom",
"(",
"handle",
"... | Loads a JSON file int a Python object and return this object. | [
"Loads",
"a",
"JSON",
"file",
"int",
"a",
"Python",
"object",
"and",
"return",
"this",
"object",
"."
] | [
"\"\"\"Loads a JSON file int a Python object and return this object.\n \"\"\"",
"# TODO(beaudoin): When moving to Python 2.7 use object_pairs_hook=OrderedDict."
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
86d1772b0633d0cd40db27519ba9519d5746a2ca | sunlongbo/chromium | tools/json_to_struct/json_to_struct.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GenerateStruct | null | def GenerateStruct(basepath, output_root, namespace, schema, description,
description_filename, schema_filename, year=None):
"""Generates a C++ struct from a JSON description.
Args:
basepath: The base directory in which files are generated.
output_root: The filename and path, relative to... | Generates a C++ struct from a JSON description.
Args:
basepath: The base directory in which files are generated.
output_root: The filename and path, relative to basepath, of the file to
create, without an extension.
namespace: A string corresponding to the C++ namespace to use.
schema: A dict... | Generates a C++ struct from a JSON description. | [
"Generates",
"a",
"C",
"++",
"struct",
"from",
"a",
"JSON",
"description",
"."
] | def GenerateStruct(basepath, output_root, namespace, schema, description,
description_filename, schema_filename, year=None):
year = int(year) if year else datetime.now().year
head = HEAD % (year, schema_filename, description_filename)
_GenerateH(basepath, output_root, head, namespace, schema, d... | [
"def",
"GenerateStruct",
"(",
"basepath",
",",
"output_root",
",",
"namespace",
",",
"schema",
",",
"description",
",",
"description_filename",
",",
"schema_filename",
",",
"year",
"=",
"None",
")",
":",
"year",
"=",
"int",
"(",
"year",
")",
"if",
"year",
... | Generates a C++ struct from a JSON description. | [
"Generates",
"a",
"C",
"++",
"struct",
"from",
"a",
"JSON",
"description",
"."
] | [
"\"\"\"Generates a C++ struct from a JSON description.\n\n Args:\n basepath: The base directory in which files are generated.\n output_root: The filename and path, relative to basepath, of the file to\n create, without an extension.\n namespace: A string corresponding to the C++ namespace to use.\n... | [
{
"param": "basepath",
"type": null
},
{
"param": "output_root",
"type": null
},
{
"param": "namespace",
"type": null
},
{
"param": "schema",
"type": null
},
{
"param": "description",
"type": null
},
{
"param": "description_filename",
"type": null
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "basepath",
"type": null,
"docstring": "The base directory in which files are generated.",
"docstring_tokens": [
"The",
"base",
"directory",
"in",
"which",
"files",
"are",... |
71f30c163082d3c0864664d915e4cd7027f57d5f | sunlongbo/chromium | remoting/host/installer/build-installer-archive.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | cleanDir | null | def cleanDir(dir):
"""Deletes and recreates the dir to make sure it is clean.
Args:
dir: The directory to clean.
"""
try:
shutil.rmtree(dir)
except OSError:
if os.path.exists(dir):
raise
else:
pass
os.makedirs(dir, 0o775) | Deletes and recreates the dir to make sure it is clean.
Args:
dir: The directory to clean.
| Deletes and recreates the dir to make sure it is clean. | [
"Deletes",
"and",
"recreates",
"the",
"dir",
"to",
"make",
"sure",
"it",
"is",
"clean",
"."
] | def cleanDir(dir):
try:
shutil.rmtree(dir)
except OSError:
if os.path.exists(dir):
raise
else:
pass
os.makedirs(dir, 0o775) | [
"def",
"cleanDir",
"(",
"dir",
")",
":",
"try",
":",
"shutil",
".",
"rmtree",
"(",
"dir",
")",
"except",
"OSError",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"dir",
")",
":",
"raise",
"else",
":",
"pass",
"os",
".",
"makedirs",
"(",
"dir"... | Deletes and recreates the dir to make sure it is clean. | [
"Deletes",
"and",
"recreates",
"the",
"dir",
"to",
"make",
"sure",
"it",
"is",
"clean",
"."
] | [
"\"\"\"Deletes and recreates the dir to make sure it is clean.\n\n Args:\n dir: The directory to clean.\n \"\"\""
] | [
{
"param": "dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dir",
"type": null,
"docstring": "The directory to clean.",
"docstring_tokens": [
"The",
"directory",
"to",
"clean",
"."
],
"default": null,
"is_optional": null
}
... |
71f30c163082d3c0864664d915e4cd7027f57d5f | sunlongbo/chromium | remoting/host/installer/build-installer-archive.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | buildDefDictionary | <not_specific> | def buildDefDictionary(definitions):
"""Builds the definition dictionary from the VARIABLE=value array.
Args:
defs: Array of variable definitions: 'VARIABLE=value'.
Returns:
Dictionary with the definitions.
"""
defs = {}
for d in definitions:
(key, val) = d.split('=')
defs[key] = val
... | Builds the definition dictionary from the VARIABLE=value array.
Args:
defs: Array of variable definitions: 'VARIABLE=value'.
Returns:
Dictionary with the definitions.
| Builds the definition dictionary from the VARIABLE=value array. | [
"Builds",
"the",
"definition",
"dictionary",
"from",
"the",
"VARIABLE",
"=",
"value",
"array",
"."
] | def buildDefDictionary(definitions):
defs = {}
for d in definitions:
(key, val) = d.split('=')
defs[key] = val
return defs | [
"def",
"buildDefDictionary",
"(",
"definitions",
")",
":",
"defs",
"=",
"{",
"}",
"for",
"d",
"in",
"definitions",
":",
"(",
"key",
",",
"val",
")",
"=",
"d",
".",
"split",
"(",
"'='",
")",
"defs",
"[",
"key",
"]",
"=",
"val",
"return",
"defs"
] | Builds the definition dictionary from the VARIABLE=value array. | [
"Builds",
"the",
"definition",
"dictionary",
"from",
"the",
"VARIABLE",
"=",
"value",
"array",
"."
] | [
"\"\"\"Builds the definition dictionary from the VARIABLE=value array.\n\n Args:\n defs: Array of variable definitions: 'VARIABLE=value'.\n\n Returns:\n Dictionary with the definitions.\n \"\"\""
] | [
{
"param": "definitions",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "definitions",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [
{
"identifier": "defs",
"type": null,
"docstring": ... |
71f30c163082d3c0864664d915e4cd7027f57d5f | sunlongbo/chromium | remoting/host/installer/build-installer-archive.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | remapSrcFile | <not_specific> | def remapSrcFile(dst_root, src_roots, src_file):
"""Calculates destination file path and creates directory.
Any matching |src_roots| prefix is stripped from |src_file| before
appending to |dst_root|.
For example, given:
dst_root = '/output'
src_roots = ['host/installer/mac']
src_file = 'host/insta... | Calculates destination file path and creates directory.
Any matching |src_roots| prefix is stripped from |src_file| before
appending to |dst_root|.
For example, given:
dst_root = '/output'
src_roots = ['host/installer/mac']
src_file = 'host/installer/mac/Scripts/keystone_install.sh'
The final calc... | Calculates destination file path and creates directory.
The |src_file| must match one of the |src_roots| prefixes. If there are no
matches, then an error is reported.
If multiple |src_roots| match, then only the first match is applied. Because
of this, if you have roots that share a common prefix, the longest strin... | [
"Calculates",
"destination",
"file",
"path",
"and",
"creates",
"directory",
".",
"The",
"|src_file|",
"must",
"match",
"one",
"of",
"the",
"|src_roots|",
"prefixes",
".",
"If",
"there",
"are",
"no",
"matches",
"then",
"an",
"error",
"is",
"reported",
".",
"I... | def remapSrcFile(dst_root, src_roots, src_file):
found_root = False
for root in src_roots:
root = os.path.normpath(root)
src_file = os.path.normpath(src_file)
if os.path.commonprefix([root, src_file]) == root:
src_file = os.path.relpath(src_file, root)
found_root = True
break
if not ... | [
"def",
"remapSrcFile",
"(",
"dst_root",
",",
"src_roots",
",",
"src_file",
")",
":",
"found_root",
"=",
"False",
"for",
"root",
"in",
"src_roots",
":",
"root",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"root",
")",
"src_file",
"=",
"os",
".",
"path... | Calculates destination file path and creates directory. | [
"Calculates",
"destination",
"file",
"path",
"and",
"creates",
"directory",
"."
] | [
"\"\"\"Calculates destination file path and creates directory.\n\n Any matching |src_roots| prefix is stripped from |src_file| before\n appending to |dst_root|.\n\n For example, given:\n dst_root = '/output'\n src_roots = ['host/installer/mac']\n src_file = 'host/installer/mac/Scripts/keystone_install.s... | [
{
"param": "dst_root",
"type": null
},
{
"param": "src_roots",
"type": null
},
{
"param": "src_file",
"type": null
}
] | {
"returns": [
{
"docstring": "Full path to destination file in |dst_root|.",
"docstring_tokens": [
"Full",
"path",
"to",
"destination",
"file",
"in",
"|dst_root|",
"."
],
"type": null
}
],
"raises": [],
"params": [
... |
71f30c163082d3c0864664d915e4cd7027f57d5f | sunlongbo/chromium | remoting/host/installer/build-installer-archive.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | copyFileWithDefs | null | def copyFileWithDefs(src_file, dst_file, defs):
"""Copies from src_file to dst_file, performing variable substitution.
Any @@VARIABLE@@ in the source is replaced with the value of VARIABLE
in the |defs| dictionary when written to the destination file.
Args:
src_file: Full or relative path to source file t... | Copies from src_file to dst_file, performing variable substitution.
Any @@VARIABLE@@ in the source is replaced with the value of VARIABLE
in the |defs| dictionary when written to the destination file.
Args:
src_file: Full or relative path to source file to copy.
dst_file: Relative path (and filename) wh... | Copies from src_file to dst_file, performing variable substitution.
Any @@VARIABLE@@ in the source is replaced with the value of VARIABLE
in the |defs| dictionary when written to the destination file. | [
"Copies",
"from",
"src_file",
"to",
"dst_file",
"performing",
"variable",
"substitution",
".",
"Any",
"@@VARIABLE@@",
"in",
"the",
"source",
"is",
"replaced",
"with",
"the",
"value",
"of",
"VARIABLE",
"in",
"the",
"|defs|",
"dictionary",
"when",
"written",
"to",... | def copyFileWithDefs(src_file, dst_file, defs):
data = open(src_file, 'r').read()
for key, val in defs.items():
try:
data = data.replace('@@' + key + '@@', val)
except TypeError:
print(repr(key), repr(val))
open(dst_file, 'w').write(data)
shutil.copystat(src_file, dst_file) | [
"def",
"copyFileWithDefs",
"(",
"src_file",
",",
"dst_file",
",",
"defs",
")",
":",
"data",
"=",
"open",
"(",
"src_file",
",",
"'r'",
")",
".",
"read",
"(",
")",
"for",
"key",
",",
"val",
"in",
"defs",
".",
"items",
"(",
")",
":",
"try",
":",
"da... | Copies from src_file to dst_file, performing variable substitution. | [
"Copies",
"from",
"src_file",
"to",
"dst_file",
"performing",
"variable",
"substitution",
"."
] | [
"\"\"\"Copies from src_file to dst_file, performing variable substitution.\n\n Any @@VARIABLE@@ in the source is replaced with the value of VARIABLE\n in the |defs| dictionary when written to the destination file.\n\n Args:\n src_file: Full or relative path to source file to copy.\n dst_file: Relative path... | [
{
"param": "src_file",
"type": null
},
{
"param": "dst_file",
"type": null
},
{
"param": "defs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "src_file",
"type": null,
"docstring": "Full or relative path to source file to copy.",
"docstring_tokens": [
"Full",
"or",
"relative",
"path",
"to",
"source",
"file",
... |
71f30c163082d3c0864664d915e4cd7027f57d5f | sunlongbo/chromium | remoting/host/installer/build-installer-archive.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | copyZipIntoArchive | null | def copyZipIntoArchive(out_dir, files_root, zip_file):
"""Expands the zip_file into the out_dir, preserving the directory structure.
Args:
out_dir: Target directory where unzipped files are copied.
files_root: Path prefix which is stripped of zip_file before appending
it to the out_dir.
... | Expands the zip_file into the out_dir, preserving the directory structure.
Args:
out_dir: Target directory where unzipped files are copied.
files_root: Path prefix which is stripped of zip_file before appending
it to the out_dir.
zip_file: Relative path (and filename) to the zip file.
| Expands the zip_file into the out_dir, preserving the directory structure. | [
"Expands",
"the",
"zip_file",
"into",
"the",
"out_dir",
"preserving",
"the",
"directory",
"structure",
"."
] | def copyZipIntoArchive(out_dir, files_root, zip_file):
base_zip_name = os.path.basename(zip_file)
old_dir = os.getcwd();
os.chdir(os.path.dirname(zip_file))
subprocess.call(['unzip', '-qq', '-o', base_zip_name])
os.chdir(old_dir)
out_zip_path = remapSrcFile(out_dir, files_root, zip_file)
out_zip_dir = os.... | [
"def",
"copyZipIntoArchive",
"(",
"out_dir",
",",
"files_root",
",",
"zip_file",
")",
":",
"base_zip_name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"zip_file",
")",
"old_dir",
"=",
"os",
".",
"getcwd",
"(",
")",
";",
"os",
".",
"chdir",
"(",
"os"... | Expands the zip_file into the out_dir, preserving the directory structure. | [
"Expands",
"the",
"zip_file",
"into",
"the",
"out_dir",
"preserving",
"the",
"directory",
"structure",
"."
] | [
"\"\"\"Expands the zip_file into the out_dir, preserving the directory structure.\n\n Args:\n out_dir: Target directory where unzipped files are copied.\n files_root: Path prefix which is stripped of zip_file before appending\n it to the out_dir.\n zip_file: Relative path (and filename) to ... | [
{
"param": "out_dir",
"type": null
},
{
"param": "files_root",
"type": null
},
{
"param": "zip_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "out_dir",
"type": null,
"docstring": "Target directory where unzipped files are copied.",
"docstring_tokens": [
"Target",
"directory",
"where",
"unzipped",
"files",
"are",
... |
71f30c163082d3c0864664d915e4cd7027f57d5f | sunlongbo/chromium | remoting/host/installer/build-installer-archive.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | buildHostArchive | null | def buildHostArchive(temp_dir, zip_path, source_file_roots, source_files,
gen_files, gen_files_dst, defs):
"""Builds a zip archive with the files needed to build the installer.
Args:
temp_dir: Temporary dir used to build up the contents for the archive.
zip_path: Full path to the zip f... | Builds a zip archive with the files needed to build the installer.
Args:
temp_dir: Temporary dir used to build up the contents for the archive.
zip_path: Full path to the zip file to create.
source_file_roots: Array of path prefixes to strip off |files| when adding
to the archive.
... | Builds a zip archive with the files needed to build the installer. | [
"Builds",
"a",
"zip",
"archive",
"with",
"the",
"files",
"needed",
"to",
"build",
"the",
"installer",
"."
] | def buildHostArchive(temp_dir, zip_path, source_file_roots, source_files,
gen_files, gen_files_dst, defs):
cleanDir(temp_dir)
for f in source_files:
dst_file = remapSrcFile(temp_dir, source_file_roots, f)
base_file = os.path.basename(f)
(base, ext) = os.path.splitext(f)
if ext =... | [
"def",
"buildHostArchive",
"(",
"temp_dir",
",",
"zip_path",
",",
"source_file_roots",
",",
"source_files",
",",
"gen_files",
",",
"gen_files_dst",
",",
"defs",
")",
":",
"cleanDir",
"(",
"temp_dir",
")",
"for",
"f",
"in",
"source_files",
":",
"dst_file",
"=",... | Builds a zip archive with the files needed to build the installer. | [
"Builds",
"a",
"zip",
"archive",
"with",
"the",
"files",
"needed",
"to",
"build",
"the",
"installer",
"."
] | [
"\"\"\"Builds a zip archive with the files needed to build the installer.\n\n Args:\n temp_dir: Temporary dir used to build up the contents for the archive.\n zip_path: Full path to the zip file to create.\n source_file_roots: Array of path prefixes to strip off |files| when adding\n ... | [
{
"param": "temp_dir",
"type": null
},
{
"param": "zip_path",
"type": null
},
{
"param": "source_file_roots",
"type": null
},
{
"param": "source_files",
"type": null
},
{
"param": "gen_files",
"type": null
},
{
"param": "gen_files_dst",
"type": nul... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "temp_dir",
"type": null,
"docstring": "Temporary dir used to build up the contents for the archive.",
"docstring_tokens": [
"Temporary",
"dir",
"used",
"to",
"build",
"up",
... |
2702b68b9bdd527b407c28e24422f25946e6bd80 | sunlongbo/chromium | ui/ozone/generate_ozone_platform_list.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GetConstantName | <not_specific> | def GetConstantName(name):
"""Determine name of static constructor function from platform name.
We just capitalize the platform name and prepend "CreateOzonePlatform".
"""
return 'kPlatform' + name.capitalize() | Determine name of static constructor function from platform name.
We just capitalize the platform name and prepend "CreateOzonePlatform".
| Determine name of static constructor function from platform name.
We just capitalize the platform name and prepend "CreateOzonePlatform". | [
"Determine",
"name",
"of",
"static",
"constructor",
"function",
"from",
"platform",
"name",
".",
"We",
"just",
"capitalize",
"the",
"platform",
"name",
"and",
"prepend",
"\"",
"CreateOzonePlatform",
"\"",
"."
] | def GetConstantName(name):
return 'kPlatform' + name.capitalize() | [
"def",
"GetConstantName",
"(",
"name",
")",
":",
"return",
"'kPlatform'",
"+",
"name",
".",
"capitalize",
"(",
")"
] | Determine name of static constructor function from platform name. | [
"Determine",
"name",
"of",
"static",
"constructor",
"function",
"from",
"platform",
"name",
"."
] | [
"\"\"\"Determine name of static constructor function from platform name.\n\n We just capitalize the platform name and prepend \"CreateOzonePlatform\".\n \"\"\""
] | [
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2702b68b9bdd527b407c28e24422f25946e6bd80 | sunlongbo/chromium | ui/ozone/generate_ozone_platform_list.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GeneratePlatformListText | null | def GeneratePlatformListText(out, platforms):
"""Generate text file with list of platform names, in platform id order."""
for platform in platforms:
out.write(platform)
out.write('\n')
out.write('\n') | Generate text file with list of platform names, in platform id order. | Generate text file with list of platform names, in platform id order. | [
"Generate",
"text",
"file",
"with",
"list",
"of",
"platform",
"names",
"in",
"platform",
"id",
"order",
"."
] | def GeneratePlatformListText(out, platforms):
for platform in platforms:
out.write(platform)
out.write('\n')
out.write('\n') | [
"def",
"GeneratePlatformListText",
"(",
"out",
",",
"platforms",
")",
":",
"for",
"platform",
"in",
"platforms",
":",
"out",
".",
"write",
"(",
"platform",
")",
"out",
".",
"write",
"(",
"'\\n'",
")",
"out",
".",
"write",
"(",
"'\\n'",
")"
] | Generate text file with list of platform names, in platform id order. | [
"Generate",
"text",
"file",
"with",
"list",
"of",
"platform",
"names",
"in",
"platform",
"id",
"order",
"."
] | [
"\"\"\"Generate text file with list of platform names, in platform id order.\"\"\""
] | [
{
"param": "out",
"type": null
},
{
"param": "platforms",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "out",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "platforms",
"type": null,
"docstring": null,
"docstring_tokens... |
2702b68b9bdd527b407c28e24422f25946e6bd80 | sunlongbo/chromium | ui/ozone/generate_ozone_platform_list.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GeneratePlatformListHeader | null | def GeneratePlatformListHeader(out, platforms):
"""Generate ids of ozone platforms & declaration of static names array."""
out.write('// DO NOT MODIFY. GENERATED BY generate_ozone_platform_list.py\n')
out.write('\n')
out.write('#ifndef UI_OZONE_PLATFORM_LIST_H_\n')
out.write('#define UI_OZONE_PLATFORM_LIST_... | Generate ids of ozone platforms & declaration of static names array. | Generate ids of ozone platforms & declaration of static names array. | [
"Generate",
"ids",
"of",
"ozone",
"platforms",
"&",
"declaration",
"of",
"static",
"names",
"array",
"."
] | def GeneratePlatformListHeader(out, platforms):
out.write('// DO NOT MODIFY. GENERATED BY generate_ozone_platform_list.py\n')
out.write('\n')
out.write('#ifndef UI_OZONE_PLATFORM_LIST_H_\n')
out.write('#define UI_OZONE_PLATFORM_LIST_H_\n')
out.write('\n')
out.write('namespace ui {\n')
out.write('\n')
fo... | [
"def",
"GeneratePlatformListHeader",
"(",
"out",
",",
"platforms",
")",
":",
"out",
".",
"write",
"(",
"'// DO NOT MODIFY. GENERATED BY generate_ozone_platform_list.py\\n'",
")",
"out",
".",
"write",
"(",
"'\\n'",
")",
"out",
".",
"write",
"(",
"'#ifndef UI_OZONE_PLAT... | Generate ids of ozone platforms & declaration of static names array. | [
"Generate",
"ids",
"of",
"ozone",
"platforms",
"&",
"declaration",
"of",
"static",
"names",
"array",
"."
] | [
"\"\"\"Generate ids of ozone platforms & declaration of static names array.\"\"\"",
"# Prototypes for platform initializers.",
"# Platform count.",
"# Declaration for names list."
] | [
{
"param": "out",
"type": null
},
{
"param": "platforms",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "out",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "platforms",
"type": null,
"docstring": null,
"docstring_tokens... |
2702b68b9bdd527b407c28e24422f25946e6bd80 | sunlongbo/chromium | ui/ozone/generate_ozone_platform_list.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | GeneratePlatformListSource | null | def GeneratePlatformListSource(out, platforms):
"""Generate static array containing a list of ozone platforms."""
out.write('// DO NOT MODIFY. GENERATED BY generate_ozone_platform_list.py\n')
out.write('\n')
out.write('#include "ui/ozone/platform_list.h"\n')
out.write('\n')
out.write('namespace ui {\n')
... | Generate static array containing a list of ozone platforms. | Generate static array containing a list of ozone platforms. | [
"Generate",
"static",
"array",
"containing",
"a",
"list",
"of",
"ozone",
"platforms",
"."
] | def GeneratePlatformListSource(out, platforms):
out.write('// DO NOT MODIFY. GENERATED BY generate_ozone_platform_list.py\n')
out.write('\n')
out.write('#include "ui/ozone/platform_list.h"\n')
out.write('\n')
out.write('namespace ui {\n')
out.write('\n')
out.write('const char* kPlatformNames[] = {\n')
f... | [
"def",
"GeneratePlatformListSource",
"(",
"out",
",",
"platforms",
")",
":",
"out",
".",
"write",
"(",
"'// DO NOT MODIFY. GENERATED BY generate_ozone_platform_list.py\\n'",
")",
"out",
".",
"write",
"(",
"'\\n'",
")",
"out",
".",
"write",
"(",
"'#include \"ui/ozone/p... | Generate static array containing a list of ozone platforms. | [
"Generate",
"static",
"array",
"containing",
"a",
"list",
"of",
"ozone",
"platforms",
"."
] | [
"\"\"\"Generate static array containing a list of ozone platforms.\"\"\"",
"# Definition of names list.",
"# Prototypes for platform initializers."
] | [
{
"param": "out",
"type": null
},
{
"param": "platforms",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "out",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "platforms",
"type": null,
"docstring": null,
"docstring_tokens... |
e1387d9f35abf511c9c23233d8a3f0b5d78c27e3 | sunlongbo/chromium | tools/clang/scripts/build_clang_tools_extra.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | FetchLLVM | null | def FetchLLVM(checkout_dir, revision):
"""Clone llvm repo into |out_dir| or update if it already exists."""
CreateDirIfNotExists(os.path.dirname(checkout_dir))
try:
# First, try to clone the repo.
args = [
'git',
'clone',
'https://github.com/llvm/llvm-project.git',
checkou... | Clone llvm repo into |out_dir| or update if it already exists. | Clone llvm repo into |out_dir| or update if it already exists. | [
"Clone",
"llvm",
"repo",
"into",
"|out_dir|",
"or",
"update",
"if",
"it",
"already",
"exists",
"."
] | def FetchLLVM(checkout_dir, revision):
CreateDirIfNotExists(os.path.dirname(checkout_dir))
try:
args = [
'git',
'clone',
'https://github.com/llvm/llvm-project.git',
checkout_dir,
]
subprocess.check_call(args, shell=sys.platform == 'win32')
except subprocess.CalledProces... | [
"def",
"FetchLLVM",
"(",
"checkout_dir",
",",
"revision",
")",
":",
"CreateDirIfNotExists",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"checkout_dir",
")",
")",
"try",
":",
"args",
"=",
"[",
"'git'",
",",
"'clone'",
",",
"'https://github.com/llvm/llvm-projec... | Clone llvm repo into |out_dir| or update if it already exists. | [
"Clone",
"llvm",
"repo",
"into",
"|out_dir|",
"or",
"update",
"if",
"it",
"already",
"exists",
"."
] | [
"\"\"\"Clone llvm repo into |out_dir| or update if it already exists.\"\"\"",
"# First, try to clone the repo.",
"# Otherwise, try to update it."
] | [
{
"param": "checkout_dir",
"type": null
},
{
"param": "revision",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "checkout_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "revision",
"type": null,
"docstring": null,
"docstrin... |
e14a2ddba5522e25648864dbbab0923d044d82ea | sunlongbo/chromium | testing/scripts/variations_seed_access_helper.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | update_local_state | null | def update_local_state(user_data_dir, update_dict):
"""Updates local state file under user data dir with given dict.
Args:
user_data_dir (str): Path to the user data directory used to launch Chrome.
update_dict (dict): A dict used to update current local state file.
"""
with open(os.path.join(user_data... | Updates local state file under user data dir with given dict.
Args:
user_data_dir (str): Path to the user data directory used to launch Chrome.
update_dict (dict): A dict used to update current local state file.
| Updates local state file under user data dir with given dict. | [
"Updates",
"local",
"state",
"file",
"under",
"user",
"data",
"dir",
"with",
"given",
"dict",
"."
] | def update_local_state(user_data_dir, update_dict):
with open(os.path.join(user_data_dir, _LOCAL_STATE_FILE_NAME)) as f:
local_state = json.load(f)
local_state.update(update_dict)
with open(os.path.join(user_data_dir, _LOCAL_STATE_FILE_NAME), 'w') as f:
json.dump(local_state, f) | [
"def",
"update_local_state",
"(",
"user_data_dir",
",",
"update_dict",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"user_data_dir",
",",
"_LOCAL_STATE_FILE_NAME",
")",
")",
"as",
"f",
":",
"local_state",
"=",
"json",
".",
"load",
"(... | Updates local state file under user data dir with given dict. | [
"Updates",
"local",
"state",
"file",
"under",
"user",
"data",
"dir",
"with",
"given",
"dict",
"."
] | [
"\"\"\"Updates local state file under user data dir with given dict.\n\n Args:\n user_data_dir (str): Path to the user data directory used to launch Chrome.\n update_dict (dict): A dict used to update current local state file.\n \"\"\""
] | [
{
"param": "user_data_dir",
"type": null
},
{
"param": "update_dict",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "user_data_dir",
"type": null,
"docstring": "Path to the user data directory used to launch Chrome.",
"docstring_tokens": [
"Path",
"to",
"the",
"user",
"data",
"directory",
... |
1d6f43e04725027d157fd0094704a259f1fb4144 | sunlongbo/chromium | tools/json_schema_compiler/preview.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetRequestPath | <not_specific> | def _GetRequestPath(self, parsed_url, strip_nav=False):
"""Get the relative path from the current directory to the requested file.
"""
path = parsed_url.path
if strip_nav:
path = parsed_url.path.replace('/nav', '')
return os.path.normpath(os.curdir + path) | Get the relative path from the current directory to the requested file.
| Get the relative path from the current directory to the requested file. | [
"Get",
"the",
"relative",
"path",
"from",
"the",
"current",
"directory",
"to",
"the",
"requested",
"file",
"."
] | def _GetRequestPath(self, parsed_url, strip_nav=False):
path = parsed_url.path
if strip_nav:
path = parsed_url.path.replace('/nav', '')
return os.path.normpath(os.curdir + path) | [
"def",
"_GetRequestPath",
"(",
"self",
",",
"parsed_url",
",",
"strip_nav",
"=",
"False",
")",
":",
"path",
"=",
"parsed_url",
".",
"path",
"if",
"strip_nav",
":",
"path",
"=",
"parsed_url",
".",
"path",
".",
"replace",
"(",
"'/nav'",
",",
"''",
")",
"... | Get the relative path from the current directory to the requested file. | [
"Get",
"the",
"relative",
"path",
"from",
"the",
"current",
"directory",
"to",
"the",
"requested",
"file",
"."
] | [
"\"\"\"Get the relative path from the current directory to the requested file.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "parsed_url",
"type": null
},
{
"param": "strip_nav",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parsed_url",
"type": null,
"docstring": null,
"docstring_toke... |
1d6f43e04725027d157fd0094704a259f1fb4144 | sunlongbo/chromium | tools/json_schema_compiler/preview.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ShowPanels | null | def _ShowPanels(self, parsed_url, head, body):
"""Show the previewer frame structure.
Code panes are populated via XHR after links in the nav pane are clicked.
"""
(head.Append('<style>')
.Append('body {')
.Append(' margin: 0;')
.Append('}')
.Append('.pane {')
... | Show the previewer frame structure.
Code panes are populated via XHR after links in the nav pane are clicked.
| Show the previewer frame structure.
Code panes are populated via XHR after links in the nav pane are clicked. | [
"Show",
"the",
"previewer",
"frame",
"structure",
".",
"Code",
"panes",
"are",
"populated",
"via",
"XHR",
"after",
"links",
"in",
"the",
"nav",
"pane",
"are",
"clicked",
"."
] | def _ShowPanels(self, parsed_url, head, body):
(head.Append('<style>')
.Append('body {')
.Append(' margin: 0;')
.Append('}')
.Append('.pane {')
.Append(' height: 100%;')
.Append(' overflow-x: auto;')
.Append(' overflow-y: scroll;')
.Append(... | [
"def",
"_ShowPanels",
"(",
"self",
",",
"parsed_url",
",",
"head",
",",
"body",
")",
":",
"(",
"head",
".",
"Append",
"(",
"'<style>'",
")",
".",
"Append",
"(",
"'body {'",
")",
".",
"Append",
"(",
"' margin: 0;'",
")",
".",
"Append",
"(",
"'}'",
")... | Show the previewer frame structure. | [
"Show",
"the",
"previewer",
"frame",
"structure",
"."
] | [
"\"\"\"Show the previewer frame structure.\n\n Code panes are populated via XHR after links in the nav pane are clicked.\n \"\"\"",
"# The Javascript that interacts with the nav pane and panes to show the",
"# compiled files as the URL or highlighting options change."
] | [
{
"param": "self",
"type": null
},
{
"param": "parsed_url",
"type": null
},
{
"param": "head",
"type": null
},
{
"param": "body",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parsed_url",
"type": null,
"docstring": null,
"docstring_toke... |
1d6f43e04725027d157fd0094704a259f1fb4144 | sunlongbo/chromium | tools/json_schema_compiler/preview.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _ShowCompiledFile | <not_specific> | def _ShowCompiledFile(self, parsed_url, head, body):
"""Show the compiled version of a json or idl file given the path to the
compiled file.
"""
api_model = model.Model()
request_path = self._GetRequestPath(parsed_url)
(file_root, file_ext) = os.path.splitext(request_path)
(filedir, filenam... | Show the compiled version of a json or idl file given the path to the
compiled file.
| Show the compiled version of a json or idl file given the path to the
compiled file. | [
"Show",
"the",
"compiled",
"version",
"of",
"a",
"json",
"or",
"idl",
"file",
"given",
"the",
"path",
"to",
"the",
"compiled",
"file",
"."
] | def _ShowCompiledFile(self, parsed_url, head, body):
api_model = model.Model()
request_path = self._GetRequestPath(parsed_url)
(file_root, file_ext) = os.path.splitext(request_path)
(filedir, filename) = os.path.split(file_root)
namespace_resolver = NamespaceResolver("./",
... | [
"def",
"_ShowCompiledFile",
"(",
"self",
",",
"parsed_url",
",",
"head",
",",
"body",
")",
":",
"api_model",
"=",
"model",
".",
"Model",
"(",
")",
"request_path",
"=",
"self",
".",
"_GetRequestPath",
"(",
"parsed_url",
")",
"(",
"file_root",
",",
"file_ext... | Show the compiled version of a json or idl file given the path to the
compiled file. | [
"Show",
"the",
"compiled",
"version",
"of",
"a",
"json",
"or",
"idl",
"file",
"given",
"the",
"path",
"to",
"the",
"compiled",
"file",
"."
] | [
"\"\"\"Show the compiled version of a json or idl file given the path to the\n compiled file.\n \"\"\"",
"# Get main file.",
"# Generate code",
"# Do highlighting on the generated code"
] | [
{
"param": "self",
"type": null
},
{
"param": "parsed_url",
"type": null
},
{
"param": "head",
"type": null
},
{
"param": "body",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parsed_url",
"type": null,
"docstring": null,
"docstring_toke... |
1d6f43e04725027d157fd0094704a259f1fb4144 | sunlongbo/chromium | tools/json_schema_compiler/preview.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _GetHighlighterParams | <not_specific> | def _GetHighlighterParams(self, parsed_url):
"""Get the highlighting parameters from a parsed url.
"""
query_dict = urlparse.parse_qs(parsed_url.query)
return (query_dict.get('highlighter', ['pygments'])[0],
query_dict.get('style', ['colorful'])[0]) | Get the highlighting parameters from a parsed url.
| Get the highlighting parameters from a parsed url. | [
"Get",
"the",
"highlighting",
"parameters",
"from",
"a",
"parsed",
"url",
"."
] | def _GetHighlighterParams(self, parsed_url):
query_dict = urlparse.parse_qs(parsed_url.query)
return (query_dict.get('highlighter', ['pygments'])[0],
query_dict.get('style', ['colorful'])[0]) | [
"def",
"_GetHighlighterParams",
"(",
"self",
",",
"parsed_url",
")",
":",
"query_dict",
"=",
"urlparse",
".",
"parse_qs",
"(",
"parsed_url",
".",
"query",
")",
"return",
"(",
"query_dict",
".",
"get",
"(",
"'highlighter'",
",",
"[",
"'pygments'",
"]",
")",
... | Get the highlighting parameters from a parsed url. | [
"Get",
"the",
"highlighting",
"parameters",
"from",
"a",
"parsed",
"url",
"."
] | [
"\"\"\"Get the highlighting parameters from a parsed url.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "parsed_url",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parsed_url",
"type": null,
"docstring": null,
"docstring_toke... |
1d6f43e04725027d157fd0094704a259f1fb4144 | sunlongbo/chromium | tools/json_schema_compiler/preview.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _RenderNavPane | <not_specific> | def _RenderNavPane(self, path):
"""Renders an HTML nav pane.
This consists of a select element to set highlight style, and a list of all
files at |path| with the appropriate onclick handlers to open either
subdirectories or JSON files.
"""
html = code.Code()
# Highlighter chooser.
html... | Renders an HTML nav pane.
This consists of a select element to set highlight style, and a list of all
files at |path| with the appropriate onclick handlers to open either
subdirectories or JSON files.
| Renders an HTML nav pane.
This consists of a select element to set highlight style, and a list of all
files at |path| with the appropriate onclick handlers to open either
subdirectories or JSON files. | [
"Renders",
"an",
"HTML",
"nav",
"pane",
".",
"This",
"consists",
"of",
"a",
"select",
"element",
"to",
"set",
"highlight",
"style",
"and",
"a",
"list",
"of",
"all",
"files",
"at",
"|path|",
"with",
"the",
"appropriate",
"onclick",
"handlers",
"to",
"open",... | def _RenderNavPane(self, path):
html = code.Code()
html.Append('<select id="highlighters" onChange="updateEverything()">')
for name, highlighter in self.server.highlighters.items():
html.Append('<option value="%s">%s</option>' %
(name, highlighter.DisplayName()))
html.Append('</select>')... | [
"def",
"_RenderNavPane",
"(",
"self",
",",
"path",
")",
":",
"html",
"=",
"code",
".",
"Code",
"(",
")",
"html",
".",
"Append",
"(",
"'<select id=\"highlighters\" onChange=\"updateEverything()\">'",
")",
"for",
"name",
",",
"highlighter",
"in",
"self",
".",
"s... | Renders an HTML nav pane. | [
"Renders",
"an",
"HTML",
"nav",
"pane",
"."
] | [
"\"\"\"Renders an HTML nav pane.\n\n This consists of a select element to set highlight style, and a list of all\n files at |path| with the appropriate onclick handlers to open either\n subdirectories or JSON files.\n \"\"\"",
"# Highlighter chooser.",
"# Style for each highlighter.",
"# The corre... | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [... |
5c1166a77856ba27b75b44c2ba7b32353b394bc2 | sunlongbo/chromium | tools/perf/benchmarks/memory.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CreateCoreTimelineBasedMemoryMeasurementOptions | <not_specific> | def CreateCoreTimelineBasedMemoryMeasurementOptions():
"""Creates necessary TBM options for measuring memory usage.
Separated out so that code can be re-used in other benchmarks.
"""
# Enable only memory-infra, to get memory dumps, and blink.console, to get
# the timeline markers used for mapping threads to ... | Creates necessary TBM options for measuring memory usage.
Separated out so that code can be re-used in other benchmarks.
| Creates necessary TBM options for measuring memory usage.
Separated out so that code can be re-used in other benchmarks. | [
"Creates",
"necessary",
"TBM",
"options",
"for",
"measuring",
"memory",
"usage",
".",
"Separated",
"out",
"so",
"that",
"code",
"can",
"be",
"re",
"-",
"used",
"in",
"other",
"benchmarks",
"."
] | def CreateCoreTimelineBasedMemoryMeasurementOptions():
trace_memory = chrome_trace_category_filter.ChromeTraceCategoryFilter(
filter_string='-*,blink.console,disabled-by-default-memory-infra')
tbm_options = timeline_based_measurement.Options(
overhead_level=trace_memory)
tbm_options.config.enable_andr... | [
"def",
"CreateCoreTimelineBasedMemoryMeasurementOptions",
"(",
")",
":",
"trace_memory",
"=",
"chrome_trace_category_filter",
".",
"ChromeTraceCategoryFilter",
"(",
"filter_string",
"=",
"'-*,blink.console,disabled-by-default-memory-infra'",
")",
"tbm_options",
"=",
"timeline_based... | Creates necessary TBM options for measuring memory usage. | [
"Creates",
"necessary",
"TBM",
"options",
"for",
"measuring",
"memory",
"usage",
"."
] | [
"\"\"\"Creates necessary TBM options for measuring memory usage.\n\n Separated out so that code can be re-used in other benchmarks.\n \"\"\"",
"# Enable only memory-infra, to get memory dumps, and blink.console, to get",
"# the timeline markers used for mapping threads to tabs.",
"# Setting an empty memory ... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
5c1166a77856ba27b75b44c2ba7b32353b394bc2 | sunlongbo/chromium | tools/perf/benchmarks/memory.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | SetExtraBrowserOptionsForMemoryMeasurement | null | def SetExtraBrowserOptionsForMemoryMeasurement(options):
"""Sets extra browser args necessary for measuring memory usage.
Separated out so that code can be re-used in other benchmarks.
"""
# Just before we measure memory we flush the system caches
# unfortunately this doesn't immediately take effect, instead... | Sets extra browser args necessary for measuring memory usage.
Separated out so that code can be re-used in other benchmarks.
| Sets extra browser args necessary for measuring memory usage.
Separated out so that code can be re-used in other benchmarks. | [
"Sets",
"extra",
"browser",
"args",
"necessary",
"for",
"measuring",
"memory",
"usage",
".",
"Separated",
"out",
"so",
"that",
"code",
"can",
"be",
"re",
"-",
"used",
"in",
"other",
"benchmarks",
"."
] | def SetExtraBrowserOptionsForMemoryMeasurement(options):
options.flush_os_page_caches_on_start = True | [
"def",
"SetExtraBrowserOptionsForMemoryMeasurement",
"(",
"options",
")",
":",
"options",
".",
"flush_os_page_caches_on_start",
"=",
"True"
] | Sets extra browser args necessary for measuring memory usage. | [
"Sets",
"extra",
"browser",
"args",
"necessary",
"for",
"measuring",
"memory",
"usage",
"."
] | [
"\"\"\"Sets extra browser args necessary for measuring memory usage.\n\n Separated out so that code can be re-used in other benchmarks.\n \"\"\"",
"# Just before we measure memory we flush the system caches",
"# unfortunately this doesn't immediately take effect, instead",
"# the next page run is effected. ... | [
{
"param": "options",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "options",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a710b52cd8dbd2973476e125b04736aada73ff1e | sunlongbo/chromium | chrome/installer/mac/signing/signing.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | _linker_signed_arm64_needs_force | <not_specific> | def _linker_signed_arm64_needs_force(path):
"""Detects linker-signed arm64 code that can only be signed with --force
on this system.
Args:
path: A path to a code object to test.
Returns:
True if --force must be used with codesign --sign to successfully sign
the code, False othe... | Detects linker-signed arm64 code that can only be signed with --force
on this system.
Args:
path: A path to a code object to test.
Returns:
True if --force must be used with codesign --sign to successfully sign
the code, False otherwise.
| Detects linker-signed arm64 code that can only be signed with --force
on this system. | [
"Detects",
"linker",
"-",
"signed",
"arm64",
"code",
"that",
"can",
"only",
"be",
"signed",
"with",
"--",
"force",
"on",
"this",
"system",
"."
] | def _linker_signed_arm64_needs_force(path):
if commands.macos_version() >= [10, 16]:
return False
(returncode, stdout, stderr) = commands.lenient_run_command_output(
['codesign', '--display', '--verbose', '--arch=arm64', '--', path])
if returncode != 0:
return False
match = re.se... | [
"def",
"_linker_signed_arm64_needs_force",
"(",
"path",
")",
":",
"if",
"commands",
".",
"macos_version",
"(",
")",
">=",
"[",
"10",
",",
"16",
"]",
":",
"return",
"False",
"(",
"returncode",
",",
"stdout",
",",
"stderr",
")",
"=",
"commands",
".",
"leni... | Detects linker-signed arm64 code that can only be signed with --force
on this system. | [
"Detects",
"linker",
"-",
"signed",
"arm64",
"code",
"that",
"can",
"only",
"be",
"signed",
"with",
"--",
"force",
"on",
"this",
"system",
"."
] | [
"\"\"\"Detects linker-signed arm64 code that can only be signed with --force\n on this system.\n\n Args:\n path: A path to a code object to test.\n\n Returns:\n True if --force must be used with codesign --sign to successfully sign\n the code, False otherwise.\n \"\"\"",
"# On mac... | [
{
"param": "path",
"type": null
}
] | {
"returns": [
{
"docstring": "True if --force must be used with codesign --sign to successfully sign\nthe code, False otherwise.",
"docstring_tokens": [
"True",
"if",
"--",
"force",
"must",
"be",
"used",
"with",
"codesign",
... |
a710b52cd8dbd2973476e125b04736aada73ff1e | sunlongbo/chromium | chrome/installer/mac/signing/signing.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | verify_part | null | def verify_part(paths, part):
"""Displays and verifies the code signature of a part.
Args:
paths: A |model.Paths| object.
part: The |model.CodeSignedProduct| to verify. The product's |path|
must be in |paths.work|.
"""
verify_options = list(part.verify_options) if part.verif... | Displays and verifies the code signature of a part.
Args:
paths: A |model.Paths| object.
part: The |model.CodeSignedProduct| to verify. The product's |path|
must be in |paths.work|.
| Displays and verifies the code signature of a part. | [
"Displays",
"and",
"verifies",
"the",
"code",
"signature",
"of",
"a",
"part",
"."
] | def verify_part(paths, part):
verify_options = list(part.verify_options) if part.verify_options else []
part_path = os.path.join(paths.work, part.path)
commands.run_command([
'codesign', '--display', '--verbose=5', '--requirements', '-', part_path
])
commands.run_command(['codesign', '--veri... | [
"def",
"verify_part",
"(",
"paths",
",",
"part",
")",
":",
"verify_options",
"=",
"list",
"(",
"part",
".",
"verify_options",
")",
"if",
"part",
".",
"verify_options",
"else",
"[",
"]",
"part_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"paths",
".... | Displays and verifies the code signature of a part. | [
"Displays",
"and",
"verifies",
"the",
"code",
"signature",
"of",
"a",
"part",
"."
] | [
"\"\"\"Displays and verifies the code signature of a part.\n\n Args:\n paths: A |model.Paths| object.\n part: The |model.CodeSignedProduct| to verify. The product's |path|\n must be in |paths.work|.\n \"\"\""
] | [
{
"param": "paths",
"type": null
},
{
"param": "part",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "paths",
"type": null,
"docstring": "A |model.Paths| object.",
"docstring_tokens": [
"A",
"|model",
".",
"Paths|",
"object",
"."
],
"default": null,
"is_optional... |
a710b52cd8dbd2973476e125b04736aada73ff1e | sunlongbo/chromium | chrome/installer/mac/signing/signing.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | validate_app | null | def validate_app(paths, config, part):
"""Displays and verifies the signature of a CodeSignedProduct.
Args:
paths: A |model.Paths| object.
conifg: The |model.CodeSignConfig| object.
part: The |model.CodeSignedProduct| for the outer application bundle.
"""
app_path = os.path.join... | Displays and verifies the signature of a CodeSignedProduct.
Args:
paths: A |model.Paths| object.
conifg: The |model.CodeSignConfig| object.
part: The |model.CodeSignedProduct| for the outer application bundle.
| Displays and verifies the signature of a CodeSignedProduct. | [
"Displays",
"and",
"verifies",
"the",
"signature",
"of",
"a",
"CodeSignedProduct",
"."
] | def validate_app(paths, config, part):
app_path = os.path.join(paths.work, part.path)
commands.run_command([
'codesign', '--display', '--requirements', '-', '--verbose=5', app_path
])
if config.run_spctl_assess:
commands.run_command(['spctl', '--assess', '-vv', app_path]) | [
"def",
"validate_app",
"(",
"paths",
",",
"config",
",",
"part",
")",
":",
"app_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"paths",
".",
"work",
",",
"part",
".",
"path",
")",
"commands",
".",
"run_command",
"(",
"[",
"'codesign'",
",",
"'--dis... | Displays and verifies the signature of a CodeSignedProduct. | [
"Displays",
"and",
"verifies",
"the",
"signature",
"of",
"a",
"CodeSignedProduct",
"."
] | [
"\"\"\"Displays and verifies the signature of a CodeSignedProduct.\n\n Args:\n paths: A |model.Paths| object.\n conifg: The |model.CodeSignConfig| object.\n part: The |model.CodeSignedProduct| for the outer application bundle.\n \"\"\""
] | [
{
"param": "paths",
"type": null
},
{
"param": "config",
"type": null
},
{
"param": "part",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "paths",
"type": null,
"docstring": "A |model.Paths| object.",
"docstring_tokens": [
"A",
"|model",
".",
"Paths|",
"object",
"."
],
"default": null,
"is_optional... |
a7137baa8a19d5f7dbb67fafc830c6673e560cbf | sunlongbo/chromium | remoting/host/linux/configure_url_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | env_with_current_desktop | dict[str, str] | def env_with_current_desktop(desktop_env: str) -> dict[str, str]:
"""Returns an environment variable dictionary with XDG_CURRENT_DESKTOP set to
|desktop_env|."""
env = os.environ.copy()
env['XDG_CURRENT_DESKTOP'] = desktop_env
return env | Returns an environment variable dictionary with XDG_CURRENT_DESKTOP set to
|desktop_env|. | Returns an environment variable dictionary with XDG_CURRENT_DESKTOP set to
|desktop_env|. | [
"Returns",
"an",
"environment",
"variable",
"dictionary",
"with",
"XDG_CURRENT_DESKTOP",
"set",
"to",
"|desktop_env|",
"."
] | def env_with_current_desktop(desktop_env: str) -> dict[str, str]:
env = os.environ.copy()
env['XDG_CURRENT_DESKTOP'] = desktop_env
return env | [
"def",
"env_with_current_desktop",
"(",
"desktop_env",
":",
"str",
")",
"->",
"dict",
"[",
"str",
",",
"str",
"]",
":",
"env",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"env",
"[",
"'XDG_CURRENT_DESKTOP'",
"]",
"=",
"desktop_env",
"return",
"env"... | Returns an environment variable dictionary with XDG_CURRENT_DESKTOP set to
|desktop_env|. | [
"Returns",
"an",
"environment",
"variable",
"dictionary",
"with",
"XDG_CURRENT_DESKTOP",
"set",
"to",
"|desktop_env|",
"."
] | [
"\"\"\"Returns an environment variable dictionary with XDG_CURRENT_DESKTOP set to\n |desktop_env|.\"\"\""
] | [
{
"param": "desktop_env",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "desktop_env",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a7137baa8a19d5f7dbb67fafc830c6673e560cbf | sunlongbo/chromium | remoting/host/linux/configure_url_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | load_host_settings_file | dict[str, str] | def load_host_settings_file() -> dict[str, str]:
"""Loads and returns the host settings JSON."""
if not os.path.isfile(HOST_SETTINGS_PATH):
return {}
with open(HOST_SETTINGS_PATH, 'r') as settings_file:
try:
return json.load(settings_file)
except JSONDecodeError as e:
print('Failed to loa... | Loads and returns the host settings JSON. | Loads and returns the host settings JSON. | [
"Loads",
"and",
"returns",
"the",
"host",
"settings",
"JSON",
"."
] | def load_host_settings_file() -> dict[str, str]:
if not os.path.isfile(HOST_SETTINGS_PATH):
return {}
with open(HOST_SETTINGS_PATH, 'r') as settings_file:
try:
return json.load(settings_file)
except JSONDecodeError as e:
print('Failed to load JSON file:', e, file=sys.stderr)
return {} | [
"def",
"load_host_settings_file",
"(",
")",
"->",
"dict",
"[",
"str",
",",
"str",
"]",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"HOST_SETTINGS_PATH",
")",
":",
"return",
"{",
"}",
"with",
"open",
"(",
"HOST_SETTINGS_PATH",
",",
"'r'",
"... | Loads and returns the host settings JSON. | [
"Loads",
"and",
"returns",
"the",
"host",
"settings",
"JSON",
"."
] | [
"\"\"\"Loads and returns the host settings JSON.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
a7137baa8a19d5f7dbb67fafc830c6673e560cbf | sunlongbo/chromium | remoting/host/linux/configure_url_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | save_host_settings_file | None | def save_host_settings_file(settings: dict[str, str]) -> None:
"""Saves the host settings JSON to the file."""
with open(HOST_SETTINGS_PATH, 'w') as settings_file:
json.dump(settings, settings_file) | Saves the host settings JSON to the file. | Saves the host settings JSON to the file. | [
"Saves",
"the",
"host",
"settings",
"JSON",
"to",
"the",
"file",
"."
] | def save_host_settings_file(settings: dict[str, str]) -> None:
with open(HOST_SETTINGS_PATH, 'w') as settings_file:
json.dump(settings, settings_file) | [
"def",
"save_host_settings_file",
"(",
"settings",
":",
"dict",
"[",
"str",
",",
"str",
"]",
")",
"->",
"None",
":",
"with",
"open",
"(",
"HOST_SETTINGS_PATH",
",",
"'w'",
")",
"as",
"settings_file",
":",
"json",
".",
"dump",
"(",
"settings",
",",
"setti... | Saves the host settings JSON to the file. | [
"Saves",
"the",
"host",
"settings",
"JSON",
"to",
"the",
"file",
"."
] | [
"\"\"\"Saves the host settings JSON to the file.\"\"\""
] | [
{
"param": "settings",
"type": "dict[str, str]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "settings",
"type": "dict[str, str]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a7137baa8a19d5f7dbb67fafc830c6673e560cbf | sunlongbo/chromium | remoting/host/linux/configure_url_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | restore_default_browser | None | def restore_default_browser(
desktop_env: str,
backup_dict: dict[str, str],
backup_key: str) -> None:
"""Restores XDG default-web-browser to backup_dict[backup_key] on the given
desktop environment.
Args:
desktop_env: The desktop environment to be configured.
backup_dict: The dictionary where... | Restores XDG default-web-browser to backup_dict[backup_key] on the given
desktop environment.
Args:
desktop_env: The desktop environment to be configured.
backup_dict: The dictionary where the previous configuration can be found.
backup_key: The dictionary key to find the previous configuration.
| Restores XDG default-web-browser to backup_dict[backup_key] on the given
desktop environment. | [
"Restores",
"XDG",
"default",
"-",
"web",
"-",
"browser",
"to",
"backup_dict",
"[",
"backup_key",
"]",
"on",
"the",
"given",
"desktop",
"environment",
"."
] | def restore_default_browser(
desktop_env: str,
backup_dict: dict[str, str],
backup_key: str) -> None:
if (backup_key not in backup_dict) or not backup_dict[backup_key]:
print("No setting to restore from", backup_key, file=sys.stderr)
return
previous_setting = backup_dict[backup_key]
if (previo... | [
"def",
"restore_default_browser",
"(",
"desktop_env",
":",
"str",
",",
"backup_dict",
":",
"dict",
"[",
"str",
",",
"str",
"]",
",",
"backup_key",
":",
"str",
")",
"->",
"None",
":",
"if",
"(",
"backup_key",
"not",
"in",
"backup_dict",
")",
"or",
"not",
... | Restores XDG default-web-browser to backup_dict[backup_key] on the given
desktop environment. | [
"Restores",
"XDG",
"default",
"-",
"web",
"-",
"browser",
"to",
"backup_dict",
"[",
"backup_key",
"]",
"on",
"the",
"given",
"desktop",
"environment",
"."
] | [
"\"\"\"Restores XDG default-web-browser to backup_dict[backup_key] on the given\n desktop environment.\n\n Args:\n desktop_env: The desktop environment to be configured.\n backup_dict: The dictionary where the previous configuration can be found.\n backup_key: The dictionary key to find the previous conf... | [
{
"param": "desktop_env",
"type": "str"
},
{
"param": "backup_dict",
"type": "dict[str, str]"
},
{
"param": "backup_key",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "desktop_env",
"type": "str",
"docstring": "The desktop environment to be configured.",
"docstring_tokens": [
"The",
"desktop",
"environment",
"to",
"be",
"configured",
".... |
a7137baa8a19d5f7dbb67fafc830c6673e560cbf | sunlongbo/chromium | remoting/host/linux/configure_url_forwarder.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | check_default_browser_is_url_forwarder | None | def check_default_browser_is_url_forwarder(desktop_env: str) -> None:
"""Checks if the default browser is set to the remote URL forwarder on the
given desktop environment. Exits with 1 if it's not the case."""
if (desktop_env != 'XFCE' and
get_default_browser(desktop_env) == XFCE4_WEB_BROWSER_DESKTOP_ENTRY... | Checks if the default browser is set to the remote URL forwarder on the
given desktop environment. Exits with 1 if it's not the case. | Checks if the default browser is set to the remote URL forwarder on the
given desktop environment. Exits with 1 if it's not the case. | [
"Checks",
"if",
"the",
"default",
"browser",
"is",
"set",
"to",
"the",
"remote",
"URL",
"forwarder",
"on",
"the",
"given",
"desktop",
"environment",
".",
"Exits",
"with",
"1",
"if",
"it",
"'",
"s",
"not",
"the",
"case",
"."
] | def check_default_browser_is_url_forwarder(desktop_env: str) -> None:
if (desktop_env != 'XFCE' and
get_default_browser(desktop_env) == XFCE4_WEB_BROWSER_DESKTOP_ENTRY):
print('Default browser for', desktop_env, 'is',
XFCE4_WEB_BROWSER_DESKTOP_ENTRY,
'. Checking default browser for XFCE ... | [
"def",
"check_default_browser_is_url_forwarder",
"(",
"desktop_env",
":",
"str",
")",
"->",
"None",
":",
"if",
"(",
"desktop_env",
"!=",
"'XFCE'",
"and",
"get_default_browser",
"(",
"desktop_env",
")",
"==",
"XFCE4_WEB_BROWSER_DESKTOP_ENTRY",
")",
":",
"print",
"(",... | Checks if the default browser is set to the remote URL forwarder on the
given desktop environment. | [
"Checks",
"if",
"the",
"default",
"browser",
"is",
"set",
"to",
"the",
"remote",
"URL",
"forwarder",
"on",
"the",
"given",
"desktop",
"environment",
"."
] | [
"\"\"\"Checks if the default browser is set to the remote URL forwarder on the\n given desktop environment. Exits with 1 if it's not the case.\"\"\""
] | [
{
"param": "desktop_env",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "desktop_env",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a72e2a583d58e6c6b318de8712b4cd9928227fd2 | sunlongbo/chromium | chrome/test/mini_installer/process_operations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | VerifyProcessExpectation | null | def VerifyProcessExpectation(expectation_name, expectation, variable_expander):
"""Verifies that a file is present or absent, throwing an AssertionError if
the expectation is not met.
Args:
expectation_name: Path to the process being verified (may contain
variables to be expanded).
... | Verifies that a file is present or absent, throwing an AssertionError if
the expectation is not met.
Args:
expectation_name: Path to the process being verified (may contain
variables to be expanded).
expectation: A dictionary with the following key and value:
'running' a... | Verifies that a file is present or absent, throwing an AssertionError if
the expectation is not met. | [
"Verifies",
"that",
"a",
"file",
"is",
"present",
"or",
"absent",
"throwing",
"an",
"AssertionError",
"if",
"the",
"expectation",
"is",
"not",
"met",
"."
] | def VerifyProcessExpectation(expectation_name, expectation, variable_expander):
running_process_paths = [
path for (_, path) in chrome_helper.GetProcessIDAndPathPairs()
]
process_path = variable_expander.Expand(expectation_name)
is_running = process_path in running_process_paths
assert expec... | [
"def",
"VerifyProcessExpectation",
"(",
"expectation_name",
",",
"expectation",
",",
"variable_expander",
")",
":",
"running_process_paths",
"=",
"[",
"path",
"for",
"(",
"_",
",",
"path",
")",
"in",
"chrome_helper",
".",
"GetProcessIDAndPathPairs",
"(",
")",
"]",... | Verifies that a file is present or absent, throwing an AssertionError if
the expectation is not met. | [
"Verifies",
"that",
"a",
"file",
"is",
"present",
"or",
"absent",
"throwing",
"an",
"AssertionError",
"if",
"the",
"expectation",
"is",
"not",
"met",
"."
] | [
"\"\"\"Verifies that a file is present or absent, throwing an AssertionError if\n the expectation is not met.\n\n Args:\n expectation_name: Path to the process being verified (may contain\n variables to be expanded).\n expectation: A dictionary with the following key and value:\n ... | [
{
"param": "expectation_name",
"type": null
},
{
"param": "expectation",
"type": null
},
{
"param": "variable_expander",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "If an expectation is not satisfied.",
"docstring_tokens": [
"If",
"an",
"expectation",
"is",
"not",
"satisfied",
"."
],
"type": "AssertionError"
}
],
"params": [
{
"iden... |
a72e2a583d58e6c6b318de8712b4cd9928227fd2 | sunlongbo/chromium | chrome/test/mini_installer/process_operations.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CleanProcess | null | def CleanProcess(expectation_name, expectation, variable_expander):
"""Terminates processes based on expectations.
Args:
expectation_name: Path to a process's executable.
expectation: A dictionary describing the state of the process:
'running': A boolean False indicating that the pr... | Terminates processes based on expectations.
Args:
expectation_name: Path to a process's executable.
expectation: A dictionary describing the state of the process:
'running': A boolean False indicating that the process must not be
running.
variable_expander: A Var... | Terminates processes based on expectations. | [
"Terminates",
"processes",
"based",
"on",
"expectations",
"."
] | def CleanProcess(expectation_name, expectation, variable_expander):
process_path = variable_expander.Expand(expectation_name)
assert not expectation['running'], (
'Invalid expectation for CleanProcess operation: \'running\' property '
+ 'for %s must not be True' % process_path)
for proc in p... | [
"def",
"CleanProcess",
"(",
"expectation_name",
",",
"expectation",
",",
"variable_expander",
")",
":",
"process_path",
"=",
"variable_expander",
".",
"Expand",
"(",
"expectation_name",
")",
"assert",
"not",
"expectation",
"[",
"'running'",
"]",
",",
"(",
"'Invali... | Terminates processes based on expectations. | [
"Terminates",
"processes",
"based",
"on",
"expectations",
"."
] | [
"\"\"\"Terminates processes based on expectations.\n\n Args:\n expectation_name: Path to a process's executable.\n expectation: A dictionary describing the state of the process:\n 'running': A boolean False indicating that the process must not be\n running.\n variab... | [
{
"param": "expectation_name",
"type": null
},
{
"param": "expectation",
"type": null
},
{
"param": "variable_expander",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "If an expectation is not satisfied.",
"docstring_tokens": [
"If",
"an",
"expectation",
"is",
"not",
"satisfied",
"."
],
"type": "AssertionError"
},
{
"docstring": "If an err... |
b4688cf21083009eb82c5ce00c9ce4642e61eb24 | sunlongbo/chromium | chrome/updater/test/service/win/rpc_handler.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunAsSystem | <not_specific> | def RunAsSystem(self, command, env=None, cwd=None, timeout=30):
"""Runs the command as SYSTEM user.
Args:
command: The command to run. This argument will be forwarded to
subprocess.Popen().
env: Environment variables to pass to command.
cwd: Working directory for the command.
ti... | Runs the command as SYSTEM user.
Args:
command: The command to run. This argument will be forwarded to
subprocess.Popen().
env: Environment variables to pass to command.
cwd: Working directory for the command.
timeout: How long the child process should wait before timeout.
Retu... | Runs the command as SYSTEM user. | [
"Runs",
"the",
"command",
"as",
"SYSTEM",
"user",
"."
] | def RunAsSystem(self, command, env=None, cwd=None, timeout=30):
try:
process = subprocess.Popen(
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
env=env, cwd=cwd)
stdout, stderr = process.communicate()
logging.info('Command %s stdout:\n %s', command, stdout)
if s... | [
"def",
"RunAsSystem",
"(",
"self",
",",
"command",
",",
"env",
"=",
"None",
",",
"cwd",
"=",
"None",
",",
"timeout",
"=",
"30",
")",
":",
"try",
":",
"process",
"=",
"subprocess",
".",
"Popen",
"(",
"command",
",",
"stdout",
"=",
"subprocess",
".",
... | Runs the command as SYSTEM user. | [
"Runs",
"the",
"command",
"as",
"SYSTEM",
"user",
"."
] | [
"\"\"\"Runs the command as SYSTEM user.\n\n Args:\n command: The command to run. This argument will be forwarded to\n subprocess.Popen().\n env: Environment variables to pass to command.\n cwd: Working directory for the command.\n timeout: How long the child process should wait before ... | [
{
"param": "self",
"type": null
},
{
"param": "command",
"type": null
},
{
"param": "env",
"type": null
},
{
"param": "cwd",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [
{
"docstring": "(pid, exit_code, sdtout, stderr) tuple.",
"docstring_tokens": [
"(",
"pid",
"exit_code",
"sdtout",
"stderr",
")",
"tuple",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
... |
b4688cf21083009eb82c5ce00c9ce4642e61eb24 | sunlongbo/chromium | chrome/updater/test/service/win/rpc_handler.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | RunAsStandardUser | <not_specific> | def RunAsStandardUser(self, command_line, env=None, cwd=None, timeout=30):
"""Runs the command as the non-elevated logon user on default desktop.
Args:
command_line: The command line string, includes all arguments.
env: Environment variables to pass to command.
cwd: Working directory for the ... | Runs the command as the non-elevated logon user on default desktop.
Args:
command_line: The command line string, includes all arguments.
env: Environment variables to pass to command.
cwd: Working directory for the command.
timeout: How long the child process should wait before timeout.
... | Runs the command as the non-elevated logon user on default desktop. | [
"Runs",
"the",
"command",
"as",
"the",
"non",
"-",
"elevated",
"logon",
"user",
"on",
"default",
"desktop",
"."
] | def RunAsStandardUser(self, command_line, env=None, cwd=None, timeout=30):
return impersonate.RunAsStandardUser(command_line, env, cwd, timeout) | [
"def",
"RunAsStandardUser",
"(",
"self",
",",
"command_line",
",",
"env",
"=",
"None",
",",
"cwd",
"=",
"None",
",",
"timeout",
"=",
"30",
")",
":",
"return",
"impersonate",
".",
"RunAsStandardUser",
"(",
"command_line",
",",
"env",
",",
"cwd",
",",
"tim... | Runs the command as the non-elevated logon user on default desktop. | [
"Runs",
"the",
"command",
"as",
"the",
"non",
"-",
"elevated",
"logon",
"user",
"on",
"default",
"desktop",
"."
] | [
"\"\"\"Runs the command as the non-elevated logon user on default desktop.\n\n Args:\n command_line: The command line string, includes all arguments.\n env: Environment variables to pass to command.\n cwd: Working directory for the command.\n timeout: How long the child process should wait be... | [
{
"param": "self",
"type": null
},
{
"param": "command_line",
"type": null
},
{
"param": "env",
"type": null
},
{
"param": "cwd",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [
{
"docstring": "(pid, exit_code, sdtout, stderr) tuple.",
"docstring_tokens": [
"(",
"pid",
"exit_code",
"sdtout",
"stderr",
")",
"tuple",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
... |
b4688cf21083009eb82c5ce00c9ce4642e61eb24 | sunlongbo/chromium | chrome/updater/test/service/win/rpc_handler.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | AnswerUpcomingUACPrompt | <not_specific> | def AnswerUpcomingUACPrompt(self,
actions,
timeout=10,
wait_child=False,
source=''):
"""Answers upcoming UAC prompt that does not require username/password.
Args:
actions: Actions to ta... | Answers upcoming UAC prompt that does not require username/password.
Args:
actions: Actions to take in string, such as 'AADDA', 'A' to accept,
'D' to deny.
timeout: How long the child process should wait for each UAC click.
wait_child: Whether this thread should wait the completion of c... | Answers upcoming UAC prompt that does not require username/password. | [
"Answers",
"upcoming",
"UAC",
"prompt",
"that",
"does",
"not",
"require",
"username",
"/",
"password",
"."
] | def AnswerUpcomingUACPrompt(self,
actions,
timeout=10,
wait_child=False,
source=''):
uac_tool = os.path.join(os.path.dirname(__file__), 'answer_uac.py')
command = ('python %s --actions=%s --ti... | [
"def",
"AnswerUpcomingUACPrompt",
"(",
"self",
",",
"actions",
",",
"timeout",
"=",
"10",
",",
"wait_child",
"=",
"False",
",",
"source",
"=",
"''",
")",
":",
"uac_tool",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(... | Answers upcoming UAC prompt that does not require username/password. | [
"Answers",
"upcoming",
"UAC",
"prompt",
"that",
"does",
"not",
"require",
"username",
"/",
"password",
"."
] | [
"\"\"\"Answers upcoming UAC prompt that does not require username/password.\n\n Args:\n actions: Actions to take in string, such as 'AADDA', 'A' to accept,\n 'D' to deny.\n timeout: How long the child process should wait for each UAC click.\n wait_child: Whether this thread should wait th... | [
{
"param": "self",
"type": null
},
{
"param": "actions",
"type": null
},
{
"param": "timeout",
"type": null
},
{
"param": "wait_child",
"type": null
},
{
"param": "source",
"type": null
}
] | {
"returns": [
{
"docstring": "(pid, exit_code) of the created UAC-answering process. If the sub-process\nis not created, or did not finish in wait time, returns (None, None).",
"docstring_tokens": [
"(",
"pid",
"exit_code",
")",
"of",
"the",
"cr... |
54b0ec65bf9dd231312d4d73918ce870ff9e22b4 | sunlongbo/chromium | tools/perf/experimental/story_clustering/similarity_calculator.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | CalculateDistances | <not_specific> | def CalculateDistances(
input_dataframe,
metric,
normalize=False,
output_path=None):
"""Calculates the distances of stories.
If normalize flag is set the values are first normalized using min-max
normalization. Then the similarity measure between every two stories is
calculated using pearson correlatio... | Calculates the distances of stories.
If normalize flag is set the values are first normalized using min-max
normalization. Then the similarity measure between every two stories is
calculated using pearson correlation.
Args:
input_dataframe: A dataframe containing a list of records
having (test_case, c... | Calculates the distances of stories.
If normalize flag is set the values are first normalized using min-max
normalization. Then the similarity measure between every two stories is
calculated using pearson correlation.
A dataframe containing a list of records
having (test_case, commit_pos, bot, value).
metric: String c... | [
"Calculates",
"the",
"distances",
"of",
"stories",
".",
"If",
"normalize",
"flag",
"is",
"set",
"the",
"values",
"are",
"first",
"normalized",
"using",
"min",
"-",
"max",
"normalization",
".",
"Then",
"the",
"similarity",
"measure",
"between",
"every",
"two",
... | def CalculateDistances(
input_dataframe,
metric,
normalize=False,
output_path=None):
input_by_story = input_dataframe.groupby('test_case')['value']
total_values_per_story = input_by_story.size()
nan_values_per_story = input_by_story.apply(lambda s: s.isna().sum())
should_keep = nan_values_per_story < (
... | [
"def",
"CalculateDistances",
"(",
"input_dataframe",
",",
"metric",
",",
"normalize",
"=",
"False",
",",
"output_path",
"=",
"None",
")",
":",
"input_by_story",
"=",
"input_dataframe",
".",
"groupby",
"(",
"'test_case'",
")",
"[",
"'value'",
"]",
"total_values_p... | Calculates the distances of stories. | [
"Calculates",
"the",
"distances",
"of",
"stories",
"."
] | [
"\"\"\"Calculates the distances of stories.\n\n If normalize flag is set the values are first normalized using min-max\n normalization. Then the similarity measure between every two stories is\n calculated using pearson correlation.\n\n Args:\n input_dataframe: A dataframe containing a list of records\n h... | [
{
"param": "input_dataframe",
"type": null
},
{
"param": "metric",
"type": null
},
{
"param": "normalize",
"type": null
},
{
"param": "output_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_dataframe",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "metric",
"type": null,
"docstring": null,
"docstri... |
d14465b1d583952b03092345a96cc147d9cd97ca | sunlongbo/chromium | third_party/blink/renderer/bindings/scripts/web_idl/extended_attribute.py | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Python | value | <not_specific> | def value(self):
"""
Returns the value for format Ident. Returns None for format NoArgs.
Otherwise, raises a ValueError.
"""
if self._format in (self._FORM_NO_ARGS, self._FORM_IDENT):
return self._values
raise ValueError('[{}] does not have a single value.'.f... |
Returns the value for format Ident. Returns None for format NoArgs.
Otherwise, raises a ValueError.
| Returns the value for format Ident. Returns None for format NoArgs.
Otherwise, raises a ValueError. | [
"Returns",
"the",
"value",
"for",
"format",
"Ident",
".",
"Returns",
"None",
"for",
"format",
"NoArgs",
".",
"Otherwise",
"raises",
"a",
"ValueError",
"."
] | def value(self):
if self._format in (self._FORM_NO_ARGS, self._FORM_IDENT):
return self._values
raise ValueError('[{}] does not have a single value.'.format(
self.syntactic_form)) | [
"def",
"value",
"(",
"self",
")",
":",
"if",
"self",
".",
"_format",
"in",
"(",
"self",
".",
"_FORM_NO_ARGS",
",",
"self",
".",
"_FORM_IDENT",
")",
":",
"return",
"self",
".",
"_values",
"raise",
"ValueError",
"(",
"'[{}] does not have a single value.'",
"."... | Returns the value for format Ident. | [
"Returns",
"the",
"value",
"for",
"format",
"Ident",
"."
] | [
"\"\"\"\n Returns the value for format Ident. Returns None for format NoArgs.\n Otherwise, raises a ValueError.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.