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
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetUsageString
<not_specific>
def GetUsageString(self): """Returns a brief string describing the argument's usage.""" if not self.positional: string = self.names[0] if self.type in Command.Argument.TYPES_WITH_VALUES: string += "="+self.metaname else: string = self.metaname if not self.requi...
Returns a brief string describing the argument's usage.
Returns a brief string describing the argument's usage.
[ "Returns", "a", "brief", "string", "describing", "the", "argument", "'", "s", "usage", "." ]
def GetUsageString(self): if not self.positional: string = self.names[0] if self.type in Command.Argument.TYPES_WITH_VALUES: string += "="+self.metaname else: string = self.metaname if not self.required: string = "["+string+"]" return string
[ "def", "GetUsageString", "(", "self", ")", ":", "if", "not", "self", ".", "positional", ":", "string", "=", "self", ".", "names", "[", "0", "]", "if", "self", ".", "type", "in", "Command", ".", "Argument", ".", "TYPES_WITH_VALUES", ":", "string", "+=",...
Returns a brief string describing the argument's usage.
[ "Returns", "a", "brief", "string", "describing", "the", "argument", "'", "s", "usage", "." ]
[ "\"\"\"Returns a brief string describing the argument's usage.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetNames
<not_specific>
def GetNames(self): """Returns a string containing a list of the arg's names.""" if self.positional: return self.metaname else: return ", ".join(self.names)
Returns a string containing a list of the arg's names.
Returns a string containing a list of the arg's names.
[ "Returns", "a", "string", "containing", "a", "list", "of", "the", "arg", "'", "s", "names", "." ]
def GetNames(self): if self.positional: return self.metaname else: return ", ".join(self.names)
[ "def", "GetNames", "(", "self", ")", ":", "if", "self", ".", "positional", ":", "return", "self", ".", "metaname", "else", ":", "return", "\", \"", ".", "join", "(", "self", ".", "names", ")" ]
Returns a string containing a list of the arg's names.
[ "Returns", "a", "string", "containing", "a", "list", "of", "the", "arg", "'", "s", "names", "." ]
[ "\"\"\"Returns a string containing a list of the arg's names.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetHelpString
<not_specific>
def GetHelpString(self, width=80, indent=5, names_width=20, gutter=2): """Returns a help string including help for all the arguments.""" names = [" "*indent + line +" "*(names_width-len(line)) for line in textwrap.wrap(self.GetNames(), names_width)] helpstring = textwrap.wrap(self.help...
Returns a help string including help for all the arguments.
Returns a help string including help for all the arguments.
[ "Returns", "a", "help", "string", "including", "help", "for", "all", "the", "arguments", "." ]
def GetHelpString(self, width=80, indent=5, names_width=20, gutter=2): names = [" "*indent + line +" "*(names_width-len(line)) for line in textwrap.wrap(self.GetNames(), names_width)] helpstring = textwrap.wrap(self.helptext, width-indent-names_width-gutter) if len(names) < len(helpstri...
[ "def", "GetHelpString", "(", "self", ",", "width", "=", "80", ",", "indent", "=", "5", ",", "names_width", "=", "20", ",", "gutter", "=", "2", ")", ":", "names", "=", "[", "\" \"", "*", "indent", "+", "line", "+", "\" \"", "*", "(", "names_width", ...
Returns a help string including help for all the arguments.
[ "Returns", "a", "help", "string", "including", "help", "for", "all", "the", "arguments", "." ]
[ "\"\"\"Returns a help string including help for all the arguments.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "width", "type": null }, { "param": "indent", "type": null }, { "param": "names_width", "type": null }, { "param": "gutter", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "width", "type": null, "docstring": null, "docstring_tokens": ...
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
AddArgument
<not_specific>
def AddArgument(self, names, helptext, type="string", metaname=None, required=False, default=None, positional=False): """Command-line argument to a command. Args: names: argument name, or list of synonyms helptext: brief description of the argument type: type of...
Command-line argument to a command. Args: names: argument name, or list of synonyms helptext: brief description of the argument type: type of the argument metaname: Name to display for value in help, inferred if not required: True if argument must be specified d...
Command-line argument to a command.
[ "Command", "-", "line", "argument", "to", "a", "command", "." ]
def AddArgument(self, names, helptext, type="string", metaname=None, required=False, default=None, positional=False): if IsString(names): names = [names] names = [name.lower() for name in names] for name in names: if name in self.arg_dict: raise ValueError("%s is already an a...
[ "def", "AddArgument", "(", "self", ",", "names", ",", "helptext", ",", "type", "=", "\"string\"", ",", "metaname", "=", "None", ",", "required", "=", "False", ",", "default", "=", "None", ",", "positional", "=", "False", ")", ":", "if", "IsString", "("...
Command-line argument to a command.
[ "Command", "-", "line", "argument", "to", "a", "command", "." ]
[ "\"\"\"Command-line argument to a command.\n\n Args:\n names: argument name, or list of synonyms\n helptext: brief description of the argument\n type: type of the argument\n metaname: Name to display for value in help, inferred if not\n required: True if argument must be...
[ { "param": "self", "type": null }, { "param": "names", "type": null }, { "param": "helptext", "type": null }, { "param": "type", "type": null }, { "param": "metaname", "type": null }, { "param": "required", "type": null }, { "param": "defau...
{ "returns": [ { "docstring": "The newly-created argument", "docstring_tokens": [ "The", "newly", "-", "created", "argument" ], "type": null } ], "raises": [ { "docstring": "the argument already exists or is invalid", "docstri...
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
AddMutualExclusion
null
def AddMutualExclusion(self, args): """Specifies that a list of arguments are mutually exclusive.""" if len(args) < 2: raise ValueError("At least two arguments must be specified.") args = [arg.lower() for arg in args] for index in xrange(len(args)-1): for index2 in xrange(index+1, len(args...
Specifies that a list of arguments are mutually exclusive.
Specifies that a list of arguments are mutually exclusive.
[ "Specifies", "that", "a", "list", "of", "arguments", "are", "mutually", "exclusive", "." ]
def AddMutualExclusion(self, args): if len(args) < 2: raise ValueError("At least two arguments must be specified.") args = [arg.lower() for arg in args] for index in xrange(len(args)-1): for index2 in xrange(index+1, len(args)): self.arg_dict[args[index]].AddMutualExclusion(self.arg_dict...
[ "def", "AddMutualExclusion", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", "<", "2", ":", "raise", "ValueError", "(", "\"At least two arguments must be specified.\"", ")", "args", "=", "[", "arg", ".", "lower", "(", ")", "for", "arg", ...
Specifies that a list of arguments are mutually exclusive.
[ "Specifies", "that", "a", "list", "of", "arguments", "are", "mutually", "exclusive", "." ]
[ "\"\"\"Specifies that a list of arguments are mutually exclusive.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": [...
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
AddDependency
null
def AddDependency(self, dependent, depends_on): """Specifies that one argument may only be present if another is. Args: dependent: the name of the dependent argument depends_on: the name of the argument on which it depends """ self.arg_dict[dependent.lower()].AddDependency( self.arg_...
Specifies that one argument may only be present if another is. Args: dependent: the name of the dependent argument depends_on: the name of the argument on which it depends
Specifies that one argument may only be present if another is.
[ "Specifies", "that", "one", "argument", "may", "only", "be", "present", "if", "another", "is", "." ]
def AddDependency(self, dependent, depends_on): self.arg_dict[dependent.lower()].AddDependency( self.arg_dict[depends_on.lower()])
[ "def", "AddDependency", "(", "self", ",", "dependent", ",", "depends_on", ")", ":", "self", ".", "arg_dict", "[", "dependent", ".", "lower", "(", ")", "]", ".", "AddDependency", "(", "self", ".", "arg_dict", "[", "depends_on", ".", "lower", "(", ")", "...
Specifies that one argument may only be present if another is.
[ "Specifies", "that", "one", "argument", "may", "only", "be", "present", "if", "another", "is", "." ]
[ "\"\"\"Specifies that one argument may only be present if another is.\n\n Args:\n dependent: the name of the dependent argument\n depends_on: the name of the argument on which it depends\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "dependent", "type": null }, { "param": "depends_on", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dependent", "type": null, "docstring": "the name of the dependent a...
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
AddMutualDependency
null
def AddMutualDependency(self, args): """Specifies that a list of arguments are all mutually dependent.""" if len(args) < 2: raise ValueError("At least two arguments must be specified.") args = [arg.lower() for arg in args] for (arg1, arg2) in [(arg1, arg2) for arg1 in args for arg2 in args]: ...
Specifies that a list of arguments are all mutually dependent.
Specifies that a list of arguments are all mutually dependent.
[ "Specifies", "that", "a", "list", "of", "arguments", "are", "all", "mutually", "dependent", "." ]
def AddMutualDependency(self, args): if len(args) < 2: raise ValueError("At least two arguments must be specified.") args = [arg.lower() for arg in args] for (arg1, arg2) in [(arg1, arg2) for arg1 in args for arg2 in args]: if arg1 == arg2: continue self.arg_dict[arg1].AddDependency(self.a...
[ "def", "AddMutualDependency", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", "<", "2", ":", "raise", "ValueError", "(", "\"At least two arguments must be specified.\"", ")", "args", "=", "[", "arg", ".", "lower", "(", ")", "for", "arg",...
Specifies that a list of arguments are all mutually dependent.
[ "Specifies", "that", "a", "list", "of", "arguments", "are", "all", "mutually", "dependent", "." ]
[ "\"\"\"Specifies that a list of arguments are all mutually dependent.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": [...
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
AddRequiredGroup
null
def AddRequiredGroup(self, args): """Specifies that at least one of the named arguments must be present.""" if len(args) < 2: raise ValueError("At least two arguments must be in a required group.") args = [self.arg_dict[arg.lower()] for arg in args] self.required_groups.append(args)
Specifies that at least one of the named arguments must be present.
Specifies that at least one of the named arguments must be present.
[ "Specifies", "that", "at", "least", "one", "of", "the", "named", "arguments", "must", "be", "present", "." ]
def AddRequiredGroup(self, args): if len(args) < 2: raise ValueError("At least two arguments must be in a required group.") args = [self.arg_dict[arg.lower()] for arg in args] self.required_groups.append(args)
[ "def", "AddRequiredGroup", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", "<", "2", ":", "raise", "ValueError", "(", "\"At least two arguments must be in a required group.\"", ")", "args", "=", "[", "self", ".", "arg_dict", "[", "arg", "....
Specifies that at least one of the named arguments must be present.
[ "Specifies", "that", "at", "least", "one", "of", "the", "named", "arguments", "must", "be", "present", "." ]
[ "\"\"\"Specifies that at least one of the named arguments must be present.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": [...
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ParseArguments
null
def ParseArguments(self): """Given a command line, parse and validate the arguments.""" # reset all the arguments before we parse for arg in self.args: arg.present = False arg.value = None self.parse_errors = [] # look for arguments remaining on the command line while len(self.cmd...
Given a command line, parse and validate the arguments.
Given a command line, parse and validate the arguments.
[ "Given", "a", "command", "line", "parse", "and", "validate", "the", "arguments", "." ]
def ParseArguments(self): for arg in self.args: arg.present = False arg.value = None self.parse_errors = [] while len(self.cmdline.rargs): try: self.ParseNextArgument() except ParseError, e: self.parse_errors.append(e.args[0]) for arg in self.args: if not ar...
[ "def", "ParseArguments", "(", "self", ")", ":", "for", "arg", "in", "self", ".", "args", ":", "arg", ".", "present", "=", "False", "arg", ".", "value", "=", "None", "self", ".", "parse_errors", "=", "[", "]", "while", "len", "(", "self", ".", "cmdl...
Given a command line, parse and validate the arguments.
[ "Given", "a", "command", "line", "parse", "and", "validate", "the", "arguments", "." ]
[ "\"\"\"Given a command line, parse and validate the arguments.\"\"\"", "# reset all the arguments before we parse", "# look for arguments remaining on the command line", "# after all the arguments are parsed, check for problems", "# check for required groups", "# if we have any validators, invoke them" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ParseNextArgument
null
def ParseNextArgument(self): """Find the next argument in the command line and parse it.""" arg = None value = None argstr = self.cmdline.rargs.pop(0) # First check: is this a literal argument? if argstr.lower() in self.arg_dict: arg = self.arg_dict[argstr.lower()] if arg.type in Co...
Find the next argument in the command line and parse it.
Find the next argument in the command line and parse it.
[ "Find", "the", "next", "argument", "in", "the", "command", "line", "and", "parse", "it", "." ]
def ParseNextArgument(self): arg = None value = None argstr = self.cmdline.rargs.pop(0) if argstr.lower() in self.arg_dict: arg = self.arg_dict[argstr.lower()] if arg.type in Command.Argument.TYPES_WITH_VALUES: if len(self.cmdline.rargs): value = self.cmdline.rargs.pop(0) ...
[ "def", "ParseNextArgument", "(", "self", ")", ":", "arg", "=", "None", "value", "=", "None", "argstr", "=", "self", ".", "cmdline", ".", "rargs", ".", "pop", "(", "0", ")", "if", "argstr", ".", "lower", "(", ")", "in", "self", ".", "arg_dict", ":",...
Find the next argument in the command line and parse it.
[ "Find", "the", "next", "argument", "in", "the", "command", "line", "and", "parse", "it", "." ]
[ "\"\"\"Find the next argument in the command line and parse it.\"\"\"", "# First check: is this a literal argument?", "# Second check: is this of the form \"arg=val\" or \"arg:val\"?", "# Third check: does this begin an argument?", "# Fourth check: do we have any positional arguments available?", "# Push ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
StringToValue
<not_specific>
def StringToValue(self, value, type, argstr): """Convert a string from the command line to a value type.""" try: if type == 'string': pass # leave it be elif type == 'int': try: value = int(value) except ValueError: raise ParseError elif type == '...
Convert a string from the command line to a value type.
Convert a string from the command line to a value type.
[ "Convert", "a", "string", "from", "the", "command", "line", "to", "a", "value", "type", "." ]
def StringToValue(self, value, type, argstr): try: if type == 'string': pass elif type == 'int': try: value = int(value) except ValueError: raise ParseError elif type == 'readfile': if not os.path.isfile(value): raise ParseError("'%s'...
[ "def", "StringToValue", "(", "self", ",", "value", ",", "type", ",", "argstr", ")", ":", "try", ":", "if", "type", "==", "'string'", ":", "pass", "elif", "type", "==", "'int'", ":", "try", ":", "value", "=", "int", "(", "value", ")", "except", "Val...
Convert a string from the command line to a value type.
[ "Convert", "a", "string", "from", "the", "command", "line", "to", "a", "value", "type", "." ]
[ "\"\"\"Convert a string from the command line to a value type.\"\"\"", "# leave it be", "# The bare exception is raised in the generic case; more specific errors", "# will arrive with arguments and should just be reraised" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null }, { "param": "type", "type": null }, { "param": "argstr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": null, "docstring_tokens": ...
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
SortArgs
<not_specific>
def SortArgs(self): """Returns a method that can be passed to sort() to sort arguments.""" def ArgSorter(arg1, arg2): """Helper for sorting arguments in the usage string. Positional arguments come first, then required arguments, then optional arguments. Pylint demands this trivial function ...
Returns a method that can be passed to sort() to sort arguments.
Returns a method that can be passed to sort() to sort arguments.
[ "Returns", "a", "method", "that", "can", "be", "passed", "to", "sort", "()", "to", "sort", "arguments", "." ]
def SortArgs(self): def ArgSorter(arg1, arg2): return ((arg2.positional-arg1.positional)*2 + (arg2.required-arg1.required)) return ArgSorter
[ "def", "SortArgs", "(", "self", ")", ":", "def", "ArgSorter", "(", "arg1", ",", "arg2", ")", ":", "\"\"\"Helper for sorting arguments in the usage string.\n\n Positional arguments come first, then required arguments,\n then optional arguments. Pylint demands this trivial functi...
Returns a method that can be passed to sort() to sort arguments.
[ "Returns", "a", "method", "that", "can", "be", "passed", "to", "sort", "()", "to", "sort", "arguments", "." ]
[ "\"\"\"Returns a method that can be passed to sort() to sort arguments.\"\"\"", "\"\"\"Helper for sorting arguments in the usage string.\n\n Positional arguments come first, then required arguments,\n then optional arguments. Pylint demands this trivial function\n have both Args: and Returns: secti...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ArgSorter
<not_specific>
def ArgSorter(arg1, arg2): """Helper for sorting arguments in the usage string. Positional arguments come first, then required arguments, then optional arguments. Pylint demands this trivial function have both Args: and Returns: sections, sigh. Args: arg1: the first argument to c...
Helper for sorting arguments in the usage string. Positional arguments come first, then required arguments, then optional arguments. Pylint demands this trivial function have both Args: and Returns: sections, sigh. Args: arg1: the first argument to compare arg2: the second argu...
Helper for sorting arguments in the usage string. Positional arguments come first, then required arguments, then optional arguments. Pylint demands this trivial function have both Args: and Returns: sections, sigh.
[ "Helper", "for", "sorting", "arguments", "in", "the", "usage", "string", ".", "Positional", "arguments", "come", "first", "then", "required", "arguments", "then", "optional", "arguments", ".", "Pylint", "demands", "this", "trivial", "function", "have", "both", "...
def ArgSorter(arg1, arg2): return ((arg2.positional-arg1.positional)*2 + (arg2.required-arg1.required))
[ "def", "ArgSorter", "(", "arg1", ",", "arg2", ")", ":", "return", "(", "(", "arg2", ".", "positional", "-", "arg1", ".", "positional", ")", "*", "2", "+", "(", "arg2", ".", "required", "-", "arg1", ".", "required", ")", ")" ]
Helper for sorting arguments in the usage string.
[ "Helper", "for", "sorting", "arguments", "in", "the", "usage", "string", "." ]
[ "\"\"\"Helper for sorting arguments in the usage string.\n\n Positional arguments come first, then required arguments,\n then optional arguments. Pylint demands this trivial function\n have both Args: and Returns: sections, sigh.\n\n Args:\n arg1: the first argument to compare\n ar...
[ { "param": "arg1", "type": null }, { "param": "arg2", "type": null } ]
{ "returns": [ { "docstring": "1 if arg1 should be sorted first, +1 if it should be sorted second,\nand 0 if arg1 and arg2 have the same sort level.", "docstring_tokens": [ "1", "if", "arg1", "should", "be", "sorted", "first", "+", ...
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetUsageString
<not_specific>
def GetUsageString(self, width=80, name=None): """Gets a string describing how the command is used.""" if name is None: name = self.names[0] initial_indent = "Usage: %s %s " % (self.cmdline.prog, name) subsequent_indent = " " * len(initial_indent) sorted_args = self.args[:] sorted_args.sort(se...
Gets a string describing how the command is used.
Gets a string describing how the command is used.
[ "Gets", "a", "string", "describing", "how", "the", "command", "is", "used", "." ]
def GetUsageString(self, width=80, name=None): if name is None: name = self.names[0] initial_indent = "Usage: %s %s " % (self.cmdline.prog, name) subsequent_indent = " " * len(initial_indent) sorted_args = self.args[:] sorted_args.sort(self.SortArgs()) return textwrap.fill( " ".join([arg.G...
[ "def", "GetUsageString", "(", "self", ",", "width", "=", "80", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "name", "=", "self", ".", "names", "[", "0", "]", "initial_indent", "=", "\"Usage: %s %s \"", "%", "(", "self", ".", ...
Gets a string describing how the command is used.
[ "Gets", "a", "string", "describing", "how", "the", "command", "is", "used", "." ]
[ "\"\"\"Gets a string describing how the command is used.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "width", "type": null }, { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "width", "type": null, "docstring": null, "docstring_tokens": ...
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetHelpString
<not_specific>
def GetHelpString(self, width=80): """Returns a list of help strings for all this command's arguments.""" sorted_args = self.args[:] sorted_args.sort(self.SortArgs()) return "\n".join([arg.GetHelpString(width) for arg in sorted_args])
Returns a list of help strings for all this command's arguments.
Returns a list of help strings for all this command's arguments.
[ "Returns", "a", "list", "of", "help", "strings", "for", "all", "this", "command", "'", "s", "arguments", "." ]
def GetHelpString(self, width=80): sorted_args = self.args[:] sorted_args.sort(self.SortArgs()) return "\n".join([arg.GetHelpString(width) for arg in sorted_args])
[ "def", "GetHelpString", "(", "self", ",", "width", "=", "80", ")", ":", "sorted_args", "=", "self", ".", "args", "[", ":", "]", "sorted_args", ".", "sort", "(", "self", ".", "SortArgs", "(", ")", ")", "return", "\"\\n\"", ".", "join", "(", "[", "ar...
Returns a list of help strings for all this command's arguments.
[ "Returns", "a", "list", "of", "help", "strings", "for", "all", "this", "command", "'", "s", "arguments", "." ]
[ "\"\"\"Returns a list of help strings for all this command's arguments.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "width", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "width", "type": null, "docstring": null, "docstring_tokens": ...
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
AddCommand
<not_specific>
def AddCommand(self, names, helptext, validator=None, impl=None): """Add a new command to the parser. Args: names: command name, or list of synonyms helptext: brief string description of the command validator: method to validate a command's arguments impl: callable to ...
Add a new command to the parser. Args: names: command name, or list of synonyms helptext: brief string description of the command validator: method to validate a command's arguments impl: callable to be invoked when command is called Raises: ValueError: raised i...
Add a new command to the parser.
[ "Add", "a", "new", "command", "to", "the", "parser", "." ]
def AddCommand(self, names, helptext, validator=None, impl=None): if IsString(names): names = [names] for name in names: if name in self.cmd_dict: raise ValueError("%s is already a command"%name) cmd = Command(names, helptext, validator, impl) cmd.cmdline = self self.commands.append(cm...
[ "def", "AddCommand", "(", "self", ",", "names", ",", "helptext", ",", "validator", "=", "None", ",", "impl", "=", "None", ")", ":", "if", "IsString", "(", "names", ")", ":", "names", "=", "[", "names", "]", "for", "name", "in", "names", ":", "if", ...
Add a new command to the parser.
[ "Add", "a", "new", "command", "to", "the", "parser", "." ]
[ "\"\"\"Add a new command to the parser.\n\n Args:\n names: command name, or list of synonyms\n helptext: brief string description of the command\n validator: method to validate a command's arguments\n impl: callable to be invoked when command is called\n\n Raises:\n ...
[ { "param": "self", "type": null }, { "param": "names", "type": null }, { "param": "helptext", "type": null }, { "param": "validator", "type": null }, { "param": "impl", "type": null } ]
{ "returns": [ { "docstring": "The new command", "docstring_tokens": [ "The", "new", "command" ], "type": null } ], "raises": [ { "docstring": "raised if command already added", "docstring_tokens": [ "raised", "if", "c...
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ParseCommandLine
<not_specific>
def ParseCommandLine(self, argv=None, prog=None, execute=True): """Does the work of parsing a command line. Args: argv: list of arguments, defaults to sys.args[1:] prog: name of the command, defaults to the base name of the script execute: if false, just parse, don't invoke the 'impl...
Does the work of parsing a command line. Args: argv: list of arguments, defaults to sys.args[1:] prog: name of the command, defaults to the base name of the script execute: if false, just parse, don't invoke the 'impl' member Returns: The command that was executed
Does the work of parsing a command line.
[ "Does", "the", "work", "of", "parsing", "a", "command", "line", "." ]
def ParseCommandLine(self, argv=None, prog=None, execute=True): if argv is None: argv = sys.argv[1:] if prog is None: prog = os.path.basename(sys.argv[0]).split('.')[0] self.argv = argv self.prog = prog if not len(argv): self.out.writelines(self.GetUsageString()) self.Exit() return...
[ "def", "ParseCommandLine", "(", "self", ",", "argv", "=", "None", ",", "prog", "=", "None", ",", "execute", "=", "True", ")", ":", "if", "argv", "is", "None", ":", "argv", "=", "sys", ".", "argv", "[", "1", ":", "]", "if", "prog", "is", "None", ...
Does the work of parsing a command line.
[ "Does", "the", "work", "of", "parsing", "a", "command", "line", "." ]
[ "\"\"\"Does the work of parsing a command line.\n\n Args:\n argv: list of arguments, defaults to sys.args[1:]\n prog: name of the command, defaults to the base name of the script\n execute: if false, just parse, don't invoke the 'impl' member\n\n Returns:\n The command that was ex...
[ { "param": "self", "type": null }, { "param": "argv", "type": null }, { "param": "prog", "type": null }, { "param": "execute", "type": null } ]
{ "returns": [ { "docstring": "The command that was executed", "docstring_tokens": [ "The", "command", "that", "was", "executed" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "doc...
d2a54e5d04bad8c5112e80aaa5d987bd29d1c968
sunlongbo/chromium
tools/site_compare/command_line.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
DoHelpCommand
null
def DoHelpCommand(command): """Executed when the command is 'help'.""" out = command.cmdline.out width = command['--width'] if 'command' not in command: out.write(command.GetUsageString()) out.write("\n\n") indent = 5 gutter = 2 command_width = ( max([len(cmd.names[0]) for cmd in co...
Executed when the command is 'help'.
Executed when the command is 'help'.
[ "Executed", "when", "the", "command", "is", "'", "help", "'", "." ]
def DoHelpCommand(command): out = command.cmdline.out width = command['--width'] if 'command' not in command: out.write(command.GetUsageString()) out.write("\n\n") indent = 5 gutter = 2 command_width = ( max([len(cmd.names[0]) for cmd in command.cmdline.commands]) + gutter) for cmd i...
[ "def", "DoHelpCommand", "(", "command", ")", ":", "out", "=", "command", ".", "cmdline", ".", "out", "width", "=", "command", "[", "'--width'", "]", "if", "'command'", "not", "in", "command", ":", "out", ".", "write", "(", "command", ".", "GetUsageString...
Executed when the command is 'help'.
[ "Executed", "when", "the", "command", "is", "'", "help", "'", "." ]
[ "\"\"\"Executed when the command is 'help'.\"\"\"" ]
[ { "param": "command", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "command", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a29d0646e6ef57495817a773fc596db88540e7c2
sunlongbo/chromium
components/test/data/cast_certificate/certificates/generate_policies_tests.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
generate_policies_chain
null
def generate_policies_chain(intermediate_policies, leaf_policies): """Creates a certificate chain and writes it to a PEM file (in the current directory). The chain has 3 certificates (root, intermediate, leaf). The root has no policies extension, whereas the intermediate has policies given by |intermediate_p...
Creates a certificate chain and writes it to a PEM file (in the current directory). The chain has 3 certificates (root, intermediate, leaf). The root has no policies extension, whereas the intermediate has policies given by |intermediate_policies| and the leaf has policies given by |leaf_policies|. The poli...
Creates a certificate chain and writes it to a PEM file (in the current directory). The chain has 3 certificates (root, intermediate, leaf). The root has no policies extension, whereas the intermediate has policies given by |intermediate_policies| and the leaf has policies given by |leaf_policies|. The policies are s...
[ "Creates", "a", "certificate", "chain", "and", "writes", "it", "to", "a", "PEM", "file", "(", "in", "the", "current", "directory", ")", ".", "The", "chain", "has", "3", "certificates", "(", "root", "intermediate", "leaf", ")", ".", "The", "root", "has", ...
def generate_policies_chain(intermediate_policies, leaf_policies): root = common.create_self_signed_root_certificate('Root') root.set_validity_range(JAN_2015, JAN_2018) intermediate = common.create_intermediate_certificate('Intermediate', root) set_policies_from_list(intermediate, intermediate_policies) inter...
[ "def", "generate_policies_chain", "(", "intermediate_policies", ",", "leaf_policies", ")", ":", "root", "=", "common", ".", "create_self_signed_root_certificate", "(", "'Root'", ")", "root", ".", "set_validity_range", "(", "JAN_2015", ",", "JAN_2018", ")", "intermedia...
Creates a certificate chain and writes it to a PEM file (in the current directory).
[ "Creates", "a", "certificate", "chain", "and", "writes", "it", "to", "a", "PEM", "file", "(", "in", "the", "current", "directory", ")", "." ]
[ "\"\"\"Creates a certificate chain and writes it to a PEM file (in the current\n directory).\n\n The chain has 3 certificates (root, intermediate, leaf). The root has no\n policies extension, whereas the intermediate has policies given by\n |intermediate_policies| and the leaf has policies given by |leaf_polici...
[ { "param": "intermediate_policies", "type": null }, { "param": "leaf_policies", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "intermediate_policies", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "leaf_policies", "type": null, "docstring": null, ...
5a47a265ed5f0d4fa0c351859acb80bdc09337b2
sunlongbo/chromium
tools/usb_gadget/hid_gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ClassControlRead
<not_specific>
def ClassControlRead(self, recipient, request, value, index, length): """Handle class-specific control requests. See Device Class Definition for Human Interface Devices (HID) Version 1.11 section 7.2. Args: recipient: Request recipient (device, interface, endpoint, etc.) request: bRequest ...
Handle class-specific control requests. See Device Class Definition for Human Interface Devices (HID) Version 1.11 section 7.2. Args: recipient: Request recipient (device, interface, endpoint, etc.) request: bRequest field of the setup packet. value: wValue field of the setup packet. ...
Handle class-specific control requests. See Device Class Definition for Human Interface Devices (HID) Version 1.11 section 7.2.
[ "Handle", "class", "-", "specific", "control", "requests", ".", "See", "Device", "Class", "Definition", "for", "Human", "Interface", "Devices", "(", "HID", ")", "Version", "1", ".", "11", "section", "7", ".", "2", "." ]
def ClassControlRead(self, recipient, request, value, index, length): if recipient != usb_constants.Recipient.INTERFACE: return None if index != self._interface_number: return None if request == hid_constants.Request.GET_REPORT: report_type, report_id = value >> 8, value & 0xFF print...
[ "def", "ClassControlRead", "(", "self", ",", "recipient", ",", "request", ",", "value", ",", "index", ",", "length", ")", ":", "if", "recipient", "!=", "usb_constants", ".", "Recipient", ".", "INTERFACE", ":", "return", "None", "if", "index", "!=", "self",...
Handle class-specific control requests.
[ "Handle", "class", "-", "specific", "control", "requests", "." ]
[ "\"\"\"Handle class-specific control requests.\n\n See Device Class Definition for Human Interface Devices (HID) Version 1.11\n section 7.2.\n\n Args:\n recipient: Request recipient (device, interface, endpoint, etc.)\n request: bRequest field of the setup packet.\n value: wValue field of th...
[ { "param": "self", "type": null }, { "param": "recipient", "type": null }, { "param": "request", "type": null }, { "param": "value", "type": null }, { "param": "index", "type": null }, { "param": "length", "type": null } ]
{ "returns": [ { "docstring": "A buffer to return to the USB host with len <= length on success or\nNone to stall the pipe.", "docstring_tokens": [ "A", "buffer", "to", "return", "to", "the", "USB", "host", "with", "len", ...
5a47a265ed5f0d4fa0c351859acb80bdc09337b2
sunlongbo/chromium
tools/usb_gadget/hid_gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ClassControlWrite
<not_specific>
def ClassControlWrite(self, recipient, request, value, index, data): """Handle class-specific control requests. See Device Class Definition for Human Interface Devices (HID) Version 1.11 section 7.2. Args: recipient: Request recipient (device, interface, endpoint, etc.) request: bRequest f...
Handle class-specific control requests. See Device Class Definition for Human Interface Devices (HID) Version 1.11 section 7.2. Args: recipient: Request recipient (device, interface, endpoint, etc.) request: bRequest field of the setup packet. value: wValue field of the setup packet. ...
Handle class-specific control requests. See Device Class Definition for Human Interface Devices (HID) Version 1.11 section 7.2.
[ "Handle", "class", "-", "specific", "control", "requests", ".", "See", "Device", "Class", "Definition", "for", "Human", "Interface", "Devices", "(", "HID", ")", "Version", "1", ".", "11", "section", "7", ".", "2", "." ]
def ClassControlWrite(self, recipient, request, value, index, data): if recipient != usb_constants.Recipient.INTERFACE: return None if index != self._interface_number: return None if request == hid_constants.Request.SET_REPORT: report_type, report_id = value >> 8, value & 0xFF print(...
[ "def", "ClassControlWrite", "(", "self", ",", "recipient", ",", "request", ",", "value", ",", "index", ",", "data", ")", ":", "if", "recipient", "!=", "usb_constants", ".", "Recipient", ".", "INTERFACE", ":", "return", "None", "if", "index", "!=", "self", ...
Handle class-specific control requests.
[ "Handle", "class", "-", "specific", "control", "requests", "." ]
[ "\"\"\"Handle class-specific control requests.\n\n See Device Class Definition for Human Interface Devices (HID) Version 1.11\n section 7.2.\n\n Args:\n recipient: Request recipient (device, interface, endpoint, etc.)\n request: bRequest field of the setup packet.\n value: wValue field of th...
[ { "param": "self", "type": null }, { "param": "recipient", "type": null }, { "param": "request", "type": null }, { "param": "value", "type": null }, { "param": "index", "type": null }, { "param": "data", "type": null } ]
{ "returns": [ { "docstring": "True on success, None to stall the pipe.", "docstring_tokens": [ "True", "on", "success", "None", "to", "stall", "the", "pipe", "." ], "type": null } ], "raises": [], "params": ...
5a47a265ed5f0d4fa0c351859acb80bdc09337b2
sunlongbo/chromium
tools/usb_gadget/hid_gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
SendReport
null
def SendReport(self, report_id, data): """Send a HID report. See Device Class Definition for Human Interface Devices (HID) Version 1.11 section 8. Args: report_id: Report ID associated with the data. data: Contents of the report. """ if report_id == 0: self.SendPacket(self._i...
Send a HID report. See Device Class Definition for Human Interface Devices (HID) Version 1.11 section 8. Args: report_id: Report ID associated with the data. data: Contents of the report.
Send a HID report. See Device Class Definition for Human Interface Devices (HID) Version 1.11 section 8.
[ "Send", "a", "HID", "report", ".", "See", "Device", "Class", "Definition", "for", "Human", "Interface", "Devices", "(", "HID", ")", "Version", "1", ".", "11", "section", "8", "." ]
def SendReport(self, report_id, data): if report_id == 0: self.SendPacket(self._in_endpoint, data) else: self.SendPacket(self._in_endpoint, struct.pack('B', report_id) + data)
[ "def", "SendReport", "(", "self", ",", "report_id", ",", "data", ")", ":", "if", "report_id", "==", "0", ":", "self", ".", "SendPacket", "(", "self", ".", "_in_endpoint", ",", "data", ")", "else", ":", "self", ".", "SendPacket", "(", "self", ".", "_i...
Send a HID report.
[ "Send", "a", "HID", "report", "." ]
[ "\"\"\"Send a HID report.\n\n See Device Class Definition for Human Interface Devices (HID) Version 1.11\n section 8.\n\n Args:\n report_id: Report ID associated with the data.\n data: Contents of the report.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "report_id", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "report_id", "type": null, "docstring": "Report ID associated with t...
5a47a265ed5f0d4fa0c351859acb80bdc09337b2
sunlongbo/chromium
tools/usb_gadget/hid_gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ReceivePacket
null
def ReceivePacket(self, endpoint, data): """Dispatch a report to the appropriate feature. See Device Class Definition for Human Interface Devices (HID) Version 1.11 section 8. Args: endpoint: Incoming endpoint (must be the Interrupt OUT pipe). data: Interrupt packet data. """ asser...
Dispatch a report to the appropriate feature. See Device Class Definition for Human Interface Devices (HID) Version 1.11 section 8. Args: endpoint: Incoming endpoint (must be the Interrupt OUT pipe). data: Interrupt packet data.
Dispatch a report to the appropriate feature. See Device Class Definition for Human Interface Devices (HID) Version 1.11 section 8.
[ "Dispatch", "a", "report", "to", "the", "appropriate", "feature", ".", "See", "Device", "Class", "Definition", "for", "Human", "Interface", "Devices", "(", "HID", ")", "Version", "1", ".", "11", "section", "8", "." ]
def ReceivePacket(self, endpoint, data): assert endpoint == self._out_endpoint if 0 in self._features: self._features[0].SetOutputReport(data) elif len(data) >= 1: report_id, = struct.unpack('B', data[0]) feature = self._features.get(report_id, None) if feature is None or feature.Set...
[ "def", "ReceivePacket", "(", "self", ",", "endpoint", ",", "data", ")", ":", "assert", "endpoint", "==", "self", ".", "_out_endpoint", "if", "0", "in", "self", ".", "_features", ":", "self", ".", "_features", "[", "0", "]", ".", "SetOutputReport", "(", ...
Dispatch a report to the appropriate feature.
[ "Dispatch", "a", "report", "to", "the", "appropriate", "feature", "." ]
[ "\"\"\"Dispatch a report to the appropriate feature.\n\n See Device Class Definition for Human Interface Devices (HID) Version 1.11\n section 8.\n\n Args:\n endpoint: Incoming endpoint (must be the Interrupt OUT pipe).\n data: Interrupt packet data.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "endpoint", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "endpoint", "type": null, "docstring": "Incoming endpoint (must be t...
5a47a265ed5f0d4fa0c351859acb80bdc09337b2
sunlongbo/chromium
tools/usb_gadget/hid_gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
SendReport
null
def SendReport(self, data): """Send a report with this feature's Report ID. Args: data: Report to send. If necessary the Report ID will be added. Raises: RuntimeError: If a report cannot be sent at this time. """ if not self.IsConnected(): raise RuntimeError('Device is not connec...
Send a report with this feature's Report ID. Args: data: Report to send. If necessary the Report ID will be added. Raises: RuntimeError: If a report cannot be sent at this time.
Send a report with this feature's Report ID.
[ "Send", "a", "report", "with", "this", "feature", "'", "s", "Report", "ID", "." ]
def SendReport(self, data): if not self.IsConnected(): raise RuntimeError('Device is not connected.') self._gadget.SendReport(self._report_id, data)
[ "def", "SendReport", "(", "self", ",", "data", ")", ":", "if", "not", "self", ".", "IsConnected", "(", ")", ":", "raise", "RuntimeError", "(", "'Device is not connected.'", ")", "self", ".", "_gadget", ".", "SendReport", "(", "self", ".", "_report_id", ","...
Send a report with this feature's Report ID.
[ "Send", "a", "report", "with", "this", "feature", "'", "s", "Report", "ID", "." ]
[ "\"\"\"Send a report with this feature's Report ID.\n\n Args:\n data: Report to send. If necessary the Report ID will be added.\n\n Raises:\n RuntimeError: If a report cannot be sent at this time.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [ { "docstring": "If a report cannot be sent at this time.", "docstring_tokens": [ "If", "a", "report", "cannot", "be", "sent", "at", "this", "time", "." ], "type": "RuntimeError" ...
5a47a265ed5f0d4fa0c351859acb80bdc09337b2
sunlongbo/chromium
tools/usb_gadget/hid_gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
SetInputReport
null
def SetInputReport(self, data): """Handle an input report sent from the host. This function is called when a SET_REPORT(input) command for this class's Report ID is received. It should be overridden by a subclass. Args: data: Contents of the input report. """ pass
Handle an input report sent from the host. This function is called when a SET_REPORT(input) command for this class's Report ID is received. It should be overridden by a subclass. Args: data: Contents of the input report.
Handle an input report sent from the host. This function is called when a SET_REPORT(input) command for this class's Report ID is received. It should be overridden by a subclass.
[ "Handle", "an", "input", "report", "sent", "from", "the", "host", ".", "This", "function", "is", "called", "when", "a", "SET_REPORT", "(", "input", ")", "command", "for", "this", "class", "'", "s", "Report", "ID", "is", "received", ".", "It", "should", ...
def SetInputReport(self, data): pass
[ "def", "SetInputReport", "(", "self", ",", "data", ")", ":", "pass" ]
Handle an input report sent from the host.
[ "Handle", "an", "input", "report", "sent", "from", "the", "host", "." ]
[ "\"\"\"Handle an input report sent from the host.\n\n This function is called when a SET_REPORT(input) command for this class's\n Report ID is received. It should be overridden by a subclass.\n\n Args:\n data: Contents of the input report.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": "Contents of the input report.", ...
5a47a265ed5f0d4fa0c351859acb80bdc09337b2
sunlongbo/chromium
tools/usb_gadget/hid_gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
SetOutputReport
null
def SetOutputReport(self, data): """Handle an feature report sent from the host. This function is called when a SET_REPORT(output) command or interrupt OUT transfer is received with this class's Report ID. It should be overridden by a subclass. Args: data: Contents of the output report. ...
Handle an feature report sent from the host. This function is called when a SET_REPORT(output) command or interrupt OUT transfer is received with this class's Report ID. It should be overridden by a subclass. Args: data: Contents of the output report.
Handle an feature report sent from the host. This function is called when a SET_REPORT(output) command or interrupt OUT transfer is received with this class's Report ID. It should be overridden by a subclass.
[ "Handle", "an", "feature", "report", "sent", "from", "the", "host", ".", "This", "function", "is", "called", "when", "a", "SET_REPORT", "(", "output", ")", "command", "or", "interrupt", "OUT", "transfer", "is", "received", "with", "this", "class", "'", "s"...
def SetOutputReport(self, data): pass
[ "def", "SetOutputReport", "(", "self", ",", "data", ")", ":", "pass" ]
Handle an feature report sent from the host.
[ "Handle", "an", "feature", "report", "sent", "from", "the", "host", "." ]
[ "\"\"\"Handle an feature report sent from the host.\n\n This function is called when a SET_REPORT(output) command or interrupt OUT\n transfer is received with this class's Report ID. It should be overridden\n by a subclass.\n\n Args:\n data: Contents of the output report.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": "Contents of the output report.",...
5a47a265ed5f0d4fa0c351859acb80bdc09337b2
sunlongbo/chromium
tools/usb_gadget/hid_gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
SetFeatureReport
null
def SetFeatureReport(self, data): """Handle an feature report sent from the host. This function is called when a SET_REPORT(feature) command for this class's Report ID is received. It should be overridden by a subclass. Args: data: Contents of the feature report. """ pass
Handle an feature report sent from the host. This function is called when a SET_REPORT(feature) command for this class's Report ID is received. It should be overridden by a subclass. Args: data: Contents of the feature report.
Handle an feature report sent from the host. This function is called when a SET_REPORT(feature) command for this class's Report ID is received. It should be overridden by a subclass.
[ "Handle", "an", "feature", "report", "sent", "from", "the", "host", ".", "This", "function", "is", "called", "when", "a", "SET_REPORT", "(", "feature", ")", "command", "for", "this", "class", "'", "s", "Report", "ID", "is", "received", ".", "It", "should...
def SetFeatureReport(self, data): pass
[ "def", "SetFeatureReport", "(", "self", ",", "data", ")", ":", "pass" ]
Handle an feature report sent from the host.
[ "Handle", "an", "feature", "report", "sent", "from", "the", "host", "." ]
[ "\"\"\"Handle an feature report sent from the host.\n\n This function is called when a SET_REPORT(feature) command for this class's\n Report ID is received. It should be overridden by a subclass.\n\n Args:\n data: Contents of the feature report.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": "Contents of the feature report."...
5a47a265ed5f0d4fa0c351859acb80bdc09337b2
sunlongbo/chromium
tools/usb_gadget/hid_gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetInputReport
null
def GetInputReport(self): """Handle a input report request from the host. This function is called when a GET_REPORT(input) command for this class's Report ID is received. It should be overridden by a subclass. Returns: The input report or None to stall the pipe. """ pass
Handle a input report request from the host. This function is called when a GET_REPORT(input) command for this class's Report ID is received. It should be overridden by a subclass. Returns: The input report or None to stall the pipe.
Handle a input report request from the host. This function is called when a GET_REPORT(input) command for this class's Report ID is received. It should be overridden by a subclass.
[ "Handle", "a", "input", "report", "request", "from", "the", "host", ".", "This", "function", "is", "called", "when", "a", "GET_REPORT", "(", "input", ")", "command", "for", "this", "class", "'", "s", "Report", "ID", "is", "received", ".", "It", "should",...
def GetInputReport(self): pass
[ "def", "GetInputReport", "(", "self", ")", ":", "pass" ]
Handle a input report request from the host.
[ "Handle", "a", "input", "report", "request", "from", "the", "host", "." ]
[ "\"\"\"Handle a input report request from the host.\n\n This function is called when a GET_REPORT(input) command for this class's\n Report ID is received. It should be overridden by a subclass.\n\n Returns:\n The input report or None to stall the pipe.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "The input report or None to stall the pipe.", "docstring_tokens": [ "The", "input", "report", "or", "None", "to", "stall", "the", "pipe", "." ], "type": null } ], "raises"...
5a47a265ed5f0d4fa0c351859acb80bdc09337b2
sunlongbo/chromium
tools/usb_gadget/hid_gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetOutputReport
null
def GetOutputReport(self): """Handle a output report request from the host. This function is called when a GET_REPORT(output) command for this class's Report ID is received. It should be overridden by a subclass. Returns: The output report or None to stall the pipe. """ pass
Handle a output report request from the host. This function is called when a GET_REPORT(output) command for this class's Report ID is received. It should be overridden by a subclass. Returns: The output report or None to stall the pipe.
Handle a output report request from the host. This function is called when a GET_REPORT(output) command for this class's Report ID is received. It should be overridden by a subclass.
[ "Handle", "a", "output", "report", "request", "from", "the", "host", ".", "This", "function", "is", "called", "when", "a", "GET_REPORT", "(", "output", ")", "command", "for", "this", "class", "'", "s", "Report", "ID", "is", "received", ".", "It", "should...
def GetOutputReport(self): pass
[ "def", "GetOutputReport", "(", "self", ")", ":", "pass" ]
Handle a output report request from the host.
[ "Handle", "a", "output", "report", "request", "from", "the", "host", "." ]
[ "\"\"\"Handle a output report request from the host.\n\n This function is called when a GET_REPORT(output) command for this class's\n Report ID is received. It should be overridden by a subclass.\n\n Returns:\n The output report or None to stall the pipe.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "The output report or None to stall the pipe.", "docstring_tokens": [ "The", "output", "report", "or", "None", "to", "stall", "the", "pipe", "." ], "type": null } ], "raise...
5a47a265ed5f0d4fa0c351859acb80bdc09337b2
sunlongbo/chromium
tools/usb_gadget/hid_gadget.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetFeatureReport
null
def GetFeatureReport(self): """Handle a feature report request from the host. This function is called when a GET_REPORT(feature) command for this class's Report ID is received. It should be overridden by a subclass. Returns: The feature report or None to stall the pipe. """ pass
Handle a feature report request from the host. This function is called when a GET_REPORT(feature) command for this class's Report ID is received. It should be overridden by a subclass. Returns: The feature report or None to stall the pipe.
Handle a feature report request from the host. This function is called when a GET_REPORT(feature) command for this class's Report ID is received. It should be overridden by a subclass.
[ "Handle", "a", "feature", "report", "request", "from", "the", "host", ".", "This", "function", "is", "called", "when", "a", "GET_REPORT", "(", "feature", ")", "command", "for", "this", "class", "'", "s", "Report", "ID", "is", "received", ".", "It", "shou...
def GetFeatureReport(self): pass
[ "def", "GetFeatureReport", "(", "self", ")", ":", "pass" ]
Handle a feature report request from the host.
[ "Handle", "a", "feature", "report", "request", "from", "the", "host", "." ]
[ "\"\"\"Handle a feature report request from the host.\n\n This function is called when a GET_REPORT(feature) command for this class's\n Report ID is received. It should be overridden by a subclass.\n\n Returns:\n The feature report or None to stall the pipe.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "The feature report or None to stall the pipe.", "docstring_tokens": [ "The", "feature", "report", "or", "None", "to", "stall", "the", "pipe", "." ], "type": null } ], "rai...
3389bdf1da31f59f18910139c725f72358e4df53
sunlongbo/chromium
chrome/updater/test/service/win/updater_test_service_control.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_RunCommand
<not_specific>
def _RunCommand(command, log_error=True): """Run a command and logs stdout/stderr if needed. Args: command: Command to run. log_error: Whether to log the stderr. Returns: True if the process exits with 0. """ process = subprocess.Popen(command, stdout=subprocess.PIPE...
Run a command and logs stdout/stderr if needed. Args: command: Command to run. log_error: Whether to log the stderr. Returns: True if the process exits with 0.
Run a command and logs stdout/stderr if needed.
[ "Run", "a", "command", "and", "logs", "stdout", "/", "stderr", "if", "needed", "." ]
def _RunCommand(command, log_error=True): process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = process.communicate() logging.info('Command %s stdout:\n %s', command, stdout) if log_error and stderr: log...
[ "def", "_RunCommand", "(", "command", ",", "log_error", "=", "True", ")", ":", "process", "=", "subprocess", ".", "Popen", "(", "command", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ")", "stdout", ",", ...
Run a command and logs stdout/stderr if needed.
[ "Run", "a", "command", "and", "logs", "stdout", "/", "stderr", "if", "needed", "." ]
[ "\"\"\"Run a command and logs stdout/stderr if needed.\n\n Args:\n command: Command to run.\n log_error: Whether to log the stderr.\n\n Returns:\n True if the process exits with 0.\n \"\"\"" ]
[ { "param": "command", "type": null }, { "param": "log_error", "type": null } ]
{ "returns": [ { "docstring": "True if the process exits with 0.", "docstring_tokens": [ "True", "if", "the", "process", "exits", "with", "0", "." ], "type": null } ], "raises": [], "params": [ { "identifie...
3389bdf1da31f59f18910139c725f72358e4df53
sunlongbo/chromium
chrome/updater/test/service/win/updater_test_service_control.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_IsServiceInStatus
<not_specific>
def _IsServiceInStatus(status): """Returns the if test service is in the given status.""" try: return status == win32serviceutil.QueryServiceStatus( _UPDATER_TEST_SERVICE_NAME)[1] except _ServiceErrors as err: return False
Returns the if test service is in the given status.
Returns the if test service is in the given status.
[ "Returns", "the", "if", "test", "service", "is", "in", "the", "given", "status", "." ]
def _IsServiceInStatus(status): try: return status == win32serviceutil.QueryServiceStatus( _UPDATER_TEST_SERVICE_NAME)[1] except _ServiceErrors as err: return False
[ "def", "_IsServiceInStatus", "(", "status", ")", ":", "try", ":", "return", "status", "==", "win32serviceutil", ".", "QueryServiceStatus", "(", "_UPDATER_TEST_SERVICE_NAME", ")", "[", "1", "]", "except", "_ServiceErrors", "as", "err", ":", "return", "False" ]
Returns the if test service is in the given status.
[ "Returns", "the", "if", "test", "service", "is", "in", "the", "given", "status", "." ]
[ "\"\"\"Returns the if test service is in the given status.\"\"\"" ]
[ { "param": "status", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "status", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3389bdf1da31f59f18910139c725f72358e4df53
sunlongbo/chromium
chrome/updater/test/service/win/updater_test_service_control.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_MainServiceScriptPath
<not_specific>
def _MainServiceScriptPath(): """Returns the service main script path.""" # Assumes updater_test_service.py file is in the same directory as this file. service_main = os.path.join( os.path.abspath(os.path.dirname(__file__)), 'updater_test_service.py') if not os.path.isfile(service_main): logging.error...
Returns the service main script path.
Returns the service main script path.
[ "Returns", "the", "service", "main", "script", "path", "." ]
def _MainServiceScriptPath(): service_main = os.path.join( os.path.abspath(os.path.dirname(__file__)), 'updater_test_service.py') if not os.path.isfile(service_main): logging.error('Cannot find service main module: %s', service_main) return None return service_main
[ "def", "_MainServiceScriptPath", "(", ")", ":", "service_main", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", ",", "'updater_test_service.py'", ")", "if", ...
Returns the service main script path.
[ "Returns", "the", "service", "main", "script", "path", "." ]
[ "\"\"\"Returns the service main script path.\"\"\"", "# Assumes updater_test_service.py file is in the same directory as this file." ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
3389bdf1da31f59f18910139c725f72358e4df53
sunlongbo/chromium
chrome/updater/test/service/win/updater_test_service_control.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_WaitServiceStatus
<not_specific>
def _WaitServiceStatus(status, timeout=30): """Wait the service to be in the given state.""" check_interval = 0.2 for i in range(int(timeout / check_interval)): if _IsServiceInStatus(status): return True time.sleep(check_interval) return False
Wait the service to be in the given state.
Wait the service to be in the given state.
[ "Wait", "the", "service", "to", "be", "in", "the", "given", "state", "." ]
def _WaitServiceStatus(status, timeout=30): check_interval = 0.2 for i in range(int(timeout / check_interval)): if _IsServiceInStatus(status): return True time.sleep(check_interval) return False
[ "def", "_WaitServiceStatus", "(", "status", ",", "timeout", "=", "30", ")", ":", "check_interval", "=", "0.2", "for", "i", "in", "range", "(", "int", "(", "timeout", "/", "check_interval", ")", ")", ":", "if", "_IsServiceInStatus", "(", "status", ")", ":...
Wait the service to be in the given state.
[ "Wait", "the", "service", "to", "be", "in", "the", "given", "state", "." ]
[ "\"\"\"Wait the service to be in the given state.\"\"\"" ]
[ { "param": "status", "type": null }, { "param": "timeout", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "status", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "timeout", "type": null, "docstring": null, "docstring_token...
3389bdf1da31f59f18910139c725f72358e4df53
sunlongbo/chromium
chrome/updater/test/service/win/updater_test_service_control.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
InstallService
<not_specific>
def InstallService(): """Install updater test service. If the service was previously installed, it will be updated. Returns: True if the service is installed successfully. """ _SetupEnvironmentForVPython() service_main = _MainServiceScriptPath() if not service_main: logging.error('Cannot find t...
Install updater test service. If the service was previously installed, it will be updated. Returns: True if the service is installed successfully.
Install updater test service. If the service was previously installed, it will be updated.
[ "Install", "updater", "test", "service", ".", "If", "the", "service", "was", "previously", "installed", "it", "will", "be", "updated", "." ]
def InstallService(): _SetupEnvironmentForVPython() service_main = _MainServiceScriptPath() if not service_main: logging.error('Cannot find the service main script [%s].', service_main) return False try: if _IsServiceInStatus(win32service.SERVICE_RUNNING) and not StopService(): logging.error('...
[ "def", "InstallService", "(", ")", ":", "_SetupEnvironmentForVPython", "(", ")", "service_main", "=", "_MainServiceScriptPath", "(", ")", "if", "not", "service_main", ":", "logging", ".", "error", "(", "'Cannot find the service main script [%s].'", ",", "service_main", ...
Install updater test service.
[ "Install", "updater", "test", "service", "." ]
[ "\"\"\"Install updater test service.\n\n If the service was previously installed, it will be updated.\n\n Returns:\n True if the service is installed successfully.\n \"\"\"" ]
[]
{ "returns": [ { "docstring": "True if the service is installed successfully.", "docstring_tokens": [ "True", "if", "the", "service", "is", "installed", "successfully", "." ], "type": null } ], "raises": [], "params"...
3389bdf1da31f59f18910139c725f72358e4df53
sunlongbo/chromium
chrome/updater/test/service/win/updater_test_service_control.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
StartService
<not_specific>
def StartService(timeout=30): """Start updater test service and make sure it is reachable. Args: timeout: How long to wait for service to be ready. Returns: True if the service is started successfully. """ logging.info('Starting service [%s].', _UPDATER_TEST_SERVICE_NAME) if _IsServiceInStatus(win...
Start updater test service and make sure it is reachable. Args: timeout: How long to wait for service to be ready. Returns: True if the service is started successfully.
Start updater test service and make sure it is reachable.
[ "Start", "updater", "test", "service", "and", "make", "sure", "it", "is", "reachable", "." ]
def StartService(timeout=30): logging.info('Starting service [%s].', _UPDATER_TEST_SERVICE_NAME) if _IsServiceInStatus(win32service.SERVICE_RUNNING): logging.info('Test service is already running.') return True try: win32serviceutil.StartService(_UPDATER_TEST_SERVICE_NAME) if not _WaitServiceStatu...
[ "def", "StartService", "(", "timeout", "=", "30", ")", ":", "logging", ".", "info", "(", "'Starting service [%s].'", ",", "_UPDATER_TEST_SERVICE_NAME", ")", "if", "_IsServiceInStatus", "(", "win32service", ".", "SERVICE_RUNNING", ")", ":", "logging", ".", "info", ...
Start updater test service and make sure it is reachable.
[ "Start", "updater", "test", "service", "and", "make", "sure", "it", "is", "reachable", "." ]
[ "\"\"\"Start updater test service and make sure it is reachable.\n\n Args:\n timeout: How long to wait for service to be ready.\n\n Returns:\n True if the service is started successfully.\n \"\"\"" ]
[ { "param": "timeout", "type": null } ]
{ "returns": [ { "docstring": "True if the service is started successfully.", "docstring_tokens": [ "True", "if", "the", "service", "is", "started", "successfully", "." ], "type": null } ], "raises": [], "params": [ ...
3389bdf1da31f59f18910139c725f72358e4df53
sunlongbo/chromium
chrome/updater/test/service/win/updater_test_service_control.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
StopService
<not_specific>
def StopService(timeout=30): """Stop test service if it is running. Returns: True if the service is stopped successfully. """ logging.info('Stopping service [%s]...', _UPDATER_TEST_SERVICE_NAME) try: if not _IsServiceInStatus(win32service.SERVICE_RUNNING): return True win32serviceutil.Stop...
Stop test service if it is running. Returns: True if the service is stopped successfully.
Stop test service if it is running.
[ "Stop", "test", "service", "if", "it", "is", "running", "." ]
def StopService(timeout=30): logging.info('Stopping service [%s]...', _UPDATER_TEST_SERVICE_NAME) try: if not _IsServiceInStatus(win32service.SERVICE_RUNNING): return True win32serviceutil.StopService(_UPDATER_TEST_SERVICE_NAME) if not _WaitServiceStatus(win32service.SERVICE_STOPPED, timeout): ...
[ "def", "StopService", "(", "timeout", "=", "30", ")", ":", "logging", ".", "info", "(", "'Stopping service [%s]...'", ",", "_UPDATER_TEST_SERVICE_NAME", ")", "try", ":", "if", "not", "_IsServiceInStatus", "(", "win32service", ".", "SERVICE_RUNNING", ")", ":", "r...
Stop test service if it is running.
[ "Stop", "test", "service", "if", "it", "is", "running", "." ]
[ "\"\"\"Stop test service if it is running.\n\n Returns:\n True if the service is stopped successfully.\n \"\"\"" ]
[ { "param": "timeout", "type": null } ]
{ "returns": [ { "docstring": "True if the service is stopped successfully.", "docstring_tokens": [ "True", "if", "the", "service", "is", "stopped", "successfully", "." ], "type": null } ], "raises": [], "params": [ ...
3389bdf1da31f59f18910139c725f72358e4df53
sunlongbo/chromium
chrome/updater/test/service/win/updater_test_service_control.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
OpenService
null
def OpenService(): """Open the service as a managed resource.""" try: if InstallService() and StartService(): yield _UPDATER_TEST_SERVICE_NAME else: yield None finally: UninstallService()
Open the service as a managed resource.
Open the service as a managed resource.
[ "Open", "the", "service", "as", "a", "managed", "resource", "." ]
def OpenService(): try: if InstallService() and StartService(): yield _UPDATER_TEST_SERVICE_NAME else: yield None finally: UninstallService()
[ "def", "OpenService", "(", ")", ":", "try", ":", "if", "InstallService", "(", ")", "and", "StartService", "(", ")", ":", "yield", "_UPDATER_TEST_SERVICE_NAME", "else", ":", "yield", "None", "finally", ":", "UninstallService", "(", ")" ]
Open the service as a managed resource.
[ "Open", "the", "service", "as", "a", "managed", "resource", "." ]
[ "\"\"\"Open the service as a managed resource.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
6f9cd1668c56032b26c483445fe57a784ebb8ae1
sunlongbo/chromium
tools/metrics/histograms/update_gpu_driver_bug_workaround_entries.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ReadGpuDriverBugEntries
<not_specific>
def ReadGpuDriverBugEntries(filename): """Reads in the gpu driver bug list, returning a dictionary mapping workaround ids to descriptions. """ # Read the file as a list of lines with open(path_util.GetInputFile(filename)) as f: json_data = json.load(f) entries = {} entries[0] = '0: Recorded once ever...
Reads in the gpu driver bug list, returning a dictionary mapping workaround ids to descriptions.
Reads in the gpu driver bug list, returning a dictionary mapping workaround ids to descriptions.
[ "Reads", "in", "the", "gpu", "driver", "bug", "list", "returning", "a", "dictionary", "mapping", "workaround", "ids", "to", "descriptions", "." ]
def ReadGpuDriverBugEntries(filename): with open(path_util.GetInputFile(filename)) as f: json_data = json.load(f) entries = {} entries[0] = '0: Recorded once every time this histogram is updated.' for entry in json_data["entries"]: entries[entry["id"]] = "%d: %s" % (entry["id"], entry["description"]) ...
[ "def", "ReadGpuDriverBugEntries", "(", "filename", ")", ":", "with", "open", "(", "path_util", ".", "GetInputFile", "(", "filename", ")", ")", "as", "f", ":", "json_data", "=", "json", ".", "load", "(", "f", ")", "entries", "=", "{", "}", "entries", "[...
Reads in the gpu driver bug list, returning a dictionary mapping workaround ids to descriptions.
[ "Reads", "in", "the", "gpu", "driver", "bug", "list", "returning", "a", "dictionary", "mapping", "workaround", "ids", "to", "descriptions", "." ]
[ "\"\"\"Reads in the gpu driver bug list, returning a dictionary mapping\n workaround ids to descriptions.\n \"\"\"", "# Read the file as a list of lines" ]
[ { "param": "filename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6fb668163b5e19db0a2e703364595951f6b0d985
sunlongbo/chromium
chrome/android/java/src/PRESUBMIT_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
testTruePositives
null
def testTruePositives(self): """Examples of when Notification.Builder use is correctly flagged.""" mock_input = MockInputApi() mock_input.files = [ MockFile('path/One.java', ['new Notification.Builder()']), MockFile('path/Two.java', ['new NotificationCompat.Builder()']), ] errors = P...
Examples of when Notification.Builder use is correctly flagged.
Examples of when Notification.Builder use is correctly flagged.
[ "Examples", "of", "when", "Notification", ".", "Builder", "use", "is", "correctly", "flagged", "." ]
def testTruePositives(self): mock_input = MockInputApi() mock_input.files = [ MockFile('path/One.java', ['new Notification.Builder()']), MockFile('path/Two.java', ['new NotificationCompat.Builder()']), ] errors = PRESUBMIT._CheckNotificationConstructors( mock_input, MockOutputApi...
[ "def", "testTruePositives", "(", "self", ")", ":", "mock_input", "=", "MockInputApi", "(", ")", "mock_input", ".", "files", "=", "[", "MockFile", "(", "'path/One.java'", ",", "[", "'new Notification.Builder()'", "]", ")", ",", "MockFile", "(", "'path/Two.java'",...
Examples of when Notification.Builder use is correctly flagged.
[ "Examples", "of", "when", "Notification", ".", "Builder", "use", "is", "correctly", "flagged", "." ]
[ "\"\"\"Examples of when Notification.Builder use is correctly flagged.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6fb668163b5e19db0a2e703364595951f6b0d985
sunlongbo/chromium
chrome/android/java/src/PRESUBMIT_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
testFalsePositives
null
def testFalsePositives(self): """Examples of when Notification.Builder should not be flagged.""" mock_input = MockInputApi() mock_input.files = [ MockFile( 'chrome/android/java/src/org/chromium/chrome/browser/notifications/' 'ChromeNotificationWrapperBuilder.java', ...
Examples of when Notification.Builder should not be flagged.
Examples of when Notification.Builder should not be flagged.
[ "Examples", "of", "when", "Notification", ".", "Builder", "should", "not", "be", "flagged", "." ]
def testFalsePositives(self): mock_input = MockInputApi() mock_input.files = [ MockFile( 'chrome/android/java/src/org/chromium/chrome/browser/notifications/' 'ChromeNotificationWrapperBuilder.java', ['new Notification.Builder()']), MockFile( 'chrom...
[ "def", "testFalsePositives", "(", "self", ")", ":", "mock_input", "=", "MockInputApi", "(", ")", "mock_input", ".", "files", "=", "[", "MockFile", "(", "'chrome/android/java/src/org/chromium/chrome/browser/notifications/'", "'ChromeNotificationWrapperBuilder.java'", ",", "[...
Examples of when Notification.Builder should not be flagged.
[ "Examples", "of", "when", "Notification", ".", "Builder", "should", "not", "be", "flagged", "." ]
[ "\"\"\"Examples of when Notification.Builder should not be flagged.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6fb668163b5e19db0a2e703364595951f6b0d985
sunlongbo/chromium
chrome/android/java/src/PRESUBMIT_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
testTruePositives
null
def testTruePositives(self): """Examples of when AlertDialog.Builder use is correctly flagged.""" mock_input = MockInputApi() mock_input.files = [ MockFile('path/One.java', ['new AlertDialog.Builder()']), MockFile('path/Two.java', ['new AlertDialog.Builder(context);']), ] errors = PR...
Examples of when AlertDialog.Builder use is correctly flagged.
Examples of when AlertDialog.Builder use is correctly flagged.
[ "Examples", "of", "when", "AlertDialog", ".", "Builder", "use", "is", "correctly", "flagged", "." ]
def testTruePositives(self): mock_input = MockInputApi() mock_input.files = [ MockFile('path/One.java', ['new AlertDialog.Builder()']), MockFile('path/Two.java', ['new AlertDialog.Builder(context);']), ] errors = PRESUBMIT._CheckAlertDialogBuilder(mock_input, MockOutputApi()) self.as...
[ "def", "testTruePositives", "(", "self", ")", ":", "mock_input", "=", "MockInputApi", "(", ")", "mock_input", ".", "files", "=", "[", "MockFile", "(", "'path/One.java'", ",", "[", "'new AlertDialog.Builder()'", "]", ")", ",", "MockFile", "(", "'path/Two.java'", ...
Examples of when AlertDialog.Builder use is correctly flagged.
[ "Examples", "of", "when", "AlertDialog", ".", "Builder", "use", "is", "correctly", "flagged", "." ]
[ "\"\"\"Examples of when AlertDialog.Builder use is correctly flagged.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6fb668163b5e19db0a2e703364595951f6b0d985
sunlongbo/chromium
chrome/android/java/src/PRESUBMIT_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
testFalsePositives
null
def testFalsePositives(self): """Examples of when AlertDialog.Builder should not be flagged.""" mock_input = MockInputApi() mock_input.files = [ MockFile('path/One.java', ['AlertDialog.Builder']), MockFile('path/Two.java', ['// do not: new AlertDialog.Builder()']), MockFile('path/Thr...
Examples of when AlertDialog.Builder should not be flagged.
Examples of when AlertDialog.Builder should not be flagged.
[ "Examples", "of", "when", "AlertDialog", ".", "Builder", "should", "not", "be", "flagged", "." ]
def testFalsePositives(self): mock_input = MockInputApi() mock_input.files = [ MockFile('path/One.java', ['AlertDialog.Builder']), MockFile('path/Two.java', ['// do not: new AlertDialog.Builder()']), MockFile('path/Three.java', ['/** ChromeAlertDialogBuilder', ...
[ "def", "testFalsePositives", "(", "self", ")", ":", "mock_input", "=", "MockInputApi", "(", ")", "mock_input", ".", "files", "=", "[", "MockFile", "(", "'path/One.java'", ",", "[", "'AlertDialog.Builder'", "]", ")", ",", "MockFile", "(", "'path/Two.java'", ","...
Examples of when AlertDialog.Builder should not be flagged.
[ "Examples", "of", "when", "AlertDialog", ".", "Builder", "should", "not", "be", "flagged", "." ]
[ "\"\"\"Examples of when AlertDialog.Builder should not be flagged.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6fb668163b5e19db0a2e703364595951f6b0d985
sunlongbo/chromium
chrome/android/java/src/PRESUBMIT_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
testFailure_WrongBuilderCheck
null
def testFailure_WrongBuilderCheck(self): """Use of AppCompat AlertDialog.Builder is correctly flagged.""" mock_input = MockInputApi() mock_input.files = [ MockFile('path/One.java', ['import android.support.v7.app.AlertDialog;', 'new AlertDialog.Builder()']), ...
Use of AppCompat AlertDialog.Builder is correctly flagged.
Use of AppCompat AlertDialog.Builder is correctly flagged.
[ "Use", "of", "AppCompat", "AlertDialog", ".", "Builder", "is", "correctly", "flagged", "." ]
def testFailure_WrongBuilderCheck(self): mock_input = MockInputApi() mock_input.files = [ MockFile('path/One.java', ['import android.support.v7.app.AlertDialog;', 'new AlertDialog.Builder()']), MockFile('path/Two.java', ['import android.app.Ale...
[ "def", "testFailure_WrongBuilderCheck", "(", "self", ")", ":", "mock_input", "=", "MockInputApi", "(", ")", "mock_input", ".", "files", "=", "[", "MockFile", "(", "'path/One.java'", ",", "[", "'import android.support.v7.app.AlertDialog;'", ",", "'new AlertDialog.Builder...
Use of AppCompat AlertDialog.Builder is correctly flagged.
[ "Use", "of", "AppCompat", "AlertDialog", ".", "Builder", "is", "correctly", "flagged", "." ]
[ "\"\"\"Use of AppCompat AlertDialog.Builder is correctly flagged.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6fb668163b5e19db0a2e703364595951f6b0d985
sunlongbo/chromium
chrome/android/java/src/PRESUBMIT_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
testSuccess_WrongBuilderCheck
null
def testSuccess_WrongBuilderCheck(self): """Use of OS-dependent AlertDialog should not be flagged.""" mock_input = MockInputApi() mock_input.files = [ MockFile('path/One.java', ['import android.app.AlertDialog;', 'new AlertDialog.Builder()']), MockFile('pat...
Use of OS-dependent AlertDialog should not be flagged.
Use of OS-dependent AlertDialog should not be flagged.
[ "Use", "of", "OS", "-", "dependent", "AlertDialog", "should", "not", "be", "flagged", "." ]
def testSuccess_WrongBuilderCheck(self): mock_input = MockInputApi() mock_input.files = [ MockFile('path/One.java', ['import android.app.AlertDialog;', 'new AlertDialog.Builder()']), MockFile('path/Two.java', ['import android.app.AlertDialog;',...
[ "def", "testSuccess_WrongBuilderCheck", "(", "self", ")", ":", "mock_input", "=", "MockInputApi", "(", ")", "mock_input", ".", "files", "=", "[", "MockFile", "(", "'path/One.java'", ",", "[", "'import android.app.AlertDialog;'", ",", "'new AlertDialog.Builder()'", "]"...
Use of OS-dependent AlertDialog should not be flagged.
[ "Use", "of", "OS", "-", "dependent", "AlertDialog", "should", "not", "be", "flagged", "." ]
[ "\"\"\"Use of OS-dependent AlertDialog should not be flagged.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6fb668163b5e19db0a2e703364595951f6b0d985
sunlongbo/chromium
chrome/android/java/src/PRESUBMIT_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
testFailure
null
def testFailure(self): """Use of CompatibleAlertDialogBuilder use is correctly flagged.""" mock_input = MockInputApi() mock_input.files = [ MockFile('path/One.java', ['import ' 'org.chromium.ui.UiUtils.CompatibleAlertDialogBuilder;', 'new Compatib...
Use of CompatibleAlertDialogBuilder use is correctly flagged.
Use of CompatibleAlertDialogBuilder use is correctly flagged.
[ "Use", "of", "CompatibleAlertDialogBuilder", "use", "is", "correctly", "flagged", "." ]
def testFailure(self): mock_input = MockInputApi() mock_input.files = [ MockFile('path/One.java', ['import ' 'org.chromium.ui.UiUtils.CompatibleAlertDialogBuilder;', 'new CompatibleAlertDialogBuilder()', 'A new line to make sure ther...
[ "def", "testFailure", "(", "self", ")", ":", "mock_input", "=", "MockInputApi", "(", ")", "mock_input", ".", "files", "=", "[", "MockFile", "(", "'path/One.java'", ",", "[", "'import '", "'org.chromium.ui.UiUtils.CompatibleAlertDialogBuilder;'", ",", "'new CompatibleA...
Use of CompatibleAlertDialogBuilder use is correctly flagged.
[ "Use", "of", "CompatibleAlertDialogBuilder", "use", "is", "correctly", "flagged", "." ]
[ "\"\"\"Use of CompatibleAlertDialogBuilder use is correctly flagged.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6fb668163b5e19db0a2e703364595951f6b0d985
sunlongbo/chromium
chrome/android/java/src/PRESUBMIT_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
testSuccess
null
def testSuccess(self): """Examples of when AlertDialog.Builder should not be flagged.""" mock_input = MockInputApi() mock_input.files = [ MockFile('chrome/android/java/src/org/chromium/chrome/browser/payments/' 'AndroidPaymentApp.java', ['new UiUtils.CompatibleAlert...
Examples of when AlertDialog.Builder should not be flagged.
Examples of when AlertDialog.Builder should not be flagged.
[ "Examples", "of", "when", "AlertDialog", ".", "Builder", "should", "not", "be", "flagged", "." ]
def testSuccess(self): mock_input = MockInputApi() mock_input.files = [ MockFile('chrome/android/java/src/org/chromium/chrome/browser/payments/' 'AndroidPaymentApp.java', ['new UiUtils.CompatibleAlertDialogBuilder()']), MockFile('path/One.java', ['UiUtils.Compat...
[ "def", "testSuccess", "(", "self", ")", ":", "mock_input", "=", "MockInputApi", "(", ")", "mock_input", ".", "files", "=", "[", "MockFile", "(", "'chrome/android/java/src/org/chromium/chrome/browser/payments/'", "'AndroidPaymentApp.java'", ",", "[", "'new UiUtils.Compatib...
Examples of when AlertDialog.Builder should not be flagged.
[ "Examples", "of", "when", "AlertDialog", ".", "Builder", "should", "not", "be", "flagged", "." ]
[ "\"\"\"Examples of when AlertDialog.Builder should not be flagged.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6fb668163b5e19db0a2e703364595951f6b0d985
sunlongbo/chromium
chrome/android/java/src/PRESUBMIT_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
testFailure
null
def testFailure(self): """ SplitCompatUtils.getIdentifierName() without a String literal is flagged. """ mock_input = MockInputApi() mock_input.files = [ MockFile('path/One.java', [ 'SplitCompatUtils.getIdentifierName(foo)', 'A new line to...
SplitCompatUtils.getIdentifierName() without a String literal is flagged.
SplitCompatUtils.getIdentifierName() without a String literal is flagged.
[ "SplitCompatUtils", ".", "getIdentifierName", "()", "without", "a", "String", "literal", "is", "flagged", "." ]
def testFailure(self): mock_input = MockInputApi() mock_input.files = [ MockFile('path/One.java', [ 'SplitCompatUtils.getIdentifierName(foo)', 'A new line to make sure there is no duplicate error.']), MockFile('path/Two.java', ...
[ "def", "testFailure", "(", "self", ")", ":", "mock_input", "=", "MockInputApi", "(", ")", "mock_input", ".", "files", "=", "[", "MockFile", "(", "'path/One.java'", ",", "[", "'SplitCompatUtils.getIdentifierName(foo)'", ",", "'A new line to make sure there is no duplicat...
SplitCompatUtils.getIdentifierName() without a String literal is flagged.
[ "SplitCompatUtils", ".", "getIdentifierName", "()", "without", "a", "String", "literal", "is", "flagged", "." ]
[ "\"\"\"\n SplitCompatUtils.getIdentifierName() without a String literal is flagged.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6fb668163b5e19db0a2e703364595951f6b0d985
sunlongbo/chromium
chrome/android/java/src/PRESUBMIT_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
testSuccess
null
def testSuccess(self): """ Examples of when SplitCompatUtils.getIdentifierName() should not be flagged. """ mock_input = MockInputApi() mock_input.files = [ MockFile('path/One.java', [ 'SplitCompatUtils.getIdentifierName("foo")', 'A new li...
Examples of when SplitCompatUtils.getIdentifierName() should not be flagged.
Examples of when SplitCompatUtils.getIdentifierName() should not be flagged.
[ "Examples", "of", "when", "SplitCompatUtils", ".", "getIdentifierName", "()", "should", "not", "be", "flagged", "." ]
def testSuccess(self): mock_input = MockInputApi() mock_input.files = [ MockFile('path/One.java', [ 'SplitCompatUtils.getIdentifierName("foo")', 'A new line.']), MockFile('path/Two.java', ['SplitCompatUtils.getIdentifierName( ...
[ "def", "testSuccess", "(", "self", ")", ":", "mock_input", "=", "MockInputApi", "(", ")", "mock_input", ".", "files", "=", "[", "MockFile", "(", "'path/One.java'", ",", "[", "'SplitCompatUtils.getIdentifierName(\"foo\")'", ",", "'A new line.'", "]", ")", ",", "M...
Examples of when SplitCompatUtils.getIdentifierName() should not be flagged.
[ "Examples", "of", "when", "SplitCompatUtils", ".", "getIdentifierName", "()", "should", "not", "be", "flagged", "." ]
[ "\"\"\"\n Examples of when SplitCompatUtils.getIdentifierName() should not be flagged.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a2b8e7db76550a042876355ee087d755677b12cb
sunlongbo/chromium
ppapi/generate_ppapi_size_checks.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Delete
null
def Delete(self, start_line, end_line): """Make the patch delete the lines starting with |start_line| up to but not including |end_line|. """ self.linenums_to_delete |= set(range(start_line, end_line))
Make the patch delete the lines starting with |start_line| up to but not including |end_line|.
Make the patch delete the lines starting with |start_line| up to but not including |end_line|.
[ "Make", "the", "patch", "delete", "the", "lines", "starting", "with", "|start_line|", "up", "to", "but", "not", "including", "|end_line|", "." ]
def Delete(self, start_line, end_line): self.linenums_to_delete |= set(range(start_line, end_line))
[ "def", "Delete", "(", "self", ",", "start_line", ",", "end_line", ")", ":", "self", ".", "linenums_to_delete", "|=", "set", "(", "range", "(", "start_line", ",", "end_line", ")", ")" ]
Make the patch delete the lines starting with |start_line| up to but not including |end_line|.
[ "Make", "the", "patch", "delete", "the", "lines", "starting", "with", "|start_line|", "up", "to", "but", "not", "including", "|end_line|", "." ]
[ "\"\"\"Make the patch delete the lines starting with |start_line| up to but not\n including |end_line|.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "start_line", "type": null }, { "param": "end_line", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "start_line", "type": null, "docstring": null, "docstring_toke...
a2b8e7db76550a042876355ee087d755677b12cb
sunlongbo/chromium
ppapi/generate_ppapi_size_checks.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Add
null
def Add(self, text, line_number): """Add the given text before the text on the given line number.""" if line_number in self.lines_to_add: self.lines_to_add[line_number].append(text) else: self.lines_to_add[line_number] = [text]
Add the given text before the text on the given line number.
Add the given text before the text on the given line number.
[ "Add", "the", "given", "text", "before", "the", "text", "on", "the", "given", "line", "number", "." ]
def Add(self, text, line_number): if line_number in self.lines_to_add: self.lines_to_add[line_number].append(text) else: self.lines_to_add[line_number] = [text]
[ "def", "Add", "(", "self", ",", "text", ",", "line_number", ")", ":", "if", "line_number", "in", "self", ".", "lines_to_add", ":", "self", ".", "lines_to_add", "[", "line_number", "]", ".", "append", "(", "text", ")", "else", ":", "self", ".", "lines_t...
Add the given text before the text on the given line number.
[ "Add", "the", "given", "text", "before", "the", "text", "on", "the", "given", "line", "number", "." ]
[ "\"\"\"Add the given text before the text on the given line number.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "text", "type": null }, { "param": "line_number", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "text", "type": null, "docstring": null, "docstring_tokens": [...
a2b8e7db76550a042876355ee087d755677b12cb
sunlongbo/chromium
ppapi/generate_ppapi_size_checks.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Apply
null
def Apply(self): """Apply the patch by writing it to self.filename.""" # Read the lines of the existing file in to a list. sourcefile = open(self.filename, "r") file_lines = sourcefile.readlines() sourcefile.close() # Now apply the patch. Our strategy is to keep the array at the same size, ...
Apply the patch by writing it to self.filename.
Apply the patch by writing it to self.filename.
[ "Apply", "the", "patch", "by", "writing", "it", "to", "self", ".", "filename", "." ]
def Apply(self): sourcefile = open(self.filename, "r") file_lines = sourcefile.readlines() sourcefile.close() for linenum_to_delete in self.linenums_to_delete: file_lines[linenum_to_delete] = ""; for linenum, sourcelines in self.lines_to_add.items(): sourcelines.sort() file_lines[l...
[ "def", "Apply", "(", "self", ")", ":", "sourcefile", "=", "open", "(", "self", ".", "filename", ",", "\"r\"", ")", "file_lines", "=", "sourcefile", ".", "readlines", "(", ")", "sourcefile", ".", "close", "(", ")", "for", "linenum_to_delete", "in", "self"...
Apply the patch by writing it to self.filename.
[ "Apply", "the", "patch", "by", "writing", "it", "to", "self", ".", "filename", "." ]
[ "\"\"\"Apply the patch by writing it to self.filename.\"\"\"", "# Read the lines of the existing file in to a list.", "# Now apply the patch. Our strategy is to keep the array at the same size,", "# and just edit strings in the file_lines list as necessary. When we delete", "# lines, we just blank the lin...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a2b8e7db76550a042876355ee087d755677b12cb
sunlongbo/chromium
ppapi/generate_ppapi_size_checks.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CheckAndInsert
<not_specific>
def CheckAndInsert(typeinfo, typeinfo_map): """Check if a TypeInfo exists already in the given map with the same name. If so, make sure the size is consistent. - If the name exists but the sizes do not match, print a message and exit with non-zero exit code. - If the name exists and the sizes match, do not...
Check if a TypeInfo exists already in the given map with the same name. If so, make sure the size is consistent. - If the name exists but the sizes do not match, print a message and exit with non-zero exit code. - If the name exists and the sizes match, do nothing. - If the name does not exist, insert the ...
Check if a TypeInfo exists already in the given map with the same name. If so, make sure the size is consistent. If the name exists but the sizes do not match, print a message and exit with non-zero exit code. If the name exists and the sizes match, do nothing. If the name does not exist, insert the typeinfo in to the...
[ "Check", "if", "a", "TypeInfo", "exists", "already", "in", "the", "given", "map", "with", "the", "same", "name", ".", "If", "so", "make", "sure", "the", "size", "is", "consistent", ".", "If", "the", "name", "exists", "but", "the", "sizes", "do", "not",...
def CheckAndInsert(typeinfo, typeinfo_map): if typeinfo.name == "": return elif int(typeinfo.size) == 0: return elif typeinfo.source_location.filename.find("ppapi") == -1: return elif typeinfo.source_location.filename.find("GLES2") > -1: return elif (typeinfo.name[:4] == "PPP_") or (typeinfo.n...
[ "def", "CheckAndInsert", "(", "typeinfo", ",", "typeinfo_map", ")", ":", "if", "typeinfo", ".", "name", "==", "\"\"", ":", "return", "elif", "int", "(", "typeinfo", ".", "size", ")", "==", "0", ":", "return", "elif", "typeinfo", ".", "source_location", "...
Check if a TypeInfo exists already in the given map with the same name.
[ "Check", "if", "a", "TypeInfo", "exists", "already", "in", "the", "given", "map", "with", "the", "same", "name", "." ]
[ "\"\"\"Check if a TypeInfo exists already in the given map with the same name. If\n so, make sure the size is consistent.\n - If the name exists but the sizes do not match, print a message and\n exit with non-zero exit code.\n - If the name exists and the sizes match, do nothing.\n - If the name does not ex...
[ { "param": "typeinfo", "type": null }, { "param": "typeinfo_map", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "typeinfo", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "typeinfo_map", "type": null, "docstring": null, "docstrin...
a2b8e7db76550a042876355ee087d755677b12cb
sunlongbo/chromium
ppapi/generate_ppapi_size_checks.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ProcessTarget
null
def ProcessTarget(clang_command, target, types): """Run clang using the given clang_command for the given target string. Parse the output to create TypeInfos for each discovered type. Insert each type in to the 'types' dictionary. If the type already exists in the types dictionary, make sure that the size ma...
Run clang using the given clang_command for the given target string. Parse the output to create TypeInfos for each discovered type. Insert each type in to the 'types' dictionary. If the type already exists in the types dictionary, make sure that the size matches what's already in the map. If not, exit with ...
Run clang using the given clang_command for the given target string. Parse the output to create TypeInfos for each discovered type. Insert each type in to the 'types' dictionary. If the type already exists in the types dictionary, make sure that the size matches what's already in the map. If not, exit with an error...
[ "Run", "clang", "using", "the", "given", "clang_command", "for", "the", "given", "target", "string", ".", "Parse", "the", "output", "to", "create", "TypeInfos", "for", "each", "discovered", "type", ".", "Insert", "each", "type", "in", "to", "the", "'", "ty...
def ProcessTarget(clang_command, target, types): p = subprocess.Popen(clang_command + " -triple " + target, shell=True, stdout=subprocess.PIPE) lines = p.communicate()[0].split() for line in lines: typeinfo = TypeInfo(line, target) CheckAndInsert(typeinfo, typ...
[ "def", "ProcessTarget", "(", "clang_command", ",", "target", ",", "types", ")", ":", "p", "=", "subprocess", ".", "Popen", "(", "clang_command", "+", "\" -triple \"", "+", "target", ",", "shell", "=", "True", ",", "stdout", "=", "subprocess", ".", "PIPE", ...
Run clang using the given clang_command for the given target string.
[ "Run", "clang", "using", "the", "given", "clang_command", "for", "the", "given", "target", "string", "." ]
[ "\"\"\"Run clang using the given clang_command for the given target string. Parse\n the output to create TypeInfos for each discovered type. Insert each type in\n to the 'types' dictionary. If the type already exists in the types\n dictionary, make sure that the size matches what's already in the map. If\n ...
[ { "param": "clang_command", "type": null }, { "param": "target", "type": null }, { "param": "types", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "clang_command", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target", "type": null, "docstring": null, "docstring...
a2b8e7db76550a042876355ee087d755677b12cb
sunlongbo/chromium
ppapi/generate_ppapi_size_checks.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
WriteArchSpecificCode
null
def WriteArchSpecificCode(types, root, filename): """Write a header file that contains a compile-time assertion for the size of each of the given typeinfos, in to a file named filename rooted at root. """ assertion_lines = [ToAssertionCode(typeinfo) for typeinfo in types] assertion_lines.sort() outfile =...
Write a header file that contains a compile-time assertion for the size of each of the given typeinfos, in to a file named filename rooted at root.
Write a header file that contains a compile-time assertion for the size of each of the given typeinfos, in to a file named filename rooted at root.
[ "Write", "a", "header", "file", "that", "contains", "a", "compile", "-", "time", "assertion", "for", "the", "size", "of", "each", "of", "the", "given", "typeinfos", "in", "to", "a", "file", "named", "filename", "rooted", "at", "root", "." ]
def WriteArchSpecificCode(types, root, filename): assertion_lines = [ToAssertionCode(typeinfo) for typeinfo in types] assertion_lines.sort() outfile = open(os.path.join(root, filename), "w") header_guard = "PPAPI_TESTS_" + filename.upper().replace(".", "_") + "_" outfile.write(COPYRIGHT_STRING_C) outfile.wr...
[ "def", "WriteArchSpecificCode", "(", "types", ",", "root", ",", "filename", ")", ":", "assertion_lines", "=", "[", "ToAssertionCode", "(", "typeinfo", ")", "for", "typeinfo", "in", "types", "]", "assertion_lines", ".", "sort", "(", ")", "outfile", "=", "open...
Write a header file that contains a compile-time assertion for the size of each of the given typeinfos, in to a file named filename rooted at root.
[ "Write", "a", "header", "file", "that", "contains", "a", "compile", "-", "time", "assertion", "for", "the", "size", "of", "each", "of", "the", "given", "typeinfos", "in", "to", "a", "file", "named", "filename", "rooted", "at", "root", "." ]
[ "\"\"\"Write a header file that contains a compile-time assertion for the size of\n each of the given typeinfos, in to a file named filename rooted at root.\n \"\"\"" ]
[ { "param": "types", "type": null }, { "param": "root", "type": null }, { "param": "filename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "types", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "root", "type": null, "docstring": null, "docstring_tokens": ...
a2c07c4ca572f964ca3c1b2666717c28ce2c51f9
sunlongbo/chromium
components/policy/tools/template_writers/writer_configuration.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetConfigurationForBuild
<not_specific>
def GetConfigurationForBuild(defines): '''Returns a configuration dictionary for the given build that contains build-specific settings and information. Args: defines: Definitions coming from the build system. Raises: Exception: If 'defines' contains an unknown build-type. ''' # The prefix of key n...
Returns a configuration dictionary for the given build that contains build-specific settings and information. Args: defines: Definitions coming from the build system. Raises: Exception: If 'defines' contains an unknown build-type.
Returns a configuration dictionary for the given build that contains build-specific settings and information.
[ "Returns", "a", "configuration", "dictionary", "for", "the", "given", "build", "that", "contains", "build", "-", "specific", "settings", "and", "information", "." ]
def GetConfigurationForBuild(defines): if '_chromium' in defines: config = { 'build': 'chromium', 'app_name': 'Chromium', 'frame_name': 'Chromium Frame', 'os_name': 'Chromium OS', 'webview_name': 'Chromium WebView', 'win_config': { 'win': { ...
[ "def", "GetConfigurationForBuild", "(", "defines", ")", ":", "if", "'_chromium'", "in", "defines", ":", "config", "=", "{", "'build'", ":", "'chromium'", ",", "'app_name'", ":", "'Chromium'", ",", "'frame_name'", ":", "'Chromium Frame'", ",", "'os_name'", ":", ...
Returns a configuration dictionary for the given build that contains build-specific settings and information.
[ "Returns", "a", "configuration", "dictionary", "for", "the", "given", "build", "that", "contains", "build", "-", "specific", "settings", "and", "information", "." ]
[ "'''Returns a configuration dictionary for the given build that contains\n build-specific settings and information.\n\n Args:\n defines: Definitions coming from the build system.\n\n Raises:\n Exception: If 'defines' contains an unknown build-type.\n '''", "# The prefix of key names in config determines...
[ { "param": "defines", "type": null } ]
{ "returns": [], "raises": [ { "docstring": "If 'defines' contains an unknown build-type.", "docstring_tokens": [ "If", "'", "defines", "'", "contains", "an", "unknown", "build", "-", "type", "." ], "...
abf95df42acfa90e7ca7eef427a1d2d3667bc9f5
sunlongbo/chromium
tools/clang/scripts/apply_edits.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_ParseEditsFromStdin
<not_specific>
def _ParseEditsFromStdin(build_directory): """Extracts generated list of edits from the tool's stdout. The expected format is documented at the top of this file. Args: build_directory: Directory that contains the compile database. Used to normalize the filenames. stdout: The stdout from running th...
Extracts generated list of edits from the tool's stdout. The expected format is documented at the top of this file. Args: build_directory: Directory that contains the compile database. Used to normalize the filenames. stdout: The stdout from running the clang tool. Returns: A dictionary mappi...
Extracts generated list of edits from the tool's stdout. The expected format is documented at the top of this file.
[ "Extracts", "generated", "list", "of", "edits", "from", "the", "tool", "'", "s", "stdout", ".", "The", "expected", "format", "is", "documented", "at", "the", "top", "of", "this", "file", "." ]
def _ParseEditsFromStdin(build_directory): path_to_resolved_path = {} def _ResolvePath(path): if path in path_to_resolved_path: return path_to_resolved_path[path] if not os.path.isfile(path): resolved_path = os.path.realpath(os.path.join(build_directory, path)) else: resolved_path = os...
[ "def", "_ParseEditsFromStdin", "(", "build_directory", ")", ":", "path_to_resolved_path", "=", "{", "}", "def", "_ResolvePath", "(", "path", ")", ":", "if", "path", "in", "path_to_resolved_path", ":", "return", "path_to_resolved_path", "[", "path", "]", "if", "n...
Extracts generated list of edits from the tool's stdout.
[ "Extracts", "generated", "list", "of", "edits", "from", "the", "tool", "'", "s", "stdout", "." ]
[ "\"\"\"Extracts generated list of edits from the tool's stdout.\n\n The expected format is documented at the top of this file.\n\n Args:\n build_directory: Directory that contains the compile database. Used to\n normalize the filenames.\n stdout: The stdout from running the clang tool.\n\n Returns:\n ...
[ { "param": "build_directory", "type": null } ]
{ "returns": [ { "docstring": "A dictionary mapping filenames to the associated edits.", "docstring_tokens": [ "A", "dictionary", "mapping", "filenames", "to", "the", "associated", "edits", "." ], "type": null } ...
abf95df42acfa90e7ca7eef427a1d2d3667bc9f5
sunlongbo/chromium
tools/clang/scripts/apply_edits.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_FindStartOfPreviousLine
<not_specific>
def _FindStartOfPreviousLine(contents, index): """ Requires that `index` points to the start of a line. Returns an index to the start of the previous line. """ assert (index > 0) assert (contents[index - 1] in _NEWLINE_CHARACTERS) # Go back over the newline characters associated with the *single* end o...
Requires that `index` points to the start of a line. Returns an index to the start of the previous line.
Requires that `index` points to the start of a line. Returns an index to the start of the previous line.
[ "Requires", "that", "`", "index", "`", "points", "to", "the", "start", "of", "a", "line", ".", "Returns", "an", "index", "to", "the", "start", "of", "the", "previous", "line", "." ]
def _FindStartOfPreviousLine(contents, index): assert (index > 0) assert (contents[index - 1] in _NEWLINE_CHARACTERS) index = index - 1 if index > 0 and contents[index - 1] in _NEWLINE_CHARACTERS and \ contents[index - 1] != contents[index]: index = index - 1 while index > 0 and contents[index - 1] ...
[ "def", "_FindStartOfPreviousLine", "(", "contents", ",", "index", ")", ":", "assert", "(", "index", ">", "0", ")", "assert", "(", "contents", "[", "index", "-", "1", "]", "in", "_NEWLINE_CHARACTERS", ")", "index", "=", "index", "-", "1", "if", "index", ...
Requires that `index` points to the start of a line.
[ "Requires", "that", "`", "index", "`", "points", "to", "the", "start", "of", "a", "line", "." ]
[ "\"\"\" Requires that `index` points to the start of a line.\n Returns an index to the start of the previous line.\n \"\"\"", "# Go back over the newline characters associated with the *single* end of a", "# line just before `index`, despite of whether end of a line is designated by", "# \"\\r\", \"\\n\...
[ { "param": "contents", "type": null }, { "param": "index", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "contents", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "index", "type": null, "docstring": null, "docstring_token...
19b50c9a70209291f73d184366e0d7c869034762
sunlongbo/chromium
content/test/gpu/gpu_tests/trace_integration_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GenerateBrowserArgs
<not_specific>
def GenerateBrowserArgs(cls, additional_args): """Adds default arguments to |additional_args|. See the parent class' method documentation for additional information. """ default_args = super(TraceIntegrationTest, cls).GenerateBrowserArgs(additional_args) default_args.extend...
Adds default arguments to |additional_args|. See the parent class' method documentation for additional information.
Adds default arguments to |additional_args|. See the parent class' method documentation for additional information.
[ "Adds", "default", "arguments", "to", "|additional_args|", ".", "See", "the", "parent", "class", "'", "method", "documentation", "for", "additional", "information", "." ]
def GenerateBrowserArgs(cls, additional_args): default_args = super(TraceIntegrationTest, cls).GenerateBrowserArgs(additional_args) default_args.extend([ cba.ENABLE_LOGGING, cba.ENABLE_EXPERIMENTAL_WEB_PLATFORM_FEATURES, ]) return default_args
[ "def", "GenerateBrowserArgs", "(", "cls", ",", "additional_args", ")", ":", "default_args", "=", "super", "(", "TraceIntegrationTest", ",", "cls", ")", ".", "GenerateBrowserArgs", "(", "additional_args", ")", "default_args", ".", "extend", "(", "[", "cba", ".", ...
Adds default arguments to |additional_args|.
[ "Adds", "default", "arguments", "to", "|additional_args|", "." ]
[ "\"\"\"Adds default arguments to |additional_args|.\n\n See the parent class' method documentation for additional information.\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "additional_args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "additional_args", "type": null, "docstring": null, "docstring_...
19b50c9a70209291f73d184366e0d7c869034762
sunlongbo/chromium
content/test/gpu/gpu_tests/trace_integration_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_GetVideoExpectations
<not_specific>
def _GetVideoExpectations(self, other_args): """Helper for creating expectations for CheckVideoPath and CheckOverlayMode. Args: other_args: The |other_args| arg passed into the test. Returns: A _VideoExpectations instance with zero_copy, pixel_format, no_overlay, and presentation_mode fi...
Helper for creating expectations for CheckVideoPath and CheckOverlayMode. Args: other_args: The |other_args| arg passed into the test. Returns: A _VideoExpectations instance with zero_copy, pixel_format, no_overlay, and presentation_mode filled in.
Helper for creating expectations for CheckVideoPath and CheckOverlayMode.
[ "Helper", "for", "creating", "expectations", "for", "CheckVideoPath", "and", "CheckOverlayMode", "." ]
def _GetVideoExpectations(self, other_args): overlay_bot_config = self._GetAndAssertOverlayBotConfig() expected = _VideoExpectations() expected.zero_copy = other_args.get('zero_copy', None) expected.pixel_format = other_args.get('pixel_format', None) expected.no_overlay = other_args.get('no_overlay'...
[ "def", "_GetVideoExpectations", "(", "self", ",", "other_args", ")", ":", "overlay_bot_config", "=", "self", ".", "_GetAndAssertOverlayBotConfig", "(", ")", "expected", "=", "_VideoExpectations", "(", ")", "expected", ".", "zero_copy", "=", "other_args", ".", "get...
Helper for creating expectations for CheckVideoPath and CheckOverlayMode.
[ "Helper", "for", "creating", "expectations", "for", "CheckVideoPath", "and", "CheckOverlayMode", "." ]
[ "\"\"\"Helper for creating expectations for CheckVideoPath and CheckOverlayMode.\n\n Args:\n other_args: The |other_args| arg passed into the test.\n\n Returns:\n A _VideoExpectations instance with zero_copy, pixel_format, no_overlay,\n and presentation_mode filled in.\n \"\"\"", "# TODO(s...
[ { "param": "self", "type": null }, { "param": "other_args", "type": null } ]
{ "returns": [ { "docstring": "A _VideoExpectations instance with zero_copy, pixel_format, no_overlay,\nand presentation_mode filled in.", "docstring_tokens": [ "A", "_VideoExpectations", "instance", "with", "zero_copy", "pixel_format", "no_overl...
19b50c9a70209291f73d184366e0d7c869034762
sunlongbo/chromium
content/test/gpu/gpu_tests/trace_integration_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_EvaluateSuccess_CheckVideoPath
<not_specific>
def _EvaluateSuccess_CheckVideoPath(self, category, event_iterator, other_args): """Verifies Chrome goes down the code path as expected. Depending on whether hardware overlays are supported or not, which formats are supported in overlays, whether video is downscaled or...
Verifies Chrome goes down the code path as expected. Depending on whether hardware overlays are supported or not, which formats are supported in overlays, whether video is downscaled or not, whether video is rotated or not, Chrome's video presentation code path can be different.
Verifies Chrome goes down the code path as expected. Depending on whether hardware overlays are supported or not, which formats are supported in overlays, whether video is downscaled or not, whether video is rotated or not, Chrome's video presentation code path can be different.
[ "Verifies", "Chrome", "goes", "down", "the", "code", "path", "as", "expected", ".", "Depending", "on", "whether", "hardware", "overlays", "are", "supported", "or", "not", "which", "formats", "are", "supported", "in", "overlays", "whether", "video", "is", "down...
def _EvaluateSuccess_CheckVideoPath(self, category, event_iterator, other_args): os_name = self.browser.platform.GetOSName() assert os_name and os_name.lower() == 'win' other_args = other_args or {} expected = self._GetVideoExpectations(other_args) for event in ...
[ "def", "_EvaluateSuccess_CheckVideoPath", "(", "self", ",", "category", ",", "event_iterator", ",", "other_args", ")", ":", "os_name", "=", "self", ".", "browser", ".", "platform", ".", "GetOSName", "(", ")", "assert", "os_name", "and", "os_name", ".", "lower"...
Verifies Chrome goes down the code path as expected.
[ "Verifies", "Chrome", "goes", "down", "the", "code", "path", "as", "expected", "." ]
[ "\"\"\"Verifies Chrome goes down the code path as expected.\n\n Depending on whether hardware overlays are supported or not, which formats\n are supported in overlays, whether video is downscaled or not, whether\n video is rotated or not, Chrome's video presentation code path can be\n different.\n \"...
[ { "param": "self", "type": null }, { "param": "category", "type": null }, { "param": "event_iterator", "type": null }, { "param": "other_args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "category", "type": null, "docstring": null, "docstring_tokens...
19b50c9a70209291f73d184366e0d7c869034762
sunlongbo/chromium
content/test/gpu/gpu_tests/trace_integration_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_EvaluateSuccess_CheckOverlayMode
<not_specific>
def _EvaluateSuccess_CheckOverlayMode(self, category, event_iterator, other_args): """Verifies video frames are promoted to overlays when supported.""" os_name = self.browser.platform.GetOSName() assert os_name and os_name.lower() == 'win' other_args = other_args...
Verifies video frames are promoted to overlays when supported.
Verifies video frames are promoted to overlays when supported.
[ "Verifies", "video", "frames", "are", "promoted", "to", "overlays", "when", "supported", "." ]
def _EvaluateSuccess_CheckOverlayMode(self, category, event_iterator, other_args): os_name = self.browser.platform.GetOSName() assert os_name and os_name.lower() == 'win' other_args = other_args or {} expected = self._GetVideoExpectations(other_args) presentat...
[ "def", "_EvaluateSuccess_CheckOverlayMode", "(", "self", ",", "category", ",", "event_iterator", ",", "other_args", ")", ":", "os_name", "=", "self", ".", "browser", ".", "platform", ".", "GetOSName", "(", ")", "assert", "os_name", "and", "os_name", ".", "lowe...
Verifies video frames are promoted to overlays when supported.
[ "Verifies", "video", "frames", "are", "promoted", "to", "overlays", "when", "supported", "." ]
[ "\"\"\"Verifies video frames are promoted to overlays when supported.\"\"\"", "# Be more tolerant to avoid test flakiness", "# Be more tolerant for the first half frames in non-overlay mode." ]
[ { "param": "self", "type": null }, { "param": "category", "type": null }, { "param": "event_iterator", "type": null }, { "param": "other_args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "category", "type": null, "docstring": null, "docstring_tokens...
19b50c9a70209291f73d184366e0d7c869034762
sunlongbo/chromium
content/test/gpu/gpu_tests/trace_integration_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_EvaluateSuccess_CheckSwapChainPath
null
def _EvaluateSuccess_CheckSwapChainPath(self, category, event_iterator, other_args): """Verifies that swap chains are used as expected for low latency canvas.""" os_name = self.browser.platform.GetOSName() assert os_name and os_name.lower() == 'win' overlay_bot...
Verifies that swap chains are used as expected for low latency canvas.
Verifies that swap chains are used as expected for low latency canvas.
[ "Verifies", "that", "swap", "chains", "are", "used", "as", "expected", "for", "low", "latency", "canvas", "." ]
def _EvaluateSuccess_CheckSwapChainPath(self, category, event_iterator, other_args): os_name = self.browser.platform.GetOSName() assert os_name and os_name.lower() == 'win' overlay_bot_config = self.GetOverlayBotConfig() if overlay_bot_config is None: self...
[ "def", "_EvaluateSuccess_CheckSwapChainPath", "(", "self", ",", "category", ",", "event_iterator", ",", "other_args", ")", ":", "os_name", "=", "self", ".", "browser", ".", "platform", ".", "GetOSName", "(", ")", "assert", "os_name", "and", "os_name", ".", "lo...
Verifies that swap chains are used as expected for low latency canvas.
[ "Verifies", "that", "swap", "chains", "are", "used", "as", "expected", "for", "low", "latency", "canvas", "." ]
[ "\"\"\"Verifies that swap chains are used as expected for low latency canvas.\"\"\"", "# Verify expectations through captured trace events." ]
[ { "param": "self", "type": null }, { "param": "category", "type": null }, { "param": "event_iterator", "type": null }, { "param": "other_args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "category", "type": null, "docstring": null, "docstring_tokens...
19b50c9a70209291f73d184366e0d7c869034762
sunlongbo/chromium
content/test/gpu/gpu_tests/trace_integration_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_EvaluateSuccess_CheckMainSwapChainPath
null
def _EvaluateSuccess_CheckMainSwapChainPath(self, category, event_iterator, other_args): """Verified that Chrome's main swap chain is presented with full damage.""" os_name = self.browser.platform.GetOSName() assert os_name and os_name.lower() == 'win' over...
Verified that Chrome's main swap chain is presented with full damage.
Verified that Chrome's main swap chain is presented with full damage.
[ "Verified", "that", "Chrome", "'", "s", "main", "swap", "chain", "is", "presented", "with", "full", "damage", "." ]
def _EvaluateSuccess_CheckMainSwapChainPath(self, category, event_iterator, other_args): os_name = self.browser.platform.GetOSName() assert os_name and os_name.lower() == 'win' overlay_bot_config = self.GetOverlayBotConfig() if overlay_bot_config is None: ...
[ "def", "_EvaluateSuccess_CheckMainSwapChainPath", "(", "self", ",", "category", ",", "event_iterator", ",", "other_args", ")", ":", "os_name", "=", "self", ".", "browser", ".", "platform", ".", "GetOSName", "(", ")", "assert", "os_name", "and", "os_name", ".", ...
Verified that Chrome's main swap chain is presented with full damage.
[ "Verified", "that", "Chrome", "'", "s", "main", "swap", "chain", "is", "presented", "with", "full", "damage", "." ]
[ "\"\"\"Verified that Chrome's main swap chain is presented with full damage.\"\"\"", "# Verify expectations through captured trace events.", "# Today Chrome either run with full damage or partial damage, but not both.", "# This may change in the future." ]
[ { "param": "self", "type": null }, { "param": "category", "type": null }, { "param": "event_iterator", "type": null }, { "param": "other_args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "category", "type": null, "docstring": null, "docstring_tokens...
19c294fba54b353df1af1998c97ffe08c19c0e44
sunlongbo/chromium
tools/resources/ar.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ExpandThinArchives
<not_specific>
def ExpandThinArchives(paths): """Expands all thin archives found in |paths| into .o paths. Args: paths: List of paths relative to |output_directory|. output_directory: Output directory. Returns: * A new list of paths with all archives replaced by .o paths. """ expanded_paths = [] for path in ...
Expands all thin archives found in |paths| into .o paths. Args: paths: List of paths relative to |output_directory|. output_directory: Output directory. Returns: * A new list of paths with all archives replaced by .o paths.
Expands all thin archives found in |paths| into .o paths.
[ "Expands", "all", "thin", "archives", "found", "in", "|paths|", "into", ".", "o", "paths", "." ]
def ExpandThinArchives(paths): expanded_paths = [] for path in paths: if not path.endswith('.a'): expanded_paths.append(path) continue with open(path, 'rb') as f: header = f.read(8) is_thin = header == b'!<thin>\n' if is_thin: for subpath in _IterThinPaths(path): ...
[ "def", "ExpandThinArchives", "(", "paths", ")", ":", "expanded_paths", "=", "[", "]", "for", "path", "in", "paths", ":", "if", "not", "path", ".", "endswith", "(", "'.a'", ")", ":", "expanded_paths", ".", "append", "(", "path", ")", "continue", "with", ...
Expands all thin archives found in |paths| into .o paths.
[ "Expands", "all", "thin", "archives", "found", "in", "|paths|", "into", ".", "o", "paths", "." ]
[ "\"\"\"Expands all thin archives found in |paths| into .o paths.\n\n Args:\n paths: List of paths relative to |output_directory|.\n output_directory: Output directory.\n\n Returns:\n * A new list of paths with all archives replaced by .o paths.\n \"\"\"" ]
[ { "param": "paths", "type": null } ]
{ "returns": [ { "docstring": "A new list of paths with all archives replaced by .o paths.", "docstring_tokens": [ "A", "new", "list", "of", "paths", "with", "all", "archives", "replaced", "by", ".", "o", ...
490061b4bb35eb23cf66787a22523d087c468bbb
sunlongbo/chromium
third_party/blink/tools/blinkpy/style/filereader_unittest.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_create_file
<not_specific>
def _create_file(self, rel_path, text): """Create a file with given text and return the path to the file.""" # FIXME: There are better/more secure APIs for creating tmp file paths. file_path = self.filesystem.join(self._temp_dir, rel_path) self.filesystem.write_text_file(file_path, text)...
Create a file with given text and return the path to the file.
Create a file with given text and return the path to the file.
[ "Create", "a", "file", "with", "given", "text", "and", "return", "the", "path", "to", "the", "file", "." ]
def _create_file(self, rel_path, text): file_path = self.filesystem.join(self._temp_dir, rel_path) self.filesystem.write_text_file(file_path, text) return file_path
[ "def", "_create_file", "(", "self", ",", "rel_path", ",", "text", ")", ":", "file_path", "=", "self", ".", "filesystem", ".", "join", "(", "self", ".", "_temp_dir", ",", "rel_path", ")", "self", ".", "filesystem", ".", "write_text_file", "(", "file_path", ...
Create a file with given text and return the path to the file.
[ "Create", "a", "file", "with", "given", "text", "and", "return", "the", "path", "to", "the", "file", "." ]
[ "\"\"\"Create a file with given text and return the path to the file.\"\"\"", "# FIXME: There are better/more secure APIs for creating tmp file paths." ]
[ { "param": "self", "type": null }, { "param": "rel_path", "type": null }, { "param": "text", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rel_path", "type": null, "docstring": null, "docstring_tokens...
4904aa2a25334f244f8dbcc41ae2584535dad571
sunlongbo/chromium
chrome/updater/mac/signing/pipeline.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_sign_app
null
def _sign_app(paths, config, dest_dir): """Does signing of an updater app bundle, which is moved into |dest_dir|. Args: paths: A |model.Paths| object. config: A |config.CodeSignConfig|. dest_dir: The directory into which the product will be placed when the operations are com...
Does signing of an updater app bundle, which is moved into |dest_dir|. Args: paths: A |model.Paths| object. config: A |config.CodeSignConfig|. dest_dir: The directory into which the product will be placed when the operations are completed.
Does signing of an updater app bundle, which is moved into |dest_dir|.
[ "Does", "signing", "of", "an", "updater", "app", "bundle", "which", "is", "moved", "into", "|dest_dir|", "." ]
def _sign_app(paths, config, dest_dir): commands.copy_files(os.path.join(paths.input, config.app_dir), paths.work) parts.sign_all(paths, config) commands.make_dir(dest_dir) commands.move_file( os.path.join(paths.work, config.app_dir), os.path.join(dest_dir, config.app_dir))
[ "def", "_sign_app", "(", "paths", ",", "config", ",", "dest_dir", ")", ":", "commands", ".", "copy_files", "(", "os", ".", "path", ".", "join", "(", "paths", ".", "input", ",", "config", ".", "app_dir", ")", ",", "paths", ".", "work", ")", "parts", ...
Does signing of an updater app bundle, which is moved into |dest_dir|.
[ "Does", "signing", "of", "an", "updater", "app", "bundle", "which", "is", "moved", "into", "|dest_dir|", "." ]
[ "\"\"\"Does signing of an updater app bundle, which is moved into |dest_dir|.\n\n Args:\n paths: A |model.Paths| object.\n config: A |config.CodeSignConfig|.\n dest_dir: The directory into which the product will be placed when\n the operations are completed.\n \"\"\"" ]
[ { "param": "paths", "type": null }, { "param": "config", "type": null }, { "param": "dest_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "paths", "type": null, "docstring": "A |model.Paths| object.", "docstring_tokens": [ "A", "|model", ".", "Paths|", "object", "." ], "default": null, "is_optional...
4904aa2a25334f244f8dbcc41ae2584535dad571
sunlongbo/chromium
chrome/updater/mac/signing/pipeline.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_package_and_sign_dmg
<not_specific>
def _package_and_sign_dmg(paths, config): """Packages, signs, and verifies a DMG for a signed build product. Args: paths: A |model.Paths| object. config: The |config.CodeSignConfig| object. Returns: The path to the signed DMG file. """ dmg_path = _package_dmg(paths, config)...
Packages, signs, and verifies a DMG for a signed build product. Args: paths: A |model.Paths| object. config: The |config.CodeSignConfig| object. Returns: The path to the signed DMG file.
Packages, signs, and verifies a DMG for a signed build product.
[ "Packages", "signs", "and", "verifies", "a", "DMG", "for", "a", "signed", "build", "product", "." ]
def _package_and_sign_dmg(paths, config): dmg_path = _package_dmg(paths, config) product = model.CodeSignedProduct( dmg_path, config.packaging_basename, sign_with_identifier=True) signing.sign_part(paths, config, product) signing.verify_part(paths, product) return dmg_path
[ "def", "_package_and_sign_dmg", "(", "paths", ",", "config", ")", ":", "dmg_path", "=", "_package_dmg", "(", "paths", ",", "config", ")", "product", "=", "model", ".", "CodeSignedProduct", "(", "dmg_path", ",", "config", ".", "packaging_basename", ",", "sign_w...
Packages, signs, and verifies a DMG for a signed build product.
[ "Packages", "signs", "and", "verifies", "a", "DMG", "for", "a", "signed", "build", "product", "." ]
[ "\"\"\"Packages, signs, and verifies a DMG for a signed build product.\n\n Args:\n paths: A |model.Paths| object.\n config: The |config.CodeSignConfig| object.\n\n Returns:\n The path to the signed DMG file.\n \"\"\"" ]
[ { "param": "paths", "type": null }, { "param": "config", "type": null } ]
{ "returns": [ { "docstring": "The path to the signed DMG file.", "docstring_tokens": [ "The", "path", "to", "the", "signed", "DMG", "file", "." ], "type": null } ], "raises": [], "params": [ { "identifier"...
4904aa2a25334f244f8dbcc41ae2584535dad571
sunlongbo/chromium
chrome/updater/mac/signing/pipeline.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_package_dmg
<not_specific>
def _package_dmg(paths, config): """Packages an Updater application bundle into a DMG. Args: paths: A |model.Paths| object. config: The |config.CodeSignConfig| object. Returns: A path to the produced DMG file. """ dmg_path = os.path.join(paths.output, ...
Packages an Updater application bundle into a DMG. Args: paths: A |model.Paths| object. config: The |config.CodeSignConfig| object. Returns: A path to the produced DMG file.
Packages an Updater application bundle into a DMG.
[ "Packages", "an", "Updater", "application", "bundle", "into", "a", "DMG", "." ]
def _package_dmg(paths, config): dmg_path = os.path.join(paths.output, '{}.dmg'.format(config.packaging_basename)) app_path = os.path.join(paths.work, config.app_dir) empty_dir = os.path.join(paths.work, 'empty') commands.make_dir(empty_dir) pkg_dmg = [ os.path.jo...
[ "def", "_package_dmg", "(", "paths", ",", "config", ")", ":", "dmg_path", "=", "os", ".", "path", ".", "join", "(", "paths", ".", "output", ",", "'{}.dmg'", ".", "format", "(", "config", ".", "packaging_basename", ")", ")", "app_path", "=", "os", ".", ...
Packages an Updater application bundle into a DMG.
[ "Packages", "an", "Updater", "application", "bundle", "into", "a", "DMG", "." ]
[ "\"\"\"Packages an Updater application bundle into a DMG.\n\n Args:\n paths: A |model.Paths| object.\n config: The |config.CodeSignConfig| object.\n\n Returns:\n A path to the produced DMG file.\n \"\"\"" ]
[ { "param": "paths", "type": null }, { "param": "config", "type": null } ]
{ "returns": [ { "docstring": "A path to the produced DMG file.", "docstring_tokens": [ "A", "path", "to", "the", "produced", "DMG", "file", "." ], "type": null } ], "raises": [], "params": [ { "identifier"...
4907d85badb7c89d8823d03bbe9630232a0807e1
sunlongbo/chromium
tools/check_git_config.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
is_in_google_corp
<not_specific>
def is_in_google_corp(): """True when running in google corp network.""" try: return socket.getfqdn().endswith('.corp.google.com') except socket.error: logging.exception('Failed to get FQDN') return False
True when running in google corp network.
True when running in google corp network.
[ "True", "when", "running", "in", "google", "corp", "network", "." ]
def is_in_google_corp(): try: return socket.getfqdn().endswith('.corp.google.com') except socket.error: logging.exception('Failed to get FQDN') return False
[ "def", "is_in_google_corp", "(", ")", ":", "try", ":", "return", "socket", ".", "getfqdn", "(", ")", ".", "endswith", "(", "'.corp.google.com'", ")", "except", "socket", ".", "error", ":", "logging", ".", "exception", "(", "'Failed to get FQDN'", ")", "retur...
True when running in google corp network.
[ "True", "when", "running", "in", "google", "corp", "network", "." ]
[ "\"\"\"True when running in google corp network.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
4907d85badb7c89d8823d03bbe9630232a0807e1
sunlongbo/chromium
tools/check_git_config.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
read_git_config
<not_specific>
def read_git_config(prop): """Reads git config property of src.git repo. Returns empty string in case of errors. """ try: proc = subprocess.Popen( [GIT_EXE, 'config', prop], stdout=subprocess.PIPE, cwd=REPO_ROOT) out, _ = proc.communicate() return out.strip().decode('utf-8') except OSErro...
Reads git config property of src.git repo. Returns empty string in case of errors.
Reads git config property of src.git repo. Returns empty string in case of errors.
[ "Reads", "git", "config", "property", "of", "src", ".", "git", "repo", ".", "Returns", "empty", "string", "in", "case", "of", "errors", "." ]
def read_git_config(prop): try: proc = subprocess.Popen( [GIT_EXE, 'config', prop], stdout=subprocess.PIPE, cwd=REPO_ROOT) out, _ = proc.communicate() return out.strip().decode('utf-8') except OSError as exc: if exc.errno != errno.ENOENT: logging.exception('Unexpected error when callin...
[ "def", "read_git_config", "(", "prop", ")", ":", "try", ":", "proc", "=", "subprocess", ".", "Popen", "(", "[", "GIT_EXE", ",", "'config'", ",", "prop", "]", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "cwd", "=", "REPO_ROOT", ")", "out", ","...
Reads git config property of src.git repo.
[ "Reads", "git", "config", "property", "of", "src", ".", "git", "repo", "." ]
[ "\"\"\"Reads git config property of src.git repo.\n\n Returns empty string in case of errors.\n \"\"\"" ]
[ { "param": "prop", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "prop", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4907d85badb7c89d8823d03bbe9630232a0807e1
sunlongbo/chromium
tools/check_git_config.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
read_netrc_user
<not_specific>
def read_netrc_user(netrc_obj, host): """Reads 'user' field of a host entry in netrc. Returns empty string if netrc is missing, or host is not there. """ if not netrc_obj: return '' entry = netrc_obj.authenticators(host) if not entry: return '' return entry[0]
Reads 'user' field of a host entry in netrc. Returns empty string if netrc is missing, or host is not there.
Reads 'user' field of a host entry in netrc. Returns empty string if netrc is missing, or host is not there.
[ "Reads", "'", "user", "'", "field", "of", "a", "host", "entry", "in", "netrc", ".", "Returns", "empty", "string", "if", "netrc", "is", "missing", "or", "host", "is", "not", "there", "." ]
def read_netrc_user(netrc_obj, host): if not netrc_obj: return '' entry = netrc_obj.authenticators(host) if not entry: return '' return entry[0]
[ "def", "read_netrc_user", "(", "netrc_obj", ",", "host", ")", ":", "if", "not", "netrc_obj", ":", "return", "''", "entry", "=", "netrc_obj", ".", "authenticators", "(", "host", ")", "if", "not", "entry", ":", "return", "''", "return", "entry", "[", "0", ...
Reads 'user' field of a host entry in netrc.
[ "Reads", "'", "user", "'", "field", "of", "a", "host", "entry", "in", "netrc", "." ]
[ "\"\"\"Reads 'user' field of a host entry in netrc.\n\n Returns empty string if netrc is missing, or host is not there.\n \"\"\"" ]
[ { "param": "netrc_obj", "type": null }, { "param": "host", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "netrc_obj", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "host", "type": null, "docstring": null, "docstring_token...
4907d85badb7c89d8823d03bbe9630232a0807e1
sunlongbo/chromium
tools/check_git_config.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
read_git_insteadof
<not_specific>
def read_git_insteadof(host): """Reads relevant insteadOf config entries.""" try: proc = subprocess.Popen([GIT_EXE, 'config', '-l'], stdout=subprocess.PIPE) out, _ = proc.communicate() lines = [] for line in out.strip().split('\n'): line = line.lower() if 'insteadof=' in line and host in...
Reads relevant insteadOf config entries.
Reads relevant insteadOf config entries.
[ "Reads", "relevant", "insteadOf", "config", "entries", "." ]
def read_git_insteadof(host): try: proc = subprocess.Popen([GIT_EXE, 'config', '-l'], stdout=subprocess.PIPE) out, _ = proc.communicate() lines = [] for line in out.strip().split('\n'): line = line.lower() if 'insteadof=' in line and host in line: lines.append(line) return '\n'...
[ "def", "read_git_insteadof", "(", "host", ")", ":", "try", ":", "proc", "=", "subprocess", ".", "Popen", "(", "[", "GIT_EXE", ",", "'config'", ",", "'-l'", "]", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", "out", ",", "_", "=", "proc", ".", ...
Reads relevant insteadOf config entries.
[ "Reads", "relevant", "insteadOf", "config", "entries", "." ]
[ "\"\"\"Reads relevant insteadOf config entries.\"\"\"" ]
[ { "param": "host", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "host", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4907d85badb7c89d8823d03bbe9630232a0807e1
sunlongbo/chromium
tools/check_git_config.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
scan_configuration
<not_specific>
def scan_configuration(): """Scans local environment for git related configuration values.""" # Git checkout? is_git = is_using_git() # On Windows HOME should be set. if 'HOME' in os.environ: netrc_path = os.path.join( os.environ['HOME'], '_netrc' if sys.platform.startswith('win') else '....
Scans local environment for git related configuration values.
Scans local environment for git related configuration values.
[ "Scans", "local", "environment", "for", "git", "related", "configuration", "values", "." ]
def scan_configuration(): is_git = is_using_git() if 'HOME' in os.environ: netrc_path = os.path.join( os.environ['HOME'], '_netrc' if sys.platform.startswith('win') else '.netrc') else: netrc_path = None is_using_netrc = netrc_path and os.path.exists(netrc_path) netrc_obj = None if i...
[ "def", "scan_configuration", "(", ")", ":", "is_git", "=", "is_using_git", "(", ")", "if", "'HOME'", "in", "os", ".", "environ", ":", "netrc_path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "environ", "[", "'HOME'", "]", ",", "'_netrc'", "...
Scans local environment for git related configuration values.
[ "Scans", "local", "environment", "for", "git", "related", "configuration", "values", "." ]
[ "\"\"\"Scans local environment for git related configuration values.\"\"\"", "# Git checkout?", "# On Windows HOME should be set.", "# Netrc exists?", "# Read it.", "# Read gclient 'src' solution." ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
4907d85badb7c89d8823d03bbe9630232a0807e1
sunlongbo/chromium
tools/check_git_config.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
last_configuration_path
<not_specific>
def last_configuration_path(): """Path to store last checked configuration.""" if is_using_git(): return os.path.join(REPO_ROOT, '.git', 'check_git_push_access_conf.json') elif is_using_svn(): return os.path.join(REPO_ROOT, '.svn', 'check_git_push_access_conf.json') else: return os.path.join(REPO_RO...
Path to store last checked configuration.
Path to store last checked configuration.
[ "Path", "to", "store", "last", "checked", "configuration", "." ]
def last_configuration_path(): if is_using_git(): return os.path.join(REPO_ROOT, '.git', 'check_git_push_access_conf.json') elif is_using_svn(): return os.path.join(REPO_ROOT, '.svn', 'check_git_push_access_conf.json') else: return os.path.join(REPO_ROOT, '.check_git_push_access_conf.json')
[ "def", "last_configuration_path", "(", ")", ":", "if", "is_using_git", "(", ")", ":", "return", "os", ".", "path", ".", "join", "(", "REPO_ROOT", ",", "'.git'", ",", "'check_git_push_access_conf.json'", ")", "elif", "is_using_svn", "(", ")", ":", "return", "...
Path to store last checked configuration.
[ "Path", "to", "store", "last", "checked", "configuration", "." ]
[ "\"\"\"Path to store last checked configuration.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
4907d85badb7c89d8823d03bbe9630232a0807e1
sunlongbo/chromium
tools/check_git_config.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
read_last_configuration
<not_specific>
def read_last_configuration(): """Reads last checked configuration if it exists.""" try: with open(last_configuration_path(), 'r') as f: return json.load(f) except (IOError, ValueError): return None
Reads last checked configuration if it exists.
Reads last checked configuration if it exists.
[ "Reads", "last", "checked", "configuration", "if", "it", "exists", "." ]
def read_last_configuration(): try: with open(last_configuration_path(), 'r') as f: return json.load(f) except (IOError, ValueError): return None
[ "def", "read_last_configuration", "(", ")", ":", "try", ":", "with", "open", "(", "last_configuration_path", "(", ")", ",", "'r'", ")", "as", "f", ":", "return", "json", ".", "load", "(", "f", ")", "except", "(", "IOError", ",", "ValueError", ")", ":",...
Reads last checked configuration if it exists.
[ "Reads", "last", "checked", "configuration", "if", "it", "exists", "." ]
[ "\"\"\"Reads last checked configuration if it exists.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
4907d85badb7c89d8823d03bbe9630232a0807e1
sunlongbo/chromium
tools/check_git_config.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
write_last_configuration
null
def write_last_configuration(conf): """Writes last checked configuration to a file.""" try: with open(last_configuration_path(), 'w') as f: json.dump(conf, f, indent=2, sort_keys=True) except IOError: logging.exception('Failed to write JSON to %s', path)
Writes last checked configuration to a file.
Writes last checked configuration to a file.
[ "Writes", "last", "checked", "configuration", "to", "a", "file", "." ]
def write_last_configuration(conf): try: with open(last_configuration_path(), 'w') as f: json.dump(conf, f, indent=2, sort_keys=True) except IOError: logging.exception('Failed to write JSON to %s', path)
[ "def", "write_last_configuration", "(", "conf", ")", ":", "try", ":", "with", "open", "(", "last_configuration_path", "(", ")", ",", "'w'", ")", "as", "f", ":", "json", ".", "dump", "(", "conf", ",", "f", ",", "indent", "=", "2", ",", "sort_keys", "=...
Writes last checked configuration to a file.
[ "Writes", "last", "checked", "configuration", "to", "a", "file", "." ]
[ "\"\"\"Writes last checked configuration to a file.\"\"\"" ]
[ { "param": "conf", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "conf", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4907d85badb7c89d8823d03bbe9630232a0807e1
sunlongbo/chromium
tools/check_git_config.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
temp_directory
null
def temp_directory(): """Creates a temp directory, then nukes it.""" tmp = tempfile.mkdtemp() try: yield tmp finally: try: shutil.rmtree(tmp) except (OSError, IOError): logging.exception('Failed to remove temp directory %s', tmp)
Creates a temp directory, then nukes it.
Creates a temp directory, then nukes it.
[ "Creates", "a", "temp", "directory", "then", "nukes", "it", "." ]
def temp_directory(): tmp = tempfile.mkdtemp() try: yield tmp finally: try: shutil.rmtree(tmp) except (OSError, IOError): logging.exception('Failed to remove temp directory %s', tmp)
[ "def", "temp_directory", "(", ")", ":", "tmp", "=", "tempfile", ".", "mkdtemp", "(", ")", "try", ":", "yield", "tmp", "finally", ":", "try", ":", "shutil", ".", "rmtree", "(", "tmp", ")", "except", "(", "OSError", ",", "IOError", ")", ":", "logging",...
Creates a temp directory, then nukes it.
[ "Creates", "a", "temp", "directory", "then", "nukes", "it", "." ]
[ "\"\"\"Creates a temp directory, then nukes it.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
4907d85badb7c89d8823d03bbe9630232a0807e1
sunlongbo/chromium
tools/check_git_config.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
check_git_config
<not_specific>
def check_git_config(conf, report_url, verbose): """Attempts to push to a git repository, reports results to a server. Returns True if the check finished without incidents (push itself may have failed) and should NOT be retried on next invocation of the hook. """ # Don't even try to push if netrc is not conf...
Attempts to push to a git repository, reports results to a server. Returns True if the check finished without incidents (push itself may have failed) and should NOT be retried on next invocation of the hook.
Attempts to push to a git repository, reports results to a server. Returns True if the check finished without incidents (push itself may have failed) and should NOT be retried on next invocation of the hook.
[ "Attempts", "to", "push", "to", "a", "git", "repository", "reports", "results", "to", "a", "server", ".", "Returns", "True", "if", "the", "check", "finished", "without", "incidents", "(", "push", "itself", "may", "have", "failed", ")", "and", "should", "NO...
def check_git_config(conf, report_url, verbose): if not conf['chromium_netrc_email']: return upload_report( conf, report_url, verbose, push_works=False, push_log='', push_duration_ms=0) ref = 'refs/push-test/%s' % conf['chromium_netrc_email'] push_works = False ...
[ "def", "check_git_config", "(", "conf", ",", "report_url", ",", "verbose", ")", ":", "if", "not", "conf", "[", "'chromium_netrc_email'", "]", ":", "return", "upload_report", "(", "conf", ",", "report_url", ",", "verbose", ",", "push_works", "=", "False", ","...
Attempts to push to a git repository, reports results to a server.
[ "Attempts", "to", "push", "to", "a", "git", "repository", "reports", "results", "to", "a", "server", "." ]
[ "\"\"\"Attempts to push to a git repository, reports results to a server.\n\n Returns True if the check finished without incidents (push itself may\n have failed) and should NOT be retried on next invocation of the hook.\n \"\"\"", "# Don't even try to push if netrc is not configured.", "# Ref to push to, ea...
[ { "param": "conf", "type": null }, { "param": "report_url", "type": null }, { "param": "verbose", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "conf", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "report_url", "type": null, "docstring": null, "docstring_toke...
4907d85badb7c89d8823d03bbe9630232a0807e1
sunlongbo/chromium
tools/check_git_config.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
check_gclient_config
<not_specific>
def check_gclient_config(conf): """Shows warning if gclient solution is not properly configured for git.""" # Ignore configs that do not have 'src' solution at all. if not conf['gclient_url']: return current = { 'name': 'src', 'deps_file': conf['gclient_deps'] or 'DEPS', 'managed': conf['gclient...
Shows warning if gclient solution is not properly configured for git.
Shows warning if gclient solution is not properly configured for git.
[ "Shows", "warning", "if", "gclient", "solution", "is", "not", "properly", "configured", "for", "git", "." ]
def check_gclient_config(conf): if not conf['gclient_url']: return current = { 'name': 'src', 'deps_file': conf['gclient_deps'] or 'DEPS', 'managed': conf['gclient_managed'] or False, 'url': conf['gclient_url'], } good = GOOD_GCLIENT_SOLUTION.copy() good['deps_file'] = current['deps_file']...
[ "def", "check_gclient_config", "(", "conf", ")", ":", "if", "not", "conf", "[", "'gclient_url'", "]", ":", "return", "current", "=", "{", "'name'", ":", "'src'", ",", "'deps_file'", ":", "conf", "[", "'gclient_deps'", "]", "or", "'DEPS'", ",", "'managed'",...
Shows warning if gclient solution is not properly configured for git.
[ "Shows", "warning", "if", "gclient", "solution", "is", "not", "properly", "configured", "for", "git", "." ]
[ "\"\"\"Shows warning if gclient solution is not properly configured for git.\"\"\"", "# Ignore configs that do not have 'src' solution at all.", "# After depot_tools r291592 both DEPS and .DEPS.git are valid.", "# Show big warning if url or deps_file is wrong.", "# Show smaller (additional) warning about ma...
[ { "param": "conf", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "conf", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4907d85badb7c89d8823d03bbe9630232a0807e1
sunlongbo/chromium
tools/check_git_config.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
upload_report
<not_specific>
def upload_report( conf, report_url, verbose, push_works, push_log, push_duration_ms): """Posts report to the server, returns True if server accepted it. Uploads the report only if script is running in Google corp network. Otherwise just prints the report. """ report = conf.copy() report.update( ...
Posts report to the server, returns True if server accepted it. Uploads the report only if script is running in Google corp network. Otherwise just prints the report.
Posts report to the server, returns True if server accepted it. Uploads the report only if script is running in Google corp network. Otherwise just prints the report.
[ "Posts", "report", "to", "the", "server", "returns", "True", "if", "server", "accepted", "it", ".", "Uploads", "the", "report", "only", "if", "script", "is", "running", "in", "Google", "corp", "network", ".", "Otherwise", "just", "prints", "the", "report", ...
def upload_report( conf, report_url, verbose, push_works, push_log, push_duration_ms): report = conf.copy() report.update( push_works=push_works, push_log=push_log, push_duration_ms=push_duration_ms) as_bytes = json.dumps({'access_check': report}, indent=2, sort_keys=True) if verbose: ...
[ "def", "upload_report", "(", "conf", ",", "report_url", ",", "verbose", ",", "push_works", ",", "push_log", ",", "push_duration_ms", ")", ":", "report", "=", "conf", ".", "copy", "(", ")", "report", ".", "update", "(", "push_works", "=", "push_works", ",",...
Posts report to the server, returns True if server accepted it.
[ "Posts", "report", "to", "the", "server", "returns", "True", "if", "server", "accepted", "it", "." ]
[ "\"\"\"Posts report to the server, returns True if server accepted it.\n\n Uploads the report only if script is running in Google corp network. Otherwise\n just prints the report.\n \"\"\"", "# Do not upload it outside of corp or if server side is already disabled." ]
[ { "param": "conf", "type": null }, { "param": "report_url", "type": null }, { "param": "verbose", "type": null }, { "param": "push_works", "type": null }, { "param": "push_log", "type": null }, { "param": "push_duration_ms", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "conf", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "report_url", "type": null, "docstring": null, "docstring_toke...
72e4dfc5832bdf2f1a9f1708553f0f65bfeaf291
sunlongbo/chromium
components/policy/tools/template_writers/writers/chromeos_adml_writer.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetWriter
<not_specific>
def GetWriter(config): '''Factory method for creating ADMLWriter objects for the Chrome OS platform. See the constructor of TemplateWriter for description of arguments. ''' return ChromeOSADMLWriter(['chrome_os'], config)
Factory method for creating ADMLWriter objects for the Chrome OS platform. See the constructor of TemplateWriter for description of arguments.
Factory method for creating ADMLWriter objects for the Chrome OS platform. See the constructor of TemplateWriter for description of arguments.
[ "Factory", "method", "for", "creating", "ADMLWriter", "objects", "for", "the", "Chrome", "OS", "platform", ".", "See", "the", "constructor", "of", "TemplateWriter", "for", "description", "of", "arguments", "." ]
def GetWriter(config): return ChromeOSADMLWriter(['chrome_os'], config)
[ "def", "GetWriter", "(", "config", ")", ":", "return", "ChromeOSADMLWriter", "(", "[", "'chrome_os'", "]", ",", "config", ")" ]
Factory method for creating ADMLWriter objects for the Chrome OS platform.
[ "Factory", "method", "for", "creating", "ADMLWriter", "objects", "for", "the", "Chrome", "OS", "platform", "." ]
[ "'''Factory method for creating ADMLWriter objects for the Chrome OS platform.\n See the constructor of TemplateWriter for description of arguments.\n '''" ]
[ { "param": "config", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "config", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
72fed749231cd53af8379162f8de735715952dd4
sunlongbo/chromium
components/autofill_assistant/browser/devtools/devtools_api/client_api_generator.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
InitializeDomainDependencies
<not_specific>
def InitializeDomainDependencies(json_api): """For each domain create list of domains given domain depends on, including itself.""" direct_deps = collections.defaultdict(set) types_required = collections.defaultdict(set) def GetDomainDepsFromRefs(domain_name, json): if isinstance(json, list): for ...
For each domain create list of domains given domain depends on, including itself.
For each domain create list of domains given domain depends on, including itself.
[ "For", "each", "domain", "create", "list", "of", "domains", "given", "domain", "depends", "on", "including", "itself", "." ]
def InitializeDomainDependencies(json_api): direct_deps = collections.defaultdict(set) types_required = collections.defaultdict(set) def GetDomainDepsFromRefs(domain_name, json): if isinstance(json, list): for value in json: GetDomainDepsFromRefs(domain_name, value) return if not isins...
[ "def", "InitializeDomainDependencies", "(", "json_api", ")", ":", "direct_deps", "=", "collections", ".", "defaultdict", "(", "set", ")", "types_required", "=", "collections", ".", "defaultdict", "(", "set", ")", "def", "GetDomainDepsFromRefs", "(", "domain_name", ...
For each domain create list of domains given domain depends on, including itself.
[ "For", "each", "domain", "create", "list", "of", "domains", "given", "domain", "depends", "on", "including", "itself", "." ]
[ "\"\"\"For each domain create list of domains given domain depends on,\n including itself.\"\"\"" ]
[ { "param": "json_api", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "json_api", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
da049f54c8814c35f777782570950deaf4b3e3ee
sunlongbo/chromium
third_party/metrics_proto/PRESUBMIT.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
CheckChange
<not_specific>
def CheckChange(input_api, output_api): """Checks that all changes include a README update.""" paths = [af.AbsoluteLocalPath() for af in input_api.AffectedFiles()] if (any((IsMetricsProtoPath(input_api, p) for p in paths)) and not any( (IsReadmeFile(input_api, p) or IsPresubmitFile(input_api, p) for ...
Checks that all changes include a README update.
Checks that all changes include a README update.
[ "Checks", "that", "all", "changes", "include", "a", "README", "update", "." ]
def CheckChange(input_api, output_api): paths = [af.AbsoluteLocalPath() for af in input_api.AffectedFiles()] if (any((IsMetricsProtoPath(input_api, p) for p in paths)) and not any( (IsReadmeFile(input_api, p) or IsPresubmitFile(input_api, p) for p in paths))): return [output_api.PresubmitError( ...
[ "def", "CheckChange", "(", "input_api", ",", "output_api", ")", ":", "paths", "=", "[", "af", ".", "AbsoluteLocalPath", "(", ")", "for", "af", "in", "input_api", ".", "AffectedFiles", "(", ")", "]", "if", "(", "any", "(", "(", "IsMetricsProtoPath", "(", ...
Checks that all changes include a README update.
[ "Checks", "that", "all", "changes", "include", "a", "README", "update", "." ]
[ "\"\"\"Checks that all changes include a README update.\"\"\"" ]
[ { "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...
40a7f8513e81c933574fcdde2aadb72aadb4f550
sunlongbo/chromium
tools/json_schema_compiler/feature_compiler_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_parseFeature
<not_specific>
def _parseFeature(self, value): """Parses a feature from the given value and returns the result.""" f = feature_compiler.Feature('alpha') f.Parse(value, {}) return f
Parses a feature from the given value and returns the result.
Parses a feature from the given value and returns the result.
[ "Parses", "a", "feature", "from", "the", "given", "value", "and", "returns", "the", "result", "." ]
def _parseFeature(self, value): f = feature_compiler.Feature('alpha') f.Parse(value, {}) return f
[ "def", "_parseFeature", "(", "self", ",", "value", ")", ":", "f", "=", "feature_compiler", ".", "Feature", "(", "'alpha'", ")", "f", ".", "Parse", "(", "value", ",", "{", "}", ")", "return", "f" ]
Parses a feature from the given value and returns the result.
[ "Parses", "a", "feature", "from", "the", "given", "value", "and", "returns", "the", "result", "." ]
[ "\"\"\"Parses a feature from the given value and returns the result.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": null, "docstring_tokens": ...
40a7f8513e81c933574fcdde2aadb72aadb4f550
sunlongbo/chromium
tools/json_schema_compiler/feature_compiler_test.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_hasError
null
def _hasError(self, f, error): """Asserts that |error| is present somewhere in the given feature's errors.""" errors = f.GetErrors() self.assertTrue(errors) self.assertNotEqual(-1, str(errors).find(error), str(errors))
Asserts that |error| is present somewhere in the given feature's errors.
Asserts that |error| is present somewhere in the given feature's errors.
[ "Asserts", "that", "|error|", "is", "present", "somewhere", "in", "the", "given", "feature", "'", "s", "errors", "." ]
def _hasError(self, f, error): errors = f.GetErrors() self.assertTrue(errors) self.assertNotEqual(-1, str(errors).find(error), str(errors))
[ "def", "_hasError", "(", "self", ",", "f", ",", "error", ")", ":", "errors", "=", "f", ".", "GetErrors", "(", ")", "self", ".", "assertTrue", "(", "errors", ")", "self", ".", "assertNotEqual", "(", "-", "1", ",", "str", "(", "errors", ")", ".", "...
Asserts that |error| is present somewhere in the given feature's errors.
[ "Asserts", "that", "|error|", "is", "present", "somewhere", "in", "the", "given", "feature", "'", "s", "errors", "." ]
[ "\"\"\"Asserts that |error| is present somewhere in the given feature's\n errors.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "f", "type": null }, { "param": "error", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "f", "type": null, "docstring": null, "docstring_tokens": [], ...
9772b163b6023367a6c6f7d6752a329ca60234cf
sunlongbo/chromium
chrome/updater/test/service/win/uac.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
_QueryPolicyValue
<not_specific>
def _QueryPolicyValue(value_name, expected_type=winreg.REG_DWORD): """Queries the system policy value from registry. Args: value_name: Registry value name for the policy. expected_type: Expected registry value data type. Returns: The policy value in its desired data type, or None if no such policy o...
Queries the system policy value from registry. Args: value_name: Registry value name for the policy. expected_type: Expected registry value data type. Returns: The policy value in its desired data type, or None if no such policy or data type is not expected.
Queries the system policy value from registry.
[ "Queries", "the", "system", "policy", "value", "from", "registry", "." ]
def _QueryPolicyValue(value_name, expected_type=winreg.REG_DWORD): system_policy_path = (r'Software\Microsoft\Windows' r'\CurrentVersion\Policies\System') try: hklm = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) policy_key = winreg.OpenKeyEx(hklm, system_policy_path) v...
[ "def", "_QueryPolicyValue", "(", "value_name", ",", "expected_type", "=", "winreg", ".", "REG_DWORD", ")", ":", "system_policy_path", "=", "(", "r'Software\\Microsoft\\Windows'", "r'\\CurrentVersion\\Policies\\System'", ")", "try", ":", "hklm", "=", "winreg", ".", "Co...
Queries the system policy value from registry.
[ "Queries", "the", "system", "policy", "value", "from", "registry", "." ]
[ "\"\"\"Queries the system policy value from registry.\n\n Args:\n value_name: Registry value name for the policy.\n expected_type: Expected registry value data type.\n\n Returns:\n The policy value in its desired data type, or None if no such policy or\n data type is not expected.\n \"\"\"" ]
[ { "param": "value_name", "type": null }, { "param": "expected_type", "type": null } ]
{ "returns": [ { "docstring": "The policy value in its desired data type, or None if no such policy or\ndata type is not expected.", "docstring_tokens": [ "The", "policy", "value", "in", "its", "desired", "data", "type", "or", ...
9772b163b6023367a6c6f7d6752a329ca60234cf
sunlongbo/chromium
chrome/updater/test/service/win/uac.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
IsSupported
<not_specific>
def IsSupported(): """Checks whether current system supports UAC. Returns: True if system supports UAC (after XP), otherwise False. """ return sys.getwindowsversion()[0] > 5
Checks whether current system supports UAC. Returns: True if system supports UAC (after XP), otherwise False.
Checks whether current system supports UAC.
[ "Checks", "whether", "current", "system", "supports", "UAC", "." ]
def IsSupported(): return sys.getwindowsversion()[0] > 5
[ "def", "IsSupported", "(", ")", ":", "return", "sys", ".", "getwindowsversion", "(", ")", "[", "0", "]", ">", "5" ]
Checks whether current system supports UAC.
[ "Checks", "whether", "current", "system", "supports", "UAC", "." ]
[ "\"\"\"Checks whether current system supports UAC.\n\n Returns:\n True if system supports UAC (after XP), otherwise False.\n \"\"\"" ]
[]
{ "returns": [ { "docstring": "True if system supports UAC (after XP), otherwise False.", "docstring_tokens": [ "True", "if", "system", "supports", "UAC", "(", "after", "XP", ")", "otherwise", "False", "." ...
9772b163b6023367a6c6f7d6752a329ca60234cf
sunlongbo/chromium
chrome/updater/test/service/win/uac.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
IsLuaEnabled
<not_specific>
def IsLuaEnabled(): """Checks whether LUA is enabled on the machine. Returns: True if LUA is enable, False otherwise. """ enable_lua = _QueryPolicyValue(_REG_VALUE_ENABLE_LUA) return enable_lua is None or bool(enable_lua)
Checks whether LUA is enabled on the machine. Returns: True if LUA is enable, False otherwise.
Checks whether LUA is enabled on the machine.
[ "Checks", "whether", "LUA", "is", "enabled", "on", "the", "machine", "." ]
def IsLuaEnabled(): enable_lua = _QueryPolicyValue(_REG_VALUE_ENABLE_LUA) return enable_lua is None or bool(enable_lua)
[ "def", "IsLuaEnabled", "(", ")", ":", "enable_lua", "=", "_QueryPolicyValue", "(", "_REG_VALUE_ENABLE_LUA", ")", "return", "enable_lua", "is", "None", "or", "bool", "(", "enable_lua", ")" ]
Checks whether LUA is enabled on the machine.
[ "Checks", "whether", "LUA", "is", "enabled", "on", "the", "machine", "." ]
[ "\"\"\"Checks whether LUA is enabled on the machine.\n\n Returns:\n True if LUA is enable, False otherwise.\n \"\"\"" ]
[]
{ "returns": [ { "docstring": "True if LUA is enable, False otherwise.", "docstring_tokens": [ "True", "if", "LUA", "is", "enable", "False", "otherwise", "." ], "type": null } ], "raises": [], "params": [], "outlie...
9772b163b6023367a6c6f7d6752a329ca60234cf
sunlongbo/chromium
chrome/updater/test/service/win/uac.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
IsElevationSilent
<not_specific>
def IsElevationSilent(): """Checks whether user can elevate silently (without UAC prompt). Returns: True if silent elevation is possible, False otherwise. """ prompt_behavior = _QueryPolicyValue(_REG_VALUE_PROMPT_CONSENT) if prompt_behavior == 0: logging.info('Silent UAC elevation is enabled.') ...
Checks whether user can elevate silently (without UAC prompt). Returns: True if silent elevation is possible, False otherwise.
Checks whether user can elevate silently (without UAC prompt).
[ "Checks", "whether", "user", "can", "elevate", "silently", "(", "without", "UAC", "prompt", ")", "." ]
def IsElevationSilent(): prompt_behavior = _QueryPolicyValue(_REG_VALUE_PROMPT_CONSENT) if prompt_behavior == 0: logging.info('Silent UAC elevation is enabled.') return True else: logging.info('UAC prompt must be explicitly clicked.') return False
[ "def", "IsElevationSilent", "(", ")", ":", "prompt_behavior", "=", "_QueryPolicyValue", "(", "_REG_VALUE_PROMPT_CONSENT", ")", "if", "prompt_behavior", "==", "0", ":", "logging", ".", "info", "(", "'Silent UAC elevation is enabled.'", ")", "return", "True", "else", ...
Checks whether user can elevate silently (without UAC prompt).
[ "Checks", "whether", "user", "can", "elevate", "silently", "(", "without", "UAC", "prompt", ")", "." ]
[ "\"\"\"Checks whether user can elevate silently (without UAC prompt).\n\n Returns:\n True if silent elevation is possible, False otherwise.\n \"\"\"" ]
[]
{ "returns": [ { "docstring": "True if silent elevation is possible, False otherwise.", "docstring_tokens": [ "True", "if", "silent", "elevation", "is", "possible", "False", "otherwise", "." ], "type": null } ], ...
9772b163b6023367a6c6f7d6752a329ca60234cf
sunlongbo/chromium
chrome/updater/test/service/win/uac.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
IsEnabled
<not_specific>
def IsEnabled(): """Checks whether UAC is supported and enabled on current system.""" uac_enabled = IsSupported() and IsLuaEnabled() and not IsElevationSilent() logging.info('UAC is %s.', 'enabled' if uac_enabled else 'NOT enabled') return uac_enabled
Checks whether UAC is supported and enabled on current system.
Checks whether UAC is supported and enabled on current system.
[ "Checks", "whether", "UAC", "is", "supported", "and", "enabled", "on", "current", "system", "." ]
def IsEnabled(): uac_enabled = IsSupported() and IsLuaEnabled() and not IsElevationSilent() logging.info('UAC is %s.', 'enabled' if uac_enabled else 'NOT enabled') return uac_enabled
[ "def", "IsEnabled", "(", ")", ":", "uac_enabled", "=", "IsSupported", "(", ")", "and", "IsLuaEnabled", "(", ")", "and", "not", "IsElevationSilent", "(", ")", "logging", ".", "info", "(", "'UAC is %s.'", ",", "'enabled'", "if", "uac_enabled", "else", "'NOT en...
Checks whether UAC is supported and enabled on current system.
[ "Checks", "whether", "UAC", "is", "supported", "and", "enabled", "on", "current", "system", "." ]
[ "\"\"\"Checks whether UAC is supported and enabled on current system.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
9772b163b6023367a6c6f7d6752a329ca60234cf
sunlongbo/chromium
chrome/updater/test/service/win/uac.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
AnswerUpcomingUACPrompt
<not_specific>
def AnswerUpcomingUACPrompt(allow=True, timeout=30): """Answer upcoming UAC prompt that does not require username/password. Args: allow: Answer allow or not to the prompt. timeout: Wait timeout value in seconds. Returns: True if UAC prompt clicked as requested. """ logging.info('Waiting at most ...
Answer upcoming UAC prompt that does not require username/password. Args: allow: Answer allow or not to the prompt. timeout: Wait timeout value in seconds. Returns: True if UAC prompt clicked as requested.
Answer upcoming UAC prompt that does not require username/password.
[ "Answer", "upcoming", "UAC", "prompt", "that", "does", "not", "require", "username", "/", "password", "." ]
def AnswerUpcomingUACPrompt(allow=True, timeout=30): logging.info('Waiting at most %s seconds for UAC prompt...', timeout) uac_hwnd = ui.WaitForWindow(_UAC_DIALOG_TITLE, None, timeout)[0] if not uac_hwnd: logging.warning('UAC prompt not found in %f seconds.', timeout) return False else: logging.info...
[ "def", "AnswerUpcomingUACPrompt", "(", "allow", "=", "True", ",", "timeout", "=", "30", ")", ":", "logging", ".", "info", "(", "'Waiting at most %s seconds for UAC prompt...'", ",", "timeout", ")", "uac_hwnd", "=", "ui", ".", "WaitForWindow", "(", "_UAC_DIALOG_TIT...
Answer upcoming UAC prompt that does not require username/password.
[ "Answer", "upcoming", "UAC", "prompt", "that", "does", "not", "require", "username", "/", "password", "." ]
[ "\"\"\"Answer upcoming UAC prompt that does not require username/password.\n\n Args:\n allow: Answer allow or not to the prompt.\n timeout: Wait timeout value in seconds.\n\n Returns:\n True if UAC prompt clicked as requested.\n \"\"\"", "# We assume the UAC prompt does not require credentials.", "#...
[ { "param": "allow", "type": null }, { "param": "timeout", "type": null } ]
{ "returns": [ { "docstring": "True if UAC prompt clicked as requested.", "docstring_tokens": [ "True", "if", "UAC", "prompt", "clicked", "as", "requested", "." ], "type": null } ], "raises": [], "params": [ { ...
3e3796d8d3c48a4f1976464fab474b905d8feebf
sunlongbo/chromium
tools/cr/cr/plugin.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Init
null
def Init(self): """Post plugin registration initialisation method.""" for config_root in CONFIG_TYPES: config = getattr(self, config_root.property_name) config.name = self.name if config_root.only_active and not self.is_active: config.enabled = False if config_root.only_enabled a...
Post plugin registration initialisation method.
Post plugin registration initialisation method.
[ "Post", "plugin", "registration", "initialisation", "method", "." ]
def Init(self): for config_root in CONFIG_TYPES: config = getattr(self, config_root.property_name) config.name = self.name if config_root.only_active and not self.is_active: config.enabled = False if config_root.only_enabled and not self.enabled: config.enabled = False ...
[ "def", "Init", "(", "self", ")", ":", "for", "config_root", "in", "CONFIG_TYPES", ":", "config", "=", "getattr", "(", "self", ",", "config_root", ".", "property_name", ")", "config", ".", "name", "=", "self", ".", "name", "if", "config_root", ".", "only_...
Post plugin registration initialisation method.
[ "Post", "plugin", "registration", "initialisation", "method", "." ]
[ "\"\"\"Post plugin registration initialisation method.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3e3796d8d3c48a4f1976464fab474b905d8feebf
sunlongbo/chromium
tools/cr/cr/plugin.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetInstance
<not_specific>
def GetInstance(cls): """Gets an instance of this plugin. This looks in the plugin registry, and if an instance is not found a new one is built and registered. Returns: The registered plugin instance. """ plugin = _plugins.get(cls, None) if plugin is None: # Run delayed class...
Gets an instance of this plugin. This looks in the plugin registry, and if an instance is not found a new one is built and registered. Returns: The registered plugin instance.
Gets an instance of this plugin. This looks in the plugin registry, and if an instance is not found a new one is built and registered.
[ "Gets", "an", "instance", "of", "this", "plugin", ".", "This", "looks", "in", "the", "plugin", "registry", "and", "if", "an", "instance", "is", "not", "found", "a", "new", "one", "is", "built", "and", "registered", "." ]
def GetInstance(cls): plugin = _plugins.get(cls, None) if plugin is None: cls.ClassInit() plugin = cls() _plugins[cls] = plugin for name, value in cls.__dict__.items(): if isinstance(value, cr.Config): for base in cls.__bases__: child = getattr(base, name, N...
[ "def", "GetInstance", "(", "cls", ")", ":", "plugin", "=", "_plugins", ".", "get", "(", "cls", ",", "None", ")", "if", "plugin", "is", "None", ":", "cls", ".", "ClassInit", "(", ")", "plugin", "=", "cls", "(", ")", "_plugins", "[", "cls", "]", "=...
Gets an instance of this plugin.
[ "Gets", "an", "instance", "of", "this", "plugin", "." ]
[ "\"\"\"Gets an instance of this plugin.\n\n This looks in the plugin registry, and if an instance is not found a new\n one is built and registered.\n\n Returns:\n The registered plugin instance.\n \"\"\"", "# Run delayed class initialization", "# Build a new instance of cls, and register it a...
[ { "param": "cls", "type": null } ]
{ "returns": [ { "docstring": "The registered plugin instance.", "docstring_tokens": [ "The", "registered", "plugin", "instance", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "cls", "type": null, ...
3e3796d8d3c48a4f1976464fab474b905d8feebf
sunlongbo/chromium
tools/cr/cr/plugin.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
UnorderedPlugins
null
def UnorderedPlugins(cls): """Returns all enabled plugins of type cls, in undefined order.""" plugin = cls.GetInstance() if plugin.enabled: yield plugin for child in cls.__subclasses__(): for p in child.UnorderedPlugins(): yield p
Returns all enabled plugins of type cls, in undefined order.
Returns all enabled plugins of type cls, in undefined order.
[ "Returns", "all", "enabled", "plugins", "of", "type", "cls", "in", "undefined", "order", "." ]
def UnorderedPlugins(cls): plugin = cls.GetInstance() if plugin.enabled: yield plugin for child in cls.__subclasses__(): for p in child.UnorderedPlugins(): yield p
[ "def", "UnorderedPlugins", "(", "cls", ")", ":", "plugin", "=", "cls", ".", "GetInstance", "(", ")", "if", "plugin", ".", "enabled", ":", "yield", "plugin", "for", "child", "in", "cls", ".", "__subclasses__", "(", ")", ":", "for", "p", "in", "child", ...
Returns all enabled plugins of type cls, in undefined order.
[ "Returns", "all", "enabled", "plugins", "of", "type", "cls", "in", "undefined", "order", "." ]
[ "\"\"\"Returns all enabled plugins of type cls, in undefined order.\"\"\"" ]
[ { "param": "cls", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3e3796d8d3c48a4f1976464fab474b905d8feebf
sunlongbo/chromium
tools/cr/cr/plugin.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
GetActivePlugin
<not_specific>
def GetActivePlugin(cls): """Gets the active plugin of type cls. This method will select a plugin to be the active one, and will activate the plugin if needed. Returns: the plugin that is currently active. """ plugin, _ = _GetActivePlugin(cls) return plugin
Gets the active plugin of type cls. This method will select a plugin to be the active one, and will activate the plugin if needed. Returns: the plugin that is currently active.
Gets the active plugin of type cls. This method will select a plugin to be the active one, and will activate the plugin if needed.
[ "Gets", "the", "active", "plugin", "of", "type", "cls", ".", "This", "method", "will", "select", "a", "plugin", "to", "be", "the", "active", "one", "and", "will", "activate", "the", "plugin", "if", "needed", "." ]
def GetActivePlugin(cls): plugin, _ = _GetActivePlugin(cls) return plugin
[ "def", "GetActivePlugin", "(", "cls", ")", ":", "plugin", ",", "_", "=", "_GetActivePlugin", "(", "cls", ")", "return", "plugin" ]
Gets the active plugin of type cls.
[ "Gets", "the", "active", "plugin", "of", "type", "cls", "." ]
[ "\"\"\"Gets the active plugin of type cls.\n\n This method will select a plugin to be the active one, and will activate\n the plugin if needed.\n Returns:\n the plugin that is currently active.\n \"\"\"" ]
[ { "param": "cls", "type": null } ]
{ "returns": [ { "docstring": "the plugin that is currently active.", "docstring_tokens": [ "the", "plugin", "that", "is", "currently", "active", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "...
3e3796d8d3c48a4f1976464fab474b905d8feebf
sunlongbo/chromium
tools/cr/cr/plugin.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
default
<not_specific>
def default(cls): """Returns the plugin that should be used if the user did not choose one.""" result = None for plugin in cls.UnorderedPlugins(): if not result or plugin.priority > result.priority: result = plugin return result
Returns the plugin that should be used if the user did not choose one.
Returns the plugin that should be used if the user did not choose one.
[ "Returns", "the", "plugin", "that", "should", "be", "used", "if", "the", "user", "did", "not", "choose", "one", "." ]
def default(cls): result = None for plugin in cls.UnorderedPlugins(): if not result or plugin.priority > result.priority: result = plugin return result
[ "def", "default", "(", "cls", ")", ":", "result", "=", "None", "for", "plugin", "in", "cls", ".", "UnorderedPlugins", "(", ")", ":", "if", "not", "result", "or", "plugin", ".", "priority", ">", "result", ".", "priority", ":", "result", "=", "plugin", ...
Returns the plugin that should be used if the user did not choose one.
[ "Returns", "the", "plugin", "that", "should", "be", "used", "if", "the", "user", "did", "not", "choose", "one", "." ]
[ "\"\"\"Returns the plugin that should be used if the user did not choose one.\"\"\"" ]
[ { "param": "cls", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3e3796d8d3c48a4f1976464fab474b905d8feebf
sunlongbo/chromium
tools/cr/cr/plugin.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Select
<not_specific>
def Select(cls): """Called to determine which plugin should be the active one.""" plugin = cls.default selector = getattr(cls, 'SELECTOR', None) if selector: if plugin is not None: _selectors[selector] = plugin.name name = cr.context.Find(selector) if name is not None: ...
Called to determine which plugin should be the active one.
Called to determine which plugin should be the active one.
[ "Called", "to", "determine", "which", "plugin", "should", "be", "the", "active", "one", "." ]
def Select(cls): plugin = cls.default selector = getattr(cls, 'SELECTOR', None) if selector: if plugin is not None: _selectors[selector] = plugin.name name = cr.context.Find(selector) if name is not None: plugin = cls.FindPlugin(name) return plugin
[ "def", "Select", "(", "cls", ")", ":", "plugin", "=", "cls", ".", "default", "selector", "=", "getattr", "(", "cls", ",", "'SELECTOR'", ",", "None", ")", "if", "selector", ":", "if", "plugin", "is", "not", "None", ":", "_selectors", "[", "selector", ...
Called to determine which plugin should be the active one.
[ "Called", "to", "determine", "which", "plugin", "should", "be", "the", "active", "one", "." ]
[ "\"\"\"Called to determine which plugin should be the active one.\"\"\"" ]
[ { "param": "cls", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3e3796d8d3c48a4f1976464fab474b905d8feebf
sunlongbo/chromium
tools/cr/cr/plugin.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
ChainModuleConfigs
null
def ChainModuleConfigs(module): """Detects and connects the default Config objects from a module.""" for config_root in CONFIG_TYPES: if hasattr(module, config_root.name): config = getattr(module, config_root.name) config.name = module.__name__ config_root.AddChild(config)
Detects and connects the default Config objects from a module.
Detects and connects the default Config objects from a module.
[ "Detects", "and", "connects", "the", "default", "Config", "objects", "from", "a", "module", "." ]
def ChainModuleConfigs(module): for config_root in CONFIG_TYPES: if hasattr(module, config_root.name): config = getattr(module, config_root.name) config.name = module.__name__ config_root.AddChild(config)
[ "def", "ChainModuleConfigs", "(", "module", ")", ":", "for", "config_root", "in", "CONFIG_TYPES", ":", "if", "hasattr", "(", "module", ",", "config_root", ".", "name", ")", ":", "config", "=", "getattr", "(", "module", ",", "config_root", ".", "name", ")",...
Detects and connects the default Config objects from a module.
[ "Detects", "and", "connects", "the", "default", "Config", "objects", "from", "a", "module", "." ]
[ "\"\"\"Detects and connects the default Config objects from a module.\"\"\"" ]
[ { "param": "module", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "module", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3e3796d8d3c48a4f1976464fab474b905d8feebf
sunlongbo/chromium
tools/cr/cr/plugin.py
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Python
Activate
null
def Activate(): """Activates a plugin for all known plugin types.""" types = Plugin.Type.__subclasses__() modified = True while modified: modified = False for child in types: _, activated = _GetActivePlugin(child) if activated: modified = True
Activates a plugin for all known plugin types.
Activates a plugin for all known plugin types.
[ "Activates", "a", "plugin", "for", "all", "known", "plugin", "types", "." ]
def Activate(): types = Plugin.Type.__subclasses__() modified = True while modified: modified = False for child in types: _, activated = _GetActivePlugin(child) if activated: modified = True
[ "def", "Activate", "(", ")", ":", "types", "=", "Plugin", ".", "Type", ".", "__subclasses__", "(", ")", "modified", "=", "True", "while", "modified", ":", "modified", "=", "False", "for", "child", "in", "types", ":", "_", ",", "activated", "=", "_GetAc...
Activates a plugin for all known plugin types.
[ "Activates", "a", "plugin", "for", "all", "known", "plugin", "types", "." ]
[ "\"\"\"Activates a plugin for all known plugin types.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }